diff --git a/ChangeLog b/ChangeLog index a3c61829..8891d797 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2004-04-17 10:58 Gregory John Casamento + + * Palettes/3Containers/GormNSOutlineView.m: Changed some of + the default data source's elements to be closer to the actual + class hierarchy. + * Palettes/3Containers/inspectors.m: Added code to the + GormTableViewInspector to add or delete columns based on the + new field which specifies the number of columns in the + table/outline. + * Palettes/3Containers/main.m: removed some old code and + added code to expand the outline view so it looks better + in the palette. + * Palettes/3Containers/GormNSTableViewInspector.gorm: added + "#Columns" field to allow the user to modify the columns in the + table without cutting/pasting. + 2004-04-13 20:57 Gregory John Casamento * Version 0.7.5 diff --git a/Palettes/3Containers/GormNSOutlineView.m b/Palettes/3Containers/GormNSOutlineView.m index 6998ca52..0692d5c5 100644 --- a/Palettes/3Containers/GormNSOutlineView.m +++ b/Palettes/3Containers/GormNSOutlineView.m @@ -60,33 +60,27 @@ return @"NSApplication"; break; case 1: - return @"NSPanel"; + return @"NSTableColumn"; break; case 2: - return @"NSWindow"; + return @"NSStatusBar"; break; case 3: - return @"NSOutlineView"; + return @"NSResponder"; break; default: break; } } - if([item isEqual: @"NSPanel"]) + if([item isEqual: @"NSResponder"]) { switch(index) { case 0: - return @"class1"; + return @"NSWindow"; break; case 1: - return @"class2"; - break; - case 2: - return @"class3"; - break; - case 3: - return @"class4"; + return @"NSView"; break; default: break; @@ -107,7 +101,7 @@ { if([item isEqual: @"NSObject"]) return YES; - if([item isEqual: @"NSPanel"]) + if([item isEqual: @"NSResponder"]) return YES; return NO; @@ -122,8 +116,8 @@ if([item isEqual: @"NSObject"]) return 4; else - if([item isEqual: @"NSPanel"]) - return 4; + if([item isEqual: @"NSResponder"]) + return 2; return 0; } @@ -142,15 +136,15 @@ else if([[tableColumn identifier] isEqual: @"outlets"]) { - value = @"1"; + value = @"0"; } else if([[tableColumn identifier] isEqual: @"actions"]) { - value = @"2"; + value = @"0"; } } - if([item isEqual: @"NSApplication"]) + else { if([[tableColumn identifier] isEqual: @"classes"]) { @@ -167,78 +161,6 @@ value = @"3"; } } - if([item isEqual: @"NSPanel"]) - { - if([[tableColumn identifier] isEqual: @"classes"]) - { - value = @"NSPanel"; - } - else - if([[tableColumn identifier] isEqual: @"outlets"]) - { - value = @"2"; - } - else - if([[tableColumn identifier] isEqual: @"actions"]) - { - value = @"3"; - } - } - if([item isEqual: @"NSWindow"]) - { - if([[tableColumn identifier] isEqual: @"classes"]) - { - value = @"NSWindow"; - } - else - if([[tableColumn identifier] isEqual: @"outlets"]) - { - value = @"3"; - } - else - if([[tableColumn identifier] isEqual: @"actions"]) - { - value = @"5"; - } - } - if([item isEqual: @"NSOutlineView"]) - { - if([[tableColumn identifier] isEqual: @"classes"]) - { - value = @"NSOutlineView"; - } - else - if([[tableColumn identifier] isEqual: @"outlets"]) - { - value = @"4"; - } - else - if([[tableColumn identifier] isEqual: @"actions"]) - { - value = @"6"; - } - } - - if([item isEqual: @"class1"] || - [item isEqual: @"class2"] || - [item isEqual: @"class3"] || - [item isEqual: @"class4"]) - { - if([[tableColumn identifier] isEqual: @"classes"]) - { - value = item; - } - else - if([[tableColumn identifier] isEqual: @"outlets"]) - { - value = @"2"; - } - else - if([[tableColumn identifier] isEqual: @"actions"]) - { - value = @"3"; - } - } return value; } diff --git a/Palettes/3Containers/GormNSTableViewInspector.gorm/objects.gorm b/Palettes/3Containers/GormNSTableViewInspector.gorm/objects.gorm index 22dcf340..bafee385 100644 Binary files a/Palettes/3Containers/GormNSTableViewInspector.gorm/objects.gorm and b/Palettes/3Containers/GormNSTableViewInspector.gorm/objects.gorm differ diff --git a/Palettes/3Containers/inspectors.m b/Palettes/3Containers/inspectors.m index f6d80663..1817c5a7 100644 --- a/Palettes/3Containers/inspectors.m +++ b/Palettes/3Containers/inspectors.m @@ -451,7 +451,46 @@ else if (control == rowsHeightForm) { + int numCols = [object numberOfColumns]; + int newNumCols = [[control cellAtIndex: 1] intValue]; + + // add/delete columns based on number in #columns field... [object setRowHeight: [[control cellAtIndex: 0] intValue] ]; + if(newNumCols > 0) + { + if(numCols < newNumCols) + { + int colsToAdd = newNumCols - numCols; + int i = 0; + // Add columns from the last to the target number... + for(i = 0; i < colsToAdd; i++) + { + NSString *identifier = [NSString stringWithFormat: @"TableColumn%d",(numCols + i + 1)]; + NSTableColumn *tc = AUTORELEASE([[NSTableColumn alloc] initWithIdentifier: identifier]); + [tc setWidth: 50]; + [tc setMinWidth: 20]; + [tc setResizable: YES]; + [tc setEditable: YES]; + [object addTableColumn: tc]; + } + } + else if(numCols > newNumCols) + { + int colsToDelete = numCols - newNumCols; + int i = 0; + NSArray *columns = [object tableColumns]; + // remove columns... + for(i = 0; i < colsToDelete; i++) + { + NSTableColumn *tc = [columns objectAtIndex: (i + newNumCols)]; + [object removeTableColumn: tc]; + } + } + } + + // recompute column sizes.. + [object sizeToFit]; + [object tile]; } else if (control == optionMatrix) @@ -516,7 +555,8 @@ } [[rowsHeightForm cellAtIndex: 0] setIntValue: [anObject rowHeight] ]; - + [[rowsHeightForm cellAtIndex: 1] setIntValue: [anObject numberOfColumns]]; + [optionMatrix deselectAllCells]; if ([anObject drawsGrid]) [optionMatrix selectCellAtRow: 0 column: 0]; diff --git a/Palettes/3Containers/main.m b/Palettes/3Containers/main.m index ba8c72e0..71014fe2 100644 --- a/Palettes/3Containers/main.m +++ b/Palettes/3Containers/main.m @@ -18,7 +18,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software + along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -112,8 +112,6 @@ tv = [[GormNSTableView alloc] initWithFrame: NSZeroRect]; - //[v setDocumentView: tv]; - //RELEASE(tv); tc = [[NSTableColumn alloc] initWithIdentifier: @"column1"]; [[tc headerCell] setStringValue: @" "]; @@ -148,8 +146,6 @@ ov = [[GormNSOutlineView alloc] initWithFrame: NSZeroRect]; - //[v setDocumentView: ov]; - //RELEASE(ov); tc = [[NSTableColumn alloc] initWithIdentifier: @"classes"]; [[tc headerCell] setStringValue: @" "]; @@ -169,9 +165,20 @@ [tc setEditable: YES]; [ov addTableColumn: tc]; RELEASE(tc); + + tc = [[NSTableColumn alloc] initWithIdentifier: @"actions"]; + [[tc headerCell] setStringValue: @" "]; + [tc setWidth: ceil(contentSize.width/2)]; + [tc setMinWidth: 20]; + [tc setResizable: YES]; + [tc setEditable: YES]; + [ov addTableColumn: tc]; + RELEASE(tc); + [ov setDrawsGrid: NO]; [ov setIndentationPerLevel: 10.]; [ov setIndentationMarkerFollowsCell: YES]; + [ov expandItem: @"NSObject" expandChildren: YES]; [v setDocumentView: ov]; RELEASE(ov);