sim: working on UX

This commit is contained in:
Tomasz Wlostowski
2016-08-11 14:42:00 +02:00
committed by Maciej Suminski
parent ec1b8be528
commit 8c14f2f6b1
20 changed files with 3148 additions and 988 deletions
+39 -4
View File
@@ -27,6 +27,7 @@
#include <eeschema_id.h>
#include <kiway.h>
#include <confirm.h>
#include <bitmaps.h>
#include <widgets/tuner_slider.h>
#include <dialogs/dialog_signal_list.h>
@@ -118,6 +119,32 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent )
Connect( EVT_SIM_STARTED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimStarted ), NULL, this );
Connect( EVT_SIM_FINISHED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimFinished ), NULL, this );
Connect( EVT_SIM_CURSOR_UPDATE, wxCommandEventHandler( SIM_PLOT_FRAME::onCursorUpdate ), NULL, this );
m_toolSimulate = m_toolBar->AddTool( ID_SIM_RUN, _("Run Simulation"), KiBitmap( sim_run_xpm ), _("Run Simulation"), wxITEM_NORMAL );
m_toolAddSignals = m_toolBar->AddTool( ID_SIM_ADD_SIGNALS, _("Add Signals"), KiBitmap( sim_add_signal_xpm ), _("Add signals to plot"), wxITEM_NORMAL );
m_toolProbe = m_toolBar->AddTool( ID_SIM_PROBE, _("Probe"), KiBitmap( sim_probe_xpm ),_("Probe signals on the schematic"), wxITEM_NORMAL );
m_toolTune = m_toolBar->AddTool( ID_SIM_TUNE, _("Tune"), KiBitmap( sim_tune_xpm ), _("Tune component values"), wxITEM_NORMAL );
m_toolSettings = m_toolBar->AddTool( wxID_ANY, _("Settings"), KiBitmap( sim_settings_xpm ), _("Simulation settings"), wxITEM_NORMAL );
Connect( m_toolSimulate->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimulate ), NULL, this );
Connect( m_toolAddSignals->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME::onAddSignal ), NULL, this );
Connect( m_toolProbe->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME::onProbe ), NULL, this );
Connect( m_toolTune->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME::onTune ), NULL, this );
Connect( m_toolSettings->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME::onSettings ), NULL, this );
int w, h;
GetSize( &w, &h );
printf("%d %d\n", w, h);
m_toolBar->Realize();
Layout();
m_splitterConsole->SetSashPosition( w * 0.8 );
m_splitterPlot->SetSashPosition( h *0.8 );
}
@@ -152,6 +179,12 @@ void SIM_PLOT_FRAME::StartSimulation()
m_simulator->Init();
m_simulator->LoadNetlist( formatter.GetString() );
m_simulator->Run();
m_welcomePanel->Show(false);
m_plotNotebook->Show(true);
m_plotNotebook->Raise();
Layout();
}
@@ -559,7 +592,7 @@ void SIM_PLOT_FRAME::menuShowLegendUpdate( wxUpdateUIEvent& event )
event.Check( plot ? plot->IsLegendShown() : false );
}
#if 0
void SIM_PLOT_FRAME::menuShowCoords( wxCommandEvent& event )
{
SIM_PLOT_PANEL* plot = CurrentPlot();
@@ -572,7 +605,7 @@ void SIM_PLOT_FRAME::menuShowCoordsUpdate( wxUpdateUIEvent& event )
SIM_PLOT_PANEL* plot = CurrentPlot();
event.Check( plot ? plot->IsCoordsShown() : false );
}
#endif
void SIM_PLOT_FRAME::onPlotChanged( wxNotebookEvent& event )
{
@@ -705,14 +738,14 @@ void SIM_PLOT_FRAME::onCursorUpdate( wxCommandEvent& event )
void SIM_PLOT_FRAME::onSimStarted( wxCommandEvent& aEvent )
{
m_simulateBtn->SetLabel( wxT( "Stop" ) );
//m_simulateBtn->SetLabel( wxT( "Stop" ) );
SetCursor( wxCURSOR_ARROWWAIT );
}
void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
{
m_simulateBtn->SetLabel( wxT( "Simulate" ) );
//m_simulateBtn->SetLabel( wxT( "Simulate" ) );
SetCursor( wxCURSOR_ARROW );
SIM_TYPE simType = m_exporter->GetSimType();
@@ -765,6 +798,8 @@ void SIM_PLOT_FRAME::onSimUpdate( wxCommandEvent& aEvent )
std::string command( "alter @" + tuner->GetSpiceName()
+ "=" + tuner->GetValue().ToSpiceString() );
m_simulator->Command( command );
printf("CMD: %s\n", command.c_str() );
}
}