From e4b262d6e1f5a8622714d73f07417d697e189051 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 20 Jul 2023 17:41:23 +0100 Subject: [PATCH] Fixed-y-scale bug fixes. Default dialog to SPICE command. Any of the three axis locks must lock the plotWindow Y axis (otherwise locking Y2 but not Y1 doesn't preclude zooming). --- eeschema/dialogs/dialog_sim_command.cpp | 5 +++++ eeschema/dialogs/dialog_sim_command_base.cpp | 4 ++-- eeschema/dialogs/dialog_sim_command_base.fbp | 4 ++-- eeschema/sim/sim_plot_tab.cpp | 10 ---------- eeschema/sim/simulator_frame_ui.cpp | 3 +++ 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/eeschema/dialogs/dialog_sim_command.cpp b/eeschema/dialogs/dialog_sim_command.cpp index 01c91c0172..9d9790a793 100644 --- a/eeschema/dialogs/dialog_sim_command.cpp +++ b/eeschema/dialogs/dialog_sim_command.cpp @@ -534,6 +534,10 @@ void DIALOG_SIM_COMMAND::ApplySettings( SIM_TAB* aTab ) SIM_VALUE::ToDouble( m_y3Max->GetValue().ToStdString() ) ); } + plotTab->GetPlotWin()->LockY( m_lockY1->GetValue() + || m_lockY2->GetValue() + || m_lockY3->GetValue() ); + plotTab->ShowGrid( m_grid->GetValue() ); plotTab->ShowLegend( m_legend->GetValue() ); plotTab->SetDottedSecondary( m_dottedSecondary->GetValue() ); @@ -543,6 +547,7 @@ void DIALOG_SIM_COMMAND::ApplySettings( SIM_TAB* aTab ) plotTab->GetPlotWin()->SetMarginTop( TO_INT( m_marginTop ) ); plotTab->GetPlotWin()->SetMarginBottom( TO_INT( m_marginBottom ) ); + plotTab->GetPlotWin()->AdjustLimitedView(); plotTab->GetPlotWin()->UpdateAll(); } } diff --git a/eeschema/dialogs/dialog_sim_command_base.cpp b/eeschema/dialogs/dialog_sim_command_base.cpp index b247ebcf7c..5c2b433397 100644 --- a/eeschema/dialogs/dialog_sim_command_base.cpp +++ b/eeschema/dialogs/dialog_sim_command_base.cpp @@ -669,7 +669,7 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i m_panelCommand->SetSizer( bCommandSizer ); m_panelCommand->Layout(); bCommandSizer->Fit( m_panelCommand ); - m_notebook1->AddPage( m_panelCommand, _("SPICE Command"), false ); + m_notebook1->AddPage( m_panelCommand, _("SPICE Command"), true ); m_panelPlotSetup = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bPlotSetupSizer; bPlotSetupSizer = new wxBoxSizer( wxVERTICAL ); @@ -879,7 +879,7 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i m_panelPlotSetup->SetSizer( bPlotSetupSizer ); m_panelPlotSetup->Layout(); bPlotSetupSizer->Fit( m_panelPlotSetup ); - m_notebook1->AddPage( m_panelPlotSetup, _("Plot Setup"), true ); + m_notebook1->AddPage( m_panelPlotSetup, _("Plot Setup"), false ); bSizer1->Add( m_notebook1, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); diff --git a/eeschema/dialogs/dialog_sim_command_base.fbp b/eeschema/dialogs/dialog_sim_command_base.fbp index 228432b26c..06de92648d 100644 --- a/eeschema/dialogs/dialog_sim_command_base.fbp +++ b/eeschema/dialogs/dialog_sim_command_base.fbp @@ -269,7 +269,7 @@ SPICE Command - 0 + 1 1 1 @@ -7611,7 +7611,7 @@ Plot Setup - 1 + 0 1 1 diff --git a/eeschema/sim/sim_plot_tab.cpp b/eeschema/sim/sim_plot_tab.cpp index e095ec72b4..aa5c8391f5 100644 --- a/eeschema/sim/sim_plot_tab.cpp +++ b/eeschema/sim/sim_plot_tab.cpp @@ -441,16 +441,6 @@ SIM_PLOT_TAB::~SIM_PLOT_TAB() void SIM_PLOT_TAB::SetY1Scale( bool aLock, double aMin, double aMax ) { m_axis_y1->SetAxisMinMax( aLock, aMin, aMax ); - - if( aLock ) - { - m_plotWin->LockY( true ); - m_plotWin->AdjustLimitedView(); - } - else - { - m_plotWin->LockY( false ); - } } diff --git a/eeschema/sim/simulator_frame_ui.cpp b/eeschema/sim/simulator_frame_ui.cpp index fb01c9d05f..b69e0c91a1 100644 --- a/eeschema/sim/simulator_frame_ui.cpp +++ b/eeschema/sim/simulator_frame_ui.cpp @@ -1869,18 +1869,21 @@ bool SIMULATOR_FRAME_UI::loadJsonWorkbook( const wxString& aPath ) { const nlohmann::json& scale_js = tab_js[ "fixedY1scale" ]; plotTab->SetY1Scale( true, scale_js[ "min" ], scale_js[ "max" ] ); + plotTab->GetPlotWin()->LockY( true ); } if( tab_js.contains( "fixedY2scale" ) ) { const nlohmann::json& scale_js = tab_js[ "fixedY2scale" ]; plotTab->SetY2Scale( true, scale_js[ "min" ], scale_js[ "max" ] ); + plotTab->GetPlotWin()->LockY( true ); } if( tab_js.contains( "fixedY3scale" ) ) { const nlohmann::json& scale_js = tab_js[ "fixedY3scale" ]; plotTab->SetY3Scale( true, scale_js[ "min" ], scale_js[ "max" ] ); + plotTab->GetPlotWin()->LockY( true ); } if( tab_js.contains( "legend" ) )