Revision: 13427
http://sourceforge.net/p/skim-app/code/13427
Author: hofman
Date: 2023-04-28 16:23:51 +0000 (Fri, 28 Apr 2023)
Log Message:
-----------
implement copy: action in overview
Modified Paths:
--------------
trunk/SKOverviewView.m
trunk/SKThumbnailView.m
Modified: trunk/SKOverviewView.m
===================================================================
--- trunk/SKOverviewView.m 2023-04-28 16:03:36 UTC (rev 13426)
+++ trunk/SKOverviewView.m 2023-04-28 16:23:51 UTC (rev 13427)
@@ -64,6 +64,33 @@
}
}
+- (void)copy:(id)sender {
+ NSUInteger i = [[self selectionIndexes] firstIndex];
+ if (i != NSNotFound) {
+ id view = [[self itemAtIndex:i] view];
+ if ([view respondsToSelector:_cmd])
+ [view copy:sender];
+ }
+}
+
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
+ if ([menuItem action] == @selector(copy:)) {
+ NSUInteger i = [[self selectionIndexes] firstIndex];
+ if (i == NSNotFound)
+ return NO;
+ id view = [[self itemAtIndex:i] view];
+ if ([view respondsToSelector:@selector(copy:)] == NO)
+ return NO;
+ if ([view respondsToSelector:_cmd])
+ return [view validateMenuItem:menuItem];
+ return YES;
+ } else if ([[SKOverviewView superclass] instancesRespondToSelector:_cmd]) {
+ return [super validateMenuItem:menuItem];
+ } else {
+ return YES;
+ }
+}
+
- (void)mouseDown:(NSEvent *)theEvent {
SEL action = [theEvent clickCount] == 1 ? [self singleClickAction] :
[theEvent clickCount] == 2 ? [self doubleClickAction] : NULL;
Modified: trunk/SKThumbnailView.m
===================================================================
--- trunk/SKThumbnailView.m 2023-04-28 16:03:36 UTC (rev 13426)
+++ trunk/SKThumbnailView.m 2023-04-28 16:23:51 UTC (rev 13427)
@@ -436,7 +436,7 @@
}
}
-- (void)copyPage:(id)sender {
+- (void)copy:(id)sender {
PDFPage *page = [[self thumbnail] page];
NSIndexSet *selectionIndexes = [[[self controller] collectionView]
selectionIndexes];
if ([selectionIndexes count] < 2 || [selectionIndexes containsIndex:[page
pageIndex]] == NO)
@@ -479,7 +479,7 @@
NSMenu *menu = nil;
if (page && [[page document] isLocked] == NO) {
menu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
- [menu addItemWithTitle:NSLocalizedString(@"Copy", @"Menu item title")
action:@selector(copyPage:) target:self];
+ [menu addItemWithTitle:NSLocalizedString(@"Copy", @"Menu item title")
action:@selector(copy:) target:self];
[menu addItemWithTitle:NSLocalizedString(@"Copy URL", @"Menu item
title") action:@selector(copyPageURL:) target:self];
}
return menu;
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