From a6d96cd14a69f3d0b752db5a9722ca7885874360 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sat, 7 Dec 2024 13:14:53 -0500 Subject: [PATCH 01/14] Add new class for outline, update existing classes --- GormCore/GormDocument.m | 48 ++- GormCore/GormGenericEditor.h | 2 +- GormCore/GormObjectEditor.h | 12 + GormCore/GormObjectEditor.m | 6 +- GormCore/GormObjectOutline.h | 43 +++ GormCore/GormObjectOutline.m | 587 +++++++++++++++++++++++++++++++++++ 6 files changed, 691 insertions(+), 7 deletions(-) create mode 100644 GormCore/GormObjectOutline.h create mode 100644 GormCore/GormObjectOutline.m diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index c1dc81a3..36b1b22c 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -3914,26 +3914,70 @@ willBeInsertedIntoToolbar: (BOOL)flag child: (NSInteger)index ofItem: (id)item { + if (item == nil) + { + return [[topLevelObjects allObjects] objectAtIndex: index]; + } + else if ([item isKindOfClass: [NSWindow class]]) + { + return [item contentView]; + } + else if ([item isKindOfClass: [NSView class]]) + { + return [[item subviews] objectAtIndex: index]; + } + return nil; } - (BOOL) outlineView: (NSOutlineView *)ov isItemExpandable: (id)item { + if (item == nil) + { + return [topLevelObjects count] > 0; + } + else if ([item isKindOfClass: [NSWindow class]]) + { + return [item contentView] != nil; + } + else if ([item isKindOfClass: [NSView class]]) + { + return [[item subviews] count] > 0; + } + return NO; } - (NSInteger) outlineView: (NSOutlineView *)ov numberOfChildrenOfItem: (id)item { + if (item == nil) + { + return [topLevelObjects count]; + } + else if ([item isKindOfClass: [NSWindow class]]) + { + return 1; // [[[item contentView] subviews] count]; + } + else if ([item isKindOfClass: [NSView class]]) + { + return [[item subviews] count]; + } + return 0; } - (id) outlineView: (NSOutlineView *)ov objectValueForTableColumn: (NSTableColumn *)tableColumn - byItem: (id)tem + byItem: (id)item { - return nil; + if (item == nil) + { + return @"Objects"; + } + + return [self nameForObject: item]; } // Other methods... diff --git a/GormCore/GormGenericEditor.h b/GormCore/GormGenericEditor.h index 8e7a5bfa..4b3b9d45 100644 --- a/GormCore/GormGenericEditor.h +++ b/GormCore/GormGenericEditor.h @@ -31,7 +31,7 @@ #include -@interface GormGenericEditor : NSMatrix +@interface GormGenericEditor : NSMatrix { NSMutableArray *objects; id document; diff --git a/GormCore/GormObjectEditor.h b/GormCore/GormObjectEditor.h index 80358a94..ad48e080 100644 --- a/GormCore/GormObjectEditor.h +++ b/GormCore/GormObjectEditor.h @@ -28,6 +28,18 @@ #include "GormGenericEditor.h" +@interface NSObject (GormObjectAdditions) + +- (NSImage*) imageForViewer; +- (NSString*) inspectorClassName; +- (NSString*) connectInspectorClassName; +- (NSString*) sizeInspectorClassName; +- (NSString*) helpInspectorClassName; +- (NSString*) classInspectorClassName; +- (NSString*) editorClassName; + +@end + @interface GormObjectEditor : GormGenericEditor { } diff --git a/GormCore/GormObjectEditor.m b/GormCore/GormObjectEditor.m index 9e087fb2..e447b8c4 100644 --- a/GormCore/GormObjectEditor.m +++ b/GormCore/GormObjectEditor.m @@ -34,14 +34,11 @@ #import "GormClassManager.h" #import "GormAbstractDelegate.h" +@implementation NSObject (GormObjectAdditions) /* * Method to return the image that should be used to display objects within * the matrix containing the objects in a document. */ -@interface NSObject (GormObjectAdditions) -@end - -@implementation NSObject (GormObjectAdditions) - (NSImage*) imageForViewer { static NSImage *image = nil; @@ -86,6 +83,7 @@ { return @"GormObjectEditor"; } + @end @implementation NSView (GormObjectAdditions) diff --git a/GormCore/GormObjectOutline.h b/GormCore/GormObjectOutline.h new file mode 100644 index 00000000..b9e380fb --- /dev/null +++ b/GormCore/GormObjectOutline.h @@ -0,0 +1,43 @@ +/* GormObjectOutline.h + * + * Copyright (C) 2024 Free Software Foundation, Inc. + * + * Author: Gregory John Casamento + * Date: 2024 + * + * 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. + */ + +#ifndef INCLUDED_GormObjectEditor_h +#define INCLUDED_GormObjectEditor_h + +#include "GormObjectEditor.h" + +extern static NSMapTable *docMap; + +@interface GormObjectOutline : GormObjectEditor +{ +} ++ (void) setEditor: (id)editor forDocument: (id)aDocument; +- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f; +- (NSDragOperation) draggingSourceOperationMaskForLocal: (BOOL)flag; +- (BOOL) acceptsTypeFromArray: (NSArray*)types; +- (void) makeSelectionVisible: (BOOL)flag; +- (void) resetObject: (id)anObject; +@end + +#endif diff --git a/GormCore/GormObjectOutline.m b/GormCore/GormObjectOutline.m new file mode 100644 index 00000000..99fdbc31 --- /dev/null +++ b/GormCore/GormObjectOutline.m @@ -0,0 +1,587 @@ +/* GormObjectOutline.m + * + * Copyright (C) 2024 Free Software Foundation, Inc. + * + * Author: Gregory John Casamento + * Date: 2024 + * + * 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. + */ + +#import +#import + +#import "GormPrivate.h" +#import "GormObjectEditor.h" +#import "GormFunctions.h" +#import "GormDocument.h" +#import "GormClassManager.h" +#import "GormAbstractDelegate.h" + +/* + * Method to return the image that should be used to display objects within + * the matrix containing the objects in a document. + */ +@implementation NSObject (GormObjectAdditions) +- (NSImage*) imageForViewer +{ + static NSImage *image = nil; + GormAbstractDelegate *delegate = (GormAbstractDelegate *)[NSApp delegate]; + + if (image == nil && [delegate isInTool] == NO) + { + NSBundle *bundle = [NSBundle bundleForClass: [self class]]; + NSString *path = [bundle pathForImageResource: @"GormUnknown"]; + image = [[NSImage alloc] initWithContentsOfFile: path]; + } + + return image; +} + +- (NSString*) inspectorClassName +{ + return @"GormObjectInspector"; +} + +- (NSString*) connectInspectorClassName +{ + return @"GormConnectionInspector"; +} + +- (NSString*) sizeInspectorClassName +{ + return @"GormNotApplicableInspector"; +} + +- (NSString*) helpInspectorClassName +{ + return @"GormNotApplicableInspector"; +} + +- (NSString*) classInspectorClassName +{ + return @"GormCustomClassInspector"; +} + +- (NSString*) editorClassName +{ + return @"GormObjectEditor"; +} +@end + +@implementation NSView (GormObjectAdditions) +- (NSString*) helpInspectorClassName +{ + return @"GormHelpInspector"; +} +@end + +// Map top level document editors to their documents... +static NSMapTable *docMap = 0; + +@implementation GormObjectOutline + ++ (void) initialize +{ + if (self == [GormObjectEditor class]) + { + docMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks, + NSNonRetainedObjectMapValueCallBacks, + 2); + } +} + ++ (id) editorForDocument: (id)aDocument +{ + id editor = NSMapGet(docMap, (void*)aDocument); + + if (editor == nil) + { + editor = [[self alloc] initWithObject: nil inDocument: aDocument]; + AUTORELEASE(editor); + } + return editor; +} + ++ (void) setEditor: (id)editor + forDocument: (id)aDocument +{ + NSMapInsert(docMap, (void*)aDocument, (void*)editor); +} + + +- (BOOL) acceptsTypeFromArray: (NSArray*)types +{ + return ([[(GormDocument *)document allManagedPboardTypes] firstObjectCommonWithArray: types] != nil); +} + +- (void) pasteInSelection +{ + NSPasteboard *pb = [NSPasteboard generalPasteboard]; + NSString *type = [[(GormDocument *)document allManagedPboardTypes] firstObjectCommonWithArray: [pb types]]; + + if(type != nil) + { + // paste the object in. + [document pasteType: type + fromPasteboard: pb + parent: nil]; + } +} + +- (void) copySelection +{ + NSArray *sel = [self selection]; + if([sel count] > 0) + { + NSString *type = nil; + id obj = [sel objectAtIndex: 0]; + + if([obj isKindOfClass: [NSWindow class]]) + { + type = IBWindowPboardType; + } + else if([obj isKindOfClass: [NSView class]]) + { + type = IBViewPboardType; + } + else + { + type = IBObjectPboardType; + } + + [document copyObjects: sel + type: type + toPasteboard: [NSPasteboard generalPasteboard]]; + } +} + +- (void) deleteSelection +{ + if (selected != nil + && [[document nameForObject: selected] isEqualToString: @"NSOwner"] == NO + && [[document nameForObject: selected] isEqualToString: @"NSFirst"] == NO) + { + if ([selected isKindOfClass: [NSMenu class]] && + [[document nameForObject: selected] isEqual: @"NSMenu"] == YES) + { + NSString *title = _(@"Removing Main Menu"); + NSString *msg = _(@"Are you sure you want to do this?"); + NSInteger retval = NSRunAlertPanel(title, msg,_(@"OK"),_(@"Cancel"), nil, nil); + + // if the user *really* wants to delete the menu, do it. + if(retval != NSAlertDefaultReturn) + return; + } + + [document detachObject: selected]; + if ([selected isKindOfClass: [NSWindow class]] == YES) + { + NSArray *subviews = allSubviews([(NSWindow *)selected contentView]); + [document detachObjects: subviews]; + [selected close]; + } + + if ([selected isKindOfClass: [NSMenu class]] == YES) + { + NSArray *items = findAll( selected ); + NSEnumerator *en = [items objectEnumerator]; + id obj = nil; + + while((obj = [en nextObject]) != nil) + { + [document detachObject: obj]; + } + } + + [objects removeObjectIdenticalTo: selected]; + [self selectObjects: [NSArray array]]; + [self refreshCells]; + } +} + +/* + * Dragging source protocol implementation + */ +- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f +{ +} + +- (NSDragOperation) draggingEntered: (id)sender +{ + NSArray *pbTypes = nil; + + // Get the resource manager first, if nil don't bother calling the rest... + dragPb = [sender draggingPasteboard]; + pbTypes = [dragPb types]; + + if ([pbTypes containsObject: GormLinkPboardType] == YES) + { + dragType = GormLinkPboardType; + } + else + { + dragType = nil; + } + + return [self draggingUpdated: sender]; +} + +- (NSDragOperation) draggingUpdated: (id)sender +{ + if (dragType == GormLinkPboardType) + { + NSPoint loc = [sender draggingLocation]; + NSInteger r, c; + int pos; + id obj = nil; + id delegate = [NSApp delegate]; + + loc = [self convertPoint: loc fromView: nil]; + [self getRow: &r column: &c forPoint: loc]; + pos = r * [self numberOfColumns] + c; + if (pos >= 0 && pos < [objects count]) + { + obj = [objects objectAtIndex: pos]; + } + if (obj == [delegate connectSource]) + { + return NSDragOperationNone; /* Can't drag an object onto itsself */ + } + + [delegate displayConnectionBetween: [delegate connectSource] and: obj]; + if (obj != nil) + { + return NSDragOperationLink; + } + + return NSDragOperationNone; + } + + return NSDragOperationNone; +} + + +/** + * Used for autoscrolling when you connect IBActions. + * FIXME: Maybye there is a better way to do it. +*/ +- (void)draggingExited:(id < NSDraggingInfo >)sender +{ + if (dragType == GormLinkPboardType) + { + NSRect documentVisibleRect; + NSRect documentRect; + NSPoint loc = [sender draggingLocation]; + + loc = [self convertPoint:loc fromView:nil]; + documentVisibleRect = [(NSClipView *)[self superview] documentVisibleRect]; + documentRect = [(NSClipView *)[self superview] documentRect]; + + /* Down */ + if ( (loc.y >= documentVisibleRect.size.height) + && ( ! NSEqualRects(documentVisibleRect,documentRect) ) ) + { + loc.x = 0; + loc.y = documentRect.origin.y + [self cellSize].height; + [(NSClipView*) [self superview] scrollToPoint:loc]; + } + /* up */ + else if ( (loc.y + 10 >= documentVisibleRect.origin.y ) + && ( ! NSEqualRects(documentVisibleRect,documentRect) ) ) + { + loc.x = 0; + loc.y = documentRect.origin.y - [self cellSize].height; + [(NSClipView*) [self superview] scrollToPoint:loc]; + } + + } +} + +- (NSDragOperation) draggingSourceOperationMaskForLocal: (BOOL)flag +{ + return NSDragOperationLink; +} + +- (void) drawSelection +{ +} + +- (void) handleNotification: (NSNotification*)aNotification +{ + NSString *name = [aNotification name]; + + if([name isEqual: GormResizeCellNotification]) + { + NSDebugLog(@"Received notification"); + [self setCellSize: defaultCellSize()]; + } +} + +/* + * Initialisation - register to receive DnD with our own types. + */ +- (id) initWithObject: (id)anObject inDocument: (id)aDocument +{ + id old = NSMapGet(docMap, (void*)aDocument); + + if (old != nil) + { + RELEASE(self); + self = RETAIN(old); + [self addObject: anObject]; + return self; + } + + self = [super initWithObject: anObject inDocument: aDocument]; + if (self != nil) + { + NSButtonCell *proto; + NSColor *color = [NSColor colorWithCalibratedRed: 0.850980 + green: 0.737255 + blue: 0.576471 + alpha: 0.0 ]; + + document = aDocument; + + [self registerForDraggedTypes:[NSArray arrayWithObject:GormLinkPboardType]]; + [self setAutosizesCells: NO]; + [self setCellSize: defaultCellSize()]; + [self setIntercellSpacing: NSMakeSize(8,8)]; + [self setAutoresizingMask: NSViewMinYMargin|NSViewWidthSizable]; + [self setMode: NSRadioModeMatrix]; + /* + * Send mouse click actions to self, so we can handle selection. + */ + [self setAction: @selector(changeSelection:)]; + [self setDoubleAction: @selector(raiseSelection:)]; + [self setTarget: self]; + + // set the background color. + [self setBackgroundColor: color]; + + objects = [[NSMutableArray alloc] init]; + proto = [[NSButtonCell alloc] init]; + [proto setBordered: NO]; + [proto setAlignment: NSCenterTextAlignment]; + [proto setImagePosition: NSImageAbove]; + [proto setSelectable: NO]; + [proto setEditable: NO]; + [self setPrototype: proto]; + RELEASE(proto); + [self setEditor: self + forDocument: aDocument]; + [self addObject: anObject]; + + // set up the notification... + [[NSNotificationCenter defaultCenter] + addObserver: self + selector: @selector(handleNotification:) + name: GormResizeCellNotification + object: nil]; + + [[NSNotificationCenter defaultCenter] + addObserver: self + selector: @selector(handleNotification:) + name: IBResourceManagerRegistryDidChangeNotification + object: nil]; + } + return self; +} + +- (void) willCloseDocument: (NSNotification *)aNotification +{ + NSMapRemove(docMap,document); + [super willCloseDocument: aNotification]; +} + +- (void) close +{ + [super close]; + [[NSNotificationCenter defaultCenter] removeObserver: self]; + NSMapRemove(docMap,document); +} + +- (void) makeSelectionVisible: (BOOL)flag +{ + if (flag == YES && selected != nil) + { + unsigned pos = [objects indexOfObjectIdenticalTo: selected]; + int r = pos / [self numberOfColumns]; + int c = pos % [self numberOfColumns]; + + [self selectCellAtRow: r column: c]; + } + else + { + [self deselectAllCells]; + } + [self displayIfNeeded]; + [[self window] flushWindow]; +} + +- (void) mouseDown: (NSEvent*)theEvent +{ + if ([theEvent modifierFlags] & NSControlKeyMask) + { + NSPoint loc = [theEvent locationInWindow]; + NSString *name; + NSInteger r = 0, c = 0; + int pos = 0; + id obj = nil; + + loc = [self convertPoint: loc fromView: nil]; + [self getRow: &r column: &c forPoint: loc]; + pos = r * [self numberOfColumns] + c; + if (pos >= 0 && pos < [objects count]) + { + obj = [objects objectAtIndex: pos]; + } + if (obj != nil && obj != selected) + { + [self selectObjects: [NSArray arrayWithObject: obj]]; + [self makeSelectionVisible: YES]; + } + name = [document nameForObject: obj]; + if ([name isEqualToString: @"NSFirst"] == NO && name != nil) + { + NSPasteboard *pb; + + pb = [NSPasteboard pasteboardWithName: NSDragPboard]; + [pb declareTypes: [NSArray arrayWithObject: GormLinkPboardType] + owner: self]; + [pb setString: name forType: GormLinkPboardType]; + [[NSApp delegate] displayConnectionBetween: obj and: nil]; + [[NSApp delegate] startConnecting]; + + [self dragImage: [[NSApp delegate] linkImage] + at: loc + offset: NSZeroSize + event: theEvent + pasteboard: pb + source: self + slideBack: YES]; + [self makeSelectionVisible: YES]; + return; + } + } + + [super mouseDown: theEvent]; +} + +- (BOOL) performDragOperation: (id)sender +{ + if (dragType == GormLinkPboardType) + { + NSPoint loc = [sender draggingLocation]; + NSInteger r, c; + int pos; + id obj = nil; + + loc = [self convertPoint: loc fromView: nil]; + [self getRow: &r column: &c forPoint: loc]; + pos = r * [self numberOfColumns] + c; + if (pos >= 0 && pos < [objects count]) + { + obj = [objects objectAtIndex: pos]; + } + if (obj == nil) + { + return NO; + } + else + { + [[NSApp delegate] displayConnectionBetween: [NSApp connectSource] and: obj]; + [[NSApp delegate] startConnecting]; + return YES; + } + } + else + { + NSLog(@"Drop with unrecognized type!"); + return NO; + } +} + +- (BOOL) prepareForDragOperation: (id)sender +{ + /* + * Tell the source that we will accept the drop if we can. + */ + if (dragType == GormLinkPboardType) + { + NSPoint loc = [sender draggingLocation]; + NSInteger r, c; + int pos; + id obj = nil; + + loc = [self convertPoint: loc fromView: nil]; + [self getRow: &r column: &c forPoint: loc]; + pos = r * [self numberOfColumns] + c; + if (pos >= 0 && pos < [objects count]) + { + obj = [objects objectAtIndex: pos]; + } + if (obj != nil) + { + return YES; + } + } + return NO; +} + +- (id) raiseSelection: (id)sender +{ + id obj = [self changeSelection: sender]; + id e; + + if(obj != nil) + { + e = [document editorForObject: obj create: YES]; + [e orderFront]; + [e resetObject: obj]; + } + + return self; +} + +- (void) resetObject: (id)anObject +{ + NSString *name = [document nameForObject: anObject]; + GormInspectorsManager *mgr = [(id)[NSApp delegate] inspectorsManager]; + + if ([name isEqual: @"NSOwner"] == YES) + { + [mgr setClassInspector]; + } + if ([name isEqual: @"NSFirst"] == YES) + { + [mgr setClassInspector]; + } +} + +- (void) addObject:(id)anObject +{ + [super addObject:anObject]; + /* we need to do this for palettes which can drop top level objects */ + [(GormDocument *)document changeToViewWithTag:0]; +} + + +@end + + From 4a23bc81e0dd786f67b5fd2652b13ab4aa2336fd Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Wed, 25 Dec 2024 08:17:26 -0500 Subject: [PATCH 02/14] Cleanup code --- GormCore/GNUmakefile | 1 + GormCore/GormDocument.m | 2 +- GormCore/GormObjectEditor.h | 28 ++++++++++++++-------------- GormCore/GormObjectEditor.m | 3 +-- GormCore/Images/iconView.tiff | Bin 0 -> 3604 bytes 5 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 GormCore/Images/iconView.tiff diff --git a/GormCore/GNUmakefile b/GormCore/GNUmakefile index cf8d9188..bd35ba50 100644 --- a/GormCore/GNUmakefile +++ b/GormCore/GNUmakefile @@ -217,6 +217,7 @@ GormCore_RESOURCE_FILES = \ Images/GormWindow.tiff \ Images/browserView.tiff \ Images/outlineView.tiff \ + Images/iconView.tiff \ Resources/VersionProfiles.plist \ Resources/ClassInformation.plist diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index 6ac6516f..d97ab9eb 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -3961,7 +3961,7 @@ willBeInsertedIntoToolbar: (BOOL)flag } else if ([item isKindOfClass: [NSWindow class]]) { - return 1; // [[[item contentView] subviews] count]; + return 1; // We are only counting the contentView... } else if ([item isKindOfClass: [NSView class]]) { diff --git a/GormCore/GormObjectEditor.h b/GormCore/GormObjectEditor.h index ad48e080..656810f9 100644 --- a/GormCore/GormObjectEditor.h +++ b/GormCore/GormObjectEditor.h @@ -3,8 +3,8 @@ * Copyright (C) 1999, 2003 Free Software Foundation, Inc. * * Author: Richard Frith-Macdonald - * Author: Gregory John Casamento - * Date: 1999, 2003, 2004 + * Author: Gregory John Casamento + * Date: 1999, 2003, 2004, 2024 * * This file is part of GNUstep. * @@ -26,29 +26,29 @@ #ifndef INCLUDED_GormObjectEditor_h #define INCLUDED_GormObjectEditor_h -#include "GormGenericEditor.h" +#import "GormGenericEditor.h" @interface NSObject (GormObjectAdditions) -- (NSImage*) imageForViewer; -- (NSString*) inspectorClassName; -- (NSString*) connectInspectorClassName; -- (NSString*) sizeInspectorClassName; -- (NSString*) helpInspectorClassName; -- (NSString*) classInspectorClassName; -- (NSString*) editorClassName; +- (NSImage *) imageForViewer; +- (NSString *) inspectorClassName; +- (NSString *) connectInspectorClassName; +- (NSString *) sizeInspectorClassName; +- (NSString *) helpInspectorClassName; +- (NSString *) classInspectorClassName; +- (NSString *) editorClassName; @end @interface GormObjectEditor : GormGenericEditor -{ -} + + (void) setEditor: (id)editor forDocument: (id)aDocument; -- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f; +- (void) draggedImage: (NSImage *)i endedAt: (NSPoint)p deposited: (BOOL)f; - (NSDragOperation) draggingSourceOperationMaskForLocal: (BOOL)flag; -- (BOOL) acceptsTypeFromArray: (NSArray*)types; +- (BOOL) acceptsTypeFromArray: (NSArray *)types; - (void) makeSelectionVisible: (BOOL)flag; - (void) resetObject: (id)anObject; + @end #endif diff --git a/GormCore/GormObjectEditor.m b/GormCore/GormObjectEditor.m index e447b8c4..2a974f4b 100644 --- a/GormCore/GormObjectEditor.m +++ b/GormCore/GormObjectEditor.m @@ -103,7 +103,7 @@ static NSMapTable *docMap = 0; { docMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks, NSNonRetainedObjectMapValueCallBacks, - 2); + 2); } } @@ -125,7 +125,6 @@ static NSMapTable *docMap = 0; NSMapInsert(docMap, (void*)aDocument, (void*)editor); } - - (BOOL) acceptsTypeFromArray: (NSArray*)types { return ([[(GormDocument *)document allManagedPboardTypes] firstObjectCommonWithArray: types] != nil); diff --git a/GormCore/Images/iconView.tiff b/GormCore/Images/iconView.tiff new file mode 100644 index 0000000000000000000000000000000000000000..940ed4c3e8274c79d40b2589bee1ed2db09fa8a4 GIT binary patch literal 3604 zcmbW32UHWw8pmfhjWk+9=n!h?y#$cn1*BI|2}yuZLI}-X5f!+Ch=_oqhy_qklp=OS zQ9%?H#CkyTHV9 z#46IG)R|}p28|2>Acg!;$XX#FhcwU}hQBcyQO`iAA36qk!v0_wVZskaCV`{?;zi~G zKn#+eqs#nY(M+@-EQ%%j(?1L;&GGB}VA1^cb2w;@C-@tSX6)RQ4sZaFyb$g|Vk6Oi z+z^tB=tlZ{dHhsZ5`YwbhA_y}g&q+ZMaT657~laGm;%6JrwjaoJwimoz1>~u>4-_h zzpnQK-&O|h7A&>JJffThoD`0TI}zTTmB~dI<%@7`7LS{a@Lhy8lQUCz z2+tr)P2sZA0YH;PdIp!BfUpU|Bw_uuRB{PspI_ zuyyICHa1MU7dJbZn~`A{z+xw{gdDnSYKnlxUk1SUHH$_8X;E$INRh2fZLF*e&5V%p z|GfUT^QY_YLA1Bu9d84_?HNSt`KA3D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`5>K^eP^&V56mYyp-FL+_Re7v@K z-SbxVW_#CqPtCWUziNJ`56LIkr`+eMub!{ax7`o+oA0;X@6iIS1^flA{=nbcf4l$V z07gJs!0AA2U_f9+;Ikmppp`*g!Ia=7!F9p!LtH`%Lmr0egl2|zgh_-&ht-CC2zLuF z4j+mzj#w4Z9jOq>i)@R+MTJEjjGA8PzHrCF(P+!)+~|Qtj73WqU0bZMIC=5eB@#hmyV~hbK3th^54&oZ?IKllYyfDyd6T`vm%eT)|M9 zZQ72sDWQ+>U^+MJP%o*V0P#dC$Z_cqyWs@ja+%-h_%#eB=IEno6DdDrtz@=NnS7qAPi|7QAI z*>7LB#%=8_v?|L8+b+#rMY}$iCzSVBxKuP&DphW&{IHv|`}Q8EJq=aLRryt)_VV@)?(^K&QmtKG zx*xkgYyY#Fu$ry|%mcLt6%OVf{PPh1(9q$a!=1I(wY7Chb%phCeP;dmk?140j=CLf zYcOos*GOy3KL(Cv9(!>-=J-I9PgBPU=81-rS|=-;Db0B;P|LEGsn&$np|;4jzEks0 zb+p^HH=i~-edvtZnToSAXA92}&gGo@dVcx&=?j7jlNaMJj&v;Pcz7w|(%sI$&fd#D zm#<#&xN@n>x$FE@`>SWJ*z$FisShUJasUaQ`go7OkmZrR*w@0-_m z?zZFYi+9}aT)FFgx4VBqf8Rjpz~H^;dqabq!RPmr@4tDF^ee&+B; f=Ets2;h)B4vp?fLm;I^xXZshQFOR;aeEs@wp}SzL literal 0 HcmV?d00001 From f22ba14a5d828c8ec4d75575773a1d2e6e12a820 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Wed, 25 Dec 2024 21:00:46 -0500 Subject: [PATCH 03/14] Add new views --- GormCore/GNUmakefile | 4 + GormCore/GormObjectMainView.h | 45 +++ GormCore/GormObjectMainView.m | 30 ++ GormCore/GormObjectOutline.h | 43 --- GormCore/GormObjectOutline.m | 587 ------------------------------- GormCore/GormObjectOutlineView.h | 45 +++ GormCore/GormObjectOutlineView.m | 30 ++ 7 files changed, 154 insertions(+), 630 deletions(-) create mode 100644 GormCore/GormObjectMainView.h create mode 100644 GormCore/GormObjectMainView.m delete mode 100644 GormCore/GormObjectOutline.h delete mode 100644 GormCore/GormObjectOutline.m create mode 100644 GormCore/GormObjectOutlineView.h create mode 100644 GormCore/GormObjectOutlineView.m diff --git a/GormCore/GNUmakefile b/GormCore/GNUmakefile index bd35ba50..abf78b5a 100644 --- a/GormCore/GNUmakefile +++ b/GormCore/GNUmakefile @@ -69,6 +69,8 @@ GormCore_HEADER_FILES = \ GormNSWindow.h \ GormObjectEditor.h \ GormObjectInspector.h \ + GormObjectMainView.h \ + GormObjectOutlineView.h \ GormOpenGLView.h \ GormOutlineView.h \ GormPalettesManager.h \ @@ -148,6 +150,8 @@ GormCore_OBJC_FILES = \ GormNSWindow.m \ GormObjectEditor.m \ GormObjectInspector.m \ + GormObjectMainView.m \ + GormObjectOutlineView.m \ GormOpenGLView.m \ GormOutlineView.m \ GormPalettesManager.m \ diff --git a/GormCore/GormObjectMainView.h b/GormCore/GormObjectMainView.h new file mode 100644 index 00000000..32e20bda --- /dev/null +++ b/GormCore/GormObjectMainView.h @@ -0,0 +1,45 @@ +/* Definition of class GormObjectMainView + Copyright (C) 2024 Free Software Foundation, Inc. + + By: Gregory John Casamento + Date: 25-12-2024 + + This file is part of GNUstep. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110 USA. +*/ + +#ifndef _GormObjectMainView_h_INCLUDE +#define _GormObjectMainView_h_INCLUDE + +#import +#import + +#if defined(__cplusplus) +extern "C" { +#endif + +GS_EXPORT_CLASS +@interface GormObjectMainView : NSView + +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* _GormObjectMainView_h_INCLUDE */ + diff --git a/GormCore/GormObjectMainView.m b/GormCore/GormObjectMainView.m new file mode 100644 index 00000000..8e0cae22 --- /dev/null +++ b/GormCore/GormObjectMainView.m @@ -0,0 +1,30 @@ +/* Implementation of class GormObjectMainView + Copyright (C) 2024 Free Software Foundation, Inc. + + By: Gregory John Casamento + Date: 25-12-2024 + + This file is part of GNUstep. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110 USA. +*/ + +#import "GormObjectMainView.h" + +@implementation GormObjectMainView + +@end + diff --git a/GormCore/GormObjectOutline.h b/GormCore/GormObjectOutline.h deleted file mode 100644 index b9e380fb..00000000 --- a/GormCore/GormObjectOutline.h +++ /dev/null @@ -1,43 +0,0 @@ -/* GormObjectOutline.h - * - * Copyright (C) 2024 Free Software Foundation, Inc. - * - * Author: Gregory John Casamento - * Date: 2024 - * - * 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. - */ - -#ifndef INCLUDED_GormObjectEditor_h -#define INCLUDED_GormObjectEditor_h - -#include "GormObjectEditor.h" - -extern static NSMapTable *docMap; - -@interface GormObjectOutline : GormObjectEditor -{ -} -+ (void) setEditor: (id)editor forDocument: (id)aDocument; -- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f; -- (NSDragOperation) draggingSourceOperationMaskForLocal: (BOOL)flag; -- (BOOL) acceptsTypeFromArray: (NSArray*)types; -- (void) makeSelectionVisible: (BOOL)flag; -- (void) resetObject: (id)anObject; -@end - -#endif diff --git a/GormCore/GormObjectOutline.m b/GormCore/GormObjectOutline.m deleted file mode 100644 index 99fdbc31..00000000 --- a/GormCore/GormObjectOutline.m +++ /dev/null @@ -1,587 +0,0 @@ -/* GormObjectOutline.m - * - * Copyright (C) 2024 Free Software Foundation, Inc. - * - * Author: Gregory John Casamento - * Date: 2024 - * - * 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. - */ - -#import -#import - -#import "GormPrivate.h" -#import "GormObjectEditor.h" -#import "GormFunctions.h" -#import "GormDocument.h" -#import "GormClassManager.h" -#import "GormAbstractDelegate.h" - -/* - * Method to return the image that should be used to display objects within - * the matrix containing the objects in a document. - */ -@implementation NSObject (GormObjectAdditions) -- (NSImage*) imageForViewer -{ - static NSImage *image = nil; - GormAbstractDelegate *delegate = (GormAbstractDelegate *)[NSApp delegate]; - - if (image == nil && [delegate isInTool] == NO) - { - NSBundle *bundle = [NSBundle bundleForClass: [self class]]; - NSString *path = [bundle pathForImageResource: @"GormUnknown"]; - image = [[NSImage alloc] initWithContentsOfFile: path]; - } - - return image; -} - -- (NSString*) inspectorClassName -{ - return @"GormObjectInspector"; -} - -- (NSString*) connectInspectorClassName -{ - return @"GormConnectionInspector"; -} - -- (NSString*) sizeInspectorClassName -{ - return @"GormNotApplicableInspector"; -} - -- (NSString*) helpInspectorClassName -{ - return @"GormNotApplicableInspector"; -} - -- (NSString*) classInspectorClassName -{ - return @"GormCustomClassInspector"; -} - -- (NSString*) editorClassName -{ - return @"GormObjectEditor"; -} -@end - -@implementation NSView (GormObjectAdditions) -- (NSString*) helpInspectorClassName -{ - return @"GormHelpInspector"; -} -@end - -// Map top level document editors to their documents... -static NSMapTable *docMap = 0; - -@implementation GormObjectOutline - -+ (void) initialize -{ - if (self == [GormObjectEditor class]) - { - docMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks, - NSNonRetainedObjectMapValueCallBacks, - 2); - } -} - -+ (id) editorForDocument: (id)aDocument -{ - id editor = NSMapGet(docMap, (void*)aDocument); - - if (editor == nil) - { - editor = [[self alloc] initWithObject: nil inDocument: aDocument]; - AUTORELEASE(editor); - } - return editor; -} - -+ (void) setEditor: (id)editor - forDocument: (id)aDocument -{ - NSMapInsert(docMap, (void*)aDocument, (void*)editor); -} - - -- (BOOL) acceptsTypeFromArray: (NSArray*)types -{ - return ([[(GormDocument *)document allManagedPboardTypes] firstObjectCommonWithArray: types] != nil); -} - -- (void) pasteInSelection -{ - NSPasteboard *pb = [NSPasteboard generalPasteboard]; - NSString *type = [[(GormDocument *)document allManagedPboardTypes] firstObjectCommonWithArray: [pb types]]; - - if(type != nil) - { - // paste the object in. - [document pasteType: type - fromPasteboard: pb - parent: nil]; - } -} - -- (void) copySelection -{ - NSArray *sel = [self selection]; - if([sel count] > 0) - { - NSString *type = nil; - id obj = [sel objectAtIndex: 0]; - - if([obj isKindOfClass: [NSWindow class]]) - { - type = IBWindowPboardType; - } - else if([obj isKindOfClass: [NSView class]]) - { - type = IBViewPboardType; - } - else - { - type = IBObjectPboardType; - } - - [document copyObjects: sel - type: type - toPasteboard: [NSPasteboard generalPasteboard]]; - } -} - -- (void) deleteSelection -{ - if (selected != nil - && [[document nameForObject: selected] isEqualToString: @"NSOwner"] == NO - && [[document nameForObject: selected] isEqualToString: @"NSFirst"] == NO) - { - if ([selected isKindOfClass: [NSMenu class]] && - [[document nameForObject: selected] isEqual: @"NSMenu"] == YES) - { - NSString *title = _(@"Removing Main Menu"); - NSString *msg = _(@"Are you sure you want to do this?"); - NSInteger retval = NSRunAlertPanel(title, msg,_(@"OK"),_(@"Cancel"), nil, nil); - - // if the user *really* wants to delete the menu, do it. - if(retval != NSAlertDefaultReturn) - return; - } - - [document detachObject: selected]; - if ([selected isKindOfClass: [NSWindow class]] == YES) - { - NSArray *subviews = allSubviews([(NSWindow *)selected contentView]); - [document detachObjects: subviews]; - [selected close]; - } - - if ([selected isKindOfClass: [NSMenu class]] == YES) - { - NSArray *items = findAll( selected ); - NSEnumerator *en = [items objectEnumerator]; - id obj = nil; - - while((obj = [en nextObject]) != nil) - { - [document detachObject: obj]; - } - } - - [objects removeObjectIdenticalTo: selected]; - [self selectObjects: [NSArray array]]; - [self refreshCells]; - } -} - -/* - * Dragging source protocol implementation - */ -- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f -{ -} - -- (NSDragOperation) draggingEntered: (id)sender -{ - NSArray *pbTypes = nil; - - // Get the resource manager first, if nil don't bother calling the rest... - dragPb = [sender draggingPasteboard]; - pbTypes = [dragPb types]; - - if ([pbTypes containsObject: GormLinkPboardType] == YES) - { - dragType = GormLinkPboardType; - } - else - { - dragType = nil; - } - - return [self draggingUpdated: sender]; -} - -- (NSDragOperation) draggingUpdated: (id)sender -{ - if (dragType == GormLinkPboardType) - { - NSPoint loc = [sender draggingLocation]; - NSInteger r, c; - int pos; - id obj = nil; - id delegate = [NSApp delegate]; - - loc = [self convertPoint: loc fromView: nil]; - [self getRow: &r column: &c forPoint: loc]; - pos = r * [self numberOfColumns] + c; - if (pos >= 0 && pos < [objects count]) - { - obj = [objects objectAtIndex: pos]; - } - if (obj == [delegate connectSource]) - { - return NSDragOperationNone; /* Can't drag an object onto itsself */ - } - - [delegate displayConnectionBetween: [delegate connectSource] and: obj]; - if (obj != nil) - { - return NSDragOperationLink; - } - - return NSDragOperationNone; - } - - return NSDragOperationNone; -} - - -/** - * Used for autoscrolling when you connect IBActions. - * FIXME: Maybye there is a better way to do it. -*/ -- (void)draggingExited:(id < NSDraggingInfo >)sender -{ - if (dragType == GormLinkPboardType) - { - NSRect documentVisibleRect; - NSRect documentRect; - NSPoint loc = [sender draggingLocation]; - - loc = [self convertPoint:loc fromView:nil]; - documentVisibleRect = [(NSClipView *)[self superview] documentVisibleRect]; - documentRect = [(NSClipView *)[self superview] documentRect]; - - /* Down */ - if ( (loc.y >= documentVisibleRect.size.height) - && ( ! NSEqualRects(documentVisibleRect,documentRect) ) ) - { - loc.x = 0; - loc.y = documentRect.origin.y + [self cellSize].height; - [(NSClipView*) [self superview] scrollToPoint:loc]; - } - /* up */ - else if ( (loc.y + 10 >= documentVisibleRect.origin.y ) - && ( ! NSEqualRects(documentVisibleRect,documentRect) ) ) - { - loc.x = 0; - loc.y = documentRect.origin.y - [self cellSize].height; - [(NSClipView*) [self superview] scrollToPoint:loc]; - } - - } -} - -- (NSDragOperation) draggingSourceOperationMaskForLocal: (BOOL)flag -{ - return NSDragOperationLink; -} - -- (void) drawSelection -{ -} - -- (void) handleNotification: (NSNotification*)aNotification -{ - NSString *name = [aNotification name]; - - if([name isEqual: GormResizeCellNotification]) - { - NSDebugLog(@"Received notification"); - [self setCellSize: defaultCellSize()]; - } -} - -/* - * Initialisation - register to receive DnD with our own types. - */ -- (id) initWithObject: (id)anObject inDocument: (id)aDocument -{ - id old = NSMapGet(docMap, (void*)aDocument); - - if (old != nil) - { - RELEASE(self); - self = RETAIN(old); - [self addObject: anObject]; - return self; - } - - self = [super initWithObject: anObject inDocument: aDocument]; - if (self != nil) - { - NSButtonCell *proto; - NSColor *color = [NSColor colorWithCalibratedRed: 0.850980 - green: 0.737255 - blue: 0.576471 - alpha: 0.0 ]; - - document = aDocument; - - [self registerForDraggedTypes:[NSArray arrayWithObject:GormLinkPboardType]]; - [self setAutosizesCells: NO]; - [self setCellSize: defaultCellSize()]; - [self setIntercellSpacing: NSMakeSize(8,8)]; - [self setAutoresizingMask: NSViewMinYMargin|NSViewWidthSizable]; - [self setMode: NSRadioModeMatrix]; - /* - * Send mouse click actions to self, so we can handle selection. - */ - [self setAction: @selector(changeSelection:)]; - [self setDoubleAction: @selector(raiseSelection:)]; - [self setTarget: self]; - - // set the background color. - [self setBackgroundColor: color]; - - objects = [[NSMutableArray alloc] init]; - proto = [[NSButtonCell alloc] init]; - [proto setBordered: NO]; - [proto setAlignment: NSCenterTextAlignment]; - [proto setImagePosition: NSImageAbove]; - [proto setSelectable: NO]; - [proto setEditable: NO]; - [self setPrototype: proto]; - RELEASE(proto); - [self setEditor: self - forDocument: aDocument]; - [self addObject: anObject]; - - // set up the notification... - [[NSNotificationCenter defaultCenter] - addObserver: self - selector: @selector(handleNotification:) - name: GormResizeCellNotification - object: nil]; - - [[NSNotificationCenter defaultCenter] - addObserver: self - selector: @selector(handleNotification:) - name: IBResourceManagerRegistryDidChangeNotification - object: nil]; - } - return self; -} - -- (void) willCloseDocument: (NSNotification *)aNotification -{ - NSMapRemove(docMap,document); - [super willCloseDocument: aNotification]; -} - -- (void) close -{ - [super close]; - [[NSNotificationCenter defaultCenter] removeObserver: self]; - NSMapRemove(docMap,document); -} - -- (void) makeSelectionVisible: (BOOL)flag -{ - if (flag == YES && selected != nil) - { - unsigned pos = [objects indexOfObjectIdenticalTo: selected]; - int r = pos / [self numberOfColumns]; - int c = pos % [self numberOfColumns]; - - [self selectCellAtRow: r column: c]; - } - else - { - [self deselectAllCells]; - } - [self displayIfNeeded]; - [[self window] flushWindow]; -} - -- (void) mouseDown: (NSEvent*)theEvent -{ - if ([theEvent modifierFlags] & NSControlKeyMask) - { - NSPoint loc = [theEvent locationInWindow]; - NSString *name; - NSInteger r = 0, c = 0; - int pos = 0; - id obj = nil; - - loc = [self convertPoint: loc fromView: nil]; - [self getRow: &r column: &c forPoint: loc]; - pos = r * [self numberOfColumns] + c; - if (pos >= 0 && pos < [objects count]) - { - obj = [objects objectAtIndex: pos]; - } - if (obj != nil && obj != selected) - { - [self selectObjects: [NSArray arrayWithObject: obj]]; - [self makeSelectionVisible: YES]; - } - name = [document nameForObject: obj]; - if ([name isEqualToString: @"NSFirst"] == NO && name != nil) - { - NSPasteboard *pb; - - pb = [NSPasteboard pasteboardWithName: NSDragPboard]; - [pb declareTypes: [NSArray arrayWithObject: GormLinkPboardType] - owner: self]; - [pb setString: name forType: GormLinkPboardType]; - [[NSApp delegate] displayConnectionBetween: obj and: nil]; - [[NSApp delegate] startConnecting]; - - [self dragImage: [[NSApp delegate] linkImage] - at: loc - offset: NSZeroSize - event: theEvent - pasteboard: pb - source: self - slideBack: YES]; - [self makeSelectionVisible: YES]; - return; - } - } - - [super mouseDown: theEvent]; -} - -- (BOOL) performDragOperation: (id)sender -{ - if (dragType == GormLinkPboardType) - { - NSPoint loc = [sender draggingLocation]; - NSInteger r, c; - int pos; - id obj = nil; - - loc = [self convertPoint: loc fromView: nil]; - [self getRow: &r column: &c forPoint: loc]; - pos = r * [self numberOfColumns] + c; - if (pos >= 0 && pos < [objects count]) - { - obj = [objects objectAtIndex: pos]; - } - if (obj == nil) - { - return NO; - } - else - { - [[NSApp delegate] displayConnectionBetween: [NSApp connectSource] and: obj]; - [[NSApp delegate] startConnecting]; - return YES; - } - } - else - { - NSLog(@"Drop with unrecognized type!"); - return NO; - } -} - -- (BOOL) prepareForDragOperation: (id)sender -{ - /* - * Tell the source that we will accept the drop if we can. - */ - if (dragType == GormLinkPboardType) - { - NSPoint loc = [sender draggingLocation]; - NSInteger r, c; - int pos; - id obj = nil; - - loc = [self convertPoint: loc fromView: nil]; - [self getRow: &r column: &c forPoint: loc]; - pos = r * [self numberOfColumns] + c; - if (pos >= 0 && pos < [objects count]) - { - obj = [objects objectAtIndex: pos]; - } - if (obj != nil) - { - return YES; - } - } - return NO; -} - -- (id) raiseSelection: (id)sender -{ - id obj = [self changeSelection: sender]; - id e; - - if(obj != nil) - { - e = [document editorForObject: obj create: YES]; - [e orderFront]; - [e resetObject: obj]; - } - - return self; -} - -- (void) resetObject: (id)anObject -{ - NSString *name = [document nameForObject: anObject]; - GormInspectorsManager *mgr = [(id)[NSApp delegate] inspectorsManager]; - - if ([name isEqual: @"NSOwner"] == YES) - { - [mgr setClassInspector]; - } - if ([name isEqual: @"NSFirst"] == YES) - { - [mgr setClassInspector]; - } -} - -- (void) addObject:(id)anObject -{ - [super addObject:anObject]; - /* we need to do this for palettes which can drop top level objects */ - [(GormDocument *)document changeToViewWithTag:0]; -} - - -@end - - diff --git a/GormCore/GormObjectOutlineView.h b/GormCore/GormObjectOutlineView.h new file mode 100644 index 00000000..89ca8a24 --- /dev/null +++ b/GormCore/GormObjectOutlineView.h @@ -0,0 +1,45 @@ +/* Definition of class GormObjectOutlineView + Copyright (C) 2024 Free Software Foundation, Inc. + + By: Gregory John Casamento + Date: 25-12-2024 + + This file is part of GNUstep. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110 USA. +*/ + +#ifndef _GormObjectOutlineView_h_INCLUDE +#define _GormObjectOutlineView_h_INCLUDE + +#import +#import + +#if defined(__cplusplus) +extern "C" { +#endif + +GS_EXPORT_CLASS +@interface GormObjectOutlineView : NSView + +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* _GormObjectOutlineView_h_INCLUDE */ + diff --git a/GormCore/GormObjectOutlineView.m b/GormCore/GormObjectOutlineView.m new file mode 100644 index 00000000..d8c6b0f0 --- /dev/null +++ b/GormCore/GormObjectOutlineView.m @@ -0,0 +1,30 @@ +/* Implementation of class GormObjectOutlineView + Copyright (C) 2024 Free Software Foundation, Inc. + + By: Gregory John Casamento + Date: 25-12-2024 + + This file is part of GNUstep. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110 USA. +*/ + +#import "GormObjectOutlineView.h" + +@implementation GormObjectOutlineView + +@end + From 5b5ca6c09bab7c6a4490f718e624f574c9accbff Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Thu, 26 Dec 2024 08:59:47 -0500 Subject: [PATCH 04/14] Update view controller --- .../GormObjectOutlineView.gorm/data.classes | 22 ++++++++++++++++++ .../GormObjectOutlineView.gorm/data.info | Bin 0 -> 184 bytes .../GormObjectOutlineView.gorm/iconView.tiff | Bin 0 -> 3604 bytes .../GormObjectOutlineView.gorm/objects.gorm | Bin 0 -> 6330 bytes .../outlineView.tiff | Bin 0 -> 2650 bytes GormCore/GormObjectMainView.h | 3 +++ GormCore/GormObjectViewController.h | 20 ++++++++++++++++ GormCore/GormObjectViewController.m | 15 ++++++++++++ 8 files changed, 60 insertions(+) create mode 100644 GormCore/English.lproj/GormObjectOutlineView.gorm/data.classes create mode 100644 GormCore/English.lproj/GormObjectOutlineView.gorm/data.info create mode 100644 GormCore/English.lproj/GormObjectOutlineView.gorm/iconView.tiff create mode 100644 GormCore/English.lproj/GormObjectOutlineView.gorm/objects.gorm create mode 100644 GormCore/English.lproj/GormObjectOutlineView.gorm/outlineView.tiff create mode 100644 GormCore/GormObjectViewController.h create mode 100644 GormCore/GormObjectViewController.m diff --git a/GormCore/English.lproj/GormObjectOutlineView.gorm/data.classes b/GormCore/English.lproj/GormObjectOutlineView.gorm/data.classes new file mode 100644 index 00000000..837c17cb --- /dev/null +++ b/GormCore/English.lproj/GormObjectOutlineView.gorm/data.classes @@ -0,0 +1,22 @@ +{ + "## Comment" = "Do NOT change this file, Gorm maintains it"; + FirstResponder = { + Actions = ( + "iconView:", + "outlineView:" + ); + Super = NSObject; + }; + GormObjectViewController = { + Actions = ( + "iconView:", + "outlineView:" + ); + Outlets = ( + displayView, + iconButton, + outlineButton + ); + Super = NSViewController; + }; +} \ No newline at end of file diff --git a/GormCore/English.lproj/GormObjectOutlineView.gorm/data.info b/GormCore/English.lproj/GormObjectOutlineView.gorm/data.info new file mode 100644 index 0000000000000000000000000000000000000000..70a46922b39d56c6923e7127e1efdd8450eeeb95 GIT binary patch literal 184 zcmZ?w3oR~5El@}-O3uhEOEoYsNHZ}qF|YzMK)@J-0hD4iWMmL=&o9b#%gjj)C`wH$ z_D#%7OiwLh00KiM1`fYq|D>$cTHV9 z#46IG)R|}p28|2>Acg!;$XX#FhcwU}hQBcyQO`iAA36qk!v0_wVZskaCV`{?;zi~G zKn#+eqs#nY(M+@-EQ%%j(?1L;&GGB}VA1^cb2w;@C-@tSX6)RQ4sZaFyb$g|Vk6Oi z+z^tB=tlZ{dHhsZ5`YwbhA_y}g&q+ZMaT657~laGm;%6JrwjaoJwimoz1>~u>4-_h zzpnQK-&O|h7A&>JJffThoD`0TI}zTTmB~dI<%@7`7LS{a@Lhy8lQUCz z2+tr)P2sZA0YH;PdIp!BfUpU|Bw_uuRB{PspI_ zuyyICHa1MU7dJbZn~`A{z+xw{gdDnSYKnlxUk1SUHH$_8X;E$INRh2fZLF*e&5V%p z|GfUT^QY_YLA1Bu9d84_?HNSt`KA3D`%6o$27oz@)TZc{7P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FL+_Re7v@K z-SbxVW_#CqPtCWUziNJ`56LIkr`+eMub!{ax7`o+oA0;X@6iIS1^flA{=nbcf4l$V z07gJs!0AA2U_f9+;Ikmppp`*g!Ia=7!F9p!LtH`%Lmr0egl2|zgh_-&ht-CC2zLuF z4j+mzj#w4Z9jOq>i)@R+MTJEjjGA8PzHrCF(P+!)+~|Qtj73WqU0bZMIC=5eB@#hmyV~hbK3th^54&oZ?IKllYyfDyd6T`vm%eT)|M9 zZQ72sDWQ+>U^+MJP%o*V0P#dC$Z_cqyWs@ja+%-h_%#eB=IEno6DdDrtz@=NnS7qAPi|7QAI z*>7LB#%=8_v?|L8+b+#rMY}$iCzSVBxKuP&DphW&{IHv|`}Q8EJq=aLRryt)_VV@)?(^K&QmtKG zx*xkgYyY#Fu$ry|%mcLt6%OVf{PPh1(9q$a!=1I(wY7Chb%phCeP;dmk?140j=CLf zYcOos*GOy3KL(Cv9(!>-=J-I9PgBPU=81-rS|=-;Db0B;P|LEGsn&$np|;4jzEks0 zb+p^HH=i~-edvtZnToSAXA92}&gGo@dVcx&=?j7jlNaMJj&v;Pcz7w|(%sI$&fd#D zm#<#&xN@n>x$FE@`>SWJ*z$FisShUJasUaQ`go7OkmZrR*w@0-_m z?zZFYi+9}aT)FFgx4VBqf8Rjpz~H^;dqabq!RPmr@4tDF^ee&+B; f=Ets2;h)B4vp?fLm;I^xXZshQFOR;aeEs@wp}SzL literal 0 HcmV?d00001 diff --git a/GormCore/English.lproj/GormObjectOutlineView.gorm/objects.gorm b/GormCore/English.lproj/GormObjectOutlineView.gorm/objects.gorm new file mode 100644 index 0000000000000000000000000000000000000000..ab0591c3710186e99244ad6d0df4de3fc1aff915 GIT binary patch literal 6330 zcmd^DeQaCR6+eD<>^N~goUf)y3Z=ANohHq>SytMV4mSzSGO2Ef3;6>H)rlXii(^NQ z)6joV5r~gU6Hna$sYT*L2sVjT&x1lmB?MyPOKcKfLLedW2mHYwn~+f1G)-*h-22|k z!+mbttWy!Vjs3glo_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Jl@$%C4%iEev@bdo zaEsFDbX<38@#qfzyM2j5ZG)E7cd?ZRwYj!iPX0gN2KBajw;1^ z$6dXa&dd{2f0VZg$HW?Fx2wU7aaqJMvmb9%Cfw!ahPU#wm0_DN6?+r1VTt@ ztb>XjA-{8S&X@1xYQBF#+#T|tzAqeRlS_XauDz+xq$P80GuU{LT57E+r=I_WOwUIypZaoUo4skCKK-knY-W%(dY>9|HqE5h*v2NU zrkwQGwySqHX{j~8;Xd`--obRP&)TPd-Ak9a$-im#uDLG0{#?(9e3Bud(ia`ne2g(w z*g+m*?j8Rz4Md*zYzuaf_ozeeasR-YedICn^)4X?^jqJ>c%<|m3g)_F!8gc9qMo46 z3EiswJfY61;0f}XqH`{odzdJUA#ufzMOgwYf+9=V9V}s<*ZxvUO_Zors;6K0cYaVg&=cxBJSS`Nu literal 0 HcmV?d00001 diff --git a/GormCore/GormObjectMainView.h b/GormCore/GormObjectMainView.h index 32e20bda..d9876a73 100644 --- a/GormCore/GormObjectMainView.h +++ b/GormCore/GormObjectMainView.h @@ -34,6 +34,9 @@ extern "C" { GS_EXPORT_CLASS @interface GormObjectMainView : NSView +{ + IBOutlet NSBox *contentView; +} @end diff --git a/GormCore/GormObjectViewController.h b/GormCore/GormObjectViewController.h new file mode 100644 index 00000000..56327da1 --- /dev/null +++ b/GormCore/GormObjectViewController.h @@ -0,0 +1,20 @@ +/* All rights reserved */ + +#ifndef GormObjectViewController_H_INCLUDE +#define GormObjectViewController_H_INCLUDE + +#import + +@interface GormObjectViewController : NSViewController +{ + IBOutlet id displayView; + IBOutlet id iconButton; + IBOutlet id outlineButton; +} + +- (IBAction) iconView: (id)sender; +- (IBAction) outlineView: (id)sender; + +@end + +#endif // GormObjectViewController_H_INCLUDE diff --git a/GormCore/GormObjectViewController.m b/GormCore/GormObjectViewController.m new file mode 100644 index 00000000..e37736b4 --- /dev/null +++ b/GormCore/GormObjectViewController.m @@ -0,0 +1,15 @@ +/* All rights reserved */ + +#import "GormObjectViewController.h" + +@implementation GormObjectViewController + +- (IBAction) iconView: (id)sender +{ +} + +- (IBAction) outlineView: (id)sender +{ +} + +@end From 85552db43e8b0e25186b7593695170d26a9e3434 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Fri, 27 Dec 2024 04:02:24 -0500 Subject: [PATCH 05/14] Add OCProperty --- GormCore/GNUmakefile | 2 ++ GormCore/GormObjectMainView.h | 2 +- GormObjCHeaderParser/OCProperty.h | 45 +++++++++++++++++++++++++++++++ GormObjCHeaderParser/OCProperty.m | 30 +++++++++++++++++++++ 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 GormObjCHeaderParser/OCProperty.h create mode 100644 GormObjCHeaderParser/OCProperty.m diff --git a/GormCore/GNUmakefile b/GormCore/GNUmakefile index abf78b5a..5abbafed 100644 --- a/GormCore/GNUmakefile +++ b/GormCore/GNUmakefile @@ -71,6 +71,7 @@ GormCore_HEADER_FILES = \ GormObjectInspector.h \ GormObjectMainView.h \ GormObjectOutlineView.h \ + GormObjectViewController.h \ GormOpenGLView.h \ GormOutlineView.h \ GormPalettesManager.h \ @@ -152,6 +153,7 @@ GormCore_OBJC_FILES = \ GormObjectInspector.m \ GormObjectMainView.m \ GormObjectOutlineView.m \ + GormObjectViewController.m \ GormOpenGLView.m \ GormOutlineView.m \ GormPalettesManager.m \ diff --git a/GormCore/GormObjectMainView.h b/GormCore/GormObjectMainView.h index d9876a73..acf2c7ab 100644 --- a/GormCore/GormObjectMainView.h +++ b/GormCore/GormObjectMainView.h @@ -25,7 +25,7 @@ #ifndef _GormObjectMainView_h_INCLUDE #define _GormObjectMainView_h_INCLUDE -#import +#import #import #if defined(__cplusplus) diff --git a/GormObjCHeaderParser/OCProperty.h b/GormObjCHeaderParser/OCProperty.h new file mode 100644 index 00000000..b748a3de --- /dev/null +++ b/GormObjCHeaderParser/OCProperty.h @@ -0,0 +1,45 @@ +/* Definition of class OCProperty + Copyright (C) 2024 Free Software Foundation, Inc. + + By: Gregory John Casamento + Date: 27-12-2024 + + This file is part of GNUstep. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110 USA. +*/ + +#ifndef _OCProperty_h_INCLUDE +#define _OCProperty_h_INCLUDE + +#import "OCIVar.h" +#import + +#if defined(__cplusplus) +extern "C" { +#endif + +GS_EXPORT_CLASS +@interface OCProperty : OCIVar + +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* _OCProperty_h_INCLUDE */ + diff --git a/GormObjCHeaderParser/OCProperty.m b/GormObjCHeaderParser/OCProperty.m new file mode 100644 index 00000000..58c6d73c --- /dev/null +++ b/GormObjCHeaderParser/OCProperty.m @@ -0,0 +1,30 @@ +/* Implementation of class OCProperty + Copyright (C) 2024 Free Software Foundation, Inc. + + By: Gregory John Casamento + Date: 27-12-2024 + + This file is part of GNUstep. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110 USA. +*/ + +#import "OCProperty.h" + +@implementation OCProperty + +@end + From 07d7b65a2720d84ddd5446520c392f0faafafad3 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Fri, 27 Dec 2024 06:08:10 -0500 Subject: [PATCH 06/14] Add .gorm file --- GormCore/GNUmakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/GormCore/GNUmakefile b/GormCore/GNUmakefile index 5abbafed..8f89c2aa 100644 --- a/GormCore/GNUmakefile +++ b/GormCore/GNUmakefile @@ -244,6 +244,7 @@ GormCore_LOCALIZED_RESOURCE_FILES = \ GormInspectorPanel.gorm \ GormNSSplitViewInspector.gorm \ GormObjectInspector.gorm \ + GormObjectOutlineView.gorm \ GormPalettePanel.gorm \ GormPrefColors.gorm \ GormPreferences.gorm \ From 00a962677a0a1a69f55ebd8f73cc61a4d9f64235 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Fri, 27 Dec 2024 07:40:23 -0500 Subject: [PATCH 07/14] Got containing view working for outline/icon view of objects --- .../GormObjectOutlineView.gorm/objects.gorm | Bin 6330 -> 6330 bytes GormCore/GormDocument.h | 5 ++++- GormCore/GormDocument.m | 13 +++++++++--- GormCore/GormObjectViewController.h | 10 +++++++++ GormCore/GormObjectViewController.m | 19 ++++++++++++++++++ 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/GormCore/English.lproj/GormObjectOutlineView.gorm/objects.gorm b/GormCore/English.lproj/GormObjectOutlineView.gorm/objects.gorm index ab0591c3710186e99244ad6d0df4de3fc1aff915..fe7e0a69b78eff8de01068f8c02049f235b703a2 100644 GIT binary patch delta 225 zcmdmGxXW;ZBNL;-WI=X`%~4Djm>7#EKNQg09LYL?5h6M{iphGjE&EPxIS~dh;BkO5 z#CRM^EsJHfzoqx1%?4F;1F#3f|3 qH)u^TumlPiZP1=zU44uhS#IqT-CrR`%YESN$&;|gVbUZTv delta 246 zcmdmGxXW;ZBNO9+$%5<>o1>U6Fin0Spuahibpj(qY;qKn^=4c4o!oLV3}C?H0A+~r zIFw9)3MC~>{>vuAh2T%#$0)WqK$ww{d2^u14Mr1oRiH{%Q6Rz26qcDda8Qj(tsk`|sED^@gFP+W%5a5A^JESrJm22KN`$tT6+ChLl;^B8T= zonTc2BXOd;u11C8?+`ESONtMHt0++umUplK_b>bhW6ws;@ONklO*~Wbtd;q GXafKS-982Y diff --git a/GormCore/GormDocument.h b/GormCore/GormDocument.h index c3b97ac9..a81181de 100644 --- a/GormCore/GormDocument.h +++ b/GormCore/GormDocument.h @@ -34,7 +34,7 @@ #include @class GormClassManager, GormClassEditor, GormObjectProxy, GormFilesOwner, - GormFilePrefsManager, GormDocumentWindow; + GormFilePrefsManager, GormDocumentWindow, GormObjectViewController; /* * Trivial classes for connections from objects to their editors, and from @@ -99,6 +99,9 @@ NSMutableSet *topLevelObjects; NSMutableSet *visibleWindows; NSMutableSet *deferredWindows; + + // Controllers... + GormObjectViewController *objectViewController; } /* Handle notifications */ diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index d97ab9eb..2fa20499 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -56,6 +56,7 @@ #import "GormDocumentWindow.h" #import "GormDocumentController.h" #import "GormXLIFFDocument.h" +#import "GormObjectViewController.h" @interface NSObject (GormNSCoding) @end @@ -368,6 +369,11 @@ static NSImage *fileImage = nil; [scrollView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable]; [scrollView setBorderType: NSBezelBorder]; + + objectViewController = [[GormObjectViewController alloc] initWithNibName: @"GormObjectOutlineView" + bundle: [NSBundle bundleForClass: [self class]]]; + [objectViewController setDocument: self]; + NSLog(@"objectViewController = %@, view = %@", objectViewController, [objectViewController view]); objectsView = [[GormObjectEditor alloc] initWithObject: nil inDocument: self]; @@ -376,7 +382,8 @@ static NSImage *fileImage = nil; NSViewHeightSizable|NSViewWidthSizable]; [scrollView setDocumentView: objectsView]; RELEASE(objectsView); - + [objectViewController resetDisplayView: scrollView]; + // images... mainRect.origin = NSMakePoint(0,0); imagesScrollView = [[NSScrollView alloc] initWithFrame: scrollRect]; @@ -417,7 +424,7 @@ static NSImage *fileImage = nil; /* * Set the objects view as the initial view the user's see on startup. */ - [selectionBox setContentView: scrollView]; + [selectionBox setContentView: [objectViewController view]]; //scrollView]; // add to the objects view... [objectsView addObject: filesOwner]; @@ -952,7 +959,7 @@ static NSImage *fileImage = nil; { case 0: // objects { - [selectionBox setContentView: scrollView]; + [selectionBox setContentView: [objectViewController view]]; //scrollView]; [toolbar setSelectedItemIdentifier: @"ObjectsItem"]; if (![[NSApp delegate] isConnecting]) [self setSelectionFromEditor: objectsView]; diff --git a/GormCore/GormObjectViewController.h b/GormCore/GormObjectViewController.h index 56327da1..19a7577a 100644 --- a/GormCore/GormObjectViewController.h +++ b/GormCore/GormObjectViewController.h @@ -5,13 +5,23 @@ #import +@class GormDocument; + @interface GormObjectViewController : NSViewController { IBOutlet id displayView; IBOutlet id iconButton; IBOutlet id outlineButton; + + // Document + GormDocument *_document; } +- (GormDocument *) document; +- (void) setDocument: (GormDocument *)document; + +- (void) resetDisplayView: (NSView *)view; + - (IBAction) iconView: (id)sender; - (IBAction) outlineView: (id)sender; diff --git a/GormCore/GormObjectViewController.m b/GormCore/GormObjectViewController.m index e37736b4..cee6ad54 100644 --- a/GormCore/GormObjectViewController.m +++ b/GormCore/GormObjectViewController.m @@ -1,15 +1,34 @@ /* All rights reserved */ #import "GormObjectViewController.h" +#import "GormDocument.h" @implementation GormObjectViewController +- (GormDocument *) document +{ + return _document; +} + +- (void) setDocument: (GormDocument *)document +{ + ASSIGN(_document, document); +} + - (IBAction) iconView: (id)sender { + NSLog(@"Called %@", NSStringFromSelector(_cmd)); } - (IBAction) outlineView: (id)sender { + NSLog(@"Called %@", NSStringFromSelector(_cmd)); +} + +- (void) resetDisplayView: (NSView *)view +{ + [displayView setContentView: view]; + NSLog(@"displayView = %@", view); } @end From 77497d00ff5601c6c4d1ae81bdd656d6e1ebee11 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Fri, 27 Dec 2024 08:19:32 -0500 Subject: [PATCH 08/14] Update GormDocument and GormObjectOutlineView files --- .../English.lproj/GormDocument.gorm/data.info | Bin 184 -> 184 bytes .../GormDocument.gorm/objects.gorm | Bin 13934 -> 16038 bytes .../GormObjectOutlineView.gorm/objects.gorm | Bin 6330 -> 6330 bytes GormCore/GormDocument.m | 4 +++- 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/GormCore/English.lproj/GormDocument.gorm/data.info b/GormCore/English.lproj/GormDocument.gorm/data.info index 6cfa7dce70ded4f15aba0c694ad0bfdeba4f7770..70a46922b39d56c6923e7127e1efdd8450eeeb95 100644 GIT binary patch delta 37 scmdnNxPwvL-7mDbB(*>xu_!qsvn!^HGJ0Od&wHvj+t delta 37 rcmdnNxPwvL-7mDbB(*>xu_!qsvnFT1bLPC}%(=58V~1u+ZXuQ~P8`kL=W@=E?C9UYuLXdg{=)<~J0`pl zjw#Er*wT^ISmy9>K37U-a&D0^W;-@pGL|}U_*L#i34b%jZKsJv$5OYJOXhalI7W~vqU~X9DvZ|w6Tt{)NSreA)lL6 zWGyBiXO-UG=$`LMh_Ps50|C9!#4+v-6=?EinqkXEJ%9n}4QD*0w|`mzyxD1IEn}(M zGwv(~>~muQNfZ@)XrPWHHt5=xZTS+ds8o21)4`T%)ejbn>En`=6J@PqDgRH>nk5xx z@m8l(8Y?wX%xAMk?angk7YC)odaPTV<*W_Dz}KM~ z@G%@kam9ye9?fL(>}2uKg0irRXyYBE7FN+t#-mP`^r&GsD`kl=-dSyxs$&(t)L9{? z_CZqo-K10&sVKtIMe6_4Zo_>436JQhd4NczQt>IwgErrkjWsNz72DDgY`)xC$vQoA z4Ck}u=^Tc!<}O-uL`H10@)p2Ek-6G;^me1+4^x;zp$xoO0@r#j~J zuw|HVkCpai-0Y+`Y&*R&4hAPmnS9P0vlw4V9Gf-AW_uJIH&%Feb%h*kudirJt6i(r z_SK|E=2MD~?BhfiLDAZqDkm$v$5|zl0@RzAdAy17URrCHT9(vq7p2oNmS)q;MM51$ zO3mVb5lOay(Fx}ARrFMgeySyc+2d@6mGI0oUrqC*EJ<}m1kdG>pi7`5>803F&{FBT z#(`f_T_t+ODt;+F->vC)N7!sF!Lxm!Lh>C1zhj`PrL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_O?x(Y*e#cyBZ>7%;^6vw3_^$!@&Z}Xli|WHA$87bss>hgW zLrO6fL+ay9Ekf#PrWPahkrH-Tg2a1?Sc=3G+}3UuIPYz%rTeA z$nl4l$6O)2`XNa%O&^~^)(&QU!ZACARsYUBiIeQ`aH&KEh@-5+5XD4IBEn zW3Cm+y2ttd%7c#i9CMww4TYcyabeWGZqm)-y!oeg#E$CMBmdLHzd`u*n;*h2-|KwH zu*XKU$s?OKA@NlrHY4$jdIYI0NPUxDU5~_PiP(z7=ZHuk@dYBb@ld|ynEsVeJuWlT ze1X|9w=>f-j(MY)rDw)Wk?!<6<__d}hD?8%@aTDDG+j)m@>7KoHMiG)R ztR5V*3+?+5+1Kr16zvpN-8MffD71W+eFNQH5B>>E@b6XRLzTWRoeJ*FNbYpZ-Cp7; zbEo=%WA5>8pwkWAIYVw*>>cwa;l%;&72c&`T3>2~y#9?G$J~bl_$UqFW+a{?;^jzO zBH|Wr>rIL;AQm;hnMfCzwcYEv-R~++IGR?aE$Af^l zN4Q>a%zK4PUs)wk@oPFR-;Q}7ihcwm(=qQy>f1~mN05+m%o8$HJywp7=4I_hn9|te jS?+NXsZXkBQOXEXU*UJ7NPSHyeCK*w$a_t7Mcw*6e=@4F diff --git a/GormCore/English.lproj/GormObjectOutlineView.gorm/objects.gorm b/GormCore/English.lproj/GormObjectOutlineView.gorm/objects.gorm index fe7e0a69b78eff8de01068f8c02049f235b703a2..2b6db9d36061e69af90ce7e14ccf3274b744e38f 100644 GIT binary patch delta 111 zcmdmGxXW;ZBNO9+$%5<>lcSi-8F@BOVw%A;`GJ7`=1A5Fj3_cz>;>FFfxm1rlNSha ri63A90VWV+WMc3F^B5R}CchBUVoGiRD>D%01TptBif#@N&SC`sz1jXv=IV<)8ZlJ(lHkru_ rgt){N7(jpt1R0qayudslG5Lj%7E{s#urdQ-P7rfHqv+-U;Vf1FKl2-5 diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index 2fa20499..cdf803fc 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -381,7 +381,9 @@ static NSImage *fileImage = nil; [objectsView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable]; [scrollView setDocumentView: objectsView]; - RELEASE(objectsView); + RELEASE(objectsView); + [[objectViewController view] setAutoresizingMask: + NSViewHeightSizable|NSViewWidthSizable]; [objectViewController resetDisplayView: scrollView]; // images... From 226d5d306718621e08462c651c2ab2fbd8ca3832 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Fri, 27 Dec 2024 21:49:16 -0500 Subject: [PATCH 09/14] Update controller / document. Add outlineView --- GormCore/GormDocument.m | 12 ++++++++++- GormCore/GormObjectViewController.h | 8 ++++++++ GormCore/GormObjectViewController.m | 32 +++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index cdf803fc..0b243263 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -327,7 +327,8 @@ static NSImage *fileImage = nil; NSMenu *mainMenu = nil; NSEnumerator *en = nil; id o = nil; - + NSOutlineView *outlineView = [[NSOutlineView alloc] init]; + // get the window and cache it... window = (GormDocumentWindow *)[self _docWindow]; [IBResourceManager registerForAllPboardTypes:window @@ -382,6 +383,15 @@ static NSImage *fileImage = nil; NSViewHeightSizable|NSViewWidthSizable]; [scrollView setDocumentView: objectsView]; RELEASE(objectsView); + + [objectViewController setIconView: scrollView]; + RELEASE(scrollView); + + [objectViewController setOutlineView: outlineView]; + [outlineView setDataSource: self]; + [outlineView reloadData]; + RELEASE(outlineView); + [[objectViewController view] setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable]; [objectViewController resetDisplayView: scrollView]; diff --git a/GormCore/GormObjectViewController.h b/GormCore/GormObjectViewController.h index 19a7577a..63322a43 100644 --- a/GormCore/GormObjectViewController.h +++ b/GormCore/GormObjectViewController.h @@ -15,11 +15,19 @@ // Document GormDocument *_document; + id _iconView; + id _outlineView; } - (GormDocument *) document; - (void) setDocument: (GormDocument *)document; +- (id) iconView; +- (void) setIconView: (id)iconView; + +- (id) outlineView; +- (void) setOutlineView: (id)outlineView; + - (void) resetDisplayView: (NSView *)view; - (IBAction) iconView: (id)sender; diff --git a/GormCore/GormObjectViewController.m b/GormCore/GormObjectViewController.m index cee6ad54..b764ee5a 100644 --- a/GormCore/GormObjectViewController.m +++ b/GormCore/GormObjectViewController.m @@ -2,9 +2,19 @@ #import "GormObjectViewController.h" #import "GormDocument.h" +#import "GormObjectEditor.h" @implementation GormObjectViewController +- (void) dealloc +{ + RELEASE(_document); + RELEASE(_iconView); + RELEASE(_outlineView); + + [super dealloc]; +} + - (GormDocument *) document { return _document; @@ -15,14 +25,36 @@ ASSIGN(_document, document); } +- (id) iconView +{ + return _iconView; +} + +- (void) setIconView: (id)iconView +{ + ASSIGN(_iconView, iconView); +} + +- (id) outlineView +{ + return _outlineView; +} + +- (void) setOutlineView: (id)outlineView +{ + ASSIGN(_outlineView, outlineView); +} + - (IBAction) iconView: (id)sender { NSLog(@"Called %@", NSStringFromSelector(_cmd)); + [self resetDisplayView: _iconView]; } - (IBAction) outlineView: (id)sender { NSLog(@"Called %@", NSStringFromSelector(_cmd)); + [self resetDisplayView: _outlineView]; } - (void) resetDisplayView: (NSView *)view From db124f0b94507834b1cf5bcd284b2b249db2c48e Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sat, 28 Dec 2024 03:05:10 -0500 Subject: [PATCH 10/14] Display data from outline view --- GormCore/GormDocument.m | 52 ++++++++++++++++++++--------- GormCore/GormObjectViewController.m | 1 + 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index 0b243263..9358c720 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -363,6 +363,17 @@ static NSImage *fileImage = nil; object: window]; // objects... + NSTableColumn *tb = [[NSTableColumn alloc] initWithIdentifier: @"object"]; + NSScrollView *outlineScrollView = [[NSScrollView alloc] initWithFrame: scrollRect]; + + [tb setTitle: @"Object"]; + [outlineView addTableColumn: tb]; + [outlineScrollView setHasVerticalScroller: YES]; + [outlineScrollView setHasHorizontalScroller: YES]; + [outlineScrollView setAutoresizingMask: + NSViewHeightSizable|NSViewWidthSizable]; + [outlineScrollView setBorderType: NSBezelBorder]; + mainRect.origin = NSMakePoint(0,0); scrollView = [[NSScrollView alloc] initWithFrame: scrollRect]; [scrollView setHasVerticalScroller: YES]; @@ -386,8 +397,9 @@ static NSImage *fileImage = nil; [objectViewController setIconView: scrollView]; RELEASE(scrollView); - - [objectViewController setOutlineView: outlineView]; + + [outlineScrollView setDocumentView: outlineView]; + [objectViewController setOutlineView: outlineScrollView]; [outlineView setDataSource: self]; [outlineView reloadData]; RELEASE(outlineView); @@ -3936,58 +3948,68 @@ willBeInsertedIntoToolbar: (BOOL)flag child: (NSInteger)index ofItem: (id)item { + id result = nil; + + NSLog(@"index = %ld, item = %@", index, item); if (item == nil) { - return [[topLevelObjects allObjects] objectAtIndex: index]; + result = [[topLevelObjects allObjects] objectAtIndex: index]; } else if ([item isKindOfClass: [NSWindow class]]) { - return [item contentView]; + result = [item contentView]; } else if ([item isKindOfClass: [NSView class]]) { - return [[item subviews] objectAtIndex: index]; + result = [[item subviews] objectAtIndex: index]; } - - return nil; + NSLog(@"result = %@", result); + + return result; } - (BOOL) outlineView: (NSOutlineView *)ov isItemExpandable: (id)item { + BOOL f = NO; + if (item == nil) { - return [topLevelObjects count] > 0; + f = [topLevelObjects count] > 0; } else if ([item isKindOfClass: [NSWindow class]]) { - return [item contentView] != nil; + f = [item contentView] != nil; } else if ([item isKindOfClass: [NSView class]]) { - return [[item subviews] count] > 0; + f = [[item subviews] count] > 0; } - return NO; + NSLog(@"f = %d",f); + return f; } - (NSInteger) outlineView: (NSOutlineView *)ov numberOfChildrenOfItem: (id)item { + NSInteger c = 0; + if (item == nil) { - return [topLevelObjects count]; + c = [topLevelObjects count]; } else if ([item isKindOfClass: [NSWindow class]]) { - return 1; // We are only counting the contentView... + c = 1; // We are only counting the contentView... } else if ([item isKindOfClass: [NSView class]]) { - return [[item subviews] count]; + c = [[item subviews] count]; } - return 0; + NSLog(@"c = %ld", c); + return c; } - (id) outlineView: (NSOutlineView *)ov diff --git a/GormCore/GormObjectViewController.m b/GormCore/GormObjectViewController.m index b764ee5a..1a7d3fea 100644 --- a/GormCore/GormObjectViewController.m +++ b/GormCore/GormObjectViewController.m @@ -54,6 +54,7 @@ - (IBAction) outlineView: (id)sender { NSLog(@"Called %@", NSStringFromSelector(_cmd)); + [[_outlineView documentView] reloadData]; [self resetDisplayView: _outlineView]; } From ffa7cf75e5680c1a58c01d40b31f2fb039872f4c Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sun, 29 Dec 2024 01:19:38 -0500 Subject: [PATCH 11/14] Add columns to the outline view for objects --- GormCore/GormDocument.m | 47 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index 9358c720..f6e9046d 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -363,11 +363,16 @@ static NSImage *fileImage = nil; object: window]; // objects... - NSTableColumn *tb = [[NSTableColumn alloc] initWithIdentifier: @"object"]; NSScrollView *outlineScrollView = [[NSScrollView alloc] initWithFrame: scrollRect]; + NSTableColumn *tbo = [[NSTableColumn alloc] initWithIdentifier: @"objects"]; + NSTableColumn *tbc = [[NSTableColumn alloc] initWithIdentifier: @"connections"]; - [tb setTitle: @"Object"]; - [outlineView addTableColumn: tb]; + [tbo setTitle: @"Objects"]; + [tbc setTitle: @"Connections"]; + [outlineView setDrawsGrid: NO]; + [outlineView setOutlineTableColumn: tbo]; + [outlineView addTableColumn: tbo]; + [outlineView addTableColumn: tbc]; [outlineScrollView setHasVerticalScroller: YES]; [outlineScrollView setHasHorizontalScroller: YES]; [outlineScrollView setAutoresizingMask: @@ -3811,24 +3816,6 @@ static void _real_close(GormDocument *self, } } - /* - NSLog(@"Checking connections..."); // %@", connections); - en = [connections objectEnumerator]; - o = nil; - while ((o = [en nextObject]) != nil) - { - id src = [o source]; - id dst = [o destination]; - NSString *label = [o label]; - - if ([o isKindOfClass: [NSNibControlConnector class]]) - { - } - else if ([o isKindOfClass: [NSNibOutletConnector class]]) - { - } - } - */ return results; } @@ -4016,12 +4003,24 @@ willBeInsertedIntoToolbar: (BOOL)flag objectValueForTableColumn: (NSTableColumn *)tableColumn byItem: (id)item { - if (item == nil) + id value = nil; + + if ([[tableColumn identifier] isEqualToString: @"objects"]) + { + if (item == nil) + { + value = @"Objects"; + } + else + { + value = [self nameForObject: item]; + } + } + else if ([[tableColumn identifier] isEqualToString: @"connections"]) { - return @"Objects"; } - return [self nameForObject: item]; + return value; } // Other methods... From faa7726c9129a473568c066b1e6cee90c93d1d14 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sun, 29 Dec 2024 01:50:30 -0500 Subject: [PATCH 12/14] Update objects, turn off editors when refreshing the outlineview --- GormCore/GormDocument.m | 3 +++ GormCore/GormObjectViewController.m | 2 ++ 2 files changed, 5 insertions(+) diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index f6e9046d..6e44f787 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -406,7 +406,10 @@ static NSImage *fileImage = nil; [outlineScrollView setDocumentView: outlineView]; [objectViewController setOutlineView: outlineScrollView]; [outlineView setDataSource: self]; + [self deactivateEditors]; [outlineView reloadData]; + [self reactivateEditors]; + RELEASE(outlineView); [[objectViewController view] setAutoresizingMask: diff --git a/GormCore/GormObjectViewController.m b/GormCore/GormObjectViewController.m index 1a7d3fea..7143b710 100644 --- a/GormCore/GormObjectViewController.m +++ b/GormCore/GormObjectViewController.m @@ -54,7 +54,9 @@ - (IBAction) outlineView: (id)sender { NSLog(@"Called %@", NSStringFromSelector(_cmd)); + [_document deactivateEditors]; [[_outlineView documentView] reloadData]; + [_document reactivateEditors]; [self resetDisplayView: _outlineView]; } From 294c88427a55fbdbc978c0d743b42b9345323054 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sun, 29 Dec 2024 06:10:10 -0500 Subject: [PATCH 13/14] Add items to recurse down in outline view datasource --- GormCore/GormDocument.m | 51 +++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index 6e44f787..b169ecb5 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -2647,6 +2647,9 @@ static void _real_close(GormDocument *self, */ - (void) touch { + [self deactivateEditors]; + [[[objectViewController outlineView] documentView] reloadData]; + [self reactivateEditors]; [self updateChangeCount: NSChangeDone]; } @@ -3939,7 +3942,8 @@ willBeInsertedIntoToolbar: (BOOL)flag ofItem: (id)item { id result = nil; - + + [self deactivateEditors]; NSLog(@"index = %ld, item = %@", index, item); if (item == nil) { @@ -3953,7 +3957,16 @@ willBeInsertedIntoToolbar: (BOOL)flag { result = [[item subviews] objectAtIndex: index]; } + else if ([item isKindOfClass: [NSMenu class]]) + { + result = [item itemAtIndex: index]; + } + else if ([item isKindOfClass: [NSMenuItem class]]) + { + result = [item submenu]; + } NSLog(@"result = %@", result); + [self reactivateEditors]; return result; } @@ -3963,6 +3976,7 @@ willBeInsertedIntoToolbar: (BOOL)flag { BOOL f = NO; + [self deactivateEditors]; if (item == nil) { f = [topLevelObjects count] > 0; @@ -3974,7 +3988,16 @@ willBeInsertedIntoToolbar: (BOOL)flag else if ([item isKindOfClass: [NSView class]]) { f = [[item subviews] count] > 0; + } + else if ([item isKindOfClass: [NSMenu class]]) + { + f = [item numberOfItems] > 0; } + else if ([item isKindOfClass: [NSMenuItem class]]) + { + f = [item hasSubmenu]; + } + [self reactivateEditors]; NSLog(@"f = %d",f); return f; @@ -3985,6 +4008,7 @@ willBeInsertedIntoToolbar: (BOOL)flag { NSInteger c = 0; + [self deactivateEditors]; if (item == nil) { c = [topLevelObjects count]; @@ -3997,6 +4021,15 @@ willBeInsertedIntoToolbar: (BOOL)flag { c = [[item subviews] count]; } + else if ([item isKindOfClass: [NSMenu class]]) + { + c = [item numberOfItems]; + } + else if ([item isKindOfClass: [NSMenuItem class]]) + { + c = 1; // one submenu... + } + [self reactivateEditors]; NSLog(@"c = %ld", c); return c; @@ -4008,21 +4041,19 @@ willBeInsertedIntoToolbar: (BOOL)flag { id value = nil; + [self deactivateEditors]; if ([[tableColumn identifier] isEqualToString: @"objects"]) { - if (item == nil) - { - value = @"Objects"; - } - else - { - value = [self nameForObject: item]; - } + NSString *className = [classManager classNameForObject: item]; + NSString *name = [self nameForObject: item]; + + value = [NSString stringWithFormat: @"%@ - %@", (name != nil)?name:@"", className]; } else if ([[tableColumn identifier] isEqualToString: @"connections"]) { } - + [self reactivateEditors]; + return value; } From 323e94d0f8c57ee1e1a897c9a5675412b176af91 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sun, 29 Dec 2024 10:19:17 -0500 Subject: [PATCH 14/14] Update columns --- ChangeLog | 17 +++++++++++ GormCore/GormDocument.m | 62 +++++++++++++++++++++++++++++++++-------- 2 files changed, 67 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index becbc30e..f6166bfe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2024-12-29 Gregory John Casamento + + * GormCore/English.lproj/GormObjectOutlineView.gorm/data.classes + * GormCore/GNUmakefile + * GormCore/GormDocument.h + * GormCore/GormDocument.m + * GormCore/GormGenericEditor.h + * GormCore/GormObjectEditor.h + * GormCore/GormObjectEditor.m + * GormCore/GormObjectMainView.h + * GormCore/GormObjectMainView.m + * GormCore/GormObjectOutlineView.h + * GormCore/GormObjectOutlineView.m + * GormCore/GormObjectViewController.h + * GormCore/GormObjectViewController.m: Add support for + outline view of objects. + 2024-12-25 Gregory John Casamento * GormObjCHeaderParser/OCClass.m: Improve parsing diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index b169ecb5..702e19ab 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -364,21 +364,34 @@ static NSImage *fileImage = nil; // objects... NSScrollView *outlineScrollView = [[NSScrollView alloc] initWithFrame: scrollRect]; - NSTableColumn *tbo = [[NSTableColumn alloc] initWithIdentifier: @"objects"]; - NSTableColumn *tbc = [[NSTableColumn alloc] initWithIdentifier: @"connections"]; + NSTableColumn *tbo = AUTORELEASE([[NSTableColumn alloc] initWithIdentifier: @"objects"]); + NSTableColumn *tbc = AUTORELEASE([[NSTableColumn alloc] initWithIdentifier: @"destination"]); + NSTableColumn *tbs = AUTORELEASE([[NSTableColumn alloc] initWithIdentifier: @"source"]); + NSTableColumn *tbcl = AUTORELEASE([[NSTableColumn alloc] initWithIdentifier: @"class"]); + NSTableColumn *tbv = AUTORELEASE([[NSTableColumn alloc] initWithIdentifier: @"version"]); + // Titles [tbo setTitle: @"Objects"]; - [tbc setTitle: @"Connections"]; + [tbc setTitle: @"Destination"]; + [tbs setTitle: @"Source"]; + [tbcl setTitle: @"Class"]; + [tbv setTitle: @"Version"]; + + // Set up the outline view... [outlineView setDrawsGrid: NO]; [outlineView setOutlineTableColumn: tbo]; [outlineView addTableColumn: tbo]; + [outlineView addTableColumn: tbcl]; + [outlineView addTableColumn: tbv]; [outlineView addTableColumn: tbc]; + [outlineView addTableColumn: tbs]; [outlineScrollView setHasVerticalScroller: YES]; [outlineScrollView setHasHorizontalScroller: YES]; [outlineScrollView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable]; [outlineScrollView setBorderType: NSBezelBorder]; + // Configure the scrollview... mainRect.origin = NSMakePoint(0,0); scrollView = [[NSScrollView alloc] initWithFrame: scrollRect]; [scrollView setHasVerticalScroller: YES]; @@ -390,7 +403,7 @@ static NSImage *fileImage = nil; objectViewController = [[GormObjectViewController alloc] initWithNibName: @"GormObjectOutlineView" bundle: [NSBundle bundleForClass: [self class]]]; [objectViewController setDocument: self]; - NSLog(@"objectViewController = %@, view = %@", objectViewController, [objectViewController view]); + NSDebugLog(@"objectViewController = %@, view = %@", objectViewController, [objectViewController view]); objectsView = [[GormObjectEditor alloc] initWithObject: nil inDocument: self]; @@ -3944,7 +3957,7 @@ willBeInsertedIntoToolbar: (BOOL)flag id result = nil; [self deactivateEditors]; - NSLog(@"index = %ld, item = %@", index, item); + NSDebugLog(@"index = %ld, item = %@", index, item); if (item == nil) { result = [[topLevelObjects allObjects] objectAtIndex: index]; @@ -3965,7 +3978,7 @@ willBeInsertedIntoToolbar: (BOOL)flag { result = [item submenu]; } - NSLog(@"result = %@", result); + NSDebugLog(@"result = %@", result); [self reactivateEditors]; return result; @@ -3999,7 +4012,7 @@ willBeInsertedIntoToolbar: (BOOL)flag } [self reactivateEditors]; - NSLog(@"f = %d",f); + NSDebugLog(@"f = %d",f); return f; } @@ -4031,7 +4044,7 @@ willBeInsertedIntoToolbar: (BOOL)flag } [self reactivateEditors]; - NSLog(@"c = %ld", c); + NSDebugLog(@"c = %ld", c); return c; } @@ -4040,17 +4053,42 @@ willBeInsertedIntoToolbar: (BOOL)flag byItem: (id)item { id value = nil; + NSString *className = [classManager classNameForObject: item]; + NSString *name = [self nameForObject: item]; + NSUInteger version = 0; [self deactivateEditors]; if ([[tableColumn identifier] isEqualToString: @"objects"]) { - NSString *className = [classManager classNameForObject: item]; - NSString *name = [self nameForObject: item]; + NSString *title = @""; - value = [NSString stringWithFormat: @"%@ - %@", (name != nil)?name:@"", className]; + if ([item respondsToSelector: @selector(title)]) + { + title = [item title]; + value = [NSString stringWithFormat: @"%@ : %@", title, (name != nil)?name:@"*Unnamed*"]; + } + else + { + value = [NSString stringWithFormat: @"%@", (name != nil)?name:@"*Unnamed*"]; + } } - else if ([[tableColumn identifier] isEqualToString: @"connections"]) + else if ([[tableColumn identifier] isEqualToString: @"class"]) { + value = className; + } + else if ([[tableColumn identifier] isEqualToString: @"version"]) + { + value = [NSNumber numberWithInteger: version]; + } + else if ([[tableColumn identifier] isEqualToString: @"destination"]) + { + NSArray *c = [self connectorsForDestination: item]; + value = [NSNumber numberWithInteger: [c count]]; + } + else if ([[tableColumn identifier] isEqualToString: @"source"]) + { + NSArray *c = [self connectorsForSource: item]; + value = [NSNumber numberWithInteger: [c count]]; } [self reactivateEditors];