33#include <boost/algorithm/string/join.hpp>
137 _(
"Numerals (0,1,2,...,9,10)" ),
141 _(
"Hexadecimal (0,1,...,F,10,...)" ),
145 _(
"Alphabet, minus IOSQXZ" ),
149 _(
"Alphabet, full 26 characters" ),
154 std::unique_ptr<ARRAY_OPTIONS>& aSettings,
155 bool aIsFootprintEditor,
const VECTOR2I& aOrigPos ) :
157 m_settings( aSettings ),
158 m_originalItemPosition( aOrigPos ),
159 m_isFootprintEditor( aIsFootprintEditor ),
160 m_hSpacing( aParent, m_labelDx, m_entryDx, m_unitLabelDx ),
161 m_vSpacing( aParent, m_labelDy, m_entryDy, m_unitLabelDy ),
162 m_hOffset( aParent, m_labelOffsetX, m_entryOffsetX, m_unitLabelOffsetX ),
163 m_vOffset( aParent, m_labelOffsetY, m_entryOffsetY, m_unitLabelOffsetY ),
164 m_refPosX( aParent, m_stRefPosXTxt, m_tcRefPosX, m_stRefPosXUnit ),
165 m_refPosY( aParent, m_stRefPosYTxt, m_tcRefPosY, m_stRefPosYUnit ),
166 m_hCentre( aParent, m_labelCentreX, m_entryCentreX, m_unitLabelCentreX ),
167 m_vCentre( aParent, m_labelCentreY, m_entryCentreY, m_unitLabelCentreY ),
168 m_circRadius( aParent, m_labelCircRadius, m_tcValueCircRadius, m_unitLabelCircRadius ),
169 m_circCenterAngle( aParent, m_labelCircCenterAngle, m_tcValueCircCenterAngle, m_unitLabelCircCenterAngle ),
170 m_circAngle( aParent, m_labelCircAngle, m_entryCircAngle, m_unitLabelCircAngle ),
184 const wxString label = wxGetTranslation( numData.m_label );
185 void* clientData = (
void*) &numData;
253 SetMinSize( GetSize() );
320static bool validateLongEntry(
const wxTextEntry& entry,
long& dest,
const wxString& description,
321 wxArrayString& errors )
325 if( !entry.GetValue().ToLong( &dest ) )
328 err.Printf(
_(
"Bad numeric value for %s: %s" ), description, entry.GetValue() );
348 const wxTextCtrl& aStepEntry,
ARRAY_AXIS& aAxis,
349 wxArrayString& errors )
351 void* clientData = typeEntry.GetClientData( typeEntry.GetSelection() );
354 wxCHECK_MSG( numberingData,
false, wxT(
"Failed to get client data from list control." ) );
358 const wxString
text = offsetEntry.GetValue();
364 errors.Add( wxString::Format(
_(
"Could not determine numbering start from '%s': "
365 "expected value consistent with alphabet '%s'." ),
383 std::unique_ptr<ARRAY_OPTIONS> newSettings;
385 wxArrayString errors;
390 auto newGrid = std::make_unique<ARRAY_GRID_OPTIONS>();
416 if( newGrid->GetNumberingStartIsSpecified() )
424 newGrid->m_pri_axis, errors );
426 if( newGrid->m_2dArrayNumbering )
431 newGrid->m_sec_axis, errors );
439 newGrid->m_2dArrayNumbering =
false;
441 newGrid->m_pri_axis.SetOffset( 1 );
447 newSettings = std::move( newGrid );
451 auto newCirc = std::make_unique<ARRAY_CIRCULAR_OPTIONS>();
468 if( newCirc->GetNumberingStartIsSpecified() )
477 newCirc->m_axis.SetOffset( 1 );
483 newSettings = std::move( newCirc );
503 if( errors.IsEmpty() )
504 errorStr =
_(
"Bad parameters");
506 errorStr = boost::algorithm::join( errors, wxT(
"\n" ) );
508 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)
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
@ 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.
Class DIALOG_CREATE_ARRAY_BASE.
wxTextCtrl * m_entryCentreX
wxRadioBox * m_radioBoxGridNumberingAxis
wxRadioBox * m_radioBoxGridNumberingScheme
wxCheckBox * m_entryRotateItemsCb
wxTextCtrl * m_entryGridSecNumberingOffset
wxTextCtrl * m_tcValueCircRadius
wxChoice * m_choiceSecAxisNumbering
wxRadioBox * m_radioBoxGridStaggerType
wxRadioBox * m_rbCircStartNumberingOpt
wxNotebook * m_gridTypeNotebook
wxPanel * m_gridPadNumberingPanel
wxTextCtrl * m_entryGridPriNumberingOffset
wxTextCtrl * m_entryGridPriNumberingStep
wxPanel * m_circularPadNumberingPanel
wxRadioButton * m_radioBtnUniqueRefs
TEXT_CTRL_EVAL * m_entryCircCount
TEXT_CTRL_EVAL * m_entryNx
wxTextCtrl * m_entryCentreY
wxStaticText * m_labelPriAxisNumbering
wxTextCtrl * m_entryCircAngle
wxChoice * m_choicePriAxisNumbering
wxRadioButton * m_radioBtnSetByRadius
wxPanel * m_footprintReannotatePanel
wxStaticText * m_labelSecAxisNumbering
wxTextCtrl * m_entryCircNumberingStart
wxPanel * m_circularPanel
wxRadioButton * m_radioBtnKeepRefs
wxStaticText * m_labelGridNumberingOffset
wxRadioButton * m_radioBtnSetByPos
wxChoice * m_choiceCircNumbering
wxCheckBox * m_checkBoxGridReverseNumbering
TEXT_CTRL_EVAL * m_entryStagger
wxTextCtrl * m_entryGridSecNumberingStep
wxRadioBox * m_rbGridStartNumberingOpt
TEXT_CTRL_EVAL * m_entryNy
wxTextCtrl * m_tcValueCircCenterAngle
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.
void OnButtonRadius(wxCommandEvent &event) override
bool TransferDataFromWindow() override
void OnButtonPosition(wxCommandEvent &event) override
void OnParameterChanged(wxCommandEvent &event) override
void OnRadiusChanged(wxCommandEvent &event) override
void setCircularArrayEnablement()
void calculateCircularArrayProperties()
const VECTOR2I m_originalItemPosition
std::unique_ptr< ARRAY_OPTIONS > & m_settings
The settings to re-seat on dialog OK.
UNIT_BINDER m_circCenterAngle
void setControlEnablement()
void SetupStandardButtons(std::map< int, wxString > aLabels={})
EDA_ANGLE Round(int digits) const
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
virtual EDA_ANGLE GetAngleValue()
virtual void SetAngleValue(const EDA_ANGLE &aValue)
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
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
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts 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.
long m_GridSecondaryAxisStep
wxString m_GridPrimaryNumOffset
wxString m_GridSecondaryNumOffset
bool m_FootprintKeepAnnotations
bool m_FootprintReannotate
long m_GridSecondaryAxisScheme
bool m_CircRotatationStep
long m_GridPrimaryAxisScheme
wxString m_CircNumberingOffset
long m_Grid2dArrayNumbering
Local mapping for list-box <-> numbering type.
ARRAY_AXIS::NUMBERING_TYPE m_numbering_type