Commit Graph

290 Commits

Author SHA1 Message Date
Jeff Young e517199794 Move ConfigurePaths and LibTable management to common ACTIONs. 2019-06-03 21:08:30 +01:00
Jeff Young 33773bad4d Yet more command conversions to ACTIONs. 2019-06-02 21:10:56 +01:00
Jeff Young 6ac273264d Move Show3DViewer to common action. 2019-06-02 16:21:44 +01:00
Jeff Young 45a9544726 Instantate a default menu from no selection when menu is first built.
This might resolve some of the GTK menu anomalies.
2019-06-02 12:58:08 +01:00
Jeff Young 7f1ed30ff5 Move DeMorgan handling to ACTIONs. 2019-06-01 23:03:24 +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 a27e4246e0 Move some more menu commands to ACTIONs. 2019-05-29 00:26:29 +01:00
Jeff Young 6936effaa7 Implement undo for Page Settings in PlEditor, Eeschema and PCBNew.
Fixes: lp:1820059
* https://bugs.launchpad.net/kicad/+bug/1820059
2019-05-27 11:58:55 +01:00
Jeff Young a3dfce5adb Implement common file menu actions and move Eeschema over. 2019-05-25 01:14:21 +01:00
Jeff Young 85f984ccd9 Add point-editor activation for immediate-mode drawing. 2019-05-24 19:49:09 +01:00
Jeff Young 09424db68f Restore selection around undo/redo. 2019-05-24 19:49:09 +01:00
Jeff Young 323bb0f8e1 Moving PageLayout editor to GAL canvas and modern toolset. 2019-05-24 19:49:09 +01:00
Jeff Young 0047f88f82 Mark unfold bus menu as clean so it doesn't get generated a second time.
Fixes: lp:1829878
* https://bugs.launchpad.net/kicad/+bug/1829878
2019-05-23 00:27:53 +01:00
Jeff Young 67cc2aac2e Rework Eeschema find/replace for modern toolset.
Fixes: lp:1827274
* https://bugs.launchpad.net/kicad/+bug/1827274

Fixes: lp:1827240
* https://bugs.launchpad.net/kicad/+bug/1827240
2019-05-22 21:48:04 +01:00
jean-pierre charras aee1fe45f4 Fix a few issues related to Bitmaps in menus.
- fix missing icons.
- remove duplicate (and incorrect) code to set these icons in wxMenuItems
2019-05-21 17:50:05 +02:00
Jeff Young f21faceb74 A hack to work around wxWidgets failure to capture WX_MENU_OPEN events
See the comments.  It's not pretty, but it works.

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

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

Fixes: lp:1594029
* https://bugs.launchpad.net/kicad/+bug/1594029
2019-05-19 22:04:28 +01:00
Jeff Young 7d9a0b06e0 Push help menu down into EDA_BASE_FRAME. 2019-05-18 13:14:08 +01:00
Jeff Young 13aa503614 Hack for wxWidgets failure to open menu on MSW. 2019-05-18 00:21:49 +01:00
Jeff Young 1a3d0492f5 Push polar coords down into COMMON_TOOLS. 2019-05-18 00:21:49 +01:00
Jeff Young fbb807f3bb Move some more menu & toolbar items to modern toolset. 2019-05-16 19:57:06 +01:00
Jeff Young 69afa27a5f Implement ACTION_TOOLBAR and update some of the menus to ACTION_MENU.
This gives us better separation of MVC in line with the design of
the modern toolset.  It also reduces a whole bunch of duplicated
data.
2019-05-15 17:50:52 +01:00
Jeff Young f9e4ee1fc9 CONTEXT_MENU -> ACTION_MENU. (Now used for menu-bar menus too.) 2019-05-15 17:50:52 +01:00
Jeff Young e850592587 Cleanup. 2019-05-15 17:50:52 +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 ea0941cab3 Implement modern tools for LibEdit. 2019-05-10 16:11:57 +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 ed0e6af66d Move to direct tool registration.
It was confusing that the primary frames registered their tools
differently than the other frames.  In addition, since the other
frames also added their own tools, foo_actions::RegisterAllTools()
didn't really register all tool but rather those used by the
principal frame (PCB_EDIT_FRAME, SCH_EDIT_FRAME, etc.)
2019-05-05 17:14:30 +01:00
Jeff Young 20b63174dc Support wire & bus drawing from selection tool. 2019-05-05 17:14:30 +01:00
Jeff Young 29f1787af2 Logic improvements and fixes for wire segment selection states. 2019-05-05 17:14:30 +01:00
Jeff Young 423d430b58 Replace deleteNode and deleteConnection with selectNode and selectConnection. 2019-05-05 17:14:29 +01:00
Jeff Young 2244dcd567 Move show datasheet to SCH_INSPECTOR_TOOL and add show marker info. 2019-05-05 17:12:59 +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
Jeff Young 42383ae871 Build out some of the modern toolkit context menus. 2019-05-05 17:12:59 +01:00
Jeff Young 1a007c3e4b Implement SCH_SELECTION_TOOL (but still with legacy semantics). 2019-04-22 22:08:18 +01:00
Jeff Young c88fd514a0 Implement drawing tools in modern toolset.
Fixes: lp:1825192
* https://bugs.launchpad.net/kicad/+bug/1825192
2019-04-17 21:49:50 +01:00
Jeff Young 94a948fdd1 Move grid selection for both Eeschema and Pcbnew to COMMON_TOOLS. 2019-04-13 18:43:35 +01:00
Jon Evans dec5d80180 Veto mouse warping from DRC dialog
Fixes: lp:1824630
* https://bugs.launchpad.net/kicad/+bug/1824630
2019-04-13 11:23:57 -04:00
Jeff Young 3c11b89e4c Hook up refresh buttons to library tree synchronisation.
Fixes: lp:1820057
* https://bugs.launchpad.net/kicad/+bug/1820057
2019-04-11 19:45:10 +01:00
Jeff Young adf3637476 Allow dialogs to veto mouse-warping when called from context menu.
Fixes: lp:1745731
* https://bugs.launchpad.net/kicad/+bug/1745731
2019-04-08 20:07:40 +01:00
Seth Hillbrand d15876595f Fix init order to quiet warnings 2019-02-16 12:53:45 -08:00
Seth Hillbrand 813578eba6 Fix a few coverity errors 2019-02-15 20:15:04 -08:00
John Beard 267e17d539 QA: Add a generic utility tool executable.
The intention here is to make it possible to wrap up many of the
KiCad utility tools into a single executable. This reduces link times
as well as the duplication of CMake files needed to build very
similar tools.

This particular tool should be suitable for any code in common,
code in pcbnew and other end-executables probalby will need an
analagous version linked to the relevant kiface.

The first tool is the coroutine_example.cpp test case, which
can be useful when learning, debugging or porting the coroutine
infrastructure.
2019-01-22 09:04:38 -05:00
Seth Hillbrand 0f1a11ef38 pcbnew: Cut only copied objects
Fixes a bug where objects where accessed after being freed by the cut

Fixes: lp:1811456
* https://bugs.launchpad.net/kicad/+bug/1811456
2019-01-11 17:27:29 -08:00
Seth Hillbrand 8f11a2133e Revert "QA: Add a generic utility tool executable."
This reverts commit 502306314e.
2019-01-06 16:17:44 -08:00
John Beard 502306314e QA: Add a generic utility tool executable.
The intention here is to make it possible to wrap up many of the
KiCad utility tools into a single executable. This reduces link times
as well as the duplication of CMake files needed to build very
similar tools.

This particular tool should be suitable for any code in common,
code in pcbnew and other end-executables probalby will need an
analagous version linked to the relevant kiface.

The first tool is the coroutine_example.cpp test case, which
can be useful when learning, debugging or porting the coroutine
infrastructure.
2019-01-06 07:51:23 -08:00
jean-pierre charras 256f1a26e6 Fix a compil issue with gcc 4.8.4 compiler
On Ubuntu 14.04 the compiler does not like using const iterators instead of iterators.
2018-10-25 20:24:33 +02:00
Seth Hillbrand 1dd22f5035 SELECTION: Utilize sorted deque
Many operations on the selection involved getting an item by index or
dereference.  The std::set needed to iterate from the beginning of the
set to find the item in its red-black tree.  Using a deque that we keep
sorted, we get index access in O(1) and item search in O(lg N).
2018-10-24 16:32:34 -07: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
John Beard 445a9fa963 Put cursor and pan control in libcommon/tool, enable in Gerbview
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
2018-10-04 11:41:06 +02:00
Jeff Young cbb3492d98 Standardize Footprint Viewer and Footprint Browser.
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
2018-09-12 14:01:35 +01:00
Jeff Young 5f3ee1e7ce More g_UserUnit erradication.
(cherry picked from commit 3f08780)
2018-07-17 15:12:31 +01:00
Jeff Young 05ef6f05d1 Move SanitizePads to CLIENT_SELECTION_FILTER architecture.
This not only reduces the number of different mechanisms, but
will also reduce (yet again) the number of Clarify Selection
pop-ups (because the CLIENT_SELECTION_FILTER runs before the
pop-up, while SanitizePads ran after it).

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

(cherry picked from commit e50a993)
2018-07-17 15:10:18 +01: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
Jeff Young 79e0bb08d0 Architecturally-simpler fix for grid context menu unit changes.
Fixes: lp:1777519
* https://bugs.launchpad.net/kicad/+bug/1777519
2018-06-20 16:54:24 +01:00
Jeff Young 3c7b91b96a Always create grid menu so units are up-to-date.
Fixes: lp:1777519
* https://bugs.launchpad.net/kicad/+bug/1777519
2018-06-19 10:52:36 +01:00
Jeff Young cd5f727880 Fix off-by-1 errors in zoom menus & use zoom steps in GAL canvas.
Also bumps the maximums a bit (at user request).

Fixes: lp:1773215
* https://bugs.launchpad.net/kicad/+bug/1773215
2018-05-25 13:01:58 +01:00
jean-pierre charras 319908b7f4 fix a compil issue. 2018-04-24 15:20:35 +02:00
Maciej Suminski 143d580596 Fixed relative coordinates reset when a tool forces the cursor position
Fixes: lp:1759044
* https://bugs.launchpad.net/kicad/+bug/1759044
2018-04-24 12:56:19 +02:00
Jeff Young 99e659ff54 Coverity fixes. 2018-03-21 23:11:55 +00:00
Tomasz Włostowski af7064ef89 pcbnew: synchronize zone visibility view menu entries with the toolbar buttons 2018-03-03 17:38:28 +01:00
Carsten Schoenert 6256feb9db fix misspelled 'occured' -> 'occurred' 2018-02-25 17:10:10 -05:00
Maciej Suminski 151021919e Tool Manager: yet another approach to handling tool view control settings
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
2018-02-14 15:34:05 +01:00
Maciej Suminski 4f0c9b6b20 Fix double disambiguation menu when removing footprints
Second disambiguation menu was caused by another call to
SELECTION_TOOL::RequestSelection() meant to get the list of
connected tracks. When there were only footprints under the cursor,
it asked the user again to pick an item to remove.

Fixes: lp:1748521
* https://bugs.launchpad.net/kicad/+bug/1748521
2018-02-12 10:34:22 +01:00
Maciej Suminski 95864780e2 Fix cursor freezes in GAL
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
2018-02-02 19:08:05 +01: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
Maciej Suminski 7f9202842d Fix an initialization order warning in coroutine.h 2018-01-10 08:52:17 +01:00
Camille 9ff66a5274 Fix unnecessary value parameter detected by clang-tidy. - Replace value parameter by const reference parameter or move-assignement in some cases 2018-01-09 18:55:51 -05:00
Mark Roszko b98cc0b937 Some coverity fixes 2018-01-05 22:51:03 -07:00
Maciej Suminski 769611b79e Do not ask for confirmation to open Properties dialog for a locked footprint
Opening Properties dialog normally does not ask the user to confirm the
action, even for locked items. The exception was a case when there was
nothing selected and Properties dialog was invoked via its hot key -
then SELECTION_TOOL::RequestSelection() tried to get the item under the
cursor, verifying the lock flag.

Fixes: lp:1734537
* https://bugs.launchpad.net/kicad/+bug/1734537
2017-11-28 17:35:46 +01:00
Marvin Schmidt 69974b73db Remove some extra semicolons 2017-11-09 19:52:18 +01:00
Maciej Suminski 40129d2244 Fixed cursor freeze after canceling a tool with cursor over a drag point
Fixes: lp:1716702
* https://bugs.launchpad.net/kicad/+bug/1716702
2017-11-08 11:41:45 +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
jean-pierre charras eb2340bc23 Show/Hide icons in menus (according to Icons option) in GAL, like in Legacy mode.
Cosmetic enhancement in Gerbview context menu.
2017-10-23 18:48:03 +02:00
jean-pierre charras 4905bbe500 hotkey management: enhancements in code to know if a hotkey was handled by an event or not.
No actual change in key management: in legacy it was partially existing, and not yet used in GAL mode.
2017-10-06 09:23:13 +02:00
Tomasz Włostowski 931a1ccaff Improved copy/paste functionality by Kristoffer:
- added selection of reference point
- added snapping when pasting
- some minor code refactoring
- disabled pasting between footprint and pcb editors due to model incompatibility
2017-09-30 14:28:54 +02:00
Jon Evans 77bf22359e Move zoom_tool.h to include 2017-09-25 13:35:01 +02:00
Jon Evans eec1366ead Move ZOOM_TOOL to common; add RMB-drag to zoom out 2017-08-31 10:04:00 +02:00
Tomasz Włostowski 2e4c22f718 router: fix corruption of board data when the inline drag is activated while the router tool is running
Fixes: lp:1712838
* https://bugs.launchpad.net/kicad/+bug/1712838
2017-08-30 01:16:06 +02:00
jean-pierre charras aa3a1267ea Fix compil warnings 2017-08-04 17:46:18 +02:00
Tomasz Włostowski 32185ddcd3 Multiple improvements concerning colors, configuration handling and legacy features in pcbnew:
- support for background color setting
    - removed several global config settings (such as g_Drc_On)
    - wrapped most of global config settings in PCB_GENERAL_SETTINGS class
    - reorganized PCB general options dialog to clearly mark which options concern only the legacy canvas
    - new GAL feature for legacy users: double-click (or E) to change track width available as an option.

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

Fixes: lp:1707145
* https://bugs.launchpad.net/kicad/+bug/1707145
2017-08-04 16:06:57 +02:00
Maciej Suminski 76bd05a69b Prevent creating too many transitions by TOOL_MANAGER
- added TOOL_INTERACTIVE::resetTransitions()
- made protected and moved TOOL_BASE::setTransitions() to TOOL_INTERACTIVE
- TOOL_MANAGER calls TOOL_INTERACTIVE::resetTransitions() instead of
setTransitions()
2017-07-31 15:09:19 +02:00
jean-pierre charras 6a3c1720b2 Fix a few doxygen warnings 2017-06-25 11:26:04 +02:00
jean-pierre charras 2c21c70f46 Fix a few doxygen warnings 2017-06-22 09:09:52 +02:00
Robbert Lagerweij e57c962336 Pcbnew: add option to select origin & anchor in move exactly tool
This patch adds a radiobox to allow the user to select a reference point for
the move. The additional options are: User Origin (set with <space>),
Grid Origin and Sheet Origin (effectively making it an absolute coordinate).

A checkbox is added (where it makes sense) to allow overriding which point
within the component is put on top of the designated coordinate.

Fixes: lp:1460460
* https://bugs.launchpad.net/kicad/+bug/1460460
2017-04-25 11:32:49 -04:00
John Beard 78a5185857 Allow GAL cursor to be always displayed
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
2017-03-22 10:04:56 +01:00
Tomasz Włostowski eedf7cb243 Switched coroutine library from Boost libcotext to custom libcontext.
Fixes lp:1658249

https://bugs.launchpad.net/kicad/+bug/1658249
2017-03-07 11:45:29 -05:00
Maciej Suminski 338735c5bf Added a missing include to tool_manager.h
Previously full information about VC_SETTINGS type was not
available, so it was not possible to create a VC_SETTINGS stack
for some compilers.
2017-03-07 17:18:58 +01:00
Maciej Suminski fc4240886b Store VIEW_CONTROLS settings on a stack
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.
2017-03-06 15:04:27 +01:00
Tomasz Włostowski 966052272f Coding style fixes 2017-03-03 20:27:05 +01:00
Tomasz Włostowski cc3d79f932 Reworked selection passing mechanism in SELECTION_TOOL.
- The tools can now specify if the items in the selection must be editable/
deletable. This is groundwork to be able to select/delete DRC markers, which can't
otherwise be edited.
- Fixed disappearing of selected objects
2017-03-03 20:26:34 +01:00
Jon Evans 88f7c55d95 Move ZoomFitScreen and ZoomPreset from PCBNEW_CONTROL to COMMON_TOOLS
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.
2017-03-03 13:28:19 +01:00
Kristoffer Ödmark dda51ab550 CrossProbes Schematics from eeschema to pcbnew
Adds a similar crossprobe as modules has in pcbnew. When clicking a
sheet in eeschema, the items that are exclusive in that scheet will be
selected in pcbnew if using the GAL canvas.
2017-03-03 07:25:32 -05:00
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
Jon Evans fd4e2b042c Refactor SELECTION, SELECTION_CONDITIONS, and context menus to common
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)
2017-02-28 14:47:20 +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
John Beard c001c6114f Add cancel interactive tool action to GAL
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.
2017-02-24 10:37:07 +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 d7bf44eee0 Removed a few more headers from base_struct.h 2017-02-22 17:54:01 +01:00