111 _(
"Numerals (0,1,2,...,9,10)" ),
115 _(
"Hexadecimal (0,1,...,F,10,...)" ),
119 _(
"Alphabet, minus IOSQXZ" ),
123 _(
"Alphabet, full 26 characters" ),
128 std::unique_ptr<ARRAY_OPTIONS>& aSettings,
129 bool aIsFootprintEditor,
const VECTOR2I& aOrigPos ) :
155 const wxString label = wxGetTranslation( numData.m_label );
156 void* clientData = (
void*) &numData;
231 SetMinSize( GetSize() );
258 wxCHECK( pickerTool, );
275 wxFAIL_MSG(
"Unknown event source" );
284 const int newAlphabet = aEvent.GetSelection();
286 wxCHECK( newAlphabet >= 0 && newAlphabet <
static_cast<int>(
numberingTypeData.size() ),
292 wxTextCtrl* matchingTextCtrl =
nullptr;
301 wxCHECK( matchingTextCtrl, );
309 const bool isAlreadyOK = dummyAxis.
SetOffset( matchingTextCtrl->GetValue() );
353static bool validateLongEntry(
const wxTextEntry& entry,
long& dest,
const wxString& description,
354 wxArrayString& errors )
358 if( !entry.GetValue().ToLong( &dest ) )
361 err.Printf(
_(
"Bad numeric value for %s: %s" ), description, entry.GetValue() );
381 const wxTextCtrl& aStepEntry,
ARRAY_AXIS& aAxis,
382 wxArrayString& errors )
384 void* clientData = typeEntry.GetClientData( typeEntry.GetSelection() );
387 wxCHECK_MSG( numberingData,
false, wxT(
"Failed to get client data from list control." ) );
391 const wxString
text = offsetEntry.GetValue();
397 errors.Add( wxString::Format(
_(
"Could not determine numbering start from '%s': "
398 "expected value consistent with alphabet '%s'." ),
416 std::unique_ptr<ARRAY_OPTIONS> newSettings;
418 wxArrayString errors;
423 auto newGrid = std::make_unique<ARRAY_GRID_OPTIONS>();
430 newGrid->m_delta.x =
m_hSpacing.GetIntValue();
431 newGrid->m_delta.y =
m_vSpacing.GetIntValue();
433 newGrid->m_offset.x =
m_hOffset.GetIntValue();
434 newGrid->m_offset.y =
m_vOffset.GetIntValue();
451 if( newGrid->GetNumberingStartIsSpecified() )
459 newGrid->m_pri_axis, errors );
461 if( newGrid->m_2dArrayNumbering )
466 newGrid->m_sec_axis, errors );
474 newGrid->m_2dArrayNumbering =
false;
476 newGrid->m_pri_axis.SetOffset( 1 );
482 newSettings = std::move( newGrid );
486 auto newCirc = std::make_unique<ARRAY_CIRCULAR_OPTIONS>();
491 newCirc->m_centre.x =
m_hCentre.GetIntValue();
492 newCirc->m_centre.y =
m_vCentre.GetIntValue();
506 if( newCirc->GetNumberingStartIsSpecified() )
515 newCirc->m_axis.SetOffset( 1 );
521 newSettings = std::move( newCirc );
544 if( errors.IsEmpty() )
545 errorStr =
_(
"Bad parameters");
547 errorStr = wxJoin( errors,
'\n' );
549 wxMessageBox( errorStr );
constexpr EDA_IU_SCALE pcbIUScale
Class that contains information about a single array axis and the numbering of items along that axis.
bool SetOffset(const wxString &aOffsetName)
Set the axis start (as a string, which should decode to a valid index in the alphabet),...
wxString GetItemNumber(int n) const
Get the position number (name) for the n'th axis point.
static bool TypeIsNumeric(NUMBERING_TYPE type)
Check if a numbering type is a numeric type.
const wxString & GetAlphabet() const
Get the alphabet for the current numbering scheme.
void SetAxisType(NUMBERING_TYPE aType)
Set the axis numbering type.
@ NUMBERING_NUMERIC
Arabic numerals: 0,1,2,3,4,5,6,7,8,9,10,11...
@ NUMBERING_ALPHA_NO_IOSQXZ
Alphabet, excluding IOSQXZ.
@ NUMBERING_ALPHA_FULL
Full 26-character alphabet.
void SetStep(int aStep)
Set the skip between consecutive numbers (useful when doing a partial array, e.g.
wxTextCtrl * m_entryCentreX
wxRadioButton * m_radioBtnArrangeSelection
wxRadioBox * m_radioBoxGridNumberingAxis
wxRadioBox * m_radioBoxGridNumberingScheme
wxStaticText * m_labelGridNumberingStep
wxCheckBox * m_entryRotateItemsCb
wxTextCtrl * m_entryGridSecNumberingOffset
TEXT_CTRL_EVAL * m_entryCircOffset
wxChoice * m_choiceSecAxisNumbering
wxStaticText * m_unitLabelCircAngle
wxTextCtrl * m_entryOffsetX
wxButton * m_btnSelectCenterItem
wxRadioBox * m_rbCircStartNumberingOpt
wxStaticText * m_labelOffsetY
wxRadioButton * m_radioBtnDuplicateSelection
wxNotebook * m_gridTypeNotebook
wxPanel * m_gridPadNumberingPanel
wxStaticText * m_labelCentreX
wxStaticText * m_unitLabelDx
wxStaticText * m_unitLabelCentreY
wxButton * m_btnSelectCenterPoint
wxTextCtrl * m_entryOffsetY
wxTextCtrl * m_entryGridPriNumberingOffset
wxTextCtrl * m_entryGridPriNumberingStep
wxPanel * m_circularPadNumberingPanel
wxStaticText * m_unitLabelOffsetY
wxRadioButton * m_radioBtnUniqueRefs
TEXT_CTRL_EVAL * m_entryCircCount
TEXT_CTRL_EVAL * m_entryNx
wxTextCtrl * m_entryCentreY
wxStaticText * m_unitLabelOffsetX
wxStaticText * m_labelPriAxisNumbering
wxStaticText * m_labelOffsetX
wxTextCtrl * m_entryCircAngle
wxChoice * m_choicePriAxisNumbering
wxPanel * m_footprintReannotatePanel
wxRadioButton * m_staggerRows
wxStaticText * m_unitLabelCentreX
wxCheckBox * m_checkBoxFullCircle
wxStaticText * m_labelSecAxisNumbering
wxTextCtrl * m_entryCircNumberingStart
wxCheckBox * m_cbRenumberPads
wxStaticText * m_labelCircOffset
wxRadioBox * m_rbCircDirection
wxPanel * m_circularPanel
wxRadioButton * m_radioBtnKeepRefs
wxStaticText * m_labelCircAngle
DIALOG_CREATE_ARRAY_BASE(wxWindow *parent, wxWindowID id=wxID_DIALOG_CREATE_ARRAY, const wxString &title=_("Create Array"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxStaticText * m_labelGridNumberingOffset
wxStaticText * m_unitLabelCircOffset
wxRadioButton * m_rbCentreOnSource
wxChoice * m_choiceCircNumbering
wxCheckBox * m_checkBoxGridReverseNumbering
wxRadioButton * m_rbItemsRemainInPlace
TEXT_CTRL_EVAL * m_entryStagger
wxTextCtrl * m_entryGridSecNumberingStep
wxRadioBox * m_rbGridStartNumberingOpt
wxStaticText * m_labelCentreY
TEXT_CTRL_EVAL * m_entryNy
wxStaticText * m_unitLabelDy
wxTextCtrl * m_entryCircNumberingStep
WIDGET_SAVE_RESTORE m_cfg_persister
DIALOG_CREATE_ARRAY(PCB_BASE_FRAME *aParent, std::unique_ptr< ARRAY_OPTIONS > &aOptions, bool enableNumbering, const VECTOR2I &aOrigPos)
Construct a new dialog.
bool TransferDataFromWindow() override
void OnSelectCenterButton(wxCommandEvent &aEvent) override
void calculateCircularArrayProperties()
const VECTOR2I m_originalItemPosition
std::unique_ptr< ARRAY_OPTIONS > & m_settings
The settings to re-seat on dialog OK.
void OnParameterChanged(wxCommandEvent &aEvent) override
void UpdatePickedItem(const EDA_ITEM *aItem) override
void UpdatePickedPoint(const std::optional< VECTOR2I > &aPoint) override
void setControlEnablement()
void OnAxisNumberingChange(wxCommandEvent &aEvent) override
bool Show(bool show) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
static TOOL_ACTION selectPointInteractively
static TOOL_ACTION selectItemInteractively
Selection of reference points/items.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
static const std::vector< NUMBERING_LIST_DATA > numberingTypeData
List of type <--> name mappings (in order) for the numbering type list boxes.
static bool validateAxisOptions(const wxTextCtrl &offsetEntry, const wxChoice &typeEntry, const wxTextCtrl &aStepEntry, ARRAY_AXIS &aAxis, wxArrayString &errors)
Validates and saves (if valid) the type and offset of an array axis numbering.
static bool validateLongEntry(const wxTextEntry &entry, long &dest, const wxString &description, wxArrayString &errors)
Validate and save a long integer entry.
static CREATE_ARRAY_DIALOG_ENTRIES s_arrayOptions
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Convert aTextValue to a double.
Struct containing the last-entered values for the dialog.
long m_GridPrimaryAxisStep
CREATE_ARRAY_DIALOG_ENTRIES()
Construct with some sensible defaults.
EDA_ANGLE m_CircOffsetAngle
long m_GridSecondaryAxisStep
wxString m_GridPrimaryNumOffset
wxString m_GridSecondaryNumOffset
bool m_FootprintKeepAnnotations
bool m_FootprintReannotate
bool m_SelectionDuplicate
long m_GridSecondaryAxisScheme
bool m_CircRotatationStep
bool m_GridPositionItemsInPlace
long m_GridPrimaryAxisScheme
wxString m_CircNumberingOffset
bool m_GridPositionCentreOnItems
long m_Grid2dArrayNumbering
Local mapping for list-box <-> numbering type.
ARRAY_AXIS::NUMBERING_TYPE m_numbering_type
VECTOR2< int32_t > VECTOR2I