Reworked version of patches by Marcian Lytwyn

<marcian.lytwyn@advcsi.com>


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35899 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2012-12-16 22:51:23 +00:00
parent 02259cada8
commit ec3e830817
4 changed files with 56 additions and 20 deletions

View file

@ -1,3 +1,17 @@
2012-12-16 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSFontPanel.m (-_initWithoutGModel): Fix font panel size
background color - this broke when theme colors were added.
* Source/GSCharacterPanel.m: Compile in -[NSApplication
orderFrontCharacterPalette:] and do nothing instead of throwing a
run-time exception.
* Source/NSTextView.m (-_stopInsertionTimer, -_startInsertionTimer):
Extract this helper methods from -updateInsertionPointStateAndRestartTimer:.
* Source/NSTextView.m (-cleanUpAfterDragOperation): Add cleanup code to
cleanUpAfterDragOperation. Gets invoked from concludeDragOperation:.
Fix drag and drop of file objects.
Based on patches by Marcian Lytwyn <marcian.lytwyn@advcsi.com>
2012-12-10 Riccardo Mottola <rm@gnu.org> 2012-12-10 Riccardo Mottola <rm@gnu.org>
* Source/NSMenuItemCell.m (titleRectForBounds) * Source/NSMenuItemCell.m (titleRectForBounds)

View file

@ -42,11 +42,6 @@
#import "GNUstepGUI/GSCharacterPanel.h" #import "GNUstepGUI/GSCharacterPanel.h"
#import "GSGuiPrivate.h" #import "GSGuiPrivate.h"
#if defined(HAVE_UNICODE_UCHAR_H) && defined(HAVE_UNICODE_USTRING_H)
#include <unicode/uchar.h>
#include <unicode/ustring.h>
@implementation NSApplication (CharacterPanel) @implementation NSApplication (CharacterPanel)
- (void) orderFrontCharacterPalette: (id)sender - (void) orderFrontCharacterPalette: (id)sender
@ -56,7 +51,9 @@
@end @end
#if defined(HAVE_UNICODE_UCHAR_H) && defined(HAVE_UNICODE_USTRING_H)
#include <unicode/uchar.h>
#include <unicode/ustring.h>
@interface GSVerticallyCenteredTextFieldCell : NSTextFieldCell @interface GSVerticallyCenteredTextFieldCell : NSTextFieldCell
{ {

View file

@ -544,6 +544,11 @@ static float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
backing: NSBackingStoreRetained backing: NSBackingStoreRetained
defer: YES defer: YES
screen: nil]; screen: nil];
if (!self)
{
return nil;
}
[self setTitle: _(@"Font Panel")]; [self setTitle: _(@"Font Panel")];
[self setBecomesKeyOnlyIfNeeded: YES]; [self setBecomesKeyOnlyIfNeeded: YES];
@ -623,7 +628,7 @@ static float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
// label for selection of size // label for selection of size
label = [[NSTextField alloc] initWithFrame: sizeTitleRect]; label = [[NSTextField alloc] initWithFrame: sizeTitleRect];
[label setCell: [GSBrowserTitleCell new]]; [label setCell: AUTORELEASE([GSBrowserTitleCell new])];
[label setFont: [NSFont boldSystemFontOfSize: 0]]; [label setFont: [NSFont boldSystemFontOfSize: 0]];
[label setAlignment: NSCenterTextAlignment]; [label setAlignment: NSCenterTextAlignment];
[label setDrawsBackground: YES]; [label setDrawsBackground: YES];
@ -642,7 +647,6 @@ static float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
[sizeField setEditable: YES]; [sizeField setEditable: YES];
[sizeField setAllowsEditingTextAttributes: NO]; [sizeField setAllowsEditingTextAttributes: NO];
[sizeField setAlignment: NSCenterTextAlignment]; [sizeField setAlignment: NSCenterTextAlignment];
[sizeField setBackgroundColor: [NSColor windowFrameTextColor]];
[sizeField setAutoresizingMask: NSViewMinXMargin | NSViewMinYMargin]; [sizeField setAutoresizingMask: NSViewMinXMargin | NSViewMinYMargin];
[sizeField setDelegate: self]; [sizeField setDelegate: self];
[sizeField setTag: NSFPSizeField]; [sizeField setTag: NSFPSizeField];

View file

@ -4111,6 +4111,30 @@ Figure out how the additional layout stuff is supposed to work.
return nil; return nil;
} }
- (void) _stopInsertionTimer
{
if (_insertionPointTimer != nil)
{
[_insertionPointTimer invalidate];
DESTROY(_insertionPointTimer);
}
}
- (void) _startInsertionTimer
{
if (_insertionPointTimer != nil)
{
NSWarnMLog(@"Starting insertion timer with existing one running");
[self _stopInsertionTimer];
}
_insertionPointTimer = [NSTimer scheduledTimerWithTimeInterval: 0.5
target: self
selector: @selector(_blink:)
userInfo: nil
repeats: YES];
RETAIN(_insertionPointTimer);
}
- (void) updateInsertionPointStateAndRestartTimer: (BOOL)restartFlag - (void) updateInsertionPointStateAndRestartTimer: (BOOL)restartFlag
{ {
NSRect new; NSRect new;
@ -4175,7 +4199,6 @@ Figure out how the additional layout stuff is supposed to work.
if (_dragTargetLocation != NSNotFound) if (_dragTargetLocation != NSNotFound)
{ {
_insertionPointRect = new;
_drawInsertionPointNow = YES; _drawInsertionPointNow = YES;
[self setNeedsDisplayInRect: _insertionPointRect [self setNeedsDisplayInRect: _insertionPointRect
avoidAdditionalLayout: YES]; avoidAdditionalLayout: YES];
@ -4192,19 +4215,15 @@ Figure out how the additional layout stuff is supposed to work.
/* Start blinking timer if not yet started */ /* Start blinking timer if not yet started */
if (_insertionPointTimer == nil && [self shouldDrawInsertionPoint]) if (_insertionPointTimer == nil && [self shouldDrawInsertionPoint])
{ {
// NSLog(@"Start timer"); // Save new insertion point rectangle before starting the insertion timer...
_insertionPointRect = new; _insertionPointRect = new;
_insertionPointTimer = [NSTimer scheduledTimerWithTimeInterval: 0.5 [self _startInsertionTimer];
target: self
selector: @selector(_blink:)
userInfo: nil
repeats: YES];
RETAIN (_insertionPointTimer);
} }
else if (_insertionPointTimer != nil) else if (_insertionPointTimer != nil)
{ {
if (!NSEqualRects(new, _insertionPointRect)) if (!NSEqualRects(new, _insertionPointRect))
{ {
// Erase previous insertion point line...
_drawInsertionPointNow = NO; _drawInsertionPointNow = NO;
[self setNeedsDisplayInRect: _insertionPointRect [self setNeedsDisplayInRect: _insertionPointRect
avoidAdditionalLayout: YES]; avoidAdditionalLayout: YES];
@ -4226,9 +4245,7 @@ Figure out how the additional layout stuff is supposed to work.
// restartFlag is set to NO when control resigns first responder // restartFlag is set to NO when control resigns first responder
// status or window resings key window status. So we invalidate // status or window resings key window status. So we invalidate
// timer to avoid extra method calls // timer to avoid extra method calls
// NSLog(@"Stop timer"); [self _stopInsertionTimer];
[_insertionPointTimer invalidate];
DESTROY (_insertionPointTimer);
_drawInsertionPointNow = NO; _drawInsertionPointNow = NO;
[self setNeedsDisplayInRect: _insertionPointRect [self setNeedsDisplayInRect: _insertionPointRect
@ -5347,11 +5364,15 @@ other than copy/paste or dragging. */
- (void) concludeDragOperation: (id <NSDraggingInfo>)sender - (void) concludeDragOperation: (id <NSDraggingInfo>)sender
{ {
[self cleanUpAfterDragOperation];
} }
- (void) cleanUpAfterDragOperation - (void) cleanUpAfterDragOperation
{ {
// release drag information // Cleanup information after dragging operation completes...
_dragTargetLocation = NSNotFound;
[self updateInsertionPointStateAndRestartTimer: NO];
[self displayIfNeeded];
} }
- (unsigned int) dragOperationForDraggingInfo: (id <NSDraggingInfo>)dragInfo - (unsigned int) dragOperationForDraggingInfo: (id <NSDraggingInfo>)dragInfo