Revision: 13151
          http://sourceforge.net/p/skim-app/code/13151
Author:   hofman
Date:     2022-11-03 15:16:36 +0000 (Thu, 03 Nov 2022)
Log Message:
-----------
Add an option to the go command and displayline tool for sync without selecting 
the line

Modified Paths:
--------------
    trunk/SKMainDocument.m
    trunk/SKPDFSynchronizer.h
    trunk/SKPDFView.h
    trunk/SKPDFView.m
    trunk/Skim.sdef
    trunk/displayline

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2022-11-03 10:33:05 UTC (rev 13150)
+++ trunk/SKMainDocument.m      2022-11-03 15:16:36 UTC (rev 13151)
@@ -1557,7 +1557,7 @@
         PDFPage *page = [pdfDoc pageAtIndex:pageIndex];
         if ((options & SKPDFSynchronizerFlippedMask))
             point.y = NSMaxY([page boundsForBox:kPDFDisplayBoxMediaBox]) - 
point.y;
-        [[self pdfView] displayLineAtPoint:point inPageAtIndex:pageIndex 
showReadingBar:(options & SKPDFSynchronizerShowReadingBarMask) != 0];
+        [[self pdfView] displayLineAtPoint:point inPageAtIndex:pageIndex 
showReadingBar:(options & SKPDFSynchronizerShowReadingBarMask) != 0 
noSelect:(options & SKPDFSynchronizerNoSelectMask) != 0];
     }
 }
 
@@ -2038,8 +2038,11 @@
         [[self pdfView] goToRect:bounds onPage:page];
     } else if ([location isKindOfClass:[NSNumber class]]) {
         id source = [args objectForKey:@"Source"];
-        BOOL showBar = [[args objectForKey:@"ShowReadingBar"] boolValue];
-        NSInteger options = showBar ? SKPDFSynchronizerShowReadingBarMask : 0;
+        NSInteger options = SKPDFSynchronizerDefaultOptions;
+        if ([[args objectForKey:@"ShowReadingBar"] boolValue])
+            options |= SKPDFSynchronizerShowReadingBarMask;
+        if ([args objectForKey:@"Selecting"] && [[args 
objectForKey:@"Selecting"] boolValue] == NO)
+            options |= SKPDFSynchronizerNoSelectMask;
         if ([source isKindOfClass:[NSString class]])
             source = [NSURL fileURLWithPath:source isDirectory:NO];
         else if ([source isKindOfClass:[NSURL class]] == NO)

Modified: trunk/SKPDFSynchronizer.h
===================================================================
--- trunk/SKPDFSynchronizer.h   2022-11-03 10:33:05 UTC (rev 13150)
+++ trunk/SKPDFSynchronizer.h   2022-11-03 15:16:36 UTC (rev 13151)
@@ -43,7 +43,8 @@
 typedef NS_OPTIONS(NSUInteger, SKPDFSynchronizerOption) {
     SKPDFSynchronizerDefaultOptions = 0,
     SKPDFSynchronizerShowReadingBarMask = 1 << 0,
-    SKPDFSynchronizerFlippedMask = 1 << 1,
+    SKPDFSynchronizerNoSelectMask = 1 << 1,
+    SKPDFSynchronizerFlippedMask = 1 << 2,
 };
 
 @protocol SKPDFSynchronizerDelegate;

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2022-11-03 10:33:05 UTC (rev 13150)
+++ trunk/SKPDFView.h   2022-11-03 15:16:36 UTC (rev 13151)
@@ -238,7 +238,7 @@
 - (void)selectPreviousActiveAnnotation:(id)sender;
 
 - (void)scrollAnnotationToVisible:(PDFAnnotation *)annotation;
-- (void)displayLineAtPoint:(NSPoint)point inPageAtIndex:(NSUInteger)pageIndex 
showReadingBar:(BOOL)showBar;
+- (void)displayLineAtPoint:(NSPoint)point inPageAtIndex:(NSUInteger)pageIndex 
showReadingBar:(BOOL)showBar noSelect:(BOOL)noSelect;
 - (void)zoomToRect:(NSRect)rect onPage:(PDFPage *)page;
 
 - (void)takeSnapshot:(id)sender;

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2022-11-03 10:33:05 UTC (rev 13150)
+++ trunk/SKPDFView.m   2022-11-03 15:16:36 UTC (rev 13151)
@@ -3030,7 +3030,7 @@
 #pragma mark Sync
 
 // @@ Horizontal layout
-- (void)displayLineAtPoint:(NSPoint)point inPageAtIndex:(NSUInteger)pageIndex 
showReadingBar:(BOOL)showBar {
+- (void)displayLineAtPoint:(NSPoint)point inPageAtIndex:(NSUInteger)pageIndex 
showReadingBar:(BOOL)showBar noSelect:(BOOL)noSelect {
     if (pageIndex < [[self document] pageCount]) {
         PDFPage *page = [[self document] pageAtIndex:pageIndex];
         PDFSelection *sel = [page selectionForLineAtPoint:point];
@@ -3064,7 +3064,7 @@
                 } else {
                     [readingBar goToLine:line onPage:page];
                 }
-            } else if ([sel hasCharacters] && [self toolMode] == 
SKTextToolMode) {
+            } else if (noSelect == NO && [sel hasCharacters] && [self 
toolMode] == SKTextToolMode) {
                 [self setCurrentSelection:sel];
             }
         }

Modified: trunk/Skim.sdef
===================================================================
--- trunk/Skim.sdef     2022-11-03 10:33:05 UTC (rev 13150)
+++ trunk/Skim.sdef     2022-11-03 15:16:36 UTC (rev 13151)
@@ -399,10 +399,14 @@
                                description="The TeX source file. By default 
this is derived from the file. Only applies for a TeX line."> 
                                <cocoa key="Source"/> 
                        </parameter>
-                       <parameter name="showing reading bar" code="RBar" 
type="boolean" optional="yes"
-                               description="Whether to move the reading bar 
instead of selecting. Only applies for a TeX line."> 
-                               <cocoa key="ShowReadingBar"/> 
-                       </parameter>
+            <parameter name="showing reading bar" code="RBar" type="boolean" 
optional="yes"
+                description="Whether to move the reading bar instead of 
selecting. Only applies for a TeX line.">
+                <cocoa key="ShowReadingBar"/>
+            </parameter>
+            <parameter name="selecting" code="Sele" type="boolean" 
optional="yes"
+                description="Whether to select the text. True by default if 
no=t showing reading bar. Only applies for a TeX line.">
+                <cocoa key="Selecting"/>
+            </parameter>
         </command>
 
         <command name="convert notes" code="SKIMConv"

Modified: trunk/displayline
===================================================================
--- trunk/displayline   2022-11-03 10:33:05 UTC (rev 13150)
+++ trunk/displayline   2022-11-03 15:16:36 UTC (rev 13151)
@@ -5,10 +5,11 @@
 # Usage: displayline [-r] [-b] [-g] [-z] LINE PDFFILE [TEXSOURCEFILE]
 
 if [[ $# -eq 0 || "$1" == "-h" || "$1" == "-help" ]]; then
-  echo "Usage: displayline [-r] [-b] [-g] [-z] LINE PDFFILE [TEXSOURCEFILE]
+  echo "Usage: displayline [-r] [-b] [-n] [-g] [-z] LINE PDFFILE 
[TEXSOURCEFILE]
 Options:
 -r, -revert      Revert the file from disk if it was open
 -b, -readingbar  Indicate the line using the reading bar
+-n, -noselect    Do not select the line
 -g, -background  Do not bring Skim to the foreground
 -z, -zerobased   LINE is zero-based rather than one-based"
   exit 0
@@ -17,6 +18,7 @@
 # get arguments
 revert=
 reading_bar=
+no_select=
 activate="activate"
 zerobased=
 from_source=
@@ -29,6 +31,8 @@
     end try"
   elif [[ "$1" == "-b" || "$1" == "-readingbar" ]]; then
     reading_bar="with showing reading bar"
+  elif [[ "$1" == "-n" || "$1" == "-noselect" ]]; then
+    no_select="without selecting"
   elif [[ "$1" == "-g" || "$1" == "-background" ]]; then
     activate=
   elif [[ "$1" == "-z" || "$1" == "-zerobased" ]]; then
@@ -55,7 +59,7 @@
   tell application "Skim"
     ${revert}
     open theFile
-    go document 1 to TeX line ${line} ${from_source} ${reading_bar}
+    go document 1 to TeX line ${line} ${from_source} ${reading_bar} 
${no_select}
     $activate
   end tell
 EOF

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



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to