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.
This commit is contained in:
jean-pierre charras 2016-09-17 09:34:16 +02:00
parent e8b244486a
commit 48f916bd63
3 changed files with 20 additions and 4 deletions

View File

@ -32,6 +32,7 @@
#include <widgets/tuner_slider.h>
#include <dialogs/dialog_signal_list.h>
#include "netlist_exporter_pspice_sim.h"
#include <pgm_base.h>
#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" ) );
}

View File

@ -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

View File

@ -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)