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:
Fred Kiefer 2009-11-15 18:04:17 +00:00
parent 8c9b9aff31
commit 6c1bfef9f3
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>
* Source/NSWindow.m (-sendEvent:): Always shift keyboard focus to

View file

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

View file

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

View file

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

View file

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

View file

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