Commit Graph

171 Commits

Author SHA1 Message Date
Jeff Young 7e0ba42f0e Bug fixes for dragging labels attached to wires in orthogonal mode.
Fixes https://gitlab.com/kicad/code/kicad/issues/12677
2022-11-25 15:05:15 +00:00
Jeff Young bc271a8d15 Protect move tool from re-entrancy.
m_dragInProgress is usually sufficient, except when we haven't started
one yet.  In any case, conflating the two is probably a bad idea.

Fixes https://gitlab.com/kicad/code/kicad/issues/12936
2022-11-18 17:08:38 +00:00
Jeff Young 8dea227da7 Special cases for sheet-pin dragging.
Fixes https://gitlab.com/kicad/code/kicad/issues/11949
2022-10-12 16:36:54 +01:00
Jeff Young 3231bc5be3 Formatting and cleanup. 2022-10-12 16:36:54 +01:00
Jeff Young 7bb0275d3c Fix incompatibility with old rubber-band wire algo and new ortho wire drag alog.
Fixes https://gitlab.com/kicad/code/kicad/issues/11948
2022-10-03 22:12:23 +01:00
Jeff Young c6284f4835 Formatting. 2022-10-03 22:12:23 +01:00
Jeff Young 83a7ab2449 Initialize resolved status of newly created wires during drag operation.
Fixes https://gitlab.com/kicad/code/kicad/issues/12522
2022-09-27 14:12:06 +01:00
Mike Williams 9304607624 TOOL_EVENT: make command string non-optional
We're getting segfaults in places where this isn't checked. Also, add
some asserts so we can catch bad tool push/pop.

Removes all uses of GetCommandStr() and makes it private.
2022-09-19 10:23:09 -04:00
Seth Hillbrand b736460e71 Move optional access from value() to *operator
`value()` throws.  Where we check for existence, we don't need to use
the throwing version and should just use the unprotected variant
2022-08-30 13:59:39 -07:00
Seth Hillbrand f1261e71d4 Replace boost::optional with std::optional 2022-08-25 15:50:47 -07:00
Jeff Young aa2ad3b44c Move KICAD_T[] to std::initializer_list<KICAD_T>. 2022-08-20 10:28:11 +01:00
Seth Hillbrand 35ac39844f Clean up some auto usage
Don't make new copies of shared_ptr if we can use references.  Keep auto
usage down to hard-to-type-out sequences
2022-08-15 11:29:45 -07:00
Jeff Young bdffbbd43b Handle rotation while moving from move tool.
This keeps us from getting CancelInteractive events in the move tool
when the EditTool runs to do the rotate.

Fixes https://gitlab.com/kicad/code/kicad/issues/12004
2022-07-22 09:31:09 +01:00
Jeff Young 29900cad34 Add create-wire logic to labels.
Fixes https://gitlab.com/kicad/code/kicad/issues/11768
2022-06-10 22:38:01 +01:00
Jeff Young bce1fd337b Second tool hotkey accepts action (ie: acts as click).
Fixes https://gitlab.com/kicad/code/kicad/issues/11729
2022-06-09 16:54:04 +01:00
Simon Richter bd7447cff3 Fix variable name
This is the top left position, not the top right.
2022-05-05 10:27:19 +00:00
Mike Williams 653baf270c Schematic: drag created / changed segments need junction checks
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10844
2022-04-18 17:24:02 +00:00
Jeff Young 8dc680adbb Implement align-to-grid for sheets.
Fixes https://gitlab.com/kicad/code/kicad/issues/11201
2022-03-29 19:31:02 +01:00
Mike Williams 2a726a882f Schematic: new feature, force 45 degree lines
* New modes to force 45 deg angle at beginning or end of line

* Backspace will undo most recent segment added

* / will toggle posture of 90 and 45 degree lines

* Added alg::signbit for convenience

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10869
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/9175
2022-03-28 16:07:23 -04:00
Mike Williams e51ab86225 Schematic Drag: fixes and improvements
Fixes:
* Various special cases around junctions on pins and dragging.

* Some rotations of endpoints resulting in a 45 degree rotate.

* Some cases where it was possible to get a line with neither
  endpoint selected, and also substractive unselecting only one of two
  selected endpoints unselecting both.

* Use line midpoint for sorting.  Start and endpoints aren't
  consistent in the order they appear on the X or Y axis. So,
  we need to use the midpoint for our position for consistent
  sorting when dragging groups of parallel lines where some
  have the start and end reversed.

Other:
* Rename TEMP_SELECTED TO SELECTED_BY_DRAG. This is the actual meaning
  of the flag, and should reduce confusion as
  to when it should be used.

* Move usage of TEMP_SELECTED as an algorithmic mark to CANDIDATE
  instead.

* Fix mistaken clearing of START_POINT and ENDPOINT.

* Move endpoint setting and clearing out of narrowSelection, and into
  selectPoint and selectMultiple.

* Don't show dangling end warnings on new lines
2022-03-28 16:02:48 -04:00
Jeff Young 05bca282f7 Re-entrancy blocker for line/wire/bus tool.
Also clear infobar messages after a cancelInteractive.

Fixes https://gitlab.com/kicad/code/kicad/issues/11155
2022-03-17 15:27:33 +00:00
Jeff Young a2772b3363 Don't crash on highight net during drag.
Fixes https://gitlab.com/kicad/code/kicad/issues/10866
2022-02-21 13:30:15 +00:00
Mike Williams d0749c4e9a Schematic: more drag undo fixes
Drag was not clearing IS_CHANGED status of items that were moved by the
drag, but weren't selected or created by it.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10845
2022-02-20 11:49:18 +00:00
Seth Hillbrand 24ac516135 Trim wires based on how many pins they intersect
If a wire intersects more than 2 pins from the same symbol, we don't
trim connections.  If the wire intersects exactly two pins from a single
symbol, we remove the wire between the pins.

We avoided doing this before because we didn't have a good metric for
trimming vs. not.  But the per-symbol calculation feels like the least
surprising option.

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

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

(cherry picked from commit 75a4036e45)
2022-02-19 16:54:45 -08:00
Mike Williams 97797c44b9 Schematic: added drag wires undo/redo fix
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10845
2022-02-15 19:31:17 +00:00
Seth Hillbrand 45a1a9a715 Replace awkward double cast with binary logic
The use of XOR with integers here is needed as MSVC doesn't implement
the use of std::signbit for integers and casting up to double just to
get the signbit feels wrong
2022-02-15 10:13:59 -08:00
Marek Roszko 3129f96686 Add awkward cast to double due to msvc conflict
https://github.com/microsoft/STL/issues/519
2022-02-14 21:43:11 -05:00
Mike Williams 9c59c4ee12 Schematic: orthogonal drag bends should depend on move direction
Prevents overlapping lines when possible.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10844
2022-02-14 22:52:34 +00:00
Mike Williams 21b59b4b6a Eeschema: fix bus label drag adding a line
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10822
2022-02-11 21:30:50 +00:00
Mike Williams a5e8575091 Eeschema: Implement orthogonal dragging
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1956
2022-02-10 18:38:40 +00:00
Jeff Young c6a8100d46 Schematic and symbol text boxes.
Also fixes some plot bugs with arcs.

Also moves polygonization of arcs (when required) in plotting code
from 5 degrees to calculated based on ARC_HIGH_DEF.

Fixes https://gitlab.com/kicad/code/kicad/issues/5017
2022-01-28 21:38:15 +00:00
Jeff Young 3409783d9f Break sch_text.h/.cpp into sch_text and sch_label.
Also moves SCH_NETCLASS_FLAG to SCH_DIRECTIVE_LABEL, and remaps Altium
harnesses from SCH_TEXT to SCH_DIRECTIVE_LABEL.
2022-01-28 21:38:15 +00:00
Marek Roszko 34e90e5045 Silence MSVC warnings about type mismatch and unused var 2022-01-01 14:41:36 -05:00
Marek Roszko c4c56de708 Neurotically update position wxPoint usages 2022-01-01 11:55:51 -05:00
Marek Roszko 347e03363a Convert wxPoint/wxSize starting from EDA_RECT usages 2022-01-01 11:30:33 -05:00
Jeff Young 889970a449 SCH_NETCLASS_FLAGs and SCH_FIELDs for labels.
ADDED: a new label type for netclass flags.
ADDED: the ability to define fields on labels.
2021-12-24 16:13:27 +00:00
Seth Hillbrand 85ab4e5886 Don't deselect wires when aligning
This makes undo/redo look really strange as the other elements get
aligned but the wires do not (or rather their unconnected ends do not)

Fixes https://gitlab.com/kicad/code/kicad/issues/9275
2021-11-30 16:30:28 -08:00
dsa-t 5750e38102 Re-enable and fix Move+Autoplace Fields
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9766
2021-11-29 20:48:16 +00:00
Jeff Young a224d8dd6c Disable autoplace fields when dragging/moving.
Fixes https://gitlab.com/kicad/code/kicad/issues/9766
2021-11-28 19:18:08 +00:00
Roberto Fernandez Bautista b572781a8a eeschema: Update anchor position of pasted items after initial move
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9534
2021-11-06 16:03:41 +00:00
Jeff Young 996a5b85a6 Overhaul IsJunctionNeeded logic to support all the different cases.
Several clients were using this with different needs.  The API is
now more explicit (and there are more options under the hood).

Fixes https://gitlab.com/kicad/code/kicad/issues/9518
2021-11-04 12:57:16 +00:00
Jeff Young b8d193485d Respect selection reference point when set.
Fixes https://gitlab.com/kicad/code/kicad/issues/8520
2021-10-18 18:09:40 +01:00
Seth Hillbrand 71602475eb Allow rotate/mirror even when dragging
Keeps the lines connected but doesn't solve the crossed-wire mixups.
This allows common usage (mirroring labels/rotating segments) and leaves
prevention of the crossed wires to the user.

We can't really prevent crossed wires when rotating e.g. a part with
wires connected to 4 sides and users will not expect that.  But we
should not disable useful features like mirroring multiple parallel
items to avoid a known impossible situation

Also provides an alternative solution to 345f506f0c that allows us to
rotate groups without destroying connections on hover

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

Fixes https://gitlab.com/kicad/code/kicad/issues/8523
2021-09-23 14:47:49 -07:00
Jeff Young fdfecf5932 Don't push view control settings to the previous active tool.
See further comments in bug report.

Fixes https://gitlab.com/kicad/code/kicad/issues/9147
2021-09-13 13:28:05 +01:00
Wayne Stambaugh 8fd83cbb95 Pass wxPoint objects by reference instead of on the stack. 2021-07-26 15:35:33 -04:00
Jeff Young a1a48a4c42 Don't allow rotation/mirroring while dragging.
Fixes https://gitlab.com/kicad/code/kicad/issues/8523
2021-06-13 20:22:25 +01:00
Wayne Stambaugh fbc135e69f Rename SCH_COMPONENT to SCH_SYMBOL. 2021-06-10 10:34:49 -04:00
Jon Evans 9ffa2955b7 Fix drag of bus wire creating net wires 2021-06-03 22:29:04 -04:00
Jeff Young 0598c82972 Terminology (use present tense for flags). 2021-05-31 12:26:44 +01:00
Jeff Young 2a856890e6 Allow connections between sheet (pins) and symbols.
Fixes https://gitlab.com/kicad/code/kicad/issues/8305
2021-05-12 00:07:17 +01:00