From 205e60918c2cdc7be6c70ac71db9b85bf6301828 Mon Sep 17 00:00:00 2001 From: avenjamin Date: Thu, 21 May 2009 07:00:04 +0000 Subject: - Fixed NSFontPanel issue. Now showing font collections in Font Panel - Replaced some toolbar icons with new ones - Edited some toolbar icons. - Added keyboard shortcut section to preferences (Disabled for now) --- Source/CustomQuery.m | 7 +++++++ Source/SPPreferenceController.h | 1 + Source/SPPreferenceController.m | 39 +++++++++++++++++++++++++-------------- 3 files changed, 33 insertions(+), 14 deletions(-) (limited to 'Source') diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 3aa90ce0..da538fe2 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -220,6 +220,7 @@ closes the sheet // "Editor font..." menu item to bring up the font panel if (sender == editorFontMenuItem) { [[NSFontPanel sharedFontPanel] setPanelFont:[textView font] isMultiple:NO]; + [[NSFontPanel sharedFontPanel] setDelegate:self]; [[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self]; } @@ -1393,6 +1394,12 @@ traps enter key and [prefs setObject:[NSArchiver archivedDataWithRootObject:[textView font]] forKey:@"CustomQueryEditorFont"]; } +// set font panel's valid modes +- (unsigned int)validModesForFontPanel:(NSFontPanel *)fontPanel +{ + return (NSFontPanelAllModesMask ^ NSFontPanelAllEffectsModeMask); +} + #pragma mark - #pragma mark MySQL Help diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h index 778be090..1147351e 100644 --- a/Source/SPPreferenceController.h +++ b/Source/SPPreferenceController.h @@ -64,6 +64,7 @@ NSToolbarItem *autoUpdateItem; NSToolbarItem *networkItem; NSToolbarItem *editorItem; + NSToolbarItem *shortcutItem; NSUserDefaults *prefs; } diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 597024a3..1f10eede 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -38,6 +38,7 @@ #define PREFERENCE_TOOLBAR_AUTOUPDATE @"Preference Toolbar Auto Update" #define PREFERENCE_TOOLBAR_NETWORK @"Preference Toolbar Network" #define PREFERENCE_TOOLBAR_EDITOR @"Preference Toolbar Editor" +#define PREFERENCE_TOOLBAR_SHORTCUTS @"Preference Toolbar Shortcuts" #pragma mark - @@ -588,6 +589,9 @@ else if ([itemIdentifier isEqualToString:PREFERENCE_TOOLBAR_EDITOR]) { return editorItem; } + else if ([itemIdentifier isEqualToString:PREFERENCE_TOOLBAR_SHORTCUTS]) { + return shortcutItem; + } return [[[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier] autorelease]; } @@ -597,7 +601,7 @@ // ------------------------------------------------------------------------------- - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar { - return [NSArray arrayWithObjects:PREFERENCE_TOOLBAR_GENERAL, PREFERENCE_TOOLBAR_TABLES, PREFERENCE_TOOLBAR_FAVORITES, PREFERENCE_TOOLBAR_NOTIFICATIONS, PREFERENCE_TOOLBAR_AUTOUPDATE, PREFERENCE_TOOLBAR_NETWORK, PREFERENCE_TOOLBAR_EDITOR, nil]; + return [NSArray arrayWithObjects:PREFERENCE_TOOLBAR_GENERAL, PREFERENCE_TOOLBAR_TABLES, PREFERENCE_TOOLBAR_FAVORITES, PREFERENCE_TOOLBAR_NOTIFICATIONS, PREFERENCE_TOOLBAR_EDITOR, PREFERENCE_TOOLBAR_SHORTCUTS, PREFERENCE_TOOLBAR_AUTOUPDATE, PREFERENCE_TOOLBAR_NETWORK, nil]; } // ------------------------------------------------------------------------------- @@ -605,7 +609,7 @@ // ------------------------------------------------------------------------------- - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar { - return [NSArray arrayWithObjects:PREFERENCE_TOOLBAR_GENERAL, PREFERENCE_TOOLBAR_TABLES, PREFERENCE_TOOLBAR_FAVORITES, PREFERENCE_TOOLBAR_NOTIFICATIONS, PREFERENCE_TOOLBAR_AUTOUPDATE, PREFERENCE_TOOLBAR_NETWORK, PREFERENCE_TOOLBAR_EDITOR, nil]; + return [NSArray arrayWithObjects:PREFERENCE_TOOLBAR_GENERAL, PREFERENCE_TOOLBAR_TABLES, PREFERENCE_TOOLBAR_FAVORITES, PREFERENCE_TOOLBAR_NOTIFICATIONS, PREFERENCE_TOOLBAR_EDITOR, PREFERENCE_TOOLBAR_SHORTCUTS, PREFERENCE_TOOLBAR_AUTOUPDATE, PREFERENCE_TOOLBAR_NETWORK, nil]; } // ------------------------------------------------------------------------------- @@ -613,7 +617,7 @@ // ------------------------------------------------------------------------------- - (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar { - return [NSArray arrayWithObjects:PREFERENCE_TOOLBAR_GENERAL, PREFERENCE_TOOLBAR_TABLES, PREFERENCE_TOOLBAR_FAVORITES, PREFERENCE_TOOLBAR_NOTIFICATIONS, PREFERENCE_TOOLBAR_AUTOUPDATE, PREFERENCE_TOOLBAR_NETWORK, PREFERENCE_TOOLBAR_EDITOR, nil]; + return [NSArray arrayWithObjects:PREFERENCE_TOOLBAR_GENERAL, PREFERENCE_TOOLBAR_TABLES, PREFERENCE_TOOLBAR_FAVORITES, PREFERENCE_TOOLBAR_NOTIFICATIONS, PREFERENCE_TOOLBAR_EDITOR, PREFERENCE_TOOLBAR_SHORTCUTS, PREFERENCE_TOOLBAR_AUTOUPDATE, PREFERENCE_TOOLBAR_NETWORK, nil]; } #pragma mark - @@ -799,7 +803,7 @@ // set font panel's valid modes - (unsigned int)validModesForFontPanel:(NSFontPanel *)fontPanel { - return (NSFontPanelFaceModeMask | NSFontPanelSizeModeMask); + return (NSFontPanelAllModesMask ^ NSFontPanelAllEffectsModeMask); } // Action receiver for a font change in the font panel - (void)changeFont:(id)sender @@ -861,11 +865,27 @@ // Notification preferences notificationsItem = [[NSToolbarItem alloc] initWithItemIdentifier:PREFERENCE_TOOLBAR_NOTIFICATIONS]; - [notificationsItem setLabel:NSLocalizedString(@"Notifications", @"")]; + [notificationsItem setLabel:NSLocalizedString(@"Alerts", @"")]; [notificationsItem setImage:[NSImage imageNamed:@"toolbar-preferences-notifications"]]; [notificationsItem setTarget:self]; [notificationsItem setAction:@selector(displayNotificationPreferences:)]; + // Editor preferences + editorItem = [[NSToolbarItem alloc] initWithItemIdentifier:PREFERENCE_TOOLBAR_EDITOR]; + + [editorItem setLabel:NSLocalizedString(@"Query Editor", @"")]; + [editorItem setImage:[NSImage imageNamed:@"toolbar-preferences-queryeditor"]]; + [editorItem setTarget:self]; + [editorItem setAction:@selector(displayEditorPreferences:)]; + + // Shortcut preferences + shortcutItem = [[NSToolbarItem alloc] initWithItemIdentifier:PREFERENCE_TOOLBAR_SHORTCUTS]; + + [shortcutItem setLabel:NSLocalizedString(@"Shortcuts", @"")]; + [shortcutItem setImage:[NSImage imageNamed:@"toolbar-preferences-shortcuts"]]; + [shortcutItem setTarget:self]; + [shortcutItem setAction:@selector(NSBeep)]; + // AutoUpdate preferences autoUpdateItem = [[NSToolbarItem alloc] initWithItemIdentifier:PREFERENCE_TOOLBAR_AUTOUPDATE]; @@ -882,15 +902,6 @@ [networkItem setTarget:self]; [networkItem setAction:@selector(displayNetworkPreferences:)]; - // Editor preferences - editorItem = [[NSToolbarItem alloc] initWithItemIdentifier:PREFERENCE_TOOLBAR_EDITOR]; - - [editorItem setLabel:NSLocalizedString(@"Query Editor", @"")]; - [editorItem setImage:[NSImage imageNamed:@"toolbar-switch-to-sql"]]; - [editorItem setTarget:self]; - [editorItem setAction:@selector(displayEditorPreferences:)]; - - [toolbar setDelegate:self]; [toolbar setSelectedItemIdentifier:PREFERENCE_TOOLBAR_GENERAL]; [toolbar setAllowsUserCustomization:NO]; -- cgit v1.2.3