Commit Graph

230 Commits

Author SHA1 Message Date
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
Seth Hillbrand 81c5ba257b pcbnew: Ensure cursor remains set during tool activity
Mouse capture end is called by some actions such as save board.  This
resets the cursor image but doesn't change the current tool.  Resetting
the cursor image during action prevents this.

(cherry picked from commit 35e87128f5)

Fixes: lp:1831888
* https://bugs.launchpad.net/kicad/+bug/1831888
2019-06-08 10:25:24 -07:00
Jeff Young c1298570cb Remove legacy routing options. 2019-06-01 16:29:12 +01:00
Jeff Young 7553cc2651 Clean up some dangling legacy odds and ends. 2019-06-01 01:17:46 +01:00
Jeff Young 1e9da7f57b Remove CurItem() architecture and legacy routers and drawing code. 2019-05-29 00:26:30 +01:00
Jeff Young 0260b32125 Push resetLocalCoords down into COMMON_TOOLS.
Fixes: lp:1830693
* https://bugs.launchpad.net/kicad/+bug/1830693
2019-05-29 00:26:29 +01:00
jean-pierre charras 75cea18f07 Pcbnew, toolbars: fix incorrect icons 2019-05-23 11:07:55 +02:00
Jeff Young 67cc2aac2e Rework Eeschema find/replace for modern toolset.
Fixes: lp:1827274
* https://bugs.launchpad.net/kicad/+bug/1827274

Fixes: lp:1827240
* https://bugs.launchpad.net/kicad/+bug/1827240
2019-05-22 21:48:04 +01:00
Jeff Young 97445f1714 Don't go into interactive move when position was set in creation dialog.
Fixes: lp:1822569
* https://bugs.launchpad.net/kicad/+bug/1822569
2019-05-16 19:57:06 +01:00
Jeff Young fbb807f3bb Move some more menu & toolbar items to modern toolset. 2019-05-16 19:57:06 +01:00
Jeff Young f602ccd814 Insert EE_TOOL_BASE under SchEdit and LibEdit tools, and fix errant rename scope which clobbered PCBNew's PICKER_TOOL. 2019-05-12 13:47:08 +01:00
Martin McNamara 7200f4d7b5 PCBnew: Fixes crosshair issue with "Place Text" and "Add Dimension".
When using "Place Text" the crosshair was freezing if cancelled before
placing text.

After the crosshair freezes, the next uses of the "Place Text" or
"Add Dimension" caused the crosshair to jump to the screen location
where the previously the crosshair was frozen.

Cancelling the "Add Dimension" caused the crosshair to jump to the
screen location where the crosshair was when cancelled on the next use
of the "Place Text" or "Add Dimension".

Fixes: lp:1822578
* https://bugs.launchpad.net/kicad/+bug/1822578
2019-05-11 06:44:40 -07:00
Jeff Young fd546da640 Homogenize hit testing and selection return types.
Prep work for sharing SCH_SELECTION_TOOL with LibEdit.
2019-05-05 17:14:30 +01:00
Jeff Young 42383ae871 Build out some of the modern toolkit context menus. 2019-05-05 17:12:59 +01:00
Jeff Young e885d739a4 Simiplify VECTOR2 -> wxPoint conversions.
There has always been an operator specified, but it's explicit so
most folks don't notice it.
2019-04-22 22:08:18 +01:00
Jeff Young 77284e82c8 Replace switch-to-non-copper-layer for DIMENSION and POLYGON.
These still aren't handled by DRC.

Fixes: lp:1796500
* https://bugs.launchpad.net/kicad/+bug/1796500
2019-04-03 19:14:45 +01:00
Jeff Young 920d9e3d46 Don't switch to non-copper layer when drawing text & graphics.
We now allow these items on copper layers (and do the necessary
DRC, etc.)

Fixes: lp:1796500
* https://bugs.launchpad.net/kicad/+bug/1796500
2019-04-03 10:18:11 +01:00
jean-pierre charras e6a200b09e Pcbnew: avoid integer overflow when displaying local coordinates.
Minor cleanup in code.
2019-02-14 10:57:22 +01:00
Seth Hillbrand 184711beb4 pcbnew: Fix via snapping to multiple tracks
Rather than selecting an arbitrary track to snap, we select the closest
track to our point, allowing the via to be placed along the full track
length.

Fixes: lp:1813324
* https://bugs.launchpad.net/kicad/+bug/1813324
2019-01-25 09:13:18 -08:00
Seth Hillbrand 4247e32cd6 pcbnew: Disallow new via where DRC is violated
Prior to placing the via, we check if the resulting via will pass too
close to different nets on different layers.

Fixes: lp:1718827
* https://bugs.launchpad.net/kicad/+bug/1718827
2019-01-23 10:20:59 -08:00
Seth Hillbrand efe880bb79 pcbnew: Fix zone cutout duplication
When creating the zone cutout, we delete the old zone and add a new one
with each cutout.  This requires resetting the source zone and clearing
our previous selection if we would like to continue using the cutout
tool on the new zone.

Fixes: lp:1812339
* https://bugs.launchpad.net/kicad/+bug/1812339
2019-01-23 06:42:07 -08:00
jean-pierre charras 1c4b0337c2 Footprint editor, GAL mode: add missing initialization of local coordinates when creating graphic items
Fixes: lp:1812233
https://bugs.launchpad.net/kicad/+bug/1812233
2019-01-17 17:59:00 +01:00
Seth Hillbrand 77163e27f0 suppress boost optional compiler warning 2018-12-13 12:43:29 -08:00
jean-pierre charras 85775d522c Fix incorrect include paths
Especially, pcbnew/import_dxf is no longer in use.
2018-12-11 11:32:58 +01:00
Seth Hillbrand 4fc81bb923 pcbnew: Graphic lines snap as single segments
Graphic lines and polygons are drawn to fit specific areas for which it
is helpful to have the endpoint controlled by the cursor even when
constraining the angle.

Fixes: lp:1805502
* https://bugs.launchpad.net/kicad/+bug/1805502
2018-12-08 07:26:58 -08:00
jean-pierre charras cc0aa8b928 Gfx import: fix many issues, and add many enhancements.
* Do not compile dxf old files.
* import gfx, gal mode: make absolute placement working.
* Import gfx in legacy canvas: use it and make interactive placement working
* Take imported line width in account. Ensure DXF line thickness is OK.
* handling empty files in legacy mode.
2018-12-03 15:25:44 +01:00
jean-pierre charras 430c61822d Import svg import code from experimental trunk: convert dxf importer 2018-12-03 13:42:23 +01:00
jean-pierre charras 74a9d5401a Import svg import code from experimental trunk: start point 2018-12-03 13:42:22 +01:00
Seth Hillbrand 908c2a37e5 GRID_HELPER: Finish drawing closed path
When we draw a path, we usually want to close the path when clicking on
the end of another line.  This uses grid helper to ensure this
progression happens as expected.
2018-11-24 08:00:11 -08:00
Maciej Suminski 361b768aaf Fix frozen cursor on interactive DXF placement 2018-11-13 14:58:54 +01:00
Jeff Young befc504734 Warp cursor back to creation point after new-text dailog.
Also fixes same issue for new zones.

Fixes: lp:1802532
* https://bugs.launchpad.net/kicad/+bug/1802532
2018-11-11 20:26:19 +00:00
Seth Hillbrand 4b931aeb57 pcbnew: Force cursor position when snapping
This places the crosshairs (confusingly named here) at the snap
position, either one of the snap points or the grid, depending on the
status of the hotkeys SHIFT/ALT.

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

Fixes: lp:1801369
* https://bugs.launchpad.net/kicad/+bug/1801369
2018-11-07 14:36:46 -08:00
Jeff Young a5c892d9cd Update line width each time a new object is drawn.
Fixes: lp:1797481
* https://bugs.launchpad.net/kicad/+bug/1797481
2018-10-18 15:25:56 +01:00
Seth Hillbrand 915d2ed374 pcbnew: Zone tool follows active layer
Refactor the polygon event loop into its parent function to allow access
to the params structure.  Active layer now updates the drawing layer for
add/cutout zones.

Fixes: lp:1797483
* https://bugs.launchpad.net/kicad/+bug/1797483
2018-10-11 21:16:05 -07:00