Started implementing new feature and fixed a bug with the NSWindowTemplate.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@15607 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-01-16 04:09:07 +00:00
parent a939756a02
commit d7e21278a0
5 changed files with 51 additions and 19 deletions

View file

@ -1,3 +1,16 @@
2003-01-15 Gregory John Casamento <greg_casamento@yahoo.com>
* Gorm.m: [NSWindowTemplate initWithObject:]: corrected
a problem which was preventing the stylemask from being
saved.
* GormDocument.[hm]: Added code to support the deferred
flag for windows. setObject:isDeferred: and
objectIsDeferred: were added.
* Palettes/main.m: Added support for deferred flag.
I didn't enable the flag in the gui, since
NSBundleAdditions.m needs to be changed to allow this
flag to be used. Once that's done, it will be enabled.
2003-01-14 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: replaceTemplatesWithObjects: when

10
Gorm.m
View file

@ -210,10 +210,14 @@ static NSButtonType _buttonTypeForObject( id button )
}
@implementation NSWindowTemplate (GormCustomClassAdditions)
- (void) _setStyleMask: (unsigned int)mask
{
_styleMask = mask;
}
- (id) initWithObject: (id)object
className: (NSString *)name
{
NSLog(@"Creating the new object...");
[super init];
[self setBackgroundColor: [object backgroundColor]];
[self setContentView: [object contentView]];
@ -225,15 +229,15 @@ static NSButtonType _buttonTypeForObject( id button )
[self _setVisible: [object isVisible]];
[self setTitle: [object title]];
[self setFrame: [object frame] display: NO];
[self _setStyleMask: [object styleMask]];
[self setClassName: name];
[object setContentView: nil];
[self update];
[object update];
// [self setDeferFlag: [[(Gorm)NSApp activeDocument] isWindowDeferred: object]];
_parentClassName = NSStringFromClass([object class]);
return self;
}
}
@end
@implementation NSViewTemplate (GormCustomClassAdditions)

View file

@ -48,7 +48,6 @@
NSMenuItem *quitItem; /* Replaced during test */
NSMutableArray *savedEditors;
NSMutableArray *hidden;
NSMutableArray *deferredWindows;
NSMutableSet *sounds;
NSMutableSet *images;
// NSFileWrapper *wrapper;
@ -82,6 +81,7 @@
- (NSString*) nameForObject: (id)anObject;
- (id) objectForName: (NSString*)aString;
- (BOOL) objectIsVisibleAtLaunch: (id)anObject;
- (BOOL) objectIsDeferred: (id)anObject;
- (NSArray*) objects;
- (id) loadDocument: (NSString*)path;
- (id) openDocument: (id)sender;
@ -97,6 +97,7 @@
- (void) setDocumentActive: (BOOL)flag;
- (void) setName: (NSString*)aName forObject: (id)object;
- (void) setObject: (id)anObject isVisibleAtLaunch: (BOOL)flag;
- (void) setObject: (id)anObject isDeferred: (BOOL)flag;
- (void) touch; /* Mark document as having been changed. */
- (NSWindow*) window;
- (BOOL) windowShouldClose: (id)sender;

View file

@ -1480,9 +1480,6 @@ static NSImage *classesImage = nil;
// for saving the editors when the gorm file is persisted.
savedEditors = [NSMutableArray new];
// defferred windows for this document...
deferredWindows = [NSMutableArray new];
// sounds & images
sounds = [NSMutableSet new];
images = [NSMutableSet new];
@ -2414,24 +2411,33 @@ static NSImage *classesImage = nil;
}
}
- (void) setWindow: (id)anObject isDeffered: (BOOL)flag
- (void) setObject: (id)anObject isDeferred: (BOOL)flag
{
NSMutableArray *a = [nameTable objectForKey: @"NSDeferred"];
if (flag == YES)
{
if ([deferredWindows containsObject: anObject] == NO)
if (a == nil)
{
[deferredWindows addObject: anObject];
a = [NSMutableArray new];
[nameTable setObject: a forKey: @"NSDeferred"];
RELEASE(a);
}
if ([a containsObject: anObject] == NO)
{
[a addObject: anObject];
}
}
else
{
[deferredWindows removeObject: anObject];
[a removeObject: anObject];
}
}
- (BOOL) isWindowDeferred: (id)aWindow
- (BOOL) objectIsDeferred: (id)anObject
{
return [deferredWindows containsObject: aWindow];
// NSLog(@"%@, %@", nameTable, anObject);
return [[nameTable objectForKey: @"NSDeferred"] containsObject: anObject];
}
/*

View file

@ -36,6 +36,7 @@
- (void) encodeWithCoder: (NSCoder*)aCoder
{
}
- (id) initWithCoder: (NSCoder*)aCoder
{
id w;
@ -241,11 +242,11 @@ NSwindow inspector
}
// Deferred
// FIXME: This flag is not a Window property. Like Visible at launch time
// it should be stored in the Nib File and used at the Window creation time
// but I do not know how to do that
flag = ([[control cellAtRow: 3 column: 0] state] == NSOnState) ? YES : NO;
{
GormDocument *doc = (GormDocument*)[(id<IB>)NSApp activeDocument];
[doc setObject: object isDeferred: flag];
}
// One shot
flag = ([[control cellAtRow: 4 column: 0] state] == NSOnState) ? YES : NO;
@ -286,13 +287,20 @@ NSwindow inspector
[optionMatrix selectCellAtRow: 0 column: 0];
if ([anObject hidesOnDeactivate])
[optionMatrix selectCellAtRow: 1 column: 0];
// visible at launch time.
{
GormDocument *doc = (GormDocument*)[(id<IB>)NSApp activeDocument];
GormDocument *doc = (GormDocument*)[(id<IB>)NSApp activeDocument];
if ([doc objectIsVisibleAtLaunch: anObject])
[optionMatrix selectCellAtRow: 2 column: 0];
}
// FIXME: defer comes here.
// defer comes here.
{
GormDocument *doc = (GormDocument*)[(id<IB>)NSApp activeDocument];
if ([doc objectIsDeferred: anObject])
[optionMatrix selectCellAtRow: 3 column: 0];
}
if ([anObject isOneShot])
[optionMatrix selectCellAtRow: 4 column: 0];