Commit Graph

1138 Commits

Author SHA1 Message Date
Seth Hillbrand 853b9d06ad pcbnew: Fix snapping while moving on pads
When requesting to move a footprint based on the pad, the pad layers
should determine the snapping.  This extracts layers from the selected
pad before allowing the filtering for locked pads

Fixes: lp:1787627
* https://bugs.launchpad.net/kicad/+bug/1787627
2018-10-04 15:53:41 -07:00
Seth Hillbrand 1ff9931333 pcbnew: Remove legacy Magnetize() from GAL picker
Magnetic items handled by GRID_HELPER in GAL.  Also includes the
standard keyboard modifier shift to change magnetic items on/off
2018-10-04 15:48:15 -07:00
Seth Hillbrand a4966adb67 pcbnew: Don't call evt->pos for non-mouse events
Since we are handling snapping in the grid helper, we don't need to
enable it in the cursor position return.  This allows the grid helper to
use the frame position while optionally snapping to segments.
2018-10-04 07:29:41 -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
Seth Hillbrand 03e642a8db pcbnew: Implement consistent graphical snapping
This creates a standard snapping framework in the GRID_HELPER class that
allows snapping to items on the same layer as the object being
created/moved as well as consistent toggling of this using the Shift key
modifier.

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

Fixes: lp:1604616
* https://bugs.launchpad.net/kicad/+bug/1604616
2018-10-03 17:23:56 -07:00
Seth Hillbrand f714d2fa64 pcbnew: draw polygon and element previews on layer
This ensures that when starting to draw a zone or graphic element, the
preview is drawn in the same color/on the same layer as the element that
will be created.  Previously, beginning a graphic polygon while a copper
layer was active would result in the preview being drawn in the color of
the active copper layer.
2018-10-03 17:23:56 -07:00
Seth Hillbrand 6c693f80a7 pcbnew: Fix polygon corner adding in board editor
Polygon corners were enabled in the footprint editor but the logic
didn't extend to the board editor.  This revises the logic to look for
DRAWSEGMENTs and only reference the PCB_MODULE_EDGE_T where needed to
create a new segment in the footprint.

Fixes: lp:1782966
* https://bugs.launchpad.net/kicad/+bug/1782966
2018-10-03 11:29:02 -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
Jeff Young dfe164e0dc Only clear link when adding footprint from library, cache, etc.
Fixes: lp:1792256
* https://bugs.launchpad.net/kicad/+bug/1792256
2018-10-01 19:22:42 +01:00
jean-pierre charras db5386467b Re activate Zone Unfill All command, accidentally removed by a previous commit.
Fixes: lp:1795293
https://bugs.launchpad.net/kicad/+bug/1795293
2018-10-01 09:04:14 +02:00
Jeff Young f06bf81651 Don't deselected items that have been deleted.
De-referencing freed memory is never a good idea.

Fixes: lp:1795195
* https://bugs.launchpad.net/kicad/+bug/1795195
2018-09-30 15:47:18 +01:00
Seth Hillbrand ef6f7e96f3 pcbnew: Handle SEGZONE in GAL
SEGZONEs are no longer created by pcbnew but may exist in older boards.
This allows deleting the old fills in a manner similar to the deletion
in Legacy canvas.

Fixes: lp:1794571
* https://bugs.launchpad.net/kicad/+bug/1794571
2018-09-29 15:09:15 -07:00
Seth Hillbrand b3a5e08c2f pcbnew: Rename PCB_ZONE_T and remove from connectivity
SEGZONE types were confusingly named PCB_ZONE_T.  Zones in pcbnew are
now _only_ PCB_ZONE_AREA_T, so we name segzone types PCB_SEGZONE_T to be
clear.

This also removes processing of the SEGZONEs from connectivity
calculations.
2018-09-29 15:09:15 -07:00
Seth Hillbrand a81e3c2b13 pcbnew: Avoid double-separators in context menu 2018-09-29 15:09:15 -07:00
Jeff Young 6764cda34d Fix issues with pad locking.
Fixes: lp:1794548
* https://bugs.launchpad.net/kicad/+bug/1794548
2018-09-26 21:57:35 +01: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 ee465fb23c pcbnew: Fixup for edde02481 to enable aux axis
Correcting edde02481 which had side effects to
efdbc91e42 while dragging a line but not a
zone.
2018-09-24 14:29:23 -07:00
Seth Hillbrand edde02481e pcbnew: Fix alignment with off-grid drag
Commit efdbc91e42 broken the primary
alignment mechanism for maintaining the current point as an auxilliary
grid reference.  This reverts that commit and fixes both the initial
issue and the associated bug by applying the primary constraint after
the secondary.  In this way, we consider the secondary constraint as an
additive rather than alternative constraint.

Fixes: lp:1793888
* https://bugs.launchpad.net/kicad/+bug/1793888
2018-09-24 14:07:30 -07:00
Jeff Young f3c6e1fb62 Change Position Relative To to use anchor, not centroid.
Fixes: lp:1793984
* https://bugs.launchpad.net/kicad/+bug/1793984
2018-09-24 00:42:56 +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
Seth Hillbrand e0316af69c pcbnew: Prevent redo while moving items
Fixes: lp:1793948
* https://bugs.launchpad.net/kicad/+bug/1793948

(cherry picked from commit c5c89fd216)
2018-09-23 06:03:41 -07:00
Jeff Young 5974899fa5 Clean up file locations and names. 2018-09-22 16:23:13 +01:00
Seth Hillbrand 969e85daa3 pcbnew: Standardize zone fills threading
This is a boyscouting commit to standardize the threading of zone fills.
We do not need to join threads after their completion, instead we simply
allow them to clean up their memory without blocking the user.  This
also sets the maximum number of threads that may be created to the
number of zones being filled.  More than this will only leave un-used
threads being created and immediately killed.

We also include the connectivity search as a phase in the fill progress
reporter.  This was the case before but did not utilize the correct
maxsize, leading to stalled progress bar.
2018-09-21 12:44:20 -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
Seth Hillbrand 47fac8a259 Removing some unused code 2018-09-20 12:52:53 -07: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 7470d5ba98 pcbnew: retain selection between edits
We had been deselecting items after calling edits to be safe in case the
item was deleted/exchanged by the edit.  The item pointer itself remains
valid even when deleting as it is assigned to the undo stack.  But it
should not remain visible or selected on the schematic if it is removed.

This tests for removed items by checking whether it (in the case of
first-level BOARD_ITEMS) or its parent (in the case of footprint item
components) remain in the view list after editing.  If they are still in
the view list, then we re-select them.

( cherry-picked from 2c6d0ffe2 )
Fixes: lp:1765774
* https://bugs.launchpad.net/kicad/+bug/1765774

Fixes: lp:1775946
* https://bugs.launchpad.net/kicad/+bug/1775946
2018-09-17 10:58:42 -07:00
Jeff Young 99cb1471c3 Added safety for POINT_EDITOR.
Fixes: lp:1786349
* https://bugs.launchpad.net/kicad/+bug/1786349
2018-09-17 18:01:08 +01:00
Jeff Young a40ab768fc Allow deletion of non-Reference/non-Value module text items.
Fixes: lp:1781226
* https://bugs.launchpad.net/kicad/+bug/1781226
2018-09-17 18:01:08 +01:00
Seth Hillbrand dd228b60a7 pcbnew: Allow removing corners from graphical polygons
( cherry-picked from 22df4e301 )

Fixes: lp:1792712
* https://bugs.launchpad.net/kicad/+bug/1792712
2018-09-16 10:27:07 -07:00
Seth Hillbrand cf2980e1b2 pcbnew: Add corners in polygons
Allow corner adding to polygons in both module editor and board editor.
The board editor was already allowed but only through special types.
The module editor is now sychronized to the same process and both
recognize standard context menus

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

( cherry-picked from 06ac172c2 )
2018-09-15 10:02:58 -07:00
Seth Hillbrand efdbc91e42 pcbnew: snap final points to grid
When constraining moves, the cursor snaps to grid but does not
represent the position of the final edited point.  The point is rotated
to the nearest snap angle, while the vector length remains unchanged
resulting in a line longer than intended and off-grid.

This adds a grid-snap after the constraint is applied.

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

( cherry-picked from e7c51a6a6 )
2018-09-15 09:53:52 -07:00
Jeff Young e3f74646b9 Allow measure tool to survive zoom and pan.
Fixes: lp:1792232
* https://bugs.launchpad.net/kicad/+bug/1792232
2018-09-14 11:00:13 +01:00
Seth Hillbrand ded64aef3d pcbnew: Control cursor capture in microwave tool
Turns off cursor capture when the microwave tool is not actively drawing
a new inductor.

Fixes: lp:1792128
* https://bugs.launchpad.net/kicad/+bug/1792128
2018-09-12 09:11:48 -07: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
Jeff Young c90a3efea2 Change KIDIALOG hashing algorithm to __FILE__ + __LINE__.
Using Title + Message wasn't working for all the dialogs which
did substitutions in the message (which was a lot of them).

Fixes: lp:1789348
* https://bugs.launchpad.net/kicad/+bug/1789348
2018-08-29 23:38:23 +01: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
Seth Hillbrand f4eaf55497 pcbnew: keep selected zone highlighted when moding
When adding a cutout to a zone, it helps to have the zone highlighted so
that you can see when zone you are operating on.
2018-08-28 14:59:54 -07:00
Tomasz Wlostowski 61fb3f6d0f pcbnew: bring back the autoplacer tool to GAL 2018-08-24 14:42:49 +02:00
Jeff Young ec9d38e21f Add filter to net selector widget.
Also fixes a bug where nets wouldn't get changed because the
pads weren't changed and so the pad nets would propagate and
wipe out the changed nets on the tracks.

Also includes warning dialogs that pad nets will be changed if the
track nets are.

Fixes: lp:1779854
* https://bugs.launchpad.net/kicad/+bug/1779854
2018-08-24 10:56:13 +01:00
Jeff Young 30bb911154 Bring PICKER_TOOL in line with other tools.
Use standard Magnetize() to handle grid and magnetic pads.

Use the standard menu from PCB_TOOL.  Delegating the menu to
the SELECTION_TOOL just caused grief.

Also brings clients (such as Position Relative To) into line,
and implements better Cancel behaviour.

Also improves visibility of modal status messages:
- moves Select Anchor message from status bar to popup
- moves Select Reference message from dialog to popup

Fixes: lp:1786727
* https://bugs.launchpad.net/kicad/+bug/1786727
2018-08-23 00:58:01 +01: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
John Beard a1e0735853 Add hotkey (Insert) for zone create corner
Adds a hotkey to the TOOL_ACTION, and also checks for
action validity prior to running the actions (previously
implicitly gated by  the enablement of the menu item).
2018-08-07 09:19:18 -07:00
Ronnie Gaensli 3ca84dca71 Cancel Add dimension leaves auto panning on
Fixes: lp:178551
* https://bugs.launchpad.net/kicad/+bug/178551
2018-08-06 11:24:23 +02:00
Jeff Young c655bffac1 Improve context menu consistency.
Also fixes some interactivity issues in the microwave tools around
single-click tools that have initial properties dialogs.  Those
need to act kind of like a hybrid between single-click and two-click
tools.

Fixes: lp:1751381
* https://bugs.launchpad.net/kicad/+bug/1751381
2018-08-02 11:01:03 +01:00
Jeff Young d6c6322f95 Leave measurement visible until another is started. 2018-08-02 11:01:03 +01:00
Seth Hillbrand 3a09358264 modedit: Store single copy of the footprint in undo
When changing elements in the module editor, each element shares the
same parent.  Undo commits store a copy of the parent as it existed
before the change.  For footprints with many elements, this creates
large, slow undo commits as a copy of the full footprint is stored for
each element being edited.

This keeps a single copy of the footprint in the undo stack per edit.

Fixes: lp:1780526
* https://bugs.launchpad.net/kicad/+bug/1780526
2018-08-01 11:06:23 -07:00
Jeff Young 9322139baa Touch up Footprint Viewer for new Lib Tree. 2018-08-01 11:47:48 +01:00
Jeff Young 9175a48c90 Enable Distribute H/V on pads.
Fixes: lp:1782988
* https://bugs.launchpad.net/kicad/+bug/1782988
2018-08-01 09:35:46 +01:00
Jeff Young b400565880 Convert Place Footprint to component tree. 2018-08-01 09:35:45 +01:00
Tomasz Wlostowski 099fcf1247 ZONE_CREATE_HELPER: fix zone cutout creation in zones with holes, reinit selection with the resulting zone
Fixes: lp:1784268
* https://bugs.launchpad.net/kicad/+bug/1784268
2018-07-31 22:34:56 +02:00
Maciej Suminski 630631b41b Code formatting 2018-07-26 16:04:31 +02:00
Tomasz Wlostowski a9af4d0141 ZONE_CREATE_HELPER: fixed crash when adding a cutout to a zone
Fixes: lp:1783541
* https://bugs.launchpad.net/kicad/+bug/1783541
2018-07-26 15:30:21 +02:00
John Beard 6df2d69b6e Add global zone fill/unfill to Edit menu
This means if you don't know the hotkey, the tool action can be
reached without having to activate the zone tool.

Fixes: lp:1783250
https://bugs.launchpad.net/kicad/+bug/1783250
2018-07-25 09:04:51 +02:00
John Beard 7acc0b89f9 Pcbnew: fix 45-degree snapping of ruler and dimension tools
This introduces a new util function in geometry_utils which snaps a vector
to axes or 45 degree lines. This can be used whenever you want to
snap a vector to these angles, but still want it to stay on a grid.

This snapping is used for the dimension tool and the ruler tool.

This is substantially simpler for two-point tools that the method
used by the line tool, which uses DIRECTION_45.

Fixes: lp:1780826
https://bugs.launchpad.net/kicad/+bug/1780826
2018-07-24 15:01:02 +01:00
Jeff Young afd80c3cdb Fix botched attempt to have ruler adjust to unit changes.
Also fixes the context menu so there's a specific one for the
measurement tool, allowing zooming for instance without cancelling
the tool.
2018-07-23 12:37:01 +01:00
Jeff Young 16b5f40817 Remove assert and update ruler units on the fly.
Fixes: lp:1781595
* https://bugs.launchpad.net/kicad/+bug/1781595
2018-07-23 02:02:02 +01:00
jean-pierre charras db712ea643 Footprint editor: display a warning when trying to created a custom pad shape with a Bezier curve.
Currently, Bezier curve (S_CURVE shape) is not supported in a custom pad shape.
2018-07-22 18:39:48 +02:00
jean-pierre charras 4cac974420 Add Bezier curve (S_CURVE shape) support in DIALOG_GRAPHIC_ITEM_PROPERTIES.
Fix some issues related to S_CURVE shape support.
2018-07-22 18:39:48 +02:00
jean-pierre charras 72d1597201 DXF import: add import of DXF splines that are converted to Bezier curves.
Fix also a lot of bugs related to Bezier curves (S_CURVE shape in DRAW_SEGMENT class) in Pcbnew code.
Add missing code to handle these Bezier curves
2018-07-22 18:39:47 +02:00
Jeff Young 5c646119a7 Allow user-specification of dimension units.
Also fixes a units bug when round-tripping a dimension through
the file format.

Fixes: lp:1782797
* https://bugs.launchpad.net/kicad/+bug/1782797
2018-07-21 13:50:21 +01:00
Jeff Young 99db5cb543 Allow for reduced nagging with wider use of KIDIALOG.
(cherry picked from commit c2dd5df)
2018-07-17 15:13:53 +01:00
Jeff Young 45e6dfc7af Simplify copy/paste of pad settings.
Fixes: lp:1743141
* https://bugs.launchpad.net/kicad/+bug/1743141

(cherry picked from commit 13ece03)
2018-07-17 15:13:39 +01:00
Jeff Young da69a7cd9c Enable position-relative tool in footprint editor.
Fixes: lp:1778624
* https://bugs.launchpad.net/kicad/+bug/1778624

(cherry picked from commit 3ee9703)
2018-07-17 15:12:43 +01:00
Jeff Young aab97c8385 Consolidate design rules UI.
Implement new Board Setup paged dialog which includes:
  Layers Setup
  Design Rules
  Solder Mask & Paste
  Text & Drawings

Moves line width and text properties to a layer-class-based
system.  Renames unlocked to upright (which also reverses the
logic).

New Edit Text and Graphic Properties dialog which replaces
Edit Footprint Text and adds layer-class-based editing and the
italic, upright and visibility properties.

Adds Import Settings functionality which allows settings to
be imported from another project at page granularity.

Also UNIT_BINDERizes the dialog and adds editing of pcb text.

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

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

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

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

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

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

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

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

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

(cherry picked from commit 3944a5e)
2018-07-17 15:12:34 +01:00
Jeff Young 5f3ee1e7ce More g_UserUnit erradication.
(cherry picked from commit 3f08780)
2018-07-17 15:12:31 +01:00
Jeff Young ae2cb331b1 Merge PCBnew text edit dialogs.
(cherry picked from commit 63b7738)
2018-07-17 15:12:24 +01:00
Jeff Young 2ff414adb4 Simplify Move Exactly and Postion Relative dialogs.
Also removes g_UserUnit references.

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

(cherry picked from commit 1639636)
2018-07-17 15:12:11 +01:00
Jeff Young 5ce0f8ba54 Kill off a few more g_UserUnit references.
(cherry picked from commit 452b1a7)
2018-07-17 15:12:07 +01:00
Jeff Young 92dcf43ae8 UNIT_BINDERize zone dialogs.
Also includes a bunch of changes to simplifiy the terminology
and unify the copper, non-copper and keepout versions.

Also removes some legacy features:
Removes contol for fill method.  If the fill method is currently
segments the dialog will ask if you want to convert to polygons
on OK.
Removes control of boundary resolution.  We've done this with trig
since 5.0.

(cherry picked from commit 487aaeb)
2018-07-17 15:11:32 +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 a39fb03822 Remove some references to g_UserUnit
(cherry picked from commit 614d832)
2018-07-17 15:09:56 +01:00
Jeff Young 74acb76e7f Switch UNIT_BINDER and DIALOG_SHIM to local units.
The general idea is to support user-units inheritance.  The
UNIT_BINDER allows wrapped controls to inherit units from their
parent dialog, while KEYWAY_HOLDER and DIALOG_SHIM allow child
KEYWAY_HOLDERs or DIALOG_SHIMs to inherit units from their
parent.

The GetUserUnits() method signature has to move to KEYWAY_HOLDER
rather than KEYWAY_PLAYER (where it makes more sense) as it’s the
only common ancestor of KEYWAY_PLAYER and DIALOG_SHIM.

As long as we'll be using the UNIT_BINDER more widely, it also
makes sense to move evaluation and validation into it.

This commit also provides eeschema’s DIALOG_LABEL_EDITOR and
pcbnew’s DIALOG_TRACK_VIA_PROPERTIES and DIALOG_SET_GRID as
models of how to use the new user-units inheritance, eval, and
validation.

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

(cherry picked from commit c8bc53e)
2018-07-17 15:09:53 +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
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
Seth Hillbrand e2122db587 pcbnew: Clear unused code 2018-06-21 09:20:48 -07:00
Seth Hillbrand 147c1e6088 pcbnew: Allow clearing local ratsnest
The local ratsnest needs to be able to hide as well as show visibility.
Clicking a module will toggle the visibility while clicking off all
modules clears the local ratsnest display.

Fixes: lp:1531332
* https://bugs.launchpad.net/kicad/+bug/1531332
2018-06-19 15:12:20 -07:00
Jeff Young feebb3a36c Don't double-move module text when parent is also selected.
Fixes: lp:1776871
* https://bugs.launchpad.net/kicad/+bug/1776871
2018-06-18 22:03:39 +01:00
Maciej Suminski 94b6f848bb pcbnew_control.cpp: change C-style asserts to wxCHECK/wxFAIL 2018-06-15 17:11:32 +02:00
Maciej Suminski eb97634bdf Enable 'Delete Item' toolbar icon in the Footprint Editor when the tool is active 2018-06-15 17:10:12 +02:00
Maciej Suminski 7d66dc0cc3 Fixed an assert on pasting items in the Footprint Library Editor
The assert in the title line verifies that an item does not belong to
any DLIST when it is being added to one. Items in clipboard are already
owned by DLISTs, therefore they need to be removed from the original
DLISTs before being added to new ones.
2018-06-15 14:35:55 +02: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
Seth Hillbrand 11ab8f6dc1 pcbnew: Fix a couple of duplicate hotkeys 2018-06-13 22:53:06 -07:00
Seth Hillbrand fb1aa56b77 modedit: Don't activate measure tool without a footprint
There's no risk in measuring an empty footprint but there's no benefit
either.  This matches the measure tool to the other, deactivated
footprint tools.
2018-06-12 16:48:59 -07:00
Seth Hillbrand 04706d9d02 pcbnew: Add placement hotkeys
Assigns configurable hotkeys to the placement commands.

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

Fixes: lp:1167895
* https://bugs.launchpad.net/kicad/+bug/1167895
2018-06-12 16:08:06 -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
Seth Hillbrand 61c3bc4af4 pcbnew: Don't stage undo commits on new items
New items just being placed on the board are still temporary.  Although
we can modify their orientations/positions, we can't stage these changes
for undo/redo without corrupting the undo stack.

Fixes: lp:1776312
* https://bugs.launchpad.net/kicad/+bug/1776312
2018-06-11 16:43:30 -07: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
Seth Hillbrand a5b92a1fe4 Constrain dimension tool while creating
The dimension tool is optionally constrained (MD_CTRL) while editing the
dimension.  This ensures same behavior for the creation step.
2018-06-06 17:04:28 -07:00
Seth Hillbrand 0a91f0bc9c Add 45º constraints to lines when moving with CTRL
Fixes: lp:1774750
* https://bugs.launchpad.net/kicad/+bug/1774750
2018-06-02 15:52:18 -07:00
Seth Hillbrand da061718e5 Remove constraint on circle
Allows circle radius to snap to arbitrary points while editing

Fixes: lp:1773436
* https://bugs.launchpad.net/kicad/+bug/1773436
2018-05-25 12:30:47 -07: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
jean-pierre charras 6f249e5eb6 Add missing icons in lock/unlock context submenu 2018-05-22 14:36:35 +02:00
Seth Hillbrand 0c2f9b1827 Keep circles controlled by radius
Circles are defined by center and a point on their edge.  This requires
the user to do extra math to figure out the size of the circle.  The
patch allows the user to edit and draw circles using radial coordinates.
2018-05-20 17:16:44 -07:00
jean-pierre charras 45dad4ded5 DIALOG_POSITION_RELATIVE: make dialog more understandable.
Better texts, and add a helper comment.
2018-05-18 13:53:31 +02:00
jean-pierre charras 2832f997c5 PcbNew; fix crash on copy/paste
Due to a bug introduced by commit ba1e0efda that tried to fix an other bug.

Fixes: lp:1771003
https://bugs.launchpad.net/kicad/+bug/1771003
2018-05-13 21:50:59 +02: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 ba1e0efdad Pcbnew, GAL mode: Fix incorrect management of zones in append board and copy from Paste from clipboard.
Fixes: lp:1770855
https://bugs.launchpad.net/kicad/+bug/1770855
2018-05-12 20:48:50 +02:00
Maciej Suminski 471e3de5a7 Fixed board append function, broken in 046e73ec
The previous implementation cleared all DLISTs, but has not added
everything back on append.
2018-05-08 11:21:55 +02:00
Maciej Suminski 8cb3aa79f2 pcbnew_control.cpp code formatting 2018-05-08 10:40:33 +02:00
Maciej Suminski 046e73ecac Clear the source DLIST when pasting items to a BOARD
Fixes the assert triggering when items already belonging to a list are
added to another one.
2018-05-08 10:40:33 +02:00
Seth Hillbrand 4c7f5f2a2f Allow disabling snap-to when placing vias
This allows the user to selectively disable the snap-to behavior when
placing stand-alone vias.  Full solution will require an update to the
segment distance calculation that takes into account the rounded line
caps.

Fixes: lp:1769523
* https://bugs.launchpad.net/kicad/+bug/1769523
2018-05-07 13:58:26 -07:00
Jeff Young a31017bc9c Check zone fills before plotting.
Also adds a "Draft Plot" button for those who wish to sidestep
zone checking (which can be slow).

Fixes: lp:1712579
* https://bugs.launchpad.net/kicad/+bug/1712579
2018-05-05 23:40:40 +01:00
Maciej Suminski 684f085ac5 Coverity fixes
CIDs:
dereference before null check:
175439 @ drc.cpp

uninitalized field:
175435 @ point_editor.cpp
174162 @ zone_filler.cpp
163188 @ footprint_info_impl.cpp

logically dead code:
155146 @ pcb_editor_control.cpp
2018-05-04 14:06:08 +02:00
Jeff Young 2f157f9b23 Enable magnetic pads in Modedit.
Also fixes a bug where a FOOTPRINT_EDIT_FRAME was being passed
in to a PCB_EDIT_FRAME.

Also tidies up Modedit settings handling for settings which can't
be edited in Modedit's preferences dialog.  They're now copied
from Pcbnew.

Fixes: lp:1768477
* https://bugs.launchpad.net/kicad/+bug/1768477
2018-05-02 21:49:57 +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
Seth Hillbrand 76d3b6f04a Adding locking to the context menu for modules
Locking submenu was activated only for tracks and via but it makes sense
(and is probably expected) when right-clicking on modules as well.
2018-05-02 08:35:53 -07:00
Jeff Young 6b3410974d Fix "same layers" test when duplicating zones. 2018-05-01 13:54:31 +01:00
Andrzej Wolski 5ac4dbe641 Fix window/crossed selection mode recognition in flipped view
Fixes: lp:1767233
2018-04-30 14:57:38 +02:00
Jeff Young c8a784058e Allow duplicating a zone onto the same layer in a GAL canvas.
Duplicate already works, so there's little reason to disallow
using the zone dialog to do it.

The legacy canvas can't be fixed because we'll immediately
union the two zones, resulting in a no-op.

Fixes: lp:1464677
* https://bugs.launchpad.net/kicad/+bug/1464677
2018-04-29 20:28:45 +01:00
Jeff Young 5342aacf97 Implement magnetic pads & tracks for measurement tool.
This really needs to get put into the VIEW_CONTROLS for all the
tools, but that's probably a bit too risky for 5.0 at this
point.

Fixes: lp:1766547
* https://bugs.launchpad.net/kicad/+bug/1766547
2018-04-25 23:36:17 +01:00
Seth Hillbrand d0ffff3b88 Prevent deletion while actively routing
Fixes: lp:1766280
* https://bugs.launchpad.net/kicad/+bug/1766280
2018-04-24 10:44:49 -07:00
jean-pierre charras bfc70c8208 Fix an issue in footprint editor, "Create Pad from Selected Shapes" command.
If the initial pad was a custom pad converted in a usual pad + graphic items by the command:
"Explode Pad to Graphic Shapes"
the "old" primitives were not cleaned, and the new created pad contained these old primitives, regardless the new selected shapes.
(Usual case when a user want to edit a custom shape)
2018-04-24 17:00:29 +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
Maciej Suminski 536529e48f Fixed unused captured variable warning 2018-04-20 08:44:41 +02:00
Maciej Suminski f81c77cd4e Edit Tool: update the reference point for in-place modification
Fixes: lp:1765027
* https://bugs.launchpad.net/kicad/+bug/1765027
2018-04-19 17:10:06 +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
Maciej Suminski dce0743ddb Removed nagging dialog in the delete tool. 2018-04-19 15:35:10 +02:00
Seth Hillbrand f68268c8ca Only update msgpanel when dimension started
Fixes: lp:1765118
* https://bugs.launchpad.net/kicad/+bug/1765118
2018-04-18 10:06:23 -07:00
Seth Hillbrand 1663627135 Update msg panel on create/modify graphic items
This clears the msg panel when not editing an item and updates the
position information when moving
2018-04-12 10:07:24 -07:00
Tomasz Włostowski 4e99b0d0e7 pcbnew: refresh message panel while drawing & editing graphical lines, arcs, circles and texts
Fixes: lp:1763052
* https://bugs.launchpad.net/kicad/+bug/1763052
2018-04-12 18:23:33 +02:00
Jeff Young a597ebc85e Break a track when placing a via on it.
Fixes: lp:1737349
* https://bugs.launchpad.net/kicad/+bug/1737349
2018-04-09 11:05:14 +01:00
Carsten Schoenert 77b3a662fc fix misspelled 'Allows to' -> 'Allows one to' 2018-04-08 13:24:30 -04:00
Maciej Suminski 94dbcc7199 Fixed crash after multiple 'cut' commands in the footprint editor
When multiple cut commands were issued, the cut command handler would
restart multiple times and keep running until the handler that was
invoked first finishes. As all handlers kept a selection copy, they
would try to save the deleted items to the clipboard resulting in a
crash.

Fixes: lp:1761221
* https://bugs.launchpad.net/kicad/+bug/1761221
2018-04-05 00:26:57 +02:00
Maciej Suminski 7943372e8b Refill zones only when required
Previous implementation refilled zones every time they have been
unselected. This patch adds a flag that tracks whether the
zone has been actually modified, so it will be refilled only when
necessary.

Fixes: lp:1760903
* https://bugs.launchpad.net/kicad/+bug/1760903
2018-04-03 22:28:05 +02:00
Jeff Young d391489596 Don't clear old footprint till after user has hit OK.
Fixes: lp:1759190
* https://bugs.launchpad.net/kicad/+bug/1759190
2018-04-02 22:32:09 +01:00
Jon Evans 0ded476f9d Add a hotkey to control net highlighting
Fixes: lp:1757446
* https://bugs.launchpad.net/kicad/+bug/1757446
2018-03-26 23:09:44 -04:00
Maciej Suminski 886dc48cc4 Point Editor: reset the pointer to the modified point as it becomes invalid
Fixes: lp:1759024
* https://bugs.launchpad.net/kicad/+bug/1759024
2018-03-27 00:03:48 +02:00
Maciej Suminski 4b5ca0ec14 Drawing tool: prevent creating zero-length lines
Fixes: lp:1758570
* https://bugs.launchpad.net/kicad/+bug/1758570
2018-03-24 23:57:06 +01: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
Maciej Suminski ce610f33a2 Coverity fixes
resource leak: #172233
negative array index write: #102363
uninitialized scalar field: #174540 #174539
structurally dead code: #169334 #169331
2018-03-19 10:02:05 +01:00
Jeff Young 89ebab5df2 Comments for SELECTION_TOOL::guessSelectionCandidates(). 2018-03-18 22:17:27 +00:00