Usability improvement: Make color and font panels key only when

necessary. Avoids annoying and unnecessary focus shifts when changing
colors or fonts.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29681 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2010-02-20 00:20:30 +00:00
parent 9d425f4eea
commit 61187ead14
6 changed files with 33 additions and 2 deletions

View file

@ -1,3 +1,22 @@
2010-02-20 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSColorPanel.m (-_initWithoutGModel):
* Source/NSFontPanel.m (-_initWithoutGModel): Set
becomesKeyOnlyIfNeeded panel attribute to YES.
* ColorPickers/GSWheelColorPicker.m (-acceptsFirstMouse:,
acceptsFirstResponder): Accept first mouse, so that the color
wheel can be used when the Color panel is not key window.
* Source/NSTextField.m (-needsPanelToBecomeKey):
* Source/NSTextView.m (-needsPanelToBecomeKey): Return YES also if
a text field or view is selectable but not editable. Primarily
makes the combo box in the color list picker usable if the Color
panel is not first responder. In addition, this change ensures
that the standard key equivalents Cmd-C and Cmd-A (Copy and Select
All) will work as expected after clicking selectable text in a
window that is not key.
2010-02-20 Wolfgang Lux <wolfgang.lux@gmail.com>
* TextConverters/RTF/RTFConsumer.h: Add encoding attribute to

View file

@ -151,6 +151,16 @@
PSrectfill(x - 1, y - 1, 2, 2);
}
- (BOOL) acceptsFirstMouse: (NSEvent *)theEvent
{
return YES;
}
- (BOOL) acceptsFirstResponder
{
return NO;
}
- (void) mouseDown: (NSEvent *)theEvent
{
unsigned int eventMask = NSLeftMouseDownMask | NSLeftMouseUpMask

View file

@ -225,6 +225,7 @@ static int _gs_gui_color_picker_mode = NSRGBModeColorPanel;
defer: NO
screen: nil];
[self setTitle: _(@"Colors")];
[self setBecomesKeyOnlyIfNeeded: YES];
v = [self contentView];

View file

@ -542,6 +542,7 @@ static float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
defer: YES
screen: nil];
[self setTitle: _(@"Font Panel")];
[self setBecomesKeyOnlyIfNeeded: YES];
v = [self contentView];

View file

@ -439,7 +439,7 @@ static Class textFieldCellClass;
-(BOOL) needsPanelToBecomeKey
{
return [self isEditable];
return [self isEditable] || [self isSelectable];
}
- (BOOL) abortEditing

View file

@ -1494,7 +1494,7 @@ to make sure syncing is handled properly in all cases.
- (BOOL) needsPanelToBecomeKey
{
return _tf.is_editable;
return _tf.is_editable || _tf.is_selectable;
}
- (BOOL) acceptsFirstResponder