From ba6100e37e1d1c8b2a5f1bf60802e374910f6ce3 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 22 Mar 2011 18:58:58 +0100 Subject: [PATCH] Pcbnew: fix a minor issue: *.pro file updated by Pcbnew only on demand. --- pcbnew/dialogs/dialog_netlist.cpp | 19 +++++++++++++++++-- pcbnew/pcbframe.cpp | 7 ------- pcbnew/pcbnew_config.cpp | 2 +- pcbnew/pcbplot.cpp | 8 ++++---- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index fbbc0741c1..805681fd59 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -5,10 +5,12 @@ ///////////////////////////////////////////////////////////////////////////// #include "fctsys.h" +#include "appl_wxstruct.h" #include "common.h" +#include "confirm.h" #include "pcbnew.h" #include "wxPcbStruct.h" - +#include "pcbnew_config.h" #include "dialog_netlist.h" @@ -24,6 +26,7 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC, const wxPoint& pos ) * name if no last file read is not set. */ wxFileName fn = GetLastNetListRead(); + wxString lastNetlistName = GetLastNetListRead(); if( !fn.FileExists() ) { @@ -31,9 +34,21 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC, const wxPoint& pos ) fn.SetExt( NetExtBuffer ); } - DIALOG_NETLIST frame( this, DC, fn.GetFullPath() ); + DIALOG_NETLIST frame( this, DC, lastNetlistName ); frame.ShowModal(); + + // Save project settings if needed. + // Project settings are saved in the corresponding .pro file + if( lastNetlistName != GetLastNetListRead() && + !GetScreen()->GetFileName().IsEmpty() && + IsOK(NULL, _("Project config has changed. Save it ?") ) ) + { + wxFileName fn = GetScreen()->GetFileName(); + fn.SetExt( ProjectFileExtension ); + wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, + GetProjectFileParameters() ); + } } diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index b3e996411d..f0cb614777 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -467,13 +467,6 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) } } - if( !GetScreen()->GetFileName().IsEmpty() ) - { - wxFileName fn = GetScreen()->GetFileName(); - fn.SetExt( ProjectFileExtension ); - wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() ); - } - SaveSettings(); // do not show the window because ScreenPcb will be deleted and we do not diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 03c6f0d2ac..5a2047d990 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -231,7 +231,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters() 120, 0, 0xFFFF ) ); m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "MSegLar" ), &g_ModuleSegmentWidth, 120, 0, 0xFFFF ) ); - m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "LastNetListRead" ), + m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) ); return m_projectFileParams; } diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 5899227528..7040e859c1 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -19,7 +19,6 @@ #include "dialog_plot_base.h" #include "pcb_plot_params.h" - /* Keywords to r/w options in m_Config */ #define CONFIG_XFINESCALE_ADJ wxT( "PlotXFineScaleAdj" ) #define CONFIG_YFINESCALE_ADJ wxT( "PlotYFineScaleAdj" ) @@ -57,10 +56,10 @@ class DIALOG_PLOT : public DIALOG_PLOT_BASE private: PCB_EDIT_FRAME* m_Parent; wxConfig* m_Config; - std::vector layerList; // List to hold CheckListBox layer numbers + std::vector layerList; // List to hold CheckListBox layer numbers double m_XScaleAdjust; double m_YScaleAdjust; - static wxPoint prevPosition; // Dialog position & size + static wxPoint prevPosition; // Dialog position & size static wxSize prevSize; public: DIALOG_PLOT( PCB_EDIT_FRAME* parent ); @@ -235,6 +234,7 @@ void DIALOG_PLOT::OnClose( wxCloseEvent& event ) prevPosition = GetPosition(); prevSize = GetSize(); applyPlotSettings(); + EndModal( 0 ); } @@ -260,7 +260,7 @@ void DIALOG_PLOT::OnSetScaleOpt( wxCommandEvent& event ) void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { // Build the absolute path of current output plot directory - // to preselect it when opening the Di Dialog. + // to preselect it when opening the dialog. wxFileName fn( m_outputDirectoryName->GetValue() ); wxString path; if( fn.IsRelative() )