Author: mlytwyn
Date: Thu Mar 10 23:37:09 2016
New Revision: 39524

URL: http://svn.gna.org/viewcvs/gnustep?rev=39524&view=rev
Log:
Fix bad scrollers and NSButtonCell merge with main branch revision 39484

Modified:
    libs/gui/branches/gnustep_testplant_branch/Source/GSThemeDrawing.m
    libs/gui/branches/gnustep_testplant_branch/Source/NSButtonCell.m

Modified: libs/gui/branches/gnustep_testplant_branch/Source/GSThemeDrawing.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/GSThemeDrawing.m?rev=39524&r1=39523&r2=39524&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/GSThemeDrawing.m  
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/GSThemeDrawing.m  Thu Mar 
10 23:37:09 2016
@@ -365,7 +365,7 @@
             break;
             
           default:
-            margins.left = 3; margins.top = 3; margins.right = 3; 
margins.bottom = 3;
+            //margins.left = 3; margins.top = 3; margins.right = 3; 
margins.bottom = 3;
             break;
         }
     }

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSButtonCell.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSButtonCell.m?rev=39524&r1=39523&r2=39524&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSButtonCell.m    
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSButtonCell.m    Thu Mar 
10 23:37:09 2016
@@ -933,6 +933,14 @@
 - (void) setBackgroundColor: (NSColor *)color
 {
   ASSIGN(_backgroundColor, color);
+
+  if (_control_view)
+    {
+      if ([_control_view isKindOfClass: [NSControl class]])
+        {
+          [(NSControl*)_control_view updateCell: self];
+}
+    }
 }
 
 - (GSThemeControlState) themeControlState
@@ -1013,57 +1021,27 @@
       NSPoint offset;
       NSRect rect;
       CGFloat fraction;
-      NSSize size = [imageToDisplay size];
-
-      // Make sure image does not exceed or touch our frame...
-      // Not the best solution so have at it if you have a better one...
-      if ([self imagePosition] == NSImageOnly)
-        cellFrame = NSInsetRect(cellFrame, 4, 4);
-      
-      size = [self _scaleImageWithSize: [imageToDisplay size]
+      NSSize size = [self _scaleImageWithSize: [imageToDisplay size]
                            toFitInSize: cellFrame.size
                            scalingType: _imageScaling];
       
-      /* Pixel-align size */
-
-      if (controlView)
-        {
-          NSSize sizeInBase = [controlView convertSizeToBase: size];
-          sizeInBase.width = GSRoundTowardsInfinity(sizeInBase.width);
-          sizeInBase.height = GSRoundTowardsInfinity(sizeInBase.height);
-          size = [controlView convertSizeFromBase: sizeInBase];
-        }
-
       /* Calculate an offset from the cellFrame origin */
-     
       offset = NSMakePoint((NSWidth(cellFrame) - size.width) / 2.0,
                            (NSHeight(cellFrame) - size.height) / 2.0);
 
-      /* Pixel-align the offset */
-
-      if (controlView)
-        {
-          NSPoint inBase = [controlView convertPointToBase: offset];
-          
-          // By convention we will round down and to the right.
-          // With the standard button design this looks good
-          // because the bottom and right edges of the button look 'heavier'
-          // so if the image's center must be offset from the button's 
geometric
-          // center, it looks beter if it's closer to the 'heavier' part
-          
-          inBase.x = GSRoundTowardsInfinity(inBase.x);
-          inBase.y = ([controlView isFlipped] ? 
GSRoundTowardsInfinity(inBase.y) :
-                      GSRoundTowardsNegativeInfinity(inBase.y));
-          
-          offset = [controlView convertPointFromBase: inBase];
+      rect = NSMakeRect(cellFrame.origin.x + offset.x,
+                       cellFrame.origin.y + offset.y,
+                       size.width,
+                       size.height);
+
+      /* Pixel-align */
+      if (nil != controlView)
+        {
+          rect = [controlView centerScanRect: rect];
         }
 
       /* Draw the image */
 
-      rect = NSMakeRect(cellFrame.origin.x + offset.x,
-                        cellFrame.origin.y + offset.y,
-                        size.width,
-                        size.height);
       fraction = (![self isEnabled] &&
                  [self imageDimsWhenDisabled]) ? 0.5 : 1.0;
       
@@ -1584,8 +1562,7 @@
       GSThemeMargins margins = [[GSTheme theme] buttonMarginsForCell: self
                                                                style: 
_bezel_style
                                                                state: 
GSThemeNormalState];
-      NSRect frame = [self insetFrame:theRect withMargins:margins];
-      return frame;
+      return [self insetFrame:theRect withMargins:margins];
     }
 }
 


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

Reply via email to