KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_create_array.cpp File Reference
#include "dialogs/dialog_create_array.h"
#include <set>
#include <wx/msgdlg.h>
#include <base_units.h>
#include <footprint.h>
#include <pcb_edit_frame.h>
#include <tools/pcb_actions.h>
#include <tools/pcb_picker_tool.h>
#include <tool/tool_manager.h>
#include <widgets/text_ctrl_eval.h>

Go to the source code of this file.

Classes

struct  CREATE_ARRAY_DIALOG_ENTRIES
 Struct containing the last-entered values for the dialog. More...
 
struct  NUMBERING_LIST_DATA
 Local mapping for list-box <-> numbering type. More...
 

Functions

static bool validateLongEntry (const wxTextEntry &entry, long &dest, const wxString &description, wxArrayString &errors)
 Validate and save a long integer entry.
 
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 arrayHasStackedPositions (const ARRAY_OPTIONS &aOptions, const VECTOR2I &aPos)
 Detect whether the array configuration would produce two or more items at the same position and rotation, i.e.
 

Variables

static CREATE_ARRAY_DIALOG_ENTRIES s_arrayOptions
 
static const std::vector< NUMBERING_LIST_DATAnumberingTypeData
 List of type <--> name mappings (in order) for the numbering type list boxes.
 

Function Documentation

◆ arrayHasStackedPositions()

static bool arrayHasStackedPositions ( const ARRAY_OPTIONS & aOptions,
const VECTOR2I & aPos )
static

Detect whether the array configuration would produce two or more items at the same position and rotation, i.e.

visually stacked on top of one another. Uses the same transform path that array creation will use so partial-row/column overlaps and circular full-circle layouts are all classified correctly.

Definition at line 423 of file dialog_create_array.cpp.

References ARRAY_OPTIONS::GetArraySize(), ARRAY_OPTIONS::GetTransform(), ARRAY_OPTIONS::TRANSFORM::m_offset, and ARRAY_OPTIONS::TRANSFORM::m_rotation.

Referenced by DIALOG_CREATE_ARRAY::TransferDataFromWindow().

◆ validateAxisOptions()

static bool validateAxisOptions ( const wxTextCtrl & offsetEntry,
const wxChoice & typeEntry,
const wxTextCtrl & aStepEntry,
ARRAY_AXIS & aAxis,
wxArrayString & errors )
static

Validates and saves (if valid) the type and offset of an array axis numbering.

Parameters
offsetEntrythe entry of the offset (text)
typeEntrythe entry of the axis nmbering scheme (choice)
typethe destination of the type if valid
offsetthe destination of the offset if valid
errorserror string accumulator
Returns
if all valid

Definition at line 383 of file dialog_create_array.cpp.

References _, ARRAY_AXIS::GetAlphabet(), NUMBERING_LIST_DATA::m_numbering_type, ARRAY_AXIS::SetAxisType(), ARRAY_AXIS::SetOffset(), ARRAY_AXIS::SetStep(), text, and validateLongEntry().

Referenced by DIALOG_CREATE_ARRAY::TransferDataFromWindow().

◆ validateLongEntry()

static bool validateLongEntry ( const wxTextEntry & entry,
long & dest,
const wxString & description,
wxArrayString & errors )
static

Validate and save a long integer entry.

Parameters
entrythe text entry to read from
destthe value destination
descriptiondescription of the field (used if the value is not OK)
errorsa list of errors to add any error to
Returns
valid

Definition at line 356 of file dialog_create_array.cpp.

References _.

Referenced by DIALOG_CREATE_ARRAY::TransferDataFromWindow(), and validateAxisOptions().

Variable Documentation

◆ numberingTypeData

const std::vector<NUMBERING_LIST_DATA> numberingTypeData
static
Initial value:
{
{
_( "Numerals (0,1,2,...,9,10)" ),
},
{
_( "Hexadecimal (0,1,...,F,10,...)" ),
},
{
_( "Alphabet, minus IOSQXZ" ),
},
{
_( "Alphabet, full 26 characters" ),
},
}
@ NUMBERING_NUMERIC
Arabic numerals: 0,1,2,3,4,5,6,7,8,9,10,11...
Definition array_axis.h:44
@ NUMBERING_ALPHA_NO_IOSQXZ
Alphabet, excluding IOSQXZ.
Definition array_axis.h:53
@ NUMBERING_ALPHA_FULL
Full 26-character alphabet.
Definition array_axis.h:54
#define _(s)

List of type <--> name mappings (in order) for the numbering type list boxes.

Definition at line 110 of file dialog_create_array.cpp.

Referenced by DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY(), and DIALOG_CREATE_ARRAY::OnAxisNumberingChange().

◆ s_arrayOptions

CREATE_ARRAY_DIALOG_ENTRIES s_arrayOptions
static

Definition at line 95 of file dialog_create_array.cpp.

Referenced by DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY().