Commit 8031e512 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

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)
parent c41bb774
Loading
Loading
Loading
Loading
+9 −34
Original line number Diff line number Diff line
@@ -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 );
}
+0 −1
Original line number Diff line number Diff line
@@ -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)
+10 −8
Original line number Diff line number Diff line
@@ -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 );
+90 −83
Original line number Diff line number Diff line
@@ -495,9 +495,21 @@
                                </object>
                                <object class="sizeritem" expanded="1">
                                    <property name="border">5</property>
                                    <property name="flag">wxALL|wxEXPAND</property>
                                    <property name="flag">wxEXPAND</property>
                                    <property name="proportion">0</property>
                                    <object class="wxRadioBox" expanded="1">
                                    <object class="wxStaticBoxSizer" expanded="1">
                                        <property name="id">wxID_ANY</property>
                                        <property name="label">Precision</property>
                                        <property name="minimum_size"></property>
                                        <property name="name">sbSizerPrecision</property>
                                        <property name="orient">wxVERTICAL</property>
                                        <property name="permission">none</property>
                                        <event name="OnUpdateUI"></event>
                                        <object class="sizeritem" expanded="1">
                                            <property name="border">5</property>
                                            <property name="flag">wxALL</property>
                                            <property name="proportion">0</property>
                                            <object class="wxStaticText" expanded="1">
                                                <property name="BottomDockable">1</property>
                                                <property name="LeftDockable">1</property>
                                                <property name="RightDockable">1</property>
@@ -511,7 +523,6 @@
                                                <property name="caption"></property>
                                                <property name="caption_visible">1</property>
                                                <property name="center_pane">0</property>
                                        <property name="choices">&quot;2:3&quot; &quot;2:4&quot;</property>
                                                <property name="close_button">1</property>
                                                <property name="context_help"></property>
                                                <property name="context_menu">1</property>
@@ -527,7 +538,6 @@
                                                <property name="hidden">0</property>
                                                <property name="id">wxID_ANY</property>
                                                <property name="label">Precision</property>
                                        <property name="majorDimension">1</property>
                                                <property name="max_size"></property>
                                                <property name="maximize_button">0</property>
                                                <property name="maximum_size"></property>
@@ -535,7 +545,7 @@
                                                <property name="minimize_button">0</property>
                                                <property name="minimum_size"></property>
                                                <property name="moveable">1</property>
                                        <property name="name">m_Choice_Precision</property>
                                                <property name="name">m_staticTextPrecision</property>
                                                <property name="pane_border">1</property>
                                                <property name="pane_position"></property>
                                                <property name="pane_size"></property>
@@ -543,20 +553,16 @@
                                                <property name="pin_button">1</property>
                                                <property name="pos"></property>
                                                <property name="resize">Resizable</property>
                                        <property name="selection">1</property>
                                                <property name="show">1</property>
                                                <property name="size"></property>
                                        <property name="style">wxRA_SPECIFY_COLS</property>
                                                <property name="style"></property>
                                                <property name="subclass"></property>
                                                <property name="toolbar_pane">0</property>
                                        <property name="tooltip">Choose EXCELLON numbers precision</property>
                                        <property name="validator_data_type"></property>
                                        <property name="validator_style">wxFILTER_NONE</property>
                                        <property name="validator_type">wxDefaultValidator</property>
                                        <property name="validator_variable"></property>
                                                <property name="tooltip"></property>
                                                <property name="window_extra_style"></property>
                                                <property name="window_name"></property>
                                                <property name="window_style"></property>
                                                <property name="wrap">-1</property>
                                                <event name="OnChar"></event>
                                                <event name="OnEnterWindow"></event>
                                                <event name="OnEraseBackground"></event>
@@ -574,7 +580,6 @@
                                                <event name="OnMouseEvents"></event>
                                                <event name="OnMouseWheel"></event>
                                                <event name="OnPaint"></event>
                                        <event name="OnRadioBox"></event>
                                                <event name="OnRightDClick"></event>
                                                <event name="OnRightDown"></event>
                                                <event name="OnRightUp"></event>
@@ -585,6 +590,8 @@
                                        </object>
                                    </object>
                                </object>
                            </object>
                        </object>
                        <object class="sizeritem" expanded="1">
                            <property name="border">5</property>
                            <property name="flag">wxEXPAND</property>
@@ -1723,7 +1730,7 @@
                                </object>
                                <object class="sizeritem" expanded="1">
                                    <property name="border">5</property>
                                    <property name="flag">wxALL</property>
                                    <property name="flag">wxALL|wxEXPAND</property>
                                    <property name="proportion">0</property>
                                    <object class="wxButton" expanded="1">
                                        <property name="BottomDockable">1</property>
@@ -1811,7 +1818,7 @@
                                </object>
                                <object class="sizeritem" expanded="1">
                                    <property name="border">5</property>
                                    <property name="flag">wxALL</property>
                                    <property name="flag">wxALL|wxEXPAND</property>
                                    <property name="proportion">0</property>
                                    <object class="wxButton" expanded="1">
                                        <property name="BottomDockable">1</property>
+2 −2
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>

///////////////////////////////////////////////////////////////////////////
@@ -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;