Commit Graph

363 Commits

Author SHA1 Message Date
Jeff Young 8b295a3bd7 Handle properties dialog while creating an arc.
Fixes https://gitlab.com/kicad/code/kicad/issues/6215
2020-11-05 20:21:06 +00:00
Jeff Young a6552f14f1 Improve SNR (code, status bar and user messages).
Fixes https://gitlab.com/kicad/code/kicad/issues/6304
2020-11-05 16:38:04 +00:00
Jeff Young 8c782506b9 Appy units updating more consistently to editing assistants.
Fixes https://gitlab.com/kicad/code/kicad/issues/6283
2020-11-04 14:11:25 +00:00
Ian McInerney dc542be91d Fix parentage of groups
In the footprint editor, we must parent the group to the module
not the board.

Fixes https://gitlab.com/kicad/code/kicad/issues/6181
2020-10-26 23:53:38 +00:00
jean-pierre charras f74ffc5623 Pcbnew: Fix incorrect position of the graphic crosshairs cursor in H,V,45deg
forced mode, when the graphic polygon tool is active, but a graphic item is not started.
(The code was using the last created point, but it does not exist before starting
a line)

Fixes #6079
https://gitlab.com/kicad/code/kicad/issues/6079
2020-10-26 11:56:09 +01:00
Jon Evans e832a94a9c Turn on zone visibility when you start drawing a zone
It's disconcerting to have the zone turn invisible when
you finish drawing and drop the selection.
2020-10-17 15:53:02 -04:00
Jeff Young 92d84b0d67 Naming updates. 2020-10-15 01:35:16 +01:00
Jeff Young ef3b7052e0 Remove layer nag dialogs and just ignore non-shapes on Edge_Cuts.
Fixes https://gitlab.com/kicad/code/kicad/issues/5812
2020-10-13 20:22:31 +01:00
Jeff Young 70c3c5c514 Retire the two-item version of BOARD_CONNECTED_ITEM::GetClearance(). 2020-10-12 18:40:03 +01:00
Ian McInerney 5aa796b5fe Cleanup compiler warnings 2020-10-10 15:24:35 +01:00
Jeff Young 9c6977a994 Remember mirror setting in print dialog.
Fixes https://gitlab.com/kicad/code/kicad/issues/5909
2020-10-08 14:15:10 +01:00
Marek Roszko f5e0754f65 Use the setCursor lambda pattern and fix up the initial cursor states 2020-10-07 23:26:14 -04:00
Mark Roszko d9485129c8 Implement more context specific cursors using both stock and custom cursors. 2020-10-08 00:50:28 +00:00
Jeff Young 305fe54971 Drawing tool needs to pass resetLocalCoords event after recording it.
Fixes https://gitlab.com/kicad/code/kicad/issues/5879
2020-10-06 12:08:31 +01:00
Jeff Young 37906511f5 Class renaming.
DRAWSEGMENT  -> PCB_SHAPE
EDGE_MODULE  -> FP_SHAPE
TEXTE_PCB    -> PCB_TEXT
TEXTE_MODULE -> FP_TEXT
2020-10-05 11:55:33 +01:00
Jeff Young 7a4900b8dc PCB_LINE_T -> PCB_SHAPE_T and PCB_MODULE_EDGE_T -> PCB_FP_SHAPE_T
Also updated footprint text and zone types for consistencey.
2020-10-04 16:49:04 +01:00
Mikolaj Wielgus 400c15b8eb Add mils to units, remove useMils variables 2020-10-03 20:06:56 +00:00
Jon Evans acf13a1869 ADDED: Orthogonal dimension object 2020-09-21 23:55:02 -04:00
Jon Evans 18e17abd6a Rename "Keepout" to "Rule Area"
These objects can now be used in advanced DRC rules and
not just for keeping things out.  Also remove the restriction
that at least one of the "basic" keepout rules must be set,
so that these areas can be used for more advanced rules.
2020-09-21 23:55:02 -04:00
jean-pierre charras 492a634413 Fp editor: Fix bug when moving fp anchor: pad shapes where not updated on screen. 2020-09-21 14:43:26 +02:00
Jeff Young 8dd725469f Process properties command locally within drawing tools.
Fixes https://gitlab.com/kicad/code/kicad/issues/5612

Fixes https://gitlab.com/kicad/code/kicad/issues/5615
2020-09-17 22:32:22 +01:00
Jon Evans e9b627bfd8 ADDED: Center marker dimension type 2020-09-16 20:55:11 -04:00
Jon Evans 75ffce1a0b ADDED: Leader dimension object
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5555
2020-09-15 23:37:38 -04:00
Seth Hillbrand 08bf5f4b4e ADDED: 45° snapping for rectangles aka Squares
The snap obeys only the Ctrl key and not the global preference setting
for drawsegments because rectangles are _always_ on H/V lines when drawn

Fixes https://gitlab.com/kicad/code/kicad/issues/5607
2020-09-15 11:22:26 -07:00
Jon Evans 3940e20fcb Expose extension offset and zero suppression settings 2020-09-12 11:52:59 -04:00
Jon Evans e40287d327 Fix auto units to work when drawing new dimensions 2020-09-12 10:30:33 -04:00
Jon Evans 0e9997d9ca Add new dimension features to board design defaults 2020-09-11 21:12:36 -04:00
Jon Evans b11e315d10 Refactor DIMENSION to hide internal details; add some new properties
This is a board file format change to account for the new properties.
Also, we now only store the critical information about the dimension's
geometry in the board, rather than storing every drawn line.

The DIMENSION object is now an abstract base, and ALIGNED_DIMENSION
is the implementation that exists today (we will add more dimension
types in the future)
2020-09-11 21:12:36 -04:00
Seth Hillbrand f493e270ea ADDED: Menu option to enable/disable snap to grid
You can now enable and disable snap to grid when drawing/editing across
all apps.  You can also tie snap to grid to the visibility of the grid
to allow rapid enable/disable via grid display.
2020-09-10 20:09:30 -07:00
Seth Hillbrand 4026904cc4 Make grid snapping depend on grid visibility
Turning the grid view on enables snapping to the grid.  Turning it off
removes the snap and allows free draw
2020-09-09 10:18:15 -07:00
Seth Hillbrand 173b4ff588 Add snapping to eeschema
This generalizes both the SetPosition() function and ORIGIN_VIEWITEM
class away from the pcbnew-centric.
2020-09-09 10:18:15 -07:00
Jeff Young 6e72f609f0 Make sure router and via tools update when sizes change.
Also adds a size menu to the context menu for the Via tool.

Fixes https://gitlab.com/kicad/code/kicad/issues/5321
2020-08-31 23:33:02 +01:00
Jeff Young c71bb246e6 Don't allow preview to try and draw empty polygons.
Fixes https://gitlab.com/kicad/code/kicad/issues/5314
2020-08-22 23:46:56 +01:00
Seth Hillbrand 20de1b2b4f Minor code tightening 2020-08-20 20:18:31 -07:00
PJM 29ddc73d6c Pcbnew: Allow rects to have overlapping end corner locations
CHANGED: If a rectangle is drawn and the location of the second corner
is the same as another rectangle's second corner, Pcbnew crashes. The
reason is that a call is made to DRAWSEGMENT::GetLength(), but that
function only handles shapes of type S_CURVE and S_SEGMENT.  This code
checks if the overlapping end points are from a rectangle and if so
it doesn't call DRAWSEGMENT::GetLength().

Fixes https://gitlab.com/kicad/code/kicad/issues/5282
2020-08-21 02:58:32 +00:00
Ian McInerney c479deaf02 Use groups when doing graphics import
ADDED: Allow DXF/SVG graphics to be imported as a group

Also, cleanup the placement routine to allow the edit tool's flip
and rotate routines to be used when placing the items.
2020-08-20 01:22:48 +01:00
Marek Roszko d2086eecdd Don't update panel while drawing a dimension 2020-08-18 13:11:47 +00:00
Marek Roszko 73b2a10cab Don't try updating msgpanel while segments. 2020-08-18 13:11:47 +00:00
Marek Roszko a0956fbf97 text tool: msgpanel on motion is the same as msgpanel on not moved text.... 2020-08-18 13:11:47 +00:00
Jeff Young 34705fd8b2 More clone vs duplicate bugs.
Fixes https://gitlab.com/kicad/code/kicad/issues/5120
2020-08-10 14:45:01 +01:00
Fabien Corona 133d082cc5 Pcbnew fix arc edition 2020-08-09 23:03:31 +00:00
Jeff Young e5b50d90a7 Update DRC rules to new layer and disallow grammars.
Also adds support for hooking rules up to named zones.

Fixes https://gitlab.com/kicad/code/kicad/issues/2041
2020-08-07 21:49:36 +01:00
Jeff Young 7108a25278 Fix issues flipping text.
This is a really hard problem to get right.  This algorithm won't
look quite right if you assemble a paragraph from disjoint text
objects and flip them all top-to-bottom (as it will re-order the
text).  But this is really the nature of the problem (and has to
stay that way to correctly flip disjoint graphic items or mixed
text and graphic items).  The real fix here is to support text
wrapped in a single text box.

Fixes https://gitlab.com/kicad/code/kicad/issues/4480
2020-08-02 17:05:13 +01:00
Thomas Pointhuber 7ba6a77c94 Improve arc geometry manager to choose the direction which makes more sense
As long as the arc angle stays below <60°, it will automatically choose between
clockwise and counter clockwise. This allows the user to choose the direction
with a simple mouse movement.
2020-07-03 15:05:17 +00:00
Jon Evans 0d4ee39f75 CHANGED: Copper zones can be on more than one layer
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1963
2020-06-28 08:52:37 -04:00
Jeff Young 367fd79b5f Don't try and second-guess the user.
(Especially now that polygons are useful on copper layers for custom
pad shapes.)
2020-06-27 22:08:13 +01:00
Jon Evans a16c9df79c Delete the right object in arc cleanup
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4694
2020-06-21 13:03:14 -04:00
jean-pierre charras ad69e449fe Fix a collision name in drawing_tool.h with a msys2 header 2020-06-21 10:36:01 +02:00
Jeff Young a3cab09fb4 Make it clearer that drawSegment() can modifiy the current seg pointer.
This might also quiet the Coverity warning, but I've also marked it as a
false positive (as it might still mess up on the new code).
2020-06-17 18:44:39 +01:00
Seth Hillbrand 8c57821e9b pcbnew: Move ratsnest items to separate folder 2020-06-16 11:15:14 -07:00
Jeff Young aeed8e6e2c Finish implementation of DRAWSEGMENT::C_RECT.
It's currently only supported in the Footprint Editor.  It could be
easily added to the board editor (all the code is there), but the board
editor is a little short on room in the drawing tools toolbar.
2020-06-15 20:51:31 +01:00
Jeff Young 47ab7c78a6 Divorce GRID_HELPER from the parent frame.
This moves GRID_HELPER fully into the tool framework.
2020-06-13 22:44:16 +01:00
Jeff Young 19dc1f8b69 Make sure text gets drawn after placing even if the mouse isn't moved. 2020-05-09 14:14:38 +01:00
Ian McInerney f649204c04 Allow graphic polygons/keepouts to be closed automatically
ADDED: Auto close option for graphic polygons/keepouts/cutouts
ADDED: Delete last point option for graphic polygons/keepouts/cutouts

Fixes https://gitlab.com/kicad/code/kicad/issues/2350
2020-04-24 18:35:43 +01:00
Jeff Young cb708aaadb Fix some memory leaks. 2020-04-16 21:57:07 +01:00
Jeff Young 9c8941e040 Remove a bunch of globals. 2020-04-16 17:34:46 +01:00
Jeff Young 6e800bddae Rationalize penWidth processing as first step in removing some globals. 2020-04-13 20:58:13 +01:00
Jon Evans e59a3d981e Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme

Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
2020-02-19 23:44:56 -05:00
Ian McInerney 34e5b76c5f Add virtual constructors to some classes that should have them
This is more for safety from undefined deletion behavior than
anything else (it also silences the Clang -Wnon-virtual-dtor warning).
2020-02-05 22:19:14 +00:00
Seth Hillbrand 7c296fbcb7 GRID_HELPER: Provide alignment axes from snap points
ADDED: alignment lines from item snap points

Alignment lines are shown when moving the cursor horizontally or
vertically from a possible snap point.
2020-01-18 20:43:40 -08:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
Mark Roszko 19ceb11ae7 Change more enums over to scoped enums 2019-12-28 00:55:11 +00:00
Mark Roszko 11ff16be4e Switch to scoped enums 2019-12-20 14:11:39 +00:00
Jeff Young 1c153c55c0 Add default units and precision for new dimension objects.
Fixes: lp:1846376
* https://bugs.launchpad.net/kicad/+bug/1846376
2019-11-05 17:22:51 +00:00
Seth Hillbrand 2e1af66a2b pcbnew: Commit polygon points to new constrained zone
Adds leader points if they are not already existing in the zone

Fixes: lp:1846028
* https://bugs.launchpad.net/kicad/+bug/1846028
2019-10-20 09:29:35 -07:00
Ian McInerney 0aa5424511 pcbnew: Switch over some drawing tools to use PrimeTool
Before, if the tools were activated from the context menu,
they would start drawing where the menu item was selected
instead of where the menu was opened.
2019-10-03 19:04:36 +01:00
Jeff Young d2cd659471 Be better about cleaning up mouse capture.
Fixes: lp:1841996
* https://bugs.launchpad.net/kicad/+bug/1841996
2019-08-29 23:56:16 +01:00
Jeff Young 359cf384de Import graphics is a one-shot, not a tool.
Fixes: lp:1841975
* https://bugs.launchpad.net/kicad/+bug/1841975
2019-08-29 23:56:16 +01:00
Seth Hillbrand 64c012c175 modedit: Enable snapping on anchors
The selection of footprint anchor should obey normal snapping paradigm.
2019-08-28 10:38:27 -07:00
Jeff Young 3f28a1d1cb Cleanup after cancelled add text dialog.
Fixes: lp:1838452
* https://bugs.launchpad.net/kicad/+bug/1838452
2019-07-31 23:10:13 -06:00
Jeff Young 5347c2ad3d Clear selection when running drawing tools.
Fixes: lp:1837796
* https://bugs.launchpad.net/kicad/+bug/1837796
2019-07-26 23:38:37 -06:00
Jeff Young 77334628c4 Change default tool behaviour to skip unhandled events.
The problem is that wxEVT_CHAR_HOOK doesn’t do the key translation
properly.  wxEVT_CHAR does, but we only get to that if we skip the
event at the end of the tool’s event processing loop, which most tools
don’t do.  (Selection tools, point editors, pickers, and a couple of
others do skip, which is probably why this didn’t get reported earlier.)

I played around with a couple of ways to fix wxEVT_CHAR_HOOK.  Most of
them don’t work, and the few egregious hacks I tried weren't cross-
platform.

So I’m changing it so that most tools now skip at the end of their
event loops.  I left out a couple that I felt were high risk (length
tuning, for instance).  But there’s still enough risk that I’m 100%
sure it will break something, I just haven’t a clue what.

Fixes: lp:1836903
* https://bugs.launchpad.net/kicad/+bug/1836903
2019-07-26 12:21:24 -06:00
Jeff Young 1808d8bd40 Add hole-to-hole-minimum checking to via placement.
Courtesy of Frank Severinsen.

Fixes: lp:1833214
* https://bugs.launchpad.net/kicad/+bug/1833214
2019-07-21 21:21:11 -06:00
Jeff Young 02eb1d2c62 Don't try and run drawing tools in ModEdit with no module selected.
Fixes: lp:1836673
* https://bugs.launchpad.net/kicad/+bug/1836673
2019-07-19 15:29:10 -06:00
Jeff Young 58ca5b71a9 A more robust fix for 36f1d023f0.
This one also handles when the events get out-of-order due to them
starting out in the Simulation window and not getting dispatched until
the mouse goes over the Schematic window.

Fixes: lp:1835907
* https://bugs.launchpad.net/kicad/+bug/1835907

Fixes: lp:1836544
* https://bugs.launchpad.net/kicad/+bug/1836544
2019-07-15 14:15:24 +01:00
Jeff Young 37af3adffb Add preference for flip axis.
Fixes: lp:1836267
* https://bugs.launchpad.net/kicad/+bug/1836267
2019-07-14 10:36:48 +01:00
Seth Hillbrand f2f2b4bcf9 Explode/Combine in terms of visible elements
When generating a complex pad, this allows the user to combine with a
rotated pad and explode rotated pads without needing to rotate elements
to 0 orientation first.

Fixes: lp:1808137
* https://bugs.launchpad.net/kicad/+bug/1808137
2019-07-12 16:55:41 -07:00
Jeff Young 13d61e4b2b Cleanup. 2019-07-10 01:14:21 +01:00
Jeff Young 70ca02537d Don't split track when via is placed at one of its ends.
Zero-length tracks are just a pain.

Fixes: lp:1813077
* https://bugs.launchpad.net/kicad/+bug/1813077
2019-07-06 22:54:31 +01:00
Jeff Young 0eed5175cc Fix crash in Pcbnew drawing tools.
Couple of typos: return !cancelled instead of cancel, and some breaks
on the wrong side of the braces.

Fixes: lp:1835172
* https://bugs.launchpad.net/kicad/+bug/1835172
2019-07-03 11:44:30 +01:00
Seth Hillbrand 9460f207f5 Fix misc build warnings
This removes unused static function in page layout editor, unused
variable in pcb_painter and restors the gcc unitialized fix for
pcbnew's drawing_tool.
2019-07-02 10:32:49 -07:00
Jeff Young 9effd24f3a Allow move tool to run on top of other tools.
Fixes: lp:1784480
* https://bugs.launchpad.net/kicad/+bug/1784480
2019-07-01 22:15:25 +01:00
Jeff Young 981072598b Overhaul cursor code for new tool/action framework.
Includes the addition of an onSetCursor() handler which must be called
from both the GAL canvas AND the GAL backend (at least on OSX) to prevent
cursor flickering between (for instance) pencil and arrow.

Also includes new architecture for point editors which allows them to
coordiate cursors with the editing tools (so we can switch to an arrow
when over a point).
2019-06-27 22:37:11 +01:00
Jeff Young 2f23aa9556 Implement a more robust tool stacking architecture.
We were running into various corner conditions where a tool's event
loop would exit while the tool was still active, or the tool would
get popped while we were still in the event loop.  (A lot of these
had to do with the POINT_EDITOR's, but not all of them.)

The new architecture:
1) tools always do a Push()/Pop()
2) everyone is responsible for their own pops; no more stack-clearing
on a cancel
3) CancelInteractive events go to all tools to facilitate (2)
2019-06-27 17:01:31 +01:00
Jeff Young e785c140b9 Eradicate globals for PCB_GENERAL_SETTINGS.
Fixes: lp:1832896
* https://bugs.launchpad.net/kicad/+bug/1832896
2019-06-26 21:54:03 +01:00
Jeff Young f9702aab87 Immediate actions for PlEditor, PcbNew, etc. 2019-06-25 11:34:28 +01:00
Jeff Young dcbd897a95 Push/pop tools even when selected from the toolbar. 2019-06-18 20:24:15 +01:00
Jeff Young 1f35ec5521 Beware of copying events and losing the m_passEvent flag.
Fixes: lp:1833031
* https://bugs.launchpad.net/kicad/+bug/1833031
2019-06-17 14:44:39 +01:00
Jeff Young e6d5110ccf Implement I18N for ACTIONs.
It's a bit of a hack because they're statically initialized and
so we can't make use of the _() macro.  We do still want it in the
code, however, because the string harvesting is based off of it.

Fixes: lp:1833000
* https://bugs.launchpad.net/kicad/+bug/1833000
2019-06-17 10:45:23 +01:00
Jeff Young 6d335f2a82 While Seth fixed the main issue, repeated Activate() calls probably still aren't a good idea.
(The main issue was addressed here: 552815d48617c08a6ec29f22c7ecdf1906988e11.)
2019-06-16 11:03:56 +01:00
Jeff Young 945eaceb91 Try and keep POINT_EDITOR and SELECTION_TOOL from fighting with drawing tool.
Set the IS_NEW flags so the POINT_EDITOR doesn't try an poke its head
in, and apply the EE_SELECTION_TOOL hack for mouse clicks leaking
through to the underlying tools.

Fixes: lp:1832911
* https://bugs.launchpad.net/kicad/+bug/1832911
2019-06-15 20:43:52 +01:00
Jeff Young 19aba615c2 Remove selection condition from conditional menu separators.
We don't allow duplicate separators anyway so all they really do
is complicate the code.
2019-06-15 20:43:51 +01:00
Jeff Young 5610261dce Immediate-action hotkeys (and context menu actions) for eeschema. 2019-06-15 20:43:51 +01:00
Jeff Young 8f84c3ec4f Grid rid of GetCanvas/GetGalCanvas distinction now that there's only gal. 2019-06-13 19:58:37 +01:00
Jeff Young ce1f35a1be Cleanup some left-over vestiages of the legacy canvas architecture. 2019-06-13 15:51:32 +01:00
Jeff Young 7726b039b2 Re-jigger standard submenus so they both link AND work. 2019-06-11 18:03:16 +01:00
John Beard 9625cea57f Fix hotkey debug spew
Two issues:

* Unassigned hotkeys were being passed to WX in the menu strings as
  "<unassigned>". WX doesn't recognise this, and prints debug each time.
  Unassigned hotkeys are no longer rare or naughty, so we shouldn't provoke
  debug spew. Suppress by not appending hotkey strings for actions with 0
  (i.e. unassigned) hotkey IDs.
* The zone cutout tool uses GR_KB_SHIFT, not MD_SHIFT. This causes
  "unknown hotkey" spew from WX.
2019-06-11 14:40:57 +01:00
Jeff Young bb96255a03 Fix dangerous static_cast-ing to wrong type. 2019-06-10 23:46:01 +01:00
Jeff Young 5e49517781 Move hotkeys to ACTION architecture. 2019-06-10 23:46:00 +01:00
Jeff Young 765606012f Convert separate-compilation of selection.cpp to polymorphism. 2019-06-10 23:46:00 +01:00