diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp
index 371a5b92a3..d4ef2e4abb 100644
--- a/common/widgets/mathplot.cpp
+++ b/common/widgets/mathplot.cpp
@@ -696,8 +696,8 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
}
else
{
- wxCoord x0, y0;
- bool first = true;
+ wxPoint* points = new wxPoint[GetCount()];
+ int count = 0;
while( GetNextXY( x, y ) )
{
@@ -707,30 +707,13 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
wxCoord x1 = w.x2p( px );
wxCoord y1 = w.y2p( py );
- if( first )
- {
- first = false;
- x0 = x1;
- y0 = y1;
- continue;
- }
-
-// This gives disastrous results with very high-frequency plots where the
-// X coordinate may not increment until several waves later
-//
-// if( x0 == x1 ) // continue until a new X coordinate is reached
-// continue;
-
- bool outDown = ( y0 > maxYpx ) && ( y1 > maxYpx );
- bool outUp = ( y0 < minYpx ) && ( y1 < minYpx );
- bool outLeft = ( x1 < startPx ) && ( x0 < startPx );
- bool outRight = ( x1 > endPx ) && ( x0 > endPx );
- if( !( outUp || outDown || outLeft || outRight ) )
- dc.DrawLine( x0, y0, x1, y1 );
-
- x0 = x1;
- y0 = y1;
+ points[count++] = wxPoint( x1, y1 );
}
+
+ if( count > 0 )
+ dc.DrawLines( count, points );
+
+ delete[] points;
}
if( !m_name.IsEmpty() && m_showName )
@@ -3377,6 +3360,11 @@ void mpFXYVector::Rewind()
m_index = 0;
}
+size_t mpFXYVector::GetCount()
+{
+ return m_xs.size();
+}
+
bool mpFXYVector::GetNextXY( double& x, double& y )
{
diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp
index 3b9831ce22..54627bec76 100644
--- a/eeschema/sim/sim_plot_frame.cpp
+++ b/eeschema/sim/sim_plot_frame.cpp
@@ -1084,6 +1084,23 @@ void SIM_PLOT_FRAME::menuShowLegendUpdate( wxUpdateUIEvent& event )
}
+void SIM_PLOT_FRAME::menuShowDotted( wxCommandEvent& event )
+{
+ SIM_PLOT_PANEL* plot = CurrentPlot();
+
+ if( plot )
+ plot->SetDottedCurrentPhase( !plot->GetDottedCurrentPhase() );
+}
+
+
+void SIM_PLOT_FRAME::menuShowDottedUpdate( wxUpdateUIEvent& event )
+{
+ SIM_PLOT_PANEL* plot = CurrentPlot();
+
+ event.Check( plot ? plot->GetDottedCurrentPhase() : false );
+}
+
+
void SIM_PLOT_FRAME::onPlotClose( wxAuiNotebookEvent& event )
{
int idx = event.GetSelection();
diff --git a/eeschema/sim/sim_plot_frame.h b/eeschema/sim/sim_plot_frame.h
index 496ca27f22..78a0e71b09 100644
--- a/eeschema/sim/sim_plot_frame.h
+++ b/eeschema/sim/sim_plot_frame.h
@@ -257,6 +257,8 @@ private:
void menuShowGridUpdate( wxUpdateUIEvent& event ) override;
void menuShowLegend( wxCommandEvent& event ) override;
void menuShowLegendUpdate( wxUpdateUIEvent& event ) override;
+ void menuShowDotted( wxCommandEvent& event ) override;
+ void menuShowDottedUpdate( wxUpdateUIEvent& event ) override;
// Event handlers
void onPlotChanged( wxAuiNotebookEvent& event ) override;
diff --git a/eeschema/sim/sim_plot_frame_base.cpp b/eeschema/sim/sim_plot_frame_base.cpp
index 256e6b2c75..ad529d391f 100644
--- a/eeschema/sim/sim_plot_frame_base.cpp
+++ b/eeschema/sim/sim_plot_frame_base.cpp
@@ -97,6 +97,12 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
m_showLegend = new wxMenuItem( m_viewMenu, ID_MENU_SHOW_LEGEND, wxString( _("Show &Legend") ) , wxEmptyString, wxITEM_CHECK );
m_viewMenu->Append( m_showLegend );
+ m_viewMenu->AppendSeparator();
+
+ wxMenuItem* m_showDotted;
+ m_showDotted = new wxMenuItem( m_viewMenu, ID_MENU_DOTTED, wxString( _("Dotted current/phase") ) , wxEmptyString, wxITEM_CHECK );
+ m_viewMenu->Append( m_showDotted );
+
m_mainMenu->Append( m_viewMenu, _("View") );
this->SetMenuBar( m_mainMenu );
@@ -298,6 +304,8 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
this->Connect( m_showGrid->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowGridUpdate ) );
m_viewMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuShowLegend ), this, m_showLegend->GetId());
this->Connect( m_showLegend->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowLegendUpdate ) );
+ m_viewMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuShowDotted ), this, m_showDotted->GetId());
+ this->Connect( m_showDotted->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowDottedUpdate ) );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotChanged ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotClose ), NULL, this );
m_signals->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SIM_PLOT_FRAME_BASE::onSignalDblClick ), NULL, this );
@@ -309,6 +317,7 @@ SIM_PLOT_FRAME_BASE::~SIM_PLOT_FRAME_BASE()
// Disconnect Events
this->Disconnect( ID_MENU_SHOW_GRID, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowGridUpdate ) );
this->Disconnect( ID_MENU_SHOW_LEGEND, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowLegendUpdate ) );
+ this->Disconnect( ID_MENU_DOTTED, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowDottedUpdate ) );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotChanged ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotClose ), NULL, this );
m_signals->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( SIM_PLOT_FRAME_BASE::onSignalDblClick ), NULL, this );
diff --git a/eeschema/sim/sim_plot_frame_base.fbp b/eeschema/sim/sim_plot_frame_base.fbp
index 8b6d2417cf..aee87dd41e 100644
--- a/eeschema/sim/sim_plot_frame_base.fbp
+++ b/eeschema/sim/sim_plot_frame_base.fbp
@@ -272,7 +272,7 @@
-