New patches

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4328 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-06-02 02:56:07 +00:00
parent dcd2e40b41
commit 37629d31fd
4 changed files with 66 additions and 7 deletions

View file

@ -1,3 +1,16 @@
Wed Jun 2 4:10:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Added patches from jagapen@whitewater.chem.wisc.edu -
* Source/NSApplication.m: In setApplicationIconImage, invoke
([setName:@"NSApplicationIcon"]) on the appicon NSImage so gmodels
can use that name to get the appicon.
* Source/NSOpenPanel.m: Load the save panel gmodel as an NSOpenPanel
instead. (Integrated from mGSTEP code.)
Raise an exception if the panel gmodel is not found.
Added +allocWithZone Removed some old code.
* Model/GMAppKit.m: Changed NSSavePanel code to support sub-classes
(i.e. NSOpenPanel). Encoding/decoding of titles for NSFormCell
Tue Jun 1 18:20:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Headers/AppKit/NSResponder.h: New flag for dnd.

View file

@ -1209,11 +1209,14 @@ void __dummy_GMAppKit_functionForLinking() {}
@"backingType"];
unsigned styleMask = [unarchiver decodeUnsignedIntWithName:@"styleMask"];
NSRect aRect = [unarchiver decodeRectWithName:@"frame"];
NSSavePanel* panel = [[[NSSavePanel allocWithZone:[unarchiver objectZone]]
// Use [self class] here instead of NSSavePanel so as to invoke
// +allocWithZone on the correct (if any) sub-class
NSSavePanel* panel = [[[[self class] allocWithZone:[unarchiver objectZone]]
initWithContentRect:aRect
styleMask:styleMask backing:backingType defer:YES]
autorelease];
NSDebugLLog(@"NSSavePanel", @"NSSavePanel +createObjectForModelUnarchiver");
return panel;
}
@ -1443,3 +1446,22 @@ void __dummy_GMAppKit_functionForLinking() {}
@end /* NSTextFieldCell (GMArchiverMethods) */
@implementation NSFormCell (GMArchiverMethods)
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
{
[super encodeWithModelArchiver:archiver];
[archiver encodeString:[self title] withName:@"title"];
}
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
{
self = [super initWithModelUnarchiver:unarchiver];
[self setTitle:[unarchiver decodeStringWithName:@"title"]];
return self;
}
@end /* NSFormCell (GMArchiverMethods) */

View file

@ -1034,6 +1034,8 @@ NSApplication *NSApp = nil;
// Set the app's icon
- (void) setApplicationIconImage: (NSImage*)anImage
{
[app_icon setName:nil];
[anImage setName:@"NSApplicationIcon"];
ASSIGN(app_icon, anImage);
}

View file

@ -34,6 +34,10 @@
#include <string.h>
#include <Foundation/NSString.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSException.h>
#include <AppKit/GMArchiver.h>
#include <AppKit/IMLoading.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSOpenPanel.h>
/*
@ -52,9 +56,9 @@ static NSOpenPanel *gnustep_gui_open_panel = nil;
+ (void) initialize
{
if (self == [NSOpenPanel class])
{
[self setVersion: 1];
}
{
[self setVersion: 1];
}
}
/*
@ -63,11 +67,29 @@ static NSOpenPanel *gnustep_gui_open_panel = nil;
+ (NSOpenPanel *) openPanel
{
if (!gnustep_gui_open_panel)
{
[GMUnarchiver decodeClassName:@"NSSavePanel"
asClassName:@"NSOpenPanel"];
if( ![GMModel loadIMFile:@"SavePanel" owner:NSApp] )
{
// PanelLoader *pl = [PanelLoader panelLoader];
// gnustep_gui_open_panel = [pl loadPanel: @"NSOpenPanel"];
gnustep_gui_open_panel = [[NSOpenPanel alloc] init];
[NSException raise:NSGenericException
format:@"Unable to load open panel model file"];
}
[gnustep_gui_open_panel setTitle:@"Open"];
[GMUnarchiver decodeClassName:@"NSSavePanel"
asClassName:@"NSSavePanel"];
}
return gnustep_gui_open_panel;
}
+ (id)allocWithZone:(NSZone*)z
{
NSDebugLLog(@"NSOpenPanel", @"NSOpenPanel +allocWithZone");
if( !gnustep_gui_open_panel)
gnustep_gui_open_panel = NSAllocateObject(self, 0, z);
return gnustep_gui_open_panel;
}