change in NSBrowser because oldmatrix was getting released twice

various changes to NSMatrix's mousedown to support double clicks
added field editor instance variable to NSWindow


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2830 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Felipe A. Rodriguez 1998-07-10 18:44:18 +00:00
parent bb62c80de9
commit df43649637
4 changed files with 42 additions and 13 deletions

View file

@ -1477,7 +1477,7 @@
// If we are not reusing matrixes
// then delete the old matrix and create a new one
[oldm release];
// [oldm release];
matrix = [[[_browserMatrixClass alloc]
initWithFrame: matrixRect
mode: NSListModeMatrix
@ -1514,7 +1514,7 @@
// If we are not reusing matrixes
// then delete the old matrix and create a new one
[oldm release];
// [oldm release];
matrix = [[[_browserMatrixClass alloc]
initWithFrame: matrixRect
mode: NSListModeMatrix

View file

@ -374,6 +374,7 @@ static int mouseDownFlags = 0;
cellSize = NSMakeSize(DEFAULT_CELL_WIDTH, DEFAULT_CELL_HEIGHT);
intercell = NSMakeSize(1, 1);
[self setBackgroundColor:[NSColor lightGrayColor]];
[self setDrawsBackground:YES];
[self setCellBackgroundColor:[NSColor lightGrayColor]];
[self setSelectionByRect:YES];
[self setAutosizesCells:YES];
@ -382,7 +383,7 @@ static int mouseDownFlags = 0;
[self selectCellAtRow:0 column:0];
}
else
selectedRow = selectedColumn = -1;
selectedRow = selectedColumn = 0;
return self;
}
@ -1198,8 +1199,10 @@ static int mouseDownFlags = 0;
/* At the first click, deselect the selected cell */
if (!previousCell) {
NSRect f = [self cellFrameAtRow:selectedRow column:selectedColumn];
[selectedCell highlight:NO withFrame:f inView:self]; // FAR
[self deselectSelectedCell];
[self deselectAllCells]; // FAR
[self setNeedsDisplayInRect:f];
}
else {
@ -1211,7 +1214,14 @@ static int mouseDownFlags = 0;
selectedRow = row;
selectedColumn = column;
[selectedCell highlight:YES withFrame:rect inView:self];
[self setNeedsDisplayInRect:rect];
((tMatrix)selectedCells)->matrix[row][column] = YES; // FAR
// [self setNeedsDisplayInRect:rect]; // FAR
[self selectCellAtRow:row column:column];
if ([lastEvent clickCount] > 1) // double click
[target performSelector:doubleAction withObject:self];
break;
case NSListModeMatrix: {
@ -1285,7 +1295,11 @@ static int mouseDownFlags = 0;
break;
case NSLeftMouseUp:
done = YES;
shouldProceedEvent = YES;
// shouldProceedEvent = YES;
ASSIGN(lastEvent, theEvent);
break;
case NSLeftMouseDown:
// shouldProceedEvent = YES;
ASSIGN(lastEvent, theEvent);
break;
default:
@ -1317,16 +1331,25 @@ static int mouseDownFlags = 0;
case NSListModeMatrix:
break;
}
if ([selectedCell target])
[[selectedCell target] performSelector:[selectedCell action] withObject:self];
else if (target)
[target performSelector:action withObject:self];
if ([selectedCell target]) // send single click action
[[selectedCell target] performSelector:[selectedCell action]
withObject:self];
else
{
if (target)
[target performSelector:action withObject:self];
}
if (target && ([lastEvent clickCount] > 1)) // send double click action
[target performSelector:doubleAction withObject:self];
[self unlockFocus];
if (mode != NSTrackModeMatrix)
[NSEvent stopPeriodicEvents];
[lastEvent release];
[self setNeedsDisplayInRect:rect];
}
- (BOOL)performKeyEquivalent:(NSEvent*)theEvent

View file

@ -363,6 +363,8 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
if (post_frame_changes)
[[NSNotificationCenter defaultCenter]
postNotificationName:NSViewFrameDidChangeNotification object:self];
[self setNeedsDisplay:YES]; // FAR
}
- (void)setFrameOrigin:(NSPoint)newOrigin

View file

@ -8,6 +8,8 @@
Author: Scott Christley <scottc@net-community.com>
Venkat Ajjanagadde <venkat@ocbi.com>
Date: 1996
Author: Felipe A. Rodriguez <far@ix.netcom.com>
Date: June 1998
This file is part of the GNUstep GUI Library.
@ -364,10 +366,12 @@ static BOOL _needsFlushWindows = YES;
- (void)endEditingFor:anObject
{}
- (NSText *)fieldEditor:(BOOL)createFlag
forObject:anObject
- (NSText *)fieldEditor:(BOOL)createFlag forObject:anObject
{
return nil;
if(!_fieldEditor && createFlag) // each window has a global
_fieldEditor = [[NSText alloc] init]; // text field editor
return _fieldEditor;
}
//