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).
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.
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
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.
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
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
* 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.
* 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
* 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
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
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.
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.
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.
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).
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)
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
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
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.
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
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.
We prevent the creation of invalid polygons by keeping the converging
lines from intersecting. This test doesn't make sense for triangular
polygons as they always intersect and we want to allow them to move
outside of the singular point.
Fixes: lp:1831481
* https://bugs.launchpad.net/kicad/+bug/1831481
(cherry picked from commit 966173c129)
The action menu handler was capturing too many menuitem events.
Only context menuitem highlight events and some popup menu events need to be captured
Any id < 0 (like automatically assigned menuitem id) is no longer captured.
Fixes: lp:1831669
https://bugs.launchpad.net/kicad/+bug/1831669
The source bitmap was copied to the new created item.
However, for Checkable menu-items, when setting a bitmap, our standard check bitmap is also added.
This is unwanted when the source bitmap is the wxNullBitmap (bitmap sizes are different)
This commit redirected too many menuitem IDs to the tool manager.
Only some context menu items have to be redirected, not all inside ACTION_EVENT events.
This hack is not perfect. It needs a better handling of ACTION_EVENT handling.
This removes the remaining hard-coded segments counts and replaces them
with the relative error calculation where the segments per arc is
determined by the maximum error we allow (smaller arcs = fewer segments)
Add the N/Shift+N hotkeys to the eeschema hotkey file.
Also adjust the COMMON_TOOLS::GridNext/Prev to work when
the screen's grid definitions do not have consecutive command
IDs (they do not in eeschema).
This is related to lp:1811018 (but doesn't constitute a fix).
* https://bugs.launchpad.net/kicad/+bug/1811018
If user hotkeys do not map all available actions, we still want the most
recent change to be the primary value. This can happen if the defaults
load a set of hotkeys that are not completely overwritten by the updated
hotkey preferences file. We assume that the most recent hotkey is what
the user want to map.
Fixes: lp:1778408
* https://bugs.launchpad.net/kicad/+bug/1778408
The standard DIM() macro was not typesafe as it happily deferred errors
to runtime that can be caught at compile time. Replacing it with a
generic C++11 constexpr allows for typecasting, comparison and compile
time error checking.
Display GALs had an incorrect world unit value set. Now the world unit
value says how many internal units are in an inch, in accord with the comments
in the GAL header. Bitmap drawing code relied on the information about DPI,
so scaling worked differently for display and print GALs.
Put the cursor and pan control TOOL_ACTIONs in ACTION,
and refer to them in that way.
The handlers are currently identical in Pcbnew and Cvpcb,
and Gerbview (and all canvases) can benefit from them as well
if they are in libcommon. Also saves duplicated code.
Fixes: lp:1795855
* https://bugs.launchpad.net/kicad/+bug/1795855
Add Display Settings to Footprint Browser.
Make each of them OpenGL on OSX and Cairo on other platforms.
Allow auto-zoom to be turned off and save last zoom setting.
Make ordering of tools in htoolbar consistent.
Standardize grid and zoom drop-downs.
Fixes: lp:1791667
* https://bugs.launchpad.net/kicad/+bug/1791667
The tools were being set as idle, whenever an event handler execution
finished (via TOOL_MANAGER::finishTool()). Such approach does not take
into account cases when a tool is active and receives an event causing
another event handler of the same tool to run. When this happend, the
tool has been incorrectly set as idle when the second handler finished
its execution.
In a particular case, invoking the router settings dialog caused the PNS
router to be incorrectly detected as inactive in
EDIT_TOOL::invokeInlineRouter(). Due to that, ROUTER_TOOL::CanInlineDrag()
requested a selection that required disambiguation menu for items
that were modified by the router, but not yet committed. After the drag
tool had finished, the disambiguation menu was eventually shown
with items existing only in the undo buffer. Removing such item lead to
track DLIST corruption, effectively erasing all tracks.
Fixes: lp:1767826
* https://bugs.launchpad.net/kicad/+bug/1767826
The hotkey fix committed in 53b1ec81 broke non-us keyboards. Change the
hotkey help hotkey from '?' to Ctrl+F1 to prevent the hotkey list dialog
from being shown when placing a bus wire junction in Eeschema and when
changing the track posture in Pcbnew. This is still broken in the GAL
framework.
wxASSERT(), contrary to assert() does not terminate the program when
triggered. As assertions in ACTION_MANAGER are not critical and should be
treated as warnings - there is no need to close the program.
The change track posture hotkey '/' was getting interpreted as the show
hotkey list shortcut '?' on windows. This fix is temporary hack to fix
the problem which much more involved than the simple #ifdef/#endif used
to fix this issue.
Add key code tracing to help analyze key codes for future development.
This is so that tools checking for a selected item won't think
the menu has been cancelled if the selection was in a submenu.
Fixes: lp:1758372
* https://bugs.launchpad.net/kicad/+bug/1758372
All calls to {save,apply}ViewControls() have been replaced with a new
method: setActiveState(). The advantage is that setActiveState() always
saves view controls settings to the tool that set them. As long
as setActiveState() is called every time there is a tool context
switch, the changes are kept up-to-date.
Fixes: lp:1748613
* https://bugs.launchpad.net/kicad/+bug/1748613
Fixes a bunch of errors:
- libedit and libbrowser would zoom to bounding box but centre on canvas
- libedit, libbrowser and gerbview didn’t take the scroll bars into account
- pcbnew didn’t take scroll bars into account or apply the 10% margin
- appending a board file would re-centre, but not re-zoom
Fixes: lp:1504302
* https://bugs.launchpad.net/kicad/+bug/1504302
It affected just started tools that did not have cursor settings
stored, so could not be reverted after the context menu is gone.
Fixes: lp:1748613
* https://bugs.launchpad.net/kicad/+bug/1748613
Launching right click context menu overrides the cursor position, so all
actions executed by the tools will be performed in the right click
position. It created an issue, as the overridden cursor settings were
saved into wrong context if there was another tool activated in the
meantime.
Current implementation saves cursor settings for all tools and restores
them once the right click context menu disappears.
Fixes: lp:1745981
* https://bugs.launchpad.net/kicad/+bug/1745981
Fixes: lp:1746507
* https://bugs.launchpad.net/kicad/+bug/1746507
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
Don't apply missing-mouse-up logic to mouse-down events. The
logic depends on mouse-state, and the OS-synthesized mouse-up
and mouse-down events from a tap don't contain any state.
Fixes: lp:1737010
* https://bugs.launchpad.net/kicad/+bug/1737010
The OSX implementation needs to be poked to update the
brightening / unbrightening during running of the
disambiguation menu. (FWIW, now that I've finally seen
it in action, it's a REALLY cool feature.)
Fixes: lp:1715440
* https://bugs.launchpad.net/kicad/+bug/1715440
The fix is now only for Windows, because it creates issues and does not fix the special keys issues on Linux.
This is due to the serious differences in event management between platforms.
- added TOOL_INTERACTIVE::resetTransitions()
- made protected and moved TOOL_BASE::setTransitions() to TOOL_INTERACTIVE
- TOOL_MANAGER calls TOOL_INTERACTIVE::resetTransitions() instead of
setTransitions()
A new items is added to the GAL display options (and the dialog), and a
hotkey (Ctrl+Shift+x) is added to toggle it.
Fixes: lp:1673633
* https://bugs.launchpad.net/kicad/+bug/1673633
This is the right implementation of the commit b25ded4d.
Previously if there were tools launched from another tool,
the settings could be stored in a wrong TOOL_STATE object.
BOARD::GetBoundingBox() now directly calls BOARD::ComputeBoundingBox()
and there is a new method BOARD::GetBoardEdgesBoundingBox() used for
call sites that needed to use ComputeBoundingBox( true ) in the past.
This allows COMMON_TOOLS to implement ZoomFitScreen without knowledge
of the BOARD class.
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
SELECTION now holds EDA_ITEMs not BOARD_ITEMs so various places had to
change to casting the selected items to BOARD_ITEMs.
Fixed compilation warnings on clang (Tom)
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.
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.
This is used to provide menu entries that allows cancellation of
interactive drawing and routing tools without needing the keyboard.
It is provided in the drawing tools and the router tool.
The cancel event doesn't have any new functionality (e.g. track rip-up
for the PNS router - lp:1448460), this just adds it to the menu, where
it behaves the same as an Escape keypress.
Some grid/zoom tools are left in PCBNEW_CONTROL because they currently
depend on Pcbnew-specific class members. Once refactoring is done to
make it possible to use all zoom and grid controls outside of pcbnew,
these last tools can be moved to common to match their ACTIONs.
New virtual class ACTIONS is added as a member to EDA_DRAW_FRAME so
that the TOOL_DISPATCHER can have access to the appropriate derived
version of TranslateLegacyId()
The apply settings and push settings options now take account of the
validity of the global pad settings when deciding whether to show or
not.
Global pad push now requires a source pad and doesn't push from the
global pad setting when there is no selection.
The whole submenu is hidden when there are no enabled items.
Fixes: lp:1664016
* https://bugs.launchpad.net/kicad/+bug/1664016
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.
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().
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.