Implement y axis locking for secondary y axes.

Still a bit of a work-in-progress.

Also fixes some bugs with formatting of measurements and cursor values.
This commit is contained in:
Jeff Young 2023-07-20 17:20:57 +01:00
parent 619ec2a559
commit 06f19aa761
12 changed files with 91 additions and 318 deletions

View File

@ -887,17 +887,26 @@ void mpScaleY::computeSlaveTicks( mpWindow& w )
void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
{
if( m_masterScale )
double minVvis, maxVvis;
if( m_axisLocked )
{
minVvis = m_axisMin;
maxVvis = m_axisMax;
m_offset = -m_axisMin;
m_scale = 1.0 / ( m_axisMax - m_axisMin );
}
else if( m_masterScale )
{
computeSlaveTicks( w );
updateTickLabels( dc, w );
return;
}
double minV, maxV, minVvis, maxVvis;
GetDataRange( minV, maxV );
getVisibleDataRange( w, minVvis, maxVvis );
else
{
getVisibleDataRange( w, minVvis, maxVvis );
}
m_absVisibleMaxV = std::max( std::abs( minVvis ), std::abs( maxVvis ) );
m_tickValues.clear();
@ -908,8 +917,8 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
for( int i = 10; i <= 20; i += 2 )
{
double curr_step = fabs( maxVvis - minVvis ) / (double) i;
double base = pow( 10, floor( log10( curr_step ) ) );
double curr_step = fabs( maxVvis - minVvis ) / (double) i;
double base = pow( 10, floor( log10( curr_step ) ) );
double stepInt = floor( curr_step / base ) * base;
double err = fabs( curr_step - stepInt );
@ -920,15 +929,12 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
}
}
double v = floor( minVvis / bestStep ) * bestStep;
double zeroOffset = 100000000.0;
const int iterLimit = 1000;
int i = 0;
const int iterLimit = 1000;
int i = 0;
while( v < maxVvis && i < iterLimit )
while( v <= maxVvis && i < iterLimit )
{
m_tickValues.push_back( v );
@ -939,7 +945,6 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
i++;
}
// something weird happened...
if( i == iterLimit )
m_tickValues.clear();

View File

@ -183,17 +183,13 @@ void DIALOG_SIM_COMMAND::OnUpdateUILockY3( wxUpdateUIEvent& event )
void DIALOG_SIM_COMMAND::SetPlotSettings( const SIM_TAB* aSimTab )
{
#define GET_STR( val ) EDA_UNIT_UTILS::UI::MessageTextFromValue( unityScale, EDA_UNITS::UNSCALED, \
val, false /* no units */ )
if( const SIM_PLOT_TAB* plotTab = dynamic_cast<const SIM_PLOT_TAB*>( aSimTab ) )
{
if( !plotTab->GetLabelY1().IsEmpty() )
{
m_bSizerY1->Show( true );
m_lockY1->SetLabel( wxString::Format( m_lockY1->GetLabel(), plotTab->GetLabelY1() ) );
m_y1MinUnits->SetLabel( plotTab->GetUnitsY1() );
m_y1MaxUnits->SetLabel( plotTab->GetUnitsY1() );
m_y1Units->SetLabel( plotTab->GetUnitsY1() );
double min, max;
bool locked = plotTab->GetY1Scale( &min, &max );
@ -206,14 +202,11 @@ void DIALOG_SIM_COMMAND::SetPlotSettings( const SIM_TAB* aSimTab )
m_y1Max->SetValue( SIM_VALUE::Normalize( max ) );
}
/* JEY TODO: figure out how to decuple slave axes from master axis
*
if( !plotTab->GetLabelY2().IsEmpty() )
{
m_bSizerY2->Show( true );
m_lockY2->SetLabel( wxString::Format( m_lockY2->GetLabel(), plotTab->GetLabelY2() ) );
m_y2MinUnits->SetLabel( plotTab->GetUnitsY2() );
m_y2MaxUnits->SetLabel( plotTab->GetUnitsY2() );
m_y2Units->SetLabel( plotTab->GetUnitsY2() );
double min, max;
bool locked = plotTab->GetY2Scale( &min, &max );
@ -230,8 +223,7 @@ void DIALOG_SIM_COMMAND::SetPlotSettings( const SIM_TAB* aSimTab )
{
m_bSizerY3->Show( true );
m_lockY3->SetLabel( wxString::Format( m_lockY3->GetLabel(), plotTab->GetLabelY3() ) );
m_y3MinUnits->SetLabel( plotTab->GetUnitsY3() );
m_y3MaxUnits->SetLabel( plotTab->GetUnitsY3() );
m_y3Units->SetLabel( plotTab->GetUnitsY3() );
double min, max;
bool locked = plotTab->GetY3Scale( &min, &max );
@ -243,12 +235,14 @@ void DIALOG_SIM_COMMAND::SetPlotSettings( const SIM_TAB* aSimTab )
if( !std::isnan( max ) )
m_y3Max->SetValue( SIM_VALUE::Normalize( max ) );
}
*/
m_grid->SetValue( plotTab->IsGridShown() );
m_legend->SetValue( plotTab->IsLegendShown() );
m_dottedSecondary->SetValue( plotTab->GetDottedSecondary() );
#define GET_STR( val ) EDA_UNIT_UTILS::UI::MessageTextFromValue( unityScale, EDA_UNITS::UNSCALED, \
val, false /* no units */ )
m_marginLeft->SetValue( GET_STR( plotTab->GetPlotWin()->GetMarginLeft() ) );
m_marginTop->SetValue( GET_STR( plotTab->GetPlotWin()->GetMarginTop() ) );
m_marginRight->SetValue( GET_STR( plotTab->GetPlotWin()->GetMarginRight() ) );

View File

@ -683,23 +683,17 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_bSizerY1->Add( 0, 2, 1, wxEXPAND, 5 );
wxFlexGridSizer* fgSizerY1;
fgSizerY1 = new wxFlexGridSizer( 0, 6, 0, 0 );
fgSizerY1 = new wxFlexGridSizer( 0, 5, 0, 0 );
fgSizerY1->SetFlexibleDirection( wxBOTH );
fgSizerY1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_y1MinLabel = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("Min:"), wxDefaultPosition, wxDefaultSize, 0 );
m_y1MinLabel->Wrap( -1 );
fgSizerY1->Add( m_y1MinLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 25 );
fgSizerY1->Add( m_y1MinLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
m_y1Min = new wxTextCtrl( m_panelPlotSetup, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerY1->Add( m_y1Min, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_y1MinUnits = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_y1MinUnits->Wrap( -1 );
m_y1MinUnits->SetMinSize( wxSize( 40,-1 ) );
fgSizerY1->Add( m_y1MinUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_y1MaxLabel = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("Max:"), wxDefaultPosition, wxDefaultSize, 0 );
m_y1MaxLabel->Wrap( -1 );
fgSizerY1->Add( m_y1MaxLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 18 );
@ -707,17 +701,17 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_y1Max = new wxTextCtrl( m_panelPlotSetup, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerY1->Add( m_y1Max, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_y1MaxUnits = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_y1MaxUnits->Wrap( -1 );
m_y1MaxUnits->SetMinSize( wxSize( 40,-1 ) );
m_y1Units = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_y1Units->Wrap( -1 );
m_y1Units->SetMinSize( wxSize( 40,-1 ) );
fgSizerY1->Add( m_y1MaxUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
fgSizerY1->Add( m_y1Units, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_bSizerY1->Add( fgSizerY1, 0, wxBOTTOM, 8 );
bPlotSetupSizer->Add( m_bSizerY1, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bPlotSetupSizer->Add( m_bSizerY1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_bSizerY2 = new wxBoxSizer( wxVERTICAL );
@ -728,23 +722,17 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_bSizerY2->Add( 0, 2, 1, wxEXPAND, 5 );
wxFlexGridSizer* fgSizerY2;
fgSizerY2 = new wxFlexGridSizer( 0, 6, 0, 0 );
fgSizerY2 = new wxFlexGridSizer( 0, 5, 0, 0 );
fgSizerY2->SetFlexibleDirection( wxBOTH );
fgSizerY2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_y2MinLabel = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("Min:"), wxDefaultPosition, wxDefaultSize, 0 );
m_y2MinLabel->Wrap( -1 );
fgSizerY2->Add( m_y2MinLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 25 );
fgSizerY2->Add( m_y2MinLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
m_y2Min = new wxTextCtrl( m_panelPlotSetup, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerY2->Add( m_y2Min, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_y2MinUnits = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_y2MinUnits->Wrap( -1 );
m_y2MinUnits->SetMinSize( wxSize( 40,-1 ) );
fgSizerY2->Add( m_y2MinUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_y2MaxLabel = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("Max:"), wxDefaultPosition, wxDefaultSize, 0 );
m_y2MaxLabel->Wrap( -1 );
fgSizerY2->Add( m_y2MaxLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 18 );
@ -752,15 +740,15 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_y2Max = new wxTextCtrl( m_panelPlotSetup, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerY2->Add( m_y2Max, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_y2MaxUnits = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_y2MaxUnits->Wrap( -1 );
fgSizerY2->Add( m_y2MaxUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_y2Units = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_y2Units->Wrap( -1 );
fgSizerY2->Add( m_y2Units, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_bSizerY2->Add( fgSizerY2, 0, wxBOTTOM, 8 );
bPlotSetupSizer->Add( m_bSizerY2, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bPlotSetupSizer->Add( m_bSizerY2, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_bSizerY3 = new wxBoxSizer( wxVERTICAL );
@ -771,23 +759,17 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_bSizerY3->Add( 0, 2, 1, wxEXPAND, 5 );
wxFlexGridSizer* fgSizerY3;
fgSizerY3 = new wxFlexGridSizer( 0, 6, 0, 0 );
fgSizerY3 = new wxFlexGridSizer( 0, 5, 0, 0 );
fgSizerY3->SetFlexibleDirection( wxBOTH );
fgSizerY3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_y3MinLabel = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("Min:"), wxDefaultPosition, wxDefaultSize, 0 );
m_y3MinLabel->Wrap( -1 );
fgSizerY3->Add( m_y3MinLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 25 );
fgSizerY3->Add( m_y3MinLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 30 );
m_y3Min = new wxTextCtrl( m_panelPlotSetup, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerY3->Add( m_y3Min, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_y3MinUnits = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_y3MinUnits->Wrap( -1 );
m_y3MinUnits->SetMinSize( wxSize( 40,-1 ) );
fgSizerY3->Add( m_y3MinUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_y3MaxLabel = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("Max:"), wxDefaultPosition, wxDefaultSize, 0 );
m_y3MaxLabel->Wrap( -1 );
fgSizerY3->Add( m_y3MaxLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 18 );
@ -795,11 +777,11 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_y3Max = new wxTextCtrl( m_panelPlotSetup, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerY3->Add( m_y3Max, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_y3MaxUnits = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_y3MaxUnits->Wrap( -1 );
m_y3MaxUnits->SetMinSize( wxSize( 40,-1 ) );
m_y3Units = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_y3Units->Wrap( -1 );
m_y3Units->SetMinSize( wxSize( 40,-1 ) );
fgSizerY3->Add( m_y3MaxUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
fgSizerY3->Add( m_y3Units, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_bSizerY3->Add( fgSizerY3, 0, wxBOTTOM, 8 );
@ -812,7 +794,7 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_grid = new wxCheckBox( m_panelPlotSetup, wxID_ANY, _("Show grid"), wxDefaultPosition, wxDefaultSize, 0 );
m_grid->SetValue(true);
bSizerCheckboxes->Add( m_grid, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerCheckboxes->Add( m_grid, 0, wxALL, 5 );
m_legend = new wxCheckBox( m_panelPlotSetup, wxID_ANY, _("Show legend"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerCheckboxes->Add( m_legend, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@ -824,6 +806,9 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
bPlotSetupSizer->Add( bSizerCheckboxes, 0, wxEXPAND|wxLEFT, 5 );
bPlotSetupSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_marginsLabel = new wxStaticText( m_panelPlotSetup, wxID_ANY, _("Margins:"), wxDefaultPosition, wxDefaultSize, 0 );
m_marginsLabel->Wrap( -1 );
bPlotSetupSizer->Add( m_marginsLabel, 0, wxTOP|wxRIGHT|wxLEFT, 10 );
@ -888,7 +873,7 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
bSizerMargins->Add( bSizerRight, 0, wxEXPAND, 5 );
bPlotSetupSizer->Add( bSizerMargins, 0, wxRIGHT|wxLEFT, 5 );
bPlotSetupSizer->Add( bSizerMargins, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_panelPlotSetup->SetSizer( bPlotSetupSizer );
@ -927,22 +912,19 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_pzFunctionType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_COMMAND_BASE::onDCSource1Selected ), NULL, this );
m_y1MinLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1Min->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1MinUnits->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1MaxLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1Max->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1MaxUnits->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1Units->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y2MinLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2Min->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2MinUnits->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2MaxLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2Max->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2MaxUnits->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2Units->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y3MinLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3Min->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3MinUnits->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3MaxLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3Max->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3MaxUnits->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3Units->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
}
DIALOG_SIM_COMMAND_BASE::~DIALOG_SIM_COMMAND_BASE()
@ -960,21 +942,18 @@ DIALOG_SIM_COMMAND_BASE::~DIALOG_SIM_COMMAND_BASE()
m_pzFunctionType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_COMMAND_BASE::onDCSource1Selected ), NULL, this );
m_y1MinLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1Min->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1MinUnits->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1MaxLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1Max->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1MaxUnits->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y1Units->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY1 ), NULL, this );
m_y2MinLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2Min->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2MinUnits->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2MaxLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2Max->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2MaxUnits->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y2Units->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY2 ), NULL, this );
m_y3MinLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3Min->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3MinUnits->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3MaxLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3Max->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3MaxUnits->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
m_y3Units->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_COMMAND_BASE::OnUpdateUILockY3 ), NULL, this );
}

View File

@ -7670,7 +7670,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@ -7756,7 +7756,7 @@
<property name="flag">wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">6</property>
<property name="cols">5</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
@ -7768,7 +7768,7 @@
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">25</property>
<property name="border">30</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
@ -7894,68 +7894,6 @@
<event name="OnUpdateUI">OnUpdateUILockY1</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">40,-1</property>
<property name="moveable">1</property>
<property name="name">m_y1MinUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnUpdateUI">OnUpdateUILockY1</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">18</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
@ -8124,7 +8062,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size">40,-1</property>
<property name="moveable">1</property>
<property name="name">m_y1MaxUnits</property>
<property name="name">m_y1Units</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -8151,7 +8089,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@ -8237,7 +8175,7 @@
<property name="flag">wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">6</property>
<property name="cols">5</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
@ -8249,7 +8187,7 @@
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">25</property>
<property name="border">30</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
@ -8375,68 +8313,6 @@
<event name="OnUpdateUI">OnUpdateUILockY2</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">40,-1</property>
<property name="moveable">1</property>
<property name="name">m_y2MinUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnUpdateUI">OnUpdateUILockY2</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">18</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
@ -8605,7 +8481,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_y2MaxUnits</property>
<property name="name">m_y2Units</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -8718,7 +8594,7 @@
<property name="flag">wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">6</property>
<property name="cols">5</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
@ -8730,7 +8606,7 @@
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">25</property>
<property name="border">30</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
@ -8856,68 +8732,6 @@
<event name="OnUpdateUI">OnUpdateUILockY3</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">40,-1</property>
<property name="moveable">1</property>
<property name="name">m_y3MinUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnUpdateUI">OnUpdateUILockY3</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">18</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
@ -9086,7 +8900,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size">40,-1</property>
<property name="moveable">1</property>
<property name="name">m_y3MaxUnits</property>
<property name="name">m_y3Units</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -9122,7 +8936,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -9314,6 +9128,16 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
@ -9377,7 +9201,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>

View File

@ -166,26 +166,23 @@ class DIALOG_SIM_COMMAND_BASE : public DIALOG_SHIM
wxCheckBox* m_lockY1;
wxStaticText* m_y1MinLabel;
wxTextCtrl* m_y1Min;
wxStaticText* m_y1MinUnits;
wxStaticText* m_y1MaxLabel;
wxTextCtrl* m_y1Max;
wxStaticText* m_y1MaxUnits;
wxStaticText* m_y1Units;
wxBoxSizer* m_bSizerY2;
wxCheckBox* m_lockY2;
wxStaticText* m_y2MinLabel;
wxTextCtrl* m_y2Min;
wxStaticText* m_y2MinUnits;
wxStaticText* m_y2MaxLabel;
wxTextCtrl* m_y2Max;
wxStaticText* m_y2MaxUnits;
wxStaticText* m_y2Units;
wxBoxSizer* m_bSizerY3;
wxCheckBox* m_lockY3;
wxStaticText* m_y3MinLabel;
wxTextCtrl* m_y3Min;
wxStaticText* m_y3MinUnits;
wxStaticText* m_y3MaxLabel;
wxTextCtrl* m_y3Max;
wxStaticText* m_y3MaxUnits;
wxStaticText* m_y3Units;
wxCheckBox* m_grid;
wxCheckBox* m_legend;
wxCheckBox* m_dottedSecondary;

View File

@ -22,11 +22,11 @@ DIALOG_SIM_FORMAT_VALUE_BASE::DIALOG_SIM_FORMAT_VALUE_BASE( wxWindow* parent, wx
fgSizer->SetFlexibleDirection( wxBOTH );
fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_precisionLabel = new wxStaticText( this, wxID_ANY, _("Significant digits:"), wxDefaultPosition, wxDefaultSize, 0 );
m_precisionLabel = new wxStaticText( this, wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 );
m_precisionLabel->Wrap( -1 );
fgSizer->Add( m_precisionLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_precisionCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 9, 3 );
m_precisionCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 9, 2 );
fgSizer->Add( m_precisionCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_rangeLabel = new wxStaticText( this, wxID_ANY, _("Range:"), wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -109,7 +109,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Significant digits:</property>
<property name="label">Precision:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@ -170,7 +170,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="initial">3</property>
<property name="initial">2</property>
<property name="max">9</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>

View File

@ -444,8 +444,6 @@ void SIM_PLOT_TAB::SetY1Scale( bool aLock, double aMin, double aMax )
if( aLock )
{
m_plotWin->Fit( m_plotWin->GetDesiredXmin(), m_plotWin->GetDesiredXmax(),
m_axis_y1->TransformToPlot( aMin ), m_axis_y1->TransformToPlot( aMax ) );
m_plotWin->LockY( true );
m_plotWin->AdjustLimitedView();
}
@ -459,16 +457,12 @@ void SIM_PLOT_TAB::SetY1Scale( bool aLock, double aMin, double aMax )
void SIM_PLOT_TAB::SetY2Scale( bool aLock, double aMin, double aMax )
{
m_axis_y2->SetAxisMinMax( aLock, aMin, aMax );
// TODO: de-couple Y2 from Y1 and independently set Y2's scale
}
void SIM_PLOT_TAB::SetY3Scale( bool aLock, double aMin, double aMax )
{
m_axis_y3->SetAxisMinMax( aLock, aMin, aMax );
// TODO: de-couple Y2 from Y1 and independently set Y2's scale
}
@ -992,21 +986,4 @@ void SIM_PLOT_TAB::ResetScales( bool aIncludeX )
}
void SIM_PLOT_TAB::FitScales()
{
GetPlotWin()->Fit();
double min, max;
if( m_axis_y1 && m_axis_y1->GetAxisMinMax( &min, &max ) )
SetY1Scale( true, min, max );
if( m_axis_y2 && m_axis_y2->GetAxisMinMax( &min, &max ) )
SetY2Scale( true, min, max );
if( m_axis_y3 && m_axis_y3->GetAxisMinMax( &min, &max ) )
SetY3Scale( true, min, max );
}
wxDEFINE_EVENT( EVT_SIM_CURSOR_UPDATE, wxCommandEvent );

View File

@ -333,8 +333,6 @@ public:
///< Reset scale ranges to fit the current traces.
void ResetScales( bool aIncludeX );
void FitScales();
///< Update trace line style
void UpdateTraceStyle( TRACE* trace );

View File

@ -484,8 +484,8 @@ SIMULATOR_FRAME_UI::SIMULATOR_FRAME_UI( SIMULATOR_FRAME* aSimulatorFrame,
for( int cursorId = 0; cursorId < 3; ++cursorId )
{
m_cursorFormats[ cursorId ][ 0 ] = { 3, wxS( "~s" ) };
m_cursorFormats[ cursorId ][ 1 ] = { 3, wxS( "~V" ) };
m_cursorFormats[ cursorId ][ 0 ] = { 2, wxS( "~s" ) };
m_cursorFormats[ cursorId ][ 1 ] = { 2, wxS( "~V" ) };
}
attr = new wxGridCellAttr;
@ -1386,7 +1386,7 @@ void SIMULATOR_FRAME_UI::AddMeasurement( const wxString& aCmd )
}
m_measurementsGrid->SetCellValue( row, COL_MEASUREMENT, aCmd );
SetMeasureFormat( row, { 3, wxS( "~V" ) } );
SetMeasureFormat( row, { 2, wxS( "~V" ) } );
UpdateMeasurement( row );
m_simulatorFrame->OnModify();
@ -2619,7 +2619,7 @@ void SIMULATOR_FRAME_UI::OnSimRefresh( bool aFinal )
if( aFinal )
plotTab->ResetScales( true );
plotTab->FitScales();
plotTab->GetPlotWin()->Fit();
updatePlotCursors();

View File

@ -253,9 +253,7 @@ wxString SPICE_VALUE::ToString( const SPICE_VALUE_FORMAT& aFormat )
mantissa = KiROUND( mantissa * std::pow( 10, aFormat.Precision - 1 ) );
mantissa *= std::pow( 10, scale - aFormat.Precision + 1 );
wxString res = wxString::FromCDouble( mantissa );
StripZeros( res );
wxString res = wxString::FromCDouble( mantissa, aFormat.Precision );
return res + range;
}

View File

@ -1355,6 +1355,7 @@ public:
}
void LockY( bool aLock ) { m_yLocked = aLock; }
bool GetYLocked() const { return m_yLocked; }
void AdjustLimitedView();