From 48f916bd63f8432ac1e2a3915fa601ab4842ede4 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 17 Sep 2016 09:34:16 +0200 Subject: [PATCH] Kicad manger: add .cir netlist files to the list of files to show in project tree. Simulator: open/save worbook file dialog: the dialog opens the current project folder by default. --- eeschema/sim/sim_plot_frame.cpp | 18 +++++++++++++++--- eeschema/sim/sim_plot_frame.h | 3 +++ kicad/tree_project_frame.cpp | 3 ++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index f2d1595fc6..713ae641a1 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -32,6 +32,7 @@ #include #include #include "netlist_exporter_pspice_sim.h" +#include #include "sim_plot_frame.h" #include "sim_plot_panel.h" @@ -100,6 +101,8 @@ TRACE_DESC::TRACE_DESC( const NETLIST_EXPORTER_PSPICE_SIM& aExporter, const wxSt m_title += " (phase)"; } +// Store the path of saved workbooks during the session +wxString SIM_PLOT_FRAME::m_savedWorkbooksPath; SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SIM_PLOT_FRAME_BASE( aParent ), m_lastSimPlot( nullptr ) @@ -127,6 +130,11 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) m_simulator->Init(); + if( m_savedWorkbooksPath.IsEmpty() ) + { + m_savedWorkbooksPath = Prj().GetProjectPath(); + } + m_reporter = new SIM_THREAD_REPORTER( this ); m_simulator->SetReporter( m_reporter ); @@ -710,14 +718,16 @@ void SIM_PLOT_FRAME::menuNewPlot( wxCommandEvent& aEvent ) void SIM_PLOT_FRAME::menuOpenWorkbook( wxCommandEvent& event ) { - wxFileDialog openDlg( this, _( "Open simulation workbook" ), "", "", + wxFileDialog openDlg( this, _( "Open simulation workbook" ), m_savedWorkbooksPath, "", _( "Workbook file (*.wbk)|*.wbk" ), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( openDlg.ShowModal() == wxID_CANCEL ) return; + m_savedWorkbooksPath = openDlg.GetDirectory(); + if( !loadWorkbook( openDlg.GetPath() ) ) - DisplayError( this, wxT( "There was an error while opening the workbook file" ) ); + DisplayError( this, _( "There was an error while opening the workbook file" ) ); } @@ -726,12 +736,14 @@ void SIM_PLOT_FRAME::menuSaveWorkbook( wxCommandEvent& event ) if( !CurrentPlot() ) return; - wxFileDialog saveDlg( this, _( "Save simulation workbook" ), "", "", + wxFileDialog saveDlg( this, _( "Save simulation workbook" ), m_savedWorkbooksPath, "", _( "Workbook file (*.wbk)|*.wbk" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( saveDlg.ShowModal() == wxID_CANCEL ) return; + m_savedWorkbooksPath = saveDlg.GetDirectory(); + if( !saveWorkbook( saveDlg.GetPath() ) ) DisplayError( this, _( "There was an error while saving the workbook file" ) ); } diff --git a/eeschema/sim/sim_plot_frame.h b/eeschema/sim/sim_plot_frame.h index 3cad93d362..a0434bd1fd 100644 --- a/eeschema/sim/sim_plot_frame.h +++ b/eeschema/sim/sim_plot_frame.h @@ -324,6 +324,9 @@ private: ///> imagelists uset to add a small coloured icon to signal names ///> and cursors name, the same color as the corresponding signal traces wxImageList* m_signalsIconColorList; + + ///> A string to store the path of saved workbooks during a session + static wxString m_savedWorkbooksPath; }; // Commands diff --git a/kicad/tree_project_frame.cpp b/kicad/tree_project_frame.cpp index e4b53cc690..a00bd98eeb 100644 --- a/kicad/tree_project_frame.cpp +++ b/kicad/tree_project_frame.cpp @@ -69,7 +69,8 @@ static const wxChar* s_allowedExtensionsToList[] = wxT( "^[^$].*\\.kicad_pcb$" ), // S format Pcbnew board files wxT( "^[^$].*\\.kicad_wks$" ), // S format kicad page layout descr files wxT( "^[^$].*\\.kicad_mod$" ), // S format kicad footprint files, currently not listed - wxT( "^.*\\.net$" ), + wxT( "^.*\\.net$" ), // pcbnew netlist file + wxT( "^.*\\.cir$" ), // Spice netlist file wxT( "^.*\\.lib$" ), // Schematic library file wxT( "^.*\\.txt$" ), wxT( "^.*\\.pho$" ), // Gerber file (Old Kicad extension)