Revision: 5566
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5566&view=rev
Author:   hofman
Date:     2009-08-17 21:32:25 +0000 (Mon, 17 Aug 2009)

Log Message:
-----------
add hidden pref to show the active annotation bounds in the status bar

Modified Paths:
--------------
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_Actions.m
    trunk/SKMainWindowController_UI.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2009-08-16 12:25:18 UTC (rev 5565)
+++ trunk/SKMainWindowController.m      2009-08-17 21:32:25 UTC (rev 5566)
@@ -148,6 +148,8 @@
 #define SKUsesDrawersKey @"SKUsesDrawers"
 #define SKDisableAnimatedSearchHighlightKey @"SKDisableAnimatedSearchHighlight"
 
+#define SKDisplayNoteBoundsKey @"SKDisplayNoteBounds" 
+
 NSString *SKUnarchiveFromDataArrayTransformerName = 
@"SKUnarchiveFromDataArrayTransformer";
 
 
@@ -621,24 +623,26 @@
 }
 
 - (void)updateRightStatus {
-    NSRect selRect = [pdfView currentSelectionRect];
+    NSRect rect = [pdfView currentSelectionRect];
+    CGFloat magnification = [pdfView currentMagnification];
+    NSString *message;
     
-    NSString *message;
-    if (NSEqualRects(selRect, NSZeroRect)) {
-        CGFloat magnification = [pdfView currentMagnification];
-        if (magnification > 0.0001)
-            message = [NSString stringWithFormat:@"%.2f %C", magnification, 
MULTIPLICATION_SIGN_CHARACTER];
-        else
-           message = @"";
-    } else {
+    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKDisplayNoteBoundsKey] && NSEqualRects(rect, NSZeroRect) && 
[pdfView activeAnnotation])
+        rect = [[pdfView activeAnnotation] bounds];
+    
+    if (NSEqualRects(rect, NSZeroRect) == NO) {
         if ([statusBar rightState] == NSOnState) {
             BOOL useMetric = [[[NSLocale currentLocale] 
objectForKey:NSLocaleUsesMetricSystem] boolValue];
             NSString *units = useMetric ? @"cm" : @"in";
             CGFloat factor = useMetric ? 0.035277778 : 0.013888889;
-            message = [NSString stringWithFormat:@"%.2f %C %.2f @ (%.2f, %.2f) 
%@", NSWidth(selRect) * factor, MULTIPLICATION_SIGN_CHARACTER, 
NSHeight(selRect) * factor, NSMinX(selRect) * factor, NSMinY(selRect) * factor, 
units];
+            message = [NSString stringWithFormat:@"%.2f %C %.2f @ (%.2f, %.2f) 
%@", NSWidth(rect) * factor, MULTIPLICATION_SIGN_CHARACTER, NSHeight(rect) * 
factor, NSMinX(rect) * factor, NSMinY(rect) * factor, units];
         } else {
-            message = [NSString stringWithFormat:@"%ld %C %ld @ (%ld, %ld) 
pt", (long)NSWidth(selRect), MULTIPLICATION_SIGN_CHARACTER, 
(long)NSHeight(selRect), (long)NSMinX(selRect), (long)NSMinY(selRect)];
+            message = [NSString stringWithFormat:@"%ld %C %ld @ (%ld, %ld) 
pt", (long)NSWidth(rect), MULTIPLICATION_SIGN_CHARACTER, (long)NSHeight(rect), 
(long)NSMinX(rect), (long)NSMinY(rect)];
         }
+    } else if (magnification > 0.0001) {
+        message = [NSString stringWithFormat:@"%.2f %C", magnification, 
MULTIPLICATION_SIGN_CHARACTER];
+    } else {
+        message = @"";
     }
     [statusBar setRightStringValue:message];
 }
@@ -2496,6 +2500,10 @@
                 [noteOutlineView reloadData];
             }
             
+            if ([keyPath isEqualToString:SKNPDFAnnotationBoundsKey] && 
[[NSUserDefaults standardUserDefaults] boolForKey:SKDisplayNoteBoundsKey]) {
+                [self updateRightStatus];
+            }
+            
             // update the various panels if necessary
             if ([[self window] isMainWindow] && [note isEqual:[pdfView 
activeAnnotation]]) {
                 if (mwcFlags.updatingColor == 0 && ([keyPath 
isEqualToString:SKNPDFAnnotationColorKey] || [keyPath 
isEqualToString:SKNPDFAnnotationInteriorColorKey])) {

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2009-08-16 12:25:18 UTC (rev 
5565)
+++ trunk/SKMainWindowController_Actions.m      2009-08-17 21:32:25 UTC (rev 
5566)
@@ -818,7 +818,7 @@
         [statusBar setAutoresizingMask:NSViewWidthSizable | NSViewMaxYMargin];
         [self updateLeftStatus];
         [self updateRightStatus];
-        [statusBar setRightAction:[pdfView toolMode] == SKSelectToolMode ? 
@selector(statusBarClicked:) : NULL];
+        [statusBar setRightAction:@selector(statusBarClicked:)];
         [statusBar setRightTarget:self];
     }
     [statusBar toggleBelowView:splitView offset:1.0];

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2009-08-16 12:25:18 UTC (rev 5565)
+++ trunk/SKMainWindowController_UI.m   2009-08-17 21:32:25 UTC (rev 5566)
@@ -1548,7 +1548,6 @@
 
 - (void)handleToolModeChangedNotification:(NSNotification *)notification {
     [toolModeButton selectSegmentWithTag:[pdfView toolMode]];
-    [statusBar setRightAction:[pdfView toolMode] == SKSelectToolMode ? 
@selector(statusBarClicked:) : NULL];
 }
 
 - (void)handleDisplayBoxChangedNotification:(NSNotification *)notification {
@@ -1609,6 +1608,7 @@
         [noteOutlineView deselectAll:self];
     }
     [noteOutlineView reloadData];
+    [self updateRightStatus];
 }
 
 - (void)handleDidAddAnnotationNotification:(NSNotification *)notification {


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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to