Commit Graph

194 Commits

Author SHA1 Message Date
Wayne Stambaugh a1fb8e1b1d Coverity fixes and code cleaning. 2023-03-06 07:12:18 -05:00
Marek Roszko aacc9746e3 Yeet the last of wxSize/wxPoint to stop leaking gdicmn everywhere 2023-02-18 22:57:18 -05:00
Jon Evans fc68b8d71a Make selected background layers translucent
We can't render them underneath other objects, but we can at least
make it possible to see other objects through them.
2023-02-16 22:45:29 -05:00
Seth Hillbrand 43e4797d4d Don't double-tap Connectivity Recalculate
SCH_EDIT_FRAME::RecalculateConnections() calls SchematicCleanup and then
resets the connectivity graph and recalculates it.  OnModify() also
calls RecalculateConnections().  For long calculation schematics, this
can impact usability
2023-01-24 10:30:52 -08:00
Jeff Young cb58cb8cd3 Put new lines and junctions on the right layer.
Fixes https://gitlab.com/kicad/code/kicad/issues/13505
2023-01-12 15:17:45 +00:00
jean-pierre charras 4d5c4c4ea8 Ensure all selected items have their edit flags cleared after move.
Some sub-items like fields can be selected, and are not in the main item list.
Fixes #13435
https://gitlab.com/kicad/code/kicad/issues/13435
2023-01-08 11:52:21 +01:00
jean-pierre charras c2f7dbfc15 Eeschema, AlignElements(): fix broken align of lines (bus, wire, graphic line)
It was due to a recent change (commit d824b7f5)  for SCH_LINE_T in
SCH_MOVE_TOOL::moveItem()
2023-01-07 09:06:03 +01:00
Jeff Young 8dc7baad3d Cleanup actions should not activate tools. It causes all manner of side-effects.
Fixes https://gitlab.com/kicad/code/kicad/issues/13331
2023-01-06 22:15:20 +00:00
Jeff Young 933a5d45e1 Be more aggressive about clearing edit flags after operations.
Fixes https://gitlab.com/kicad/code/kicad/issues/13173

Fixes https://gitlab.com/kicad/code/kicad/issues/13385
2023-01-05 18:08:22 +00:00
Mike Williams bd5d10cd7b Schematic: remove more extraneous dangling symbols 2023-01-04 11:07:23 -05:00
Mike Williams e65de51fc7 Schematic: label auto orientation needs to respect move/drag/change
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13226
2022-12-28 14:30:57 -05:00
Mike Williams 6cc17e4a16 Schematic: new flag IS_BROKEN for trimming BreakSegment danglers 2022-12-28 12:27:57 -05:00
Mike Williams b5b65e1455 Schematic: update dragged lines dangling state in realtime
Makes the visuals a little nicer as we add bend lines
2022-12-28 12:27:57 -05:00
Mike Williams 8ca8f83a18 Schematic: sheet pin dragging special case needs to check endpoints
Otherwise we'll force the wrong end of a line to be special-cased
2022-12-27 12:15:49 -05:00
Mike Williams 33b774685b Schematic: fix inconsistent selected-by-drag behavior of mid-line labels
Two issues here:

Selected labels would half of the time add junctions splitting lines
when the lines would have been selected-by-drag (removing the need for a
junction).

Split lines aren't selected by drag by default, and we need to test
labels against lines that are selected by drag.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13224
2022-12-27 12:15:49 -05:00
Jeff Young ba4a7a979a Don't respond to Duplicate events while placing multiple copies of a symbol.
It doesn't really make any sense as clicking will just create another copy
as well.

Fixes https://gitlab.com/kicad/code/kicad/issues/13253
2022-12-24 19:40:39 +00:00
Mike Williams 389f0655cd Schematic: re-enable old break wire functionality, add slice
Also fix break/slice wires for multiple wires. The shortcut and code
always allowed it, the context menu just didn't appear.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13163
2022-12-19 15:55:59 -05:00
Mike Williams 5e72a1008b Schematic: don't trim unchanged segments that are connected
Previously if you had a wire with two unconnected ends and dragged the
end of another wire to connect with one end, it would delete the first
wire.
2022-12-13 09:03:23 -05:00
Mike Williams d824b7f506 Schematic: move wires always moves the whole line
Discussion here:
https://gitlab.com/kicad/code/kicad/-/issues/13022#note_1205922621
2022-12-12 14:45:06 -05:00
Jeff Young 2459b61aa6 Don't add second half of line and new juction to screen twice.
Fixes https://gitlab.com/kicad/code/kicad/issues/13129
2022-12-12 13:44:47 +00:00
Jeff Young 45eae3e594 Don't Simplify() polys with arcs in them.
Fixes https://gitlab.com/kicad/code/kicad/issues/13134
2022-12-12 12:54:34 +00:00
Mike Williams 5b2020daf5 Schematic: only delete dangling lines not created directly by the user 2022-12-01 13:13:45 -05:00
Seth Hillbrand 01cf6d76d8 Remove newly dangling lines when dragging
These lines are remnants from drag operations that should be cleaned
after commiting the new line positions

Fixes https://gitlab.com/kicad/code/kicad/issues/12870
2022-11-30 13:46:38 -08:00
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