diff --git a/eeschema/sim/ngspice.cpp b/eeschema/sim/ngspice.cpp index 43f539b513..0c365c1ec2 100644 --- a/eeschema/sim/ngspice.cpp +++ b/eeschema/sim/ngspice.cpp @@ -53,27 +53,29 @@ NGSPICE::NGSPICE() m_ngSpice_AllVecs = (ngSpice_AllVecs) m_dll->GetSymbol( "ngSpice_AllVecs" ); m_ngSpice_Running = (ngSpice_Running) m_dll->GetSymbol( "ngSpice_running" ); - setlocale( LC_ALL, "C" ); } NGSPICE::~NGSPICE() { - setlocale( LC_ALL, "" ); delete m_dll; } void NGSPICE::Init() { + setlocale( LC_ALL, "C" ); m_ngSpice_Init( &cbSendChar, &cbSendStat, &cbControlledExit, NULL, NULL, &cbBGThreadRunning, this ); + setlocale( LC_ALL, "" ); } vector NGSPICE::GetPlot( const string& aName, int aMaxLen ) { vector data; + setlocale( LC_ALL, "C" ); vector_info* vi = m_ngGet_Vec_Info( (char*) aName.c_str() ); + setlocale( LC_ALL, "" ); if( vi ) { @@ -99,7 +101,9 @@ vector NGSPICE::GetPlot( const string& aName, int aMaxLen ) vector NGSPICE::GetRealPlot( const string& aName, int aMaxLen ) { vector data; + setlocale( LC_ALL, "C" ); vector_info* vi = m_ngGet_Vec_Info( (char*) aName.c_str() ); + setlocale( LC_ALL, "" ); if( vi ) { @@ -130,7 +134,10 @@ vector NGSPICE::GetRealPlot( const string& aName, int aMaxLen ) vector NGSPICE::GetImagPlot( const string& aName, int aMaxLen ) { vector data; + + setlocale( LC_ALL, "C" ); vector_info* vi = m_ngGet_Vec_Info( (char*) aName.c_str() ); + setlocale( LC_ALL, "" ); if( vi ) { @@ -153,7 +160,10 @@ vector NGSPICE::GetImagPlot( const string& aName, int aMaxLen ) vector NGSPICE::GetMagPlot( const string& aName, int aMaxLen ) { vector data; + + setlocale( LC_ALL, "C" ); vector_info* vi = m_ngGet_Vec_Info( (char*) aName.c_str() ); + setlocale( LC_ALL, "" ); if( vi ) { @@ -179,7 +189,10 @@ vector NGSPICE::GetMagPlot( const string& aName, int aMaxLen ) vector NGSPICE::GetPhasePlot( const string& aName, int aMaxLen ) { vector data; + + setlocale( LC_ALL, "C" ); vector_info* vi = m_ngGet_Vec_Info( (char*) aName.c_str() ); + setlocale( LC_ALL, "" ); if( vi ) { @@ -209,52 +222,58 @@ bool NGSPICE::LoadNetlist( const string& aNetlist ) stringstream ss( aNetlist ); int n = 0; - printf("***\n"); while( !ss.eof() && n < 16384 ) { char line[1024]; ss.getline( line, sizeof(line) ); lines[n++] = strdup(line); - printf("%s\n", line); } - printf("***\n"); - lines[n] = NULL; + setlocale( LC_ALL, "C" ); m_ngSpice_Circ( lines ); + setlocale( LC_ALL, "" ); for(int i = 0; i < n; i++) delete lines[i]; - - printf("Netlist load complete!\n"); - return true; } bool NGSPICE::Run() { - return Command( "bg_run" ); + setlocale( LC_ALL, "C" ); + bool rv = Command( "bg_run" ); + setlocale( LC_ALL, "" ); + return rv; } bool NGSPICE::Stop() { - return Command( "bg_halt" ); + setlocale( LC_ALL, "C" ); + bool rv = Command( "bg_halt" ); + setlocale( LC_ALL, "" ); + return rv; } bool NGSPICE::IsRunning() { - return m_ngSpice_Running(); + setlocale( LC_ALL, "C" ); + bool rv = m_ngSpice_Running(); + setlocale( LC_ALL, "" ); + return rv; } bool NGSPICE::Command( const string& aCmd ) { + setlocale( LC_ALL, "C" ); m_ngSpice_Command( (char*) aCmd.c_str() ); + setlocale( LC_ALL, "" ); return true; } diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index aa5337cb32..b109c9e78c 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -133,16 +133,10 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) 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 ); - m_toolBar->Realize(); + m_plotNotebook->SetPageText(0, _("Welcome!") ); - m_splitterConsole->SetSashPosition( w * 0.8 ); - m_splitterPlot->SetSashPosition( h * 0.8 ); - - Layout(); + //relayout(); } @@ -178,9 +172,11 @@ void SIM_PLOT_FRAME::StartSimulation() m_simulator->LoadNetlist( formatter.GetString() ); m_simulator->Run(); - m_welcomePanel->Show(false); - m_plotNotebook->Show(true); - m_plotNotebook->Fit(); + if ( m_welcomePanel ) + { + m_plotNotebook->DeletePage( 0 ); + m_welcomePanel = nullptr; + } Layout(); } @@ -253,9 +249,13 @@ void SIM_PLOT_FRAME::AddTuner( SCH_COMPONENT* aComponent ) TUNER_SLIDER* tuner = new TUNER_SLIDER( this, m_sidePanel, aComponent ); m_tuneSizer->Add( tuner , 0, wxALL, 5 ); tunerList.push_back( tuner ); - m_sidePanel->Layout(); - m_sideSizer->Fit( m_sidePanel ); - m_splitterPlot->Layout(); + //m_sidePanel->Layout(); + //m_sideSizer->Fit( m_sidePanel ); + //m_splitterPlot->Layout(); + Layout(); + Layout(); + Layout(); + Layout(); Layout(); } catch( ... ) @@ -275,6 +275,8 @@ void SIM_PLOT_FRAME::RemoveTuner( TUNER_SLIDER* aTuner ) m_plots[plotPanel].m_tuners.remove( aTuner ); aTuner->Destroy(); Layout(); + Layout(); + Layout(); } @@ -319,17 +321,9 @@ void SIM_PLOT_FRAME::addPlot( const wxString& aName, SIM_PLOT_TYPE aType, const if( updated ) { updateSignalList(); - plotPanel->Layout(); - plotPanel->Fit(); - m_plotPanel->Layout(); - //m_sideSizer->Fit( m_sidePanel ); - m_splitterPlot->Layout(); - Layout(); - } } - void SIM_PLOT_FRAME::removePlot( const wxString& aPlotName ) { SIM_PLOT_PANEL* plotPanel = CurrentPlot(); diff --git a/eeschema/sim/sim_plot_frame.h b/eeschema/sim/sim_plot_frame.h index 6a11cb491b..e984564152 100644 --- a/eeschema/sim/sim_plot_frame.h +++ b/eeschema/sim/sim_plot_frame.h @@ -136,6 +136,7 @@ class SIM_PLOT_FRAME : public SIM_PLOT_FRAME_BASE SIM_PLOT_PANEL* CurrentPlot() const; private: + void relayout(); /** * @brief Adds a new plot to the current panel. * @param aName is the device/net name. diff --git a/eeschema/sim/sim_plot_frame_base.cpp b/eeschema/sim/sim_plot_frame_base.cpp index fa87e39ade..d6d3e6fb11 100644 --- a/eeschema/sim/sim_plot_frame_base.cpp +++ b/eeschema/sim/sim_plot_frame_base.cpp @@ -101,43 +101,35 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const this->SetMenuBar( m_mainMenu ); - wxBoxSizer* bSizer1; - bSizer1 = new wxBoxSizer( wxVERTICAL ); + m_sizer1 = new wxBoxSizer( wxVERTICAL ); m_toolBar = new wxToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_FLAT|wxTB_HORIZONTAL|wxTB_TEXT ); m_toolBar->Realize(); - bSizer1->Add( m_toolBar, 0, wxEXPAND, 5 ); + m_sizer1->Add( m_toolBar, 0, wxEXPAND, 5 ); m_splitterPlot = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D ); m_splitterPlot->SetSashGravity( 0.8 ); m_splitterPlot->Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterPlotOnIdle ), NULL, this ); m_panel2 = new wxPanel( m_splitterPlot, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer11; - bSizer11 = new wxBoxSizer( wxVERTICAL ); + m_sizer11 = new wxBoxSizer( wxVERTICAL ); m_splitterConsole = new wxSplitterWindow( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D ); m_splitterConsole->SetSashGravity( 0.8 ); m_splitterConsole->Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterConsoleOnIdle ), NULL, this ); m_plotPanel = new wxPanel( m_splitterConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer5; - bSizer5 = new wxBoxSizer( wxHORIZONTAL ); + m_sizer5 = new wxBoxSizer( wxHORIZONTAL ); m_plotNotebook = new wxNotebook( m_plotPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - m_plotNotebook->Hide(); m_plotNotebook->SetMinSize( wxSize( 400,-1 ) ); - - bSizer5->Add( m_plotNotebook, 3, wxEXPAND | wxALL, 5 ); - - m_welcomePanel = new wxPanel( m_plotPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer8; - bSizer8 = new wxBoxSizer( wxVERTICAL ); + m_welcomePanel = new wxPanel( m_plotNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_sizer8 = new wxBoxSizer( wxVERTICAL ); - bSizer8->Add( 0, 0, 1, wxEXPAND, 5 ); + m_sizer8->Add( 0, 0, 1, wxEXPAND, 5 ); wxBoxSizer* bSizer81; bSizer81 = new wxBoxSizer( wxHORIZONTAL ); @@ -156,41 +148,42 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const bSizer81->Add( 0, 0, 1, wxEXPAND, 5 ); - bSizer8->Add( bSizer81, 0, wxEXPAND, 5 ); + m_sizer8->Add( bSizer81, 0, wxEXPAND, 5 ); - bSizer8->Add( 0, 0, 1, wxEXPAND, 5 ); + m_sizer8->Add( 0, 0, 1, wxEXPAND, 5 ); - m_welcomePanel->SetSizer( bSizer8 ); + m_welcomePanel->SetSizer( m_sizer8 ); m_welcomePanel->Layout(); - bSizer8->Fit( m_welcomePanel ); - bSizer5->Add( m_welcomePanel, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + m_sizer8->Fit( m_welcomePanel ); + m_plotNotebook->AddPage( m_welcomePanel, _("a page"), false ); + + m_sizer5->Add( m_plotNotebook, 3, wxEXPAND | wxALL, 5 ); - m_plotPanel->SetSizer( bSizer5 ); + m_plotPanel->SetSizer( m_sizer5 ); m_plotPanel->Layout(); - bSizer5->Fit( m_plotPanel ); + m_sizer5->Fit( m_plotPanel ); m_panel5 = new wxPanel( m_splitterConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer13; - bSizer13 = new wxBoxSizer( wxVERTICAL ); + m_sizer13 = new wxBoxSizer( wxVERTICAL ); m_simConsole = new wxTextCtrl( m_panel5, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_DONTWRAP|wxTE_MULTILINE|wxTE_READONLY ); m_simConsole->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 76, 90, 90, false, wxEmptyString ) ); - bSizer13->Add( m_simConsole, 1, wxALL|wxEXPAND, 5 ); + m_sizer13->Add( m_simConsole, 1, wxALL|wxEXPAND, 5 ); - m_panel5->SetSizer( bSizer13 ); + m_panel5->SetSizer( m_sizer13 ); m_panel5->Layout(); - bSizer13->Fit( m_panel5 ); + m_sizer13->Fit( m_panel5 ); m_splitterConsole->SplitHorizontally( m_plotPanel, m_panel5, 0 ); - bSizer11->Add( m_splitterConsole, 1, wxEXPAND, 5 ); + m_sizer11->Add( m_splitterConsole, 1, wxEXPAND, 5 ); - m_panel2->SetSizer( bSizer11 ); + m_panel2->SetSizer( m_sizer11 ); m_panel2->Layout(); - bSizer11->Fit( m_panel2 ); + m_sizer11->Fit( m_panel2 ); m_sidePanel = new wxPanel( m_splitterPlot, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_sideSizer = new wxBoxSizer( wxVERTICAL ); @@ -227,10 +220,10 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const m_sidePanel->Layout(); m_sideSizer->Fit( m_sidePanel ); m_splitterPlot->SplitVertically( m_panel2, m_sidePanel, 0 ); - bSizer1->Add( m_splitterPlot, 1, wxEXPAND, 5 ); + m_sizer1->Add( m_splitterPlot, 1, wxEXPAND, 5 ); - this->SetSizer( bSizer1 ); + this->SetSizer( m_sizer1 ); this->Layout(); this->Centre( wxBOTH ); diff --git a/eeschema/sim/sim_plot_frame_base.fbp b/eeschema/sim/sim_plot_frame_base.fbp index 0a08ebd1b8..eb664e9611 100644 --- a/eeschema/sim/sim_plot_frame_base.fbp +++ b/eeschema/sim/sim_plot_frame_base.fbp @@ -415,9 +415,9 @@ - bSizer1 + m_sizer1 wxVERTICAL - none + protected 5 wxEXPAND @@ -668,14 +668,14 @@ - bSizer11 + m_sizer11 wxVERTICAL - none + protected 5 wxEXPAND 1 - + 1 1 1 @@ -759,8 +759,8 @@ - - + + 1 1 1 @@ -795,7 +795,7 @@ 0 1 - m_panel4 + m_plotPanel 1 @@ -834,11 +834,11 @@ - + - bSizer5 + m_sizer5 wxHORIZONTAL - none + protected 5 wxEXPAND | wxALL @@ -870,7 +870,7 @@ 1 0 - 1 + 0 wxID_ANY 0 @@ -921,223 +921,223 @@ - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_welcomePanel - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - bSizer8 - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND - 0 + + + a page + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_welcomePanel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + - bSizer81 - wxHORIZONTAL - none - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxALIGN_RIGHT|wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - wxSYS_COLOUR_GRAYTEXT - 1 - ,90,92,-1,70,0 - 0 - 0 - wxID_ANY - Start the simulation by clicking the Run Simulation button - - 0 - - - 0 - - 1 - m_staticText2 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - - - 5 - wxEXPAND - 1 - - 0 + m_sizer8 + wxVERTICAL protected - 0 + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 0 + + + bSizer81 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALIGN_RIGHT|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + wxSYS_COLOUR_GRAYTEXT + 1 + ,90,92,-1,70,0 + 0 + 0 + wxID_ANY + Start the simulation by clicking the Run Simulation button + + 0 + + + 0 + + 1 + m_staticText2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + @@ -1223,9 +1223,9 @@ - bSizer13 + m_sizer13 wxVERTICAL - none + protected 5 wxALL|wxEXPAND diff --git a/eeschema/sim/sim_plot_frame_base.h b/eeschema/sim/sim_plot_frame_base.h index 5a6da6d9e1..ea08cb2345 100644 --- a/eeschema/sim/sim_plot_frame_base.h +++ b/eeschema/sim/sim_plot_frame_base.h @@ -24,10 +24,10 @@ class KIWAY_PLAYER; #include #include #include -#include #include #include #include +#include #include #include #include @@ -50,15 +50,20 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER wxMenu* m_fileMenu; wxMenu* m_simulationMenu; wxMenu* m_viewMenu; + wxBoxSizer* m_sizer1; wxToolBar* m_toolBar; wxSplitterWindow* m_splitterPlot; wxPanel* m_panel2; + wxBoxSizer* m_sizer11; wxSplitterWindow* m_splitterConsole; wxPanel* m_plotPanel; + wxBoxSizer* m_sizer5; wxNotebook* m_plotNotebook; wxPanel* m_welcomePanel; + wxBoxSizer* m_sizer8; wxStaticText* m_staticText2; wxPanel* m_panel5; + wxBoxSizer* m_sizer13; wxTextCtrl* m_simConsole; wxPanel* m_sidePanel; wxBoxSizer* m_sideSizer;