ADDED: Option to assign unique reference designators to footprints
created with the array tool [pcbnew]
CHANGED: Array creator dialog no longer displays pad numbering properties
when in the board editor. [pcbnew]
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2354
This commit applies display origin transforms to all Pcbnew
dialog classes that use UNIT_BINDER for their formatting:
* DIALOG_CREATE_ARRAY
* DIALOG_FOOTPRINT_BOARD_EDITOR
* DIALOG_GRAPHIC_ITEM_PROPERTIES
* DIALOG_GRID_SETTINGS
* DIALOG_MOVE_EXACT
* DIALOG_PAD_PROPERTIES
* DIALOG_POSITION_RELATIVE
* DIALOG_TEXT_PROPERTIES
* DIALOG_TRACK_VIA_PROPERTIES
This prevents the dialog being sensitive to the exact ordering
of the enum, and instead defines an explicit mapping between
the axis numbering type, the label string and the position in the
list box control.
Remove the axis numbering code from ARRAY_OPTIONS
and place in a new class, ARRAY_AXIS. This keeps
the logic for the array item numbering separate from
the logic for the array item geometry.
This simplifies the logic in the ARRAY_OPTIONS class, which
no longer has to deal with the numbering of each axis.
The using the "first available" numbering option, force an
artifical linear numbering scheme starting at '1'.
Start the pad name provider at the 0'th pad index.
Also adds a few related tests and adjusts tests affected by
this change to reflect that the offset still applies.
This can be expanded in future to be more general by skipping
pad (which would allow a custom start and numbering scheme
while still avoiding duplication), but for now,
this does what the UI says and avoids string changes in 5.1rc.
Fixes: lp:1814918
* https://bugs.launchpad.net/kicad/+bug/1814918
Fixes: lp:1814917
* https://bugs.launchpad.net/kicad/+bug/1814917
The CONFIG_SAVE_RESTORE_WINDOW class does not need to be tied
to the array dialog, put it in common/widgets.
Also do a refactor and tidy-up of the the class, use a union for (slightly)
better type-safety and syntax (a variant would be better but that's C++17).
Also enable integral field save/restore from text boxes.
Fully initialise the CREATE_ARRAY_DIALOG_ENTRIES object,
and use these values for the dialog on first open. Currently,
the initial values aren't all initialised, and none are used, as the
valid flag is not set. This means there are poor defaults in some
fields.
Also more declarations and defintions of CREATE_ARRAY_DIALOG_ENTRIES
to the .cpp, as these do not need to be exposed in the header,
even privately.
The numbering axis priority (h then v or v then h), and alternate
reversing are not actually numbering parameters, they are part of
the geometry of the array (the items are physically in different
orders).
So enable these options, even when numbering is disabled.
Also fix broken logic about when numbering scheme is enabled
(it still applies even if the numbering offset is fixed.)
The geometry and numbering logic is separate to the dialog, and
can be separated for clearer logic and better testability.
Moreover, refactor it to avoid any dependency on pcbnew
classes, so it can be move to common for potential re-use in
eeschema and friends in future.
Also convert all wxPoint logic in these classes to VECTOR2I and
fix some function visibilities.
Add some unit tests of the ARRAY_OPTIONS geometry and numbering.
The standard DIM() macro was not typesafe as it happily deferred errors
to runtime that can be caught at compile time. Replacing it with a
generic C++11 constexpr allows for typecasting, comparison and compile
time error checking.
This patch enables math expression evaluation for most of the text input
controls in pcbnew.
NEW: pcbnew text input controls are able to evaluate simple
mathematical expressions, including distance units (e.g. 5.0+(2*1.2mm)).
I tried to merge some constants used both in legacy mode and gal mode (which were, before this patch, separate constants).
There is still a serious work to avoid different calculation code for the same text in draw and plot functions.
Work in progress to merge these calculation functions.
* No initial copied object changed (this was a serious bug to modify these objects. Previous version modified references and other texts using a very stupid algorithm).
It also fixes bug 1549231
* only new pads are numbered (therefore renumbering is used only in footprint editor)
* remove not working and useless feature in circular array: now only use number for pads (others options using alphabetical letters are removed: did not work corectly, and were useless)
* a more clear option is used to choose if the pads are numbered from a choosen value, or from the first avaible value
* Adding a warning messsage if a parameter is incorrect.
* Clean up formatting and make OK button the default in the array dialog.
* Make the OK button the default in the move exact dialog.
* Change the directory picker control from wxGenericDirCtrl to wxDirPickerCtrl so the native
directory picker dialog is used to select the directory in the select pretty library path dialog.
* Make the OK button the default in the select pretty library path dialog.