better hide/show splitviews

This commit is contained in:
German Laullon
2011-04-22 15:48:19 -07:00
parent cc10bda032
commit f6e69682d1
14 changed files with 141 additions and 303 deletions
+30 -28
View File
@@ -2,10 +2,10 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10J567</string>
<string key="IBDocument.SystemVersion">10J869</string>
<string key="IBDocument.InterfaceBuilderVersion">1305</string>
<string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">462.00</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">1305</string>
@@ -109,11 +109,9 @@
<string key="NSToolbarItemPaletteLabel">Clone Repository To</string>
<nil key="NSToolbarItemToolTip"/>
<object class="NSButton" key="NSToolbarItemView" id="703553818">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{38, 14}, {40, 25}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="64590231">
<int key="NSCellFlags">-2080244224</int>
@@ -156,11 +154,9 @@
<string key="NSToolbarItemPaletteLabel">Refresh</string>
<nil key="NSToolbarItemToolTip"/>
<object class="NSButton" key="NSToolbarItemView" id="438380428">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{8, 14}, {32, 25}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="604536609">
<int key="NSCellFlags">-2080244224</int>
@@ -199,11 +195,9 @@
<string key="NSToolbarItemPaletteLabel">View</string>
<nil key="NSToolbarItemToolTip"/>
<object class="NSSegmentedControl" key="NSToolbarItemView" id="371591001">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{0, 14}, {94, 25}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSegmentedCell" key="NSCell" id="399933706">
<int key="NSCellFlags">67239424</int>
@@ -402,6 +396,7 @@
<string key="NSFrameSize">{184, 483}</string>
<reference key="NSSuperview" ref="120427370"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="933485175"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="933485175">
@@ -410,12 +405,14 @@
<string key="NSFrame">{{185, 0}, {705, 483}}</string>
<reference key="NSSuperview" ref="120427370"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="207262158"/>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrame">{{0, 31}, {890, 483}}</string>
<reference key="NSSuperview" ref="751230759"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="3950721"/>
<bool key="NSIsVertical">YES</bool>
<int key="NSDividerStyle">2</int>
<string key="NSAutosaveName">sourceSplitView</string>
@@ -426,6 +423,7 @@
<string key="NSFrame">{{0, 1}, {515, 31}}</string>
<reference key="NSSuperview" ref="751230759"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="44848571"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="44848571">
@@ -440,6 +438,7 @@
<string key="NSFrame">{{20, 7}, {16, 16}}</string>
<reference key="NSSuperview" ref="44848571"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="508249619"/>
<int key="NSpiFlags">20746</int>
<double key="NSMaxValue">100</double>
</object>
@@ -449,6 +448,7 @@
<string key="NSFrame">{{41, 8}, {188, 14}}</string>
<reference key="NSSuperview" ref="44848571"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="708164574">
<int key="NSCellFlags">67239488</int>
@@ -484,14 +484,16 @@
<string key="NSFrame">{{552, 0}, {246, 31}}</string>
<reference key="NSSuperview" ref="751230759"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="490597384"/>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrame">{{7, 11}, {890, 514}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="120427370"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{600, 528}</string>
<string key="NSMaxSize">{1e+13, 1e+13}</string>
<string key="NSFrameAutosaveName">GitX</string>
@@ -533,14 +535,6 @@
</object>
<int key="connectionID">356</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">splitView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="120427370"/>
</object>
<int key="connectionID">357</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">sourceListControlsView</string>
@@ -621,6 +615,14 @@
</object>
<int key="connectionID">423</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">mainSplitView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="120427370"/>
</object>
<int key="connectionID">424</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -945,7 +947,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">423</int>
<int key="maxID">424</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1026,10 +1028,10 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>contentSplitView</string>
<string>finderItem</string>
<string>mainSplitView</string>
<string>progressIndicator</string>
<string>sourceListControlsView</string>
<string>sourceSplitView</string>
<string>splitView</string>
<string>statusField</string>
<string>terminalItem</string>
</object>
@@ -1037,10 +1039,10 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSView</string>
<string>NSToolbarItem</string>
<string>NSSplitView</string>
<string>NSProgressIndicator</string>
<string>NSView</string>
<string>NSView</string>
<string>NSSplitView</string>
<string>NSTextField</string>
<string>NSToolbarItem</string>
</object>
@@ -1051,10 +1053,10 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>contentSplitView</string>
<string>finderItem</string>
<string>mainSplitView</string>
<string>progressIndicator</string>
<string>sourceListControlsView</string>
<string>sourceSplitView</string>
<string>splitView</string>
<string>statusField</string>
<string>terminalItem</string>
</object>
@@ -1068,6 +1070,10 @@
<string key="name">finderItem</string>
<string key="candidateClassName">NSToolbarItem</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">mainSplitView</string>
<string key="candidateClassName">NSSplitView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">progressIndicator</string>
<string key="candidateClassName">NSProgressIndicator</string>
@@ -1080,10 +1086,6 @@
<string key="name">sourceSplitView</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">splitView</string>
<string key="candidateClassName">NSSplitView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">statusField</string>
<string key="candidateClassName">NSTextField</string>
+1
View File
@@ -219,6 +219,7 @@
[[view mainFrame] reload];
}
}
lastFile=nil;
}
- (NSView *)accessoryViewForScopeBar:(MGScopeBar *)scopeBar
-32
View File
@@ -62,7 +62,6 @@
31460CD6124185BA00B90AED /* TODO in Resources */ = {isa = PBXBuildFile; fileRef = 31460CB1124185BA00B90AED /* TODO */; };
316E7202131EE9C600AFBB36 /* list_Template.png in Resources */ = {isa = PBXBuildFile; fileRef = 316E7200131EE9C600AFBB36 /* list_Template.png */; };
316E7203131EE9C600AFBB36 /* sidebar_Template.png in Resources */ = {isa = PBXBuildFile; fileRef = 316E7201131EE9C600AFBB36 /* sidebar_Template.png */; };
3177607D133554A80025876E /* SearchWebView.js in Sources */ = {isa = PBXBuildFile; fileRef = 3177607C133554A80025876E /* SearchWebView.js */; };
31776089133569350025876E /* SearchWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 31776088133569350025876E /* SearchWebView.m */; };
31DAA7ED1317737100463846 /* gitx_l_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 31DAA7EC1317737100463846 /* gitx_l_pub.pem */; };
3BC07F4C0ED5A5C5009A7768 /* HistoryViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 3BC07F4A0ED5A5C5009A7768 /* HistoryViewTemplate.png */; };
@@ -142,10 +141,6 @@
D8FDDA6F114335E8005647F6 /* PBGitSVStageItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D8FDDA67114335E8005647F6 /* PBGitSVStageItem.m */; };
D8FDDA70114335E8005647F6 /* PBGitSVTagItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D8FDDA69114335E8005647F6 /* PBGitSVTagItem.m */; };
D8FDDBF41143F318005647F6 /* AddRemote.png in Resources */ = {isa = PBXBuildFile; fileRef = D8FDDBF31143F318005647F6 /* AddRemote.png */; };
EB2A734A0FEE3F09006601CF /* PBCollapsibleSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = EB2A73490FEE3F09006601CF /* PBCollapsibleSplitView.m */; };
F50A411F0EBB874C00208746 /* mainSplitterBar.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F50A411D0EBB874C00208746 /* mainSplitterBar.tiff */; };
F50A41200EBB874C00208746 /* mainSplitterDimple.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F50A411E0EBB874C00208746 /* mainSplitterDimple.tiff */; };
F50A41230EBB875D00208746 /* PBNiceSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = F50A41220EBB875D00208746 /* PBNiceSplitView.m */; };
F50FE0E30E07BE9600854FCD /* PBGitRevisionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F50FE0E20E07BE9600854FCD /* PBGitRevisionCell.m */; };
F513085B0E0740F2000C8BCD /* PBQLOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = F513085A0E0740F2000C8BCD /* PBQLOutlineView.m */; };
F5140DC90E8A8EB20091E9F3 /* RoundedRectangle.m in Sources */ = {isa = PBXBuildFile; fileRef = F5140DC80E8A8EB20091E9F3 /* RoundedRectangle.m */; };
@@ -355,7 +350,6 @@
31460CB1124185BA00B90AED /* TODO */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TODO; sourceTree = "<group>"; };
316E7200131EE9C600AFBB36 /* list_Template.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = list_Template.png; sourceTree = "<group>"; };
316E7201131EE9C600AFBB36 /* sidebar_Template.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sidebar_Template.png; sourceTree = "<group>"; };
3177607C133554A80025876E /* SearchWebView.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = SearchWebView.js; path = html/lib/SearchWebView.js; sourceTree = "<group>"; };
31776087133569350025876E /* SearchWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchWebView.h; sourceTree = "<group>"; };
31776088133569350025876E /* SearchWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchWebView.m; sourceTree = "<group>"; };
31DAA7EC1317737100463846 /* gitx_l_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gitx_l_pub.pem; sourceTree = "<group>"; };
@@ -477,12 +471,6 @@
D8FDDA69114335E8005647F6 /* PBGitSVTagItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitSVTagItem.m; sourceTree = "<group>"; };
D8FDDA7311433634005647F6 /* PBSourceViewItems.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBSourceViewItems.h; sourceTree = "<group>"; };
D8FDDBF31143F318005647F6 /* AddRemote.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AddRemote.png; path = Images/AddRemote.png; sourceTree = "<group>"; };
EB2A73480FEE3F09006601CF /* PBCollapsibleSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCollapsibleSplitView.h; sourceTree = "<group>"; };
EB2A73490FEE3F09006601CF /* PBCollapsibleSplitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCollapsibleSplitView.m; sourceTree = "<group>"; };
F50A411D0EBB874C00208746 /* mainSplitterBar.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = mainSplitterBar.tiff; path = Images/mainSplitterBar.tiff; sourceTree = "<group>"; };
F50A411E0EBB874C00208746 /* mainSplitterDimple.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = mainSplitterDimple.tiff; path = Images/mainSplitterDimple.tiff; sourceTree = "<group>"; };
F50A41210EBB875D00208746 /* PBNiceSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBNiceSplitView.h; sourceTree = "<group>"; };
F50A41220EBB875D00208746 /* PBNiceSplitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBNiceSplitView.m; sourceTree = "<group>"; };
F50FE0E10E07BE9600854FCD /* PBGitRevisionCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRevisionCell.h; sourceTree = "<group>"; };
F50FE0E20E07BE9600854FCD /* PBGitRevisionCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRevisionCell.m; sourceTree = "<group>"; };
F51308590E0740F2000C8BCD /* PBQLOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBQLOutlineView.h; sourceTree = "<group>"; };
@@ -766,7 +754,6 @@
29B97314FDCFA39411CA2CEA /* GitTest */ = {
isa = PBXGroup;
children = (
3177607C133554A80025876E /* SearchWebView.js */,
F5886A080ED5D26B0066E74C /* SpeedTest */,
913D5E420E5563FD00CECEA2 /* cli */,
D89E9B4C1218C22A0097A90B /* GitXScripting */,
@@ -835,7 +822,6 @@
02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */,
F5F7D0641062E7940072C81C /* UpdateKey.pem */,
31DAA7EC1317737100463846 /* gitx_l_pub.pem */,
F50A41130EBB872D00208746 /* Widgets */,
47DBDB920E94F47200671A1E /* Preference Icons */,
D26DC6440E782C9000C777B2 /* gitx.icns */,
8D1107310486CEB800E47090 /* Info.plist */,
@@ -992,15 +978,6 @@
name = "Source View Items";
sourceTree = "<group>";
};
F50A41130EBB872D00208746 /* Widgets */ = {
isa = PBXGroup;
children = (
F50A411D0EBB874C00208746 /* mainSplitterBar.tiff */,
F50A411E0EBB874C00208746 /* mainSplitterDimple.tiff */,
);
name = Widgets;
sourceTree = "<group>";
};
F56174540E05887E001DCD79 /* Git */ = {
isa = PBXGroup;
children = (
@@ -1075,10 +1052,6 @@
F5140DC80E8A8EB20091E9F3 /* RoundedRectangle.m */,
F56244070E9684B0002B6C44 /* PBUnsortableTableHeader.h */,
F56244080E9684B0002B6C44 /* PBUnsortableTableHeader.m */,
F50A41210EBB875D00208746 /* PBNiceSplitView.h */,
F50A41220EBB875D00208746 /* PBNiceSplitView.m */,
EB2A73480FEE3F09006601CF /* PBCollapsibleSplitView.h */,
EB2A73490FEE3F09006601CF /* PBCollapsibleSplitView.m */,
F5FC41F20EBCBD4300191D80 /* PBGitXProtocol.h */,
F5FC41F30EBCBD4300191D80 /* PBGitXProtocol.m */,
D823487410CB382C00944BDE /* Terminal.h */,
@@ -1399,8 +1372,6 @@
F59116E60E843BB50072CCB1 /* PBGitCommitView.xib in Resources */,
F5E92A230E88569500056E75 /* new_file.png in Resources */,
F5E424110EA3E4D60046E362 /* PBDiffWindow.xib in Resources */,
F50A411F0EBB874C00208746 /* mainSplitterBar.tiff in Resources */,
F50A41200EBB874C00208746 /* mainSplitterDimple.tiff in Resources */,
056438B70ED0C40B00985397 /* DetailViewTemplate.png in Resources */,
F56ADDD90ED19F9E002AC78F /* AddBranchTemplate.png in Resources */,
F56ADDDA0ED19F9E002AC78F /* AddLabelTemplate.png in Resources */,
@@ -1564,7 +1535,6 @@
F5E424150EA3E4E10046E362 /* PBDiffWindowController.m in Sources */,
F5E424180EA3E4EB0046E362 /* PBWebDiffController.m in Sources */,
F5FE6C030EB13BC900F30D12 /* PBServicesController.m in Sources */,
F50A41230EBB875D00208746 /* PBNiceSplitView.m in Sources */,
F5FC41F40EBCBD4300191D80 /* PBGitXProtocol.m in Sources */,
F574A2850EAE2EAC003F2CB1 /* PBRefController.m in Sources */,
F5FC43FE0EBD08EE00191D80 /* PBRefMenuItem.m in Sources */,
@@ -1573,7 +1543,6 @@
47DBDB670E94EE8B00671A1E /* PBPrefsWindowController.m in Sources */,
47DBDBCA0E95016F00671A1E /* PBNSURLPathUserDefaultsTransfomer.m in Sources */,
F562C8870FE1766C000EC528 /* NSString_RegEx.m in Sources */,
EB2A734A0FEE3F09006601CF /* PBCollapsibleSplitView.m in Sources */,
F59F1DD5105C4FF300115F88 /* PBGitIndex.m in Sources */,
D854948610D5C01B0083B917 /* PBCreateBranchSheet.m in Sources */,
D8E3B34D10DCA958001096A3 /* PBCreateTagSheet.m in Sources */,
@@ -1624,7 +1593,6 @@
217FF0BB12A1CB3300785A65 /* PBGitResetController.m in Sources */,
217FF0BE12A1CB3E00785A65 /* PBRevealWithFinderCommand.m in Sources */,
65D58BC7132D48C2003F7290 /* PBResetSheet.m in Sources */,
3177607D133554A80025876E /* SearchWebView.js in Sources */,
31776089133569350025876E /* SearchWebView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Binary file not shown.
Binary file not shown.
-29
View File
@@ -1,29 +0,0 @@
//
// PBCollapsibleSplitView.h
// GitX
//
// This is a limited subclass of a SplitView. It adds methods to aid in
// collapsing/uncollapsing subviews using the mouse or programmatically.
// Right now it only works for vertical layouts and with two subviews.
//
// Created by Johannes Gilger on 6/21/09.
// Copyright 2009 Johannes Gilger. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "PBNiceSplitView.h"
@interface PBCollapsibleSplitView : PBNiceSplitView {
CGFloat topViewMin;
CGFloat bottomViewMin;
CGFloat splitterPosition;
}
@property (readonly) CGFloat topViewMin;
@property (readonly) CGFloat bottomViewMin;
- (void)setTopMin:(CGFloat)topMin andBottomMin:(CGFloat)bottomMin;
- (void)uncollapse;
- (void)keyDown:(NSEvent *)event;
@end
-57
View File
@@ -1,57 +0,0 @@
//
// PBCollapsibleSplitView.m
// GitX
//
// Created by Johannes Gilger on 6/21/09.
// Copyright 2009 Johannes Gilger. All rights reserved.
//
#import "PBCollapsibleSplitView.h"
@implementation PBCollapsibleSplitView
@synthesize topViewMin, bottomViewMin;
- (void)setTopMin:(CGFloat)topMin andBottomMin:(CGFloat)bottomMin {
topViewMin = topMin;
bottomViewMin = bottomMin;
}
- (void)uncollapse {
for (NSView *subview in [self subviews]) {
if([self isSubviewCollapsed:subview]) {
[self setPosition:[self frame].size.height / 3 ofDividerAtIndex:0];
[self adjustSubviews];
}
}
}
- (void)collapseSubview:(NSInteger)index {
// Already collapsed, just uncollapse
if ([self isSubviewCollapsed:[[self subviews] objectAtIndex:index]]) {
[self setPosition:splitterPosition ofDividerAtIndex:0];
return;
}
// Store splitterposition if the other view isn't collapsed
if (![self isSubviewCollapsed:[[self subviews] objectAtIndex:(index + 1) % 2]])
splitterPosition = [[[self subviews] objectAtIndex:0] frame].size.height;
if (index == 0) // Top view
[self setPosition:0.0 ofDividerAtIndex:0];
else // Bottom view
[self setPosition:[self frame].size.height ofDividerAtIndex:0];
}
- (void)keyDown:(NSEvent *)event {
if (!([event modifierFlags] & NSShiftKeyMask && [event modifierFlags] & NSCommandKeyMask))
return [super keyDown:event];
if ([event keyCode] == 0x07E) { // Up-Key
[self collapseSubview:0];
[[self window] makeFirstResponder:[[self subviews] objectAtIndex:1]];
} else if ([event keyCode] == 0x07D) { // Down-Key
[self collapseSubview:1];
[[self window] makeFirstResponder:[[self subviews] objectAtIndex:0]];
}
}
@end
+4 -5
View File
@@ -11,7 +11,6 @@
#import "PBChangedFile.h"
#import "PBWebChangesController.h"
#import "PBGitIndex.h"
#import "PBNiceSplitView.h"
#define kCommitSplitViewPositionDefault @"Commit SplitView Position"
@@ -229,16 +228,16 @@
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
{
if (splitView == commitSplitView)
if (proposedMin < kCommitSplitViewTopViewMin)
return kCommitSplitViewTopViewMin;
return proposedMin;
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
{
if (splitView == commitSplitView)
return [splitView frame].size.height - [splitView dividerThickness] - kCommitSplitViewBottomViewMin;
CGFloat max=[splitView frame].size.height - [splitView dividerThickness] - kCommitSplitViewBottomViewMin;
if (max < proposedMax)
return max;
return proposedMax;
}
+2 -5
View File
@@ -10,7 +10,6 @@
#import "PBGitCommit.h"
#import "PBGitTree.h"
#import "PBViewController.h"
#import "PBCollapsibleSplitView.h"
@class PBGitSidebarController;
@class PBWebHistoryController;
@@ -32,7 +31,7 @@
IBOutlet NSOutlineView* fileBrowser;
NSArray *currentFileBrowserSelectionPath;
IBOutlet PBCommitList* commitList;
IBOutlet PBCollapsibleSplitView *historySplitView;
IBOutlet NSSplitView *historySplitView;
IBOutlet PBWebHistoryController *webHistoryController;
QLPreviewPanel* previewPanel;
IBOutlet PBHistorySearchController *searchController;
@@ -59,7 +58,7 @@
}
@property (readonly) NSTreeController* treeController;
@property (readonly) PBCollapsibleSplitView *historySplitView;
@property (readonly) NSSplitView *historySplitView;
@property (assign) int selectedCommitDetailsIndex;
@property (retain) PBGitCommit *webCommit;
@property (retain) PBGitTree* gitTree;
@@ -107,7 +106,5 @@
- (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview;
- (BOOL)splitView:(NSSplitView *)splitView shouldCollapseSubview:(NSView *)subview forDoubleClickOnDividerAtIndex:(NSInteger)dividerIndex;
- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset;
- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset;
@end
+18 -37
View File
@@ -83,7 +83,7 @@
// Add a menu that allows a user to select which columns to view
[[commitList headerView] setMenu:[self tableColumnMenu]];
[historySplitView setTopMin:58.0 andBottomMin:100.0];
// [historySplitView setTopMin:58.0 andBottomMin:100.0];
[historySplitView setHidden:YES];
[self performSelector:@selector(restoreSplitViewPositiion) withObject:nil afterDelay:0];
@@ -628,42 +628,6 @@
return FALSE;
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
{
return historySplitView.topViewMin;
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
{
return [splitView frame].size.height - [splitView dividerThickness] - historySplitView.bottomViewMin;
}
// while the user resizes the window keep the upper (history) view constant and just resize the lower view
// unless the lower view gets too small
- (void)splitView:(NSSplitView *)splitView resizeSubviewsWithOldSize:(NSSize)oldSize
{
NSRect newFrame = [splitView frame];
float dividerThickness = [splitView dividerThickness];
NSView *upperView = [[splitView subviews] objectAtIndex:0];
NSRect upperFrame = [upperView frame];
upperFrame.size.width = newFrame.size.width;
if ((newFrame.size.height - upperFrame.size.height - dividerThickness) < historySplitView.bottomViewMin) {
upperFrame.size.height = newFrame.size.height - historySplitView.bottomViewMin - dividerThickness;
}
NSView *lowerView = [[splitView subviews] objectAtIndex:1];
NSRect lowerFrame = [lowerView frame];
lowerFrame.origin.y = upperFrame.size.height + dividerThickness;
lowerFrame.size.height = newFrame.size.height - lowerFrame.origin.y;
lowerFrame.size.width = newFrame.size.width;
[upperView setFrame:upperFrame];
[lowerView setFrame:lowerFrame];
}
// NSSplitView does not save and restore the position of the SplitView correctly so do it manually
- (void)saveSplitViewPosition
{
@@ -684,6 +648,23 @@
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
{
if (proposedMin < 100)
return 100;
return proposedMin;
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
{
CGFloat max=[splitView frame].size.height - [splitView dividerThickness] - 100;
if (max < proposedMax)
return max;
return proposedMax;
}
#pragma mark Repository Methods
- (IBAction) createBranch:(id)sender
+7 -3
View File
@@ -21,7 +21,7 @@
PBGitSidebarController *sidebarController;
IBOutlet NSView *sourceListControlsView;
IBOutlet NSSplitView *splitView;
IBOutlet NSSplitView *mainSplitView;
IBOutlet NSView *sourceSplitView;
IBOutlet NSView *contentSplitView;
@@ -30,6 +30,9 @@
IBOutlet NSToolbarItem *terminalItem;
IBOutlet NSToolbarItem *finderItem;
NSArray *splitViews;
NSMutableArray *splitViewsSize;
}
@property (assign) __weak PBGitRepository *repository;
@@ -42,7 +45,9 @@
- (void)showMessageSheet:(NSString *)messageText infoText:(NSString *)infoText;
- (void)showErrorSheet:(NSError *)error;
- (void)showErrorSheetTitle:(NSString *)title message:(NSString *)message arguments:(NSArray *)arguments output:(NSString *)output;
- (void)collapseSplitView:(NSSplitView *)sp show:(BOOL)show;
-(void)initChangeLayout;
-(IBAction)changeLayout:(id)sender;
- (IBAction) showCommitView:(id)sender;
- (IBAction) showHistoryView:(id)sender;
@@ -50,7 +55,6 @@
- (IBAction) openInTerminal:(id)sender;
- (IBAction) cloneTo:(id)sender;
- (IBAction) refresh:(id)sender;
- (IBAction) changeLayout:(id)sender;
- (void)setHistorySearch:(NSString *)searchString mode:(NSInteger)mode;
+79 -47
View File
@@ -25,19 +25,19 @@
{
if (!(self = [self initWithWindowNibName:@"RepositoryWindow"]))
return nil;
self.repository = theRepository;
return self;
}
- (void)windowWillClose:(NSNotification *)notification
{
//DLog(@"Window will close!");
if (sidebarController)
[sidebarController closeView];
if (contentController)
[contentController removeObserver:self forKeyPath:@"status"];
}
@@ -59,22 +59,23 @@
[[self window] setDelegate:self];
[[self window] setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge];
[[self window] setContentBorderThickness:31.0f forEdge:NSMinYEdge];
sidebarController = [[PBGitSidebarController alloc] initWithRepository:repository superController:self];
[[sidebarController view] setFrame:[sourceSplitView bounds]];
[sourceSplitView addSubview:[sidebarController view]];
[sourceListControlsView addSubview:sidebarController.sourceListControlsView];
[[statusField cell] setBackgroundStyle:NSBackgroundStyleRaised];
[progressIndicator setUsesThreadedAnimation:YES];
NSImage *finderImage = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kFinderIcon)];
[finderItem setImage:finderImage];
NSImage *terminalImage = [[NSWorkspace sharedWorkspace] iconForFile:@"/Applications/Utilities/Terminal.app/"];
[terminalItem setImage:terminalImage];
[self showWindow:nil];
[self initChangeLayout];
}
- (void) removeAllContentSubViews
@@ -88,17 +89,17 @@
{
if (!controller || (contentController == controller))
return;
if (contentController)
[contentController removeObserver:self forKeyPath:@"status"];
[self removeAllContentSubViews];
contentController = controller;
[[contentController view] setFrame:[contentSplitView bounds]];
[contentSplitView addSubview:[contentController view]];
[self setNextResponder: contentController];
[[self window] makeFirstResponder:[contentController firstResponder]];
[contentController updateView];
@@ -183,14 +184,14 @@
{
NSString *status = contentController.status;
BOOL isBusy = contentController.isBusy;
if (!status) {
status = @"";
isBusy = NO;
}
[statusField setStringValue:status];
if (isBusy) {
[progressIndicator startAnimation:self];
[progressIndicator setHidden:NO];
@@ -207,7 +208,7 @@
[self updateStatus];
return;
}
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
@@ -216,46 +217,77 @@
[sidebarController setHistorySearch:searchString mode:mode];
}
- (IBAction) changeLayout:(id)sender{
NSSplitView *sp=nil;
switch ([sender selectedSegment]) {
case 0:
sp=splitView;
break;
case 1:
sp=[[sidebarController historyViewController] historySplitView];
break;
}
DLog(@"sp=%@",sp);
if(sp!=nil) {
[self collapseSplitView:sp show:[sender isSelectedForSegment:[sender selectedSegment]]];
}
#pragma mark - SplitView changeLayout
-(void)initChangeLayout
{
splitViews=[NSArray arrayWithObjects:mainSplitView,[[sidebarController historyViewController] historySplitView], nil];
splitViewsSize=[NSMutableArray arrayWithCapacity:[splitViews count]];
for (int n=0; n<[splitViews count]; n++) {
NSSplitView *splitView=[splitViews objectAtIndex:n];
NSView *left=[[splitView subviews] objectAtIndex:0];
[splitViewsSize addObject:[NSNumber numberWithInt:[left frame].size.width]];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(resizeSubviewsHandler:)
name:NSSplitViewWillResizeSubviewsNotification
object:splitView
];
}
}
- (void)collapseSplitView:(NSSplitView *)sp show:(BOOL)show{
NSView *clipview = [[sp subviews] objectAtIndex:0];
NSRect clipFrame = [clipview frame];
- (IBAction)changeLayout:(id)sender
{
NSInteger index=[sender selectedSegment];
NSSplitView *splitView=[splitViews objectAtIndex:index];
NSView *left=[[splitView subviews] objectAtIndex:0];
CGFloat pos;
if ([splitView isSubviewCollapsed:left])
pos=[[splitViewsSize objectAtIndex:index] intValue];
else
pos=[splitView minPossiblePositionOfDividerAtIndex:0];
if ([sp isVertical]) {
clipFrame.size.width = kGitSplitViewMinWidth * show;
}else{
clipFrame.size.height = kGitSplitViewMinWidth * show;
}
[splitView setPosition:pos ofDividerAtIndex:0 ];
}
[[clipview animator] setFrame:clipFrame];
[sp adjustSubviews];
- (void)resizeSubviewsHandler:(NSNotification *)notif
{
NSSplitView *splitView=[notif object];
NSInteger index=[splitViews indexOfObject:splitView];
NSView *left=[[splitView subviews] objectAtIndex:0];
NSNumber *pos;
if([splitView isVertical]){
pos=[NSNumber numberWithInt:[left frame].size.width];
}else{
pos=[NSNumber numberWithInt:[left frame].size.height];
}
[splitViewsSize removeObjectAtIndex:index];
[splitViewsSize insertObject:pos atIndex:index];
}
#pragma mark -
#pragma mark SplitView Delegates
- (BOOL)splitView:(NSSplitView *)sp canCollapseSubview:(NSView *)subview
{
return TRUE;
}
- (BOOL)splitView:(NSSplitView *)splitView shouldCollapseSubview:(NSView *)subview forDoubleClickOnDividerAtIndex:(NSInteger)dividerIndex
{
NSUInteger index = [[splitView subviews] indexOfObject:subview];
return index==0;
}
#pragma mark min/max widths while moving the divider
- (CGFloat)splitView:(NSSplitView *)view constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
{
if (proposedMin < kGitSplitViewMinWidth)
return kGitSplitViewMinWidth;
return proposedMin;
}
@@ -263,7 +295,7 @@
{
if (dividerIndex == 0)
return kGitSplitViewMaxWidth;
return proposedMax;
}
@@ -272,19 +304,19 @@
- (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:(NSSize)oldSize
{
NSRect newFrame = [sender frame];
float dividerThickness = [sender dividerThickness];
NSView *sourceView = [[sender subviews] objectAtIndex:0];
NSRect sourceFrame = [sourceView frame];
sourceFrame.size.height = newFrame.size.height;
NSView *mainView = [[sender subviews] objectAtIndex:1];
NSRect mainFrame = [mainView frame];
mainFrame.origin.x = sourceFrame.size.width + dividerThickness;
mainFrame.size.width = newFrame.size.width - mainFrame.origin.x;
mainFrame.size.height = newFrame.size.height;
[sourceView setFrame:sourceFrame];
[mainView setFrame:mainFrame];
}
-15
View File
@@ -1,15 +0,0 @@
//
// PBNiceSplitView.h
// GitX
//
// Created by Pieter de Bie on 31-10-08.
// Copyright 2008 Pieter de Bie. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface PBNiceSplitView : NSSplitView {
}
@end
-45
View File
@@ -1,45 +0,0 @@
//
// PBNiceSplitView.m
// GitX
//
// Created by Pieter de Bie on 31-10-08.
// Copyright 2008 Pieter de Bie. All rights reserved.
//
#import "PBNiceSplitView.h"
static NSImage *bar;
static NSImage *grip;
@implementation PBNiceSplitView
+(void) initialize
{
NSString *barPath = [[NSBundle mainBundle] pathForResource:@"mainSplitterBar" ofType:@"tiff"];
bar = [[NSImage alloc] initWithContentsOfFile: barPath];
[bar setFlipped: YES];
NSString *gripPath = [[NSBundle mainBundle] pathForResource:@"mainSplitterDimple" ofType:@"tiff"];
grip = [[NSImage alloc] initWithContentsOfFile: gripPath];
[grip setFlipped: YES];
}
- (void)drawDividerInRect:(NSRect)aRect
{
// Draw bar and grip onto the canvas
NSRect gripRect = aRect;
gripRect.origin.x = (NSMidX(aRect) - ([grip size].width/2));
gripRect.size.width = 8;
[self lockFocus];
[bar drawInRect:aRect fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0];
[grip drawInRect:gripRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
[self unlockFocus];
}
- (CGFloat)dividerThickness
{
return 10.0;
}
@end