mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +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
6dc099b85e
commit
5271b53ebe
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>
|
||||
|
||||
* Printing/GNUmakefile: Now goes in and build GSCUPS (Work in progress!)
|
||||
|
|
|
@ -298,6 +298,10 @@ static Class controlClass;
|
|||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
if ([aDecoder containsValueForKey: @"NSTag"])
|
||||
{
|
||||
[self setTag: [aDecoder decodeIntForKey: @"NSTag"]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -947,7 +947,14 @@ static BOOL supports_lzw_compression = NO;
|
|||
NSData *data;
|
||||
|
||||
self = [super initWithCoder: aDecoder];
|
||||
data = [aDecoder decodeObject];
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
data = [aDecoder decodeObjectForKey: @"NSTIFFRepresentation"];
|
||||
}
|
||||
else
|
||||
{
|
||||
data = [aDecoder decodeObject];
|
||||
}
|
||||
return [self initWithData: data];
|
||||
}
|
||||
|
||||
|
|
|
@ -1284,23 +1284,33 @@
|
|||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSString *alternateContents = [aDecoder decodeObjectForKey: @"NSAlternateContents"];
|
||||
NSImage *alternateImage = [aDecoder decodeObjectForKey: @"NSAlternateImage"];
|
||||
//NSControl *control = [aDecoder decodeObjectForKey: @"NSControlView"];
|
||||
NSString *key = [aDecoder decodeObjectForKey: @"NSKeyEquivalent"];
|
||||
int bFlags;
|
||||
int bFlags2;
|
||||
int delay = 0;
|
||||
int interval = 0;
|
||||
|
||||
[self setAlternateImage: alternateImage];
|
||||
[self setAlternateTitle: alternateContents];
|
||||
[self setKeyEquivalent: key];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSKeyEquivalent"])
|
||||
{
|
||||
[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"])
|
||||
{
|
||||
bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
|
||||
// FIXME
|
||||
[self setImagePosition: NSImageLeft];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSButtonFlags2"])
|
||||
{
|
||||
|
|
|
@ -370,6 +370,10 @@ static NSColor *shadowCol;
|
|||
[super initWithCoder: aDecoder];
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
if ([aDecoder containsValueForKey: @"NSContents"])
|
||||
{
|
||||
[self setStringValue: [aDecoder decodeObjectForKey: @"NSContents"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSTitleWidth"])
|
||||
{
|
||||
[self setTitleWidth: [aDecoder decodeFloatForKey: @"NSTitleWidth"]];
|
||||
|
|
105
Source/NSImage.m
105
Source/NSImage.m
|
@ -25,15 +25,15 @@
|
|||
#include "config.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/NSFileManager.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSKeyedArchiver.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
|
||||
#include "AppKit/NSImage.h"
|
||||
#include "AppKit/AppKitExceptions.h"
|
||||
|
@ -1217,44 +1217,75 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
|||
BOOL flag;
|
||||
|
||||
_reps = [[NSMutableArray alloc] initWithCapacity: 2];
|
||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
if (flag == YES)
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
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);
|
||||
self = RETAIN([NSImage imageNamed: theName]);
|
||||
// FIXME: NSReps is in a strange format. It is a mutable array with one
|
||||
// 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
|
||||
{
|
||||
NSArray *a;
|
||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
if (flag == YES)
|
||||
{
|
||||
NSString *theName = [coder decodeObject];
|
||||
|
||||
[coder decodeValueOfObjCType: @encode(NSSize) at: &_size];
|
||||
[coder decodeValueOfObjCType: @encode(id) at: &_color];
|
||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
_flags.scalable = flag;
|
||||
[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;
|
||||
RELEASE(self);
|
||||
self = RETAIN([NSImage imageNamed: theName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSArray *a;
|
||||
|
||||
/*
|
||||
* get the image reps and add them.
|
||||
*/
|
||||
a = [coder decodeObject];
|
||||
[self addRepresentations: a];
|
||||
[coder decodeValueOfObjCType: @encode(NSSize) at: &_size];
|
||||
[coder decodeValueOfObjCType: @encode(id) at: &_color];
|
||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
_flags.scalable = flag;
|
||||
[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;
|
||||
}
|
||||
|
|
|
@ -2486,7 +2486,7 @@ static SEL getSel;
|
|||
}
|
||||
if ([aDecoder containsValueForKey: @"NSCellBackgroundColor"])
|
||||
{
|
||||
[self setBackgroundColor: [aDecoder decodeObjectForKey: @"NSCellBackgroundColor"]];
|
||||
[self setCellBackgroundColor: [aDecoder decodeObjectForKey: @"NSCellBackgroundColor"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSProtoCell"])
|
||||
{
|
||||
|
@ -2502,11 +2502,13 @@ static SEL getSel;
|
|||
}
|
||||
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"])
|
||||
{
|
||||
[self setIntercellSpacing: [aDecoder decodeSizeForKey: @"NSIntercellSpacing"]];
|
||||
// Don't use method here as this would change the frame
|
||||
_intercell = [aDecoder decodeSizeForKey: @"NSIntercellSpacing"];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSMatrixFlags"])
|
||||
{
|
||||
|
@ -2537,7 +2539,6 @@ static SEL getSel;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
int row, column;
|
||||
|
|
Loading…
Reference in a new issue