mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
Remove duplicate handling for grid checkboxes.
Also corrects logic of otherRow loop. Fixes https://gitlab.com/kicad/code/kicad/-/issues/18843
This commit is contained in:
parent
ec6af4a5b4
commit
846ffa5659
@ -232,13 +232,15 @@ void GRID_TRICKS::onGridCellLeftClick( wxGridEvent& aEvent )
|
||||
|
||||
wxString newVal = m_grid->GetCellValue( row, col );
|
||||
|
||||
for( int affectedRow = m_sel_row_start; affectedRow < m_sel_row_count; ++affectedRow )
|
||||
for( int otherRow = m_sel_row_start; otherRow < m_sel_row_start + m_sel_row_count; ++otherRow )
|
||||
{
|
||||
if( affectedRow == row )
|
||||
if( otherRow == row )
|
||||
continue;
|
||||
|
||||
m_grid->SetCellValue( affectedRow, col, newVal );
|
||||
m_grid->SetCellValue( otherRow, col, newVal );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,15 +355,11 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
|
||||
|
||||
|
||||
setupGrid( m_global_grid );
|
||||
m_global_grid->Bind( wxEVT_GRID_CELL_LEFT_CLICK,
|
||||
&PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
|
||||
|
||||
if( m_projectTable )
|
||||
{
|
||||
m_project_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *m_projectTable ), true );
|
||||
setupGrid( m_project_grid );
|
||||
m_project_grid->Bind( wxEVT_GRID_CELL_LEFT_CLICK,
|
||||
&PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -401,15 +397,9 @@ PANEL_SYM_LIB_TABLE::~PANEL_SYM_LIB_TABLE()
|
||||
// Delete the GRID_TRICKS.
|
||||
// Any additional event handlers should be popped before the window is deleted.
|
||||
m_global_grid->PopEventHandler( true );
|
||||
m_global_grid->Unbind( wxEVT_GRID_CELL_LEFT_CLICK,
|
||||
&PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
|
||||
|
||||
if( m_project_grid )
|
||||
{
|
||||
m_project_grid->PopEventHandler( true );
|
||||
m_project_grid->Unbind( wxEVT_GRID_CELL_LEFT_CLICK,
|
||||
&PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
|
||||
}
|
||||
|
||||
m_path_subs_grid->PopEventHandler( true );
|
||||
}
|
||||
@ -1151,33 +1141,6 @@ SYMBOL_LIB_TABLE_GRID* PANEL_SYM_LIB_TABLE::cur_model() const
|
||||
}
|
||||
|
||||
|
||||
void PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler( wxGridEvent& event )
|
||||
{
|
||||
// Get the grid object that triggered the event
|
||||
wxGrid* grid = dynamic_cast<wxGrid*>( event.GetEventObject() );
|
||||
|
||||
// If the event object is a wxGrid, proceed with the handling
|
||||
if( grid )
|
||||
{
|
||||
int row = event.GetRow();
|
||||
int col = event.GetCol();
|
||||
|
||||
// Get the cell renderer for the clicked cell
|
||||
wxGridCellRenderer* renderer = grid->GetCellRenderer( row, col );
|
||||
|
||||
// Check if the renderer is a wxGridCellBoolRenderer using dynamic_cast
|
||||
if( dynamic_cast<wxGridCellBoolRenderer*>( renderer ) )
|
||||
{
|
||||
// Set the grid cursor to the clicked boolean cell
|
||||
grid->SetGridCursor( row, col );
|
||||
}
|
||||
}
|
||||
|
||||
// Allow the default behavior to continue (toggle the bool)
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
size_t PANEL_SYM_LIB_TABLE::m_pageNdx = 0;
|
||||
|
||||
|
||||
|
@ -58,7 +58,6 @@ private:
|
||||
void onSizeGrid( wxSizeEvent& event ) override;
|
||||
void adjustPathSubsGridColumns( int aWidth );
|
||||
void onConvertLegacyLibraries( wxCommandEvent& event ) override;
|
||||
void onGridCellLeftClickHandler( wxGridEvent& event );
|
||||
|
||||
void onPageChange( wxBookCtrlEvent& event ) override;
|
||||
void onReset( wxCommandEvent& event ) override;
|
||||
|
@ -418,7 +418,6 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PRO
|
||||
m_lastProjectLibDir = m_projectBasePath;
|
||||
|
||||
setupGrid( m_global_grid );
|
||||
m_global_grid->Bind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_FP_LIB_TABLE::onGridCellLeftClickHandler, this );
|
||||
|
||||
populateEnvironReadOnlyTable();
|
||||
|
||||
@ -426,7 +425,6 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PRO
|
||||
{
|
||||
m_project_grid->SetTable( new FP_LIB_TABLE_GRID( *aProjectTable ), true );
|
||||
setupGrid( m_project_grid );
|
||||
m_project_grid->Bind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_FP_LIB_TABLE::onGridCellLeftClickHandler, this );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -521,13 +519,9 @@ PANEL_FP_LIB_TABLE::~PANEL_FP_LIB_TABLE()
|
||||
// Delete the GRID_TRICKS.
|
||||
// Any additional event handlers should be popped before the window is deleted.
|
||||
m_global_grid->PopEventHandler( true );
|
||||
m_global_grid->Unbind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_FP_LIB_TABLE::onGridCellLeftClickHandler, this );
|
||||
|
||||
if( m_project_grid )
|
||||
{
|
||||
m_project_grid->PopEventHandler( true );
|
||||
m_project_grid->Unbind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_FP_LIB_TABLE::onGridCellLeftClickHandler, this );
|
||||
}
|
||||
|
||||
m_path_subs_grid->PopEventHandler( true );
|
||||
}
|
||||
@ -1234,32 +1228,6 @@ void PANEL_FP_LIB_TABLE::populateEnvironReadOnlyTable()
|
||||
}
|
||||
|
||||
|
||||
void PANEL_FP_LIB_TABLE::onGridCellLeftClickHandler( wxGridEvent& event )
|
||||
{
|
||||
// Get the grid object that triggered the event
|
||||
wxGrid* grid = dynamic_cast<wxGrid*>( event.GetEventObject() );
|
||||
|
||||
// If the event object is a wxGrid, proceed with the handling
|
||||
if( grid )
|
||||
{
|
||||
int row = event.GetRow();
|
||||
int col = event.GetCol();
|
||||
|
||||
// Get the cell renderer for the clicked cell
|
||||
wxGridCellRenderer* renderer = grid->GetCellRenderer( row, col );
|
||||
|
||||
// Check if the renderer is a wxGridCellBoolRenderer using dynamic_cast
|
||||
if( dynamic_cast<wxGridCellBoolRenderer*>( renderer ) )
|
||||
{
|
||||
// Set the grid cursor to the clicked boolean cell
|
||||
grid->SetGridCursor( row, col );
|
||||
}
|
||||
}
|
||||
|
||||
// Allow the default behavior to continue (toggle the bool)
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
//-----</event handlers>---------------------------------
|
||||
|
||||
|
||||
|
@ -60,7 +60,6 @@ private:
|
||||
void moveDownHandler( wxCommandEvent& event ) override;
|
||||
void onMigrateLibraries( wxCommandEvent& event ) override;
|
||||
void onSizeGrid( wxSizeEvent& event ) override;
|
||||
void onGridCellLeftClickHandler( wxGridEvent& event );
|
||||
|
||||
void onPageChange( wxBookCtrlEvent& event ) override;
|
||||
void onReset( wxCommandEvent& event ) override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user