Index: Headers/AppKit/NSSearchFieldCell.h =================================================================== --- Headers/AppKit/NSSearchFieldCell.h (revision 28600) +++ Headers/AppKit/NSSearchFieldCell.h (working copy) @@ -52,7 +52,7 @@ NSMenu *_menu_template; BOOL _sends_whole_search_string; BOOL _sends_search_string_immediatly; - unsigned char _max_recents; + int _max_recents; } // Managing button cells Index: Source/NSSearchFieldCell.m =================================================================== --- Source/NSSearchFieldCell.m (revision 28600) +++ Source/NSSearchFieldCell.m (working copy) @@ -443,35 +443,56 @@ [self searchButtonRectForBounds: [_control_view bounds]] inView: _control_view]; } + // // NSCoding protocol // + + +static NSString *NSSearchButtonCell = @"NSSearchButtonCell"; +static NSString *NSCancelButtonCell = @"NSCancelButtonCell"; +static NSString *NSRecentsAutosaveName = @"NSRecentsAutosaveName"; +static NSString *NSSendsWholeSearchString = @"NSSendsWholeSearchString"; +static NSString *NSMaximumRecents = @"NSMaximumRecents"; + + - (void) encodeWithCoder: (NSCoder*)aCoder { [super encodeWithCoder: aCoder]; - [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_recents]; + if ([aCoder allowsKeyedCoding]) + { + [aCoder encodeObject: _search_button_cell forKey: NSSearchButtonCell]; + [aCoder encodeObject: _cancel_button_cell forKey: NSCancelButtonCell]; + [aCoder encodeObject: _recents_autosave_name forKey: NSRecentsAutosaveName]; + [aCoder encodeBool: _sends_whole_search_string forKey: NSSendsWholeSearchString]; + [aCoder encodeInt: _max_recents forKey: NSMaximumRecents]; + } + else + { + [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(int) + at: &_max_recents]; + } } - (id) initWithCoder: (NSCoder*)aDecoder { self = [super initWithCoder: aDecoder]; - if(self != nil) + if (self != nil) { if ([aDecoder allowsKeyedCoding]) { - [self setSearchButtonCell: [aDecoder decodeObjectForKey: @"NSSearchButtonCell"]]; - [self setCancelButtonCell: [aDecoder decodeObjectForKey: @"NSCancelButtonCell"]]; - [self setRecentsAutosaveName: [aDecoder decodeObjectForKey: @"NSRecentsAutosaveName"]]; - [self setSendsWholeSearchString: [aDecoder decodeBoolForKey: @"NSSendsWholeSearchString"]]; - [self setMaximumRecents: [aDecoder decodeIntForKey: @"NSMaximumRecents"]]; + [self setSearchButtonCell: [aDecoder decodeObjectForKey: NSSearchButtonCell]]; + [self setCancelButtonCell: [aDecoder decodeObjectForKey: NSCancelButtonCell]]; + [self setRecentsAutosaveName: [aDecoder decodeObjectForKey: NSRecentsAutosaveName]]; + [self setSendsWholeSearchString: [aDecoder decodeBoolForKey: NSSendsWholeSearchString]]; + [self setMaximumRecents: [aDecoder decodeIntForKey: NSMaximumRecents]]; } else { @@ -479,7 +500,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_recents]; + [aDecoder decodeValueOfObjCType: @encode(int) at: &_max_recents]; } [self resetCancelButtonCell];