From 3f892d52a9d0bed67f02e2a0fd8038e542819124 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Rivaille Date: Sun, 31 Mar 2002 15:59:18 +0000 Subject: [PATCH] ChangeLog GormWindowEditor.m GNUmakefile GormObjectEditor.m GormTableViewEditor.m ClassInformation.plist GormDocument.m Palettes/3Containers/main.m Palettes/3Containers/GNUmakefile Palettes/3Containers/inspectors.m Palettes/2Controls/GormBoxInspector.gorm Palettes/2Controls/GormTextFieldInspector.gorm Palettes/2Controls/GormSliderInspector.gorm Palettes/2Controls/GormFormInspector.gorm Palettes/2Controls/GormButtonInspector.gorm Resources/GormViewSizeInspector.gorm Resources/GormViewSizeInspector.classes Palettes/3Containers/GormNSOutlineView.m Palettes/3Containers/GormNSOutlineView.h git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@13277 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 32 + ClassInformation.plist | 4 + GNUmakefile | 1 + GormDocument.m | 12 +- GormObjectEditor.m | 132 +--- GormTableViewEditor.m | 18 +- GormWindowEditor.m | 20 +- Palettes/2Controls/GormBoxInspector.gorm | Bin 10592 -> 10592 bytes Palettes/2Controls/GormButtonInspector.gorm | Bin 10346 -> 10342 bytes Palettes/2Controls/GormFormInspector.gorm | Bin 7658 -> 7655 bytes Palettes/2Controls/GormSliderInspector.gorm | Bin 6386 -> 6383 bytes .../2Controls/GormTextFieldInspector.gorm | Bin 9666 -> 9663 bytes Palettes/3Containers/GNUmakefile | 6 +- Palettes/3Containers/GormNSOutlineView.h | 37 ++ Palettes/3Containers/GormNSOutlineView.m | 389 ++++++++++++ Palettes/3Containers/inspectors.m | 1 - Palettes/3Containers/main.m | 56 +- Resources/GormViewSizeInspector.classes | 571 ++++++++++++++++++ 18 files changed, 1139 insertions(+), 140 deletions(-) create mode 100644 Palettes/3Containers/GormNSOutlineView.h create mode 100644 Palettes/3Containers/GormNSOutlineView.m create mode 100644 Resources/GormViewSizeInspector.classes diff --git a/ChangeLog b/ChangeLog index dd558d73..0adb0d35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2002-03-31 Pierre-Yves Rivaille + * GormWindowEditor.m + When resizing matrix, use integer values for setCellSize. + When dropping an object from the palettes, use integer + coordinates for its frame. + + * GNUMakefile + * GormObjectEditor.m + * Resources/GormViewSizeInspector.gorm + * Resources/GormViewSizeInspector.classes + Moved GormViewSizeInspector to gorm. + + * ClassInformation.plist: NSOutlineView declaration. + * GormDocument.m ([GormDocument -{load, save}Document]): + * GormTableViewEditor.m ([-outlineViewSelectionDidChange:]) + * Palettes/3Containers/GNUMakefile + * Palettes/3Containers/main.m + * Palettes/3Containers/GormNSOutlineView.m + * Palettes/3Containers/GormNSOutlineView.h + * Palettes/3Containers/inspectors.m + GormNSOutlineView replaces NSOutlineView when editing interface. + GormNSOutlineView features a dummy dataSource during editing and + testing. + + * Palettes/2Controls/GormBoxInspector.gorm + * Palettes/2Controls/GormButtonInspector.gorm + * Palettes/2Controls/GormFormInspector.gorm + * Palettes/2Controls/GormSliderInspector.gorm + * Palettes/2Controls/GormTextFieldInspector.gorm + Cosmetic changes. + + 2002-03-29 Pierre-Yves Rivaille * GormDocument.m ([GormDocument -windowAndRect:forObject:]): diff --git a/ClassInformation.plist b/ClassInformation.plist index a73b631e..1a24380d 100644 --- a/ClassInformation.plist +++ b/ClassInformation.plist @@ -478,6 +478,10 @@ Super = NSControl; }; + NSOutlineView = { + Super = NSTableView; + }; + NSText = { Actions = ( alignCenter:, diff --git a/GNUmakefile b/GNUmakefile index cb2787ff..adbb233e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -103,6 +103,7 @@ Gorm_RESOURCE_FILES = \ Images/iconTopLeft_nib.tiff \ Images/iconTopRight_nib.tiff \ Images/iconTop_nib.tiff \ + Resources/GormViewSizeInspector.gorm Gorm_HEADERS = \ Gorm.h \ diff --git a/GormDocument.m b/GormDocument.m index db94b997..4fbb2b3d 100644 --- a/GormDocument.m +++ b/GormDocument.m @@ -1343,6 +1343,7 @@ static NSImage *classesImage = nil; [u decodeClassName: @"NSWindow" asClassName: @"GormNSWindow"]; [u decodeClassName: @"NSBrowser" asClassName: @"GormNSBrowser"]; [u decodeClassName: @"NSTableView" asClassName: @"GormNSTableView"]; + [u decodeClassName: @"NSOutlineView" asClassName: @"GormNSOutlineView"]; c = [u decodeObject]; if (c == nil || [c isKindOfClass: [GSNibContainer class]] == NO) @@ -1882,14 +1883,16 @@ static NSImage *classesImage = nil; archiverData = [NSMutableData dataWithCapacity: 0]; archiver = [[NSArchiver alloc] initForWritingWithMutableData: archiverData]; [archiver encodeClassName: @"GormObjectProxy" intoClassName: @"GSNibItem"]; - [archiver encodeClassName: @"GormCustomView" + [archiver encodeClassName: @"GormCustomView" intoClassName: @"GSCustomView"]; - [archiver encodeClassName: @"GormNSWindow" + [archiver encodeClassName: @"GormNSWindow" intoClassName: @"NSWindow"]; - [archiver encodeClassName: @"GormNSBrowser" + [archiver encodeClassName: @"GormNSBrowser" intoClassName: @"NSBrowser"]; - [archiver encodeClassName: @"GormNSTableView" + [archiver encodeClassName: @"GormNSTableView" intoClassName: @"NSTableView"]; + [archiver encodeClassName: @"GormNSOutlineView" + intoClassName: @"NSOutlineView"]; [archiver encodeRootObject: self]; archiveResult = [archiverData writeToFile: documentPath atomically: YES]; //archiveResult = [NSArchiver archiveRootObject: self toFile: documentPath]; @@ -2150,7 +2153,6 @@ numberOfChildrenOfItem: (id)item child: (int)index ofItem: (id)item { - NSLog(@"child:ofItem"); if(item == nil && index == 0) { return @"NSObject"; diff --git a/GormObjectEditor.m b/GormObjectEditor.m index 5c9f91e9..49b82c50 100644 --- a/GormObjectEditor.m +++ b/GormObjectEditor.m @@ -740,36 +740,18 @@ NSImage *mVLine = nil; self = [super init]; if (self != nil) { - NSView *contents; - NSButton *button; - NSBox *box, *sizeBox; - NSRect rect; + if ([NSBundle loadNibNamed: @"GormViewSizeInspector" owner: self] == NO) + { + NSLog(@"Could not open gorm GormViewSizeInspector"); + return nil; + } - rect = NSMakeRect(0, 0, IVW, IVH); - window = [[NSWindow alloc] initWithContentRect: rect - styleMask: NSBorderlessWindowMask - backing: NSBackingStoreRetained - defer: NO]; - contents = [window contentView]; - - rect = NSMakeRect((IVW-200)/2, IVW, 200, 80); - sizeBox = [[NSBox alloc] initWithFrame: NSZeroRect]; - [sizeBox setBorderType: NSBezelBorder]; - [sizeBox setTitle: @"Size"]; - [sizeBox setTitlePosition: NSAtTop]; - [sizeBox setFrameFromContentFrame: rect]; - [contents addSubview: sizeBox]; - RELEASE(sizeBox); - - rect = NSMakeRect(25, 5, 150, 75); - sizeForm = [[NSForm alloc] initWithFrame: rect]; - [sizeForm addEntry: @"X"]; - [sizeForm addEntry: @"Y"]; - [sizeForm addEntry: @"Width"]; - [sizeForm addEntry: @"Height"]; - [sizeForm setEntryWidth: 150]; - [sizeForm setInterlineSpacing: 3]; - [sizeBox addSubview: sizeForm]; + [top setTag: NSViewMaxYMargin]; + [bottom setTag: NSViewMinYMargin]; + [right setTag: NSViewMaxXMargin]; + [left setTag: NSViewMinXMargin]; + [width setTag: NSViewWidthSizable]; + [height setTag: NSViewHeightSizable]; [[NSNotificationCenter defaultCenter] addObserver: self @@ -782,98 +764,6 @@ NSImage *mVLine = nil; name: NSControlTextDidEndEditingNotification object: nil]; - rect = NSMakeRect((IVW-200)/2, (IVW-200)/2, 200, 200); - box = [[NSBox alloc] initWithFrame: NSZeroRect]; - [box setBorderType: NSBezelBorder]; - [box setTitle: @"Autosizing"]; - [box setTitlePosition: NSAtTop]; - [box setFrameFromContentFrame: rect]; - [contents addSubview: box]; - RELEASE(box); - - rect = NSMakeRect(50, 50, 100, 100); - button = [[NSButton alloc] initWithFrame: rect]; - [button setTitle: @""]; - [button setEnabled: NO]; - [box addSubview: button]; - - rect = NSMakeRect(91,151,20,50); - top = [[NSButton alloc] initWithFrame: rect]; - [top setImagePosition: NSImageOnly]; - [top setImage: eVLine]; - [top setAlternateImage: eVCoil]; - [top setBordered: NO]; - [top setButtonType: NSToggleButton]; - [top setTag: NSViewMaxYMargin]; - [top setTarget: self]; - [top setAction: @selector(setAutosize:)]; - [box addSubview: top]; - RELEASE(top); - - rect = NSMakeRect(91,0,20,50); - bottom = [[NSButton alloc] initWithFrame: rect]; - [bottom setImagePosition: NSImageOnly]; - [bottom setImage: eVLine]; - [bottom setAlternateImage: eVCoil]; - [bottom setBordered: NO]; - [bottom setButtonType: NSToggleButton]; - [bottom setTag: NSViewMinYMargin]; - [bottom setTarget: self]; - [bottom setAction: @selector(setAutosize:)]; - [box addSubview: bottom]; - RELEASE(bottom); - - rect = NSMakeRect(0,91,50,20); - left = [[NSButton alloc] initWithFrame: rect]; - [left setImagePosition: NSImageOnly]; - [left setImage: eHLine]; - [left setAlternateImage: eHCoil]; - [left setBordered: NO]; - [left setButtonType: NSToggleButton]; - [left setTag: NSViewMinXMargin]; - [left setTarget: self]; - [left setAction: @selector(setAutosize:)]; - [box addSubview: left]; - RELEASE(left); - - rect = NSMakeRect(151,91,50,20); - right = [[NSButton alloc] initWithFrame: rect]; - [right setImagePosition: NSImageOnly]; - [right setImage: eHLine]; - [right setAlternateImage: eHCoil]; - [right setBordered: NO]; - [right setButtonType: NSToggleButton]; - [right setTag: NSViewMaxXMargin]; - [right setTarget: self]; - [right setAction: @selector(setAutosize:)]; - [box addSubview: right]; - RELEASE(right); - - rect = NSMakeRect(51,92,97,19); - width = [[NSButton alloc] initWithFrame: rect]; - [width setImagePosition: NSImageOnly]; - [width setImage: mHLine]; - [width setAlternateImage: mHCoil]; - [width setBordered: NO]; - [width setButtonType: NSToggleButton]; - [width setTag: NSViewWidthSizable]; - [width setTarget: self]; - [width setAction: @selector(setAutosize:)]; - [box addSubview: width]; - RELEASE(width); - - rect = NSMakeRect(91,52,19,96); - height = [[NSButton alloc] initWithFrame: rect]; - [height setImagePosition: NSImageOnly]; - [height setImage: mVLine]; - [height setAlternateImage: mVCoil]; - [height setBordered: NO]; - [height setButtonType: NSToggleButton]; - [height setTag: NSViewHeightSizable]; - [height setTarget: self]; - [height setAction: @selector(setAutosize:)]; - [box addSubview: height]; - RELEASE(height); } return self; } diff --git a/GormTableViewEditor.m b/GormTableViewEditor.m index c83118e8..e2096979 100644 --- a/GormTableViewEditor.m +++ b/GormTableViewEditor.m @@ -306,7 +306,6 @@ static NSColor *_oldColor; [[[tableView enclosingScrollView] superview] convertPoint: [theEvent locationInWindow] fromView: nil]]; - NSLog(@"mouseDown %@", hitView); if (hitView == [tableView headerView]) { @@ -343,6 +342,23 @@ static NSColor *_oldColor; NSLog(@"no selection"); } } + + +- (void) outlineViewSelectionDidChange: (id) tv +{ + if ([tableView selectedColumn] != -1) + { + selected = [[tableView tableColumns] + objectAtIndex: [tableView selectedColumn]]; + [self selectObjects: + [NSArray arrayWithObject: selected]]; + } + else + { + NSLog(@"no selection"); + } +} + - (void) editHeader: (NSTableHeaderView*) th withEvent: (NSEvent *) theEvent { diff --git a/GormWindowEditor.m b/GormWindowEditor.m index 9ae55b25..0522d362 100644 --- a/GormWindowEditor.m +++ b/GormWindowEditor.m @@ -24,6 +24,8 @@ #include "GormPrivate.h" +#include + static NSRect NSRectFromPoints(NSPoint p0, NSPoint p1) { @@ -590,10 +592,12 @@ static BOOL done_editing; else { /* Increase the cell size */ - cellSize = NSMakeSize((NSWidth(frame)+intercellSpace.width)/cols - - intercellSpace.width, - (NSHeight(frame)+intercellSpace.height)/rows - - intercellSpace.height); + cellSize = NSMakeSize + (floor((NSWidth(frame)+intercellSpace.width)/cols - + intercellSpace.width), + floor((NSHeight(frame)+intercellSpace.height)/rows - + intercellSpace.height)); + /* Check if it is already too small and we're just making it bigger */ if (NSWidth(frame) < NSWidth(oldFrame) && NSHeight(frame) < NSHeight(oldFrame)) @@ -604,6 +608,7 @@ static BOOL done_editing; if (cellSize.height < minSize.height) return NO; } + if (update) [view setCellSize: cellSize]; } @@ -1686,9 +1691,14 @@ static BOOL done_editing; while ((sub = [enumerator nextObject]) != nil) { NSRect rect = [sub frame]; - + rect.origin = loc; [sub setFrame: rect]; + rect.origin.x = (int) rect.origin.x; + rect.origin.y = (int) rect.origin.y; + rect.size.width = (int) rect.size.width; + rect.size.height = (int) rect.size.height; + [edit_view addSubview: sub]; } [self selectObjects: views]; diff --git a/Palettes/2Controls/GormBoxInspector.gorm b/Palettes/2Controls/GormBoxInspector.gorm index 05540c695d430bf4551ac499191774fa76b052d6..438cf20e893f6c0e5a8f92abe2b39e811bf1b519 100644 GIT binary patch delta 159 zcmaD5^dM-02(yK8@125ul`5aV__2V^>405Zk6fdUL*0!f&O0SFm4H!;dE zvYh}c-MoZp4)f$+0=$#uMY$%2vz0UQPCm~T&-h_-f`Ay~hs|#6Zy1@F7$$EQh~GS! gv!9j8i3KPl3Zyn$^Ov$QHcs9snv5ia75FaZ~y?9AQA29yM<*nFKk zo>>B<2UXz>psZ8FWpJ6n5G)d4s$dv`wtEEgZBBjVAZANK9VF63^JN znT=JDO{0K;f!l$BfkBMhX,mT*0;|2;afC;$pWP9#DwzHw3Koy%WbH_6?W=wu3 zAjX)n*^57yk&$8Y4gnKM#|s#mZ-C6au$fh`mQCUjhU_Pxtka{-v&54bnH(=n{x2a4 zq&AC5iZU{WZPt-Gz{IA~z`*SsvH6qCN+t~tplav*2B1@&8-T)2%h1h(3U59v&&S9( KW%DJ4DeM5$IX}7p diff --git a/Palettes/2Controls/GormFormInspector.gorm b/Palettes/2Controls/GormFormInspector.gorm index ceecb0503cbe35272c7e9a2292c836d55ed1fca3..e9ac1cfdfaed13699734e05c5b8d483b8f77f9f3 100644 GIT binary patch delta 265 zcmaE5{oHzj2(yK8@w-XUEs z)G!0h-5kMtoRv)hsK6;;vZ`>rL$~C{5JXk delta 254 zcmaEE{mOcR2(!7N(MEB1M%j4`4BUtIpPgWKE&n5@50pz53xN|m(nXm%@9x69+ diff --git a/Palettes/2Controls/GormSliderInspector.gorm b/Palettes/2Controls/GormSliderInspector.gorm index 6e70a9625ecffea12a625f2e681f563f05bc22f2..b4d34a3245ae8ec036efa9e2d1ee317cde7f244e 100644 GIT binary patch delta 131 zcmexl_}*}W2(yK8@<#DhEWDig*;ZwSMh*s6CJq*xFS5L2V>Fq3fLn~wWb<`yXGRSH z1_o{hAQ0nr`UPY~Il!tKncp#T?l`UMiMKvxYF-fYjy$H+W2G<0(SUn!eJ4Z1Rjp*5TDiU_d) E0Q{{Q^8f$< diff --git a/Palettes/2Controls/GormTextFieldInspector.gorm b/Palettes/2Controls/GormTextFieldInspector.gorm index 4fcf5e5a1f1786ef7e2375dea92111fcd84de3b2..f16ef1262a4782d25fa17cfe18e90cf2ad74309d 100644 GIT binary patch delta 321 zcmX@)z2AF+2(yK8@3%ylcU&d zCWrGFY(B;|jg`qsV6vlt7^A@EQl8Vyj4@zN%;pGzcgzxuV4E-uUtjS+>%c77#O%64=^x@iE%Rk0hkcucA7VNo}~EZNsK~_ zY-dA5fhsnyVsc^@;K|RnDl>44rU5aG!) h6wH~NUQBM3272Sg<`)V!jBLF?4K5a&wUnkZ0{|)2NeBP{ diff --git a/Palettes/3Containers/GNUmakefile b/Palettes/3Containers/GNUmakefile index 377c7b9d..cc90ef74 100644 --- a/Palettes/3Containers/GNUmakefile +++ b/Palettes/3Containers/GNUmakefile @@ -26,8 +26,10 @@ include $(GNUSTEP_MAKEFILES)/common.make PALETTE_NAME = 3Containers 3Containers_PALETTE_ICON = ContainersPalette 3Containers_OBJC_FILES = main.m inspectors.m GormNSBrowser.m \ - GormNSTableView.m -3Containers_HEADER_FILES = GormNSBrowser.h GormNSTableView.h + GormNSTableView.m \ + GormNSOutlineView.m +3Containers_HEADER_FILES = GormNSBrowser.h GormNSTableView.h \ + GormNSOutlineView.h 3Containers_PRINCIPAL_CLASS = ContainersPalette 3Containers_RESOURCE_FILES = ContainersPalette.tiff \ GormBrowserInspector.gorm \ diff --git a/Palettes/3Containers/GormNSOutlineView.h b/Palettes/3Containers/GormNSOutlineView.h new file mode 100644 index 00000000..92868247 --- /dev/null +++ b/Palettes/3Containers/GormNSOutlineView.h @@ -0,0 +1,37 @@ +/* GormNSOutlineView.h + + Copyright (C) 2002 Free Software Foundation, Inc. + + Author: Pierre-Yves Rivaille + Date: 2002 + + This file is part of GNUstep. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + 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 + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#import + +@interface GormNSOutlineView : NSOutlineView +{ + id _gormDataSource; + id _gormDelegate; + BOOL _gormAllowsColumnReordering; + BOOL _gormAllowsColumnResizing; + BOOL _gormAllowsColumnSelection; + BOOL _gormAllowsMultipleSelection; + BOOL _gormAllowsEmptySelection; +} +@end diff --git a/Palettes/3Containers/GormNSOutlineView.m b/Palettes/3Containers/GormNSOutlineView.m new file mode 100644 index 00000000..85ccae79 --- /dev/null +++ b/Palettes/3Containers/GormNSOutlineView.m @@ -0,0 +1,389 @@ +/* GormNSOutlineView.m + + Copyright (C) 2002 Free Software Foundation, Inc. + + Author: Pierre-Yves Rivaille + Date: 2002 + + This file is part of GNUstep. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + 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 + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#import "GormNSOutlineView.h" + +/* --------------------------------------------------------------- + * NSTableView dataSource +*/ +@interface NSOutlineViewDataSource: NSObject +{ +} +- (id)outlineView: (NSOutlineView *)outlineView + child: (int)index + ofItem: (id)item; + +- (BOOL)outlineView: (NSOutlineView *)outlineView + isItemExpandable: (id)item; + +- (int) outlineView: (NSOutlineView *)outlineView + numberOfChildrenOfItem: (id)item; + +- (id) outlineView: (NSOutlineView *)outlineView + objectValueForTableColumn: (NSTableColumn *)tableColumn + byItem: (id)item; +@end + + +@implementation NSOutlineViewDataSource +// required methods for data source +- (id)outlineView: (NSOutlineView *)outlineView + child: (int)index + ofItem: (id)item +{ + if([item isEqual: @"NSObject"]) + { + switch(index) + { + case 0: + return @"NSApplication"; + break; + case 1: + return @"NSPanel"; + break; + case 2: + return @"NSWindow"; + break; + case 3: + return @"NSOutlineView"; + break; + default: + break; + } + } + if([item isEqual: @"NSPanel"]) + { + switch(index) + { + case 0: + return @"class1"; + break; + case 1: + return @"class2"; + break; + case 2: + return @"class3"; + break; + case 3: + return @"class4"; + break; + default: + break; + } + } + else + if(item == nil) + { + if(index == 0) + return @"NSObject"; + } + + return nil; +} + +- (BOOL)outlineView: (NSOutlineView *)outlineView + isItemExpandable: (id)item +{ + if([item isEqual: @"NSObject"]) + return YES; + if([item isEqual: @"NSPanel"]) + return YES; + + return NO; +} + +- (int) outlineView: (NSOutlineView *)outlineView + numberOfChildrenOfItem: (id)item +{ + if(item == nil) + return 1; + else + if([item isEqual: @"NSObject"]) + return 4; + else + if([item isEqual: @"NSPanel"]) + return 4; + + return 0; +} + +- (id) outlineView: (NSOutlineView *)outlineView + objectValueForTableColumn: (NSTableColumn *)tableColumn + byItem: (id)item +{ + NSString *value = nil; + if([item isEqual: @"NSObject"]) + { + if([[tableColumn identifier] isEqual: @"classes"]) + { + value = @"NSObject"; + } + else + if([[tableColumn identifier] isEqual: @"outlets"]) + { + value = @"1"; + } + else + if([[tableColumn identifier] isEqual: @"actions"]) + { + value = @"2"; + } + } + if([item isEqual: @"NSApplication"]) + { + if([[tableColumn identifier] isEqual: @"classes"]) + { + value = @"NSApplication"; + } + else + if([[tableColumn identifier] isEqual: @"outlets"]) + { + value = @"2"; + } + else + if([[tableColumn identifier] isEqual: @"actions"]) + { + 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; +} + +@end + +static id _sharedDataSource = nil; + +@implementation GormNSOutlineView ++ (id) sharedDataSource +{ + if (_sharedDataSource == nil) + { + _sharedDataSource = [[NSOutlineViewDataSource alloc] init]; + } + return _sharedDataSource; +} + +- (id) initWithFrame: (NSRect) aRect +{ + self = [super initWithFrame: aRect]; + [super setDataSource: [GormNSOutlineView sharedDataSource]]; + _gormDataSource = nil; + return self; +} + +- (void)setDataSource: (id)anObject +{ + _gormDataSource = anObject; +} + +- (id)dataSource +{ + return _gormDataSource; +} + +- (void)setDelegate: (id)anObject +{ + _gormDelegate = anObject; +} + +- (id)delegate +{ + return _gormDelegate; +} + +- (id)setGormDelegate: (id)anObject +{ + [super setDelegate: anObject]; +} + +- (void)encodeWithCoder: (NSCoder*) aCoder +{ + id oldDelegate; + int oldNumberOfRows; + _allowsColumnReordering = _gormAllowsColumnReordering; + _allowsColumnResizing = _gormAllowsColumnResizing; + _allowsColumnSelection = _gormAllowsColumnSelection; + _allowsMultipleSelection = _gormAllowsMultipleSelection; + _allowsEmptySelection = _gormAllowsEmptySelection; + + _dataSource = _gormDataSource; + oldDelegate = _delegate; + _delegate = _gormDelegate; + oldNumberOfRows = _numberOfRows; + _numberOfRows = 0; + [super encodeWithCoder: aCoder]; + _numberOfRows = oldNumberOfRows; + _allowsColumnReordering = YES; + _allowsColumnResizing = YES; + _allowsColumnSelection = YES; + _allowsMultipleSelection = NO; + _allowsEmptySelection = YES; + + _delegate = oldDelegate; + _dataSource = _sharedDataSource; +} + +- (id) initWithCoder: (NSCoder*) aCoder +{ + self = [super initWithCoder: aCoder]; + [super setDataSource: [GormNSOutlineView sharedDataSource]]; + + _gormAllowsColumnReordering = _allowsColumnReordering; + _gormAllowsColumnResizing = _allowsColumnResizing; + _gormAllowsColumnSelection = _allowsColumnSelection; + _gormAllowsMultipleSelection = _allowsMultipleSelection; + _gormAllowsEmptySelection = _allowsEmptySelection; + _gormDelegate = _delegate; + _delegate = nil; + + return self; +} + + +- (void) setGormAllowsColumnReordering: (BOOL)flag +{ + _gormAllowsColumnReordering = flag; +} + +- (BOOL) gormAllowsColumnReordering +{ + return _gormAllowsColumnReordering; +} + +- (void) setGormAllowsColumnResizing: (BOOL)flag +{ + _gormAllowsColumnResizing = flag; +} + +- (BOOL) gormAllowsColumnResizing +{ + return _gormAllowsColumnResizing; +} + +- (void) setGormAllowsMultipleSelection: (BOOL)flag +{ + _gormAllowsMultipleSelection = flag; +} + +- (BOOL) gormAllowsMultipleSelection +{ + return _gormAllowsMultipleSelection; +} + +- (void) setGormAllowsEmptySelection: (BOOL)flag +{ + _gormAllowsEmptySelection = flag; +} + +- (BOOL) gormAllowsEmptySelection +{ + return _gormAllowsEmptySelection; +} + +- (void) setGormAllowsColumnSelection: (BOOL)flag +{ + _gormAllowsColumnSelection = flag; +} + +- (BOOL) gormAllowsColumnSelection +{ + return _gormAllowsColumnSelection; +} + + + +@end diff --git a/Palettes/3Containers/inspectors.m b/Palettes/3Containers/inspectors.m index e8a9823d..267bc763 100644 --- a/Palettes/3Containers/inspectors.m +++ b/Palettes/3Containers/inspectors.m @@ -337,7 +337,6 @@ - (void) ok: (id)sender { - NSLog(@"ok"); [self _setValuesFromControl: sender]; } diff --git a/Palettes/3Containers/main.m b/Palettes/3Containers/main.m index 651fe846..1bee5600 100644 --- a/Palettes/3Containers/main.m +++ b/Palettes/3Containers/main.m @@ -26,6 +26,7 @@ #include "../../Gorm.h" #include "GormNSBrowser.h" #include "GormNSTableView.h" +#include "GormNSOutlineView.h" #include @@ -44,9 +45,10 @@ { NSView *contents; - NSTableView *tv; - NSTableColumn *tc; - NSSize contentSize; + NSTableView *tv; + NSOutlineView *ov; + NSTableColumn *tc; + NSSize contentSize; id v; window = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, 272, 192) @@ -86,7 +88,8 @@ // NSTableView - v = [[NSScrollView alloc] initWithFrame: NSMakeRect(136, 38, 124, 116)]; + v = [[NSScrollView alloc] initWithFrame: + NSMakeRect(136, 10, 124, 78)]; [v setHasVerticalScroller: YES]; [v setHasHorizontalScroller: NO]; @@ -94,7 +97,7 @@ contentSize = [v contentSize]; tv = [[GormNSTableView alloc] initWithFrame: - NSMakeRect(0,0,contentSize.width, contentSize.height)]; + NSZeroRect]; // [tv setDataSource: [[NSTableViewDataSource alloc] init]]; // [tv setAutoresizesAllColumnsToFit: YES]; [v setDocumentView: tv]; @@ -124,6 +127,49 @@ RELEASE(tv); RELEASE(v); + // NSOutlineView + v = [[NSScrollView alloc] initWithFrame: + NSMakeRect(136, 98, 124, 78)]; + + [v setHasVerticalScroller: YES]; + [v setHasHorizontalScroller: NO]; + //[v setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable]; + contentSize = [v contentSize]; + + ov = [[GormNSOutlineView alloc] initWithFrame: + NSMakeRect(0,0,contentSize.width, contentSize.height)]; + // [tv setAutoresizesAllColumnsToFit: YES]; + [v setDocumentView: ov]; + RELEASE(tv); + + tc = [[NSTableColumn alloc] initWithIdentifier: @"classes"]; + [[tc headerCell] setStringValue: @" "]; + [tc setWidth: floor(contentSize.width/2)]; + [tc setMinWidth: 20]; + [tc setResizable: YES]; + [tc setEditable: YES]; + [ov addTableColumn: tc]; + [ov setOutlineTableColumn: tc]; + RELEASE(tc); + + tc = [[NSTableColumn alloc] initWithIdentifier: @"outlets"]; + [[tc headerCell] setStringValue: @" "]; + [tc setWidth: ceil(contentSize.width/2)]; + [tc setMinWidth: 20]; + [tc setResizable: YES]; + [tc setEditable: YES]; + [ov addTableColumn: tc]; + RELEASE(tc); + [ov setFrame: NSMakeRect(0,0,contentSize.width, contentSize.height)]; + [ov setDrawsGrid: NO]; + [ov setIndentationPerLevel: 10.]; + [ov setIndentationMarkerFollowsCell: YES]; + + [contents addSubview: v]; + RELEASE(ov); + RELEASE(v); + + } @end diff --git a/Resources/GormViewSizeInspector.classes b/Resources/GormViewSizeInspector.classes new file mode 100644 index 00000000..1cbe38a3 --- /dev/null +++ b/Resources/GormViewSizeInspector.classes @@ -0,0 +1,571 @@ +{ + FirstResponder = { + Actions = ( + activateContextHelpMode:, + alignCenter:, + alignJustified:, + alignLeft:, + alignRight:, + arrangeInFront:, + cancel:, + capitalizeWord:, + changeColor:, + changeFont:, + checkSpelling:, + close:, + complete:, + copy:, + copyFont:, + copyRuler:, + cut:, + delete:, + deleteBackward:, + deleteForward:, + deleteToBeginningOfLine:, + deleteToBeginningOfParagraph:, + deleteToEndOfLine:, + deleteToEndOfParagraph:, + deleteToMark:, + deleteWordBackward:, + deleteWordForward:, + deminiaturize:, + deselectAll:, + fax:, + hide:, + hideOtherApplications:, + indent:, + loosenKerning:, + lowerBaseline:, + lowercaseWord:, + makeKeyAndOrderFront:, + miniaturize:, + miniaturizeAll:, + moveBackward:, + moveBackwardAndModifySelection:, + moveDown:, + moveDownAndModifySelection:, + moveForward:, + moveForwardAndModifySelection:, + moveLeft:, + moveRight:, + moveToBeginningOfDocument:, + moveToBeginningOfLine:, + moveToBeginningOfParagraph:, + moveToEndOfDocument:, + moveToEndOfLine:, + moveToEndOfParagraph:, + moveUp:, + moveUpAndModifySelection:, + moveWordBackward:, + moveWordBackwardAndModifySelection:, + moveWordForward:, + moveWordForwardAndModifySelection:, + ok:, + open:, + orderBack:, + orderFront:, + orderFrontColorPanel:, + orderFrontDataLinkPanel:, + orderFrontHelpPanel:, + orderFrontStandardAboutPanel:, + orderFrontStandardInfoPanel:, + orderOut:, + pageDown:, + pageUp:, + paste:, + pasteAsPlainText:, + pasteAsRichText:, + pasteFont:, + pasteRuler:, + performClose:, + performMiniaturize:, + performZoom:, + print:, + raiseBaseline:, + runPageLayout:, + runToolbarCustomizationPalette:, + scrollLineDown:, + scrollLineUp:, + scrollPageDown:, + scrollPageUp:, + scrollViaScroller:, + selectAll:, + selectLine:, + selectNextKeyView:, + selectParagraph:, + selectPreviousKeyView:, + selectText:, + selectText:, + selectToMark:, + selectWord:, + showContextHelp:, + showGuessPanel:, + showHelp:, + showWindow:, + stop:, + subscript:, + superscript:, + swapWithMark:, + takeDoubleValueFrom:, + takeFloatValueFrom:, + takeIntValueFrom:, + takeObjectValueFrom:, + takeStringValueFrom:, + terminate:, + tightenKerning:, + toggle:, + toggleContinuousSpellChecking:, + toggleRuler:, + toggleToolbarShown:, + toggleTraditionalCharacterShape:, + transpose:, + transposeWords:, + turnOffKerning:, + turnOffLigatures:, + underline:, + unhide:, + unhideAllApplications:, + unscript:, + uppercaseWord:, + useAllLigatures:, + useStandardKerning:, + useStandardLigatures:, + yank:, + zoom: + ); + Super = NSObject; + }; + GormViewSizeInpector = { + Actions = ( + setAutosize: + ); + Outlets = ( + bottom, + height, + left, + right, + sizeForm, + top, + width + ); + Super = IBInspector; + }; + IBInspector = { + Actions = ( + ok:, + revert:, + touch: + ); + Outlets = ( + window + ); + Super = NSObject; + }; + IBPalette = { + Actions = ( + ); + Outlets = ( + originalWindow + ); + Super = NSObject; + }; + NSActionCell = { + Super = NSCell; + }; + NSApplication = { + Actions = ( + arrangeInFront:, + hide:, + hideOtherApplications:, + miniaturizeAll:, + orderFrontColorPanel:, + orderFrontDataLinkPanel:, + orderFrontHelpPanel:, + orderFrontStandardAboutPanel:, + orderFrontStandardInfoPanel:, + runPageLayout:, + stop:, + terminate:, + unhide:, + unhideAllApplications: + ); + Outlets = ( + delegate + ); + Super = NSResponder; + }; + NSArray = { + Super = NSObject; + }; + NSBrowser = { + Actions = ( + doClick:, + doDoubleClick:, + selectAll: + ); + Outlets = ( + delegate + ); + Super = NSControl; + }; + NSBrowserCell = { + Super = NSCell; + }; + NSButton = { + Actions = ( + performClick: + ); + Super = NSControl; + }; + NSButtonCell = { + Actions = ( + performClick: + ); + Super = NSActionCell; + }; + NSCStringText = { + Actions = ( + clear:, + selectText: + ); + Super = NSText; + }; + NSCell = { + Actions = ( + takeDoubleValueFrom:, + takeFloatValueFrom:, + takeIntValueFrom:, + takeStringValueFrom: + ); + Super = NSObject; + }; + NSColorWell = { + Actions = ( + takeColorFrom: + ); + Super = NSControl; + }; + NSComboBox = { + Outlets = ( + dataSource + ); + Super = NSTextField; + }; + NSControl = { + Actions = ( + takeDoubleValueFrom:, + takeFloatValueFrom:, + takeIntValueFrom:, + takeObjectValueFrom:, + takeStringValueFrom: + ); + Outlets = ( + target + ); + Super = NSView; + }; + NSCursor = { + Super = NSObject; + }; + NSDateFormatter = { + Super = NSFormatter; + }; + NSDictionary = { + Super = NSObject; + }; + NSDocument = { + Actions = ( + printDocument:, + revertDocumentToSaved:, + runPageLayout:, + saveDocument:, + saveDocumentAs:, + saveDocumentTo: + ); + Super = NSObject; + }; + NSDocumentController = { + Actions = ( + clearRecentDocuments:, + newDocument:, + openDocument:, + saveAllDocuments: + ); + Super = NSObject; + }; + NSDrawer = { + Actions = ( + close:, + open:, + toggle: + ); + Outlets = ( + delegate + ); + Super = NSResponder; + }; + NSFontManager = { + Actions = ( + addFontTrait:, + modifyFont:, + modifyFontViaPanel:, + orderFrontFontPanel:, + removeFontTrait: + ); + Outlets = ( + menu + ); + Super = NSResponder; + }; + NSForm = { + Super = NSMatrix; + }; + NSFormCell = { + Super = NSActionCell; + }; + NSFormatter = { + Super = NSObject; + }; + NSHelpManager = { + Actions = ( + activateContextHelpMode:, + showHelp: + ); + Super = NSResponder; + }; + NSImage = { + Super = NSObject; + }; + NSImageView = { + Super = NScontrol; + }; + NSMatrix = { + Actions = ( + selectAll:, + selectText: + ); + Outlets = ( + delegate + ); + Super = NSControl; + }; + NSMenu = { + Super = NSObject; + }; + NSMenuItem = { + Outlets = ( + target + ); + Super = NSObject; + }; + NSMutableArray = { + Super = NSArray; + }; + NSMutableDictionary = { + Super = NSDictionary; + }; + NSNumberFormatter = { + Super = NSFormatter; + }; + NSOutlineView = { + Super = NSTableView; + }; + NSPanel = { + Super = NSWindow; + }; + NSPopUpButton = { + Super = NSButton; + }; + NSProgressIndicator = { + Actions = ( + animate:, + startAnimation:, + stopAnimation: + ); + Super = NSObject; + }; + NSResponder = { + Outlets = ( + menu + ); + Super = NSObject; + }; + NSRulerView = { + Super = NSView; + }; + NSScrollView = { + Super = NSView; + }; + NSScroller = { + Super = NSControl; + }; + NSSecureTextField = { + Super = NSTextField; + }; + NSSecureTextFieldCell = { + Super = NSTextFieldCell; + }; + NSSlider = { + Super = NSControl; + }; + NSSliderCell = { + Super = NSActionCell; + }; + NSSplitView = { + Super = NSView; + }; + NSTabView = { + Actions = ( + selectFirstTabViewItem:, + selectLastTabViewItem:, + selectNextTabViewItem:, + selectPreviousTabViewItem:, + takeSelectedTabViewItemFromSender: + ); + Outlets = ( + delegate + ); + Super = NSView; + }; + NSTableColumn = { + Super = NSObject; + }; + NSTableHeaderCell = { + Super = NSTextFieldCell; + }; + NSTableHeaderView = { + Super = NSView; + }; + NSTableView = { + Actions = ( + deselectAll:, + selectAll: + ); + Outlets = ( + dataSource, + delegate + ); + Super = NSControl; + }; + NSText = { + Actions = ( + alignCenter:, + alignLeft:, + alignRight:, + changeFont:, + changeSpelling:, + checkSpelling:, + copy:, + copyFont:, + copyRuler:, + cut:, + delete:, + ignoreSpelling:, + paste:, + pasteFont:, + pasteRuler:, + selectAll:, + showGuessPanel:, + subscript:, + superscript:, + toggleRuler:, + underline:, + unscript: + ); + Outlets = ( + delegate + ); + Super = NSView; + }; + NSTextField = { + Actions = ( + selectText: + ); + Outlets = ( + delegate + ); + Super = NSControl; + }; + NSTextFieldCell = { + Super = NSActionCell; + }; + NSTextView = { + Actions = ( + alignJustified:, + changeColor:, + deleteBackwards:, + insertBacktab:, + insertNewLine:, + insertParagraphSeparator:, + insertTab:, + loosenKerning:, + lowerBaseline:, + moveBackward:, + moveDown:, + moveForward:, + moveLeft:, + moveRight:, + moveUp:, + pasteAsPlainText:, + pasteAsRichText:, + raiseBaseline:, + tightenKerning:, + toggleContinuousSpellChecking:, + toggleTraditionalCharacterShape:, + turnOffKerning:, + turnOffLigatures:, + useAllLigatures:, + useDefaultBaseline:, + useDefaultKerning:, + useDefaultLigatures:, + useStandardBaseline:, + useStandardKerning:, + useStandardLigatures: + ); + Super = NSText; + }; + NSView = { + Actions = ( + fax:, + print: + ); + Outlets = ( + nextKeyView + ); + Super = NSResponder; + }; + NSWindow = { + Actions = ( + deminiaturize:, + fax:, + makeKeyAndOrderFront:, + miniaturize:, + orderBack:, + orderFront:, + orderOut:, + performClose:, + performMiniaturize:, + performZoom:, + print:, + runToolbarCustomizationPalette:, + selectNextKeyView:, + selectPreviousKeyView:, + toggleToolbarShown:, + zoom: + ); + Outlets = ( + delegate, + initialFirstResponder + ); + Super = NSResponder; + }; + NSWindowController = { + Actions = ( + showWindow: + ); + Outlets = ( + document + ); + Super = NSResponder; + }; +} \ No newline at end of file