diff --git a/ChangeLog b/ChangeLog index a2e731a5b..3dd197efb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2012-12-16 Fred Kiefer + + * 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 + 2012-12-10 Riccardo Mottola * Source/NSMenuItemCell.m (titleRectForBounds) diff --git a/Source/GSCharacterPanel.m b/Source/GSCharacterPanel.m index 8b2be2ef8..45d4f4495 100644 --- a/Source/GSCharacterPanel.m +++ b/Source/GSCharacterPanel.m @@ -42,11 +42,6 @@ #import "GNUstepGUI/GSCharacterPanel.h" #import "GSGuiPrivate.h" -#if defined(HAVE_UNICODE_UCHAR_H) && defined(HAVE_UNICODE_USTRING_H) - -#include -#include - @implementation NSApplication (CharacterPanel) - (void) orderFrontCharacterPalette: (id)sender @@ -56,7 +51,9 @@ @end - +#if defined(HAVE_UNICODE_UCHAR_H) && defined(HAVE_UNICODE_USTRING_H) +#include +#include @interface GSVerticallyCenteredTextFieldCell : NSTextFieldCell { diff --git a/Source/NSFontPanel.m b/Source/NSFontPanel.m index a5c057994..036c7206d 100644 --- a/Source/NSFontPanel.m +++ b/Source/NSFontPanel.m @@ -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]; diff --git a/Source/NSTextView.m b/Source/NSTextView.m index 8fa3f7162..7f2a43227 100644 --- a/Source/NSTextView.m +++ b/Source/NSTextView.m @@ -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 )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 )dragInfo