From 9006f38e70d0a6516f01fd858f86c2393d39fc67 Mon Sep 17 00:00:00 2001 From: Fabien Corona Date: Wed, 22 Feb 2023 19:03:50 +0100 Subject: [PATCH] sim - Don't allow user to delete the type-in measure entry --- eeschema/sim/sim_plot_frame.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 6dc607390a..bd48aa41ee 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -366,7 +366,9 @@ void MEASUREMENTS_GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent if( m_menuCol == COL_MEASUREMENT_VALUE ) menu.Append( MYID_FORMAT_VALUE, _( "Format Value..." ) ); - menu.Append( MYID_DELETE_MEASUREMENT, _( "Delete Measurement" ) ); + if( m_menuRow < ( m_grid->GetNumberRows() - 1 ) ) + menu.Append( MYID_DELETE_MEASUREMENT, _( "Delete Measurement" ) ); + menu.AppendSeparator(); GRID_TRICKS::showPopupMenu( menu, aEvent ); @@ -1212,8 +1214,11 @@ void SIM_PLOT_FRAME::SetMeasureFormat( int aRow, const SPICE_VALUE_FORMAT& aForm void SIM_PLOT_FRAME::DeleteMeasurement( int aRow ) { - m_measurementsGrid->DeleteRows( aRow, 1 ); - m_workbookModified = true; + if( aRow < ( m_measurementsGrid->GetNumberRows() - 1 ) ) + { + m_measurementsGrid->DeleteRows( aRow, 1 ); + m_workbookModified = true; + } }