Commit Graph

466 Commits

Author SHA1 Message Date
jean-pierre charras 5f4530493a Make DRC markers always selectable.
Fixes: lp:1808181
https://bugs.launchpad.net/kicad/+bug/1808181
2018-12-13 09:06:38 +01:00
Seth Hillbrand 2cfcb2b9fb SELECTION: Allow RequestSelection() to add items
The client filter might add items in the case where locked pads are
filtered.  We need to handle this case when requesting selection by
adding new items to the m_selection

Fixes: lp:1802686
* https://bugs.launchpad.net/kicad/+bug/1802686
2018-11-25 08:33:49 -08:00
Jeff Young 208622699f Scale zone hit area by zoom.
Fixes: lp:1803362
* https://bugs.launchpad.net/kicad/+bug/1803362
2018-11-17 00:35:07 +00:00
Jeff Young 02a559678a Improve terminology of track selection commands.
There was confusion that "copper" and "net" meant zones, and there
was confusion about what "trivial" meant.

Fixes: lp:1772251
* https://bugs.launchpad.net/kicad/+bug/1772251
2018-11-13 21:29:35 +00:00
Jeff Young 6d76097291 When running selectable() recursively, we're really only checking visibility.
Fixes: lp:1802949
* https://bugs.launchpad.net/kicad/+bug/1802949
2018-11-12 21:59:43 +00:00
Jeff Young 62e2fe8bbd Recurse for more detailed selectability tests.
Fixes: lp:1801709
* https://bugs.launchpad.net/kicad/+bug/1801709
2018-11-11 20:26:19 +00:00
jean-pierre charras 15fa8f8a22 Minor fixes. 2018-11-03 14:30:34 +01:00
Jeff Young 569d4a0f64 More selection logic improvements.
Separate out zone edges (which are quite specific, and should
win over most other things) from zone fills (which are pretty
generic and should only be considered when there's nothing else).

Also excludes zone fills when the zones aren't being shown as
filled.
2018-11-02 23:52:00 +00:00
Seth Hillbrand 90233e5ec6 SELECTION: Prevent double select/deselect.
When processing the selection filter, items were deselected before being
reselected after passing through the filter.  This adjusts the logic to
only deselect those items that are filtered out.
2018-10-24 17:17:45 -07:00
Seth Hillbrand 4460313104 pcbnew: Separating connectivity to subdir 2018-10-12 16:31:09 -07:00
Seth Hillbrand 246f49b8cb pcbnew: Fix Footprint selection to only footprint area
Fixes: lp:1796866
* https://bugs.launchpad.net/kicad/+bug/1796866
2018-10-09 05:53:31 -07:00
Seth Hillbrand f11cb736e5 pcbnew: Zone selection heuristic continuity for edge
If the user is carefully selecting the zone edge, we do not filter the
zone preemptively from our disambiguation list in the same manner as we
do for selecting on zone copper.

Fixes: lp:1796719
* https://bugs.launchpad.net/kicad/+bug/1796719
2018-10-08 11:31:52 -07:00
Seth Hillbrand 8c56f5b035 pcbnew: Allow deselection when clicking on zone
Deselection by clicking on a zone makes working with plane zones easier
by allowing the selected item to de-selected by clicking on a zone.
Once the selection is cleared, the zone may be re-selected as normal.
Clicking on non-zone items while a separate item is selected will still
select the new non-zone item without requiring a second click.
2018-10-05 21:20:32 -07:00
Seth Hillbrand 6a6d580a1c pcbnew: Improve zone/polygon selection
Allows selection of polygons and zones by their visible area.  Will only
select polygons/filled areas when they are unobstructed by other
elements in the footprint/pcb.  Also adds a "skip heuristics" modifier
key for clicking (ALT) that allows the full disambiguation list to be
displayed without removing less-likely elements.  This dovetails the
zone/polygon selection as it allows selecting even when areas a fully
overlapped.

Fixes: lp:1753153
* https://bugs.launchpad.net/kicad/+bug/1753153
2018-10-03 06:23:35 -07:00
Seth Hillbrand 65678b223a pcbnew: Fixup for 491098af3
Unselecting performs two functions: unselecting and unhighlighting.
Some items may be deselected but still live in the temporary highlighted
layer (e.g. selecting a footprint and exchanging it).  Since there is no
harm in unselecting an unselected item, we can allow it to proceed
without the check.
2018-09-26 08:54:09 -07:00
Jeff Young 37f7faf433 Move lock checks to CLIENT_SELECTION_FILTER.
Also checks render item visibility as well as layer visibility
when making selections.

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

Fixes: lp:1541756
* https://bugs.launchpad.net/kicad/+bug/1541756
2018-09-25 17:56:38 +01:00
Seth Hillbrand 518b53f78c pcbnew: Cancel highlight with ESC
When editing the pcb, Ctrl-Click will highlight a net.  This allows
de-highlight with the ESC/cancel action from the selection tool.  Inside
the highlight tool, ESC reverts to the selection tool while keeping the
net highlighted.

Fixes: lp:1793842
* https://bugs.launchpad.net/kicad/+bug/1793842
2018-09-23 15:09:18 -07:00
Jeff Young 04534c83e0 Allow marker selection in high-contrast mode.
Fixes: lp:1793357
* https://bugs.launchpad.net/kicad/+bug/1793357
2018-09-20 21:54:47 +01:00
Wayne Stambaugh ed94f2c5e0 Pcbnew: fix minor bug in find dialog.
Repeating find with the same search string would result in a not found
error for absolute search strings.  Don't clear the found item if the
search string did not change from the previous search..

Fix another minor bug where the do not warp mouse pointer option was
always checked when the find dialog was called from one of the gal
canvases.

Fixes lp:1793300

https://bugs.launchpad.net/kicad/+bug/1793300
2018-09-19 12:31:17 -04:00
Seth Hillbrand 21ea31af15 pcbnew: Allow selection of back pads
Pads should be selectable when the respective copper layer is enabled.

Fixes: lp:1789084
* https://bugs.launchpad.net/kicad/+bug/1789084
2018-09-08 17:25:34 -07:00
Maciej Suminski 5993b33010 Relax selection discard rules for footprints with area larger than the viewport
Normally working at a zoom level when a footprint is not fully displayed
indicates that the user modifies other components. Selection Tool used
to discard footprints that had area larger than the viewport area, but
it may make sense to select them if there are no other candidates.

Fixes: lp:1789578
* https://bugs.launchpad.net/kicad/+bug/1789578
2018-09-05 11:26:02 +02:00
Seth Hillbrand 1d9c9cd10d pcbnew: Select copper through THT connections
This allows full copper connections even when THT changes a trace layer.
It avoides selecting the actual pad to prevent actions on the copper
connections from affecting the footprints as well.

Fixes: lp:1789807
* https://bugs.launchpad.net/kicad/+bug/1789807
2018-09-03 07:44:44 -07:00
Seth Hillbrand d45946396c pcbnew: Fix loop condition when unhighlighting modules
Text can be included in the same selection group as the parent module.
Thus if we clear the selection marker on a module's child elements we
also need to remove the element from the selection group.

Fixes: lp:1789418
* https://bugs.launchpad.net/kicad/+bug/1789418
2018-08-30 09:27:42 -07:00
Seth Hillbrand dc4125206b GAL: Add a selected item layer
The selected items should be displayed above the rest of the items but
below informational overlays.

Fixes: lp:1789505
* https://bugs.launchpad.net/kicad/+bug/1789505
2018-08-28 15:00:05 -07:00
Jeff Young c91e51f688 Don't inadventently clear selection reference point.
New algorithm more targetted and just clears the items.  This
also obviates the need for the aQuietMode flags.

Only fixes one part of the bug, but the "fixes" line is the
easiest way to get a link in the bug to the commit.

Fixes: lp:1786727
* https://bugs.launchpad.net/kicad/+bug/1786727
2018-08-22 15:11:58 +01:00
Ronnie Gaensli 46fddab126 pcbnew: fix pan while moving mouse after cancelling selection box
Fixes: lp:1776648
* https://bugs.launchpad.net/kicad/+bug/1776648
2018-08-17 13:39:36 +02:00
Jeff Young 43e99e6df0 Inflate footprint bounding box to include texts.
This makes zoom automatique work much better in the footprint
editor, and should improve other things which probably assumed
the bounding box included everything (such as refresh code).

Callers which still want just the module outline should call
GetFootprintRect() instead of GetBoundingBox().
2018-08-11 17:14:27 +01:00
Jeff Young a9fa66bb41 Don't broadcast events when running client selection filters.
Some other tools (in this case the POINT_EDITOR) aren't good
citizens and activate themselves when receiving selection
changes.

Fixes: lp:1785781
* https://bugs.launchpad.net/kicad/+bug/1785781
2018-08-08 01:44:56 +01:00
Jeff Young 84504599ce Don't check for visibles in the Footprint Editor.
Everything is drawn anyway, and we crash if the viewPrivData
hasn't been allocated yet.

Fixes: lp:1785716
* https://bugs.launchpad.net/kicad/+bug/1785716
2018-08-07 18:39:20 +01:00
Jeff Young eacaa39aa2 Remove global units usage from GetSelectionText...
... and GetMsgPanelInfo.

Step 4 in the g_UserUnit eradication effort.

Also removes a couple of conversion routines that were close
enough to extinction.

(cherry picked from commit c75da51)
2018-07-17 15:11:09 +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
Jeff Young 6ad37972c0 Don't center objects behind the DRC dialog.
(cherry picked from commit d5bb39f)
2018-07-17 15:09:43 +01:00
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
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
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