Applied patch [ 607261 ] Fix: wxGrid: row and cell selection
This is a patch against version 1.222 of src/generic/grid.cpp. 1. The patch contains a fix for the row selection as mentioned by me on the wx-dev mailing list. After selecting one row and deselecting it no new row could be selected. 2. Another change has been made to the function CoordToRowOrCol() and addresses an error mailed to wx-dev by John Labensky. The error was that no cell could be selected until a horizontal and vertical resize of at least one cell has been made. The error was that the function could not handle grids with default row or columns sizes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17112 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3573,14 +3573,15 @@ void wxGridWindow::OnEraseBackground( wxEraseEvent& WXUNUSED(event) )
|
||||
// Internal helper macros for simpler use of that function
|
||||
|
||||
static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
|
||||
const wxArrayInt& BorderArray, bool maxOnOverflow);
|
||||
const wxArrayInt& BorderArray, int nMax,
|
||||
bool maxOnOverflow);
|
||||
|
||||
#define internalXToCol(x) CoordToRowOrCol(x, m_defaultColWidth, \
|
||||
WXGRID_MIN_COL_WIDTH, \
|
||||
m_colRights, TRUE)
|
||||
m_colRights, m_numCols, TRUE)
|
||||
#define internalYToRow(y) CoordToRowOrCol(y, m_defaultRowHeight, \
|
||||
WXGRID_MIN_ROW_HEIGHT, \
|
||||
m_rowBottoms, TRUE)
|
||||
m_rowBottoms, m_numRows, TRUE)
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( wxGrid, wxScrolledWindow )
|
||||
@@ -4558,7 +4559,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
|
||||
{
|
||||
if ( !event.ShiftDown() && !event.ControlDown() )
|
||||
ClearSelection();
|
||||
else if ( m_selection )
|
||||
if ( m_selection )
|
||||
{
|
||||
if ( event.ShiftDown() )
|
||||
{
|
||||
@@ -7323,7 +7324,8 @@ void wxGrid::XYToCell( int x, int y, wxGridCellCoords& coords )
|
||||
// of m_rowBottoms/m_ColRights to speed up the search!
|
||||
|
||||
static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
|
||||
const wxArrayInt& BorderArray, bool maxOnOverflow)
|
||||
const wxArrayInt& BorderArray, int nMax,
|
||||
bool maxOnOverflow)
|
||||
{
|
||||
if (!defaultDist)
|
||||
defaultDist = 1;
|
||||
@@ -7331,6 +7333,8 @@ static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
|
||||
i_min = 0;
|
||||
if (BorderArray.IsEmpty())
|
||||
{
|
||||
if((int) i_max <= nMax)
|
||||
return i_max;
|
||||
return maxOnOverflow ? (int)i_max : -1;
|
||||
}
|
||||
|
||||
@@ -7371,14 +7375,14 @@ static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
|
||||
int wxGrid::YToRow( int y )
|
||||
{
|
||||
return CoordToRowOrCol(y, m_defaultRowHeight,
|
||||
WXGRID_MIN_ROW_HEIGHT, m_rowBottoms, FALSE);
|
||||
WXGRID_MIN_ROW_HEIGHT, m_rowBottoms, m_numRows, FALSE);
|
||||
}
|
||||
|
||||
|
||||
int wxGrid::XToCol( int x )
|
||||
{
|
||||
return CoordToRowOrCol(x, m_defaultColWidth,
|
||||
WXGRID_MIN_COL_WIDTH, m_colRights, FALSE);
|
||||
WXGRID_MIN_COL_WIDTH, m_colRights, m_numCols, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user