1998-11-19 21:53:44 +00:00
|
|
|
/* -*- C++ -*-
|
1997-12-04 01:58:57 +00:00
|
|
|
GMAppKit.m
|
|
|
|
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Ovidiu Predescu <ovidiu@net-community.com>
|
|
|
|
Date: November 1997
|
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library 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
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/NSArray.h>
|
|
|
|
#import <Foundation/NSException.h>
|
1998-02-04 17:46:08 +00:00
|
|
|
#include "AppKit/GMAppKit.h"
|
1997-12-04 01:58:57 +00:00
|
|
|
|
|
|
|
void __dummy_GMAppKit_functionForLinking() {}
|
|
|
|
|
|
|
|
@implementation NSApplication (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
#if NeXT_GUI_LIBRARY
|
|
|
|
NSArray* windows1 = [self windows];
|
|
|
|
NSMutableArray* windows2 = [NSMutableArray array];
|
|
|
|
int i, count = [windows1 count];
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
NSWindow* window = [windows1 objectAtIndex:i];
|
|
|
|
|
|
|
|
if (![window isKindOfClass:[NSMenu class]])
|
|
|
|
[windows2 addObject:window];
|
|
|
|
}
|
|
|
|
[archiver encodeObject:windows2 withName:@"windows"];
|
|
|
|
|
|
|
|
#else
|
|
|
|
[archiver encodeObject:[self windows] withName:@"windows"];
|
|
|
|
#endif
|
|
|
|
[archiver encodeObject:[self keyWindow] withName:@"keyWindow"];
|
|
|
|
[archiver encodeObject:[self mainWindow] withName:@"mainWindow"];
|
|
|
|
[archiver encodeObject:[self mainMenu] withName:@"mainMenu"];
|
1998-01-14 03:39:14 +00:00
|
|
|
[archiver encodeObject:[self delegate] withName:@"delegate"];
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
NSArray* windows;
|
|
|
|
NSWindow* keyWindow;
|
|
|
|
NSWindow* mainWindow;
|
|
|
|
NSMenu* mainMenu;
|
1998-01-14 03:39:14 +00:00
|
|
|
id anObject;
|
1997-12-04 01:58:57 +00:00
|
|
|
|
|
|
|
#if GNU_GUI_LIBRARY
|
|
|
|
mainMenu = [unarchiver decodeObjectWithName:@"mainMenu"];
|
1998-01-14 03:39:14 +00:00
|
|
|
if (mainMenu)
|
|
|
|
[self setMainMenu:mainMenu];
|
1997-12-04 01:58:57 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
windows = [unarchiver decodeObjectWithName:@"windows"];
|
|
|
|
keyWindow = [unarchiver decodeObjectWithName:@"keyWindow"];
|
|
|
|
mainWindow = [unarchiver decodeObjectWithName:@"mainWindow"];
|
1998-01-14 23:03:44 +00:00
|
|
|
|
1998-01-14 03:39:14 +00:00
|
|
|
anObject = [unarchiver decodeObjectWithName:@"delegate"];
|
1998-01-14 23:03:44 +00:00
|
|
|
if (anObject)
|
|
|
|
[self setDelegate:anObject];
|
1997-12-04 01:58:57 +00:00
|
|
|
|
|
|
|
#if NeXT_GUI_LIBRARY
|
|
|
|
mainMenu = [unarchiver decodeObjectWithName:@"mainMenu"];
|
1998-01-14 03:39:14 +00:00
|
|
|
if (mainMenu)
|
|
|
|
[self setMainMenu:mainMenu];
|
1997-12-04 01:58:57 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
[keyWindow makeKeyWindow];
|
|
|
|
[mainWindow makeMainWindow];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)awakeFromModel
|
|
|
|
{
|
|
|
|
NSMenu* mainMenu = [self mainMenu];
|
|
|
|
|
|
|
|
[mainMenu update];
|
1999-05-09 07:27:45 +00:00
|
|
|
#if XDPS_BACKEND_LIBRARY || XRAW_BACKEND_LIBRARY || XGPS_BACKEND_LIBRARY
|
1997-12-04 01:58:57 +00:00
|
|
|
[mainMenu display];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
1998-12-13 11:29:13 +00:00
|
|
|
return [NSApplication sharedApplication];
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSApplication (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
1998-01-14 23:03:44 +00:00
|
|
|
@implementation NSBox (GMArchiverMethods)
|
1998-01-15 00:55:50 +00:00
|
|
|
|
1998-01-14 23:03:44 +00:00
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
1999-04-29 12:25:10 +00:00
|
|
|
[archiver encodeSize:[self contentViewMargins] withName:@"contentViewMargins"];
|
1998-01-14 23:03:44 +00:00
|
|
|
[archiver encodeInt:[self borderType] withName:@"borderType"];
|
|
|
|
[archiver encodeInt:[self titlePosition] withName:@"titlePosition"];
|
|
|
|
[archiver encodeString:[self title] withName:@"title"];
|
|
|
|
[archiver encodeObject:[self titleFont] withName:@"titleFont"];
|
|
|
|
[archiver encodeObject:[self contentView] withName:@"contentView"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
1999-04-27 14:56:43 +00:00
|
|
|
[self setContentViewMargins:[unarchiver decodeSizeWithName:@"contentViewMargins"]];
|
1998-01-14 23:03:44 +00:00
|
|
|
[self setBorderType:[unarchiver decodeIntWithName:@"borderType"]];
|
|
|
|
[self setTitlePosition:[unarchiver decodeIntWithName:@"titlePosition"]];
|
|
|
|
[self setTitle:[unarchiver decodeStringWithName:@"title"]];
|
|
|
|
[self setTitleFont:[unarchiver decodeObjectWithName:@"titleFont"]];
|
|
|
|
[self setContentView:[unarchiver decodeObjectWithName:@"contentView"]];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSBox (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
1997-12-04 01:58:57 +00:00
|
|
|
@implementation NSButton (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
float delay, interval;
|
|
|
|
id theCell = [self cell];
|
|
|
|
|
|
|
|
[archiver encodeInt:[self state] withName:@"state"];
|
1999-03-24 09:01:12 +00:00
|
|
|
[self getPeriodicDelay:&delay interval:&interval];
|
1997-12-04 01:58:57 +00:00
|
|
|
[archiver encodeFloat:delay withName:@"delay"];
|
|
|
|
[archiver encodeFloat:interval withName:@"interval"];
|
|
|
|
[archiver encodeString:[self title] withName:@"title"];
|
|
|
|
[archiver encodeString:[self alternateTitle] withName:@"alternateTitle"];
|
|
|
|
[archiver encodeObject:[self image] withName:@"image"];
|
|
|
|
[archiver encodeObject:[self alternateImage] withName:@"alternateImage"];
|
|
|
|
[archiver encodeInt:[self imagePosition] withName:@"imagePosition"];
|
|
|
|
[archiver encodeBOOL:[self isBordered] withName:@"isBordered"];
|
|
|
|
[archiver encodeBOOL:[self isTransparent] withName:@"isTransparent"];
|
|
|
|
[archiver encodeString:[self keyEquivalent] withName:@"keyEquivalent"];
|
|
|
|
[archiver encodeInt:[theCell highlightsBy] withName:@"highlightsBy"];
|
|
|
|
[archiver encodeInt:[theCell showsStateBy] withName:@"showsStateBy"];
|
|
|
|
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
float delay, interval;
|
1999-04-14 15:38:36 +00:00
|
|
|
id theCell;
|
1997-12-04 01:58:57 +00:00
|
|
|
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
[self setState:[unarchiver decodeIntWithName:@"state"]];
|
|
|
|
|
|
|
|
delay = [unarchiver decodeFloatWithName:@"delay"];
|
|
|
|
interval = [unarchiver decodeFloatWithName:@"interval"];
|
|
|
|
[self setPeriodicDelay:delay interval:interval];
|
|
|
|
|
|
|
|
[self setTitle:[unarchiver decodeStringWithName:@"title"]];
|
|
|
|
[self setAlternateTitle:[unarchiver decodeStringWithName:@"alternateTitle"]];
|
|
|
|
[self setImage:[unarchiver decodeObjectWithName:@"image"]];
|
|
|
|
[self setAlternateImage:[unarchiver decodeObjectWithName:@"alternateImage"]];
|
|
|
|
[self setImagePosition:[unarchiver decodeIntWithName:@"imagePosition"]];
|
|
|
|
[self setBordered:[unarchiver decodeBOOLWithName:@"isBordered"]];
|
|
|
|
[self setTransparent:[unarchiver decodeBOOLWithName:@"isTransparent"]];
|
|
|
|
[self setKeyEquivalent:[unarchiver decodeStringWithName:@"keyEquivalent"]];
|
1999-04-29 12:25:10 +00:00
|
|
|
|
|
|
|
theCell = [self cell];
|
|
|
|
|
1997-12-04 01:58:57 +00:00
|
|
|
[theCell setHighlightsBy:[unarchiver decodeIntWithName:@"highlightsBy"]];
|
|
|
|
[theCell setShowsStateBy:[unarchiver decodeIntWithName:@"showsStateBy"]];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSButton (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSCell (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
1999-03-24 09:01:12 +00:00
|
|
|
[archiver encodeInt:[self type] withName:@"type"];
|
|
|
|
[archiver encodeObject:[self font] withName:@"font"];
|
|
|
|
[archiver encodeString:[self stringValue] withName:@"stringValue"];
|
|
|
|
[archiver encodeInt:[self entryType] withName:@"entryType"];
|
|
|
|
[archiver encodeInt:[self alignment] withName:@"alignment"];
|
|
|
|
[archiver encodeBOOL:[self wraps] withName:@"wraps"];
|
|
|
|
[archiver encodeObject:[self image] withName:@"image"];
|
|
|
|
[archiver encodeInt:[self state] withName:@"state"];
|
|
|
|
[archiver encodeBOOL:[self isEnabled] withName:@"isEnabled"];
|
|
|
|
[archiver encodeBOOL:[self isBordered] withName:@"isBordered"];
|
|
|
|
[archiver encodeBOOL:[self isBezeled] withName:@"isBezeled"];
|
|
|
|
[archiver encodeBOOL:[self isEditable] withName:@"isEditable"];
|
|
|
|
[archiver encodeBOOL:[self isSelectable] withName:@"isSelectable"];
|
|
|
|
[archiver encodeBOOL:[self isScrollable] withName:@"isScrollable"];
|
|
|
|
[archiver encodeBOOL:[self isContinuous] withName:@"isContinuous"];
|
|
|
|
[archiver encodeInt:[self sendActionOn:0] withName:@"sendActionMask"];
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
1999-03-24 09:01:12 +00:00
|
|
|
NSFont* font = [unarchiver decodeObjectWithName:@"font"];
|
|
|
|
if (!font)
|
|
|
|
font = [NSFont userFontOfSize:0];
|
|
|
|
|
|
|
|
[self setFont:font];
|
|
|
|
|
|
|
|
// if (model_version >= 2) {
|
|
|
|
[self setStringValue:[unarchiver decodeStringWithName:@"stringValue"]];
|
|
|
|
[self setEntryType:[unarchiver decodeIntWithName:@"entryType"]];
|
|
|
|
[self setAlignment:[unarchiver decodeIntWithName:@"alignment"]];
|
|
|
|
[self setWraps:[unarchiver decodeBOOLWithName:@"wraps"]];
|
|
|
|
[self setImage:[unarchiver decodeObjectWithName:@"image"]];
|
|
|
|
[self setState:[unarchiver decodeIntWithName:@"state"]];
|
|
|
|
[self setEnabled:[unarchiver decodeBOOLWithName:@"isEnabled"]];
|
|
|
|
[self setBordered:[unarchiver decodeBOOLWithName:@"isBordered"]];
|
|
|
|
[self setBezeled:[unarchiver decodeBOOLWithName:@"isBezeled"]];
|
|
|
|
[self setEditable:[unarchiver decodeBOOLWithName:@"isEditable"]];
|
|
|
|
[self setSelectable:[unarchiver decodeBOOLWithName:@"isSelectable"]];
|
|
|
|
[self setScrollable:[unarchiver decodeBOOLWithName:@"isScrollable"]];
|
|
|
|
[self setContinuous:[unarchiver decodeBOOLWithName:@"isContinuous"]];
|
|
|
|
[self sendActionOn:[unarchiver decodeIntWithName:@"sendActionMask"]];
|
1999-04-01 09:37:06 +00:00
|
|
|
[self setType:[unarchiver decodeIntWithName:@"type"]];
|
1999-03-24 09:01:12 +00:00
|
|
|
// }
|
|
|
|
|
|
|
|
return self;
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSCell (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
1999-03-24 09:01:12 +00:00
|
|
|
|
|
|
|
@implementation NSActionCell (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
|
|
|
[archiver encodeInt:[self tag] withName:@"tag"];
|
|
|
|
[archiver encodeObject:[self target] withName:@"target"];
|
|
|
|
[archiver encodeSelector:[self action] withName:@"action"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
// if (model_version >= 2) {
|
|
|
|
[self setTag:[unarchiver decodeIntWithName:@"tag"]];
|
|
|
|
[self setTarget:[unarchiver decodeObjectWithName:@"target"]];
|
|
|
|
[self setAction:[unarchiver decodeSelectorWithName:@"action"]];
|
|
|
|
// }
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSActionCell (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSButtonCell (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
float delay, interval;
|
|
|
|
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
|
|
|
[self getPeriodicDelay:&delay interval:&interval];
|
|
|
|
[archiver encodeFloat:delay withName:@"delay"];
|
|
|
|
[archiver encodeFloat:interval withName:@"interval"];
|
1999-08-19 23:30:03 +00:00
|
|
|
[archiver encodeString:[self title] withName:@"title"];
|
1999-03-24 09:01:12 +00:00
|
|
|
[archiver encodeString:[self alternateTitle] withName:@"alternateTitle"];
|
|
|
|
[archiver encodeObject:[self alternateImage] withName:@"alternateImage"];
|
|
|
|
[archiver encodeInt:[self imagePosition] withName:@"imagePosition"];
|
|
|
|
[archiver encodeBOOL:[self isTransparent] withName:@"isTransparent"];
|
|
|
|
[archiver encodeString:[self keyEquivalent] withName:@"keyEquivalent"];
|
|
|
|
[archiver encodeObject:[self keyEquivalentFont] withName:@"keyEquivalentFont"];
|
|
|
|
[archiver encodeInt:[self keyEquivalentModifierMask] withName:@"keyEquivalentModifierMask"];
|
|
|
|
[archiver encodeInt:[self highlightsBy] withName:@"highlightsBy"];
|
|
|
|
[archiver encodeInt:[self showsStateBy] withName:@"showsStateBy"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
float delay, interval;
|
|
|
|
id obj;
|
|
|
|
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
// if (model_version >= 2) {
|
|
|
|
delay = [unarchiver decodeFloatWithName:@"delay"];
|
|
|
|
interval = [unarchiver decodeFloatWithName:@"interval"];
|
|
|
|
[self setPeriodicDelay:delay interval:interval];
|
|
|
|
|
1999-08-19 23:30:03 +00:00
|
|
|
obj = [unarchiver decodeStringWithName:@"title"];
|
|
|
|
if (obj) [self setTitle:obj];
|
1999-03-24 09:01:12 +00:00
|
|
|
obj = [unarchiver decodeStringWithName:@"alternateTitle"];
|
|
|
|
if (obj) [self setAlternateTitle:obj];
|
|
|
|
obj = [unarchiver decodeObjectWithName:@"alternateImage"];
|
|
|
|
[self setAlternateImage:obj];
|
|
|
|
[self setImagePosition:[unarchiver decodeIntWithName:@"imagePosition"]];
|
|
|
|
[self setTransparent:[unarchiver decodeBOOLWithName:@"isTransparent"]];
|
|
|
|
[self setKeyEquivalent:[unarchiver decodeStringWithName:@"keyEquivalent"]];
|
|
|
|
[self setKeyEquivalentFont:[unarchiver decodeObjectWithName:@"keyEquivalentFont"]];
|
|
|
|
[self setKeyEquivalentModifierMask:[unarchiver decodeIntWithName:@"keyEquivalentModifierMask"]];
|
|
|
|
[self setHighlightsBy:[unarchiver decodeIntWithName:@"highlightsBy"]];
|
|
|
|
[self setShowsStateBy:[unarchiver decodeIntWithName:@"showsStateBy"]];
|
|
|
|
// }
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSButtonCell (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSMatrix (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
|
|
|
[archiver encodeInt:[self mode] withName:@"mode"];
|
|
|
|
[archiver encodeBOOL:[self allowsEmptySelection] withName:@"allowsEmptySelection"];
|
|
|
|
[archiver encodeBOOL:[self isSelectionByRect] withName:@"isSelectionByRect"];
|
|
|
|
|
|
|
|
[archiver encodeBOOL:[self autosizesCells] withName:@"autosizesCells"];
|
|
|
|
[archiver encodeBOOL:[self isAutoscroll] withName:@"isAutoscroll"];
|
|
|
|
[archiver encodeSize:[self cellSize] withName:@"cellSize"];
|
|
|
|
[archiver encodeSize:[self intercellSpacing] withName:@"intercellSpacing"];
|
|
|
|
[archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"];
|
|
|
|
[archiver encodeObject:[self cellBackgroundColor] withName:@"cellBackgroundColor"];
|
|
|
|
[archiver encodeBOOL:[self drawsBackground] withName:@"drawsBackground"];
|
|
|
|
[archiver encodeBOOL:[self drawsCellBackground] withName:@"drawsCellBackground"];
|
|
|
|
|
|
|
|
[archiver encodeClass:[self cellClass] withName:@"cellClass"];
|
|
|
|
[archiver encodeObject:[self prototype] withName:@"prototype"];
|
|
|
|
[archiver encodeInt:[self numberOfRows] withName:@"numberOfRows"];
|
|
|
|
[archiver encodeInt:[self numberOfColumns] withName:@"numberOfColumns"];
|
|
|
|
[archiver encodeObject:[self cells] withName:@"cells"];
|
|
|
|
[archiver encodeObject:[self delegate] withName:@"delegate"];
|
|
|
|
|
|
|
|
[archiver encodeObject:[self target] withName:@"target"];
|
|
|
|
[archiver encodeSelector:[self action] withName:@"action"];
|
|
|
|
[archiver encodeSelector:[self doubleAction] withName:@"doubleAction"];
|
|
|
|
[archiver encodeSelector:[self errorAction] withName:@"errorAction"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
int nr, nc;
|
|
|
|
NSArray *cell_array;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
// if (model_version >= 2) {
|
|
|
|
[self setMode:[unarchiver decodeIntWithName:@"mode"]];
|
|
|
|
[self setAllowsEmptySelection:[unarchiver decodeBOOLWithName:@"allowsEmptySelection"]];
|
|
|
|
[self setSelectionByRect:[unarchiver decodeBOOLWithName:@"isSelectionByRect"]];
|
|
|
|
|
|
|
|
[self setAutosizesCells:[unarchiver decodeBOOLWithName:@"autosizesCells"]];
|
|
|
|
[self setAutoscroll:[unarchiver decodeBOOLWithName:@"isAutoscroll"]];
|
|
|
|
[self setCellSize:[unarchiver decodeSizeWithName:@"cellSize"]];
|
|
|
|
[self setIntercellSpacing:[unarchiver decodeSizeWithName:@"intercellSpacing"]];
|
|
|
|
[self setBackgroundColor:[unarchiver decodeObjectWithName:@"backgroundColor"]];
|
|
|
|
[self setCellBackgroundColor:[unarchiver decodeObjectWithName:@"cellBackgroundColor"]];
|
|
|
|
[self setDrawsBackground:[unarchiver decodeBOOLWithName:@"drawsBackground"]];
|
|
|
|
[self setDrawsCellBackground:[unarchiver decodeBOOLWithName:@"drawsCellBackground"]];
|
|
|
|
|
|
|
|
[self setCellClass:[unarchiver decodeClassWithName:@"cellClass"]];
|
|
|
|
[self setPrototype:[unarchiver decodeObjectWithName:@"prototype"]];
|
|
|
|
|
|
|
|
nr = [unarchiver decodeIntWithName:@"numberOfRows"];
|
|
|
|
nc = [unarchiver decodeIntWithName:@"numberOfColumns"];
|
|
|
|
cell_array = [unarchiver decodeObjectWithName:@"cells"];
|
|
|
|
[self renewRows:nr columns:nc];
|
|
|
|
for (i = 0; (i < [cell_array count]) && (i < nr*nc); i++) {
|
|
|
|
[self putCell:[cell_array objectAtIndex:i] atRow:i/nc column:i%nc];
|
|
|
|
}
|
|
|
|
|
|
|
|
[self setDelegate:[unarchiver decodeObjectWithName:@"delegate"]];
|
|
|
|
|
|
|
|
|
|
|
|
[self setTarget:[unarchiver decodeObjectWithName:@"target"]];
|
|
|
|
[self setAction:[unarchiver decodeSelectorWithName:@"action"]];
|
|
|
|
[self setDoubleAction:[unarchiver decodeSelectorWithName:@"doubleAction"]];
|
|
|
|
[self setErrorAction:[unarchiver decodeSelectorWithName:@"errorAction"]];
|
|
|
|
[self sizeToCells];
|
|
|
|
// }
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSMatrix (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSScrollView (GMArchiverMethods)
|
|
|
|
|
|
|
|
// do not encode our subviews in NSView (it would encode the clipview and
|
|
|
|
// the scroller, which are not necessary).
|
|
|
|
- (NSArray *)subviewsForModel
|
|
|
|
{
|
|
|
|
return [NSArray array];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
|
|
|
[archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"];
|
|
|
|
[archiver encodeInt:[self borderType] withName:@"borderType"];
|
|
|
|
[archiver encodeBOOL:[self hasHorizontalScroller] withName:@"hasHorizontalScroller"];
|
|
|
|
[archiver encodeBOOL:[self hasVerticalScroller] withName:@"hasVerticalScroller"];
|
|
|
|
[archiver encodeObject:[self documentView] withName:@"documentView"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
[self setBackgroundColor:[unarchiver decodeObjectWithName:@"backgroundColor"]];
|
|
|
|
[self setBorderType:[unarchiver decodeIntWithName:@"borderType"]];
|
|
|
|
[self setHasHorizontalScroller:[unarchiver decodeBOOLWithName:@"hasHorizontalScroller"]];
|
|
|
|
[self setHasVerticalScroller:[unarchiver decodeBOOLWithName:@"hasVerticalScroller"]];
|
|
|
|
[self setDocumentView:[unarchiver decodeObjectWithName:@"documentView"]];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSScrollView (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
1998-01-30 00:34:25 +00:00
|
|
|
@implementation NSClipView (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
|
|
|
[archiver encodeObject:[self documentView] withName:@"documentView"];
|
|
|
|
[archiver encodeBOOL:[self copiesOnScroll] withName:@"copiesOnScroll"];
|
|
|
|
[archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
[self setDocumentView:[unarchiver decodeObjectWithName:@"documentView"]];
|
|
|
|
[self setCopiesOnScroll:[unarchiver decodeBOOLWithName:@"copiesOnScroll"]];
|
|
|
|
[self setBackgroundColor:[unarchiver decodeObjectWithName:@"backgroundColor"]];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSClipView (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
1997-12-04 01:58:57 +00:00
|
|
|
@implementation NSColor (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
NSString* colorSpaceName = [self colorSpaceName];
|
|
|
|
|
|
|
|
[archiver encodeString:colorSpaceName withName:@"colorSpaceName"];
|
|
|
|
|
|
|
|
if ([colorSpaceName isEqual:@"NSDeviceCMYKColorSpace"]) {
|
|
|
|
[archiver encodeFloat:[self cyanComponent] withName:@"cyan"];
|
|
|
|
[archiver encodeFloat:[self magentaComponent] withName:@"magenta"];
|
|
|
|
[archiver encodeFloat:[self yellowComponent] withName:@"yellow"];
|
|
|
|
[archiver encodeFloat:[self blackComponent] withName:@"black"];
|
|
|
|
[archiver encodeFloat:[self alphaComponent] withName:@"alpha"];
|
|
|
|
}
|
|
|
|
else if ([colorSpaceName isEqual:@"NSDeviceWhiteColorSpace"]
|
|
|
|
|| [colorSpaceName isEqual:@"NSCalibratedWhiteColorSpace"]) {
|
|
|
|
[archiver encodeFloat:[self whiteComponent] withName:@"white"];
|
|
|
|
[archiver encodeFloat:[self alphaComponent] withName:@"alpha"];
|
|
|
|
}
|
|
|
|
else if ([colorSpaceName isEqual:@"NSDeviceRGBColorSpace"]
|
|
|
|
|| [colorSpaceName isEqual:@"NSCalibratedRGBColorSpace"]) {
|
|
|
|
[archiver encodeFloat:[self redComponent] withName:@"red"];
|
|
|
|
[archiver encodeFloat:[self greenComponent] withName:@"green"];
|
|
|
|
[archiver encodeFloat:[self blueComponent] withName:@"blue"];
|
|
|
|
[archiver encodeFloat:[self alphaComponent] withName:@"alpha"];
|
|
|
|
[archiver encodeFloat:[self hueComponent] withName:@"hue"];
|
|
|
|
[archiver encodeFloat:[self saturationComponent] withName:@"saturation"];
|
|
|
|
[archiver encodeFloat:[self brightnessComponent] withName:@"brightness"];
|
|
|
|
}
|
|
|
|
else if ([colorSpaceName isEqual:@"NSNamedColorSpace"]) {
|
|
|
|
// TODO: change it when NSColor in GNUstep will have named color lists
|
|
|
|
#if 1
|
|
|
|
NSColor* new
|
|
|
|
= [self colorUsingColorSpaceName:@"NSCalibratedRGBColorSpace"];
|
|
|
|
[new encodeWithModelArchiver:archiver];
|
|
|
|
#else
|
|
|
|
[unarchiver encodeString:[self catalogNameComponent]
|
|
|
|
withName:@"catalogName"];
|
|
|
|
[unarchiver encodeString:[self colorNameComponent] withName:@"colorName"];
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
NSString* colorSpaceName
|
|
|
|
= [unarchiver decodeStringWithName:@"colorSpaceName"];
|
|
|
|
|
|
|
|
if ([colorSpaceName isEqual:@"NSDeviceCMYKColorSpace"]) {
|
|
|
|
float cyan = [unarchiver decodeFloatWithName:@"cyan"];
|
|
|
|
float magenta = [unarchiver decodeFloatWithName:@"magenta"];
|
|
|
|
float yellow = [unarchiver decodeFloatWithName:@"yellow"];
|
|
|
|
float black = [unarchiver decodeFloatWithName:@"black"];
|
|
|
|
float alpha = [unarchiver decodeFloatWithName:@"alpha"];
|
|
|
|
|
1998-12-13 11:29:13 +00:00
|
|
|
return [NSColor colorWithDeviceCyan:cyan
|
1997-12-04 01:58:57 +00:00
|
|
|
magenta:magenta
|
|
|
|
yellow:yellow
|
|
|
|
black:black
|
|
|
|
alpha:alpha];
|
|
|
|
}
|
|
|
|
else if ([colorSpaceName isEqual:@"NSDeviceWhiteColorSpace"]) {
|
|
|
|
float white = [unarchiver decodeFloatWithName:@"white"];
|
|
|
|
float alpha = [unarchiver decodeFloatWithName:@"alpha"];
|
|
|
|
|
1998-12-13 11:29:13 +00:00
|
|
|
return [NSColor colorWithDeviceWhite:white alpha:alpha];
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
else if ([colorSpaceName isEqual:@"NSCalibratedWhiteColorSpace"]) {
|
|
|
|
float white = [unarchiver decodeFloatWithName:@"white"];
|
|
|
|
float alpha = [unarchiver decodeFloatWithName:@"alpha"];
|
|
|
|
|
1998-12-13 11:29:13 +00:00
|
|
|
return [NSColor colorWithCalibratedWhite:white alpha:alpha];
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
else if ([colorSpaceName isEqual:@"NSDeviceRGBColorSpace"]) {
|
|
|
|
float red = [unarchiver decodeFloatWithName:@"red"];
|
|
|
|
float green = [unarchiver decodeFloatWithName:@"green"];
|
|
|
|
float blue = [unarchiver decodeFloatWithName:@"blue"];
|
|
|
|
float alpha = [unarchiver decodeFloatWithName:@"alpha"];
|
|
|
|
|
|
|
|
return [self colorWithDeviceRed:red green:green blue:blue alpha:alpha];
|
|
|
|
}
|
|
|
|
else if ([colorSpaceName isEqual:@"NSCalibratedRGBColorSpace"]) {
|
|
|
|
float red = [unarchiver decodeFloatWithName:@"red"];
|
|
|
|
float green = [unarchiver decodeFloatWithName:@"green"];
|
|
|
|
float blue = [unarchiver decodeFloatWithName:@"blue"];
|
|
|
|
float alpha = [unarchiver decodeFloatWithName:@"alpha"];
|
|
|
|
|
|
|
|
return [self colorWithCalibratedRed:red green:green blue:blue alpha:alpha];
|
|
|
|
}
|
|
|
|
else if ([colorSpaceName isEqual:@"NSNamedColorSpace"]) {
|
|
|
|
NSAssert (0, @"Named color spaces not supported yet!");
|
|
|
|
}
|
1998-01-15 00:55:50 +00:00
|
|
|
return nil;
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (Class)classForModelArchiver
|
|
|
|
{
|
1998-01-15 00:55:50 +00:00
|
|
|
return [NSColor class];
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSColor (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSControl (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
1999-03-24 09:01:12 +00:00
|
|
|
[archiver encodeObject:[self cell] withName:@"cell"];
|
|
|
|
[archiver encodeBOOL:[self isEnabled] withName:@"isEnabled"];
|
|
|
|
[archiver encodeInt:[self tag] withName:@"tag"];
|
|
|
|
[archiver encodeBOOL:[self ignoresMultiClick] withName:@"ignoresMultiClick"];
|
1997-12-04 01:58:57 +00:00
|
|
|
|
1999-03-24 09:01:12 +00:00
|
|
|
[super encodeWithModelArchiver:archiver];
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
1999-03-24 09:01:12 +00:00
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
// if (model_version == 1) {
|
|
|
|
//[self setTarget:[unarchiver decodeObjectWithName:@"target"]];
|
|
|
|
//[self setAction:[unarchiver decodeSelectorWithName:@"action"]];
|
|
|
|
//[self setEnabled:[unarchiver decodeBOOLWithName:@"isEnabled"]];
|
|
|
|
//[self setAlignment:[unarchiver decodeIntWithName:@"alignment"]];
|
|
|
|
//[self setFont:[unarchiver decodeObjectWithName:@"font"]];
|
|
|
|
//[self setContinuous:[unarchiver decodeBOOLWithName:@"isContinuous"]];
|
|
|
|
//[self setTag:[unarchiver decodeIntWithName:@"tag"]];
|
|
|
|
//[self setIgnoresMultiClick:
|
|
|
|
// [unarchiver decodeBOOLWithName:@"ignoresMultiClick"]];
|
|
|
|
// } else {
|
|
|
|
[self setCell:[unarchiver decodeObjectWithName:@"cell"]];
|
|
|
|
[self setEnabled:[unarchiver decodeBOOLWithName:@"isEnabled"]];
|
|
|
|
[self setTag:[unarchiver decodeIntWithName:@"tag"]];
|
|
|
|
[self setIgnoresMultiClick:
|
|
|
|
[unarchiver decodeBOOLWithName:@"ignoresMultiClick"]];
|
|
|
|
// }
|
|
|
|
return self;
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSControl (GMArchiverMethods) */
|
|
|
|
|
1999-06-14 20:33:19 +00:00
|
|
|
#ifndef __APPLE__
|
1998-01-09 22:28:14 +00:00
|
|
|
@implementation NSCStringText (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
return [super initWithModelUnarchiver:unarchiver];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSCStringText (GMArchiverMethods) */
|
1999-06-14 20:33:19 +00:00
|
|
|
#endif
|
1998-01-09 22:28:14 +00:00
|
|
|
|
1997-12-04 01:58:57 +00:00
|
|
|
@implementation NSFont (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[archiver encodeString:[self fontName] withName:@"name"];
|
|
|
|
[archiver encodeFloat:[self pointSize] withName:@"size"];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
1998-12-13 11:29:13 +00:00
|
|
|
return [NSFont fontWithName:[unarchiver decodeStringWithName:@"name"]
|
1997-12-04 01:58:57 +00:00
|
|
|
size:[unarchiver decodeFloatWithName:@"size"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSFont (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSImage (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[archiver encodeString:[self name] withName:@"name"];
|
|
|
|
[archiver encodeSize:[self size] withName:@"size"];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
1998-12-13 11:29:13 +00:00
|
|
|
id image = [NSImage imageNamed:[unarchiver decodeStringWithName:@"name"]];
|
1998-01-09 22:28:14 +00:00
|
|
|
|
|
|
|
if (!image)
|
1998-12-13 11:29:13 +00:00
|
|
|
image = [NSImage imageNamed:@"NSRadioButton"];
|
1998-01-09 22:28:14 +00:00
|
|
|
return image;
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
[self setSize:[unarchiver decodeSizeWithName:@"size"]];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSImage (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSMenuItem (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
1999-05-09 07:27:45 +00:00
|
|
|
#if XDPS_BACKEND_LIBRARY || XRAW_BACKEND_LIBRARY || XGPS_BACKEND_LIBRARY
|
1997-12-04 01:58:57 +00:00
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
[archiver encodeObject:[self target] withName:@"target"];
|
|
|
|
[archiver encodeSelector:[self action] withName:@"action"];
|
|
|
|
[archiver encodeString:[self title] withName:@"title"];
|
|
|
|
[archiver encodeInt:[self tag] withName:@"tag"];
|
|
|
|
[archiver encodeBOOL:[self isEnabled] withName:@"isEnabled"];
|
|
|
|
[archiver encodeString:[self keyEquivalent] withName:@"keyEquivalent"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
1999-05-09 07:27:45 +00:00
|
|
|
#if XDPS_BACKEND_LIBRARY || XRAW_BACKEND_LIBRARY || XGPS_BACKEND_LIBRARY
|
1997-12-04 01:58:57 +00:00
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
[self setTarget:[unarchiver decodeObjectWithName:@"target"]];
|
|
|
|
[self setAction:[unarchiver decodeSelectorWithName:@"action"]];
|
|
|
|
[self setTitle:[unarchiver decodeStringWithName:@"title"]];
|
|
|
|
[self setTag:[unarchiver decodeIntWithName:@"tag"]];
|
|
|
|
[self setEnabled:[unarchiver decodeBOOLWithName:@"isEnabled"]];
|
|
|
|
[self setKeyEquivalent:[unarchiver decodeStringWithName:@"keyEquivalent"]];
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
NSLog (@"menu item %@: target = %@, isEnabled = %d",
|
|
|
|
[self title], [self target], [self isEnabled]);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSMenuItem (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSMenu (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[archiver encodeObject:[self itemArray] withName:@"itemArray"];
|
|
|
|
[archiver encodeBOOL:[self autoenablesItems] withName:@"autoenablesItems"];
|
|
|
|
[archiver encodeString:[self title] withName:@"title"];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Define this method here because on OPENSTEP 4.x the NSMenu is inherited from
|
|
|
|
NSWindow and we don't want the NSWindow's method to be called. */
|
|
|
|
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
NSString* theTitle = [unarchiver decodeStringWithName:@"title"];
|
|
|
|
return [[[self allocWithZone:[unarchiver objectZone]] initWithTitle:theTitle]
|
|
|
|
autorelease];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
int i, count;
|
|
|
|
NSMutableArray* itemArray = [self itemArray];
|
|
|
|
NSMutableArray* decodedItems
|
|
|
|
= [unarchiver decodeObjectWithName:@"itemArray"];
|
|
|
|
|
|
|
|
for (i = 0, count = [decodedItems count]; i < count; i++)
|
1999-07-13 01:58:32 +00:00
|
|
|
[self addItem:[decodedItems objectAtIndex:i]];
|
|
|
|
// [self addItemWithTitle:@"dummy" action:NULL keyEquivalent:@""];
|
1997-12-04 01:58:57 +00:00
|
|
|
|
1999-07-13 01:58:32 +00:00
|
|
|
// [itemArray replaceObjectsInRange:NSMakeRange(0, count)
|
|
|
|
// withObjectsFromArray:decodedItems];
|
1997-12-04 01:58:57 +00:00
|
|
|
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
id item = [itemArray objectAtIndex:i];
|
|
|
|
id target = [item target];
|
|
|
|
|
|
|
|
if ([target isKindOfClass:[NSMenu class]])
|
|
|
|
[self setSubmenu:target forItem:item];
|
|
|
|
}
|
|
|
|
|
|
|
|
[self setAutoenablesItems:
|
|
|
|
[unarchiver decodeBOOLWithName:@"autoenablesItems"]];
|
|
|
|
|
|
|
|
[self sizeToFit];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSMenu (GMArchiverMethods) */
|
|
|
|
|
1999-06-30 03:10:38 +00:00
|
|
|
#if 0
|
1998-01-09 22:28:14 +00:00
|
|
|
@implementation NSPopUpButton (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
1998-01-15 21:01:41 +00:00
|
|
|
[archiver encodeBOOL:[self pullsDown] withName:@"pullsDown"];
|
1999-04-29 12:25:10 +00:00
|
|
|
|
1998-01-16 00:57:21 +00:00
|
|
|
#if 0
|
|
|
|
/* OUCH! This code crashes the translator; probably we interfere somehow with
|
|
|
|
the way NSPopUpButton is handled by the NeXT's NIB code. Sorry, the
|
|
|
|
popup buttons cannot be handled by the convertor! */
|
1998-01-15 21:01:41 +00:00
|
|
|
[archiver encodeArray:[self itemArray] withName:@"itemArray"];
|
|
|
|
[archiver encodeString:[self titleOfSelectedItem] withName:@"selectedItem"];
|
1998-01-16 00:57:21 +00:00
|
|
|
[super encodeWithModelArchiver:archiver];
|
1999-04-29 12:25:10 +00:00
|
|
|
#else // need frame for workarounds to know where to place the popup
|
|
|
|
[archiver encodeRect:[self frame] withName:@"frame"];
|
1998-01-16 00:57:21 +00:00
|
|
|
#endif
|
1998-01-09 22:28:14 +00:00
|
|
|
}
|
|
|
|
|
1999-04-29 12:25:10 +00:00
|
|
|
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
NSRect rect = [unarchiver decodeRectWithName:@"frame"];
|
|
|
|
NSPopUpButton *popup = \
|
|
|
|
[[[NSPopUpButton allocWithZone:[unarchiver objectZone]]
|
|
|
|
initWithFrame:rect
|
|
|
|
pullsDown:[unarchiver decodeBOOLWithName:@"pullsDown"]]
|
|
|
|
autorelease];
|
|
|
|
if (!popup)
|
|
|
|
NSLog (@"cannot create the requested view!");
|
|
|
|
|
|
|
|
return popup;
|
|
|
|
}
|
|
|
|
|
1998-01-09 22:28:14 +00:00
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
1998-01-30 00:34:25 +00:00
|
|
|
/* Check the following: the program simply crashes if there's nothing in the
|
|
|
|
model file */
|
1998-11-22 11:21:48 +00:00
|
|
|
|
1998-01-15 21:01:41 +00:00
|
|
|
int i, count;
|
|
|
|
NSMutableArray* decodedItems
|
|
|
|
= [unarchiver decodeObjectWithName:@"itemArray"];
|
1998-01-09 22:28:14 +00:00
|
|
|
|
1998-01-15 21:01:41 +00:00
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
1998-11-22 11:21:48 +00:00
|
|
|
if (decodedItems) {
|
|
|
|
for (i = 0, count = [decodedItems count]; i < count; i++) {
|
|
|
|
id item = [decodedItems objectAtIndex:i];
|
|
|
|
id myItem;
|
|
|
|
|
|
|
|
[self addItemWithTitle:[item title]];
|
|
|
|
myItem = [self itemAtIndex:i];
|
|
|
|
[myItem setTarget:[item target]];
|
|
|
|
[myItem setAction:[item action]];
|
|
|
|
[myItem setEnabled:[item isEnabled]];
|
|
|
|
[myItem setTag:[item tag]];
|
|
|
|
[myItem setKeyEquivalent:[item keyEquivalent]];
|
|
|
|
}
|
1998-01-15 21:01:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[self selectItemWithTitle:[unarchiver decodeStringWithName:@"selectedItem"]];
|
|
|
|
[self synchronizeTitleAndSelectedItem];
|
1998-11-22 11:21:48 +00:00
|
|
|
|
1998-01-15 21:01:41 +00:00
|
|
|
|
|
|
|
return self;
|
1998-01-09 22:28:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSPopUpButton (GMArchiverMethods) */
|
1999-06-30 03:10:38 +00:00
|
|
|
#endif
|
1998-01-09 22:28:14 +00:00
|
|
|
|
1997-12-04 01:58:57 +00:00
|
|
|
@implementation NSResponder (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
id nextResponder;
|
|
|
|
|
|
|
|
if ((nextResponder = [self nextResponder]))
|
|
|
|
[archiver encodeObject:nextResponder withName:@"nextResponder"];
|
1999-06-12 08:36:38 +00:00
|
|
|
if ([self respondsToSelector: @selector(interfaceStyle)])
|
|
|
|
[archiver encodeUnsignedInt: [self interfaceStyle]
|
|
|
|
withName:@"interfaceStyle"];
|
1997-12-04 01:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
[self setNextResponder:[unarchiver decodeObjectWithName:@"nextResponder"]];
|
1999-06-12 08:36:38 +00:00
|
|
|
if ([self respondsToSelector: @selector(setInterfaceStyle:)])
|
|
|
|
[self setInterfaceStyle:
|
|
|
|
[unarchiver decodeUnsignedIntWithName:@"interfaceStyle"]];
|
|
|
|
|
1997-12-04 01:58:57 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSResponder (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSTextField (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
id theCell = [self cell];
|
|
|
|
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
|
|
|
[archiver encodeBOOL:[self isSelectable] withName:@"isSelectable"];
|
|
|
|
[archiver encodeSelector:[self errorAction] withName:@"errorAction"];
|
|
|
|
[archiver encodeObject:[self textColor] withName:@"textColor"];
|
|
|
|
[archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"];
|
|
|
|
[archiver encodeBOOL:[self drawsBackground] withName:@"drawsBackground"];
|
|
|
|
[archiver encodeBOOL:[self isBordered] withName:@"isBordered"];
|
|
|
|
[archiver encodeBOOL:[self isBezeled] withName:@"isBezeled"];
|
|
|
|
[archiver encodeObject:[self nextText] withName:@"nextText"];
|
|
|
|
[archiver encodeObject:[self previousText] withName:@"previousText"];
|
|
|
|
[archiver encodeObject:[self delegate] withName:@"delegate"];
|
|
|
|
[archiver encodeString:[self stringValue] withName:@"stringValue"];
|
|
|
|
[archiver encodeBOOL:[self isEditable] withName:@"isEditable"];
|
|
|
|
[archiver encodeBOOL:[theCell isScrollable] withName:@"isScrollable"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
1999-04-14 15:38:36 +00:00
|
|
|
id theCell;
|
1997-12-04 01:58:57 +00:00
|
|
|
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
[self setSelectable:[unarchiver decodeBOOLWithName:@"isSelectable"]];
|
|
|
|
[self setErrorAction:[unarchiver decodeSelectorWithName:@"errorAction"]];
|
|
|
|
[self setTextColor:[unarchiver decodeObjectWithName:@"textColor"]];
|
|
|
|
[self setBackgroundColor:
|
|
|
|
[unarchiver decodeObjectWithName:@"backgroundColor"]];
|
|
|
|
[self setDrawsBackground:[unarchiver decodeBOOLWithName:@"drawsBackground"]];
|
|
|
|
|
1998-11-20 03:36:09 +00:00
|
|
|
[self setBordered:[unarchiver decodeBOOLWithName:@"isBordered"]];
|
|
|
|
[self setBezeled:[unarchiver decodeBOOLWithName:@"isBezeled"]];
|
1997-12-04 01:58:57 +00:00
|
|
|
|
|
|
|
[self setNextText:[unarchiver decodeObjectWithName:@"nextText"]];
|
|
|
|
[self setPreviousText:[unarchiver decodeObjectWithName:@"previousText"]];
|
|
|
|
[self setDelegate:[unarchiver decodeObjectWithName:@"delegate"]];
|
1999-04-29 12:25:10 +00:00
|
|
|
|
|
|
|
theCell = [self cell];
|
|
|
|
|
1997-12-04 01:58:57 +00:00
|
|
|
[theCell setStringValue:[unarchiver decodeStringWithName:@"stringValue"]];
|
|
|
|
[self setEditable:[unarchiver decodeBOOLWithName:@"isEditable"]];
|
|
|
|
[theCell setScrollable:[unarchiver decodeBOOLWithName:@"isScrollable"]];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSTextField (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSView (GMArchiverMethods)
|
|
|
|
|
1999-03-24 09:01:12 +00:00
|
|
|
// subclasses may not want to encode all subviews...
|
|
|
|
- (NSArray *)subviewsForModel
|
|
|
|
{
|
|
|
|
return [self subviews];
|
|
|
|
}
|
|
|
|
|
1997-12-04 01:58:57 +00:00
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
|
|
|
[archiver encodeConditionalObject:[self superview] withName:@"superview"];
|
1999-03-24 09:01:12 +00:00
|
|
|
[archiver encodeObject:[self subviewsForModel] withName:@"subviews"];
|
1997-12-04 01:58:57 +00:00
|
|
|
[archiver encodeRect:[self frame] withName:@"frame"];
|
|
|
|
[archiver encodeRect:[self bounds] withName:@"bounds"];
|
|
|
|
[archiver encodeBOOL:[self postsFrameChangedNotifications]
|
|
|
|
withName:@"postsFrameChangedNotifications"];
|
|
|
|
[archiver encodeBOOL:[self postsBoundsChangedNotifications]
|
|
|
|
withName:@"postsBoundsChangedNotifications"];
|
|
|
|
[archiver encodeBOOL:[self autoresizesSubviews]
|
|
|
|
withName:@"autoresizesSubviews"];
|
|
|
|
[archiver encodeUnsignedInt:[self autoresizingMask]
|
|
|
|
withName:@"autoresizingMask"];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
NSRect rect = [unarchiver decodeRectWithName:@"frame"];
|
|
|
|
NSView* view = [[[self allocWithZone:[unarchiver objectZone]]
|
|
|
|
initWithFrame:rect]
|
|
|
|
autorelease];
|
1998-01-30 00:34:25 +00:00
|
|
|
if (!view)
|
|
|
|
NSLog (@"cannot create the requested view!");
|
1997-12-04 01:58:57 +00:00
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
NSArray* subviews;
|
|
|
|
int i, count;
|
|
|
|
id superview;
|
|
|
|
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
superview = [unarchiver decodeObjectWithName:@"superview"];
|
|
|
|
[superview addSubview:self];
|
|
|
|
|
|
|
|
subviews = [unarchiver decodeObjectWithName:@"subviews"];
|
|
|
|
for (i = 0, count = [subviews count]; i < count; i++)
|
|
|
|
[self addSubview:[subviews objectAtIndex:i]];
|
|
|
|
|
1999-03-24 09:01:12 +00:00
|
|
|
// [self setBounds:[unarchiver decodeRectWithName:@"bounds"]];
|
1997-12-04 01:58:57 +00:00
|
|
|
[self setPostsFrameChangedNotifications:
|
|
|
|
[unarchiver decodeBOOLWithName:@"postsFrameChangedNotifications"]];
|
|
|
|
[self setPostsBoundsChangedNotifications:
|
|
|
|
[unarchiver decodeBOOLWithName:@"postsBoundsChangedNotifications"]];
|
|
|
|
[self setAutoresizesSubviews:
|
|
|
|
[unarchiver decodeBOOLWithName:@"autoresizesSubviews"]];
|
|
|
|
[self setAutoresizingMask:
|
|
|
|
[unarchiver decodeUnsignedIntWithName:@"autoresizingMask"]];
|
|
|
|
|
1999-07-23 18:07:42 +00:00
|
|
|
#ifndef NeXT_GUI_LIBRARY
|
1999-05-07 20:08:51 +00:00
|
|
|
_rFlags.flipped_view = [self isFlipped];
|
1999-06-10 21:12:10 +00:00
|
|
|
_rFlags.opaque_view = [self isOpaque];
|
1999-05-07 20:08:51 +00:00
|
|
|
if ([sub_views count])
|
|
|
|
_rFlags.has_subviews = 1;
|
1999-07-23 18:07:42 +00:00
|
|
|
#endif
|
1999-05-07 20:08:51 +00:00
|
|
|
|
1997-12-04 01:58:57 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSView (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSWindow (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
1999-04-29 12:25:10 +00:00
|
|
|
NSPoint wnOrigin = [self frame].origin;
|
|
|
|
NSRect ctFrame = [[self contentView] frame];
|
|
|
|
|
|
|
|
ctFrame.origin = wnOrigin;
|
|
|
|
|
|
|
|
[archiver encodeRect:ctFrame withName:@"contentFrame"];
|
1997-12-04 01:58:57 +00:00
|
|
|
[archiver encodeSize:[self maxSize] withName:@"maxSize"];
|
|
|
|
[archiver encodeSize:[self minSize] withName:@"minSize"];
|
|
|
|
[archiver encodeString:[self frameAutosaveName]
|
|
|
|
withName:@"frameAutosaveName"];
|
|
|
|
[archiver encodeInt:[self level] withName:@"level"];
|
|
|
|
[archiver encodeBOOL:[self isVisible] withName:@"isVisible"];
|
|
|
|
[archiver encodeBOOL:[self isAutodisplay] withName:@"isAutodisplay"];
|
|
|
|
[archiver encodeString:[self title] withName:@"title"];
|
|
|
|
[archiver encodeString:[self representedFilename]
|
|
|
|
withName:@"representedFilename"];
|
|
|
|
[archiver encodeBOOL:[self isReleasedWhenClosed]
|
|
|
|
withName:@"isReleasedWhenClosed"];
|
|
|
|
[archiver encodeObject:[self contentView] withName:@"contentView"];
|
|
|
|
[archiver encodeBOOL:[self hidesOnDeactivate]
|
|
|
|
withName:@"hidesOnDeactivate"];
|
|
|
|
[archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"];
|
|
|
|
[archiver encodeUnsignedInt:[self styleMask] withName:@"styleMask"];
|
|
|
|
[archiver encodeUnsignedInt:[self backingType] withName:@"backingType"];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
unsigned backingType = [unarchiver decodeUnsignedIntWithName:@"backingType"];
|
|
|
|
unsigned styleMask = [unarchiver decodeUnsignedIntWithName:@"styleMask"];
|
1999-04-27 14:56:43 +00:00
|
|
|
NSRect ctRect = [unarchiver decodeRectWithName:@"contentFrame"];
|
1999-04-29 12:25:10 +00:00
|
|
|
|
1998-12-13 11:29:13 +00:00
|
|
|
NSWindow* win = [[[NSWindow allocWithZone:[unarchiver objectZone]]
|
1999-04-27 14:56:43 +00:00
|
|
|
initWithContentRect:ctRect
|
1997-12-04 01:58:57 +00:00
|
|
|
styleMask:styleMask backing:backingType defer:YES]
|
|
|
|
autorelease];
|
1999-04-29 12:25:10 +00:00
|
|
|
// printf("content: %g, %g -- frame %g, %g\n", ctRect.size.width, ctRect.size.height, [win frame].size.width, [win frame].size.height);
|
1999-04-27 14:56:43 +00:00
|
|
|
|
1997-12-04 01:58:57 +00:00
|
|
|
return win;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
NSString* frameAutosaveName;
|
|
|
|
|
|
|
|
[self setContentView:[unarchiver decodeObjectWithName:@"contentView"]];
|
|
|
|
[self setMaxSize:[unarchiver decodeSizeWithName:@"maxSize"]];
|
|
|
|
[self setMinSize:[unarchiver decodeSizeWithName:@"minSize"]];
|
|
|
|
|
|
|
|
frameAutosaveName = [unarchiver decodeStringWithName:@"frameAutosaveName"];
|
|
|
|
if (frameAutosaveName)
|
|
|
|
[self setFrameAutosaveName:frameAutosaveName];
|
|
|
|
|
1999-07-23 18:07:42 +00:00
|
|
|
#ifndef NeXT_GUI_LIBRARY
|
1999-07-06 20:31:16 +00:00
|
|
|
window_level = [unarchiver decodeIntWithName:@"level"];
|
1999-07-23 18:07:42 +00:00
|
|
|
#endif
|
1997-12-04 01:58:57 +00:00
|
|
|
|
|
|
|
[self setAutodisplay:[unarchiver decodeBOOLWithName:@"isAutodisplay"]];
|
|
|
|
[self setTitle:[unarchiver decodeStringWithName:@"title"]];
|
|
|
|
[self setRepresentedFilename:
|
|
|
|
[unarchiver decodeStringWithName:@"representedFilename"]];
|
|
|
|
[self setReleasedWhenClosed:
|
|
|
|
[unarchiver decodeBOOLWithName:@"isReleasedWhenClosed"]];
|
|
|
|
[self setHidesOnDeactivate:
|
|
|
|
[unarchiver decodeBOOLWithName:@"hidesOnDeactivate"]];
|
|
|
|
[self setBackgroundColor:
|
|
|
|
[unarchiver decodeObjectWithName:@"backgroundColor"]];
|
|
|
|
if ([unarchiver decodeBOOLWithName:@"isVisible"])
|
|
|
|
[self orderFront:nil];
|
|
|
|
|
|
|
|
#if GNU_GUI_LIBRARY
|
1998-11-25 17:16:48 +00:00
|
|
|
[[self contentView] setNeedsDisplay:YES];
|
1997-12-04 01:58:57 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSWindow (GMArchiverMethods) */
|
|
|
|
|
1998-11-19 21:53:44 +00:00
|
|
|
@implementation NSPanel (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
1999-04-29 12:25:10 +00:00
|
|
|
NSPoint wnOrigin = [self frame].origin;
|
|
|
|
NSRect ctFrame = [[self contentView] frame];
|
|
|
|
|
|
|
|
ctFrame.origin = wnOrigin;
|
|
|
|
|
|
|
|
[archiver encodeRect:ctFrame withName:@"contentFrame"];
|
1998-11-19 21:53:44 +00:00
|
|
|
[archiver encodeSize:[self maxSize] withName:@"maxSize"];
|
|
|
|
[archiver encodeSize:[self minSize] withName:@"minSize"];
|
|
|
|
[archiver encodeString:[self frameAutosaveName]
|
|
|
|
withName:@"frameAutosaveName"];
|
|
|
|
[archiver encodeInt:[self level] withName:@"level"];
|
|
|
|
[archiver encodeBOOL:[self isVisible] withName:@"isVisible"];
|
|
|
|
[archiver encodeBOOL:[self isAutodisplay] withName:@"isAutodisplay"];
|
|
|
|
[archiver encodeString:[self title] withName:@"title"];
|
|
|
|
[archiver encodeString:[self representedFilename]
|
|
|
|
withName:@"representedFilename"];
|
|
|
|
[archiver encodeBOOL:[self isReleasedWhenClosed]
|
|
|
|
withName:@"isReleasedWhenClosed"];
|
|
|
|
[archiver encodeObject:[self contentView] withName:@"contentView"];
|
|
|
|
[archiver encodeBOOL:[self hidesOnDeactivate]
|
|
|
|
withName:@"hidesOnDeactivate"];
|
|
|
|
[archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"];
|
|
|
|
[archiver encodeUnsignedInt:[self styleMask] withName:@"styleMask"];
|
|
|
|
[archiver encodeUnsignedInt:[self backingType] withName:@"backingType"];
|
|
|
|
|
|
|
|
[archiver encodeBOOL:[self isFloatingPanel] withName:@"isFloatingPanel"];
|
|
|
|
[archiver encodeBOOL:[self becomesKeyOnlyIfNeeded]
|
|
|
|
withName:@"becomesKeyOnlyIfNeeded"];
|
|
|
|
[archiver encodeBOOL:[self worksWhenModal] withName:@"worksWhenModal"];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
unsigned backingType = [unarchiver decodeUnsignedIntWithName:
|
|
|
|
@"backingType"];
|
|
|
|
unsigned styleMask = [unarchiver decodeUnsignedIntWithName:@"styleMask"];
|
1999-04-29 12:25:10 +00:00
|
|
|
NSRect ctRect = [unarchiver decodeRectWithName:@"contentFrame"];
|
1998-12-13 11:29:13 +00:00
|
|
|
NSPanel* panel = [[[NSPanel allocWithZone:[unarchiver objectZone]]
|
1999-04-29 12:25:10 +00:00
|
|
|
initWithContentRect:ctRect
|
1998-11-19 21:53:44 +00:00
|
|
|
styleMask:styleMask backing:backingType defer:YES]
|
|
|
|
autorelease];
|
|
|
|
|
|
|
|
return panel;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(id)initWithModelUnarchiver :(GMUnarchiver *)unarchiver
|
|
|
|
{
|
|
|
|
NSString* frameAutosaveName;
|
|
|
|
|
|
|
|
[self setContentView:[unarchiver decodeObjectWithName:@"contentView"]];
|
|
|
|
[self setMaxSize:[unarchiver decodeSizeWithName:@"maxSize"]];
|
|
|
|
[self setMinSize:[unarchiver decodeSizeWithName:@"minSize"]];
|
|
|
|
|
|
|
|
frameAutosaveName = [unarchiver decodeStringWithName:@"frameAutosaveName"];
|
|
|
|
if (frameAutosaveName)
|
|
|
|
[self setFrameAutosaveName:frameAutosaveName];
|
|
|
|
|
1999-07-23 18:07:42 +00:00
|
|
|
#ifndef NeXT_GUI_LIBRARY
|
1999-07-06 20:31:16 +00:00
|
|
|
window_level = [unarchiver decodeIntWithName:@"level"];
|
1999-07-23 18:07:42 +00:00
|
|
|
#endif
|
1998-11-19 21:53:44 +00:00
|
|
|
|
|
|
|
[self setAutodisplay:[unarchiver decodeBOOLWithName:@"isAutodisplay"]];
|
|
|
|
[self setTitle:[unarchiver decodeStringWithName:@"title"]];
|
|
|
|
[self setRepresentedFilename:
|
|
|
|
[unarchiver decodeStringWithName:@"representedFilename"]];
|
|
|
|
[self setReleasedWhenClosed:
|
|
|
|
[unarchiver decodeBOOLWithName:@"isReleasedWhenClosed"]];
|
|
|
|
[self setHidesOnDeactivate:
|
|
|
|
[unarchiver decodeBOOLWithName:@"hidesOnDeactivate"]];
|
|
|
|
[self setBackgroundColor:
|
|
|
|
[unarchiver decodeObjectWithName:@"backgroundColor"]];
|
|
|
|
if ([unarchiver decodeBOOLWithName:@"isVisible"])
|
|
|
|
[self orderFront:nil];
|
|
|
|
|
|
|
|
[self setFloatingPanel:
|
|
|
|
[unarchiver decodeBOOLWithName:@"isFloatingPanel"]];
|
|
|
|
[self setBecomesKeyOnlyIfNeeded:
|
|
|
|
[unarchiver decodeBOOLWithName:@"becomesKeyOnlyIfNeeded"]];
|
|
|
|
[self setWorksWhenModal:
|
|
|
|
[unarchiver decodeBOOLWithName:@"setWorksWhenModal"]];
|
|
|
|
|
|
|
|
#if GNU_GUI_LIBRARY
|
1998-11-25 17:16:48 +00:00
|
|
|
[[self contentView] setNeedsDisplay:YES];
|
1998-11-19 21:53:44 +00:00
|
|
|
#endif
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSPanel (GMArchiverMethods) */
|
|
|
|
|
|
|
|
|
|
|
|
@implementation NSSavePanel (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
//NSWindow specific
|
|
|
|
[archiver encodeRect:[self frame] withName:@"frame"];
|
|
|
|
[archiver encodeSize:[self maxSize] withName:@"maxSize"];
|
|
|
|
[archiver encodeSize:[self minSize] withName:@"minSize"];
|
|
|
|
[archiver encodeString:[self frameAutosaveName]
|
|
|
|
withName:@"frameAutosaveName"];
|
|
|
|
[archiver encodeInt:[self level] withName:@"level"];
|
|
|
|
[archiver encodeBOOL:[self isVisible] withName:@"isVisible"];
|
|
|
|
[archiver encodeBOOL:[self isAutodisplay] withName:@"isAutodisplay"];
|
|
|
|
[archiver encodeString:[self title] withName:@"title"];
|
|
|
|
[archiver encodeString:[self representedFilename]
|
|
|
|
withName:@"representedFilename"];
|
|
|
|
[archiver encodeBOOL:[self isReleasedWhenClosed]
|
|
|
|
withName:@"isReleasedWhenClosed"];
|
|
|
|
[archiver encodeObject:[self contentView] withName:@"contentView"];
|
|
|
|
[archiver encodeBOOL:[self hidesOnDeactivate]
|
|
|
|
withName:@"hidesOnDeactivate"];
|
|
|
|
[archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"];
|
|
|
|
[archiver encodeUnsignedInt:[self styleMask] withName:@"styleMask"];
|
|
|
|
[archiver encodeUnsignedInt:[self backingType] withName:@"backingType"];
|
|
|
|
|
|
|
|
// NSPanel specific
|
|
|
|
[archiver encodeBOOL:[self isFloatingPanel] withName:@"isFloatingPanel"];
|
|
|
|
[archiver encodeBOOL:[self becomesKeyOnlyIfNeeded]
|
|
|
|
withName:@"becomesKeyOnlyIfNeeded"];
|
|
|
|
[archiver encodeBOOL:[self worksWhenModal] withName:@"worksWhenModal"];
|
|
|
|
|
|
|
|
// NSSavePanel specific
|
|
|
|
[archiver encodeString:[self prompt] withName:@"prompt"];
|
|
|
|
[archiver encodeObject:[self accessoryView] withName:@"accessoryView"];
|
|
|
|
[archiver encodeString:[self requiredFileType]
|
|
|
|
withName:@"requiredFileType"];
|
|
|
|
[archiver encodeBOOL:[self treatsFilePackagesAsDirectories]
|
|
|
|
withName:@"treatsFilePackagesAsDirectories"];
|
|
|
|
[archiver encodeString:[self directory]
|
|
|
|
withName:@"directory"];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
unsigned backingType = [unarchiver decodeUnsignedIntWithName:
|
|
|
|
@"backingType"];
|
|
|
|
unsigned styleMask = [unarchiver decodeUnsignedIntWithName:@"styleMask"];
|
|
|
|
NSRect aRect = [unarchiver decodeRectWithName:@"frame"];
|
1999-06-02 02:56:07 +00:00
|
|
|
// 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]]
|
1998-11-19 21:53:44 +00:00
|
|
|
initWithContentRect:aRect
|
|
|
|
styleMask:styleMask backing:backingType defer:YES]
|
|
|
|
autorelease];
|
|
|
|
|
1999-07-23 18:07:42 +00:00
|
|
|
#if GNU_GUI_LIBRARY
|
|
|
|
NSDebugLLog(@"NSSavePanel", @"NSSavePanel +createObjectForModelUnarchiver");
|
|
|
|
#endif
|
1998-11-19 21:53:44 +00:00
|
|
|
return panel;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(id)initWithModelUnarchiver :(GMUnarchiver *)unarchiver
|
|
|
|
{
|
|
|
|
NSString* frameAutosaveName;
|
|
|
|
|
|
|
|
//NSWindow specifics
|
|
|
|
[self setContentView:[unarchiver decodeObjectWithName:@"contentView"]];
|
|
|
|
[self setMaxSize:[unarchiver decodeSizeWithName:@"maxSize"]];
|
|
|
|
[self setMinSize:[unarchiver decodeSizeWithName:@"minSize"]];
|
|
|
|
|
|
|
|
frameAutosaveName = [unarchiver decodeStringWithName:@"frameAutosaveName"];
|
|
|
|
if (frameAutosaveName)
|
|
|
|
[self setFrameAutosaveName:frameAutosaveName];
|
|
|
|
|
1999-07-23 18:07:42 +00:00
|
|
|
#ifndef NeXT_GUI_LIBRARY
|
1999-07-06 20:31:16 +00:00
|
|
|
window_level = [unarchiver decodeIntWithName:@"level"];
|
1999-07-23 18:07:42 +00:00
|
|
|
#endif
|
1998-11-19 21:53:44 +00:00
|
|
|
|
|
|
|
[self setAutodisplay:[unarchiver decodeBOOLWithName:@"isAutodisplay"]];
|
|
|
|
[self setTitle:[unarchiver decodeStringWithName:@"title"]];
|
|
|
|
[self setRepresentedFilename:
|
|
|
|
[unarchiver decodeStringWithName:@"representedFilename"]];
|
|
|
|
[self setReleasedWhenClosed:
|
|
|
|
[unarchiver decodeBOOLWithName:@"isReleasedWhenClosed"]];
|
|
|
|
[self setHidesOnDeactivate:
|
|
|
|
[unarchiver decodeBOOLWithName:@"hidesOnDeactivate"]];
|
|
|
|
[self setBackgroundColor:
|
|
|
|
[unarchiver decodeObjectWithName:@"backgroundColor"]];
|
|
|
|
if ([unarchiver decodeBOOLWithName:@"isVisible"])
|
|
|
|
[self orderFront:nil];
|
|
|
|
|
|
|
|
//NSPanel specifics
|
|
|
|
[self setFloatingPanel:
|
|
|
|
[unarchiver decodeBOOLWithName:@"isFloatingPanel"]];
|
|
|
|
[self setBecomesKeyOnlyIfNeeded:
|
|
|
|
[unarchiver decodeBOOLWithName:@"becomesKeyOnlyIfNeeded"]];
|
|
|
|
[self setWorksWhenModal:
|
|
|
|
[unarchiver decodeBOOLWithName:@"setWorksWhenModal"]];
|
|
|
|
|
|
|
|
//NSSavePanel specifics
|
|
|
|
[self setPrompt:[unarchiver decodeStringWithName:@"prompt"]];
|
|
|
|
[self setAccessoryView:[unarchiver decodeObjectWithName:@"accessoryView"]];
|
|
|
|
[self setRequiredFileType:
|
|
|
|
[unarchiver decodeStringWithName:@"requiredFileType"]];
|
|
|
|
[self setTreatsFilePackagesAsDirectories:
|
|
|
|
[unarchiver decodeBOOLWithName:@"treatsFilePackagesAsDirectories"]];
|
|
|
|
[self setDirectory:
|
|
|
|
[unarchiver decodeStringWithName:@"directory"]];
|
|
|
|
|
|
|
|
#if GNU_GUI_LIBRARY
|
1998-11-25 17:16:48 +00:00
|
|
|
[[self contentView] setNeedsDisplay:YES];
|
1998-11-19 21:53:44 +00:00
|
|
|
#endif
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSSavePanel (GMArchiverMethods) */
|
1998-11-20 03:36:09 +00:00
|
|
|
|
|
|
|
|
1998-11-20 09:24:33 +00:00
|
|
|
@implementation NSBrowser (GMArchiverMethods)
|
1998-11-20 03:36:09 +00:00
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver :(GMArchiver*)archiver
|
|
|
|
{
|
1998-11-20 09:24:33 +00:00
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
|
|
|
//NSBrowser
|
|
|
|
[archiver encodeString:[self path] withName:@"path"];
|
|
|
|
[archiver encodeString:[self pathSeparator] withName:@"pathSeparator"];
|
|
|
|
[archiver encodeBOOL:[self allowsBranchSelection]
|
|
|
|
withName:@"allowsBranchSelection"];
|
|
|
|
[archiver encodeBOOL:[self allowsEmptySelection]
|
|
|
|
withName:@"allowsEmptySelection"];
|
|
|
|
[archiver encodeBOOL:[self allowsMultipleSelection]
|
|
|
|
withName:@"allowsMultipleSelection"];
|
|
|
|
[archiver encodeBOOL:[self reusesColumns] withName:@"reusesColumns"];
|
|
|
|
[archiver encodeUnsignedInt:[self maxVisibleColumns]
|
|
|
|
withName:@"maxVisibleColumns"];
|
|
|
|
[archiver encodeUnsignedInt:[self minColumnWidth]
|
|
|
|
withName:@"minColumnWidth"];
|
|
|
|
[archiver encodeBOOL:[self separatesColumns]
|
|
|
|
withName:@"separatesColumns"];
|
|
|
|
[archiver encodeBOOL:[self takesTitleFromPreviousColumn]
|
|
|
|
withName:@"takesTitleFromPreviousColumn"];
|
|
|
|
[archiver encodeBOOL:[self isTitled] withName:@"isTitled"];
|
|
|
|
[archiver encodeBOOL:[self hasHorizontalScroller]
|
|
|
|
withName:@"hasHorizontalScroller"];
|
|
|
|
[archiver encodeBOOL:[self acceptsArrowKeys]
|
|
|
|
withName:@"acceptsArrowKeys"];
|
|
|
|
[archiver encodeBOOL:[self sendsActionOnArrowKeys]
|
|
|
|
withName:@"sendsActionOnArrowKeys"];
|
|
|
|
|
|
|
|
[archiver encodeObject:[self delegate] withName:@"delegate"];
|
|
|
|
[archiver encodeSelector:[self doubleAction] withName:@"doubleAction"];
|
1998-11-20 03:36:09 +00:00
|
|
|
}
|
|
|
|
|
1998-11-21 00:11:26 +00:00
|
|
|
#if 0
|
1998-11-20 09:24:33 +00:00
|
|
|
+ (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver
|
1998-11-20 03:36:09 +00:00
|
|
|
{
|
1998-11-20 09:24:33 +00:00
|
|
|
unsigned backingType = [unarchiver decodeUnsignedIntWithName:
|
|
|
|
@"backingType"];
|
|
|
|
unsigned styleMask = [unarchiver decodeUnsignedIntWithName:@"styleMask"];
|
|
|
|
NSRect aRect = [unarchiver decodeRectWithName:@"frame"];
|
1998-12-13 11:29:13 +00:00
|
|
|
NSBrowser* browser = [[[NSBrowser allocWithZone:[unarchiver objectZone]]
|
1998-11-20 09:24:33 +00:00
|
|
|
initWithContentRect:aRect
|
|
|
|
styleMask:styleMask backing:backingType defer:YES]
|
|
|
|
autorelease];
|
|
|
|
|
|
|
|
return browser;
|
1998-11-20 03:36:09 +00:00
|
|
|
}
|
1998-11-21 00:11:26 +00:00
|
|
|
#endif
|
1998-11-20 03:36:09 +00:00
|
|
|
|
1998-11-20 09:24:33 +00:00
|
|
|
- (id)initWithModelUnarchiver :(GMUnarchiver *)unarchiver
|
|
|
|
{
|
1998-11-21 00:11:26 +00:00
|
|
|
id delegate;
|
|
|
|
|
|
|
|
|
1998-11-20 09:24:33 +00:00
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
[self setPath:[unarchiver decodeStringWithName:@"path"]];
|
|
|
|
[self setPathSeparator:[unarchiver decodeStringWithName:@"pathSeparator"]];
|
|
|
|
[self setAllowsBranchSelection:[unarchiver
|
|
|
|
decodeBOOLWithName:@"allowsBranchSelection"]];
|
|
|
|
[self setAllowsEmptySelection:[unarchiver
|
|
|
|
decodeBOOLWithName:@"allowsEmptySelection"]];
|
|
|
|
[self setAllowsMultipleSelection:[unarchiver
|
|
|
|
decodeBOOLWithName:@"allowsMultipleSelection"]];
|
|
|
|
|
|
|
|
[self setReusesColumns:[unarchiver decodeBOOLWithName:@"reusesColumns"]];
|
|
|
|
[self setMaxVisibleColumns:[unarchiver
|
|
|
|
decodeUnsignedIntWithName:@"maxVisibleColumns"]];
|
|
|
|
[self setMinColumnWidth:[unarchiver
|
|
|
|
decodeUnsignedIntWithName:@"minColumnWidth"]];
|
|
|
|
[self setSeparatesColumns:[unarchiver
|
|
|
|
decodeBOOLWithName:@"separatesColumns"]];
|
|
|
|
[self setTakesTitleFromPreviousColumn:[unarchiver
|
|
|
|
decodeBOOLWithName:@"takesTitleFromPreviousColumn"]];
|
|
|
|
[self setTitled:[unarchiver
|
|
|
|
decodeBOOLWithName:@"isTitled"]];
|
|
|
|
[self setHasHorizontalScroller:[unarchiver
|
|
|
|
decodeBOOLWithName:@"hasHorizontalScroller"]];
|
|
|
|
[self setAcceptsArrowKeys:[unarchiver
|
|
|
|
decodeBOOLWithName:@"acceptsArrowKeys"]];
|
|
|
|
[self setSendsActionOnArrowKeys:[unarchiver
|
|
|
|
decodeBOOLWithName:@"sendsActionOnArrowKeys"]];
|
|
|
|
|
1998-11-21 00:11:26 +00:00
|
|
|
//avoid an exeption
|
|
|
|
delegate = [unarchiver decodeObjectWithName:@"delegate"];
|
|
|
|
if (delegate)
|
|
|
|
[self setDelegate:delegate];
|
|
|
|
|
|
|
|
[self setDoubleAction:[unarchiver decodeSelectorWithName:@"doubleAction"]];
|
1998-11-22 11:21:48 +00:00
|
|
|
return self;
|
1998-11-20 09:24:33 +00:00
|
|
|
}
|
1998-11-20 03:36:09 +00:00
|
|
|
|
1998-11-20 09:24:33 +00:00
|
|
|
@end /* NSBrowser (GMArchiverMethods) */
|
1999-04-01 09:37:06 +00:00
|
|
|
|
|
|
|
@implementation NSColorWell (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
[self setColor:[unarchiver decodeObjectWithName:@"color"]];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
|
|
|
[archiver encodeObject:[self color] withName:@"color"];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSColorWell (GMArchiverMethods) */
|
|
|
|
|
|
|
|
@implementation NSImageView (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
|
|
|
[archiver encodeInt:[self imageAlignment] withName:@"alignment"];
|
|
|
|
[archiver encodeInt:[self imageFrameStyle] withName:@"frameStyle"];
|
|
|
|
[archiver encodeObject:[self image] withName:@"image"];
|
|
|
|
[archiver encodeBOOL:[self isEditable] withName:@"isEditable"];
|
|
|
|
[archiver encodeInt:[self imageScaling] withName:@"scaling"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
[self setImageAlignment:[unarchiver decodeIntWithName:@"alignment"]];
|
|
|
|
[self setImageFrameStyle:[unarchiver decodeIntWithName:@"frameStyle"]];
|
|
|
|
[self setImage:[unarchiver decodeObjectWithName:@"image"]];
|
|
|
|
[self setEditable:[unarchiver decodeBOOLWithName:@"isEditable"]];
|
|
|
|
[self setImageScaling:[unarchiver decodeIntWithName:@"scaling"]];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
1999-04-29 12:25:10 +00:00
|
|
|
|
1999-04-22 20:47:36 +00:00
|
|
|
@end
|
1999-04-01 09:37:06 +00:00
|
|
|
|
|
|
|
@implementation NSTextFieldCell (GMArchiverMethods)
|
|
|
|
|
|
|
|
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
|
|
|
|
{
|
|
|
|
[super encodeWithModelArchiver:archiver];
|
|
|
|
|
|
|
|
[archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"];
|
|
|
|
[archiver encodeBOOL:[self drawsBackground] withName:@"drawsBackground"];
|
|
|
|
[archiver encodeObject:[self textColor] withName:@"textColor"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
|
|
|
|
{
|
|
|
|
self = [super initWithModelUnarchiver:unarchiver];
|
|
|
|
|
|
|
|
[self setBackgroundColor:
|
|
|
|
[unarchiver decodeObjectWithName:@"backgroundColor"]];
|
|
|
|
[self setDrawsBackground:
|
|
|
|
[unarchiver decodeBOOLWithName:@"drawsBackground"]];
|
|
|
|
[self setTextColor:[unarchiver decodeObjectWithName:@"textColor"]];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end /* NSTextFieldCell (GMArchiverMethods) */
|
|
|
|
|
1999-06-02 02:56:07 +00:00
|
|
|
@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) */
|