Revision: 27899
          http://sourceforge.net/p/bibdesk/svn/27899
Author:   hofman
Date:     2022-09-16 12:41:11 +0000 (Fri, 16 Sep 2022)
Log Message:
-----------
fix layout of editor status bar icons, tghey are layed out from the right, not 
the left

Modified Paths:
--------------
    trunk/bibdesk/BDSKStatusBar.m

Modified: trunk/bibdesk/BDSKStatusBar.m
===================================================================
--- trunk/bibdesk/BDSKStatusBar.m       2022-09-16 12:16:41 UTC (rev 27898)
+++ trunk/bibdesk/BDSKStatusBar.m       2022-09-16 12:41:11 UTC (rev 27899)
@@ -108,9 +108,14 @@
        return NSMakeSize(cellWidth, cellHeight);
 }
 
-- (void)drawRect:(NSRect)rect {
-       NSRect textRect = BDSKShrinkRect([self bounds], leftMargin, NSMinXEdge);
-       
+- (void)drawRect:(NSRect)dirtyRect {
+    if ([icons count] == 0)
+        return;
+    
+    CGFloat fullRightMargin = rightMargin;
+    if (progressIndicator)
+        fullRightMargin += NSWidth([progressIndicator frame]) + 
MARGIN_BETWEEN_ITEMS;
+       NSRect rect = BDSKShrinkRect([self bounds], fullRightMargin, 
NSMaxXEdge);
        NSImage *icon;
        NSRect iconRect;    
        NSSize size;
@@ -118,8 +123,8 @@
        for (NSDictionary *dict in icons) {
                icon = [dict objectForKey:@"icon"];
         size = [self cellSizeForIcon:icon];
-        NSDivideRect(textRect, &iconRect, &textRect, size.width, NSMaxXEdge);
-        textRect = BDSKShrinkRect(textRect, MARGIN_BETWEEN_ITEMS, NSMaxXEdge);
+        NSDivideRect(rect, &iconRect, &rect, size.width, NSMaxXEdge);
+        rect = BDSKShrinkRect(rect, MARGIN_BETWEEN_ITEMS, NSMaxXEdge);
         iconRect = BDSKCenterRectVertically(iconRect, size.height, NO);
         iconRect.origin.y += VERTICAL_OFFSET;
                [iconCell setImage:icon];
@@ -128,12 +133,7 @@
 }
 
 - (CGFloat)fullLeftMargin {
-    CGFloat fullLeftMargin = leftMargin + TEXT_INSET;
-    
-    for (NSDictionary *dict in icons)
-        fullLeftMargin += [self cellSizeForIcon:[dict 
objectForKey:@"icon"]].width + MARGIN_BETWEEN_ITEMS;
-    
-    return fullLeftMargin;
+    return leftMargin + TEXT_INSET;
 }
 
 - (CGFloat)fullRightMargin {
@@ -142,6 +142,9 @@
     if (progressIndicator)
         fullRightMargin += NSWidth([progressIndicator frame]) + 
MARGIN_BETWEEN_ITEMS;
     
+    for (NSDictionary *dict in icons)
+        fullRightMargin += [self cellSizeForIcon:[dict 
objectForKey:@"icon"]].width + MARGIN_BETWEEN_ITEMS;
+    
     return fullRightMargin;
 }
 
@@ -360,8 +363,10 @@
 }
 
 - (void)rebuildToolTips {
-       NSRect rect = BDSKShrinkRect([self bounds], leftMargin, NSMinXEdge);
-    
+    CGFloat fullRightMargin = rightMargin;
+    if (progressIndicator)
+        fullRightMargin += NSWidth([progressIndicator frame]) + 
MARGIN_BETWEEN_ITEMS;
+    NSRect rect = BDSKShrinkRect([self bounds], fullRightMargin, NSMaxXEdge);
        NSRect iconRect;
     NSSize size;
        

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to