Pcbnew: allow alphabetic numbering in n circular grids

Add controls to the dialog and wire up to the axis numbering
scheme, same as the grid axes.

Fixes: lp:1814923
* https://bugs.launchpad.net/kicad/+bug/1814923
This commit is contained in:
John Beard 2019-05-15 17:21:12 +01:00
parent f47e2b54f8
commit 6ade8c25e1
4 changed files with 149 additions and 16 deletions

View File

@ -89,6 +89,7 @@ struct CREATE_ARRAY_DIALOG_ENTRIES
long m_circAngle;
long m_circCount;
long m_circNumberingStartSet;
long m_gridCircNumScheme;
wxString m_circNumberingOffset;
bool m_circRotate;
long m_arrayTypeTab;
@ -153,10 +154,12 @@ DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY(
m_choicePriAxisNumbering->Append( label, clientData );
m_choiceSecAxisNumbering->Append( label, clientData );
m_choiceCircNumbering->Append( label, clientData );
}
m_choicePriAxisNumbering->SetSelection( 0 );
m_choiceSecAxisNumbering->SetSelection( 0 );
m_choiceCircNumbering->SetSelection( 0 );
m_circAngle.SetUnits( EDA_UNITS_T::DEGREES );
@ -195,6 +198,7 @@ DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY(
m_cfg_persister.Add( *m_entryRotateItemsCb, saved_array_options.m_circRotate );
m_cfg_persister.Add( *m_rbCircStartNumberingOpt, saved_array_options.m_circNumberingStartSet );
m_cfg_persister.Add( *m_choiceCircNumbering, saved_array_options.m_gridCircNumScheme );
m_cfg_persister.Add( *m_entryCircNumberingStart, saved_array_options.m_circNumberingOffset );
m_cfg_persister.Add( *m_gridTypeNotebook, saved_array_options.m_arrayTypeTab );
@ -377,22 +381,13 @@ bool DIALOG_CREATE_ARRAY::TransferDataFromWindow()
if( newCirc->GetNumberingStartIsSpecified() )
{
newCirc->m_axis.SetAxisType( ARRAY_AXIS::NUMBERING_NUMERIC );
long offset;
ok = ok
&& validateLongEntry(
*m_entryCircNumberingStart, offset, _( "numbering start" ), errors );
if( ok )
{
newCirc->m_axis.SetOffset( offset );
}
ok = ok && validateNumberingTypeAndOffset( *m_entryCircNumberingStart,
*m_choiceCircNumbering, newCirc->m_axis, errors );
}
else
{
// artificial linear numeric scheme from 1
newCirc->m_axis.SetAxisType( ARRAY_AXIS::NUMBERING_TYPE::NUMBERING_NUMERIC );
newCirc->m_axis.SetOffset( 1 ); // Start at "1"
}
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 10 2018)
// C++ code generated with wxFormBuilder (version Mar 28 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -267,6 +267,15 @@ DIALOG_CREATE_ARRAY_BASE::DIALOG_CREATE_ARRAY_BASE( wxWindow* parent, wxWindowID
m_rbCircStartNumberingOpt->SetSelection( 0 );
m_circPadNumberingSizer->Add( m_rbCircStartNumberingOpt, 0, wxALL|wxEXPAND, 5 );
m_labelCircNumbering = new wxStaticText( m_circPadNumberingSizer->GetStaticBox(), wxID_ANY, _("Pad Numbering:"), wxDefaultPosition, wxDefaultSize, 0 );
m_labelCircNumbering->Wrap( -1 );
m_circPadNumberingSizer->Add( m_labelCircNumbering, 0, wxALL, 5 );
wxArrayString m_choiceCircNumberingChoices;
m_choiceCircNumbering = new wxChoice( m_circPadNumberingSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceCircNumberingChoices, 0 );
m_choiceCircNumbering->SetSelection( 0 );
m_circPadNumberingSizer->Add( m_choiceCircNumbering, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );

View File

@ -14,6 +14,7 @@
<property name="file">dialog_create_array_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">DIALOG_CREATE_ARRAY_BASE</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -1452,11 +1454,11 @@
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_gridPadNumberingSizer</property>
<property name="orient">wxVERTICAL</property>
@ -3389,6 +3391,131 @@
<event name="OnRadioBox">OnParameterChanged</event>
</object>
</object>
<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>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pad Numbering:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_labelCircNumbering</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</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>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices"></property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_choiceCircNumbering</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></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="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 10 2018)
// C++ code generated with wxFormBuilder (version Mar 28 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -98,6 +98,8 @@ class DIALOG_CREATE_ARRAY_BASE : public DIALOG_SHIM
wxCheckBox* m_entryRotateItemsCb;
wxStaticBoxSizer* m_circPadNumberingSizer;
wxRadioBox* m_rbCircStartNumberingOpt;
wxStaticText* m_labelCircNumbering;
wxChoice* m_choiceCircNumbering;
wxStaticText* m_labelCircNumStart;
wxTextCtrl* m_entryCircNumberingStart;
wxStdDialogButtonSizer* m_stdButtons;