Commit Graph

367 Commits

Author SHA1 Message Date
John Beard 9625cea57f Fix hotkey debug spew
Two issues:

* Unassigned hotkeys were being passed to WX in the menu strings as
  "<unassigned>". WX doesn't recognise this, and prints debug each time.
  Unassigned hotkeys are no longer rare or naughty, so we shouldn't provoke
  debug spew. Suppress by not appending hotkey strings for actions with 0
  (i.e. unassigned) hotkey IDs.
* The zone cutout tool uses GR_KB_SHIFT, not MD_SHIFT. This causes
  "unknown hotkey" spew from WX.
2019-06-11 14:40:57 +01:00
Jeff Young bb96255a03 Fix dangerous static_cast-ing to wrong type. 2019-06-10 23:46:01 +01:00
Jeff Young 5e49517781 Move hotkeys to ACTION architecture. 2019-06-10 23:46:00 +01:00
Jeff Young 765606012f Convert separate-compilation of selection.cpp to polymorphism. 2019-06-10 23:46:00 +01:00
Seth Hillbrand 81c5ba257b pcbnew: Ensure cursor remains set during tool activity
Mouse capture end is called by some actions such as save board.  This
resets the cursor image but doesn't change the current tool.  Resetting
the cursor image during action prevents this.

(cherry picked from commit 35e87128f5)

Fixes: lp:1831888
* https://bugs.launchpad.net/kicad/+bug/1831888
2019-06-08 10:25:24 -07:00
Jeff Young c1298570cb Remove legacy routing options. 2019-06-01 16:29:12 +01:00
Jeff Young 7553cc2651 Clean up some dangling legacy odds and ends. 2019-06-01 01:17:46 +01:00
Jeff Young 1e9da7f57b Remove CurItem() architecture and legacy routers and drawing code. 2019-05-29 00:26:30 +01:00
Jeff Young 0260b32125 Push resetLocalCoords down into COMMON_TOOLS.
Fixes: lp:1830693
* https://bugs.launchpad.net/kicad/+bug/1830693
2019-05-29 00:26:29 +01:00
jean-pierre charras 75cea18f07 Pcbnew, toolbars: fix incorrect icons 2019-05-23 11:07:55 +02:00
Jeff Young 67cc2aac2e Rework Eeschema find/replace for modern toolset.
Fixes: lp:1827274
* https://bugs.launchpad.net/kicad/+bug/1827274

Fixes: lp:1827240
* https://bugs.launchpad.net/kicad/+bug/1827240
2019-05-22 21:48:04 +01:00
Jeff Young 97445f1714 Don't go into interactive move when position was set in creation dialog.
Fixes: lp:1822569
* https://bugs.launchpad.net/kicad/+bug/1822569
2019-05-16 19:57:06 +01:00
Jeff Young fbb807f3bb Move some more menu & toolbar items to modern toolset. 2019-05-16 19:57:06 +01:00
Jeff Young f602ccd814 Insert EE_TOOL_BASE under SchEdit and LibEdit tools, and fix errant rename scope which clobbered PCBNew's PICKER_TOOL. 2019-05-12 13:47:08 +01:00
Martin McNamara 7200f4d7b5 PCBnew: Fixes crosshair issue with "Place Text" and "Add Dimension".
When using "Place Text" the crosshair was freezing if cancelled before
placing text.

After the crosshair freezes, the next uses of the "Place Text" or
"Add Dimension" caused the crosshair to jump to the screen location
where the previously the crosshair was frozen.

Cancelling the "Add Dimension" caused the crosshair to jump to the
screen location where the crosshair was when cancelled on the next use
of the "Place Text" or "Add Dimension".

Fixes: lp:1822578
* https://bugs.launchpad.net/kicad/+bug/1822578
2019-05-11 06:44:40 -07:00
Jeff Young fd546da640 Homogenize hit testing and selection return types.
Prep work for sharing SCH_SELECTION_TOOL with LibEdit.
2019-05-05 17:14:30 +01:00
Jeff Young 42383ae871 Build out some of the modern toolkit context menus. 2019-05-05 17:12:59 +01:00
Jeff Young e885d739a4 Simiplify VECTOR2 -> wxPoint conversions.
There has always been an operator specified, but it's explicit so
most folks don't notice it.
2019-04-22 22:08:18 +01:00
Jeff Young 77284e82c8 Replace switch-to-non-copper-layer for DIMENSION and POLYGON.
These still aren't handled by DRC.

Fixes: lp:1796500
* https://bugs.launchpad.net/kicad/+bug/1796500
2019-04-03 19:14:45 +01:00
Jeff Young 920d9e3d46 Don't switch to non-copper layer when drawing text & graphics.
We now allow these items on copper layers (and do the necessary
DRC, etc.)

Fixes: lp:1796500
* https://bugs.launchpad.net/kicad/+bug/1796500
2019-04-03 10:18:11 +01:00
jean-pierre charras e6a200b09e Pcbnew: avoid integer overflow when displaying local coordinates.
Minor cleanup in code.
2019-02-14 10:57:22 +01:00
Seth Hillbrand 184711beb4 pcbnew: Fix via snapping to multiple tracks
Rather than selecting an arbitrary track to snap, we select the closest
track to our point, allowing the via to be placed along the full track
length.

Fixes: lp:1813324
* https://bugs.launchpad.net/kicad/+bug/1813324
2019-01-25 09:13:18 -08:00
Seth Hillbrand 4247e32cd6 pcbnew: Disallow new via where DRC is violated
Prior to placing the via, we check if the resulting via will pass too
close to different nets on different layers.

Fixes: lp:1718827
* https://bugs.launchpad.net/kicad/+bug/1718827
2019-01-23 10:20:59 -08:00
Seth Hillbrand efe880bb79 pcbnew: Fix zone cutout duplication
When creating the zone cutout, we delete the old zone and add a new one
with each cutout.  This requires resetting the source zone and clearing
our previous selection if we would like to continue using the cutout
tool on the new zone.

Fixes: lp:1812339
* https://bugs.launchpad.net/kicad/+bug/1812339
2019-01-23 06:42:07 -08:00
jean-pierre charras 1c4b0337c2 Footprint editor, GAL mode: add missing initialization of local coordinates when creating graphic items
Fixes: lp:1812233
https://bugs.launchpad.net/kicad/+bug/1812233
2019-01-17 17:59:00 +01:00
Seth Hillbrand 77163e27f0 suppress boost optional compiler warning 2018-12-13 12:43:29 -08:00
jean-pierre charras 85775d522c Fix incorrect include paths
Especially, pcbnew/import_dxf is no longer in use.
2018-12-11 11:32:58 +01:00
Seth Hillbrand 4fc81bb923 pcbnew: Graphic lines snap as single segments
Graphic lines and polygons are drawn to fit specific areas for which it
is helpful to have the endpoint controlled by the cursor even when
constraining the angle.

Fixes: lp:1805502
* https://bugs.launchpad.net/kicad/+bug/1805502
2018-12-08 07:26:58 -08:00
jean-pierre charras cc0aa8b928 Gfx import: fix many issues, and add many enhancements.
* Do not compile dxf old files.
* import gfx, gal mode: make absolute placement working.
* Import gfx in legacy canvas: use it and make interactive placement working
* Take imported line width in account. Ensure DXF line thickness is OK.
* handling empty files in legacy mode.
2018-12-03 15:25:44 +01:00
jean-pierre charras 430c61822d Import svg import code from experimental trunk: convert dxf importer 2018-12-03 13:42:23 +01:00
jean-pierre charras 74a9d5401a Import svg import code from experimental trunk: start point 2018-12-03 13:42:22 +01:00
Seth Hillbrand 908c2a37e5 GRID_HELPER: Finish drawing closed path
When we draw a path, we usually want to close the path when clicking on
the end of another line.  This uses grid helper to ensure this
progression happens as expected.
2018-11-24 08:00:11 -08:00
Maciej Suminski 361b768aaf Fix frozen cursor on interactive DXF placement 2018-11-13 14:58:54 +01:00
Jeff Young befc504734 Warp cursor back to creation point after new-text dailog.
Also fixes same issue for new zones.

Fixes: lp:1802532
* https://bugs.launchpad.net/kicad/+bug/1802532
2018-11-11 20:26:19 +00:00
Seth Hillbrand 4b931aeb57 pcbnew: Force cursor position when snapping
This places the crosshairs (confusingly named here) at the snap
position, either one of the snap points or the grid, depending on the
status of the hotkeys SHIFT/ALT.

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

Fixes: lp:1801369
* https://bugs.launchpad.net/kicad/+bug/1801369
2018-11-07 14:36:46 -08:00
Jeff Young a5c892d9cd Update line width each time a new object is drawn.
Fixes: lp:1797481
* https://bugs.launchpad.net/kicad/+bug/1797481
2018-10-18 15:25:56 +01:00
Seth Hillbrand 915d2ed374 pcbnew: Zone tool follows active layer
Refactor the polygon event loop into its parent function to allow access
to the params structure.  Active layer now updates the drawing layer for
add/cutout zones.

Fixes: lp:1797483
* https://bugs.launchpad.net/kicad/+bug/1797483
2018-10-11 21:16:05 -07:00
Jeff Young e79e2f0175 Remove properties flag from via placer so single-click mode works.
Fixes: lp:1796769
* https://bugs.launchpad.net/kicad/+bug/1796769
2018-10-10 10:59:50 +01:00
Seth Hillbrand 1ee579c821 pcbnew: Set graphic line width based on layer
Get the board settings when changing the drawing layer.  These include
default line thickness that should be updated.

Fixes: lp:1796489
* https://bugs.launchpad.net/kicad/+bug/1796489
2018-10-06 21:42:25 -07:00
Seth Hillbrand 821b10a37e pcbnew: Drawing tool's crosshairs follow the element
When drawing the crosshair should track the element while the mouse
provides the position to calculate the next snap.

Fixes: lp:1796524
* https://bugs.launchpad.net/kicad/+bug/1796524
2018-10-06 20:27:18 -07:00
Seth Hillbrand d669ae043a GRID_HELPER: Standardize grid helper logic to dim
Places dimension tool under same snapping logic as rest of draw tools

Fixes: lp:1796498
* https://bugs.launchpad.net/kicad/+bug/1796498
2018-10-06 09:53:14 -07:00
Seth Hillbrand f2a49c6bd6 pcbnew: Get anchor from layer when drawing
When drawing segments, the segment will be NULL'd after committing, at
which point we lost our snap layer.  Choosing snap layers from the
current drawing layer is a more robust method.

Fixes: lp:1796467
* https://bugs.launchpad.net/kicad/+bug/1796467
2018-10-06 08:18:31 -07:00
Seth Hillbrand 4c6b84bfdb GRID_HELPER: enable/disable grid in editor with ALT
Apply optional grid while editing
2018-10-04 21:31:28 -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
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 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
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
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
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 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 5ce0f8ba54 Kill off a few more g_UserUnit references.
(cherry picked from commit 452b1a7)
2018-07-17 15:12:07 +01:00
Seth Hillbrand 11ab8f6dc1 pcbnew: Fix a couple of duplicate hotkeys 2018-06-13 22:53:06 -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
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 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
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
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
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
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
Seth Hillbrand 8639c308fa Spelling "free-stanging" -> "free-standing" 2018-03-08 12:33:32 -08:00
Maciej Suminski 52fcddf4f4 Allow drawing self-intersecting polygons, just display a warning
Fixes: lp:1751654
* https://bugs.launchpad.net/kicad/+bug/1751654
2018-03-02 10:58:43 +01:00
Maciej Suminski 4da47f2c01 Forbid drawing self-intersecting polygons. 2018-02-22 16:24:08 +01:00
Jeff Young cd81254262 Respect 45-degree mode when set from zone dialog.
Fixes: lp:1655073
* https://bugs.launchpad.net/kicad/+bug/1655073
2018-02-20 17:38:20 +01:00
Jeff Young 4d5e1489fb New menu structure for ModEdit.
Includes some dialog changes to go with the menu update.
Includes promoting the Pcbnew graphics mode back to main menu.
Includes renaming Graphics modes to Toolsets.
2018-02-20 10:49:41 -05:00
jean-pierre charras de72ef8518 Fix code after renaming files 2018-02-16 20:27:57 +01:00
jean-pierre charras 8552f3fedf fix code after renaming files 2018-01-29 22:00:44 +01:00
jean-pierre charras 270a63daac DRAWSEGMENT, S_POLYGON shape: remove useless copies or conversion to std::vector<wxPoint> of SHPE_POLY_SET polygon shape.
Rename GetPolyPoint() to BuildPolyPointsList(), because GetPolyPoint() looks like an accessor, but it is not an accessor.
(Using it as accessor can creates a *very long calculation time* for very basic access to polygon vertices)

Fixes: lp:1745050
https://bugs.launchpad.net/kicad/+bug/1745050
2018-01-24 14:22:43 +01:00
Maciej Suminski 388d07a808 Fix disappearance of placed objects after 'Properties' action 2018-01-19 14:20:42 +01:00
Maciej Suminski 903e33375f Fix rotation & flip of newly placed texts
When a rotation/flip command was issued when a newly placed text
was hovering over an existing item - the item underneath would be
affected by the command and the new text would be discarded.

Fixes: lp:1744152
* https://bugs.launchpad.net/kicad/+bug/1744152
2018-01-19 14:20:42 +01:00
jean-pierre charras 5a74fe373b Fix incorrect parent in dialog edit_module_text, when this dialog is called from an other dialog.
Fix also a coding style issue.
2018-01-14 14:28:48 +01:00
Jeff Young 658d181ec7 Don't capture cursor if zone or polygon cancelled.
If the client tool indicates it isn't happy for us to continue
(because, for instance, the user has cancelled the Zone Properties
dialog), then make sure we don't capture the mouse.

Fixes: lp: 1740780
* https://bugs.launchpad.net/kicad/+bug/1740780
2018-01-04 13:10:37 -05:00
Robbert Lagerweij bd7f5081d1 Pcbnew: make the line/arc drawing tool show segment length
This patch adds functionality to the Pcbnew draw tool to show the dx and
dy of the current segment being drawn if the relative origin (pressing
spacebar) is not already set (i.e. if those coordinates are ( 0, 0 ) ).
You can set the relative origin while using the draw tool by pressing
spacebar. The relative origin is reset on exit of the tool.

fixes: lp:1736133
* https://bugs.launchpad.net/kicad/+bug/1736133
2017-12-28 15:14:14 -05:00
Tomasz Włostowski 9932ff32ae refactoring: wrapped boost::optional in OPT<> class for the purpose of easier transition to C++17 in the future 2017-11-03 23:59:02 +01:00
jean-pierre charras 78ec983632 DRAWSEGMENT fix crash when trying to copy a empty polygon.
SHAPE_POLY_SET: fix crash in VertexCount when it is a empty poly set, or when params are incorrect.

minor other fixes:
warning in degug mode in dialog_dxf_import_base.cpp
pcb_painter.cpp: remove a useless debug line.
2017-10-25 09:39:26 +02:00
Tomasz Włostowski d9bfbb4fec pcbnew: added graphical polygon drawing & editing tools 2017-10-19 23:14:01 +02:00
Tomasz Włostowski 32185ddcd3 Multiple improvements concerning colors, configuration handling and legacy features in pcbnew:
- support for background color setting
    - removed several global config settings (such as g_Drc_On)
    - wrapped most of global config settings in PCB_GENERAL_SETTINGS class
    - reorganized PCB general options dialog to clearly mark which options concern only the legacy canvas
    - new GAL feature for legacy users: double-click (or E) to change track width available as an option.

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

Fixes: lp:1707145
* https://bugs.launchpad.net/kicad/+bug/1707145
2017-08-04 16:06:57 +02:00
Maciej Suminski 76bd05a69b Prevent creating too many transitions by TOOL_MANAGER
- added TOOL_INTERACTIVE::resetTransitions()
- made protected and moved TOOL_BASE::setTransitions() to TOOL_INTERACTIVE
- TOOL_MANAGER calls TOOL_INTERACTIVE::resetTransitions() instead of
setTransitions()
2017-07-31 15:09:19 +02:00
Maciej Suminski f3fbce9560 Code formatting and clean-up 2017-06-23 15:43:13 +02:00
Tomasz Włostowski 113163257d Fixed compilation warnings 2017-06-23 11:36:05 +02:00
Tomasz Włostowski a7759efc59 Multiple fixes:
- ratsnest is updated now when undoing in legacy view
- select whole net regression
- local ratsnest in the GAL regression
- pick correct zone net for stitching vias
- mark nets as dirty on net propagation to force ratsnest update

Todo:
- cleanup board algorithm is still broken
2017-06-23 11:12:37 +02:00
Tomasz Włostowski 3b16d3cffe further DLIST/Iterators cleanup, some code formatting 2017-06-23 11:12:37 +02:00
Tomasz Włostowski 63f4ab697b post-rebase fixes 2017-06-23 11:12:37 +02:00
Tomasz Włostowski 3b7b0603b6 pcbnew: via placement tool, initial version 2017-06-23 11:12:37 +02:00
jean-pierre charras 6ed4f9b208 Make EDA_DRAW_FRAME::SetToolID and mouse cursor shape setting working in GAL canvases, and uses same mouse cursor shapes in legacy and gal canvases.
Starting fixing incorrect UI behavior of Zoom to selection in Pcbnew.
2017-06-12 15:16:09 +02:00
Maciej Suminski 6507dbf3ad Fixed code formatting & comments typos 2017-04-24 00:02:07 +02:00
jean-pierre charras 9a7abd5914 Pcbnew: fix some issues in GAL when adding holes in zones. 2017-04-07 11:57:02 +02:00
Jon Evans 3ec28e2acf Refactor layer enumerations to all live in the same place 2017-03-30 16:01:48 -04:00
Maciej Suminski f2763e90ea Disable autopanning & cursor capture when drawing is finished 2017-03-23 14:15:34 +01:00
John Beard 9fe780f1b3 Rework zone creation in GAL
The zone creation in DRAWING_TOOL was a complex event loop whici
simultaneously managed the event handling, construction of the preview
polygon and the creation and commiting of the zone, all in the same
scope. This has been broken into several pieces:

* POLYGON_ITEM preview item, used to preview the polygon in progress
* POLYGON_GEOM_MANAGER is a class that collects points from user input
  and used them to describe a polygon's geometry, including calculation
  of 45-degree constrained leader lines
* ZONE_CREATE_HELPER is a class which deals with creating zones based on
  geometry from a geometry manager and parameters from the DRAWING_TOOL
* The (much simpler) event loop in DRAWING_TOOL drives the
  POLYGON_GEOM_MANAGER. With a minor refactor, this loop can be reused
  in future for other polygonal tools if wanted.

The polygon preview now has a translucent fill which makes it easier to
visualise the zone.

This also adds the Close Zone Outline and Delete Last Corner actions as
part of the new event loop.

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

Fixes: lp:1667885
* https://bugs.launchpad.net/kicad/+bug/1667885
2017-03-22 17:18:12 +01:00
John Beard 1fd503bf58 Move DIRECTION45 to common/geometry
This class is useful for generic geometric layout of 45-deg constrained
line chains, not only in the PNS router.
2017-03-22 15:23:09 +01:00
John Beard 5f303f7b25 Enhance Pcbnew arc construction
This adds a richer overlay to the arc-by-three-points tool in Pcbnew,
including more guide-lines and a live display of radius and angle.

Also included is ability to go back to the previous step (if setting end
angle, you can go back to setting start point, etc) using Backspace, and
Ctrl snaps the start/end angles to 45 degree multiples.

This adds new classes

* MULTISTEP_GEOM_MANAGER: represents a generic "geometry manager" that
  builds up some geometrical construction based on a sequence of points.
  Used by:
* ARC_GEOM_MANAGER: handles the logical flow of constructing an
  arc by centre-point, set radius, set angle. This moves the logic out
  of the Pcbnew DRAWING_TOOL event loop in drawArc().
* ARC_ASSISTANT: graphical overlay to communicate current arc shape to
  the user during the drawing process
2017-03-17 20:56:54 +01:00
Maciej Suminski 3174573361 Removed code resetting VIEW_CONTROLS settings
As the VIEW_CONTROLS settings are managed for each tool,
there is no need to restore the settings to initial state
when a tool is finished.
2017-03-06 15:04:27 +01:00
Maciej Suminski 275ba503d1 Fix drawing arcs on Edge.Cuts layer
Fixes: lp:1666822
* https://bugs.launchpad.net/kicad/+bug/1666822
2017-03-02 13:52:36 +01:00
Jon Evans fd4e2b042c Refactor SELECTION, SELECTION_CONDITIONS, and context menus to common
SELECTION now holds EDA_ITEMs not BOARD_ITEMs so various places had to
change to casting the selected items to BOARD_ITEMs.

Fixed compilation warnings on clang (Tom)
2017-02-28 14:47:20 +01:00
John Beard 796f3219d0 Draw zone hatching in GAL
This just uses the same hatch lines that are built into the zone as
legacy.

They are always drawn, even when there is a fill, as if the fill
doesn't reach the corners, the hatches can be seen.

Fixes: lp:1487043
* https://bugs.launchpad.net/kicad/+bug/1487043
2017-02-27 18:00:46 +01:00
John Beard c001c6114f Add cancel interactive tool action to GAL
This is used to provide menu entries that allows cancellation of
interactive drawing and routing tools without needing the keyboard.

It is provided in the drawing tools and the router tool.

The cancel event doesn't have any new functionality (e.g. track rip-up
for the PNS router - lp:1448460), this just adds it to the menu, where
it behaves the same as an Escape keypress.
2017-02-24 10:37:07 +01:00
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
Maciej Suminski 95794df088 Code formatting 2017-02-10 23:23:56 +01:00
John Beard 728349ea12 Add similar zone tool in GAL
This action launches the normal interactive zone tool, but re-uses the
settings from an existing zone, based on a flag passed to the main zone
function.
2017-02-10 23:23:55 +01:00
John Beard abe83b54ae Add zone cutout tool to GAL
When activated, the zone interactive editor is launched with a flag. The
drawn zone is then used to modify the existing zone at the end of the
action.
2017-02-10 23:23:55 +01:00
John Beard d37586aeaf Refactor GAL dialog prompt for new zone settings
Break a chunk of the new zone tool out into a separate function to keep
the code clear. When zone cutouts and similar zone tools are added,
they'll get the settings from existing zones.

This commit now used std::unique_ptr for the temporary zone item, which
simplifies handling of the ownership of that item.
2017-02-10 23:23:55 +01:00
John Beard 7045ed92fb Add CCW rotation to GAL canvas
This makes "rotate" into two separate TOOL_EVENTs, which each have a
"multiplier" parameter.

Also added is a namespace for 'free functions' that use TOOL_EVENT
public interfaces (perhaps with other inputs too) to centralise some
decision-making and calculations.

Fixes: lp:1660731
* https://bugs.launchpad.net/kicad/+bug/1660731
2017-02-09 12:50:47 +01:00
Maciej Suminski a3e16988be Remove shadow of drawn arcs after undoing them (GAL) 2017-02-09 12:19:16 +01:00
Maciej Suminski 2a9c6a6283 Minor DRAWING_TOOL refactor
Automatically switch to a drawing layer, if a copper layer was
preselected. No annoying message boxes.
  Do not deactivate the tool on layer switch.
  Replaced setting updatePreview with direct calls to VIEW::update
  Line width is kept in m_lineWidth for all shapes.
2017-02-09 12:03:28 +01:00
John Beard 019b949646 Pre-select highlighted net in zone create dialog
Applies in GAL mode (legacy mode already did this).

Fixes: lp:1482866
* https://bugs.launchpad.net/kicad/+bug/1482866
2017-01-29 23:46:41 +01:00
Dick Hollenbeck 0c459ced97 EDA_TEXT object refactor.
Make all EDA_TEXT data private and rename accessors to avoid function
name collisions in derived classes.

Overload EDA_TEXT's SetTextAngle() and SetEffects() in TEXTE_PCB.

Add support for preserving Reference text position, size, orientation
during a netlist import into a BOARD, as well as the one off footprint
update dialog.
2017-01-25 08:03:32 -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 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 f1c5b9a9ae Add context menu to GAL DRAWING_TOOL, including the zone menu
Includes a tiny class for scoped set-reset of a variable, which is used
here to store the current drawing mode.

Fixes: lp:1218629
 * https://bugs.launchpad.net/kicad/+bug/1518629
2017-01-11 10:41:08 +01:00
John Beard 6baf0edc08 Line segments obey 45 degree preference in GAL
The GAL line segment tool now listens to the global line segment 45
degree locking preference, with Ctrl used to invert the behaviour. The
behaviour therefore follows the setting normally, and the user can
override when needed with Ctrl.

Fixes: lp:1635718
* https://bugs.launchpad.net/kicad/+bug/1635718
2017-01-11 09:57:55 +01:00
Maciej Suminski f94c10b453 Fixed a warning in release builds 2016-12-12 16:45:52 +01:00
Maciej Suminski 89055c4425 Code formatting 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
jean-pierre charras 502d0a38be Fix a missing parameter initialization (arc angle) in footprint DXF import 2016-09-30 11:11:52 +02:00
Chris Pavlina 2b7e6e73ec Fix uninitialized variable in drawing_tool.cpp 2016-09-30 09:04:18 +02:00
Maciej Suminski 18695751e8 Fixed a footprint editor crash on DXF import
Fixes: lp:1627422
* https://bugs.launchpad.net/kicad/+bug/1627422
2016-09-27 13:36:52 +02:00
decimad ee3d75f273 Add coroutine call invocation context to identify the main stack frame.
Run the text draw-tool on the main stack frame.

Fixes: lp:1547282
* https://bugs.launchpad.net/kicad/+bug/1547282
2016-09-21 11:56:40 +02:00
Maciej Suminski 4bb16afc9e Fixed text placement tool in FP editor
Fixes: lp:1625304
* https://bugs.launchpad.net/kicad/+bug/1625304
2016-09-20 10:19:33 +02:00
Maciej Suminski 5a1f52bf30 Modified tools to use BOARD_COMMIT. 2016-09-12 13:45:57 +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
Maciej Suminski 1dd43d1d98 Unified undo buffer handling code for PCB & module editor.
Replaced UR_MODEDIT with UR_CHANGED.
2016-09-12 11:50:06 +02:00
jean-pierre charras a4658ab6be Fix a few compil warnings (not used vars, shadowed local vars) 2016-06-01 14:22:05 +02:00
Tomasz Wlostowski ee3418e90b One-click PCB update improvements
- Fix repetitive undo/redo segfaults & assertions.
- Add Update menu entry on PCB side.
- Fix Python build error
- Add spread footprints after updating
2016-01-29 15:43:40 +01:00
Simon Richter da9ca2def2 Avoid cast from const_iterator to iterator
The standard library requires iterators passed to functions that modify the
container to be mutable iterators, but GCC's implementation accepts
const_iterator in some places where these are only used to mark a place,
but the actual modification happens through a different parameter.

As this breaks implementations that use the passed iterator to modify the
container (e.g. because they use a different data organization), this is
not portable; because we already have a non-const reference to the
container anyway, this is trivially fixed as well.
2016-01-17 12:31:00 -05:00
Chris Pavlina c44c076bdb Fix coding style error in 6429 2016-01-07 17:33:31 -05:00
Johannes Agricola 07b73b9677 Properly set keepout flag for new zones in GAL 2016-01-07 14:39:21 -05:00
Tomasz Wlostowski 72b0593fdb Pcbnew: push and shove router fixes.
* Fix segfault caused by invalidation of the end item by
  PNS_LINE_PLACER::UpdateSizes().
* GAL zone drawing tool updates the ratsnest after zone drawing is complete.
* Fixed performance issue in zones processing using strict simplification
  only for the final filled area.
2015-11-18 09:35:17 -05:00
Maciej Suminski db8560f055 Fixed crash when placing 45-degree lines in the footprint editor (GAL). 2015-10-01 15:52:45 +02:00
jean-pierre charras 00cffb080e Make call to DXF importer not possible if a footprint does not exist, also in GAL mode. 2015-09-13 18:44:07 +02:00
Maciej Suminski 5caa1523bd Handling Coverity reports. 2015-08-07 17:07:06 +02:00
Maciej Suminski 2a93d083ee More DXF import fixes. 2015-08-03 21:11:59 +02:00
Maciej Suminski cb629e0ad4 Fixed DXF placing problem (GAL). 2015-07-30 13:49:36 +02:00
Maciej Suminski 5402bf0960 Allow zone drawing tool to start a new zone in the previous zone last point. 2015-07-28 17:33:18 +02:00
Tomasz Wlostowski 591f54f540 DRAWING_TOOL: show cursor when placing text 2015-07-22 13:51:59 +02:00
Andrew Zonenberg 561a962977 Fixed bug where "add text" tool in module editor did not update the toolbar radio buttons correctly 2015-07-11 17:03:50 -07:00
Andrew Zonenberg 6775cf392a Removed leading space 2015-07-11 16:50:31 -07:00
Andrew Zonenberg 1ea566b59d Fixed bug where GAL text tool was overzealously capturing the cursor when not necessary 2015-07-11 16:03:07 -07:00
Andrew Zonenberg a3a0db9be9 Fixed bug where GAL module editor does not release mouse capture after exiting text tool 2015-07-11 15:31:01 -07:00
Maciej Suminski 0cc6992d88 Double click finishes drawing (GAL). 2015-07-03 20:58:13 +02:00
Maciej Suminski 5ca8e0b9d6 Fixed incorrect polygon finishing in 45-degree mode (GAL). 2015-06-30 13:55:30 +02:00
Chris Pavlina 064e8a82e1 Fixed an assertion in arc drawing tool (GAL). 2015-06-02 20:16:55 +02:00
Maciej Suminski 946b9d1933 setTransitions() are called automatically for tools. 2015-04-30 10:46:03 +02:00
Maciej Suminski 26f20fbb00 Moved "Place Target" and "Place Module" tools from DRAWING_TOOL to PCB_EDITOR_CONTROL (to avoid placing modules in the footprint editor). 2015-03-10 16:58:26 +01:00
Maciej Suminski c160a7de17 Capturing cursor in drawing tools (GAL). 2015-03-10 14:43:14 +01:00
Maciej Suminski cc72e585f0 Fixed segfault in arc drawing tool (GAL footprint editor). 2015-03-10 14:32:40 +01:00
Maciej Suminski b0ad779ee4 Calming down the Coverity report. 2015-02-15 23:21:52 +01:00
Maciej Suminski 902d0e3f1f Tools are processing const TOOL_EVENT& (Tool Framework). 2015-02-14 21:28:47 +01:00
jean-pierre charras 6bae852cb9 Minor fixes: specctra export: skip malformed circles (having a radius = 0) in board outline creation, which can crash 3d-viewer or vrml export.
dialog_fp_lib_table: remember during a session the last open table (global or local).
drawing_tool: fix compil warning
Update demos.
2014-09-22 09:51:06 +02:00
Maciej Suminski c13cdb0964 Fixed line width settings in the module editor (GAL). 2014-09-01 13:48:51 +02:00
Maciej Suminski 242d42cf1d Changed 'line width change' & 'change arc posture' to TOOL_ACTIONs. 2014-08-04 14:23:19 +02:00
Maciej Suminski a1e08ae568 Drawing tools reset its state on layer change. 2014-07-15 11:41:55 +02:00
Maciej Suminski c1eda6b88c Some of the Tool Actions need to be run in immediate mode - fixed. 2014-07-09 16:50:31 +02:00
Maciej Suminski db0d708300 Simplified code for switching layers in GAL view. Tools are notified of layer change event. 2014-07-09 16:25:50 +02:00
Maciej Suminski b2d0737329 Fixed continous line drawing.
Outline mode can be set up on any layer.
2014-07-09 15:10:32 +02:00
Maciej Suminski ed88c40be5 Moved module editor-specific tools to a separate class (MODULE_TOOLS). 2014-07-09 15:02:56 +02:00
Maciej Suminski a6484f1acb Drawing tools used to crash when the drawing tool was interrupted - fixed. 2014-07-09 15:02:56 +02:00
Maciej Suminski b42091bc06 Fixed anchor placement tool in module editor (GAL). 2014-07-09 15:02:56 +02:00
Maciej Suminski 47f1fec31d DXF drawing placement tool for GAL. 2014-07-09 15:02:56 +02:00
Maciej Suminski d73ab976df Added support for placing the footprint anchor. 2014-07-09 14:01:06 +02:00
Maciej Suminski 5dc1f92608 Added pad placement tool for module editor (GAL). 2014-07-09 14:01:06 +02:00
Maciej Suminski 67136d21b1 MInor fixes. 2014-07-09 14:01:06 +02:00
Maciej Suminski 99043b777d Adapted graphics tools to cooperate with module editor. 2014-07-09 14:01:06 +02:00
Maciej Suminski ba320ac7c3 Added "edit modules" mode for DRAWING_TOOL. 2014-07-09 14:01:06 +02:00
Maciej Suminski fc44f34ade Fixed DRAWING_TOOL::PlaceTextModule() method. 2014-07-09 14:01:06 +02:00
Maciej Suminski b05885c2f1 Refactored drawing tools: lines, circles and arcs. 2014-07-09 14:01:06 +02:00
Maciej Suminski 94cc845b3f Added AF_ACTIVATE flag for TOOL_ACTIONs.
Reworked the way of processing events in TOOL_MANAGER class.
Added GetCommandStr() for TOOL_EVENT class.
2014-07-09 13:50:27 +02:00
Maciej Suminski 5d1ec2b204 Restored invocation of SELECTION_TOOL commands with TOOL_ACTIONs. 2014-07-09 13:50:27 +02:00
Maciej Suminski 6e0bd1eedc Adapted tools to PCB_BASE{_EDIT}_FRAME. 2014-07-09 13:50:27 +02:00
Maciej Suminski a6dac245c0 Removed TOOL_ACTIONs: selectionSingle, selectionClear. SELECTION_TOOL methods are called directly instead. 2014-07-09 11:59:24 +02:00
Maciej Suminski 9a47f4c645 Created a specialization of EDA_DRAW_PANEL_GAL: PCB_DRAW_PANEL_GAL.
Moved View related routines & fields from PCB_{BASE,EDIT}_FRAME & BOARD to PCB_DRAW_PANEL_GAL.
2014-07-09 10:57:32 +02:00
Dick Hollenbeck 4578ea8b9e 1) Add 32 Cu Layers.
2) Change from legacy Cu stack to counting down from top=(F_Cu or 0).
   The old Cu stack required knowing the count of Cu layers to make
   sense of the layer number when converting to many exported file types.
   The new Cu stack is more commonly used, although ours still gives
   B_Cu a fixed number.
3) Introduce class LSET and enum LAYER_ID.
4) Change *.kicad_pcb file format version to 4 from 3.
5) Change fixed names Inner1_Cu-Inner14_Cu to In1_Cu-In30_Cu and their
   meanings are typically flipped.
6) Moved the #define LAYER_N_* stuff into legacy_plugin.cpp where they
   can die a quiet death, and switch to enum LAYER_ID symbols throughout.
7) Removed the LEGACY_PLUGIN::Save() and FootprintSave() functions.
   You will need to convert to the format immediately, *.kicad_pcb and
   *.kicad_mod (=pretty) since legacy format was never going to know
   about 32 Cu layers and additional technical layers and the reversed Cu
   stack.
2014-06-24 11:17:18 -05:00
Maciej Suminski f5de166a7e Removed an unused parameter from TOOL_BASE::getModel<T>() method. 2014-06-06 14:59:25 +02:00
Maciej Suminski 2ed804b8ef Upstream merge. 2014-05-12 17:17:51 +02:00
Maciej Suminski 3f8d9da31f Key events are handled by wxEVT_CHAR instead of wxEVT_KEY_[UP|DOWN]. Fixed issue of chars that require modifiers (e.g. ? is Shift+/ on US keyboard layout). 2014-04-09 17:33:22 +02:00
Maciej Suminski 4c5afc46af Added possibility of switching tools by the right toolbar buttons, without deactivating the current tool first (previously tools did not switch if there was one active). 2014-04-04 11:50:15 +02:00
Maciej Suminski b6aa832f83 Converted std::bind1st to boost::bind. 2014-04-02 16:30:48 +02:00
Maciej Suminski 23392ce8c9 Upstream merge. 2014-04-02 15:38:59 +02:00
Maciej Suminski a55d25803e Activation of any drawing/placement tool clears current selection. 2014-04-01 14:06:19 +02:00
Maciej Suminski dbcc18ab31 Enabled autopanning while drawing zones. 2014-03-18 14:01:09 +01:00
Maciej Suminski 4d6f628a1f Minor fixes to zone drawing tool. 2014-03-18 11:33:49 +01:00
Maciej Suminski 1ff99b47c8 Fixed triple click bug while drawing zones with DRAWING_TOOL. 2014-03-18 11:09:43 +01:00
Maciej Suminski 54bf21768c Added a few settings to make the layer settings more similar to KiCad defaults (moved vias to VIA_THROUGH_VISIBLE, added a few rules for required layers). 2014-03-11 10:58:58 +01:00
Maciej Suminski 1c253bfba0 Some variables initialized to NULL. 2014-02-24 11:17:49 +01:00
Maciej Suminski 87785441bc Removed some excessive variables. 2014-02-19 15:20:42 +01:00
Maciej Suminski 57c69b41db Continous mode for drawing tools (i.e. they do not finish after adding a single object). 2014-02-19 13:51:32 +01:00
Maciej Suminski e14d9aaf8f Fixed wrongly formulated assert. 2014-02-17 17:20:44 +01:00
Maciej Suminski 05de84d542 Undo/redo support. 2014-02-17 14:53:01 +01:00