mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
GormObjectEditor.m
ClassInformation.plist Gorm.m GormWindowEditor.m GormTableViewEditor.m GormDocument.m GormInspectorsManager.m Palettes/0Menus/main.m Palettes/0Menus/GormMenuEditor.m Palettes/0Menus/GNUmakefile Palettes/0Menus/GormNSMenu.m Palettes/0Menus/GormNSMenu.h git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@13391 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c9dd930d5c
commit
1dbef9900b
13 changed files with 373 additions and 48 deletions
30
ChangeLog
30
ChangeLog
|
@ -1,3 +1,33 @@
|
|||
2002-07-01 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||
|
||||
* ClassInformation.plist: new outlet for NSWindowController
|
||||
* Gorm.m
|
||||
* GormWindowEditor.m
|
||||
* GormTableViewEditor.m
|
||||
* GormObjectEditor.m
|
||||
Bugfixes for proper drawing/updating of selection.
|
||||
|
||||
* GormDocument.m
|
||||
Only the toplevel menu goes into the objectview panel.
|
||||
The last directory used for opening is now saved and proposed
|
||||
as the default for next time.
|
||||
|
||||
* GormObjectEditor.m
|
||||
* Resources/GormViewSizeInspector.gorm
|
||||
* Resources/GormViewSizeInspector.classes
|
||||
The size inspector is now loaded from a gorm file.
|
||||
|
||||
* GormDocument.m
|
||||
* Palettes/0Menus/GormNSMenu.m
|
||||
* Palettes/0Menus/GormNSMenu.h
|
||||
* Palettes/0Menus/main.m
|
||||
* Palettes/0Menus/GormMenuEditor.m
|
||||
* Palettes/0Menus/GNUmakefile
|
||||
GormNSMenu replaces NSMenu when editing interface.
|
||||
|
||||
* GormInspectorsManager.m: fix selected item in popupbutton when using
|
||||
keyEquivalent (patch from Fabien Vallon).
|
||||
|
||||
2002-04-01 Pierre-Yves <pyrivail@spocky>
|
||||
|
||||
* GormTableViewEditor.m ([GormTableViewEditor -activate]):
|
||||
|
|
|
@ -605,7 +605,8 @@
|
|||
showWindow:
|
||||
);
|
||||
Outlets = (
|
||||
document
|
||||
document,
|
||||
window
|
||||
);
|
||||
Super = NSResponder;
|
||||
};
|
||||
|
|
7
Gorm.m
7
Gorm.m
|
@ -718,6 +718,7 @@ NSLog(@"StartupTime %f", [startDate timeIntervalSinceNow]);
|
|||
{
|
||||
[self stopConnecting];
|
||||
}
|
||||
[selectionOwner makeSelectionVisible: NO];
|
||||
selectionOwner = obj;
|
||||
[[self inspectorsManager] updateSelection];
|
||||
}
|
||||
|
@ -743,7 +744,7 @@ NSLog(@"StartupTime %f", [startDate timeIntervalSinceNow]);
|
|||
@"Richard Frith-Macdonald <rfm@gnu.org>"]
|
||||
forKey: @"Authors"];
|
||||
// [d setObject: @"See http://www.gnustep.org" forKey: @"URL"];
|
||||
[d setObject: @"Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc."
|
||||
[d setObject: @"Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc."
|
||||
forKey: @"Copyright"];
|
||||
[d setObject: @"Released under the GNU General Public License 2.0"
|
||||
forKey: @"CopyrightDescription"];
|
||||
|
@ -1070,6 +1071,8 @@ NSLog(@"StartupTime %f", [startDate timeIntervalSinceNow]);
|
|||
[a beginArchiving];
|
||||
[archiver encodeClassName: @"GormNSWindow"
|
||||
intoClassName: @"NSWindow"];
|
||||
[archiver encodeClassName: @"GormNSMenu"
|
||||
intoClassName: @"NSMenu"];
|
||||
[archiver encodeRootObject: a];
|
||||
d = RETAIN([archiver archiverData]);
|
||||
[a endArchiving];
|
||||
|
@ -1233,7 +1236,7 @@ main(int argc, const char **argv)
|
|||
NSImageDoesCaching = YES;
|
||||
//[NSObject enableDoubleReleaseCheck: YES];
|
||||
|
||||
startDate = [[NSDate alloc] init];
|
||||
startDate = [[NSDate alloc] init];
|
||||
NSApplicationMain(argc, argv);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -184,17 +184,23 @@ static NSImage *classesImage = nil;
|
|||
* Add top-level objects to objectsView and open their editors.
|
||||
*/
|
||||
if ([anObject isKindOfClass: [NSWindow class]] == YES
|
||||
|| [anObject isKindOfClass: [NSMenu class]] == YES
|
||||
|| [anObject isKindOfClass: [GSNibItem class]] == YES)
|
||||
// || [anObject isKindOfClass: [NSMenu class]] == YES
|
||||
|| [anObject isKindOfClass: [GSNibItem class]] == YES)
|
||||
{
|
||||
[objectsView addObject: anObject];
|
||||
[[self openEditorForObject: anObject] activate];
|
||||
if ([anObject isKindOfClass: [NSWindow class]] == YES)
|
||||
{
|
||||
// RETAIN(anObject);
|
||||
[anObject setReleasedWhenClosed: NO];
|
||||
}
|
||||
}
|
||||
|
||||
if ([anObject isKindOfClass: [NSMenu class]] == YES)
|
||||
{
|
||||
[[self openEditorForObject: anObject] activate];
|
||||
}
|
||||
|
||||
/*
|
||||
* if this a scrollview, it is interesting to add its contentview
|
||||
* if it is a tableview or a textview
|
||||
|
@ -292,7 +298,8 @@ static NSImage *classesImage = nil;
|
|||
|
||||
/* Add information about the NSOwner to the archive */
|
||||
NSMapInsert(objToName, (void*)[filesOwner className], (void*)@"NSOwner");
|
||||
[nameTable setObject: [filesOwner className] forKey: @"NSOwner"];
|
||||
[nameTable setObject: [filesOwner className] forKey: @"NSOwner"];
|
||||
|
||||
}
|
||||
|
||||
- (void) changeCurrentClass: (id)sender
|
||||
|
@ -1340,6 +1347,7 @@ static NSImage *classesImage = nil;
|
|||
[u decodeClassName: @"GSNibContainer" asClassName: @"GormDocument"];
|
||||
[u decodeClassName: @"GSNibItem" asClassName: @"GormObjectProxy"];
|
||||
[u decodeClassName: @"GSCustomView" asClassName: @"GormCustomView"];
|
||||
[u decodeClassName: @"NSMenu" asClassName: @"GormNSMenu"];
|
||||
[u decodeClassName: @"NSWindow" asClassName: @"GormNSWindow"];
|
||||
[u decodeClassName: @"NSBrowser" asClassName: @"GormNSBrowser"];
|
||||
[u decodeClassName: @"NSTableView" asClassName: @"GormNSTableView"];
|
||||
|
@ -1413,7 +1421,6 @@ static NSImage *classesImage = nil;
|
|||
NSMapInsert(objToName, (void*)obj, (void*)name);
|
||||
if ([obj isKindOfClass: [NSMenu class]] == YES)
|
||||
{
|
||||
[objectsView addObject: obj];
|
||||
if ([name isEqual: @"NSMenu"] == YES)
|
||||
{
|
||||
NSRect frame = [[NSScreen mainScreen] frame];
|
||||
|
@ -1421,6 +1428,7 @@ static NSImage *classesImage = nil;
|
|||
[[obj window] setFrameTopLeftPoint:
|
||||
NSMakePoint(1, frame.size.height-200)];
|
||||
[[self openEditorForObject: obj] activate];
|
||||
[objectsView addObject: obj];
|
||||
}
|
||||
}
|
||||
else if ([obj isKindOfClass: [NSWindow class]] == YES)
|
||||
|
@ -1455,6 +1463,8 @@ static NSImage *classesImage = nil;
|
|||
NSArray *fileTypes;
|
||||
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
|
||||
int result;
|
||||
NSString *pth = [[NSUserDefaults standardUserDefaults]
|
||||
objectForKey:@"OpenDir"];
|
||||
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"OpenNibs"] == YES)
|
||||
{
|
||||
|
@ -1467,9 +1477,11 @@ static NSImage *classesImage = nil;
|
|||
[oPanel setAllowsMultipleSelection: NO];
|
||||
[oPanel setCanChooseFiles: YES];
|
||||
[oPanel setCanChooseDirectories: NO];
|
||||
result = [oPanel runModalForDirectory: nil
|
||||
result = [oPanel runModalForDirectory: pth
|
||||
file: nil
|
||||
types: fileTypes];
|
||||
[[NSUserDefaults standardUserDefaults] setObject: [oPanel directory]
|
||||
forKey:@"OpenDir"];
|
||||
if (result == NSOKButton)
|
||||
{
|
||||
return [self loadDocument: [oPanel filename]];
|
||||
|
@ -1607,17 +1619,37 @@ static NSImage *classesImage = nil;
|
|||
hasSetDefaults = YES;
|
||||
if ([type isEqual: @"Application"] == YES)
|
||||
{
|
||||
NSMenu *aMenu = [NSMenu new];
|
||||
NSMenu *aMenu;
|
||||
NSWindow *aWindow;
|
||||
NSRect frame = [[NSScreen mainScreen] frame];
|
||||
unsigned style = NSTitledWindowMask | NSClosableWindowMask
|
||||
| NSResizableWindowMask | NSMiniaturizableWindowMask;
|
||||
|
||||
aWindow = [[NSWindow allocSubstitute]
|
||||
initWithContentRect: NSMakeRect(0,0,600, 400)
|
||||
styleMask: style
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
if ([NSMenu respondsToSelector: @selector(allocSubstitute)])
|
||||
{
|
||||
aMenu = [[NSMenu allocSubstitute] init];
|
||||
}
|
||||
else
|
||||
{
|
||||
aMenu = [[NSMenu alloc] init];
|
||||
}
|
||||
|
||||
if ([NSWindow respondsToSelector: @selector(allocSubstitute)])
|
||||
{
|
||||
aWindow = [[NSWindow allocSubstitute]
|
||||
initWithContentRect: NSMakeRect(0,0,600, 400)
|
||||
styleMask: style
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
aWindow = [[NSWindow alloc]
|
||||
initWithContentRect: NSMakeRect(0,0,600, 400)
|
||||
styleMask: style
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
}
|
||||
[aWindow setFrameTopLeftPoint:
|
||||
NSMakePoint(220, frame.size.height-100)];
|
||||
[aWindow setTitle: @"My Window"];
|
||||
|
@ -1632,9 +1664,12 @@ static NSImage *classesImage = nil;
|
|||
keyEquivalent: @"h"];
|
||||
[aMenu addItemWithTitle: @"Quit"
|
||||
action: @selector(terminate:)
|
||||
keyEquivalent: @"q"];
|
||||
keyEquivalent: @"q"];
|
||||
[self setName: @"NSMenu" forObject: aMenu];
|
||||
[self attachObject: aMenu toParent: nil];
|
||||
[objectsView addObject: aMenu];
|
||||
// RETAIN(aMenu);
|
||||
|
||||
[[aMenu window] setFrameTopLeftPoint:
|
||||
NSMakePoint(1, frame.size.height-200)];
|
||||
RELEASE(aMenu);
|
||||
|
@ -1885,6 +1920,8 @@ static NSImage *classesImage = nil;
|
|||
[archiver encodeClassName: @"GormObjectProxy" intoClassName: @"GSNibItem"];
|
||||
[archiver encodeClassName: @"GormCustomView"
|
||||
intoClassName: @"GSCustomView"];
|
||||
[archiver encodeClassName: @"GormNSMenu"
|
||||
intoClassName: @"NSMenu"];
|
||||
[archiver encodeClassName: @"GormNSWindow"
|
||||
intoClassName: @"NSWindow"];
|
||||
[archiver encodeClassName: @"GormNSBrowser"
|
||||
|
@ -1964,7 +2001,7 @@ static NSImage *classesImage = nil;
|
|||
- (void) setSelectionFromEditor: (id<IBEditors>)anEditor
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
NSLog(@"setSelectionFromEditor %@", anEditor);
|
||||
[nc postNotificationName: IBSelectionChangedNotification
|
||||
object: anEditor];
|
||||
}
|
||||
|
|
|
@ -436,6 +436,7 @@
|
|||
[[inspector revertButton] removeFromSuperview];
|
||||
[[inspector window] setContentView:
|
||||
[[inspectorView subviews] lastObject]];
|
||||
[popup selectItemAtIndex: current];
|
||||
|
||||
ASSIGN(oldInspector, newInspector);
|
||||
inspector = [cache objectForKey: newInspector];
|
||||
|
|
|
@ -740,10 +740,25 @@ NSImage *mVLine = nil;
|
|||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
if ([NSBundle loadNibNamed: @"GormViewSizeInspector" owner: self] == NO)
|
||||
if ([NSBundle loadNibNamed: @"GormViewSizeInspector"
|
||||
owner: self] == NO)
|
||||
{
|
||||
NSLog(@"Could not open gorm GormViewSizeInspector");
|
||||
return nil;
|
||||
|
||||
NSDictionary *table;
|
||||
NSBundle *bundle;
|
||||
|
||||
table = [NSDictionary dictionaryWithObject: self
|
||||
forKey: @"NSOwner"];
|
||||
bundle = [NSBundle mainBundle];
|
||||
|
||||
if ( [bundle loadNibFile: @"GormViewSizeInspector"
|
||||
externalNameTable: table
|
||||
withZone: [self zone]] == NO)
|
||||
{
|
||||
NSLog(@"Could not open gorm GormViewSizeInspector");
|
||||
NSLog(@"self %@", self);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
[top setTag: NSViewMaxYMargin];
|
||||
|
@ -777,8 +792,23 @@ NSImage *mVLine = nil;
|
|||
[[control cellAtIndex: 1] floatValue],
|
||||
[[control cellAtIndex: 2] floatValue],
|
||||
[[control cellAtIndex: 3] floatValue]);
|
||||
[object setFrame: rect];
|
||||
[object setNeedsDisplay: YES];
|
||||
|
||||
if (NSEqualRects(rect, [object frame]) == NO)
|
||||
{
|
||||
NSRect oldFrame = [object frame];
|
||||
|
||||
[object setFrame: rect];
|
||||
[object display];
|
||||
|
||||
if ([object superview])
|
||||
[[object superview] displayRect:
|
||||
GormExtBoundsForRect(oldFrame)];
|
||||
[[object superview] lockFocus];
|
||||
GormDrawKnobsForRect([object frame]);
|
||||
GormShowFastKnobFills();
|
||||
[[object superview] unlockFocus];
|
||||
[[object window] flushWindow];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -826,7 +856,7 @@ NSImage *mVLine = nil;
|
|||
|
||||
- (void) setObject: (id)anObject
|
||||
{
|
||||
if (object != nil)
|
||||
if ((object != nil) && (anObject != object))
|
||||
[object setPostsFrameChangedNotifications: NO];
|
||||
|
||||
if (anObject != nil && anObject != object)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/* GormMatrixEditor.m - Editor for matrices.
|
||||
/* GormTableViewEditor.m - Editor for matrices.
|
||||
*
|
||||
* Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||
* Date: Sep 2002
|
||||
* Date: 2002
|
||||
*
|
||||
* This file is part of GNUstep.
|
||||
*
|
||||
|
@ -68,6 +68,8 @@ static NSColor *_oldColor;
|
|||
[tableView setAllowsColumnReordering: YES];
|
||||
[tableView setGormDelegate: self];
|
||||
}
|
||||
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -75,8 +77,8 @@ static NSColor *_oldColor;
|
|||
inDocument: (id/*<IBDocuments>*/)aDocument
|
||||
{
|
||||
self = [super init];
|
||||
[self changeObject: anObject];
|
||||
document = aDocument;
|
||||
[self changeObject: anObject];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -90,10 +92,6 @@ static NSColor *_oldColor;
|
|||
NSLog(@"close");
|
||||
if (tableView)
|
||||
{
|
||||
if ([tableView selectedColumn] != -1)
|
||||
{
|
||||
[tableView deselectColumn: [tableView selectedColumn]];
|
||||
}
|
||||
[self closeSubeditors];
|
||||
|
||||
[self deactivate];
|
||||
|
@ -122,6 +120,11 @@ static NSColor *_oldColor;
|
|||
{
|
||||
if (tableView)
|
||||
{
|
||||
[tableView setBackgroundColor: [NSColor controlBackgroundColor]];
|
||||
if ([tableView selectedColumn] != -1)
|
||||
{
|
||||
[tableView deselectColumn: [tableView selectedColumn]];
|
||||
}
|
||||
[tableView setAllowsColumnResizing:
|
||||
[tableView gormAllowsColumnResizing]];
|
||||
[tableView setAllowsColumnSelection:
|
||||
|
@ -133,6 +136,7 @@ static NSColor *_oldColor;
|
|||
[tableView setAllowsColumnReordering:
|
||||
[tableView gormAllowsColumnReordering]];
|
||||
[tableView setGormDelegate: nil];
|
||||
[tableView setNeedsDisplay: YES];
|
||||
}
|
||||
NSLog(@"deactivate");
|
||||
selected = nil;
|
||||
|
@ -168,12 +172,17 @@ static NSColor *_oldColor;
|
|||
- (void) copySelection
|
||||
{
|
||||
NSLog(@"copySelection");
|
||||
if (selected != nil)
|
||||
if ([[[self selection] objectAtIndex: 0]
|
||||
isKindOf: [NSTableColumn class]])
|
||||
{
|
||||
[document copyObjects: [self selection]
|
||||
type: IBTableColumnPboardType
|
||||
toPasteboard: [NSPasteboard generalPasteboard]];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"no paste");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -200,6 +209,12 @@ static NSColor *_oldColor;
|
|||
{
|
||||
NSLog(@"warning strange behaviour : GormTableViewEditor pasteInSelection");
|
||||
}
|
||||
else if ([[objects objectAtIndex: 0] isKindOf: [NSTableColumn class]]
|
||||
== NO)
|
||||
{
|
||||
NSLog(@"invalid data in IBTableColumnPboardType");
|
||||
return;
|
||||
}
|
||||
|
||||
[tableView addTableColumn: [objects objectAtIndex: 0]];
|
||||
|
||||
|
@ -263,7 +278,6 @@ static NSColor *_oldColor;
|
|||
- (void) selectObjects: (NSArray*)anArray
|
||||
{
|
||||
id obj = [anArray lastObject];
|
||||
NSLog(@"selectObjects");
|
||||
[self makeSelectionVisible: NO];
|
||||
selected = obj;
|
||||
[document setSelectionFromEditor: self];
|
||||
|
@ -319,11 +333,34 @@ static NSColor *_oldColor;
|
|||
[hitView mouseDown: theEvent];
|
||||
}
|
||||
}
|
||||
else if ([hitView isKindOf: [NSScroller class]])
|
||||
{
|
||||
[hitView mouseDown: theEvent];
|
||||
}
|
||||
else if (hitView == tableView)
|
||||
{
|
||||
if ([tableView selectedColumn] != -1)
|
||||
{
|
||||
[tableView deselectColumn: [tableView selectedColumn]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) changeObject: (id)anObject
|
||||
{
|
||||
if (tableView != nil)
|
||||
{
|
||||
if ([tableView selectedColumn] != -1)
|
||||
{
|
||||
[tableView deselectColumn: [tableView selectedColumn]];
|
||||
}
|
||||
[tableView setBackgroundColor: [NSColor controlBackgroundColor]];
|
||||
}
|
||||
ASSIGN(tableView, anObject);
|
||||
|
||||
[tableView setBackgroundColor: [NSColor whiteColor]];
|
||||
[tableView setNeedsDisplay: YES];
|
||||
[self selectObjects: [NSArray arrayWithObject: tableView]];
|
||||
[self activate];
|
||||
}
|
||||
|
||||
|
@ -339,7 +376,8 @@ static NSColor *_oldColor;
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"no selection");
|
||||
[self selectObjects:
|
||||
[NSArray arrayWithObject: tableView]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +393,9 @@ static NSColor *_oldColor;
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"no selection");
|
||||
selected = nil;
|
||||
[self selectObjects:
|
||||
[NSArray arrayWithObject: tableView]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -423,15 +463,17 @@ static NSColor *_oldColor;
|
|||
|
||||
- (NSArray*) selection
|
||||
{
|
||||
if (selected == nil)
|
||||
if (tableView == nil)
|
||||
return [NSArray array];
|
||||
else if (selected == nil)
|
||||
return [NSArray arrayWithObject: tableView];
|
||||
else
|
||||
return [NSArray arrayWithObject: selected];
|
||||
}
|
||||
|
||||
- (unsigned) selectionCount
|
||||
{
|
||||
return (selected == nil) ? 0 : 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (void) drawSelection
|
||||
|
|
|
@ -623,6 +623,8 @@ static BOOL done_editing;
|
|||
NSPoint mouseDownPoint;
|
||||
NSMutableArray *array;
|
||||
|
||||
NSLog(@"mouseDown %@", self);
|
||||
|
||||
mouseDownPoint = [edit_view convertPoint: [theEvent locationInWindow]
|
||||
fromView: nil];
|
||||
|
||||
|
@ -1289,6 +1291,7 @@ static BOOL done_editing;
|
|||
|
||||
- (BOOL) activate
|
||||
{
|
||||
NSLog(@"GormWindowEditor activate");
|
||||
NSAssert(isClosed == NO, NSInternalInconsistencyException);
|
||||
if (original == nil)
|
||||
{
|
||||
|
@ -1373,6 +1376,7 @@ static BOOL done_editing;
|
|||
|
||||
- (void) deactivate
|
||||
{
|
||||
NSLog(@"GormWindowEditor deactivate");
|
||||
if (original != nil)
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
|
@ -1389,8 +1393,15 @@ static BOOL done_editing;
|
|||
{
|
||||
[original addSubview: sub];
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: NSWindowDidBecomeKeyNotification
|
||||
object: nil];
|
||||
|
||||
DESTROY(original);
|
||||
RELEASE(self);
|
||||
RELEASE(self);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1572,6 +1583,19 @@ static BOOL done_editing;
|
|||
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
||||
IBViewPboardType, GormLinkPboardType, IBFormatterPboardType, nil]];
|
||||
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(windowDidResignMain:)
|
||||
name: NSWindowDidResignMainNotification
|
||||
object: win];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(windowDidBecomeMain:)
|
||||
name: NSWindowDidBecomeMainNotification
|
||||
object: win];
|
||||
|
||||
[win setInitialFirstResponder: self];
|
||||
return self;
|
||||
}
|
||||
|
@ -1666,6 +1690,11 @@ static BOOL done_editing;
|
|||
NSEnumerator *enumerator;
|
||||
NSView *sub;
|
||||
|
||||
if ([[NSApplication sharedApplication] selectionOwner] != self)
|
||||
{
|
||||
[[[NSApplication sharedApplication] selectionOwner] deactivate];
|
||||
}
|
||||
|
||||
[self makeSelectionVisible: NO];
|
||||
/*
|
||||
* Ask the document to get the dragged views from the pasteboard and add
|
||||
|
@ -1907,4 +1936,23 @@ static BOOL done_editing;
|
|||
{
|
||||
return [super window];
|
||||
}
|
||||
|
||||
|
||||
- (void)windowDidBecomeMain: (id) aNotification
|
||||
{
|
||||
NSLog(@"windowDidBecomeMain %@", selection);
|
||||
if ([NSApp isConnecting] == NO)
|
||||
{
|
||||
[document setSelectionFromEditor: self];
|
||||
NSLog(@"windowDidBecomeMain %@", selection);
|
||||
[self makeSelectionVisible: YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowDidResignMain: (id) aNotification
|
||||
{
|
||||
NSLog(@"windowDidResignMain");
|
||||
// [document setSelectionFromEditor: self];
|
||||
[self makeSelectionVisible: NO];
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -28,6 +28,7 @@ PALETTE_NAME = 0Menus
|
|||
0Menus_OBJC_FILES = \
|
||||
GormMenuEditor.m \
|
||||
GormMenuInspectors.m \
|
||||
GormNSMenu.m \
|
||||
main.m
|
||||
0Menus_PRINCIPAL_CLASS = MenusPalette
|
||||
0Menus_RESOURCE_FILES = MenusPalette.tiff
|
||||
|
|
|
@ -114,11 +114,19 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL) resignFirstResponder
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent*)theEvent
|
||||
{
|
||||
NSPoint loc = [theEvent locationInWindow];
|
||||
NSView *hit = [super hitTest: loc];
|
||||
|
||||
[[self window] becomeMainWindow];
|
||||
[[self window] makeFirstResponder: self];
|
||||
|
||||
if (hit == rep)
|
||||
{
|
||||
int pos = [rep indexOfItemAtPoint: loc];
|
||||
|
@ -404,6 +412,7 @@
|
|||
|
||||
- (void) deactivate
|
||||
{
|
||||
NSLog(@"deactivate");
|
||||
if (original != nil)
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
|
@ -413,6 +422,7 @@
|
|||
/*
|
||||
* Swap ourselves out and the original window content view in.
|
||||
*/
|
||||
[self makeSelectionVisible: NO];
|
||||
[original setFrame: [self frame]];
|
||||
[[rep window] setContentView: original];
|
||||
enumerator = [[self subviews] objectEnumerator];
|
||||
|
|
30
Palettes/0Menus/GormNSMenu.h
Normal file
30
Palettes/0Menus/GormNSMenu.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* GormNSMenu.h
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
Author: Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||
Date: 2002
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
@interface GormNSMenu : NSMenu
|
||||
{
|
||||
}
|
||||
@end
|
91
Palettes/0Menus/GormNSMenu.m
Normal file
91
Palettes/0Menus/GormNSMenu.m
Normal file
|
@ -0,0 +1,91 @@
|
|||
/* GormNSMenu.m
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
Author: Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||
Date: 2002
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#import "GormNSMenu.h"
|
||||
|
||||
@interface GormNSMenuWindow : NSWindow
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GormNSMenuWindow
|
||||
- (BOOL)canBecomeMainWindow
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
- (BOOL)canBecomeKeyWindow
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
- (void) sendEvent: (NSEvent*)theEvent
|
||||
{
|
||||
NSEventType type;
|
||||
|
||||
type = [theEvent type];
|
||||
if (type == NSLeftMouseDown)
|
||||
{
|
||||
NSLog(@"here");
|
||||
if (_f.is_main == YES)
|
||||
{
|
||||
NSLog(@"already main %@", [NSApp mainWindow]);
|
||||
}
|
||||
[self makeMainWindow];
|
||||
[self makeKeyWindow];
|
||||
}
|
||||
|
||||
[super sendEvent: theEvent];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation GormNSMenu
|
||||
- (BOOL) performKeyEquivalent: (NSEvent*)theEvent
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
- (NSPanel*) _createWindow
|
||||
{
|
||||
NSLog(@"called _cre");
|
||||
NSPanel *win = [[GormNSMenuWindow alloc]
|
||||
initWithContentRect: NSZeroRect
|
||||
styleMask: /*NSTitledWindowMask/*/NSBorderlessWindowMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: YES];
|
||||
[win setLevel: NSSubmenuWindowLevel];
|
||||
// [win setWorksWhenModal: YES];
|
||||
// [win setBecomesKeyOnlyIfNeeded: YES];
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSMenu (GormNSMenu)
|
||||
+ (id) allocSubstitute
|
||||
{
|
||||
return [GormNSMenu alloc];
|
||||
}
|
||||
@end
|
|
@ -24,6 +24,7 @@
|
|||
#include <Foundation/Foundation.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
#include "../../GormPrivate.h"
|
||||
#include "GormNSMenu.h"
|
||||
|
||||
@interface MenusPalette: IBPalette
|
||||
{
|
||||
|
@ -50,7 +51,7 @@
|
|||
/*
|
||||
* The Info menu
|
||||
*/
|
||||
m = [NSMenu new];
|
||||
m = [GormNSMenu new];
|
||||
[m addItemWithTitle: @"Info Panel..."
|
||||
action: @selector(infoPanel:)
|
||||
keyEquivalent: @""];
|
||||
|
@ -83,7 +84,7 @@
|
|||
/*
|
||||
* The Font menu
|
||||
*/
|
||||
m = [NSMenu new];
|
||||
m = [GormNSMenu new];
|
||||
[m addItemWithTitle: @"Font Panel..."
|
||||
action: @selector(orderFrontFontPanel:)
|
||||
keyEquivalent: @"t"];
|
||||
|
@ -134,7 +135,7 @@
|
|||
/*
|
||||
* The Document menu
|
||||
*/
|
||||
m = [NSMenu new];
|
||||
m = [GormNSMenu new];
|
||||
[m addItemWithTitle: @"Open..."
|
||||
action: @selector(open:)
|
||||
keyEquivalent: @"o"];
|
||||
|
@ -182,7 +183,7 @@
|
|||
/*
|
||||
* The Text menu
|
||||
*/
|
||||
m = [NSMenu new];
|
||||
m = [GormNSMenu new];
|
||||
[m addItemWithTitle: @"Align Left"
|
||||
action: @selector(alignSelLeft:)
|
||||
keyEquivalent: @""];
|
||||
|
@ -224,7 +225,7 @@
|
|||
/*
|
||||
* The Edit menu
|
||||
*/
|
||||
m = [NSMenu new];
|
||||
m = [GormNSMenu new];
|
||||
[m addItemWithTitle: @"Cut"
|
||||
action: @selector(cut:)
|
||||
keyEquivalent: @"x"];
|
||||
|
@ -260,7 +261,7 @@
|
|||
/*
|
||||
* The Find menu
|
||||
*/
|
||||
m = [NSMenu new];
|
||||
m = [GormNSMenu new];
|
||||
[m addItemWithTitle: @"Find Panel..."
|
||||
action: NULL
|
||||
keyEquivalent: @"f"];
|
||||
|
@ -299,14 +300,14 @@
|
|||
/*
|
||||
* The Format menu
|
||||
*/
|
||||
m = [NSMenu new];
|
||||
m = [GormNSMenu new];
|
||||
/*
|
||||
* Font submenu
|
||||
*/
|
||||
i = [m addItemWithTitle: @"Font"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
s = [NSMenu new];
|
||||
s = [GormNSMenu new];
|
||||
[s addItemWithTitle: @"Font Panel..."
|
||||
action: @selector(orderFrontFontPanel:)
|
||||
keyEquivalent: @"t"];
|
||||
|
@ -343,7 +344,7 @@
|
|||
i = [m addItemWithTitle: @"Text"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
s = [NSMenu new];
|
||||
s = [GormNSMenu new];
|
||||
[s addItemWithTitle: @"Align Left"
|
||||
action: @selector(alignSelLeft:)
|
||||
keyEquivalent: @""];
|
||||
|
@ -409,7 +410,7 @@
|
|||
/*
|
||||
* The Windows menu
|
||||
*/
|
||||
m = [NSMenu new];
|
||||
m = [GormNSMenu new];
|
||||
[m addItemWithTitle: @"Arrange In Front"
|
||||
action: @selector(arrangeInFront:)
|
||||
keyEquivalent: @""];
|
||||
|
@ -460,7 +461,7 @@
|
|||
/*
|
||||
* The Services menu
|
||||
*/
|
||||
m = [NSMenu new];
|
||||
m = [GormNSMenu new];
|
||||
[m setTitle: @"Services"];
|
||||
i = [[NSMenuItem alloc] initWithTitle: @"Services"
|
||||
action: @selector(submenuAction:)
|
||||
|
@ -484,7 +485,7 @@
|
|||
/*
|
||||
* The general submenu
|
||||
*/
|
||||
m = [NSMenu new];
|
||||
m = [GormNSMenu new];
|
||||
[m addItemWithTitle: @"Item"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
|
|
Loading…
Reference in a new issue