Commit Graph

169 Commits

Author SHA1 Message Date
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
Mark Roszko c940a45937 ADDED: Autostart wires in eeschema
Allows wires to be automatically started by clicking over a connection point
2020-10-01 23:53:47 +00:00
Jon Evans 71ed7ee707 Revert "Drag preselected items even when "prefer selection to dragging" enabled"
This reverts commit d530e2c2cd.
2020-10-01 18:23:30 -04:00
Jon Evans d530e2c2cd Drag preselected items even when "prefer selection to dragging" enabled
Not being able to drag an already-selected item feels broken
2020-09-30 20:10:13 -07:00
PJM b0e05ad9bf Eeschema: Check for NULL pointer when using interactive delete tool
CHANGED: If you start the interactive delete tool and the mouse pointer
isn't near anything, Eeschema tries to use a null EDA_ITEM pointer
which throws an exception.  This commit checks if the pointer is null
and exits if it is.
2020-09-30 23:05:29 +00:00
PJM e77b7e3360 Make MMB double click perform 'Zoom to Fit'
ADDED: Make middle mouse button double click do a 'Zoom to Fit'
in Eeschema, Pcbnew, and Gerbview.  Ctrl-MMB does a 'Zoom to Objects'
in Eeschema.

Fixes https://gitlab.com/kicad/code/kicad/issues/1988
2020-09-22 23:21:44 +00:00
Jeff Young 39bdc547af Smarten up the guess selection routine to pick closest item.
Fixes https://gitlab.com/kicad/code/kicad/issues/5697
2020-09-19 15:55:27 +01:00
Jeff Young 97c34e2516 ADDED alternate pin definitions and assignments.
Fixes https://gitlab.com/kicad/code/kicad/issues/2002
2020-08-21 18:29:36 +01:00
Seth Hillbrand 7565a08396 eeschema: Add select all to schematic and library editor
Fixes https://gitlab.com/kicad/code/kicad/issues/2497
2020-08-20 16:07:10 -07:00
Ian McInerney 3b05d7cddd Move more frames to the new UI condition framework
* Frames moved: cvpcb, cvpcb footprints frame, gerbview, pagelayout editor

This also introduces new EDITOR_CONDITIONS that are used to set the
conditions of very common editor settings.

Also, some IDs were converted to tools in the pagelayout editor.
2020-08-16 19:10:25 +00:00
Seth Hillbrand 7cea4b23f1 ADDED: Expand selection in context menu
Break out the context menu with heuristically limited choices being
appended to the main list rather than re-selecting

Fixes https://gitlab.com/kicad/code/kicad/issues/4799
2020-07-07 14:18:35 -07:00
Jeff Young e66523586b Add Assign Netclass... to context menu.
ADDED Assign Netclass feature to EEschema.

Netclass assignments also now shown in status bar.

Fixes https://gitlab.com/kicad/code/kicad/issues/4581
2020-07-07 14:23:39 +01:00
Wayne Stambaugh 52078a4b1b Allow setting mandatory derived symbol field properties.
CHANGED: All mandatory fields in derived symbols can be edited.  This
not only includes the field value but also all text properties.

Kill the dual datasheet variable storage which caused many datasheet
bugs over the years.  The datasheet is now always stored in the data
sheet field.
2020-06-02 14:21:11 +00:00
Jon Evans 1792479ca5 Fix sheet pin import after SelectPoint API change
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4552
2020-05-27 11:21:59 -04:00
Mikołaj Wielgus ecec7192fc Add "Select All" in schematic & layout disambiguation popup menu
ADDED: "Select All" in schematic editor disambiguation menu
ADDED: "Select All" in layout edtor disambiguation menu

Fixes https://gitlab.com/kicad/code/kicad/-/issues/3877
2020-05-24 23:35:04 +00:00
jean-pierre charras 4cfff6b35d Libedit: fix crash when right clicking.
Fixes #4511
https://gitlab.com/kicad/code/kicad/issues/4511
2020-05-22 09:01:29 +02:00
Jon Evans d7bd4c9b04 Move Eeschema globals to new SCHEMATIC object
Set up a new lineage for SCH_ITEMS to get back to the SCHEMATIC
they live on: Items will all be parented to the SCH_SCREEN that
they are added to, and each SCH_SCREEN will point back to the
SCHEMATIC that it is part of.  Note that this hierarchy is not
the same as the actual schematic hierarchy, which continues to
be managed through SCH_SHEETs and SCH_SHEET_PATHS.
2020-05-18 13:04:56 -04:00
Ian McInerney facf40d3ce libedit: Add drag to move behavior
ADDED: Drag to move behavior in the symbol editor

Fixes https://gitlab.com/kicad/code/kicad/issues/1904
2020-04-23 23:58:33 +01:00
Jeff Young 122b1ddaae Unwrap an unnecessary layer now that we have new config stuff. 2020-04-13 20:58:12 +01:00
Jeff Young c4994eee7b Fix a pair of bugs in the new highlight net logic.
Fixes https://gitlab.com/kicad/code/kicad/issues/4180
2020-04-11 13:02:18 +01:00
Jeff Young 962aa73e12 Improve EE_COLLECTOR to not miss children of sheets or symbols.
Also implements pin highlighting and special cases for power symbols.

Fixes https://gitlab.com/kicad/code/kicad/issues/4180
2020-04-10 14:09:26 +01:00
Jeff Young 20c00cbb21 Finish off "busses" -> "buses".
Fixes https://gitlab.com/kicad/code/kicad/issues/4144
2020-04-02 18:27:05 +01:00
Jeff Young 4990d1e7b2 Variable substitution framework.
This implements editing of variables and moving SCH_FIELDs,
TEXTE_MODULEs, TEXTE_PCB and worksheet items over to the new
framework.
2020-03-30 14:15:59 +01:00
Jeff Young cee973dc04 Move ERC error reporting over to the new framework.
Fixes https://gitlab.com/kicad/code/kicad/issues/1989
2020-03-16 11:06:15 +00:00
Jeff Young 535033c5c9 Enable editing of sheet fields. 2020-03-07 18:52:30 +00:00
Jeff Young fe3e0307d8 Move sheet name and filename to SCH_FIELD architecture.
Only internal storage architecture has changed (so far).
2020-03-06 16:23:44 +00:00
Ian McInerney b1240b5b1e Gracefully shutdown tools when frames are closed
If the tools are not gracefully exited, then the stack variables are
never destroyed, so variable lifetime issues can occur.

Fixes https://gitlab.com/kicad/code/kicad/issues/1753
2020-02-05 22:23:24 +00:00
Seth Hillbrand 7d64527eeb eeschema: Handle Rebuild for subcomponents
The parents are the only items that live in the RTree, so the rebuild
check needs to recurse into the sub structure to check for selection

Fixes https://gitlab.com/kicad/code/kicad/issues/3858
2020-02-04 22:49:43 -06:00
Jon Evans ac875e26a8 Fix handling of SCH_PINs on multi-unit parts
Fixes https://gitlab.com/kicad/code/kicad/issues/3770
2020-02-04 11:51:29 +00:00
Seth Hillbrand 9f7e0ef8e8 eeschema: Remove Bus-Bus and Place sheet pin buttons
Cleaning toolbars of functions that are superfluous or do not match well
to the user workflow.
2020-02-04 04:39:26 -06:00
Jeff Young 836c1ea56e Fix a bunch of un-caught boost::bad_pointer exceptions.
This also removes vector cover types which do nothing except obfuscate
the underlying implementation.

Mainly changes SCH_SHEET_PINS and CONFIG_PARAM_ARRAY (which will soon
be replaced by Jon's new stuff).
2020-01-12 19:55:00 +00:00
Seth Hillbrand 77c60d9655 Remove the last vestiges of dlist
It served us (mostly) well for more than a decade.  It helped KiCad grow
before the std:: came into decent shape or speed.  It was a good little
list.

RIP DLIST 2008-2020
2020-01-10 06:37:08 -08: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
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
Ian McInerney 079423c3cc eeschema: Remove unused include of eeschema_id.h 2020-01-03 16:04:54 +00:00
Mark Roszko 19ceb11ae7 Change more enums over to scoped enums 2019-12-28 00:55:11 +00:00
Ian McInerney 3ca231aa78 Rename lib viewer frame files to use the class name 2019-12-19 14:05:46 +00:00
jean-pierre charras d9de28de35 Eeschema: usability enhancement.
ADDED: a config option to select (when clicking on a pin) the parent symbol
or only the pin.

Previously, when cliking on a pin, the parent symbol was selected.

Allowing the pin selection is mandatory in cross probing, and to display the pin
characteristics in some cases, for instance if a pin is flagged by the ERC tooL.
2019-12-19 12:41:51 +01:00
jean-pierre charras a049348576 Eeschema: fix null pointer use.
Fixes #3694 | https://gitlab.com/kicad/code/kicad/issues/3694
2019-12-19 09:11:34 +01:00
Wayne Stambaugh a18d7a8495 Eeschema: fix a selection bug created in commit bec87864.
Apparently the schematic and symbol library editors now have common
selection filtering so checking for a valid LIB_EDIT_FRAME when
filtering for the  schematic editor frame prevented all schematic
object from being selected.
2019-12-12 11:42:11 -05:00
Wayne Stambaugh bec878640c Symbol editor: fix crash caused by broken root symbol name.
The symbol editor selection criteria did not include LIB_FIELD objects
which allowed the root symbol name to be changed causing broken derived
symbol links.  Disable the symbols fields from being edited when a
derived part is shown in the editor to prevent this.

Add a missing warning that deleting a root symbol used to derive other
symbols would also delete all derived symbols from a library.  Give the
user a chance to cancel the delete operation in this case.

Fixes kicad/code/kicad#3654
2019-12-12 10:45:12 -05:00
Wayne Stambaugh 54f066fed7 Implement simple inheritance for library symbols.
This change completely removes the LIB_ALIAS design pattern an replaces
it by allowing LIB_PART objects to inherit from other LIB_PART objects.
The initial implementation only allows for single inheritance and only
supports the mandatory fields in the derived part because that is all
that the current symbol library file format will support.  Once the new
file format is implemented and saving to the old file format is deprecated,
more complex inheritance will be added.  The LIB_ALIAS information saved
in the document files was move into the LIB_PART object.  This change
impacts virtually every part of the schematic and symbol library editor
code so this commit message is woefully incomplete.

REMOVE: Removed the symbol aliases concept from the schematic and symbol
editors and the symbol viewer.

NEW: Replace the symbol alias concept with simple inheritance that allows
a library symbol to be derived from another library symbol.
2019-12-06 11:33:52 -05:00
Seth Hillbrand 868ff5bb2c Right click gets a new object if the mouse has moved
Right click is a pointing operation combined with a request for the
context menu.  We need to highlight the user's intended object when they
have moved their mouse to a new element instead of showing the context
menu for the selected object.

However, in cases where the selection is difficult to make, it is
sometimes helpful to select the item first, then right-click.  In these
cases, we keep the selection where the mouse remains inside the selected
object's bounding box.
2019-10-29 16:11:06 -07:00
Seth Hillbrand e533ea4ae6 eeschema: Keep selection with only components
Adding a field to a selection changes the bounding box and count for
rotation.  This can cause odd offsets when the field is rotated against
the selection center rather than the bounding box as well as with the
component.

Fixes: lp:1849078
* https://bugs.launchpad.net/kicad/+bug/1849078
2019-10-28 10:50:26 -07:00
Jeff Young 3996a490a1 Re-allocating a std::vector invalidates its iterators.
When we add enough SHEET_PINs that the vector has to grow, it
re-allocates the vector causing our for-loop to get its knickers
tied in a knot.

Fixes: lp:1842394
* https://bugs.launchpad.net/kicad/+bug/1842394
2019-09-04 11:50:56 +01:00
Jeff Young 8bbbc66e46 Another attempt to fix the crash-on-selection bug.
Fixes: lp:1842394
* https://bugs.launchpad.net/kicad/+bug/1842394
2019-09-03 22:29:05 +01:00
Jeff Young 54a85cfaa2 Not everything in a VIEW_GROUP is an EDA_ITEM.
Fixes: lp:1842394
* https://bugs.launchpad.net/kicad/+bug/1842394
2019-09-03 17:24:50 +01:00
Seth Hillbrand 83b2332f1f eeschema: Check for proper type before dereference
When bundling a selection, we need to ensure that we have correct types
before attempting to dereference.

Fixes: lp:1841919
* https://bugs.launchpad.net/kicad/+bug/1841919
2019-08-29 08:47:26 -07:00
Jeff Young 5348f88a8f Add sheet pins to candidate list by hand (as they're not in the view).
Fixes: lp:1841555
* https://bugs.launchpad.net/kicad/+bug/1841555
2019-08-27 21:08:36 +01:00
Jeff Young a5a237ac32 Improve readability of flag checking. 2019-08-27 19:23:07 +01:00
Jeff Young 8ba7d4570c Move warp-mouse-on-move setting from Eeschema settings to common settings.
It's also used by the Symbol Editor, and will likely be used by
Pcbnew and friends in the future.
2019-08-15 12:53:04 +01:00
Jeff Young b4c8657904 Fix non-visible-part or conversion items from getting selected.
Also renames lib_draw_item to lib_item to match the class.

Fixes: lp:1840170
* https://bugs.launchpad.net/kicad/+bug/1840170
2019-08-15 10:00:23 +01:00
Jeff Young 3cdf88f2c6 CERN copyrights for work packages. 2019-08-14 09:35:15 +01:00
Jeff Young 03a33b6b56 Selection fixes for multi-part lib items.
1) Don't select pins from other units/conversions
2) Don't delete pins from other units/conversions

Fixes: lp:1838511
* https://bugs.launchpad.net/kicad/+bug/1838511
2019-07-31 22:34:24 -06:00
Jeff Young 483dc24e87 Homogenize selection tools around our HIG.
In particular make addative and exclusive-or selections work the
same way.

Also give Highlight Net a hotkey now that it can't use ctrl-click
anymore.
2019-07-09 21:59:46 +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 232e21cb37 Restore selection properly after an undo. 2019-06-29 20:03:08 +01:00
Jeff Young 2ed3bf47bb Improve hittesting for Eeschema and LibEdit delete tools. 2019-06-28 22:18:30 +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
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 7292ce6a8b Improve eeschema selection disambiguation logic. 2019-06-26 21:54:03 +01:00
jean-pierre charras 70ff2e14a5 Eeschema: avoid crashes when the tool highlight or delete is activated and clicking in a empty schematic.
Was a nullptr not tested.
2019-06-25 08:31:22 +02:00
Jeff Young b0c1c1ad2b Select both ends of wires in block select.
Fixes: lp:1830717
* https://bugs.launchpad.net/kicad/+bug/1830717
2019-06-18 20:24:15 +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 c7bfa9857e Use more reflective naming of what the tool does. 2019-06-16 19:52:07 +01:00
Jeff Young e4fbd003e0 Make m_passEvent event-specific rather than global.
If a tool called something like clearSelection while processing a
MOUSE_CLICK, the SELECTION_TOOL will pass the clearSelection
COMMAND_EVENT because it handles it as a transition, not as an
event. Because m_passEvent is effectively global, the tool manager
would then interpret that as passing the MOUSE_CLICK and we'd end
up processing the click by multiple tools.
2019-06-16 12:06:49 +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
Maciej Suminski 7d69a917b9 Fixed a crash in EE_SELECTION_TOOL::SelectPoint()
The for loop is continued after an item removal, so the removed item
is not accessed anymore.
2019-06-14 13:00:39 +02:00
Jeff Young 8cc1e2b5e7 Fix breakage in wire moving/dragging/etc.
Fixes: lp:1832750
* https://bugs.launchpad.net/kicad/+bug/1832750
2019-06-13 19:58:37 +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 c0e1f7a17a Add dragging of wire ends, corners and junctions.
Fixes: lp:1830007
* https://bugs.launchpad.net/kicad/+bug/1830007
2019-06-11 21:20:19 +01:00
Jeff Young 7726b039b2 Re-jigger standard submenus so they both link AND work. 2019-06-11 18:03:16 +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
Jeff Young 2d40425e4d Move footprint & symbol tree context menus to tool infrastructure.
Fixes: lp:1831692
* https://bugs.launchpad.net/kicad/+bug/1831692
2019-06-05 20:16:48 +01:00
Jeff Young 9f1e2e34b7 Move some dupicated tools to common tools. 2019-06-03 21:08:30 +01:00
Jeff Young d7774b94fc Fix regression with switching between drag and move operation. 2019-05-31 21:56:35 +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 b8e2054b23 Activate context menu in LIB_VIEW_FRAME canvas. 2019-05-25 10:13:27 +02:00
Jeff Young 1636405b66 Set a reference point for all selection sizes.
Fixes: lp:1829833
* https://bugs.launchpad.net/kicad/+bug/1829833
2019-05-23 00:27:53 +01: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
Seth Hillbrand e1373d70ae libedit: Ensure proper dereference in shared tools
Fixes: lp:1829826
* https://bugs.launchpad.net/kicad/+bug/1829826
2019-05-21 19:43:15 -07:00