CommitView: Allow doubleclick to (un)stage changes

This commit is contained in:
Pieter de Bie
2008-10-03 19:38:26 +02:00
parent 7793e5eed4
commit a42adc6d82
3 changed files with 43 additions and 9 deletions
+3
View File
@@ -26,6 +26,9 @@
IBOutlet PBIconAndTextCell* unstagedButtonCell;
IBOutlet PBIconAndTextCell* cachedButtonCell;
IBOutlet NSTableView *unstagedTable;
IBOutlet NSTableView *cachedTable;
}
@property (retain) NSMutableArray *files;
+14 -7
View File
@@ -19,8 +19,11 @@
[super awakeFromNib];
self.busy = 0;
[unstagedButtonCell setAction:@selector(cellClicked:)];
[cachedButtonCell setAction:@selector(cellClicked:)];
[unstagedButtonCell setAction:@selector(rowClicked:)];
[cachedButtonCell setAction:@selector(rowClicked:)];
[unstagedTable setDoubleAction:@selector(tableClicked:)];
[cachedTable setDoubleAction:@selector(tableClicked:)];
[self refresh:self];
@@ -236,12 +239,8 @@
[self refresh:self];
}
- (void) cellClicked:(NSCell*) sender
- (void) tableClicked:(NSTableView *) tableView
{
NSTableView *tableView = (NSTableView *)[sender controlView];
if([tableView numberOfSelectedRows] != 1)
return;
NSUInteger selectionIndex = [[tableView selectedRowIndexes] firstIndex];
NSArrayController *controller, *otherController;
if ([tableView tag] == 0) {
@@ -268,6 +267,14 @@
[otherController addObject:selectedItem];
}
- (void) rowClicked:(NSCell *)sender
{
NSTableView *tableView = (NSTableView *)[sender controlView];
if([tableView numberOfSelectedRows] != 1)
return;
[self tableClicked: tableView];
}
- (void)tableView:(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(int)rowIndex
{
[[tableColumn dataCell] setImage:[[[(([tableView tag] == 0) ? unstagedFilesController : cachedFilesController) arrangedObjects] objectAtIndex:rowIndex] icon]];
+26 -2
View File
@@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="207"/>
<integer value="45"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1110,6 +1110,22 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<int key="connectionID">222</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">unstagedTable</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="588180404"/>
</object>
<int key="connectionID">223</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">cachedTable</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="638535043"/>
</object>
<int key="connectionID">224</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1500,7 +1516,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">222</int>
<int key="maxID">224</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1527,17 +1543,21 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>cachedButtonCell</string>
<string>cachedFilesController</string>
<string>cachedTable</string>
<string>commitMessageView</string>
<string>unstagedButtonCell</string>
<string>unstagedFilesController</string>
<string>unstagedTable</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>PBIconAndTextCell</string>
<string>NSArrayController</string>
<string>NSTableView</string>
<string>NSTextView</string>
<string>PBIconAndTextCell</string>
<string>NSArrayController</string>
<string>NSTableView</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -1556,6 +1576,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="IBPartialClassDescription">
<string key="className">PBViewController</string>
<string key="superclassName">NSViewController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">viewToolbar</string>
<string key="NS.object.0">NSToolbar</string>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">PBViewController.h</string>