diff --git a/pcbnew/dialogs/dialog_export_idf.cpp b/pcbnew/dialogs/dialog_export_idf.cpp index 882224b7c5..a9c92ff247 100644 --- a/pcbnew/dialogs/dialog_export_idf.cpp +++ b/pcbnew/dialogs/dialog_export_idf.cpp @@ -1,12 +1,8 @@ -/** - * @file dialog_export_idf.cpp - */ - /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013-2015 Cirilo Bernardo - * Copyright (C) 2013-2017 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2013-2019 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -32,8 +28,6 @@ #include #include #include - -// IDF export header generated by wxFormBuilder #include #include #include @@ -181,14 +175,18 @@ bool DIALOG_EXPORT_IDF3::TransferDataFromWindow() void PCB_EDIT_FRAME::OnExportIDF3( wxCommandEvent& event ) { - wxFileName fn; + // Build default output file name + wxString path = GetLastPath( LAST_PATH_IDF ); - // Build default file name - fn = GetBoard()->GetFileName(); - fn.SetExt( wxT( "emn" ) ); + if( path.IsEmpty() ) + { + wxFileName brdFile = GetBoard()->GetFileName(); + brdFile.SetExt( "emn" ); + path = brdFile.GetFullPath(); + } DIALOG_EXPORT_IDF3 dlg( this ); - dlg.FilePicker()->SetPath( fn.GetFullPath() ); + dlg.FilePicker()->SetPath( path ); if ( dlg.ShowModal() != wxID_OK ) return; @@ -221,6 +219,7 @@ void PCB_EDIT_FRAME::OnExportIDF3( wxCommandEvent& event ) wxBusyCursor dummy; wxString fullFilename = dlg.FilePicker()->GetPath(); + SetLastPath( LAST_PATH_IDF, fullFilename ); if( !Export_IDF3( GetBoard(), fullFilename, thou, aXRef, aYRef ) ) { diff --git a/pcbnew/dialogs/dialog_export_step.cpp b/pcbnew/dialogs/dialog_export_step.cpp index a3338838cc..3312c35f3a 100644 --- a/pcbnew/dialogs/dialog_export_step.cpp +++ b/pcbnew/dialogs/dialog_export_step.cpp @@ -1,7 +1,3 @@ -/** - * @file dialog_export_step.cpp - */ - /* * This program source code file is part of KiCad, a free EDA CAD application. * @@ -33,8 +29,6 @@ #include "kiface_i.h" #include "confirm.h" #include "reporter.h" - -#include "pcbnew.h" #include "class_board.h" #include "dialog_export_step_base.h" #include @@ -124,9 +118,16 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString& m_sdbSizer->Layout(); // Build default output file name - wxFileName brdFile = m_parent->GetBoard()->GetFileName(); - brdFile.SetExt( "step" ); - m_filePickerSTEP->SetPath( brdFile.GetFullPath() ); + wxString path = m_parent->GetLastPath( LAST_PATH_STEP ); + + if( path.IsEmpty() ) + { + wxFileName brdFile = m_parent->GetBoard()->GetFileName(); + brdFile.SetExt( "step" ); + path = brdFile.GetFullPath(); + } + + m_filePickerSTEP->SetPath( path ); SetFocus(); @@ -226,6 +227,8 @@ extern bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) { + m_parent->SetLastPath( LAST_PATH_STEP, m_filePickerSTEP->GetPath() ); + SHAPE_POLY_SET outline; wxString msg; diff --git a/pcbnew/dialogs/dialog_export_vrml.cpp b/pcbnew/dialogs/dialog_export_vrml.cpp index 7119a458df..e387c41ac8 100644 --- a/pcbnew/dialogs/dialog_export_vrml.cpp +++ b/pcbnew/dialogs/dialog_export_vrml.cpp @@ -187,33 +187,27 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event ) { // These variables are static to keep info during the session. static wxString subDirFor3Dshapes; - static wxString last_brdName; // the last board name used to build the vrml filename - static wxString last_vrmlName; // the last wrml file name built - // If the board name has changed since the last export, - // do not use the old path, initialized by another board - if( last_brdName.IsEmpty() || last_brdName != GetBoard()->GetFileName() ) + // Build default output file name + wxString path = GetLastPath( LAST_PATH_VRML ); + + if( path.IsEmpty() ) { - last_brdName = GetBoard()->GetFileName(); - last_vrmlName = last_brdName; + wxFileName brdFile = GetBoard()->GetFileName(); + brdFile.SetExt( "wrl" ); + path = brdFile.GetFullPath(); } if( subDirFor3Dshapes.IsEmpty() ) - { subDirFor3Dshapes = wxT( "shapes3D" ); - } // The general VRML scale factor // Assuming the VRML default unit is the mm // this is the mm to VRML scaling factor for mm, 0.1 inch, and inch double scaleList[4] = { 1.0, 0.001, 10.0/25.4, 1.0/25.4 }; - // Build default file name, to display in the file picker - wxFileName fn = last_vrmlName; - fn.SetExt( wxT( "wrl" ) ); - DIALOG_EXPORT_3DFILE dlg( this ); - dlg.FilePicker()->SetPath( fn.GetFullPath() ); + dlg.FilePicker()->SetPath( path ); dlg.SetSubdir( subDirFor3Dshapes ); if( dlg.ShowModal() != wxID_OK ) @@ -234,8 +228,10 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event ) bool useRelativePaths = dlg.GetUseRelativePathsOption(); bool usePlainPCB = dlg.GetUsePlainPCBOption(); - last_vrmlName = dlg.FilePicker()->GetPath(); - wxFileName modelPath = last_vrmlName; + path = dlg.FilePicker()->GetPath(); + SetLastPath( LAST_PATH_VRML, path ); + wxFileName modelPath = path; + wxBusyCursor dummy; subDirFor3Dshapes = dlg.GetSubdir3Dshapes(); @@ -246,11 +242,11 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event ) modelPath.Mkdir(); } - if( !ExportVRML_File( last_vrmlName, scale, export3DFiles, useRelativePaths, + if( !ExportVRML_File( path, scale, export3DFiles, useRelativePaths, usePlainPCB, modelPath.GetPath(), aXRef, aYRef ) ) { wxString msg; - msg.Printf( _( "Unable to create file \"%s\"" ), GetChars( last_vrmlName ) ); + msg.Printf( _( "Unable to create file \"%s\"" ), path ); wxMessageBox( msg ); return; } diff --git a/pcbnew/dialogs/dialog_gencad_export_options.cpp b/pcbnew/dialogs/dialog_gencad_export_options.cpp index af23b9f73b..681a45a070 100644 --- a/pcbnew/dialogs/dialog_gencad_export_options.cpp +++ b/pcbnew/dialogs/dialog_gencad_export_options.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 CERN - * Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2018-2019 KiCad Developers, see change_log.txt for contributors. * * @author Maciej Suminski * @@ -31,41 +31,31 @@ #include #include #include - +#include #include -#include -DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_OPTIONS( PCB_EDIT_FRAME* aParent ) + +DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_OPTIONS( PCB_EDIT_FRAME* aParent, + const wxString& aPath ) : DIALOG_SHIM( aParent, wxID_ANY, _( "Export to GenCAD settings" ), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ) { - // Obtain a potential filename for the exported file - wxFileName fn = aParent->GetBoard()->GetFileName(); - fn.SetExt( "cad" ); - // Create widgets SetSizeHints( wxSize( 500, 200 ), wxDefaultSize ); wxBoxSizer* m_mainSizer= new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* m_fileSizer = new wxBoxSizer( wxHORIZONTAL ); - - m_filePath = new wxTextCtrl( this, wxID_ANY, fn.GetFullPath() ); - m_fileSizer->Add( m_filePath, 1, wxEXPAND | wxRIGHT, 5 ); - - wxButton* m_browseBtn = new wxButton( this, wxID_ANY, _( "Browse" ) ); - m_browseBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler( DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse ), NULL, this ); - m_fileSizer->Add( m_browseBtn, 0 ); - - m_mainSizer->Add( m_fileSizer, 0, wxEXPAND | wxALL, 5 ); - + m_filePicker = new wxFilePickerCtrl( this, wxID_ANY, aPath, + _("Select a GenCAD export filename"), + GencadFileWildcard(), + wxDefaultPosition, wxSize( -1,-1 ), + wxFLP_SAVE|wxFLP_USE_TEXTCTRL ); + m_mainSizer->Add( m_filePicker, 0, wxEXPAND | wxRIGHT, 5 ); m_optsSizer = new wxGridSizer( 0, 1, 3, 3 ); createOptCheckboxes(); m_mainSizer->Add( m_optsSizer, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); - wxSizer* stdButtons = CreateSeparatedButtonSizer( wxOK | wxCANCEL ); m_mainSizer->Add( stdButtons, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); @@ -109,7 +99,7 @@ std::map DIALOG_GENCAD_EXPORT_OPTIONS::GetAllOptions() wxString DIALOG_GENCAD_EXPORT_OPTIONS::GetFileName() const { - return m_filePath->GetValue(); + return m_filePicker->GetPath(); } @@ -138,11 +128,11 @@ void DIALOG_GENCAD_EXPORT_OPTIONS::createOptCheckboxes() { std::map opts = { - { FLIP_BOTTOM_PADS, _( "Flip bottom footprint padstacks" ) }, - { UNIQUE_PIN_NAMES, _( "Generate unique pin names" ) }, - { INDIVIDUAL_SHAPES, _( "Generate a new shape for each footprint instance (do not reuse shapes)" ) }, - { USE_AUX_ORIGIN, _( "Use auxiliary axis as origin" ) }, - { STORE_ORIGIN_COORDS, _( "Save the origin coordinates in the file" ) } + { FLIP_BOTTOM_PADS, _( "Flip bottom footprint padstacks" ) }, + { UNIQUE_PIN_NAMES, _( "Generate unique pin names" ) }, + { INDIVIDUAL_SHAPES, _( "Generate a new shape for each footprint instance (do not reuse shapes)" ) }, + { USE_AUX_ORIGIN, _( "Use auxiliary axis as origin" ) }, + { STORE_ORIGIN_COORDS, _( "Save the origin coordinates in the file" ) } }; for( const auto& option : opts ) @@ -153,17 +143,3 @@ void DIALOG_GENCAD_EXPORT_OPTIONS::createOptCheckboxes() } } - -void DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse( wxCommandEvent& aEvent ) -{ - wxFileDialog dlg( this, _( "Save GenCAD Board File" ), - wxPathOnly( Prj().GetProjectFullName() ), - m_filePath->GetValue(), - GencadFileWildcard(), - wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - - if( dlg.ShowModal() == wxID_CANCEL ) - return; - - m_filePath->SetValue( dlg.GetPath() ); -} diff --git a/pcbnew/dialogs/dialog_gencad_export_options.h b/pcbnew/dialogs/dialog_gencad_export_options.h index a0d01c237a..d686f18714 100644 --- a/pcbnew/dialogs/dialog_gencad_export_options.h +++ b/pcbnew/dialogs/dialog_gencad_export_options.h @@ -28,7 +28,7 @@ #include class PCB_EDIT_FRAME; -class wxTextCtrl; +class wxFilePickerCtrl; ///> Settings for GenCAD exporter enum GENCAD_EXPORT_OPT @@ -43,33 +43,30 @@ enum GENCAD_EXPORT_OPT class DIALOG_GENCAD_EXPORT_OPTIONS : public DIALOG_SHIM { - public: - DIALOG_GENCAD_EXPORT_OPTIONS( PCB_EDIT_FRAME* aParent ); - ~DIALOG_GENCAD_EXPORT_OPTIONS(); +public: + DIALOG_GENCAD_EXPORT_OPTIONS( PCB_EDIT_FRAME* aParent, const wxString& aPath ); + ~DIALOG_GENCAD_EXPORT_OPTIONS(); - ///> Checks whether an option has been selected - bool GetOption( GENCAD_EXPORT_OPT aOption ) const; + ///> Checks whether an option has been selected + bool GetOption( GENCAD_EXPORT_OPT aOption ) const; - ///> Returns all export settings - std::map GetAllOptions() const; + ///> Returns all export settings + std::map GetAllOptions() const; - ///> Returns the selected file path - wxString GetFileName() const; + ///> Returns the selected file path + wxString GetFileName() const; - protected: - bool TransferDataFromWindow() override; +protected: + bool TransferDataFromWindow() override; - ///> Creates checkboxes for GenCAD export options - void createOptCheckboxes(); + ///> Creates checkboxes for GenCAD export options + void createOptCheckboxes(); - ///> Browse output file event handler - void onBrowse( wxCommandEvent& aEvent ); + std::map m_options; - std::map m_options; - - // Widgets - wxGridSizer* m_optsSizer; - wxTextCtrl* m_filePath; + // Widgets + wxGridSizer* m_optsSizer; + wxFilePickerCtrl* m_filePicker; }; #endif //__DIALOG_GENCAD_EXPORT_OPTIONS_H__ diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index a967883264..aa869c839d 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -54,23 +54,13 @@ void PCB_EDIT_FRAME::InstallNetlistFrame() { - wxString netlistName = GetLastNetListRead(); + wxString netlistName = GetLastPath( LAST_PATH_NETLIST ); DIALOG_NETLIST dlg( this, netlistName ); dlg.ShowModal(); - // Save project settings if needed. - // Project settings are saved in the corresponding .pro file - bool configChanged = !GetLastNetListRead().IsEmpty() && ( netlistName != GetLastNetListRead() ); - - if( configChanged && !GetBoard()->GetFileName().IsEmpty() ) - { - wxFileName fn = Prj().AbsolutePath( GetBoard()->GetFileName() ); - fn.SetExt( ProjectFileExtension ); - wxString path = fn.GetFullPath(); - Prj().ConfigSave( Kiface().KifaceSearch(), GROUP_PCB, GetProjectFileParameters(), path ); - } + SetLastPath( LAST_PATH_NETLIST, netlistName ); } @@ -124,7 +114,7 @@ void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event ) { wxString dirPath = wxFileName( Prj().GetProjectFullName() ).GetPath(); - wxString filename = m_parent->GetLastNetListRead(); + wxString filename = m_parent->GetLastPath( LAST_PATH_NETLIST ); if( !filename.IsEmpty() ) { diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index 138ad30217..6cb69a34a6 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -271,17 +271,29 @@ static double MapYTo( int aY ) /* Driver function: processing starts here */ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) { - DIALOG_GENCAD_EXPORT_OPTIONS optionsDialog( this ); + // Build default output file name + wxString path = GetLastPath( LAST_PATH_GENCAD ); + + if( path.IsEmpty() ) + { + wxFileName brdFile = GetBoard()->GetFileName(); + brdFile.SetExt( "cad" ); + path = brdFile.GetFullPath(); + } + + DIALOG_GENCAD_EXPORT_OPTIONS optionsDialog( this, path ); if( optionsDialog.ShowModal() == wxID_CANCEL ) return; - FILE* file = wxFopen( optionsDialog.GetFileName(), "wt" ); + path = optionsDialog.GetFileName(); + SetLastPath( LAST_PATH_GENCAD, path ); + FILE* file = wxFopen( path, "wt" ); if( !file ) { DisplayError( this, wxString::Format( _( "Unable to create \"%s\"" ), - GetChars( optionsDialog.GetFileName() ) ) ); + optionsDialog.GetFileName() ) ); return; } diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 7d46208fe1..db9d6e58db 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -72,7 +72,7 @@ bool PCB_EDIT_FRAME::ReadNetlistFromFile( const wxString &aFilename, return false; } - SetLastNetListRead( aFilename ); + SetLastPath( LAST_PATH_NETLIST, aFilename ); netlistReader->LoadNetlist(); LoadFootprints( aNetlist, aReporter ); } @@ -83,7 +83,7 @@ bool PCB_EDIT_FRAME::ReadNetlistFromFile( const wxString &aFilename, return false; } - SetLastNetListRead( aFilename ); + SetLastPath( LAST_PATH_NETLIST, aFilename ); return true; } diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 78b50b81ea..408e5517d9 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -754,30 +754,30 @@ void PCB_EDIT_FRAME::ShowChangedLanguage() } -wxString PCB_EDIT_FRAME::GetLastNetListRead() +wxString PCB_EDIT_FRAME::GetLastPath( LAST_PATH_TYPE aType ) { - wxFileName absoluteFileName = m_lastNetListRead; + if( m_lastPath[ aType ].IsEmpty() ) + return wxEmptyString; + + wxFileName absoluteFileName = m_lastPath[ aType ]; wxFileName pcbFileName = GetBoard()->GetFileName(); - if( !absoluteFileName.MakeAbsolute( pcbFileName.GetPath() ) || !absoluteFileName.FileExists() ) - { - absoluteFileName.Clear(); - m_lastNetListRead = wxEmptyString; - } - + absoluteFileName.MakeAbsolute( pcbFileName.GetPath() ); return absoluteFileName.GetFullPath(); } -void PCB_EDIT_FRAME::SetLastNetListRead( const wxString& aLastNetListRead ) +void PCB_EDIT_FRAME::SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPath ) { - wxFileName relativeFileName = aLastNetListRead; + wxFileName relativeFileName = aLastPath; wxFileName pcbFileName = GetBoard()->GetFileName(); - if( relativeFileName.MakeRelativeTo( pcbFileName.GetPath() ) - && relativeFileName.GetFullPath() != aLastNetListRead ) + relativeFileName.MakeRelativeTo( pcbFileName.GetPath() ); + + if( relativeFileName.GetFullPath() != m_lastPath[ aType ] ) { - m_lastNetListRead = relativeFileName.GetFullPath(); + m_lastPath[ aType ] = relativeFileName.GetFullPath(); + SaveProjectSettings( false ); } } diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index ff58ab10af..f246160bf7 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -73,6 +73,18 @@ enum TRACK_ACTION_RESULT TRACK_ACTION_NONE //!< TRACK_ACTION_NONE - Nothing to change }; +enum LAST_PATH_TYPE +{ + LAST_PATH_NETLIST = 0, + LAST_PATH_STEP, + LAST_PATH_IDF, + LAST_PATH_VRML, + LAST_PATH_SPECCTRADSN, + LAST_PATH_GENCAD, + + LAST_PATH_SIZE +}; + /** * Class PCB_EDIT_FRAME * is the main frame for Pcbnew. @@ -92,10 +104,10 @@ class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME protected: PCB_LAYER_WIDGET* m_Layers; - PARAM_CFG_ARRAY m_configParams; ///< List of Pcbnew configuration settings. + PARAM_CFG_ARRAY m_configParams; // List of Pcbnew configuration settings. PARAM_CFG_ARRAY m_projectFileParams; - wxString m_lastNetListRead; ///< Last net list read with relative path. + wxString m_lastPath[ LAST_PATH_SIZE ]; // The Tool Framework initalization void setupTools(); @@ -422,13 +434,13 @@ public: wxConfigBase* GetSettings() { return config(); }; /** - * Get the last net list read with the net list dialog box. - * @return - Absolute path and file name of the last net list file successfully read. + * Get the last path for a particular type. + * @return - Absolute path and file name of the last file successfully read. */ - wxString GetLastNetListRead(); + wxString GetLastPath( LAST_PATH_TYPE aType ); /** - * Set the last net list successfully read by the net list dialog box. + * Set the path of the last file successfully read. * * Note: the file path is converted to a path relative to the project file path. If * the path cannot be made relative, than m_lastNetListRead is set to and empty @@ -436,28 +448,14 @@ public: * the project file. The advantage of relative paths is that is more likely to * work when opening the same project from both Windows and Linux. * - * @param aNetListFile - The last net list file with full path successfully read. + * @param aLastPath - The last file with full path successfully read. */ - void SetLastNetListRead( const wxString& aNetListFile ); + void SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPath ); void OnCloseWindow( wxCloseEvent& Event ) override; void Process_Special_Functions( wxCommandEvent& event ); void Tracks_and_Vias_Size_Event( wxCommandEvent& event ); - /** - * Function OnEditTextAndGraphics - * Dialog for editing properties of text and graphic items, selected by type, layer, - * and/or parent footprint. - */ - void OnEditTextAndGraphics( wxCommandEvent& event ); - - /** - * Function OnEditTracksAndVias - * Dialog for editing the properties of tracks and vias, selected by net, netclass, - * and/or layer. - */ - void OnEditTracksAndVias( wxCommandEvent& event ); - void ReCreateHToolbar() override; void ReCreateAuxiliaryToolbar() override; void ReCreateVToolbar() override; diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 8b577538ef..c61d19ef4e 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -133,9 +133,25 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters() // so pointers into that cannot be saved for long. m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), - &BASE_SCREEN::m_PageLayoutDescrFileName ) ); + &BASE_SCREEN::m_PageLayoutDescrFileName ) ); - m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) ); + m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), + &m_lastPath[ LAST_PATH_NETLIST ] ) ); + + m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LastSTEPExportPath" ), + &m_lastPath[ LAST_PATH_STEP ] ) ); + + m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LastIDFExportPath" ), + &m_lastPath[ LAST_PATH_IDF ] ) ); + + m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LastVRMLExportPath" ), + &m_lastPath[ LAST_PATH_VRML ] ) ); + + m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LastSpecctraDSNExportPath" ), + &m_lastPath[ LAST_PATH_SPECCTRADSN ] ) ); + + m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LastGenCADExportPath" ), + &m_lastPath[ LAST_PATH_GENCAD ] ) ); GetBoard()->GetDesignSettings().AppendConfigs( GetBoard(), &m_projectFileParams); @@ -153,40 +169,40 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() &m_PolarCoords, false ) ); // Display options and modes: m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ), - &displ_opts->m_DisplayNetNamesMode, 3, 0, 3 ) ); + &displ_opts->m_DisplayNetNamesMode, 3, 0, 3 ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ), - &displ_opts->m_DisplayPcbTrackFill, true ) ); + &displ_opts->m_DisplayPcbTrackFill, true ) ); m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ), - (int*) &displ_opts->m_ShowTrackClearanceMode, - PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) ); + (int*) &displ_opts->m_ShowTrackClearanceMode, + PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ), - &displ_opts->m_DisplayPadFill, true ) ); + &displ_opts->m_DisplayPadFill, true ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ), - &displ_opts->m_DisplayViaFill, true ) ); + &displ_opts->m_DisplayViaFill, true ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PadAffG" ), - &displ_opts->m_DisplayPadIsol, true ) ); + &displ_opts->m_DisplayPadIsol, true ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ), - &displ_opts->m_DisplayPadNum, true ) ); + &displ_opts->m_DisplayPadNum, true ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffC" ), - &displ_opts->m_DisplayModEdgeFill, FILLED ) ); + &displ_opts->m_DisplayModEdgeFill, FILLED ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffT" ), - &displ_opts->m_DisplayModTextFill, FILLED ) ); + &displ_opts->m_DisplayModTextFill, FILLED ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PcbAffT" ), - &displ_opts->m_DisplayDrawItemsFill, FILLED ) ); + &displ_opts->m_DisplayDrawItemsFill, FILLED ) ); m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), - &displ_opts->m_DisplayZonesMode, 0, 0, 2 ) ); + &displ_opts->m_DisplayZonesMode, 0, 0, 2 ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "CurvedRatsnestLines" ), - &displ_opts->m_DisplayRatsnestLinesCurved, false ) ); + &displ_opts->m_DisplayRatsnestLinesCurved, false ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ShowRatsnestLines" ), - &displ_opts->m_ShowGlobalRatsnest, true) ); + &displ_opts->m_ShowGlobalRatsnest, true) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ShowRatsnestModuleLines" ), - &displ_opts->m_ShowModuleRatsnest, true) ); + &displ_opts->m_ShowModuleRatsnest, true) ); // Miscellaneous: m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), - &m_rotationAngle, 900, 1, 900 ) ); + &m_rotationAngle, 900, 1, 900 ) ); m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ), - &displ_opts->m_MaxLinksShowed, 3, 0, 15 ) ); + &displ_opts->m_MaxLinksShowed, 3, 0, 15 ) ); } return m_configParams; diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index 0759727d74..ab33b099e3 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -40,19 +40,14 @@ #include // std::set #include // std::map -#include // boost::addressof() - #include #include #include #include #include -#include #include #include - #include - #include #include #include @@ -104,7 +99,7 @@ bool PCB_EDIT_FRAME::ExportSpecctraFile( const wxString& aFullFilename ) { GetBoard()->SynchronizeNetsAndNetClasses(); db.FromBOARD( GetBoard() ); - db.ExportPCB( aFullFilename, true ); + db.ExportPCB( aFullFilename, true ); // if an exception is thrown by FromBOARD or ExportPCB(), then // ~SPECCTRA_DB() will close the file. diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 1b9214fe2f..93b7d0ca78 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -352,17 +352,26 @@ int PCB_EDITOR_CONTROL::ImportSpecctraSession( const TOOL_EVENT& aEvent ) int PCB_EDITOR_CONTROL::ExportSpecctraDSN( const TOOL_EVENT& aEvent ) { - wxString fullFileName; - wxFileName fn( frame()->GetBoard()->GetFileName() ); + wxString fullFileName = m_frame->GetLastPath( LAST_PATH_SPECCTRADSN ); + wxFileName fn; - fn.SetExt( SpecctraDsnFileExtension ); + if( fullFileName.IsEmpty() ) + { + fn = m_frame->GetBoard()->GetFileName(); + fn.SetExt( SpecctraDsnFileExtension ); + } + else + fn = fullFileName; fullFileName = EDA_FILE_SELECTOR( _( "Specctra DSN File" ), fn.GetPath(), fn.GetFullName(), SpecctraDsnFileExtension, SpecctraDsnFileWildcard(), frame(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, false ); if( !fullFileName.IsEmpty() ) + { + m_frame->SetLastPath( LAST_PATH_SPECCTRADSN, fullFileName ); getEditFrame()->ExportSpecctraFile( fullFileName ); + } return 0; }