From b4a5f241c7a6adfdf1b8f4afb94f8d8c57a5c0a9 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 30 Nov 2010 02:24:42 +0000 Subject: - Rework insertCommonPrefix to insertAutocompletePlaceholder, implementing a more Mac-like behaviour: insert a faded placeholder for the currently selected autocomplete item. - Update the autocomplete placeholder when the autocomplete dropdown selection is changed - Clean up methods for removing placeholders, and ensure the placeholder is always removed (fixes issues with pasting with a placeholder visible, etc) - When the Help window is closed, switch off AutoHelp - this will aid in supporting those users who accidentally switch on AutoHelp and then can't figure out how to switch it off, resulting in returning windows. --- Interfaces/English.lproj/DBView.xib | 1178 ++++++----------------------------- Source/SPCustomQuery.m | 16 + Source/SPNarrowDownCompletion.h | 5 +- Source/SPNarrowDownCompletion.m | 117 ++-- Source/SPTextView.m | 2 +- 5 files changed, 267 insertions(+), 1051 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index d9a07f9b..d8df8add 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -23,13 +23,12 @@ YES - YES com.brandonwalkin.BWToolkit - com.apple.WebKitIBPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin PluginDependencyRecalculationVersion @@ -86,6 +85,7 @@ 290 {{5, 2}, {204, 19}} + YES 343014976 @@ -178,6 +178,7 @@ 4362 {218, 38} + YES @@ -222,7 +223,7 @@ controlColor 3 - MC42NjY2NjY2ODY1AA + MC42NjY2NjY2NjY3AA @@ -267,6 +268,7 @@ {{1, 1}, {218, 38}} + @@ -282,6 +284,7 @@ -2147483392 {{-100, -100}, {15, 8}} + _doScroller: 0.42105263471603394 @@ -291,6 +294,7 @@ -2147483392 {{-100, -100}, {223, 15}} + 1 _doScroller: @@ -299,6 +303,7 @@ {{-1, -13}, {220, 40}} + 2 @@ -309,6 +314,7 @@ {214, 26} + NSView @@ -331,6 +337,7 @@ 4352 {214, 354} + YES @@ -397,6 +404,7 @@ {214, 354} + @@ -407,6 +415,7 @@ -2147483392 {{197, 0}, {15, 292}} + _doScroller: 0.096045196056365967 @@ -417,6 +426,7 @@ -2147483392 {{-100, -100}, {141, 11}} + 257 _doScroller: @@ -425,6 +435,7 @@ {214, 354} + 528 @@ -435,11 +446,13 @@ {{0, 27}, {214, 354}} + NSView {214, 381} + 2 6 @@ -473,6 +486,7 @@ {214, 381} + NSView @@ -495,6 +509,7 @@ 4352 {214, 145} + YES @@ -537,15 +552,7 @@ 3 2 - - 6 - System - _sourceListBackgroundColor - - 1 - MC44MzkyMTU2OTU5IDAuODY2NjY2Njc0NiAwLjg5ODAzOTIyMTgAA - - + 17 1379926016 @@ -561,6 +568,7 @@ {214, 145} + @@ -571,6 +579,7 @@ -2147483392 {{-100, -100}, {15, 20}} + _doScroller: 0.48965516686439514 @@ -581,7 +590,7 @@ -2147483392 {{-100, -100}, {141, 11}} - YES + 257 _doScroller: @@ -590,8 +599,9 @@ {214, 145} + - 672 + 544 @@ -612,6 +622,7 @@ 4352 {214, 145} + YES @@ -678,6 +689,7 @@ {214, 145} + @@ -688,6 +700,7 @@ -2147483392 {{-100, -100}, {15, 20}} + _doScroller: 0.48965516686439514 @@ -698,6 +711,7 @@ -2147483392 {{-100, -100}, {141, 11}} + 257 _doScroller: @@ -706,6 +720,7 @@ {214, 145} + 512 @@ -716,11 +731,13 @@ {{0, 382}, {214, 145}} + NSView {{0, 23}, {214, 527}} + 2 NO @@ -771,6 +788,7 @@ 268 {{-1, -1}, {32, 24}} + YES 67239424 @@ -795,6 +813,7 @@ 268 {{30, -1}, {32, 24}} + YES 71433792 @@ -992,6 +1011,7 @@ 268 {{61, -1}, {32, 24}} + YES 67239424 @@ -1016,6 +1036,7 @@ 268 {{92, -1}, {32, 24}} + YES -2080244224 @@ -1042,6 +1063,7 @@ {{0, 1}, {214, 23}} + YES YES NO @@ -1050,6 +1072,7 @@ {214, 550} + NSView @@ -1062,6 +1085,7 @@ 274 {{-7, -10}, {741, 564}} + YES @@ -1086,6 +1110,7 @@ 289 {{662, -1}, {32, 24}} + YES 71433792 @@ -1193,6 +1218,7 @@ -2147483356 {{124, -1}, {33, 25}} + YES -2080244224 @@ -1227,12 +1253,14 @@ 4352 {694, 289} + YES 256 {694, 17} + @@ -1240,6 +1268,7 @@ -2147483392 {{-26, 0}, {16, 17}} + YES @@ -1793,6 +1822,7 @@ {{1, 17}, {694, 289}} + @@ -1803,6 +1833,7 @@ -2147483392 {{674, 17}, {15, 274}} + _doScroller: 0.9480968713760376 @@ -1812,6 +1843,7 @@ -2147483392 {{1, 291}, {694, 15}} + 1 _doScroller: @@ -1827,6 +1859,7 @@ {{1, 0}, {694, 17}} + @@ -1836,6 +1869,7 @@ {{-1, 22}, {696, 307}} + 562 @@ -1850,6 +1884,7 @@ 292 {{-1, -1}, {32, 25}} + YES -1543373312 @@ -1874,6 +1909,7 @@ 292 {{93, -1}, {32, 25}} + YES -2080244224 @@ -1898,6 +1934,7 @@ 292 {{30, -1}, {32, 25}} + YES -1543373312 @@ -1922,6 +1959,7 @@ 292 {{61, -1}, {32, 25}} + YES -1543373312 @@ -1958,6 +1996,7 @@ {{125, 0}, {507, 23}} + YES 130560 @@ -1978,6 +2017,7 @@ 289 {{632, -1}, {32, 25}} + YES -1543373312 @@ -2000,6 +2040,7 @@ {695, 329} + NSView @@ -2017,6 +2058,7 @@ 268 {{3, 3}, {49, 14}} + YES 68288064 @@ -2055,6 +2097,7 @@ {{678, 4}, {10, 13}} + YES 130560 @@ -2073,6 +2116,7 @@ {{0, 181}, {695, 20}} + 1 MC42NzU3Njg0OTQ2IDAuNzIxOTQ4MTQ2OCAwLjc2NTMwNjExNTIAA @@ -2115,12 +2159,14 @@ 4352 {694, 140} + YES 256 {694, 17} + @@ -2128,6 +2174,7 @@ -2147483392 {{-26, 0}, {16, 17}} + YES @@ -2383,6 +2430,7 @@ {{1, 17}, {694, 140}} + @@ -2393,6 +2441,7 @@ -2147483392 {{611, 17}, {15, 126}} + _doScroller: 0.97794115543365479 @@ -2402,6 +2451,7 @@ -2147483392 {{1, 143}, {610, 15}} + 1 _doScroller: @@ -2416,6 +2466,7 @@ {{1, 0}, {694, 17}} + @@ -2425,6 +2476,7 @@ {{-1, 23}, {696, 158}} + 562 @@ -2439,6 +2491,7 @@ 292 {{-1, 0}, {32, 25}} + YES -1543373312 @@ -2460,6 +2513,7 @@ 292 {{61, 0}, {32, 25}} + YES -2080244224 @@ -2481,6 +2535,7 @@ 292 {{30, 0}, {32, 25}} + YES -1543373312 @@ -2514,6 +2569,7 @@ {{93, 1}, {602, 23}} + YES 130560 @@ -2529,16 +2585,19 @@ {{0, 330}, {695, 201}} + NSView {{7, 10}, {695, 531}} + 2 {{10, 7}, {706, 544}} + Structure @@ -6299,11 +6358,13 @@ {{215, 0}, {729, 550}} + NSView {{0, -1}, {944, 550}} + YES 2 DBViewSplitter @@ -6311,6 +6372,7 @@ {943, 549} + NSView @@ -7033,7 +7095,7 @@ View - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {213, 107} @@ -7187,7 +7249,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1440, 878}} {213, 129} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 7 @@ -7197,7 +7259,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 Reset Auto Increment NSWindow - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {255, 95} @@ -7360,7 +7422,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1280, 1002}} {255, 117} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 1 @@ -7370,7 +7432,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 New Relation NSPanel - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 256 @@ -7971,7 +8033,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {302, 307} {{0, 0}, {1440, 878}} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 9 @@ -7981,7 +8043,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 New Trigger NSPanel - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {360, 348} @@ -8388,7 +8450,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1680, 1028}} {360, 370} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 3 @@ -8400,7 +8462,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 View - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {213, 50} @@ -8520,7 +8582,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1920, 1178}} {213, 72} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 9 @@ -8532,7 +8594,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 View - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {213, 107} @@ -8667,7 +8729,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1440, 878}} {213, 129} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 15 @@ -8679,7 +8741,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 View - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {350, 200} @@ -8902,7 +8964,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1680, 1028}} {350, 222} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} SPCreateSyntaxSheet @@ -8915,7 +8977,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 View - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {213, 107} @@ -9085,7 +9147,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1440, 878}} {213, 129} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 31 @@ -9095,7 +9157,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 MySQL Help NSPanel - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {351, 120} @@ -9493,7 +9555,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1280, 1002}} {351, 136} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} MYSQL_HELP_WINDOW @@ -9504,7 +9566,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 Filter NSPanel - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {380, 170} @@ -10149,7 +10211,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1280, 778}} {380, 192} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} SPTableFilterPanel @@ -10649,7 +10711,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA Secure Text Input Sheet NSPanel - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 256 @@ -10753,7 +10815,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA {338, 150} {{0, 0}, {1280, 778}} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} @@ -10936,7 +10998,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA disabledControlTextColor 3 - MC4zMzMzMzMzNDMzAA + MC4zMzMzMzMzMzMzAA @@ -16372,6 +16434,14 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA 7714 + + + delegate + + + + 7715 + @@ -25601,7 +25671,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{323, 184}, {943, 549}} + {{59, 184}, {943, 549}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -26107,7 +26177,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA - 7714 + 7715 @@ -26154,6 +26224,13 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA + + NSMenu + + IBProjectSource + Source/SPMenuAdditions.h + + NSObject @@ -27097,8 +27174,6 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA customQueryInstance errorsSheet errorsView - importCSVBox - importCSVView importEncodingPopup importFieldMapperSheetWindow importFieldNamesSwitch @@ -27110,6 +27185,9 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA importFromClipboardSheet importFromClipboardTextView importLinesTerminatedField + importSQLErrorHandlingPopup + importTabView + importView multiCSVFullStreamingSwitch multiXMLFullStreamingSwitch singleProgressBar @@ -27134,8 +27212,6 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA id id id - id - id NSPopUpButton id id @@ -27147,6 +27223,9 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA id NSTextView id + NSPopUpButton + id + id id id id @@ -27174,8 +27253,6 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA customQueryInstance errorsSheet errorsView - importCSVBox - importCSVView importEncodingPopup importFieldMapperSheetWindow importFieldNamesSwitch @@ -27187,6 +27264,9 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA importFromClipboardSheet importFromClipboardTextView importLinesTerminatedField + importSQLErrorHandlingPopup + importTabView + importView multiCSVFullStreamingSwitch multiXMLFullStreamingSwitch singleProgressBar @@ -27235,14 +27315,6 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA errorsView id - - importCSVBox - id - - - importCSVView - id - importEncodingPopup NSPopUpButton @@ -27287,6 +27359,18 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA importLinesTerminatedField id + + importSQLErrorHandlingPopup + NSPopUpButton + + + importTabView + id + + + importView + id + multiCSVFullStreamingSwitch id @@ -27401,6 +27485,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA import: importFromClipboard: openCurrentConnectionInNewWindow: + openDatabaseInNewTab: optimizeTable: refreshTables: removeDatabase: @@ -27465,6 +27550,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA id id id + id @@ -27496,6 +27582,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA import: importFromClipboard: openCurrentConnectionInNewWindow: + openDatabaseInNewTab: optimizeTable: refreshTables: removeDatabase: @@ -27617,6 +27704,10 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA openCurrentConnectionInNewWindow: id + + openDatabaseInNewTab: + id + optimizeTable: id @@ -30365,17 +30456,25 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA YES YES + activitiesScrollView + activitiesTable + containerView infoTable tableDataInstance tableDocumentInstance + tableInfoScrollView tableList tableListInstance YES + NSScrollView + NSTableView + NSView id id id + NSScrollView id id @@ -30384,14 +30483,30 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA YES YES + activitiesScrollView + activitiesTable + containerView infoTable tableDataInstance tableDocumentInstance + tableInfoScrollView tableList tableListInstance YES + + activitiesScrollView + NSScrollView + + + activitiesTable + NSTableView + + + containerView + NSView + infoTable id @@ -30404,6 +30519,10 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA tableDocumentInstance id + + tableInfoScrollView + NSScrollView + tableList id @@ -31594,35 +31713,14 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA SPTextView NSTextView - YES - - YES - executeBundleItemForEditor: - showMySQLHelpForCurrentWord: - - - YES - id - id - + showMySQLHelpForCurrentWord: + id - YES - - YES - executeBundleItemForEditor: - showMySQLHelpForCurrentWord: - - - YES - - executeBundleItemForEditor: - id - - - showMySQLHelpForCurrentWord: - id - + showMySQLHelpForCurrentWord: + + showMySQLHelpForCurrentWord: + id @@ -31685,926 +31783,6 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA - - YES - - SPDatabaseDocument - NSObject - - YES - - YES - addConnectionToFavorites: - addDatabase: - analyzeTable: - backForwardInHistory: - cancelTask: - checkTable: - checksumTable: - chooseDatabase: - chooseEncoding: - closePanelSheet: - closePasswordSheet: - closeSheet: - copyChecksumFromSheet: - copyCreateTableSyntax: - copyCreateTableSyntaxFromSheet: - copyDatabase: - export: - exportSelectedTablesAs: - flushPrivileges: - flushTable: - focusOnTableContentFilter: - focusOnTableListFilter: - import: - importFromClipboard: - openCurrentConnectionInNewWindow: - openDatabaseInNewTab: - optimizeTable: - refreshTables: - removeDatabase: - renameDatabase: - repairTable: - saveConnectionSheet: - saveCreateSyntax: - setDatabases: - showConsole: - showCreateTableSyntax: - showMySQLHelp: - showNavigator: - showServerProcesses: - showServerVariables: - showUserManager: - toggleNavigator: - updateWindowTitle: - validateSaveConnectionAccessory: - - - YES - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - - - - YES - - YES - addConnectionToFavorites: - addDatabase: - analyzeTable: - backForwardInHistory: - cancelTask: - checkTable: - checksumTable: - chooseDatabase: - chooseEncoding: - closePanelSheet: - closePasswordSheet: - closeSheet: - copyChecksumFromSheet: - copyCreateTableSyntax: - copyCreateTableSyntaxFromSheet: - copyDatabase: - export: - exportSelectedTablesAs: - flushPrivileges: - flushTable: - focusOnTableContentFilter: - focusOnTableListFilter: - import: - importFromClipboard: - openCurrentConnectionInNewWindow: - openDatabaseInNewTab: - optimizeTable: - refreshTables: - removeDatabase: - renameDatabase: - repairTable: - saveConnectionSheet: - saveCreateSyntax: - setDatabases: - showConsole: - showCreateTableSyntax: - showMySQLHelp: - showNavigator: - showServerProcesses: - showServerVariables: - showUserManager: - toggleNavigator: - updateWindowTitle: - validateSaveConnectionAccessory: - - - YES - - addConnectionToFavorites: - id - - - addDatabase: - id - - - analyzeTable: - id - - - backForwardInHistory: - id - - - cancelTask: - id - - - checkTable: - id - - - checksumTable: - id - - - chooseDatabase: - id - - - chooseEncoding: - id - - - closePanelSheet: - id - - - closePasswordSheet: - id - - - closeSheet: - id - - - copyChecksumFromSheet: - id - - - copyCreateTableSyntax: - id - - - copyCreateTableSyntaxFromSheet: - id - - - copyDatabase: - id - - - export: - id - - - exportSelectedTablesAs: - id - - - flushPrivileges: - id - - - flushTable: - id - - - focusOnTableContentFilter: - id - - - focusOnTableListFilter: - id - - - import: - id - - - importFromClipboard: - id - - - openCurrentConnectionInNewWindow: - id - - - openDatabaseInNewTab: - id - - - optimizeTable: - id - - - refreshTables: - id - - - removeDatabase: - id - - - renameDatabase: - id - - - repairTable: - id - - - saveConnectionSheet: - id - - - saveCreateSyntax: - id - - - setDatabases: - id - - - showConsole: - id - - - showCreateTableSyntax: - id - - - showMySQLHelp: - id - - - showNavigator: - id - - - showServerProcesses: - id - - - showServerVariables: - id - - - showUserManager: - id - - - toggleNavigator: - id - - - updateWindowTitle: - id - - - validateSaveConnectionAccessory: - id - - - - - YES - - YES - addDatabaseButton - chooseDatabaseButton - connectionErrorDialog - contentViewSplitter - copyDatabaseButton - copyDatabaseDataButton - copyDatabaseMessageField - createTableSyntaxTextField - createTableSyntaxTextView - createTableSyntaxWindow - customQueryInstance - customQueryTextView - databaseCopyNameField - databaseCopySheet - databaseDataInstance - databaseEncodingButton - databaseNameField - databaseRenameNameField - databaseRenameSheet - databaseSheet - dbTablesTableView - encodingPopUp - exportControllerInstance - extendedTableInfoInstance - favoritesButton - historyControl - inputTextWindow - inputTextWindowHeader - inputTextWindowMessage - inputTextWindowSecureTextField - listFilterField - parentView - queryProgressBar - renameDatabaseButton - renameDatabaseMessageField - saveConnectionAccessory - saveConnectionAutoConnect - saveConnectionEncrypt - saveConnectionEncryptString - saveConnectionIncludeData - saveConnectionIncludeQuery - saveConnectionSavePassword - saveConnectionSavePasswordAlert - sidebarGrabber - spHistoryControllerInstance - statusTableAccessoryView - statusTableCopyChecksum - statusTableView - statusValues - tableContentInstance - tableDataInstance - tableDumpInstance - tableInfoCollapseButton - tableInfoTable - tableListSplitter - tableRelationsInstance - tableSourceInstance - tableTabView - tableTriggersInstance - tablesListInstance - taskCancelButton - taskCancellationCallbackObject - taskDescriptionText - taskProgressIndicator - taskProgressLayer - titleAccessoryView - titleImageView - titleStringView - - - YES - id - id - NSWindow - NSSplitView - id - id - id - NSTextField - NSTextView - NSWindow - id - NSTextView - id - id - id - id - id - id - id - id - NSTableView - NSPopUpButton - id - id - id - id - id - id - id - id - NSSearchField - NSView - id - id - id - id - id - id - NSSecureTextField - id - id - id - id - id - id - id - id - id - id - id - id - id - NSButton - NSTableView - NSSplitView - id - id - NSTabView - id - id - NSButton - id - id - id - NSBox - id - id - id - - - - YES - - YES - addDatabaseButton - chooseDatabaseButton - connectionErrorDialog - contentViewSplitter - copyDatabaseButton - copyDatabaseDataButton - copyDatabaseMessageField - createTableSyntaxTextField - createTableSyntaxTextView - createTableSyntaxWindow - customQueryInstance - customQueryTextView - databaseCopyNameField - databaseCopySheet - databaseDataInstance - databaseEncodingButton - databaseNameField - databaseRenameNameField - databaseRenameSheet - databaseSheet - dbTablesTableView - encodingPopUp - exportControllerInstance - extendedTableInfoInstance - favoritesButton - historyControl - inputTextWindow - inputTextWindowHeader - inputTextWindowMessage - inputTextWindowSecureTextField - listFilterField - parentView - queryProgressBar - renameDatabaseButton - renameDatabaseMessageField - saveConnectionAccessory - saveConnectionAutoConnect - saveConnectionEncrypt - saveConnectionEncryptString - saveConnectionIncludeData - saveConnectionIncludeQuery - saveConnectionSavePassword - saveConnectionSavePasswordAlert - sidebarGrabber - spHistoryControllerInstance - statusTableAccessoryView - statusTableCopyChecksum - statusTableView - statusValues - tableContentInstance - tableDataInstance - tableDumpInstance - tableInfoCollapseButton - tableInfoTable - tableListSplitter - tableRelationsInstance - tableSourceInstance - tableTabView - tableTriggersInstance - tablesListInstance - taskCancelButton - taskCancellationCallbackObject - taskDescriptionText - taskProgressIndicator - taskProgressLayer - titleAccessoryView - titleImageView - titleStringView - - - YES - - addDatabaseButton - id - - - chooseDatabaseButton - id - - - connectionErrorDialog - NSWindow - - - contentViewSplitter - NSSplitView - - - copyDatabaseButton - id - - - copyDatabaseDataButton - id - - - copyDatabaseMessageField - id - - - createTableSyntaxTextField - NSTextField - - - createTableSyntaxTextView - NSTextView - - - createTableSyntaxWindow - NSWindow - - - customQueryInstance - id - - - customQueryTextView - NSTextView - - - databaseCopyNameField - id - - - databaseCopySheet - id - - - databaseDataInstance - id - - - databaseEncodingButton - id - - - databaseNameField - id - - - databaseRenameNameField - id - - - databaseRenameSheet - id - - - databaseSheet - id - - - dbTablesTableView - NSTableView - - - encodingPopUp - NSPopUpButton - - - exportControllerInstance - id - - - extendedTableInfoInstance - id - - - favoritesButton - id - - - historyControl - id - - - inputTextWindow - id - - - inputTextWindowHeader - id - - - inputTextWindowMessage - id - - - inputTextWindowSecureTextField - id - - - listFilterField - NSSearchField - - - parentView - NSView - - - queryProgressBar - id - - - renameDatabaseButton - id - - - renameDatabaseMessageField - id - - - saveConnectionAccessory - id - - - saveConnectionAutoConnect - id - - - saveConnectionEncrypt - id - - - saveConnectionEncryptString - NSSecureTextField - - - saveConnectionIncludeData - id - - - saveConnectionIncludeQuery - id - - - saveConnectionSavePassword - id - - - saveConnectionSavePasswordAlert - id - - - sidebarGrabber - id - - - spHistoryControllerInstance - id - - - statusTableAccessoryView - id - - - statusTableCopyChecksum - id - - - statusTableView - id - - - statusValues - id - - - tableContentInstance - id - - - tableDataInstance - id - - - tableDumpInstance - id - - - tableInfoCollapseButton - NSButton - - - tableInfoTable - NSTableView - - - tableListSplitter - NSSplitView - - - tableRelationsInstance - id - - - tableSourceInstance - id - - - tableTabView - NSTabView - - - tableTriggersInstance - id - - - tablesListInstance - id - - - taskCancelButton - NSButton - - - taskCancellationCallbackObject - id - - - taskDescriptionText - id - - - taskProgressIndicator - id - - - taskProgressLayer - NSBox - - - titleAccessoryView - id - - - titleImageView - id - - - titleStringView - id - - - - - IBDocumentRelativeSource - ../../Source/SPDatabaseDocument.h - - - - SPTableInfo - NSObject - - YES - - YES - activitiesScrollView - activitiesTable - containerView - infoTable - tableDataInstance - tableDocumentInstance - tableInfoScrollView - tableList - tableListInstance - - - YES - NSScrollView - NSTableView - NSView - id - id - id - NSScrollView - id - id - - - - YES - - YES - activitiesScrollView - activitiesTable - containerView - infoTable - tableDataInstance - tableDocumentInstance - tableInfoScrollView - tableList - tableListInstance - - - YES - - activitiesScrollView - NSScrollView - - - activitiesTable - NSTableView - - - containerView - NSView - - - infoTable - id - - - tableDataInstance - id - - - tableDocumentInstance - id - - - tableInfoScrollView - NSScrollView - - - tableList - id - - - tableListInstance - id - - - - - IBDocumentRelativeSource - ../../Source/SPTableInfo.h - - - YES diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index f590de42..415bf2fa 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -3126,6 +3126,22 @@ return webViewMenuItems; } +/** + * Detect when the help window is closed (manually) and disable autohelp to ensure it + * isn't reopened on keypresses. + */ +- (BOOL)windowShouldClose:(id)sender +{ + if (sender == helpWebViewWindow) { + [prefs setBool:NO forKey:SPCustomQueryUpdateAutoHelp]; + [prefs synchronize]; + [autohelpMenuItem setState:NSOffState]; + [textView setAutohelp:NO]; + } + + return YES; +} + #pragma mark - #pragma mark Query favorites manager delegate methods diff --git a/Source/SPNarrowDownCompletion.h b/Source/SPNarrowDownCompletion.h index a158926e..b5c52f04 100644 --- a/Source/SPNarrowDownCompletion.h +++ b/Source/SPNarrowDownCompletion.h @@ -48,7 +48,7 @@ BOOL autoCompletionMode; BOOL oneColumnMode; BOOL isQueryingDatabaseStructure; - BOOL commonPrefixWasInsertedByAutoComplete; + BOOL autocompletePlaceholderWasInserted; NSMutableString *originalFilterString; NSInteger backtickMode; NSFont *tableFont; @@ -81,7 +81,8 @@ isQueryingDBStructure:(BOOL)isQueryingDBStructure; - (void)setCaretPos:(NSPoint)aPos; - (void)insert_text:(NSString* )aString; -- (void)insertCommonPrefix; +- (void)insertAutocompletePlaceholder; +- (void)removeAutocompletionPlaceholder; - (void)adjustWorkingRangeByDelta:(NSInteger)delta; - (void)updateSyncArrowStatus; diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index d83f78c5..a960e74a 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -35,6 +35,12 @@ #import "RegexKitLite.h" #import "SPTextView.h" +#pragma mark - +#pragma mark attribute definition + +#define kSPAutoCompletePlaceholderName @"Placeholder" +#define kSPAutoCompletePlaceholderVal @"placholder" + @interface NSTableView (MovingSelectedRow) - (BOOL)SP_NarrowDownCompletion_canHandleEvent:(NSEvent*)anEvent; @@ -47,7 +53,7 @@ - (NSString*)filterString; - (void)setupInterface; - (void)filter; -- (void)insertCommonPrefix; +- (void)insertAutocompletePlaceholder; - (void)completeAndInsertSnippet; @end @@ -86,6 +92,7 @@ [self selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; } [self scrollRowToVisible:row]; + [[self delegate] insertAutocompletePlaceholder]; return YES; } } @@ -115,7 +122,7 @@ currentSyncImage = 0; staticPrefix = nil; suggestions = nil; - commonPrefixWasInsertedByAutoComplete = NO; + autocompletePlaceholderWasInserted = NO; prefs = [NSUserDefaults standardUserDefaults]; originalFilterString = [[NSMutableString alloc] init]; [originalFilterString setString:@""]; @@ -794,14 +801,11 @@ if (([event modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask)) == NSAlternateKeyMask || [[event characters] length] == 0) { if(autoCompletionMode) { - if(commonPrefixWasInsertedByAutoComplete) { - [theView setSelectedRange:theCharRange]; - [theView insertText:originalFilterString]; - [theView setCompletionIsOpen:NO]; - [self close]; - [NSApp sendEvent:event]; - break; - } + if (autocompletePlaceholderWasInserted) [self removeAutocompletionPlaceholder]; + [theView setCompletionIsOpen:NO]; + [self close]; + [NSApp sendEvent:event]; + break; } [NSApp sendEvent: event]; @@ -826,10 +830,7 @@ [self filter]; } else { if(autoCompletionMode) { - if(commonPrefixWasInsertedByAutoComplete) { - [theView setSelectedRange:theCharRange]; - [theView insertText:originalFilterString]; - } + if (autocompletePlaceholderWasInserted) [self removeAutocompletionPlaceholder]; [theView setCompletionIsOpen:NO]; [self close]; break; @@ -845,10 +846,7 @@ else if(key == NSBackspaceCharacter || key == NSDeleteCharacter) { if(autoCompletionMode) { - if(commonPrefixWasInsertedByAutoComplete) { - [theView setSelectedRange:theCharRange]; - [theView insertText:originalFilterString]; - } + if (autocompletePlaceholderWasInserted) [self removeAutocompletionPlaceholder]; [NSApp sendEvent:event]; break; } @@ -868,10 +866,7 @@ if(autoCompletionMode) { [theView setCompletionIsOpen:NO]; [self close]; - if(commonPrefixWasInsertedByAutoComplete) { - [theView setSelectedRange:theCharRange]; - [theView insertText:originalFilterString]; - } + if (autocompletePlaceholderWasInserted) [self removeAutocompletionPlaceholder]; [NSApp sendEvent:event]; return; } @@ -887,7 +882,7 @@ theCharRange.length++; theParseRange.length++; [self filter]; - [self insertCommonPrefix]; + [self insertAutocompletePlaceholder]; } else @@ -904,10 +899,7 @@ } else { if(!NSPointInRect([NSEvent mouseLocation], [self frame])) { if(autoCompletionMode) { - if(commonPrefixWasInsertedByAutoComplete) { - [theView setSelectedRange:theCharRange]; - [theView insertText:originalFilterString]; - } + if (autocompletePlaceholderWasInserted) [self removeAutocompletionPlaceholder]; } if(cursorMovedLeft) [theView performSelector:@selector(moveRight:)]; [NSApp sendEvent:event]; @@ -921,6 +913,34 @@ [NSApp sendEvent:event]; } } + + // If the autocomplete menu is open, but the placeholder is still present, it needs removing. + if (autoCompletionMode && autocompletePlaceholderWasInserted) { + [[theView textStorage] beginEditing]; + NSRange attributeResultRange; + while (1) { + attributeResultRange = NSMakeRange(NSNotFound, 0); + if ([[theView textStorage] attribute:kSPAutoCompletePlaceholderName atIndex:0 longestEffectiveRange:&attributeResultRange inRange:NSMakeRange(0, [[theView textStorage] length])]) { + + // A match was found - attributeResultRange contains the range of the attributed string + [[theView textStorage] deleteCharactersInRange:attributeResultRange]; + } else { + + // No match was found. attributeResultRange contains the range of the no match - this can be + // checked to see whether a match is inside the full range. + if (attributeResultRange.length == [[theView textStorage] length]) break; + + // A match was found - retrieve the location + NSUInteger matchStart = attributeResultRange.location+attributeResultRange.length; + if ([[theView textStorage] attribute:kSPAutoCompletePlaceholderName atIndex:matchStart longestEffectiveRange:&attributeResultRange inRange:NSMakeRange(matchStart, [[theView textStorage] length] - matchStart)]) { + [[theView textStorage] deleteCharactersInRange:attributeResultRange]; + } + } + } + [[theView textStorage] endEditing]; + autocompletePlaceholderWasInserted = NO; + } + [theView setCompletionIsOpen:NO]; [self close]; usleep(70); // tiny delay to suppress while continously pressing of ESC overlapping @@ -929,49 +949,50 @@ // ================== // = Action methods = // ================== -- (void)insertCommonPrefix +- (void)insertAutocompletePlaceholder { - if([theTableView selectedRow] == -1 || fuzzyMode) return; - id cur = [filtered objectAtIndex:0]; + // Clear any current placeholder + if (autocompletePlaceholderWasInserted) [self removeAutocompletionPlaceholder]; - if([cur objectForKey:@"noCompletion"]) return; + // Select the highlighted item in the list of suggestions + id cur = [filtered objectAtIndex:[theTableView selectedRow]]; + // Ensure it's a valid suggestion and extract the string + if ([cur objectForKey:@"noCompletion"]) return; NSString* curMatch = [cur objectForKey:@"match"] ?: [cur objectForKey:@"display"]; + if (![curMatch length]) return; - if(![curMatch length]) return; - - NSMutableString *commonPrefix = [NSMutableString string]; - [commonPrefix setString:curMatch]; - for(id candidate in filtered) { - NSString* candidateMatch; - candidateMatch = [candidate objectForKey:@"match"] ?: [candidate objectForKey:@"display"]; - NSString *tempPrefix = [candidateMatch commonPrefixWithString:commonPrefix options:NSCaseInsensitiveSearch]; - // if(![tempPrefix length]) break; - if([commonPrefix length] > [tempPrefix length]) - [commonPrefix setString:tempPrefix]; - } - - // Insert common prefix automatically - if([[self filterString] length] < [commonPrefix length]) { + // Insert a placeholder for the string in the textview + if ([originalFilterString length] < [curMatch length]) { NSUInteger currentSelectionPosition = [theView selectedRange].location; - NSString* toInsert = [commonPrefix substringFromIndex:[[self filterString] length]]; + NSString* toInsert = [curMatch substringFromIndex:[originalFilterString length]]; [mutablePrefix appendString:toInsert]; theCharRange.length += [toInsert length]; theParseRange.length += [toInsert length]; [theView insertText:[toInsert lowercaseString]]; - commonPrefixWasInsertedByAutoComplete = YES; + autocompletePlaceholderWasInserted = YES; // Restore the text selection location, and clearly mark the autosuggested text [theView setSelectedRange:NSMakeRange(currentSelectionPosition, 0)]; NSMutableAttributedStringAddAttributeValueRange([theView textStorage], NSForegroundColorAttributeName, [[theView otherTextColor] colorWithAlphaComponent:0.3], NSMakeRange(currentSelectionPosition, [toInsert length])); + NSMutableAttributedStringAddAttributeValueRange([theView textStorage], kSPAutoCompletePlaceholderName, kSPAutoCompletePlaceholderVal, NSMakeRange(currentSelectionPosition, [toInsert length])); [self checkSpaceForAllowedCharacter]; } } +- (void)removeAutocompletionPlaceholder +{ + if (!autocompletePlaceholderWasInserted) return; + + [theView setSelectedRange:theCharRange]; + [theView insertText:originalFilterString]; + autocompletePlaceholderWasInserted = NO; +} + - (void)insert_text:(NSString* )aString { diff --git a/Source/SPTextView.m b/Source/SPTextView.m index 85d2623a..ab37f464 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -852,7 +852,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) [completionPopup setCaretPos:pos]; [completionPopup orderFront:self]; - [completionPopup insertCommonPrefix]; + [completionPopup insertAutocompletePlaceholder]; } -- cgit v1.2.3