aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPConstants.m1
-rw-r--r--Source/SPProcessListController.m28
3 files changed, 30 insertions, 0 deletions
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 00fc0607..a5efccee 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -309,6 +309,7 @@ extern NSString *SPConsoleShowHelps;
extern NSString *SPEditInSheetEnabled;
extern NSString *SPTableInformationPanelCollapsed;
extern NSString *SPTableColumnWidths;
+extern NSString *SPProcessListTableColumnWidths;
extern NSString *SPProcessListShowProcessID;
extern NSString *SPProcessListEnableAutoRefresh;
extern NSString *SPProcessListAutoRrefreshInterval;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index e3de4b06..e7cbb414 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -135,6 +135,7 @@ NSString *SPConsoleShowConnections = @"ConsoleShowConnections";
NSString *SPEditInSheetEnabled = @"EditInSheetEnabled";
NSString *SPTableInformationPanelCollapsed = @"TableInformationPanelCollapsed";
NSString *SPTableColumnWidths = @"tableColumnWidths";
+NSString *SPProcessListTableColumnWidths = @"ProcessListTableColumnWidths";
NSString *SPProcessListShowProcessID = @"ProcessListShowProcessID";
NSString *SPProcessListEnableAutoRefresh = @"ProcessListEnableAutoRefresh";
NSString *SPProcessListAutoRrefreshInterval = @"ProcessListAutoRrefreshInterval";
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m
index 886e6f2b..961e983c 100644
--- a/Source/SPProcessListController.m
+++ b/Source/SPProcessListController.m
@@ -92,6 +92,11 @@
for (NSTableColumn *column in [processListTableView tableColumns])
{
[[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+
+ // Also, if available restore the table's column widths
+ NSNumber *columnWidth = [[prefs objectForKey:SPProcessListTableColumnWidths] objectForKey:[[column headerCell] stringValue]];
+
+ if (columnWidth) [column setWidth:[columnWidth doubleValue]];
}
// Register as an observer for the when the UseMonospacedFonts preference changes
@@ -479,6 +484,29 @@
[tableView reloadData];
}
+/**
+ * Table view delegate method. Called whenever the user changes a column width.
+ */
+- (void)tableViewColumnDidResize:(NSNotification *)notification
+{
+ NSTableColumn *column = [[notification userInfo] objectForKey:@"NSTableColumn"];
+
+ // Get the existing table column widths dictionary if it exists
+ NSMutableDictionary *tableColumnWidths = ([prefs objectForKey:SPProcessListTableColumnWidths]) ?
+ [NSMutableDictionary dictionaryWithDictionary:[prefs objectForKey:SPProcessListTableColumnWidths]] :
+ [NSMutableDictionary dictionary];
+
+ // Save column size
+ NSString *columnName = [[column headerCell] stringValue];
+
+ if (columnName) {
+ [tableColumnWidths setObject:[NSNumber numberWithDouble:[column width]] forKey:columnName];
+
+ [prefs setObject:tableColumnWidths forKey:SPProcessListTableColumnWidths];
+ }
+}
+
+
#pragma mark -
#pragma mark Text field delegate methods