force a single row to always be selected in the group list

This commit is contained in:
Mitchell Livingston 2008-11-29 21:58:09 +00:00
parent 877cc03308
commit 45e59c8bb7
3 changed files with 8 additions and 21 deletions

View File

@ -28,12 +28,11 @@
@interface GroupsWindowController : NSWindowController
{
IBOutlet NSColorWell * fSelectedColorView;
IBOutlet NSTextField * fSelectedColorNameField;
IBOutlet NSTableView * fTableView;
IBOutlet NSSegmentedControl * fAddRemoveControl;
NSInteger fCurrentColorIndex;
IBOutlet NSColorWell * fSelectedColorView;
IBOutlet NSTextField * fSelectedColorNameField;
}
- (void) addRemoveGroup: (id) sender;

View File

@ -58,10 +58,7 @@
[fAddRemoveControl setEnabled: NO forSegment: REMOVE_TAG];
[fSelectedColorView addObserver: self forKeyPath: @"color" options: 0 context: NULL];
if ([fTableView numberOfRows] > 0)
[fTableView selectRow: 0 byExtendingSelection: NO];
else
[self updateSelectedColor]; //make sure all fields are disabled
[self updateSelectedColor];
}
- (NSInteger) numberOfRowsInTableView: (NSTableView *) tableview
@ -163,22 +160,13 @@
break;
case REMOVE_TAG:
#warning refactor in color picker (fCurrentColorIndex) code)
//close color picker if corresponding row is removed
row = [fTableView selectedRow];
if ([[NSColorPanel sharedColorPanel] isVisible]
&& row == [[GroupsController groups] rowValueForIndex: fCurrentColorIndex])
[[NSColorPanel sharedColorPanel] close];
[[GroupsController groups] removeGroupWithRowIndex: row];
[fTableView reloadData];
//select the next row
if (row == [fTableView numberOfRows])
row--;
if (row >= 0)
[fTableView selectRow: row byExtendingSelection: NO];
if ([fTableView numberOfRows] > 0)
[fTableView scrollRowToVisible: [fTableView selectedRow]];
break;
}

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="1779"/>
<integer value="1771"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -3805,7 +3805,7 @@ eHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDA4AA</bytes>
<reference key="NSBackgroundColor" ref="381671284"/>
<reference key="NSGridColor" ref="1038987165"/>
<double key="NSRowHeight">1.800000e+01</double>
<int key="NSTvFlags">448790528</int>
<int key="NSTvFlags">46137344</int>
<int key="NSColumnAutoresizingStyle">4</int>
<int key="NSDraggingSourceMaskForLocal">15</int>
<int key="NSDraggingSourceMaskForNonLocal">0</int>