From 8031e512e686e56ec1614f1602392511d0b96df0 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 5 Oct 2012 21:04:17 +0200 Subject: [PATCH] Dialog drill file: remove precision choice, because only one choice was acceptable (the option with the smallest number of digits for coordinates created unacceptable truncation coordinates in Excellon drill files) --- pcbnew/dialogs/dialog_gendrill.cpp | 43 ++---- pcbnew/dialogs/dialog_gendrill.h | 1 - pcbnew/dialogs/dialog_gendrill_base.cpp | 18 +-- pcbnew/dialogs/dialog_gendrill_base.fbp | 173 ++++++++++++------------ pcbnew/dialogs/dialog_gendrill_base.h | 4 +- 5 files changed, 111 insertions(+), 128 deletions(-) diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 3b84202876..148f891f8a 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -51,18 +51,9 @@ // list of allowed precision for EXCELLON files, for integer format: // Due to difference between inches and mm, -// there are 2 set of reasonnable precision values, one for inches and one for metric -static DRILL_PRECISION precisionListForInches[] = -{ - DRILL_PRECISION( 2, 3 ), DRILL_PRECISION( 2, 4 ) -}; - -static DRILL_PRECISION precisionListForMetric[] = -{ - DRILL_PRECISION( 3, 2 ), DRILL_PRECISION( 3, 3 ) -}; - - +// there are 2 precision values, one for inches and one for metric +static DRILL_PRECISION precisionListForInches( 2, 4 ); +static DRILL_PRECISION precisionListForMetric( 3, 3 ); /* This function displays the dialog frame for drill tools @@ -96,7 +87,6 @@ int DIALOG_GENDRILL::m_ZerosFormat = EXCELLON_WRITER::DECIMAL_FORMAT; bool DIALOG_GENDRILL::m_MinimalHeader = false; bool DIALOG_GENDRILL::m_Mirror = false; bool DIALOG_GENDRILL::m_DrillOriginIsAuxAxis = false; -int DIALOG_GENDRILL::m_PrecisionFormat = 1; int DIALOG_GENDRILL::m_mapFileType = 1; @@ -109,7 +99,6 @@ DIALOG_GENDRILL::~DIALOG_GENDRILL() void DIALOG_GENDRILL::initDialog() { m_config->Read( ZerosFormatKey, &DIALOG_GENDRILL::m_ZerosFormat ); - m_config->Read( PrecisionKey, &DIALOG_GENDRILL::m_PrecisionFormat ); m_config->Read( MirrorKey, &DIALOG_GENDRILL::m_Mirror ); m_config->Read( MinimalHeaderKey, &DIALOG_GENDRILL::m_MinimalHeader ); m_config->Read( UnitDrillInchKey, &DIALOG_GENDRILL::m_UnitDrillIsInch ); @@ -124,12 +113,8 @@ void DIALOG_GENDRILL::InitDisplayParams() wxString msg; m_Choice_Unit->SetSelection( m_UnitDrillIsInch ? 1 : 0 ); - m_Choice_Precision->SetSelection( m_PrecisionFormat ); m_Choice_Zeros_Format->SetSelection( m_ZerosFormat ); - if( m_ZerosFormat == EXCELLON_WRITER::DECIMAL_FORMAT ) - m_Choice_Precision->Enable( false ); - UpdatePrecisionOptions(); m_Check_Minimal->SetValue( m_MinimalHeader ); @@ -228,7 +213,6 @@ void DIALOG_GENDRILL::UpdateConfig() SetParams(); m_config->Write( ZerosFormatKey, m_ZerosFormat ); - m_config->Write( PrecisionKey, m_PrecisionFormat ); m_config->Write( MirrorKey, m_Mirror ); m_config->Write( MinimalHeaderKey, m_MinimalHeader ); m_config->Write( UnitDrillInchKey, m_UnitDrillIsInch ); @@ -268,22 +252,17 @@ void DIALOG_GENDRILL::OnSelZerosFmtSelected( wxCommandEvent& event ) void DIALOG_GENDRILL::UpdatePrecisionOptions() { if( m_Choice_Unit->GetSelection()== 1 ) // Units = inches - { - // inch options - m_Choice_Precision->SetString( 0, precisionListForInches[0].GetPrecisionString() ); - m_Choice_Precision->SetString( 1, precisionListForInches[1].GetPrecisionString() ); - } + m_staticTextPrecision->SetLabel( precisionListForInches.GetPrecisionString() ); else { // metric options - m_Choice_Precision->SetString( 0, precisionListForMetric[0].GetPrecisionString() ); - m_Choice_Precision->SetString( 1, precisionListForMetric[1].GetPrecisionString() ); + m_staticTextPrecision->SetLabel( precisionListForMetric.GetPrecisionString() ); } if( m_Choice_Zeros_Format->GetSelection() == EXCELLON_WRITER::DECIMAL_FORMAT ) - m_Choice_Precision->Enable( false ); + m_staticTextPrecision->Enable( false ); else - m_Choice_Precision->Enable( true ); + m_staticTextPrecision->Enable( true ); } void DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) @@ -339,20 +318,16 @@ void DIALOG_GENDRILL::SetParams() m_Mirror = m_Check_Mirror->IsChecked(); m_ZerosFormat = m_Choice_Zeros_Format->GetSelection(); m_DrillOriginIsAuxAxis = m_Choice_Drill_Offset->GetSelection(); - m_PrecisionFormat = m_Choice_Precision->GetSelection(); if( m_Choice_Drill_Offset->GetSelection() == 0 ) m_FileDrillOffset = wxPoint( 0, 0 ); else m_FileDrillOffset = m_parent->GetOriginAxisPosition(); - // get precision - int idx = m_Choice_Precision->GetSelection(); - if( m_UnitDrillIsInch ) - m_Precision = precisionListForInches[idx]; + m_Precision = precisionListForInches; else - m_Precision = precisionListForMetric[idx]; + m_Precision = precisionListForMetric; m_board->SetPlotOptions( m_plotOpts ); } diff --git a/pcbnew/dialogs/dialog_gendrill.h b/pcbnew/dialogs/dialog_gendrill.h index 58b3307d20..b7c2717886 100644 --- a/pcbnew/dialogs/dialog_gendrill.h +++ b/pcbnew/dialogs/dialog_gendrill.h @@ -39,7 +39,6 @@ public: static int m_UnitDrillIsInch; static int m_ZerosFormat; - static int m_PrecisionFormat; static bool m_MinimalHeader; static bool m_Mirror; static bool m_DrillOriginIsAuxAxis; /* Axis selection (main / auxiliary) diff --git a/pcbnew/dialogs/dialog_gendrill_base.cpp b/pcbnew/dialogs/dialog_gendrill_base.cpp index cdbd6f7520..9c30867e80 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.cpp +++ b/pcbnew/dialogs/dialog_gendrill_base.cpp @@ -54,13 +54,15 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con m_LeftBoxSizer->Add( m_Choice_Zeros_Format, 0, wxALL|wxEXPAND, 5 ); - wxString m_Choice_PrecisionChoices[] = { _("2:3"), _("2:4") }; - int m_Choice_PrecisionNChoices = sizeof( m_Choice_PrecisionChoices ) / sizeof( wxString ); - m_Choice_Precision = new wxRadioBox( this, wxID_ANY, _("Precision"), wxDefaultPosition, wxDefaultSize, m_Choice_PrecisionNChoices, m_Choice_PrecisionChoices, 1, wxRA_SPECIFY_COLS ); - m_Choice_Precision->SetSelection( 1 ); - m_Choice_Precision->SetToolTip( _("Choose EXCELLON numbers precision") ); + wxStaticBoxSizer* sbSizerPrecision; + sbSizerPrecision = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Precision") ), wxVERTICAL ); - m_LeftBoxSizer->Add( m_Choice_Precision, 0, wxALL|wxEXPAND, 5 ); + m_staticTextPrecision = new wxStaticText( this, wxID_ANY, _("Precision"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPrecision->Wrap( -1 ); + sbSizerPrecision->Add( m_staticTextPrecision, 0, wxALL, 5 ); + + + m_LeftBoxSizer->Add( sbSizerPrecision, 0, wxEXPAND, 5 ); bmiddlerSizer->Add( m_LeftBoxSizer, 0, wxEXPAND, 5 ); @@ -166,10 +168,10 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con bSizerButtons->Add( m_buttonDrill, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); m_buttonMap = new wxButton( this, wxID_ANY, _("Map File"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerButtons->Add( m_buttonMap, 0, wxALL, 5 ); + bSizerButtons->Add( m_buttonMap, 0, wxALL|wxEXPAND, 5 ); m_buttonReport = new wxButton( this, wxID_ANY, _("Report File"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerButtons->Add( m_buttonReport, 0, wxALL, 5 ); + bSizerButtons->Add( m_buttonReport, 0, wxALL|wxEXPAND, 5 ); m_CancelButton = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerButtons->Add( m_CancelButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); diff --git a/pcbnew/dialogs/dialog_gendrill_base.fbp b/pcbnew/dialogs/dialog_gendrill_base.fbp index 3c0424596d..143c6d7f82 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.fbp +++ b/pcbnew/dialogs/dialog_gendrill_base.fbp @@ -495,92 +495,99 @@ 5 - wxALL|wxEXPAND + wxEXPAND 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "2:3" "2:4" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 + wxID_ANY Precision - 1 - - 0 - - - 0 - 1 - m_Choice_Precision - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - Choose EXCELLON numbers precision - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - + sbSizerPrecision + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Precision + + 0 + + + 0 + + 1 + m_staticTextPrecision + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1723,7 +1730,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -1811,7 +1818,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 diff --git a/pcbnew/dialogs/dialog_gendrill_base.h b/pcbnew/dialogs/dialog_gendrill_base.h index e4f5ac6e4b..a3b9680676 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.h +++ b/pcbnew/dialogs/dialog_gendrill_base.h @@ -22,8 +22,8 @@ #include #include #include -#include #include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM wxButton* m_buttonBrowse; wxRadioBox* m_Choice_Unit; wxRadioBox* m_Choice_Zeros_Format; - wxRadioBox* m_Choice_Precision; + wxStaticText* m_staticTextPrecision; wxRadioBox* m_Choice_Drill_Map; wxCheckBox* m_Check_Mirror; wxCheckBox* m_Check_Minimal;