Commit Graph

334 Commits

Author SHA1 Message Date
Jeff Young 3e190cee4b Implement selection brightening for DRC.
The old item pointers (which aren't safe to keep around) were
removed in favour of opaque references (void*) which are then
compared against existing items when needed.

Also improves brightening by brightening the whole footprint
(ie: its pads, drawings, reference and value) rather than just
its target cross.

(cherry picked from commit 30e90b0)
2018-07-17 15:09:40 +01:00
Seth Hillbrand e2122db587 pcbnew: Clear unused code 2018-06-21 09:20:48 -07:00
Andrzej Wolski 316ff2898d Fix footprint selection
Commit 72b49acc changed behavior of MODULE::ViewBBox(),
which now includes text fields area. This caused problems
with selecting footprints with relatively large text fields.
This patch fixes this problem by using MODULE::GetBoundingBox instead.

Fixes: lp:1776942
* https://bugs.launchpad.net/kicad/+bug/1776942
2018-06-14 19:32:09 -07:00
jean-pierre charras cee313da8c Pcbnew: legacy canvas: make trace len display working while creating the trace.
Previously, the full trace length was always displayed as 0 during track creation in the info canvas.
2018-06-12 18:21:46 +02:00
Maciej Suminski 9605dd8e1d Fix selection clearance for via and tracks
- fixed via bounding box calculation in TRACK::GetBoundingBox()
- moved clearance to TRACK::ViewBBox()
- modified the Selection Tool to use EDA_ITEM::GetBoundingBox() rather
than VIEW_ITEM::ViewBBox() to determine selection

Fixes: lp:1776314
* https://bugs.launchpad.net/kicad/+bug/1776314
2018-06-12 10:59:30 +02:00
John Beard 896ad3774d "Select Connection" menus enablement
Previously, the "Select Connection" sub-items were greyed out when the
selection contained both tracks and vias. This meant that you couldn't
access "Select Copper Connection" when the selection contained both
tracks and vias (though the keyboard shortcuts did work).

Change to use SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks
) to allow any combination of track elements to be selected.

Fixes: lp:1772249
* https://bugs.launchpad.net/kicad/+bug/1772249
2018-06-11 10:58:26 -07:00
Jeff Young de7791cc8b Add context menu to footprint viewer for zoom & grid.
Fixes: lp:1776126
* https://bugs.launchpad.net/kicad/+bug/1776126
2018-06-11 11:37:48 +01:00
Jeff Young b89f6d4af3 Decrease allowed coverage ration when zones are involved.
A perfect solution would create holes in the coverage map
for the zone edges and handles, but that's a lot more
work.

Fixes: lp:1773204
* https://bugs.launchpad.net/kicad/+bug/1773204
2018-05-25 13:01:58 +01:00
Seth Hillbrand 8506cdf3ae Avoid numerical dereference of selections
The SELECTION is a std::set.  Numerical dereference of item n is O(n) as
the iterator is not random access.  Therefore, a for loop using
numerical dereference is O(n!) and quickly slows.

We avoid this by storing items to remove separately while iterating and
then removing the items after we complete.

Fixes: lp:1692081
* https://bugs.launchpad.net/kicad/+bug/1692081
2018-05-22 16:37:45 -07:00
Seth Hillbrand 8d52dc9451 Avoid re-checking items already selected
If you select a track with many segments (e.g. a length-tuned track) and
then select all connected items again ('U' -> 'U'), we would iterate
over all items in the selection and mark connections for each of the n
segments n separate times.

We avoid this by using the marked flag to show when the segment has
already been visited by the routine.  This means that if the segment has
been checked for connections because it was connected to the previous
item, it won't be checked for connections again.  However, a selection
that interleaves items from multiple connection segments will still
(potentially) be multiply checked as the BUSY flag is cleared each time
there is one not-BUSY track in the selection.
2018-05-22 16:26:52 -07:00
Jeff Young a9dc417319 Fix bug in pruning of selection.
Fixes: lp:1770939
* https://bugs.launchpad.net/kicad/+bug/1770939
2018-05-13 15:23:41 +01:00
jean-pierre charras 037f7a1698 Cosmetic enhancement: Add missing icons in GAL Select submenu (context submenu). 2018-05-02 21:42:41 +02:00
Andrzej Wolski 5ac4dbe641 Fix window/crossed selection mode recognition in flipped view
Fixes: lp:1767233
2018-04-30 14:57:38 +02:00
Maciej Suminski 0a58de0c46 Selection Tool: reset is-hover flag
Fixes: lp:1765034
* https://bugs.launchpad.net/kicad/+bug/1765034
2018-04-19 16:17:54 +02:00
Andrzej Wolski 4152069504 Make vias selectable even if top and bottom layer are hidden 2018-03-21 22:15:17 -04:00
Andrzej Wolski ff3f229871 Decouple vias from tracks in selection filter 2018-03-21 17:21:08 -04:00
Andrzej Wolski ea3f8743fd Fixes in GAL selection filter:
- vias were always left selected, include vias in tracks filter - as in legacy
- make text filtering work
- cleanup drawings filtering code
- hide checkbox "Include items on invisible layers" because it does not work in GAL
2018-03-21 17:21:01 -04:00
Jon Evans b9ce203487 Fix pad selection requirements in footprint editor
Fixes: lp:1757295
* https://bugs.launchpad.net/kicad/+bug/1757295
2018-03-20 21:15:05 -04:00
jean-pierre charras b5f1fdd981 Add icon to Get and Move context menu item in GAL mode.
Windows does not like mixing menu items with and without icons (sizing error).

Fixes: lp:1756263
https://bugs.launchpad.net/kicad/+bug/1756263
2018-03-20 08:30:02 +01:00
Jeff Young 89ebab5df2 Comments for SELECTION_TOOL::guessSelectionCandidates(). 2018-03-18 22:17:27 +00:00
Jeff Young ab730709c7 Only use hover track if there are no selected tracks.
Fixes: lp:1645670
* https://bugs.launchpad.net/kicad/+bug/1645670
2018-03-08 18:03:46 +00:00
Jon Evans 1e66a23dbc Rework footprint selection filtering to improve behavior
Fixes: lp:1751960
* https://bugs.launchpad.net/kicad/+bug/1751960
2018-03-07 20:41:10 -05:00
Maciej Suminski 98616da017 Added an option to enforce dragging gesture to always draw selection box
Partial solution to a problem described in lp:#1636214
2018-03-01 17:15:57 +01:00
Maciej Suminski fef1ba9993 Increase the area ratio threshold for rejecting large footprints in selection 2018-02-28 17:00:45 +01:00
Jon Evans 88fb4c57e5 PcbNew: center on items rather than zooming to them on find
Fixes: lp:1751480
* https://bugs.launchpad.net/kicad/+bug/1751480
2018-02-28 16:58:05 +01:00
Andrzej Wolski 2e42d5c006 Do not allow selecting tracks if they are hidden
This is a complementary patch to dbafdd39.
2018-02-22 17:31:18 +01:00
Jeff Young c69db55c1f Fix regression in auto-selection-disambiguation.
Fixes: lp:1646339
* https://bugs.launchpad.net/kicad/+bug/1646339
2018-02-22 11:31:11 +01:00
Maciej Suminski a752f376a1 Fix autopanning issues when selecting a segment
Fixes: lp:1750302
* https://bugs.launchpad.net/kicad/+bug/1750302
2018-02-20 09:48:48 +01:00
Maciej Suminski 90d53df790 Fix double disambiguation menu on track removal
Commit complementary to 4f0c9b6b. In case there were multiple tracks
under the cursor, disambiguation was shown twice because
SELECTION_TOOL::selectConnection() cleared the selection and requested
it again.
2018-02-13 14:56:11 +01:00
Jeff Young 53e705f634 Add Get and Move Footprint to empty-selection-context menu.
Also adds Cancel context menu items for Place Footprint,
Place Target, Place Drill Origin and Place Grid Origin tools,
as well as the standard Zoom and Grid choices.

Removes the Paste context menu item from the Place Drill
and Place Grid Origin tools.

Fixes: lp:1568396
* https://bugs.launchpad.net/kicad/+bug/1568396
2018-02-12 21:50:51 +01:00
Jeff Young 1afbfad44a Use "..." uniformly in menus.
See the bug report for some wording changes and a couple of
menu restructurings that were also cleaned up.

Fixes: lp:1597827
* https://bugs.launchpad.net/kicad/+bug/1597827
2018-02-10 17:32:28 -05:00
Maciej Suminski 6dbd7a8d73 Selection Tool: compare footprint area ratio only if there are >1 footprints
There is no point in comparing candidate footprint areas when there is
only one footprint, because it is always equal to 1 and rejected.

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

Fixes: lp:1747378
* https://bugs.launchpad.net/kicad/+bug/1747378
2018-02-09 16:19:48 +01:00
jean-pierre charras 8552f3fedf fix code after renaming files 2018-01-29 22:00:44 +01:00
Maciej Suminski 3aafa2b574 Clear selection box when another tool is invoked while selecting items 2018-01-26 15:10:48 +01:00
Jeff Young 8c4874866a Set a selection reference point in get-and-move-module.
This will cause InteractiveEdit to move the reference point to
the cursor before waiting for mouse move events.

Fixes: lp:1571217
* https://bugs.launchpad.net/kicad/+bug/1571217
2018-01-22 09:58:57 +01:00
Maciej Suminski ef13b97ff7 Complementary patch to 3114fa4a (filter invisible vias when selecting)
This patch handles items selected with selection box.

Fixes: lp:1743894
* https://bugs.launchpad.net/kicad/+bug/1743894
2018-01-18 09:56:43 +01:00
Jon Evans 2b2612120c Filter via selection based on render settings
Fixes: lp:1743894
* https://bugs.launchpad.net/kicad/+bug/1743894
2018-01-18 09:56:43 +01:00
Jeff Young 3f6af59cac Avoid selection disambiguation menu when possible.
Some actions, such as select trivial connection, don't need the
user to choose which trace at a corner to start from -- either
one will do.  Same for moving a simple trace corner.

Likewise, Edit in Footprint Editor shouldn't ask if you mean the
footprint or the pad.  Obviously it's the footprint.

This change adds a CLIENT_SELECTION_FILTER which allows clients
to do tool- or action-specific filtering of the selection before
the disambiguation menu is run.

It also removes some tool- and action-specific code which was
in the selection_tool and shouldn't have been.

Fixes: lp:1708869
* https://bugs.launchpad.net/kicad/+bug/1708869
2018-01-18 09:09:25 +01:00
Jeff Young f76e7568bc Don't warp cursor if the disambiguation menu is cancelled.
Also fixes the empty-selection-context-menu coming up after
a cancelled disambiguation menu.

Fixes: lp:1738339
* https://bugs.launchpad.net/kicad/+bug/1738339
2018-01-02 13:01:55 -05:00
Jeff Young 0f943f1e4b Disambiguation menu fix for footprints with a single pad.
Fix selection disambiguation to allow for selecting of footprints which are
mostly covered by their pads, text, etc.

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

Fixes: lp:1723469
* https://bugs.launchpad.net/kicad/+bug/1723469
2017-12-28 15:36:34 -05:00
Jeff Young dbf39e6333 A bit more commenting for the guessSelectionCandidates logic. 2017-12-21 13:15:23 +01:00
Maciej Suminski 158bc0619d Footprints with pads taking most of area are kept in the selection menu
Improved the selection heuristics to keep footprints in the
disambiguation menu when they contain pads with high pad-to-footprint
area ratio.
In other words: make it possible to select a footprint when
most of its area is taken by a pad. Previously pads were given the
priority, so it was very tricky to select the parent footprint.

Fixes: lp:1739425
* https://bugs.launchpad.net/kicad/+bug/1739425
2017-12-21 10:32:00 +01:00
Maciej Suminski 69ceae0ccf Selection tool: do not select relatively large modules
To avoid situations when a large footprint covering most of the board
area (e.g. shield connector) is always selected, even when user clicks
in a seemingly empty spot, a simple filter has been added. In case
the footprint area covers more than 90% of the view area, the large
footprint is not selected. This way large footprints do not disturb
editing when the zoom is high enough.

Fixes: lp:1636214
* https://bugs.launchpad.net/kicad/+bug/1636214
2017-12-20 17:32:00 +01:00
jean-pierre charras c18b638c17 Cosmetic enhancement in GAL: disambiguationMenu: add icons in menuitems, like in Legacy mode. 2017-12-13 19:42:33 +01:00
Jeff Young df76380a2d Don't leave a hidden item behind.
If the object changes between a TA_CONTEXT_MENU_UPDATE
event and a TA_CONTEXT_MENU_CHOICE event (usually as
a result of a cancel), the old code would leave the
last item hidden.

Fixes: lp:1737562
* https://bugs.launchpad.net/kicad/+bug/1737562
2017-12-13 15:59:21 +01: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
Tomasz Włostowski 00ad8f24a0 pcbnew: Minor changes in CONNECTIVITY_DATA interface:
- renamed connectivity.[h|cpp] to connectivity_data [.h|.cpp] so that the file name matches the main class name.
- GetNetItems() now returns a vector instead of a list
2017-11-15 18:34:08 +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
Tomasz Włostowski 3170eba801 refactoring: implemented SELECTION_TOOL's own GetCollectorsGuide() to avoid dependency on PCB_BASE_FRAME 2017-11-03 20:02:06 +01:00
Tomasz Włostowski 781008bfa5 refactoring: allow to run TOOL_MANAGER and SELECTION_TOOL without a host wxFrame 2017-11-03 20:02:06 +01:00
Tomasz Włostowski 22063dc5a5 pcbnew: clear selection reference point when moving footprint by name
Fixes: lp:1722870
* https://bugs.launchpad.net/kicad/+bug/1722870
2017-10-19 23:57:42 +02:00
Tomasz Włostowski c6a0ad895b pcbnew: code formatting, removed previous module editor copy/paste functions 2017-09-30 14:28:54 +02:00
Tomasz Włostowski 5731000135 pcbnew/copy&paste: multiple improvements:
- fixed netcode propagation bug
- factored out EDIT_TOOL::m_offset, now selection offset is stored in SELECTION class
- added VECTOR2I-based Move/Flip/Rotate methods in BOARD_ITEM
2017-09-30 14:28:54 +02:00
Kristoffer Ödmark b4879d061c Fixed menu items, moved the copy and cut to the EDIT_TOOL, Fixed rendering when copying a module 2017-09-30 14:28:53 +02:00
Kristoffer Ödmark 84b803042c Improvements to copy-paste
-Can paste items from board to module-editor (only module parts)
-Can paste entire modules just as copy
-Can copy items inside module-editor

Known limitations:

-Will crash if trying to paste a module containing module_text inside
the module editor ( dont know why, problem existed before )
-If copying things with strange layer names, the layer names will be
changed.
2017-09-30 14:28:53 +02:00
Kristoffer Ödmark c0981b8444 Added a new plugin that can save and load to clipboard, using ctrl+shift+c/v for copy pasting
Added the needed kicad_clipboard files and made copy pasted modules have no path
2017-09-30 14:28:53 +02:00
Oliver Walters 2895030cfa Add multi-layer zone rendering for GAL
Enable multi-layer selection for keepout zones in GAL
2017-09-27 10:34:59 +02:00
Jon Evans 256f52f27e Use VIEW_GROUP for candidate highlighting; enable in PcbNew also 2017-09-25 13:39:37 +02:00
Maciej Suminski df472e6426 Added mouse position refresh event WX_VIEW_CONTROLS::WarpCursor() 2017-09-22 11:13:45 +02:00
Maciej Suminski 25abe30c72 Code formatting 2017-09-18 11:25:32 +02:00
Kristoffer Ödmark aaa1e35b6a Heirarchical sheet selection includes more.
Now the heirarchical sheet selection feature includes tracks that belong
to a net spanning multiple sheets, but only by doing a logical connection
from the pads of the modules. This is to be able to select connections
between components on the same sheet. For example if the sheet contains a
star power connection or something similar, then most of the sheet local
connections will now also be included.
2017-09-18 11:16:13 +02:00
Maciej Suminski 3570154ef0 Fixes to speed select/deselect commit (161045f1)
Deselecting items require full refresh, as otherwise e.g.
umbilical lines for modules stays.
2017-08-03 16:14:46 +02:00
Maciej Suminski 71c33d3dcd Fixes for canceling selection after invoking menu on an unselected item (9cbcb322) 2017-08-03 14:28:07 +02:00
Maciej Suminski 3629fcbf4a Code formatting 2017-08-03 14:28:07 +02:00
Maciej Suminski 30ad7e4f99 Improved the algorithm for guessing the selection candidates
Now it filters out items that are bigger than the current viewport
2017-08-01 18:00:30 +02:00
Maciej Suminski 9cbcb3224c Cancel selection if an item has been selected by right click 2017-08-01 15:23:08 +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
Maciej Suminski acbfea48f2 Fixed a bug allowing to drag locked footprints without approval
Fixes: lp:1576655
* https://bugs.launchpad.net/kicad/+bug/1576655
2017-07-27 17:13:22 +02:00
Tomasz Włostowski b682882807 pcbnew: add keyboard shortcuts [1..9] to the selection disambiguation menu 2017-07-27 16:21:54 +02:00
Oliver Walters 161045f17d Speed improvement for select / deselect in GAL
- No longer invalidates the item layers
- For multiple items, this results in a drastic speed improvement
2017-07-25 16:34:03 +02:00
Maciej Suminski 10c5297f2e Code clean-up and formatting 2017-07-17 10:21:39 +02:00
Kristoffer Ödmark 4c94d02c42 Fixed sheet-selection code
Fixes: lp:1704644
* https://bugs.launchpad.net/kicad/+bug/1704644
2017-07-17 10:21:39 +02:00
Maciej Suminski 08c4a0bc7b Fixed SELECTION_TOOL::selectCursor()
In the previous version the method did not work correctly
when an action was invoked from context menu. In such case,
the cursor position was obtained in the moment of selecting
the action, instead of using the right click location.
2017-07-12 09:34:20 +02:00
hauptmech 4e908da057 pcbnew: Add hotkeys for Select Trivial Connection and Select Copper Connection 2017-06-30 14:30:10 +02:00
Maciej Suminski 3dd4429ef6 Dead code removal 2017-06-23 18:50:31 +02:00
Maciej Suminski f3fbce9560 Code formatting and clean-up 2017-06-23 15:43:13 +02:00
Tomasz Włostowski 3b16d3cffe further DLIST/Iterators cleanup, some code formatting 2017-06-23 11:12:37 +02:00
Tomasz Włostowski edf1aac357 Fixed some compilation warnings. Missing features so far: single-module ratsnest & DRC unconnected report 2017-06-23 11:12:37 +02:00
Tomasz Włostowski 9ad886344b New connectivity algorithm. 2017-06-23 11:12:36 +02:00
Maciej Suminski f0c8391a46 Use mouse (rather than cursor) position when selecting an item. 2017-06-12 16:24:52 +02:00
Oliver Walters 18488342a5 Improved speed of Duplicate action
- Removed repetitive tool calls
2017-06-12 11:16:30 +02:00
Oliver Walters cd738297b0 SELECTION_AREA color now indicates selection mode
BLUE = Normal
GREEN = Addition
RED = Subtraction

Line color indicates "window" or "crossing" selection mode
2017-05-10 10:57:29 +02:00
Oliver Walters a2fda9bd39 Fixed selection filtering
- Fixed "double selection" of pads and pad parents in PCBNEW
- Disabled selection of entire module in MODEDIT
2017-05-10 10:57:29 +02:00
Oliver Walters b53ba56ac2 Use CTRL modifier to deselect items 2017-05-10 10:57:29 +02:00
Oliver Walters f8734bd057 Fixed ::HitTest for Circle shape
- Testing against rectangle intersection now works correctly
- Previously tested against BoundingBox() not circle outline
2017-05-10 10:57:28 +02:00
Oliver Walters ef25ffbab7 Alter selection mode based on drag direction
LEFT > RIGHT = Enclosed selection
RIGHT > LEFT = Touching selection
2017-05-10 10:57:28 +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
Maciej Suminski bc8668b039 Renamed PCB_ACTIONS::editModifiedSelection to selectionModified 2017-04-20 14:11:59 +02:00
Maciej Suminski bb999f1bbf Fixed items disappearing after a rotation/flip
Fixes: lp:1683831
* https://bugs.launchpad.net/kicad/+bug/1683831
2017-04-20 14:11:59 +02:00
Maciej Suminski 74847bf8ff Code formatting and clean-up 2017-04-20 14:01:38 +02:00
Jon Evans 3ec28e2acf Refactor layer enumerations to all live in the same place 2017-03-30 16:01:48 -04:00
jean-pierre charras 5bd61d7eb6 Pcbnew fix: checking properties on error marker crashed pcbnew
Fixes: lp:1674671
https://bugs.launchpad.net/kicad/+bug/1674671
2017-03-21 16:44:56 +01:00
Maciej Suminski fe4f02f5b9 Coverity fixes
CIDs:
- 153097
- 157120
- 157119
- 155148
- 155146
- 153103
- 153099
- 153095
- 153087
- 153086
2017-03-11 22:20:08 +01:00
Jon Evans 082b8dd2a9 Refactor BRIGHT_BOX to common so it can be used by other programs 2017-03-11 21:38:01 +01:00
John Beard 9c08873210 Make SELECTION_AREA a generic overlay item
This simplifies the (already simple) SELECTION_AREA class. It is also
moved into KIGFX::PREVIEW and put in the common library, where it can be
reused by other GAL-aware tools (not just in Pcbnew) in future.
2017-03-10 16:21:44 +01:00
jean-pierre charras 7a120ad698 selection_tool.* add comments and use better names for 2 similar methods. 2017-03-04 17:35:34 +01:00
jean-pierre charras 5b3d7962bb Fix questionable code and memory leak. 2017-03-04 17:35:34 +01:00
jean-pierre charras 101a600be6 Fix coding style issue and a minor other issue. 2017-03-04 17:35:34 +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