Commit Graph

103 Commits

Author SHA1 Message Date
Maciej Suminski 1d8730752c Restore valid force cursor setting before saving VIEW_CONTROLS settings
There are times, when TOOL_MANAGER has to force cursor position
to make tools work as expected (e.g. when popping up a menu,
so tools get the right click position instead of current position
pointing to an entry in the menu).

If another tool is invoked, VIEW_CONTROLS settings have to be stored
in the TOOL_STATE object. In such case, it is necessary to revert the
force cursor setting when saving VIEW_CONTROLS settings.

Fixes: lp:1668712
* https://bugs.launchpad.net/kicad/+bug/1668712
2017-03-02 12:07:09 +01:00
Maciej Suminski adba96fd2b Changed optional::value_or() to optional::get_value_or()
get_value_or() is considered deprecated, but still works in the newest
boost (1.63). On the other hand, value_or() is not available in some
versions that are still used by major distros.
2017-02-24 17:34:23 +01:00
Maciej Suminski e34b73e187 Do not freeze cursor when a tool was cancelled using the context menu
dispatchContextMenu() stores the cursor position before displaying a
menu, so the tools use the original cursor position when processing
events (instead of the mouse position pointing to a menu entry). Later,
the previous position has to be restored, but if in the meantime the
tool was cancelled - previous settings were restored to a wrong tool.
2017-02-24 16:55:18 +01:00
Maciej Suminski b25ded4d90 Store VIEW_CONTROLS settings when tools are switched
Fixes: lp:1663783
* https://bugs.launchpad.net/kicad/+bug/1663783

Fixes: lp:1667580
* https://bugs.launchpad.net/kicad/+bug/1667580
2017-02-24 16:47:19 +01:00
jean-pierre charras a9d6af8001 Fix a comment 2017-02-23 13:17:23 +01:00
jean-pierre charras 10396ff435 Tool manager: renames Yield() to KiYield(), due to a collision name between the Yield macro in wxWidgets and Tool manager Yield.
Can be dependent on platforms.
2017-02-23 08:30:29 +01:00
Maciej Suminski 4b9243e0bf Allow registering TOOLs in any order. 2017-01-30 13:21:43 +01:00
Maciej Suminski 5d9190038f TOOL_EVENTs of "message" type are passed to all tools
Message type is a kind of notification, so it should be received by all
interested tools. It used to be like that in the past, but has been
broken recently.
2017-01-25 11:31:55 +01:00
Maciej Suminski 682da70a86 Fixed the issue of creating and event handling in context menus (GAL).
When creating a copy of CONTEXT_MENU, always a CONTEXT_MENU instance was
constructed, whereas an inherited type should be used. Solved with
CONTEXT_MENU::create() that has to be overridden in inheriting classes.

Event & update handlers are now virtual functions, instead of setting
the handlers with Set{Event,Update}Handler().
2017-01-23 11:40:59 +01:00
Maciej Suminski 75fb04d650 TOOL_ACTIONs are handled with transitions, no handlers needed in the event loops
There used to be a number of TOOL_ACTIONs that had entries both in
SetTransitions() and the event loop, which seemed redundant and
troublesome.
Now it is not necessary anymore, transitions setup is enough to execute
associated actions.
2017-01-18 14:20:39 +01:00
decimad ee3d75f273 Add coroutine call invocation context to identify the main stack frame.
Run the text draw-tool on the main stack frame.

Fixes: lp:1547282
* https://bugs.launchpad.net/kicad/+bug/1547282
2016-09-21 11:56:40 +02:00
Maciej Suminski cdc951d0a3 Fixed a crash when dragging a line was interrupted
Crash was caused by removing an element from m_activeTools list, causing other iterators to be invalidated.
2016-08-08 17:20:02 +02:00
Michael Steinberg 86496d3141 Pcbnew: fix dangling board reference crash in GAL. (fixes lp:1584489) 2016-08-05 13:45:14 -04:00
decimad 532634abf2 fix reentrant tool state crash 2016-08-02 10:34:27 +02:00
Michael Steinberg 06d4894fdb boost::context fixes to make it compatible with boost 1.61 2016-07-05 00:14:32 +02:00
Maciej Suminski 33e7fe6211 Fix a crash caused by invalid iterator (thanks to Michael Steinberg)
TOOL_MANAGER::finishTool() caused iterator to become invalid when an element was removed from the m_activeTools deque.
2016-07-04 16:12:21 +02:00
Simon Richter 1b2fd6a382 Replace BOOST_FOREACH with C++11 range based for. 2016-06-29 16:07:55 -04:00
Maciej Suminski 03d8d6850a Minor fixes. - Prevent a crash if m_activeTools is empty (should not happen, but you know the Murphy's law) - Better use of conditions in FOOTPRINT_EDIT_FRAME::Process_Special_Functions() 2015-08-07 18:17:51 +02:00
Maciej Suminski 29cbaa206e Fixed updating of Zoom & Grid context menus. 2015-07-30 13:49:35 +02:00
Maciej Suminski c9837595ef Fixed VIEW_CONTROLS too frequent reset. 2015-07-28 10:30:06 +02:00
Maciej Suminski e9921d8eea Fixed an assert when footprint viewer was closed before the pcbnew window. 2015-07-28 10:29:00 +02:00
Maciej Suminski d010703eaf Fixed cursor freeze in pcbnew (GAL). 2015-07-24 10:58:47 +02:00
Maciej Suminski d6bc33bd42 Removed a few more memory leaks and fixed crash on exit. 2015-07-24 09:42:46 +02:00
Maciej Suminski 59af7a96f8 Minor code cleaning. 2015-07-15 14:08:52 +02:00
Tomasz Wlostowski a86fda1d37 tools: added TOOL_SETTINGS class for storing persistent tool settings in config file (just a wrapper for wxConfigBase) router: free angle mode (mark obstacles only) & persistent settings 2015-07-02 16:09:51 +02:00
Maciej Suminski da75c52665 Hot keys settings are synchronized between GAL & legacy 2015-05-05 20:39:42 +02:00
Maciej Suminski 99e5228948 Moved the list of TOOL_ACTIONs to ACTION_MANAGER. 2015-05-05 20:39:41 +02:00
jean-pierre charras 2047d87317 Minor fixes (Bug #1414328 and Bug #1440312). Remove translatable attribute in a debug message.
tools/edit_tool.cpp: remove limitation (GAL mode) to delete the last pad in a footprint (a footprint can have 0 pad, for instance a logo)
2015-05-01 17:01:09 +02:00
Maciej Suminski 8390fec69d Minor fixes. 2015-04-30 10:46:08 +02:00
Maciej Suminski b218c1099f Added TA_CONTEXT_MENU_CLOSED tool event. 2015-04-30 10:46:07 +02:00
Maciej Suminski f2788a3086 Corrected way of storing cursor coordinates for context 2015-04-30 10:46:06 +02:00
Maciej Suminski 06b978b829 Refactored CONTEXT_MENU, added handler for updating. 2015-04-30 10:46:05 +02:00
Maciej Suminski 946b9d1933 setTransitions() are called automatically for tools. 2015-04-30 10:46:03 +02:00
Maciej Suminski 5c984aa069 Parametrized TOOL_ACTIONs. 2015-04-30 10:46:01 +02:00
unknown b3b791961a coverity common folder fixes (mainly not initialized members). 2015-03-11 17:04:20 +01:00
Maciej Suminski f7a32e839e Moved UndoInhibit related functions from TOOL_MANAGER to EDIT_TOOL. 2015-02-19 14:53:31 +01:00
Maciej Suminski f06690c8d3 Merged lp:~john-j-beard/kicad/moveexact. 2015-02-18 20:27:00 +01:00
Maciej Suminski 902d0e3f1f Tools are processing const TOOL_EVENT& (Tool Framework). 2015-02-14 21:28:47 +01:00
John Beard 4f3672da4d Add "move exact" and "duplicate" tools to pcbnew 2015-02-12 03:22:24 +00:00
Maciej Suminski 7e249c758b bugfix: Tools are deactivated on canvas switch. 2014-12-10 00:50:31 +01:00
Maciej Suminski 18898fe807 tool: Added a generic parameter for RunAction(). 2014-11-21 11:28:34 +01:00
Maciej Suminski aad359fcf9 Fixed Mac OS build. 2014-07-20 20:58:33 +02:00
Maciej Suminski ff30ced4f4 Cursor position is frozen when a context menu is displayed (GAL). 2014-07-09 16:50:31 +02:00
Maciej Suminski b1837615aa Added event queue to handle events at the end of the event processing cycle. 2014-07-09 16:25:50 +02:00
Maciej Suminski c0a96141df Added AF_NOTIFY flag for TOOL_ACTIONs. 2014-07-09 15:10:32 +02:00
Maciej Suminski 95a4f61eee wxWidgets 2.8 compatibility fix. 2014-07-09 14:23:13 +02:00
Maciej Suminski 456eeaba10 Routines for handling clipboard with TOOL_MANAGER. 2014-07-09 14:01:07 +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 5703b7e8bf Implemented stacking for TOOL_STATEs. 2014-07-09 13:50:27 +02:00