gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more NSTableView mouseDown: stuff..


From: Fred Kiefer
Subject: Re: more NSTableView mouseDown: stuff..
Date: Mon, 05 Feb 2007 01:06:44 +0100
User-agent: Thunderbird 1.5.0.9 (X11/20060911)

Looks fine to me.

Fred

Matt Rice schrieb:
> wrt some of the stuff in bug #18946
> heres a patch... not the prettiest thing but seems to do the job
> any objections to this approach?
> 
> <foo.diff>
> 
> 
> ------------------------------------------------------------------------
> 
> Index: Source/NSTableView.m
> ===================================================================
> --- Source/NSTableView.m      (revision 24465)
> +++ Source/NSTableView.m      (working copy)
> @@ -3519,6 +3519,25 @@
>      }
>    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 @@
>           down for a long time.
>         */
>         CREATE_AUTORELEASE_POOL(arp);
> -       BOOL shouldComputeNewSelection = NO;
>         NSEventType eventType = [lastEvent type];
>         
>         mouseLocationWin = [lastEvent locationInWindow]; 
> @@ -3623,7 +3641,7 @@
>                 
>                 if (oldRow != currentRow)
>                   {
> -                   shouldComputeNewSelection = YES;
> +                   COMPUTE_NEW_SELECTION;
>                   }
>                 
>                 if (dragOperationPossible == YES)
> @@ -3694,7 +3712,7 @@
>                 currentRow = [self rowAtPoint: mouseLocationView];
>                 if (oldRow != currentRow)
>                   {
> -                   shouldComputeNewSelection = YES;
> +                   COMPUTE_NEW_SELECTION;
>                   }
>                 
>                 if (eventType == NSLeftMouseDown)
> @@ -3718,10 +3736,8 @@
>                         /* 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 @@
>                     currentRow++;
>                     [self scrollRowToVisible: currentRow];
>                     if (dragOperationPossible == NO)
> -                     shouldComputeNewSelection = YES;
> +                     COMPUTE_NEW_SELECTION;
>                   }
>               }
>             else
> @@ -3785,35 +3801,13 @@
>                     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)
>           {
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Gnustep-dev mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gnustep-dev





reply via email to

[Prev in Thread] Current Thread [Next in Thread]