Commit Graph

88 Commits

Author SHA1 Message Date
Jeff Young d468618411 Don't eat commands that aren't ours in SCH_MOVE_TOOL.
Fixes https://gitlab.com/kicad/code/kicad/issues/5692
2020-09-18 16:45:41 +01:00
PJM c8879d9034 Eeschema: Check if user wants to warp mouse to origin of moved object
CHANGED: When moving a footprint, Eeschema was always warping the mouse
when moving an item regardless of the state of the "Warp mouse to
origin of moved object" checkbox.  This MR now honors the state of the
checkbox when moving schematic items.

NOTE: Issue 5279 originally only mentioned Pcbnew, but after the fix
for Pcbnew was submitted, a user pointed out it also happened in
Eeschema.  Becuase of this, there are two MRs that "fix" the same issue.

Fixes https://gitlab.com/kicad/code/kicad/issues/5279
2020-09-18 02:49:59 +00:00
Seth Hillbrand 471f81742f ADDED: Align to Grid function in Eeschema
Adds tool option to align selected elements to the current grid.

Fixes https://gitlab.com/kicad/code/kicad/issues/5481
2020-09-17 12:27:43 -07:00
Seth Hillbrand 23a9df8a59 ADDED: Allow Eeschema dragging graphical corners
This separates the two options (drag/move) into different actions.  Drag
will drag all graphical lines connected.  Move will disconnect the
graphical lines when moving.
2020-09-11 09:31:38 -07: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 62433736bc Snap Eeschema moves to nearest anchor
Fixes https://gitlab.com/kicad/code/kicad/issues/3803
2020-09-09 10:48:15 -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
Seth Hillbrand 02a5d47de9 Avoid passing references in EESchema
This returns the connection list by value.  This allows easier Python
use

Also renames m_End() to GetEnd()
2020-09-08 06:29:27 -07:00
Mark Roszko 1082402b33 Convert UNDO_REDO_T to an enum class 2020-08-26 18:04:32 +00:00
Jeff Young 1138c32bf3 Don't pass Cancel event where there was a specific action cancelled.
For instance, if during a move the user hits ESC they only want the
move cancelled, not (for instance) the selection dropped.

Fixes https://gitlab.com/kicad/code/kicad/issues/5356
2020-08-25 12:54:40 +01:00
Marek Roszko 3674064b9e Fix double msgpanel refresh and use the new moved event 2020-08-18 13:11:48 +00:00
Jeff Young 7340c97ef9 Undo for schematic-wide operations.
Editing value/footprint fields of multi-unit components.
Find/Change.
Annotation.
Back annotation.

Fixes https://gitlab.com/kicad/code/kicad/issues/2122

Fixes https://gitlab.com/kicad/code/kicad/issues/4869

Fixes https://gitlab.com/kicad/code/kicad/issues/3933

Fixes https://gitlab.com/kicad/code/kicad/issues/4871

Fixes https://gitlab.com/kicad/code/kicad/issues/3899
2020-07-13 12:32:17 +01:00
Jeff Young 73e1496b25 Change attached-label algorithm.
Rather than try and keep moving with other items, calculate nearest
point on current line to original label at each step.

Fixes https://gitlab.com/kicad/code/kicad/issues/4347
2020-05-07 18:59:47 +01:00
Jeff Young 51e72ed9ba Finish the collect-attached-labels rewrite.
Fixes https://gitlab.com/kicad/code/kicad/issues/4341
2020-05-06 20:38:12 +01:00
Jeff Young 0f34fc2e5f Simplify the "pick up attached labels" logic.
This should vastly reduce the number of side-effects we were seeing.

Fixes https://gitlab.com/kicad/code/kicad/issues/4311

Fixes https://gitlab.com/kicad/code/kicad/issues/git

Fixes https://gitlab.com/kicad/code/kicad/issues/4320
2020-05-06 15:48:58 +01:00
Jeff Young 5bed201a23 Don't collect connected labels on a paste.
Fixes https://gitlab.com/kicad/code/kicad/issues/4311
2020-05-03 21:47:53 +01:00
Jeff Young a286cb5a8f Keep labels on dragged wires.
Fixes https://gitlab.com/kicad/code/kicad/issues/2107
2020-04-19 18:24:39 +01:00
Jeff Young 122b1ddaae Unwrap an unnecessary layer now that we have new config stuff. 2020-04-13 20:58:12 +01:00
jean-pierre charras e811101567 fix a few Coverity warnings. 2020-04-01 09:34:44 +02:00
Jeff Young 535033c5c9 Enable editing of sheet fields. 2020-03-07 18:52:30 +00:00
Seth Hillbrand 84a697060f Don't insert pins/text when moving
Pins and component fields belong to the parent object and need to be
avoided when moving to prevent re-insertion on update.

Fixes #3804 | https://gitlab.com/kicad/code/kicad/issues/3804

Fixes #3811 | https://gitlab.com/kicad/code/kicad/issues/3811
2020-01-25 09:30:51 -08:00
Jeff Young 8abfc13053 Fix possible null dereference (from Coverity scan). 2020-01-10 22:32:50 +00:00
Seth Hillbrand 6e5e453d0d Replace EESchema DLIST
This moves EESchema DLIST structures to rtree.  These changes are more
fundamental than the pcbnew changes from 9163ac543 888c01d11 d1877d7c1
and 961b22d60 as eeschema operations were more dependent on passing
drawing list references around with SCH_ITEM* objects.
2020-01-10 06:37:08 -08:00
Jeff Young e85701f405 Don't allow IS_NEW flag on created-line-segments to fool us.
When dragging we'll create new line segments between selection-edge
objects and things outside the selection that they're attached to.
These new lines have their IS_NEW flags set, but shouldn't fool us
into thinking that the selection contains pasted (or placed) items.
2019-12-28 11:58:33 +00:00
Jeff Young 87e163945e Items added to a selection for a drag should only be temporary.
After the drag, cancel, or undo, only the originally-selected items
should remain selected.
2019-12-28 11:58:33 +00:00
Jeff Young fb52124426 Fix several issue with bus entry connectivity.
When dragging a bus the entry is connected to the bus so the wire
connected to the entry (if any) needs to stretch.

While an entry can connect in the middle of bus, it cannot connect
in the middle of a wire.

Fixes: lp:1849973
* https://bugs.launchpad.net/kicad/+bug/1849973
2019-11-18 11:36:30 +00:00
Seth Hillbrand 080275b4ee Cleanup wire merge code 2019-10-18 20:15:29 -07:00
Jeff Young d9336e9f97 Reset autoplace flag when a field is moved with respect to its component.
Fixes: lp:1843929
* https://bugs.launchpad.net/kicad/+bug/1843929
2019-10-01 15:31:52 +01:00
Seth Hillbrand f2bf9fa534 eeschema: Prevent crash on move/drag re-entry
Restarting a move/drag operation breaks the stack by starting the tool
without popping it on exit.

TODO: implement RAII for these stack push/pop
2019-09-11 17:01:16 -07:00
Jeff Young 5e353e8967 Fix another case of selection getting out of sync with dragged items.
Use a big hammer this time.

Fixes: lp:1839780
* https://bugs.launchpad.net/kicad/+bug/1839780
2019-08-31 20:23:06 +01:00
Jeff Young 71c7bf3274 Avoid ghosting items in original location when pasting. 2019-08-29 23:56:16 +01:00
Jeff Young bc450853ae More robust solution for adding dragged items to selection.
Fixes: lp:1839780
* https://bugs.launchpad.net/kicad/+bug/1839780
2019-08-29 23:56:16 +01:00
Jeff Young a5a237ac32 Improve readability of flag checking. 2019-08-27 19:23:07 +01:00
Jeff Young 3cdf88f2c6 CERN copyrights for work packages. 2019-08-14 09:35:15 +01:00
Michael Kavanagh b414cbfada Cleanup doDelete ACTIONs 2019-08-12 13:49:55 -04:00
Ian McInerney ce7833b982 Warp display when selecting schematic items
When selecting items where the reference point is off-screen, GTK
would default the cursor to jump to the bottom of the screen.

Fixes: lp:1838843
* https://bugs.launchpad.net/kicad/+bug/1838843
2019-08-03 19:17:53 -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
Seth Hillbrand 5324b65fb0 eeschema: Don't trust the pointer
We are not guaranteed a selection.  Keep pointers to the front items
guarded.  This can happen after repeating a new item, e.g.
2019-07-17 18:21:36 -07: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 029b624e96 When adding new wires due to directly-connected items, don't try and de-select them after an undo. The won't be around anymore.
Fixes: lp:1836218
* https://bugs.launchpad.net/kicad/+bug/1836218
2019-07-11 17:36:32 +01:00
Jeff Young a9c66e15ea Common-ize EE_ACTIONS::refreshPreview and use it after cursor actions.
Fixes: lp:1818667
* https://bugs.launchpad.net/kicad/+bug/1818667
2019-07-05 14:45:15 +01: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
Seth Hillbrand e16bf40e60 eeschema: Insert junctions when repeating
This is the v6 analog to 697234dd5

Fixes: lp:1832253
* https://bugs.launchpad.net/kicad/+bug/1832253
2019-06-18 20:12:08 -07: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 c7bfa9857e Use more reflective naming of what the tool does. 2019-06-16 19:52:07 +01:00
Jeff Young 5610261dce Immediate-action hotkeys (and context menu actions) for eeschema. 2019-06-15 20:43:51 +01:00