mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
* Source/NSMenuItemCell.m: encode menu item in encodeWithCoder:
method. * Source/NSMenu.m: Add code to handle NSNoAutoenable * Source/NSPopUpButtonCell.m: Decode/encode selected index * Source/NSPrintInfo.m: Set orientation after the page size is known, since it has no effect when done earlier. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27568 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2d97996e15
commit
864092095d
5 changed files with 62 additions and 16 deletions
|
@ -1,3 +1,12 @@
|
|||
2009-01-09 22:53-EST Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSMenuItemCell.m: encode menu item in encodeWithCoder:
|
||||
method.
|
||||
* Source/NSMenu.m: Add code to handle NSNoAutoenable
|
||||
* Source/NSPopUpButtonCell.m: Decode/encode selected index
|
||||
* Source/NSPrintInfo.m: Set orientation after the page size is
|
||||
known, since it has no effect when done earlier.
|
||||
|
||||
2009-01-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSColorWell.m: Fix bug #25278 after checking behavior on MacOS
|
||||
|
|
|
@ -1408,7 +1408,20 @@ static BOOL menuBarVisible = YES;
|
|||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
dAuto = YES;
|
||||
//
|
||||
// NSNoAutoenable is present when the "Autoenable" option is NOT checked.
|
||||
// NO = Autoenable menus, YES = Don't auto enable menus. We, therefore,
|
||||
// have to invert the values of this flag in order to get the value of
|
||||
// dAuto.
|
||||
//
|
||||
if ([aDecoder containsValueForKey: @"NSNoAutoenable"])
|
||||
{
|
||||
dAuto = ([aDecoder decodeBoolForKey: @"NSNoAutoenable"] == NO) ? YES : NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
dAuto = NO;
|
||||
}
|
||||
dTitle = [aDecoder decodeObjectForKey: @"NSTitle"];
|
||||
dItems = [aDecoder decodeObjectForKey: @"NSMenuItems"];
|
||||
}
|
||||
|
|
|
@ -883,8 +883,15 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
|||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
[aCoder encodeConditionalObject: _menuItem];
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeObject: _menuItem
|
||||
forKey: @"NSMenuItem"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeConditionalObject: _menuItem];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
|
|
|
@ -1048,21 +1048,25 @@ static NSImage *_pbc_image[5];
|
|||
[super encodeWithCoder: aCoder];
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeBool: [self altersStateOfSelectedItem] forKey: @"NSAltersState"];
|
||||
[aCoder encodeBool: [self usesItemFromMenu] forKey: @"NSUsesItemFromMenu"];
|
||||
[aCoder encodeInt: [self arrowPosition] forKey: @"NSArrowPosition"];
|
||||
[aCoder encodeInt: [self preferredEdge] forKey: @"NSPreferredEdge"];
|
||||
|
||||
[aCoder encodeBool: [self altersStateOfSelectedItem]
|
||||
forKey: @"NSAltersState"];
|
||||
[aCoder encodeBool: [self usesItemFromMenu]
|
||||
forKey: @"NSUsesItemFromMenu"];
|
||||
[aCoder encodeInt: [self arrowPosition]
|
||||
forKey: @"NSArrowPosition"];
|
||||
[aCoder encodeInt: [self preferredEdge]
|
||||
forKey: @"NSPreferredEdge"];
|
||||
[aCoder encodeInt: [self indexOfSelectedItem]
|
||||
forKey: @"NSSelectedIndex"];
|
||||
[aCoder encodeBool: [self pullsDown]
|
||||
forKey: @"NSPullDown"];
|
||||
|
||||
// encode the menu, if present.
|
||||
if (_menu != nil)
|
||||
{
|
||||
[aCoder encodeObject: _menu forKey: @"NSMenu"];
|
||||
[aCoder encodeObject: _menu
|
||||
forKey: @"NSMenu"];
|
||||
}
|
||||
|
||||
if (_menuItem != nil)
|
||||
{
|
||||
[aCoder encodeObject: _menuItem forKey: @"NSMenuItem"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1107,7 +1111,7 @@ static NSImage *_pbc_image[5];
|
|||
if ([aDecoder containsValueForKey: @"NSArrowPosition"])
|
||||
{
|
||||
NSPopUpArrowPosition position = [aDecoder decodeIntForKey:
|
||||
@"NSArrowPosition"];
|
||||
@"NSArrowPosition"];
|
||||
|
||||
[self setArrowPosition: position];
|
||||
}
|
||||
|
@ -1117,10 +1121,23 @@ static NSImage *_pbc_image[5];
|
|||
|
||||
[self setPreferredEdge: edge];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSSelectedIndex"])
|
||||
{
|
||||
int selectedIdx = [aDecoder decodeIntForKey:
|
||||
@"NSSelectedIndex"];
|
||||
[self selectItem: [self itemAtIndex: selectedIdx]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSPullDown"])
|
||||
{
|
||||
BOOL pullDown = [aDecoder decodeBoolForKey: @"NSPullDown"];
|
||||
[self setPullsDown: pullDown];
|
||||
}
|
||||
|
||||
menu = [aDecoder decodeObjectForKey: @"NSMenu"];
|
||||
[self setMenu: nil];
|
||||
[self setMenu: menu];
|
||||
[self setAutoenablesItems: NO];
|
||||
[self setEnabled: YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -155,7 +155,6 @@ static NSPrintInfo *sharedPrintInfo = nil;
|
|||
[self setJobDisposition: NSPrintSpoolJob];
|
||||
[self setHorizontallyCentered: YES];
|
||||
[self setVerticallyCentered: YES];
|
||||
[self setOrientation: NSPortraitOrientation];
|
||||
|
||||
printer = [NSPrintInfo defaultPrinter];
|
||||
[self setPrinter: printer];
|
||||
|
@ -176,6 +175,7 @@ static NSPrintInfo *sharedPrintInfo = nil;
|
|||
[self setLeftMargin: 36];
|
||||
[self setTopMargin: 72];
|
||||
[self setBottomMargin: 72];
|
||||
[self setOrientation: NSPortraitOrientation];
|
||||
|
||||
if (aDict != nil)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue