aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/DBView.xib772
-rw-r--r--Source/NSMutableArray-MultipleSort.h54
-rw-r--r--Source/NSMutableArray-MultipleSort.m77
-rw-r--r--Source/TableDocument.m1
-rw-r--r--Source/TableDump.h1
-rw-r--r--Source/TableDump.m9
-rw-r--r--Source/TableSource.m9
-rw-r--r--Source/TablesList.h20
-rw-r--r--Source/TablesList.m1017
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj6
10 files changed, 1309 insertions, 657 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 77286596..14b44c40 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -8,6 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="6277"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -70,95 +71,124 @@
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSSplitView" id="355288374">
+ <object class="BWSplitView" id="213762440">
<reference key="NSNextResponder" ref="131633443"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSScrollView" id="233472824">
- <reference key="NSNextResponder" ref="355288374"/>
- <int key="NSvFlags">4370</int>
+ <object class="BWCustomView" id="801427893">
+ <reference key="NSNextResponder" ref="213762440"/>
+ <int key="NSvFlags">288</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSClipView" id="73685676">
- <reference key="NSNextResponder" ref="233472824"/>
- <int key="NSvFlags">2304</int>
+ <object class="NSScrollView" id="199860064">
+ <reference key="NSNextResponder" ref="801427893"/>
+ <int key="NSvFlags">4370</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSTableView" id="251040077">
- <reference key="NSNextResponder" ref="73685676"/>
- <int key="NSvFlags">4352</int>
- <string key="NSFrameSize">{212, 381}</string>
- <reference key="NSSuperview" ref="73685676"/>
- <reference key="NSWindow"/>
- <bool key="NSEnabled">YES</bool>
- <object class="_NSCornerView" key="NSCornerView">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">-2147483392</int>
- <string key="NSFrame">{{-26, 0}, {16, 17}}</string>
- </object>
- <object class="NSMutableArray" key="NSTableColumns">
+ <object class="NSClipView" id="588922296">
+ <reference key="NSNextResponder" ref="199860064"/>
+ <int key="NSvFlags">2304</int>
+ <object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSTableColumn" id="544378883">
- <string key="NSIdentifier">tables</string>
- <double key="NSWidth">2.090000e+02</double>
- <double key="NSMinWidth">4.286900e+01</double>
- <double key="NSMaxWidth">1.000000e+03</double>
- <object class="NSTableHeaderCell" key="NSHeaderCell">
- <int key="NSCellFlags">75628032</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Tables</string>
- <object class="NSFont" key="NSSupport" id="26">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">1.100000e+01</double>
- <int key="NSfFlags">3100</int>
- </object>
- <object class="NSColor" key="NSBackgroundColor" id="799519821">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes>
- </object>
- <object class="NSColor" key="NSTextColor" id="222976159">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">headerTextColor</string>
- <object class="NSColor" key="NSColor" id="304829493">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MAA</bytes>
- </object>
- </object>
- </object>
- <object class="NSTextFieldCell" key="NSDataCell" id="37718544">
- <int key="NSCellFlags">337772096</int>
- <int key="NSCellFlags2">272761856</int>
- <string key="NSContents">Text Cell</string>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSControlView" ref="251040077"/>
- <bool key="NSDrawsBackground">YES</bool>
- <object class="NSColor" key="NSBackgroundColor" id="62854682">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor" id="1001122760">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
+ <object class="NSCustomView" id="643201879">
+ <reference key="NSNextResponder" ref="588922296"/>
+ <int key="NSvFlags">274</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSSearchField" id="727834078">
+ <reference key="NSNextResponder" ref="643201879"/>
+ <int key="NSvFlags">266</int>
+ <string key="NSFrame">{{5, 2}, {202, 19}}</string>
+ <reference key="NSSuperview" ref="643201879"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSSearchFieldCell" key="NSCell" id="134854992">
+ <int key="NSCellFlags">343014976</int>
+ <int key="NSCellFlags2">268567552</int>
+ <string key="NSContents"/>
+ <object class="NSFont" key="NSSupport" id="26">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">1.100000e+01</double>
+ <int key="NSfFlags">3100</int>
+ </object>
+ <reference key="NSControlView" ref="727834078"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <int key="NSTextBezelStyle">1</int>
+ <object class="NSColor" key="NSBackgroundColor" id="480189472">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">textBackgroundColor</string>
+ <object class="NSColor" key="NSColor" id="449903125">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ </object>
+ <object class="NSColor" key="NSTextColor" id="454249633">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlTextColor</string>
+ <object class="NSColor" key="NSColor" id="304829493">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ </object>
+ </object>
+ <object class="NSButtonCell" key="NSSearchButtonCell">
+ <int key="NSCellFlags">130560</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">search</string>
+ <string key="NSAction">_searchFieldSearch:</string>
+ <reference key="NSTarget" ref="134854992"/>
+ <reference key="NSControlView" ref="727834078"/>
+ <int key="NSButtonFlags">138690815</int>
+ <int key="NSButtonFlags2">0</int>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ <object class="NSButtonCell" key="NSCancelButtonCell">
+ <int key="NSCellFlags">130560</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">clear</string>
+ <object class="NSMutableArray" key="NSAccessibilityOverriddenAttributes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableDictionary">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>AXDescription</string>
+ <string>NSAccessibilityEncodedAttributesValueType</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>cancel</string>
+ <integer value="1" id="9"/>
+ </object>
+ </object>
+ </object>
+ <string key="NSAction">_searchFieldCancel:</string>
+ <reference key="NSTarget" ref="134854992"/>
+ <reference key="NSControlView" ref="727834078"/>
+ <int key="NSButtonFlags">138690815</int>
+ <int key="NSButtonFlags2">0</int>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ <int key="NSMaximumRecents">255</int>
+ <bytes key="NSSearchFieldFlags">CAAAAA</bytes>
</object>
</object>
- <object class="NSColor" key="NSTextColor" id="454249633">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlTextColor</string>
- <reference key="NSColor" ref="304829493"/>
- </object>
</object>
- <int key="NSResizingMask">3</int>
- <bool key="NSIsResizeable">YES</bool>
- <bool key="NSIsEditable">YES</bool>
- <reference key="NSTableView" ref="251040077"/>
+ <string key="NSFrameSize">{212, 26}</string>
+ <reference key="NSSuperview" ref="588922296"/>
+ <string key="NSClassName">NSView</string>
</object>
</object>
- <double key="NSIntercellSpacingWidth">3.000000e+00</double>
- <double key="NSIntercellSpacingHeight">2.000000e+00</double>
- <object class="NSColor" key="NSBackgroundColor">
+ <string key="NSFrameSize">{212, 26}</string>
+ <reference key="NSSuperview" ref="199860064"/>
+ <reference key="NSNextKeyView" ref="643201879"/>
+ <reference key="NSDocView" ref="643201879"/>
+ <object class="NSColor" key="NSBGColor" id="529261656">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">_sourceListBackgroundColor</string>
@@ -167,78 +197,218 @@
<bytes key="NSRGB">MC44MzkyMTU3IDAuODY2NjY2NjcgMC44OTgwMzkyMgA</bytes>
</object>
</object>
- <object class="NSColor" key="NSGridColor" id="864903678">
+ <int key="NScvFlags">4</int>
+ </object>
+ <object class="NSScroller" id="540853896">
+ <reference key="NSNextResponder" ref="199860064"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{-100, -100}, {15, 94}}</string>
+ <reference key="NSSuperview" ref="199860064"/>
+ <reference key="NSTarget" ref="199860064"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSCurValue">1.000000e+00</double>
+ <double key="NSPercent">9.636363e-01</double>
+ </object>
+ <object class="NSScroller" id="566705316">
+ <reference key="NSNextResponder" ref="199860064"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{-100, -100}, {166, 15}}</string>
+ <reference key="NSSuperview" ref="199860064"/>
+ <int key="NSsFlags">1</int>
+ <reference key="NSTarget" ref="199860064"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSPercent">5.060241e-01</double>
+ </object>
+ </object>
+ <string key="NSFrameSize">{212, 26}</string>
+ <reference key="NSSuperview" ref="801427893"/>
+ <reference key="NSNextKeyView" ref="588922296"/>
+ <int key="NSsFlags">0</int>
+ <reference key="NSVScroller" ref="540853896"/>
+ <reference key="NSHScroller" ref="566705316"/>
+ <reference key="NSContentView" ref="588922296"/>
+ </object>
+ </object>
+ <string key="NSFrameSize">{212, 26}</string>
+ <reference key="NSSuperview" ref="213762440"/>
+ <string key="NSClassName">NSView</string>
+ </object>
+ <object class="BWCustomView" id="1017775084">
+ <reference key="NSNextResponder" ref="213762440"/>
+ <int key="NSvFlags">272</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSScrollView" id="233472824">
+ <reference key="NSNextResponder" ref="1017775084"/>
+ <int key="NSvFlags">4370</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSClipView" id="73685676">
+ <reference key="NSNextResponder" ref="233472824"/>
+ <int key="NSvFlags">2304</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTableView" id="251040077">
+ <reference key="NSNextResponder" ref="73685676"/>
+ <int key="NSvFlags">4352</int>
+ <string key="NSFrameSize">{212, 354}</string>
+ <reference key="NSSuperview" ref="73685676"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="_NSCornerView" key="NSCornerView">
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{-26, 0}, {16, 17}}</string>
+ </object>
+ <object class="NSMutableArray" key="NSTableColumns">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTableColumn" id="544378883">
+ <string key="NSIdentifier">tables</string>
+ <double key="NSWidth">2.090000e+02</double>
+ <double key="NSMinWidth">4.286900e+01</double>
+ <double key="NSMaxWidth">1.000000e+03</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628032</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Tables</string>
+ <reference key="NSSupport" ref="26"/>
+ <object class="NSColor" key="NSBackgroundColor" id="799519821">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes>
+ </object>
+ <object class="NSColor" key="NSTextColor" id="222976159">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">headerTextColor</string>
+ <reference key="NSColor" ref="304829493"/>
+ </object>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="37718544">
+ <int key="NSCellFlags">337772096</int>
+ <int key="NSCellFlags2">272761856</int>
+ <string key="NSContents">Text Cell</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="251040077"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <object class="NSColor" key="NSBackgroundColor" id="62854682">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlColor</string>
+ <object class="NSColor" key="NSColor" id="1001122760">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
+ </object>
+ </object>
+ <reference key="NSTextColor" ref="454249633"/>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="251040077"/>
+ </object>
+ </object>
+ <double key="NSIntercellSpacingWidth">3.000000e+00</double>
+ <double key="NSIntercellSpacingHeight">2.000000e+00</double>
+ <object class="NSColor" key="NSBackgroundColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">_sourceListBackgroundColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC44MzkyMTU3IDAuODY2NjY2NjcgMC44OTgwMzkyMgA</bytes>
+ </object>
+ </object>
+ <object class="NSColor" key="NSGridColor" id="864903678">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">gridColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ </object>
+ <double key="NSRowHeight">1.700000e+01</double>
+ <int key="NSTvFlags">1514143744</int>
+ <int key="NSColumnAutoresizingStyle">2</int>
+ <int key="NSDraggingSourceMaskForLocal">15</int>
+ <int key="NSDraggingSourceMaskForNonLocal">0</int>
+ <bool key="NSAllowsTypeSelect">YES</bool>
+ <int key="NSTableViewSelectionHighlightStyle">1</int>
+ </object>
+ </object>
+ <string key="NSFrameSize">{212, 354}</string>
+ <reference key="NSSuperview" ref="233472824"/>
+ <reference key="NSNextKeyView" ref="251040077"/>
+ <reference key="NSDocView" ref="251040077"/>
+ <object class="NSColor" key="NSBGColor" id="1024678221">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
- <string key="NSColorName">gridColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC41AA</bytes>
- </object>
+ <string key="NSColorName">controlBackgroundColor</string>
+ <reference key="NSColor" ref="1001122760"/>
</object>
- <double key="NSRowHeight">1.700000e+01</double>
- <int key="NSTvFlags">1514143744</int>
- <int key="NSColumnAutoresizingStyle">2</int>
- <int key="NSDraggingSourceMaskForLocal">15</int>
- <int key="NSDraggingSourceMaskForNonLocal">0</int>
- <bool key="NSAllowsTypeSelect">YES</bool>
- <int key="NSTableViewSelectionHighlightStyle">1</int>
+ <int key="NScvFlags">4</int>
+ </object>
+ <object class="NSScroller" id="693168867">
+ <reference key="NSNextResponder" ref="233472824"/>
+ <int key="NSvFlags">-2147483392</int>
+ <string key="NSFrame">{{197, 0}, {15, 292}}</string>
+ <reference key="NSSuperview" ref="233472824"/>
+ <reference key="NSTarget" ref="233472824"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSPercent">9.965870e-01</double>
+ </object>
+ <object class="NSScroller" id="656188692">
+ <reference key="NSNextResponder" ref="233472824"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{-100, -100}, {141, 11}}</string>
+ <reference key="NSSuperview" ref="233472824"/>
+ <int key="NSsFlags">257</int>
+ <reference key="NSTarget" ref="233472824"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSPercent">9.904762e-01</double>
</object>
</object>
- <string key="NSFrameSize">{212, 381}</string>
- <reference key="NSSuperview" ref="233472824"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="251040077"/>
- <reference key="NSDocView" ref="251040077"/>
- <object class="NSColor" key="NSBGColor" id="1024678221">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlBackgroundColor</string>
- <reference key="NSColor" ref="1001122760"/>
- </object>
- <int key="NScvFlags">4</int>
- </object>
- <object class="NSScroller" id="693168867">
- <reference key="NSNextResponder" ref="233472824"/>
- <int key="NSvFlags">-2147483392</int>
- <string key="NSFrame">{{175, 1}, {15, 481}}</string>
- <reference key="NSSuperview" ref="233472824"/>
- <reference key="NSWindow"/>
- <reference key="NSTarget" ref="233472824"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSPercent">9.979253e-01</double>
- </object>
- <object class="NSScroller" id="656188692">
- <reference key="NSNextResponder" ref="233472824"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{-100, -100}, {141, 11}}</string>
- <reference key="NSSuperview" ref="233472824"/>
- <reference key="NSWindow"/>
- <int key="NSsFlags">257</int>
- <reference key="NSTarget" ref="233472824"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSPercent">9.904762e-01</double>
+ <string key="NSFrameSize">{212, 354}</string>
+ <reference key="NSSuperview" ref="1017775084"/>
+ <reference key="NSNextKeyView" ref="73685676"/>
+ <int key="NSsFlags">528</int>
+ <reference key="NSVScroller" ref="693168867"/>
+ <reference key="NSHScroller" ref="656188692"/>
+ <reference key="NSContentView" ref="73685676"/>
+ <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
</object>
</object>
- <string key="NSFrameSize">{212, 381}</string>
- <reference key="NSSuperview" ref="355288374"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="73685676"/>
- <int key="NSsFlags">528</int>
- <reference key="NSVScroller" ref="693168867"/>
- <reference key="NSHScroller" ref="656188692"/>
- <reference key="NSContentView" ref="73685676"/>
- <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
+ <string key="NSFrame">{{0, 27}, {212, 354}}</string>
+ <reference key="NSSuperview" ref="213762440"/>
+ <string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrameSize">{212, 381}</string>
<reference key="NSSuperview" ref="131633443"/>
- <reference key="NSWindow"/>
+ <int key="NSDividerStyle">2</int>
+ <reference key="BWSVColor" ref="529261656"/>
+ <bool key="BWSVColorIsEnabled">YES</bool>
+ <object class="NSMutableDictionary" key="BWSVMinValues">
+ <integer value="0" key="NS.key.0" id="8"/>
+ <integer value="26" key="NS.object.0"/>
+ </object>
+ <object class="NSMutableDictionary" key="BWSVMaxValues">
+ <reference key="NS.key.0" ref="8"/>
+ <integer value="26" key="NS.object.0"/>
+ </object>
+ <object class="NSMutableDictionary" key="BWSVMinUnits">
+ <reference key="NS.key.0" ref="8"/>
+ <reference key="NS.object.0" ref="8"/>
+ </object>
+ <object class="NSMutableDictionary" key="BWSVMaxUnits">
+ <reference key="NS.key.0" ref="8"/>
+ <reference key="NS.object.0" ref="8"/>
+ </object>
+ <int key="BWSVCollapsiblePopupSelection">1</int>
+ <bool key="BWSVDividerCanCollapse">NO</bool>
</object>
</object>
<string key="NSFrameSize">{212, 381}</string>
<reference key="NSSuperview" ref="298095498"/>
- <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="BWCustomView" id="192579410">
@@ -261,7 +431,6 @@
<int key="NSvFlags">4352</int>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="685057119"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="_NSCornerView" key="NSCornerView">
<nil key="NSNextResponder"/>
@@ -325,7 +494,6 @@
</object>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="298226231"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="347093764"/>
<reference key="NSDocView" ref="347093764"/>
<reference key="NSBGColor" ref="1024678221"/>
@@ -336,7 +504,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {15, 20}}</string>
<reference key="NSSuperview" ref="298226231"/>
- <reference key="NSWindow"/>
<reference key="NSTarget" ref="298226231"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">9.473684e-01</double>
@@ -346,7 +513,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{-100, -100}, {141, 11}}</string>
<reference key="NSSuperview" ref="298226231"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">257</int>
<reference key="NSTarget" ref="298226231"/>
<string key="NSAction">_doScroller:</string>
@@ -355,7 +521,6 @@
</object>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="192579410"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="685057119"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="245346414"/>
@@ -366,19 +531,17 @@
</object>
<string key="NSFrame">{{0, 382}, {212, 145}}</string>
<reference key="NSSuperview" ref="298095498"/>
- <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrame">{{0, 23}, {212, 527}}</string>
<reference key="NSSuperview" ref="372294785"/>
- <reference key="NSWindow"/>
<int key="NSDividerStyle">2</int>
<reference key="BWSVColor" ref="304829493"/>
<bool key="BWSVColorIsEnabled">NO</bool>
<object class="NSMutableDictionary" key="BWSVMinValues">
- <integer value="1" key="NS.key.0" id="9"/>
- <integer value="0" key="NS.object.0" id="8"/>
+ <reference key="NS.key.0" ref="9"/>
+ <reference key="NS.object.0" ref="8"/>
</object>
<object class="NSMutableDictionary" key="BWSVMaxValues">
<reference key="NS.key.0" ref="9"/>
@@ -423,7 +586,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{-1, -1}, {32, 24}}</string>
<reference key="NSSuperview" ref="28219887"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="BWAnchoredButtonCell" key="NSCell" id="283448047">
<int key="NSCellFlags">67239424</int>
@@ -448,7 +610,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{30, -1}, {32, 24}}</string>
<reference key="NSSuperview" ref="28219887"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="BWAnchoredPopUpButtonCell" key="NSCell" id="321871356">
<int key="NSCellFlags">71433792</int>
@@ -558,7 +719,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{61, -1}, {32, 24}}</string>
<reference key="NSSuperview" ref="28219887"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="BWAnchoredButtonCell" key="NSCell" id="227511715">
<int key="NSCellFlags">67239424</int>
@@ -583,7 +743,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{92, -1}, {32, 24}}</string>
<reference key="NSSuperview" ref="28219887"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="BWAnchoredButtonCell" key="NSCell" id="708016222">
<int key="NSCellFlags">-2080244224</int>
@@ -610,7 +769,6 @@
</object>
<string key="NSFrameSize">{212, 23}</string>
<reference key="NSSuperview" ref="372294785"/>
- <reference key="NSWindow"/>
<bool key="BWABBIsResizable">YES</bool>
<bool key="BWABBIsAtBottom">YES</bool>
<bool key="BWABBHandleIsRightAligned">NO</bool>
@@ -619,7 +777,6 @@
</object>
<string key="NSFrameSize">{212, 550}</string>
<reference key="NSSuperview" ref="937377983"/>
- <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="604818293">
@@ -632,7 +789,6 @@
<int key="NSvFlags">274</int>
<string key="NSFrame">{{-7, -10}, {735, 564}}</string>
<reference key="NSSuperview" ref="604818293"/>
- <reference key="NSWindow"/>
<object class="NSMutableArray" key="NSTabViewItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTabViewItem" id="831053945">
@@ -702,15 +858,7 @@
<string key="NSContents">Text Cell</string>
<reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="715508012"/>
- <object class="NSColor" key="NSBackgroundColor" id="480189472">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">textBackgroundColor</string>
- <object class="NSColor" key="NSColor" id="449903125">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- </object>
- </object>
+ <reference key="NSBackgroundColor" ref="480189472"/>
<reference key="NSTextColor" ref="454249633"/>
</object>
<int key="NSResizingMask">3</int>
@@ -3982,14 +4130,12 @@
<int key="NSvFlags">4352</int>
<string key="NSFrameSize">{688, 454}</string>
<reference key="NSSuperview" ref="705580858"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="370758200">
<reference key="NSNextResponder" ref="996985254"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{688, 17}</string>
<reference key="NSSuperview" ref="996985254"/>
- <reference key="NSWindow"/>
<reference key="NSTableView" ref="952375340"/>
</object>
<object class="_NSCornerView" key="NSCornerView" id="793765259">
@@ -3997,7 +4143,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-26, 0}, {16, 17}}</string>
<reference key="NSSuperview" ref="717203719"/>
- <reference key="NSWindow"/>
</object>
<object class="NSMutableArray" key="NSTableColumns">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -4181,7 +4326,6 @@
</object>
<string key="NSFrame">{{1, 17}, {688, 454}}</string>
<reference key="NSSuperview" ref="717203719"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="952375340"/>
<reference key="NSDocView" ref="952375340"/>
<reference key="NSBGColor" ref="1024678221"/>
@@ -4192,7 +4336,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{674, 17}, {15, 453}}</string>
<reference key="NSSuperview" ref="717203719"/>
- <reference key="NSWindow"/>
<reference key="NSTarget" ref="717203719"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">9.679487e-01</double>
@@ -4202,7 +4345,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{1, 470}, {688, 15}}</string>
<reference key="NSSuperview" ref="717203719"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="717203719"/>
<string key="NSAction">_doScroller:</string>
@@ -4217,7 +4359,6 @@
</object>
<string key="NSFrame">{{1, 0}, {688, 17}}</string>
<reference key="NSSuperview" ref="717203719"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="370758200"/>
<reference key="NSDocView" ref="370758200"/>
<reference key="NSBGColor" ref="1024678221"/>
@@ -4227,7 +4368,6 @@
</object>
<string key="NSFrame">{{6, 32}, {690, 472}}</string>
<reference key="NSSuperview" ref="49633996"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="705580858"/>
<int key="NSsFlags">562</int>
<reference key="NSVScroller" ref="429193901"/>
@@ -4242,7 +4382,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{6, 9}, {32, 25}}</string>
<reference key="NSSuperview" ref="49633996"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="796363844">
<int key="NSCellFlags">-1543373312</int>
@@ -4264,7 +4403,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{68, 9}, {32, 25}}</string>
<reference key="NSSuperview" ref="49633996"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="815097407">
<int key="NSCellFlags">-2080244224</int>
@@ -4286,7 +4424,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{37, 9}, {32, 25}}</string>
<reference key="NSSuperview" ref="49633996"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="693201961">
<int key="NSCellFlags">-1543373312</int>
@@ -4320,7 +4457,6 @@
</object>
<string key="NSFrame">{{100, 10}, {596, 23}}</string>
<reference key="NSSuperview" ref="49633996"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="889065570">
<int key="NSCellFlags">130560</int>
@@ -4338,7 +4474,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{14, 515}, {347, 14}}</string>
<reference key="NSSuperview" ref="49633996"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="538829847">
<int key="NSCellFlags">68288064</int>
@@ -4353,7 +4488,6 @@
</object>
<string key="NSFrame">{{10, 7}, {700, 544}}</string>
<reference key="NSSuperview" ref="714795046"/>
- <reference key="NSWindow"/>
</object>
<string key="NSLabel">Relations</string>
<reference key="NSColor" ref="62854682"/>
@@ -4373,20 +4507,17 @@
</object>
<string key="NSFrame">{{221, 0}, {723, 550}}</string>
<reference key="NSSuperview" ref="937377983"/>
- <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrameSize">{944, 550}</string>
<reference key="NSSuperview" ref="579726586"/>
- <reference key="NSWindow"/>
<bool key="NSIsVertical">YES</bool>
<string key="NSAutosaveName">DBViewSplitter</string>
</object>
</object>
<string key="NSFrameSize">{944, 550}</string>
<reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMinSize">{780, 502}</string>
@@ -6019,7 +6150,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<object class="NSView" key="NSWindowView" id="842408319">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -6038,7 +6169,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{80, 10}, {171, 22}}</string>
<reference key="NSSuperview" ref="677403043"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="535836876">
<int key="NSCellFlags">-2076049856</int>
@@ -6104,7 +6234,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{29, 15}, {49, 14}}</string>
<reference key="NSSuperview" ref="677403043"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="148999128">
<int key="NSCellFlags">68288064</int>
@@ -6119,12 +6248,10 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSFrame">{{1, 1}, {266, 40}}</string>
<reference key="NSSuperview" ref="536822293"/>
- <reference key="NSWindow"/>
</object>
</object>
<string key="NSFrame">{{17, 231}, {268, 56}}</string>
<reference key="NSSuperview" ref="842408319"/>
- <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -6158,7 +6285,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{81, 40}, {170, 22}}</string>
<reference key="NSSuperview" ref="40346767"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="431726441">
<int key="NSCellFlags">-2076049856</int>
@@ -6244,7 +6370,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{81, 10}, {170, 22}}</string>
<reference key="NSSuperview" ref="40346767"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="181520855">
<int key="NSCellFlags">-2076049856</int>
@@ -6330,7 +6455,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{15, 45}, {64, 14}}</string>
<reference key="NSSuperview" ref="40346767"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="878239911">
<int key="NSCellFlags">68288064</int>
@@ -6347,7 +6471,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{19, 15}, {59, 14}}</string>
<reference key="NSSuperview" ref="40346767"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="5496">
<int key="NSCellFlags">68288064</int>
@@ -6362,12 +6485,10 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSFrame">{{1, 1}, {266, 71}}</string>
<reference key="NSSuperview" ref="607035293"/>
- <reference key="NSWindow"/>
</object>
</object>
<string key="NSFrame">{{17, 49}, {268, 87}}</string>
<reference key="NSSuperview" ref="842408319"/>
- <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -6401,7 +6522,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{80, 40}, {171, 22}}</string>
<reference key="NSSuperview" ref="931900868"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="141679483">
<int key="NSCellFlags">-2076049856</int>
@@ -6467,7 +6587,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{80, 10}, {171, 22}}</string>
<reference key="NSSuperview" ref="931900868"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="980368532">
<int key="NSCellFlags">-2076049856</int>
@@ -6533,7 +6652,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{41, 45}, {37, 14}}</string>
<reference key="NSSuperview" ref="931900868"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="725351885">
<int key="NSCellFlags">68288064</int>
@@ -6550,7 +6668,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{29, 15}, {49, 14}}</string>
<reference key="NSSuperview" ref="931900868"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="20664131">
<int key="NSCellFlags">68288064</int>
@@ -6565,12 +6682,10 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSFrame">{{1, 1}, {266, 71}}</string>
<reference key="NSSuperview" ref="951603292"/>
- <reference key="NSWindow"/>
</object>
</object>
<string key="NSFrame">{{17, 140}, {268, 87}}</string>
<reference key="NSSuperview" ref="842408319"/>
- <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -6594,7 +6709,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{191, 13}, {96, 28}}</string>
<reference key="NSSuperview" ref="842408319"/>
- <reference key="NSWindow"/>
<int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="600004052">
@@ -6616,7 +6730,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{97, 13}, {96, 28}}</string>
<reference key="NSSuperview" ref="842408319"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="721913578">
<int key="NSCellFlags">67239424</int>
@@ -6634,8 +6747,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<string key="NSFrameSize">{302, 307}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
@@ -12382,14 +12493,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="connectionID">4681</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">tableListView</string>
- <reference key="source" ref="225526897"/>
- <reference key="destination" ref="251040077"/>
- </object>
- <int key="connectionID">4683</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">toggleFilterField:</string>
<reference key="source" ref="392169872"/>
@@ -13815,22 +13918,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">tableListSplitter</string>
- <reference key="source" ref="427689665"/>
- <reference key="destination" ref="355288374"/>
- </object>
- <int key="connectionID">5939</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="355288374"/>
- <reference key="destination" ref="427689665"/>
- </object>
- <int key="connectionID">5940</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
<string key="label">tableInfoTable</string>
<reference key="source" ref="427689665"/>
<reference key="destination" ref="347093764"/>
@@ -14353,6 +14440,46 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">6259</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">tableListSplitter</string>
+ <reference key="source" ref="427689665"/>
+ <reference key="destination" ref="213762440"/>
+ </object>
+ <int key="connectionID">6269</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">tableListFilterSplitView</string>
+ <reference key="source" ref="438574515"/>
+ <reference key="destination" ref="213762440"/>
+ </object>
+ <int key="connectionID">6280</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="213762440"/>
+ <reference key="destination" ref="427689665"/>
+ </object>
+ <int key="connectionID">6283</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">listFilterField</string>
+ <reference key="source" ref="438574515"/>
+ <reference key="destination" ref="727834078"/>
+ </object>
+ <int key="connectionID">6284</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">updateFilter:</string>
+ <reference key="source" ref="438574515"/>
+ <reference key="destination" ref="727834078"/>
+ </object>
+ <int key="connectionID">6285</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -19727,64 +19854,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference key="object" ref="131633443"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="355288374"/>
+ <reference ref="213762440"/>
</object>
<reference key="parent" ref="298095498"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">4487</int>
- <reference key="object" ref="355288374"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="233472824"/>
- </object>
- <reference key="parent" ref="131633443"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">21</int>
- <reference key="object" ref="233472824"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="656188692"/>
- <reference ref="693168867"/>
- <reference ref="251040077"/>
- </object>
- <reference key="parent" ref="355288374"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">3916</int>
- <reference key="object" ref="656188692"/>
- <reference key="parent" ref="233472824"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">3915</int>
- <reference key="object" ref="693168867"/>
- <reference key="parent" ref="233472824"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">22</int>
- <reference key="object" ref="251040077"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="544378883"/>
- </object>
- <reference key="parent" ref="233472824"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">23</int>
- <reference key="object" ref="544378883"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="37718544"/>
- </object>
- <reference key="parent" ref="251040077"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">4015</int>
- <reference key="object" ref="37718544"/>
- <reference key="parent" ref="544378883"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">6067</int>
<reference key="object" ref="568453839"/>
<object class="NSMutableArray" key="children">
@@ -20266,6 +20340,122 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference key="object" ref="241706230"/>
<reference key="parent" ref="60735230"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6265</int>
+ <reference key="object" ref="213762440"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="801427893"/>
+ <reference ref="1017775084"/>
+ </object>
+ <reference key="parent" ref="131633443"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6266</int>
+ <reference key="object" ref="801427893"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="199860064"/>
+ </object>
+ <reference key="parent" ref="213762440"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6267</int>
+ <reference key="object" ref="1017775084"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="233472824"/>
+ </object>
+ <reference key="parent" ref="213762440"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">21</int>
+ <reference key="object" ref="233472824"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="251040077"/>
+ <reference ref="693168867"/>
+ <reference ref="656188692"/>
+ </object>
+ <reference key="parent" ref="1017775084"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">22</int>
+ <reference key="object" ref="251040077"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="544378883"/>
+ </object>
+ <reference key="parent" ref="233472824"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3915</int>
+ <reference key="object" ref="693168867"/>
+ <reference key="parent" ref="233472824"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3916</int>
+ <reference key="object" ref="656188692"/>
+ <reference key="parent" ref="233472824"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">23</int>
+ <reference key="object" ref="544378883"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="37718544"/>
+ </object>
+ <reference key="parent" ref="251040077"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">4015</int>
+ <reference key="object" ref="37718544"/>
+ <reference key="parent" ref="544378883"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6274</int>
+ <reference key="object" ref="199860064"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="643201879"/>
+ <reference ref="566705316"/>
+ <reference ref="540853896"/>
+ </object>
+ <reference key="parent" ref="801427893"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6277</int>
+ <reference key="object" ref="643201879"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="727834078"/>
+ </object>
+ <reference key="parent" ref="199860064"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6276</int>
+ <reference key="object" ref="566705316"/>
+ <reference key="parent" ref="199860064"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6275</int>
+ <reference key="object" ref="540853896"/>
+ <reference key="parent" ref="199860064"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6278</int>
+ <reference key="object" ref="727834078"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="134854992"/>
+ </object>
+ <reference key="parent" ref="643201879"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6279</int>
+ <reference key="object" ref="134854992"/>
+ <reference key="parent" ref="727834078"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -20791,8 +20981,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>4485.ImportedFromIB2</string>
<string>4486.CustomClassName</string>
<string>4486.IBPluginDependency</string>
- <string>4487.CustomClassName</string>
- <string>4487.IBPluginDependency</string>
<string>4488.IBPluginDependency</string>
<string>4503.IBPluginDependency</string>
<string>4504.IBPluginDependency</string>
@@ -21487,6 +21675,15 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>6242.IBPluginDependency</string>
<string>6249.IBPluginDependency</string>
<string>6253.IBPluginDependency</string>
+ <string>6265.IBPluginDependency</string>
+ <string>6266.IBPluginDependency</string>
+ <string>6267.IBPluginDependency</string>
+ <string>6274.IBPluginDependency</string>
+ <string>6275.IBPluginDependency</string>
+ <string>6276.IBPluginDependency</string>
+ <string>6277.IBPluginDependency</string>
+ <string>6278.IBPluginDependency</string>
+ <string>6279.IBPluginDependency</string>
<string>654.IBPluginDependency</string>
<string>654.ImportedFromIB2</string>
<string>655.IBPluginDependency</string>
@@ -22322,8 +22519,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference ref="9"/>
<string>ImageAndTextCell</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>BWSplitView</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -22516,8 +22711,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{177, 306}, {944, 550}}</string>
- <string>{{177, 306}, {944, 550}}</string>
+ <string>{{60, 298}, {944, 550}}</string>
+ <string>{{60, 298}, {944, 550}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -23256,6 +23451,15 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.brandonwalkin.BWToolkit</string>
+ <string>com.brandonwalkin.BWToolkit</string>
+ <string>com.brandonwalkin.BWToolkit</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -23476,7 +23680,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">6259</int>
+ <int key="maxID">6285</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -24429,7 +24633,6 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>tableContentInstance</string>
<string>tableDataInstance</string>
<string>tableDocumentInstance</string>
- <string>tableListView</string>
<string>tableSourceInstance</string>
<string>tableWindow</string>
<string>tablesListInstance</string>
@@ -24488,7 +24691,6 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>id</string>
<string>id</string>
<string>id</string>
- <string>id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -24609,6 +24811,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>renameTable:</string>
<string>togglePaneCollapse:</string>
<string>truncateTable:</string>
+ <string>updateFilter:</string>
<string>updateTables:</string>
</object>
<object class="NSMutableArray" key="dict.values">
@@ -24622,6 +24825,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -24639,6 +24843,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>duplicateTableContextMenuItem</string>
<string>duplicateTableMenuItem</string>
<string>extendedTableInfoInstance</string>
+ <string>listFilterField</string>
<string>removeTableContextMenuItem</string>
<string>removeTableMenuItem</string>
<string>renameTableButton</string>
@@ -24653,6 +24858,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>tableDumpInstance</string>
<string>tableEncodingButton</string>
<string>tableInfoCollapseButton</string>
+ <string>tableListFilterSplitView</string>
<string>tableListSplitView</string>
<string>tableNameField</string>
<string>tableRenameField</string>
@@ -24679,6 +24885,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
<string>id</string>
+ <string>NSSearchField</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
<string>id</string>
@@ -24694,6 +24901,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>id</string>
<string>NSButton</string>
<string>NSSplitView</string>
+ <string>NSSplitView</string>
<string>id</string>
<string>id</string>
<string>id</string>
diff --git a/Source/NSMutableArray-MultipleSort.h b/Source/NSMutableArray-MultipleSort.h
new file mode 100644
index 00000000..91c8f3f2
--- /dev/null
+++ b/Source/NSMutableArray-MultipleSort.h
@@ -0,0 +1,54 @@
+//
+// NSMutableArray-MultipleSort.h
+// iContractor
+//
+// Created by Jeff LaMarche on 1/16/09.
+// Copyright 2009 Jeff LaMarche. All rights reserved.
+//
+
+// This category on NSMutableArray implements a shell sort based on the old NeXT example
+// SortingInAction. It is functionally identical to sortArrayUsingSelector: except that
+// it will sort other paired arrays based on the comparison values of the original array
+// this is for use in paired array situations, such as when you use one array to store
+// keys and another array to store values. This is a variadic method, so you can sort
+// as many paired arrays as you have.
+
+// This source may be used, free of charge, for any purposes. commercial or non-
+// commercial. There is no attribution requirement, nor any need to distribute
+// your source code. If you do redistribute the source code, you must
+// leave the original header comments, but you may add additional ones.
+
+
+// Stride factor defines the size of the shell sort loop's stride. It can be tweaked
+// for performance, though 3 seems to be a good general purpose value
+#define STRIDE_FACTOR 3
+
+#import <Foundation/Foundation.h>
+
+// This compare method was taken from the GNUStep project. GNUStep is
+// licensed under the LGPL, which allows such use.
+static inline NSComparisonResult compare(id elem1, id elem2, void* context)
+{
+ NSComparisonResult (*imp)(id, SEL, id);
+
+ if (context == 0) {
+ [NSException raise: NSInvalidArgumentException
+ format: @"compare null selector given"];
+ }
+
+ imp = (NSComparisonResult (*)(id, SEL, id))
+ [elem1 methodForSelector: context];
+
+ if (imp == NULL) {
+ [NSException raise: NSGenericException
+ format: @"invalid selector passed to compare"];
+ }
+
+ return (*imp)(elem1, context, elem2);
+}
+
+@interface NSMutableArray(MultipleSort)
+
+// Takes a comparator and a nil-terminated list of paired arrays
+- (void)sortArrayUsingSelector:(SEL)comparator withPairedMutableArrays:(NSMutableArray *)array1, ...;
+@end
diff --git a/Source/NSMutableArray-MultipleSort.m b/Source/NSMutableArray-MultipleSort.m
new file mode 100644
index 00000000..f98732b7
--- /dev/null
+++ b/Source/NSMutableArray-MultipleSort.m
@@ -0,0 +1,77 @@
+//
+// NSMutableArray-MultipleSort.m
+// iContractor
+//
+// Created by Jeff LaMarche on 1/16/09.
+// Copyright 2009 Jeff LaMarche Consulting. All rights reserved.
+//
+// This source may be used, free of charge, for any purposes. commercial or non-
+// commercial. There is no attribution requirement, nor any need to distribute
+// your source code. If you do redistribute the source code, you must
+// leave the original header comments, but you may add additional ones.
+
+#import "NSMutableArray-MultipleSort.h"
+
+@implementation NSMutableArray(MultipleSort)
+- (void)sortArrayUsingSelector:(SEL)comparator withPairedMutableArrays:(NSMutableArray *)array1, ...
+{
+ unsigned int stride = 1;
+ BOOL found = NO;
+ unsigned int count = [self count];
+ unsigned int d;
+
+ while (stride <= count)
+ stride = stride * STRIDE_FACTOR + 1;
+
+ while (stride > (STRIDE_FACTOR - 1)) {
+ stride = stride / STRIDE_FACTOR;
+ for (unsigned int c = stride; c < count; c++) {
+ found = NO;
+ if (stride > c) break;
+
+ d = c - stride;
+ while (!found) {
+ id a = [self objectAtIndex: d + stride];
+ id b = [self objectAtIndex: d];
+
+ NSComparisonResult result = (*compare)(a, b, (void *)comparator);
+
+ if (result < 0) {
+ [a retain];
+ [self replaceObjectAtIndex: d + stride withObject: b];
+ [self replaceObjectAtIndex: d withObject: a];
+
+ id eachObject;
+ va_list argumentList;
+ if (array1) {
+ id a1 = [array1 objectAtIndex:d+stride];
+ id b1 = [array1 objectAtIndex:d];
+ [a1 retain];
+ [array1 replaceObjectAtIndex: d + stride withObject:b1];
+ [array1 replaceObjectAtIndex: d withObject: a1];
+ [a1 release];
+ va_start(argumentList, array1);
+ while (eachObject = va_arg(argumentList, id)) {
+ id ax = [eachObject objectAtIndex:d+stride];
+ id bx = [eachObject objectAtIndex:d];
+ [ax retain];
+ [eachObject replaceObjectAtIndex: d + stride withObject:bx];
+ [eachObject replaceObjectAtIndex: d withObject: ax];
+ [ax release];
+ }
+ va_end(argumentList);
+ }
+
+ [a release];
+
+ if (stride > d)
+ break;
+
+ d -= stride;
+ } else
+ found = YES;
+ }
+ }
+ }
+}
+@end \ No newline at end of file
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 7970d0aa..07b6b42b 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -116,7 +116,6 @@
// Hide the tabs in the tab view (we only show them to allow switching tabs in interface builder)
[tableTabView setTabViewType:NSNoTabsNoBorder];
- [tableListSplitter setDividerStyle:NSSplitViewDividerStyleThin];
// Add the icon accessory view to the title bar
NSView *windowFrame = [[tableWindow contentView] superview];
diff --git a/Source/TableDump.h b/Source/TableDump.h
index e0ee2c59..bb4c0284 100644
--- a/Source/TableDump.h
+++ b/Source/TableDump.h
@@ -37,7 +37,6 @@
IBOutlet id customQueryInstance;
IBOutlet id tableWindow;
- IBOutlet id tableListView;
IBOutlet id exportDumpView;
IBOutlet id exportCSVView;
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 3edf0619..34ffe262 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -379,8 +379,8 @@
}
- (IBAction)changeTable:(id)sender
-{
- [tableListView selectRowIndexes:[NSIndexSet indexSetWithIndex:[[tablesListInstance tables] indexOfObject:[fieldMappingPopup titleOfSelectedItem]]] byExtendingSelection:NO];
+{
+ [tablesListInstance selectTableOrViewWithName:[fieldMappingPopup titleOfSelectedItem]];
//set up tableView
currentRow = 0;
@@ -603,12 +603,9 @@
[fieldMappingPopup selectItemAtIndex:0];
}
- int indexOfFirstTable = [[tablesListInstance tables] indexOfObject:[fieldMappingPopup titleOfSelectedItem]];
-
- if( indexOfFirstTable == NSNotFound ){
+ if( ![tablesListInstance selectTableOrViewWithName:[fieldMappingPopup titleOfSelectedItem]] ) {
[errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR] %@\n", @"error text when trying to import csv data, but we have no tables in the db"), @"Can't import CSV data into a database without any tables!"]];
} else {
- [tableListView selectRowIndexes:[NSIndexSet indexSetWithIndex:indexOfFirstTable] byExtendingSelection:NO];
//set up tableView
currentRow = 0;
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 7fb0cdfd..48d1d75d 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -49,7 +49,12 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
// Check whether a save of the current row is required.
if ( ![self saveRowOnDeselect] ) return;
- selectedTable = aTable;
+ if (selectedTable) [selectedTable release];
+ if (aTable == nil) {
+ selectedTable = nil;
+ } else {
+ selectedTable = [[NSString alloc] initWithString:aTable];
+ }
[tableSourceView deselectAll:self];
[indexView deselectAll:self];
@@ -1342,6 +1347,7 @@ traps enter and esc and make/cancel editing without entering next row
currentlyEditingRow = -1;
defaultValues = nil;
+ selectedTable = nil;
prefs = [NSUserDefaults standardUserDefaults];
}
@@ -1363,6 +1369,7 @@ traps enter and esc and make/cancel editing without entering next row
[oldRow release];
[enumFields release];
if (defaultValues) [defaultValues release];
+ if (selectedTable) [selectedTable release];
[super dealloc];
}
diff --git a/Source/TablesList.h b/Source/TablesList.h
index 6210f9e7..68578010 100644
--- a/Source/TablesList.h
+++ b/Source/TablesList.h
@@ -40,6 +40,7 @@ enum sp_table_types
@interface NSObject (NSSplitView)
- (NSView *)collapsibleSubview;
- (IBAction)toggleCollapse:(id)sender;
+- (BOOL)collapsibleSubviewIsCollapsed;
- (void)setCollapsibleSubviewCollapsed:(BOOL)flag;
@end
@@ -74,8 +75,11 @@ enum sp_table_types
IBOutlet id truncateTableButton;
IBOutlet id truncateTableContextButton;
IBOutlet NSSplitView *tableListSplitView;
+ IBOutlet NSSplitView *tableListFilterSplitView;
IBOutlet NSButton *tableInfoCollapseButton;
-
+
+ IBOutlet NSSearchField *listFilterField;
+
IBOutlet NSMenuItem *removeTableMenuItem;
IBOutlet NSMenuItem *duplicateTableMenuItem;
IBOutlet NSMenuItem *renameTableMenuItem;
@@ -89,7 +93,13 @@ enum sp_table_types
IBOutlet NSMenuItem *separatorTableContextMenuItem;
NSMutableArray *tables;
+ NSMutableArray *filteredTables;
NSMutableArray *tableTypes;
+ NSMutableArray *filteredTableTypes;
+ int selectedTableType;
+ NSString *selectedTableName;
+ BOOL isTableListFiltered;
+ BOOL tableListContainsViews;
BOOL structureLoaded, contentLoaded, statusLoaded, alertSheetOpened;
}
@@ -112,6 +122,7 @@ enum sp_table_types
- (void)setConnection:(MCPConnection *)theConnection;
- (void)truncateTable;
- (void)doPerformQueryService:(NSString *)query;
+- (void)updateSelection;
// Getters
- (NSString *)tableName;
@@ -133,4 +144,11 @@ enum sp_table_types
- (void)setStatusRequiresReload:(BOOL)reload;
- (BOOL)selectTableOrViewWithName:(NSString *)theName;
+// Table list filter interaction
+- (void) showFilter;
+- (void) hideFilter;
+- (void) clearFilter;
+- (IBAction) updateFilter:(id)sender;
+- (void) selectTableAtIndex:(NSNumber *)rowIndex;
+
@end
diff --git a/Source/TablesList.m b/Source/TablesList.m
index a8781128..35240e46 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -34,6 +34,7 @@
#import "SPArrayAdditions.h"
#import "RegexKitLite.h"
#import "SPDatabaseData.h"
+#import "NSMutableArray-MultipleSort.h"
@implementation TablesList
@@ -47,20 +48,24 @@
MCPResult *theResult;
NSArray *resultRow;
int i;
- BOOL containsViews = NO;
- NSString *selectedTable = nil;
+ NSString *previousSelectedTable = nil;
NSInteger selectedRowIndex;
selectedRowIndex = [tablesListView selectedRow];
- if(selectedRowIndex > 0 && [tables count] && selectedRowIndex < [tables count]){
- selectedTable = [NSString stringWithString:[tables objectAtIndex:selectedRowIndex]];
+ if (selectedTableName) previousSelectedTable = [[NSString alloc] initWithString:selectedTableName];
+ if (isTableListFiltered) {
+ if (filteredTables) [filteredTables release];
+ filteredTables = tables;
+ if (filteredTableTypes) [filteredTableTypes release];
+ filteredTableTypes = tableTypes;
+ isTableListFiltered = NO;
}
+ tableListContainsViews = NO;
[tablesListView deselectAll:self];
[tables removeAllObjects];
[tableTypes removeAllObjects];
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
if ([tableDocumentInstance database]) {
@@ -82,12 +87,15 @@
[tables addObject:[resultRow objectAtIndex:0]];
if ([[resultRow objectAtIndex:1] isEqualToString:@"VIEW"]) {
[tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_VIEW]];
- containsViews = YES;
+ tableListContainsViews = YES;
} else {
[tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_TABLE]];
}
}
}
+
+ // Reorder the tables in alphabetical order
+ [tables sortArrayUsingSelector:@selector(localizedCompare:) withPairedMutableArrays:tableTypes, nil];
/* grab the procedures and functions
*
@@ -118,7 +126,7 @@
[tables addObject:NSArrayObjectAtIndex(resultRow, 3)];
if( [NSArrayObjectAtIndex(resultRow, 4) isEqualToString:@"PROCEDURE"] ) {
[tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_PROC]];
- } else {
+ } else {
[tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_FUNC]];
}
}
@@ -180,17 +188,38 @@
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
}
- if (containsViews) {
+ // Add the table headers even if no tables were found
+ if (tableListContainsViews) {
[tables insertObject:NSLocalizedString(@"TABLES & VIEWS",@"header for table & views list") atIndex:0];
} else {
[tables insertObject:NSLocalizedString(@"TABLES",@"header for table list") atIndex:0];
}
+ [tableTypes insertObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE] atIndex:0];
[tablesListView reloadData];
// if the previous selected table still exists, select it
- if( selectedTable != nil && [tables indexOfObject:selectedTable] < [tables count]) {
- [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:[tables indexOfObject:selectedTable]] byExtendingSelection:NO];
+ if( previousSelectedTable != nil && [tables indexOfObject:previousSelectedTable] < [tables count]) {
+ int itemToReselect = [tables indexOfObject:previousSelectedTable];
+ [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemToReselect] byExtendingSelection:NO];
+ if (selectedTableName) [selectedTableName release];
+ selectedTableName = [[NSString alloc] initWithString:[tables objectAtIndex:itemToReselect]];
+ selectedTableType = [[tableTypes objectAtIndex:itemToReselect] intValue];
+ } else {
+ selectedTableName = nil;
+ selectedTableType = SP_TABLETYPE_NONE;
+ }
+
+ // Determine whether or not to show the list filter based on the number of tables, and clear it
+ [self clearFilter];
+ if ([tables count] > 20) [self showFilter];
+ else [self hideFilter];
+
+ // Set the filter placeholder text
+ if ([tableDocumentInstance database]) {
+ if ([theResult numOfRows]) [[listFilterField cell] setPlaceholderString:NSLocalizedString(@"Filter tables, views, procs & funcs", @"Filter placeholder when all tables types are present")];
+ else if (tableListContainsViews) [[listFilterField cell] setPlaceholderString:NSLocalizedString(@"Filter tables and views", @"Filter placeholder when tables and views are present")];
+ else [[listFilterField cell] setPlaceholderString:NSLocalizedString(@"Filter the list of tables", @"Filter placeholder when only tables are present")];
}
}
@@ -254,11 +283,35 @@
[mySQLConnection queryString:createStatement];
if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
- // Table creation was successful
- [tables insertObject:tableName atIndex:1];
- [tableTypes insertObject:[NSNumber numberWithInt:SP_TABLETYPE_TABLE] atIndex:1];
- [tablesListView reloadData];
- [tablesListView selectRow:1 byExtendingSelection:NO];
+
+ // Table creation was successful - insert the new item into the tables list and select it.
+ int addItemAtIndex = NSNotFound;
+ for (int i = 0; i < [tables count]; i++) {
+ int tableType = [[tableTypes objectAtIndex:i] intValue];
+ if (tableType == SP_TABLETYPE_NONE) continue;
+ if (tableType == SP_TABLETYPE_PROC || tableType == SP_TABLETYPE_FUNC) {
+ addItemAtIndex = i - 1;
+ break;
+ }
+ if ([tableName localizedCompare:[tables objectAtIndex:i]] == NSOrderedAscending) {
+ addItemAtIndex = i;
+ break;
+ }
+ }
+ if (addItemAtIndex == NSNotFound) {
+ [tables addObject:tableName];
+ [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_TABLE]];
+ } else {
+ [tables insertObject:tableName atIndex:addItemAtIndex];
+ [tableTypes insertObject:[NSNumber numberWithInt:SP_TABLETYPE_TABLE] atIndex:addItemAtIndex];
+ }
+
+ // Set the selected table name and type, and then use updateFilter to update the filter list and selection.
+ if (selectedTableName) [selectedTableName release];
+ selectedTableName = [[NSString alloc] initWithString:tableName];
+ selectedTableType = SP_TABLETYPE_TABLE;
+ [self updateFilter:self];
+ [tablesListView scrollRowToVisible:[tablesListView selectedRow]];
NSInteger selectedIndex = [tabView indexOfTabViewItem:[tabView selectedTabViewItem]];
@@ -299,8 +352,6 @@
[NSString stringWithFormat:NSLocalizedString(@"Couldn't add table %@.\nMySQL said: %@", @"message of panel when table cannot be created with the given name"),
tableName, [mySQLConnection getLastErrorMessage]]);
- [tableTypes removeObjectAtIndex:([tableTypes count] - 1)];
- [tables removeObjectAtIndex:([tables count] - 1)];
[tablesListView reloadData];
}
@@ -342,25 +393,25 @@
unsigned currentIndex = [indexes lastIndex];
if ([tablesListView numberOfSelectedRows] == 1) {
- if([[tableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_VIEW)
+ if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_VIEW)
tblTypes = NSLocalizedString(@"view", @"view");
- else if([[tableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_TABLE)
+ else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_TABLE)
tblTypes = NSLocalizedString(@"table", @"table");
- else if([[tableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_PROC)
+ else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_PROC)
tblTypes = NSLocalizedString(@"procedure", @"procedure");
- else if([[tableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_FUNC)
+ else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_FUNC)
tblTypes = NSLocalizedString(@"function", @"function");
- [alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete %@ '%@'?", @"delete table/view message"), tblTypes, [tables objectAtIndex:[tablesListView selectedRow]]]];
- [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the %@ '%@'. This operation cannot be undone.", @"delete table/view informative message"), tblTypes, [tables objectAtIndex:[tablesListView selectedRow]]]];
+ [alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete %@ '%@'?", @"delete table/view message"), tblTypes, [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
+ [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the %@ '%@'. This operation cannot be undone.", @"delete table/view informative message"), tblTypes, [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
}
else {
BOOL areTableTypeEqual = YES;
- int lastType = [[tableTypes objectAtIndex:currentIndex] intValue];
+ int lastType = [[filteredTableTypes objectAtIndex:currentIndex] intValue];
while (currentIndex != NSNotFound)
{
- if([[tableTypes objectAtIndex:currentIndex] intValue]!=lastType)
+ if([[filteredTableTypes objectAtIndex:currentIndex] intValue]!=lastType)
{
areTableTypeEqual = NO;
break;
@@ -415,7 +466,7 @@
[tableWindow endEditingFor:nil];
// Detect table type: table or view
- tblType = [[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue];
+ tblType = [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] intValue];
switch (tblType){
case SP_TABLETYPE_TABLE:
@@ -439,7 +490,7 @@
[copyTableMessageField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Duplicate %@ '%@' to:", @"duplicate object message"), tableType, [self tableName]]];
//open copyTableSheet
- [copyTableNameField setStringValue:[NSString stringWithFormat:@"%@_copy", [tables objectAtIndex:[tablesListView selectedRow]]]];
+ [copyTableNameField setStringValue:[NSString stringWithFormat:@"%@_copy", [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
[copyTableContentSwitch setState:NSOffState];
[NSApp beginSheet:copyTableSheet
@@ -463,7 +514,7 @@
//get table/view structure
queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE %@ %@",
[tableType uppercaseString],
- [[tables objectAtIndex:[tablesListView selectedRow]] backtickQuotedString]
+ [[filteredTables objectAtIndex:[tablesListView selectedRow]] backtickQuotedString]
]];
if ( ![queryResult numOfRows] ) {
@@ -492,10 +543,10 @@
{
// get the create syntax
MCPResult *theResult;
- if([self tableType] == SP_TABLETYPE_PROC)
- theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE PROCEDURE %@", [[tables objectAtIndex:[tablesListView selectedRow]] backtickQuotedString]]];
+ if(selectedTableType == SP_TABLETYPE_PROC)
+ theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE PROCEDURE %@", [selectedTableName backtickQuotedString]]];
else if([self tableType] == SP_TABLETYPE_FUNC)
- theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE FUNCTION %@", [[tables objectAtIndex:[tablesListView selectedRow]] backtickQuotedString]]];
+ theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE FUNCTION %@", [selectedTableName backtickQuotedString]]];
else
return;
@@ -503,7 +554,7 @@
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
if ([mySQLConnection isConnected]) {
NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while retrieving the create syntax for '%@'.\nMySQL said: %@", @"message of panel when create syntax cannot be retrieved"), [tables objectAtIndex:[tablesListView selectedRow]], [mySQLConnection getLastErrorMessage]]);
+ [NSString stringWithFormat:NSLocalizedString(@"An error occured while retrieving the create syntax for '%@'.\nMySQL said: %@", @"message of panel when create syntax cannot be retrieved"), selectedTableName, [mySQLConnection getLastErrorMessage]]);
}
return;
}
@@ -535,7 +586,7 @@
[mySQLConnection queryString:[NSString stringWithFormat:
@"INSERT INTO %@ SELECT * FROM %@",
[[copyTableNameField stringValue] backtickQuotedString],
- [[tables objectAtIndex:[tablesListView selectedRow]] backtickQuotedString]
+ [selectedTableName backtickQuotedString]
]];
if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
@@ -553,13 +604,41 @@
);
}
}
+
+ // Insert the new item into the tables list and select it.
+ int addItemAtIndex = NSNotFound;
+ for (int i = 0; i < [tables count]; i++) {
+ int tableType = [[tableTypes objectAtIndex:i] intValue];
+ if (tableType == SP_TABLETYPE_NONE) continue;
+ if ((tableType == SP_TABLETYPE_VIEW || tableType == SP_TABLETYPE_TABLE)
+ && (tblType == SP_TABLETYPE_PROC || tblType == SP_TABLETYPE_FUNC)) {
+ continue;
+ }
+ if ((tableType == SP_TABLETYPE_PROC || tableType == SP_TABLETYPE_FUNC)
+ && (tblType == SP_TABLETYPE_VIEW || tblType == SP_TABLETYPE_TABLE)) {
+ addItemAtIndex = i - 1;
+ break;
+ }
+ if ([[copyTableNameField stringValue] localizedCompare:[tables objectAtIndex:i]] == NSOrderedAscending) {
+ addItemAtIndex = i;
+ break;
+ }
+ }
+ if (addItemAtIndex == NSNotFound) {
+ [tables addObject:[copyTableNameField stringValue]];
+ [tableTypes addObject:[NSNumber numberWithInt:tblType]];
+ } else {
+ [tables insertObject:[copyTableNameField stringValue] atIndex:addItemAtIndex];
+ [tableTypes insertObject:[NSNumber numberWithInt:tblType] atIndex:addItemAtIndex];
+ }
- [tables insertObject:[copyTableNameField stringValue] atIndex:[tablesListView selectedRow]+1];
- [tableTypes insertObject:[NSNumber numberWithInt:tblType] atIndex:[tablesListView selectedRow]+1];
- [tablesListView selectRow:[tablesListView selectedRow]+1 byExtendingSelection:NO];
- [self updateTables:self];
+ // Set the selected table name and type, and use updateFilter to update the filter list and selection
+ if (selectedTableName) [selectedTableName release];
+ selectedTableName = [[NSString alloc] initWithString:[copyTableNameField stringValue]];
+ selectedTableType = tblType;
+ [self updateFilter:self];
+ [self updateSelection];
[tablesListView scrollRowToVisible:[tablesListView selectedRow]];
-
}
}
}
@@ -622,9 +701,14 @@
}
else {
// If there was no error, rename the table in our list and reload the table view's data
- [tables replaceObjectAtIndex:[tablesListView selectedRow] withObject:[tableRenameField stringValue]];
-
+ if (isTableListFiltered) {
+ [tables replaceObjectAtIndex:[tables indexOfObject:[self tableName]] withObject:[tableRenameField stringValue]];
+ }
+ [filteredTables replaceObjectAtIndex:[tablesListView selectedRow] withObject:[tableRenameField stringValue]];
+ if (selectedTableName) [selectedTableName release];
+ selectedTableName = [[NSString alloc] initWithString:[tableRenameField stringValue]];
[tablesListView reloadData];
+ [self updateSelection];
}
} else {
// procedures and functions can only be renamed if one creates the new one and delete the old one
@@ -664,11 +748,18 @@
NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"Couldn't rename '%@'.\nMySQL said: %@", @"message of panel when an item cannot be renamed"), [self tableName], [mySQLConnection getLastErrorMessage]]);
} else {
- [tables replaceObjectAtIndex:[tablesListView selectedRow] withObject:[tableRenameField stringValue]];
+ if (isTableListFiltered) {
+ [tables replaceObjectAtIndex:[tables indexOfObject:[self tableName]] withObject:[tableRenameField stringValue]];
+ }
+ [filteredTables replaceObjectAtIndex:[tablesListView selectedRow] withObject:[tableRenameField stringValue]];
+ if (selectedTableName) [selectedTableName release];
+ selectedTableName = [[NSString alloc] initWithString:[tableRenameField stringValue]];
[tablesListView reloadData];
+ [self updateSelection];
}
}
- // set window title
+
+ // Set window title
[tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@/%@", [tableDocumentInstance mySQLVersion],
[tableDocumentInstance name], [tableDocumentInstance database], [tableRenameField stringValue]]];
}
@@ -694,8 +785,8 @@
[[buttons objectAtIndex:1] setKeyEquivalent:@"\r"];
if ([tablesListView numberOfSelectedRows] == 1) {
- [alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Truncate table '%@'?", @"truncate table message"), [tables objectAtIndex:[tablesListView selectedRow]]]];
- [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete ALL records in the table '%@'. This operation cannot be undone.", @"truncate table informative message"), [tables objectAtIndex:[tablesListView selectedRow]]]];
+ [alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Truncate table '%@'?", @"truncate table message"), [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
+ [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete ALL records in the table '%@'. This operation cannot be undone.", @"truncate table informative message"), [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
}
else {
[alert setMessageText:NSLocalizedString(@"Truncate selected tables?", @"truncate tables message")];
@@ -764,28 +855,33 @@
while (currentIndex != NSNotFound)
{
- if([[tableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_VIEW) {
+ if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_VIEW) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP VIEW %@",
- [[tables objectAtIndex:currentIndex] backtickQuotedString]
+ [[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
- } else if([[tableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_TABLE) {
+ } else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_TABLE) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP TABLE %@",
- [[tables objectAtIndex:currentIndex] backtickQuotedString]
+ [[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
- } else if([[tableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_PROC) {
+ } else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_PROC) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP PROCEDURE %@",
- [[tables objectAtIndex:currentIndex] backtickQuotedString]
+ [[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
- } else if([[tableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_FUNC) {
+ } else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_FUNC) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP FUNCTION %@",
- [[tables objectAtIndex:currentIndex] backtickQuotedString]
+ [[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
}
if ( [[mySQLConnection getLastErrorMessage] isEqualTo:@""] ) {
//dropped table with success
- [tables removeObjectAtIndex:currentIndex];
- [tableTypes removeObjectAtIndex:currentIndex];
+ if (isTableListFiltered) {
+ int unfilteredIndex = [tables indexOfObject:[filteredTables objectAtIndex:currentIndex]];
+ [tables removeObjectAtIndex:unfilteredIndex];
+ [tableTypes removeObjectAtIndex:unfilteredIndex];
+ }
+ [filteredTables removeObjectAtIndex:currentIndex];
+ [filteredTableTypes removeObjectAtIndex:currentIndex];
} else {
//couldn't drop table
error = TRUE;
@@ -795,6 +891,15 @@
// get next index (beginning from the end)
currentIndex = [indexes indexLessThanIndex:currentIndex];
}
+
+ // Remove the isolated "current selection" item for filtered lists if appropriate
+ if (isTableListFiltered && [filteredTables count] > 1
+ && [[filteredTableTypes objectAtIndex:[filteredTableTypes count]-1] intValue] == SP_TABLETYPE_NONE
+ && [[filteredTables objectAtIndex:[filteredTables count]-1] isEqualToString:NSLocalizedString(@"CURRENT SELECTION",@"header for current selection in filtered list")])
+ {
+ [filteredTables removeLastObject];
+ [filteredTableTypes removeLastObject];
+ }
[tablesListView reloadData];
@@ -822,13 +927,13 @@
while (currentIndex != NSNotFound)
{
- [mySQLConnection queryString:[NSString stringWithFormat: @"TRUNCATE TABLE %@", [[tables objectAtIndex:currentIndex] backtickQuotedString]]];
+ [mySQLConnection queryString:[NSString stringWithFormat: @"TRUNCATE TABLE %@", [[filteredTables objectAtIndex:currentIndex] backtickQuotedString]]];
// Couldn't truncate table
if (![[mySQLConnection getLastErrorMessage] isEqualTo:@""]) {
NSBeginAlertSheet(NSLocalizedString(@"Error truncating table", @"error truncating table message"),
NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occurred while trying to truncate the table '%@'.\n\nMySQL said: %@", @"error truncating table informative message"), [tables objectAtIndex:currentIndex], [mySQLConnection getLastErrorMessage]]);
+ [NSString stringWithFormat:NSLocalizedString(@"An error occurred while trying to truncate the table '%@'.\n\nMySQL said: %@", @"error truncating table informative message"), [filteredTables objectAtIndex:currentIndex], [mySQLConnection getLastErrorMessage]]);
}
// Get next index (beginning from the end)
@@ -898,6 +1003,299 @@
}
}
+/**
+ * Updates the current table selection. Triggered most times tableViewSelectionDidChange:
+ * fires, and also as a result of certain table actions.
+ */
+- (void)updateSelection
+{
+ if ( [tablesListView numberOfSelectedRows] == 1 && [[filteredTables objectAtIndex:[tablesListView selectedRow]] length] ) {
+
+ // Update the selected table name and type
+ if (selectedTableName) [selectedTableName release];
+ selectedTableName = [[NSString alloc] initWithString:[filteredTables objectAtIndex:[tablesListView selectedRow]]];
+ selectedTableType = [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] intValue];
+
+ // Remove the "current selection" item for filtered lists if appropriate
+ if (isTableListFiltered && [tablesListView selectedRow] < [filteredTables count] - 2 && [filteredTables count] > 2
+ && [[filteredTableTypes objectAtIndex:[filteredTableTypes count]-2] intValue] == SP_TABLETYPE_NONE
+ && [[filteredTables objectAtIndex:[filteredTables count]-2] isEqualToString:NSLocalizedString(@"CURRENT SELECTION",@"header for current selection in filtered list")])
+ {
+ [filteredTables removeObjectsInRange:NSMakeRange([filteredTables count]-2, 2)];
+ [filteredTableTypes removeObjectsInRange:NSMakeRange([filteredTableTypes count]-2, 2)];
+ [tablesListView reloadData];
+ }
+
+ // Reset the table information caches
+ [tableDataInstance resetAllData];
+
+ [separatorTableMenuItem setHidden:NO];
+ [separatorTableContextMenuItem setHidden:NO];
+
+ if( selectedTableType == SP_TABLETYPE_VIEW || selectedTableType == SP_TABLETYPE_TABLE) {
+
+ // tableEncoding == nil indicates that there was an error while retrieving table data
+ NSString *tableEncoding = [tableDataInstance tableEncoding];
+
+ // If encoding is set to Autodetect, update the connection character set encoding
+ // based on the newly selected table's encoding - but only if it differs from the current encoding.
+ if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultEncoding"] isEqualToString:@"Autodetect"]) {
+ if (tableEncoding != nil && ![tableEncoding isEqualToString:[tableDocumentInstance connectionEncoding]]) {
+ [tableDocumentInstance setConnectionEncoding:tableEncoding reloadingViews:NO];
+ [tableDataInstance resetAllData];
+ }
+ }
+
+ if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
+ [tableSourceInstance loadTable:selectedTableName];
+ structureLoaded = YES;
+ contentLoaded = NO;
+ statusLoaded = NO;
+ } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
+ if(tableEncoding == nil) {
+ [tableContentInstance loadTable:nil];
+ } else {
+ [tableContentInstance loadTable:selectedTableName];
+ }
+ structureLoaded = NO;
+ contentLoaded = YES;
+ statusLoaded = NO;
+ } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) {
+ [extendedTableInfoInstance loadTable:selectedTableName];
+ structureLoaded = NO;
+ contentLoaded = NO;
+ statusLoaded = YES;
+ } else {
+ structureLoaded = NO;
+ contentLoaded = NO;
+ statusLoaded = NO;
+ }
+ } else {
+
+ // if we are not looking at a table or view, clear these
+ [tableSourceInstance loadTable:nil];
+ [tableContentInstance loadTable:nil];
+ [extendedTableInfoInstance loadTable:nil];
+ structureLoaded = NO;
+ contentLoaded = NO;
+ statusLoaded = NO;
+ }
+
+ // Set gear menu items Remove/Duplicate table/view and mainMenu > Table items
+ // according to the table types
+ NSMenu *tableSubMenu = [[[NSApp mainMenu] itemAtIndex:5] submenu];
+
+ if(selectedTableType == SP_TABLETYPE_VIEW)
+ {
+ // Change mainMenu > Table > ... according to table type
+ [[tableSubMenu itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create View Syntax", @"copy create view syntax menu item")];
+ [[tableSubMenu itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create View Syntax", @"show create view syntax menu item")];
+ [[tableSubMenu itemAtIndex:2] setHidden:NO]; // divider
+ [[tableSubMenu itemAtIndex:3] setHidden:NO];
+ [[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Check View", @"check view menu item")];
+ [[tableSubMenu itemAtIndex:4] setHidden:YES]; // repair
+ [[tableSubMenu itemAtIndex:5] setHidden:YES]; // divider
+ [[tableSubMenu itemAtIndex:6] setHidden:YES]; // analyse
+ [[tableSubMenu itemAtIndex:7] setHidden:YES]; // optimize
+ [[tableSubMenu itemAtIndex:8] setHidden:NO];
+ [[tableSubMenu itemAtIndex:8] setTitle:NSLocalizedString(@"Flush View", @"flush view menu item")];
+ [[tableSubMenu itemAtIndex:9] setHidden:YES]; // checksum
+
+ [renameTableMenuItem setHidden:NO]; // we don't have to check the mysql version
+ [renameTableMenuItem setTitle:NSLocalizedString(@"Rename View...", @"rename view menu title")];
+ [duplicateTableMenuItem setHidden:NO];
+ [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate View...", @"duplicate view menu title")];
+ [truncateTableButton setHidden:YES];
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove View", @"remove view menu title")];
+
+ [renameTableContextMenuItem setHidden:NO]; // we don't have to check the mysql version
+ [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename View...", @"rename view menu title")];
+ [duplicateTableContextMenuItem setHidden:NO];
+ [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate View...", @"duplicate view menu title")];
+ [truncateTableContextButton setHidden:YES];
+ [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove View", @"remove view menu title")];
+ }
+ else if(selectedTableType == SP_TABLETYPE_TABLE) {
+ [[tableSubMenu itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create Table Syntax", @"copy create table syntax menu item")];
+ [[tableSubMenu itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create Table Syntax", @"show create table syntax menu item")];
+ [[tableSubMenu itemAtIndex:2] setHidden:NO]; // divider
+ [[tableSubMenu itemAtIndex:3] setHidden:NO];
+ [[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Check Table", @"check table menu item")];
+ [[tableSubMenu itemAtIndex:4] setHidden:NO];
+ [[tableSubMenu itemAtIndex:5] setHidden:NO]; // divider
+ [[tableSubMenu itemAtIndex:6] setHidden:NO];
+ [[tableSubMenu itemAtIndex:7] setHidden:NO];
+ [[tableSubMenu itemAtIndex:8] setHidden:NO];
+ [[tableSubMenu itemAtIndex:8] setTitle:NSLocalizedString(@"Flush Table", @"flush table menu item")];
+ [[tableSubMenu itemAtIndex:9] setHidden:NO];
+
+ [renameTableMenuItem setHidden:NO];
+ [renameTableMenuItem setTitle:NSLocalizedString(@"Rename Table...", @"rename table menu title")];
+ [duplicateTableMenuItem setHidden:NO];
+ [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate Table...", @"duplicate table menu title")];
+ [truncateTableButton setHidden:NO];
+ [truncateTableButton setTitle:NSLocalizedString(@"Truncate Table", @"truncate table menu title")];
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Table", @"remove table menu title")];
+
+ [renameTableContextMenuItem setHidden:NO];
+ [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename Table...", @"rename table menu title")];
+ [duplicateTableContextMenuItem setHidden:NO];
+ [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate Table...", @"duplicate table menu title")];
+ [truncateTableContextButton setHidden:NO];
+ [truncateTableContextButton setTitle:NSLocalizedString(@"Truncate Table", @"truncate table menu title")];
+ [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Table", @"remove table menu title")];
+
+ }
+ else if(selectedTableType == SP_TABLETYPE_PROC) {
+ [[tableSubMenu itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create Procedure Syntax", @"copy create proc syntax menu item")];
+ [[tableSubMenu itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create Procedure Syntax", @"show create proc syntax menu item")];
+ [[tableSubMenu itemAtIndex:2] setHidden:YES]; // divider
+ [[tableSubMenu itemAtIndex:3] setHidden:YES]; // copy columns
+ [[tableSubMenu itemAtIndex:4] setHidden:YES]; // divider
+ [[tableSubMenu itemAtIndex:5] setHidden:YES];
+ [[tableSubMenu itemAtIndex:6] setHidden:YES];
+ [[tableSubMenu itemAtIndex:7] setHidden:YES]; // divider
+ [[tableSubMenu itemAtIndex:8] setHidden:YES];
+ [[tableSubMenu itemAtIndex:9] setHidden:YES];
+
+ [renameTableMenuItem setHidden:NO];
+ [renameTableMenuItem setTitle:NSLocalizedString(@"Rename Procedure...", @"rename proc menu title")];
+ [duplicateTableMenuItem setHidden:NO];
+ [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate Procedure...", @"duplicate proc menu title")];
+ [truncateTableButton setHidden:YES];
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Procedure", @"remove proc menu title")];
+
+ [renameTableContextMenuItem setHidden:NO];
+ [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename Procedure...", @"rename proc menu title")];
+ [duplicateTableContextMenuItem setHidden:NO];
+ [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate Procedure...", @"duplicate proc menu title")];
+ [truncateTableContextButton setHidden:YES];
+ [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Procedure", @"remove proc menu title")];
+
+ }
+ else if(selectedTableType == SP_TABLETYPE_FUNC) {
+ [[tableSubMenu itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create Function Syntax", @"copy create func syntax menu item")];
+ [[tableSubMenu itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create Function Syntax", @"show create func syntax menu item")];
+ [[tableSubMenu itemAtIndex:2] setHidden:YES]; // divider
+ [[tableSubMenu itemAtIndex:3] setHidden:YES]; // copy columns
+ [[tableSubMenu itemAtIndex:4] setHidden:YES]; // divider
+ [[tableSubMenu itemAtIndex:5] setHidden:YES];
+ [[tableSubMenu itemAtIndex:6] setHidden:YES];
+ [[tableSubMenu itemAtIndex:7] setHidden:YES]; // divider
+ [[tableSubMenu itemAtIndex:8] setHidden:YES];
+ [[tableSubMenu itemAtIndex:9] setHidden:YES];
+
+ [renameTableMenuItem setHidden:NO];
+ [renameTableMenuItem setTitle:NSLocalizedString(@"Rename Function...", @"rename func menu title")];
+ [duplicateTableMenuItem setHidden:NO];
+ [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate Function...", @"duplicate func menu title")];
+ [truncateTableButton setHidden:YES];
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Function", @"remove func menu title")];
+
+ [renameTableContextMenuItem setHidden:NO];
+ [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename Function...", @"rename func menu title")];
+ [duplicateTableContextMenuItem setHidden:NO];
+ [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate Function...", @"duplicate func menu title")];
+ [truncateTableContextButton setHidden:YES];
+ [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Function", @"remove func menu title")];
+
+ }
+ // set window title
+ [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@/%@", [tableDocumentInstance mySQLVersion],
+ [tableDocumentInstance name], [tableDocumentInstance database], selectedTableName]];
+
+ // Update the "Show Create Syntax" window if it's already opened
+ // according to the selected table/view/proc/func
+ if([[tableDocumentInstance getCreateTableSyntaxWindow] isVisible])
+ [tableDocumentInstance showCreateTableSyntax:self];
+
+ } else {
+ NSIndexSet *indexes = [tablesListView selectedRowIndexes];
+
+ // Update the selected table name and type
+ if (selectedTableName) [selectedTableName release];
+ if ([indexes count]) {
+ selectedTableName = [[NSString alloc] initWithString:@""];
+ } else {
+ selectedTableName = nil;
+ }
+ selectedTableType = SP_TABLETYPE_NONE;
+
+ [tableSourceInstance loadTable:nil];
+ [tableContentInstance loadTable:nil];
+ [extendedTableInfoInstance loadTable:nil];
+ structureLoaded = NO;
+ contentLoaded = NO;
+ statusLoaded = NO;
+
+ // Set gear menu items Remove/Duplicate table/view according to the table types
+ // if at least one item is selected
+ if([indexes count]) {
+ unsigned int currentIndex = [indexes lastIndex];
+ BOOL areTableTypeEqual = YES;
+ int lastType = [[filteredTableTypes objectAtIndex:currentIndex] intValue];
+ while (currentIndex != NSNotFound)
+ {
+ if ([[filteredTableTypes objectAtIndex:currentIndex] intValue] != lastType)
+ {
+ areTableTypeEqual = NO;
+ break;
+ }
+ currentIndex = [indexes indexLessThanIndex:currentIndex];
+ }
+ if (areTableTypeEqual)
+ {
+ switch (lastType) {
+ case SP_TABLETYPE_TABLE:
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Tables", @"remove tables menu title")];
+ [truncateTableButton setTitle:NSLocalizedString(@"Truncate Tables", @"truncate tables menu item")];
+ [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Tables", @"remove tables menu title")];
+ [truncateTableContextButton setTitle:NSLocalizedString(@"Truncate Tables", @"truncate tables menu item")];
+ [truncateTableButton setHidden:NO];
+ [truncateTableContextButton setHidden:NO];
+ break;
+ case SP_TABLETYPE_VIEW:
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Views", @"remove views menu title")];
+ [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Views", @"remove views menu title")];
+ [truncateTableButton setHidden:YES];
+ [truncateTableContextButton setHidden:YES];
+ break;
+ case SP_TABLETYPE_PROC:
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Procedures", @"remove procedures menu title")];
+ [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Procedures", @"remove procedures menu title")];
+ [truncateTableButton setHidden:YES];
+ [truncateTableContextButton setHidden:YES];
+ break;
+ case SP_TABLETYPE_FUNC:
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Functions", @"remove functions menu title")];
+ [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Functions", @"remove functions menu title")];
+ [truncateTableButton setHidden:YES];
+ [truncateTableContextButton setHidden:YES];
+ break;
+ }
+
+ } else {
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Items", @"remove items menu title")];
+ [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Items", @"remove items menu title")];
+ [truncateTableButton setHidden:YES];
+ [truncateTableContextButton setHidden:YES];
+ }
+ }
+ [renameTableContextMenuItem setHidden:YES];
+ [duplicateTableContextMenuItem setHidden:YES];
+ [separatorTableContextMenuItem setHidden:YES];
+
+ [renameTableMenuItem setHidden:YES];
+ [duplicateTableMenuItem setHidden:YES];
+ [separatorTableMenuItem setHidden:YES];
+ [separatorTableContextMenuItem setHidden:YES];
+
+ // set window title
+ [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", [tableDocumentInstance mySQLVersion],
+ [tableDocumentInstance name], [tableDocumentInstance database]]];
+ }
+}
+
#pragma mark Getter methods
/**
@@ -905,13 +1303,7 @@
*/
- (NSString *)tableName
{
- if ( [tablesListView numberOfSelectedRows] == 1 ) {
- return [tables objectAtIndex:[tablesListView selectedRow]];
- } else if ([tablesListView numberOfSelectedRows] > 1) {
- return @"";
- } else {
- return nil;
- }
+ return selectedTableName;
}
/*
@@ -919,13 +1311,7 @@
*/
- (int) tableType
{
- if ( [tablesListView numberOfSelectedRows] == 1 ) {
- return [[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue];
- } else if ([tablesListView numberOfSelectedRows] > 1) {
- return -1;
- } else {
- return -1;
- }
+ return selectedTableType;
}
/**
@@ -1068,7 +1454,7 @@
int itemIndex = NSNotFound;
int caseInsensitiveItemIndex = NSNotFound;
- // Loop through the tables/views to find the desired item
+ // Loop through the unfiltered tables/views to find the desired item
for (i = 0; i < [tables count]; i++) {
tableType = [[tableTypes objectAtIndex:i] intValue];
if (tableType != SP_TABLETYPE_TABLE && tableType != SP_TABLETYPE_VIEW) continue;
@@ -1087,7 +1473,21 @@
// If no match found, return failure
if (itemIndex == NSNotFound) return NO;
- [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO];
+ if (!isTableListFiltered) {
+ [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO];
+ } else {
+ int filteredIndex = [filteredTables indexOfObject:[tables objectAtIndex:itemIndex]];
+ if (filteredIndex != NSNotFound) {
+ [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:filteredIndex] byExtendingSelection:NO];
+ } else {
+ [tablesListView deselectAll:nil];
+ if (selectedTableName) [selectedTableName release];
+ selectedTableName = [[NSString alloc] initWithString:[tables objectAtIndex:itemIndex]];
+ selectedTableType = [[tableTypes objectAtIndex:itemIndex] intValue];
+ [self updateFilter:self];
+ [self updateSelection];
+ }
+ }
return YES;
}
@@ -1098,7 +1498,7 @@
*/
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
- return [tables count];
+ return [filteredTables count];
}
/**
@@ -1106,16 +1506,15 @@
*/
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
- return [tables objectAtIndex:rowIndex];
+ return [filteredTables objectAtIndex:rowIndex];
}
/**
* Renames a table (in tables-array and mysql-db).
- * Removes new table from table-array if renaming had no success
*/
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
- if ([[tables objectAtIndex:rowIndex] isEqualToString:anObject]) {
+ if ([selectedTableName isEqualToString:anObject]) {
// No changes in table name
}
else if ([anObject isEqualToString:@""]) {
@@ -1125,16 +1524,16 @@
@selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addRow", NSLocalizedString(@"Empty names are not allowed.", @"message of panel when no name is given for an item"));
}
else {
- if([self tableType] == SP_TABLETYPE_VIEW || [self tableType] == SP_TABLETYPE_TABLE)
+ if(selectedTableType == SP_TABLETYPE_VIEW || selectedTableType == SP_TABLETYPE_TABLE)
{
- [mySQLConnection queryString:[NSString stringWithFormat:@"RENAME TABLE %@ TO %@", [[tables objectAtIndex:rowIndex] backtickQuotedString], [anObject backtickQuotedString]]];
+ [mySQLConnection queryString:[NSString stringWithFormat:@"RENAME TABLE %@ TO %@", [selectedTableName backtickQuotedString], [anObject backtickQuotedString]]];
}
else
{
// procedures and functions can only be renamed if one creates the new one and delete the old one
// get the create syntax
NSString *tableType;
- switch([self tableType]){
+ switch (selectedTableType){
case SP_TABLETYPE_PROC:
tableType = @"PROCEDURE";
break;
@@ -1143,10 +1542,10 @@
break;
}
MCPResult *theResult;
- if([self tableType] == SP_TABLETYPE_PROC)
- theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE PROCEDURE %@", [[tables objectAtIndex:rowIndex] backtickQuotedString]]];
- else if([self tableType] == SP_TABLETYPE_FUNC)
- theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE FUNCTION %@", [[tables objectAtIndex:rowIndex] backtickQuotedString]]];
+ if (selectedTableType == SP_TABLETYPE_PROC)
+ theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE PROCEDURE %@", [selectedTableName backtickQuotedString]]];
+ else if(selectedTableType == SP_TABLETYPE_FUNC)
+ theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE FUNCTION %@", [selectedTableName backtickQuotedString]]];
else
return;
@@ -1155,7 +1554,7 @@
if ([mySQLConnection isConnected]) {
NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"),
NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while retrieving create syntax for '%@'.\n\nMySQL said: %@", @"message of panel when create syntax cannot be retrieved"), [self tableName], [mySQLConnection getLastErrorMessage]]);
+ [NSString stringWithFormat:NSLocalizedString(@"An error occured while retrieving create syntax for '%@'.\n\nMySQL said: %@", @"message of panel when create syntax cannot be retrieved"), selectedTableName, [mySQLConnection getLastErrorMessage]]);
}
return;
@@ -1164,11 +1563,10 @@
id tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:2];
if ([tableSyntax isKindOfClass:[NSData class]])
- tableSyntax = [[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]];
+ tableSyntax = [[[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]] autorelease];
// replace the old name by the new one and drop the old one
[mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", tableType] withString:[anObject backtickQuotedString]]];
- [tableSyntax release];
if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
if ([mySQLConnection isConnected]) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP %@ %@", tableType, [[tables objectAtIndex:rowIndex] backtickQuotedString]]];
@@ -1178,8 +1576,15 @@
if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
// Renamed with success
- [tables replaceObjectAtIndex:rowIndex withObject:anObject];
- if([self tableType] == SP_TABLETYPE_FUNC || [self tableType] == SP_TABLETYPE_PROC)
+ if (isTableListFiltered) {
+ int unfilteredIndex = [tables indexOfObject:[filteredTables objectAtIndex:rowIndex]];
+ [tables replaceObjectAtIndex:unfilteredIndex withObject:anObject];
+ }
+ [filteredTables replaceObjectAtIndex:rowIndex withObject:anObject];
+ if (selectedTableName) [selectedTableName release];
+ selectedTableName = [[NSString alloc] initWithString:anObject];
+
+ if(selectedTableType == SP_TABLETYPE_FUNC || selectedTableType == SP_TABLETYPE_PROC)
return;
NSInteger selectedIndex = [tabView indexOfTabViewItem:[tabView selectedTabViewItem]];
@@ -1240,13 +1645,6 @@
//abort editing
[control abortEditing];
- if ( [[tables objectAtIndex:[tablesListView selectedRow]] isEqualToString:@""] ) {
- //user added new table and then pressed escape
- [tableTypes removeObjectAtIndex:[tablesListView selectedRow]];
- [tables removeObjectAtIndex:[tablesListView selectedRow]];
- [tablesListView reloadData];
- }
-
return TRUE;
} else{
return FALSE;
@@ -1278,264 +1676,17 @@
*/
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
{
- if ( [tablesListView numberOfSelectedRows] == 1 && [[self tableName] length] ) {
-
- // Reset the table information caches
- [tableDataInstance resetAllData];
-
- [separatorTableMenuItem setHidden:NO];
- [separatorTableContextMenuItem setHidden:NO];
-
- if( [[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_VIEW ||
- [[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_TABLE) {
-
- // tableEncoding == nil indicates that there was an error while retrieving table data
- NSString *tableEncoding = [tableDataInstance tableEncoding];
- // If encoding is set to Autodetect, update the connection character set encoding
- // based on the newly selected table's encoding - but only if it differs from the current encoding.
- if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultEncoding"] isEqualToString:@"Autodetect"]) {
- if (tableEncoding != nil && ![tableEncoding isEqualToString:[tableDocumentInstance connectionEncoding]]) {
- [tableDocumentInstance setConnectionEncoding:tableEncoding reloadingViews:NO];
- [tableDataInstance resetAllData];
- }
- }
-
- if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
- [tableSourceInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
- structureLoaded = YES;
- contentLoaded = NO;
- statusLoaded = NO;
- } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
- if(tableEncoding == nil) {
- [tableContentInstance loadTable:nil];
- } else {
- [tableContentInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
- }
- structureLoaded = NO;
- contentLoaded = YES;
- statusLoaded = NO;
- } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) {
- [extendedTableInfoInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = YES;
- } else {
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = NO;
- }
- } else {
- // if we are not looking at a table or view, clear these
- [tableSourceInstance loadTable:nil];
- [tableContentInstance loadTable:nil];
- [extendedTableInfoInstance loadTable:nil];
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = NO;
- }
-
- // Set gear menu items Remove/Duplicate table/view and mainMenu > Table items
- // according to the table types
- NSMenu *tableSubMenu = [[[NSApp mainMenu] itemAtIndex:5] submenu];
-
- if([[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_VIEW)
- {
- // Change mainMenu > Table > ... according to table type
- [[tableSubMenu itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create View Syntax", @"copy create view syntax menu item")];
- [[tableSubMenu itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create View Syntax", @"show create view syntax menu item")];
- [[tableSubMenu itemAtIndex:2] setHidden:NO]; // divider
- [[tableSubMenu itemAtIndex:3] setHidden:NO];
- [[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Check View", @"check view menu item")];
- [[tableSubMenu itemAtIndex:4] setHidden:YES]; // repair
- [[tableSubMenu itemAtIndex:5] setHidden:YES]; // divider
- [[tableSubMenu itemAtIndex:6] setHidden:YES]; // analyse
- [[tableSubMenu itemAtIndex:7] setHidden:YES]; // optimize
- [[tableSubMenu itemAtIndex:8] setHidden:NO];
- [[tableSubMenu itemAtIndex:8] setTitle:NSLocalizedString(@"Flush View", @"flush view menu item")];
- [[tableSubMenu itemAtIndex:9] setHidden:YES]; // checksum
-
- [renameTableMenuItem setHidden:NO]; // we don't have to check the mysql version
- [renameTableMenuItem setTitle:NSLocalizedString(@"Rename View...", @"rename view menu title")];
- [duplicateTableMenuItem setHidden:NO];
- [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate View...", @"duplicate view menu title")];
- [truncateTableButton setHidden:YES];
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove View", @"remove view menu title")];
-
- [renameTableContextMenuItem setHidden:NO]; // we don't have to check the mysql version
- [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename View...", @"rename view menu title")];
- [duplicateTableContextMenuItem setHidden:NO];
- [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate View...", @"duplicate view menu title")];
- [truncateTableContextButton setHidden:YES];
- [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove View", @"remove view menu title")];
- }
- else if([[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_TABLE) {
- [[tableSubMenu itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create Table Syntax", @"copy create table syntax menu item")];
- [[tableSubMenu itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create Table Syntax", @"show create table syntax menu item")];
- [[tableSubMenu itemAtIndex:2] setHidden:NO]; // divider
- [[tableSubMenu itemAtIndex:3] setHidden:NO];
- [[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Check Table", @"check table menu item")];
- [[tableSubMenu itemAtIndex:4] setHidden:NO];
- [[tableSubMenu itemAtIndex:5] setHidden:NO]; // divider
- [[tableSubMenu itemAtIndex:6] setHidden:NO];
- [[tableSubMenu itemAtIndex:7] setHidden:NO];
- [[tableSubMenu itemAtIndex:8] setHidden:NO];
- [[tableSubMenu itemAtIndex:8] setTitle:NSLocalizedString(@"Flush Table", @"flush table menu item")];
- [[tableSubMenu itemAtIndex:9] setHidden:NO];
-
- [renameTableMenuItem setHidden:NO];
- [renameTableMenuItem setTitle:NSLocalizedString(@"Rename Table...", @"rename table menu title")];
- [duplicateTableMenuItem setHidden:NO];
- [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate Table...", @"duplicate table menu title")];
- [truncateTableButton setHidden:NO];
- [truncateTableButton setTitle:NSLocalizedString(@"Truncate Table", @"truncate table menu title")];
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Table", @"remove table menu title")];
-
- [renameTableContextMenuItem setHidden:NO];
- [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename Table...", @"rename table menu title")];
- [duplicateTableContextMenuItem setHidden:NO];
- [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate Table...", @"duplicate table menu title")];
- [truncateTableContextButton setHidden:NO];
- [truncateTableContextButton setTitle:NSLocalizedString(@"Truncate Table", @"truncate table menu title")];
- [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Table", @"remove table menu title")];
-
- }
- else if([[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_PROC) {
- [[tableSubMenu itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create Procedure Syntax", @"copy create proc syntax menu item")];
- [[tableSubMenu itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create Procedure Syntax", @"show create proc syntax menu item")];
- [[tableSubMenu itemAtIndex:2] setHidden:YES]; // divider
- [[tableSubMenu itemAtIndex:3] setHidden:YES]; // copy columns
- [[tableSubMenu itemAtIndex:4] setHidden:YES]; // divider
- [[tableSubMenu itemAtIndex:5] setHidden:YES];
- [[tableSubMenu itemAtIndex:6] setHidden:YES];
- [[tableSubMenu itemAtIndex:7] setHidden:YES]; // divider
- [[tableSubMenu itemAtIndex:8] setHidden:YES];
- [[tableSubMenu itemAtIndex:9] setHidden:YES];
-
- [renameTableMenuItem setHidden:NO];
- [renameTableMenuItem setTitle:NSLocalizedString(@"Rename Procedure...", @"rename proc menu title")];
- [duplicateTableMenuItem setHidden:NO];
- [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate Procedure...", @"duplicate proc menu title")];
- [truncateTableButton setHidden:YES];
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Procedure", @"remove proc menu title")];
-
- [renameTableContextMenuItem setHidden:NO];
- [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename Procedure...", @"rename proc menu title")];
- [duplicateTableContextMenuItem setHidden:NO];
- [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate Procedure...", @"duplicate proc menu title")];
- [truncateTableContextButton setHidden:YES];
- [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Procedure", @"remove proc menu title")];
-
- }
- else if([[tableTypes objectAtIndex:[tablesListView selectedRow]] intValue] == SP_TABLETYPE_FUNC) {
- [[tableSubMenu itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create Function Syntax", @"copy create func syntax menu item")];
- [[tableSubMenu itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create Function Syntax", @"show create func syntax menu item")];
- [[tableSubMenu itemAtIndex:2] setHidden:YES]; // divider
- [[tableSubMenu itemAtIndex:3] setHidden:YES]; // copy columns
- [[tableSubMenu itemAtIndex:4] setHidden:YES]; // divider
- [[tableSubMenu itemAtIndex:5] setHidden:YES];
- [[tableSubMenu itemAtIndex:6] setHidden:YES];
- [[tableSubMenu itemAtIndex:7] setHidden:YES]; // divider
- [[tableSubMenu itemAtIndex:8] setHidden:YES];
- [[tableSubMenu itemAtIndex:9] setHidden:YES];
-
- [renameTableMenuItem setHidden:NO];
- [renameTableMenuItem setTitle:NSLocalizedString(@"Rename Function...", @"rename func menu title")];
- [duplicateTableMenuItem setHidden:NO];
- [duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate Function...", @"duplicate func menu title")];
- [truncateTableButton setHidden:YES];
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Function", @"remove func menu title")];
-
- [renameTableContextMenuItem setHidden:NO];
- [renameTableContextMenuItem setTitle:NSLocalizedString(@"Rename Function...", @"rename func menu title")];
- [duplicateTableContextMenuItem setHidden:NO];
- [duplicateTableContextMenuItem setTitle:NSLocalizedString(@"Duplicate Function...", @"duplicate func menu title")];
- [truncateTableContextButton setHidden:YES];
- [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Function", @"remove func menu title")];
-
- }
- // set window title
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@/%@", [tableDocumentInstance mySQLVersion],
- [tableDocumentInstance name], [tableDocumentInstance database], [tables objectAtIndex:[tablesListView selectedRow]]]];
-
- // Update the "Show Create Syntax" window if it's already opened
- // according to the selected table/view/proc/func
- if([[tableDocumentInstance getCreateTableSyntaxWindow] isVisible])
- [tableDocumentInstance showCreateTableSyntax:self];
-
- } else {
- [tableSourceInstance loadTable:nil];
- [tableContentInstance loadTable:nil];
- [extendedTableInfoInstance loadTable:nil];
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = NO;
- // Set gear menu items Remove/Duplicate table/view according to the table types
- // if at least one item is selected
- NSIndexSet *indexes = [tablesListView selectedRowIndexes];
- if([indexes count]) {
- unsigned int currentIndex = [indexes lastIndex];
- BOOL areTableTypeEqual = YES;
- int lastType = [[tableTypes objectAtIndex:currentIndex] intValue];
- while (currentIndex != NSNotFound)
- {
- if([[tableTypes objectAtIndex:currentIndex] intValue]!=lastType)
- {
- areTableTypeEqual = NO;
- break;
- }
- currentIndex = [indexes indexLessThanIndex:currentIndex];
- }
- if(areTableTypeEqual)
- {
- switch(lastType) {
- case SP_TABLETYPE_TABLE:
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Tables", @"remove tables menu title")];
- [truncateTableButton setTitle:NSLocalizedString(@"Truncate Tables", @"truncate tables menu item")];
- [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Tables", @"remove tables menu title")];
- [truncateTableContextButton setTitle:NSLocalizedString(@"Truncate Tables", @"truncate tables menu item")];
- [truncateTableButton setHidden:NO];
- [truncateTableContextButton setHidden:NO];
- break;
- case SP_TABLETYPE_VIEW:
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Views", @"remove views menu title")];
- [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Views", @"remove views menu title")];
- [truncateTableButton setHidden:YES];
- [truncateTableContextButton setHidden:YES];
- break;
- case SP_TABLETYPE_PROC:
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Procedures", @"remove procedures menu title")];
- [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Procedures", @"remove procedures menu title")];
- [truncateTableButton setHidden:YES];
- [truncateTableContextButton setHidden:YES];
- break;
- case SP_TABLETYPE_FUNC:
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Functions", @"remove functions menu title")];
- [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Functions", @"remove functions menu title")];
- [truncateTableButton setHidden:YES];
- [truncateTableContextButton setHidden:YES];
- break;
- }
-
- } else {
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove Items", @"remove items menu title")];
- [removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Items", @"remove items menu title")];
- [truncateTableButton setHidden:YES];
- [truncateTableContextButton setHidden:YES];
- }
- }
- [renameTableContextMenuItem setHidden:YES];
- [duplicateTableContextMenuItem setHidden:YES];
- [separatorTableContextMenuItem setHidden:YES];
-
- [renameTableMenuItem setHidden:YES];
- [duplicateTableMenuItem setHidden:YES];
- [separatorTableMenuItem setHidden:YES];
- [separatorTableContextMenuItem setHidden:YES];
- // set window title
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", [tableDocumentInstance mySQLVersion],
- [tableDocumentInstance name], [tableDocumentInstance database]]];
+ // Perform no action if the selected table hasn't actually changed - reselection etc
+ if ([tablesListView numberOfSelectedRows] == 1
+ && [[filteredTables objectAtIndex:[tablesListView selectedRow]] length]
+ && [selectedTableName isEqualToString:[filteredTables objectAtIndex:[tablesListView selectedRow]]]
+ && selectedTableType == [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] intValue])
+ {
+ return;
}
+
+ [self updateSelection];
}
/**
@@ -1544,9 +1695,9 @@
- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex
{
//return (rowIndex != 0);
- if( [tableTypes count] == 0 )
+ if( [filteredTableTypes count] == 0 )
return (rowIndex != 0 );
- return ([[tableTypes objectAtIndex:rowIndex] intValue] != SP_TABLETYPE_NONE );
+ return ([[filteredTableTypes objectAtIndex:rowIndex] intValue] != SP_TABLETYPE_NONE );
}
/**
@@ -1555,9 +1706,9 @@
- (BOOL)tableView:(NSTableView *)aTableView isGroupRow:(int)rowIndex
{
//return (row == 0);
- if( [tableTypes count] == 0 )
+ if( [filteredTableTypes count] == 0 )
return (rowIndex == 0 );
- return ([[tableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_NONE );
+ return ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_NONE );
}
/**
@@ -1566,17 +1717,17 @@
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
if (rowIndex > 0 && [[aTableColumn identifier] isEqualToString:@"tables"]) {
- if ([[tableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_VIEW) {
+ if ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_VIEW) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-view-small"]];
- } else if ([[tableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_TABLE) {
+ } else if ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_TABLE) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-small"]];
- } else if ([[tableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_PROC) {
+ } else if ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_PROC) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"proc-small"]];
- } else if ([[tableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_FUNC) {
+ } else if ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_FUNC) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"func-small"]];
}
- if ([[tableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_NONE) {
+ if ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_NONE) {
[(ImageAndTextCell*)aCell setImage:nil];
[(ImageAndTextCell*)aCell setIndentationLevel:0];
} else {
@@ -1608,17 +1759,17 @@
([self tableType] == SP_TABLETYPE_TABLE || [self tableType] == SP_TABLETYPE_VIEW) ) {
if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0) && !structureLoaded ) {
- [tableSourceInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ [tableSourceInstance loadTable:selectedTableName];
structureLoaded = YES;
}
if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1) && !contentLoaded ) {
- [tableContentInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ [tableContentInstance loadTable:selectedTableName];
contentLoaded = YES;
}
if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3) && !statusLoaded ) {
- [extendedTableInfoInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ [extendedTableInfoInstance loadTable:selectedTableName];
statusLoaded = YES;
}
}
@@ -1649,6 +1800,125 @@
return [super validateMenuItem:menuItem];
}
+#pragma mark Table list filter interaction
+
+/**
+ * Show the filter box if it's currently hidden. Use a delay to ensure
+ * action is executed on first load.
+ */
+- (void) showFilter
+{
+ if ([tableListFilterSplitView collapsibleSubviewIsCollapsed])
+ [tableListFilterSplitView performSelector:@selector(toggleCollapse:) withObject:nil afterDelay:0.0];
+}
+
+/**
+ * Hide the filter box if it's currently shown. Use a delay to ensure
+ * action is executed on first load.
+ */
+- (void) hideFilter
+{
+ if (![tableListFilterSplitView collapsibleSubviewIsCollapsed])
+ [tableListFilterSplitView performSelector:@selector(toggleCollapse:) withObject:nil afterDelay:0.0];
+}
+
+/**
+ * Clear the current content of the filter box
+ */
+- (void) clearFilter
+{
+ [listFilterField setStringValue:@""];
+}
+
+/**
+ * Update the filter search.
+ */
+- (IBAction) updateFilter:(id)sender
+{
+ if ([[listFilterField stringValue] length]) {
+ if (isTableListFiltered) {
+ [filteredTables release];
+ [filteredTableTypes release];
+ }
+ filteredTables = [[NSMutableArray alloc] init];
+ filteredTableTypes = [[NSMutableArray alloc] init];
+
+ int i, lastTableType = NSNotFound, tableType;
+ NSRange substringRange;
+ for (i = 0; i < [tables count]; i++) {
+ tableType = [[tableTypes objectAtIndex:i] intValue];
+ if (tableType == SP_TABLETYPE_NONE) continue;
+ substringRange = [[tables objectAtIndex:i] rangeOfString:[listFilterField stringValue] options:NSCaseInsensitiveSearch];
+ if (substringRange.location == NSNotFound) continue;
+
+ // Add a title if necessary
+ if ((tableType == SP_TABLETYPE_TABLE || tableType == SP_TABLETYPE_VIEW) && lastTableType == NSNotFound)
+ {
+ if (tableListContainsViews) {
+ [filteredTables addObject:NSLocalizedString(@"TABLES & VIEWS",@"header for table & views list")];
+ } else {
+ [filteredTables addObject:NSLocalizedString(@"TABLES",@"header for table list")];
+ }
+ [filteredTableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
+ } else if ((tableType == SP_TABLETYPE_PROC || tableType == SP_TABLETYPE_FUNC)
+ && (lastTableType == NSNotFound || lastTableType == SP_TABLETYPE_TABLE || lastTableType == SP_TABLETYPE_VIEW))
+ {
+ [filteredTables addObject:NSLocalizedString(@"PROCS & FUNCS",@"header for procs & funcs list")];
+ [filteredTableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
+ }
+ lastTableType = tableType;
+
+ // Add the item
+ [filteredTables addObject:[tables objectAtIndex:i]];
+ [filteredTableTypes addObject:[tableTypes objectAtIndex:i]];
+ }
+
+ // Add a "no matches" title if nothing matches the current filter settings
+ if (![filteredTables count]) {
+ [filteredTables addObject:NSLocalizedString(@"NO MATCHES",@"header for no matches in filtered list")];
+ [filteredTableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
+ }
+
+ // If the currently selected table isn't present in the filter list, add it as a special entry
+ if (selectedTableName && [filteredTables indexOfObject:selectedTableName] == NSNotFound) {
+ [filteredTables addObject:NSLocalizedString(@"CURRENT SELECTION",@"header for current selection in filtered list")];
+ [filteredTableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
+ [filteredTables addObject:selectedTableName];
+ [filteredTableTypes addObject:[NSNumber numberWithInt:selectedTableType]];
+ }
+
+// [self performSelector:@selector(selectTableAtIndex:) withObject:[NSNumber numberWithInt:[filteredTables indexOfObject:selectedTableName]] afterDelay:0.0];
+ isTableListFiltered = YES;
+ } else if (isTableListFiltered) {
+ isTableListFiltered = NO;
+ [filteredTables release];
+ filteredTables = tables;
+ [filteredTableTypes release];
+ filteredTableTypes = tableTypes;
+ if (selectedTableName) {
+// [self performSelector:@selector(selectTableAtIndex:) withObject:[NSNumber numberWithInt:[tables indexOfObject:selectedTableName]] afterDelay:0.0];
+ }
+ }
+
+ // Reselect correct row and reload the table view display
+ if ([tablesListView numberOfRows] < [filteredTables count]) [tablesListView noteNumberOfRowsChanged];
+ if (selectedTableName) [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:[filteredTables indexOfObject:selectedTableName]] byExtendingSelection:NO];
+ [tablesListView reloadData];
+}
+
+/**
+ * Select the supplied row index; added for convenience to allow
+ * use with performSelector:withObject:afterDelay: for re-selection.
+ */
+- (void) selectTableAtIndex:(NSNumber *)rowIndex
+{
+// int rowIndex = [rowIndex intValue];
+// if (rowIndex == NSNotFound || rowIndex > [filteredTables count] || [[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_NONE)
+// return;
+//
+// [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:rowIndex] byExtendingSelection:NO];
+}
+
#pragma mark Other
/**
@@ -1658,10 +1928,16 @@
{
if ((self = [super init])) {
tables = [[NSMutableArray alloc] init];
+ filteredTables = tables;
tableTypes = [[NSMutableArray alloc] init];
+ filteredTableTypes = tableTypes;
structureLoaded = NO;
contentLoaded = NO;
statusLoaded = NO;
+ isTableListFiltered = NO;
+ tableListContainsViews = NO;
+ selectedTableType = SP_TABLETYPE_NONE;
+ selectedTableName = nil;
[tables addObject:NSLocalizedString(@"TABLES",@"header for table list")];
}
@@ -1682,6 +1958,14 @@
[[tableListSplitView collapsibleSubview] setFrameSize:NSMakeSize([tableListSplitView collapsibleSubview].frame.size.width, 0)];
[tableListSplitView setCollapsibleSubviewCollapsed:YES];
}
+
+ // Start the table filter list collapsed
+ if ([tableListFilterSplitView collapsibleSubview]) {
+ [tableListFilterSplitView setValue:[NSNumber numberWithFloat:[tableListFilterSplitView collapsibleSubview].frame.size.height] forKey:@"uncollapsedSize"];
+ [[tableListFilterSplitView collapsibleSubview] setFrameSize:NSMakeSize([tableListFilterSplitView collapsibleSubview].frame.size.width, 0)];
+ [tableListFilterSplitView setCollapsibleSubviewCollapsed:YES];
+ }
+
}
/**
@@ -1689,8 +1973,11 @@
*/
- (void)dealloc
{
- [tables release], tables = nil;
- [tableTypes release], tableTypes = nil;
+ [tables release];
+ [tableTypes release];
+ if (isTableListFiltered && filteredTables) [filteredTables release];
+ if (isTableListFiltered && filteredTableTypes) [filteredTableTypes release];
+ if (selectedTableName) [selectedTableName release];
[super dealloc];
}
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index 9af19ca1..05809064 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -133,6 +133,7 @@
5822C9B51000DB2400DCC3D6 /* SPConnectionController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5822C9B41000DB2400DCC3D6 /* SPConnectionController.m */; };
5822CAE110011C8000DCC3D6 /* ConnectionView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5822CADF10011C8000DCC3D6 /* ConnectionView.xib */; };
5841423F0F97E11000A34B47 /* NoodleLineNumberView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5841423E0F97E11000A34B47 /* NoodleLineNumberView.m */; };
+ 584192A1101E57BB0089807F /* NSMutableArray-MultipleSort.m in Sources */ = {isa = PBXBuildFile; fileRef = 584192A0101E57BB0089807F /* NSMutableArray-MultipleSort.m */; };
584F5F8F0F50ACD800036517 /* table-view-small.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 584F5F8E0F50ACD800036517 /* table-view-small.tiff */; };
586F457B0FDB269E00B428D7 /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = 296DC8AB0F909194002A3258 /* RegexKitLite.m */; };
586F457E0FDB280100B428D7 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 296DC8BE0F9091DF002A3258 /* libicucore.dylib */; };
@@ -480,6 +481,8 @@
5822CAE010011C8000DCC3D6 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/ConnectionView.xib; sourceTree = "<group>"; };
5841423D0F97E11000A34B47 /* NoodleLineNumberView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoodleLineNumberView.h; sourceTree = "<group>"; };
5841423E0F97E11000A34B47 /* NoodleLineNumberView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoodleLineNumberView.m; sourceTree = "<group>"; };
+ 5841929F101E57BB0089807F /* NSMutableArray-MultipleSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray-MultipleSort.h"; sourceTree = "<group>"; };
+ 584192A0101E57BB0089807F /* NSMutableArray-MultipleSort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray-MultipleSort.m"; sourceTree = "<group>"; };
584F5F8E0F50ACD800036517 /* table-view-small.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "table-view-small.tiff"; sourceTree = "<group>"; };
586F432A0FD74CFC00B428D7 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/SSHQuestionDialog.xib; sourceTree = "<group>"; };
588593F30F7AEC9500ED0E67 /* package-application.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "package-application.sh"; sourceTree = "<group>"; };
@@ -1175,6 +1178,8 @@
children = (
B52460D30F8EF92300171639 /* SPArrayAdditions.h */,
B52460D40F8EF92300171639 /* SPArrayAdditions.m */,
+ 5841929F101E57BB0089807F /* NSMutableArray-MultipleSort.h */,
+ 584192A0101E57BB0089807F /* NSMutableArray-MultipleSort.m */,
1789343A0F30C1DD0097539A /* SPStringAdditions.h */,
1789343B0F30C1DD0097539A /* SPStringAdditions.m */,
B52460D50F8EF92300171639 /* SPTextViewAdditions.h */,
@@ -1581,6 +1586,7 @@
BC9F0881100FCF2C00A80D32 /* SPFieldEditorController.m in Sources */,
58D2E229101222670063EF1D /* SPTextAndLinkCell.m in Sources */,
BC05F1C5101241DF008A97F8 /* AMIndeterminateProgressIndicatorCell.m in Sources */,
+ 584192A1101E57BB0089807F /* NSMutableArray-MultipleSort.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};