Merge changes from Doug Simons to trunk.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29017 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2009-11-15 18:04:17 +00:00
parent bf0766fd29
commit e6b676615b
6 changed files with 78 additions and 41 deletions

View file

@ -1,3 +1,17 @@
2009-11-15 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSButtonCell.m: Change default value for
keyEquivalentModifierMask to 0. Add keyed decoding and encoding of
keyEquivalentModifierMask.
* Source/NSSearchFieldCell.m,
* Source/NSSpellChecker.m: Add explicit keyEquivalentModifierMask setting.
* Source/NSInputManager.m: Add handling of escape character to
call cancelOperation:
* Source/NSTextField.m: Fix textDidEndEditing: to send action
when sendsActionOnEndEditing is set.
Patch by Douglas Simons <doug.simons@testplant.com>.
2009-11-14 Wolfgang Lux <wolfgang.lux@gmail.com> 2009-11-14 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSWindow.m (-sendEvent:): Always shift keyboard focus to * Source/NSWindow.m (-sendEvent:): Always shift keyboard focus to

View file

@ -131,7 +131,7 @@ typedef struct _GSButtonCellFlags
[self setButtonType: NSMomentaryPushInButton]; [self setButtonType: NSMomentaryPushInButton];
_delayInterval = 0.4; _delayInterval = 0.4;
_repeatInterval = 0.075; _repeatInterval = 0.075;
_keyEquivalentModifierMask = NSCommandKeyMask; _keyEquivalentModifierMask = 0;
_keyEquivalent = @""; _keyEquivalent = @"";
_altContents = @""; _altContents = @"";
_gradient_type = NSGradientNone; _gradient_type = NSGradientNone;
@ -537,7 +537,7 @@ typedef struct _GSButtonCellFlags
/** <p>Returns the modifier mask of the NSButtonCell's key equivalent. /** <p>Returns the modifier mask of the NSButtonCell's key equivalent.
The key equivalent and its modifier mask are used to simulate the click The key equivalent and its modifier mask are used to simulate the click
of the button in [NSButton-performKeyEquivalent:]. The default mask is of the button in [NSButton-performKeyEquivalent:]. The default mask is
NSCommandKeyMask.</p><p>See Also: -setKeyEquivalentModifierMask: 0.</p><p>See Also: -setKeyEquivalentModifierMask:
-keyEquivalent [NSButton-performKeyEquivalent:]</p> -keyEquivalent [NSButton-performKeyEquivalent:]</p>
*/ */
- (unsigned int) keyEquivalentModifierMask - (unsigned int) keyEquivalentModifierMask
@ -559,7 +559,7 @@ typedef struct _GSButtonCellFlags
/** <p>Sets the modifier mask of the NSButtonCell's key equivalent to /** <p>Sets the modifier mask of the NSButtonCell's key equivalent to
<var>mask</var>. The key equivalent and its modifier mask are used to <var>mask</var>. The key equivalent and its modifier mask are used to
simulate the click of the button in [NSButton-performKeyEquivalent:]. simulate the click of the button in [NSButton-performKeyEquivalent:].
By default the mask is NSCommandKeyMask.</p> By default the mask is 0.</p>
<p>See Also: -keyEquivalentModifierMask <p>See Also: -keyEquivalentModifierMask
-setKeyEquivalent: [NSButton-performKeyEquivalent:]</p> -setKeyEquivalent: [NSButton-performKeyEquivalent:]</p>
*/ */
@ -1538,6 +1538,7 @@ typedef struct _GSButtonCellFlags
// style and border. // style and border.
bFlags2 != [self showsBorderOnlyWhileMouseInside] ? 0x8 : 0; bFlags2 != [self showsBorderOnlyWhileMouseInside] ? 0x8 : 0;
bFlags2 |= (([self bezelStyle] & 0x7) | (([self bezelStyle] & 0x18) << 2)); bFlags2 |= (([self bezelStyle] & 0x7) | (([self bezelStyle] & 0x18) << 2));
bFlags2 |= [self keyEquivalentModifierMask] << 8;
[aCoder encodeInt: bFlags2 forKey: @"NSButtonFlags2"]; [aCoder encodeInt: bFlags2 forKey: @"NSButtonFlags2"];
// alternate image encoding... // alternate image encoding...
@ -1693,6 +1694,8 @@ typedef struct _GSButtonCellFlags
bFlags2 = [aDecoder decodeIntForKey: @"NSButtonFlags2"]; bFlags2 = [aDecoder decodeIntForKey: @"NSButtonFlags2"];
[self setShowsBorderOnlyWhileMouseInside: (bFlags2 & 0x8)]; [self setShowsBorderOnlyWhileMouseInside: (bFlags2 & 0x8)];
[self setBezelStyle: (bFlags2 & 0x7) | ((bFlags2 & 0x20) >> 2)]; [self setBezelStyle: (bFlags2 & 0x7) | ((bFlags2 & 0x20) >> 2)];
[self setKeyEquivalentModifierMask: ((bFlags2 >> 8) &
NSDeviceIndependentModifierFlagsMask)];
} }
if ([aDecoder containsValueForKey: @"NSAlternateImage"]) if ([aDecoder containsValueForKey: @"NSAlternateImage"])
{ {

View file

@ -650,6 +650,10 @@ static NSInputManager *currentInputManager = nil;
[self doCommandBySelector: @selector (deleteBackward:)]; [self doCommandBySelector: @selector (deleteBackward:)];
break; break;
case '\e': // escape
[self doCommandBySelector: @selector (cancelOperation:)];
break;
case NSTabCharacter: case NSTabCharacter:
if (flags & NSShiftKeyMask) if (flags & NSShiftKeyMask)
{ {

View file

@ -275,6 +275,7 @@
[c setAction: @selector(delete:)]; [c setAction: @selector(delete:)];
[c setTarget: nil]; [c setTarget: nil];
[c setKeyEquivalent: @"\e"]; [c setKeyEquivalent: @"\e"];
[c setKeyEquivalentModifierMask: 0];
} }
- (void) resetSearchButtonCell - (void) resetSearchButtonCell
@ -296,6 +297,7 @@
[c setTarget: self]; [c setTarget: self];
[c sendActionOn:NSLeftMouseUpMask]; [c sendActionOn:NSLeftMouseUpMask];
[c setKeyEquivalent: @"\r"]; [c setKeyEquivalent: @"\r"];
[c setKeyEquivalentModifierMask: 0];
} }
#define ICON_WIDTH 16 #define ICON_WIDTH 16

View file

@ -31,26 +31,27 @@
*/ */
#include "config.h" #include "config.h"
#include <Foundation/NSArray.h> #import <Foundation/NSArray.h>
#include <Foundation/NSSet.h> #import <Foundation/NSSet.h>
#include <Foundation/NSDictionary.h> #import <Foundation/NSDictionary.h>
#include <Foundation/NSEnumerator.h> #import <Foundation/NSEnumerator.h>
#include <Foundation/NSProxy.h> #import <Foundation/NSProxy.h>
#include <Foundation/NSBundle.h> #import <Foundation/NSBundle.h>
#include <Foundation/NSSpellServer.h> #import <Foundation/NSSpellServer.h>
#include <Foundation/NSValue.h> #import <Foundation/NSValue.h>
#include "AppKit/NSNibLoading.h" #import "AppKit/NSNibLoading.h"
#include "AppKit/NSImage.h" #import "AppKit/NSEvent.h"
#include "AppKit/NSSpellChecker.h" #import "AppKit/NSImage.h"
#include "AppKit/NSApplication.h" #import "AppKit/NSSpellChecker.h"
#include "AppKit/NSTextField.h" #import "AppKit/NSApplication.h"
#include "AppKit/NSMatrix.h" #import "AppKit/NSTextField.h"
#include "AppKit/NSBrowser.h" #import "AppKit/NSMatrix.h"
#include "AppKit/NSBrowserCell.h" #import "AppKit/NSBrowser.h"
#include "AppKit/NSPopUpButton.h" #import "AppKit/NSBrowserCell.h"
#include "AppKit/NSGraphics.h" #import "AppKit/NSPopUpButton.h"
#include "AppKit/NSWindow.h" #import "AppKit/NSGraphics.h"
#include "AppKit/NSPanel.h" #import "AppKit/NSWindow.h"
#import "AppKit/NSPanel.h"
#include "GSGuiPrivate.h" #include "GSGuiPrivate.h"
#include "GNUstepGUI/GSServicesManager.h" #include "GNUstepGUI/GSServicesManager.h"
@ -674,11 +675,17 @@ inSpellDocumentWithTag:(int)tag
[_accessoryView setDoubleAction: @selector(_correct:)]; [_accessoryView setDoubleAction: @selector(_correct:)];
[_findNextButton setKeyEquivalent: @"n"]; [_findNextButton setKeyEquivalent: @"n"];
[_findNextButton setKeyEquivalentModifierMask: NSCommandKeyMask];
[_ignoreButton setKeyEquivalent: @"i"]; [_ignoreButton setKeyEquivalent: @"i"];
[_ignoreButton setKeyEquivalentModifierMask: NSCommandKeyMask];
[_learnButton setKeyEquivalent: @"l"]; [_learnButton setKeyEquivalent: @"l"];
[_learnButton setKeyEquivalentModifierMask: NSCommandKeyMask];
[_forgetButton setKeyEquivalent: @"f"]; [_forgetButton setKeyEquivalent: @"f"];
[_forgetButton setKeyEquivalentModifierMask: NSCommandKeyMask];
[_guessButton setKeyEquivalent: @"g"]; [_guessButton setKeyEquivalent: @"g"];
[_guessButton setKeyEquivalentModifierMask: NSCommandKeyMask];
[_correctButton setKeyEquivalent: @"c"]; [_correctButton setKeyEquivalent: @"c"];
[_correctButton setKeyEquivalentModifierMask: NSCommandKeyMask];
[_correctButton setImagePosition: NSImageRight]; [_correctButton setImagePosition: NSImageRight];
[_correctButton setImage: [NSImage imageNamed: @"common_ret"]]; [_correctButton setImage: [NSImage imageNamed: @"common_ret"]];
[_correctButton setAlternateImage: [NSImage imageNamed: @"common_retH"]]; [_correctButton setAlternateImage: [NSImage imageNamed: @"common_retH"]];

View file

@ -571,34 +571,41 @@ static Class textFieldCellClass;
- (void) textDidEndEditing: (NSNotification *)aNotification - (void) textDidEndEditing: (NSNotification *)aNotification
{ {
id textMovement; id textMovement;
int movement;
[super textDidEndEditing: aNotification]; [super textDidEndEditing: aNotification];
textMovement = [[aNotification userInfo] objectForKey: @"NSTextMovement"]; textMovement = [[aNotification userInfo] objectForKey: @"NSTextMovement"];
if (textMovement) if (textMovement)
{ {
switch ([(NSNumber *)textMovement intValue]) movement = [(NSNumber *)textMovement intValue];
{ }
case NSReturnTextMovement: else
if ([self sendAction: [self action] to: [self target]] == NO) {
{ movement = 0;
if ([self performKeyEquivalent: [_window currentEvent]] == NO) }
[self selectText: self];
}
break;
case NSTabTextMovement:
[_window selectKeyViewFollowingView: self];
if ([_window firstResponder] == _window) if (movement == NSReturnTextMovement)
{
if ([self sendAction: [self action] to: [self target]] == NO)
{
if ([self performKeyEquivalent: [_window currentEvent]] == NO)
[self selectText: self]; [self selectText: self];
break; }
case NSBacktabTextMovement: }
else
{
if ([[self cell] sendsActionOnEndEditing])
[self sendAction: [self action] to: [self target]];
if (movement == NSTabTextMovement)
[_window selectKeyViewFollowingView: self];
else if (movement == NSBacktabTextMovement)
[_window selectKeyViewPrecedingView: self]; [_window selectKeyViewPrecedingView: self];
if ([_window firstResponder] == _window) if ([_window firstResponder] == _window)
[self selectText: self]; [self selectText: self];
break;
}
} }
} }