diff --git a/ChangeLog b/ChangeLog index c2079bd73..7fac17054 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-02-18 Frank Le Grand + + * Source\NSToolbarItem.m: Fixed a bug where calling setImage: + on a toolbar item would draw the image even if the toolbar + display mode would be set to NSToolbarDisplayModeLabelOnly + 2013-02-18 Frank Le Grand * Source\NSCollectionView.m: Fixed a potential "index out diff --git a/Source/GSToolbarCustomizationPalette.m b/Source/GSToolbarCustomizationPalette.m index d565f3822..c3314e7da 100644 --- a/Source/GSToolbarCustomizationPalette.m +++ b/Source/GSToolbarCustomizationPalette.m @@ -304,7 +304,6 @@ { NSToolbarItem *item = [toolbar _toolbarItemForIdentifier: identifier willBeInsertedIntoToolbar: NO]; - NSLog(@"item %@ for ident %@", item, identifier); [_allowedItems addObject: item]; } diff --git a/Source/NSToolbarItem.m b/Source/NSToolbarItem.m index 72a9f22e7..2e7e157c3 100644 --- a/Source/NSToolbarItem.m +++ b/Source/NSToolbarItem.m @@ -1331,7 +1331,13 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType"; [_image setScalesWhenResized: YES]; //[_image setSize: NSMakeSize(32, 32)]; - [(GSToolbarButton*)_backView setImage: image]; + // Do not set the image on the button if we are in "LabelOnly" + // mode. If the toolbar's displayMode changes later, we'll + // put the image on the button in the layout method. + if ([[self toolbar] displayMode] != NSToolbarDisplayModeLabelOnly) + { + [(GSToolbarButton*)_backView setImage: image]; + } } - (void) setLabel: (NSString *)label @@ -1497,6 +1503,15 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType"; - (void) _layout { + // Reset to image on the backview: We may have toggled + // from one NSToolbarDisplayMode to another, and it is + // possible setImage: would have been called on the + // NSToolbarItem while we were in NSToolbarDisplayModeLabelOnly + if ([[self toolbar] displayMode] != NSToolbarDisplayModeLabelOnly) + { + [(GSToolbarButton*)_backView setImage: _image]; + } + [(id)_backView layout]; }