mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
Tidy up
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5534 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
86f6a1c1f9
commit
ac6f996208
3 changed files with 183 additions and 177 deletions
|
@ -190,11 +190,11 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
[self setFrame: frameRect];
|
||||
|
||||
if ((numCols > 0) && (numRows > 0))
|
||||
cellSize = NSMakeSize (frameRect.size.width/numCols,
|
||||
cellSize = NSMakeSize (frameRect.size.width/numCols,
|
||||
frameRect.size.height/numRows);
|
||||
else
|
||||
cellSize = NSMakeSize (DEFAULT_CELL_WIDTH, DEFAULT_CELL_HEIGHT);
|
||||
|
||||
cellSize = NSMakeSize (DEFAULT_CELL_WIDTH, DEFAULT_CELL_HEIGHT);
|
||||
|
||||
intercell = NSMakeSize(1, 1);
|
||||
_tabKeyTraversesCells = YES;
|
||||
[self setBackgroundColor: [NSColor controlBackgroundColor]];
|
||||
|
@ -800,7 +800,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
{
|
||||
if (!_selectedCell || (!allowsEmptySelection && (mode == NSRadioModeMatrix)))
|
||||
return;
|
||||
|
||||
|
||||
selectedCells[_selectedRow][_selectedColumn] = NO;
|
||||
[_selectedCell setState: 0];
|
||||
_selectedCell = nil;
|
||||
|
@ -828,7 +828,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
}
|
||||
}
|
||||
|
||||
[self display];
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
- (void) selectCellAtRow: (int)row column: (int)column
|
||||
|
@ -843,7 +843,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
{
|
||||
selectedCells[_selectedRow][_selectedColumn] = NO;
|
||||
[_selectedCell setState: 0];
|
||||
[self setNeedsDisplayInRect: [self cellFrameAtRow: _selectedRow
|
||||
[self setNeedsDisplayInRect: [self cellFrameAtRow: _selectedRow
|
||||
column: _selectedColumn]];
|
||||
}
|
||||
|
||||
|
@ -854,7 +854,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
_selectedColumn = column;
|
||||
selectedCells[row][column] = YES;
|
||||
[_selectedCell setState: 1];
|
||||
|
||||
|
||||
[self setNeedsDisplayInRect: [self cellFrameAtRow: row column: column]];
|
||||
}
|
||||
}
|
||||
|
@ -1061,7 +1061,6 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
startIndex: selectx
|
||||
endIndex: selecty];
|
||||
}
|
||||
[self display];
|
||||
}
|
||||
|
||||
- (id) cellAtRow: (int)row
|
||||
|
@ -1122,12 +1121,12 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
|
||||
if (window)
|
||||
s = [window keyViewSelectionDirection];
|
||||
|
||||
|
||||
switch (s)
|
||||
{
|
||||
// window selecting backwards
|
||||
case NSSelectingPrevious:
|
||||
[self _selectPreviousSelectableCellBeforeRow: numRows
|
||||
[self _selectPreviousSelectableCellBeforeRow: numRows
|
||||
column: numCols];
|
||||
break;
|
||||
// Window selecting forward
|
||||
|
@ -1149,7 +1148,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (id) selectTextAtRow: (int)row column: (int)column
|
||||
{
|
||||
if (row < 0 || row >= numRows || column < 0 || column >= numCols)
|
||||
|
@ -1157,7 +1156,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
|
||||
if ([cells[row][column] isSelectable] == NO)
|
||||
return nil;
|
||||
|
||||
|
||||
if (_textObject)
|
||||
{
|
||||
if (_selectedCell == cells[row][column])
|
||||
|
@ -1171,16 +1170,16 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
[self abortEditing];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now _textObject == nil
|
||||
{
|
||||
NSText *t = [window fieldEditor: YES
|
||||
NSText *t = [window fieldEditor: YES
|
||||
forObject: self];
|
||||
|
||||
|
||||
if ([t superview] != nil)
|
||||
if ([t resignFirstResponder] == NO)
|
||||
return nil;
|
||||
|
||||
|
||||
_selectedCell = cells[row][column];
|
||||
_selectedRow = row;
|
||||
_selectedColumn = column;
|
||||
|
@ -1203,7 +1202,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
}
|
||||
|
||||
- (id) nextText
|
||||
{
|
||||
{
|
||||
return _nextKeyView;
|
||||
}
|
||||
|
||||
|
@ -1216,8 +1215,8 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSDictionary *d;
|
||||
|
||||
d = [NSDictionary dictionaryWithObject:[aNotification object]
|
||||
|
||||
d = [NSDictionary dictionaryWithObject:[aNotification object]
|
||||
forKey: @"NSFieldEditor"];
|
||||
[nc postNotificationName: NSControlTextDidBeginEditingNotification
|
||||
object: self
|
||||
|
@ -1228,8 +1227,8 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSDictionary *d;
|
||||
|
||||
d = [NSDictionary dictionaryWithObject: [aNotification object]
|
||||
|
||||
d = [NSDictionary dictionaryWithObject: [aNotification object]
|
||||
forKey: @"NSFieldEditor"];
|
||||
[nc postNotificationName: NSControlTextDidChangeNotification
|
||||
object: self
|
||||
|
@ -1244,7 +1243,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
|
||||
[self validateEditing];
|
||||
|
||||
d = [NSDictionary dictionaryWithObject: [aNotification object]
|
||||
d = [NSDictionary dictionaryWithObject: [aNotification object]
|
||||
forKey: @"NSFieldEditor"];
|
||||
[nc postNotificationName: NSControlTextDidEndEditingNotification
|
||||
object: self
|
||||
|
@ -1285,11 +1284,11 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
|
||||
- (BOOL) textShouldBeginEditing: (NSText *)textObject
|
||||
{
|
||||
if (_delegate && [_delegate respondsToSelector:
|
||||
if (_delegate && [_delegate respondsToSelector:
|
||||
@selector(control:textShouldBeginEditing:)])
|
||||
return [_delegate control: self
|
||||
return [_delegate control: self
|
||||
textShouldBeginEditing: textObject];
|
||||
else
|
||||
else
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -1300,11 +1299,11 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
[self sendAction: _errorAction to: [self target]];
|
||||
return NO;
|
||||
}
|
||||
|
||||
if ([_delegate respondsToSelector:
|
||||
|
||||
if ([_delegate respondsToSelector:
|
||||
@selector(control:textShouldEndEditing:)])
|
||||
{
|
||||
if ([_delegate control: self
|
||||
if ([_delegate control: self
|
||||
textShouldEndEditing: aTextObject] == NO)
|
||||
{
|
||||
NSBeep ();
|
||||
|
@ -1366,7 +1365,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
{
|
||||
for (j = 0; j < numCols; j++)
|
||||
{
|
||||
tmpSize = [cells[i][j] cellSize];
|
||||
tmpSize = [cells[i][j] cellSize];
|
||||
if (tmpSize.width > newSize.width)
|
||||
newSize.width = tmpSize.width;
|
||||
if (tmpSize.height > newSize.height)
|
||||
|
@ -1569,7 +1568,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
{
|
||||
if (mode == NSListModeMatrix)
|
||||
return NO;
|
||||
else
|
||||
else
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -1719,12 +1718,12 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
NSApplication *app = [NSApplication sharedApplication];
|
||||
static MPoint anchor = {0, 0};
|
||||
|
||||
lastLocation = [self convertPoint: lastLocation
|
||||
lastLocation = [self convertPoint: lastLocation
|
||||
fromView: nil];
|
||||
|
||||
|
||||
// If mouse down was on a selectable cell, start editing/selecting.
|
||||
if([self getRow: &row
|
||||
column: &column
|
||||
if([self getRow: &row
|
||||
column: &column
|
||||
forPoint: lastLocation])
|
||||
{
|
||||
if ([cells[row][column] isSelectable])
|
||||
|
@ -1744,7 +1743,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
_selectedRow = row;
|
||||
_selectedColumn = column;
|
||||
_textObject = [_selectedCell setUpFieldEditorAttributes: t];
|
||||
[_selectedCell editWithFrame: [self cellFrameAtRow: row
|
||||
[_selectedCell editWithFrame: [self cellFrameAtRow: row
|
||||
column: column]
|
||||
inView: self
|
||||
editor: _textObject
|
||||
|
@ -1753,7 +1752,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Paranoia check -- _textObject should already be nil, since we
|
||||
// accept first responder, so NSWindow should have already given
|
||||
// us first responder status (thus already ending editing with _textObject).
|
||||
|
@ -1773,7 +1772,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
}
|
||||
|
||||
if ((mode != NSTrackModeMatrix) && (mode != NSHighlightModeMatrix))
|
||||
[NSEvent startPeriodicEventsAfterDelay: 0.05
|
||||
[NSEvent startPeriodicEventsAfterDelay: 0.05
|
||||
withPeriod: 0.05];
|
||||
ASSIGN(lastEvent, theEvent);
|
||||
|
||||
|
@ -1785,20 +1784,20 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
{
|
||||
BOOL shouldProceedEvent = NO;
|
||||
|
||||
onCell = [self getRow: &row
|
||||
column: &column
|
||||
onCell = [self getRow: &row
|
||||
column: &column
|
||||
forPoint: lastLocation];
|
||||
if (onCell)
|
||||
{
|
||||
aCell = [self cellAtRow: row
|
||||
aCell = [self cellAtRow: row
|
||||
column: column];
|
||||
rect = [self cellFrameAtRow: row
|
||||
rect = [self cellFrameAtRow: row
|
||||
column: column];
|
||||
if (aCell != previousCell)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case NSTrackModeMatrix:
|
||||
case NSTrackModeMatrix:
|
||||
// in Track mode the cell should track the mouse
|
||||
// until the cursor either leaves the cellframe or
|
||||
// NSLeftMouseUp occurs
|
||||
|
@ -1812,7 +1811,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
done = YES;
|
||||
break;
|
||||
|
||||
case NSHighlightModeMatrix:
|
||||
case NSHighlightModeMatrix:
|
||||
// Highlight mode is like Track mode except that
|
||||
// the cell is lit before begins tracking and
|
||||
// unlit afterwards
|
||||
|
@ -1834,7 +1833,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
[window flushWindow];
|
||||
break;
|
||||
|
||||
case NSRadioModeMatrix:
|
||||
case NSRadioModeMatrix:
|
||||
// Radio mode allows no more than one cell to be selected
|
||||
if (previousCell == aCell)
|
||||
break;
|
||||
|
@ -1861,7 +1860,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
[window flushWindow];
|
||||
break;
|
||||
|
||||
case NSListModeMatrix:
|
||||
case NSListModeMatrix:
|
||||
// List mode allows multiple cells to be selected
|
||||
{
|
||||
unsigned modifiers = [lastEvent modifierFlags];
|
||||
|
@ -1928,7 +1927,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
dequeue: YES];
|
||||
switch ([theEvent type])
|
||||
{
|
||||
case NSPeriodic:
|
||||
case NSPeriodic:
|
||||
NSDebugLog(@"NSMatrix: got NSPeriodic event\n");
|
||||
shouldProceedEvent = YES;
|
||||
break;
|
||||
|
@ -1936,10 +1935,10 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
// Track and Highlight modes do not use
|
||||
// periodic events so we must break out
|
||||
// and check if the mouse is in a cell
|
||||
case NSLeftMouseUp:
|
||||
case NSLeftMouseUp:
|
||||
done = YES;
|
||||
case NSLeftMouseDown:
|
||||
default:
|
||||
case NSLeftMouseDown:
|
||||
default:
|
||||
if ((mode == NSTrackModeMatrix)
|
||||
|| (mode == NSHighlightModeMatrix))
|
||||
shouldProceedEvent = YES;
|
||||
|
@ -1955,14 +1954,14 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
|
||||
switch (mode)
|
||||
{
|
||||
case NSRadioModeMatrix:
|
||||
case NSRadioModeMatrix:
|
||||
if (_selectedCell != nil)
|
||||
[_selectedCell highlight: NO withFrame: rect inView: self];
|
||||
case NSListModeMatrix:
|
||||
case NSListModeMatrix:
|
||||
[self setNeedsDisplayInRect: rect];
|
||||
[window flushWindow];
|
||||
case NSHighlightModeMatrix:
|
||||
case NSTrackModeMatrix:
|
||||
case NSHighlightModeMatrix:
|
||||
case NSTrackModeMatrix:
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2052,7 +2051,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
for (j = 0; j < numCols; j++)
|
||||
{
|
||||
NSCell *aCell = cells[i][j];
|
||||
|
||||
|
||||
[aCell resetCursorRect: [self cellFrameAtRow: i column: j]
|
||||
inView: self];
|
||||
}
|
||||
|
@ -2088,7 +2087,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
cellClass = class;
|
||||
if (cellClass == nil)
|
||||
{
|
||||
cellClass = defaultCellClass;
|
||||
cellClass = defaultCellClass;
|
||||
}
|
||||
cellNew = [cellClass methodForSelector: allocSel];
|
||||
cellInit = [cellClass instanceMethodForSelector: initSel];
|
||||
|
@ -2314,11 +2313,11 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
NSSize change;
|
||||
int nc = numCols;
|
||||
int nr = numRows;
|
||||
|
||||
|
||||
[super resizeWithOldSuperviewSize: oldSize];
|
||||
|
||||
newBoundsSize = bounds.size;
|
||||
|
||||
newBoundsSize = bounds.size;
|
||||
|
||||
change.height = newBoundsSize.height - oldBoundsSize.height;
|
||||
change.width = newBoundsSize.width - oldBoundsSize.width;
|
||||
|
||||
|
@ -2329,8 +2328,9 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
if (nr <= 0) nr = 1;
|
||||
if (cellSize.height == 0)
|
||||
{
|
||||
cellSize.height = oldBoundsSize.height - ((nr - 1) * intercell.height);
|
||||
cellSize.height = cellSize.height / nr;
|
||||
cellSize.height = oldBoundsSize.height
|
||||
- ((nr - 1) * intercell.height);
|
||||
cellSize.height = cellSize.height / nr;
|
||||
}
|
||||
change.height = change.height / nr;
|
||||
cellSize.height += change.height;
|
||||
|
@ -2339,11 +2339,12 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
}
|
||||
if (change.width != 0)
|
||||
{
|
||||
if (nc <= 0) nc = 1;
|
||||
if (nc <= 0) nc = 1;
|
||||
if (cellSize.width == 0)
|
||||
{
|
||||
cellSize.width = oldBoundsSize.width - ((nc - 1) * intercell.width);
|
||||
cellSize.width = cellSize.width / nc;
|
||||
cellSize.width = oldBoundsSize.width
|
||||
- ((nc - 1) * intercell.width);
|
||||
cellSize.width = cellSize.width / nc;
|
||||
}
|
||||
change.width = change.width / nc;
|
||||
cellSize.width += change.width;
|
||||
|
@ -2355,12 +2356,12 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
{
|
||||
if (change.height != 0)
|
||||
{
|
||||
if (nr > 1)
|
||||
{
|
||||
if (nr > 1)
|
||||
{
|
||||
if (intercell.height == 0)
|
||||
{
|
||||
intercell.height = oldBoundsSize.height - (nr * cellSize.height);
|
||||
intercell.height = intercell.height / (nr - 1);
|
||||
intercell.height = intercell.height / (nr - 1);
|
||||
}
|
||||
change.height = change.height / (nr - 1);
|
||||
intercell.height += change.height;
|
||||
|
@ -2370,18 +2371,18 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
}
|
||||
if (change.width != 0)
|
||||
{
|
||||
if (nc > 1)
|
||||
if (nc > 1)
|
||||
{
|
||||
if (intercell.width == 0)
|
||||
{
|
||||
intercell.width = oldBoundsSize.width - (nc * cellSize.width);
|
||||
intercell.width = intercell.width / (nc - 1);
|
||||
intercell.width = intercell.width / (nc - 1);
|
||||
}
|
||||
change.width = change.width / (nc - 1);
|
||||
intercell.width += change.width;
|
||||
if (intercell.width < 0)
|
||||
intercell.width = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[self setNeedsDisplay: YES];
|
||||
|
@ -2414,7 +2415,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
_textObject = nil;
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -2426,7 +2427,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (void) validateEditing
|
||||
- (void) validateEditing
|
||||
{
|
||||
if (_textObject)
|
||||
[_selectedCell setStringValue: [_textObject text]];
|
||||
|
@ -2480,7 +2481,7 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
}
|
||||
|
||||
/*
|
||||
* Update matrix dimension before we actually change it - so that
|
||||
* Update matrix dimension before we actually change it - so that
|
||||
* makeCellAtRow:column: diesn't think we are trying to make a cell
|
||||
* outside the array bounds.
|
||||
* Our implementation doesn't care, but a subclass might use
|
||||
|
@ -2633,17 +2634,19 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
}
|
||||
// Otherwise, make the big cycle.
|
||||
for (i = row + 1; i < numRows; i++)
|
||||
for (j = 0; j < numCols; j++)
|
||||
{
|
||||
if ([cells[i][j] isSelectable])
|
||||
{
|
||||
_selectedCell = [self selectTextAtRow: i
|
||||
column: j];
|
||||
_selectedRow = i;
|
||||
_selectedColumn = j;
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
{
|
||||
for (j = 0; j < numCols; j++)
|
||||
{
|
||||
if ([cells[i][j] isSelectable])
|
||||
{
|
||||
_selectedCell = [self selectTextAtRow: i
|
||||
column: j];
|
||||
_selectedRow = i;
|
||||
_selectedColumn = j;
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
-(BOOL) _selectPreviousSelectableCellBeforeRow: (int)row
|
||||
|
@ -2667,17 +2670,19 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
}
|
||||
// Otherwise, make the big cycle.
|
||||
for (i = row - 1; i > -1; i--)
|
||||
for (j = numCols - 1; j > -1; j--)
|
||||
{
|
||||
if ([cells[i][j] isSelectable])
|
||||
{
|
||||
_selectedCell = [self selectTextAtRow: i
|
||||
column: j];
|
||||
_selectedRow = i;
|
||||
_selectedColumn = j;
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
{
|
||||
for (j = numCols - 1; j > -1; j--)
|
||||
{
|
||||
if ([cells[i][j] isSelectable])
|
||||
{
|
||||
_selectedCell = [self selectTextAtRow: i
|
||||
column: j];
|
||||
_selectedRow = i;
|
||||
_selectedColumn = j;
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include <AppKit/NSScrollView.h>
|
||||
#include <AppKit/NSClipView.h>
|
||||
|
||||
struct NSWindow_struct
|
||||
struct NSWindow_struct
|
||||
{
|
||||
@defs(NSWindow)
|
||||
};
|
||||
|
@ -238,10 +238,10 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
{
|
||||
if (_nextKeyView)
|
||||
[_nextKeyView setPreviousKeyView: nil];
|
||||
|
||||
|
||||
if (_previousKeyView)
|
||||
[_previousKeyView setNextKeyView: nil];
|
||||
|
||||
|
||||
RELEASE(matrixToWindow);
|
||||
RELEASE(matrixFromWindow);
|
||||
RELEASE(frameMatrix);
|
||||
|
@ -615,7 +615,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
if (newSize.height < 0)
|
||||
{
|
||||
NSWarnMLog(@"given negative height", 0);
|
||||
newSize.height = 0;
|
||||
newSize.height = 0;
|
||||
}
|
||||
if (coordinates_valid)
|
||||
(*invalidateImp)(self, invalidateSel);
|
||||
|
@ -1277,7 +1277,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
DPSgsave(ctxt);
|
||||
matrix = [self _matrixToWindow];
|
||||
[matrix concat];
|
||||
|
||||
|
||||
/*
|
||||
* Clipping - set viewclip to the visible rectangle - which will never be
|
||||
* greater than the bounds of the view.
|
||||
|
@ -1327,7 +1327,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
if (flush)
|
||||
{
|
||||
rect = [[window_t->rectsBeingDrawn lastObject] rectValue];
|
||||
window_t->rectNeedingFlush =
|
||||
window_t->rectNeedingFlush =
|
||||
NSUnionRect(window_t->rectNeedingFlush, rect);
|
||||
window_t->_f.needs_flush = YES;
|
||||
}
|
||||
|
@ -1353,7 +1353,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (void) display
|
||||
- (void) display
|
||||
{
|
||||
if (window)
|
||||
{
|
||||
|
@ -1766,11 +1766,11 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
NSPoint aPoint = vRect.origin;
|
||||
BOOL shouldScroll = NO;
|
||||
|
||||
if (vRect.size.width == 0 && vRect.size.height == 0)
|
||||
if (vRect.size.width == 0 && vRect.size.height == 0)
|
||||
return NO;
|
||||
|
||||
if (!(NSMinX(vRect) <= NSMinX(aRect)
|
||||
&& (NSMaxX(vRect) >= NSMaxX(aRect))))
|
||||
|
||||
if (!(NSMinX(vRect) <= NSMinX(aRect)
|
||||
&& (NSMaxX(vRect) >= NSMaxX(aRect))))
|
||||
{
|
||||
shouldScroll = YES;
|
||||
if (aRect.origin.x < vRect.origin.x)
|
||||
|
@ -1784,8 +1784,8 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(NSMinY(vRect) <= NSMinY(aRect)
|
||||
&& (NSMaxY(vRect) >= NSMaxY(aRect))))
|
||||
if (!(NSMinY(vRect) <= NSMinY(aRect)
|
||||
&& (NSMaxY(vRect) >= NSMaxY(aRect))))
|
||||
{
|
||||
shouldScroll = YES;
|
||||
if (aRect.origin.y < vRect.origin.y)
|
||||
|
@ -1982,7 +1982,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
NSView *v;
|
||||
|
||||
v = findByTag(array[i], aTag, &l);
|
||||
|
||||
|
||||
if (v != nil && l < level)
|
||||
{
|
||||
view = v;
|
||||
|
@ -2128,13 +2128,13 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
_nextKeyView = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ([aView isKindOfClass: viewClass])
|
||||
{
|
||||
// As an exception, we do not retain aView, to avoid retain loops
|
||||
// (the simplest being a view retaining and being retained
|
||||
// by another view), which prevents objects from being ever
|
||||
// deallocated. To understand how we manage without retaining
|
||||
// As an exception, we do not retain aView, to avoid retain loops
|
||||
// (the simplest being a view retaining and being retained
|
||||
// by another view), which prevents objects from being ever
|
||||
// deallocated. To understand how we manage without retaining
|
||||
// _nextKeyView, see [NSView -dealloc].
|
||||
_nextKeyView = aView;
|
||||
if ([aView previousKeyView] != self)
|
||||
|
@ -2152,10 +2152,10 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
theView = _nextKeyView;
|
||||
while (1)
|
||||
{
|
||||
if ([theView acceptsFirstResponder] || (theView == nil)
|
||||
if ([theView acceptsFirstResponder] || (theView == nil)
|
||||
|| (theView == self))
|
||||
return theView;
|
||||
|
||||
|
||||
theView = [theView nextKeyView];
|
||||
}
|
||||
}
|
||||
|
@ -2166,7 +2166,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
_previousKeyView = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ([aView isKindOfClass: viewClass])
|
||||
{
|
||||
_previousKeyView = aView;
|
||||
|
@ -2179,16 +2179,16 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
return _previousKeyView;
|
||||
}
|
||||
- (NSView *) previousValidKeyView
|
||||
{
|
||||
{
|
||||
NSView *theView;
|
||||
|
||||
theView = _previousKeyView;
|
||||
while (1)
|
||||
{
|
||||
if ([theView acceptsFirstResponder] || (theView == nil)
|
||||
if ([theView acceptsFirstResponder] || (theView == nil)
|
||||
|| (theView == self))
|
||||
return theView;
|
||||
|
||||
|
||||
theView = [theView previousKeyView];
|
||||
}
|
||||
}
|
||||
|
@ -2434,7 +2434,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
NSRect rect;
|
||||
NSEnumerator *e;
|
||||
NSView *sub;
|
||||
NSArray *subs;
|
||||
NSArray *subs;
|
||||
|
||||
self = [super initWithCoder: aDecoder];
|
||||
|
||||
|
|
|
@ -306,10 +306,10 @@ static NSMapTable* windowmaps = NULL;
|
|||
/* rectBeingDrawn is variable used to optimize flushing the backing store.
|
||||
It is set by NSGraphicsContext during a lockFocus to tell NSWindow what
|
||||
part a view is drawing in, so NSWindow only has to flush that portion */
|
||||
rectsBeingDrawn = RETAIN([NSMutableArray arrayWithCapacity: 10]);
|
||||
rectsBeingDrawn = RETAIN([NSMutableArray arrayWithCapacity: 10]);
|
||||
|
||||
DPSwindow(context, NSMinX(contentRect), NSMinY(contentRect),
|
||||
NSWidth(contentRect), NSHeight(contentRect),
|
||||
NSWidth(contentRect), NSHeight(contentRect),
|
||||
bufferingType, &window_num);
|
||||
DPSstylewindow(context, aStyle, window_num);
|
||||
DPSsetwindowlevel(context, [self level], window_num);
|
||||
|
@ -490,13 +490,13 @@ static NSMapTable* windowmaps = NULL;
|
|||
*/
|
||||
- (void) endEditingFor: (id)anObject
|
||||
{
|
||||
NSText *t = [self fieldEditor: NO
|
||||
NSText *t = [self fieldEditor: NO
|
||||
forObject: anObject];
|
||||
|
||||
if (t && (first_responder == t))
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSTextDidEndEditingNotification
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSTextDidEndEditingNotification
|
||||
object: t];
|
||||
[t setText: @""];
|
||||
[t setDelegate: nil];
|
||||
|
@ -533,9 +533,9 @@ static NSMapTable* windowmaps = NULL;
|
|||
{
|
||||
ASSIGN(_windowController, windowController);
|
||||
}
|
||||
|
||||
|
||||
- (id) windowController
|
||||
{
|
||||
{
|
||||
return _windowController;
|
||||
}
|
||||
|
||||
|
@ -754,7 +754,7 @@ static NSMapTable* windowmaps = NULL;
|
|||
performSelector: @selector(_handleWindowNeedsDisplay:)
|
||||
target: self
|
||||
argument: nil
|
||||
order: 600000
|
||||
order: 600000
|
||||
modes: [NSArray arrayWithObjects:
|
||||
NSDefaultRunLoopMode,
|
||||
NSModalPanelRunLoopMode,
|
||||
|
@ -956,7 +956,7 @@ static NSMapTable* windowmaps = NULL;
|
|||
- (void) setResizeIncrements: (NSSize)aSize
|
||||
{
|
||||
increments = aSize;
|
||||
DPSsetresizeincrements(GSCurrentContext(), aSize.width, aSize.height,
|
||||
DPSsetresizeincrements(GSCurrentContext(), aSize.width, aSize.height,
|
||||
window_num);
|
||||
}
|
||||
|
||||
|
@ -1079,11 +1079,11 @@ static NSMapTable* windowmaps = NULL;
|
|||
i = [rectsBeingDrawn count];
|
||||
while (i-- > 0)
|
||||
{
|
||||
rectNeedingFlush = NSUnionRect(rectNeedingFlush,
|
||||
rectNeedingFlush = NSUnionRect(rectNeedingFlush,
|
||||
[[rectsBeingDrawn objectAtIndex: i] rectValue]);
|
||||
}
|
||||
|
||||
DPSflushwindowrect(context,
|
||||
|
||||
DPSflushwindowrect(context,
|
||||
NSMinX(rectNeedingFlush), NSMinY(rectNeedingFlush),
|
||||
NSWidth(rectNeedingFlush), NSHeight(rectNeedingFlush),
|
||||
window_num);
|
||||
|
@ -1486,7 +1486,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
}
|
||||
|
||||
- (void) setInitialFirstResponder: (NSView *)aView
|
||||
{
|
||||
{
|
||||
if ([aView isKindOfClass: viewClass])
|
||||
{
|
||||
if (_initial_first_responder)
|
||||
|
@ -1496,25 +1496,25 @@ resetCursorRectsForView(NSView *theView)
|
|||
}
|
||||
|
||||
- (NSView *) initialFirstResponder
|
||||
{
|
||||
{
|
||||
return _initial_first_responder;
|
||||
}
|
||||
|
||||
- (void) keyDown: (NSEvent *)theEvent
|
||||
{
|
||||
{
|
||||
unsigned int key_code = [theEvent keyCode];
|
||||
|
||||
// If this is a TAB or TAB+SHIFT event, move to the next key view
|
||||
if (key_code == 0x09)
|
||||
if (key_code == 0x09)
|
||||
{
|
||||
if ([theEvent modifierFlags] & NSShiftKeyMask)
|
||||
[self selectPreviousKeyView: self];
|
||||
else
|
||||
[self selectNextKeyView: self];
|
||||
return;
|
||||
}
|
||||
|
||||
// If this is an ESC event, abort modal loop
|
||||
}
|
||||
|
||||
// If this is an ESC event, abort modal loop
|
||||
if (key_code == 0x1b)
|
||||
{
|
||||
NSApplication *app = [NSApplication sharedApplication];
|
||||
|
@ -1526,25 +1526,25 @@ resetCursorRectsForView(NSView *theView)
|
|||
return;
|
||||
}
|
||||
|
||||
// Try to process the event as a key equivalent
|
||||
// Try to process the event as a key equivalent
|
||||
// without Command having being pressed
|
||||
{
|
||||
NSEvent *new_event
|
||||
= [NSEvent keyEventWithType: [theEvent type]
|
||||
location: NSZeroPoint
|
||||
NSEvent *new_event
|
||||
= [NSEvent keyEventWithType: [theEvent type]
|
||||
location: NSZeroPoint
|
||||
modifierFlags: ([theEvent modifierFlags] | NSCommandKeyMask)
|
||||
timestamp: [theEvent timestamp]
|
||||
timestamp: [theEvent timestamp]
|
||||
windowNumber: [theEvent windowNumber]
|
||||
context: [theEvent context]
|
||||
context: [theEvent context]
|
||||
characters: [theEvent characters]
|
||||
charactersIgnoringModifiers: [theEvent
|
||||
charactersIgnoringModifiers: [theEvent
|
||||
charactersIgnoringModifiers]
|
||||
isARepeat: [theEvent isARepeat]
|
||||
keyCode: key_code];
|
||||
if ([self performKeyEquivalent: new_event])
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Otherwise, pass the event up
|
||||
[super keyDown: theEvent];
|
||||
}
|
||||
|
@ -1919,7 +1919,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
case NSMouseExited: // Mouse exited
|
||||
break;
|
||||
|
||||
case NSKeyDown:
|
||||
case NSKeyDown:
|
||||
/*
|
||||
* Save the first responder so that the key up goes to it and not a
|
||||
* possible new first responder.
|
||||
|
@ -2018,18 +2018,18 @@ resetCursorRectsForView(NSView *theView)
|
|||
dragInfo = [GSCurrentContext() _dragInfo];
|
||||
if (_lastDragView && _lastDragView != v && _f.accepts_drag)
|
||||
{
|
||||
GSPerformVoidDragSelector(_lastDragView,
|
||||
GSPerformVoidDragSelector(_lastDragView,
|
||||
@selector(draggingExited:), dragInfo);
|
||||
}
|
||||
_f.accepts_drag = GSViewAcceptsDrag(v, dragInfo);
|
||||
if (_lastDragView != v && _f.accepts_drag)
|
||||
{
|
||||
GSPerformDragSelector(v, @selector(draggingEntered:),
|
||||
GSPerformDragSelector(v, @selector(draggingEntered:),
|
||||
dragInfo, action);
|
||||
}
|
||||
else
|
||||
{
|
||||
GSPerformDragSelector(v, @selector(draggingUpdated:),
|
||||
GSPerformDragSelector(v, @selector(draggingUpdated:),
|
||||
dragInfo, action);
|
||||
}
|
||||
e = [NSEvent otherEventWithType: NSAppKitDefined
|
||||
|
@ -2053,7 +2053,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
dragInfo = [GSCurrentContext() _dragInfo];
|
||||
if (_lastDragView && _f.accepts_drag)
|
||||
{
|
||||
GSPerformDragSelector(_lastDragView,
|
||||
GSPerformDragSelector(_lastDragView,
|
||||
@selector(draggingExited:), dragInfo,
|
||||
action);
|
||||
}
|
||||
|
@ -2063,19 +2063,19 @@ resetCursorRectsForView(NSView *theView)
|
|||
if (_lastDragView && _f.accepts_drag)
|
||||
{
|
||||
dragInfo = [GSCurrentContext() _dragInfo];
|
||||
GSPerformDragSelector(_lastDragView,
|
||||
@selector(prepareForDragOperation:),
|
||||
GSPerformDragSelector(_lastDragView,
|
||||
@selector(prepareForDragOperation:),
|
||||
dragInfo, action);
|
||||
if (action)
|
||||
{
|
||||
GSPerformDragSelector(_lastDragView,
|
||||
@selector(performDragOperation:),
|
||||
GSPerformDragSelector(_lastDragView,
|
||||
@selector(performDragOperation:),
|
||||
dragInfo, action);
|
||||
}
|
||||
if (action)
|
||||
{
|
||||
GSPerformVoidDragSelector(_lastDragView,
|
||||
@selector(concludeDragOperation:),
|
||||
GSPerformVoidDragSelector(_lastDragView,
|
||||
@selector(concludeDragOperation:),
|
||||
dragInfo);
|
||||
}
|
||||
}
|
||||
|
@ -2101,7 +2101,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
}
|
||||
break;
|
||||
|
||||
case NSPeriodic:
|
||||
case NSPeriodic:
|
||||
case NSSystemDefined:
|
||||
case NSApplicationDefined:
|
||||
break;
|
||||
|
@ -2121,7 +2121,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
- (void) selectKeyViewFollowingView: (NSView *)aView
|
||||
{
|
||||
NSView *theView = nil;
|
||||
|
||||
|
||||
if ([aView isKindOfClass: viewClass])
|
||||
theView = [aView nextValidKeyView];
|
||||
if (theView)
|
||||
|
@ -2157,15 +2157,15 @@ resetCursorRectsForView(NSView *theView)
|
|||
- (void) selectNextKeyView: (id)sender
|
||||
{
|
||||
NSView *theView = nil;
|
||||
|
||||
if ([first_responder isKindOfClass: viewClass])
|
||||
|
||||
if ([first_responder isKindOfClass: viewClass])
|
||||
theView = [first_responder nextValidKeyView];
|
||||
|
||||
|
||||
if ((theView == nil) && (_initial_first_responder))
|
||||
{
|
||||
if ([_initial_first_responder acceptsFirstResponder])
|
||||
theView = _initial_first_responder;
|
||||
else
|
||||
else
|
||||
theView = [_initial_first_responder nextValidKeyView];
|
||||
}
|
||||
|
||||
|
@ -2184,15 +2184,15 @@ resetCursorRectsForView(NSView *theView)
|
|||
- (void) selectPreviousKeyView: (id)sender
|
||||
{
|
||||
NSView *theView = nil;
|
||||
|
||||
if ([first_responder isKindOfClass: viewClass])
|
||||
|
||||
if ([first_responder isKindOfClass: viewClass])
|
||||
theView = [first_responder previousValidKeyView];
|
||||
|
||||
|
||||
if ((theView == nil) && (_initial_first_responder))
|
||||
{
|
||||
if ([_initial_first_responder acceptsFirstResponder])
|
||||
theView = _initial_first_responder;
|
||||
else
|
||||
else
|
||||
theView = [_initial_first_responder previousValidKeyView];
|
||||
}
|
||||
|
||||
|
@ -2210,10 +2210,10 @@ resetCursorRectsForView(NSView *theView)
|
|||
|
||||
// This is invoked by selectText: of some views (eg matrixes),
|
||||
// to know whether they have received it from the window, and
|
||||
// if so, in which direction is the selection moving (so that they know
|
||||
// if so, in which direction is the selection moving (so that they know
|
||||
// if they should select the last or the first editable cell).
|
||||
- (NSSelectionDirection)keyViewSelectionDirection
|
||||
{
|
||||
{
|
||||
return _selection_direction;
|
||||
}
|
||||
|
||||
|
@ -2322,7 +2322,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
[windowsLock lock];
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
obj = [self stringWithSavedFrame];
|
||||
if ([self isKindOfClass: [NSMenuWindow class]])
|
||||
if ([self isKindOfClass: [NSMenuWindow class]])
|
||||
{
|
||||
id dict;
|
||||
|
||||
|
@ -2331,7 +2331,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
if (dict == nil)
|
||||
{
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity: 1];
|
||||
}
|
||||
}
|
||||
else if ([dict isKindOfClass: [NSDictionary class]] == NO)
|
||||
{
|
||||
NSLog(@"NSMenuLocations default is not a dictionary - overwriting");
|
||||
|
@ -2392,7 +2392,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
* Autosave name cleared - remove from defaults database.
|
||||
*/
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
if ([self isKindOfClass: [NSMenuWindow class]])
|
||||
if ([self isKindOfClass: [NSMenuWindow class]])
|
||||
{
|
||||
id dict;
|
||||
|
||||
|
@ -2401,7 +2401,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
if (dict == nil)
|
||||
{
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity: 1];
|
||||
}
|
||||
}
|
||||
else if ([dict isKindOfClass: [NSDictionary class]] == NO)
|
||||
{
|
||||
NSLog(@"NSMenuLocations is not a dictionary - overwriting");
|
||||
|
@ -2545,7 +2545,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
|
||||
[windowsLock lock];
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
if ([self isKindOfClass: [NSMenuWindow class]] == YES)
|
||||
if ([self isKindOfClass: [NSMenuWindow class]] == YES)
|
||||
{
|
||||
obj = [defs objectForKey: @"NSMenuLocations"];
|
||||
if (obj != nil)
|
||||
|
@ -2655,13 +2655,14 @@ resetCursorRectsForView(NSView *theView)
|
|||
{
|
||||
if ([_delegate respondsToSelector: @selector(windowShouldClose:)])
|
||||
{
|
||||
BOOL ourReturn;
|
||||
BOOL ourReturn;
|
||||
|
||||
ourReturn = [_delegate windowShouldClose: sender];
|
||||
|
||||
if (ourReturn)
|
||||
{
|
||||
ourReturn = [[_windowController document] shouldCloseWindowController: _windowController];
|
||||
ourReturn = [[_windowController document]
|
||||
shouldCloseWindowController: _windowController];
|
||||
}
|
||||
|
||||
return ourReturn;
|
||||
|
|
Loading…
Reference in a new issue