mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 11:41:05 +00:00
Loads of tidying up etc.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@5654 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
06772dde28
commit
d5b56eea8e
12 changed files with 319 additions and 132 deletions
|
@ -1,3 +1,9 @@
|
|||
Tue Jan 4 12:13:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
Various tidyups
|
||||
Somewhat improved documentation
|
||||
Added registration ddefaults stuff
|
||||
|
||||
Mon Jan 3 10:50:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
Rewrote testing mechanism so that we test by creating an in-memory
|
||||
|
|
3
Defaults.plist
Normal file
3
Defaults.plist
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
SaveAsNib = NO;
|
||||
}
|
|
@ -6,9 +6,6 @@
|
|||
@c %**end of header
|
||||
@defcodeindex cl
|
||||
@defcodeindex pr
|
||||
@ignore
|
||||
I'm using cindex for concepts, findex for procedures and macros.
|
||||
@end ignore
|
||||
|
||||
@include version.texi
|
||||
|
||||
|
@ -62,13 +59,13 @@ Free Software Foundation instead of in the original English.
|
|||
@title Guide to the
|
||||
@title Gorm application
|
||||
@sp 3
|
||||
@c @subtitle last updated December, 1998
|
||||
@c @subtitle last updated January, 2000
|
||||
@subtitle Version @value{GORM-VERSION}
|
||||
@subtitle (for use with @samp{gstep-base} version @value{GNUSTEP-VERSION}
|
||||
@subtitle (for use with @samp{gstep-base} version @value{GNUSTEP-VERSION})
|
||||
@author Richard Frith-Macdonald <richard@@brainstorm.co.uk>
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1999 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1999,2000 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
|
@ -87,7 +84,7 @@ except that the section entitled ``GNU Library General Public License'' may be
|
|||
included in a translation approved by the author instead of in the original
|
||||
English.
|
||||
|
||||
@strong{Note: The GNUstep-Guile library is in alpha release. You will
|
||||
@strong{Note: The Gorm application is in alpha release. You will
|
||||
be performing a valuable service if you report any bugs you encounter.}
|
||||
|
||||
@end titlepage
|
||||
|
@ -95,13 +92,14 @@ be performing a valuable service if you report any bugs you encounter.}
|
|||
@node Top, Copying, ,
|
||||
|
||||
@menu
|
||||
* Copying:: GNU Library Public License says how you can copy
|
||||
* Copying:: GNU Public License says how you can copy
|
||||
and share Gorm.
|
||||
* Contributors:: People who have contributed to Gorm.
|
||||
* Installation:: How to build and install Gorm.
|
||||
* News:: The latest changes to Gorm.
|
||||
|
||||
* Overview:: Gorm in brief.
|
||||
* Usage:: How Gorm is used.
|
||||
* Implementation:: Implementation notes.
|
||||
|
||||
* Concept Index::
|
||||
|
@ -134,9 +132,10 @@ Gorm as part of the GNUstep project.
|
|||
|
||||
@subsection To Do
|
||||
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item Add support for menus
|
||||
|
||||
@item Add more inspectors
|
||||
|
||||
@item Add more editors
|
||||
|
@ -147,31 +146,68 @@ Gorm as part of the GNUstep project.
|
|||
|
||||
@end itemize
|
||||
|
||||
|
||||
@node Overview, Implementation, News, Top
|
||||
@node Overview, Usage, News, Top
|
||||
@chapter Overview
|
||||
|
||||
Gorm is an application for creating the user interface (and possibly entire
|
||||
applications) for a GNUstep application.
|
||||
applications) for a GNUstep application. Initially a close clone of the old
|
||||
NeXTstep 3.3 Interface Builder application, I expect that Gorm will mutate
|
||||
beyond the capabilities of that app.
|
||||
|
||||
GNUstep is an object-oriented programming framework and a collection of tools
|
||||
developed for or using the GNUstep libraries.
|
||||
|
||||
You can find out more about GNUstep at
|
||||
@url{http://www.gnustep.org}@*
|
||||
|
||||
The basic idea behind Gorm is simple - it provides a graphical user interface
|
||||
with which to connect together objects from the GNUstep libraries (as well as
|
||||
custom-written objects) and set their attributes in an easy to use manner.
|
||||
|
||||
The collection of objects is then saved as a document which can either be
|
||||
re-loaded into Gorm for further editing, or can be loaded into a running
|
||||
GNUstep application in order to provide that application with a user
|
||||
interface or some subsystem.
|
||||
|
||||
@subsection Major features
|
||||
@cindex features
|
||||
|
||||
@itemize bullet
|
||||
@item
|
||||
Drag-and-drop creation of GUI elements from palettes.
|
||||
|
||||
@item
|
||||
Run-time loading of additional palettes that may be written using an API
|
||||
very similar to that of Apple/NeXTs interface Builder palette API.
|
||||
|
||||
@item
|
||||
Direct on-screen manipulation of GUI elements
|
||||
|
||||
@item
|
||||
Ineractive test mode for interfaces under development.
|
||||
Manipulation and examination of objects via inspectors.
|
||||
|
||||
@item
|
||||
Drag-and-drop creation of connections between objects.
|
||||
|
||||
@item
|
||||
Ineractive test mode for interfaces/object-networks under development.
|
||||
|
||||
@item
|
||||
Saving data in a format loadable by GNUstep applications.
|
||||
|
||||
@end itemize
|
||||
|
||||
@node Implementation, Concept Index, Overview, Top
|
||||
@node Usage, Implementation, Overview, Top
|
||||
@chapter Usage
|
||||
|
||||
|
||||
@node Implementation, Concept Index, Usage, Top
|
||||
@chapter Implementation
|
||||
|
||||
@menu
|
||||
* Preferences::
|
||||
@end menu
|
||||
|
||||
Notes on implementation
|
||||
|
||||
The IB documentation on how object selection is managed and how editors and
|
||||
|
@ -201,13 +237,35 @@ document object must implement [-windowAndRect:forObject:] to return the
|
|||
window in which the object is being displayed, and the rectangle enclosing
|
||||
the object (in window base coordinates).
|
||||
|
||||
This information is neede by Gorm so that it can mark the connection.
|
||||
This information is needed by Gorm so that it can mark the connection.
|
||||
|
||||
The editors mananging the drag-and-drop operation for a connection must call
|
||||
[NSApp -displayConnectionBetween:and:] to tell Gorm to update its display.
|
||||
This method sets the values currently returned by
|
||||
[BSApp -connectSource] and [NSApp -connectDestination]
|
||||
|
||||
@node Preferences, , Implementation, Implementation
|
||||
@unnumbered Preferences
|
||||
@cindex preferences
|
||||
@cindex defaults
|
||||
|
||||
Currently (Jan 4 2000) there is no preferences panel.
|
||||
Application defaults are stored in the file `Defaults.plist', so this file
|
||||
determines the default values if they are not overridden.
|
||||
|
||||
The current defaults are -
|
||||
|
||||
@itemize @bullet
|
||||
@item SaveAsNib
|
||||
|
||||
If this boolean is set to @samp{YES} then Gorm will save documents with a
|
||||
@samp{.nib} file extension (for NeXT/Apple compatibility), otherwise it will
|
||||
save with a @samp{.gorm} extension. In either case, Gorm will permit attempts
|
||||
to open either type of document.
|
||||
|
||||
NB. While Gorm will attempt to open @samp{.nib} documents, it can't open true
|
||||
NeXT/Apple documents, only ones it has written itsself.
|
||||
@end itemize
|
||||
|
||||
@node Concept Index, , Implementation, Top
|
||||
@unnumbered Concept Index
|
||||
|
|
|
@ -8,7 +8,131 @@ Version 0.0.1
|
|||
|
||||
@itemize @bullet
|
||||
|
||||
@item Pre-pre-alpha
|
||||
@item 8th December 1999
|
||||
|
||||
@itemize @bullet
|
||||
@item Save/Load 'nib' documents (binary archived data)
|
||||
|
||||
This works so far as it can be tested - but that's just archives containing
|
||||
windows or panels so far.
|
||||
|
||||
@item Load palettes
|
||||
|
||||
Loading of palettes works. You can load palettes from the
|
||||
'Tools' menu. Gorm automatically loads all the palettes from its Resources
|
||||
directory.
|
||||
|
||||
@item Basic framework
|
||||
|
||||
So far, the app provides a basic framework that needs fleshing out.
|
||||
@itemize @bullet
|
||||
@item
|
||||
It has a palettes manager object that allows you to select a palette and
|
||||
drag items from the palette into your document.
|
||||
|
||||
@item
|
||||
It has a special per-document editor object, which keeps track of a matrix
|
||||
of icons representing the top-level objects in the document.
|
||||
|
||||
@item
|
||||
It has an inspector manager class, which updates the inspector panel
|
||||
when the selected object is changed by an editor.
|
||||
|
||||
@item
|
||||
It has special inspectors for handling an empty selection or a multiple
|
||||
selection.
|
||||
@end itemize
|
||||
|
||||
@item Palettes
|
||||
|
||||
Four palettes (three of which are empty at present) are built and installed
|
||||
in the apps Resources directory.
|
||||
|
||||
The Window palette is more fully fleshed out than the other palettes.
|
||||
It permits windows and panels to be created in Gorm.
|
||||
If provides the start of a window attributes inspector.
|
||||
|
||||
@end itemize
|
||||
|
||||
@item 18 December 1999
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
You can drag views from a palette into a window or panel.
|
||||
@item
|
||||
You can select views in a window by clicking on them, shift-clicking
|
||||
(for multiple selection), or click-drag on the window background to select
|
||||
views in a box.
|
||||
@item
|
||||
You can delete/cut/copy/paste views betwen windows.
|
||||
@item
|
||||
You can move views in a window by clicking on them and dragging.
|
||||
@item
|
||||
You can resize views by clicking on their knobs and dragging.
|
||||
@item
|
||||
You can control-drag to mark source and destination views for a connection.
|
||||
|
||||
@item Next task - inspectors.
|
||||
|
||||
The connection inspector needs to be implemented to complete the process of
|
||||
establishing connections.
|
||||
The size inspector needs to be implemented to set autosizing parameters for
|
||||
a view.
|
||||
|
||||
Once these are done, the object editor needs to be made to support connections
|
||||
so that we can connect between objects other than views, then we need to write
|
||||
a menu editor.
|
||||
|
||||
@end itemize
|
||||
|
||||
@item 22 December 1999
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
Connections inspector is now working - but it needs some effort to tidy it up.
|
||||
@item
|
||||
Class info (outlets and actions) is specified in 'ClassInformation.plist'
|
||||
and needs to be present so that the app knows what outlets/actions an object
|
||||
has (and therefore what connections can be made).
|
||||
|
||||
@item
|
||||
The view size inspector is working - allowing you to set the size of the
|
||||
subviews within a window.
|
||||
|
||||
@item
|
||||
The attributes inspector for 'FilesOwner' is working, so you can define the
|
||||
class of the files owner (it defaults to NSApplication).
|
||||
|
||||
@item
|
||||
There is a crude panel for setting the name of the selected object.
|
||||
|
||||
@item
|
||||
I've created a couple of new images and got rid of the two NeXT images that
|
||||
were lurking in there.
|
||||
|
||||
@item
|
||||
There is a Testing directory, with a GormTest application that lets you load
|
||||
a nib for testing - it assumes that the nib will set its FilesOwners delegate
|
||||
to point to a window, and makes that window the key window ...
|
||||
@end itemize
|
||||
|
||||
@item 23 December 1999
|
||||
|
||||
Last work before christmas ...
|
||||
|
||||
Various bits of tidying up plus -
|
||||
|
||||
Added an evil hack of a generic attributes inspector ... This looks through
|
||||
all the methods of the selected object to find those taking a single argument
|
||||
and beginning with 'set'. It makes all these setting methods (whose argument
|
||||
is a simple scalar type or an object) available for you to invoke from the
|
||||
inspector panel.
|
||||
|
||||
This makes it possible to set pretty much any attribute of any object, but
|
||||
you do need to have the GNUstep header files to hand, so you can tell what
|
||||
numeric values to enter to achieve a desired result.
|
||||
|
||||
|
||||
@end itemize
|
||||
|
||||
|
|
|
@ -13,10 +13,6 @@ Icons - Mostly by Andrew Lindsay.
|
|||
Code - GormViewKnobs.m adapted from code by Gerrit van Dyk.
|
||||
|
||||
|
||||
8th December 1999
|
||||
|
||||
This is Gorm version 0.0 ... a very pre-pre-alpha release.
|
||||
|
||||
Please note - to build this code you will need the latest library source
|
||||
from the CVS repository, and it may be that you also need to be using the
|
||||
xgps backend rather than xdps (I don't have xdps running to test it on).
|
||||
|
@ -25,112 +21,13 @@ xgps backend rather than xdps (I don't have xdps running to test it on).
|
|||
Gorm is an acronym for Graphic Object Relationship modeler (or perhaps
|
||||
GNUstep Object Relationship Modeler).
|
||||
|
||||
Gorm is a clone of the NeXTstep 'Interface Builder' application for GNUstep.
|
||||
Gorm is a clone of the NeXTstep `Interface Builder' application for GNUstep.
|
||||
|
||||
Gorm is not 'gormless' (a Yorkshire dialect word that my parents used when they
|
||||
Gorm is not `gormless' (a Yorkshire dialect word that my parents used when they
|
||||
spotted me staring, slack-jawed, at the TV).
|
||||
|
||||
Gorm is part of the GNUstep project, and is copyrighted by the Free Software
|
||||
Foundation.
|
||||
|
||||
My aim in writing this is to get a usable IB clone working before the new
|
||||
millenium, so there is not much time left.
|
||||
|
||||
By 'usable' I mean that, at least for simple user interfaces, it should be
|
||||
possible to create/edit/test archived representations of an interface more
|
||||
easily using Gorm than by coding by hand.
|
||||
|
||||
This initial version of the software doesn't come close to that goal - so
|
||||
don't go expecting very much.
|
||||
|
||||
Current state -
|
||||
|
||||
Save/Load 'nib' documents (binary archived data)
|
||||
This works so far as it can be tested - but that's just archives containing
|
||||
windows or panels so far.
|
||||
|
||||
Load palettes
|
||||
Loading of palettes works. You can load palettes from the 'Tools' menu.
|
||||
Gorm automatically loads all the palettes from its Resources directory.
|
||||
|
||||
Basic framework
|
||||
So far, the app provides a basic framework that needs fleshing out.
|
||||
|
||||
It has a palettes manager object that allows you to select a palette and
|
||||
drag items from the palette into your document.
|
||||
|
||||
It has a special per-document editor object, which keeps track of a matrix
|
||||
of icons representing the top-level objects in the document.
|
||||
|
||||
It has an inspector manager class, which updates the inspector panel
|
||||
when the selected object is changed by an editor.
|
||||
|
||||
It has special inspectors for handling an empty selection or a multiple
|
||||
selection.
|
||||
|
||||
Palettes
|
||||
|
||||
Four palettes (three of which are empty at present) are built and installed
|
||||
in the apps Resources directory.
|
||||
|
||||
The Window palette is more fully fleshed out than the other palettes.
|
||||
It permits windows and panels to be created in Gorm.
|
||||
If provides the start of a window attributes inspector.
|
||||
|
||||
18 December 1999
|
||||
|
||||
You can drag views from a palette into a window or panel.
|
||||
You can select views in a window by clicking on them, shift-clicking
|
||||
(for multiple selection), or click-drag on the window background to select
|
||||
views in a box.
|
||||
You can delete/cut/copy/paste views betwen windows.
|
||||
You can move views in a window by clicking on them and dragging.
|
||||
You can resize views by clicking on their knobs and dragging.
|
||||
You can control-drag to mark source and destination views for a connection.
|
||||
|
||||
Next task - inspectors.
|
||||
The connection inspector needs to be implemented to complete the process of
|
||||
establishing connections.
|
||||
The size inspector needs to be implemented to set autosizing parameters for
|
||||
a view.
|
||||
|
||||
Once these are done, the object editor needs to be made to support connections
|
||||
so that we can connect between objects other than views, then we need to write
|
||||
a menu editor.
|
||||
|
||||
22 December 1999
|
||||
|
||||
Connections inspector is now working - but it needs some effort to tidy it up.
|
||||
Class info (outlets and actions) is specified in 'ClassInformation.plist'
|
||||
and needs to be present so that the app knows what outlets/actions an object
|
||||
has (and therefore what connections can be made).
|
||||
|
||||
The view size inspector is working - allowing you to set the size of the
|
||||
subviews within a window.
|
||||
|
||||
The attributes inspector for 'FilesOwner' is working, so you can define the
|
||||
class of the files owner (it defaults to NSApplication).
|
||||
|
||||
There is a crude panel for setting the name of the selected object.
|
||||
|
||||
I've created a couple of new images and got rid of the two NeXT images that
|
||||
were lurking in there.
|
||||
|
||||
There is a Testing directory, with a GormTest application that lets you load
|
||||
a nib for testing - it assumes that the nib will set its FilesOwners delegate
|
||||
to point to a window, and makes that window the key window ...
|
||||
|
||||
23 December 1999
|
||||
|
||||
Last work before christmas ...
|
||||
|
||||
Various bits of tidying up plus -
|
||||
|
||||
Added an evil hack of a generic attributes inspector ... This looks through
|
||||
all the methods of the selected object to find those taking a single argument
|
||||
and beginning with 'set'. It makes all these setting methods (whose argument
|
||||
is a simple scalar type or an object) available for you to invoke from the
|
||||
inspector panel.
|
||||
|
||||
This makes it possible to set pretty much any attribute of any object, but
|
||||
you do need to have the GNUstep header files to hand, so you can tell what
|
||||
numeric values to enter to achieve a desired result.
|
||||
Gorm is released under the GPL - see the file `COPYING' for details.
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ include $(GNUSTEP_MAKEFILES)/common.make
|
|||
# Each palette is a subproject
|
||||
#
|
||||
SUBPROJECTS = \
|
||||
Documentation \
|
||||
Palettes
|
||||
|
||||
#
|
||||
|
@ -37,6 +38,7 @@ APP_NAME = Gorm
|
|||
Gorm_APPLICATION_ICON=Gorm.tiff
|
||||
Gorm_RESOURCE_FILES = \
|
||||
ClassInformation.plist \
|
||||
Defaults.plist \
|
||||
Palettes/0Menus/0Menus.palette \
|
||||
Palettes/1Windows/1Windows.palette \
|
||||
Palettes/2Controls/2Controls.palette \
|
||||
|
|
20
Gorm.m
20
Gorm.m
|
@ -690,6 +690,8 @@ int
|
|||
main(void)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
NSBundle *bundle;
|
||||
NSString *path;
|
||||
NSMenu *aMenu;
|
||||
NSMenu *mainMenu;
|
||||
NSMenu *windowsMenu;
|
||||
|
@ -699,6 +701,24 @@ main(void)
|
|||
pool = [NSAutoreleasePool new];
|
||||
initialize_gnustep_backend ();
|
||||
|
||||
/*
|
||||
* establish registration domain defaults from file.
|
||||
*/
|
||||
bundle = [NSBundle mainBundle];
|
||||
path = [bundle pathForResource: @"Defaults" ofType: @"plist"];
|
||||
if (path != nil)
|
||||
{
|
||||
NSDictionary *dict;
|
||||
|
||||
dict = [NSDictionary dictionaryWithContentsOfFile: path];
|
||||
if (dict != nil)
|
||||
{
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
[defs registerDefaults: dict];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Install an instance of Gorm as the application so that the app
|
||||
* can conform to the IB protocol
|
||||
|
|
|
@ -808,7 +808,7 @@ static NSImage *classesImage = nil;
|
|||
*/
|
||||
- (id) openDocument: (id)sender
|
||||
{
|
||||
NSArray *fileTypes = [NSArray arrayWithObject: @"nib"];
|
||||
NSArray *fileTypes = [NSArray arrayWithObjects: @"gorm", @"nib", nil];
|
||||
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
|
||||
int result;
|
||||
|
||||
|
@ -971,13 +971,21 @@ static NSImage *classesImage = nil;
|
|||
filePoint = [window mouseLocationOutsideOfEventStream];
|
||||
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,
|
||||
* the windows need to be positioned so they are not on top of each other.
|
||||
*/
|
||||
if ([aType isEqualToString: IBWindowPboardType] == YES)
|
||||
{
|
||||
NSWindow *win;
|
||||
|
||||
while ((win = [enumerator nextObject]) != nil)
|
||||
{
|
||||
[self setObject: win isVisibleAtLaunch: YES];
|
||||
[win setFrameTopLeftPoint: screenPoint];
|
||||
screenPoint.x += 10;
|
||||
screenPoint.y -= 10;
|
||||
}
|
||||
}
|
||||
[self attachObjects: objects toParent: parent];
|
||||
|
@ -1011,6 +1019,7 @@ static NSImage *classesImage = nil;
|
|||
if (e != editor && [e wantsSelection] == YES)
|
||||
{
|
||||
[e activate];
|
||||
[self setSelectionFromEditor: e];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1112,12 +1121,21 @@ static NSImage *classesImage = nil;
|
|||
|
||||
- (id) saveAsDocument: (id)sender
|
||||
{
|
||||
NSSavePanel *sp;
|
||||
int result;
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSSavePanel *sp;
|
||||
int result;
|
||||
|
||||
sp = [NSSavePanel savePanel];
|
||||
|
||||
[sp setRequiredFileType: @"nib"];
|
||||
if ([defs boolForKey: @"SaveAsNib"] == YES)
|
||||
{
|
||||
[sp setRequiredFileType: @"nib"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[sp setRequiredFileType: @"gorm"];
|
||||
}
|
||||
|
||||
result = [sp runModalForDirectory: NSHomeDirectory() file: @""];
|
||||
|
||||
if (result == NSOKButton)
|
||||
|
|
|
@ -83,6 +83,18 @@ static NSMapTable *docMap = 0;
|
|||
}
|
||||
}
|
||||
|
||||
+ (GormObjectEditor*) editorForDocument: (id<IBDocuments>)aDocument
|
||||
{
|
||||
id editor = NSMapGet(docMap, (void*)aDocument);
|
||||
|
||||
if (editor == nil)
|
||||
{
|
||||
editor = [[self alloc] initWithObject: nil inDocument: aDocument];
|
||||
AUTORELEASE(editor);
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
|
||||
- (BOOL) acceptsTypeFromArray: (NSArray*)types
|
||||
{
|
||||
if ([types containsObject: IBObjectPboardType] == YES)
|
||||
|
@ -101,7 +113,18 @@ static NSMapTable *docMap = 0;
|
|||
if (anObject != nil
|
||||
&& [objects indexOfObjectIdenticalTo: anObject] == NSNotFound)
|
||||
{
|
||||
NSNotificationCenter *nc;
|
||||
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[objects addObject: anObject];
|
||||
if ([anObject isKindOfClass: [NSWindow class]] == YES)
|
||||
{
|
||||
[nc addObserver: self
|
||||
selector: @selector(handleNotification:)
|
||||
name: NSWindowDidBecomeKeyNotification
|
||||
object: anObject];
|
||||
}
|
||||
[self refreshCells];
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +188,19 @@ static NSMapTable *docMap = 0;
|
|||
&& [[document nameForObject: selected] isEqualToString: @"NSFirst"] == NO
|
||||
&& [[document nameForObject: selected] isEqualToString: @"NSFont"] == NO)
|
||||
{
|
||||
NSNotificationCenter *nc;
|
||||
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[document detachObject: selected];
|
||||
if ([selected isKindOfClass: [NSWindow class]] == YES)
|
||||
{
|
||||
[nc removeObserver: self
|
||||
name: NSWindowDidBecomeKeyNotification
|
||||
object: selected];
|
||||
[selected setReleasedWhenClosed: YES];
|
||||
[selected close];
|
||||
}
|
||||
[objects removeObjectIdenticalTo: selected];
|
||||
[self selectObjects: [NSArray array]];
|
||||
[self refreshCells];
|
||||
|
@ -254,6 +289,17 @@ static NSMapTable *docMap = 0;
|
|||
return document;
|
||||
}
|
||||
|
||||
- (void) handleNotification: (NSNotification*)aNotification
|
||||
{
|
||||
id object = [aNotification object];
|
||||
NSString *name = [aNotification name];
|
||||
|
||||
if ([name isEqual: NSWindowDidBecomeKeyNotification] == YES)
|
||||
{
|
||||
[self selectObjects: [NSArray arrayWithObject: object]];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) editedObject
|
||||
{
|
||||
return selected;
|
||||
|
@ -602,6 +648,7 @@ static NSMapTable *docMap = 0;
|
|||
|
||||
selected = obj;
|
||||
[document setSelectionFromEditor: self];
|
||||
[self makeSelectionVisible: YES];
|
||||
}
|
||||
|
||||
- (NSArray*) selection
|
||||
|
|
|
@ -82,6 +82,7 @@ extern NSString *GormLinkPboardType;
|
|||
NSPasteboard *dragPb;
|
||||
NSString *dragType;
|
||||
}
|
||||
+ (GormObjectEditor*) editorForDocument: (id<IBDocuments>)aDocument;
|
||||
- (void) addObject: (id)anObject;
|
||||
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
|
||||
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
|
||||
|
|
|
@ -1190,9 +1190,20 @@ NSRectFromPoints(NSPoint p0, NSPoint p1)
|
|||
}
|
||||
/*
|
||||
* Now we must let the document (and hence the rest of the app) know
|
||||
* about our new selection.
|
||||
* about our new selection. If there is nothing in it, make sure
|
||||
* that our edited window is selected instead.
|
||||
*/
|
||||
[document setSelectionFromEditor: self];
|
||||
if ([selection count] > 0)
|
||||
{
|
||||
[document setSelectionFromEditor: self];
|
||||
}
|
||||
else
|
||||
{
|
||||
GormObjectEditor *ed;
|
||||
|
||||
ed = [GormObjectEditor editorForDocument: document];
|
||||
[ed selectObjects: [NSArray arrayWithObject: edited]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
unsigned style = NSTitledWindowMask | NSClosableWindowMask
|
||||
| NSResizableWindowMask | NSMiniaturizableWindowMask;
|
||||
|
||||
w = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, 400, 200)
|
||||
w = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, 500, 300)
|
||||
styleMask: style
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
|
@ -67,7 +67,7 @@
|
|||
unsigned style = NSTitledWindowMask | NSClosableWindowMask
|
||||
| NSResizableWindowMask | NSMiniaturizableWindowMask;
|
||||
|
||||
w = [[NSPanel alloc] initWithContentRect: NSMakeRect(0, 0, 400, 200)
|
||||
w = [[NSPanel alloc] initWithContentRect: NSMakeRect(0, 0, 500, 300)
|
||||
styleMask: style
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
|
|
Loading…
Reference in a new issue