Save last-used-paths in export dialogs.

Also fixes the export GenCAD dialog so that browse correctly updates
the textbox.

Fixes: lp:1793761
* https://bugs.launchpad.net/kicad/+bug/1793761
This commit is contained in:
Jeff Young 2019-08-02 21:03:03 -06:00
parent b8a03be869
commit 01e78b04c6
13 changed files with 173 additions and 182 deletions

View File

@ -1,12 +1,8 @@
/**
* @file dialog_export_idf.cpp
*/
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013-2015 Cirilo Bernardo * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -32,8 +28,6 @@
#include <class_board.h> #include <class_board.h>
#include <convert_to_biu.h> #include <convert_to_biu.h>
#include <widgets/text_ctrl_eval.h> #include <widgets/text_ctrl_eval.h>
// IDF export header generated by wxFormBuilder
#include <dialog_export_idf_base.h> #include <dialog_export_idf_base.h>
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <confirm.h> #include <confirm.h>
@ -181,14 +175,18 @@ bool DIALOG_EXPORT_IDF3::TransferDataFromWindow()
void PCB_EDIT_FRAME::OnExportIDF3( wxCommandEvent& event ) void PCB_EDIT_FRAME::OnExportIDF3( wxCommandEvent& event )
{ {
wxFileName fn; // Build default output file name
wxString path = GetLastPath( LAST_PATH_IDF );
// Build default file name if( path.IsEmpty() )
fn = GetBoard()->GetFileName(); {
fn.SetExt( wxT( "emn" ) ); wxFileName brdFile = GetBoard()->GetFileName();
brdFile.SetExt( "emn" );
path = brdFile.GetFullPath();
}
DIALOG_EXPORT_IDF3 dlg( this ); DIALOG_EXPORT_IDF3 dlg( this );
dlg.FilePicker()->SetPath( fn.GetFullPath() ); dlg.FilePicker()->SetPath( path );
if ( dlg.ShowModal() != wxID_OK ) if ( dlg.ShowModal() != wxID_OK )
return; return;
@ -221,6 +219,7 @@ void PCB_EDIT_FRAME::OnExportIDF3( wxCommandEvent& event )
wxBusyCursor dummy; wxBusyCursor dummy;
wxString fullFilename = dlg.FilePicker()->GetPath(); wxString fullFilename = dlg.FilePicker()->GetPath();
SetLastPath( LAST_PATH_IDF, fullFilename );
if( !Export_IDF3( GetBoard(), fullFilename, thou, aXRef, aYRef ) ) if( !Export_IDF3( GetBoard(), fullFilename, thou, aXRef, aYRef ) )
{ {

View File

@ -1,7 +1,3 @@
/**
* @file dialog_export_step.cpp
*/
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
@ -33,8 +29,6 @@
#include "kiface_i.h" #include "kiface_i.h"
#include "confirm.h" #include "confirm.h"
#include "reporter.h" #include "reporter.h"
#include "pcbnew.h"
#include "class_board.h" #include "class_board.h"
#include "dialog_export_step_base.h" #include "dialog_export_step_base.h"
#include <widgets/text_ctrl_eval.h> #include <widgets/text_ctrl_eval.h>
@ -124,9 +118,16 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString&
m_sdbSizer->Layout(); m_sdbSizer->Layout();
// Build default output file name // Build default output file name
wxString path = m_parent->GetLastPath( LAST_PATH_STEP );
if( path.IsEmpty() )
{
wxFileName brdFile = m_parent->GetBoard()->GetFileName(); wxFileName brdFile = m_parent->GetBoard()->GetFileName();
brdFile.SetExt( "step" ); brdFile.SetExt( "step" );
m_filePickerSTEP->SetPath( brdFile.GetFullPath() ); path = brdFile.GetFullPath();
}
m_filePickerSTEP->SetPath( path );
SetFocus(); SetFocus();
@ -226,6 +227,8 @@ extern bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines,
void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
{ {
m_parent->SetLastPath( LAST_PATH_STEP, m_filePickerSTEP->GetPath() );
SHAPE_POLY_SET outline; SHAPE_POLY_SET outline;
wxString msg; wxString msg;

View File

@ -187,33 +187,27 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
{ {
// These variables are static to keep info during the session. // These variables are static to keep info during the session.
static wxString subDirFor3Dshapes; 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, // Build default output file name
// do not use the old path, initialized by another board wxString path = GetLastPath( LAST_PATH_VRML );
if( last_brdName.IsEmpty() || last_brdName != GetBoard()->GetFileName() )
if( path.IsEmpty() )
{ {
last_brdName = GetBoard()->GetFileName(); wxFileName brdFile = GetBoard()->GetFileName();
last_vrmlName = last_brdName; brdFile.SetExt( "wrl" );
path = brdFile.GetFullPath();
} }
if( subDirFor3Dshapes.IsEmpty() ) if( subDirFor3Dshapes.IsEmpty() )
{
subDirFor3Dshapes = wxT( "shapes3D" ); subDirFor3Dshapes = wxT( "shapes3D" );
}
// The general VRML scale factor // The general VRML scale factor
// Assuming the VRML default unit is the mm // Assuming the VRML default unit is the mm
// this is the mm to VRML scaling factor for mm, 0.1 inch, and inch // 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 }; 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 ); DIALOG_EXPORT_3DFILE dlg( this );
dlg.FilePicker()->SetPath( fn.GetFullPath() ); dlg.FilePicker()->SetPath( path );
dlg.SetSubdir( subDirFor3Dshapes ); dlg.SetSubdir( subDirFor3Dshapes );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
@ -234,8 +228,10 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
bool useRelativePaths = dlg.GetUseRelativePathsOption(); bool useRelativePaths = dlg.GetUseRelativePathsOption();
bool usePlainPCB = dlg.GetUsePlainPCBOption(); bool usePlainPCB = dlg.GetUsePlainPCBOption();
last_vrmlName = dlg.FilePicker()->GetPath(); path = dlg.FilePicker()->GetPath();
wxFileName modelPath = last_vrmlName; SetLastPath( LAST_PATH_VRML, path );
wxFileName modelPath = path;
wxBusyCursor dummy; wxBusyCursor dummy;
subDirFor3Dshapes = dlg.GetSubdir3Dshapes(); subDirFor3Dshapes = dlg.GetSubdir3Dshapes();
@ -246,11 +242,11 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
modelPath.Mkdir(); modelPath.Mkdir();
} }
if( !ExportVRML_File( last_vrmlName, scale, export3DFiles, useRelativePaths, if( !ExportVRML_File( path, scale, export3DFiles, useRelativePaths,
usePlainPCB, modelPath.GetPath(), aXRef, aYRef ) ) usePlainPCB, modelPath.GetPath(), aXRef, aYRef ) )
{ {
wxString msg; wxString msg;
msg.Printf( _( "Unable to create file \"%s\"" ), GetChars( last_vrmlName ) ); msg.Printf( _( "Unable to create file \"%s\"" ), path );
wxMessageBox( msg ); wxMessageBox( msg );
return; return;
} }

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 CERN * 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 <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -31,41 +31,31 @@
#include <project.h> #include <project.h>
#include <confirm.h> #include <confirm.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <wx/filepicker.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/button.h>
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, : DIALOG_SHIM( aParent, wxID_ANY, _( "Export to GenCAD settings" ), wxDefaultPosition,
wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ) wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{ {
// Obtain a potential filename for the exported file
wxFileName fn = aParent->GetBoard()->GetFileName();
fn.SetExt( "cad" );
// Create widgets // Create widgets
SetSizeHints( wxSize( 500, 200 ), wxDefaultSize ); SetSizeHints( wxSize( 500, 200 ), wxDefaultSize );
wxBoxSizer* m_mainSizer= new wxBoxSizer( wxVERTICAL ); wxBoxSizer* m_mainSizer= new wxBoxSizer( wxVERTICAL );
wxBoxSizer* m_fileSizer = new wxBoxSizer( wxHORIZONTAL ); m_filePicker = new wxFilePickerCtrl( this, wxID_ANY, aPath,
_("Select a GenCAD export filename"),
m_filePath = new wxTextCtrl( this, wxID_ANY, fn.GetFullPath() ); GencadFileWildcard(),
m_fileSizer->Add( m_filePath, 1, wxEXPAND | wxRIGHT, 5 ); wxDefaultPosition, wxSize( -1,-1 ),
wxFLP_SAVE|wxFLP_USE_TEXTCTRL );
wxButton* m_browseBtn = new wxButton( this, wxID_ANY, _( "Browse" ) ); m_mainSizer->Add( m_filePicker, 0, wxEXPAND | wxRIGHT, 5 );
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_optsSizer = new wxGridSizer( 0, 1, 3, 3 ); m_optsSizer = new wxGridSizer( 0, 1, 3, 3 );
createOptCheckboxes(); createOptCheckboxes();
m_mainSizer->Add( m_optsSizer, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); m_mainSizer->Add( m_optsSizer, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
wxSizer* stdButtons = CreateSeparatedButtonSizer( wxOK | wxCANCEL ); wxSizer* stdButtons = CreateSeparatedButtonSizer( wxOK | wxCANCEL );
m_mainSizer->Add( stdButtons, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); m_mainSizer->Add( stdButtons, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
@ -109,7 +99,7 @@ std::map<GENCAD_EXPORT_OPT, bool> DIALOG_GENCAD_EXPORT_OPTIONS::GetAllOptions()
wxString DIALOG_GENCAD_EXPORT_OPTIONS::GetFileName() const wxString DIALOG_GENCAD_EXPORT_OPTIONS::GetFileName() const
{ {
return m_filePath->GetValue(); return m_filePicker->GetPath();
} }
@ -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() );
}

View File

@ -28,7 +28,7 @@
#include <dialog_shim.h> #include <dialog_shim.h>
class PCB_EDIT_FRAME; class PCB_EDIT_FRAME;
class wxTextCtrl; class wxFilePickerCtrl;
///> Settings for GenCAD exporter ///> Settings for GenCAD exporter
enum GENCAD_EXPORT_OPT enum GENCAD_EXPORT_OPT
@ -43,8 +43,8 @@ enum GENCAD_EXPORT_OPT
class DIALOG_GENCAD_EXPORT_OPTIONS : public DIALOG_SHIM class DIALOG_GENCAD_EXPORT_OPTIONS : public DIALOG_SHIM
{ {
public: public:
DIALOG_GENCAD_EXPORT_OPTIONS( PCB_EDIT_FRAME* aParent ); DIALOG_GENCAD_EXPORT_OPTIONS( PCB_EDIT_FRAME* aParent, const wxString& aPath );
~DIALOG_GENCAD_EXPORT_OPTIONS(); ~DIALOG_GENCAD_EXPORT_OPTIONS();
///> Checks whether an option has been selected ///> Checks whether an option has been selected
@ -56,20 +56,17 @@ class DIALOG_GENCAD_EXPORT_OPTIONS : public DIALOG_SHIM
///> Returns the selected file path ///> Returns the selected file path
wxString GetFileName() const; wxString GetFileName() const;
protected: protected:
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
///> Creates checkboxes for GenCAD export options ///> Creates checkboxes for GenCAD export options
void createOptCheckboxes(); void createOptCheckboxes();
///> Browse output file event handler
void onBrowse( wxCommandEvent& aEvent );
std::map<GENCAD_EXPORT_OPT, wxCheckBox*> m_options; std::map<GENCAD_EXPORT_OPT, wxCheckBox*> m_options;
// Widgets // Widgets
wxGridSizer* m_optsSizer; wxGridSizer* m_optsSizer;
wxTextCtrl* m_filePath; wxFilePickerCtrl* m_filePicker;
}; };
#endif //__DIALOG_GENCAD_EXPORT_OPTIONS_H__ #endif //__DIALOG_GENCAD_EXPORT_OPTIONS_H__

View File

@ -54,23 +54,13 @@
void PCB_EDIT_FRAME::InstallNetlistFrame() void PCB_EDIT_FRAME::InstallNetlistFrame()
{ {
wxString netlistName = GetLastNetListRead(); wxString netlistName = GetLastPath( LAST_PATH_NETLIST );
DIALOG_NETLIST dlg( this, netlistName ); DIALOG_NETLIST dlg( this, netlistName );
dlg.ShowModal(); dlg.ShowModal();
// Save project settings if needed. SetLastPath( LAST_PATH_NETLIST, netlistName );
// Project settings are saved in the corresponding <board name>.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 );
}
} }
@ -124,7 +114,7 @@ void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event )
{ {
wxString dirPath = wxFileName( Prj().GetProjectFullName() ).GetPath(); wxString dirPath = wxFileName( Prj().GetProjectFullName() ).GetPath();
wxString filename = m_parent->GetLastNetListRead(); wxString filename = m_parent->GetLastPath( LAST_PATH_NETLIST );
if( !filename.IsEmpty() ) if( !filename.IsEmpty() )
{ {

View File

@ -271,17 +271,29 @@ static double MapYTo( int aY )
/* Driver function: processing starts here */ /* Driver function: processing starts here */
void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) 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 ) if( optionsDialog.ShowModal() == wxID_CANCEL )
return; return;
FILE* file = wxFopen( optionsDialog.GetFileName(), "wt" ); path = optionsDialog.GetFileName();
SetLastPath( LAST_PATH_GENCAD, path );
FILE* file = wxFopen( path, "wt" );
if( !file ) if( !file )
{ {
DisplayError( this, wxString::Format( _( "Unable to create \"%s\"" ), DisplayError( this, wxString::Format( _( "Unable to create \"%s\"" ),
GetChars( optionsDialog.GetFileName() ) ) ); optionsDialog.GetFileName() ) );
return; return;
} }

View File

@ -72,7 +72,7 @@ bool PCB_EDIT_FRAME::ReadNetlistFromFile( const wxString &aFilename,
return false; return false;
} }
SetLastNetListRead( aFilename ); SetLastPath( LAST_PATH_NETLIST, aFilename );
netlistReader->LoadNetlist(); netlistReader->LoadNetlist();
LoadFootprints( aNetlist, aReporter ); LoadFootprints( aNetlist, aReporter );
} }
@ -83,7 +83,7 @@ bool PCB_EDIT_FRAME::ReadNetlistFromFile( const wxString &aFilename,
return false; return false;
} }
SetLastNetListRead( aFilename ); SetLastPath( LAST_PATH_NETLIST, aFilename );
return true; return true;
} }

View File

@ -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(); wxFileName pcbFileName = GetBoard()->GetFileName();
if( !absoluteFileName.MakeAbsolute( pcbFileName.GetPath() ) || !absoluteFileName.FileExists() ) absoluteFileName.MakeAbsolute( pcbFileName.GetPath() );
{
absoluteFileName.Clear();
m_lastNetListRead = wxEmptyString;
}
return absoluteFileName.GetFullPath(); 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(); wxFileName pcbFileName = GetBoard()->GetFileName();
if( relativeFileName.MakeRelativeTo( pcbFileName.GetPath() ) relativeFileName.MakeRelativeTo( pcbFileName.GetPath() );
&& relativeFileName.GetFullPath() != aLastNetListRead )
if( relativeFileName.GetFullPath() != m_lastPath[ aType ] )
{ {
m_lastNetListRead = relativeFileName.GetFullPath(); m_lastPath[ aType ] = relativeFileName.GetFullPath();
SaveProjectSettings( false );
} }
} }

View File

@ -73,6 +73,18 @@ enum TRACK_ACTION_RESULT
TRACK_ACTION_NONE //!< TRACK_ACTION_NONE - Nothing to change 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 * Class PCB_EDIT_FRAME
* is the main frame for Pcbnew. * is the main frame for Pcbnew.
@ -92,10 +104,10 @@ class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
protected: protected:
PCB_LAYER_WIDGET* m_Layers; 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; 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 // The Tool Framework initalization
void setupTools(); void setupTools();
@ -422,13 +434,13 @@ public:
wxConfigBase* GetSettings() { return config(); }; wxConfigBase* GetSettings() { return config(); };
/** /**
* Get the last net list read with the net list dialog box. * Get the last path for a particular type.
* @return - Absolute path and file name of the last net list file successfully read. * @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 * 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 * 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 * 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. * 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 OnCloseWindow( wxCloseEvent& Event ) override;
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void Tracks_and_Vias_Size_Event( 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 ReCreateHToolbar() override;
void ReCreateAuxiliaryToolbar() override; void ReCreateAuxiliaryToolbar() override;
void ReCreateVToolbar() override; void ReCreateVToolbar() override;

View File

@ -135,7 +135,23 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters()
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ), 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); GetBoard()->GetDesignSettings().AppendConfigs( GetBoard(), &m_projectFileParams);

View File

@ -40,19 +40,14 @@
#include <set> // std::set #include <set> // std::set
#include <map> // std::map #include <map> // std::map
#include <boost/utility.hpp> // boost::addressof()
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <class_edge_mod.h> #include <class_edge_mod.h>
#include <class_track.h> #include <class_track.h>
#include <class_zone.h> #include <class_zone.h>
#include <class_drawsegment.h>
#include <base_units.h> #include <base_units.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <collectors.h> #include <collectors.h>
#include <geometry/shape_poly_set.h> #include <geometry/shape_poly_set.h>
#include <geometry/convex_hull.h> #include <geometry/convex_hull.h>
#include <convert_basic_shapes_to_polygon.h> #include <convert_basic_shapes_to_polygon.h>

View File

@ -352,17 +352,26 @@ int PCB_EDITOR_CONTROL::ImportSpecctraSession( const TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ExportSpecctraDSN( const TOOL_EVENT& aEvent ) int PCB_EDITOR_CONTROL::ExportSpecctraDSN( const TOOL_EVENT& aEvent )
{ {
wxString fullFileName; wxString fullFileName = m_frame->GetLastPath( LAST_PATH_SPECCTRADSN );
wxFileName fn( frame()->GetBoard()->GetFileName() ); wxFileName fn;
if( fullFileName.IsEmpty() )
{
fn = m_frame->GetBoard()->GetFileName();
fn.SetExt( SpecctraDsnFileExtension ); fn.SetExt( SpecctraDsnFileExtension );
}
else
fn = fullFileName;
fullFileName = EDA_FILE_SELECTOR( _( "Specctra DSN File" ), fn.GetPath(), fn.GetFullName(), fullFileName = EDA_FILE_SELECTOR( _( "Specctra DSN File" ), fn.GetPath(), fn.GetFullName(),
SpecctraDsnFileExtension, SpecctraDsnFileWildcard(), SpecctraDsnFileExtension, SpecctraDsnFileWildcard(),
frame(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, false ); frame(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, false );
if( !fullFileName.IsEmpty() ) if( !fullFileName.IsEmpty() )
{
m_frame->SetLastPath( LAST_PATH_SPECCTRADSN, fullFileName );
getEditFrame<PCB_EDIT_FRAME>()->ExportSpecctraFile( fullFileName ); getEditFrame<PCB_EDIT_FRAME>()->ExportSpecctraFile( fullFileName );
}
return 0; return 0;
} }