Commits

Anonymous committed 1b256e0

Add Open In Editor button to file info pane

Comments (0)

Files changed (4)

English.lproj/Repo.xib

 		<string key="IBDocument.HIToolboxVersion">353.00</string>
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 			<bool key="EncodedWithXMLCoder">YES</bool>
+			<integer value="300061"/>
 			<integer value="300330"/>
-			<integer value="300061"/>
 		</object>
 		<object class="NSArray" key="IBDocument.PluginDependencies">
 			<bool key="EncodedWithXMLCoder">YES</bool>
 			<object class="NSWindowTemplate" id="927202284">
 				<int key="NSWindowStyleMask">15</int>
 				<int key="NSWindowBacking">2</int>
-				<string key="NSWindowRect">{{196, 22}, {586, 488}}</string>
+				<string key="NSWindowRect">{{196, 21}, {587, 489}}</string>
 				<int key="NSWTFlags">536870912</int>
 				<string key="NSWindowTitle">Repository</string>
 				<string key="NSWindowClass">NSWindow</string>
 														<object class="NSOutlineView" id="408726427">
 															<reference key="NSNextResponder" ref="305294895"/>
 															<int key="NSvFlags">4352</int>
-															<string key="NSFrameSize">{292, 262}</string>
+															<string key="NSFrameSize">{208, 262}</string>
 															<reference key="NSSuperview" ref="305294895"/>
 															<bool key="NSEnabled">YES</bool>
 															<object class="NSTableHeaderView" key="NSHeaderView" id="435744945">
 																<reference key="NSNextResponder" ref="960155502"/>
 																<int key="NSvFlags">256</int>
-																<string key="NSFrameSize">{292, 17}</string>
+																<string key="NSFrameSize">{208, 17}</string>
 																<reference key="NSSuperview" ref="960155502"/>
 																<reference key="NSTableView" ref="408726427"/>
 															</object>
 																</object>
 																<object class="NSTableColumn" id="157704806">
 																	<string key="NSIdentifier">name</string>
-																	<double key="NSWidth">2.620000e+02</double>
+																	<double key="NSWidth">1.780000e+02</double>
 																	<double key="NSMinWidth">4.000000e+01</double>
 																	<double key="NSMaxWidth">1.000000e+03</double>
 																	<object class="NSTableHeaderCell" key="NSHeaderCell">
 															<reference key="NSOutlineViewOutlineTableColumnKey" ref="157704806"/>
 														</object>
 													</object>
-													<string key="NSFrame">{{0, 17}, {292, 262}}</string>
+													<string key="NSFrame">{{0, 17}, {208, 262}}</string>
 													<reference key="NSSuperview" ref="977457134"/>
 													<reference key="NSNextKeyView" ref="408726427"/>
 													<reference key="NSDocView" ref="408726427"/>
 														<bool key="EncodedWithXMLCoder">YES</bool>
 														<reference ref="435744945"/>
 													</object>
-													<string key="NSFrameSize">{292, 17}</string>
+													<string key="NSFrameSize">{208, 17}</string>
 													<reference key="NSSuperview" ref="977457134"/>
 													<reference key="NSNextKeyView" ref="435744945"/>
 													<reference key="NSDocView" ref="435744945"/>
 												</object>
 												<reference ref="674521879"/>
 											</object>
-											<string key="NSFrameSize">{292, 279}</string>
+											<string key="NSFrameSize">{208, 279}</string>
 											<reference key="NSSuperview" ref="599257509"/>
 											<reference key="NSNextKeyView" ref="305294895"/>
 											<int key="NSsFlags">560</int>
 												<object class="NSTabView" id="795161276">
 													<reference key="NSNextResponder" ref="987824090"/>
 													<int key="NSvFlags">18</int>
-													<string key="NSFrameSize">{287, 279}</string>
+													<string key="NSFrameSize">{371, 279}</string>
 													<reference key="NSSuperview" ref="987824090"/>
 													<object class="NSMutableArray" key="NSTabViewItems">
 														<bool key="EncodedWithXMLCoder">YES</bool>
 																					<object class="NSTextView" id="1057217485">
 																						<reference key="NSNextResponder" ref="378280175"/>
 																						<int key="NSvFlags">2322</int>
-																						<string key="NSFrameSize">{0, 0}</string>
+																						<string key="NSFrameSize">{0.001, 12}</string>
 																						<reference key="NSSuperview" ref="378280175"/>
 																						<object class="NSTextContainer" key="NSTextContainer" id="178117438">
 																							<object class="NSLayoutManager" key="NSLayoutManager">
 																								<nil key="NSDelegate"/>
 																							</object>
 																							<reference key="NSTextView" ref="1057217485"/>
-																							<double key="NSWidth">0.000000e+00</double>
+																							<double key="NSWidth">1.000000e-03</double>
 																							<int key="NSTCFlags">1</int>
 																						</object>
 																						<object class="NSTextViewSharedData" key="NSSharedData">
 																						</object>
 																						<int key="NSTVFlags">7</int>
 																						<string key="NSMaxSize">{1e+07, 1e+07}</string>
+																						<string key="NSMinize">{0, 0}</string>
 																						<nil key="NSDelegate"/>
 																					</object>
 																				</object>
 																	<bool key="EncodedWithXMLCoder">YES</bool>
 																	<object class="NSSegmentedControl" id="449830288">
 																		<reference key="NSNextResponder" ref="813694821"/>
-																		<int key="NSvFlags">269</int>
-																		<string key="NSFrame">{{79, 259}, {150, 20}}</string>
+																		<int key="NSvFlags">268</int>
+																		<string key="NSFrame">{{-2, 259}, {150, 20}}</string>
 																		<reference key="NSSuperview" ref="813694821"/>
 																		<bool key="NSEnabled">YES</bool>
 																		<object class="NSSegmentedCell" key="NSCell" id="168043516">
 																						<nil key="NSDelegate"/>
 																					</object>
 																				</object>
-																				<string key="NSFrame">{{1, 1}, {270, 237}}</string>
+																				<string key="NSFrame">{{1, 1}, {354, 237}}</string>
 																				<reference key="NSSuperview" ref="73478478"/>
 																				<reference key="NSNextKeyView" ref="93501879"/>
 																				<reference key="NSDocView" ref="93501879"/>
 																			<object class="NSScroller" id="895600119">
 																				<reference key="NSNextResponder" ref="73478478"/>
 																				<int key="NSvFlags">256</int>
-																				<string key="NSFrame">{{271, 1}, {15, 237}}</string>
+																				<string key="NSFrame">{{355, 1}, {15, 237}}</string>
 																				<reference key="NSSuperview" ref="73478478"/>
 																				<reference key="NSTarget" ref="73478478"/>
 																				<string key="NSAction">_doScroller:</string>
-																				<double key="NSPercent">9.829546e-01</double>
+																				<double key="NSPercent">9.236111e-01</double>
 																			</object>
 																			<object class="NSScroller" id="829448081">
 																				<reference key="NSNextResponder" ref="73478478"/>
 																				<int key="NSvFlags">256</int>
-																				<string key="NSFrame">{{1, 238}, {270, 15}}</string>
+																				<string key="NSFrame">{{1, 238}, {354, 15}}</string>
 																				<reference key="NSSuperview" ref="73478478"/>
 																				<int key="NSsFlags">1</int>
 																				<reference key="NSTarget" ref="73478478"/>
 																				<double key="NSPercent">9.456522e-01</double>
 																			</object>
 																		</object>
-																		<string key="NSFrameSize">{287, 254}</string>
+																		<string key="NSFrameSize">{371, 254}</string>
 																		<reference key="NSSuperview" ref="813694821"/>
 																		<reference key="NSNextKeyView" ref="436421256"/>
 																		<int key="NSsFlags">50</int>
 																		<reference key="NSHScroller" ref="829448081"/>
 																		<reference key="NSContentView" ref="436421256"/>
 																	</object>
+																	<object class="NSButton" id="614794555">
+																		<reference key="NSNextResponder" ref="813694821"/>
+																		<int key="NSvFlags">265</int>
+																		<string key="NSFrame">{{258, 255}, {103, 28}}</string>
+																		<reference key="NSSuperview" ref="813694821"/>
+																		<bool key="NSEnabled">YES</bool>
+																		<object class="NSButtonCell" key="NSCell" id="77075735">
+																			<int key="NSCellFlags">67239424</int>
+																			<int key="NSCellFlags2">134348800</int>
+																			<string key="NSContents">Open in Editor</string>
+																			<reference key="NSSupport" ref="26"/>
+																			<reference key="NSControlView" ref="614794555"/>
+																			<int key="NSButtonFlags">-2038284033</int>
+																			<int key="NSButtonFlags2">129</int>
+																			<string key="NSAlternateContents"/>
+																			<string key="NSKeyEquivalent"/>
+																			<int key="NSPeriodicDelay">200</int>
+																			<int key="NSPeriodicInterval">25</int>
+																		</object>
+																	</object>
 																</object>
-																<string key="NSFrameSize">{287, 279}</string>
+																<string key="NSFrameSize">{371, 279}</string>
 																<reference key="NSSuperview" ref="795161276"/>
 															</object>
 															<string key="NSLabel">File</string>
 													</object>
 												</object>
 											</object>
-											<string key="NSFrame">{{301, 0}, {287, 279}}</string>
+											<string key="NSFrame">{{217, 0}, {371, 279}}</string>
 											<reference key="NSSuperview" ref="599257509"/>
 											<string key="NSClassName">NSView</string>
 										</object>
 									<bool key="NSIsVertical">YES</bool>
 								</object>
 							</object>
-							<string key="NSFrame">{{-1, -1}, {588, 490}}</string>
+							<string key="NSFrame">{{-1, 0}, {588, 490}}</string>
 							<reference key="NSSuperview" ref="118353878"/>
 						</object>
 					</object>
-					<string key="NSFrameSize">{586, 488}</string>
+					<string key="NSFrameSize">{587, 489}</string>
 					<reference key="NSSuperview"/>
 				</object>
 				<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
 					</object>
 					<int key="connectionID">300353</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">openInEditor:</string>
+						<reference key="source" ref="798535885"/>
+						<reference key="destination" ref="614794555"/>
+					</object>
+					<int key="connectionID">300356</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
 						<reference key="object" ref="813694821"/>
 						<object class="NSMutableArray" key="children">
 							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="73478478"/>
 							<reference ref="449830288"/>
-							<reference ref="73478478"/>
+							<reference ref="614794555"/>
 						</object>
 						<reference key="parent" ref="411344544"/>
 					</object>
 						<reference key="object" ref="93501879"/>
 						<reference key="parent" ref="73478478"/>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">300354</int>
+						<reference key="object" ref="614794555"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="77075735"/>
+						</object>
+						<reference key="parent" ref="813694821"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">300355</int>
+						<reference key="object" ref="77075735"/>
+						<reference key="parent" ref="614794555"/>
+					</object>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="flattenedProperties">
 					<string>300350.IBPluginDependency</string>
 					<string>300351.IBPluginDependency</string>
 					<string>300352.IBPluginDependency</string>
+					<string>300354.IBPluginDependency</string>
+					<string>300355.IBPluginDependency</string>
 					<string>6.IBPluginDependency</string>
 					<string>6.ImportedFromIB2</string>
 					<string>8.IBPluginDependency</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<reference ref="9"/>
-					<string>{{135, 165}, {586, 488}}</string>
-					<string>{{135, 165}, {586, 488}}</string>
+					<string>{{135, 164}, {587, 489}}</string>
+					<string>{{135, 164}, {587, 489}}</string>
 					<reference ref="9"/>
 					<string>{{166, 135}, {586, 488}}</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<reference ref="9"/>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<reference ref="9"/>
 				</object>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">300353</int>
+			<int key="maxID">300356</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
 							<string>discardChanges:</string>
 							<string>endCommitSheet:</string>
 							<string>fileInfoChooserChanged:</string>
+							<string>openInEditor:</string>
 							<string>openInTerminal:</string>
 							<string>openSelectedFile:</string>
 							<string>pushPullRevisions:</string>
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
+							<string>id</string>
 						</object>
 					</object>
 					<object class="NSMutableDictionary" key="outlets">

Source/RepoController.h

 
 @class HgRepository, HgFile, HgRevision, HgTempDir, HgOperation;
 
+enum {
+    kInfoDiffSegment = 0,
+    kInfoContentsSegment
+};
 
 /** The controller for a repository window. */
 @interface RepoController : NSWindowController 
 - (IBAction) chooseRevisionFromPopUp: (id)sender;
 
 - (IBAction) openSelectedFile: (id)sender;
+- (IBAction) openInEditor: (id)sender;
 
 - (IBAction) showRevision: (id)sender;
 - (IBAction) showDiff: (id)sender;

Source/RepoController.m

 - (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMaximumPosition ofSubviewAt:(NSInteger)dividerIndex
 {
     if (splitView != _splitter) {
-        float maxPos = splitView.frame.size.width - _fileInfoChooser.frame.size.width - splitView.dividerThickness;
+        // 275 = info chooser width + "Open In Editor" button width + padding
+        float maxPos = splitView.frame.size.width - 275 - splitView.dividerThickness;
         proposedMaximumPosition = MIN(proposedMaximumPosition,maxPos);
     }
     return proposedMaximumPosition;
 
 
 enum {
-    kInfoDiffSegment = 0,
-    kInfoContentsSegment
-};
-
-enum {
     kRevTab = 0,
     kFileTab
 };

Source/RepoController_Actions.m

         NSBeep();
 }
 
+- (IBAction) openInEditor: (id)sender
+{
+    switch (_fileInfoChooser.selectedSegment) {
+        case kInfoContentsSegment:
+            [self openSelectedFile:sender];
+            break;
+        case kInfoDiffSegment:
+            [self showDiff:sender];
+            break;
+    }
+}    
+
 
 #pragma mark -
 #pragma mark DIFFS: