2003-05-23 02:25:34 +00:00
|
|
|
/* GormPrivate.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999, 2003 Free Software Foundation, Inc.
|
|
|
|
*
|
|
|
|
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
|
|
|
|
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
|
|
|
* Date: 1999, 2003
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2003-03-03 09:15:48 +00:00
|
|
|
#ifndef INCLUDED_GormPrivate_h
|
|
|
|
#define INCLUDED_GormPrivate_h
|
1999-12-08 15:04:57 +00:00
|
|
|
|
|
|
|
@class GormDocument;
|
|
|
|
@class GormInspectorsManager;
|
|
|
|
@class GormPalettesManager;
|
|
|
|
|
2003-05-23 02:25:34 +00:00
|
|
|
#include <InterfaceBuilder/InterfaceBuilder.h>
|
1999-12-21 08:13:35 +00:00
|
|
|
#include "GormFilesOwner.h"
|
1999-12-08 15:04:57 +00:00
|
|
|
#include "GormDocument.h"
|
|
|
|
#include "GormInspectorsManager.h"
|
1999-12-20 14:20:06 +00:00
|
|
|
#include "GormClassManager.h"
|
1999-12-08 15:04:57 +00:00
|
|
|
#include "GormPalettesManager.h"
|
|
|
|
|
1999-12-17 17:22:18 +00:00
|
|
|
extern NSString *GormLinkPboardType;
|
2003-05-20 03:57:37 +00:00
|
|
|
extern NSString *GormToggleGuidelineNotification;
|
2003-06-08 04:38:59 +00:00
|
|
|
extern NSString *GormDidModifyClassNotification;
|
2003-06-30 02:15:00 +00:00
|
|
|
extern NSString *GormDidAddClassNotification;
|
|
|
|
extern NSString *GormDidDeleteClassNotification;
|
2003-10-19 04:56:07 +00:00
|
|
|
extern NSString *GormWillDetachObjectFromDocumentNotification;
|
1999-12-17 17:22:18 +00:00
|
|
|
|
2002-11-04 13:52:31 +00:00
|
|
|
// templates
|
2001-05-08 09:43:11 +00:00
|
|
|
@interface GSNibItem (GormAdditions)
|
|
|
|
- initWithClassName: (NSString*)className frame: (NSRect)frame;
|
|
|
|
- (NSString*) className;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface GormObjectProxy : GSNibItem
|
|
|
|
/*
|
|
|
|
* Use a GormObjectProxy in Gorm, but encode a GSNibItem in the archive.
|
|
|
|
* This is done so that we can provide our own decoding method
|
|
|
|
* (GSNibItem tries to morph into the actual class)
|
|
|
|
*/
|
2002-12-05 05:23:08 +00:00
|
|
|
- (void) setClassName: (NSString *)className;
|
2001-05-08 09:43:11 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface GormClassProxy : NSObject
|
|
|
|
{
|
|
|
|
NSString *name;
|
|
|
|
int t;
|
|
|
|
}
|
|
|
|
|
|
|
|
- initWithClassName: (NSString*)n;
|
|
|
|
- (NSString*) className;
|
|
|
|
- (NSString*) inspectorClassName;
|
|
|
|
- (NSString*) connectInspectorClassName;
|
|
|
|
- (NSString*) sizeInspectorClassName;
|
|
|
|
@end
|
|
|
|
|
1999-12-17 21:53:06 +00:00
|
|
|
@interface NSApplication (Gorm)
|
1999-12-20 14:20:06 +00:00
|
|
|
- (GormClassManager*) classManager;
|
1999-12-17 21:53:06 +00:00
|
|
|
@end
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
@interface Gorm : NSApplication <IB>
|
|
|
|
{
|
|
|
|
id infoPanel;
|
2003-05-13 04:10:12 +00:00
|
|
|
id preferencesController;
|
1999-12-20 14:20:06 +00:00
|
|
|
GormClassManager *classManager;
|
1999-12-08 15:04:57 +00:00
|
|
|
GormInspectorsManager *inspectorsManager;
|
|
|
|
GormPalettesManager *palettesManager;
|
2003-05-10 21:19:25 +00:00
|
|
|
id<IBSelectionOwners> selectionOwner;
|
1999-12-08 15:04:57 +00:00
|
|
|
NSMutableArray *documents;
|
1999-12-17 21:53:06 +00:00
|
|
|
BOOL isConnecting;
|
1999-12-15 15:29:27 +00:00
|
|
|
BOOL isTesting;
|
2000-01-03 11:00:14 +00:00
|
|
|
id testContainer;
|
2003-01-17 03:55:55 +00:00
|
|
|
id gormMenu;
|
2000-02-03 17:04:37 +00:00
|
|
|
NSMenu *mainMenu;
|
2001-05-08 09:43:11 +00:00
|
|
|
NSMenu *classMenu; // so we can set it for the class view
|
2003-05-20 03:57:37 +00:00
|
|
|
NSMenuItem *guideLineMenuItem;
|
2000-02-03 17:04:37 +00:00
|
|
|
NSDictionary *menuLocations;
|
1999-12-17 21:53:06 +00:00
|
|
|
NSImage *linkImage;
|
1999-12-17 12:44:06 +00:00
|
|
|
NSImage *sourceImage;
|
|
|
|
NSImage *targetImage;
|
1999-12-17 17:22:18 +00:00
|
|
|
id connectSource;
|
1999-12-17 21:53:06 +00:00
|
|
|
NSWindow *connectSWindow;
|
|
|
|
NSRect connectSRect;
|
1999-12-17 17:22:18 +00:00
|
|
|
id connectDestination;
|
1999-12-17 21:53:06 +00:00
|
|
|
NSWindow *connectDWindow;
|
|
|
|
NSRect connectDRect;
|
2003-05-24 11:12:09 +00:00
|
|
|
NSPoint cascadePoint;
|
1999-12-08 15:04:57 +00:00
|
|
|
}
|
|
|
|
- (id<IBDocuments>) activeDocument;
|
1999-12-17 17:22:18 +00:00
|
|
|
- (id) connectSource;
|
|
|
|
- (id) connectDestination;
|
|
|
|
- (void) displayConnectionBetween: (id)source and: (id)destination;
|
1999-12-08 15:19:11 +00:00
|
|
|
- (void) handleNotification: (NSNotification*)aNotification;
|
1999-12-08 15:04:57 +00:00
|
|
|
- (GormInspectorsManager*) inspectorsManager;
|
1999-12-17 17:22:18 +00:00
|
|
|
- (BOOL) isConnecting;
|
1999-12-08 15:04:57 +00:00
|
|
|
- (GormPalettesManager*) palettesManager;
|
1999-12-17 17:22:18 +00:00
|
|
|
- (void) stopConnecting;
|
1999-12-16 18:06:22 +00:00
|
|
|
|
2003-08-03 09:02:11 +00:00
|
|
|
- (void) infoPanel: (id) sender;
|
2003-05-13 04:10:12 +00:00
|
|
|
- (void) preferencesPanel: (id) sender;
|
2003-08-03 09:02:11 +00:00
|
|
|
|
|
|
|
- (void) copy: (id)sender;
|
|
|
|
- (void) cut: (id)sender;
|
|
|
|
- (void) paste: (id)sender;
|
|
|
|
- (void) delete: (id)sender;
|
|
|
|
- (void) selectAllItems: (id)sender;
|
|
|
|
- (void) setName: (id)sender;
|
|
|
|
|
|
|
|
- (id) endTesting: (id)sender;
|
|
|
|
|
|
|
|
- (void) inspector: (id) sender;
|
|
|
|
- (void) palettes: (id) sender;
|
|
|
|
- (void) loadPalette: (id) sender;
|
|
|
|
|
2003-05-24 11:12:09 +00:00
|
|
|
- (void) newGormDocument: (id) sender;
|
2003-08-03 09:02:11 +00:00
|
|
|
- (void) open: (id)sender;
|
|
|
|
- (void) revertToSaved: (id)sender;
|
|
|
|
- (void) save: (id)sender;
|
|
|
|
- (void) saveAll: (id)sender;
|
|
|
|
- (void) saveAs: (id)sender;
|
|
|
|
- (void) testInterface: (id)sender;
|
2001-05-08 09:43:11 +00:00
|
|
|
|
2003-01-04 00:17:43 +00:00
|
|
|
// sound & images.
|
|
|
|
- (void) loadSound: (id) sender;
|
|
|
|
- (void) loadImage: (id) sender;
|
|
|
|
|
|
|
|
// grouping
|
2003-08-03 09:02:11 +00:00
|
|
|
- (void) groupSelectionInSplitView: (id)sender;
|
|
|
|
- (void) groupSelectionInBox: (id)sender;
|
|
|
|
- (void) groupSelectionInScrollView: (id)sender;
|
|
|
|
- (void) ungroup: (id)sender;
|
2003-01-04 00:17:43 +00:00
|
|
|
|
2001-05-08 09:43:11 +00:00
|
|
|
// added for classes support
|
2003-08-03 09:02:11 +00:00
|
|
|
- (void) createSubclass: (id)sender;
|
|
|
|
- (void) instantiateClass: (id)sender;
|
2001-05-08 09:43:11 +00:00
|
|
|
- (NSMenu*) classMenu;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface GormClassEditor : NSObject <IBSelectionOwners>
|
|
|
|
{
|
|
|
|
GormDocument *document;
|
|
|
|
NSString *selectedClassName;
|
|
|
|
}
|
|
|
|
- (GormClassEditor*) initWithDocument: (GormDocument*)doc;
|
|
|
|
+ (GormClassEditor*) classEditorForDocument: (GormDocument*)doc;
|
|
|
|
- (void) setSelectedClassName: (NSString*)cn;
|
1999-12-08 15:04:57 +00:00
|
|
|
@end
|
|
|
|
|
2002-11-18 20:54:26 +00:00
|
|
|
@interface GormGenericEditor : NSMatrix <IBEditors, IBSelectionOwners>
|
1999-12-18 08:55:31 +00:00
|
|
|
{
|
|
|
|
NSMutableArray *objects;
|
|
|
|
id<IBDocuments> document;
|
|
|
|
id selected;
|
|
|
|
NSPasteboard *dragPb;
|
1999-12-18 11:08:18 +00:00
|
|
|
NSString *dragType;
|
1999-12-18 08:55:31 +00:00
|
|
|
}
|
2003-05-10 21:19:25 +00:00
|
|
|
// selection methods...
|
|
|
|
- (void) selectObjects: (NSArray*)objects;
|
|
|
|
- (BOOL) wantsSelection;
|
|
|
|
- (void) copySelection;
|
|
|
|
- (void) deleteSelection;
|
|
|
|
- (void) pasteInSelection;
|
|
|
|
- (void) refreshCells;
|
|
|
|
- (void) closeSubeditors;
|
|
|
|
|
|
|
|
- (NSWindow*) window;
|
|
|
|
- (void) addObject: (id)anObject;
|
|
|
|
- (void) refreshCells;
|
|
|
|
- (void) removeObject: (id)anObject;
|
|
|
|
- (BOOL) activate;
|
|
|
|
- (id) initWithObject: (id)anObject inDocument: (id<IBDocuments>)aDocument;
|
|
|
|
- (void) close;
|
|
|
|
- (void) closeSubeditors;
|
|
|
|
- (BOOL) containsObject: (id)anObject;
|
|
|
|
- (void) copySelection;
|
|
|
|
- (void) deleteSelection;
|
|
|
|
- (id<IBDocuments>) document;
|
|
|
|
- (id) editedObject;
|
|
|
|
- (id<IBEditors>) openSubeditorForObject: (id)anObject;
|
|
|
|
- (void) orderFront;
|
|
|
|
- (void) pasteInSelection;
|
|
|
|
- (NSRect) rectForObject: (id)anObject;
|
2002-11-18 20:54:26 +00:00
|
|
|
@end
|
|
|
|
|
2003-01-04 00:17:43 +00:00
|
|
|
// private methods...
|
|
|
|
@interface GormGenericEditor (PrivateMethods)
|
|
|
|
- (void) groupSelectionInScrollView;
|
2003-05-10 21:19:25 +00:00
|
|
|
- (void) groupSelectionInSplitView;
|
|
|
|
- (void) groupSelectionInBox;
|
|
|
|
- (void) ungroup;
|
|
|
|
- (void) setEditor: (id)anEditor forDocument: (id<IBDocuments>)doc;
|
|
|
|
- (id) changeSelection: (id)sender;
|
2003-01-04 00:17:43 +00:00
|
|
|
@end
|
|
|
|
|
2003-05-10 21:19:25 +00:00
|
|
|
@interface GormObjectEditor : GormGenericEditor // <IBEditors, IBSelectionOwners>
|
2002-11-18 20:54:26 +00:00
|
|
|
{
|
|
|
|
// NSMutableArray *objects;
|
|
|
|
// id<IBDocuments> document;
|
|
|
|
// id selected;
|
|
|
|
// NSPasteboard *dragPb;
|
|
|
|
// NSString *dragType;
|
|
|
|
}
|
2002-11-04 13:52:31 +00:00
|
|
|
// + (GormObjectEditor*) editorForDocument: (id<IBDocuments>)aDocument;
|
1999-12-18 08:55:31 +00:00
|
|
|
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
|
|
|
|
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
|
|
|
|
- (BOOL) acceptsTypeFromArray: (NSArray*)types;
|
|
|
|
- (void) makeSelectionVisible: (BOOL)flag;
|
|
|
|
- (void) resetObject: (id)anObject;
|
|
|
|
@end
|
|
|
|
|
2003-05-10 21:19:25 +00:00
|
|
|
@interface GormSoundEditor : GormGenericEditor // <IBEditors, IBSelectionOwners>
|
2002-11-04 13:52:31 +00:00
|
|
|
{
|
2002-11-18 20:54:26 +00:00
|
|
|
// NSMutableArray *objects;
|
|
|
|
// id<IBDocuments> document;
|
|
|
|
// id selected;
|
|
|
|
// NSPasteboard *dragPb;
|
|
|
|
// NSString *dragType;
|
2002-11-04 13:52:31 +00:00
|
|
|
}
|
|
|
|
// don't redeclare methods already declared in protocols.
|
|
|
|
+ (GormSoundEditor*) editorForDocument: (id<IBDocuments>)aDocument;
|
|
|
|
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
|
|
|
|
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
|
|
|
|
@end
|
|
|
|
|
2003-05-10 21:19:25 +00:00
|
|
|
@interface GormImageEditor : GormGenericEditor // <IBEditors, IBSelectionOwners>
|
2002-11-18 20:54:26 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
// don't redeclare methods already declared in protocols.
|
|
|
|
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
|
|
|
|
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
|
|
|
|
- (void) refreshCells;
|
|
|
|
@end
|
|
|
|
|
2002-03-29 16:30:01 +00:00
|
|
|
|
2001-10-03 17:38:46 +00:00
|
|
|
@interface GormFilesOwnerInspector : IBInspector
|
|
|
|
{
|
|
|
|
NSBrowser *browser;
|
|
|
|
NSArray *classes;
|
|
|
|
BOOL hasConnections;
|
|
|
|
}
|
|
|
|
- (void) takeClassFrom: (id)sender;
|
|
|
|
@end
|
|
|
|
|
2001-12-04 22:23:51 +00:00
|
|
|
/*
|
|
|
|
* NSDateFormatter and NSNumberFormatter extensions
|
|
|
|
* for Gorm Formatters used in the Data Palette
|
|
|
|
*/
|
|
|
|
|
|
|
|
@interface NSDateFormatter (GormAdditions)
|
|
|
|
|
|
|
|
+ (void) initialize;
|
|
|
|
+ (int) formatCount;
|
|
|
|
+ (NSString *) formatAtIndex: (int)index;
|
|
|
|
+ (int) indexOfFormat: (NSString *) format;
|
|
|
|
+ (NSString *) defaultFormat;
|
|
|
|
+ (id) defaultFormatValue;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface NSNumberFormatter (GormAdditions)
|
|
|
|
|
|
|
|
+ (void) initialize;
|
|
|
|
+ (int) formatCount;
|
|
|
|
+ (NSString *) formatAtIndex: (int)index;
|
|
|
|
+ (NSString *) positiveFormatAtIndex: (int)index;
|
|
|
|
+ (NSString *) zeroFormatAtIndex: (int)index;
|
|
|
|
+ (NSString *) negativeFormatAtIndex: (int)index;
|
|
|
|
+ (NSDecimalNumber *) positiveValueAtIndex: (int)index;
|
|
|
|
+ (NSDecimalNumber *) negativeValueAtIndex: (int)index;
|
|
|
|
+ (int) indexOfFormat: format;
|
|
|
|
+ (NSString *) defaultFormat;
|
|
|
|
+ (id) defaultFormatValue;
|
|
|
|
- (NSString *) zeroFormat;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2002-10-13 06:04:05 +00:00
|
|
|
@interface NSObject (GormAdditions)
|
|
|
|
- (id) allocSubstitute;
|
2003-05-10 21:19:25 +00:00
|
|
|
- (NSImage *) imageForViewer;
|
2002-10-13 06:04:05 +00:00
|
|
|
@end
|
|
|
|
|
2002-11-04 13:52:31 +00:00
|
|
|
// we don't use the actual sound since we don't want to read the entire sound into
|
|
|
|
// memory.
|
|
|
|
@interface GormSound : NSObject
|
|
|
|
{
|
|
|
|
NSString *name;
|
|
|
|
NSString *path;
|
|
|
|
BOOL isSystemSound;
|
|
|
|
BOOL isInWrapper;
|
|
|
|
}
|
|
|
|
- (id) initWithName: (NSString *)aName
|
|
|
|
path: (NSString *)aPath;
|
|
|
|
- (void) setSoundName: (NSString *)aName;
|
|
|
|
- (NSString *) soundName;
|
|
|
|
- (void) setSoundPath: (NSString *)aPath;
|
|
|
|
- (NSString *) soundPath;
|
|
|
|
- (void) setSystemSound: (BOOL)flag;
|
|
|
|
- (BOOL) isSystemSound;
|
|
|
|
- (void) setInWrapper: (BOOL)flag;
|
|
|
|
- (BOOL) isInWrapper;
|
|
|
|
- (NSString *)inspectorClassName;
|
|
|
|
@end
|
|
|
|
|
2002-11-18 20:54:26 +00:00
|
|
|
@interface GormImage : NSObject
|
|
|
|
{
|
|
|
|
NSString *name;
|
|
|
|
NSString *path;
|
|
|
|
NSImage *image;
|
|
|
|
NSImage *smallImage;
|
|
|
|
BOOL isSystemImage;
|
|
|
|
BOOL isInWrapper;
|
|
|
|
}
|
|
|
|
- (id) initWithName: (NSString *)aName
|
|
|
|
path: (NSString *)aPath;
|
|
|
|
- (void) setImageName: (NSString *)aName;
|
|
|
|
- (NSString *) imageName;
|
|
|
|
- (void) setImagePath: (NSString *)aPath;
|
|
|
|
- (NSString *) imagePath;
|
|
|
|
- (void) setSystemImage: (BOOL)flag;
|
|
|
|
- (BOOL) isSystemImage;
|
|
|
|
- (void) setInWrapper: (BOOL)flag;
|
|
|
|
- (BOOL) isInWrapper;
|
|
|
|
- (NSString *)inspectorClassName;
|
2003-07-20 23:11:37 +00:00
|
|
|
- (NSImage *)image;
|
|
|
|
- (NSImage *)normalImage;
|
2002-11-18 20:54:26 +00:00
|
|
|
@end
|
|
|
|
|
2003-05-10 21:19:25 +00:00
|
|
|
@interface GormDocument (PrivateMethodsForImagesAndSounds)
|
|
|
|
- (GormImage *)_createImagePlaceHolder: (NSString *)path;
|
|
|
|
- (GormSound *)_createSoundPlaceHolder: (NSString *)path;
|
|
|
|
- (void) addImage: (NSString*) path;
|
|
|
|
@end
|
|
|
|
|
1999-12-13 20:04:31 +00:00
|
|
|
/*
|
|
|
|
* Functions for drawing knobs etc.
|
|
|
|
*/
|
|
|
|
void GormDrawKnobsForRect(NSRect aFrame);
|
2001-06-07 03:57:51 +00:00
|
|
|
void GormDrawOpenKnobsForRect(NSRect aFrame);
|
1999-12-13 20:04:31 +00:00
|
|
|
NSRect GormExtBoundsForRect(NSRect aFrame);
|
|
|
|
IBKnobPosition GormKnobHitInRect(NSRect aFrame, NSPoint p);
|
|
|
|
void GormShowFastKnobFills(void);
|
1999-12-16 18:06:22 +00:00
|
|
|
void GormShowFrameWithKnob(NSRect aRect, IBKnobPosition aKnob);
|
1999-12-13 20:04:31 +00:00
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
#endif
|