* Source/NSTableView (-mouseDown:): Compute the selection immediately

instead of at the end of the loop.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24468 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Matt Rice 2007-02-05 06:15:42 +00:00
parent a39fcf72a5
commit 2d12498c2e
2 changed files with 30 additions and 31 deletions

View file

@ -1,3 +1,8 @@
2007-02-04 Matt Rice <ratmice@gmail.com>
* Source/NSTableView (-mouseDown:): Compute the selection immediately
instead of at the end of the loop.
2007-02-04 Richard Frith-Macdoanld <rfm@gnu.org>
* Source/NSImageView.m: fix minor error in dragging offset.

View file

@ -3519,6 +3519,25 @@ static inline float computePeriod(NSPoint mouseLocationWin,
}
else
{
#define COMPUTE_NEW_SELECTION do { \
if (originalRow == -1) \
{ \
originalRow = currentRow; \
} \
if (currentRow >= 0 && currentRow < _numberOfRows) \
{ \
computeNewSelection(self, \
oldSelectedRows, \
_selectedRows, \
originalRow, \
oldRow, \
currentRow, \
&_selectedRow, \
selectionMode); \
[self displayIfNeeded]; \
} \
} while (0);
// Selection
unsigned int modifiers = [theEvent modifierFlags];
unsigned int eventMask = (NSLeftMouseUpMask
@ -3598,7 +3617,6 @@ static inline float computePeriod(NSPoint mouseLocationWin,
down for a long time.
*/
CREATE_AUTORELEASE_POOL(arp);
BOOL shouldComputeNewSelection = NO;
NSEventType eventType = [lastEvent type];
mouseLocationWin = [lastEvent locationInWindow];
@ -3623,7 +3641,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
if (oldRow != currentRow)
{
shouldComputeNewSelection = YES;
COMPUTE_NEW_SELECTION;
}
if (dragOperationPossible == YES)
@ -3694,7 +3712,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
currentRow = [self rowAtPoint: mouseLocationView];
if (oldRow != currentRow)
{
shouldComputeNewSelection = YES;
COMPUTE_NEW_SELECTION;
}
if (eventType == NSLeftMouseDown)
@ -3718,10 +3736,8 @@ static inline float computePeriod(NSPoint mouseLocationWin,
/* the mouse could have gone up outside of the cell
* avoid selecting the row under mouse cursor */
/* FIXME this should really send the action
* unfortunately the row isn't currently being
* selected so that would send the action on the
* wrong row. */
if (_clickedRow != -1)
[self sendAction: _action to: _target];
return;
}
}
@ -3771,7 +3787,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
currentRow++;
[self scrollRowToVisible: currentRow];
if (dragOperationPossible == NO)
shouldComputeNewSelection = YES;
COMPUTE_NEW_SELECTION;
}
}
else
@ -3785,35 +3801,13 @@ static inline float computePeriod(NSPoint mouseLocationWin,
currentRow--;
[self scrollRowToVisible: currentRow];
if (dragOperationPossible == NO)
shouldComputeNewSelection = YES;
COMPUTE_NEW_SELECTION;
}
}
break;
default:
break;
}
if (shouldComputeNewSelection == YES)
{
if (originalRow == -1)
{
originalRow = currentRow;
}
if (currentRow >= 0 && currentRow < _numberOfRows)
{
computeNewSelection(self,
oldSelectedRows,
_selectedRows,
originalRow,
oldRow,
currentRow,
&_selectedRow,
selectionMode);
[self displayIfNeeded];
}
}
if (done == NO)
{