Commit Graph

52 Commits

Author SHA1 Message Date
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 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 7dd247f1dc Make better use of TOOL_EVENT parameters. 2019-06-18 20:24:15 +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 5610261dce Immediate-action hotkeys (and context menu actions) for eeschema. 2019-06-15 20:43:51 +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
Jeff Young ef5c69167a Start moving some LibEdit and SchEdit menubar menus to actions.
Also includes a bunch of bug fixes that got intermingled.

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

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

Fixes: lp:1828793
* https://bugs.launchpad.net/kicad/+bug/1828793
2019-05-13 21:44:29 +01:00
Jeff Young cd2bd23c37 Fix a bunch of issues with hotkeys, IDs and event processing.
Fixes: lp:1827894
* https://bugs.launchpad.net/kicad/+bug/1827894
2019-05-06 21:42:00 +01:00
Jeff Young 902be18a04 More modern toolset context menu work.
Text/label type changes and bus entry shape changes.  And some
context menu bug fixing.
2019-05-05 17:12:59 +01:00
John Beard b64c6dbf35 Use wxCHECKs to protect non-position TOOL_EVENTS
Getting the position of a non-position TOOL_EVENT will
now result in a wxCHECK, and a null-position (0,0) will
be returned. The new interface HasPosition() can be used
to determine if a call to a position function is safe to
make from the caller.

Fixes the underlying danger behind lp:1796045, which has
already been neutralised by a4966adb6, which avoids calling
the Position() functions when the TOOL_EVENT is not known
to be a position.

Fixes: lp:1796045
* https://bugs.launchpad.net/kicad/+bug/1796045
2018-10-12 09:08:07 -07:00
Carsten Schoenert 9f7109826d fix misspelled 'allows to' -> 'allows one to'
Fixup small grammar issues around used 'allows to ...' almost in
code comments.
2018-07-11 10:35:03 -04:00
Maciej Suminski b8ecc95d9c Forward context menu events to the tool that created the menu
It fixes the case when a tool sets up a menu and starts its event loop
waiting exclusively for menu events. If none arrived, the tool was stuck
in the loop forever.

Fixes: lp:1744915
* https://bugs.launchpad.net/kicad/+bug/1744915
2018-01-26 15:53:52 +01:00
Tomasz Włostowski 9932ff32ae refactoring: wrapped boost::optional in OPT<> class for the purpose of easier transition to C++17 in the future 2017-11-03 23:59:02 +01:00
Maciej Suminski 524dddaf70 Sync the PNS model when its changed 2016-11-28 15:51:18 +01:00
Maciej Suminski 3623421912 Fixed a PNS crash after undoing the last operation while routing 2016-09-23 13:58:33 +02:00
decimad 6a9c1cb6a1 Split the undo/redo event into the two stages "pre" and "post" for convenient synchronization of dependent state. 2016-09-23 13:29:25 +02:00
Simon Richter 96ec9db5d6 Add missing C++ stdlib headers
The GCC standard library headers often include other headers, which makes
some code compile that forgets to include several headers.
2016-05-28 12:46:29 -04:00
Maciej Suminski 59af7a96f8 Minor code cleaning. 2015-07-15 14:08:52 +02:00
Andrew Zonenberg 6289f5bcf4 Fixed a bug causing layer-switch events to noe be handled by GAL. 2015-07-13 17:18:29 +02:00
Andrew Zonenberg 0a5847c71a Removed a couple of trailing spaces 2015-07-12 21:57:07 -07:00
Andrew Zonenberg 1ad3b05664 Fixed a bug causing layer-switch events to not be handled by GAL 2015-07-12 21:52:17 -07:00
Maciej Suminski b9805e4530 Added missing contents for TOOL_EVENT_LIST operator||. 2015-06-05 17:49:01 +02:00
Maciej Suminski b218c1099f Added TA_CONTEXT_MENU_CLOSED tool event. 2015-04-30 10:46:07 +02:00
Maciej Suminski 5c984aa069 Parametrized TOOL_ACTIONs. 2015-04-30 10:46:01 +02:00
Maciej Suminski 18898fe807 tool: Added a generic parameter for RunAction(). 2014-11-21 11:28:34 +01:00
Maciej Suminski 468e9e4ac9 Initalize fields in TOOL_EVENT constructors. 2014-08-08 14:34:44 +02:00
Maciej Suminski c0a96141df Added AF_NOTIFY flag for TOOL_ACTIONs. 2014-07-09 15:10:32 +02:00
Maciej Suminski 2b0e27f132 Introduced SELECTION_CONDITIONS to determine which menu entries should be visible in the SELECTION_TOOL context menu, depending on the selection. 2014-07-09 15:10:32 +02:00
Maciej Suminski 94cc845b3f Added AF_ACTIVATE flag for TOOL_ACTIONs.
Reworked the way of processing events in TOOL_MANAGER class.
Added GetCommandStr() for TOOL_EVENT class.
2014-07-09 13:50:27 +02:00
Maciej Suminski f8f6fd41ad Introduced a new type of action: TA_ACTIVATE to distinguish events activating tools from common tool actions. 2014-07-09 13:50:27 +02:00
Maciej Suminski 5f806cfa18 Minor fixes to the Tool Framework. 2014-07-09 13:50:27 +02:00
Maciej Suminski 3f8d9da31f Key events are handled by wxEVT_CHAR instead of wxEVT_KEY_[UP|DOWN]. Fixed issue of chars that require modifiers (e.g. ? is Shift+/ on US keyboard layout). 2014-04-09 17:33:22 +02:00
Maciej Suminski e6598e9d41 Added VIEW::ToWorld( double ).
TOOL_EVENT message is supposed to contain string as parameter.
Added missing header for class_drawsegment.h (KiROUND).
Renamed SELECTION_TOOL::containsSelected() to SELECTION_TOOL::selectionContains().
2014-02-27 16:13:27 +01:00
Maciej Suminski 57c69b41db Continous mode for drawing tools (i.e. they do not finish after adding a single object). 2014-02-19 13:51:32 +01:00
Maciej Suminski 3e2e11fb42 Undo/redo buffer fixed once again.. 2014-01-31 16:08:20 +01:00
Maciej Suminski a73e386505 Added a new tool event: TA_UNDO_REDO, sent after undo/redo operation is issued. 2014-01-30 11:18:58 +01:00
Maciej Suminski bec2e9b178 Added some comments & asserts. 2013-12-03 15:17:43 +01:00
Maciej Suminski c21ae6efca Double click support for the Tool Framework. 2013-11-28 15:19:50 +01:00
Maciej Suminski 5249b1a6da Renamed TOOL_MOUSE_BUTTONS constants to avoid name conflict with Windows MB_RIGHT constant. 2013-10-15 10:41:00 +02:00
Maciej Suminski bc305859b2 Mainly case changes. 2013-10-14 20:40:36 +02:00
Maciej Suminski 0ac3e1fbf2 Namespace KiGfx->KIGFX.
template<> -> template <>
Some more reformatting according to uncrustify results.
2013-10-14 16:13:35 +02:00
Maciej Suminski 22045b61ea Converted tabs to spaces. Removed trailing whitespaces. 2013-10-14 13:43:57 +02:00
Maciej Suminski 6b74b5771a Even more code comments and reformatting. 2013-09-27 18:51:21 +02:00
Maciej Suminski 3f320e4d68 Some more comments and code formatting. 2013-09-27 16:23:43 +02:00
Maciej Suminski 171857a7a8 FIxed TOOL_EVENT::Modifier() (now it returns value for current modifier, not only if there is one active or not). 2013-09-23 10:02:01 +02:00
Maciej Suminski 2c03bf4109 Removed TA_ActivateTool (now tools are invoked by sending TA_Action event, with the tool name as string parameter).
Developed TOOL_Action class & added ActionManager. Hot keys registered by tools are processed.
Selection & move tool can be invoked by a hot key.
2013-09-19 17:02:57 +02:00
Maciej Suminski 9adbdd803a Added missing functions for checking type of keyboard event 2013-09-13 15:31:19 +02:00
Maciej Suminski e8083ae808 Added some comments and changed names of classes to match the coding rules. 2013-09-02 14:21:12 +02:00
Maciej Suminski 89a138c09e Added handling keyboard events for the Tool framework. 2013-08-21 17:37:27 +02:00
Maciej Suminski e87eea7abc Reformatting. 2013-08-19 09:47:36 +02:00