diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-03-06 12:36:37 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-03-06 12:36:37 +0000 |
commit | 5052718afb789f21654e094f2d065baf6bb6ac81 (patch) | |
tree | 88e9f2f8c03a7bf995208f17f619e3d40a437d71 | |
parent | 37b41c535f442aa85750679dccc7885655cb3429 (diff) | |
download | sequelpro-5052718afb789f21654e094f2d065baf6bb6ac81.tar.gz sequelpro-5052718afb789f21654e094f2d065baf6bb6ac81.tar.bz2 sequelpro-5052718afb789f21654e094f2d065baf6bb6ac81.zip |
• CSV Import Field Mapper
- fixed some issues for displaying the default values for auto_increment and time_stamp
• added possibility to change the tab stop width in each CMTextView via Preference setting in Editor window
-rw-r--r-- | Interfaces/English.lproj/Preferences.xib | 265 | ||||
-rw-r--r-- | Resources/PreferenceDefaults.plist | 2 | ||||
-rw-r--r-- | Source/CMTextView.h | 1 | ||||
-rw-r--r-- | Source/CMTextView.m | 81 | ||||
-rw-r--r-- | Source/SPConstants.h | 1 | ||||
-rw-r--r-- | Source/SPConstants.m | 1 | ||||
-rw-r--r-- | Source/SPFieldMapperController.m | 17 |
7 files changed, 304 insertions, 64 deletions
diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib index b9f04f4f..04efb9eb 100644 --- a/Interfaces/English.lproj/Preferences.xib +++ b/Interfaces/English.lproj/Preferences.xib @@ -13,6 +13,7 @@ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> <integer value="512"/> + <integer value="802"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -58,7 +59,7 @@ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSCustomView" id="594324362"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -67,7 +68,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{151, 121}, {254, 26}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="562129977"> <int key="NSCellFlags">-2076049856</int> @@ -405,7 +405,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 214}, {209, 18}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="964808674"> <int key="NSCellFlags">67239424</int> @@ -433,7 +432,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{40, 242}, {108, 17}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="996600667"> <int key="NSCellFlags">68288064</int> @@ -466,7 +464,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{151, 236}, {254, 26}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="406329678"> <int key="NSCellFlags">-2076049856</int> @@ -499,7 +496,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{33, 85}, {116, 17}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="513222356"> <int key="NSCellFlags">68288064</int> @@ -516,7 +512,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{33, 127}, {116, 17}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="163779676"> <int key="NSCellFlags">68288064</int> @@ -533,7 +528,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 84}, {166, 18}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="530413242"> <int key="NSCellFlags">67239424</int> @@ -556,7 +550,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{152, 62}, {181, 18}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="218042555"> <int key="NSCellFlags">67239424</int> @@ -579,7 +572,6 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 156}, {326, 5}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -610,7 +602,6 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 108}, {326, 5}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -633,7 +624,6 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 53}, {326, 5}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -656,7 +646,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{42, 23}, {106, 17}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="899935643"> <int key="NSCellFlags">68288064</int> @@ -673,7 +662,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{153, 20}, {38, 22}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="875775803"> <int key="NSCellFlags">-1804468671</int> @@ -750,7 +738,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{197, 23}, {162, 17}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="710086132"> <int key="NSCellFlags">68288064</int> @@ -767,7 +754,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{151, 169}, {254, 26}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="404009397"> <int key="NSCellFlags">-2076049856</int> @@ -881,7 +867,6 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{61, 175}, {88, 17}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="840580273"> <int key="NSCellFlags">68288064</int> @@ -898,7 +883,6 @@ <int key="NSvFlags">12</int> <string key="NSFrame">{{154, 204}, {326, 5}}</string> <reference key="NSSuperview" ref="594324362"/> - <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -918,8 +902,6 @@ </object> </object> <string key="NSFrameSize">{500, 280}</string> - <reference key="NSSuperview"/> - <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="395894064"> @@ -3097,10 +3079,116 @@ AQAAAAA</bytes> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="1033452264"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTextField" id="1018119488"> + <reference key="NSNextResponder" ref="1033452264"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{363, 55}, {23, 19}}</string> + <reference key="NSSuperview" ref="1033452264"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="248584789"> + <int key="NSCellFlags">-1804468671</int> + <int key="NSCellFlags2">71435264</int> + <reference key="NSSupport" ref="26"/> + <object class="NSNumberFormatter" key="NSFormatter" id="141894253"> + <object class="NSMutableDictionary" key="NS.attributes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>allowsFloats</string> + <string>formatterBehavior</string> + <string>lenient</string> + <string>locale</string> + <string>maximum</string> + <string>minimum</string> + <string>negativeInfinitySymbol</string> + <string>nilSymbol</string> + <string>numberStyle</string> + <string>positiveInfinitySymbol</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <boolean value="YES"/> + <integer value="1040"/> + <boolean value="YES"/> + <reference ref="894463536"/> + <real value="20"/> + <real value="1"/> + <string>-∞</string> + <string/> + <integer value="1"/> + <string>+∞</string> + </object> + </object> + <string key="NS.positiveformat">#,##0.###</string> + <string key="NS.negativeformat">#,##0.###</string> + <nil key="NS.positiveattrs"/> + <nil key="NS.negativeattrs"/> + <nil key="NS.zero"/> + <object class="NSAttributedString" key="NS.nil"> + <string key="NSString"/> + </object> + <object class="NSAttributedString" key="NS.nan"> + <string key="NSString">NaN</string> + <reference key="NSAttributes" ref="469277987"/> + </object> + <real value="1" key="NS.min"/> + <real value="20" key="NS.max"/> + <object class="NSDecimalNumberHandler" key="NS.rounding"> + <int key="NS.roundingmode">3</int> + <bool key="NS.raise.overflow">YES</bool> + <bool key="NS.raise.underflow">YES</bool> + <bool key="NS.raise.dividebyzero">YES</bool> + </object> + <string key="NS.decimal">.</string> + <string key="NS.thousand">,</string> + <bool key="NS.hasthousands">YES</bool> + <bool key="NS.localized">NO</bool> + <bool key="NS.allowsfloats">YES</bool> + </object> + <reference key="NSControlView" ref="1018119488"/> + <bool key="NSDrawsBackground">YES</bool> + <reference key="NSBackgroundColor" ref="1001357688"/> + <reference key="NSTextColor" ref="6928728"/> + </object> + </object> + <object class="NSTextField" id="304684720"> + <reference key="NSNextResponder" ref="1033452264"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{256, 57}, {104, 17}}</string> + <reference key="NSSuperview" ref="1033452264"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="273262177"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">272630784</int> + <string key="NSContents">Tab Stop Width:</string> + <reference key="NSSupport" ref="320262838"/> + <reference key="NSControlView" ref="304684720"/> + <reference key="NSBackgroundColor" ref="700609571"/> + <reference key="NSTextColor" ref="1035618107"/> + </object> + </object> + <object class="NSStepper" id="161634003"> + <reference key="NSNextResponder" ref="1033452264"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{393, 53}, {15, 22}}</string> + <reference key="NSSuperview" ref="1033452264"/> + <bool key="NSEnabled">YES</bool> + <object class="NSStepperCell" key="NSCell" id="93125704"> + <int key="NSCellFlags">68025888</int> + <int key="NSCellFlags2">131072</int> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="161634003"/> + <double key="NSValue">1</double> + <double key="NSMinValue">1</double> + <double key="NSMaxValue">20</double> + <double key="NSIncrement">1</double> + <bool key="NSAutorepeat">YES</bool> + </object> + </object> <object class="NSColorWell" id="868179656"> <reference key="NSNextResponder" ref="1033452264"/> <int key="NSvFlags">268</int> @@ -3802,9 +3890,14 @@ AQAAAAA</bytes> </object> </object> <string key="NSFrameSize">{500, 395}</string> + <reference key="NSSuperview"/> <string key="NSClassName">NSView</string> </object> <object class="NSUserDefaultsController" id="151174232"> + <object class="NSMutableArray" key="NSDeclaredKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>CustomQueryEditorTabStopWidth</string> + </object> <bool key="NSSharedInstance">YES</bool> </object> <object class="NSArrayController" id="937123943"> @@ -5899,6 +5992,54 @@ AQAAAAA</bytes> </object> <int key="connectionID">1494</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">takeIntegerValueFrom:</string> + <reference key="source" ref="1018119488"/> + <reference key="destination" ref="161634003"/> + </object> + <int key="connectionID">1509</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.CustomQueryEditorTabStopWidth</string> + <reference key="source" ref="1018119488"/> + <reference key="destination" ref="151174232"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="1018119488"/> + <reference key="NSDestination" ref="151174232"/> + <string key="NSLabel">value: values.CustomQueryEditorTabStopWidth</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.CustomQueryEditorTabStopWidth</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">1511</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">takeIntegerValueFrom:</string> + <reference key="source" ref="161634003"/> + <reference key="destination" ref="1018119488"/> + </object> + <int key="connectionID">1512</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">value: values.CustomQueryEditorTabStopWidth</string> + <reference key="source" ref="161634003"/> + <reference key="destination" ref="151174232"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="161634003"/> + <reference key="NSDestination" ref="151174232"/> + <string key="NSLabel">value: values.CustomQueryEditorTabStopWidth</string> + <string key="NSBinding">value</string> + <string key="NSKeyPath">values.CustomQueryEditorTabStopWidth</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">1516</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -6914,6 +7055,9 @@ AQAAAAA</bytes> <reference ref="775043265"/> <reference ref="923591695"/> <reference ref="787536920"/> + <reference ref="161634003"/> + <reference ref="304684720"/> + <reference ref="1018119488"/> </object> <reference key="parent" ref="0"/> <string key="objectName">Editor</string> @@ -8383,6 +8527,57 @@ AQAAAAA</bytes> <reference key="object" ref="238389133"/> <reference key="parent" ref="395894064"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">1497</int> + <reference key="object" ref="161634003"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="93125704"/> + </object> + <reference key="parent" ref="1033452264"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">1498</int> + <reference key="object" ref="93125704"/> + <reference key="parent" ref="161634003"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">1499</int> + <reference key="object" ref="304684720"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="273262177"/> + </object> + <reference key="parent" ref="1033452264"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">1500</int> + <reference key="object" ref="273262177"/> + <reference key="parent" ref="304684720"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">1505</int> + <reference key="object" ref="1018119488"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="248584789"/> + </object> + <reference key="parent" ref="1033452264"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">1506</int> + <reference key="object" ref="248584789"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="141894253"/> + </object> + <reference key="parent" ref="1018119488"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">1507</int> + <reference key="object" ref="141894253"/> + <reference key="parent" ref="248584789"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -8592,6 +8787,15 @@ AQAAAAA</bytes> <string>1489.IBPluginDependency</string> <string>1490.IBPluginDependency</string> <string>1492.IBPluginDependency</string> + <string>1497.IBPluginDependency</string> + <string>1498.IBPluginDependency</string> + <string>1499.IBPluginDependency</string> + <string>1500.IBPluginDependency</string> + <string>1505.IBPluginDependency</string> + <string>1506.IBPluginDependency</string> + <string>1507.IBNumberFormatterBehaviorMetadataKey</string> + <string>1507.IBNumberFormatterLocalizesFormatMetadataKey</string> + <string>1507.IBPluginDependency</string> <string>17.IBEditorWindowLastContentRect</string> <string>17.IBPluginDependency</string> <string>17.IBUserGuides</string> @@ -9063,6 +9267,15 @@ AQAAAAA</bytes> <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> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <integer value="1041"/> + <boolean value="NO"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{571, 222}, {500, 280}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableArray"> @@ -9243,7 +9456,7 @@ AQAAAAA</bytes> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> - <string>{{751, 254}, {499, 316}}</string> + <string>{{122, 254}, {499, 316}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableArray"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -9385,7 +9598,7 @@ AQAAAAA</bytes> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <boolean value="YES"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{545, 361}, {500, 395}}</string> + <string>{{121, 361}, {500, 395}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableArray"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -9446,7 +9659,7 @@ AQAAAAA</bytes> </object> </object> <nil key="sourceID"/> - <int key="maxID">1494</int> + <int key="maxID">1516</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -9662,7 +9875,6 @@ AQAAAAA</bytes> <string>displayAutoUpdatePreferences:</string> <string>displayEditorPreferences:</string> <string>displayFavoritePreferences:</string> - <string>displayGeneralPreferences:</string> <string>displayNetworkPreferences:</string> <string>displayNotificationPreferences:</string> <string>displayTablePreferences:</string> @@ -9693,7 +9905,6 @@ AQAAAAA</bytes> <string>id</string> <string>id</string> <string>id</string> - <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> @@ -9723,6 +9934,7 @@ AQAAAAA</bytes> <string>sshPasswordField</string> <string>sshSQLPasswordField</string> <string>standardPasswordField</string> + <string>tabWidthInputField</string> <string>tableCell</string> <string>tablesView</string> </object> @@ -9752,6 +9964,7 @@ AQAAAAA</bytes> <string>NSSecureTextField</string> <string>NSSecureTextField</string> <string>id</string> + <string>id</string> <string>NSView</string> </object> </object> diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist index 18b71f09..52abb689 100644 --- a/Resources/PreferenceDefaults.plist +++ b/Resources/PreferenceDefaults.plist @@ -84,6 +84,8 @@ <false/> <key>CustomQueryUpdateAutoHelp</key> <false/> + <key>CustomQueryEditorTabStopWidth</key> + <integer>4</integer> <key>CustomQueryAutoHelpDelay</key> <real>1</real> <key>lastSqlFileEncoding</key> diff --git a/Source/CMTextView.h b/Source/CMTextView.h index c278c2c3..53afe0df 100644 --- a/Source/CMTextView.h +++ b/Source/CMTextView.h @@ -121,6 +121,7 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS - (BOOL) autouppercaseKeywords; - (void) setAutohelp:(BOOL)enableAutohelp; - (BOOL) autohelp; +- (void) setTabStops; - (void) selectLineNumber:(NSUInteger)lineNumber ignoreLeadingNewLines:(BOOL)ignLeadingNewLines; - (NSUInteger) getLineNumberForCharacterIndex:(NSUInteger)anIndex; - (void) autoHelp; diff --git a/Source/CMTextView.m b/Source/CMTextView.m index d6a1e9d7..3a95a6b5 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -140,40 +140,9 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) [self setAutohelp:[prefs boolForKey:SPCustomQueryUpdateAutoHelp]]; [self setAutouppercaseKeywords:[prefs boolForKey:SPCustomQueryAutoUppercaseKeywords]]; - // Re-define 64 tab stops for a better editing - NSFont *tvFont = [self font]; - float firstColumnInch = 0.5, otherColumnInch = 0.5, pntPerInch = 72.0; - NSInteger i; - NSTextTab *aTab; - NSMutableArray *myArrayOfTabs; - NSMutableParagraphStyle *paragraphStyle; - myArrayOfTabs = [NSMutableArray arrayWithCapacity:64]; - aTab = [[NSTextTab alloc] initWithType:NSLeftTabStopType location:firstColumnInch*pntPerInch]; - [myArrayOfTabs addObject:aTab]; - [aTab release]; - for(i=1; i<64; i++) { - aTab = [[NSTextTab alloc] initWithType:NSLeftTabStopType location:(firstColumnInch*pntPerInch) + ((float)i * otherColumnInch * pntPerInch)]; - [myArrayOfTabs addObject:aTab]; - [aTab release]; - } - paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - [paragraphStyle setTabStops:myArrayOfTabs]; - // Soft wrapped lines are indented slightly - [paragraphStyle setHeadIndent:4.0]; - - NSMutableDictionary *textAttributes = [[[NSMutableDictionary alloc] initWithCapacity:1] autorelease]; - [textAttributes setObject:paragraphStyle forKey:NSParagraphStyleAttributeName]; + // Re-define tab stops for a better editing + [self setTabStops]; - NSRange range = NSMakeRange(0, [[self textStorage] length]); - if ([self shouldChangeTextInRange:range replacementString:nil]) { - [[self textStorage] setAttributes:textAttributes range: range]; - [self didChangeText]; - } - [self setTypingAttributes:textAttributes]; - [self setDefaultParagraphStyle:paragraphStyle]; - [paragraphStyle release]; - [self setFont:tvFont]; - // disabled to get the current text range in textView safer [[self layoutManager] setBackgroundLayoutEnabled:NO]; @@ -207,6 +176,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) [prefs addObserver:self forKeyPath:SPCustomQueryEditorNumericColor options:NSKeyValueObservingOptionNew context:NULL]; [prefs addObserver:self forKeyPath:SPCustomQueryEditorVariableColor options:NSKeyValueObservingOptionNew context:NULL]; [prefs addObserver:self forKeyPath:SPCustomQueryEditorTextColor options:NSKeyValueObservingOptionNew context:NULL]; + [prefs addObserver:self forKeyPath:SPCustomQueryEditorTabStopWidth options:NSKeyValueObservingOptionNew context:NULL]; } @@ -262,6 +232,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) [self setTextColor:[self otherTextColor]]; if([[self string] length]<100000 && [self isEditable]) [self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1]; + } else if ([keyPath isEqualToString:SPCustomQueryEditorTabStopWidth]) { + [self setTabStops]; } } @@ -3117,6 +3089,49 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) } +- (void) setTabStops +{ + NSFont *tvFont = [self font]; + NSInteger i; + NSTextTab *aTab; + NSMutableArray *myArrayOfTabs; + NSMutableParagraphStyle *paragraphStyle; + + NSInteger tabStopWidth = [prefs integerForKey:SPCustomQueryEditorTabStopWidth]; + if(tabStopWidth < 1) tabStopWidth = 1; + + float tabWidth = NSSizeToCGSize([[NSString stringWithString:@" "] sizeWithAttributes:[NSDictionary dictionaryWithObject:tvFont forKey:NSFontAttributeName]]).width; + tabWidth = (float)tabStopWidth * tabWidth; + + NSInteger numberOfTabs = 256/tabStopWidth; + myArrayOfTabs = [NSMutableArray arrayWithCapacity:numberOfTabs]; + aTab = [[NSTextTab alloc] initWithType:NSLeftTabStopType location:tabWidth]; + [myArrayOfTabs addObject:aTab]; + [aTab release]; + for(i=1; i<numberOfTabs; i++) { + aTab = [[NSTextTab alloc] initWithType:NSLeftTabStopType location:tabWidth + ((float)i * tabWidth)]; + [myArrayOfTabs addObject:aTab]; + [aTab release]; + } + paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; + [paragraphStyle setTabStops:myArrayOfTabs]; + // Soft wrapped lines are indented slightly + [paragraphStyle setHeadIndent:4.0]; + + NSMutableDictionary *textAttributes = [[[NSMutableDictionary alloc] initWithCapacity:1] autorelease]; + [textAttributes setObject:paragraphStyle forKey:NSParagraphStyleAttributeName]; + + NSRange range = NSMakeRange(0, [[self textStorage] length]); + if ([self shouldChangeTextInRange:range replacementString:nil]) { + [[self textStorage] setAttributes:textAttributes range: range]; + [self didChangeText]; + } + [self setTypingAttributes:textAttributes]; + [self setDefaultParagraphStyle:paragraphStyle]; + [paragraphStyle release]; + [self setFont:tvFont]; +} + - (void)drawRect:(NSRect)rect { diff --git a/Source/SPConstants.h b/Source/SPConstants.h index db38835d..07132538 100644 --- a/Source/SPConstants.h +++ b/Source/SPConstants.h @@ -133,6 +133,7 @@ extern NSString *SPCustomQueryAutoUppercaseKeywords; extern NSString *SPCustomQueryUpdateAutoHelp; extern NSString *SPCustomQueryAutoHelpDelay; extern NSString *SPCustomQueryHighlightCurrentQuery; +extern NSString *SPCustomQueryEditorTabStopWidth; // AutoUpdate Prefpane extern NSString *SPLastUsedVersion; diff --git a/Source/SPConstants.m b/Source/SPConstants.m index 338d15d4..c3d45b0a 100644 --- a/Source/SPConstants.m +++ b/Source/SPConstants.m @@ -101,6 +101,7 @@ NSString *SPCustomQueryAutoUppercaseKeywords = @"CustomQueryAutoUppercaseKey NSString *SPCustomQueryUpdateAutoHelp = @"CustomQueryUpdateAutoHelp"; NSString *SPCustomQueryAutoHelpDelay = @"CustomQueryAutoHelpDelay"; NSString *SPCustomQueryHighlightCurrentQuery = @"CustomQueryHighlightCurrentQuery"; +NSString *SPCustomQueryEditorTabStopWidth = @"CustomQueryEditorTabStopWidth"; // AutoUpdate Prefpane NSString *SPLastUsedVersion = @"LastUsedVersion"; diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 5ed301d3..7224c38a 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -284,7 +284,7 @@ [selectedTableData setConnection:mySQLConnection]; NSDictionary *tableDetails = [selectedTableData informationForTable:[tableTargetPopup titleOfSelectedItem]]; BOOL isReplacePossible = NO; - + // NSLog(@"d %@", tableDetails); if (tableDetails) { for (NSDictionary *column in [tableDetails objectForKey:@"columns"]) { [fieldMappingTableColumnNames addObject:[NSString stringWithString:[column objectForKey:@"name"]]]; @@ -298,17 +298,24 @@ if([column objectForKey:@"isprimarykey"]) { [type appendFormat:@",%@",@"PRIMARY"]; - [fieldMappingTableDefaultValues addObject:@"auto_increment"]; + if([[[column objectForKey:@"autoincrement"] description] isEqualToString:@"1"]) { + [fieldMappingTableDefaultValues addObject:@"auto_increment"]; + } else { + [fieldMappingTableDefaultValues addObject:@"0"]; + } isReplacePossible = YES; } else { if([column objectForKey:@"unique"]) { [type appendFormat:@",%@",@"UNIQUE"]; isReplacePossible = YES; } - if ([column objectForKey:@"default"]) - [fieldMappingTableDefaultValues addObject:[column objectForKey:@"default"]]; + if([[[column objectForKey:@"onupdatetimestamp"] description] isEqualToString:@"1"]) + [fieldMappingTableDefaultValues addObject:@"time_stamp"]; else - [fieldMappingTableDefaultValues addObject:@"NULL"]; + if ([column objectForKey:@"default"]) + [fieldMappingTableDefaultValues addObject:[column objectForKey:@"default"]]; + else + [fieldMappingTableDefaultValues addObject:@"NULL"]; } [fieldMappingTableTypes addObject:[NSString stringWithString:type]]; |