From b933583e58217b99e38ca8b7ce57bf83980ed5e3 Mon Sep 17 00:00:00 2001 From: Steve Mills Date: Thu, 12 Dec 2019 17:10:47 -0600 Subject: [PATCH] Adding column hidden save/restore. --- NSTableView+RSAutosaving.h | 1 + NSTableView+RSAutosaving.m | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/NSTableView+RSAutosaving.h b/NSTableView+RSAutosaving.h index 330cdb3..3b5cb86 100644 --- a/NSTableView+RSAutosaving.h +++ b/NSTableView+RSAutosaving.h @@ -12,6 +12,7 @@ extern NSString * const RSAutosavingColumnWidthKey; extern NSString * const RSAutosavingColumnIndexKey; +extern NSString* const RSAutosavingColumnHiddenKey; @interface NSTableView (RSAutosaving) - (NSDictionary *)dictionaryForAutosavingLayout; diff --git a/NSTableView+RSAutosaving.m b/NSTableView+RSAutosaving.m index 5795297..0ce9854 100644 --- a/NSTableView+RSAutosaving.m +++ b/NSTableView+RSAutosaving.m @@ -17,6 +17,8 @@ NSString * const RSAutosavingColumnWidthKey = @"AutosavedColumnWidth"; NSString * const RSAutosavingColumnIndexKey = @"AutosavedColumnIndex"; +NSString* const RSAutosavingColumnHiddenKey = @"AutosavedColumnHidden"; + @interface NSDictionary (RSTableViewAutosaving) - (NSComparisonResult)compareByAutosavedIndex:(NSDictionary *)otherDict; @@ -46,6 +48,7 @@ - (NSDictionary *)dictionaryForAutosavingLayout NSInteger thisColIndex = [self columnWithIdentifier:thisColID]; NSNumber *thisIndex = @(thisColIndex); thisColDict[RSAutosavingColumnIndexKey] = thisIndex; + thisColDict[RSAutosavingColumnHiddenKey] = @(thisCol.isHidden); // Add it all to the big dict autoDict[thisColID] = thisColDict; @@ -93,6 +96,9 @@ - (void)adjustLayoutForAutosavedDictionary:(NSDictionary *)theDict thisCol.width = (CGFloat)columnWidthNum.doubleValue; #endif thisCol.resizingMask = saveMask; + + if(thisColDict[RSAutosavingColumnHiddenKey]) + thisCol.hidden = [thisColDict[RSAutosavingColumnHiddenKey] boolValue]; } } }