Revision: 14475
          http://sourceforge.net/p/skim-app/code/14475
Author:   hofman
Date:     2024-09-24 14:11:10 +0000 (Tue, 24 Sep 2024)
Log Message:
-----------
Enable Preview button using bindings

Modified Paths:
--------------
    trunk/Base.lproj/TransitionSheet.xib
    trunk/SKPresentationOptionsSheetController.m

Modified: trunk/Base.lproj/TransitionSheet.xib
===================================================================
--- trunk/Base.lproj/TransitionSheet.xib        2024-09-23 20:53:42 UTC (rev 
14474)
+++ trunk/Base.lproj/TransitionSheet.xib        2024-09-24 14:11:10 UTC (rev 
14475)
@@ -405,6 +405,12 @@
                         </buttonCell>
                         <connections>
                             <action selector="preview:" target="-2" 
id="On3-iX-X3z"/>
+                            <binding destination="127" name="enabled" 
keyPath="selection.transitionStyle" id="4tH-Zh-Jx4">
+                                <dictionary key="options">
+                                    <integer key="NSMultipleValuesPlaceholder" 
value="0"/>
+                                    <integer key="NSNoSelectionPlaceholder" 
value="0"/>
+                                </dictionary>
+                            </binding>
                         </connections>
                     </button>
                 </subviews>

Modified: trunk/SKPresentationOptionsSheetController.m
===================================================================
--- trunk/SKPresentationOptionsSheetController.m        2024-09-23 20:53:42 UTC 
(rev 14474)
+++ trunk/SKPresentationOptionsSheetController.m        2024-09-24 14:11:10 UTC 
(rev 14475)
@@ -140,15 +140,6 @@
     [notesDocumentPopUpButton selectItemAtIndex:docIndex == -1 ? 0 : docIndex];
 }
 
-- (void)validatePreviewButton {
-    if (separate) {
-        NSInteger idx = [tableView selectedRow];
-        [previewButton setEnabled:idx != -1 && [[transitions 
objectAtIndex:idx] transitionStyle] != SKNoTransition];
-    } else {
-        [previewButton setEnabled:[transition transitionStyle] != 
SKNoTransition];
-    }
-}
-
 - (void)windowDidLoad {
     // add the filter names to the popup
     NSUInteger i, count = [[SKTransitionController transitionNames] count];
@@ -194,8 +185,6 @@
         [[self undoManager] enableUndoRegistration];
     }
     
-    [self validatePreviewButton];
-    
     // set the current notes document and observe changes for the popup
     [self handleDocumentsDidChangeNotification:nil];
     NSDocument *currentDoc = [controller presentationNotesDocument];
@@ -385,8 +374,6 @@
             }
         }
         [[[self undoManager] prepareWithInvocationTarget:self] 
setSeparate:separate == NO];
-        
-        [self validatePreviewButton];
     }
 }
 
@@ -477,9 +464,6 @@
             [changedTransitions addObject:object];
         }
         
-        if ([keyPath isEqualToString:TRANSITIONSTYLE_KEY])
-            [self validatePreviewButton];
-        
         [[[self undoManager] prepareWithInvocationTarget:self] 
setValue:oldValue forKey:keyPath ofTransition:object];
     } else {
         [super observeValueForKeyPath:keyPath ofObject:object change:change 
context:context];
@@ -559,10 +543,6 @@
     return [tv makeViewWithIdentifier:[tableColumn identifier] owner:self];
 }
 
-- (void)tableViewSelectionDidChange:(NSNotification *)notification {
-    [self validatePreviewButton];
-}
-
 - (id <SKImageToolTipContext>)tableView:(NSTableView *)tv 
imageContextForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row  
scale:(CGFloat *)scale {
     if ([[tableColumn identifier] isEqualToString:IMAGE_COLUMNID])
         return [[controller pdfDocument] pageAtIndex:row];

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