Commit Graph

17 Commits

Author SHA1 Message Date
John Beard eb1e67583f Pcbnew: tidy up array options access/allocation
Use unique_ptrs for ownership transfer.

Pass the target object to the constructor rather than
creating an internal verison.
2019-05-16 11:20:52 +01:00
John Beard f47e2b54f8 Decouple the array tool list box from the numbering enum
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.
2019-05-16 11:20:52 +01:00
John Beard f85f10930a Break widget save/restore out to reusable class
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.
2019-01-30 15:41:35 -08:00
John Beard 24ac9b7055 Pcbnew: array: repair dialog value init
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.
2019-01-30 15:41:35 -08:00
John Beard 5504981d00 Separate ARRAY_OPTIONS to own class in common
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.
2019-01-30 15:41:35 -08:00
Jeff Young 6789103961 Save internal values rather than textbox content.
Fixes: lp:1802442
* https://bugs.launchpad.net/kicad/+bug/1802442
2018-11-11 20:26:19 +00:00
Jeff Young 5f3ee1e7ce More g_UserUnit erradication.
(cherry picked from commit 3f08780)
2018-07-17 15:12:31 +01:00
Jeff Young 44b81c99ec Use TransferDataFromWindow so <enter> works.
Fixes: lp:1750471
* https://bugs.launchpad.net/kicad/+bug/1750471
2018-03-06 21:12:14 +00:00
jean-pierre charras 5d72aebd22 Fix code after renaming files 2018-01-29 16:40:22 +01:00
Simon Richter ad088db6d2 Add more "override" markers. 2016-09-25 13:59:41 -04:00
Simon Richter 59c81976dc Explicitly mark overriding functions. 2016-09-24 14:53:15 -04:00
unknown b8a91c7a98 Enhancements in Create array tool (bad parameters detection and disable parms when not applicable) 2016-04-02 14:52:29 +02:00
jean-pierre charras b237d81b75 Create Array dialog: some fixes:
*  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.
2016-03-07 08:13:06 +01:00
jean-pierre charras 20dfe9ca29 Minor fixes: dialog_create_array.* files: clean code ( remove useless declarations and functions ).
fix a few coverity warnings about not initialized members in ctors.
2015-04-22 18:39:49 +02:00
jean-pierre charras f25f465d4c Make strings translatable in Create Array dialog (and a minor cosmetic enhancement).
Modview: fix issue about mouse on wrong monitor when starting Modview.
2015-04-05 11:52:41 +02:00
John Beard 8c6313ac1a Extend arrays and duplicate to pcbnew (GAL and legacy), covering modules, text, lines, tracks, dimensions and targets.
Text arrays can now use "%s" as a placeholder to be substituted with the array index.

Also expand menu options for move exact, arrays and duplicate.

Minor fixes for arrays - use proper unit parsing, add numbering start for circular arrays

Add circle radius indicator to array dialogue
2015-02-12 03:22:24 +00:00
John Beard 3c5f3f7049 Add create array tool 2015-02-12 03:22:24 +00:00