Commit Graph

43 Commits

Author SHA1 Message Date
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
Maciej Suminski ee80c7f674 Some more reformatting and adding copyright notices. 2013-08-07 11:20:12 +02:00
tomasz. 241061025b Added core tool framework files + boost::context assembly stuff (initial, very buggy and unfinished work). 2013-08-02 16:46:53 +02:00