Commit Graph

253 Commits

Author SHA1 Message Date
Jeff Young 0ad0627bb0 Overhaul drag-select logic to handle children better.
Fixes https://gitlab.com/kicad/code/kicad/issues/6662
2021-12-10 18:44:07 +00:00
dsa-t 9c619d8f4e Allow some navigation tools when selecting
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9565
2021-12-07 23:00:39 +00:00
Jeff Young 863699f2d1 Fix logic error in selection tool.
Any new selection made by clicking is not a hover selection.

Fixes https://gitlab.com/kicad/code/kicad/issues/9857
2021-12-02 16:56:47 +00:00
Jeff Young 80d6b9e76d Tighten up hittesting for symbols and other items.
Grid-based accuracy doesn't need to be any larger than 1/2 the
diagonal as we'll snap to one side or the other.  And symbols don't
need as much slop as other items since there's plenty of "meat" on
them.

Fixes https://gitlab.com/kicad/code/kicad/issues/9805
2021-11-28 19:03:51 +00:00
Jeff Young 9f7db24871 Selection bug fixes for Symbol Editor.
1) Make sure the y-coord is correctly inverted before calling collision
routines.
2) Give LIB_SHAPE poly lines the same extra slop as SCH_LINEs.

Fixes https://gitlab.com/kicad/code/kicad/issues/9791
2021-11-27 15:17:05 +00:00
Jeff Young 5e6da9f964 Auto-start-wire tool requires an up-to-date connectivity.
Fixes https://gitlab.com/kicad/code/kicad/issues/9628
2021-11-25 01:24:35 +00:00
Wayne Stambaugh 53f5d616aa Coverity issue fixes. 2021-11-13 11:38:31 -05: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 40b4052ad4 Improve text hittesting in schematics.
Text has a fairly big bounding box to account for descenders, overbars,
etc., but it makes it feel too sloppy for hittesting.  This change
allows selection disambiguation to look at the actual strokes of the
text when deciding what's "closest".

Fixes https://gitlab.com/kicad/code/kicad/issues/9506
2021-11-01 21:13:12 +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
Jeff Young b52529521e Replace individual LIB_* shapes with LIB_SHAPE (based on EDA_SHAPE).
Also moves to more capable FILL_T model that can be shared.
2021-10-15 12:45:43 +01:00
Seth Hillbrand bb5c58b3cf Set default force cursor off in auto-lines
Leaving the forced position on results in the auto-line linking to a pin
for far longer than we intend if there are other hits in the area of the
cursor

Fixes https://gitlab.com/kicad/code/kicad/issues/9321
2021-10-05 20:28:05 -07:00
Seth Hillbrand dd1d36d40a Fix segfault when check for editing points
The point editor is not always available when checking for points.  We
need to handle the missing tool without crashing
2021-09-30 17:25:33 -07:00
Jeff Young 12b726ba2f Prevent the point editor from fighting with other tools.
1) Don't start a long-click timer when the point editor is active.
2) Don't auto-start a wire when the point editor is active.

Fixes https://gitlab.com/kicad/code/kicad/issues/9270
2021-09-29 19:16:06 +01:00
Mike Williams d90dc77e00 Selection: Don't drop small moves
If we do a real drag, the timer will be cancelled. If we don't, then
the user is still holding the mouse button down and would probably like
to see the menu. Otherwise it appears the action is dropped.
2021-09-27 16:44:32 +00:00
Jeff Young 42687f5d9d Give selection preference to pins over wires.
Fixes https://gitlab.com/kicad/code/kicad/issues/9063
2021-09-23 23:59:20 +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 4b38bd1543 Favour junction dots to wires inside the dot.
Fixes https://gitlab.com/kicad/code/kicad/issues/9187
2021-09-23 22:13:56 +01:00
Seth Hillbrand 671aec5da6 In fallback selection, handle cancelled menu
doSelectionMenu returns false to indicate a cancelled menu.  This needs
to be handled in selectPoint when directly accessing doSelectionMenu in
the same manner as SelectionMenu() events

Fixes https://gitlab.com/kicad/code/kicad/issues/9218
2021-09-23 11:48:29 -07:00
Jeff Young ec2ac181a2 Further simplify selection logic.
The select-single-wire stuff is no longer needed, and the prefer-wire-ends
stuff needs to be distance-based.

Also improved wire hit-testing to include bubbles the size of the dangling
symbol at each end.

Fixes https://gitlab.com/kicad/code/kicad/issues/9187
2021-09-21 20:27:35 +01:00
Jeff Young a5c4bace60 Improve (and simplify) wire and pin hit-testing.
1) Expand the accuracy to at least the grid spacing
2) Move pin-selects-symbol logic to Selectable()
3) Recode pick-closest algorithm to handle exactHits and inexactHits
separately
4) Remove pin target from bounding box in favour of expanding it to
at least as wide as the pin decoration (this prevents the accuracy
off the end of the pin from growing too large)
2021-09-19 11:34:43 +01:00
Jeff Young a291cae2fd Make sure intersheetRef bounding boxes get updated in RTree.
Fixes https://gitlab.com/kicad/code/kicad/issues/9177
2021-09-18 18:32:19 +01:00
Seth Hillbrand 484eaa01b9 Try harder to avoid loop contention
We have two cases where we might be requesting a disambiguation menu.
In one case, we already have the event loop waiting and we need to run
the selectionMenu through the action system.  In the other case, the
tool isn't on the stack and won't activate.  Here we need to run
directly and we are assured of not crashing because the tool isn't
active.

Fixes https://gitlab.com/kicad/code/kicad/issues/9154
2021-09-13 10:17:04 -07:00
Seth Hillbrand 29c2f3b7d4 Prevent jumping into disambiguation if moved
Moving points should not be overrided by disambiguation menu, so we
track where the disambiguation event started and only trigger the menu
if the mouse hasn't moved a full unit in x/y

Fixes https://gitlab.com/kicad/code/kicad/issues/9132
2021-09-09 16:24:18 -07:00
Seth Hillbrand c8b2e69332 Check if selection is primary tool
Previously, we were checking if the selection tool was the top of the
stack but this ignored many other "secondary" tools that might be
running such as the point editor.  These still allow the selection tool
to handle events such as clicks.  This change allows the selection tool
to handle clicks when it is the primary tool on the stack rather than
the top

Fixes https://gitlab.com/kicad/code/kicad/issues/9110
2021-09-07 10:42:01 -07:00
Seth Hillbrand 0f38a35531 Be sure to stop the timer when triggering d-click
Some mice apparently trigger double-click without triggering a click, so
stop the timer when we receive this event

Fixes https://gitlab.com/kicad/code/kicad/issues/9106
2021-09-06 12:27:31 -07:00
Seth Hillbrand 240c3b75c4 Move selection disambiguation to long-click
This standardizes selection tools in SELECTION_TOOL class to be able to
handle a long-click as asking for a non-heuristic disambiguation menu.

Fixes https://gitlab.com/kicad/code/kicad/issues/8490
2021-09-05 13:42:51 -07:00
Jon Evans 766b67a8f1 Tune selection of wire endpoints near other objects
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8941
2021-08-12 22:04:24 -04:00
Jeff Young 04764c9224 Allow dragging of fields in symbol aliases.
Fixes https://gitlab.com/kicad/code/kicad/issues/8698
2021-07-01 21:03:53 +01:00
Wayne Stambaugh ee3eac325d Expunge the use of the word part from Eeschema code. 2021-06-15 08:32:11 -04:00
Wayne Stambaugh 71c183d7bb Rename LIB_PART to LIB_SYMBOL. 2021-06-14 07:11:17 -04:00
Wayne Stambaugh fbc135e69f Rename SCH_COMPONENT to SCH_SYMBOL. 2021-06-10 10:34:49 -04:00
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Jeff Young 0598c82972 Terminology (use present tense for flags). 2021-05-31 12:26:44 +01:00
Jeff Young 7c66a0a594 Selection routines should never be snapped. 2021-05-09 18:14:41 +01:00
Wayne Stambaugh 2b86b34124 Eeschema: split out SCH_SHEET_PIN declarations into separate header. 2021-04-06 17:15:49 -04:00
Roberto Fernandez Bautista 7d9ee76f64 Don't iterate through m_selection if deleting items from it
Use the copied container saved_selection instead

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8126
2021-04-05 18:40:40 +00:00
jean-pierre charras bbd7b4ca8c Eeschema, selection tool: uniformize the cursor shape and the actual modifiers.
SHIFT, CTRL, ALT modifier keys were handled in 2 different codes, one for
the selection tool and another to modify the mouse cursor shape, with 2
different configs.
Now the modifiers are managed from only one function.
Pcbnew: group also SHIFT, CTRL, ALT modifier keys management to a specific function.
Fixes #8021
https://gitlab.com/kicad/code/kicad/issues/8021
2021-03-25 10:28:20 +01:00
Jeff Young cf4cbea8a1 Use a more robust storage of items added to drag.
We kept having various issues of the pointer list going stale.  This
will prevent all permutations of that.

Also while I was in there I fixed the double-move thing (see bug
number).

Fixes https://gitlab.com/kicad/code/kicad/issues/7910
2021-03-22 13:51:10 +00:00
Jon Evans c5c348538e Fix some STL asserts in EE_SELECTION_TOOL 2021-03-21 22:01:45 -04:00
Jon Evans 18037e2f65 Rework bitmap system to load from archived PNGs
Bitmaps are now identified by an enum class instead of by pointers.
Bitmap loading and caching is now handled by a class in common, and
we no longer compile most bitmaps into the binary, so there is no
longer a bitmaps static library.

Instead, bitmaps are archived to a .tar.gz file which is installed
in ${KICAD_DATA}/resources/images.tar.gz

The source PNGs are checked in to Git as the original CPP files were,
so that people can build without the required dependencies to convert
SVGs to PNGs.

Initial support is also added for dark theme icons, although this
is not yet exposed in the GUI.

Stubs are present for multi-resolution image resources, but this is
not fully-baked yet and could use some refinement.
2021-03-11 08:37:35 -05:00
Jon Evans 720147d272 Remove transitive inclusion of bitmaps.h 2021-03-07 16:08:57 -05:00
Jeff Young 22b4a74bfa Don't forget intersheet refs when collecting non-view items.
Fixes https://gitlab.com/kicad/code/kicad/issues/7819
2021-03-07 15:04:01 +00:00
Jeff Young 3ab1ef7b83 Formatting. 2021-03-07 15:04:01 +00:00
PJM 0fc8a9d89a Eeschema: Fix ctrl-MMB double click to perform 'Zoom to Objects'
CHANGED: Ctrl-middle mouse button double click should perform
'Zoom to Objects' in Eeschema, but a change in modifier key handling
broke it.  This MR restores the functionality.

Fixes https://gitlab.com/kicad/code/kicad/issues/7803
2021-03-04 22:43:03 -08:00
Jon Evans 4ddb942ec0 Do not allow drag selection or drag move when already moving something
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7800
2021-03-04 19:01:31 -05:00
jean-pierre charras 9797bc5f25 Left Mouse Button: use same modifiers for Pcbnew, Eeschema and pleditor for selection.
It also means the "force disambiguation menu" uses now Ctrl in Eeschema and pleditor.
2021-02-25 08:22:35 +01:00
Jeff Young 2fd5f25c3c Allow expand selection to work (even if you probably can't get there).
I think the guessSelectionCandidates narrows down to a single item
in 99.9% of cases, so we can probably remove this entirely.  But for
now it's safer just to fix it.
2021-02-24 14:12:32 +00:00
Wayne Stambaugh 1786ae8773 Eeschema: use symbol nomenclature for object file naming. 2021-02-24 08:48:02 -05:00
Jeff Young 7318417ca4 Fix typo in expand-selection-disambiguation menu logic.
Fixes https://gitlab.com/kicad/code/kicad/issues/7654
2021-02-23 22:09:00 +00:00
Jeff Young 781d293b60 Add option for text updating to Update Symbol.
Fixes https://gitlab.com/kicad/code/kicad/issues/6420
2021-02-22 00:36:40 +00:00
Jeff Young afb4bbde47 Bug fixes to Eeschema context menu.
1) Fix typo in SingleSymbolOrPower
2) Remove Edit reference/value/footprint items for power symbols
2021-02-21 23:45:32 +00:00
Mikolaj Wielgus f9c42585fb Force immediate action for auto start wire feature
Fixes https://gitlab.com/kicad/code/kicad/issues/7503
2021-02-21 18:43:34 +00:00
Jeff Young 18d4d517b0 Implement RMB Import Sheet Pin as a single-shot.
Fixes https://gitlab.com/kicad/code/kicad/issues/7638
2021-02-21 15:46:53 +00:00
Jeff Young 26cb05051b fixup! Whittle down library tree context menus to be more contextual. 2021-02-19 19:07:45 +00:00
Jeff Young 57e043e0e6 Don't allow moving markers. Do allow excluding them. 2021-02-19 19:07:45 +00:00
James Jackson 48853d0c88 Eeschema: Allow auto-wiring / drawing from unconnected bus and graphic line endpoints
Fixes https://gitlab.com/kicad/code/kicad/issues/7537
2021-02-19 17:15:27 +00:00
Seth Hillbrand a25dfcd1b4 Allow "Update Symbol" command on power symbols
Power symbols can be modified in the library so it is useful to allow
them to be updated with the right-click menu
2021-02-17 15:31:22 -08:00
Seth Hillbrand 55e34592a6 Fix expand selection option in Eeschema 2021-02-15 10:53:17 -08:00
James 9205f1571d EE_SELECTION_TOOL correctly identifies buses and wires for auto starting 2021-02-15 14:57:06 +00:00
Jon Evans 1bec10b6fa Make it easy to select small things overlapping symbols
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7487
2021-02-11 12:13:46 -05:00
Jeff Young 147c839857 Allow drag-select of fields.
Fixes https://gitlab.com/kicad/code/kicad/issues/6662
2021-02-01 17:14:30 +00:00
Seth Hillbrand 08a932a969 Add smarts to switch selection on right-click
Now looks at how hard it is to select the item (grids) and switches only
if the mouse is more than a grid square away and there is a new item
under the mouse.

Fixes https://gitlab.com/kicad/code/kicad/issues/4455
2021-01-31 07:00:48 -08:00
Seth Hillbrand b64611af7a Make highlight net flexible with grid 2021-01-29 14:28:26 -08:00
Seth Hillbrand ea6dc0d730 Make auto-wire use snapping behavior
Forcing grid snap for the kick-start behavior loses snaps to pins that
may be desired.  This also adds force-snapping in select mode to match
the user's auto-start preferences

Fixes https://gitlab.com/kicad/code/kicad/issues/7293
2021-01-29 14:09:33 -08:00
Jeff Young ff7742c6b8 File naming and include cleanup. 2021-01-28 11:35:18 +00:00
Jeff Young 360953ba98 "comp" -> "symbol". 2021-01-19 23:50:40 +00:00
Jeff Young 351074cc48 Better-encapsulate collector sources in the selection tool.
Fixes https://gitlab.com/kicad/code/kicad/issues/7191
2021-01-19 21:10:43 +00:00
Jeff Young bae5825d1b Fix copy/paste error.
Fixes https://gitlab.com/kicad/code/kicad/issues/7119
2021-01-15 13:14:47 +00:00
Michael Kavanagh 8fba0c257b Icons: remove more inconsistencies around Select
Missed from 5d9b2d3fea
2021-01-11 23:31:24 +00:00
Jeff Young 50889a9ed6 Promote mouse drag settings to full enums. 2021-01-11 22:09:36 +00:00
Jeff Young 6c648df4c6 Support 3 drag vs. select options, and unifiy with other drag prefs.
Fixes https://gitlab.com/kicad/code/kicad/issues/5493
2021-01-11 11:50:14 +00:00
Michael Kavanagh b40e3a39f5 Minor cleanup. 2021-01-04 23:59:36 +00:00
Marek Roszko db0f3b42b4 Stop the cursor from reverting away from the window select in eeschema
Fix #6590
2020-12-29 19:51:34 -05:00
Jeff Young 8a720ef305 Update naming. 2020-12-25 23:37:01 +00:00
Jeff Young 07bb2729f8 Clean up over-use of auto. 2020-12-14 22:15:43 +00:00
Wayne Stambaugh 4516aff43e Symbol Editor: don't show edit page number in context menu.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6711
2020-12-11 15:02:34 -05:00
Jeff Young a19028a396 Hook up EE_GRID_HELPER to some more tools.
Also implements EE_GRID_HELPER layers so that connectable things
snap to connectable things and graphics snap to graphics.

Fixes https://gitlab.com/kicad/code/kicad/issues/5641
2020-12-03 15:16:34 +00:00
Jeff Young 3da0ab1a9a Fix a couple of bugs in intersheet references.
1) init reference pages before trying to draw the SCH_FIELDs when
turning intersheet references on

2) don't double redraw because we accidentally cleared the last
hover item on a non-mouse-moved event.

3) make sure the root sheet gets a name for the hypertext menu.
2020-11-29 16:53:18 +00:00
Wayne Stambaugh e91a5b3f81 Symbol editor: prevent derived symbol elements from being moved. 2020-11-23 15:46:03 -05:00
Jeff Young 3a4bd6fb8b Fix uninitialized variable. 2020-11-21 20:57:36 +00:00
Jeff Young cb5ec8bce1 Make Eeschema cursors update without waiting for mouse movement. 2020-11-18 17:32:40 +00:00
Jeff Young bd1f262a6b Fix issues with Intersheet Ref highlighting and hover actions. 2020-11-18 17:32:40 +00:00
Seth Hillbrand a4201ea833 Fix crash in libedit
LIB_ITEM is not derived from SCH_ITEM but they share a selection model
2020-11-17 14:28:56 -08:00
Jeff Young 8c5c902fa3 Re-write IntersheetRefs on top of SCH_FIELDs and textVars.
1) Generalize SCH_ITEM owners (SCH_COMPONENT, SCH_SHEET, and now
SCH_GLOBALLABEL)
2) Generalize hypertext items
3) Use SCH_FIELD autoplace infrastructure for placing intersheet
references
4) Use textVar infrastructure for buildin intersheet references.

As an important side-effect this also fixes the undo issues with
intersheet refs.
2020-11-17 16:05:49 +00:00
Jeff Young bddc97df30 LibEdit -> SymbolEditor 2020-10-31 10:28:21 +00:00
Jeff Young 45618327cf Fix crash bug closing schematic with sheet selected. 2020-10-30 15:26:07 +00:00
Wayne Stambaugh 8ff51d8899 Eeschema: add schematic sheet page number.
The groundwork has now been laid for per sheet instance data.  Initially
this only supports sheet page numbers but could be expanded to include
other per sheet instance information.

ADDED: Support for user defined schematic page numbers.
2020-10-19 14:05:45 -04:00
Marek Roszko 12d21e34e2 Remove trigo.h from eda_text.h 2020-10-13 23:37:48 -04:00
Jeff Young 0efe073dec Add wires between selected wires and unselected junctions when dragging.
Also fixes a bug where the auto-start-wire stuff was messing up the seleciton
when the selection tool wasn't at the top of the tool stack.

Fixes https://gitlab.com/kicad/code/kicad/issues/5960
2020-10-12 11:46:08 +01:00
Marek Roszko 310786333d Add missing cursors for bus, graphic lines, and hier labels
Fix #5949
2020-10-10 18:25:44 -04:00
Marek Roszko bd30a4a406 Add selection lasso and window cursors 2020-10-08 21:25:21 -04:00
Marek Roszko 7e974e5ccc Use the snapped cursor position used for detection for the wire tool autostart
Fixes #5902
2020-10-07 23:57:26 -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 c9096c7168 Re-enable selection of intersheet references.
Un-modified roll-overs and clicks still produce hypertext action, but
modified clicks and drag-selects will select.
2020-10-05 11:55:33 +01:00
Marek Roszko 676f3221cc Fix symbol editor glitches due to autostart trying to start 2020-10-03 15:47:08 -04:00
Marek Roszko 0b2b8b150d Use the event position always instead of the view cursor position
Fix #5850
2020-10-03 15:20:32 -04:00
Marek Roszko b0ffbcaba1 Fix #5850 2020-10-03 02:10:56 +00:00
Jeff Young cc617b715f Implement hypertext links for intersheet references. 2020-10-02 21:18:34 +01:00
Jeff Young c1b34b02b5 Disallow selection of intersheet references. 2020-10-02 13:50:16 +01:00