From 52784a1b02f5ff32bc8d9661d948d2ebee93f610 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sat, 28 Feb 2009 02:03:50 +0000 Subject: + Separate the console from being drawer based to its own panel. New console panel also adds the ability to save the current console content to a file on disk. Speed up the updating of the text view by removing the re-draw of the view after each message is appended. The console is still very basic, but is a starting point for more functionality to be added now that it is all handled in a single class. + Add the ability to specify the encoding when creating a new database. Addresses issue #125. Also improve the usability of the create database sheet by only enabling the 'Add' button if the database name length is greater than zero. This elimates the check that is done and the error panel that is displayed if the name is empty. --- Interfaces/English.lproj/DBView.xib | 1350 +++++++++++++++++++++++++-------- Interfaces/English.lproj/MainMenu.xib | 72 +- Source/SPQueryConsole.h | 38 + Source/SPQueryConsole.m | 135 ++++ Source/TableContent.h | 8 +- Source/TableContent.m | 4 +- Source/TableDocument.h | 15 +- Source/TableDocument.m | 130 ++-- sequel-pro.xcodeproj/project.pbxproj | 6 + 9 files changed, 1325 insertions(+), 433 deletions(-) create mode 100644 Source/SPQueryConsole.h create mode 100644 Source/SPQueryConsole.m diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 978f8323..eabc24d3 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -8,8 +8,7 @@ 353.00 YES - - + YES @@ -46,7 +45,7 @@ {3.40282e+38, 3.40282e+38} {780, 480} - + 256 YES @@ -974,7 +973,6 @@ {{1, 1}, {194, 396}} - 4 @@ -1001,7 +999,6 @@ {196, 398} - 530 @@ -1086,7 +1083,6 @@ {{1, 1}, {194, 123}} - 4 @@ -1113,7 +1109,6 @@ {{0, 407}, {196, 125}} - 530 @@ -3139,29 +3134,6 @@ 6418 - - YES - - YES - Apple HTML pasteboard type - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - Apple URL pasteboard type - CorePasteboardFlavorType 0x6D6F6F76 - CorePasteboardFlavorType 0x75726C20 - NSColor pasteboard type - NSFilenamesPboardType - NSStringPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT RTFD pasteboard type - NeXT Rich Text Format v1.0 pasteboard type - NeXT TIFF v4.0 pasteboard type - NeXT font pasteboard type - NeXT ruler pasteboard type - WebURLsWithTitlesPboardType - - {626, 14} @@ -3222,7 +3194,6 @@ {{1, 1}, {626, 155}} - @@ -3254,7 +3225,6 @@ {628, 157} - 530 @@ -3341,7 +3311,6 @@ {{1, 17}, {626, 226}} - 4 @@ -3374,7 +3343,6 @@ {{1, 0}, {626, 17}} - 4 @@ -3383,7 +3351,6 @@ {628, 244} - 562 @@ -4033,7 +4000,6 @@ {863, 550} - {{0, 0}, {1440, 878}} {780, 502} @@ -4053,7 +4019,7 @@ {3.40282e+38, 3.40282e+38} {256, 191} - + 256 YES @@ -4460,7 +4426,6 @@ {{1, 17}, {213, 157}} - 4 @@ -4493,7 +4458,6 @@ {{1, 0}, {213, 17}} - 4 @@ -4502,7 +4466,6 @@ {{12, 34}, {215, 175}} - 562 @@ -4632,7 +4595,6 @@ {519, 335} - {{0, 0}, {1440, 878}} {256, 213} @@ -4791,7 +4753,7 @@ 2322 - {588, 0} + {588, 72} @@ -5037,7 +4999,6 @@ {588, 316} - 1 @@ -5069,7 +5030,6 @@ {{0, 34}, {588, 316}} - 528 @@ -5105,40 +5065,56 @@ 1 2 - {{343, 483}, {220, 112}} + {{343, 483}, {292, 112}} 1886912512 databaseSheet NSWindow View - {256, 191} - {162.05, 5} + {292, 112} + {292, 112} - + 256 YES 256 - {{17, 78}, {88, 14}} + {{17, 78}, {95, 14}} YES 67239424 4194304 - Database Name + Database Name: - + 256 - {{20, 52}, {180, 18}} + {{17, 53}, {113, 14}} + + YES + + 67239424 + 4194304 + Database Encoding: + + + + + + + + + 258 + {{135, 77}, {137, 18}} YES @@ -5154,13 +5130,13 @@ - 256 - {{135, 13}, {70, 28}} + 259 + {{207, 13}, {70, 28}} 1 YES - 67239424 + 604110336 138018816 Add @@ -5177,8 +5153,8 @@ - 256 - {{67, 13}, {70, 28}} + 259 + {{139, 13}, {70, 28}} YES @@ -5196,12 +5172,326 @@ 25 + + + 258 + {{132, 48}, {143, 22}} + + YES + + -2076049856 + 132096 + + + -2038284033 + 1 + + + + + + 400 + 75 + + + Default + + 1048576 + 2147483647 + 1 + + + _popUpItemAction: + + + YES + + OtherViews + + YES + + + + YES + YES + + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + UCS-2 Unicode (ucs2) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + UTF-8 Unicode (utf8) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + YES + YES + + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + US ASCII (ascii) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + ISO Latin 1 (latin1) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Mac Roman (macroman) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + YES + YES + + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Windows Latin 2 (cp1250) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + ISO Latin 2 (latin2) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + YES + YES + + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Windows Arabic (cp1256) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + ISO Greek (greek) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + ISO Hebrew (hebrew) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + ISO Turkish (latin5) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + YES + YES + + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Windows Baltic (cp1257) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + YES + YES + + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Windows Cyrillic (cp1251) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + YES + YES + + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Big5 Traditional Chinese (big5) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Shift-JIS Japanese (sjis) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + EUC-JP Japanese (ujis) + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + 3 + YES + YES + 1 + + - {220, 112} + {292, 112} + {{0, 0}, {1440, 878}} - {162.05, 27} - {256, 213} + {292, 134} + {292, 134} 9 @@ -5360,7 +5650,6 @@ {{1, 1}, {574, 293}} - @@ -5390,7 +5679,6 @@ {{20, 20}, {587, 295}} - 18 @@ -7310,131 +7598,177 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {300, 222} {3.40282e+38, 3.40282e+38} - - - 256 - - YES - - - 274 - - YES - - - 2304 - - YES - - - 2322 - - YES - - YES - Apple HTML pasteboard type - Apple PDF pasteboard type - Apple PICT pasteboard type - CorePasteboardFlavorType 0x6D6F6F76 - NSColor pasteboard type - NSFilenamesPboardType - NSStringPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT RTFD pasteboard type - NeXT Rich Text Format v1.0 pasteboard type - NeXT TIFF v4.0 pasteboard type - - - {770, 14} - - - - - - + + 15 + 2 + {{426, 353}, {575, 181}} + -1535638528 + Console + NSPanel + + {3.40282e+38, 3.40282e+38} + {300, 130} + + + 256 + + YES + + + 274 + + YES + + + 2304 + + YES + + + 2322 + {533, 14} + + + + + + + + + + + YES + + 6 - - YES - - - 6 - + + 5.330000e+02 + 1 - - 7.700000e+02 - 1 - - - 3041 - - - - YES - + + 2049 + + + YES - NSBackgroundColor - NSColor + + YES + NSBackgroundColor + NSColor + + + YES + + + - + + YES - - + + YES + NSColor + NSUnderline + + + YES + + + + - - - + 6 + {1068, 1e+07} + {223, 0} + - 6 - {1553, 1e+07} - {87, 0} - + {{1, 1}, {533, 114}} + + + + + + 6 + + + + -2147483392 + {{1054, 1}, {15, 230}} + + + _doScroller: + 9.829060e-01 + + + + 256 + {{-100, -100}, {518, 15}} + + 1 + + _doScroller: + 1.000000e+00 + 9.456522e-01 - {{1, 1}, {770, 78}} - - - - - - 4 - - - 256 - {{771, 1}, {11, 78}} - - 256 - - _doScroller: - 1.000000e+00 + {{20, 45}, {535, 116}} + + + 530 + + + + + + + 289 + {{360, 13}, {101, 28}} + + YES + + 67239424 + 134348800 + Save As... + + + -2038284033 + 129 + + + 200 + 25 - - - 256 - {{-100, -100}, {87, 18}} - - 257 - - _doScroller: - 1.000000e+00 - 9.456522e-01 + + + + 289 + {{459, 13}, {101, 28}} + + YES + + 67239424 + 134348800 + Clear + + + -2038284033 + 129 + + + 200 + 25 - {{8, 8}, {783, 80}} - - - 18 - - - + {575, 181} - {800, 96} - NSView - NSResponder + {{0, 0}, {1440, 878}} + {300, 152} + {3.40282e+38, 3.40282e+38} @@ -9602,17 +9936,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES YES - - - {200, 572} - {100, 80} - {2000, 1000} - 1 - 0.000000e+00 - 0.000000e+00 - - - CustomQuery @@ -9640,6 +9963,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 SPTableData + + SPQueryConsole + @@ -10548,38 +10874,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 819 - - - contentView - - - - 826 - - - - parentWindow - - - - 827 - - - - consoleTextView - - - - 830 - - - - consoleDrawer - - - - 832 - closeSheet: @@ -11938,27 +12232,99 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - delegate - - + delegate + + + + 4717 + + + + delegate + + + + 4718 + + + + nextKeyView + + + + 4719 + + + + queryConsoleInstance + + + + 4721 + + + + queryConsoleInstance + + + + 4722 + + + + window + + + + 4729 + + + + consoleTextView + + + + 4734 + + + + saveConsoleAs: + + + + 4739 + + + + clearConsole: + + + + 4740 + + + + databaseEncodingButton + + - 4717 + 4778 - delegate - - + addDatabaseButton + + - 4718 + 4780 - nextKeyView - - + delegate + + - 4719 + 4781 @@ -12389,6 +12755,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES + + @@ -12835,38 +13203,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - - 821 - - - consoleDrawer - - - 824 - - - YES - - - - consoleDrawerView - - - 828 - - - YES - - - - - - - - 829 - - - 839 @@ -13919,16 +14255,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - - 3944 - - - - - 3945 - - - 3946 @@ -14340,7 +14666,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 4488 - SP Table Info + SPTableInfo 4511 @@ -17022,6 +17348,271 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 + + 4720 + + + SPQueryConsole + + + 4723 + + + YES + + + + queryConsole + + + 4724 + + + YES + + + + + + + + 4730 + + + YES + + + + + + + + 4731 + + + + + 4732 + + + + + 4733 + + + + + 4735 + + + YES + + + + + + 4736 + + + + + 4737 + + + YES + + + + + + 4738 + + + + + 4741 + + + YES + + + + + + 4742 + + + + + 4751 + + + YES + + + + + + 4752 + + + YES + + + + + + 4753 + + + YES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4754 + + + + + 4755 + + + + + 4756 + + + + + 4757 + + + + + 4758 + + + + + 4759 + + + + + 4760 + + + + + 4761 + + + + + 4762 + + + + + 4763 + + + + + 4764 + + + + + 4765 + + + + + 4766 + + + + + 4767 + + + + + 4768 + + + + + 4769 + + + + + 4770 + + + + + 4771 + + + + + 4772 + + + + + 4773 + + + + + 4774 + + + + + 4775 + + + + + 4776 + + + + + 4777 + + + @@ -17690,10 +18281,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 3942.IBShouldRemoveOnLegacySave 3943.IBPluginDependency 3943.IBShouldRemoveOnLegacySave - 3944.IBPluginDependency - 3944.IBShouldRemoveOnLegacySave - 3945.IBPluginDependency - 3945.IBShouldRemoveOnLegacySave 3946.IBPluginDependency 3946.IBShouldRemoveOnLegacySave 3947.IBPluginDependency @@ -18013,6 +18600,79 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 47.ImportedFromIB2 4700.IBPluginDependency 4702.IBPluginDependency + 4720.IBPluginDependency + 4723.IBEditorWindowLastContentRect + 4723.IBWindowTemplateEditedContentRect + 4723.NSWindowTemplate.visibleAtLaunch + 4723.windowTemplate.hasMinSize + 4723.windowTemplate.minSize + 4724.IBPluginDependency + 4730.IBPluginDependency + 4731.IBPluginDependency + 4732.IBPluginDependency + 4733.IBPluginDependency + 4735.IBPluginDependency + 4736.IBPluginDependency + 4737.IBPluginDependency + 4738.IBPluginDependency + 4741.IBPluginDependency + 4741.ImportedFromIB2 + 4742.IBPluginDependency + 4751.IBPluginDependency + 4751.ImportedFromIB2 + 4752.IBPluginDependency + 4753.IBEditorWindowLastContentRect + 4753.IBPluginDependency + 4753.ImportedFromIB2 + 4753.editorWindowContentRectSynchronizationRect + 4754.IBPluginDependency + 4754.ImportedFromIB2 + 4755.IBPluginDependency + 4755.ImportedFromIB2 + 4756.IBPluginDependency + 4756.ImportedFromIB2 + 4757.IBPluginDependency + 4757.ImportedFromIB2 + 4758.IBPluginDependency + 4758.ImportedFromIB2 + 4759.IBPluginDependency + 4759.ImportedFromIB2 + 4760.IBPluginDependency + 4760.ImportedFromIB2 + 4761.IBPluginDependency + 4761.ImportedFromIB2 + 4762.IBPluginDependency + 4762.ImportedFromIB2 + 4763.IBPluginDependency + 4763.ImportedFromIB2 + 4764.IBPluginDependency + 4764.ImportedFromIB2 + 4765.IBPluginDependency + 4765.ImportedFromIB2 + 4766.IBPluginDependency + 4766.ImportedFromIB2 + 4767.IBPluginDependency + 4767.ImportedFromIB2 + 4768.IBPluginDependency + 4768.ImportedFromIB2 + 4769.IBPluginDependency + 4769.ImportedFromIB2 + 4770.IBPluginDependency + 4770.ImportedFromIB2 + 4771.IBPluginDependency + 4771.ImportedFromIB2 + 4772.IBPluginDependency + 4772.ImportedFromIB2 + 4773.IBPluginDependency + 4773.ImportedFromIB2 + 4774.IBPluginDependency + 4774.ImportedFromIB2 + 4775.IBPluginDependency + 4775.ImportedFromIB2 + 4776.IBPluginDependency + 4776.ImportedFromIB2 + 4777.IBPluginDependency + 4777.ImportedFromIB2 495.IBAttributePlaceholdersKey 495.IBPluginDependency 495.ImportedFromIB2 @@ -18188,15 +18848,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 815.IBEditorWindowLastContentRect 815.IBPluginDependency 815.ImportedFromIB2 - 821.IBPluginDependency - 821.ImportedFromIB2 - 824.IBEditorWindowLastContentRect - 824.IBPluginDependency - 824.ImportedFromIB2 - 828.IBPluginDependency - 828.ImportedFromIB2 - 829.IBPluginDependency - 829.ImportedFromIB2 835.IBPluginDependency 835.ImportedFromIB2 839.IBEditorWindowLastContentRect @@ -19179,10 +19830,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -19521,6 +20168,79 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{354, 365}, {575, 181}} + {{354, 365}, {575, 181}} + + + {300, 130} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + {{646, 3}, {228, 362}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{67, 289}, {228, 362}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + ToolTip @@ -19567,13 +20287,13 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin - {{147, 561}, {220, 112}} - {{147, 561}, {220, 112}} + {{525, 295}, {292, 112}} + {{525, 295}, {292, 112}} + - - {256, 191} - {162.05, 5} + {292, 112} + {292, 112} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -19783,15 +20503,6 @@ Y2hhbmdlIHRoZSBvcmRlcg com.apple.InterfaceBuilder.CocoaPlugin - {{270, 683}, {800, 96}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - {{84, 401}, {411, 341}} {{84, 401}, {411, 341}} @@ -19945,7 +20656,7 @@ Y2hhbmdlIHRoZSBvcmRlcg - 4719 + 4781 @@ -20125,6 +20836,31 @@ Y2hhbmdlIHRoZSBvcmRlcg Source/CMMCPConnection.h + + SPQueryConsole + NSWindowController + + YES + + YES + clearConsole: + saveConsoleAs: + + + YES + id + id + + + + consoleTextView + NSTextView + + + IBProjectSource + Source/SPQueryConsole.h + + SPTableData NSObject @@ -20234,6 +20970,7 @@ Y2hhbmdlIHRoZSBvcmRlcg limitRowsStepper limitRowsText multipleLineEditingButton + queryConsoleInstance removeButton tableContentView tableDataInstance @@ -20261,6 +20998,7 @@ Y2hhbmdlIHRoZSBvcmRlcg id id id + id CMCopyTable id id @@ -20296,7 +21034,6 @@ Y2hhbmdlIHRoZSBvcmRlcg chooseDatabase: chooseEncoding: chooseFavorite: - clearConsole: closeDatabaseSheet: closeSheet: connect: @@ -20316,7 +21053,6 @@ Y2hhbmdlIHRoZSBvcmRlcg setDatabases: showCreateTableSyntax: showVariables: - toggleConsole: viewContent: viewQuery: viewStatus: @@ -20355,23 +21091,21 @@ Y2hhbmdlIHRoZSBvcmRlcg id id id - id - id YES YES + addDatabaseButton chooseDatabaseButton connectFavoritesTableView connectProgressBar connectProgressStatusText connectSheet - consoleDrawer - consoleTextView createTableSyntaxWindow customQueryInstance + databaseEncodingButton databaseField databaseNameField databaseSheet @@ -20382,6 +21116,7 @@ Y2hhbmdlIHRoZSBvcmRlcg keyChainInstance passwordField portField + queryConsoleInstance queryProgressBar sidebarGrabber socketField @@ -20402,9 +21137,8 @@ Y2hhbmdlIHRoZSBvcmRlcg YES id - NSTableView - id id + NSTableView id id id @@ -20413,6 +21147,7 @@ Y2hhbmdlIHRoZSBvcmRlcg id id id + id NSTableView id NSArrayController @@ -20430,6 +21165,7 @@ Y2hhbmdlIHRoZSBvcmRlcg id id id + id NSTabView id id diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib index 82981911..731e1079 100644 --- a/Interfaces/English.lproj/MainMenu.xib +++ b/Interfaces/English.lproj/MainMenu.xib @@ -8,7 +8,7 @@ 353.00 YES - + YES @@ -3739,14 +3739,6 @@ 788 - - - toggleConsole: - - - - 792 - clearConsole: @@ -3843,6 +3835,14 @@ 830 + + + toggleConsole: + + + + 832 + @@ -6631,7 +6631,7 @@ Y2hhbmdlIHRoZSBvcmRlcg com.apple.InterfaceBuilder.CocoaPlugin - {{328, 707}, {511, 20}} + {{51, 384}, {511, 20}} com.apple.InterfaceBuilder.CocoaPlugin {{506, 836}, {511, 20}} @@ -6722,7 +6722,7 @@ Y2hhbmdlIHRoZSBvcmRlcg com.apple.InterfaceBuilder.CocoaPlugin - {{436, 241}, {235, 183}} + {{243, 201}, {235, 183}} com.apple.InterfaceBuilder.CocoaPlugin {{698, 703}, {184, 133}} @@ -6844,7 +6844,7 @@ Y2hhbmdlIHRoZSBvcmRlcg com.apple.InterfaceBuilder.CocoaPlugin - {{486, 271}, {231, 153}} + {{570, 554}, {231, 153}} com.apple.InterfaceBuilder.CocoaPlugin {{312, 683}, {231, 153}} @@ -6962,7 +6962,7 @@ Y2hhbmdlIHRoZSBvcmRlcg com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{454, 310}, {268, 173}} + {{651, 534}, {268, 173}} com.apple.InterfaceBuilder.CocoaPlugin {{829, 663}, {268, 173}} com.apple.InterfaceBuilder.CocoaPlugin @@ -7033,7 +7033,7 @@ Y2hhbmdlIHRoZSBvcmRlcg - 830 + 832 @@ -7264,6 +7264,40 @@ Y2hhbmdlIHRoZSBvcmRlcg Source/CMMCPConnection.h + + SPQueryConsole + NSObject + + YES + + YES + clearConsole: + showConsole: + + + YES + id + id + + + + YES + + YES + consolePanel + consoleTextView + + + YES + NSPanel + NSTextView + + + + IBProjectSource + Source/SPQueryConsole.h + + TableDocument NSDocument @@ -7279,7 +7313,6 @@ Y2hhbmdlIHRoZSBvcmRlcg chooseDatabase: chooseEncoding: chooseFavorite: - clearConsole: closeDatabaseSheet: closeSheet: connect: @@ -7299,7 +7332,6 @@ Y2hhbmdlIHRoZSBvcmRlcg setDatabases: showCreateTableSyntax: showVariables: - toggleConsole: viewContent: viewQuery: viewStatus: @@ -7338,8 +7370,6 @@ Y2hhbmdlIHRoZSBvcmRlcg id id id - id - id @@ -7351,8 +7381,6 @@ Y2hhbmdlIHRoZSBvcmRlcg connectProgressBar connectProgressStatusText connectSheet - consoleDrawer - consoleTextView createTableSyntaxWindow customQueryInstance databaseField @@ -7365,6 +7393,7 @@ Y2hhbmdlIHRoZSBvcmRlcg keyChainInstance passwordField portField + queryConsoleInstance queryProgressBar sidebarGrabber socketField @@ -7388,8 +7417,6 @@ Y2hhbmdlIHRoZSBvcmRlcg id id id - id - id NSWindow id id @@ -7411,6 +7438,7 @@ Y2hhbmdlIHRoZSBvcmRlcg id id id + id NSTabView id id diff --git a/Source/SPQueryConsole.h b/Source/SPQueryConsole.h new file mode 100644 index 00000000..e1072904 --- /dev/null +++ b/Source/SPQueryConsole.h @@ -0,0 +1,38 @@ +// +// SPQueryConsole.h +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on Jan 30, 2009 +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import + +@interface SPQueryConsole : NSWindowController +{ + IBOutlet NSTextView *consoleTextView; +} + +- (IBAction)clearConsole:(id)sender; +- (IBAction)saveConsoleAs:(id)sender; + +- (void)showMessageInConsole:(NSString *)message; +- (void)showErrorInConsole:(NSString *)error; + +- (NSTextView *)consoleTextView; + +@end diff --git a/Source/SPQueryConsole.m b/Source/SPQueryConsole.m new file mode 100644 index 00000000..34391119 --- /dev/null +++ b/Source/SPQueryConsole.m @@ -0,0 +1,135 @@ +// +// SPQueryConsole.m +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on Jan 30, 2009 +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import "SPQueryConsole.h" + +#define DEFAULT_CONSOLE_LOG_FILENAME @"untitled" +#define DEFAULT_CONSOLE_LOG_FILE_EXTENSION @"log" + +@interface SPQueryConsole (PrivateAPI) + +- (void)_appendMessageToConsole:(NSString *)message withColor:(NSColor *)color; + +@end + +@implementation SPQueryConsole + +// ------------------------------------------------------------------------------- +// clearConsole: +// +// Clears the console by setting its displayed text to an empty string. +// ------------------------------------------------------------------------------- +- (IBAction)clearConsole:(id)sender +{ + [consoleTextView setString:@""]; +} + +// ------------------------------------------------------------------------------- +// saveConsoleAs: +// +// Presents the user with a save panel to the save the current console to a log file. +// ------------------------------------------------------------------------------- +- (IBAction)saveConsoleAs:(id)sender +{ + NSSavePanel *panel = [NSSavePanel savePanel]; + + [panel setRequiredFileType:DEFAULT_CONSOLE_LOG_FILE_EXTENSION]; + + [panel setExtensionHidden:NO]; + [panel setAllowsOtherFileTypes:YES]; + [panel setCanSelectHiddenExtension:YES]; + + [panel beginSheetForDirectory:nil file:DEFAULT_CONSOLE_LOG_FILENAME modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; +} + +// ------------------------------------------------------------------------------- +// showMessageInConsole: +// +// Shows the supplied message in the console. +// ------------------------------------------------------------------------------- +- (void)showMessageInConsole:(NSString *)message +{ + [self _appendMessageToConsole:message withColor:[NSColor blackColor]]; +} + +// ------------------------------------------------------------------------------- +// showErrorInConsole: +// +// Shows the supplied error in the console. +// ------------------------------------------------------------------------------- +- (void)showErrorInConsole:(NSString *)error +{ + [self _appendMessageToConsole:error withColor:[NSColor redColor]]; +} + +// ------------------------------------------------------------------------------- +// consoleTextView +// +// Return a reference to the console's text view. +// ------------------------------------------------------------------------------- +- (NSTextView *)consoleTextView +{ + return consoleTextView; +} + +// ------------------------------------------------------------------------------- +// savePanelDidEnd:returnCode:contextInfo: +// +// Called when the NSSavePanel sheet ends. +// ------------------------------------------------------------------------------- +- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo +{ + if (returnCode == NSOKButton) { + [[[consoleTextView textStorage] string] writeToFile:[sheet filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; + } +} + +@end + +@implementation SPQueryConsole (PrivateAPI) + +// ------------------------------------------------------------------------------- +// _appendMessageToConsole:withColor: +// +// Appeds the supplied string to the query console, coloring the text using the +// supplied color. +// ------------------------------------------------------------------------------- +- (void)_appendMessageToConsole:(NSString *)message withColor:(NSColor *)color +{ + int begin, end; + + // Set the selected range of the text view to be the very last character + [consoleTextView setSelectedRange:NSMakeRange([[consoleTextView string] length], 0)]; + begin = [[consoleTextView string] length]; + + // Apped the message to the current text storage using the text view's current typing attributes + [[consoleTextView textStorage] appendAttributedString:[[NSAttributedString alloc] initWithString:message attributes:[consoleTextView typingAttributes]]]; + end = [[consoleTextView string] length]; + + // Color the text we just added + [consoleTextView setTextColor:color range:NSMakeRange(begin, (end - begin))]; + + // Scroll to the text we just added + [consoleTextView scrollRangeToVisible:[consoleTextView selectedRange]]; +} + +@end diff --git a/Source/TableContent.h b/Source/TableContent.h index ac7a8249..e0802e3b 100644 --- a/Source/TableContent.h +++ b/Source/TableContent.h @@ -23,19 +23,18 @@ // // More info at - #import #import #import "CMCopyTable.h" #import "CMMCPConnection.h" #import "CMMCPResult.h" - -@interface TableContent : NSObject { - +@interface TableContent : NSObject +{ IBOutlet id tableDocumentInstance; IBOutlet id tablesListInstance; IBOutlet id tableDataInstance; + IBOutlet id queryConsoleInstance; IBOutlet id tableWindow; IBOutlet CMCopyTable *tableContentView; @@ -68,7 +67,6 @@ NSUserDefaults *prefs; int numRows; bool areShowingAllRows; - } //table methods diff --git a/Source/TableContent.m b/Source/TableContent.m index 3baf5713..c2db04c2 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -29,7 +29,7 @@ #import "CMImageView.h" #import "SPDataCellFormatter.h" #import "SPTableData.h" - +#import "SPQueryConsole.h" @implementation TableContent @@ -1183,7 +1183,7 @@ [filteredResult replaceObjectAtIndex:rowIndex withObject:[NSMutableDictionary dictionaryWithDictionary:oldRow]]; isEditingRow = NO; isEditingNewRow = NO; - [tableDocumentInstance showErrorInConsole:[NSString stringWithFormat:NSLocalizedString(@"/* WARNING %@ No rows have been affected */\n", @"warning shown in the console when no rows have been affected after writing to the db"), currentTime]]; + [queryConsoleInstance showErrorInConsole:[NSString stringWithFormat:NSLocalizedString(@"/* WARNING %@ No rows have been affected */\n", @"warning shown in the console when no rows have been affected after writing to the db"), currentTime]]; return YES; // On success... diff --git a/Source/TableDocument.h b/Source/TableDocument.h index 61b770c3..7227f0dd 100644 --- a/Source/TableDocument.h +++ b/Source/TableDocument.h @@ -31,10 +31,9 @@ /** * The TableDocument class controls the primary database view window. */ - @interface TableDocument : NSDocument { - //IBOutlets + // IBOutlets IBOutlet id keyChainInstance; IBOutlet id tablesListInstance; IBOutlet id tableSourceInstance; @@ -43,12 +42,12 @@ IBOutlet id tableDumpInstance; IBOutlet id tableDataInstance; IBOutlet id tableStatusInstance; + IBOutlet id queryConsoleInstance; IBOutlet id tableWindow; IBOutlet id connectSheet; IBOutlet id databaseSheet; IBOutlet id variablesSheet; - IBOutlet id consoleDrawer; IBOutlet id queryProgressBar; IBOutlet id favoritesButton; @@ -64,8 +63,9 @@ IBOutlet id connectProgressBar; IBOutlet id connectProgressStatusText; IBOutlet id databaseNameField; + IBOutlet id databaseEncodingButton; + IBOutlet id addDatabaseButton; IBOutlet id chooseDatabaseButton; - IBOutlet id consoleTextView; IBOutlet id variablesTableView; IBOutlet NSTabView *tableTabView; @@ -126,13 +126,6 @@ - (IBAction)closeDatabaseSheet:(id)sender; - (IBAction)removeDatabase:(id)sender; -//console methods -- (void)toggleConsole:(id)sender; -- (void)clearConsole:(id)sender; -- (BOOL)consoleIsOpened; -- (void)showMessageInConsole:(NSString *)message; -- (void)showErrorInConsole:(NSString *)error; - //encoding methods - (void)setConnectionEncoding:(NSString *)mysqlEncoding reloadingViews:(BOOL)reloadViews; - (NSString *)databaseEncoding; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 6fae3a0b..1e3537b2 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -33,6 +33,7 @@ #import "TableStatus.h" #import "ImageAndTextCell.h" #import "SPGrowlController.h" +#import "SPQueryConsole.h" #import "SPSQLParser.h" #import "SPTableData.h" @@ -503,15 +504,18 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa { int code = 0; - if (![tablesListInstance selectionShouldChangeInTableView:nil]) + if (![tablesListInstance selectionShouldChangeInTableView:nil]) { return; + } [databaseNameField setStringValue:@""]; + [NSApp beginSheet:databaseSheet modalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil]; + code = [NSApp runModalForWindow:databaseSheet]; [NSApp endSheet:databaseSheet]; @@ -522,12 +526,23 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa return; } + // This check is not necessary anymore as the add database button is now only enabled if the name field + // has a length greater than zero. We'll leave it in just in case. if ([[databaseNameField stringValue] isEqualToString:@""]) { NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"Database must have a name.", @"message of panel when no db name is given")); return; } - [mySQLConnection queryString:[NSString stringWithFormat:@"CREATE DATABASE `%@`", [databaseNameField stringValue]]]; + NSString *createStatement = [NSString stringWithFormat:@"CREATE DATABASE `%@`", [databaseNameField stringValue]]; + + // If there is an encoding selected other than the default we must specify it in CREATE DATABASE statement + if ([databaseEncodingButton indexOfSelectedItem] > 0) { + createStatement = [NSString stringWithFormat:@"%@ DEFAULT CHARACTER SET `%@`", createStatement, [self mysqlEncodingFromDisplayEncoding:[databaseEncodingButton title]]]; + } + + // Create the database + [mySQLConnection queryString:createStatement]; + if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { //error while creating db NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't create database.\nMySQL said: %@", @"message of panel when creation of db failed"), [mySQLConnection getLastErrorMessage]]); @@ -572,74 +587,14 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, nil, @selector(sheetDidEnd:returnCode:contextInfo:), @"removedatabase", [NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the database %@?", @"message of panel asking for confirmation for deleting db"), [self database]]); } -#pragma mark console methods +#pragma mark Console methods -//console methods /** - * shows or hides the console + * Shows or hides the console */ - (void)toggleConsole:(id)sender { - if ([self consoleIsOpened]) { - [consoleDrawer close]; - } else { - [consoleTextView scrollRangeToVisible:[consoleTextView selectedRange]]; - [consoleDrawer openOnEdge:NSMinYEdge]; - } -} - -/** - * clears the console - */ -- (void)clearConsole:(id)sender -{ - [consoleTextView setString:@""]; -} - -/** - * returns YES if the console is visible - */ -- (BOOL)consoleIsOpened -{ - return ([consoleDrawer state] == NSDrawerOpeningState || [consoleDrawer state] == NSDrawerOpenState); -} - -/** - * shows a message in the console - */ -- (void)showMessageInConsole:(NSString *)message -{ - int begin, end; - - [consoleTextView setSelectedRange:NSMakeRange([[consoleTextView string] length],0)]; - begin = [[consoleTextView string] length]; - [consoleTextView replaceCharactersInRange:NSMakeRange(begin,0) withString:message]; - end = [[consoleTextView string] length]; - [consoleTextView setTextColor:[NSColor blackColor] range:NSMakeRange(begin,end-begin)]; - - if ([self consoleIsOpened]) { - [consoleTextView displayIfNeeded]; - [consoleTextView scrollRangeToVisible:[consoleTextView selectedRange]]; - } -} - -/** - * shows an error in the console (red) - */ -- (void)showErrorInConsole:(NSString *)error -{ - int begin, end; - - [consoleTextView setSelectedRange:NSMakeRange([[consoleTextView string] length],0)]; - begin = [[consoleTextView string] length]; - [consoleTextView replaceCharactersInRange:NSMakeRange(begin,0) withString:error]; - end = [[consoleTextView string] length]; - [consoleTextView setTextColor:[NSColor redColor] range:NSMakeRange(begin,end-begin)]; - - if ([self consoleIsOpened]) { - [consoleTextView displayIfNeeded]; - [consoleTextView scrollRangeToVisible:[consoleTextView selectedRange]]; - } + [[queryConsoleInstance window] setIsVisible:![[queryConsoleInstance window] isVisible]]; } #pragma mark Encoding Methods @@ -1279,13 +1234,15 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa [toolbarItem setPaletteLabel:NSLocalizedString(@"Show/Hide Console", @"toolbar item for show/hide console")]; //set up tooltip and image [toolbarItem setToolTip:NSLocalizedString(@"Show or hide the console which shows all MySQL commands performed by Sequel Pro", @"tooltip for toolbar item for show/hide console")]; - if ( [self consoleIsOpened] ) { + + if ([[queryConsoleInstance window] isVisible]) { [toolbarItem setLabel:NSLocalizedString(@"Hide Console", @"toolbar item for hide console")]; [toolbarItem setImage:[NSImage imageNamed:@"hideconsole"]]; } else { [toolbarItem setLabel:NSLocalizedString(@"Show Console", @"toolbar item for showconsole")]; [toolbarItem setImage:[NSImage imageNamed:@"showconsole"]]; } + //set up the target action [toolbarItem setTarget:self]; [toolbarItem setAction:@selector(toggleConsole:)]; @@ -1298,7 +1255,7 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa [toolbarItem setToolTip:NSLocalizedString(@"Clear the console which shows all MySQL commands performed by Sequel Pro", @"tooltip for toolbar item for clear console")]; [toolbarItem setImage:[NSImage imageNamed:@"clearconsole"]]; //set up the target action - [toolbarItem setTarget:self]; + [toolbarItem setTarget:queryConsoleInstance]; [toolbarItem setAction:@selector(clearConsole:)]; } else if ([itemIdentifier isEqualToString:@"SwitchToTableStructureToolbarItemIdentifier"]) { @@ -1401,8 +1358,8 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa */ - (BOOL)validateToolbarItem:(NSToolbarItem *)toolbarItem; { - if ( [[toolbarItem itemIdentifier] isEqualToString:@"ToggleConsoleIdentifier"] ) { - if ( [self consoleIsOpened] ) { + if ([[toolbarItem itemIdentifier] isEqualToString:@"ToggleConsoleIdentifier"]) { + if ([[queryConsoleInstance window] isVisible]) { [toolbarItem setLabel:@"Hide Console"]; [toolbarItem setImage:[NSImage imageNamed:@"hideconsole"]]; } else { @@ -1414,12 +1371,12 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa return YES; } +// NSDocument methods -//NSDocument methods -- (NSString *)windowNibName -/* - returns the name of the nib file +/** + * Returns the name of the nib file */ +- (NSString *)windowNibName { return @"DBView"; } @@ -1450,20 +1407,19 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa //set up interface if ( [prefs boolForKey:@"useMonospacedFonts"] ) { - [consoleTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]]; + [[queryConsoleInstance consoleTextView] setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]]; [syntaxViewContent setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]]; while ( (theCol = [theCols nextObject]) ) { [[theCol dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]]; } } else { - [consoleTextView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; + [[queryConsoleInstance consoleTextView] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; [syntaxViewContent setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; while ( (theCol = [theCols nextObject]) ) { [[theCol dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; } } - [consoleDrawer setContentSize:NSMakeSize(110,110)]; //set up toolbar [self setupToolbar]; @@ -1490,29 +1446,28 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa } else { return YES; } - } +#pragma mark SMySQL delegate methods -//SMySQL delegate methods +/** + * Invoked when framework will perform a query + */ - (void)willQueryString:(NSString *)query -/* -invoked when framework will perform a query -*/ { NSString *currentTime = [[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:nil]; - [self showMessageInConsole:[NSString stringWithFormat:@"/* MySQL %@ */ %@;\n", currentTime, query]]; + [queryConsoleInstance showMessageInConsole:[NSString stringWithFormat:@"/* MySQL %@ */ %@;\n", currentTime, query]]; } +/** + * Invoked when query gave an error + */ - (void)queryGaveError:(NSString *)error -/* -invoked when query gave an error -*/ { NSString *currentTime = [[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:nil]; - [self showErrorInConsole:[NSString stringWithFormat:@"/* ERROR %@ */ %@;\n", currentTime, error]]; + [queryConsoleInstance showErrorInConsole:[NSString stringWithFormat:@"/* ERROR %@ */ %@;\n", currentTime, error]]; } #pragma mark Connection sheet delegate methods @@ -1529,6 +1484,9 @@ invoked when query gave an error || [aNotification object] == socketField || [aNotification object] == portField) { [favoritesController setSelectionIndexes:[NSIndexSet indexSet]]; } + else if ([aNotification object] == databaseNameField) { + [addDatabaseButton setEnabled:([[databaseNameField stringValue] length] > 0)]; + } } #pragma mark SplitView delegate methods diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index b218578b..74a1b7e0 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 170088CE0F5870E200DD6B51 /* SPQueryConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = 170088CD0F5870E200DD6B51 /* SPQueryConsole.m */; }; 1761FD480EF03A6F00331368 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1761FD460EF03A6F00331368 /* MainMenu.xib */; }; 1789343C0F30C1DD0097539A /* SPStringAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1789343B0F30C1DD0097539A /* SPStringAdditions.m */; }; 17E641460EF01EB5001BC333 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E641440EF01EB5001BC333 /* main.m */; }; @@ -120,6 +121,8 @@ /* Begin PBXFileReference section */ 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 170088CC0F5870E200DD6B51 /* SPQueryConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPQueryConsole.h; sourceTree = ""; }; + 170088CD0F5870E200DD6B51 /* SPQueryConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPQueryConsole.m; sourceTree = ""; }; 1703EF2B0F0B0742005BBE7E /* bar.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = bar.gif; sourceTree = ""; }; 1703EF2C0F0B0742005BBE7E /* english_help idx */ = {isa = PBXFileReference; lastKnownFileType = file; path = "english_help idx"; sourceTree = ""; }; 1703EF2D0F0B0742005BBE7E /* icon.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = icon.gif; sourceTree = ""; }; @@ -394,6 +397,8 @@ 17E641550EF01EF6001BC333 /* TableSource.m */, 58FEF57C0F3B4E9700518E8E /* SPTableData.h */, 58FEF57D0F3B4E9700518E8E /* SPTableData.m */, + 170088CC0F5870E200DD6B51 /* SPQueryConsole.h */, + 170088CD0F5870E200DD6B51 /* SPQueryConsole.m */, ); name = Controllers; sourceTree = ""; @@ -747,6 +752,7 @@ 1789343C0F30C1DD0097539A /* SPStringAdditions.m in Sources */, 58FEF57E0F3B4E9700518E8E /* SPTableData.m in Sources */, 58C56EF50F438E120035701E /* SPDataCellFormatter.m in Sources */, + 170088CE0F5870E200DD6B51 /* SPQueryConsole.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- cgit v1.2.3