mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 03:21:04 +00:00
Correction for window size in -[NSWindowTemplate nibInstantiate]. Implemented encoding in encodeWithCoder: for some classes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23207 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3db08e83f6
commit
48db9c7614
12 changed files with 394 additions and 165 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2006-08-06 00:30-EDT Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibCompatibility.m: Correction in nibInstantiate for
|
||||
window frame.
|
||||
* Source/NSActionCell.m
|
||||
* Source/NSButtonCell.m
|
||||
* Source/NSCell.m
|
||||
* Source/NSComboBoxCell.m
|
||||
* Source/NSControl.m
|
||||
* Source/NSMatrix.m
|
||||
* Source/NSTableView.m
|
||||
* Source/NSTextContainer.m
|
||||
* Source/NSTextStorage.m
|
||||
* Source/NSTextView.m: Encoding in encodeWithCoder:.
|
||||
|
||||
2006-08-05 09:08-EDT Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSMenu.m: encodeWithCoder: encode items and title of
|
||||
|
|
|
@ -283,8 +283,7 @@ static BOOL _isInInterfaceBuilder = NO;
|
|||
[_view _fixSubviews];
|
||||
|
||||
// resize the window...
|
||||
[_realObject setFrame: [NSWindow frameRectForContentRect: [self windowRect]
|
||||
styleMask: [self windowStyle]]
|
||||
[_realObject setFrame: [self windowRect]
|
||||
display: NO];
|
||||
|
||||
// swap out any views which need to be swapped...
|
||||
|
|
|
@ -285,11 +285,20 @@ static Class controlClass;
|
|||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_tag];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
// This is only encoded for backward compatibility and won't be decoded.
|
||||
[aCoder encodeConditionalObject: nil];
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeInt: [self tag] forKey: @"NSTag"];
|
||||
[aCoder encodeObject: [self target] forKey: @"NSTarget"];
|
||||
[aCoder encodeObject: NSStringFromSelector([self action]) forKey: @"NSAction"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_tag];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
// This is only encoded for backward compatibility and won't be decoded.
|
||||
[aCoder encodeConditionalObject: nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
|
|
@ -1443,23 +1443,51 @@ typedef struct _GSButtonCellFlags
|
|||
{
|
||||
BOOL tmp;
|
||||
|
||||
// FIXME: Add new ivars
|
||||
[super encodeWithCoder: aCoder];
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
GSButtonCellFlags buttonCellFlags;
|
||||
unsigned int bFlags = 0;
|
||||
unsigned int bFlags2 = 0;
|
||||
|
||||
[aCoder encodeObject: _keyEquivalent];
|
||||
[aCoder encodeObject: _keyEquivalentFont];
|
||||
[aCoder encodeObject: _altContents];
|
||||
[aCoder encodeObject: _altImage];
|
||||
tmp = _buttoncell_is_transparent;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &tmp];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_keyEquivalentModifierMask];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_highlightsByMask];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_showAltStateMask];
|
||||
[aCoder encodeObject: [self keyEquivalent] forKey: @"NSKeyEquivalent"];
|
||||
[aCoder encodeObject: [self image] forKey: @"NSNormalImage"];
|
||||
[aCoder encodeObject: [self alternateTitle] forKey: @"NSAlternateContents"];
|
||||
|
||||
// encode button flags...
|
||||
buttonCellFlags.isTransparent = [self isTransparent];
|
||||
buttonCellFlags.isBordered = [self isBordered];
|
||||
buttonCellFlags.highlightByBackground = (_highlightsByMask & NSChangeBackgroundCellMask);
|
||||
buttonCellFlags.highlightByContents = (_highlightsByMask & NSContentsCellMask);
|
||||
buttonCellFlags.isPushin = (_highlightsByMask & NSPushInCellMask);
|
||||
buttonCellFlags.changeBackground = (_showAltStateMask & NSChangeBackgroundCellMask);
|
||||
buttonCellFlags.changeContents = (_showAltStateMask & NSContentsCellMask);
|
||||
memcpy((void *)&bFlags, (void *)&buttonCellFlags,sizeof(unsigned int));
|
||||
[aCoder encodeInt: bFlags forKey: @"NSButtonFlags"];
|
||||
|
||||
// style and border.
|
||||
bFlags2 != [self showsBorderOnlyWhileMouseInside] ? 0x8 : 0;
|
||||
bFlags2 |= [self bezelStyle];
|
||||
[aCoder encodeInt: bFlags2 forKey: @"NSButtonFlags2"];
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME: Add new ivars
|
||||
[aCoder encodeObject: _keyEquivalent];
|
||||
[aCoder encodeObject: _keyEquivalentFont];
|
||||
[aCoder encodeObject: _altContents];
|
||||
[aCoder encodeObject: _altImage];
|
||||
tmp = _buttoncell_is_transparent;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &tmp];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_keyEquivalentModifierMask];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_highlightsByMask];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &_showAltStateMask];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
|
156
Source/NSCell.m
156
Source/NSCell.m
|
@ -2185,65 +2185,105 @@ static NSColor *shadowCol;
|
|||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
BOOL flag;
|
||||
unsigned int tmp_int;
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
unsigned long cFlags = 0;
|
||||
unsigned int cFlags2 = 0;
|
||||
|
||||
[aCoder encodeObject: _contents];
|
||||
[aCoder encodeObject: _cell_image];
|
||||
[aCoder encodeObject: _font];
|
||||
[aCoder encodeObject: _objectValue];
|
||||
flag = _cell.contents_is_attributed_string;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_highlighted;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_disabled;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_editable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_rich_text;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.imports_graphics;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.shows_first_responder;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.refuses_first_responder;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.sends_action_on_end_editing;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_bordered;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_bezeled;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_scrollable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_selectable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
// This used to be is_continuous, which has been replaced.
|
||||
/* Ayers 20.03.2003: But we must continue to encode it for backward
|
||||
compatibility or current releases will have undefined behavior when
|
||||
decoding archives (i.e. .gorm files) encoded by this version. */
|
||||
flag = [self isContinuous];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.allows_mixed_state;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.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_int = _cell.state;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &_mnemonic_location];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &_mouse_down_flags];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &_action_mask];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_formatter];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_menu];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_represented_object];
|
||||
[aCoder encodeObject: _contents forKey: @"NSContents"];
|
||||
|
||||
// flags
|
||||
cFlags |= [self wraps] ? 0x40 : 0;
|
||||
cFlags |= [self isScrollable] ? 0x100000 : 0;
|
||||
cFlags |= [self isSelectable] ? 0x200001 : 0;
|
||||
cFlags |= [self isBezeled] ? 0x400000 : 0;
|
||||
cFlags |= [self isBordered] ? 0x800000 : 0;
|
||||
cFlags |= ([self type] == NSTextCellType) ? 0x4000000 : 0;
|
||||
cFlags |= [self isContinuous] ? 0x40000 : 0;
|
||||
cFlags |= [self isEditable] ? 0x10000000 : 0;
|
||||
cFlags |= ([self isEnabled] == NO) ? 0x20000000 : 0;
|
||||
cFlags |= ([self state] == NSOnState) ? 0x80000000 : 0;
|
||||
cFlags |= [self isHighlighted] ? 0x40000000 : 0;
|
||||
[aCoder encodeInt: cFlags forKey: @"NSCellFlags"];
|
||||
|
||||
// flags part 2
|
||||
cFlags2 |= [self sendsActionOnEndEditing] ? 0x400000 : 0;
|
||||
cFlags2 |= [self allowsMixedState] ? 0x1000000 : 0;
|
||||
cFlags2 |= [self refusesFirstResponder] ? 0x2000000 : 0;
|
||||
cFlags2 |= ([self alignment] == NSRightTextAlignment) ? 0x4000000 : 0;
|
||||
cFlags2 |= ([self alignment] == NSCenterTextAlignment) ? 0x8000000 : 0;
|
||||
cFlags2 |= ([self alignment] == NSJustifiedTextAlignment) ? 0xC000000 : 0;
|
||||
cFlags2 |= ([self alignment] == NSNaturalTextAlignment) ? 0x10000000 : 0;
|
||||
cFlags2 |= [self importsGraphics] ? 0x20000000 : 0;
|
||||
cFlags2 |= [self allowsEditingTextAttributes] ? 0x40000000 : 0;
|
||||
[aCoder encodeInt: cFlags2 forKey: @"NSCellFlags2"];
|
||||
|
||||
// font and formatter.
|
||||
[aCoder encodeObject: [self font] forKey: @"NSSupport"];
|
||||
[aCoder encodeObject: [self formatter] forKey: @"NSFormatter"];
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL flag;
|
||||
unsigned int tmp_int;
|
||||
|
||||
[aCoder encodeObject: _contents];
|
||||
[aCoder encodeObject: _cell_image];
|
||||
[aCoder encodeObject: _font];
|
||||
[aCoder encodeObject: _objectValue];
|
||||
flag = _cell.contents_is_attributed_string;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_highlighted;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_disabled;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_editable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_rich_text;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.imports_graphics;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.shows_first_responder;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.refuses_first_responder;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.sends_action_on_end_editing;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_bordered;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_bezeled;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_scrollable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.is_selectable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
// This used to be is_continuous, which has been replaced.
|
||||
/* Ayers 20.03.2003: But we must continue to encode it for backward
|
||||
compatibility or current releases will have undefined behavior when
|
||||
decoding archives (i.e. .gorm files) encoded by this version. */
|
||||
flag = [self isContinuous];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.allows_mixed_state;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _cell.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_int = _cell.state;
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &_mnemonic_location];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &_mouse_down_flags];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &_action_mask];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_formatter];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_menu];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_represented_object];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
|
|
@ -1654,18 +1654,26 @@ static inline NSRect buttonCellFrameFromRect(NSRect cellRect)
|
|||
{
|
||||
[super encodeWithCoder: coder];
|
||||
|
||||
[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];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &_visibleItems];
|
||||
[coder encodeValueOfObjCType: @encode(NSSize) at: &_intercellSpacing];
|
||||
[coder encodeValueOfObjCType: @encode(float) at: &_itemHeight];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &_selectedItem];
|
||||
|
||||
if (_usesDataSource == YES)
|
||||
[coder encodeConditionalObject: _dataSource];
|
||||
if([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeBool: [self hasVerticalScroller] forKey: @"NSHasVerticalScroller"];
|
||||
[coder encodeInt: [self numberOfVisibleItems] forKey: @"NSVisibleItemCount"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[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];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &_visibleItems];
|
||||
[coder encodeValueOfObjCType: @encode(NSSize) at: &_intercellSpacing];
|
||||
[coder encodeValueOfObjCType: @encode(float) at: &_itemHeight];
|
||||
[coder encodeValueOfObjCType: @encode(int) at: &_selectedItem];
|
||||
|
||||
if (_usesDataSource == YES)
|
||||
[coder encodeConditionalObject: _dataSource];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -843,10 +843,17 @@ static Class actionCellClass;
|
|||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_tag];
|
||||
[aCoder encodeObject: _cell];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_ignoresMultiClick];
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeObject: [self cell] forKey: @"NSCell"];
|
||||
[aCoder encodeBool: [self isEnabled] forKey: @"NSEnabled"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_tag];
|
||||
[aCoder encodeObject: _cell];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_ignoresMultiClick];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
|
|
@ -2677,45 +2677,77 @@ static SEL getSel;
|
|||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
GSMatrixFlags matrixFlags;
|
||||
unsigned int mFlags = 0;
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode (int) at: &_mode];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_allowsEmptySelection];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_selectionByRect];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_autosizesCells];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_autoscroll];
|
||||
[aCoder encodeSize: _cellSize];
|
||||
[aCoder encodeSize: _intercell];
|
||||
[aCoder encodeObject: _backgroundColor];
|
||||
[aCoder encodeObject: _cellBackgroundColor];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_drawsBackground];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_drawsCellBackground];
|
||||
[aCoder encodeObject: NSStringFromClass (_cellClass)];
|
||||
[aCoder encodeObject: _cellPrototype];
|
||||
[aCoder encodeValueOfObjCType: @encode (int) at: &_numRows];
|
||||
[aCoder encodeValueOfObjCType: @encode (int) at: &_numCols];
|
||||
|
||||
/* This is slower, but does not expose NSMatrix internals and will work
|
||||
[aCoder encodeObject: [self backgroundColor] forKey: @"NSBackgroundColor"];
|
||||
[aCoder encodeObject: [self cellBackgroundColor] forKey: @"NSCellBackgroundColor"];
|
||||
[aCoder encodeObject: [self prototype] forKey: @"NSProtoCell"];
|
||||
[aCoder encodeObject: NSStringFromClass([self cellClass]) forKey: @"NSCellClass"];
|
||||
[aCoder encodeSize: _cellSize forKey: @"NSCellSize"];
|
||||
[aCoder encodeSize: _intercell forKey: @"NSIntercellSpacing"];
|
||||
|
||||
/// set the flags...
|
||||
matrixFlags.isRadio = ([self mode] == NSRadioModeMatrix);
|
||||
matrixFlags.isList = ([self mode] == NSListModeMatrix);
|
||||
matrixFlags.isHighlight = ([self mode] == NSHighlightModeMatrix);
|
||||
matrixFlags.allowsEmptySelection = [self allowsEmptySelection];
|
||||
matrixFlags.selectionByRect = [self isSelectionByRect];
|
||||
matrixFlags.drawCellBackground = [self drawsCellBackground];
|
||||
matrixFlags.drawBackground = [self drawsBackground];
|
||||
matrixFlags.tabKeyTraversesCells = _tabKeyTraversesCells;
|
||||
memcpy((void *)&mFlags,(void *)&matrixFlags,sizeof(unsigned int));
|
||||
[aCoder encodeInt: mFlags forKey: @"NSMatrixFlags"];
|
||||
|
||||
[aCoder encodeInt: _numCols forKey: @"NSNumCols"];
|
||||
[aCoder encodeInt: _numRows forKey: @"NSNumRows"];
|
||||
[aCoder encodeObject: [self cells] forKey: @"NSCells"];
|
||||
[aCoder encodeInt: _selectedColumn forKey: @"NSSelectedCol"];
|
||||
[aCoder encodeInt: _selectedRow forKey: @"NSSelectedRow"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode (int) at: &_mode];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_allowsEmptySelection];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_selectionByRect];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_autosizesCells];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_autoscroll];
|
||||
[aCoder encodeSize: _cellSize];
|
||||
[aCoder encodeSize: _intercell];
|
||||
[aCoder encodeObject: _backgroundColor];
|
||||
[aCoder encodeObject: _cellBackgroundColor];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_drawsBackground];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_drawsCellBackground];
|
||||
[aCoder encodeObject: NSStringFromClass (_cellClass)];
|
||||
[aCoder encodeObject: _cellPrototype];
|
||||
[aCoder encodeValueOfObjCType: @encode (int) at: &_numRows];
|
||||
[aCoder encodeValueOfObjCType: @encode (int) at: &_numCols];
|
||||
|
||||
/* This is slower, but does not expose NSMatrix internals and will work
|
||||
with subclasses */
|
||||
[aCoder encodeObject: [self cells]];
|
||||
|
||||
[aCoder encodeConditionalObject: _delegate];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
[aCoder encodeValueOfObjCType: @encode (SEL) at: &_action];
|
||||
[aCoder encodeValueOfObjCType: @encode (SEL) at: &_doubleAction];
|
||||
[aCoder encodeValueOfObjCType: @encode (SEL) at: &_errorAction];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_tabKeyTraversesCells];
|
||||
[aCoder encodeObject: [self keyCell]];
|
||||
/* We do not encode information on selected cells, because this is saved
|
||||
with the cells themselves */
|
||||
[aCoder encodeObject: [self cells]];
|
||||
|
||||
[aCoder encodeConditionalObject: _delegate];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
[aCoder encodeValueOfObjCType: @encode (SEL) at: &_action];
|
||||
[aCoder encodeValueOfObjCType: @encode (SEL) at: &_doubleAction];
|
||||
[aCoder encodeValueOfObjCType: @encode (SEL) at: &_errorAction];
|
||||
[aCoder encodeValueOfObjCType: @encode (BOOL) at: &_tabKeyTraversesCells];
|
||||
[aCoder encodeObject: [self keyCell]];
|
||||
/* We do not encode information on selected cells, because this is saved
|
||||
with the cells themselves */
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
Class class;
|
||||
id cell;
|
||||
int rows, columns;
|
||||
int rows = 0, columns = 0;
|
||||
NSArray *array;
|
||||
int i, count;
|
||||
int i = 0, count = 0;
|
||||
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
|
|
|
@ -5136,13 +5136,14 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
|||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
unsigned int vFlags = 0; // (raw >> 26); // filter out settings not pertinent to us.
|
||||
NSSize intercellSpacing = [self intercellSpacing];
|
||||
|
||||
// make sure the corner view is properly encoded...
|
||||
[(NSKeyedArchiver *)aCoder setClassName: @"_NSCornerView" forClass: [GSTableCornerView class]];
|
||||
[super encodeWithCoder: aCoder];
|
||||
[aCoder encodeObject: [self dataSource] forKey: @"NSDataSource"];
|
||||
[aCoder encodeObject: [self delegate] forKey: @"NSDelegate"];
|
||||
[aCoder encodeObject: [self target] forKey: @"NSTarget"];
|
||||
|
@ -5178,6 +5179,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
|||
}
|
||||
else
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
[aCoder encodeConditionalObject: _dataSource];
|
||||
[aCoder encodeObject: _tableColumns];
|
||||
[aCoder encodeObject: _gridColor];
|
||||
|
|
|
@ -462,5 +462,22 @@ framework intact.
|
|||
}
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if([coder allowsKeyedCoding])
|
||||
{
|
||||
NSSize size = _containerRect.size;
|
||||
int flags = ((_widthTracksTextView)?1:0) |
|
||||
((_heightTracksTextView)?2:0) |
|
||||
((_observingFrameChanges)?4:0);
|
||||
|
||||
[coder encodeObject: _textView forKey: @"NSTextView"];
|
||||
[coder encodeFloat: size.width forKey: @"NSWidth"];
|
||||
[coder encodeInt: flags forKey: @"NSTCFlags"];
|
||||
|
||||
// TODO: Add layout manager encoding, if needed...
|
||||
}
|
||||
}
|
||||
|
||||
@end /* NSTextContainer */
|
||||
|
||||
|
|
|
@ -353,4 +353,17 @@ static NSNotificationCenter *nc = nil;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeObject: [self delegate] forKey: @"NSDelegate"];
|
||||
[coder encodeObject: [self string] forKey: @"NSString"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[super encodeWithCoder: coder];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -147,6 +147,35 @@ Interface for a bunch of internal methods that need to be cleaned up.
|
|||
|
||||
@implementation NSTextViewSharedData
|
||||
|
||||
- (id) initWithTextView: (NSTextView *)tv
|
||||
{
|
||||
if((self = [super init]) != nil)
|
||||
{
|
||||
flags = (([tv isEditable]?0x01:0) |
|
||||
([tv isSelectable]?0x02:0) |
|
||||
([tv isRichText]?0x04:0) |
|
||||
([tv importsGraphics]?0x08:0) |
|
||||
([tv isFieldEditor]?0x10:0) |
|
||||
([tv usesFontPanel]?0x20:0) |
|
||||
([tv isRulerVisible]?0x40:0) |
|
||||
([tv usesRuler]?0x100:0) |
|
||||
([tv drawsBackground]?0x800:0) |
|
||||
([tv smartInsertDeleteEnabled]?0x2000000:0) |
|
||||
([tv allowsUndo]?0x40000000:0));
|
||||
|
||||
ASSIGN(backgroundColor,[tv backgroundColor]);
|
||||
ASSIGN(paragraphStyle,[NSParagraphStyle defaultParagraphStyle]);
|
||||
ASSIGN(insertionColor,[tv insertionPointColor]);
|
||||
ASSIGN(markAttr,[tv markedTextAttributes]);
|
||||
ASSIGN(selectedAttr,[tv selectedTextAttributes]);
|
||||
|
||||
linkAttr = nil;
|
||||
textView = tv;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
|
@ -167,6 +196,21 @@ Interface for a bunch of internal methods that need to be cleaned up.
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeObject: backgroundColor forKey: @"NSBackgoundColor"];
|
||||
[coder encodeObject: paragraphStyle forKey: @"NSDefaultParagraphStyle"];
|
||||
[coder encodeInt: flags forKey: @"NSFlags"];
|
||||
[coder encodeObject: markAttr forKey: @"NSMarkedAttributes"];
|
||||
[coder encodeObject: selectedAttr forKey: @"NSSelectedAttributes"];
|
||||
[coder encodeObject: insertionColor forKey: @"NSInsertionColor"];
|
||||
|
||||
// TODO: Encode/Decode link attributes...
|
||||
}
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(backgroundColor);
|
||||
|
@ -652,45 +696,60 @@ that makes decoding and encoding compatible with the old code.
|
|||
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
[aCoder encodeConditionalObject: _delegate];
|
||||
if([aCoder allowsKeyedCoding])
|
||||
{
|
||||
NSTextViewSharedData *tvsd = [[NSTextViewSharedData alloc] initWithTextView: self];
|
||||
|
||||
flag = _tf.is_field_editor;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_editable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_selectable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_rich_text;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.imports_graphics;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.draws_background;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_horizontally_resizable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_vertically_resizable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.uses_font_panel;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.uses_ruler;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_ruler_visible;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
|
||||
[aCoder encodeObject: _backgroundColor];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSSize) at: &_minSize];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSSize) at: &_maxSize];
|
||||
|
||||
flag = _tf.smart_insert_delete;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.allows_undo;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
[aCoder encodeObject: _insertionPointColor];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSSize) at: &containerSize];
|
||||
flag = [_textContainer widthTracksTextView];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = [_textContainer heightTracksTextView];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
[aCoder encodeConditionalObject: _delegate forKey: @"NSDelegate"];
|
||||
[aCoder encodeSize: [self maxSize] forKey: @"NSMaxSize"];
|
||||
[aCoder encodeSize: [self minSize] forKey: @"NSMinSize"];
|
||||
[aCoder encodeObject: tvsd forKey: @"NSSharedData"];
|
||||
[aCoder encodeObject: [self textStorage] forKey: @"NSTextStorage"];
|
||||
[aCoder encodeObject: [self textContainer] forKey: @"NSTextContainer"];
|
||||
[aCoder encodeInt: 0 forKey: @"NSTVFlags"]; // no delegates, etc... set to zero.
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeConditionalObject: _delegate];
|
||||
|
||||
flag = _tf.is_field_editor;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_editable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_selectable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_rich_text;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.imports_graphics;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.draws_background;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_horizontally_resizable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_vertically_resizable;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.uses_font_panel;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.uses_ruler;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.is_ruler_visible;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
|
||||
[aCoder encodeObject: _backgroundColor];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSSize) at: &_minSize];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSSize) at: &_maxSize];
|
||||
|
||||
flag = _tf.smart_insert_delete;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = _tf.allows_undo;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
[aCoder encodeObject: _insertionPointColor];
|
||||
[aCoder encodeValueOfObjCType: @encode(NSSize) at: &containerSize];
|
||||
flag = [_textContainer widthTracksTextView];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
flag = [_textContainer heightTracksTextView];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||
|
|
Loading…
Reference in a new issue