Revision: 14115
          http://sourceforge.net/p/skim-app/code/14115
Author:   hofman
Date:     2024-03-17 09:46:33 +0000 (Sun, 17 Mar 2024)
Log Message:
-----------
Add row actions for snapshot table to delete, show, or hide

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

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2024-03-16 17:52:45 UTC (rev 14114)
+++ trunk/SKMainWindowController_UI.m   2024-03-17 09:46:33 UTC (rev 14115)
@@ -531,6 +531,31 @@
     return fmax(rowHeight, fmin(thumbHeight, fmin(thumbSize.height, [[tv 
tableColumnWithIdentifier:IMAGE_COLUMNID] width] * thumbSize.height / 
thumbSize.width)));
 }
 
+- (NSArray *)tableView:(NSTableView *)tv rowActionsForRow:(NSInteger)row 
edge:(NSTableRowActionEdge)edge {
+    if ([tv isEqual:rightSideController.snapshotTableView]) {
+        SKSnapshotWindowController *controller = 
[[rightSideController.snapshotArrayController arrangedObjects] 
objectAtIndex:row];
+        NSTableViewRowAction *action = nil;
+        if (edge == NSTableRowActionEdgeTrailing) {
+            action = [NSTableViewRowAction 
rowActionWithStyle:NSTableViewRowActionStyleDestructive 
title:NSLocalizedString(@"Delete", @"") handler:^(NSTableViewRowAction 
*anAction, NSInteger aRow){
+                [[controller window] close];
+            }];
+        } else if ([[controller window] isVisible]) {
+            action = [NSTableViewRowAction 
rowActionWithStyle:NSTableViewRowActionStyleRegular 
title:NSLocalizedString(@"Hide", @"") handler:^(NSTableViewRowAction *anAction, 
NSInteger aRow){
+                [controller miniaturize];
+                [tv setRowActionsVisible:NO];
+            }];
+        } else {
+            action = [NSTableViewRowAction 
rowActionWithStyle:NSTableViewRowActionStyleRegular 
title:NSLocalizedString(@"Show", @"") handler:^(NSTableViewRowAction *anAction, 
NSInteger aRow){
+                [controller deminiaturize];
+                [tv setRowActionsVisible:NO];
+            }];
+        }
+        if (action)
+            return @[action];
+    }
+    return @[];
+}
+
 - (void)tableView:(NSTableView *)tv copyRowsWithIndexes:(NSIndexSet 
*)rowIndexes {
     if ([tv isEqual:leftSideController.thumbnailTableView]) {
         NSUInteger idx = [rowIndexes firstIndex];

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