Modest document improvements

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@5780 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-01-14 17:07:44 +00:00
parent 21d066e79e
commit 69f280c043
3 changed files with 117 additions and 5 deletions

View file

@ -1,3 +1,9 @@
Fri Jan 14 16:22:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* GormDocument.m: Fix to deactivate editors while copying to pb
and add support for a few more document setup types.
* Gorm.m: Add Inspector, Panel and Empty documents.
Fri Jan 14 9:34:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Palettes/OMenus/GormMenuEditor.m: ([mouseDown:]) support for

48
Gorm.m
View file

@ -314,6 +314,7 @@ NSString *GormLinkPboardType = @"GormLinkPboardType";
{
NSMenu *aMenu;
NSMenu *mainMenu;
NSMenu *modulesMenu;
NSMenu *windowsMenu;
NSMenuItem *menuItem;
NSBundle *bundle;
@ -368,6 +369,21 @@ NSString *GormLinkPboardType = @"GormLinkPboardType";
[aMenu addItemWithTitle: @"New Application"
action: @selector(newApplication:)
keyEquivalent: @"n"];
modulesMenu = [NSMenu new];
[modulesMenu addItemWithTitle: @"New Empty"
action: @selector(newEmpty:)
keyEquivalent: @"N"];
[modulesMenu addItemWithTitle: @"New Inspector"
action: @selector(newInspector:)
keyEquivalent: @""];
[modulesMenu addItemWithTitle: @"New Palette"
action: @selector(newPalette:)
keyEquivalent: @""];
menuItem = [aMenu addItemWithTitle: @"New Module"
action: NULL
keyEquivalent: @""];
[aMenu setSubmenu: modulesMenu forItem: menuItem];
RELEASE(modulesMenu);
[aMenu addItemWithTitle: @"Save"
action: @selector(save:)
keyEquivalent: @"s"];
@ -610,7 +626,39 @@ NSString *GormLinkPboardType = @"GormLinkPboardType";
RELEASE(doc);
[doc setupDefaults: @"Application"];
[[doc window] makeKeyAndOrderFront: self];
return doc;
}
- (id) newEmpty: (id) sender
{
id doc = [GormDocument new];
[documents addObject: doc];
RELEASE(doc);
[doc setupDefaults: @"Empty"];
[[doc window] makeKeyAndOrderFront: self];
return doc;
}
- (id) newInspector: (id) sender
{
id doc = [GormDocument new];
[documents addObject: doc];
RELEASE(doc);
[doc setupDefaults: @"Inspector"];
[[doc window] makeKeyAndOrderFront: self];
return doc;
}
- (id) newPalette: (id) sender
{
id doc = [GormDocument new];
[documents addObject: doc];
RELEASE(doc);
[doc setupDefaults: @"Palette"];
[[doc window] makeKeyAndOrderFront: self];
return doc;
}

View file

@ -334,11 +334,38 @@ static NSImage *classesImage = nil;
type: (NSString*)aType
toPasteboard: (NSPasteboard*)aPasteboard
{
NSData *obj = [NSArchiver archivedDataWithRootObject: anArray];
NSEnumerator *enumerator;
NSMutableSet *editors;
id obj;
NSData *data;
/*
* Remove all editors from the selected objects before archiving
* and restore them afterwards.
*/
editors = [NSMutableSet new];
enumerator = [anArray objectEnumerator];
while ((obj = [enumerator nextObject]) != nil)
{
id editor = [self editorForObject: obj create: NO];
if (editor != nil)
{
[editors addObject: editor];
[editor deactivate];
}
}
data = [NSArchiver archivedDataWithRootObject: anArray];
enumerator = [editors objectEnumerator];
while ((obj = [enumerator nextObject]) != nil)
{
[obj activate];
}
RELEASE(editors);
[aPasteboard declareTypes: [NSArray arrayWithObject: aType]
owner: self];
return [aPasteboard setData: obj forType: aType];
return [aPasteboard setData: data forType: aType];
}
- (void) pasteboardChangedOwner: (NSPasteboard*)sender
@ -1079,8 +1106,7 @@ static NSImage *classesImage = nil;
screenPoint = [window convertBaseToScreen: filePoint];
/*
* Windows and panels are a special case - they need to be set to be
* visible at launch time (by default), and for a multiple window paste,
* Windows and panels are a special case - for a multiple window paste,
* the windows need to be positioned so they are not on top of each other.
*/
if ([aType isEqualToString: IBWindowPboardType] == YES)
@ -1089,7 +1115,6 @@ static NSImage *classesImage = nil;
while ((win = [enumerator nextObject]) != nil)
{
[self setObject: win isVisibleAtLaunch: YES];
[win setFrameTopLeftPoint: screenPoint];
screenPoint.x += 10;
screenPoint.y -= 10;
@ -1160,6 +1185,7 @@ static NSImage *classesImage = nil;
NSMakePoint(220, frame.size.height-100)];
[aWindow setTitle: @"My Window"];
[self attachObject: aWindow toParent: nil];
[self setObject: aWindow isVisibleAtLaunch: YES];
RELEASE(aWindow);
[aMenu setTitle: @"Main Menu"];
@ -1175,6 +1201,38 @@ static NSImage *classesImage = nil;
NSMakePoint(1, frame.size.height-200)];
RELEASE(aMenu);
}
else if ([type isEqual: @"Inspector"] == YES)
{
NSWindow *aWindow;
NSRect frame = [[NSScreen mainScreen] frame];
unsigned style = NSTitledWindowMask | NSClosableWindowMask;
aWindow = [[NSWindow alloc] initWithContentRect: NSMakeRect(0,0,IVW,IVH)
styleMask: style
backing: NSBackingStoreRetained
defer: NO];
[aWindow setFrameTopLeftPoint:
NSMakePoint(220, frame.size.height-100)];
[aWindow setTitle: @"Inspector Window"];
[self attachObject: aWindow toParent: nil];
RELEASE(aWindow);
}
else if ([type isEqual: @"Palette"] == YES)
{
NSWindow *aWindow;
NSRect frame = [[NSScreen mainScreen] frame];
unsigned style = NSTitledWindowMask | NSClosableWindowMask;
aWindow = [[NSWindow alloc] initWithContentRect: NSMakeRect(0,0,272,192)
styleMask: style
backing: NSBackingStoreRetained
defer: NO];
[aWindow setFrameTopLeftPoint:
NSMakePoint(220, frame.size.height-100)];
[aWindow setTitle: @"Palette Window"];
[self attachObject: aWindow toParent: nil];
RELEASE(aWindow);
}
}
- (void) setName: (NSString*)aName forObject: (id)object