Commit Graph

604 Commits

Author SHA1 Message Date
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
Seth Hillbrand 1e315bc3fe pcbnew: Add "Select All" Action to pcbnew and fpedit
Fixes https://gitlab.com/kicad/code/kicad/issues/2497
2020-08-20 16:07:10 -07:00
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00
Marek Roszko a417da4ce0 Split selecteditemmodified to a selecteditemmoved to reduce updatemsgpanel spam 2020-08-18 13:11:47 +00:00
Ian McInerney 5955091eb3 Turn CONDITIONAL_MENU's conditions into only show/hide conditions
This leaves the decision to check/enable menu items to the main UI
conditions, and only the menu has control over showing/hiding the menu
items. Also rip out a special case for the preferenes item that isn't
needed on OSX anymore since all the main menus have been moved to
ACTION_MENUs now.
2020-08-17 23:40:02 +01:00
Ian McInerney dbe5537fa9 Don't run the hotkey if the action isn't enabled
CHANGED: Don't run the hotkey if the action's UI elements aren't enabled

This makes it so the action can't be run from either the hotkey or the
UI if its enabling conditions are not met.
2020-08-16 19:10:26 +00:00
Ian McInerney 4491f24d5e Ripout the old SyncToolbars infrastructure reminants
The tool framework no longer needs to request updates of the UI
state for the controls, wxWidgets will do it for us.
2020-08-16 19:10:26 +00:00
Ian McInerney e8b11c911e Migrate Pcbnew/footprint viewer/footprint editor to the new UI update system 2020-08-16 19:10:26 +00:00
Ian McInerney fd4388710d Migrate eeschema, libview and libedit to the UI condition framework
Also, fix some issues in other frames identified along the way.
2020-08-16 19:10:25 +00: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
Ian McInerney 72a1c71e07 Implement a framework to handle wxUpdateUIEvents for tool actions
This allows for the tool framework to keep track of a universal
set of conditions for the UI state (enabled/checked/shown) for
controls of actions. It removes the need for the main menubar
menus to be CONDITIONAL_MENUs and be rebuilt on each open,
and instead makes the updates of the check and enabling of
items handled in the native wxWidgets way.

This commit switchs the 3d viewer and kicad project manager window
over to this system.
2020-08-16 19:10:25 +00:00
Ian McInerney d19ff3e595 Unify the UI IDs for actions between the menus and toolbars
By unifying the IDs so that an action only has one UI ID,
it will receive only one update event that will work for
all controls using the action.
2020-08-16 19:10:24 +00:00
jean-pierre charras 98b1f55e29 Eeschema: minor fixes: fix incorrect label in DIALOG_LIB_EDIT_PIN, electrical pin list.
Gives also to functions GetText() and GetBitmap() a more significant name.

Fixes #5007
https://gitlab.com/kicad/code/kicad/issues/5007
2020-07-29 17:04:52 +02:00
Mark Roszko 7bdb98f961 libedit: Make context menu follow context 2020-07-26 20:16:38 +00:00
Ian McInerney 50b2271f84 Fix missing variable initialization 2020-07-18 23:56:39 +01:00
Jeff Young 3fd0a3f842 Update text variables even when they're changed from other binary.
For instance, you might have PCBNew open but change the variable
value through EEschema > Schematic Setup.

Fixes https://gitlab.com/kicad/code/kicad/issues/4918
2020-07-17 21:05:11 +01:00
Jeff Young e9da02e2d5 Only reserve hotkeys for focused textCtrls that are editabled.
Otherwise just send Ctrl-C to the disabled control, and everything
else to the tool framework.

Fixes https://gitlab.com/kicad/code/kicad/issues/4801
2020-07-14 13:30:43 +01:00
Jeff Young 940570e9ec Catch exception so that we at least throw up an error message.
Fixes https://gitlab.com/kicad/code/kicad/issues/4677
2020-07-13 22:41:56 +01:00
Jon Evans 5d118b0700 More visibility settings infrastructure
ADDED: Three-state high contrast mode action
ADDED: Save contrast mode in local settings

Also some initial infrastructure for layer presets
2020-07-11 21:59:07 -04:00
jean-pierre charras 3993181de5 D_PAD::BuildEffectiveShapes(): fix incorrect rect shape size for rect pads
rotated by +-90 deg
Noticeable in PnS router.

Fixes #4771
https://gitlab.com/kicad/code/kicad/issues/4771
2020-07-01 16:06:31 +02:00
Ian McInerney fb10406e67 Add right-click context menus for toolbar items 2020-06-26 21:29:03 +00:00
Ian McInerney 52856a8ce4 Move scaled toolbar separator into ACTION_TOOLBAR
* Ensure all separators are scaled separators
* Clean up toolbar creation functions
2020-06-26 21:29:03 +00:00
Jeff Young 5ee806c3a3 The dispatch-behind & whitelist stuff got broken again, so I've
retired them in favour of a much dumber hack that special-cases
only ctrl-U for units switch.
2020-06-24 12:22:42 +01:00
Jeff Young 18ab3c4714 Fix missing user grid in COMMON_TOOLS.
Fixes https://gitlab.com/kicad/code/kicad/issues/4702
2020-06-23 11:17:15 +01:00
Jon Evans 713cd4a47a Point editor: show dragged points with a highlight
Take points editor colors from color theme

Also fix an issue where the edited object sometimes didn't
update when a point is dragged.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4600
2020-06-21 14:43:41 -04:00
Jeff Young a1332d76fe Remove SHAPE_EDITOR frame types before we forget about them.
They may go back at some point, or they may not....
2020-06-19 14:10:41 +01:00
Jeff Young cae493fe65 More infrastructure work for shape editor. 2020-06-18 15:38:01 +01:00
Jeff Young 754f958be2 Attempt to fix duplicate ID issue on MSW. 2020-06-17 18:44:39 +01:00
jean-pierre charras 5db2b6ed8d Action menu: ensure a wxEVT_COMMAND_MENU_SELECTED event is sent to the menu,
when a wxTextCtrl has the focus but is read only, and cannot use a CHAR event.
It fixes an issue in Kicad manager (menus with accelerator not working) when
the wxTextCtrl window showing messages has the focus.
2020-06-17 12:00:34 +02:00
Jon Evans 0dd34d197e Ensure currentGrid is valid on startup
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4666
2020-06-16 19:59:00 -04:00
Seth Hillbrand a18aea3a43 Fix signed/unsigned comparison 2020-06-15 12:40:02 -07:00
Jeff Young ad12c42e8b Push grid settings dialogs down into common.
This also gives support for fast grid switching and a user grid
to eeschema.

Fixes https://gitlab.com/kicad/code/kicad/issues/2200
2020-06-14 19:26:37 +01:00
Jeff Young 998fe12a5a Make sure COMMON_TOOLS initializes the grid. 2020-06-13 22:44:16 +01:00
Jeff Young c48f4272f3 Collapse a level out of the zoom settings.
The APP_SETTINGS_BASE now holds the list of zoom factors, and
the old legacy (screen-based) code has been removed.
2020-06-13 22:44:16 +01:00
Seth Hillbrand a02d8a5993 Fix a number of signed/unsigned comparisons 2020-06-13 11:55:59 -07:00
Jeff Young f84406009b Push a couple of layers of indirection out of grid settings. 2020-06-13 11:35:56 +01:00
Ian McInerney 4357c1d3b3 Coverity and compiler warning fixes
* Initialize variables
* Test dynamic casts

Fixes https://gitlab.com/kicad/code/kicad/issues/4620
2020-06-05 12:50:56 +01:00
Jeff Young b274b9f972 Fix type-checking which was too tight.
Also fixes a typo leaving the return statement in the wrong place.

Fixes https://gitlab.com/kicad/code/kicad/issues/4611
2020-06-04 22:35:01 +01:00
Johannes Pfister 8e8979e317 Fixed a memory leak in CONDITIONAL_MENU
CONDITIONAL_MENU::ENTRY now owns the wxItem object.
2020-06-04 19:08:59 +00:00
Jeff Young 0741bbb1b9 Move autocomplete to the remove filtered items paradigm.
Fixes https://gitlab.com/kicad/code/kicad/issues/4190
2020-05-30 20:09:09 +01:00
Jeff Young 449c90a0ae Some more work on getting wxWidgets to stop stealing textEntry keys.
Fixes https://gitlab.com/kicad/code/kicad/issues/1941
2020-05-30 12:32:33 +01:00
Jon Evans fbef52ec33 Don't process hotkeys on text entries
Thanks @jeffyoung for the suggestion

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4463
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1941
2020-05-29 21:20:44 -04:00
Jeff Young 112316cdfb Fixup kiway by hand when dynamic_cast fails.
Also allows a shortened version of Configure Paths without the 3D
paths when Pcbnew isn't already running.

Fixes https://gitlab.com/kicad/code/kicad/issues/4568
2020-05-29 22:06:48 +01:00
Jon Evans 695cdbbde8 Move bug reporting to COMMON_CONTROL; add to Help menu
Also make a shorter version of the version info string
and some other shortening edits to the issue template
to fix occasional 500 errors thrown by Cloudflare due
to excessively long URLs

Fixes https://gitlab.com/kicad/code/kicad/-/issues/3953
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4272
2020-05-26 21:18:32 -04:00
Ian McInerney a6e9efbe57 Add icon for schematic reverse annotation
Fixes https://gitlab.com/kicad/code/kicad/issues/4527
2020-05-24 12:13:48 +01:00
Ian McInerney c7e512852a Fix escape key event propagation regression from bdf94916
The escape key event shouldn't be propagated after the first
tool dispatcher. Propagatint it causes it to go to parent frames,
which can mean problems arise (such as in cvpcb, where an
escape key press in the fpviewer frame was closing the main
cvpcb window when it is propagated).
2020-05-24 11:58:33 +01:00
Jeff Young bdf9491682 Re-factor the event whitelist stuff so that it doesn't promise what it can't deliver. 2020-05-03 20:56:32 +01:00
Jeff Young a3486b7cd4 Fix ESC handling with whitelist. 2020-05-03 20:56:32 +01:00
Jeff Young 73eda91ec7 Allow some events to run behind a modal dialog.
Right now this is just unit switching.

Fixes https://gitlab.com/kicad/code/kicad/issues/2344
2020-05-02 14:37:24 +01:00
Ian McInerney 60891f0b6d Add more trace messages in the tool framework 2020-04-23 23:56:53 +01:00
Seth Hillbrand 1770a1ea21 Prevent invalid decrement in tool manager
Iterating over the tool stack, we potentially remove the current
iterator.  If this removal happens at the beginning of the toolstack, we
cannot decrement the iterator to a position before the stack without
creating an invalid state.
2020-04-20 11:50:45 -07:00
Ian McInerney e528769637 Move TOOLS_HOLDER into tools/ folder
Also clean up some compiler warnings
2020-04-19 01:51:49 +01:00
Jeff Young 919a66a703 Remove side-effect from finishTool().
It belongs out in the calling loop so that if someone else uses
finishTool() later they won't get bit by it.

This also fixes a crash bug where we weren't deactivating all tools
because we couldn't back up at the beginning of the stack (and the
loop increment therefore went past the first element).

Fixes https://gitlab.com/kicad/code/kicad/issues/4206
2020-04-16 21:58:45 +01:00
jean-pierre charras bdada70ee7 Cosmetic enhancements: add bitmaps to a few context menus.
Fix also a minor compil warning.
2020-04-12 10:29:28 +02:00
Jeff Young b13559c926 Add envVar and text variable resolution to plot directory paths.
Fixes https://gitlab.com/kicad/code/kicad/issues/3808
2020-04-05 23:56:24 +01:00
Jeff Young cc9ac37a0e Add text variable support to envVar processing. 2020-04-05 20:52:26 +01:00
Ian McInerney c29c3d9cc1 Diferentiate action types in the tool trace 2020-03-28 22:01:35 +00:00
Jeff Young d69ebfae49 Push tool framework base down into TOOL_HOLDER.
This allows us to use it outside of EDA_BASE_FRAMEs (in this case, in
PANEL_PREVIEW_3D.)
2020-03-24 19:00:25 +00:00
Jeff Young e9cd9ee8ff Actionize the rest of the 3D viewer.
Fixes https://gitlab.com/kicad/code/kicad/issues/2228
2020-03-19 15:10:32 +00:00
Tomasz Wlostowski 6673554866 common: prevent segfault with no edit frame in TOOL_MANAGER 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski 33f9843fb7 ACTION_MANAGER: prevent null object call when used without a host frame 2020-02-27 22:02:56 +01:00
Jon Evans e59a3d981e Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme

Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
2020-02-19 23:44:56 -05:00
Jeff Young 2017389f2d Pinning for library trees in FPEditor and SymbolEditor.
Fixes https://gitlab.com/kicad/code/kicad/issues/2288
2020-02-14 00:10:40 +00:00
Seth Hillbrand 03f74c87a1 Update immediate mode location and restart wires
The immediate action option clears (or not) the position of the events.
We use this to determine if the command should start at the given
position or merely activate the tool.  This was being checked in the
menu options, which only activated for tool commands in the context
menu.  Moving to the process event, we catch hotkeys as well.

This also restores the previous logic in eeschema that used a static
variable for storing wires rather than the private class variable.
Starting the draw event now picks up from the existing wires when
activated in immediate mode.

Fixes #3891 | https://gitlab.com/kicad/code/kicad/issues/3891
2020-02-11 09:12:36 -08:00
jean-pierre charras 46b72d807b Kicad manager: Avoid crash when calling configure paths or libraries from main menu,
when _eeschema.kiface or _pcbnew.kiface is not found.
Happen mainly when running Kicad from build tree.

Now a suitable error message is displayed.

Fixes #3868
https://gitlab.com/kicad/code/kicad/issues/3868
2020-02-06 11:41:21 +01: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
Alexander Shuklin 3d0b3a51f3 Eeschema: Adding back annotation
ADDED: Back annotation algorithm,
eeschema back annotation dialog

CHANGED: added some minor helper methods to SCH_REFERENCE_LIST and SCH_REFERENCE,
split SCH_REFERENCE_LIST::CheckAnnotation on 2 parts to reuse code
2020-01-29 16:33:57 +00:00
Jeff Young 91d1508c16 Fix some Coverity identified issues. 2020-01-13 20:16:40 +00:00
Ian McInerney 8fc434be19 Formatting change for dynamic cast tests 2020-01-13 01:48:57 +00: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 5d46e721e5 pcbnew: Cleanup includes of pcbnew_id.h
* Remove unused IDs from the enum
* Remove the include statements from files that no longer need it
2020-01-03 15:39:05 +00:00
Mark Roszko 11ff16be4e Switch to scoped enums 2019-12-20 14:11:39 +00:00
Jeff Young 1f07505b27 Fix long-standing issue with arrow keys moving in both axes. 2019-12-15 14:29:47 +00:00
Seth Hillbrand cbb88ce609 tool manager: Don't adjust the iterator to invalid
When finishing the first tool, we don't want to return an invalid
iterator
2019-11-03 10:15:21 -08:00
Ian McInerney 027658d3da Fix invalid cursor position access in tool manager
Fixes: lp:1846923
* https://bugs.launchpad.net/kicad/+bug/1846923
2019-10-06 13:26:07 +02:00
Seth Hillbrand 4302bc2562 Fix segfault when getting mouse position 2019-10-04 08:58:32 -07:00
Jeff Young d22ea0e201 Safety for frames which don't have an m_viewControls. 2019-10-03 22:23:35 +01:00
Ian McInerney 5862b1559f Cleanup position handling for TOOL_EVENTs
* Make the events generated by the selection of context menu items
  have the position where the menu was opened
* Ensure that TC_COMMAND type events have their position set to
  be the cursor position where the event originated
2019-10-03 19:04:33 +01:00
Ian McInerney d68dd09f63 Run all matching global actions for a hotkey
Fixes lp:1834547

https://bugs.launchpad.net/kicad/+bug/1834547
2019-09-18 09:21:43 -04:00
Jeff Young 10c25a2290 Update frame type enum to match current class names. 2019-09-06 23:38:20 +01:00
Jeff Young 3bd38ec245 Improve zoom-to-extents for footprints with long text.
Fixes: lp:1820540
* https://bugs.launchpad.net/kicad/+bug/1820540
2019-09-05 21:02:29 +01:00
Jeff Young fc50ddda64 Implement Paste Special for eeschema.
Also changes the normal paste behaviour to only clear annotations
when a collision is found.

Fixes: lp:1837002
* https://bugs.launchpad.net/kicad/+bug/1837002
2019-09-02 19:24:29 +01:00
Jeff Young 79d062aefc Don't allow selection dragging when a picker tool is running.
Fixes: lp:1841691
* https://bugs.launchpad.net/kicad/+bug/1841691
2019-08-30 10:33:34 +01:00
jean-pierre charras 37b166348a Fix compil error and minor compil warnings 2019-08-27 09:13:07 +02:00
Seth Hillbrand b3615b36bb pcbnew: Retain 45° constraint
This also finishes the polygon with 45° lines when chosen as a create
option.

Fixes: lp:1833673
* https://bugs.launchpad.net/kicad/+bug/1833673

(cherry picked from commit fccce265aa)
2019-08-26 14:36:23 -07:00
Jeff Young d094934cf4 Put Place & Inspect menus in standard order. 2019-08-17 12:23:19 +01:00
Jeff Young 3cdf88f2c6 CERN copyrights for work packages. 2019-08-14 09:35:15 +01:00
Ian McInerney 8493daf9ff Unify menu item creation for closing a window
* Push a function into CONDITIONAL_MENU that adds the item
* Modify the tooltip for close and exit items to have the
  program name

Fixes: lp:1835454
* https://bugs.launchpad.net/kicad/+bug/1835454
2019-08-14 09:35:15 +01:00
Michael Kavanagh 79b2ff7551 Refactor deleteTool ACTION removing duplicates 2019-08-12 13:49:55 -04:00
Ian McInerney b6f6fc3d65 Return handled status for actions run from hotkeys 2019-08-05 20:46:05 -06:00
Jeff Young 97d70d7844 Fix cursor bugs in simulation.
1) cancel simProbe or simTune when simulator window closed
2) handle non-stock cursors through SetCurrentCursor()

Fixes: lp:1833583
* https://bugs.launchpad.net/kicad/+bug/1833583
2019-08-04 16:25:36 -06:00
Jeff Young cc82e59003 Push the Quit/Close menu logic down into common. 2019-08-02 14:32:49 -06:00
Ian McInerney 05429bc39c Recursively call evaluate on submenus of conditional menus
There seems to be a bug with certain GTK setups that prevents the
submenus from getting sized correctly unless the elements are added
when the main menu is displayed.

Fixes: lp:1835460
* https://bugs.launchpad.net/kicad/+bug/1835460
2019-08-02 14:32:49 -06:00
Ian McInerney bea74c27e5 Add log trace for tool handling 2019-07-31 21:56:53 -06:00
Jeff Young 460b03372d Implement preference for immediate actions.
Also pushes prefer-selection-to-dragging to common.
2019-07-25 20:41:22 -06:00
jean-pierre charras 9e90cb9572 Kicad manager: fix incorrect handling of disabled state of tools in launcher toolbar 2019-07-24 18:04:04 +02:00
jean-pierre charras b428d74281 Fix incorrect size of the displayed worksheet when starting eeschema or gerbview without file loaded.
It was due to not fully initialized VIEW parameters the first time COMMON_TOOLS::ZoomFitScreen() is called.
2019-07-20 11:53:53 +02:00
Jeff Young e816a0c29d Push Eeschema & PLEditor PICKER_TOOLs down into common.
Also implements a more robust push/pop tool strategy for pickers.
2019-07-16 00:44:01 +01: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 1dbaa89f95 Fix a bug in tool activation/deactivation and another illegal static_cast.
Fixes: lp:1836419
* https://bugs.launchpad.net/kicad/+bug/1836419
2019-07-14 10:39:38 +01:00
Jeff Young 7159f6e48a MRU for page size and orientation, and clearer info that this is all preview data only.
Fixes: lp:1662239
* https://bugs.launchpad.net/kicad/+bug/1662239
2019-07-10 23:17:50 +01:00
Jeff Young 30ec895c96 Cleanup event processing stuff to keep better track of "handled".
See: https://lists.launchpad.net/kicad-developers/msg41471.html .
2019-07-09 21:59:46 +01:00
jean-pierre charras 1633068920 tool_dispatcher.cpp: fix incorrect handling of ESC key on Linux and Windows.
m_toolMgr->ProcessEvent() returns false when a ESC key is handled. It should return true.
So we force the handled flag to true for a ESC key event to avoid skipping this event.
Otherwise the ESC key event is handled twice.
2019-07-08 16:28:45 +02:00
jean-pierre charras 269cd11b5a tool_dispatcher.cpp: fix incorrect char event filtering, that created issues on Windows.
At the beginning of tool dispatcher, the ProcessEvent did not return the fact a key event was captured or not.
Now this is the case, and the old char event filtering was no longer correctly working,
and some events were not fired, especially on Windows.
2019-07-08 13:51:10 +02:00
Jeff Young 4852c91b42 Possible fix for GTK bug differentiating hotkeys from menu picks.
Fixes: lp:1835672
* https://bugs.launchpad.net/kicad/+bug/1835672
2019-07-08 10:51:45 +01:00
Jeff Young a11f3a0b80 Make <esc> unhighlight nets, but only after all tools have been cleared.
Also moves the Highlight Net hotkey from activating the tool to just doing
a one-shot highlight.

Fixes: lp:1835658
* https://bugs.launchpad.net/kicad/+bug/1835658
2019-07-08 00:02:25 +01:00
Jeff Young b029e4e44a Add a few more actions to the hotkeys list and add hotkeys to tooltips.
Fixes: lp:1792159
* https://bugs.launchpad.net/kicad/+bug/1792159
2019-07-07 22:30:18 +01:00
Jeff Young a3b855ac6c Massage an earlier fix so that mouse-clicks in tools update the highlighting. 2019-07-06 17:50:35 +01:00
jean-pierre charras 39c830435c Fix a bug created by commit ea0edaba. 2019-07-06 14:48:53 +02:00
Thomas Figueroa ea0edaba21 Fix cursor lag in canvases on Windows.
Fixes: lp:1831541
* https://bugs.launchpad.net/kicad/+bug/1831541
2019-07-06 00:04:54 +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 29df4f809e Better safety around boost::optional.
I'm not sure these are necessary but I got a crash when checking one
as a boolean instead of calling is_initialized().  Sadly, my debugger
doesn't like boost, so I didn't get much more info.
2019-07-05 14:45:15 +01:00
Seth Hillbrand 69b31eb88d Corrects test for return case in tool event 2019-07-02 10:32:49 -07: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
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 e175eb25b8 Fix bug with accidental modification of legacy hotkey name. 2019-06-27 11:29:05 +01:00
Jeff Young 7099614041 Expose a bunch of cursor, panning and grid shortcuts.
Fixes: lp:1819249
* https://bugs.launchpad.net/kicad/+bug/1819249
2019-06-26 21:54:03 +01:00
jean-pierre charras e800bc5ffe Avoid crashed in eeschema after selecting/deselecting and reselecting highlight tool or delete tool
It was due to use of items in std::deque without testing if these items exist.
2019-06-26 13:17:03 +02:00
Jeff Young f9702aab87 Immediate actions for PlEditor, PcbNew, etc. 2019-06-25 11:34:28 +01:00
Jeff Young fbfcba6e4d Add action for context menu (right-mouse-click).
Fixes: lp:1663595
* https://bugs.launchpad.net/kicad/+bug/1663595
2019-06-25 11:34:27 +01:00
Jeff Young 485d436860 Clear ctx-menu before rebuilding; don't veto ctx-menu mousewarp for non-ctx-menu dialog.
Fixes: lp:1833312
* https://bugs.launchpad.net/kicad/+bug/1833312
2019-06-19 21:17:56 +01:00
Jeff Young eb95202708 Fix grid update when edited from menubar.
Fixes: lp:1833399
* https://bugs.launchpad.net/kicad/+bug/1833399
2019-06-19 18:35:17 +01:00
Seth Hillbrand b876309999 Don't skip handled events in GTK
Now that our tool framework handles the hotkeys, we need to skip the
passed handling work-around for actions that are already handled in the
event.

Fixes: lp:1832604
* https://bugs.launchpad.net/kicad/+bug/1832604
2019-06-18 17:19:40 -07:00
Jeff Young dcbd897a95 Push/pop tools even when selected from the toolbar. 2019-06-18 20:24:15 +01:00
Jeff Young 7dd247f1dc Make better use of TOOL_EVENT parameters. 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 5d7739a662 Handle '&'s in menu labels.
Fixes: lp:1832904
* https://bugs.launchpad.net/kicad/+bug/1832904
2019-06-17 10:45:23 +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 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
Seth Hillbrand 552815d486 tool_mgr: Don't invalidate our own iterators
Re-arranging the stack will invalidate the iterator that is removed and
inserted (begin()).  Because this is not a threaded operation, we can
only do it to ourselves, so check that the operation isn't a NOP before
performing.

Fixes: lp:1832930
* https://bugs.launchpad.net/kicad/+bug/1832930
2019-06-15 17:49:15 -07:00
Jeff Young 18ebced8f4 Code hygiene. 2019-06-15 20:43:52 +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
Jeff Young b429dbfb88 Fix bugs with ACTIONs not being "honest" singletons.
Delete the copy ctor and assignment operator to start with, but
even then the separate apps each have their own statically allocated
copy of the common actions.  So we need to update all of them, which
also means having the kicad manager frame's set of actions on hand).

This changelist also adds a Clear Hotkey Assignment function since
the hotkeys set is now likely to be sparse with respect to the
actions.
2019-06-14 16:54:46 +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 ce1f35a1be Cleanup some left-over vestiages of the legacy canvas architecture. 2019-06-13 15:51:32 +01:00
Jeff Young 158e05adea Add mouse gestures to List Hotkeys.
Fixes: lp:1778437
* https://bugs.launchpad.net/kicad/+bug/1778437
2019-06-13 15:51:32 +01:00
Jeff Young 97d2800f16 Update hotkey maps when the hotkeys are edited.
Also removes some legacy code dealing with conflicts.
Also disambiguates zoom in/out commands for hotkey list.
2019-06-12 12:43:12 +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 b9e07f2a70 Attempt to fix un-resolved sub-menus.
While I'm pretty sure this will work, the issues don't appear on OSX
so I can't be positive.

Fixes: lp:1832049
* https://bugs.launchpad.net/kicad/+bug/1832049
2019-06-11 10:04:21 +01:00
Jeff Young a91934c7b3 Don't update toolbars on mouse-move events.
It produces cursor-lag in some instances, and none of our state changes
currently rely on mouse position.

Fixes: lp:1831541
* https://bugs.launchpad.net/kicad/+bug/1831541
2019-06-11 09:52:01 +01:00
Jeff Young 9f427da56f Use the ACTION_ID offset when updating the layer pair bitmap. 2019-06-11 09:13:56 +01:00
Jeff Young aeadc768f6 Add import of hotkeys and fix bugs in reanding and writing hotkeys. 2019-06-10 23:46:01 +01:00
Jeff Young b0e8443383 Sync-ing of menu has been done in CONDITIONAL_MENU for some time now. 2019-06-10 23:46:01 +01:00
Jeff Young 620395608c Move Kicad Manager launch bar to ACTIONs.
Also fixes a bug where hotkeys weren't getting put in menus.
2019-06-10 23:46:01 +01:00
Jeff Young 5e49517781 Move hotkeys to ACTION architecture. 2019-06-10 23:46:00 +01:00
Jeff Young c13ef839c1 Tool framework for Kicad Manager frame. 2019-06-10 23:46:00 +01:00
Jeff Young 16cb1e731d Finish moving TOOL_MANAGER down to the EDA_BASE_FRAME level. 2019-06-10 23:46:00 +01:00
Jeff Young 6025256e07 Push KIWAY_HOLDER down a level so we can move a bunch of stuff that doesn't belong there out. 2019-06-10 23:46:00 +01:00