diff options
author | avenjamin <avenjamin@gmail.com> | 2009-11-02 06:40:16 +0000 |
---|---|---|
committer | avenjamin <avenjamin@gmail.com> | 2009-11-02 06:40:16 +0000 |
commit | 87099cc81ddec5c695f4a62fa3c69de228523c82 (patch) | |
tree | 29645406508c3da180007990131dcf57ebdbba9b /Source | |
parent | 7db6c4e18fb52c2e5ada02ad108ab6415a49843d (diff) | |
download | sequelpro-87099cc81ddec5c695f4a62fa3c69de228523c82.tar.gz sequelpro-87099cc81ddec5c695f4a62fa3c69de228523c82.tar.bz2 sequelpro-87099cc81ddec5c695f4a62fa3c69de228523c82.zip |
• Initial work to set the default view mode when connecting. Issue #249
• Organize constants into groups
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPConstants.h | 97 | ||||
-rw-r--r-- | Source/SPConstants.m | 93 | ||||
-rw-r--r-- | Source/TableDocument.m | 10 |
3 files changed, 132 insertions, 68 deletions
diff --git a/Source/SPConstants.h b/Source/SPConstants.h index 8bf9fcff..d8d16adf 100644 --- a/Source/SPConstants.h +++ b/Source/SPConstants.h @@ -23,6 +23,9 @@ // // More info at <http://code.google.com/p/sequel-pro/> +// TODO: change #defines +// see http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-1003095 + #import <Cocoa/Cocoa.h> // Extensions @@ -55,10 +58,29 @@ #define MAIN_TOOLBAR_TABLE_RELATIONS @"SwitchToTableRelationsToolbarItemIdentifier" #define MAIN_TOOLBAR_USER_MANAGER @"SwitchToUserManagerToolbarItemIdentifier" +// View Modes +typedef enum { + SPStructureViewMode = 1, + SPContentViewMode = 2, + SPRelationsViewMode = 3, + SPTableInfoViewMode = 4, + SPQueryEditorViewMode = 5 +} SPViewMode; + // Preference key constants +// General Prefpane +extern NSString *SPDefaultFavorite; +extern NSString *SPSelectLastFavoriteUsed; +extern NSString *SPLastFavoriteIndex; +extern NSString *SPAutoConnectToDefault; +extern NSString *SPDefaultViewMode; +extern NSString *SPLastViewMode; extern NSString *SPDefaultEncoding; extern NSString *SPUseMonospacedFonts; extern NSString *SPDisplayTableViewVerticalGridlines; +extern NSString *SPCustomQueryMaxHistoryItems; + +// Tables Prefpane extern NSString *SPReloadAfterAddingRow; extern NSString *SPReloadAfterEditingRow; extern NSString *SPReloadAfterRemovingRow; @@ -68,61 +90,72 @@ extern NSString *SPNewFieldsAllowNulls; extern NSString *SPLimitResults; extern NSString *SPLimitResultsValue; extern NSString *SPNullValue; -extern NSString *SPShowNoAffectedRowsError; + +// Favorites Prefpane +extern NSString *SPFavorites; + +// Notifications Prefpane extern NSString *SPGrowlEnabled; +extern NSString *SPShowNoAffectedRowsError; +extern NSString *SPConsoleEnableLogging; +extern NSString *SPConsoleEnableInterfaceLogging; +extern NSString *SPConsoleEnableCustomQueryLogging; +extern NSString *SPConsoleEnableImportExportLogging; +extern NSString *SPConsoleEnableErrorLogging; + +// Network Prefpane extern NSString *SPConnectionTimeoutValue; extern NSString *SPUseKeepAlive; extern NSString *SPKeepAliveInterval; -extern NSString *SPEditInSheetEnabled; -extern NSString *SPAutoConnectToDefault; -extern NSString *SPQueryFavoriteReplacesContent; -extern NSString *SPQueryHistoryReplacesContent; + +// Editor Prefpane extern NSString *SPCustomQueryEditorFont; +extern NSString *SPCustomQueryEditorTextColor; extern NSString *SPCustomQueryEditorBackgroundColor; -extern NSString *SPCustomQueryEditorBacktickColor; +extern NSString *SPCustomQueryEditorCaretColor; extern NSString *SPCustomQueryEditorCommentColor; +extern NSString *SPCustomQueryEditorSQLKeywordColor; extern NSString *SPCustomQueryEditorNumericColor; extern NSString *SPCustomQueryEditorQuoteColor; -extern NSString *SPCustomQueryEditorSQLKeywordColor; -extern NSString *SPCustomQueryEditorTextColor; -extern NSString *SPCustomQueryEditorHighlightQueryColor; -extern NSString *SPCustomQueryEditorCaretColor; +extern NSString *SPCustomQueryEditorBacktickColor; extern NSString *SPCustomQueryEditorVariableColor; -extern NSString *SPCustomQueryHighlightCurrentQuery; +extern NSString *SPCustomQueryEditorHighlightQueryColor; extern NSString *SPCustomQueryAutoIndent; extern NSString *SPCustomQueryAutoPairCharacters; extern NSString *SPCustomQueryAutoUppercaseKeywords; extern NSString *SPCustomQueryUpdateAutoHelp; extern NSString *SPCustomQueryAutoHelpDelay; -extern NSString *SPCustomQueryMaxHistoryItems; -extern NSString *SPLastSQLFileEncoding; -extern NSString *SPSelectLastFavoriteUsed; -extern NSString *SPLastFavoriteIndex; -extern NSString *SPTableInformationPanelCollapsed; -extern NSString *SPConsoleEnableLogging; -extern NSString *SPConsoleEnableInterfaceLogging; -extern NSString *SPConsoleEnableCustomQueryLogging; -extern NSString *SPConsoleEnableImportExportLogging; -extern NSString *SPConsoleEnableErrorLogging; +extern NSString *SPCustomQueryHighlightCurrentQuery; + +// AutoUpdate Prefpane +extern NSString *SPLastUsedVersion; + +// GUI Prefs extern NSString *SPConsoleShowTimestamps; extern NSString *SPConsoleShowSelectsAndShows; extern NSString *SPConsoleShowHelps; -extern NSString *SPPrintBackground; -extern NSString *SPPrintImagePreviews; -extern NSString *SPContentFilters; +extern NSString *SPEditInSheetEnabled; +extern NSString *SPTableInformationPanelCollapsed; +extern NSString *SPTableColumnWidths; + +// Import extern NSString *SPCSVImportFieldTerminator; extern NSString *SPCSVImportLineTerminator; extern NSString *SPCSVImportFieldEnclosedBy; extern NSString *SPCSVImportFieldEscapeCharacter; extern NSString *SPCSVImportFirstLineIsHeader; -extern NSString *SPLastUsedVersion; + +// Misc +extern NSString *SPContentFilters; +extern NSString *SPDocumentTaskEndNotification; +extern NSString *SPDocumentTaskStartNotification; extern NSString *SPFieldEditorSheetFont; -extern NSString *SPQuickLookTypes; +extern NSString *SPLastSQLFileEncoding; +extern NSString *SPNoBOMforSQLdumpFile; +extern NSString *SPPrintBackground; +extern NSString *SPPrintImagePreviews; extern NSString *SPQueryFavorites; -extern NSString *SPFavorites; -extern NSString *SPTableColumnWidths; +extern NSString *SPQueryFavoriteReplacesContent; extern NSString *SPQueryHistory; -extern NSString *SPDocumentTaskStartNotification; -extern NSString *SPDocumentTaskEndNotification; -extern NSString *SPDefaultFavorite; -extern NSString *SPNoBOMforSQLdumpFile; +extern NSString *SPQueryHistoryReplacesContent; +extern NSString *SPQuickLookTypes; diff --git a/Source/SPConstants.m b/Source/SPConstants.m index cec83d44..5e88ab0d 100644 --- a/Source/SPConstants.m +++ b/Source/SPConstants.m @@ -26,9 +26,19 @@ #import "SPConstants.h" // Preference key constants +// General Prefpane +NSString *SPDefaultFavorite = @"DefaultFavorite"; +NSString *SPSelectLastFavoriteUsed = @"SelectLastFavoriteUsed"; +NSString *SPLastFavoriteIndex = @"LastFavoriteIndex"; +NSString *SPAutoConnectToDefault = @"AutoConnectToDefault"; +NSString *SPDefaultViewMode = @"DefaultViewMode"; +NSString *SPLastViewMode = @"LastViewMode"; NSString *SPDefaultEncoding = @"DefaultEncoding"; NSString *SPUseMonospacedFonts = @"UseMonospacedFonts"; NSString *SPDisplayTableViewVerticalGridlines = @"DisplayTableViewVerticalGridlines"; +NSString *SPCustomQueryMaxHistoryItems = @"CustomQueryMaxHistoryItems"; + +// Tables Prefpane NSString *SPReloadAfterAddingRow = @"ReloadAfterAddingRow"; NSString *SPReloadAfterEditingRow = @"ReloadAfterEditingRow"; NSString *SPReloadAfterRemovingRow = @"ReloadAfterRemovingRow"; @@ -38,61 +48,72 @@ NSString *SPNewFieldsAllowNulls = @"NewFieldsAllowNulls"; NSString *SPLimitResults = @"LimitResults"; NSString *SPLimitResultsValue = @"LimitResultsValue"; NSString *SPNullValue = @"NullValue"; -NSString *SPShowNoAffectedRowsError = @"ShowNoAffectedRowsError"; + +// Favorites Prefpane +NSString *SPFavorites = @"favorites"; + +// Notifications Prefpane NSString *SPGrowlEnabled = @"GrowlEnabled"; +NSString *SPShowNoAffectedRowsError = @"ShowNoAffectedRowsError"; +NSString *SPConsoleEnableLogging = @"ConsoleEnableLogging"; +NSString *SPConsoleEnableInterfaceLogging = @"ConsoleEnableInterfaceLogging"; +NSString *SPConsoleEnableCustomQueryLogging = @"ConsoleEnableCustomQueryLogging"; +NSString *SPConsoleEnableImportExportLogging = @"ConsoleEnableImportExportLogging"; +NSString *SPConsoleEnableErrorLogging = @"ConsoleEnableErrorLogging"; + +// Network Prefpane NSString *SPConnectionTimeoutValue = @"ConnectionTimeoutValue"; NSString *SPUseKeepAlive = @"UseKeepAlive"; NSString *SPKeepAliveInterval = @"KeepAliveInterval"; -NSString *SPEditInSheetEnabled = @"EditInSheetEnabled"; -NSString *SPAutoConnectToDefault = @"AutoConnectToDefault"; -NSString *SPQueryFavoriteReplacesContent = @"QueryFavoriteReplacesContent"; -NSString *SPQueryHistoryReplacesContent = @"QueryHistoryReplacesContent"; + +// Editor Prefpane NSString *SPCustomQueryEditorFont = @"CustomQueryEditorFont"; +NSString *SPCustomQueryEditorTextColor = @"CustomQueryEditorTextColor"; NSString *SPCustomQueryEditorBackgroundColor = @"CustomQueryEditorBackgroundColor"; -NSString *SPCustomQueryEditorBacktickColor = @"CustomQueryEditorBacktickColor"; +NSString *SPCustomQueryEditorCaretColor = @"CustomQueryEditorCaretColor"; NSString *SPCustomQueryEditorCommentColor = @"CustomQueryEditorCommentColor"; +NSString *SPCustomQueryEditorSQLKeywordColor = @"CustomQueryEditorSQLKeywordColor"; NSString *SPCustomQueryEditorNumericColor = @"CustomQueryEditorNumericColor"; NSString *SPCustomQueryEditorQuoteColor = @"CustomQueryEditorQuoteColor"; -NSString *SPCustomQueryEditorSQLKeywordColor = @"CustomQueryEditorSQLKeywordColor"; -NSString *SPCustomQueryEditorTextColor = @"CustomQueryEditorTextColor"; -NSString *SPCustomQueryEditorHighlightQueryColor = @"CustomQueryEditorHighlightQueryColor"; -NSString *SPCustomQueryEditorCaretColor = @"CustomQueryEditorCaretColor"; +NSString *SPCustomQueryEditorBacktickColor = @"CustomQueryEditorBacktickColor"; NSString *SPCustomQueryEditorVariableColor = @"CustomQueryEditorVariableColor"; -NSString *SPCustomQueryHighlightCurrentQuery = @"CustomQueryHighlightCurrentQuery"; +NSString *SPCustomQueryEditorHighlightQueryColor = @"CustomQueryEditorHighlightQueryColor"; NSString *SPCustomQueryAutoIndent = @"CustomQueryAutoIndent"; NSString *SPCustomQueryAutoPairCharacters = @"CustomQueryAutoPairCharacters"; NSString *SPCustomQueryAutoUppercaseKeywords = @"CustomQueryAutoUppercaseKeywords"; NSString *SPCustomQueryUpdateAutoHelp = @"CustomQueryUpdateAutoHelp"; NSString *SPCustomQueryAutoHelpDelay = @"CustomQueryAutoHelpDelay"; -NSString *SPCustomQueryMaxHistoryItems = @"CustomQueryMaxHistoryItems"; -NSString *SPLastSQLFileEncoding = @"lastSqlFileEncoding"; -NSString *SPSelectLastFavoriteUsed = @"SelectLastFavoriteUsed"; -NSString *SPLastFavoriteIndex = @"LastFavoriteIndex"; -NSString *SPTableInformationPanelCollapsed = @"TableInformationPanelCollapsed"; -NSString *SPConsoleEnableLogging = @"ConsoleEnableLogging"; -NSString *SPConsoleEnableInterfaceLogging = @"ConsoleEnableInterfaceLogging"; -NSString *SPConsoleEnableCustomQueryLogging = @"ConsoleEnableCustomQueryLogging"; -NSString *SPConsoleEnableImportExportLogging = @"ConsoleEnableImportExportLogging"; -NSString *SPConsoleEnableErrorLogging = @"ConsoleEnableErrorLogging"; -NSString *SPConsoleShowTimestamps = @"ConsoleShowTimestamps"; -NSString *SPConsoleShowSelectsAndShows = @"ConsoleShowSelectsAndShows"; +NSString *SPCustomQueryHighlightCurrentQuery = @"CustomQueryHighlightCurrentQuery"; + +// AutoUpdate Prefpane +NSString *SPLastUsedVersion = @"LastUsedVersion"; + +// GUI Prefs NSString *SPConsoleShowHelps = @"ConsoleShowHelps"; -NSString *SPPrintBackground = @"PrintBackground"; -NSString *SPPrintImagePreviews = @"PrintImagePreviews"; -NSString *SPContentFilters = @"ContentFilters"; -NSString *SPCSVImportFieldTerminator = @"CSVImportFieldTerminator"; -NSString *SPCSVImportLineTerminator = @"CSVImportLineTerminator"; +NSString *SPConsoleShowSelectsAndShows = @"ConsoleShowSelectsAndShows"; +NSString *SPConsoleShowTimestamps = @"ConsoleShowTimestamps"; +NSString *SPEditInSheetEnabled = @"EditInSheetEnabled"; +NSString *SPTableInformationPanelCollapsed = @"TableInformationPanelCollapsed"; +NSString *SPTableColumnWidths = @"tableColumnWidths"; + +// Import NSString *SPCSVImportFieldEnclosedBy = @"CSVImportFieldEnclosedBy"; NSString *SPCSVImportFieldEscapeCharacter = @"CSVImportFieldEscapeCharacter"; +NSString *SPCSVImportFieldTerminator = @"CSVImportFieldTerminator"; NSString *SPCSVImportFirstLineIsHeader = @"CSVImportFirstLineIsHeader"; -NSString *SPLastUsedVersion = @"LastUsedVersion"; +NSString *SPCSVImportLineTerminator = @"CSVImportLineTerminator"; + +// Misc +NSString *SPContentFilters = @"ContentFilters"; +NSString *SPDocumentTaskEndNotification = @"DocumentTaskEnded"; +NSString *SPDocumentTaskStartNotification = @"DocumentTaskStarted"; NSString *SPFieldEditorSheetFont = @"FieldEditorSheetFont"; -NSString *SPQuickLookTypes = @"QuickLookTypes"; +NSString *SPLastSQLFileEncoding = @"lastSqlFileEncoding"; +NSString *SPNoBOMforSQLdumpFile = @"NoBOMforSQLdumpFile"; +NSString *SPPrintBackground = @"PrintBackground"; +NSString *SPPrintImagePreviews = @"PrintImagePreviews"; NSString *SPQueryFavorites = @"queryFavorites"; -NSString *SPFavorites = @"favorites"; -NSString *SPTableColumnWidths = @"tableColumnWidths"; +NSString *SPQueryFavoriteReplacesContent = @"QueryFavoriteReplacesContent"; NSString *SPQueryHistory = @"queryHistory"; -NSString *SPDocumentTaskStartNotification = @"DocumentTaskStarted"; -NSString *SPDocumentTaskEndNotification = @"DocumentTaskEnded"; -NSString *SPDefaultFavorite = @"DefaultFavorite"; -NSString *SPNoBOMforSQLdumpFile = @"NoBOMforSQLdumpFile"; +NSString *SPQueryHistoryReplacesContent = @"QueryHistoryReplacesContent"; +NSString *SPQuickLookTypes = @"QuickLookTypes"; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index c419bd1e..8847d103 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -2805,6 +2805,8 @@ [tableTabView selectTabViewItemAtIndex:0]; [mainToolbar setSelectedItemIdentifier:MAIN_TOOLBAR_TABLE_STRUCTURE]; [spHistoryControllerInstance updateHistoryEntries]; + + [prefs setInteger:SPStructureViewMode forKey:SPLastViewMode]; } - (IBAction)viewContent:(id)sender @@ -2819,6 +2821,8 @@ [tableTabView selectTabViewItemAtIndex:1]; [mainToolbar setSelectedItemIdentifier:MAIN_TOOLBAR_TABLE_CONTENT]; [spHistoryControllerInstance updateHistoryEntries]; + + [prefs setInteger:SPContentViewMode forKey:SPLastViewMode]; } - (IBAction)viewQuery:(id)sender @@ -2843,6 +2847,8 @@ // Set the focus on the text field if no query has been run if (![[customQueryTextView string] length]) [tableWindow makeFirstResponder:customQueryTextView]; + + [prefs setInteger:SPQueryEditorViewMode forKey:SPLastViewMode]; } - (IBAction)viewStatus:(id)sender @@ -2864,6 +2870,8 @@ [tableTabView selectTabViewItemAtIndex:3]; [mainToolbar setSelectedItemIdentifier:MAIN_TOOLBAR_TABLE_INFO]; [spHistoryControllerInstance updateHistoryEntries]; + + [prefs setInteger:SPTableInfoViewMode forKey:SPLastViewMode]; } - (IBAction)viewRelations:(id)sender @@ -2885,6 +2893,8 @@ [tableTabView selectTabViewItemAtIndex:4]; [mainToolbar setSelectedItemIdentifier:MAIN_TOOLBAR_TABLE_RELATIONS]; [spHistoryControllerInstance updateHistoryEntries]; + + [prefs setInteger:SPRelationsViewMode forKey:SPLastViewMode]; } |