]> git.saurik.com Git - wxWidgets.git/commitdiff
Modified keyboard and mouse handling wrt selecting blocks/cells.
authorStefan Neis <Stefan.Neis@t-online.de>
Thu, 9 Mar 2000 14:25:07 +0000 (14:25 +0000)
committerStefan Neis <Stefan.Neis@t-online.de>
Thu, 9 Mar 2000 14:25:07 +0000 (14:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index 1fd565857ee09cb032b1a49cca2a72b77160127f..2413364681744988dc3d8ecbe04a6a43ab7a11f9 100644 (file)
@@ -4243,13 +4243,22 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
 
             if ( coords != wxGridNoCellCoords )
             {
-                if ( !IsSelection() )
-                {
-                    SelectBlock( coords, coords );
-                }
-                else
-                {
-                    SelectBlock( m_currentCellCoords, coords );
+               if ( event.ControlDown() )
+               {
+                   if ( m_selectingKeyboard == wxGridNoCellCoords)
+                       m_selectingKeyboard = coords;
+                   SelectBlock ( m_selectingKeyboard, coords );
+               }
+               else
+               {
+                   if ( !IsSelection() )
+                   {
+                       SelectBlock( coords, coords );
+                   }
+                   else
+                   {
+                       SelectBlock( m_currentCellCoords, coords );
+                   }
                 }
 
                 if (! IsVisible(coords))
@@ -4363,15 +4372,20 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
                 }
                 else
                 {
-                    m_selection->ToggleCellSelection( coords.GetRow(),
-                                                      coords.GetCol(),
-                                                      event.ControlDown(),
-                                                      event.ShiftDown(),
-                                                      event.AltDown(),
-                                                      event.MetaDown() );
-                    m_selectingTopLeft = wxGridNoCellCoords;
-                    m_selectingBottomRight = wxGridNoCellCoords;
-                    SetCurrentCell( coords );
+                   if ( event.ControlDown() )
+                   {
+                       m_selection->ToggleCellSelection( coords.GetRow(),
+                                                         coords.GetCol(),
+                                                         event.ControlDown(),
+                                                         event.ShiftDown(),
+                                                         event.AltDown(),
+                                                         event.MetaDown() );
+                       m_selectingTopLeft = wxGridNoCellCoords;
+                       m_selectingBottomRight = wxGridNoCellCoords;
+                       m_selectingKeyboard = coords;
+                   }
+                   else
+                       SetCurrentCell( coords );
                     m_waitForSlowClick = TRUE;
                 }
             }
@@ -6171,8 +6185,11 @@ bool wxGrid::MoveCursorUp( bool expandSelection )
             SelectBlock( m_currentCellCoords, m_selectingKeyboard );
         }
         else
+       {
+           ClearSelection();
             SetCurrentCell( m_currentCellCoords.GetRow() - 1,
                             m_currentCellCoords.GetCol() );
+       }
         return TRUE;
     }
 
@@ -6195,8 +6212,11 @@ bool wxGrid::MoveCursorDown( bool expandSelection )
             SelectBlock( m_currentCellCoords, m_selectingKeyboard );
         }
         else
+       {
+           ClearSelection();
             SetCurrentCell( m_currentCellCoords.GetRow() + 1,
                             m_currentCellCoords.GetCol() );
+       }
         return TRUE;
     }
 
@@ -6219,8 +6239,11 @@ bool wxGrid::MoveCursorLeft( bool expandSelection )
             SelectBlock( m_currentCellCoords, m_selectingKeyboard );
         }
         else
+       {
+           ClearSelection();
             SetCurrentCell( m_currentCellCoords.GetRow(),
                             m_currentCellCoords.GetCol() - 1 );
+       }
         return TRUE;
     }
 
@@ -6244,8 +6267,11 @@ bool wxGrid::MoveCursorRight( bool expandSelection )
             SelectBlock( m_currentCellCoords, m_selectingKeyboard );
         }
         else
-            SetCurrentCell( m_currentCellCoords.GetRow(),
+       {
+           ClearSelection();
+             SetCurrentCell( m_currentCellCoords.GetRow(),
                             m_currentCellCoords.GetCol() + 1 );
+       }
         return TRUE;
     }
 
@@ -6366,8 +6392,10 @@ bool wxGrid::MoveCursorUpBlock( bool expandSelection )
             SelectBlock( m_currentCellCoords, m_selectingKeyboard );
         }
         else
-            SetCurrentCell( row, col );
-
+       {
+           ClearSelection();
+           SetCurrentCell( row, col );
+       }
         return TRUE;
     }
 
@@ -6427,7 +6455,10 @@ bool wxGrid::MoveCursorDownBlock( bool expandSelection )
             SelectBlock( m_currentCellCoords, m_selectingKeyboard );
         }
         else
-            SetCurrentCell( row, col );
+       {
+           ClearSelection();
+           SetCurrentCell( row, col );
+       }
 
         return TRUE;
     }
@@ -6488,7 +6519,10 @@ bool wxGrid::MoveCursorLeftBlock( bool expandSelection )
             SelectBlock( m_currentCellCoords, m_selectingKeyboard );
         }
         else
-            SetCurrentCell( row, col );
+       {
+           ClearSelection();
+           SetCurrentCell( row, col );
+       }
 
         return TRUE;
     }
@@ -6549,7 +6583,10 @@ bool wxGrid::MoveCursorRightBlock( bool expandSelection )
             SelectBlock( m_currentCellCoords, m_selectingKeyboard );
         }
         else
-            SetCurrentCell( row, col );
+       {
+           ClearSelection();
+           SetCurrentCell( row, col );
+       }
 
         return TRUE;
     }