mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 11:51:56 +00:00
Some more keyed decoding.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20216 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
69707e4825
commit
45b6e203cd
7 changed files with 118 additions and 49 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2004-10-11 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSActionCell.m (-initWithCoder:):
|
||||||
|
* Source/NSBitmapImageRep.m (-initWithCoder:):
|
||||||
|
* Source/NSImage.m (-initWithCoder:): Implemented keyed decoding.
|
||||||
|
* Source/NSMatrix.m (-initWithCoder:): Don't use methods to set
|
||||||
|
the cell size and intercell spase, as this will change the frame.
|
||||||
|
* Source/NSFormCell.m (-initWithCoder:): Set the string value
|
||||||
|
later, as the decoding is super gets used for the title.
|
||||||
|
* Source/NSButtonCell.m (-initWithCoder:): Set fields only when
|
||||||
|
value is provided and fake NSImageLeft until flag decoding is there.
|
||||||
|
|
||||||
2004-10-08 22:08 Chad Hardin <cehardin@mac.com>
|
2004-10-08 22:08 Chad Hardin <cehardin@mac.com>
|
||||||
|
|
||||||
* Printing/GNUmakefile: Now goes in and build GSCUPS (Work in progress!)
|
* Printing/GNUmakefile: Now goes in and build GSCUPS (Work in progress!)
|
||||||
|
|
|
@ -298,6 +298,10 @@ static Class controlClass;
|
||||||
|
|
||||||
if ([aDecoder allowsKeyedCoding])
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
|
if ([aDecoder containsValueForKey: @"NSTag"])
|
||||||
|
{
|
||||||
|
[self setTag: [aDecoder decodeIntForKey: @"NSTag"]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -947,7 +947,14 @@ static BOOL supports_lzw_compression = NO;
|
||||||
NSData *data;
|
NSData *data;
|
||||||
|
|
||||||
self = [super initWithCoder: aDecoder];
|
self = [super initWithCoder: aDecoder];
|
||||||
data = [aDecoder decodeObject];
|
if ([aDecoder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
data = [aDecoder decodeObjectForKey: @"NSTIFFRepresentation"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = [aDecoder decodeObject];
|
||||||
|
}
|
||||||
return [self initWithData: data];
|
return [self initWithData: data];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1284,23 +1284,33 @@
|
||||||
|
|
||||||
if ([aDecoder allowsKeyedCoding])
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
NSString *alternateContents = [aDecoder decodeObjectForKey: @"NSAlternateContents"];
|
|
||||||
NSImage *alternateImage = [aDecoder decodeObjectForKey: @"NSAlternateImage"];
|
|
||||||
//NSControl *control = [aDecoder decodeObjectForKey: @"NSControlView"];
|
//NSControl *control = [aDecoder decodeObjectForKey: @"NSControlView"];
|
||||||
NSString *key = [aDecoder decodeObjectForKey: @"NSKeyEquivalent"];
|
|
||||||
int bFlags;
|
int bFlags;
|
||||||
int bFlags2;
|
int bFlags2;
|
||||||
int delay = 0;
|
int delay = 0;
|
||||||
int interval = 0;
|
int interval = 0;
|
||||||
|
|
||||||
[self setAlternateImage: alternateImage];
|
if ([aDecoder containsValueForKey: @"NSKeyEquivalent"])
|
||||||
[self setAlternateTitle: alternateContents];
|
{
|
||||||
[self setKeyEquivalent: key];
|
[self setKeyEquivalent: [aDecoder decodeObjectForKey: @"NSKeyEquivalent"]];
|
||||||
|
}
|
||||||
|
if ([aDecoder containsValueForKey: @"NSNormalImage"])
|
||||||
|
{
|
||||||
|
[self setImage: [aDecoder decodeObjectForKey: @"NSNormalImage"]];
|
||||||
|
}
|
||||||
|
if ([aDecoder containsValueForKey: @"NSAlternateImage"])
|
||||||
|
{
|
||||||
|
[self setAlternateImage: [aDecoder decodeObjectForKey: @"NSAlternateImage"]];
|
||||||
|
}
|
||||||
|
if ([aDecoder containsValueForKey: @"NSAlternateContents"])
|
||||||
|
{
|
||||||
|
[self setAlternateTitle: [aDecoder decodeObjectForKey: @"NSAlternateContents"]];
|
||||||
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSButtonFlags"])
|
if ([aDecoder containsValueForKey: @"NSButtonFlags"])
|
||||||
{
|
{
|
||||||
bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
|
bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
|
||||||
// FIXME
|
// FIXME
|
||||||
|
[self setImagePosition: NSImageLeft];
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSButtonFlags2"])
|
if ([aDecoder containsValueForKey: @"NSButtonFlags2"])
|
||||||
{
|
{
|
||||||
|
|
|
@ -370,6 +370,10 @@ static NSColor *shadowCol;
|
||||||
[super initWithCoder: aDecoder];
|
[super initWithCoder: aDecoder];
|
||||||
if ([aDecoder allowsKeyedCoding])
|
if ([aDecoder allowsKeyedCoding])
|
||||||
{
|
{
|
||||||
|
if ([aDecoder containsValueForKey: @"NSContents"])
|
||||||
|
{
|
||||||
|
[self setStringValue: [aDecoder decodeObjectForKey: @"NSContents"]];
|
||||||
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSTitleWidth"])
|
if ([aDecoder containsValueForKey: @"NSTitleWidth"])
|
||||||
{
|
{
|
||||||
[self setTitleWidth: [aDecoder decodeFloatForKey: @"NSTitleWidth"]];
|
[self setTitleWidth: [aDecoder decodeFloatForKey: @"NSTitleWidth"]];
|
||||||
|
|
105
Source/NSImage.m
105
Source/NSImage.m
|
@ -25,15 +25,15 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSArray.h>
|
||||||
|
#include <Foundation/NSBundle.h>
|
||||||
|
#include <Foundation/NSDebug.h>
|
||||||
|
#include <Foundation/NSDictionary.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSFileManager.h>
|
#include <Foundation/NSFileManager.h>
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSKeyedArchiver.h>
|
||||||
#include <Foundation/NSValue.h>
|
|
||||||
#include <Foundation/NSDictionary.h>
|
|
||||||
#include <Foundation/NSBundle.h>
|
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSValue.h>
|
||||||
|
|
||||||
#include "AppKit/NSImage.h"
|
#include "AppKit/NSImage.h"
|
||||||
#include "AppKit/AppKitExceptions.h"
|
#include "AppKit/AppKitExceptions.h"
|
||||||
|
@ -1217,44 +1217,75 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
BOOL flag;
|
BOOL flag;
|
||||||
|
|
||||||
_reps = [[NSMutableArray alloc] initWithCapacity: 2];
|
_reps = [[NSMutableArray alloc] initWithCapacity: 2];
|
||||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
if ([coder allowsKeyedCoding])
|
||||||
if (flag == YES)
|
|
||||||
{
|
{
|
||||||
NSString *theName = [coder decodeObject];
|
if ([coder containsValueForKey: @"NSColor"])
|
||||||
|
{
|
||||||
|
[self setBackgroundColor: [coder decodeObjectForKey: @"NSColor"]];
|
||||||
|
}
|
||||||
|
if ([coder containsValueForKey: @"NSImageFlags"])
|
||||||
|
{
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
//FIXME
|
||||||
|
flags = [coder decodeIntForKey: @"NSImageFlags"];
|
||||||
|
}
|
||||||
|
if ([coder containsValueForKey: @"NSReps"])
|
||||||
|
{
|
||||||
|
NSArray *reps;
|
||||||
|
|
||||||
RELEASE(self);
|
// FIXME: NSReps is in a strange format. It is a mutable array with one
|
||||||
self = RETAIN([NSImage imageNamed: theName]);
|
// element which is an array with a first element 0 and than the image rep.
|
||||||
|
reps = [coder decodeObjectForKey: @"NSReps"];
|
||||||
|
reps = [reps objectAtIndex: 0];
|
||||||
|
[self addRepresentation: [reps objectAtIndex: 1]];
|
||||||
|
}
|
||||||
|
if ([coder containsValueForKey: @"NSSize"])
|
||||||
|
{
|
||||||
|
[self setSize: [coder decodeSizeForKey: @"NSSize"]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSArray *a;
|
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
if (flag == YES)
|
||||||
|
{
|
||||||
|
NSString *theName = [coder decodeObject];
|
||||||
|
|
||||||
[coder decodeValueOfObjCType: @encode(NSSize) at: &_size];
|
RELEASE(self);
|
||||||
[coder decodeValueOfObjCType: @encode(id) at: &_color];
|
self = RETAIN([NSImage imageNamed: theName]);
|
||||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
}
|
||||||
_flags.scalable = flag;
|
else
|
||||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
{
|
||||||
_flags.dataRetained = flag;
|
NSArray *a;
|
||||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_flags.flipDraw = flag;
|
|
||||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_flags.sizeWasExplicitlySet = flag;
|
|
||||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_flags.useEPSOnResolutionMismatch = flag;
|
|
||||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_flags.colorMatchPreferred = flag;
|
|
||||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_flags.multipleResolutionMatching = flag;
|
|
||||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_flags.cacheSeparately = flag;
|
|
||||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
|
||||||
_flags.unboundedCacheDepth = flag;
|
|
||||||
|
|
||||||
/*
|
[coder decodeValueOfObjCType: @encode(NSSize) at: &_size];
|
||||||
* get the image reps and add them.
|
[coder decodeValueOfObjCType: @encode(id) at: &_color];
|
||||||
*/
|
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
a = [coder decodeObject];
|
_flags.scalable = flag;
|
||||||
[self addRepresentations: a];
|
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_flags.dataRetained = flag;
|
||||||
|
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_flags.flipDraw = flag;
|
||||||
|
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_flags.sizeWasExplicitlySet = flag;
|
||||||
|
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_flags.useEPSOnResolutionMismatch = flag;
|
||||||
|
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_flags.colorMatchPreferred = flag;
|
||||||
|
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_flags.multipleResolutionMatching = flag;
|
||||||
|
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_flags.cacheSeparately = flag;
|
||||||
|
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
_flags.unboundedCacheDepth = flag;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get the image reps and add them.
|
||||||
|
*/
|
||||||
|
a = [coder decodeObject];
|
||||||
|
[self addRepresentations: a];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2486,7 +2486,7 @@ static SEL getSel;
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSCellBackgroundColor"])
|
if ([aDecoder containsValueForKey: @"NSCellBackgroundColor"])
|
||||||
{
|
{
|
||||||
[self setBackgroundColor: [aDecoder decodeObjectForKey: @"NSCellBackgroundColor"]];
|
[self setCellBackgroundColor: [aDecoder decodeObjectForKey: @"NSCellBackgroundColor"]];
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSProtoCell"])
|
if ([aDecoder containsValueForKey: @"NSProtoCell"])
|
||||||
{
|
{
|
||||||
|
@ -2502,11 +2502,13 @@ static SEL getSel;
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSCellSize"])
|
if ([aDecoder containsValueForKey: @"NSCellSize"])
|
||||||
{
|
{
|
||||||
[self setCellSize: [aDecoder decodeSizeForKey: @"NSCellSize"]];
|
// Don't use method here as this would change the frame
|
||||||
|
_cellSize = [aDecoder decodeSizeForKey: @"NSCellSize"];
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSIntercellSpacing"])
|
if ([aDecoder containsValueForKey: @"NSIntercellSpacing"])
|
||||||
{
|
{
|
||||||
[self setIntercellSpacing: [aDecoder decodeSizeForKey: @"NSIntercellSpacing"]];
|
// Don't use method here as this would change the frame
|
||||||
|
_intercell = [aDecoder decodeSizeForKey: @"NSIntercellSpacing"];
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSMatrixFlags"])
|
if ([aDecoder containsValueForKey: @"NSMatrixFlags"])
|
||||||
{
|
{
|
||||||
|
@ -2537,7 +2539,6 @@ static SEL getSel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
int row, column;
|
int row, column;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue