Revision: 10204
          http://sourceforge.net/p/skim-app/code/10204
Author:   hofman
Date:     2018-12-30 13:31:04 +0000 (Sun, 30 Dec 2018)
Log Message:
-----------
draw tool mode button for split pdf larger, filling the whole frame

Modified Paths:
--------------
    trunk/NSImage_SKExtensions.m
    trunk/SKSecondaryPDFView.h
    trunk/SKSecondaryPDFView.m

Modified: trunk/NSImage_SKExtensions.m
===================================================================
--- trunk/NSImage_SKExtensions.m        2018-12-29 15:08:58 UTC (rev 10203)
+++ trunk/NSImage_SKExtensions.m        2018-12-30 13:31:04 UTC (rev 10204)
@@ -1578,13 +1578,13 @@
     );
     
     MAKE_IMAGE(SKImageNameTextToolAdorn, YES, 11.0, 11.0,
-        NSFont *font = [NSFont fontWithName:@"Helvetica" size:8.0] ?: [NSFont 
systemFontOfSize:8.0];
+        NSFont *font = [NSFont fontWithName:@"Helvetica" size:10.0] ?: [NSFont 
systemFontOfSize:10.0];
         NSGlyph glyph = [font glyphWithName:@"A"];
         [[NSColor blackColor] set];
-        NSBezierPath *path = [NSBezierPath bezierPathWithRect:NSMakeRect(1.5, 
1.5, 8.0, 8.0)];
+        NSBezierPath *path = [NSBezierPath bezierPathWithRect:NSMakeRect(0.5, 
0.5, 10.0, 10.0)];
         [path stroke];
         path = [NSBezierPath bezierPath];
-        [path moveToPoint:NSMakePoint(5.5 - NSMidX([font 
boundingRectForGlyph:glyph]), 2.5)];
+        [path moveToPoint:NSMakePoint(5.5 - NSMidX([font 
boundingRectForGlyph:glyph]), 2.0)];
         [path appendBezierPathWithGlyph:glyph inFont:font];
         [path fill];
     );

Modified: trunk/SKSecondaryPDFView.h
===================================================================
--- trunk/SKSecondaryPDFView.h  2018-12-29 15:08:58 UTC (rev 10203)
+++ trunk/SKSecondaryPDFView.h  2018-12-30 13:31:04 UTC (rev 10204)
@@ -50,6 +50,7 @@
     BOOL switching;
     BOOL selectsText;
     CGFloat startScale;
+    NSTrackingArea *area;
 }
 
 @property (nonatomic, retain) PDFView *synchronizedPDFView;

Modified: trunk/SKSecondaryPDFView.m
===================================================================
--- trunk/SKSecondaryPDFView.m  2018-12-29 15:08:58 UTC (rev 10203)
+++ trunk/SKSecondaryPDFView.m  2018-12-30 13:31:04 UTC (rev 10204)
@@ -52,6 +52,9 @@
 #import "NSImage_SKExtensions.h"
 #import "SKPDFView.h"
 
+@interface SKSmallButton : NSButton
+@end
+
 @interface SKSecondaryPDFView (SKPrivate)
 
 - (void)reloadPagePopUpButton;
@@ -150,34 +153,32 @@
 }
 
 - (void)reloadPagePopUpButton {
-    if (pagePopUpButton) {
-        NSArray *labels = [[self document] pageLabels];
-        NSUInteger count = [pagePopUpButton numberOfItems];
-        NSSize size = NSMakeSize(1000.0, 1000.0);
-        NSDictionary *attrs = [NSDictionary 
dictionaryWithObjectsAndKeys:[pagePopUpButton font], NSFontAttributeName, nil];
-        __block CGFloat maxWidth = 0.0;
-        __block NSUInteger maxIndex = 0;
+    NSArray *labels = [[self document] pageLabels];
+    NSUInteger count = [pagePopUpButton numberOfItems];
+    NSSize size = NSMakeSize(1000.0, 1000.0);
+    NSDictionary *attrs = [NSDictionary 
dictionaryWithObjectsAndKeys:[pagePopUpButton font], NSFontAttributeName, nil];
+    __block CGFloat maxWidth = 0.0;
+    __block NSUInteger maxIndex = 0;
+    
+    while (count--)
+        [pagePopUpButton removeItemAtIndex:count];
+    
+    if ([labels count] > 0) {
+        [labels enumerateObjectsUsingBlock:^(id label, NSUInteger i, BOOL 
*stop) {
+            CGFloat width = NSWidth([label boundingRectWithSize:size options:0 
attributes:attrs]);
+            if (width > maxWidth) {
+                maxWidth = width;
+                maxIndex = i;
+            }
+            [pagePopUpButton addItemWithTitle:label];
+        }];
         
-        while (count--)
-            [pagePopUpButton removeItemAtIndex:count];
+        sizePopUpToItemAtIndex(pagePopUpButton, maxIndex);
         
-        if ([labels count] > 0) {
-            [labels enumerateObjectsUsingBlock:^(id label, NSUInteger i, BOOL 
*stop) {
-                CGFloat width = NSWidth([label boundingRectWithSize:size 
options:0 attributes:attrs]);
-                if (width > maxWidth) {
-                    maxWidth = width;
-                    maxIndex = i;
-                }
-                [pagePopUpButton addItemWithTitle:label];
-            }];
-            
-            sizePopUpToItemAtIndex(pagePopUpButton, maxIndex);
-            
-            [pagePopUpButton selectItemAtIndex:[[self currentPage] pageIndex]];
-            
-            if (controlView)
-                [controlView setFrameSize:NSMakeSize(NSWidth([toolModeButton 
frame]) + NSWidth([pagePopUpButton frame]) + NSWidth([scalePopUpButton frame]), 
NSHeight([controlView frame]))];
-        }
+        [pagePopUpButton selectItemAtIndex:[[self currentPage] pageIndex]];
+        
+        if (controlView)
+            [controlView setFrameSize:NSMakeSize(NSWidth([toolModeButton 
frame]) + NSWidth([pagePopUpButton frame]) + NSWidth([scalePopUpButton frame]), 
NSHeight([controlView frame]))];
     }
 }
 
@@ -265,7 +266,7 @@
     if (toolModeButton == nil) {
         
         // create it
-        toolModeButton = [[NSButton alloc] initWithFrame:NSMakeRect(0.0, 0.0, 
17.0, 15.0)];
+        toolModeButton = [[SKSmallButton alloc] initWithFrame:NSMakeRect(0.0, 
0.0, 17.0, 15.0)];
         
         [toolModeButton setButtonType:NSOnOffButton];
         [toolModeButton setBezelStyle:NSTexturedSquareBezelStyle];
@@ -700,3 +701,22 @@
 }
 
 @end
+
+#pragma mark
+
+@interface SKSmallButtonCell : NSButtonCell
+@end
+
+@implementation SKSmallButton
+
++ (Class)cellClass { return [SKSmallButtonCell class]; }
+
+@end
+
+@implementation SKSmallButtonCell
+
+- (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView {
+    [super drawBezelWithFrame:NSInsetRect(frame, -4.0, -4.0) 
inView:controlView];
+}
+
+@end

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to