Revision: 12805
          http://sourceforge.net/p/skim-app/code/12805
Author:   hofman
Date:     2022-03-02 10:08:05 +0000 (Wed, 02 Mar 2022)
Log Message:
-----------
Copy text from active markup note

Modified Paths:
--------------
    trunk/SKPDFView.m

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2022-02-27 15:31:02 UTC (rev 12804)
+++ trunk/SKPDFView.m   2022-03-02 10:08:05 UTC (rev 12805)
@@ -1161,8 +1161,12 @@
     NSPasteboardItem *imageItem = nil;
     PDFAnnotation *note = nil;
     
-    if ([self hideNotes] == NO && [activeAnnotation isSkimNote] && 
[activeAnnotation isMovable])
-        note = activeAnnotation;
+    if ([self hideNotes] == NO && [activeAnnotation isSkimNote]) {
+        if ([activeAnnotation isMovable])
+            note = activeAnnotation;
+        else if (attrString == nil && [activeAnnotation isMarkup])
+            attrString = [[(PDFAnnotationMarkup *)activeAnnotation selection] 
attributedString];
+    }
     
     if (toolMode == SKSelectToolMode && NSIsEmptyRect(selectionRect) == NO && 
selectionPageIndex != NSNotFound) {
         NSRect selRect = NSIntegralRect(selectionRect);
@@ -1187,7 +1191,7 @@
          */
     }
     
-    if ([attrString length] > 0  || imageItem || note) {
+    if ([attrString length] > 0 || imageItem || note) {
     
         NSPasteboard *pboard = [NSPasteboard generalPasteboard];
         
@@ -3198,13 +3202,8 @@
             [menuItem setState:[self annotationMode] == (SKNoteType)[menuItem 
tag] ? NSOnState : NSOffState];
         return YES;
     } else if (action == @selector(copy:)) {
-        if ([[self currentSelection] hasCharacters])
-            return YES;
-        if ([activeAnnotation isSkimNote] && [activeAnnotation isMovable])
-            return YES;
-        if (toolMode == SKSelectToolMode && NSIsEmptyRect(selectionRect) == NO 
&& selectionPageIndex != NSNotFound && [[self document] isLocked] == NO)
-            return YES;
-        return NO;
+        return ([[self currentSelection] hasCharacters] || [activeAnnotation 
isSkimNote] ||
+            (toolMode == SKSelectToolMode && NSIsEmptyRect(selectionRect) == 
NO && selectionPageIndex != NSNotFound && [[self document] isLocked] == NO));
     } else if (action == @selector(cut:)) {
         if ([activeAnnotation isSkimNote] && [activeAnnotation isMovable])
             return YES;

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