aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-06-13 13:25:59 +0000
committerBibiko <bibiko@eva.mpg.de>2009-06-13 13:25:59 +0000
commita343ff6aa7e5789cd0d35a28caace8e39959e777 (patch)
tree478aea74e73770f5798a13aa96e878ff212df76c
parent348de054eb77b5291c6046b36fdaaa600f9aaaed (diff)
downloadsequelpro-a343ff6aa7e5789cd0d35a28caace8e39959e777.tar.gz
sequelpro-a343ff6aa7e5789cd0d35a28caace8e39959e777.tar.bz2
sequelpro-a343ff6aa7e5789cd0d35a28caace8e39959e777.zip
• moved code for de/increasing font and drag&drop feature (content or while holding ⌘ path) to SPTextViewAddition
- two finger zooming gesture is disabled for NSTableView cells - i.e. all NSTextViews including NSTableView cells inherit these feature • simplified QuickLookFormat IBActions - added bin/text storing type to each action • QuickLook animation set to SP's window middle point • fixed issue that while having an image in editSheet an attribute change (font/size) in the editTextView destroyed the image data • fix to allow again drag&drop an image to editSheet • hide text/image/hex segment controll and QuickLook pull down button if user chose multipleLineEditingButton for non-blob fields • disabled NSLog of print result in TableDocument
-rw-r--r--Interfaces/English.lproj/DBView.xib131
-rw-r--r--Source/CMTextView.h4
-rw-r--r--Source/CMTextView.m214
-rw-r--r--Source/SPTextViewAdditions.h7
-rw-r--r--Source/SPTextViewAdditions.m222
-rw-r--r--Source/TableContent.h16
-rw-r--r--Source/TableContent.m109
-rw-r--r--Source/TableDocument.m2
8 files changed, 351 insertions, 354 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 2e26162a..52a9fe0c 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="5945"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -6175,7 +6176,6 @@
<int key="NSvFlags">34</int>
<string key="NSFrame">{{0, 36}, {667, 5}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -6198,7 +6198,6 @@
<int key="NSvFlags">257</int>
<string key="NSFrame">{{581, 7}, {66, 25}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="614204575">
@@ -6222,7 +6221,6 @@
<int key="NSvFlags">257</int>
<string key="NSFrame">{{507, 7}, {66, 25}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="888101847">
<int key="NSCellFlags">67239424</int>
@@ -6244,7 +6242,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{94, 7}, {66, 25}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="46380971">
<int key="NSCellFlags">67239424</int>
@@ -6266,7 +6263,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{20, 7}, {66, 25}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="544799467">
<int key="NSCellFlags">67239424</int>
@@ -6288,7 +6284,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{328, 7}, {48, 25}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="1049067135">
<int key="NSCellFlags">71433792</int>
@@ -6341,6 +6336,7 @@
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSMixedImage" ref="800099743"/>
<string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">1</int>
<reference key="NSTarget" ref="1049067135"/>
</object>
<object class="NSMenuItem" id="60551315">
@@ -6351,6 +6347,7 @@
<reference key="NSOnImage" ref="285877316"/>
<reference key="NSMixedImage" ref="800099743"/>
<string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">2</int>
<reference key="NSTarget" ref="1049067135"/>
</object>
<object class="NSMenuItem" id="313658995">
@@ -6361,6 +6358,7 @@
<reference key="NSOnImage" ref="285877316"/>
<reference key="NSMixedImage" ref="800099743"/>
<string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">3</int>
<reference key="NSTarget" ref="1049067135"/>
</object>
<object class="NSMenuItem" id="405291739">
@@ -6371,6 +6369,7 @@
<reference key="NSOnImage" ref="285877316"/>
<reference key="NSMixedImage" ref="800099743"/>
<string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">4</int>
<reference key="NSTarget" ref="1049067135"/>
</object>
<object class="NSMenuItem" id="624314986">
@@ -6381,6 +6380,7 @@
<reference key="NSOnImage" ref="285877316"/>
<reference key="NSMixedImage" ref="800099743"/>
<string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">5</int>
<reference key="NSTarget" ref="1049067135"/>
</object>
<object class="NSMenuItem" id="337614031">
@@ -6391,6 +6391,7 @@
<reference key="NSOnImage" ref="285877316"/>
<reference key="NSMixedImage" ref="800099743"/>
<string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">6</int>
<reference key="NSTarget" ref="1049067135"/>
</object>
<object class="NSMenuItem" id="950803686">
@@ -6401,6 +6402,7 @@
<reference key="NSOnImage" ref="285877316"/>
<reference key="NSMixedImage" ref="800099743"/>
<string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">7</int>
<reference key="NSTarget" ref="1049067135"/>
</object>
<object class="NSMenuItem" id="182514031">
@@ -6411,10 +6413,12 @@
<reference key="NSOnImage" ref="285877316"/>
<reference key="NSMixedImage" ref="800099743"/>
<string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">8</int>
<reference key="NSTarget" ref="1049067135"/>
</object>
</object>
</object>
+ <int key="NSSelectedIndex">9</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -6427,7 +6431,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{183, 10}, {137, 19}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSegmentedCell" key="NSCell" id="438375364">
<int key="NSCellFlags">-2080244224</int>
@@ -6493,7 +6496,6 @@
</object>
<string key="NSFrameSize">{667, 14}</string>
<reference key="NSSuperview" ref="106608808"/>
- <reference key="NSWindow"/>
<object class="NSTextContainer" key="NSTextContainer" id="883111283">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
@@ -6542,7 +6544,6 @@
</object>
<string key="NSFrameSize">{667, 370}</string>
<reference key="NSSuperview" ref="533559056"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="283256023"/>
<reference key="NSDocView" ref="283256023"/>
<reference key="NSBGColor" ref="449903125"/>
@@ -6554,7 +6555,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{220, 1}, {11, 141}}</string>
<reference key="NSSuperview" ref="533559056"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">256</int>
<reference key="NSTarget" ref="533559056"/>
<string key="NSAction">_doScroller:</string>
@@ -6565,7 +6565,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{-100, -100}, {87, 18}}</string>
<reference key="NSSuperview" ref="533559056"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">257</int>
<reference key="NSTarget" ref="533559056"/>
<string key="NSAction">_doScroller:</string>
@@ -6575,7 +6574,6 @@
</object>
<string key="NSFrame">{{0, 39}, {667, 370}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="106608808"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="945638943"/>
@@ -6599,7 +6597,6 @@
</object>
<string key="NSFrame">{{0, 39}, {667, 370}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="11045283">
<int key="NSCellFlags">270663168</int>
@@ -6649,7 +6646,6 @@
</object>
<string key="NSFrameSize">{667, 14}</string>
<reference key="NSSuperview" ref="134546146"/>
- <reference key="NSWindow"/>
<object class="NSTextContainer" key="NSTextContainer" id="609699272">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
@@ -6715,7 +6711,6 @@
</object>
<string key="NSFrameSize">{667, 370}</string>
<reference key="NSSuperview" ref="1020679422"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1011820278"/>
<reference key="NSDocView" ref="1011820278"/>
<reference key="NSBGColor" ref="449903125"/>
@@ -6727,7 +6722,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{639, 2}, {11, 359}}</string>
<reference key="NSSuperview" ref="1020679422"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">256</int>
<reference key="NSTarget" ref="1020679422"/>
<string key="NSAction">_doScroller:</string>
@@ -6738,7 +6732,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{-100, -100}, {87, 18}}</string>
<reference key="NSSuperview" ref="1020679422"/>
- <reference key="NSWindow"/>
<int key="NSsFlags">257</int>
<reference key="NSTarget" ref="1020679422"/>
<string key="NSAction">_doScroller:</string>
@@ -6748,7 +6741,6 @@
</object>
<string key="NSFrame">{{0, 39}, {667, 370}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="134546146"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="435247014"/>
@@ -6761,7 +6753,6 @@
<object class="NSPSMatrix" key="NSDrawMatrix"/>
<string key="NSFrame">{{325, 220}, {32, 32}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<int key="NSpiFlags">28682</int>
<double key="NSMinValue">1.600000e+01</double>
<double key="NSMaxValue">1.000000e+02</double>
@@ -6771,7 +6762,6 @@
<int key="NSvFlags">10</int>
<string key="NSFrame">{{0, 407}, {667, 5}}</string>
<reference key="NSSuperview" ref="999543752"/>
- <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -6792,7 +6782,6 @@
</object>
<string key="NSFrameSize">{667, 416}</string>
<reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{560, 222}</string>
@@ -16007,92 +15996,92 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="connectionID">5966</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">quickLookAsImage:</string>
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">editSheetProgressBar</string>
<reference key="source" ref="392169872"/>
- <reference key="destination" ref="651311563"/>
+ <reference key="destination" ref="943659835"/>
</object>
- <int key="connectionID">5969</int>
+ <int key="connectionID">5985</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">quickLookAsPDF:</string>
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">editSheetQuickLookButton</string>
<reference key="source" ref="392169872"/>
- <reference key="destination" ref="624314986"/>
+ <reference key="destination" ref="620882358"/>
</object>
- <int key="connectionID">5970</int>
+ <int key="connectionID">5988</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">quickLookAsMovie:</string>
+ <string key="label">quickLookFormatButton:</string>
<reference key="source" ref="392169872"/>
- <reference key="destination" ref="405291739"/>
+ <reference key="destination" ref="651311563"/>
</object>
- <int key="connectionID">5973</int>
+ <int key="connectionID">5990</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">quickLookAsWordDoc:</string>
+ <string key="label">quickLookFormatButton:</string>
<reference key="source" ref="392169872"/>
- <reference key="destination" ref="950803686"/>
+ <reference key="destination" ref="290675907"/>
</object>
- <int key="connectionID">5976</int>
+ <int key="connectionID">5991</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">quickLookAsRTF:</string>
+ <string key="label">quickLookFormatButton:</string>
<reference key="source" ref="392169872"/>
- <reference key="destination" ref="182514031"/>
+ <reference key="destination" ref="60551315"/>
</object>
- <int key="connectionID">5977</int>
+ <int key="connectionID">5992</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">quickLookAsSoundLinear:</string>
+ <string key="label">quickLookFormatButton:</string>
<reference key="source" ref="392169872"/>
<reference key="destination" ref="313658995"/>
</object>
- <int key="connectionID">5980</int>
+ <int key="connectionID">5993</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">quickLookAsSoundM4A:</string>
+ <string key="label">quickLookFormatButton:</string>
<reference key="source" ref="392169872"/>
- <reference key="destination" ref="290675907"/>
+ <reference key="destination" ref="405291739"/>
</object>
- <int key="connectionID">5982</int>
+ <int key="connectionID">5994</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">quickLookAsSoundMP3:</string>
+ <string key="label">quickLookFormatButton:</string>
<reference key="source" ref="392169872"/>
- <reference key="destination" ref="60551315"/>
+ <reference key="destination" ref="624314986"/>
</object>
- <int key="connectionID">5983</int>
+ <int key="connectionID">5995</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">editSheetProgressBar</string>
+ <object class="IBActionConnection" key="connection">
+ <string key="label">quickLookFormatButton:</string>
<reference key="source" ref="392169872"/>
- <reference key="destination" ref="943659835"/>
+ <reference key="destination" ref="337614031"/>
</object>
- <int key="connectionID">5985</int>
+ <int key="connectionID">5996</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">quickLookAsHTML:</string>
+ <string key="label">quickLookFormatButton:</string>
<reference key="source" ref="392169872"/>
- <reference key="destination" ref="337614031"/>
+ <reference key="destination" ref="950803686"/>
</object>
- <int key="connectionID">5987</int>
+ <int key="connectionID">5997</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">editSheetQuickLookButton</string>
+ <object class="IBActionConnection" key="connection">
+ <string key="label">quickLookFormatButton:</string>
<reference key="source" ref="392169872"/>
- <reference key="destination" ref="620882358"/>
+ <reference key="destination" ref="182514031"/>
</object>
- <int key="connectionID">5988</int>
+ <int key="connectionID">5998</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -22602,11 +22591,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference ref="651311563"/>
<reference ref="405291739"/>
<reference ref="950803686"/>
- <reference ref="182514031"/>
<reference ref="313658995"/>
<reference ref="60551315"/>
<reference ref="624314986"/>
<reference ref="337614031"/>
+ <reference ref="182514031"/>
</object>
<reference key="parent" ref="1049067135"/>
</object>
@@ -26003,7 +25992,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{503, 95}, {137, 173}}</string>
+ <string>{{384, 199}, {126, 173}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -26024,8 +26013,8 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{230, 340}, {667, 416}}</string>
- <string>{{230, 340}, {667, 416}}</string>
+ <string>{{67, 340}, {667, 416}}</string>
+ <string>{{67, 340}, {667, 416}}</string>
<reference ref="9"/>
<reference ref="8"/>
<reference ref="9"/>
@@ -26276,7 +26265,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">5989</int>
+ <int key="maxID">5998</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -27574,15 +27563,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>dropImage:</string>
<string>filterTable:</string>
<string>openEditSheet:</string>
- <string>quickLookAsHTML:</string>
- <string>quickLookAsImage:</string>
- <string>quickLookAsMovie:</string>
- <string>quickLookAsPDF:</string>
- <string>quickLookAsRTF:</string>
- <string>quickLookAsSoundLinear:</string>
- <string>quickLookAsSoundM4A:</string>
- <string>quickLookAsSoundMP3:</string>
- <string>quickLookAsWordDoc:</string>
+ <string>quickLookFormatButton:</string>
<string>reloadTable:</string>
<string>reloadTableValues:</string>
<string>removeRow:</string>
@@ -27611,14 +27592,6 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>id</string>
<string>id</string>
<string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
diff --git a/Source/CMTextView.h b/Source/CMTextView.h
index 6c4da129..9b0d7659 100644
--- a/Source/CMTextView.h
+++ b/Source/CMTextView.h
@@ -77,10 +77,6 @@
- (unsigned int) getLineNumberForCharacterIndex:(unsigned int)anIndex;
- (void) autoHelp;
- (void) doSyntaxHighlighting;
-- (void) insertFileContentOfFile:(NSString *)aPath;
-- (unsigned int) characterIndexOfPoint:(NSPoint)aPoint;
-- (void) makeTextSizeLarger;
-- (void) makeTextSizeSmaller;
- (void) setConnection:(CMMCPConnection *)theConnection withVersion:(int)majorVersion;
- (void) doCompletion;
- (NSArray *)suggestionsForSQLCompletionWith:(NSString *)currentWord dictMode:(BOOL)isDictMode;
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 9c66b068..39c83977 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -1003,30 +1003,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
return [compl autorelease];
}
-/*
- * Increase the textView's font size by 1
- */
-- (void)makeTextSizeLarger
-{
- NSFont *aFont = [self font];
- BOOL editableStatus = [self isEditable];
- [self setEditable:YES];
- [self setFont:[[NSFontManager sharedFontManager] convertFont:aFont toSize:[aFont pointSize]+1]];
- [self setEditable:editableStatus];
-}
-
-/*
- * Decrease the textView's font size by 1 but not smaller than 4pt
- */
-- (void)makeTextSizeSmaller
-{
- NSFont *aFont = [self font];
- int newSize = ([aFont pointSize]-1 < 4) ? [aFont pointSize] : [aFont pointSize]-1;
- BOOL editableStatus = [self isEditable];
- [self setEditable:YES];
- [self setFont:[[NSFontManager sharedFontManager] convertFont:aFont toSize:newSize]];
- [self setEditable:editableStatus];
-}
/*
* Hook to invoke the auto-uppercasing of SQL keywords after pasting
@@ -2480,196 +2456,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Dragging methods
///////////////////////////
-/*
- * Insert the content of a dragged file path or if ⌘ is pressed
- * while dragging insert the file path
- */
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
-{
- NSPasteboard *pboard = [sender draggingPasteboard];
-
- if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
- NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
-
- // Only one file path is allowed
- if([files count] > 1) {
- NSLog(@"%@", NSLocalizedString(@"Only one dragged item allowed.",@"Only one dragged item allowed."));
- NSBeep();
- return YES;
- }
-
- NSString *filepath = [[pboard propertyListForType:NSFilenamesPboardType] objectAtIndex:0];
-
- // Set the new insertion point
- NSPoint draggingLocation = [sender draggingLocation];
- draggingLocation = [self convertPoint:draggingLocation fromView:nil];
- unsigned int characterIndex = [self characterIndexOfPoint:draggingLocation];
- [self setSelectedRange:NSMakeRange(characterIndex,0)];
-
- // Check if user pressed ⌘ while dragging for inserting only the file path
- if([sender draggingSourceOperationMask] == 4)
- {
- [self insertText:filepath];
- return YES;
- }
-
- // Check size and NSFileType
- NSDictionary *attr = [[NSFileManager defaultManager] fileAttributesAtPath:filepath traverseLink:YES];
- if(attr)
- {
- NSNumber *filesize = [attr objectForKey:NSFileSize];
- NSString *filetype = [attr objectForKey:NSFileType];
- if(filetype == NSFileTypeRegular && filesize)
- {
- // Ask for confirmation if file content is larger than 1MB
- if([filesize unsignedLongValue] > 1000000)
- {
- NSAlert *alert = [[NSAlert alloc] init];
- [alert addButtonWithTitle:NSLocalizedString(@"OK", @"OK button")];
- [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"cancel button")];
- [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Do you really want to proceed with %.1f MB of data?", @"message of panel asking for confirmation for inserting large text from dragging action"),
- [filesize unsignedLongValue]/1048576.0]];
- [alert setHelpAnchor:filepath];
- [alert setMessageText:NSLocalizedString(@"Warning",@"Warning")];
- [alert setAlertStyle:NSWarningAlertStyle];
- [alert beginSheetModalForWindow:[self window]
- modalDelegate:self
- didEndSelector:@selector(dragAlertSheetDidEnd:returnCode:contextInfo:)
- contextInfo:nil];
- [alert release];
-
- } else
- [self insertFileContentOfFile:filepath];
- }
- }
- return YES;
- }
-
- return [super performDragOperation:sender];
-}
-
-/*
- * Confirmation sheetDidEnd method
- */
-- (void)dragAlertSheetDidEnd:(NSAlert *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
-{
-
- [[sheet window] orderOut:nil];
- if ( returnCode == NSAlertFirstButtonReturn )
- [self insertFileContentOfFile:[sheet helpAnchor]];
-
-}
-/*
- * Convert a NSPoint, usually the mouse location, to
- * a character index of the text view.
- */
-- (unsigned int)characterIndexOfPoint:(NSPoint)aPoint
-{
- unsigned int glyphIndex;
- NSLayoutManager *layoutManager = [self layoutManager];
- float fraction;
- NSRange range;
-
- range = [layoutManager glyphRangeForTextContainer:[self textContainer]];
- glyphIndex = [layoutManager glyphIndexForPoint:aPoint
- inTextContainer:[self textContainer]
- fractionOfDistanceThroughGlyph:&fraction];
- if( fraction > 0.5 ) glyphIndex++;
-
- if( glyphIndex == NSMaxRange(range) )
- return [[self textStorage] length];
- else
- return [layoutManager characterIndexForGlyphAtIndex:glyphIndex];
-
-}
-
-/*
- * Insert content of a plain text file for a given path.
- * In addition it tries to figure out the file's text encoding heuristically.
- */
-- (void)insertFileContentOfFile:(NSString *)aPath
-{
-
- NSError *err = nil;
- NSStringEncoding enc;
- NSString *content = nil;
-
- // Make usage of the UNIX command "file" to get an info
- // about file type and encoding.
- NSTask *task=[[NSTask alloc] init];
- NSPipe *pipe=[[NSPipe alloc] init];
- NSFileHandle *handle;
- NSString *result;
- [task setLaunchPath:@"/usr/bin/file"];
- [task setArguments:[NSArray arrayWithObjects:aPath, @"-Ib", nil]];
- [task setStandardOutput:pipe];
- handle=[pipe fileHandleForReading];
- [task launch];
- result=[[NSString alloc] initWithData:[handle readDataToEndOfFile]
- encoding:NSASCIIStringEncoding];
-
- [pipe release];
- [task release];
-
- // UTF16/32 files are detected as application/octet-stream resp. audio/mpeg
- if([result hasPrefix:@"application/octet-stream"] || [result hasPrefix:@"audio/mpeg"] || [result hasPrefix:@"text/plain"] || [[[aPath pathExtension] lowercaseString] isEqualToString:@"sql"])
- {
- // if UTF16/32 cocoa will try to find the correct encoding
- if([result hasPrefix:@"application/octet-stream"] || [result hasPrefix:@"audio/mpeg"] || [result rangeOfString:@"utf-16"].length)
- enc = 0;
- else if([result rangeOfString:@"utf-8"].length)
- enc = NSUTF8StringEncoding;
- else if([result rangeOfString:@"iso-8859-1"].length)
- enc = NSISOLatin1StringEncoding;
- else if([result rangeOfString:@"us-ascii"].length)
- enc = NSASCIIStringEncoding;
- else
- enc = 0;
-
- if(enc == 0) // cocoa tries to detect the encoding
- content = [NSString stringWithContentsOfFile:aPath usedEncoding:&enc error:&err];
- else
- content = [NSString stringWithContentsOfFile:aPath encoding:enc error:&err];
-
- if(content)
- {
- [self insertText:content];
- [result release];
- [self insertText:@""]; // Invoke keyword uppercasing
- return;
- }
- // If UNIX "file" failed try cocoa's encoding detection
- content = [NSString stringWithContentsOfFile:aPath encoding:enc error:&err];
- if(content)
- {
- [self insertText:content];
- [result release];
- [self insertText:@""]; // Invoke keyword uppercasing
- return;
- }
- }
-
- [result release];
-
- NSLog(@"%@ ‘%@’.", NSLocalizedString(@"Couldn't read the file content of", @"Couldn't read the file content of"), aPath);
- NSBeep();
-}
-
-#pragma mark -
-#pragma mark multi-touch trackpad support
-
-/*
- * Trackpad two-finger zooming gesture in/decreases the font size
- */
-- (void) magnifyWithEvent:(NSEvent *)anEvent
-{
- if([anEvent deltaZ]>5.0)
- [self makeTextSizeLarger];
- else if([anEvent deltaZ]<-5.0)
- [self makeTextSizeSmaller];
-
- [self insertText:@""];
-}
- (void) dealloc
{
diff --git a/Source/SPTextViewAdditions.h b/Source/SPTextViewAdditions.h
index d1fa91d8..ccf865fb 100644
--- a/Source/SPTextViewAdditions.h
+++ b/Source/SPTextViewAdditions.h
@@ -41,4 +41,11 @@
- (IBAction)doTranspose:(id)sender;
- (IBAction)doRemoveDiacritics:(id)sender;
+- (void)makeTextSizeLarger;
+- (void)makeTextSizeSmaller;
+
+- (unsigned int)characterIndexOfPoint:(NSPoint)aPoint;
+
+- (void)insertFileContentOfFile:(NSString *)aPath;
+
@end \ No newline at end of file
diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m
index 34cbbab8..7e882dca 100644
--- a/Source/SPTextViewAdditions.m
+++ b/Source/SPTextViewAdditions.m
@@ -23,6 +23,7 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPStringAdditions.h"
+#import "SPTextViewAdditions.h"
@implementation NSTextView (SPTextViewAdditions)
@@ -384,4 +385,225 @@
}
}
+/*
+ * Insert the content of a dragged file path or if ⌘ is pressed
+ * while dragging insert the file path
+ */
+- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
+{
+ NSPasteboard *pboard = [sender draggingPasteboard];
+
+ if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
+ NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
+
+ // Only one file path is allowed
+ if([files count] > 1) {
+ NSLog(@"%@", NSLocalizedString(@"Only one dragged item allowed.",@"Only one dragged item allowed."));
+ return YES;
+ }
+
+ NSString *filepath = [[pboard propertyListForType:NSFilenamesPboardType] objectAtIndex:0];
+
+ // Set the new insertion point
+ NSPoint draggingLocation = [sender draggingLocation];
+ draggingLocation = [self convertPoint:draggingLocation fromView:nil];
+ unsigned int characterIndex = [self characterIndexOfPoint:draggingLocation];
+ [self setSelectedRange:NSMakeRange(characterIndex,0)];
+
+ // Check if user pressed ⌘ while dragging for inserting only the file path
+ if([sender draggingSourceOperationMask] == 4)
+ {
+ [self insertText:filepath];
+ return YES;
+ }
+
+ // Check size and NSFileType
+ NSDictionary *attr = [[NSFileManager defaultManager] fileAttributesAtPath:filepath traverseLink:YES];
+ if(attr)
+ {
+ NSNumber *filesize = [attr objectForKey:NSFileSize];
+ NSString *filetype = [attr objectForKey:NSFileType];
+ if(filetype == NSFileTypeRegular && filesize)
+ {
+ // Ask for confirmation if file content is larger than 1MB
+ if([filesize unsignedLongValue] > 1000000)
+ {
+ NSAlert *alert = [[NSAlert alloc] init];
+ [alert addButtonWithTitle:NSLocalizedString(@"OK", @"OK button")];
+ [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"cancel button")];
+ [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Do you really want to proceed with %.1f MB of data?", @"message of panel asking for confirmation for inserting large text from dragging action"),
+ [filesize unsignedLongValue]/1048576.0]];
+ [alert setHelpAnchor:filepath];
+ [alert setMessageText:NSLocalizedString(@"Warning",@"Warning")];
+ [alert setAlertStyle:NSWarningAlertStyle];
+ [alert beginSheetModalForWindow:[self window]
+ modalDelegate:self
+ didEndSelector:@selector(dragAlertSheetDidEnd:returnCode:contextInfo:)
+ contextInfo:nil];
+ [alert release];
+
+ } else
+ [self insertFileContentOfFile:filepath];
+ }
+ }
+ return YES;
+ }
+
+ return [super performDragOperation:sender];
+}
+
+/*
+ * Confirmation sheetDidEnd method
+ */
+- (void)dragAlertSheetDidEnd:(NSAlert *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+{
+
+ [[sheet window] orderOut:nil];
+ if ( returnCode == NSAlertFirstButtonReturn )
+ [self insertFileContentOfFile:[sheet helpAnchor]];
+
+}
+/*
+ * Convert a NSPoint, usually the mouse location, to
+ * a character index of the text view.
+ */
+- (unsigned int)characterIndexOfPoint:(NSPoint)aPoint
+{
+ unsigned int glyphIndex;
+ NSLayoutManager *layoutManager = [self layoutManager];
+ float fraction;
+ NSRange range;
+
+ range = [layoutManager glyphRangeForTextContainer:[self textContainer]];
+ glyphIndex = [layoutManager glyphIndexForPoint:aPoint
+ inTextContainer:[self textContainer]
+ fractionOfDistanceThroughGlyph:&fraction];
+ if( fraction > 0.5 ) glyphIndex++;
+
+ if( glyphIndex == NSMaxRange(range) )
+ return [[self textStorage] length];
+ else
+ return [layoutManager characterIndexForGlyphAtIndex:glyphIndex];
+
+}
+
+/*
+ * Insert content of a plain text file for a given path.
+ * In addition it tries to figure out the file's text encoding heuristically.
+ */
+- (void)insertFileContentOfFile:(NSString *)aPath
+{
+
+ NSError *err = nil;
+ NSStringEncoding enc;
+ NSString *content = nil;
+
+ // Make usage of the UNIX command "file" to get an info
+ // about file type and encoding.
+ NSTask *task=[[NSTask alloc] init];
+ NSPipe *pipe=[[NSPipe alloc] init];
+ NSFileHandle *handle;
+ NSString *result;
+ [task setLaunchPath:@"/usr/bin/file"];
+ [task setArguments:[NSArray arrayWithObjects:aPath, @"-Ib", nil]];
+ [task setStandardOutput:pipe];
+ handle=[pipe fileHandleForReading];
+ [task launch];
+ result=[[NSString alloc] initWithData:[handle readDataToEndOfFile]
+ encoding:NSASCIIStringEncoding];
+
+ [pipe release];
+ [task release];
+
+ // UTF16/32 files are detected as application/octet-stream resp. audio/mpeg
+ if([result hasPrefix:@"application/octet-stream"] || [result hasPrefix:@"audio/mpeg"] || [result hasPrefix:@"text/plain"] || [[[aPath pathExtension] lowercaseString] isEqualToString:@"sql"])
+ {
+ // if UTF16/32 cocoa will try to find the correct encoding
+ if([result hasPrefix:@"application/octet-stream"] || [result hasPrefix:@"audio/mpeg"] || [result rangeOfString:@"utf-16"].length)
+ enc = 0;
+ else if([result rangeOfString:@"utf-8"].length)
+ enc = NSUTF8StringEncoding;
+ else if([result rangeOfString:@"iso-8859-1"].length)
+ enc = NSISOLatin1StringEncoding;
+ else if([result rangeOfString:@"us-ascii"].length)
+ enc = NSASCIIStringEncoding;
+ else
+ enc = 0;
+
+ if(enc == 0) // cocoa tries to detect the encoding
+ content = [NSString stringWithContentsOfFile:aPath usedEncoding:&enc error:&err];
+ else
+ content = [NSString stringWithContentsOfFile:aPath encoding:enc error:&err];
+
+ if(content)
+ {
+ [self insertText:content];
+ [result release];
+ [self insertText:@""]; // Invoke keyword uppercasing
+ return;
+ }
+ // If UNIX "file" failed try cocoa's encoding detection
+ content = [NSString stringWithContentsOfFile:aPath encoding:enc error:&err];
+ if(content)
+ {
+ [self insertText:content];
+ [result release];
+ [self insertText:@""]; // Invoke keyword uppercasing
+ return;
+ }
+ }
+
+ [result release];
+
+ NSLog(@"%@ ‘%@’.", NSLocalizedString(@"Couldn't read the file content of", @"Couldn't read the file content of"), aPath);
+}
+
+/*
+ * Increase the textView's font size by 1
+ */
+- (void)makeTextSizeLarger
+{
+ NSFont *aFont = [self font];
+ BOOL editableStatus = [self isEditable];
+ [self setEditable:YES];
+ [self setFont:[[NSFontManager sharedFontManager] convertFont:aFont toSize:[aFont pointSize]+1]];
+ [self setEditable:editableStatus];
+}
+
+/*
+ * Decrease the textView's font size by 1 but not smaller than 4pt
+ */
+- (void)makeTextSizeSmaller
+{
+ NSFont *aFont = [self font];
+ int newSize = ([aFont pointSize]-1 < 4) ? [aFont pointSize] : [aFont pointSize]-1;
+ BOOL editableStatus = [self isEditable];
+ [self setEditable:YES];
+ [self setFont:[[NSFontManager sharedFontManager] convertFont:aFont toSize:newSize]];
+ [self setEditable:editableStatus];
+}
+
+
+#pragma mark -
+#pragma mark multi-touch trackpad support
+
+/*
+ * Trackpad two-finger zooming gesture in/decreases the font size
+ */
+- (void) magnifyWithEvent:(NSEvent *)anEvent
+{
+
+ //Avoid font resizing for NSTextViews in CMCopyTable or NSTableView
+ if([[[[self delegate] class] description] isEqualToString:@"CMCopyTable"]
+ || [[[[self delegate] class] description] isEqualToString:@"NSTableView"]) return;
+
+ if([anEvent deltaZ]>5.0)
+ [self makeTextSizeLarger];
+ else if([anEvent deltaZ]<-5.0)
+ [self makeTextSizeSmaller];
+
+ [self insertText:@""];
+}
+
+
@end
diff --git a/Source/TableContent.h b/Source/TableContent.h
index b440bf6a..7ac59148 100644
--- a/Source/TableContent.h
+++ b/Source/TableContent.h
@@ -168,6 +168,8 @@
int numRows, currentlyEditingRow, maxNumRowsOfCurrentTable;
bool areShowingAllRows;
+ BOOL editSheetWillBeInitialized;
+
int quickLookCloseMarker;
}
@@ -191,19 +193,11 @@
- (IBAction)openEditSheet:(id)sender;
- (IBAction)saveEditSheet:(id)sender;
- (IBAction)segmentControllerChanged:(id)sender;
-- (IBAction)quickLookAsMovie:(id)sender;
-- (IBAction)quickLookAsSoundLinear:(id)sender;
-- (IBAction)quickLookAsSoundM4A:(id)sender;
-- (IBAction)quickLookAsSoundMP3:(id)sender;
-- (IBAction)quickLookAsImage:(id)sender;
-- (IBAction)quickLookAsPDF:(id)sender;
-- (IBAction)quickLookAsWordDoc:(id)sender;
-- (IBAction)quickLookAsRTF:(id)sender;
-- (IBAction)quickLookAsHTML:(id)sender;
-- (void)invokeQuickLookOfType:(NSString *)type;
+- (IBAction)quickLookFormatButton:(id)sender;
+- (void)invokeQuickLookOfType:(NSString *)type treatAsText:(BOOL)isText;
- (void)processUpdatedImageData:(NSData *)data;
- (IBAction)dropImage:(id)sender;
-- (void)textDidChange:(NSNotification *)notification;
+- (void)textViewDidChangeSelection:(NSNotification *)aNotification;
- (NSString *)dataToHex:(NSData *)data;
//getter methods
diff --git a/Source/TableContent.m b/Source/TableContent.m
index f75cef3e..eb36e9ba 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -37,6 +37,7 @@
#import "SPQueryConsole.h"
#import "SPStringAdditions.h"
#import "SPArrayAdditions.h"
+#import "SPTextViewAdditions.h"
@implementation TableContent
@@ -951,6 +952,7 @@
NSString *fileName = [panel filename];
// Write binary field types directly to the file
+ //// || [editSheetBinaryButton state] == NSOnState
if ( [editData isKindOfClass:[NSData class]] ) {
[editData writeToFile:fileName atomically:YES];
@@ -970,47 +972,25 @@
#pragma mark -
#pragma mark QuickLook
-- (IBAction)quickLookAsWordDoc:(id)sender
+- (IBAction)quickLookFormatButton:(id)sender
{
- [self invokeQuickLookOfType:@"doc"];
-}
-- (IBAction)quickLookAsRTF:(id)sender
-{
- [self invokeQuickLookOfType:@"rtf"];
-}
-- (IBAction)quickLookAsMovie:(id)sender
-{
- [self invokeQuickLookOfType:@"mov"];
-}
-- (IBAction)quickLookAsSoundM4A:(id)sender
-{
- [self invokeQuickLookOfType:@"m4a"];
-}
-- (IBAction)quickLookAsSoundMP3:(id)sender
-{
- [self invokeQuickLookOfType:@"mp3"];
-}
-- (IBAction)quickLookAsSoundLinear:(id)sender
-{
- [self invokeQuickLookOfType:@"wav"];
-}
-- (IBAction)quickLookAsImage:(id)sender
-{
- [self invokeQuickLookOfType:@"pict"];
-}
-- (IBAction)quickLookAsPDF:(id)sender
-{
- [self invokeQuickLookOfType:@"pdf"];
-}
-- (IBAction)quickLookAsHTML:(id)sender
-{
- [self invokeQuickLookOfType:@"html"];
+ switch([sender tag]) {
+ case 0: [self invokeQuickLookOfType:@"pict" treatAsText:NO]; break;
+ case 1: [self invokeQuickLookOfType:@"m4a" treatAsText:NO]; break;
+ case 2: [self invokeQuickLookOfType:@"mp3" treatAsText:NO]; break;
+ case 3: [self invokeQuickLookOfType:@"wav" treatAsText:NO]; break;
+ case 4: [self invokeQuickLookOfType:@"mov" treatAsText:NO]; break;
+ case 5: [self invokeQuickLookOfType:@"pdf" treatAsText:NO]; break;
+ case 6: [self invokeQuickLookOfType:@"html" treatAsText:YES]; break;
+ case 7: [self invokeQuickLookOfType:@"doc" treatAsText:NO]; break;
+ case 8: [self invokeQuickLookOfType:@"rtf" treatAsText:YES]; break;
+ }
}
/*
* Opens QuickLook for current data if QuickLook is available
*/
-- (void)invokeQuickLookOfType:(NSString *)type
+- (void)invokeQuickLookOfType:(NSString *)type treatAsText:(BOOL)isText
{
// Load private framework
@@ -1023,7 +1003,7 @@
NSString *tmpFileName = [NSString stringWithFormat:@"/tmp/SequelProQuickLook.%@", type];
// if data are binary
- if ( [editData isKindOfClass:[NSData class]] ) {
+ if ( [editData isKindOfClass:[NSData class]] || !isText) {
[editData writeToFile:tmpFileName atomically:YES];
// write other field types' representations to the file via the current encoding
@@ -1083,11 +1063,13 @@
// if user closes the QuickLook view
quickLookCloseMarker = 1;
- // TODO get QuickLook's pulldown button's frame to zoom out/in from/into it
- NSRect r = [editSheetQuickLookButton convertRectToBase:[editSheetQuickLookButton frame]];
- // tentative setting
- r.origin.y=400;
- return r;
+ // Return the App's middle point
+ NSRect mwf = [[NSApp mainWindow] frame];
+ return NSMakeRect(
+ mwf.origin.x+mwf.size.width/2,
+ mwf.origin.y+mwf.size.height/2,
+ 5, 5);
+
}
@@ -1112,7 +1094,8 @@
NSString *contents = [[NSString alloc] initWithData:data encoding:[CMMCPConnection encodingForMySQLEncoding:[[tableDocumentInstance connectionEncoding] UTF8String]]];
// Set the string contents and hex representation
- [editTextView setString:contents];
+ if(contents)
+ [editTextView setString:contents];
[hexTextView setString:[self dataToHex:editData]];
[contents release];
@@ -1132,11 +1115,16 @@
}
}
-- (void)textDidChange:(NSNotification *)notification
+- (void)textViewDidChangeSelection:(NSNotification *)notification
/*
invoked when the user changes the string in the editSheet
*/
{
+
+ // Do nothing if user really didn't changed text (e.g. for font size changing return)
+ if(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:@""];
@@ -1148,6 +1136,7 @@
// set edit data to text
editData = [[editTextView string] retain];
+
}
- (NSString *)dataToHex:(NSData *)data
@@ -2232,8 +2221,11 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
}
}
+ BOOL isBlob = [tableDataInstance columnIsBlobOrText:[aTableColumn identifier]];
// Open the sheet if the multipleLineEditingButton is enabled or the column was a blob or a text.
- if ( [multipleLineEditingButton state] == NSOnState || [tableDataInstance columnIsBlobOrText:[aTableColumn identifier]] ) {
+ if ( [multipleLineEditingButton state] == NSOnState || isBlob ) {
+
+ editSheetWillBeInitialized = YES;
theValue = [[filteredResult objectAtIndex:rowIndex] objectForKey:[aTableColumn identifier]];
NSImage *image = nil;
@@ -2246,6 +2238,9 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
[editTextView setHidden:YES];
[editTextScrollView setHidden:YES];
+ [editSheetQuickLookButton setHidden:(!isBlob)];
+ [editSheetSegmentControl setHidden:(!isBlob)];
+
// order out editSheet to inform the user that
// SP is working
[NSApp beginSheet:editSheet modalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil];
@@ -2299,6 +2294,8 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
[editSheetProgressBar stopAnimation:self];
+ editSheetWillBeInitialized = NO;
+
// wait for editSheet
code = [NSApp runModalForWindow:editSheet];
@@ -2430,6 +2427,7 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
/**
* Traps enter and return key and closes editSheet instead of inserting a linebreak when user hits return.
+ * Catch ⌘+ and ⌘- to de/increase font size of aTextView
*/
- (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector
{
@@ -2439,7 +2437,28 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
{
[NSApp stopModalWithCode:1];
return YES;
- } else {
+ }
+ else if([[NSApp currentEvent] modifierFlags] & NSCommandKeyMask)
+ {
+ // increase text size by 1; ⌘+ and numpad +
+ if([[[NSApp currentEvent] charactersIgnoringModifiers] isEqualToString:@"+"])
+ {
+ [aTextView makeTextSizeLarger];
+ return YES;
+ }
+ // decrease text size by 1; ⌘- and numpad -
+ else if([[[NSApp currentEvent] charactersIgnoringModifiers] isEqualToString:@"-"])
+ {
+ [aTextView makeTextSizeSmaller];
+ return YES;
+ }
+ else
+ {
+ return NO;
+ }
+ }
+ else
+ {
return NO;
}
}
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index d2a24fd3..c797b530 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -241,7 +241,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
// Process the template and display the results.
NSString *result = [engine processTemplateInFileAtPath:templatePath withVariables:print_data];
- NSLog(@"result %@", result);
+ //NSLog(@"result %@", result);
return result;
}