mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-23 06:20:47 +00:00
Update to correct version
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@5415 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9c7576925d
commit
2d0fe9b5c2
13 changed files with 1081 additions and 470 deletions
|
@ -1,6 +0,0 @@
|
|||
Sat Nov 27 05:25:15 1999 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* KeyboardInput-test/KeyboardInput-test.m ([inputTestView
|
||||
-drawRect:]): Fixed bug.
|
||||
* KeyboardInput-test/KeyboardInput-test.m ([KeyboardInputTest
|
||||
-init]): Moved typing view to top.
|
|
@ -62,10 +62,10 @@ Gorm_HEADERS = \
|
|||
Gorm_OBJC_FILES = \
|
||||
Gorm.m \
|
||||
GormDocument.m \
|
||||
GormEditors.m \
|
||||
IBInspector.m \
|
||||
IBPalette.m \
|
||||
InfoPanel.m \
|
||||
GormObjectEditor.m \
|
||||
GormInspectorsManager.m \
|
||||
GormPalettesManager.m \
|
||||
GormResourcesManager.m
|
||||
|
|
100
Gorm.h
100
Gorm.h
|
@ -1,3 +1,27 @@
|
|||
/* Gorm.h
|
||||
*
|
||||
* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
|
||||
* Date: 1999
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef GORM_H
|
||||
#define GORM_H
|
||||
|
||||
|
@ -38,6 +62,10 @@ extern NSString *IBWindowPboardType;
|
|||
extern NSString *IBAttributesChangedNotification;
|
||||
extern NSString *IBInspectorDidModifyObjectNotification;
|
||||
extern NSString *IBSelectionChangedNotification;
|
||||
extern NSString *IBDidOpenDocumentNotification;
|
||||
extern NSString *IBWillSaveDocumentNotification;
|
||||
extern NSString *IBDidSaveDocumentNotification;
|
||||
extern NSString *IBWillCloseDocumentNotification;
|
||||
extern NSString *IBWillBeginTestingInterfaceNotification;
|
||||
extern NSString *IBDidBeginTestingInterfaceNotification;
|
||||
extern NSString *IBWillEndTestingInterfaceNotification;
|
||||
|
@ -61,6 +89,37 @@ extern NSString *IBDidEndTestingInterfaceNotification;
|
|||
- (void) setSource: (id)anObject;
|
||||
@end
|
||||
|
||||
@interface NSObject (IBEditorSpecification)
|
||||
- (NSString*) editorClassName;
|
||||
@end
|
||||
|
||||
@protocol IBSelectionOwners <NSObject>
|
||||
- (unsigned) selectionCount;
|
||||
- (NSArray*) selection;
|
||||
- (void) drawSelection;
|
||||
@end
|
||||
|
||||
@protocol IBEditors <IBSelectionOwners>
|
||||
- (BOOL) acceptsTypeFromArray: (NSArray*)types;
|
||||
- (BOOL) activate;
|
||||
- (id) initWithObject: (id)anObject inDocument: (id/*<IBDocuments>*/)aDocument;
|
||||
- (void) close;
|
||||
- (void) closeSubeditors;
|
||||
- (void) copySelection;
|
||||
- (void) deleteSelection;
|
||||
- (id /*<IBDocuments>*/) document;
|
||||
- (id) editedObject;
|
||||
- (void) makeSelectionVisible: (BOOL)flag;
|
||||
- (id<IBEditors>) openSubeditorForObject: (id)anObject;
|
||||
- (void) orderFront;
|
||||
- (void) pasteInSelection;
|
||||
- (void) resetObject: (id)anObject;
|
||||
- (void) selectObjects: (NSArray*)objects;
|
||||
- (void) validateEditing;
|
||||
- (BOOL) wantsSelection;
|
||||
- (NSWindow*) window;
|
||||
@end
|
||||
|
||||
@protocol IBDocuments <NSObject>
|
||||
- (void) addConnector: (id<IBConnectors>)aConnector;
|
||||
- (NSArray*) allConnectors;
|
||||
|
@ -85,23 +144,27 @@ extern NSString *IBDidEndTestingInterfaceNotification;
|
|||
- (NSString*) documentPath;
|
||||
- (BOOL) documentShouldClose;
|
||||
- (void) documentWillClose;
|
||||
- (void) editor: (id<IBEditors>)anEditor didCloseForObject: (id)anObject;
|
||||
- (id<IBEditors>) editorForObject: (id)anObject
|
||||
create: (BOOL)flag;
|
||||
- (id<IBEditors>) editorForObject: (id)anObject
|
||||
inEditor: (id<IBEditors>)anEditor
|
||||
create: (BOOL)flag;
|
||||
- (NSString*) nameForObject: (id)anObject;
|
||||
- (NSArray*) objects;
|
||||
- (id<IBEditors>) openEditorForObject: (id)anObject;
|
||||
- (id<IBEditors>) parentEditorForEditor: (id<IBEditors>)anEditor;
|
||||
- (id) parentOfObject: (id)anObject;
|
||||
- (NSArray*) pasteType: (NSString*)aType
|
||||
fromPasteboard: (NSPasteboard*)aPasteboard
|
||||
parent: (id)parent;
|
||||
- (void) removeConnector: (id<IBConnectors>)aConnector;
|
||||
- (void) resignSelectionForEditor: (id<IBEditors>)editor;
|
||||
- (void) setName: (NSString*)aName forObject: (id)object;
|
||||
- (void) setSelectionFromEditor: (id<IBEditors>)anEditor;
|
||||
- (void) touch; /* Mark document as having been changed. */
|
||||
@end
|
||||
|
||||
@protocol IBSelectionOwners <NSObject>
|
||||
- (unsigned) selectionCount;
|
||||
- (NSArray*) selection;
|
||||
- (void) drawSelection;
|
||||
@end
|
||||
|
||||
@protocol IB <NSObject>
|
||||
- (id<IBDocuments>) activeDocument;
|
||||
- (BOOL) isTestingInterface;
|
||||
|
@ -177,29 +240,4 @@ extern NSString *IBDidEndTestingInterfaceNotification;
|
|||
- (NSWindow*) window;
|
||||
@end
|
||||
|
||||
@interface NSObject (IBEditorSpecification)
|
||||
- (NSString*) editorClassName;
|
||||
@end
|
||||
|
||||
@protocol IBEditors <IBSelectionOwners>
|
||||
- (BOOL) acceptsTypeFromArray: (NSArray*)types;
|
||||
- (BOOL) activate;
|
||||
- (id) initWithObject: (id)anObject inDocument: (id<IBDocuments>)aDocument;
|
||||
- (void) close;
|
||||
- (void) closeSubeditors;
|
||||
- (void) copySelection;
|
||||
- (void) deleteSelection;
|
||||
- (id<IBDocuments>) document;
|
||||
- (id) editedObject;
|
||||
- (void) makeSelectionVisible: (BOOL)flag;
|
||||
- (id<IBEditors>) openSubeditorForObject: (id)anObject;
|
||||
- (void) orderFront;
|
||||
- (void) pasteInSelection;
|
||||
- (void) resetObject: (id)anObject;
|
||||
- (void) selectObjects: (NSArray*)objects;
|
||||
- (void) validateEditing;
|
||||
- (BOOL) wantsSelection;
|
||||
- (NSWindow*) window;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
41
Gorm.m
41
Gorm.m
|
@ -30,7 +30,7 @@
|
|||
|
||||
- (id<IBDocuments>) activeDocument
|
||||
{
|
||||
return (id<IBDocuments>)[documents lastObject];
|
||||
return activeDocument;
|
||||
}
|
||||
|
||||
- (BOOL) applicationShouldTerminate: (NSApplication*)sender
|
||||
|
@ -85,6 +85,28 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) handleNotification: (NSNotification*)notification
|
||||
{
|
||||
NSString *name = [notification name];
|
||||
id obj = [notification object];
|
||||
|
||||
if ([name isEqual: IBSelectionChangedNotification])
|
||||
{
|
||||
selectionOwner = [notification object];
|
||||
[[self inspectorsManager] updateSelection];
|
||||
}
|
||||
else if ([name isEqual: IBWillCloseDocumentNotification])
|
||||
{
|
||||
RETAIN(obj);
|
||||
[documents removeObjectIdenticalTo: obj];
|
||||
AUTORELEASE(obj);
|
||||
if (obj == (id)activeDocument)
|
||||
{
|
||||
activeDocument = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
|
@ -94,9 +116,13 @@
|
|||
|
||||
documents = [NSMutableArray new];
|
||||
[nc addObserver: self
|
||||
selector: @selector(selectionChanged:)
|
||||
selector: @selector(handleNotification:)
|
||||
name: IBSelectionChangedNotification
|
||||
object: nil];
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: IBWillCloseDocumentNotification
|
||||
object: nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -116,6 +142,7 @@
|
|||
|
||||
[documents addObject: doc];
|
||||
[doc setDocumentActive: YES];
|
||||
activeDocument = doc;
|
||||
RELEASE(doc);
|
||||
return doc;
|
||||
}
|
||||
|
@ -134,6 +161,7 @@
|
|||
else
|
||||
{
|
||||
[doc setDocumentActive: YES];
|
||||
activeDocument = doc;
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
@ -176,17 +204,12 @@
|
|||
|
||||
- (id) saveAsDocument: (id)sender
|
||||
{
|
||||
return [[documents lastObject] saveAsDocument: sender];
|
||||
return [(id)activeDocument saveAsDocument: sender];
|
||||
}
|
||||
|
||||
- (id) saveDocument: (id)sender
|
||||
{
|
||||
return [[documents lastObject] saveDocument: sender];
|
||||
}
|
||||
|
||||
- (void) selectionChanged: (NSNotification*)notification
|
||||
{
|
||||
selectionOwner = [notification object];
|
||||
return [(id)activeDocument saveDocument: sender];
|
||||
}
|
||||
|
||||
- (id<IBSelectionOwners>) selectionOwner
|
||||
|
|
|
@ -24,6 +24,11 @@
|
|||
|
||||
#include "GormPrivate.h"
|
||||
|
||||
NSString *IBDidOpenDocumentNotification = @"IBDidOpenDocumentNotification";
|
||||
NSString *IBWillSaveDocumentNotification = @"IBWillSaveDocumentNotification";
|
||||
NSString *IBDidSaveDocumentNotification = @"IBDidSaveDocumentNotification";
|
||||
NSString *IBWillCloseDocumentNotification = @"IBWillCloseDocumentNotification";
|
||||
|
||||
/*
|
||||
* A private connector for child->parent relationships.
|
||||
*/
|
||||
|
@ -268,13 +273,17 @@
|
|||
|
||||
- (void) documentWillClose
|
||||
{
|
||||
NSEnumerator *enumerator = [nameTable objectEnumerator];
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
Class winClass = [NSWindow class];
|
||||
NSEnumerator *enumerator;
|
||||
id obj;
|
||||
|
||||
[nc postNotificationName: IBWillCloseDocumentNotification
|
||||
object: self];
|
||||
/*
|
||||
* Close all open windows in this document befoew we go away.
|
||||
*/
|
||||
enumerator = [nameTable objectEnumerator];
|
||||
while ((obj = [enumerator nextObject]) != nil)
|
||||
{
|
||||
if ([obj isKindOfClass: winClass] == YES)
|
||||
|
@ -286,6 +295,27 @@
|
|||
[self setDocumentActive: NO];
|
||||
}
|
||||
|
||||
- (void) editor: (id<IBEditors>)anEditor didCloseForObject: (id)anObject
|
||||
{
|
||||
/* FIXME */
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (id<IBEditors>) editorForObject: (id)anObject
|
||||
create: (BOOL)flag
|
||||
{
|
||||
return [self editorForObject: anObject inEditor: nil create: flag];
|
||||
}
|
||||
|
||||
- (id<IBEditors>) editorForObject: (id)anObject
|
||||
inEditor: (id<IBEditors>)anEditor
|
||||
create: (BOOL)flag
|
||||
{
|
||||
/* FIXME */
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
|
@ -398,6 +428,7 @@
|
|||
types: fileTypes];
|
||||
if (result == NSOKButton)
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSString *aFile = [oPanel filename];
|
||||
NSData *data;
|
||||
NSUnarchiver *u;
|
||||
|
@ -480,11 +511,27 @@
|
|||
*/
|
||||
ASSIGN(documentPath, aFile);
|
||||
[[resourcesManager window] setTitleWithRepresentedFilename: documentPath];
|
||||
[nc postNotificationName: IBDidOpenDocumentNotification
|
||||
object: self];
|
||||
return self;
|
||||
}
|
||||
return nil; /* Failed */
|
||||
}
|
||||
|
||||
- (id<IBEditors>) openEditorForObject: (id)anObject
|
||||
{
|
||||
/* FIXME */
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id<IBEditors>) parentEditorForEditor: (id<IBEditors>)anEditor
|
||||
{
|
||||
/* FIXME */
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) parentOfObject: (id)anObject
|
||||
{
|
||||
NSArray *old;
|
||||
|
@ -539,6 +586,12 @@
|
|||
[connections removeObjectIdenticalTo: aConnector];
|
||||
}
|
||||
|
||||
- (void) resignSelectionForEditor: (id<IBEditors>)editor
|
||||
{
|
||||
/* FIXME */
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (GormResourcesManager*) resourcesManager
|
||||
{
|
||||
return resourcesManager;
|
||||
|
@ -668,10 +721,16 @@
|
|||
|
||||
- (id) saveDocument: (id)sender
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if (documentPath == nil || [documentPath isEqualToString: @""])
|
||||
{
|
||||
return [self saveAsDocument: sender];
|
||||
}
|
||||
|
||||
[nc postNotificationName: IBWillSaveDocumentNotification
|
||||
object: self];
|
||||
|
||||
if ([NSArchiver archiveRootObject: self toFile: documentPath] == NO)
|
||||
{
|
||||
NSRunAlertPanel(NULL, @"Could not save document",
|
||||
|
@ -680,6 +739,9 @@
|
|||
}
|
||||
[[resourcesManager window] setDocumentEdited: NO];
|
||||
[[resourcesManager window] setTitleWithRepresentedFilename: documentPath];
|
||||
|
||||
[nc postNotificationName: IBWillSaveDocumentNotification
|
||||
object: self];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -713,6 +775,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) setSelectionFromEditor: (id<IBEditors>)anEditor
|
||||
{
|
||||
/* FIXME */
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) touch
|
||||
{
|
||||
[[resourcesManager window] setDocumentEdited: YES];
|
||||
|
|
|
@ -5,15 +5,17 @@
|
|||
{
|
||||
NSPanel *panel;
|
||||
NSMatrix *selectionView;
|
||||
NSBox *divider;
|
||||
NSView *inspectorView;
|
||||
NSArray *selection;
|
||||
NSButton *emptyView;
|
||||
NSButton *multipleView;
|
||||
NSView *buttonView;
|
||||
IBInspector *emptyInspector;
|
||||
IBInspector *multipleInspector;
|
||||
IBInspector *inspector;
|
||||
int current;
|
||||
}
|
||||
- (NSPanel*) panel;
|
||||
- (void) setCurrentInspector: (id)anObject;
|
||||
- (void) updateSelection;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,52 +27,166 @@
|
|||
@implementation NSObject (IBInspectorClassNames)
|
||||
- (NSString*) inspectorClassName
|
||||
{
|
||||
return @"GormObjectAttributesInspector";
|
||||
return @"GormObjectInspector";
|
||||
}
|
||||
|
||||
- (NSString*) connectInspectorClassName
|
||||
{
|
||||
return @"GormObjectConnectionsInspector";
|
||||
return @"GormObjectInspector";
|
||||
}
|
||||
|
||||
- (NSString*) sizeInspectorClassName
|
||||
{
|
||||
return @"GormObjectSizeInspector";
|
||||
return @"GormObjectInspector";
|
||||
}
|
||||
|
||||
- (NSString*) helpInspectorClassName
|
||||
{
|
||||
return @"GormObjectHelpInspector";
|
||||
return @"GormObjectInspector";
|
||||
}
|
||||
|
||||
- (NSString*) classInspectorClassName
|
||||
{
|
||||
return @"GormObjectClassInspector";
|
||||
return @"GormObjectInspector";
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The GormEmptyInspector is a placeholder for an empty selection.
|
||||
*/
|
||||
@interface GormEmptyInspector : IBInspector
|
||||
@end
|
||||
|
||||
@implementation GormEmptyInspector
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(window);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
NSView *contents;
|
||||
NSButton *button;
|
||||
|
||||
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, 272, 360)
|
||||
styleMask: NSBorderlessWindowMask
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
contents = [window contentView];
|
||||
button = [[NSButton alloc] initWithFrame: [contents bounds]];
|
||||
[button setAutoresizingMask:
|
||||
NSViewHeightSizable | NSViewWidthSizable];
|
||||
[button setStringValue: @"Empty Selection"];
|
||||
[button setBordered: NO];
|
||||
[contents addSubview: button];
|
||||
RELEASE(button);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The GormObjectInspector is a placeholder for any object without a
|
||||
* suitable inspector.
|
||||
*/
|
||||
@interface GormObjectInspector : IBInspector
|
||||
@end
|
||||
|
||||
@implementation GormObjectInspector
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(window);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
NSView *contents;
|
||||
NSButton *button;
|
||||
|
||||
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, 272, 360)
|
||||
styleMask: NSBorderlessWindowMask
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
contents = [window contentView];
|
||||
button = [[NSButton alloc] initWithFrame: [contents bounds]];
|
||||
[button setAutoresizingMask:
|
||||
NSViewHeightSizable | NSViewWidthSizable];
|
||||
[button setStringValue: @"Unknown object"];
|
||||
[button setBordered: NO];
|
||||
[contents addSubview: button];
|
||||
RELEASE(button);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The GormMultipleInspector is a placeholder for a multiple selection.
|
||||
*/
|
||||
@interface GormMultipleInspector : IBInspector
|
||||
@end
|
||||
|
||||
@implementation GormMultipleInspector
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(window);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
NSView *contents;
|
||||
NSButton *button;
|
||||
|
||||
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, 272, 360)
|
||||
styleMask: NSBorderlessWindowMask
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
contents = [window contentView];
|
||||
button = [[NSButton alloc] initWithFrame: [contents bounds]];
|
||||
[button setAutoresizingMask:
|
||||
NSViewHeightSizable | NSViewWidthSizable];
|
||||
[button setStringValue: @"Multiple Selection"];
|
||||
[button setBordered: NO];
|
||||
[contents addSubview: button];
|
||||
RELEASE(button);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation GormInspectorsManager
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
RELEASE(selectionView);
|
||||
RELEASE(inspectorView);
|
||||
RELEASE(emptyView);
|
||||
RELEASE(multipleView);
|
||||
RELEASE(emptyInspector);
|
||||
RELEASE(multipleInspector);
|
||||
RELEASE(panel);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSBox *box;
|
||||
NSCell *cell;
|
||||
NSRect contentRect = {{0, 0}, {272, 420}};
|
||||
NSRect selectionRect = {{0, 378}, {272, 52}};
|
||||
NSRect boxRect = {{0, 361}, {272, 2}};
|
||||
NSRect dividerRect = {{0, 361}, {272, 2}};
|
||||
NSRect inspectorRect = {{0, 0}, {272, 360}};
|
||||
unsigned int style = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
|
||||
|
||||
|
@ -80,12 +194,12 @@
|
|||
styleMask: style
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
box = [[NSBox alloc] initWithFrame: boxRect];
|
||||
[box setBorderType: NSLineBorder];
|
||||
[box setTitlePosition: NSNoTitle];
|
||||
[box setAutoresizingMask: NSViewWidthSizable|NSViewMinYMargin];
|
||||
[[panel contentView] addSubview: box];
|
||||
RELEASE(box);
|
||||
divider = [[NSBox alloc] initWithFrame: dividerRect];
|
||||
[divider setBorderType: NSLineBorder];
|
||||
[divider setTitlePosition: NSNoTitle];
|
||||
[divider setAutoresizingMask: NSViewWidthSizable|NSViewMinYMargin];
|
||||
[[panel contentView] addSubview: divider];
|
||||
RELEASE(divider);
|
||||
|
||||
[panel setTitle: @"Inspector"];
|
||||
[panel setMinSize: [panel frame].size];
|
||||
|
@ -122,22 +236,9 @@
|
|||
|
||||
current = -1;
|
||||
|
||||
emptyView = [[NSButton alloc] initWithFrame: inspectorRect];
|
||||
[emptyView setAutoresizingMask:
|
||||
NSViewHeightSizable | NSViewWidthSizable];
|
||||
[emptyView setStringValue: @"Empty Selection"];
|
||||
[emptyView setBordered: NO];
|
||||
emptyInspector = [GormEmptyInspector new];
|
||||
multipleInspector = [GormMultipleInspector new];
|
||||
|
||||
multipleView = [[NSButton alloc] initWithFrame: inspectorRect];
|
||||
[multipleView setAutoresizingMask:
|
||||
NSViewHeightSizable | NSViewWidthSizable];
|
||||
[multipleView setStringValue: @"Multiple Selection"];
|
||||
[multipleView setBordered: NO];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(selectionChanged:)
|
||||
name: IBSelectionChangedNotification
|
||||
object: nil];
|
||||
[self setCurrentInspector: 0];
|
||||
return self;
|
||||
}
|
||||
|
@ -147,35 +248,54 @@
|
|||
return panel;
|
||||
}
|
||||
|
||||
- (void) selectionChanged: (NSNotification*)notification
|
||||
- (void) updateSelection
|
||||
{
|
||||
[self setCurrentInspector: self];
|
||||
}
|
||||
|
||||
- (void) setCurrentInspector: (id)anObj
|
||||
{
|
||||
id<IBSelectionOwners> owner = [(id<IB>)NSApp selectionOwner];
|
||||
unsigned count = [owner selectionCount];
|
||||
NSArray *sub = [inspectorView subviews];
|
||||
IBInspector *newInspector = nil;
|
||||
NSView *newView = nil;
|
||||
NSArray *selection = [[(id<IB>)NSApp selectionOwner] selection];
|
||||
unsigned count = [selection count];
|
||||
id obj = [selection lastObject];
|
||||
NSView *newView = nil;
|
||||
|
||||
if (anObj != self)
|
||||
{
|
||||
current = [anObj selectedColumn];
|
||||
}
|
||||
NSLog(@"SetCurrentInspector: %d", current);
|
||||
|
||||
if (count == 0)
|
||||
/*
|
||||
* Set panel title for the type of object being inspected.
|
||||
*/
|
||||
if (obj == nil)
|
||||
{
|
||||
newView = emptyView;
|
||||
}
|
||||
else if (count > 1)
|
||||
{
|
||||
newView = multipleView;
|
||||
[panel setTitle: @"Inspector"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[panel setTitle: [NSString stringWithFormat: @"%@ Inspector",
|
||||
NSStringFromClass([obj class])]];
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the inspector view to its original window and release the old
|
||||
* inspector.
|
||||
*/
|
||||
[[inspector window] setContentView: [[inspectorView subviews] lastObject]];
|
||||
DESTROY(inspector);
|
||||
|
||||
if (count == 0 || count > 1)
|
||||
{
|
||||
inspector = RETAIN(emptyInspector);
|
||||
}
|
||||
else if (count > 1)
|
||||
{
|
||||
inspector = RETAIN(multipleInspector);
|
||||
}
|
||||
else
|
||||
{
|
||||
id obj = [[owner selection] lastObject];
|
||||
NSString *name;
|
||||
Class c;
|
||||
|
||||
|
@ -188,37 +308,86 @@
|
|||
default: name = [obj classInspectorClassName]; break;
|
||||
}
|
||||
c = NSClassFromString(name);
|
||||
if (inspector == nil || [inspector class] != c)
|
||||
{
|
||||
newInspector = [c new];
|
||||
newView = [[newInspector window] contentView];
|
||||
}
|
||||
else
|
||||
{
|
||||
newInspector = inspector;
|
||||
}
|
||||
inspector = [c new];
|
||||
}
|
||||
|
||||
if (newInspector != inspector)
|
||||
{
|
||||
if (inspector != nil)
|
||||
{
|
||||
[[inspector window] setContentView: [sub lastObject]];
|
||||
RELEASE((id)inspector);
|
||||
sub = [inspectorView subviews];
|
||||
}
|
||||
inspector = newInspector;
|
||||
}
|
||||
newView = [[inspector window] contentView];
|
||||
NSLog(@"NewView %@", newView);
|
||||
if (newView != nil)
|
||||
{
|
||||
if ([sub count] > 0)
|
||||
NSView *outer = [panel contentView];
|
||||
NSRect rect = [outer bounds];
|
||||
|
||||
if (buttonView != nil)
|
||||
{
|
||||
[inspectorView replaceSubview: [sub lastObject] with: newView];
|
||||
[buttonView removeFromSuperview];
|
||||
buttonView = nil;
|
||||
}
|
||||
|
||||
rect.size.height = [divider frame].origin.y;
|
||||
if ([inspector wantsButtons] == YES)
|
||||
{
|
||||
NSRect buttonsRect;
|
||||
NSRect bRect = NSMakeRect(0, 0, 60, 20);
|
||||
NSButton *ok;
|
||||
NSButton *revert;
|
||||
|
||||
buttonsRect = rect;
|
||||
buttonsRect.size.height = 40;
|
||||
rect.origin.y += 40;
|
||||
rect.size.height -= 40;
|
||||
|
||||
buttonView = [[NSView alloc] initWithFrame: buttonsRect];
|
||||
[buttonView setAutoresizingMask:
|
||||
NSViewHeightSizable | NSViewWidthSizable];
|
||||
[outer addSubview: buttonView];
|
||||
RELEASE(buttonView);
|
||||
|
||||
ok = [inspector okButton];
|
||||
if (ok == nil)
|
||||
{
|
||||
ok = AUTORELEASE([[NSButton alloc] initWithFrame: bRect]);
|
||||
[ok setAutoresizingMask: NSViewMaxYMargin | NSViewMinXMargin];
|
||||
[ok setTitle: @"Ok"];
|
||||
[ok setAction: @selector(ok:)];
|
||||
[ok setTarget: inspector];
|
||||
}
|
||||
revert = [inspector revertButton];
|
||||
if (revert == nil)
|
||||
{
|
||||
revert = AUTORELEASE([[NSButton alloc] initWithFrame: bRect]);
|
||||
[revert setAutoresizingMask: NSViewMaxYMargin | NSViewMinXMargin];
|
||||
[revert setTitle: @"Revert"];
|
||||
[revert setAction: @selector(revert:)];
|
||||
[revert setTarget: inspector];
|
||||
}
|
||||
|
||||
bRect = [ok frame];
|
||||
bRect.origin.y = 10;
|
||||
bRect.origin.x = buttonsRect.size.width - 10 - bRect.size.width;
|
||||
[ok setFrame: bRect];
|
||||
|
||||
bRect = [revert frame];
|
||||
bRect.origin.y = 10;
|
||||
bRect.origin.x = 10;
|
||||
[revert setFrame: bRect];
|
||||
|
||||
[buttonView addSubview: ok];
|
||||
[buttonView addSubview: revert];
|
||||
}
|
||||
else
|
||||
{
|
||||
[inspectorView addSubview: newView];
|
||||
[buttonView removeFromSuperview];
|
||||
}
|
||||
|
||||
/*
|
||||
* Make the inspector view the correct size for the viewable panel,
|
||||
* and set the frame size for the new contents before adding them.
|
||||
*/
|
||||
[inspectorView setFrame: rect];
|
||||
rect.origin = NSZeroPoint;
|
||||
[newView setFrame: rect];
|
||||
[inspectorView addSubview: newView];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
537
GormObjectEditor.m
Normal file
537
GormObjectEditor.m
Normal file
|
@ -0,0 +1,537 @@
|
|||
/* GormObjectEditor.m
|
||||
*
|
||||
* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
|
||||
* Date: 1999
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "GormPrivate.h"
|
||||
|
||||
@interface GormObjectEditor : NSMatrix <IBEditors>
|
||||
{
|
||||
NSMutableArray *objects;
|
||||
id<IBDocuments> document;
|
||||
id selected;
|
||||
NSPoint mouseDownPoint;
|
||||
BOOL shouldBeginDrag;
|
||||
NSPasteboard *dragPb;
|
||||
}
|
||||
- (void) addObject: (id)anObject;
|
||||
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
|
||||
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
|
||||
- (void) refreshCells;
|
||||
- (void) removeObject: (id)anObject;
|
||||
- (BOOL) acceptsTypeFromArray: (NSArray*)types;
|
||||
- (BOOL) activate;
|
||||
- (id) initWithObject: (id)anObject inDocument: (id<IBDocuments>)aDocument;
|
||||
- (void) close;
|
||||
- (void) closeSubeditors;
|
||||
- (void) copySelection;
|
||||
- (void) deleteSelection;
|
||||
- (id<IBDocuments>) document;
|
||||
- (id) editedObject;
|
||||
- (void) makeSelectionVisible: (BOOL)flag;
|
||||
- (id<IBEditors>) openSubeditorForObject: (id)anObject;
|
||||
- (void) orderFront;
|
||||
- (void) pasteInSelection;
|
||||
- (void) resetObject: (id)anObject;
|
||||
- (void) selectObjects: (NSArray*)objects;
|
||||
- (void) validateEditing;
|
||||
- (BOOL) wantsSelection;
|
||||
- (NSWindow*) window;
|
||||
@end
|
||||
|
||||
@implementation GormObjectEditor
|
||||
|
||||
static NSImage *objectImage = nil;
|
||||
static NSImage *windowImage = nil;
|
||||
static NSImage *menuImage = nil;
|
||||
static NSImage *firstImage = nil;
|
||||
static NSImage *ownerImage = nil;
|
||||
static NSImage *fontImage = nil;
|
||||
static NSImage *dragImage = nil;
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [GormObjectEditor class])
|
||||
{
|
||||
NSBundle *bundle;
|
||||
NSString *path;
|
||||
|
||||
bundle = [NSBundle mainBundle];
|
||||
path = [bundle pathForImageResource: @"GormLinkImage"];
|
||||
if (path != nil)
|
||||
{
|
||||
dragImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormObject"];
|
||||
if (path != nil)
|
||||
{
|
||||
objectImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormFilesOwner"];
|
||||
if (path != nil)
|
||||
{
|
||||
ownerImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormFirstResponder"];
|
||||
if (path != nil)
|
||||
{
|
||||
firstImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormFontManager"];
|
||||
if (path != nil)
|
||||
{
|
||||
fontImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormMenu"];
|
||||
if (path != nil)
|
||||
{
|
||||
menuImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormWindow"];
|
||||
if (path != nil)
|
||||
{
|
||||
windowImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) addObject: (id)anObject
|
||||
{
|
||||
if ([objects indexOfObjectIdenticalTo: anObject] == NSNotFound)
|
||||
{
|
||||
[objects addObject: anObject];
|
||||
[self refreshCells];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(objects);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialisation - register to receive DnD with our own types.
|
||||
*/
|
||||
- (id) initWithObject: (id)anObject inDocument: (id<IBDocuments>)aDocument
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
NSButtonCell *proto;
|
||||
|
||||
selected = anObject;
|
||||
document = aDocument;
|
||||
|
||||
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
||||
IBCellPboardType, IBMenuPboardType, IBMenuCellPboardType,
|
||||
IBObjectPboardType, IBViewPboardType, IBWindowPboardType, nil]];
|
||||
|
||||
[self setAutosizesCells: NO];
|
||||
[self setCellSize: NSMakeSize(72,72)];
|
||||
[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];
|
||||
|
||||
objects = [NSMutableArray new];
|
||||
[objects addObject: ownerImage];
|
||||
[objects addObject: firstImage];
|
||||
proto = [NSButtonCell new];
|
||||
[proto setBordered: NO];
|
||||
[proto setAlignment: NSCenterTextAlignment];
|
||||
[proto setImagePosition: NSImageAbove];
|
||||
[proto setShowsStateBy: NSChangeGrayCellMask];
|
||||
[proto setHighlightsBy: NSChangeGrayCellMask];
|
||||
[proto setSelectable: NO];
|
||||
[proto setEditable: NO];
|
||||
[self setPrototype: proto];
|
||||
RELEASE(proto);
|
||||
[self refreshCells];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* Dragging source protocol implementation
|
||||
*/
|
||||
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f
|
||||
{
|
||||
NSString *type = [[dragPb types] lastObject];
|
||||
|
||||
/*
|
||||
* Windows are an exception to the normal DnD mechanism - we create them
|
||||
* if they are dropped anywhere except back in the pallettes view -
|
||||
* ie. if they are dragged, but the drop fails.
|
||||
*/
|
||||
if (f == NO && [type isEqual: IBWindowPboardType] == YES)
|
||||
{
|
||||
id<IBDocuments> active = [(id<IB>)NSApp activeDocument];
|
||||
|
||||
if (active != nil)
|
||||
{
|
||||
[active pasteType: type fromPasteboard: dragPb parent: nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag
|
||||
{
|
||||
return NSDragOperationCopy;
|
||||
}
|
||||
|
||||
/*
|
||||
* Dragging destination protocol implementation
|
||||
*
|
||||
* We actually don't handle anything being dropped on the palette,
|
||||
* but we pretend to accept drops from ourself, so that the drag
|
||||
* session quietly terminates - and it looks like the drop has
|
||||
* been successful - this stops windows being created when they are
|
||||
* dropped back on the palette (a window is normally created if the
|
||||
* dnd drop is refused).
|
||||
*/
|
||||
- (unsigned) draggingEntered: (id<NSDraggingInfo>)sender
|
||||
{
|
||||
return NSDragOperationCopy;;
|
||||
}
|
||||
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
- (BOOL) prepareForDragOperation: (id<NSDraggingInfo>)sender
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Intercepting events in the view and handling them
|
||||
*/
|
||||
- (NSView*) hitTest: (NSPoint)loc
|
||||
{
|
||||
/*
|
||||
* Stop the subviews receiving events - we grab them all.
|
||||
*/
|
||||
if ([super hitTest: loc] != nil)
|
||||
return self;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent*)theEvent
|
||||
{
|
||||
NSView *view;
|
||||
|
||||
mouseDownPoint = [theEvent locationInWindow];
|
||||
view = [super hitTest: mouseDownPoint];
|
||||
if (view == self)
|
||||
{
|
||||
shouldBeginDrag = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
shouldBeginDrag = YES;
|
||||
}
|
||||
[super mouseDown: theEvent];
|
||||
}
|
||||
|
||||
- (void) mouseDragged: (NSEvent*)theEvent
|
||||
{
|
||||
if (shouldBeginDrag == YES)
|
||||
{
|
||||
NSPoint dragPoint = [theEvent locationInWindow];
|
||||
NSView *view = [super hitTest: mouseDownPoint];
|
||||
GormDocument *active = [(id<IB>)NSApp activeDocument];
|
||||
NSRect rect = [view frame];
|
||||
NSString *type;
|
||||
id obj;
|
||||
NSPasteboard *pb;
|
||||
NSImageRep *rep;
|
||||
NSSize offset;
|
||||
|
||||
offset.width = mouseDownPoint.x - dragPoint.x;
|
||||
offset.height = mouseDownPoint.y - dragPoint.y;
|
||||
|
||||
#if 0
|
||||
NSLog(@"Could do dragging");
|
||||
#else
|
||||
RELEASE(dragImage);
|
||||
dragImage = [NSImage new];
|
||||
rep = [[NSCachedImageRep alloc] initWithWindow: [self window]
|
||||
rect: rect];
|
||||
[dragImage setSize: rect.size];
|
||||
[dragImage addRepresentation: rep];
|
||||
|
||||
type = [IBPalette typeForView: view];
|
||||
obj = [IBPalette objectForView: view];
|
||||
pb = [NSPasteboard pasteboardWithName: NSDragPboard];
|
||||
ASSIGN(dragPb, pb);
|
||||
[active copyObject: obj type: type toPasteboard: pb];
|
||||
|
||||
[self dragImage: dragImage
|
||||
at: rect.origin
|
||||
offset: offset
|
||||
event: theEvent
|
||||
pasteboard: pb
|
||||
source: self
|
||||
slideBack: [type isEqual: IBWindowPboardType] ? NO : YES];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
- (id) changeSelection: (id)sender
|
||||
{
|
||||
int row = [self selectedRow];
|
||||
int col = [self selectedColumn];
|
||||
int index = row * [self numberOfColumns] + col;
|
||||
id obj = nil;
|
||||
|
||||
if (index >= 0 && index < [objects count])
|
||||
{
|
||||
obj = [objects objectAtIndex: index];
|
||||
if (obj == ownerImage || obj == firstImage || obj == fontImage)
|
||||
{
|
||||
obj = nil; /* Can't select these. */
|
||||
}
|
||||
if (obj != selected)
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
selected = obj;
|
||||
[nc postNotificationName: IBSelectionChangedNotification
|
||||
object: self];
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
- (id) raiseSelection: (id)sender
|
||||
{
|
||||
id obj = [self changeSelection: sender];
|
||||
|
||||
if ([obj isKindOfClass: [NSWindow class]])
|
||||
{
|
||||
[obj makeKeyAndOrderFront: self];
|
||||
}
|
||||
else if ([obj isKindOfClass: [NSMenu class]])
|
||||
{
|
||||
NSLog(@"Menu needs raising"); /* FIXME */
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) refreshCells
|
||||
{
|
||||
unsigned count = [objects count];
|
||||
unsigned index;
|
||||
int cols = 0;
|
||||
int rows;
|
||||
int width;
|
||||
|
||||
width = [[self superview] bounds].size.width;
|
||||
while (width >= 72)
|
||||
{
|
||||
width -= (72 + 8);
|
||||
cols++;
|
||||
}
|
||||
if (cols == 0)
|
||||
{
|
||||
cols = 1;
|
||||
}
|
||||
rows = count / cols;
|
||||
if (rows == 0 || rows * cols != count)
|
||||
{
|
||||
rows++;
|
||||
}
|
||||
[self renewRows: rows columns: cols];
|
||||
|
||||
for (index = 0; index < count; index++)
|
||||
{
|
||||
id obj = [objects objectAtIndex: index];
|
||||
NSButtonCell *but = [self cellAtRow: index/cols column: index%cols];
|
||||
|
||||
if (obj == ownerImage)
|
||||
{
|
||||
[but setImage: obj];
|
||||
[but setTitle: @"File's Owner"];
|
||||
}
|
||||
else if (obj == firstImage)
|
||||
{
|
||||
[but setImage: obj];
|
||||
[but setTitle: @"1st Responder"];
|
||||
}
|
||||
else if (obj == fontImage)
|
||||
{
|
||||
[but setImage: obj];
|
||||
[but setTitle: @"Font Manager"];
|
||||
}
|
||||
else if ([obj isKindOfClass: [NSWindow class]])
|
||||
{
|
||||
[but setImage: windowImage];
|
||||
[but setTitle: [document nameForObject: obj]];
|
||||
}
|
||||
else if ([obj isKindOfClass: [NSMenu class]])
|
||||
{
|
||||
[but setImage: menuImage];
|
||||
[but setTitle: [document nameForObject: obj]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[but setImage: objectImage];
|
||||
[but setTitle: [document nameForObject: obj]];
|
||||
}
|
||||
}
|
||||
while (index < rows * cols)
|
||||
{
|
||||
NSButtonCell *but = [self cellAtRow: index/cols column: index%cols];
|
||||
|
||||
[but setImage: nil];
|
||||
[but setTitle: nil];
|
||||
[but setEnabled: NO];
|
||||
index++;
|
||||
}
|
||||
[self setIntercellSpacing: NSMakeSize(8,8)];
|
||||
[self sizeToCells];
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
- (void) removeObject: (id)anObject
|
||||
{
|
||||
unsigned pos;
|
||||
|
||||
pos = [objects indexOfObjectIdenticalTo: anObject];
|
||||
if (pos == NSNotFound)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (anObject == ownerImage || anObject == firstImage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
[objects removeObjectAtIndex: pos];
|
||||
[self refreshCells];
|
||||
}
|
||||
|
||||
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
|
||||
{
|
||||
[self refreshCells];
|
||||
}
|
||||
|
||||
- (BOOL) acceptsTypeFromArray: (NSArray*)types
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) activate
|
||||
{
|
||||
[window makeKeyAndOrderFront: self];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) close
|
||||
{
|
||||
[self closeSubeditors];
|
||||
}
|
||||
|
||||
- (void) closeSubeditors
|
||||
{
|
||||
}
|
||||
|
||||
- (void) copySelection
|
||||
{
|
||||
}
|
||||
|
||||
- (void) deleteSelection
|
||||
{
|
||||
}
|
||||
|
||||
- (void) drawSelection
|
||||
{
|
||||
}
|
||||
|
||||
- (id<IBDocuments>) document
|
||||
{
|
||||
return document;
|
||||
}
|
||||
|
||||
- (id) editedObject
|
||||
{
|
||||
return selected;
|
||||
}
|
||||
|
||||
- (void) makeSelectionVisible: (BOOL)flag
|
||||
{
|
||||
}
|
||||
|
||||
- (id<IBEditors>) openSubeditorForObject: (id)anObject
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) orderFront
|
||||
{
|
||||
[window orderFront: self];
|
||||
}
|
||||
|
||||
- (void) pasteInSelection
|
||||
{
|
||||
}
|
||||
|
||||
- (void) resetObject: (id)anObject
|
||||
{
|
||||
}
|
||||
|
||||
- (void) selectObjects: (NSArray*)anArray
|
||||
{
|
||||
}
|
||||
|
||||
- (NSArray*) selection
|
||||
{
|
||||
if (selected == nil)
|
||||
return [NSArray array];
|
||||
else
|
||||
return [NSArray arrayWithObject: selected];
|
||||
}
|
||||
|
||||
- (unsigned) selectionCount
|
||||
{
|
||||
return (selected == nil) ? 0 : 1;
|
||||
}
|
||||
|
||||
- (void) validateEditing
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) wantsSelection
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSWindow*) window
|
||||
{
|
||||
return [self window];
|
||||
}
|
||||
@end
|
|
@ -19,9 +19,11 @@
|
|||
GormInspectorsManager *inspectorsManager;
|
||||
GormPalettesManager *palettesManager;
|
||||
id<IBSelectionOwners> selectionOwner;
|
||||
id<IBDocuments> activeDocument;
|
||||
NSMutableArray *documents;
|
||||
}
|
||||
- (id<IBDocuments>) activeDocument;
|
||||
- (void) handleNotification: (NSNotification*)aNotification;
|
||||
- (GormInspectorsManager*) inspectorsManager;
|
||||
- (id) makeNewDocument: (id) sender;
|
||||
- (id) openPalette: (id) sender;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
}
|
||||
+ (GormResourcesManager*) newManagerForDocument: (id<IBDocuments>)doc;
|
||||
- (void) addObject: (id)anObject;
|
||||
- (void) changeView: (id)sender;
|
||||
- (id<IBDocuments>) document;
|
||||
- (void) removeObject: (id)anObject;
|
||||
- (NSWindow*) window;
|
||||
|
|
|
@ -24,359 +24,53 @@
|
|||
|
||||
#include "GormPrivate.h"
|
||||
|
||||
@class GormObjectEditor;
|
||||
|
||||
@interface GormObjectsView : NSMatrix
|
||||
{
|
||||
NSMutableArray *objects;
|
||||
NSPoint mouseDownPoint;
|
||||
BOOL shouldBeginDrag;
|
||||
NSPasteboard *dragPb;
|
||||
}
|
||||
- (void) addObject: (id)anObject;
|
||||
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
|
||||
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
|
||||
- (void) refreshCells;
|
||||
- (void) removeObject: (id)anObject;
|
||||
@end
|
||||
@implementation GormResourcesManager
|
||||
|
||||
@implementation GormObjectsView
|
||||
|
||||
static NSImage *objectImage = nil;
|
||||
static NSImage *windowImage = nil;
|
||||
static NSImage *menuImage = nil;
|
||||
static NSImage *firstImage = nil;
|
||||
static NSImage *ownerImage = nil;
|
||||
static NSImage *fontImage = nil;
|
||||
static NSImage *dragImage = nil;
|
||||
static NSImage *objectsImage = nil;
|
||||
static NSImage *imagesImage = nil;
|
||||
static NSImage *soundsImage = nil;
|
||||
static NSImage *classesImage = nil;
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [GormObjectsView class])
|
||||
if (self == [GormResourcesManager class])
|
||||
{
|
||||
NSBundle *bundle;
|
||||
NSString *path;
|
||||
|
||||
bundle = [NSBundle mainBundle];
|
||||
path = [bundle pathForImageResource: @"GormLinkImage"];
|
||||
if (path != nil)
|
||||
{
|
||||
dragImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormObject"];
|
||||
if (path != nil)
|
||||
{
|
||||
objectImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
objectsImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormFilesOwner"];
|
||||
path = [bundle pathForImageResource: @"GormImage"];
|
||||
if (path != nil)
|
||||
{
|
||||
ownerImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
imagesImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormFirstResponder"];
|
||||
path = [bundle pathForImageResource: @"GormSound"];
|
||||
if (path != nil)
|
||||
{
|
||||
firstImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
soundsImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormFontManager"];
|
||||
path = [bundle pathForImageResource: @"GormClass"];
|
||||
if (path != nil)
|
||||
{
|
||||
fontImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormMenu"];
|
||||
if (path != nil)
|
||||
{
|
||||
menuImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
path = [bundle pathForImageResource: @"GormWindow"];
|
||||
if (path != nil)
|
||||
{
|
||||
windowImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
classesImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) addObject: (id)anObject
|
||||
{
|
||||
if ([objects indexOfObjectIdenticalTo: anObject] == NSNotFound)
|
||||
{
|
||||
[objects addObject: anObject];
|
||||
[self refreshCells];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(objects);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialisation - register to receive DnD with our own types.
|
||||
*/
|
||||
- (id) initWithFrame: (NSRect)aFrame
|
||||
{
|
||||
self = [super initWithFrame: aFrame];
|
||||
if (self != nil)
|
||||
{
|
||||
NSButtonCell *proto;
|
||||
|
||||
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
||||
IBCellPboardType, IBMenuPboardType, IBMenuCellPboardType,
|
||||
IBObjectPboardType, IBViewPboardType, IBWindowPboardType, nil]];
|
||||
|
||||
[self setAutosizesCells: NO];
|
||||
[self setCellSize: NSMakeSize(72,72)];
|
||||
[self setIntercellSpacing: NSMakeSize(8,8)];
|
||||
[self setAutoresizingMask: NSViewMinYMargin|NSViewWidthSizable];
|
||||
|
||||
objects = [NSMutableArray new];
|
||||
[objects addObject: ownerImage];
|
||||
[objects addObject: firstImage];
|
||||
proto = [NSButtonCell new];
|
||||
[proto setBordered: NO];
|
||||
[proto setAlignment: NSCenterTextAlignment];
|
||||
[proto setImagePosition: NSImageAbove];
|
||||
[self setPrototype: proto];
|
||||
RELEASE(proto);
|
||||
[self renewRows: 2 columns: 3];
|
||||
[self refreshCells];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* Dragging source protocol implementation
|
||||
*/
|
||||
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f
|
||||
{
|
||||
NSString *type = [[dragPb types] lastObject];
|
||||
|
||||
/*
|
||||
* Windows are an exception to the normal DnD mechanism - we create them
|
||||
* if they are dropped anywhere except back in the pallettes view -
|
||||
* ie. if they are dragged, but the drop fails.
|
||||
*/
|
||||
if (f == NO && [type isEqual: IBWindowPboardType] == YES)
|
||||
{
|
||||
id<IBDocuments> active = [(id<IB>)NSApp activeDocument];
|
||||
|
||||
if (active != nil)
|
||||
{
|
||||
[active pasteType: type fromPasteboard: dragPb parent: nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag
|
||||
{
|
||||
return NSDragOperationCopy;
|
||||
}
|
||||
|
||||
/*
|
||||
* Dragging destination protocol implementation
|
||||
*
|
||||
* We actually don't handle anything being dropped on the palette,
|
||||
* but we pretend to accept drops from ourself, so that the drag
|
||||
* session quietly terminates - and it looks like the drop has
|
||||
* been successful - this stops windows being created when they are
|
||||
* dropped back on the palette (a window is normally created if the
|
||||
* dnd drop is refused).
|
||||
*/
|
||||
- (unsigned) draggingEntered: (id<NSDraggingInfo>)sender
|
||||
{
|
||||
return NSDragOperationCopy;;
|
||||
}
|
||||
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
- (BOOL) prepareForDragOperation: (id<NSDraggingInfo>)sender
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Intercepting events in the view and handling them
|
||||
*/
|
||||
- (NSView*) hitTest: (NSPoint)loc
|
||||
{
|
||||
/*
|
||||
* Stop the subviews receiving events - we grab them all.
|
||||
*/
|
||||
if ([super hitTest: loc] != nil)
|
||||
return self;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent*)theEvent
|
||||
{
|
||||
NSView *view;
|
||||
|
||||
mouseDownPoint = [theEvent locationInWindow];
|
||||
view = [super hitTest: mouseDownPoint];
|
||||
if (view == self)
|
||||
{
|
||||
shouldBeginDrag = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
shouldBeginDrag = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) mouseDragged: (NSEvent*)theEvent
|
||||
{
|
||||
if (shouldBeginDrag == YES)
|
||||
{
|
||||
NSPoint dragPoint = [theEvent locationInWindow];
|
||||
NSView *view = [super hitTest: mouseDownPoint];
|
||||
GormDocument *active = [(id<IB>)NSApp activeDocument];
|
||||
NSRect rect = [view frame];
|
||||
NSString *type;
|
||||
id obj;
|
||||
NSPasteboard *pb;
|
||||
NSImageRep *rep;
|
||||
NSSize offset;
|
||||
|
||||
offset.width = mouseDownPoint.x - dragPoint.x;
|
||||
offset.height = mouseDownPoint.y - dragPoint.y;
|
||||
|
||||
RELEASE(dragImage);
|
||||
dragImage = [NSImage new];
|
||||
rep = [[NSCachedImageRep alloc] initWithWindow: [self window]
|
||||
rect: rect];
|
||||
[dragImage setSize: rect.size];
|
||||
[dragImage addRepresentation: rep];
|
||||
|
||||
type = [IBPalette typeForView: view];
|
||||
obj = [IBPalette objectForView: view];
|
||||
pb = [NSPasteboard pasteboardWithName: NSDragPboard];
|
||||
ASSIGN(dragPb, pb);
|
||||
[active copyObject: obj type: type toPasteboard: pb];
|
||||
|
||||
[self dragImage: dragImage
|
||||
at: rect.origin
|
||||
offset: offset
|
||||
event: theEvent
|
||||
pasteboard: pb
|
||||
source: self
|
||||
slideBack: [type isEqual: IBWindowPboardType] ? NO : YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) refreshCells
|
||||
{
|
||||
unsigned count = [objects count];
|
||||
unsigned index;
|
||||
int cols = 0;
|
||||
int rows;
|
||||
int width;
|
||||
id<IBDocuments> document;
|
||||
|
||||
document = [(id<IB>)NSApp activeDocument];
|
||||
|
||||
width = [[self superview] bounds].size.width;
|
||||
while (width >= 72)
|
||||
{
|
||||
width -= (72 + 8);
|
||||
cols++;
|
||||
}
|
||||
if (cols == 0)
|
||||
{
|
||||
cols = 1;
|
||||
}
|
||||
rows = count / cols;
|
||||
if (rows == 0 || rows * cols != count)
|
||||
{
|
||||
rows++;
|
||||
}
|
||||
[self renewRows: rows columns: cols];
|
||||
|
||||
for (index = 0; index < count; index++)
|
||||
{
|
||||
id obj = [objects objectAtIndex: index];
|
||||
NSButtonCell *but = [self cellAtRow: index/cols column: index%cols];
|
||||
|
||||
if (obj == ownerImage)
|
||||
{
|
||||
[but setImage: obj];
|
||||
[but setTitle: @"File's Owner"];
|
||||
}
|
||||
else if (obj == firstImage)
|
||||
{
|
||||
[but setImage: obj];
|
||||
[but setTitle: @"1st Responder"];
|
||||
}
|
||||
else if (obj == fontImage)
|
||||
{
|
||||
[but setImage: obj];
|
||||
[but setTitle: @"Font Manager"];
|
||||
}
|
||||
else if ([obj isKindOfClass: [NSWindow class]])
|
||||
{
|
||||
[but setImage: windowImage];
|
||||
[but setTitle: [document nameForObject: obj]];
|
||||
}
|
||||
else if ([obj isKindOfClass: [NSMenu class]])
|
||||
{
|
||||
[but setImage: menuImage];
|
||||
[but setTitle: [document nameForObject: obj]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[but setImage: objectImage];
|
||||
[but setTitle: [document nameForObject: obj]];
|
||||
}
|
||||
}
|
||||
while (index < rows * cols)
|
||||
{
|
||||
NSButtonCell *but = [self cellAtRow: index/cols column: index%cols];
|
||||
|
||||
[but setImage: nil];
|
||||
[but setTitle: nil];
|
||||
index++;
|
||||
}
|
||||
[self setIntercellSpacing: NSMakeSize(8,8)];
|
||||
[self sizeToCells];
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
- (void) removeObject: (id)anObject
|
||||
{
|
||||
unsigned pos;
|
||||
|
||||
pos = [objects indexOfObjectIdenticalTo: anObject];
|
||||
if (pos == NSNotFound)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (anObject == ownerImage || anObject == firstImage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
[objects removeObjectAtIndex: pos];
|
||||
[self refreshCells];
|
||||
}
|
||||
|
||||
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
|
||||
{
|
||||
[self refreshCells];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation GormResourcesManager
|
||||
|
||||
+ (GormResourcesManager*) newManagerForDocument: (id<IBDocuments>)doc
|
||||
{
|
||||
GormResourcesManager *mgr;
|
||||
|
||||
mgr = [[self alloc] init];
|
||||
mgr = [self alloc];
|
||||
mgr->document = doc;
|
||||
mgr = [mgr init];
|
||||
return mgr;
|
||||
}
|
||||
|
||||
|
@ -408,8 +102,6 @@ static NSImage *dragImage = nil;
|
|||
NSRect selectionRect = {{0, 188}, {240, 64}};
|
||||
NSRect scrollRect = {{0, 0}, {340, 188}};
|
||||
NSRect mainRect = {{20, 0}, {320, 188}};
|
||||
NSBundle *bundle;
|
||||
NSString *path;
|
||||
NSImage *image;
|
||||
NSButtonCell *cell;
|
||||
unsigned style = NSTitledWindowMask | NSClosableWindowMask
|
||||
|
@ -422,6 +114,7 @@ static NSImage *dragImage = nil;
|
|||
[window setDelegate: self];
|
||||
[window setMinSize: [window frame].size];
|
||||
[window setTitle: @"UNTITLED"];
|
||||
|
||||
[nc addObserver: self
|
||||
selector: @selector(windowWillClose:)
|
||||
name: NSWindowWillCloseNotification
|
||||
|
@ -439,54 +132,40 @@ static NSImage *dragImage = nil;
|
|||
[selectionView setIntercellSpacing: NSMakeSize(28,0)];
|
||||
[selectionView setAutoresizingMask: NSViewMinYMargin|NSViewWidthSizable];
|
||||
|
||||
bundle = [NSBundle mainBundle];
|
||||
|
||||
path = [bundle pathForImageResource: @"GormObject"];
|
||||
if (path != nil)
|
||||
if ((image = objectsImage) != nil)
|
||||
{
|
||||
image = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
cell = [selectionView cellAtRow: 0 column: 0];
|
||||
[cell setImage: image];
|
||||
RELEASE(image);
|
||||
[cell setTitle: @"Objects"];
|
||||
[cell setBordered: NO];
|
||||
[cell setAlignment: NSCenterTextAlignment];
|
||||
[cell setImagePosition: NSImageAbove];
|
||||
}
|
||||
|
||||
path = [bundle pathForImageResource: @"GormImage"];
|
||||
if (path != nil)
|
||||
if ((image = imagesImage) != nil)
|
||||
{
|
||||
image = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
cell = [selectionView cellAtRow: 0 column: 1];
|
||||
[cell setImage: image];
|
||||
RELEASE(image);
|
||||
[cell setTitle: @"Images"];
|
||||
[cell setBordered: NO];
|
||||
[cell setAlignment: NSCenterTextAlignment];
|
||||
[cell setImagePosition: NSImageAbove];
|
||||
}
|
||||
|
||||
path = [bundle pathForImageResource: @"GormSound"];
|
||||
if (path != nil)
|
||||
if ((image = soundsImage) != nil)
|
||||
{
|
||||
image = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
cell = [selectionView cellAtRow: 0 column: 2];
|
||||
[cell setImage: image];
|
||||
RELEASE(image);
|
||||
[cell setTitle: @"Sounds"];
|
||||
[cell setBordered: NO];
|
||||
[cell setAlignment: NSCenterTextAlignment];
|
||||
[cell setImagePosition: NSImageAbove];
|
||||
}
|
||||
|
||||
path = [bundle pathForImageResource: @"GormClass"];
|
||||
if (path != nil)
|
||||
if ((image = classesImage) != nil)
|
||||
{
|
||||
image = [[NSImage alloc] initWithContentsOfFile: path];
|
||||
cell = [selectionView cellAtRow: 0 column: 3];
|
||||
[cell setImage: image];
|
||||
RELEASE(image);
|
||||
[cell setTitle: @"Classes"];
|
||||
[cell setBordered: NO];
|
||||
[cell setAlignment: NSCenterTextAlignment];
|
||||
|
@ -504,8 +183,9 @@ static NSImage *dragImage = nil;
|
|||
RELEASE(scrollView);
|
||||
|
||||
mainRect.origin = NSMakePoint(0,0);
|
||||
mainRect.size = [scrollView contentSize];
|
||||
objectsView = [[GormObjectsView alloc] initWithFrame: mainRect];
|
||||
objectsView = [[GormObjectEditor alloc] initWithObject: nil
|
||||
inDocument: document];
|
||||
[objectsView setFrame: mainRect];
|
||||
[objectsView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
||||
[scrollView setDocumentView: objectsView];
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "Gorm.h"
|
||||
#include "GormPrivate.h"
|
||||
|
||||
|
||||
NSString *IBInspectorDidModifyObjectNotification
|
||||
|
@ -34,11 +34,20 @@ NSString *IBSelectionChangedNotification
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(object);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
/*
|
||||
* Ask our manager for the selection for which we have been created.
|
||||
*/
|
||||
object = RETAIN([(id<IB>)NSApp selectedObject]);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -67,7 +76,7 @@ NSString *IBSelectionChangedNotification
|
|||
|
||||
- (void) touch: (id)sender
|
||||
{
|
||||
[window setDocumentEdited];
|
||||
[window setDocumentEdited: YES];
|
||||
}
|
||||
|
||||
- (BOOL) wantsButtons
|
||||
|
|
|
@ -129,3 +129,93 @@
|
|||
}
|
||||
@end
|
||||
|
||||
@implementation NSWindow (IBInspectorClassNames)
|
||||
- (NSString*) inspectorClassName
|
||||
{
|
||||
return @"GormWindowAttributesInspector";
|
||||
}
|
||||
- (NSString*) connectInspectorClassName
|
||||
{
|
||||
return @"GormWindowConnectionsInspector";
|
||||
}
|
||||
- (NSString*) sizeInspectorClassName
|
||||
{
|
||||
return @"GormWindowSizeInspector";
|
||||
}
|
||||
- (NSString*) helpInspectorClassName
|
||||
{
|
||||
return @"GormWindowHelpInspector";
|
||||
}
|
||||
- (NSString*) classInspectorClassName
|
||||
{
|
||||
return @"GormWindowClassInspector";
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@interface GormWindowAttributesInspector : IBInspector
|
||||
@end
|
||||
|
||||
@implementation GormWindowAttributesInspector
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(window);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
NSView *contents;
|
||||
NSBox *box;
|
||||
|
||||
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, 272, 360)
|
||||
styleMask: NSBorderlessWindowMask
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
contents = [window contentView];
|
||||
box = [[NSBox alloc] initWithFrame: NSMakeRect(10, 300, 100, 50)];
|
||||
[box setTitle: @"Backing"];
|
||||
[box setBorderType: NSGrooveBorder];
|
||||
[contents addSubview: box];
|
||||
RELEASE(box);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@interface GormWindowConnectionsInspector : IBInspector
|
||||
@end
|
||||
|
||||
@implementation GormWindowConnectionsInspector
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@interface GormWindowSizeInspector : IBInspector
|
||||
@end
|
||||
|
||||
@implementation GormWindowSizeInspector
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@interface GormWindowHelpInspector : IBInspector
|
||||
@end
|
||||
|
||||
@implementation GormWindowHelpInspector
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@interface GormWindowClassInspector : IBInspector
|
||||
@end
|
||||
|
||||
@implementation GormWindowClassInspector
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in a new issue