aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/MainMenu.xib255
-rw-r--r--Source/SPTextViewAdditions.h2
-rw-r--r--Source/SPTextViewAdditions.m62
3 files changed, 308 insertions, 11 deletions
diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib
index 4e81b47f..e03e9699 100644
--- a/Interfaces/English.lproj/MainMenu.xib
+++ b/Interfaces/English.lproj/MainMenu.xib
@@ -3,16 +3,16 @@
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10F569</string>
- <string key="IBDocument.InterfaceBuilderVersion">804</string>
+ <string key="IBDocument.InterfaceBuilderVersion">788</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">804</string>
+ <string key="NS.object.0">788</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="628"/>
+ <integer value="29"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -806,6 +806,39 @@
</object>
</object>
</object>
+ <object class="NSMenuItem" id="496107824">
+ <reference key="NSMenu" ref="71086556"/>
+ <string key="NSTitle">Move</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="625762401"/>
+ <reference key="NSMixedImage" ref="315854375"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="831902926">
+ <string key="NSTitle">Move</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="457544609">
+ <reference key="NSMenu" ref="831902926"/>
+ <string key="NSTitle">Line Up</string>
+ <string key="NSKeyEquiv"></string>
+ <int key="NSKeyEquivModMask">1310720</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="625762401"/>
+ <reference key="NSMixedImage" ref="315854375"/>
+ </object>
+ <object class="NSMenuItem" id="45814009">
+ <reference key="NSMenu" ref="831902926"/>
+ <string key="NSTitle">Line Down</string>
+ <string key="NSKeyEquiv"></string>
+ <int key="NSKeyEquivModMask">1310720</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="625762401"/>
+ <reference key="NSMixedImage" ref="315854375"/>
+ </object>
+ </object>
+ </object>
+ </object>
<object class="NSMenuItem" id="465877627">
<reference key="NSMenu" ref="71086556"/>
<bool key="NSIsDisabled">YES</bool>
@@ -2993,6 +3026,22 @@
</object>
<int key="connectionID">1167</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">moveSelectionLineUp:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="457544609"/>
+ </object>
+ <int key="connectionID">1172</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">moveSelectionLineDown:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="45814009"/>
+ </object>
+ <int key="connectionID">1173</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -3606,6 +3655,7 @@
<reference ref="121139500"/>
<reference ref="765987997"/>
<reference ref="784426029"/>
+ <reference ref="496107824"/>
</object>
<reference key="parent" ref="119995921"/>
</object>
@@ -4366,6 +4416,35 @@
<reference key="object" ref="219440274"/>
<reference key="parent" ref="172963563"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1168</int>
+ <reference key="object" ref="496107824"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="831902926"/>
+ </object>
+ <reference key="parent" ref="71086556"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1169</int>
+ <reference key="object" ref="831902926"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="457544609"/>
+ <reference ref="45814009"/>
+ </object>
+ <reference key="parent" ref="496107824"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1170</int>
+ <reference key="object" ref="457544609"/>
+ <reference key="parent" ref="831902926"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1171</int>
+ <reference key="object" ref="45814009"/>
+ <reference key="parent" ref="831902926"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -4429,6 +4508,13 @@
<string>1162.IBPluginDependency</string>
<string>1164.IBPluginDependency</string>
<string>1165.IBPluginDependency</string>
+ <string>1168.IBPluginDependency</string>
+ <string>1169.IBEditorWindowLastContentRect</string>
+ <string>1169.IBPluginDependency</string>
+ <string>1170.IBAttributePlaceholdersKey</string>
+ <string>1170.IBPluginDependency</string>
+ <string>1171.IBAttributePlaceholdersKey</string>
+ <string>1171.IBPluginDependency</string>
<string>129.IBPluginDependency</string>
<string>129.ImportedFromIB2</string>
<string>130.IBEditorWindowLastContentRect</string>
@@ -4795,6 +4881,27 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{762, 389}, {160, 43}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="457544609"/>
+ <string key="toolTip">Move the current line or the selected lines one line up</string>
+ </object>
+ </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="45814009"/>
+ <string key="toolTip">Move the current line or the selected lines one line down</string>
+ </object>
+ </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{562, 439}, {64, 6}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4825,7 +4932,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{749, 232}, {238, 103}}</string>
+ <string>{{762, 299}, {238, 103}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4840,7 +4947,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{479, 262}, {280, 283}}</string>
+ <string>{{482, 359}, {280, 303}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{654, 613}, {157, 223}}</string>
@@ -4888,7 +4995,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{523, 222}, {251, 323}}</string>
+ <string>{{526, 339}, {251, 323}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{698, 703}, {184, 133}}</string>
@@ -5020,7 +5127,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{655, 149}, {210, 143}}</string>
+ <string>{{762, 309}, {210, 143}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
@@ -5032,7 +5139,7 @@
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{655, 269}, {218, 83}}</string>
+ <string>{{762, 429}, {218, 83}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
@@ -5180,7 +5287,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">1167</int>
+ <int key="maxID">1173</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -9857,6 +9964,136 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSTextView</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>doDecomposedStringWithCanonicalMapping:</string>
+ <string>doDecomposedStringWithCompatibilityMapping:</string>
+ <string>doPrecomposedStringWithCanonicalMapping:</string>
+ <string>doPrecomposedStringWithCompatibilityMapping:</string>
+ <string>doRemoveDiacritics:</string>
+ <string>doSelectionLowerCase:</string>
+ <string>doSelectionTitleCase:</string>
+ <string>doSelectionUpperCase:</string>
+ <string>doTranspose:</string>
+ <string>insertNULLvalue:</string>
+ <string>moveSelectionLineDown:</string>
+ <string>moveSelectionLineUp:</string>
+ <string>selectCurrentLine:</string>
+ <string>selectCurrentWord:</string>
+ <string>selectEnclosingBrackets:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <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>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>doDecomposedStringWithCanonicalMapping:</string>
+ <string>doDecomposedStringWithCompatibilityMapping:</string>
+ <string>doPrecomposedStringWithCanonicalMapping:</string>
+ <string>doPrecomposedStringWithCompatibilityMapping:</string>
+ <string>doRemoveDiacritics:</string>
+ <string>doSelectionLowerCase:</string>
+ <string>doSelectionTitleCase:</string>
+ <string>doSelectionUpperCase:</string>
+ <string>doTranspose:</string>
+ <string>insertNULLvalue:</string>
+ <string>moveSelectionLineDown:</string>
+ <string>moveSelectionLineUp:</string>
+ <string>selectCurrentLine:</string>
+ <string>selectCurrentWord:</string>
+ <string>selectEnclosingBrackets:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBActionInfo">
+ <string key="name">doDecomposedStringWithCanonicalMapping:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">doDecomposedStringWithCompatibilityMapping:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">doPrecomposedStringWithCanonicalMapping:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">doPrecomposedStringWithCompatibilityMapping:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">doRemoveDiacritics:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">doSelectionLowerCase:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">doSelectionTitleCase:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">doSelectionUpperCase:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">doTranspose:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">insertNULLvalue:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">moveSelectionLineDown:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">moveSelectionLineUp:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">selectCurrentLine:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">selectCurrentWord:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">selectEnclosingBrackets:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBDocumentRelativeSource</string>
+ <string key="minorKey">../../Source/SPTextViewAdditions.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">SUUpdater</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
diff --git a/Source/SPTextViewAdditions.h b/Source/SPTextViewAdditions.h
index f32db8fd..0a2e69b1 100644
--- a/Source/SPTextViewAdditions.h
+++ b/Source/SPTextViewAdditions.h
@@ -39,6 +39,8 @@
- (IBAction)doTranspose:(id)sender;
- (IBAction)doRemoveDiacritics:(id)sender;
- (IBAction)insertNULLvalue:(id)sender;
+- (IBAction)moveSelectionLineUp:(id)sender;
+- (IBAction)moveSelectionLineDown:(id)sender;
- (void)makeTextSizeLarger;
- (void)makeTextSizeSmaller;
diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m
index cab4382c..5c938d21 100644
--- a/Source/SPTextViewAdditions.m
+++ b/Source/SPTextViewAdditions.m
@@ -399,7 +399,65 @@
}
-/*
+/**
+ * Move selected lines or current line one line up
+ */
+- (IBAction)moveSelectionLineUp:(id)sender;
+{
+ NSRange currentSelection = [self selectedRange];
+ NSRange lineRange = [[self string] lineRangeForRange:currentSelection];
+ if(lineRange.location > 0) {
+ NSRange beforeLineRange = [[self string] lineRangeForRange:NSMakeRange(lineRange.location-1, 0)];
+ NSRange insertPoint = NSMakeRange(beforeLineRange.location, 0);
+ NSString *currentLine = [[self string] substringWithRange:lineRange];
+ BOOL lastLine = NO;
+ if([currentLine characterAtIndex:[currentLine length]-1] != '\n') {
+ currentLine = [NSString stringWithFormat:@"%@\n", currentLine];
+ lastLine = YES;
+ }
+ [self setSelectedRange:lineRange];
+ [self insertText:@""];
+ [self setSelectedRange:insertPoint];
+ [self insertText:currentLine];
+ if(lastLine) {
+ [self setSelectedRange:NSMakeRange([[self string] length]-1,1)];
+ [self insertText:@""];
+
+ }
+ if(currentSelection.length)
+ insertPoint.length+=[currentLine length];
+ [self setSelectedRange:insertPoint];
+ }
+}
+
+/**
+ * Move selected lines or current line one line down
+ */
+- (IBAction)moveSelectionLineDown:(id)sender
+{
+
+ NSRange currentSelection = [self selectedRange];
+ NSRange lineRange = [[self string] lineRangeForRange:currentSelection];
+ if(NSMaxRange(lineRange) < [[self string] length]) {
+ NSRange afterLineRange = [[self string] lineRangeForRange:NSMakeRange(NSMaxRange(lineRange)+1, 0)];
+ NSRange insertPoint = NSMakeRange(lineRange.location + afterLineRange.length, 0);
+ NSString *currentLine = [[self string] substringWithRange:lineRange];
+ [self setSelectedRange:lineRange];
+ [self insertText:@""];
+ [self setSelectedRange:insertPoint];
+ if([[self string] characterAtIndex:insertPoint.location-1] != '\n') {
+ [self insertText:@"\n"];
+ insertPoint.location++;
+ currentLine = [currentLine substringToIndex:[currentLine length]-1];
+ }
+ [self insertText:currentLine];
+ if(currentSelection.length)
+ insertPoint.length+=[currentLine length];
+ [self setSelectedRange:insertPoint];
+ }
+}
+
+/**
* Increase the textView's font size by 1
*/
- (void)makeTextSizeLarger
@@ -428,7 +486,7 @@
#pragma mark -
#pragma mark multi-touch trackpad support
-/*
+/**
* Trackpad two-finger zooming gesture for in/decreasing the font size
*/
- (void) magnifyWithEvent:(NSEvent *)anEvent