void SIM_PLOT_PANEL::EnableCursor( const wxString& aName, bool aEnable ) { TRACE* t = GetTrace( aName ); if( t == nullptr || t->HasCursor() == aEnable ) return; if( aEnable ) { CURSOR* c = new CURSOR( t ); int plotCenter = GetMarginLeft() + ( GetXScreen() - GetMarginLeft() - GetMarginRight() ) / 2; c->SetX( plotCenter ); t->SetCursor( c ); AddLayer( c ); } else { CURSOR* c = t->GetCursor(); t->SetCursor( NULL ); DelLayer( c, true ); } // Notify the parent window about the changes wxQueueEvent( GetParent(), new wxCommandEvent( EVT_SIM_CURSOR_UPDATE ) ); }
SIM_PLOT_FRAME::SIGNAL_CONTEXT_MENU::SIGNAL_CONTEXT_MENU( const wxString& aSignal, SIM_PLOT_FRAME* aPlotFrame ) : m_signal( aSignal ), m_plotFrame( aPlotFrame ) { SIM_PLOT_PANEL* plot = m_plotFrame->CurrentPlot(); AddMenuItem( this, HIDE_SIGNAL, _( "Hide Signal" ), _( "Erase the signal from plot screen" ), KiBitmap( delete_xpm ) ); TRACE* trace = plot->GetTrace( m_signal ); if( trace->HasCursor() ) AddMenuItem( this, HIDE_CURSOR, _( "Hide Cursor" ), KiBitmap( pcb_target_xpm ) ); else AddMenuItem( this, SHOW_CURSOR, _( "Show Cursor" ), KiBitmap( pcb_target_xpm ) ); Connect( wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( SIGNAL_CONTEXT_MENU::onMenuEvent ), NULL, this ); }
bool SIM_PLOT_PANEL::HasCursorEnabled( const wxString& aName ) const { TRACE* t = GetTrace( aName ); return t ? t->HasCursor() : false; }