Add macros for encoding/decoding.

This commit is contained in:
fredkiefer 2021-01-10 22:40:29 +01:00
parent 35698d41b6
commit 5294a34911
14 changed files with 159 additions and 181 deletions

View file

@ -1,5 +1,7 @@
2021-01-08 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSComboBoxCell.h: Correct type of instance variables.
* Source/GSGuiPrivate.h: Add macros for encoding/decoding.
* Source/NSActionCell.m,
* Source/NSButtonCell.m,
* Source/NSCell.m,

View file

@ -45,10 +45,10 @@
BOOL _usesDataSource;
BOOL _hasVerticalScroller;
BOOL _completes;
int _visibleItems;
NSInteger _visibleItems;
NSSize _intercellSpacing;
float _itemHeight;
int _selectedItem;
NSInteger _selectedItem;
NSRect _lastValidFrame;
NSRange _prevSelectedRange;

View file

@ -31,6 +31,7 @@
#define _GNUstep_H_GSGuiPrivate
#import <Foundation/NSBundle.h>
#import <Foundation/NSCoder.h>
#include "GNUstepBase/GSConfig.h"
#include <math.h>
@ -103,5 +104,24 @@ static inline CGFloat GSRoundTowardsNegativeInfinity(CGFloat x)
return ceil(x - 0.5);
}
#if !defined(GS_DECODER)
#define GS_DECODER(type) \
static inline void decode_##type(NSCoder *coder, type *value) \
{ \
[coder decodeValueOfObjCType: @encode(type) at: value]; \
}
#define GS_ENCODER(type) \
static inline void encode_##type(NSCoder *coder, type *value) \
{ \
[coder encodeValueOfObjCType: @encode(type) at: value]; \
}
#endif
GS_ENCODER(NSUInteger)
GS_DECODER(NSUInteger)
GS_ENCODER(NSInteger)
GS_DECODER(NSInteger)
#endif /* _GNUstep_H_GSGuiPrivate */

View file

@ -31,6 +31,7 @@
#import "AppKit/NSActionCell.h"
#import "AppKit/NSControl.h"
#import "GSGuiPrivate.h"
@implementation NSActionCell
@ -386,10 +387,7 @@ static Class controlClass;
}
else
{
int32_t tmp;
tmp = _tag;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
encode_NSInteger(aCoder, &_tag);
[aCoder encodeConditionalObject: _target];
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
// This is only encoded for backward compatibility and won't be decoded.
@ -422,10 +420,8 @@ static Class controlClass;
else
{
id dummy;
int32_t tmp;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
_tag = tmp;
decode_NSInteger(aDecoder, &_tag);
_target = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
// Don't decode _control_view, as this may no longer be valid.

View file

@ -1695,7 +1695,7 @@
else
{
BOOL tmp;
uint32_t tmp2;
NSUInteger tmp2;
[aCoder encodeObject: _keyEquivalent];
[aCoder encodeObject: _keyEquivalentFont];
@ -1705,16 +1705,11 @@
[aCoder encodeValueOfObjCType: @encode(BOOL)
at: &tmp];
tmp2 = _keyEquivalentModifierMask;
[aCoder encodeValueOfObjCType: @encode(uint32_t)
at: &tmp2];
encode_NSUInteger(aCoder, &_keyEquivalentModifierMask);
tmp2 = _highlightsByMask;
[aCoder encodeValueOfObjCType: @encode(uint32_t)
at: &tmp2];
encode_NSUInteger(aCoder, &tmp2);
tmp2 = _showAltStateMask;
[aCoder encodeValueOfObjCType: @encode(unsigned int)
at: &tmp2];
encode_NSUInteger(aCoder, &tmp2);
[aCoder encodeObject: _sound];
[aCoder encodeObject: _backgroundColor];
@ -1723,11 +1718,9 @@
[aCoder encodeValueOfObjCType: @encode(float)
at: &_repeatInterval];
tmp2 = _bezel_style;
[aCoder encodeValueOfObjCType: @encode(uint32_t)
at: &tmp2];
encode_NSUInteger(aCoder, &tmp2);
tmp2 = _gradient_type;
[aCoder encodeValueOfObjCType: @encode(uint32_t)
at: &tmp2];
encode_NSUInteger(aCoder, &tmp2);
tmp = _image_dims_when_disabled;
[aCoder encodeValueOfObjCType: @encode(BOOL)
at: &tmp];
@ -1880,7 +1873,7 @@
else
{
BOOL tmp;
uint32_t tmp2;
NSUInteger tmp2;
int version = [aDecoder versionForClassName: @"NSButtonCell"];
NSString *key = nil;
@ -1897,18 +1890,14 @@
[aDecoder decodeValueOfObjCType: @encode(id) at: &_altImage];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
_buttoncell_is_transparent = tmp;
[aDecoder decodeValueOfObjCType: @encode(uint32_t)
at: &tmp2];
_keyEquivalentModifierMask = (NSUInteger)tmp2;
decode_NSUInteger(aDecoder, &_keyEquivalentModifierMask);
if (version <= 2)
{
_keyEquivalentModifierMask = _keyEquivalentModifierMask << 16;
}
[aDecoder decodeValueOfObjCType: @encode(uint32_t)
at: &tmp2];
decode_NSUInteger(aDecoder, &tmp2);
_highlightsByMask = (NSInteger)tmp2;
[aDecoder decodeValueOfObjCType: @encode(uint32_t)
at: &tmp2];
decode_NSUInteger(aDecoder, &tmp2);
_showAltStateMask = (NSInteger)tmp2;
if (version >= 2)
@ -1917,11 +1906,9 @@
[aDecoder decodeValueOfObjCType: @encode(id) at: &_backgroundColor];
[aDecoder decodeValueOfObjCType: @encode(float) at: &_delayInterval];
[aDecoder decodeValueOfObjCType: @encode(float) at: &_repeatInterval];
[aDecoder decodeValueOfObjCType: @encode(uint32_t)
at: &tmp2];
decode_NSUInteger(aDecoder, &tmp2);
_bezel_style = (NSBezelStyle)tmp2;
[aDecoder decodeValueOfObjCType: @encode(uint32_t)
at: &tmp2];
decode_NSUInteger(aDecoder, &tmp2);
_gradient_type = (NSGradientType)tmp2;
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
_image_dims_when_disabled = tmp;

View file

@ -2524,7 +2524,7 @@ static NSColor *dtxtCol;
else
{
BOOL flag;
uint32_t tmp_int;
NSUInteger tmp_uint;
[aCoder encodeObject: _contents];
[aCoder encodeObject: _cell_image];
@ -2566,41 +2566,39 @@ static NSColor *dtxtCol;
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
flag = [self wraps];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
tmp_int = _cell.text_align;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_int = _cell.type;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_int = _cell.image_position;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_int = _cell.entry_type;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_uint = _cell.text_align;
encode_NSUInteger(aCoder, &tmp_uint);
tmp_uint = _cell.type;
encode_NSUInteger(aCoder, &tmp_uint);
tmp_uint = _cell.image_position;
encode_NSUInteger(aCoder, &tmp_uint);
tmp_uint = _cell.entry_type;
encode_NSUInteger(aCoder, &tmp_uint);
// FIXME: State may be -1, why do we encode it as unsigned?
tmp_int = _cell.state;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_int = _cell.mnemonic_location;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_int = _mouse_down_flags;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_action_mask = _mouse_down_flags;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_uint = _cell.state;
encode_NSUInteger(aCoder, &tmp_uint);
tmp_uint = _cell.mnemonic_location;
encode_NSUInteger(aCoder, &tmp_uint);
encode_NSUInteger(aCoder, &_mouse_down_flags);
encode_NSUInteger(aCoder, &_action_mask);
[aCoder encodeValueOfObjCType: @encode(id) at: &_formatter];
[aCoder encodeValueOfObjCType: @encode(id) at: &_menu];
[aCoder encodeValueOfObjCType: @encode(id) at: &_represented_object];
tmp_int = _cell.allows_undo;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_int = _cell.line_break_mode;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_int = _cell.control_tint;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_int = _cell.control_size;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_int = _cell.focus_ring_type;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_int = _cell.base_writing_direction;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_int = _cell.uses_single_line_mode;
[aCoder encodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
tmp_uint = _cell.allows_undo;
encode_NSUInteger(aCoder, &tmp_uint);
tmp_uint = _cell.line_break_mode;
encode_NSUInteger(aCoder, &tmp_uint);
tmp_uint = _cell.control_tint;
encode_NSUInteger(aCoder, &tmp_uint);
tmp_uint = _cell.control_size;
encode_NSUInteger(aCoder, &tmp_uint);
tmp_uint = _cell.focus_ring_type;
encode_NSUInteger(aCoder, &tmp_uint);
tmp_uint = _cell.base_writing_direction;
encode_NSUInteger(aCoder, &tmp_uint);
tmp_uint = _cell.uses_single_line_mode;
encode_NSUInteger(aCoder, &tmp_uint);
}
}
@ -2704,7 +2702,7 @@ static NSColor *dtxtCol;
else
{
BOOL flag, wraps;
uint32_t tmp_int;
NSUInteger tmp_uint;
id formatter, menu;
int version = [aDecoder versionForClassName: @"NSCell"];
@ -2747,23 +2745,20 @@ static NSColor *dtxtCol;
/* The wraps attribute has been superseded by lineBreakMode. However,
we may need it to set lineBreakMode when reading old archives. */
wraps = flag;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.text_align = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.type = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.image_position = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.entry_type = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.state = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.mnemonic_location = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t)
at: &tmp_int];
_mouse_down_flags = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_action_mask = tmp_int;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.text_align = tmp_uint;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.type = tmp_uint;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.image_position = tmp_uint;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.entry_type = tmp_uint;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.state = tmp_uint;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.mnemonic_location = tmp_uint;
decode_NSUInteger(aDecoder, &_mouse_down_flags);
decode_NSUInteger(aDecoder, &_action_mask);
if (version < 3)
{
unsigned int mask = 0;
@ -2877,18 +2872,18 @@ static NSColor *dtxtCol;
if (version >= 2)
{
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.allows_undo = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.line_break_mode = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.control_tint = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.control_size = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.focus_ring_type = tmp_int;
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.base_writing_direction = tmp_int;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.allows_undo = tmp_uint;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.line_break_mode = tmp_uint;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.control_tint = tmp_uint;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.control_size = tmp_uint;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.focus_ring_type = tmp_uint;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.base_writing_direction = tmp_uint;
}
else
{
@ -2899,8 +2894,8 @@ static NSColor *dtxtCol;
if (version >= 4)
{
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &tmp_int];
_cell.uses_single_line_mode = tmp_int;
decode_NSUInteger(aDecoder, &tmp_uint);
_cell.uses_single_line_mode = tmp_uint;
}
}

View file

@ -1546,7 +1546,7 @@ static inline NSRect buttonCellFrameFromRect(NSRect cellRect)
if ([coder allowsKeyedCoding])
{
[coder encodeBool: [self hasVerticalScroller] forKey: @"NSHasVerticalScroller"];
[coder encodeInt: [self numberOfVisibleItems] forKey: @"NSVisibleItemCount"];
[coder encodeInteger: [self numberOfVisibleItems] forKey: @"NSVisibleItemCount"];
[coder encodeBool: [self completes] forKey: @"NSCompletes"];
[coder encodeDouble: _intercellSpacing.width forKey: @"NSIntercellSpacingWidth"];
[coder encodeDouble: _intercellSpacing.height forKey: @"NSIntercellSpacingHeight"];
@ -1557,19 +1557,15 @@ static inline NSRect buttonCellFrameFromRect(NSRect cellRect)
}
else
{
int32_t tmp;
[coder encodeValueOfObjCType: @encode(id) at: &_popUpList];
[coder encodeValueOfObjCType: @encode(BOOL) at: &_usesDataSource];
[coder encodeValueOfObjCType: @encode(BOOL) at: &_hasVerticalScroller];
[coder encodeValueOfObjCType: @encode(BOOL) at: &_completes];
[coder encodeValueOfObjCType: @encode(BOOL) at: &_usesDataSource];
tmp = _visibleItems;
[coder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
encode_NSInteger(coder, &_visibleItems);
[coder encodeValueOfObjCType: @encode(NSSize) at: &_intercellSpacing];
[coder encodeValueOfObjCType: @encode(float) at: &_itemHeight];
tmp = _selectedItem;
[coder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
encode_NSInteger(coder, &_selectedItem);
if (_usesDataSource == YES)
[coder encodeConditionalObject: _dataSource];
@ -1600,7 +1596,7 @@ static inline NSRect buttonCellFrameFromRect(NSRect cellRect)
}
if ([aDecoder containsValueForKey: @"NSVisibleItemCount"])
{
[self setNumberOfVisibleItems: [aDecoder decodeIntForKey:
[self setNumberOfVisibleItems: [aDecoder decodeIntegerForKey:
@"NSVisibleItemCount"]];
}
if ([aDecoder containsValueForKey: @"NSCompletes"])
@ -1639,7 +1635,6 @@ static inline NSRect buttonCellFrameFromRect(NSRect cellRect)
else
{
BOOL dummy;
int32_t tmp;
if ([aDecoder versionForClassName: @"NSComboBoxCell"] < 2)
{
@ -1654,12 +1649,10 @@ static inline NSRect buttonCellFrameFromRect(NSRect cellRect)
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasVerticalScroller];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_completes];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &dummy];
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
_visibleItems = tmp;
decode_NSInteger(aDecoder, &_visibleItems);
[aDecoder decodeValueOfObjCType: @encode(NSSize) at: &_intercellSpacing];
[aDecoder decodeValueOfObjCType: @encode(float) at: &_itemHeight];
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
_selectedItem = tmp;
decode_NSInteger(aDecoder, &_selectedItem);
if (_usesDataSource == YES)
[self setDataSource: [aDecoder decodeObject]];

View file

@ -306,14 +306,14 @@ yBottomInRect(NSSize innerSize, NSRect outerRect, BOOL flipped)
}
else
{
int32_t tmp;
NSInteger tmp;
tmp = _imageAlignment;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
encode_NSInteger(aCoder, &tmp);
tmp = _frameStyle;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
encode_NSInteger(aCoder, &tmp);
tmp = _imageScaling;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
encode_NSInteger(aCoder, &tmp);
[aCoder encodeSize: _original_image_size];
}
}
@ -343,13 +343,13 @@ yBottomInRect(NSSize innerSize, NSRect outerRect, BOOL flipped)
}
else
{
int32_t tmp;
NSInteger tmp;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
decode_NSInteger(aDecoder, &tmp);
_imageAlignment = tmp;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
decode_NSInteger(aDecoder, &tmp);
_frameStyle = tmp;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
decode_NSInteger(aDecoder, &tmp);
_imageScaling = tmp;
_original_image_size = [aDecoder decodeSize];
}

View file

@ -33,6 +33,7 @@
#import "AppKit/NSGraphics.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSLevelIndicatorCell.h"
#import "GSGuiPrivate.h"
@implementation NSLevelIndicatorCell
@ -501,20 +502,18 @@
}
else
{
int32_t tmp;
NSInteger tmp;
[aCoder encodeValueOfObjCType: @encode(double) at: &_minValue];
[aCoder encodeValueOfObjCType: @encode(double) at: &_maxValue];
[aCoder encodeValueOfObjCType: @encode(double) at: &_warningValue];
[aCoder encodeValueOfObjCType: @encode(double) at: &_criticalValue];
tmp = _style;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
tmp = _numberOfMajorTickMarks;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
tmp = _numberOfTickMarks;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
encode_NSInteger(aCoder, &tmp);
encode_NSInteger(aCoder, &_numberOfMajorTickMarks);
encode_NSInteger(aCoder, &_numberOfTickMarks);
tmp = _tickMarkPosition;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
encode_NSInteger(aCoder, &tmp);
}
}
@ -563,19 +562,17 @@
}
else
{
int32_t tmp;
NSInteger tmp;
[aDecoder decodeValueOfObjCType: @encode(double) at: &_minValue];
[aDecoder decodeValueOfObjCType: @encode(double) at: &_maxValue];
[aDecoder decodeValueOfObjCType: @encode(double) at: &_warningValue];
[aDecoder decodeValueOfObjCType: @encode(double) at: &_criticalValue];
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
decode_NSInteger(aDecoder, &tmp);
_style = tmp;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
_numberOfMajorTickMarks = tmp;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
_numberOfTickMarks = tmp;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
decode_NSInteger(aDecoder, &_numberOfMajorTickMarks);
decode_NSInteger(aDecoder, &_numberOfTickMarks);
decode_NSInteger(aDecoder, &tmp);
_tickMarkPosition = tmp;
}

View file

@ -26,6 +26,7 @@
#import "AppKit/NSWorkspace.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSPathComponentCell.h"
#import "GSGuiPrivate.h"
static Class pathComponentCellClass;
@ -250,11 +251,7 @@ static Class pathComponentCellClass;
}
else
{
uint32_t tmp;
[coder decodeValueOfObjCType: @encode(uint32_t)
at: &tmp];
_pathStyle = tmp;
decode_NSUInteger(coder, &_pathStyle);
[self setPathComponentCells: [coder decodeObject]];
}
@ -273,11 +270,7 @@ static Class pathComponentCellClass;
}
else
{
uint32_t tmp;
tmp = _pathStyle;
[coder encodeValueOfObjCType: @encode(uint32_t)
at: &tmp];
encode_NSUInteger(coder, &_pathStyle);
[coder encodeObject: [self pathComponentCells]];
}
}

View file

@ -41,6 +41,7 @@
#import "AppKit/NSWindow.h"
#import "GNUstepGUI/GSTheme.h"
#import "GSBindingHelpers.h"
#import "GSGuiPrivate.h"
/* The image to use in a specific popupbutton depends on type and
* preferred edge; that is, _pbc_image[0] if it is a
@ -1207,20 +1208,20 @@ static NSImage *_pbc_image[5];
}
else
{
int32_t flag;
NSInteger flag;
[aCoder encodeObject: _menu];
[aCoder encodeConditionalObject: [self selectedItem]];
flag = _pbcFlags.pullsDown;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &flag];
encode_NSInteger(aCoder, &flag);
flag = _pbcFlags.preferredEdge;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &flag];
encode_NSInteger(aCoder, &flag);
flag = _pbcFlags.usesItemFromMenu;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &flag];
encode_NSInteger(aCoder, &flag);
flag = _pbcFlags.altersStateOfSelectedItem;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &flag];
encode_NSInteger(aCoder, &flag);
flag = _pbcFlags.arrowPosition;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &flag];
encode_NSInteger(aCoder, &flag);
}
}
@ -1306,7 +1307,7 @@ static NSImage *_pbc_image[5];
}
else
{
int32_t flag;
NSInteger flag;
id<NSMenuItem> selectedItem;
int version = [aDecoder versionForClassName:
@"NSPopUpButtonCell"];
@ -1321,15 +1322,15 @@ static NSImage *_pbc_image[5];
[self setMenu: nil];
[self setMenu: menu];
selectedItem = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &flag];
decode_NSInteger(aDecoder, &flag);
_pbcFlags.pullsDown = flag;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &flag];
decode_NSInteger(aDecoder, &flag);
_pbcFlags.preferredEdge = flag;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &flag];
decode_NSInteger(aDecoder, &flag);
_pbcFlags.usesItemFromMenu = flag;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &flag];
decode_NSInteger(aDecoder, &flag);
_pbcFlags.altersStateOfSelectedItem = flag;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &flag];
decode_NSInteger(aDecoder, &flag);
_pbcFlags.arrowPosition = flag;
if (version < 2)

View file

@ -495,15 +495,14 @@
}
else
{
uint32_t max = [self maximumRecents];
NSInteger max = [self maximumRecents];
[aCoder encodeObject: _search_button_cell];
[aCoder encodeObject: _cancel_button_cell];
[aCoder encodeObject: _recents_autosave_name];
[aCoder encodeValueOfObjCType: @encode(BOOL)
at: &_sends_whole_search_string];
[aCoder encodeValueOfObjCType: @encode(uint32_t)
at: &max];
encode_NSInteger(aCoder, &max);
}
}
@ -523,13 +522,13 @@
}
else
{
uint32_t max;
NSInteger max;
[self setSearchButtonCell: [aDecoder decodeObject]];
[self setCancelButtonCell: [aDecoder decodeObject]];
[self setRecentsAutosaveName: [aDecoder decodeObject]];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_sends_whole_search_string];
[aDecoder decodeValueOfObjCType: @encode(uint32_t) at: &max];
decode_NSInteger(aDecoder, &max);
[self setMaximumRecents: max];
}

View file

@ -1070,7 +1070,7 @@ double _doubleValueForMousePoint (NSPoint point, NSRect knobRect,
else
{
float tmp_float;
int32_t tmp_int;
NSInteger tmp_int;
[self setDoubleValue: 0];
[decoder decodeValueOfObjCType: @encode(float) at: &tmp_float];
@ -1079,16 +1079,15 @@ double _doubleValueForMousePoint (NSPoint point, NSRect knobRect,
[self setMaxValue: tmp_float];
[decoder decodeValueOfObjCType: @encode(float) at: &tmp_float];
[self setAltIncrementValue: tmp_float];
[decoder decodeValueOfObjCType: @encode(int32_t) at: &tmp_int];
decode_NSInteger(decoder, &tmp_int);
_isVertical = tmp_int;
[decoder decodeValueOfObjCType: @encode(id) at: &_titleCell];
[decoder decodeValueOfObjCType: @encode(id) at: &_knobCell];
if ([decoder versionForClassName: @"NSSliderCell"] >= 2)
{
[decoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsTickMarkValuesOnly];
[decoder decodeValueOfObjCType: @encode(int32_t) at: &tmp_int];
_numberOfTickMarks = tmp_int;
[decoder decodeValueOfObjCType: @encode(int32_t) at: &tmp_int];
decode_NSInteger(decoder, &_numberOfTickMarks);
decode_NSInteger(decoder, &tmp_int);
_tickMarkPosition = tmp_int;
}
}
@ -1112,7 +1111,7 @@ double _doubleValueForMousePoint (NSPoint point, NSRect knobRect,
else
{
float tmp_float;
int32_t tmp_int;
NSInteger tmp_int;
tmp_float = _minValue;
[coder encodeValueOfObjCType: @encode(float) at: &tmp_float];
@ -1121,15 +1120,14 @@ double _doubleValueForMousePoint (NSPoint point, NSRect knobRect,
tmp_float = _altIncrementValue;
[coder encodeValueOfObjCType: @encode(float) at: &tmp_float];
tmp_int = _isVertical;
[coder encodeValueOfObjCType: @encode(int32_t) at: &tmp_int];
encode_NSInteger(coder, &tmp_int);
[coder encodeValueOfObjCType: @encode(id) at: &_titleCell];
[coder encodeValueOfObjCType: @encode(id) at: &_knobCell];
// New for version 2
[coder encodeValueOfObjCType: @encode(BOOL) at: &_allowsTickMarkValuesOnly];
tmp_int = _numberOfTickMarks;
[coder encodeValueOfObjCType: @encode(int32_t) at: &tmp_int];
encode_NSInteger(coder, &_numberOfTickMarks);
tmp_int = _tickMarkPosition;
[coder encodeValueOfObjCType: @encode(int32_t) at: &tmp_int];
encode_NSInteger(coder, &tmp_int);
}
}

View file

@ -35,6 +35,7 @@
#import "AppKit/NSStepperCell.h"
#import "AppKit/NSWindow.h"
#import "GNUstepGUI/GSTheme.h"
#import "GSGuiPrivate.h"
@interface NSStepperCell (Private)
- (void) _increment;
@ -381,7 +382,7 @@
}
else
{
int32_t tmp;
NSInteger tmp;
[aCoder encodeValueOfObjCType: @encode(double)
at: &_maxValue];
@ -389,12 +390,10 @@
at: &_minValue];
[aCoder encodeValueOfObjCType: @encode(double)
at: &_increment];
tmp = (int32_t)_autorepeat;
[aCoder encodeValueOfObjCType: @encode(int32_t)
at: &tmp];
tmp = (int32_t)_valueWraps;
[aCoder encodeValueOfObjCType: @encode(int32_t)
at: &tmp];
tmp = _autorepeat;
encode_NSInteger(aCoder, &tmp);
tmp = _valueWraps;
encode_NSInteger(aCoder, &tmp);
}
}
@ -417,7 +416,7 @@
}
else
{
int32_t tmp;
NSInteger tmp;
[aDecoder decodeValueOfObjCType: @encode(double)
at: &_maxValue];
@ -425,11 +424,9 @@
at: &_minValue];
[aDecoder decodeValueOfObjCType: @encode(double)
at: &_increment];
[aDecoder decodeValueOfObjCType: @encode(int32_t)
at: &tmp];
decode_NSInteger(aDecoder, &tmp);
_autorepeat = (BOOL)tmp;
[aDecoder decodeValueOfObjCType: @encode(int32_t)
at: &tmp];
decode_NSInteger(aDecoder, &tmp);
_valueWraps = (BOOL)tmp;
}