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:
Fred Kiefer 2012-12-16 22:51:23 +00:00
parent 3ef13c9a23
commit 0f3af93a92
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>
* Source/NSMenuItemCell.m (titleRectForBounds)

View file

@ -42,11 +42,6 @@
#import "GNUstepGUI/GSCharacterPanel.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)
- (void) orderFrontCharacterPalette: (id)sender
@ -56,7 +51,9 @@
@end
#if defined(HAVE_UNICODE_UCHAR_H) && defined(HAVE_UNICODE_USTRING_H)
#include <unicode/uchar.h>
#include <unicode/ustring.h>
@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
defer: YES
screen: nil];
if (!self)
{
return nil;
}
[self setTitle: _(@"Font Panel")];
[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 = [[NSTextField alloc] initWithFrame: sizeTitleRect];
[label setCell: [GSBrowserTitleCell new]];
[label setCell: AUTORELEASE([GSBrowserTitleCell new])];
[label setFont: [NSFont boldSystemFontOfSize: 0]];
[label setAlignment: NSCenterTextAlignment];
[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 setAllowsEditingTextAttributes: NO];
[sizeField setAlignment: NSCenterTextAlignment];
[sizeField setBackgroundColor: [NSColor windowFrameTextColor]];
[sizeField setAutoresizingMask: NSViewMinXMargin | NSViewMinYMargin];
[sizeField setDelegate: self];
[sizeField setTag: NSFPSizeField];

View file

@ -4111,6 +4111,30 @@ Figure out how the additional layout stuff is supposed to work.
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
{
NSRect new;
@ -4175,7 +4199,6 @@ Figure out how the additional layout stuff is supposed to work.
if (_dragTargetLocation != NSNotFound)
{
_insertionPointRect = new;
_drawInsertionPointNow = YES;
[self setNeedsDisplayInRect: _insertionPointRect
avoidAdditionalLayout: YES];
@ -4192,19 +4215,15 @@ Figure out how the additional layout stuff is supposed to work.
/* Start blinking timer if not yet started */
if (_insertionPointTimer == nil && [self shouldDrawInsertionPoint])
{
// NSLog(@"Start timer");
// Save new insertion point rectangle before starting the insertion timer...
_insertionPointRect = new;
_insertionPointTimer = [NSTimer scheduledTimerWithTimeInterval: 0.5
target: self
selector: @selector(_blink:)
userInfo: nil
repeats: YES];
RETAIN (_insertionPointTimer);
[self _startInsertionTimer];
}
else if (_insertionPointTimer != nil)
{
if (!NSEqualRects(new, _insertionPointRect))
{
// Erase previous insertion point line...
_drawInsertionPointNow = NO;
[self setNeedsDisplayInRect: _insertionPointRect
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
// status or window resings key window status. So we invalidate
// timer to avoid extra method calls
// NSLog(@"Stop timer");
[_insertionPointTimer invalidate];
DESTROY (_insertionPointTimer);
[self _stopInsertionTimer];
_drawInsertionPointNow = NO;
[self setNeedsDisplayInRect: _insertionPointRect
@ -5347,11 +5364,15 @@ other than copy/paste or dragging. */
- (void) concludeDragOperation: (id <NSDraggingInfo>)sender
{
[self 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