Commit Graph

233 Commits

Author SHA1 Message Date
Kristoffer Ödmark 69a649c093 Refactored out the function that selects items based on the sheetname 2017-03-03 07:21:41 -05: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 887f2b2a70 Adjusted "Select" context menu conditions
Shows "Select" submenu when there is at least one item selected.
It is necessary to use "select same sheet" and selection filter
effectively.
2017-02-23 10:50:38 +01:00
John Beard c6046d6da2 Add selection filter dialog to GAL
Fixes: lp:1535805
* https://bugs.launchpad.net/kicad/+bug/1535805
2017-02-23 10:50:38 +01:00
Jon Evans 4c83b0a94d Move TOOL_ACTIONs to their corresponding tools; create COMMON_TOOLS
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.
2017-02-22 10:32:48 +01:00
Jon Evans 167f45ca2b Refactor COMMON_ACTIONS into a base and derived class
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()
2017-02-22 10:32:48 +01:00
Kristoffer Ödmark 37c086896e Enables selection of components and tracks on same sheet.
Modifies the selection menu to be adaptive and disable selection options
that are not possible.

Adds a new selection option that is only available when selecting
modules, this tool will select all footprints on the same sheet level or
belonging to subsheets. It will also search for nets that are only
connecting between modules on the same sheet or lower and select every
segment and via belonging to it.
2017-02-11 07:33:49 -05:00
John Beard 0cd121049f Allow selectConnection/Copper/Net on multiple items
The previous behaviour was to act on only the first item in the
selection. The new behaviour is to act on every eligible item (in this
case, tracks and vias).
2017-02-10 22:42:55 +01:00
Maciej Suminski a16586756f Moved EDIT_TOOL::hoverSelection() code to SELECTION_TOOL::CursorSelection() 2017-02-09 12:03:28 +01:00
John Beard cdc392867a When 'Find-moving' modules in GAL, pick up at origin
Perviously, the generic snapping code would choose the nearest of the
module origin and origin of each module pad when selecting a module
using the "Find module" tool (T hotkey).

This is unlikely to be expected unless the cursor is already near the
correct pad or the module centre.

New behaviour is to pick up by module origin first, then
select the module. This means that the cursor is already nearest the
main module origin anchor, so that is what will be used.

Fixes: lp:1571214
* https://bugs.launchpad.net/kicad/+bug/1571214
2017-02-07 11:19:38 -05:00
Maciej Suminski 1102eb0d0d Store menu titles in CONTEXT_MENU
Previously a title had to be provided when a submenu was added,
but this led to storing the same title in many places.
2017-01-23 14:52:11 +01:00
Maciej Suminski 6362e5cf0f Added create() method for SELECTION_MENU 2017-01-23 14:52:11 +01:00
John Beard 6a1b068dd2 Allow editing locked modules in modedit
Since you have to explicitly enter the module editor with the menu or
hotkey, allowing editing of module sub-parts once in should not cause
any unexpected changes.

Fixes: lp:1591625
* https://bugs.launchpad.net/kicad/+bug/1591625
2017-01-22 20:31:59 -05:00
Maciej Suminski e5fbd0c442 Fixed crash upon finished zone drawing in GAL.
In principle, this patch reverts 2eefa117. The difference is removal of
one unused method (SELECTION::clear) and fixing hidden overloaded
virtual methods warnings.

Fixes: lp:1657569
* https://bugs.launchpad.net/kicad/+bug/1657569
2017-01-18 22:06:23 +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
Maciej Suminski 2eefa11732 SELECTION has-a VIEW_GROUP instead of being-a VIEW_GROUP
Fixed numerous warnings caused by hidden overloaded methods
provided in both classes (Add(), Remove(), etc.)
2017-01-18 13:22:41 +01:00
Maciej Suminski c758f434c0 Removed unused fields in VIEW & ANTIALIASING_SMAA classes 2017-01-18 13:22:18 +01:00
John Beard d7db84e282 Break out tools' common menu functions and ownership
Add a class TOOL_MENU, which provides a management class for a
CONDITIONAL_MENU and a set of CONTEXT_MENUs. The aim of this is to
provide a central place where all TOOL_INTERACTIVEs can get a "basic"
context menu that either they or other tools can register new items and
sub-menus against.

This means that "top-level" tools no longer need to manage the lifetimes
of any CONTEXT_MENUs that they add, and can also delegate simple menu
display functions.
2017-01-12 14:33:57 +01:00
John Beard 378f5cce33 Don't show separator in Select tool if not needed
If the SELECTION_TOOL's Select... menu is not shown, the separator under
it should also not be shown, so use the same SELECTION_CONDITIONS to
enforce this.
2017-01-11 11:15:25 +01:00
Maciej Suminski 89055c4425 Code formatting 2016-12-12 16:45:52 +01:00
Tomasz Włostowski 3f7c5a0845 fixed post-rebase issues 2016-12-12 16:45:52 +01:00
Tomasz Włostowski 1c1f4e9a50 Refactoring of VIEW/VIEW_ITEM classes:
- Remove dependency of EDA_ITEM on VIEW
- VIEW_ITEM is now a pure virtual interface
2016-12-12 16:45:52 +01:00
Tomasz Włostowski 27a10e8597 Multiple simplifications to GAL tools in PCBNew:
- Finalize transition to BOARD_COMMIT (removed all remaining uses of PICKED_ITEMS_LIST) and implicit view/ratsnest updates
- Simplified SELECTION class, it now can be directly added to a VIEW
- Removed unnecesary casts and templates
- Introduced C++11 features (range based for, lambdas) where they improve code readability
- Added non-undoable COMMITs, which can be used to propagate change notifications to interested listeners (e.g. ratsnest/view)
2016-12-12 16:45:52 +01: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
Maciej Suminski 8590809c7a Selection tool fix to enable selecting overlapping items
Fixes: lp:1499022
* https://bugs.launchpad.net/kicad/+bug/1499022
2016-09-15 13:25:08 +02:00
Tomasz Wlostowski 1924507001 Added a PCB_TOOL subclass. 2016-09-12 11:50:06 +02:00
Maciej Suminski ff6bdeee4b Removed a number 'if(m_editModules)' sections from pcbnew tools. 2016-09-12 11:50:06 +02:00
Simon Richter 1b2fd6a382 Replace BOOST_FOREACH with C++11 range based for. 2016-06-29 16:07:55 -04:00
Simon Richter da5699de0a Replace boost::shared_ptr with std::shared_ptr. 2016-06-29 11:09:55 -04:00
Michael Steinberg fde12ebd25 Replace boost::function and boost::bind with their std:: counterparts 2016-06-29 12:23:11 +02:00
Maciej Suminski ad66af66af Highlight an item when context menu is displayed (GAL). 2016-05-09 10:41:11 +02:00
Tomasz Wlostowski 5349eb4179 fixed segfault in selection tool 2016-02-08 15:12:59 +01:00
Maciej Suminski 75c8094b5a Make DRC markers not editable with the standard tools (GAL). 2016-01-20 15:22:09 +01:00
jean-pierre charras e175a96be4 Pcbnew: Enhancement: in Get footprint (hotkey 'T') : better footprint selector dialog. 2015-12-20 19:47:52 +01:00
Simon Wells 5bc6a55015 Changed behaviour so if the menu is closed without selection by pressing esc or clicking outside of the menu that the last highlighted option wont be selected 2015-10-08 02:32:36 +13:00
Maciej Suminski 0bd85fd8d1 Fixed a minor memleak. 2015-08-07 18:20:49 +02:00
Tomasz Wlostowski 9c2bcb2f3c Fixed crash on right click on zone with GAL mode. 2015-08-03 11:53:58 +02:00
Maciej Suminski 3049bc1d5f Fixing SELECTION_TOOL heuristics, take #2. 2015-07-30 13:49:35 +02:00
Maciej Suminski 4718b6d7c8 Code formatting. 2015-07-30 13:49:35 +02:00
Maciej Suminski 63b0e63152 Prevent 'select copper' & 'select trivial connection' from picking modules. 2015-07-28 17:33:18 +02:00
Maciej Suminski 656790a672 Make module texts selectable if overlapping with module pads. 2015-07-24 09:42:46 +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 4b45146c46 Improvements to the SELECTION_TOOL heuristics & sanitization rules. 2015-07-15 14:08:52 +02:00
Maciej Suminski 59af7a96f8 Minor code cleaning. 2015-07-15 14:08:52 +02:00
Maciej Suminski ca27eeb5c7 Fixed "select copper connection". 2015-07-09 20:04:54 +02:00
Maciej Suminski f0a1f6dd78 Hotkeys for selecting trivial or copper connection (GAL). 2015-07-09 17:11:34 +02:00
Maciej Suminski 1b208e0a5e Display info in the message panel if only one item was selected using area selection tool. 2015-07-03 20:58:12 +02:00
Maciej Suminski e91fdd0079 Removed redundant transition in SELECTION_TOOL. 2015-06-19 17:32:32 +02:00
Maciej Suminski fa3d074ca4 Find command zooms in found items (GAL). 2015-06-18 17:51:52 +02:00
Maciej Suminski ac10ca40f8 Net highlighting is moved to a separate TOOL_ACTION. 2015-06-18 17:51:50 +02:00
Maciej Suminski dd5275f6c6 Minor SELECTION_TOOL fixes. 2015-06-16 14:51:39 +02:00
Maciej Suminski 209e630873 Disable net highlighting after loading a new board. 2015-06-04 14:54:08 +02:00
Maciej Suminski 01c9f09833 wxWidgets under OS X require wxMenuItem ids to be >0. 2015-05-18 13:48:13 +02:00
Maciej Suminski 4fe65715a2 Added trivial connection selection (GAL). 2015-05-18 13:48:10 +02:00
unknown 04ffd0a4ac i18n pcbnew GAL popup menu entries 2015-05-03 17:53:44 +02:00
jean-pierre charras d41bc31c49 Fix bug #1447905 (very minor bug, in fact). Fix a few minor coding style issues.
Fix 2 coverity warnings.
2015-05-03 08:31:14 +02:00
Maciej Suminski 872259981a CONDITIONAL_MENU supports separators and ordering. 2015-04-30 10:46:08 +02:00
Maciej Suminski 958046ddb2 Moved SELECTION_TOOL context menu to a separate class. 2015-04-30 10:46:08 +02:00
Maciej Suminski 9ef9b7b8e1 Preliminary selection mode for SELECTION_TOOL. 2015-04-30 10:46:07 +02:00
Maciej Suminski b8295b6af8 Code formatting. 2015-04-30 10:46:07 +02:00
Maciej Suminski 6379d80636 Zoom & grid menus for GAL canvases. 2015-04-30 10:46:05 +02:00
Maciej Suminski 06b978b829 Refactored CONTEXT_MENU, added handler for updating. 2015-04-30 10:46:05 +02:00
Maciej Suminski 4be876a13a Expandable CONTEXT_MENUs (GAL). Minor CONTEXT_MENU 2015-04-30 10:46:04 +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
Eldar Khayrullin 5d55fa018e Translate Selection tool "Select..." entry. 2015-04-04 21:57:38 +02:00
Maciej Suminski b1cd83c197 Icons in GAL context menus. 2015-04-02 16:09:48 +02:00
Maciej Suminski b6c5b291a2 Coverity fixes. 2015-03-11 14:17:43 +01:00
Maciej Suminski 035b231b62 Refinement for fix in 5497. 2015-03-10 18:31:23 +01:00
Maciej Suminski 2ecb72da84 Fixed disappearing selected items when switching between GAL canvases. 2015-03-10 17:05:38 +01:00
Maciej Suminski 56b692ae3e "Select net/connection" (GAL). 2015-03-10 09:36:04 +01:00
Maciej Suminski 0dd9efd9db Merged the differential pair router & length tuning tool. 2015-03-03 11:50:50 +01:00
Maciej Suminski 3e9bb6b887 SELECTION::GetCenter() returns VECTOR2I instead of wxPoint. 2015-02-20 11:40:36 +01:00
Maciej Suminski f06690c8d3 Merged lp:~john-j-beard/kicad/moveexact. 2015-02-18 20:27:00 +01:00
Maciej Suminski 4fb9bce354 Code formatting. 2015-02-18 17:53:46 +01:00
Tomasz Włostowski e5deafb4bb bulk improvements for selection and edit tools (GAL) disambiguatin heuristics and smarter grid alignment 2015-02-18 01:10:20 +01:00
Maciej Suminski b19010ff8b Cross-probing pcbnew<->eeschema (GAL). 2015-02-14 21:52:22 +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 789bb9663c bugfix: Find does not work in high contrast mode in GAL. 2015-01-29 18:23:54 +01:00
Maciej Suminski 0c1a87ca56 selection_tool: Added SelectItem and UnselectItem actions. 2014-11-21 11:50:13 +01:00
Maciej Suminski 823623acb8 selection_tool: Renamed deselect* to unselect* for naming consistency. 2014-11-21 11:49:54 +01:00
Maciej Suminski 62e2537e73 selection_tool: Renamed selectSingle to selectCursor. 2014-11-21 11:49:28 +01:00
Maciej Suminski 4eabe23104 pcbnew: Allows selecting module edges in module editor, when they are covered with other items (GAL). 2014-11-13 16:58:24 +01:00
Maciej Suminski 1855db5493 pcbnew: Fix persistent multiple items selection box that stays after selecting a polygon/line (GAL). 2014-11-13 14:11:26 +01:00
Maciej Suminski ac7bdfc7f6 pcbnew: Fixed 'Find Item' (GAL canvas). 2014-10-13 15:25:16 +02:00
Maciej Suminski 1c74019f4c pcbnew: Added "Get and Move" in pcbnew (GAL canvas). 2014-10-13 15:22:14 +02:00
Maciej Suminski 1b058cae1e Disable highlight mode in the module editor (GAL). 2014-08-06 09:33:10 +02:00
Maciej Suminski 03a17a284b bugfix: modules are not selectable in the high contrast mode (GAL). 2014-08-04 10:06:24 +02:00
Maciej Suminski 0adb6fa943 Module editor does not ask for permission to modify a locked module. 2014-07-15 17:33:19 +02:00
Maciej Suminski b8fd1de71c Added module texts to the preferred types list in SELECTION_TOOL. 2014-07-09 16:50:31 +02:00
Maciej Suminski 433e17a582 Support for "locked" property for modules (GAL). 2014-07-09 16:50:31 +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 bfa15d8db0 Moved SELECTION out of SELECTION_TOOL class. 2014-07-09 15:10:32 +02:00
Maciej Suminski d21271b432 Pad Enumeration tool support for SMD pads. 2014-07-09 15:10:32 +02:00
Maciej Suminski 72c70148e8 Fixed a few memory leaks and Valgrind warnings. 2014-07-09 15:02:56 +02:00
Maciej Suminski 77d8b2d84e Context menu for the Placement Tool. 2014-07-09 14:23:13 +02:00
Maciej Suminski 6d1417bafa SELECTION_TOOL in edit module mode does not try to select MODULEs. 2014-07-09 13:50:27 +02:00
Maciej Suminski 5d1ec2b204 Restored invocation of SELECTION_TOOL commands with TOOL_ACTIONs. 2014-07-09 13:50:27 +02:00
Maciej Suminski 6e0bd1eedc Adapted tools to PCB_BASE{_EDIT}_FRAME. 2014-07-09 13:50:27 +02:00