Various improvements and a correction for but #10849.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20356 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-11-17 05:59:04 +00:00
parent e0ead07623
commit 37839119b2
5 changed files with 57 additions and 18 deletions

View file

@ -1,3 +1,13 @@
2004-11-17 12:59 Gregory John Casamento <greg_casamento@yahoo.com>
* GormViewEditor.m: initWithObject:withDocument: added code
to instantiated GormViewWindow if the view being added has no
window attached to it. This is to handle standalone views.
Correction for Report #10849.
* GormViewWindow.m: [GormViewWindow initWithView:] call to
setReleasedWhenClosed so that the window isn't released when
the view window is closed. This was causing a crash.
2004-11-16 19:19 Gregory John Casamento <greg_casamento@yahoo.com> 2004-11-16 19:19 Gregory John Casamento <greg_casamento@yahoo.com>
* GormClassPanelController.[hm]: Added method browserAction:. Changed * GormClassPanelController.[hm]: Added method browserAction:. Changed

View file

@ -1,15 +1,40 @@
#/* GormColorsPref.h
*
* Copyright (C) 2003 Free Software Foundation, Inc.
*
* 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.
*/
#ifndef INCLUDED_GormColorsPref_h #ifndef INCLUDED_GormColorsPref_h
#define INCLUDED_GormColorsPref_h #define INCLUDED_GormColorsPref_h
#include <Foundation/NSObject.h> #include <Foundation/NSObject.h>
#include <Foundation/NSArray.h> #include <Foundation/NSArray.h>
#include <AppKit/NSView.h> #include <AppKit/NSView.h>
@class NSWindow;
@interface GormColorsPref : NSObject @interface GormColorsPref : NSObject
{ {
id color; id color;
id window; NSWindow *window;
id _view; id _view;
} }
- (NSView *) view; - (NSView *) view;

View file

@ -31,8 +31,7 @@
} }
[color setColor: aColor]; [color setColor: aColor];
_view = [[window contentView] retain];
_view = [[window contentView] retain];
} }
return self; return self;
} }
@ -52,6 +51,9 @@
- (void) ok: (id)sender - (void) ok: (id)sender
{ {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject: colorToDict([color color]) forKey: @"GuideColor"]; if(sender == color)
{
[defaults setObject: colorToDict([color color]) forKey: @"GuideColor"];
}
} }
@end @end

View file

@ -158,17 +158,10 @@ static BOOL currently_displaying = NO;
{ {
NSView *superview; NSView *superview;
// put the view into a "view window" if it's a standalone view... // if the view window is not nil, it's a standalone view...
if([_editedObject window] == nil) if(viewWindow != nil)
{ {
if(viewWindow == nil) [viewWindow setView: _editedObject];
{
viewWindow = [[GormViewWindow alloc] initWithView: _editedObject];
}
else
{
[viewWindow setView: _editedObject];
}
} }
superview = [_editedObject superview]; superview = [_editedObject superview];
@ -317,6 +310,14 @@ static BOOL currently_displaying = NO;
activated = NO; activated = NO;
closed = NO; closed = NO;
// if this window is nil when the editor is created, we know it's a
// standalone view.
if([anObject window] == nil)
{
NSLog(@"#### Stand alone view: %@",_editedObject);
viewWindow = [[GormViewWindow alloc] initWithView: _editedObject];
}
} }
return self; return self;

View file

@ -32,16 +32,16 @@
@interface GormViewWindowDelegate : NSObject @interface GormViewWindowDelegate : NSObject
{ {
id _view; NSView *_view;
} }
- (id) initWithView: (id)view; - (id) initWithView: (NSView *)view;
- (void) resize; - (void) resize;
@end @end
@implementation GormViewWindowDelegate @implementation GormViewWindowDelegate
- (id) initWithView: (id)view; - (id) initWithView: (NSView *)view;
{ {
if((self = [super init]) != nil) if((self = [super init]) != nil)
{ {
@ -87,6 +87,7 @@
[self setTitle: title]; [self setTitle: title];
[self setFrame: NSMakeRect(0,0,400,300) display: YES]; [self setFrame: NSMakeRect(0,0,400,300) display: YES];
// [self setBackgroundColor: [NSColor redColor]]; // [self setBackgroundColor: [NSColor redColor]];
[self setReleasedWhenClosed: NO];
[self setView: view]; [self setView: view];
} }
return self; return self;