diff options
author | stuconnolly <stuart02@gmail.com> | 2012-06-27 09:42:27 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-06-27 09:42:27 +0000 |
commit | 018271d3804ead3488e089898695f7f1d2cda812 (patch) | |
tree | fff8d7e86a5d5c7fab66ed15b4183adffbad2eee | |
parent | e0be0f0668619e4fb70e23d8e25b2680f12b6a12 (diff) | |
download | sequelpro-018271d3804ead3488e089898695f7f1d2cda812.tar.gz sequelpro-018271d3804ead3488e089898695f7f1d2cda812.tar.bz2 sequelpro-018271d3804ead3488e089898695f7f1d2cda812.zip |
Tidy up an use enums.
-rw-r--r-- | Source/SPConstants.h | 6 | ||||
-rw-r--r-- | Source/SPEditorPreferencePane.m | 2 | ||||
-rw-r--r-- | Source/SPGrowlController.h | 1 | ||||
-rw-r--r-- | Source/SPGrowlController.m | 18 | ||||
-rw-r--r-- | Source/SPPreferenceController.h | 7 | ||||
-rw-r--r-- | Source/SPPreferenceController.m | 4 | ||||
-rw-r--r-- | Source/SPTablesPreferencePane.m | 2 |
7 files changed, 27 insertions, 13 deletions
diff --git a/Source/SPConstants.h b/Source/SPConstants.h index 6f25e357..bba7eb89 100644 --- a/Source/SPConstants.h +++ b/Source/SPConstants.h @@ -214,6 +214,12 @@ typedef enum SPExportFileHandleExists = 2 } SPExportFileHandleStatus; +typedef enum +{ + SPPrefFontChangeTargetTable = 1, + SPPrefFontChangeTargetEditor = 2 +} SPPreferenceFontChangeTarget; + // Predefined localisable URLs #define SPLOCALIZEDURL_HOMEPAGE NSLocalizedString(@"http://www.sequelpro.com/", @"Localized home page - do not localize if no translated webpage is available") #define SPLOCALIZEDURL_FAQ NSLocalizedString(@"http://www.sequelpro.com/docs/Frequently_Asked_Questions", @"Localized help page for Frequently Asked Questions - do not localize if no translated webpage is available") diff --git a/Source/SPEditorPreferencePane.m b/Source/SPEditorPreferencePane.m index b84e41ba..54949618 100644 --- a/Source/SPEditorPreferencePane.m +++ b/Source/SPEditorPreferencePane.m @@ -265,7 +265,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined"; */ - (IBAction)showCustomQueryFontPanel:(id)sender { - [(SPPreferenceController *)[[[self view] window] delegate] setFontChangeTarget:2]; + [(SPPreferenceController *)[[[self view] window] delegate] setFontChangeTarget:SPPrefFontChangeTargetEditor]; [[NSFontPanel sharedFontPanel] setPanelFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]] isMultiple:NO]; [[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self]; diff --git a/Source/SPGrowlController.h b/Source/SPGrowlController.h index 2075b143..8ad6bf70 100644 --- a/Source/SPGrowlController.h +++ b/Source/SPGrowlController.h @@ -63,6 +63,5 @@ // Timing functions - (void)setVisibilityForNotificationName:(NSString *)name; -- (double)milliTime; @end diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m index 7c352b9f..481bfdd1 100644 --- a/Source/SPGrowlController.m +++ b/Source/SPGrowlController.m @@ -33,6 +33,12 @@ static SPGrowlController *sharedGrowlController = nil; @class SPWindowController; +@interface SPGrowlController () + +- (double)milliTime; + +@end + @implementation SPGrowlController /** @@ -72,6 +78,8 @@ static SPGrowlController *sharedGrowlController = nil; return self; } +#pragma mark - + /** * Posts a Growl notification using the supplied details and default values. * Calls the notification after a tiny delay to allow isKeyWindow to have updated @@ -121,8 +129,8 @@ static SPGrowlController *sharedGrowlController = nil; // Don't post the notification if the notification document is frontmost // as that suggests the user is already viewing the notification result. - if ([[document parentWindow] isKeyWindow] - && [[[document parentTabViewItem] tabView] selectedTabViewItem] == [document parentTabViewItem]) + if ([[document parentWindow] isKeyWindow] && + [[[document parentTabViewItem] tabView] selectedTabViewItem] == [document parentTabViewItem]) { postNotification = NO; } @@ -159,9 +167,11 @@ static SPGrowlController *sharedGrowlController = nil; NSUInteger documentHash = [[clickContext objectForKey:@"notificationDocumentHash"] unsignedIntegerValue]; // Loop through the windows, looking for the document - for (NSWindow *eachWindow in [NSApp orderedWindows]) { + for (NSWindow *eachWindow in [NSApp orderedWindows]) + { if ([[eachWindow windowController] isKindOfClass:[SPWindowController class]]) { - for (SPDatabaseDocument *eachDocument in [[eachWindow windowController] documents]) { + for (SPDatabaseDocument *eachDocument in [[eachWindow windowController] documents]) + { if ([eachDocument hash] == documentHash) { [NSApp activateIgnoringOtherApps:YES]; [eachDocument makeKeyDocument]; diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h index f05b63e3..1e306fa1 100644 --- a/Source/SPPreferenceController.h +++ b/Source/SPPreferenceController.h @@ -62,7 +62,7 @@ NSToolbarItem *editorItem; NSToolbarItem *shortcutItem; - NSUInteger fontChangeTarget; + SPPreferenceFontChangeTarget fontChangeTarget; } @property (readonly) SPGeneralPreferencePane *generalPreferencePane; @@ -73,10 +73,9 @@ @property (readonly) SPNetworkPreferencePane *networkPreferencePane; /** - * @property fontChangeTarget Indicates which font was changed (1 for global table font, 2 for custom - * query font). + * @property fontChangeTarget Indicates which font was changed. See SPPreferenceFontChangeTarget for values. */ -@property (readwrite, assign) NSUInteger fontChangeTarget; +@property (readwrite, assign) SPPreferenceFontChangeTarget fontChangeTarget; // Toolbar item IBAction methods - (IBAction)displayPreferencePane:(id)sender; diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 78cb0b9b..f13a3f9b 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -159,14 +159,14 @@ switch (fontChangeTarget) { - case 1: + case SPPrefFontChangeTargetTable: font = [[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPGlobalResultTableFont]]]; [prefs setObject:[NSArchiver archivedDataWithRootObject:font] forKey:SPGlobalResultTableFont]; [(SPTablesPreferencePane *)tablesPreferencePane updateDisplayedTableFontName]; break; - case 2: + case SPPrefFontChangeTargetEditor: font = [[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]]; [prefs setObject:[NSArchiver archivedDataWithRootObject:font] forKey:SPCustomQueryEditorFont]; diff --git a/Source/SPTablesPreferencePane.m b/Source/SPTablesPreferencePane.m index 6e009cd8..0736c4bd 100644 --- a/Source/SPTablesPreferencePane.m +++ b/Source/SPTablesPreferencePane.m @@ -36,7 +36,7 @@ */ - (IBAction)showGlobalResultTableFontPanel:(id)sender { - [(SPPreferenceController *)[[[self view] window] delegate] setFontChangeTarget:1]; + [(SPPreferenceController *)[[[self view] window] delegate] setFontChangeTarget:SPPrefFontChangeTargetEditor]; [[NSFontPanel sharedFontPanel] setPanelFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPGlobalResultTableFont]] isMultiple:NO]; [[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self]; |