Don't set modified flag when updating measurement format internally.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15909
This commit is contained in:
Jeff Young 2023-10-21 14:26:17 +01:00
parent eff4e2cc9c
commit 68e46ecad5
2 changed files with 22 additions and 19 deletions

View File

@ -417,6 +417,7 @@ void MEASUREMENTS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
{ {
m_parent->SetMeasureFormat( m_menuRow, format ); m_parent->SetMeasureFormat( m_menuRow, format );
m_parent->UpdateMeasurement( m_menuRow ); m_parent->UpdateMeasurement( m_menuRow );
m_parent->OnModify();
} }
} }
else if( event.GetId() == MYID_DELETE_MEASUREMENT ) else if( event.GetId() == MYID_DELETE_MEASUREMENT )
@ -431,11 +432,9 @@ void MEASUREMENTS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
if( cells1[i].GetCol() == COL_MEASUREMENT ) if( cells1[i].GetCol() == COL_MEASUREMENT )
{ {
for( int j = cells1[i].GetRow(); j < cells2[i].GetRow() + 1; j++ ) for( int j = cells1[i].GetRow(); j < cells2[i].GetRow() + 1; j++ )
{
measurements.push_back( j ); measurements.push_back( j );
} }
} }
}
wxGridCellCoordsArray cells3 = m_grid->GetSelectedCells(); wxGridCellCoordsArray cells3 = m_grid->GetSelectedCells();
@ -456,6 +455,8 @@ void MEASUREMENTS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
m_parent->DeleteMeasurement( row ); m_parent->DeleteMeasurement( row );
m_grid->ClearSelection(); m_grid->ClearSelection();
m_parent->OnModify();
} }
else else
{ {
@ -1085,7 +1086,7 @@ void SIMULATOR_FRAME_UI::onSignalsGridCellChanged( wxGridEvent& aEvent )
// Update enabled/visible states of other controls // Update enabled/visible states of other controls
updateSignalsGrid(); updateSignalsGrid();
updatePlotCursors(); updatePlotCursors();
m_simulatorFrame->OnModify(); OnModify();
} }
else if( col == COL_SIGNAL_COLOR ) else if( col == COL_SIGNAL_COLOR )
{ {
@ -1097,7 +1098,7 @@ void SIMULATOR_FRAME_UI::onSignalsGridCellChanged( wxGridEvent& aEvent )
trace->SetTraceColour( color.ToColour() ); trace->SetTraceColour( color.ToColour() );
plotTab->UpdateTraceStyle( trace ); plotTab->UpdateTraceStyle( trace );
plotTab->UpdatePlotColors(); plotTab->UpdatePlotColors();
m_simulatorFrame->OnModify(); OnModify();
} }
} }
else if( col == COL_CURSOR_1 || col == COL_CURSOR_2 ) else if( col == COL_CURSOR_1 || col == COL_CURSOR_2 )
@ -1111,7 +1112,7 @@ void SIMULATOR_FRAME_UI::onSignalsGridCellChanged( wxGridEvent& aEvent )
bool enable = ii == row && text == wxS( "1" ); bool enable = ii == row && text == wxS( "1" );
plotTab->EnableCursor( vectorName, traceType, id, enable, signalName ); plotTab->EnableCursor( vectorName, traceType, id, enable, signalName );
m_simulatorFrame->OnModify(); OnModify();
} }
// Update cursor checkboxes (which are really radio buttons) // Update cursor checkboxes (which are really radio buttons)
@ -1159,7 +1160,7 @@ void SIMULATOR_FRAME_UI::onCursorsGridCellChanged( wxGridEvent& aEvent )
cursor2->SetCoordX( cursor1->GetCoords().x + value ); cursor2->SetCoordX( cursor1->GetCoords().x + value );
updatePlotCursors(); updatePlotCursors();
m_simulatorFrame->OnModify(); OnModify();
} }
else else
{ {
@ -1179,17 +1180,13 @@ SPICE_VALUE_FORMAT SIMULATOR_FRAME_UI::GetMeasureFormat( int aRow ) const
void SIMULATOR_FRAME_UI::SetMeasureFormat( int aRow, const SPICE_VALUE_FORMAT& aFormat ) void SIMULATOR_FRAME_UI::SetMeasureFormat( int aRow, const SPICE_VALUE_FORMAT& aFormat )
{ {
m_measurementsGrid->SetCellValue( aRow, COL_MEASUREMENT_FORMAT, aFormat.ToString() ); m_measurementsGrid->SetCellValue( aRow, COL_MEASUREMENT_FORMAT, aFormat.ToString() );
m_simulatorFrame->OnModify();
} }
void SIMULATOR_FRAME_UI::DeleteMeasurement( int aRow ) void SIMULATOR_FRAME_UI::DeleteMeasurement( int aRow )
{ {
if( aRow < ( m_measurementsGrid->GetNumberRows() - 1 ) ) if( aRow < ( m_measurementsGrid->GetNumberRows() - 1 ) )
{
m_measurementsGrid->DeleteRows( aRow, 1 ); m_measurementsGrid->DeleteRows( aRow, 1 );
m_simulatorFrame->OnModify();
}
} }
@ -1207,7 +1204,7 @@ void SIMULATOR_FRAME_UI::onMeasurementsGridCellChanged( wxGridEvent& aEvent )
if( col == COL_MEASUREMENT ) if( col == COL_MEASUREMENT )
{ {
UpdateMeasurement( row ); UpdateMeasurement( row );
m_simulatorFrame->OnModify(); OnModify();
} }
else else
{ {
@ -1244,7 +1241,7 @@ void SIMULATOR_FRAME_UI::OnUpdateUI( wxUpdateUIEvent& event )
if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() ) ) if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() ) )
{ {
if( plotTab->GetLegendPosition() != plotTab->m_LastLegendPosition ) if( plotTab->GetLegendPosition() != plotTab->m_LastLegendPosition )
m_simulatorFrame->OnModify(); OnModify();
} }
} }
@ -1401,7 +1398,7 @@ void SIMULATOR_FRAME_UI::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL*
m_sizerTuners->Add( tuner ); m_sizerTuners->Add( tuner );
m_tuners.push_back( tuner ); m_tuners.push_back( tuner );
m_panelTuners->Layout(); m_panelTuners->Layout();
m_simulatorFrame->OnModify(); OnModify();
} }
catch( const KI_PARAM_ERROR& e ) catch( const KI_PARAM_ERROR& e )
{ {
@ -1449,7 +1446,7 @@ void SIMULATOR_FRAME_UI::RemoveTuner( TUNER_SLIDER* aTuner )
m_tuners.remove( aTuner ); m_tuners.remove( aTuner );
aTuner->Destroy(); aTuner->Destroy();
m_panelTuners->Layout(); m_panelTuners->Layout();
m_simulatorFrame->OnModify(); OnModify();
} }
@ -1486,7 +1483,7 @@ void SIMULATOR_FRAME_UI::AddMeasurement( const wxString& aCmd )
SetMeasureFormat( row, { 2, wxS( "~V" ) } ); SetMeasureFormat( row, { 2, wxS( "~V" ) } );
UpdateMeasurement( row ); UpdateMeasurement( row );
m_simulatorFrame->OnModify(); OnModify();
// Always leave at least one empty row for type-in: // Always leave at least one empty row for type-in:
row = m_measurementsGrid->GetNumberRows() - 1; row = m_measurementsGrid->GetNumberRows() - 1;
@ -1557,7 +1554,7 @@ void SIMULATOR_FRAME_UI::AddTrace( const wxString& aName, SIM_TRACE_TYPE aType )
plotTab->GetPlotWin()->UpdateAll(); plotTab->GetPlotWin()->UpdateAll();
updateSignalsGrid(); updateSignalsGrid();
m_simulatorFrame->OnModify(); OnModify();
} }
@ -1628,7 +1625,7 @@ void SIMULATOR_FRAME_UI::SetUserDefinedSignals( const std::map<int, wxString>& a
rebuildSignalsGrid( m_filter->GetValue() ); rebuildSignalsGrid( m_filter->GetValue() );
updateSignalsGrid(); updateSignalsGrid();
updatePlotCursors(); updatePlotCursors();
m_simulatorFrame->OnModify(); OnModify();
} }
@ -2328,7 +2325,7 @@ void SIMULATOR_FRAME_UI::ToggleDarkModePlots()
void SIMULATOR_FRAME_UI::onPlotClose( wxAuiNotebookEvent& event ) void SIMULATOR_FRAME_UI::onPlotClose( wxAuiNotebookEvent& event )
{ {
m_simulatorFrame->OnModify(); OnModify();
} }
@ -2583,7 +2580,7 @@ void SIMULATOR_FRAME_UI::updatePlotCursors()
void SIMULATOR_FRAME_UI::onPlotCursorUpdate( wxCommandEvent& aEvent ) void SIMULATOR_FRAME_UI::onPlotCursorUpdate( wxCommandEvent& aEvent )
{ {
updatePlotCursors(); updatePlotCursors();
m_simulatorFrame->OnModify(); OnModify();
} }
@ -2817,3 +2814,7 @@ void SIMULATOR_FRAME_UI::OnSimRefresh( bool aFinal )
} }
void SIMULATOR_FRAME_UI::OnModify()
{
m_simulatorFrame->OnModify();
}

View File

@ -223,6 +223,8 @@ public:
void OnSimReport( const wxString& aMsg ); void OnSimReport( const wxString& aMsg );
void OnSimRefresh( bool aFinal ); void OnSimRefresh( bool aFinal );
void OnModify();
private: private:
/** /**
* Get the simulator output vector name for a given signal name and type. * Get the simulator output vector name for a given signal name and type.