mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:40:47 +00:00
Minor tidyup.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3836 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3fa6c2695a
commit
ee0eb44c06
1 changed files with 196 additions and 183 deletions
|
@ -1003,22 +1003,17 @@ fprintf(stderr, " NSMatrix: selectTextAtRow --- ");
|
|||
NSRectFill(rect);
|
||||
}
|
||||
|
||||
[self _getRow:&row1 column:&col1
|
||||
forPoint:rect.origin
|
||||
above:NO right:NO
|
||||
isBetweenCells:NULL];
|
||||
[self _getRow: &row1 column: &col1 forPoint: rect.origin
|
||||
above: NO right: NO isBetweenCells: NULL];
|
||||
[self _getRow: &row2 column: &col2
|
||||
forPoint: NSMakePoint(NSMaxX(rect), NSMaxY(rect))
|
||||
above:NO right:NO
|
||||
isBetweenCells:NULL];
|
||||
above: NO right: NO isBetweenCells: NULL];
|
||||
|
||||
if (row1 < 0)
|
||||
row1 = 0;
|
||||
if (col1 < 0)
|
||||
col1 = 0;
|
||||
|
||||
//NSLog (@"display cells between (%d, %d) and (%d, %d)",row1,col1, row2, col2);
|
||||
|
||||
/* Draw the cells within the drawing rectangle. */
|
||||
for (i = row1; i <= row2 && i < numRows; i++)
|
||||
for (j = col1; j <= col2 && j < numCols; j++)
|
||||
|
@ -1028,21 +1023,35 @@ fprintf(stderr, " NSMatrix: selectTextAtRow --- ");
|
|||
- (void) drawCellAtRow: (int)row column: (int)column
|
||||
{
|
||||
NSCell *aCell = [self cellAtRow: row column: column];
|
||||
|
||||
if (aCell)
|
||||
{
|
||||
NSRect cellFrame = [self cellFrameAtRow: row column: column];
|
||||
|
||||
if (drawsCellBackground)
|
||||
{
|
||||
[cellBackgroundColor set];
|
||||
NSRectFill(cellFrame);
|
||||
}
|
||||
[aCell drawWithFrame: cellFrame inView: self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)highlightCell:(BOOL)flag
|
||||
atRow:(int)row
|
||||
column:(int)column
|
||||
- (void) highlightCell: (BOOL)flag atRow: (int)row column: (int)column
|
||||
{
|
||||
NSCell *aCell = [self cellAtRow: row column: column];
|
||||
|
||||
if (aCell)
|
||||
{
|
||||
NSRect cellFrame = [self cellFrameAtRow: row column: column];
|
||||
|
||||
if (drawsCellBackground)
|
||||
{
|
||||
[cellBackgroundColor set];
|
||||
NSRectFill(cellFrame);
|
||||
}
|
||||
[aCell highlight: flag
|
||||
withFrame:[self cellFrameAtRow:row column:column]
|
||||
withFrame: cellFrame
|
||||
inView: self];
|
||||
}
|
||||
}
|
||||
|
@ -1481,20 +1490,15 @@ static MPoint anchor = {0, 0};
|
|||
}
|
||||
|
||||
- (void) updateCell: (NSCell*)aCell
|
||||
{ // attempt to update
|
||||
int r, c; // only the cell and
|
||||
// not the hole matrix
|
||||
if([aCell isOpaque])
|
||||
{
|
||||
if([self getRow:&r column:&c ofCell:aCell])
|
||||
{
|
||||
[self setNeedsDisplayInRect:[self cellFrameAtRow:r column:c]];
|
||||
int row, col;
|
||||
NSRect rect;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
// oh well, update the
|
||||
[self setNeedsDisplay:YES]; // whole matrix
|
||||
if ([self getRow: &row column: &col ofCell: aCell] == NO)
|
||||
return; // Not a cell in this matrix - we can't update it.
|
||||
|
||||
rect = [self cellFrameAtRow: row column: col];
|
||||
[self setNeedsDisplayInRect: rect];
|
||||
}
|
||||
|
||||
- (BOOL)performKeyEquivalent:(NSEvent*)theEvent
|
||||
|
@ -1688,20 +1692,24 @@ fprintf(stderr, " NSMatrix: keyDown --- ");
|
|||
SET_POINTER_VALUE(isBetweenCells, NO);
|
||||
|
||||
/* First check the limit cases */
|
||||
if (point.x > theBounds.size.width) {
|
||||
if (point.x > theBounds.size.width)
|
||||
{
|
||||
SET_POINTER_VALUE(column, numCols - 1);
|
||||
colReady = YES;
|
||||
}
|
||||
else if (point.x < 0) {
|
||||
else if (point.x < 0)
|
||||
{
|
||||
SET_POINTER_VALUE(column, 0);
|
||||
colReady = YES;
|
||||
}
|
||||
|
||||
if (point.y > theBounds.size.height) {
|
||||
if (point.y > theBounds.size.height)
|
||||
{
|
||||
SET_POINTER_VALUE(row, numRows - 1);
|
||||
rowReady = YES;
|
||||
}
|
||||
else if (point.y < 0) {
|
||||
else if (point.y < 0)
|
||||
{
|
||||
SET_POINTER_VALUE(row, 0);
|
||||
rowReady = YES;
|
||||
}
|
||||
|
@ -1709,7 +1717,8 @@ fprintf(stderr, " NSMatrix: keyDown --- ");
|
|||
if (rowReady && colReady)
|
||||
return NO;
|
||||
|
||||
if (!rowReady) {
|
||||
if (!rowReady)
|
||||
{
|
||||
int approxRow = point.y / (cellSize.height + intercell.height);
|
||||
float approxRowsHeight = approxRow * (cellSize.height + intercell.height);
|
||||
|
||||
|
@ -1722,22 +1731,24 @@ fprintf(stderr, " NSMatrix: keyDown --- ");
|
|||
if (aboveRequired && betweenRows)
|
||||
approxRow++;
|
||||
|
||||
#if HAS_FLIPPED_VIEWS
|
||||
SET_POINTER_VALUE(row, approxRow);
|
||||
#else
|
||||
SET_POINTER_VALUE(row, numRows - approxRow - 1);
|
||||
#if HAS_FLIPPED_VIEWS == 0
|
||||
approxRow = numRows - approxRow - 1;
|
||||
#endif
|
||||
if (*row < 0) {
|
||||
*row = -1;
|
||||
if (approxRow < 0)
|
||||
{
|
||||
approxRow = -1;
|
||||
rowReady = YES;
|
||||
}
|
||||
else if (*row >= numRows) {
|
||||
*row = numRows - 1;
|
||||
else if (approxRow >= numRows)
|
||||
{
|
||||
approxRow = numRows - 1;
|
||||
rowReady = YES;
|
||||
}
|
||||
SET_POINTER_VALUE(row, approxRow);
|
||||
}
|
||||
|
||||
if (!colReady) {
|
||||
if (!colReady)
|
||||
{
|
||||
int approxCol = point.x / (cellSize.width + intercell.width);
|
||||
float approxColsWidth = approxCol * (cellSize.width + intercell.width);
|
||||
|
||||
|
@ -1750,15 +1761,17 @@ fprintf(stderr, " NSMatrix: keyDown --- ");
|
|||
if (rightRequired && betweenCols)
|
||||
approxCol++;
|
||||
|
||||
if (approxCol < 0)
|
||||
{
|
||||
approxCol = -1;
|
||||
colReady = YES;
|
||||
}
|
||||
else if (approxCol >= numCols)
|
||||
{
|
||||
approxCol = numCols - 1;
|
||||
colReady = YES;
|
||||
}
|
||||
SET_POINTER_VALUE(column, approxCol);
|
||||
if (*column < 0) {
|
||||
*column = -1;
|
||||
colReady = YES;
|
||||
}
|
||||
else if (*column >= numCols) {
|
||||
*column = numCols - 1;
|
||||
colReady = YES;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the point is outside the matrix bounds return NO */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue