mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
Merge branch 'master' of github.com:gnustep/libs-gui into NSGridView_NSStackView_branch
This commit is contained in:
commit
44d956d508
15 changed files with 251 additions and 197 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2021-01-15 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSControl.m: Change encoding/decoding to protect
|
||||
against differences in integer size.
|
||||
|
||||
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,
|
||||
* Source/NSComboBoxCell.m,
|
||||
* Source/NSImageCell.m,
|
||||
* Source/NSLevelIndicatorCell.m,
|
||||
* Source/NSPathCell.m,
|
||||
* Source/NSPopUpButtonCell.m,
|
||||
* Source/NSSearchFieldCell.m,
|
||||
* Source/NSSliderCell.m,
|
||||
* Source/NSStepperCell.m: Change encoding/decoding to protect
|
||||
against differences in integer size.
|
||||
|
||||
2020-12-13 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSSearchFieldCell.m: Use GSTheme to display the popup.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#import "AppKit/NSActionCell.h"
|
||||
#import "AppKit/NSControl.h"
|
||||
#import "GSGuiPrivate.h"
|
||||
|
||||
@implementation NSActionCell
|
||||
|
||||
|
@ -386,7 +387,7 @@ static Class controlClass;
|
|||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(NSInteger) at: &_tag];
|
||||
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.
|
||||
|
@ -420,11 +421,12 @@ static Class controlClass;
|
|||
{
|
||||
id dummy;
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSInteger) at: &_tag];
|
||||
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.
|
||||
dummy = [aDecoder decodeObject];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &dummy];
|
||||
RELEASE(dummy);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
|
@ -1579,9 +1579,8 @@
|
|||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
BOOL tmp;
|
||||
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
GSButtonCellFlags buttonCellFlags;
|
||||
|
@ -1695,6 +1694,9 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
BOOL tmp;
|
||||
NSUInteger tmp2;
|
||||
|
||||
[aCoder encodeObject: _keyEquivalent];
|
||||
[aCoder encodeObject: _keyEquivalentFont];
|
||||
[aCoder encodeObject: _altContents];
|
||||
|
@ -1703,42 +1705,28 @@
|
|||
[aCoder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &tmp];
|
||||
|
||||
if([NSButtonCell version] <= 2)
|
||||
{
|
||||
unsigned int ke = _keyEquivalentModifierMask << 16;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &ke];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_keyEquivalentModifierMask];
|
||||
}
|
||||
encode_NSUInteger(aCoder, &_keyEquivalentModifierMask);
|
||||
tmp2 = _highlightsByMask;
|
||||
encode_NSUInteger(aCoder, &tmp2);
|
||||
tmp2 = _showAltStateMask;
|
||||
encode_NSUInteger(aCoder, &tmp2);
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_highlightsByMask];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_showAltStateMask];
|
||||
|
||||
if([NSButtonCell version] >= 2)
|
||||
{
|
||||
[aCoder encodeObject: _sound];
|
||||
[aCoder encodeObject: _backgroundColor];
|
||||
[aCoder encodeValueOfObjCType: @encode(float)
|
||||
at: &_delayInterval];
|
||||
[aCoder encodeValueOfObjCType: @encode(float)
|
||||
at: &_repeatInterval];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_bezel_style];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_gradient_type];
|
||||
tmp = _image_dims_when_disabled;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &tmp];
|
||||
tmp = _shows_border_only_while_mouse_inside;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &tmp];
|
||||
}
|
||||
[aCoder encodeObject: _sound];
|
||||
[aCoder encodeObject: _backgroundColor];
|
||||
[aCoder encodeValueOfObjCType: @encode(float)
|
||||
at: &_delayInterval];
|
||||
[aCoder encodeValueOfObjCType: @encode(float)
|
||||
at: &_repeatInterval];
|
||||
tmp2 = _bezel_style;
|
||||
encode_NSUInteger(aCoder, &tmp2);
|
||||
tmp2 = _gradient_type;
|
||||
encode_NSUInteger(aCoder, &tmp2);
|
||||
tmp = _image_dims_when_disabled;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &tmp];
|
||||
tmp = _shows_border_only_while_mouse_inside;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &tmp];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1885,27 +1873,32 @@
|
|||
else
|
||||
{
|
||||
BOOL tmp;
|
||||
NSUInteger tmp2;
|
||||
int version = [aDecoder versionForClassName: @"NSButtonCell"];
|
||||
NSString *key = nil;
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &key];
|
||||
[self setKeyEquivalent: key]; // Set the key equivalent...
|
||||
// Hack to correct a Gorm problem, there "\n" is used instead of "\r".
|
||||
if ([key isEqualToString: @"\n" ])
|
||||
{
|
||||
key = @"\r";
|
||||
}
|
||||
[self setKeyEquivalent: key];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalentFont];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_altContents];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_altImage];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||
_buttoncell_is_transparent = tmp;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_keyEquivalentModifierMask];
|
||||
decode_NSUInteger(aDecoder, &_keyEquivalentModifierMask);
|
||||
if (version <= 2)
|
||||
{
|
||||
_keyEquivalentModifierMask = _keyEquivalentModifierMask << 16;
|
||||
}
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_highlightsByMask];
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_showAltStateMask];
|
||||
decode_NSUInteger(aDecoder, &tmp2);
|
||||
_highlightsByMask = (NSInteger)tmp2;
|
||||
decode_NSUInteger(aDecoder, &tmp2);
|
||||
_showAltStateMask = (NSInteger)tmp2;
|
||||
|
||||
if (version >= 2)
|
||||
{
|
||||
|
@ -1913,10 +1906,10 @@
|
|||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_backgroundColor];
|
||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_delayInterval];
|
||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_repeatInterval];
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_bezel_style];
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_gradient_type];
|
||||
decode_NSUInteger(aDecoder, &tmp2);
|
||||
_bezel_style = (NSBezelStyle)tmp2;
|
||||
decode_NSUInteger(aDecoder, &tmp2);
|
||||
_gradient_type = (NSGradientType)tmp2;
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||
_image_dims_when_disabled = tmp;
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||
|
@ -1926,12 +1919,6 @@
|
|||
_imageScaling = NSImageScaleNone;
|
||||
}
|
||||
|
||||
// Hack to correct a Gorm problem, there "\n" is used instead of "\r".
|
||||
if ([_keyEquivalent isEqualToString: @"\n" ])
|
||||
{
|
||||
[self setKeyEquivalent: @"\r"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
117
Source/NSCell.m
117
Source/NSCell.m
|
@ -2524,7 +2524,7 @@ static NSColor *dtxtCol;
|
|||
else
|
||||
{
|
||||
BOOL flag;
|
||||
unsigned int tmp_int;
|
||||
NSUInteger tmp_uint;
|
||||
|
||||
[aCoder encodeObject: _contents];
|
||||
[aCoder encodeObject: _cell_image];
|
||||
|
@ -2566,39 +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(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.type;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.image_position;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.entry_type;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) 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(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.mnemonic_location;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSUInteger) at: &_mouse_down_flags];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSUInteger) at: &_action_mask];
|
||||
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(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.line_break_mode;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.control_tint;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.control_size;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.focus_ring_type;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.base_writing_direction;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
tmp_int = _cell.uses_single_line_mode;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2702,7 +2702,7 @@ static NSColor *dtxtCol;
|
|||
else
|
||||
{
|
||||
BOOL flag, wraps;
|
||||
unsigned int tmp_int;
|
||||
NSUInteger tmp_uint;
|
||||
id formatter, menu;
|
||||
int version = [aDecoder versionForClassName: @"NSCell"];
|
||||
|
||||
|
@ -2745,21 +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(unsigned int) at: &tmp_int];
|
||||
_cell.text_align = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.type = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.image_position = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.entry_type = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.state = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.mnemonic_location = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSUInteger)
|
||||
at: &_mouse_down_flags];
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSUInteger) at: &_action_mask];
|
||||
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;
|
||||
|
@ -2873,18 +2872,18 @@ static NSColor *dtxtCol;
|
|||
|
||||
if (version >= 2)
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.allows_undo = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.line_break_mode = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.control_tint = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.control_size = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.focus_ring_type = tmp_int;
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) 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
|
||||
{
|
||||
|
@ -2895,8 +2894,8 @@ static NSColor *dtxtCol;
|
|||
|
||||
if (version >= 4)
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
_cell.uses_single_line_mode = tmp_int;
|
||||
decode_NSUInteger(aDecoder, &tmp_uint);
|
||||
_cell.uses_single_line_mode = tmp_uint;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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"];
|
||||
|
@ -1562,10 +1562,10 @@ static inline NSRect buttonCellFrameFromRect(NSRect cellRect)
|
|||
[coder encodeValueOfObjCType: @encode(BOOL) at: &_hasVerticalScroller];
|
||||
[coder encodeValueOfObjCType: @encode(BOOL) at: &_completes];
|
||||
[coder encodeValueOfObjCType: @encode(BOOL) at: &_usesDataSource];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &_visibleItems];
|
||||
encode_NSInteger(coder, &_visibleItems);
|
||||
[coder encodeValueOfObjCType: @encode(NSSize) at: &_intercellSpacing];
|
||||
[coder encodeValueOfObjCType: @encode(float) at: &_itemHeight];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &_selectedItem];
|
||||
encode_NSInteger(coder, &_selectedItem);
|
||||
|
||||
if (_usesDataSource == YES)
|
||||
[coder encodeConditionalObject: _dataSource];
|
||||
|
@ -1596,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"])
|
||||
|
@ -1649,10 +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(int) at: &_visibleItems];
|
||||
decode_NSInteger(aDecoder, &_visibleItems);
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSSize) at: &_intercellSpacing];
|
||||
[aDecoder decodeValueOfObjCType: @encode(float) at: &_itemHeight];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_selectedItem];
|
||||
decode_NSInteger(aDecoder, &_selectedItem);
|
||||
|
||||
if (_usesDataSource == YES)
|
||||
[self setDataSource: [aDecoder decodeObject]];
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#import "AppKit/NSWindow.h"
|
||||
#import "GSBindingHelpers.h"
|
||||
#import "NSViewPrivate.h"
|
||||
#import "GSGuiPrivate.h"
|
||||
|
||||
/*
|
||||
* Class variables
|
||||
|
@ -993,7 +994,7 @@ static NSNotificationCenter *nc;
|
|||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_tag];
|
||||
encode_NSInteger(aCoder, &_tag);
|
||||
[aCoder encodeObject: _cell];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_ignoresMultiClick];
|
||||
}
|
||||
|
@ -1038,7 +1039,7 @@ static NSNotificationCenter *nc;
|
|||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_tag];
|
||||
decode_NSInteger(aDecoder, &_tag);
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cell];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_ignoresMultiClick];
|
||||
}
|
||||
|
|
|
@ -306,9 +306,14 @@ yBottomInRect(NSSize innerSize, NSRect outerRect, BOOL flipped)
|
|||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_imageAlignment];
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_frameStyle];
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_imageScaling];
|
||||
NSInteger tmp;
|
||||
|
||||
tmp = _imageAlignment;
|
||||
encode_NSInteger(aCoder, &tmp);
|
||||
tmp = _frameStyle;
|
||||
encode_NSInteger(aCoder, &tmp);
|
||||
tmp = _imageScaling;
|
||||
encode_NSInteger(aCoder, &tmp);
|
||||
[aCoder encodeSize: _original_image_size];
|
||||
}
|
||||
}
|
||||
|
@ -338,9 +343,14 @@ yBottomInRect(NSSize innerSize, NSRect outerRect, BOOL flipped)
|
|||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_imageAlignment];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_frameStyle];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_imageScaling];
|
||||
NSInteger tmp;
|
||||
|
||||
decode_NSInteger(aDecoder, &tmp);
|
||||
_imageAlignment = tmp;
|
||||
decode_NSInteger(aDecoder, &tmp);
|
||||
_frameStyle = tmp;
|
||||
decode_NSInteger(aDecoder, &tmp);
|
||||
_imageScaling = tmp;
|
||||
_original_image_size = [aDecoder decodeSize];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#import "AppKit/NSGraphics.h"
|
||||
#import "AppKit/NSImage.h"
|
||||
#import "AppKit/NSLevelIndicatorCell.h"
|
||||
#import "GSGuiPrivate.h"
|
||||
|
||||
@implementation NSLevelIndicatorCell
|
||||
|
||||
|
@ -501,14 +502,18 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
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];
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_style];
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfMajorTickMarks];
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfTickMarks];
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_tickMarkPosition];
|
||||
tmp = _style;
|
||||
encode_NSInteger(aCoder, &tmp);
|
||||
encode_NSInteger(aCoder, &_numberOfMajorTickMarks);
|
||||
encode_NSInteger(aCoder, &_numberOfTickMarks);
|
||||
tmp = _tickMarkPosition;
|
||||
encode_NSInteger(aCoder, &tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -556,15 +561,19 @@
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
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(int) at: &_style];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_numberOfMajorTickMarks];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_numberOfTickMarks];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &_tickMarkPosition];
|
||||
decode_NSInteger(aDecoder, &tmp);
|
||||
_style = tmp;
|
||||
decode_NSInteger(aDecoder, &_numberOfMajorTickMarks);
|
||||
decode_NSInteger(aDecoder, &_numberOfTickMarks);
|
||||
decode_NSInteger(aDecoder, &tmp);
|
||||
_tickMarkPosition = tmp;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#import "AppKit/NSWorkspace.h"
|
||||
#import "AppKit/NSImage.h"
|
||||
#import "AppKit/NSPathComponentCell.h"
|
||||
#import "GSGuiPrivate.h"
|
||||
|
||||
static Class pathComponentCellClass;
|
||||
|
||||
|
@ -250,8 +251,7 @@ static Class pathComponentCellClass;
|
|||
}
|
||||
else
|
||||
{
|
||||
[coder decodeValueOfObjCType: @encode(NSUInteger)
|
||||
at: &_pathStyle];
|
||||
decode_NSUInteger(coder, &_pathStyle);
|
||||
[self setPathComponentCells: [coder decodeObject]];
|
||||
}
|
||||
|
||||
|
@ -270,8 +270,7 @@ static Class pathComponentCellClass;
|
|||
}
|
||||
else
|
||||
{
|
||||
[coder encodeValueOfObjCType: @encode(NSUInteger)
|
||||
at: &_pathStyle];
|
||||
encode_NSUInteger(coder, &_pathStyle);
|
||||
[coder encodeObject: [self pathComponentCells]];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,19 +1208,20 @@ static NSImage *_pbc_image[5];
|
|||
}
|
||||
else
|
||||
{
|
||||
int flag;
|
||||
NSInteger flag;
|
||||
|
||||
[aCoder encodeObject: _menu];
|
||||
[aCoder encodeConditionalObject: [self selectedItem]];
|
||||
flag = _pbcFlags.pullsDown;
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &flag];
|
||||
encode_NSInteger(aCoder, &flag);
|
||||
flag = _pbcFlags.preferredEdge;
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &flag];
|
||||
encode_NSInteger(aCoder, &flag);
|
||||
flag = _pbcFlags.usesItemFromMenu;
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &flag];
|
||||
encode_NSInteger(aCoder, &flag);
|
||||
flag = _pbcFlags.altersStateOfSelectedItem;
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &flag];
|
||||
encode_NSInteger(aCoder, &flag);
|
||||
flag = _pbcFlags.arrowPosition;
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &flag];
|
||||
encode_NSInteger(aCoder, &flag);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1305,7 +1307,7 @@ static NSImage *_pbc_image[5];
|
|||
}
|
||||
else
|
||||
{
|
||||
int flag;
|
||||
NSInteger flag;
|
||||
id<NSMenuItem> selectedItem;
|
||||
int version = [aDecoder versionForClassName:
|
||||
@"NSPopUpButtonCell"];
|
||||
|
@ -1320,15 +1322,15 @@ static NSImage *_pbc_image[5];
|
|||
[self setMenu: nil];
|
||||
[self setMenu: menu];
|
||||
selectedItem = [aDecoder decodeObject];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &flag];
|
||||
decode_NSInteger(aDecoder, &flag);
|
||||
_pbcFlags.pullsDown = flag;
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &flag];
|
||||
decode_NSInteger(aDecoder, &flag);
|
||||
_pbcFlags.preferredEdge = flag;
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &flag];
|
||||
decode_NSInteger(aDecoder, &flag);
|
||||
_pbcFlags.usesItemFromMenu = flag;
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &flag];
|
||||
decode_NSInteger(aDecoder, &flag);
|
||||
_pbcFlags.altersStateOfSelectedItem = flag;
|
||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &flag];
|
||||
decode_NSInteger(aDecoder, &flag);
|
||||
_pbcFlags.arrowPosition = flag;
|
||||
|
||||
if (version < 2)
|
||||
|
|
|
@ -481,12 +481,12 @@
|
|||
//
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
NSInteger max = [self maximumRecents];
|
||||
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
int max = [self maximumRecents];
|
||||
|
||||
[aCoder encodeObject: _search_button_cell forKey: @"NSSearchButtonCell"];
|
||||
[aCoder encodeObject: _cancel_button_cell forKey: @"NSCancelButtonCell"];
|
||||
[aCoder encodeObject: _recents_autosave_name forKey: @"NSRecentsAutosaveName"];
|
||||
|
@ -495,13 +495,14 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
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(unsigned int)
|
||||
at: &max];
|
||||
encode_NSInteger(aCoder, &max);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -527,7 +528,7 @@
|
|||
[self setCancelButtonCell: [aDecoder decodeObject]];
|
||||
[self setRecentsAutosaveName: [aDecoder decodeObject]];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_sends_whole_search_string];
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &max];
|
||||
decode_NSInteger(aDecoder, &max);
|
||||
[self setMaximumRecents: max];
|
||||
}
|
||||
|
||||
|
|
|
@ -1069,24 +1069,26 @@ double _doubleValueForMousePoint (NSPoint point, NSRect knobRect,
|
|||
}
|
||||
else
|
||||
{
|
||||
float minValue, maxValue;
|
||||
float altIncrementValue;
|
||||
int isVertical;
|
||||
float tmp_float;
|
||||
NSInteger tmp_int;
|
||||
|
||||
[decoder decodeValuesOfObjCTypes: "fffi",
|
||||
&minValue, &maxValue, &altIncrementValue, &isVertical];
|
||||
[self setDoubleValue: 0];
|
||||
[self setMinValue: minValue];
|
||||
[self setMaxValue: maxValue];
|
||||
[self setAltIncrementValue: altIncrementValue];
|
||||
_isVertical = isVertical;
|
||||
[decoder decodeValueOfObjCType: @encode(float) at: &tmp_float];
|
||||
[self setMinValue: tmp_float];
|
||||
[decoder decodeValueOfObjCType: @encode(float) at: &tmp_float];
|
||||
[self setMaxValue: tmp_float];
|
||||
[decoder decodeValueOfObjCType: @encode(float) at: &tmp_float];
|
||||
[self setAltIncrementValue: tmp_float];
|
||||
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(NSInteger) at: &_numberOfTickMarks];
|
||||
[decoder decodeValueOfObjCType: @encode(int) at: &_tickMarkPosition];
|
||||
decode_NSInteger(decoder, &_numberOfTickMarks);
|
||||
decode_NSInteger(decoder, &tmp_int);
|
||||
_tickMarkPosition = tmp_int;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
|
@ -1108,19 +1110,24 @@ double _doubleValueForMousePoint (NSPoint point, NSRect knobRect,
|
|||
}
|
||||
else
|
||||
{
|
||||
float minValue = _minValue;
|
||||
float maxValue = _maxValue;
|
||||
float altIncrementValue = _altIncrementValue;
|
||||
int isVertical = _isVertical;
|
||||
float tmp_float;
|
||||
NSInteger tmp_int;
|
||||
|
||||
[coder encodeValuesOfObjCTypes: "fffi",
|
||||
&minValue, &maxValue, &altIncrementValue, &isVertical];
|
||||
tmp_float = _minValue;
|
||||
[coder encodeValueOfObjCType: @encode(float) at: &tmp_float];
|
||||
tmp_float = _maxValue;
|
||||
[coder encodeValueOfObjCType: @encode(float) at: &tmp_float];
|
||||
tmp_float = _altIncrementValue;
|
||||
[coder encodeValueOfObjCType: @encode(float) at: &tmp_float];
|
||||
tmp_int = _isVertical;
|
||||
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];
|
||||
[coder encodeValueOfObjCType: @encode(NSInteger) at: &_numberOfTickMarks];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &_tickMarkPosition];
|
||||
encode_NSInteger(coder, &_numberOfTickMarks);
|
||||
tmp_int = _tickMarkPosition;
|
||||
encode_NSInteger(coder, &tmp_int);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,21 +382,18 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
int tmp1, tmp2;
|
||||
NSInteger tmp;
|
||||
|
||||
tmp1 = (int)_autorepeat;
|
||||
tmp2 = (int)_valueWraps;
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(double)
|
||||
at: &_maxValue];
|
||||
[aCoder encodeValueOfObjCType: @encode(double)
|
||||
at: &_minValue];
|
||||
[aCoder encodeValueOfObjCType: @encode(double)
|
||||
at: &_increment];
|
||||
[aCoder encodeValueOfObjCType: @encode(int)
|
||||
at: &tmp1];
|
||||
[aCoder encodeValueOfObjCType: @encode(int)
|
||||
at: &tmp2];
|
||||
tmp = _autorepeat;
|
||||
encode_NSInteger(aCoder, &tmp);
|
||||
tmp = _valueWraps;
|
||||
encode_NSInteger(aCoder, &tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -418,7 +416,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
int tmp1, tmp2;
|
||||
NSInteger tmp;
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(double)
|
||||
at: &_maxValue];
|
||||
|
@ -426,13 +424,10 @@
|
|||
at: &_minValue];
|
||||
[aDecoder decodeValueOfObjCType: @encode(double)
|
||||
at: &_increment];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int)
|
||||
at: &tmp1];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int)
|
||||
at: &tmp2];
|
||||
|
||||
_autorepeat = (BOOL)tmp1;
|
||||
_valueWraps = (BOOL)tmp2;
|
||||
decode_NSInteger(aDecoder, &tmp);
|
||||
_autorepeat = (BOOL)tmp;
|
||||
decode_NSInteger(aDecoder, &tmp);
|
||||
_valueWraps = (BOOL)tmp;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
Loading…
Reference in a new issue