Revision: 2806
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2806&view=rev
Author:   hofman
Date:     2007-09-01 16:37:36 -0700 (Sat, 01 Sep 2007)

Log Message:
-----------
PerformClick on the imagePopUpButton should send the action when enabled.

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

Modified: trunk/BDSKImagePopUpButtonCell.m
===================================================================
--- trunk/BDSKImagePopUpButtonCell.m    2007-09-01 21:27:50 UTC (rev 2805)
+++ trunk/BDSKImagePopUpButtonCell.m    2007-09-01 23:37:36 UTC (rev 2806)
@@ -250,16 +250,12 @@
 
     if ([event type] == NSKeyDown) {
                // Keyboard event
-               unichar upAndDownArrowCharacters[2];
-               upAndDownArrowCharacters[0] = NSUpArrowFunctionKey;
-               upAndDownArrowCharacters[1] = NSDownArrowFunctionKey;
-               NSString *upAndDownArrowString = [NSString 
stringWithCharacters: upAndDownArrowCharacters  length: 2];
-               NSCharacterSet *upAndDownArrowCharacterSet = [NSCharacterSet 
characterSetWithCharactersInString: upAndDownArrowString];
+        NSString *characters = [event charactersIgnoringModifiers];
+        unichar ch = [characters length] > 0 ? [characters characterAtIndex:0] 
: 0;
                
-               if ([self showsMenuWhenIconClicked] == YES ||
-                       [[event characters] rangeOfCharacterFromSet: 
upAndDownArrowCharacterSet].location != NSNotFound) {
+               if ([self showsMenuWhenIconClicked] == YES || ch == 
NSUpArrowFunctionKey || ch == NSDownArrowFunctionKey) {
                        [self showMenuInView:controlView withEvent:event];
-               } else if ([[event characters] rangeOfString: @" "].location != 
NSNotFound) {
+               } else if (ch == ' ') {
                        [self performClick: controlView];
                }
     } else {
@@ -354,10 +350,7 @@
                if (shouldSendAction) {
                        NSMenuItem *selectedItem = [self selectedItem];
                        [NSEvent stopPeriodicEvents];
-                       [[NSApplication sharedApplication] sendAction: 
[selectedItem action]  
-                                                                               
                           to: [selectedItem target]
-                                                                               
                         from: selectedItem];
-                       
+            [NSApp sendAction: [selectedItem action] to: [selectedItem target] 
from: selectedItem];
                }
     }
     
@@ -369,6 +362,10 @@
 - (void)performClick:(id)sender{
     [buttonCell performClick: sender];
     [super performClick: sender];
+    if ([self iconActionEnabled]) {
+        NSMenuItem *selectedItem = [self selectedItem];
+        [NSApp sendAction: [selectedItem action] to: [selectedItem target] 
from: selectedItem];
+    }
 }
 
 


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to