Some minor comments wording changes in wxGridSelection

Try to better explain the behaviour of the methods of this class.
This commit is contained in:
Vadim Zeitlin 2020-04-06 02:26:02 +02:00
parent b17d3ecb52
commit fe6d07d2d1

View File

@ -61,14 +61,14 @@ public:
void UpdateRows( size_t pos, int numRows ); void UpdateRows( size_t pos, int numRows );
void UpdateCols( size_t pos, int numCols ); void UpdateCols( size_t pos, int numCols );
// Extend (or shrink) the current selection block or select a new one. // Extend (or shrink) the current selection block or create a new one.
// blockStart and blockEnd specifies the opposite corners of the currently // blockStart and blockEnd specifies the opposite corners of the currently
// edited selection block. In almost all cases blockStart equals to // edited selection block. In almost all cases blockStart equals to
// wxGrid::m_currentCellCoords (the exception is when we scrolled out from // wxGrid::m_currentCellCoords (the exception is when we scrolled out from
// the top of the grid and select a column or scrolled right and select // the top of the grid and select a column or scrolled right and select
// a row: in this case the lowest visible row/column will be set as // a row: in this case the lowest visible row/column will be set as
// current, not the first one). If the row or the column component of // current, not the first one). If the row or the column component of
// blockEnd parametr has value of -1, it means that the corresponding // blockEnd parameter has value of -1, it means that the corresponding
// component of the current block should not be changed. // component of the current block should not be changed.
// Return true if the current block was actually changed or created. // Return true if the current block was actually changed or created.
bool ExtendOrCreateCurrentBlock(const wxGridCellCoords& blockStart, bool ExtendOrCreateCurrentBlock(const wxGridCellCoords& blockStart,
@ -103,15 +103,25 @@ private:
void Select(const wxGridBlockCoords& block, void Select(const wxGridBlockCoords& block,
const wxKeyboardState& kbd, bool sendEvent); const wxKeyboardState& kbd, bool sendEvent);
// If the new block containing any of the passed blocks, remove them. // Ensure that the new "block" becomes part of "blocks", adding it to them
// if a new block contained in the passed blockc, return. // if necessary and, if we do it, also removing any existing elements of
// Otherwise add the new block to the blocks array. // "blocks" that become unnecessary because they're entirely contained in
// the new "block". However note that we may also not to have to add it at
// all, if it's already contained in one of the existing blocks.
//
// We don't currently check if the new block is contained by several
// existing blocks, as this would be more difficult and doesn't seem to be
// really needed in practice.
void MergeOrAddBlock(wxVectorGridBlockCoords& blocks, void MergeOrAddBlock(wxVectorGridBlockCoords& blocks,
const wxGridBlockCoords& block); const wxGridBlockCoords& block);
// The vector of selection blocks. We expect that the users select // All currently selected blocks. We expect there to be a relatively small
// relatively small amount of blocks. K-D tree can be used to speed up // amount of them, even for very large grids, as each block must be
// searching speed. // selected by the user, so we store them unsorted.
//
// Selection may be empty, but if it isn't, the last block is special, as
// it is the current block, which is affected by operations such as
// extending the current selection from keyboard.
wxVectorGridBlockCoords m_selection; wxVectorGridBlockCoords m_selection;
wxGrid *m_grid; wxGrid *m_grid;