Author: franklegrand
Date: Fri Mar 28 18:47:45 2014
New Revision: 37777

URL: http://svn.gna.org/viewcvs/gnustep?rev=37777&view=rev
Log:
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

Modified:
    libs/gui/branches/gnustep_testplant_branch/ChangeLog
    
libs/gui/branches/gnustep_testplant_branch/Source/GSToolbarCustomizationPalette.m
    libs/gui/branches/gnustep_testplant_branch/Source/NSToolbarItem.m

Modified: libs/gui/branches/gnustep_testplant_branch/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/ChangeLog?rev=37777&r1=37776&r2=37777&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/ChangeLog        (original)
+++ libs/gui/branches/gnustep_testplant_branch/ChangeLog        Fri Mar 28 
18:47:45 2014
@@ -1,3 +1,9 @@
+2013-02-18  Frank Le Grand <[email protected]>
+
+       * 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 <[email protected]>
 
        * Source\NSCollectionView.m: Fixed a potential "index out

Modified: 
libs/gui/branches/gnustep_testplant_branch/Source/GSToolbarCustomizationPalette.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/GSToolbarCustomizationPalette.m?rev=37777&r1=37776&r2=37777&view=diff
==============================================================================
--- 
libs/gui/branches/gnustep_testplant_branch/Source/GSToolbarCustomizationPalette.m
   (original)
+++ 
libs/gui/branches/gnustep_testplant_branch/Source/GSToolbarCustomizationPalette.m
   Fri Mar 28 18:47:45 2014
@@ -304,7 +304,6 @@
     {
       NSToolbarItem *item = [toolbar _toolbarItemForIdentifier: identifier
                                     willBeInsertedIntoToolbar: NO];
-      NSLog(@"item %@ for ident %@", item, identifier);
       [_allowedItems addObject: item]; 
     }
 

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSToolbarItem.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSToolbarItem.m?rev=37777&r1=37776&r2=37777&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSToolbarItem.m   
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSToolbarItem.m   Fri Mar 
28 18:47:45 2014
@@ -1331,7 +1331,13 @@
   [_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 @@
 
 - (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];
 }
 


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to