Fix bug: pcbnew: in Plot dialog, layer list gets duplicate after calling the drill dialog.

Fixes: lp:1703355
https://bugs.launchpad.net/kicad/+bug/1703355
This commit is contained in:
jean-pierre charras 2017-07-10 15:16:57 +02:00
parent a3fc0ef658
commit 2a301d5883
3 changed files with 21 additions and 8 deletions

View File

@ -46,14 +46,14 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
{ {
m_config = Kiface().KifaceSettings(); m_config = Kiface().KifaceSettings();
m_plotOpts = aParent->GetPlotSettings(); m_plotOpts = aParent->GetPlotSettings();
Init_Dialog(); init_Dialog();
GetSizer()->Fit( this ); GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
} }
void DIALOG_PLOT::Init_Dialog() void DIALOG_PLOT::init_Dialog()
{ {
wxString msg; wxString msg;
wxFileName fileName; wxFileName fileName;
@ -117,8 +117,6 @@ void DIALOG_PLOT::Init_Dialog()
// Set units for PS global width correction. // Set units for PS global width correction.
AddUnitSymbol( *m_textPSFineAdjustWidth, g_UserUnit ); AddUnitSymbol( *m_textPSFineAdjustWidth, g_UserUnit );
m_useAuxOriginCheckBox->SetValue( m_plotOpts.GetUseAuxOrigin() );
// Test for a reasonable scale value. Set to 1 if problem // Test for a reasonable scale value. Set to 1 if problem
if( m_XScaleAdjust < PLOT_MIN_SCALE || m_YScaleAdjust < PLOT_MIN_SCALE if( m_XScaleAdjust < PLOT_MIN_SCALE || m_YScaleAdjust < PLOT_MIN_SCALE
|| m_XScaleAdjust > PLOT_MAX_SCALE || m_YScaleAdjust > PLOT_MAX_SCALE ) || m_XScaleAdjust > PLOT_MAX_SCALE || m_YScaleAdjust > PLOT_MAX_SCALE )
@ -206,8 +204,9 @@ void DIALOG_PLOT::Init_Dialog()
// Put vias on mask layer // Put vias on mask layer
m_plotNoViaOnMaskOpt->SetValue( m_plotOpts.GetPlotViaOnMaskLayer() ); m_plotNoViaOnMaskOpt->SetValue( m_plotOpts.GetPlotViaOnMaskLayer() );
// Output directory // Initialize a few other parameters, which can also be modified
m_outputDirectoryName->SetValue( m_plotOpts.GetOutputDirectory() ); // from the drill dialog
reInitDialog();
// Update options values: // Update options values:
wxCommandEvent cmd_event; wxCommandEvent cmd_event;
@ -216,6 +215,18 @@ void DIALOG_PLOT::Init_Dialog()
} }
void DIALOG_PLOT::reInitDialog()
{
// after calling drill dialog, some parameters can be modified.
// update them
// Output directory
m_outputDirectoryName->SetValue( m_plotOpts.GetOutputDirectory() );
// Origin of coordinates:
m_useAuxOriginCheckBox->SetValue( m_plotOpts.GetUseAuxOrigin() );
}
void DIALOG_PLOT::OnQuit( wxCommandEvent& event ) void DIALOG_PLOT::OnQuit( wxCommandEvent& event )
{ {
Close( true ); // true is to force the frame to close Close( true ); // true is to force the frame to close
@ -297,7 +308,7 @@ void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
// a few plot settings can be modified: take them in account // a few plot settings can be modified: take them in account
m_plotOpts = m_parent->GetPlotSettings(); m_plotOpts = m_parent->GetPlotSettings();
Init_Dialog(); reInitDialog();
} }

View File

@ -58,7 +58,6 @@ private:
PCB_PLOT_PARAMS m_plotOpts; PCB_PLOT_PARAMS m_plotOpts;
// Event called functions // Event called functions
void Init_Dialog();
void Plot( wxCommandEvent& event ) override; void Plot( wxCommandEvent& event ) override;
void OnQuit( wxCommandEvent& event ) override; void OnQuit( wxCommandEvent& event ) override;
void OnClose( wxCloseEvent& event ) override; void OnClose( wxCloseEvent& event ) override;
@ -73,6 +72,8 @@ private:
void onRunDRC( wxCommandEvent& event ) override; void onRunDRC( wxCommandEvent& event ) override;
// other functions // other functions
void init_Dialog(); // main initialization
void reInitDialog(); // initialization after calling drill dialog
void applyPlotSettings(); void applyPlotSettings();
PlotFormat getPlotFormat(); PlotFormat getPlotFormat();

View File

@ -113,6 +113,7 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
} }
wxPoint gridOrigin; wxPoint gridOrigin;
if( !getGridOrigin( gridOrigin ) ) if( !getGridOrigin( gridOrigin ) )
{ {
wxMessageBox( wxString::Format( _( "Incorrect grid origin " wxMessageBox( wxString::Format( _( "Incorrect grid origin "