aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/DBView.xib65
-rw-r--r--Interfaces/English.lproj/FieldEditorSheet.xib27
-rw-r--r--Resources/PreferenceDefaults.plist2
-rw-r--r--Source/SPEditSheetTextView.h1
-rw-r--r--Source/SPEditSheetTextView.m17
-rw-r--r--Source/SPFieldEditorController.m71
6 files changed, 110 insertions, 73 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 1db91c7e..7b8afb3a 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -8,7 +8,6 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="839"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -186,7 +185,6 @@
</object>
<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>
@@ -222,7 +220,6 @@
</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"/>
@@ -337,7 +334,6 @@
</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>
@@ -369,7 +365,6 @@
</object>
<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"/>
@@ -494,7 +489,6 @@
</object>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="298226231"/>
- <reference key="NSNextKeyView" ref="347093764"/>
<reference key="NSDocView" ref="347093764"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">6</int>
@@ -521,7 +515,6 @@
</object>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="192579410"/>
- <reference key="NSNextKeyView" ref="685057119"/>
<int key="NSsFlags">512</int>
<reference key="NSVScroller" ref="245346414"/>
<reference key="NSHScroller" ref="353686052"/>
@@ -2052,7 +2045,7 @@
<object class="NSTabViewItem" id="624106058">
<string key="NSIdentifier">content</string>
<object class="NSView" key="NSView" id="1013108064">
- <reference key="NSNextResponder" ref="714795046"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2242,8 +2235,8 @@
<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>
+ <string key="NS.decimal">,</string>
+ <string key="NS.thousand">.</string>
<bool key="NS.hasthousands">NO</bool>
<bool key="NS.localized">YES</bool>
<bool key="NS.allowsfloats">NO</bool>
@@ -2690,7 +2683,6 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {700, 544}}</string>
- <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Content</string>
<reference key="NSColor" ref="62854682"/>
@@ -2699,7 +2691,7 @@
<object class="NSTabViewItem" id="105987292">
<string key="NSIdentifier">customQuery</string>
<object class="NSView" key="NSView" id="746504912">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder" ref="714795046"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2786,7 +2778,6 @@
</object>
<string key="NSFrame">{{1, 1}, {688, 155}}</string>
<reference key="NSSuperview" ref="71560786"/>
- <reference key="NSNextKeyView" ref="1055190999"/>
<reference key="NSDocView" ref="1055190999"/>
<reference key="NSBGColor" ref="449903125"/>
<object class="NSCursor" key="NSCursor" id="32917531">
@@ -2818,7 +2809,6 @@
</object>
<string key="NSFrameSize">{690, 157}</string>
<reference key="NSSuperview" ref="873437769"/>
- <reference key="NSNextKeyView" ref="1072692119"/>
<int key="NSsFlags">530</int>
<reference key="NSVScroller" ref="413233170"/>
<reference key="NSHScroller" ref="783638826"/>
@@ -2905,7 +2895,6 @@
</object>
<string key="NSFrame">{{1, 17}, {688, 228}}</string>
<reference key="NSSuperview" ref="678281118"/>
- <reference key="NSNextKeyView" ref="581095761"/>
<reference key="NSDocView" ref="581095761"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">4</int>
@@ -2938,7 +2927,6 @@
</object>
<string key="NSFrame">{{1, 0}, {688, 17}}</string>
<reference key="NSSuperview" ref="678281118"/>
- <reference key="NSNextKeyView" ref="1038415606"/>
<reference key="NSDocView" ref="1038415606"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">4</int>
@@ -2947,7 +2935,6 @@
</object>
<string key="NSFrameSize">{690, 246}</string>
<reference key="NSSuperview" ref="345834048"/>
- <reference key="NSNextKeyView" ref="90844306"/>
<int key="NSsFlags">562</int>
<reference key="NSVScroller" ref="472831765"/>
<reference key="NSHScroller" ref="851610321"/>
@@ -3101,7 +3088,7 @@
<reference key="NSControlView" ref="363916571"/>
<int key="NSButtonFlags">-2042609409</int>
<int key="NSButtonFlags2">35</int>
- <object class="NSCustomResource" key="NSNormalImage">
+ <object class="NSCustomResource" key="NSNormalImage" id="103563712">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button_action</string>
</object>
@@ -3116,10 +3103,7 @@
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
- <object class="NSCustomResource" key="NSImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">button_action</string>
- </object>
+ <reference key="NSImage" ref="103563712"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="984501775"/>
</object>
@@ -3491,6 +3475,7 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {700, 544}}</string>
+ <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Custom Query</string>
<reference key="NSColor" ref="62854682"/>
@@ -4530,14 +4515,14 @@
<reference key="NSTabView" ref="714795046"/>
</object>
</object>
- <reference key="NSSelectedTabViewItem" ref="624106058"/>
+ <reference key="NSSelectedTabViewItem" ref="105987292"/>
<reference key="NSFont" ref="26"/>
<int key="NSTvFlags">134217731</int>
<bool key="NSAllowTruncatedLabels">YES</bool>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1013108064"/>
+ <reference ref="746504912"/>
</object>
</object>
</object>
@@ -7331,7 +7316,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{350, 200}</string>
<object class="NSView" key="NSWindowView" id="226131408">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -7436,7 +7421,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSFrame">{{1, 17}, {399, 251}}</string>
<reference key="NSSuperview" ref="294857516"/>
- <reference key="NSNextKeyView" ref="460727716"/>
<reference key="NSDocView" ref="460727716"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">4</int>
@@ -7470,7 +7454,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSFrame">{{1, 0}, {399, 17}}</string>
<reference key="NSSuperview" ref="294857516"/>
- <reference key="NSNextKeyView" ref="74674217"/>
<reference key="NSDocView" ref="74674217"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">4</int>
@@ -7479,7 +7462,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string key="NSFrame">{{-1, 39}, {412, 269}}</string>
<reference key="NSSuperview" ref="226131408"/>
- <reference key="NSNextKeyView" ref="841219743"/>
<int key="NSsFlags">18</int>
<reference key="NSVScroller" ref="297298990"/>
<reference key="NSHScroller" ref="857738313"/>
@@ -7626,7 +7608,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
</object>
<string key="NSFrameSize">{411, 341}</string>
- <reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{350, 222}</string>
@@ -11272,6 +11253,10 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string key="NSClassName">NSView</string>
</object>
<object class="NSUserDefaultsController" id="461189245">
+ <object class="NSMutableArray" key="NSDeclaredKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>EditInSheetEnabled</string>
+ </object>
<bool key="NSSharedInstance">YES</bool>
</object>
<object class="NSCustomObject" id="601471102">
@@ -14922,6 +14907,22 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">6349</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.EditInSheetEnabled</string>
+ <reference key="source" ref="393139604"/>
+ <reference key="destination" ref="461189245"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="393139604"/>
+ <reference key="NSDestination" ref="461189245"/>
+ <string key="NSLabel">value: values.EditInSheetEnabled</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.EditInSheetEnabled</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">6351</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -23356,9 +23357,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{366, 250}, {944, 550}}</string>
+ <string>{{219, 267}, {944, 550}}</string>
<boolean value="NO"/>
- <string>{{366, 250}, {944, 550}}</string>
+ <string>{{219, 267}, {944, 550}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -24354,7 +24355,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">6349</int>
+ <int key="maxID">6351</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/Interfaces/English.lproj/FieldEditorSheet.xib b/Interfaces/English.lproj/FieldEditorSheet.xib
index c4192a3e..19d70fa8 100644
--- a/Interfaces/English.lproj/FieldEditorSheet.xib
+++ b/Interfaces/English.lproj/FieldEditorSheet.xib
@@ -45,7 +45,7 @@
</object>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<object class="NSView" key="NSWindowView" id="559857537">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">4370</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -54,7 +54,6 @@
<int key="NSvFlags">34</int>
<string key="NSFrame">{{0, 48}, {667, 5}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -89,7 +88,6 @@
<int key="NSvFlags">257</int>
<string key="NSFrame">{{581, 10}, {66, 25}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="630700737">
@@ -121,7 +119,6 @@
<int key="NSvFlags">257</int>
<string key="NSFrame">{{507, 10}, {66, 25}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="617021739">
<int key="NSCellFlags">67239424</int>
@@ -147,7 +144,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{94, 10}, {66, 25}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1054617135">
<int key="NSCellFlags">67239424</int>
@@ -169,7 +165,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{20, 10}, {66, 25}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="369856023">
<int key="NSCellFlags">67239424</int>
@@ -191,7 +186,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{328, 10}, {48, 25}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="583599991">
<int key="NSCellFlags">71433792</int>
@@ -340,7 +334,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{183, 13}, {137, 19}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSegmentedCell" key="NSCell" id="772630454">
<int key="NSCellFlags">-2080244224</int>
@@ -406,7 +399,6 @@
</object>
<string key="NSFrameSize">{667, 14}</string>
<reference key="NSSuperview" ref="1068411389"/>
- <reference key="NSWindow"/>
<object class="NSTextContainer" key="NSTextContainer" id="222392072">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
@@ -471,7 +463,6 @@
</object>
<string key="NSFrameSize">{667, 370}</string>
<reference key="NSSuperview" ref="983787914"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="459839028"/>
<reference key="NSDocView" ref="459839028"/>
<reference key="NSBGColor" ref="940290613"/>
@@ -486,7 +477,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{220, 1}, {11, 141}}</string>
<reference key="NSSuperview" ref="983787914"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">256</int>
<reference key="NSTarget" ref="983787914"/>
<string key="NSAction">_doScroller:</string>
@@ -497,7 +487,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{-100, -100}, {87, 18}}</string>
<reference key="NSSuperview" ref="983787914"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">257</int>
<reference key="NSTarget" ref="983787914"/>
<string key="NSAction">_doScroller:</string>
@@ -507,7 +496,6 @@
</object>
<string key="NSFrame">{{0, 51}, {667, 370}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1068411389"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="977735067"/>
@@ -531,7 +519,6 @@
</object>
<string key="NSFrame">{{0, 51}, {667, 370}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="521189288">
<int key="NSCellFlags">270663168</int>
@@ -581,7 +568,6 @@
</object>
<string key="NSFrameSize">{667, 14}</string>
<reference key="NSSuperview" ref="967441740"/>
- <reference key="NSWindow"/>
<object class="NSTextContainer" key="NSTextContainer" id="872196016">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
@@ -602,7 +588,7 @@
<int key="NSTCFlags">1</int>
</object>
<object class="NSTextViewSharedData" key="NSSharedData">
- <int key="NSFlags">4067</int>
+ <int key="NSFlags">4083</int>
<reference key="NSBackgroundColor" ref="940290613"/>
<reference key="NSInsertionColor" ref="1021276550"/>
<object class="NSDictionary" key="NSSelectedAttributes">
@@ -650,7 +636,6 @@
</object>
<string key="NSFrameSize">{667, 370}</string>
<reference key="NSSuperview" ref="604699677"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="702566211"/>
<reference key="NSDocView" ref="702566211"/>
<reference key="NSBGColor" ref="940290613"/>
@@ -662,7 +647,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{639, 2}, {11, 359}}</string>
<reference key="NSSuperview" ref="604699677"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">256</int>
<reference key="NSTarget" ref="604699677"/>
<string key="NSAction">_doScroller:</string>
@@ -673,7 +657,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{-100, -100}, {87, 18}}</string>
<reference key="NSSuperview" ref="604699677"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">257</int>
<reference key="NSTarget" ref="604699677"/>
<string key="NSAction">_doScroller:</string>
@@ -683,7 +666,6 @@
</object>
<string key="NSFrame">{{0, 51}, {667, 370}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="967441740"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="699979333"/>
@@ -696,7 +678,6 @@
<object class="NSPSMatrix" key="NSDrawMatrix"/>
<string key="NSFrame">{{325, 232}, {32, 32}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<int key="NSpiFlags">28682</int>
<double key="NSMinValue">1.600000e+01</double>
<double key="NSMaxValue">1.000000e+02</double>
@@ -706,7 +687,6 @@
<int key="NSvFlags">10</int>
<string key="NSFrame">{{0, 419}, {667, 5}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -729,7 +709,6 @@
<int key="NSvFlags">257</int>
<string key="NSFrame">{{284, 36}, {362, 11}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="581551870">
<int key="NSCellFlags">67239488</int>
@@ -757,8 +736,6 @@
</object>
</object>
<string key="NSFrameSize">{667, 428}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist
index 72e975b3..f56b7432 100644
--- a/Resources/PreferenceDefaults.plist
+++ b/Resources/PreferenceDefaults.plist
@@ -38,6 +38,8 @@
<integer>60</integer>
<key>DisplayTableViewVerticalGridlines</key>
<false/>
+ <key>EditInSheetEnabled</key>
+ <false/>
<key>CustomQueryEditorFont</key>
<data>BAtzdHJlYW10eXBlZIHoA4QBQISEhAZOU0ZvbnQehIQITlNPYmplY3QAhYQBaRiEBVsyNGNdBgAAAA4AAAD//k0AbwBuAGEAYwBvAAAAhAFmCoQBYwCYAZgAmACG</data>
<key>CustomQueryEditorBackgroundColor</key>
diff --git a/Source/SPEditSheetTextView.h b/Source/SPEditSheetTextView.h
index 1c6ee563..7c225a78 100644
--- a/Source/SPEditSheetTextView.h
+++ b/Source/SPEditSheetTextView.h
@@ -28,5 +28,6 @@
- (unsigned int)characterIndexOfPoint:(NSPoint)aPoint;
- (void)insertFileContentOfFile:(NSString *)aPath;
+- (void)saveChangedFontInUserDefaults;
@end
diff --git a/Source/SPEditSheetTextView.m b/Source/SPEditSheetTextView.m
index 7f7e0d6c..83b691c9 100644
--- a/Source/SPEditSheetTextView.m
+++ b/Source/SPEditSheetTextView.m
@@ -24,6 +24,7 @@
#import "SPEditSheetTextView.h"
#import "SPTextViewAdditions.h"
+#import "SPFieldEditorController.h"
@implementation SPEditSheetTextView
@@ -51,11 +52,13 @@
if([charactersIgnMod isEqualToString:@"+"]) // increase text size by 1; ⌘+ and numpad +
{
[self makeTextSizeLarger];
+ [self saveChangedFontInUserDefaults];
return;
}
if([charactersIgnMod isEqualToString:@"-"]) // decrease text size by 1; ⌘- and numpad -
{
[self makeTextSizeSmaller];
+ [self saveChangedFontInUserDefaults];
return;
}
}
@@ -246,5 +249,19 @@
NSLog(@"%@ ‘%@’.", NSLocalizedString(@"Couldn't read the file content of", @"Couldn't read the file content of"), aPath);
}
+// Store the font in the prefs for selected delegates only
+- (void)saveChangedFontInUserDefaults
+{
+ if([[[[self delegate] class] description] isEqualToString:@"SPFieldEditorController"])
+ [[NSUserDefaults standardUserDefaults] setObject:[NSArchiver archivedDataWithRootObject:[self font]] forKey:@"FieldEditorSheetFont"];
+}
+
+// Action receiver for a font change in the font panel
+- (void)changeFont:(id)sender
+{
+ NSFont *nf = [[NSFontPanel sharedFontPanel] panelConvertFont:[self font]];
+ [self setFont:nf];
+ [self saveChangedFontInUserDefaults];
+}
@end
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index e5fd0550..40088a2b 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -30,28 +30,34 @@
#import "QLPreviewPanel.h"
#import "SPDataCellFormatter.h"
#import "RegexKitLite.h"
+#import "SPDataCellFormatter.h"
@implementation SPFieldEditorController
-- (id) init
+- (id)init
{
if ((self = [super initWithWindowNibName:@"FieldEditorSheet"])) {
// force the nib to be loaded
(void) [self window];
counter = 0;
maxTextLength = 0;
+
+ prefs = [NSUserDefaults standardUserDefaults];
// Used for max text length recognition if last typed char is a non-space char
editTextViewWasChanged = NO;
// Allow the user to enter cmd+return to close the edit sheet in addition to fn+return
[editSheetOkButton setKeyEquivalentModifierMask:NSCommandKeyMask];
+
+ // [editTextView setFormatter:[[SPDataCellFormatter new] autorelease]];
+
}
return self;
}
-- (void) dealloc
+- (void)dealloc
{
if ( sheetEditData ) [sheetEditData release];
[super dealloc];
@@ -65,13 +71,17 @@
- (id)editWithObject:(id)data fieldName:(NSString*)fieldName usingEncoding:(NSStringEncoding)anEncoding
isObjectBlob:(BOOL)isFieldBlob isEditable:(BOOL)isEditable withWindow:(NSWindow *)tableWindow
{
- prefs = [NSUserDefaults standardUserDefaults];
- if ( [prefs boolForKey:@"UseMonospacedFonts"] ) {
- [editTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- } else {
- [editTextView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
+ if ( ![prefs objectForKey:@"FieldEditorSheetFont"] )
+ if ( [prefs boolForKey:@"UseMonospacedFonts"] ) {
+ [editTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ } else {
+ [editTextView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ // [prefs setObject:[NSArchiver archivedDataWithRootObject:[editTextView font]] forKey:@"FieldEditorSheetFont"];
+ }
+ else
+ [editTextView setFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:@"FieldEditorSheetFont"]]];
+
[hexTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
[editSheetFieldName setStringValue:[NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Field", @"Field"), fieldName]];
@@ -210,7 +220,18 @@
- (IBAction)closeEditSheet:(id)sender
{
+
+ // Validate the sheet data before saving them.
+ // - for max text length select the part which won't be saved
+ if(sender == editSheetOkButton)
+ if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength) {
+ [editTextView setSelectedRange:NSMakeRange(maxTextLength, [[editTextView textStorage] length] - maxTextLength)];
+ NSBeep();
+ return;
+ }
+
[NSApp stopModalWithCode:[sender tag]];
+
}
- (IBAction)openEditSheet:(id)sender
@@ -614,7 +635,7 @@
- (BOOL)textView:(NSTextView *)textView shouldChangeTextInRange:(NSRange)r replacementString:(NSString *)replacementString
{
if(textView == editTextView && maxTextLength > 0) {
-
+
int newLength;
// Auxilary to ensure that eg textViewDidChangeSelection:
@@ -629,11 +650,28 @@
// The exact change isn't known. Disallow the change to be safe.
if (r.location==NSNotFound) return NO;
+ // Length checking while using the Input Manager (eg for Japanese)
+ if ([textView hasMarkedText] && maxTextLength > 0 && r.location < maxTextLength)
+ // User tries to insert a new char but max text length was already reached - return NO
+ if( !r.length && [[textView textStorage] length] >= maxTextLength ) {
+ NSBeep();
+ [textView unmarkText];
+ return NO;
+ }
+ // otherwise allow it if insertion point is valid for eg
+ // a VARCHAR(3) field filled with two Chinese chars and one inserts the
+ // third char by typing its pronounciation "wo" - 2 Chinese chars plus "wo" would give
+ // 4 which is larger than max length.
+ // TODO this doesn't solve the problem of inserting more than one char. For now
+ // that part which won't be saved will be hilited if user pressed the OK button.
+ else if (r.location < maxTextLength)
+ return YES;
+
// Calculate the length of the text after the change.
newLength=[[textView textStorage] length]+[replacementString length]-r.length;
- // If it's too long, disallow the change.
- // If the user pastes something into insert it partially to maxTextLength.
+ // If it's too long, disallow the change but try
+ // to insert a text chunk partially to maxTextLength.
if (newLength>maxTextLength) {
if(maxTextLength-[[textView textStorage] length] < [replacementString length]) {
@@ -659,7 +697,7 @@
// Do nothing if user really didn't changed text (e.g. for font size changing return)
if(!editTextViewWasChanged && (editSheetWillBeInitialized || ([[[notification object] textStorage] changeInLength]==0)))
return;
-
+
// clear the image and hex (since i doubt someone can "type" a gif)
[editImage setImage:nil];
[hexTextView setString:@""];
@@ -668,7 +706,7 @@
if ( sheetEditData != nil ) {
[sheetEditData release];
}
-
+
// set edit data to text
sheetEditData = [[NSString stringWithString:[editTextView string]] retain];
@@ -685,9 +723,10 @@
if ( [aTextView methodForSelector:aSelector] == [aTextView methodForSelector:@selector(insertNewline:)] &&
[[[NSApp currentEvent] characters] isEqualToString:@"\003"] )
{
- [NSApp stopModalWithCode:1];
- return YES;
- }
+ // [NSApp stopModalWithCode:1];
+ // return YES;
+ [self closeEditSheet:editSheetOkButton];
+ }
else
return NO;
}