Commit Graph

816 Commits

Author SHA1 Message Date
Maciej Suminski 74847bf8ff Code formatting and clean-up 2017-04-20 14:01:38 +02:00
jean-pierre charras a35a46804e Pcbnew fix: "create array" extremely slow in GAL mode, due to a useless call of a time consuming method for each new item created. 2017-04-19 14:15:11 +02:00
jean-pierre charras 01f5a129a3 Fixes: lp:1683147 (Board append command *extremely* slow)
https://bugs.launchpad.net/kicad/+bug/1683147
2017-04-18 20:10:34 +02:00
jean-pierre charras 74cd53fb31 finishing work started in commit ba37d6fca35b67fc04a21aa111aba97c80c3a1b0:
Command add corner to zone in GAL mode: fix corner cases (existing when a zone has holes).
(Well, "corner case" is the right word: I can't resist)
2017-04-14 14:39:45 +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
jean-pierre charras 70c961fe6a Pcbnew: fix serious issues (broken files) when saving and loading .kicad_pcb files when zones have holes in outlines. 2017-04-07 08:02:26 +02:00
jean-pierre charras ba37d6fca3 Temporary fix of broken command add corner to zone in GAL mode.
Fixes: lp:1680339
https://bugs.launchpad.net/kicad/+bug/1680339
2017-04-06 19:04:47 +02:00
Jon Evans 3ec28e2acf Refactor layer enumerations to all live in the same place 2017-03-30 16:01:48 -04:00
John Beard c94269e173 Pcbnew GAL: Switch CW/CCW hotkeys to match legacy mode 2017-03-30 16:05:56 +02:00
John Beard 0b593faa93 Pcbnew: correct CW/CCW rotation.
These were backwards since internal angles are CCW due to the inverted Y
axis.

The hotkeys have NOT changed. This means 'R' is now clockwise and
'Shift+R' is anti-clockwise. This is the same as EEschema, but not the
same as Legacy mode.
2017-03-30 16:05:56 +02:00
Alejandro García Montoro f68ce306bd CPolyLine -> SHAPE_POLY_SET refactor.
Removes the need of using the legacy code in polygon/PolyLine.{h,cpp},
refactoring all CPolyLine instances with SHAPE_POLY_SET instances.

The remaining legacy methods have been ported to SHAPE_POLY_SET;
mainly: Chamfer, Fillet, {,Un}Hatch.

The iteration over the polygon vertices have been simplified using the
family of ITERATOR classes.
2017-03-24 10:43:47 +01: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 d99fbddc22 Enable angle snap for pcbnew GAL ruler tool
This uses the two-point geometry manager to split the logic of the ruler
geometry and the preview item display. This allows the ruler to use that
manager's angle snap feature.
2017-03-22 10:59:47 +01:00
John Beard b8edecc10f Move cursor shape flag into GAL settings
The motivation here is to concentrate display options in the GAL display
settings, ready for removal of legacy canvases. Instead of having the
property as a member of the DRAW_FRAME, with the GAL canvas retreiving
it from there, it is now in the GAL_DISPLAY_OPTIONS struct, and both GAL
and legacy get it from there.

The options for setting cursor shape are then moved out of the general
options dialog, and into the GAL display options widget, where they can
be used in all GAL-aware programs.

GAL cursor shape works on GAL, but not legacy, so the option is now
available on OSX (but only affects GAL, and is labelled as such).
2017-03-22 10:24:48 +01: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
John Beard ce731f8b62 Add GAL microwave tools
This adds the microwave tools to GAL in Pcbnew as a new tool:
MICROWAVE_TOOL.

Some new preview items are introduced to support this:

* TWO_POINT_GEOM_MANAGER for managing construction of two-point
  geometries, such as that used to construct the inductor.
* CENTRELINE_RECT_ITEM a preview item to draw ractangle with a given
  aspect ratio along a line (specified using a TWO_POINT_GEOM_MANAGER)

PCB_TOOL gets a generic event loops which should be useful for more
than just microwave tools:

* doInteractiveItemPlacement() - handles event loops that wait for a
  click, create an item on click and then allow moving it
  around/flipping, etc.

Fixes: lp:1531323
* https://bugs.launchpad.net/kicad/+bug/1531323
2017-03-20 16:10:51 +01:00
Tomasz Włostowski 77c1b1b4ea Refresh vias geometry when switching via display mode
Fixes: lp:1674096
* https://bugs.launchpad.net/kicad/+bug/1674096
2017-03-20 12:06:56 +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
Tomasz Włostowski 2f730cad81 EDIT_TOOL: restore cursor position on exit
Fixes: lp:1671564
* https://bugs.launchpad.net/kicad/+bug/1671564
2017-03-14 10:54:58 +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 8c3b8ee693 Add a ruler tool to pcbnew GAL
This allows to measure between features on a PCB. It uses a preview
EDA_ITEM in common, but due to the use of the IDs, it's currently
Pcbnew/Modedit only.

This also adds several "utils" for graphical functons useful when
drawing preview items on GAL canvases.

Fixes: lp:1467313
* https://bugs.launchpad.net/kicad/+bug/1467313
2017-03-10 16:21:44 +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
Maciej Suminski 62235348d1 Use GAL axes instead of a ORIGIN_VIEWITEM in module editor 2017-03-08 10:35:51 +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
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
Jon Evans 88f7c55d95 Move ZoomFitScreen and ZoomPreset from PCBNEW_CONTROL to COMMON_TOOLS
BOARD::GetBoundingBox() now directly calls BOARD::ComputeBoundingBox()
and there is a new method BOARD::GetBoardEdgesBoundingBox() used for
call sites that needed to use ComputeBoundingBox( true ) in the past.

This allows COMMON_TOOLS to implement ZoomFitScreen without knowledge
of the BOARD class.
2017-03-03 13:28:19 +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
Maciej Suminski 906ee77dbf Fixed VIEW_ITEM memory leaks 2017-03-02 23:57:13 +01:00
Chris Pavlina 586c8f0feb Fix signed/unsigned compare warning 2017-03-02 14:46:19 -05:00
Maciej Suminski 35c7974a96 Enable grid snapping when dragging items (GAL)
Fixes: lp:1668077
* https://bugs.launchpad.net/kicad/+bug/1668077
2017-03-02 15:21:49 +01:00
Tomasz Włostowski 4a911e0790 Highlight net tool in GAL now cross-probes to EEschema if clicked on a pad
Fixes: lp:1663767
* https://bugs.launchpad.net/kicad/+bug/1663767
2017-03-02 14:43:37 +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
Maciej Suminski a5ac165c4b Make 'Enumerate Pad' tool more user friendly
Effects of enumeration are shown instantly, instead of after accepting
the changes.
2017-03-02 12:34:19 +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 a0df0f7f06 When filling/unfilling zones, create undo points in GAL
This is a feature which is apparently not available in legacy, but the
undo points created in GAL do work in legacy mode.
2017-02-27 18:00:51 +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
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
John Beard a8eea6155a Move bitmaps.h out of base_struct.h
bitmaps.h was included in nearly every file in the project due to it
being included by base_struct.h

Only about 130 files actually use the XPM definitions defined there, and
many of those already included bitmaps.h themselves, or via
menu_helpers.h. However, touching bitmaps.h would result in over 400
rebuilt files for pcbnew alone.

This commit moves the bitmap-related types like BITMAT_DEF out to a new
header, which is still included by base_struct.h, which is less
avoidable for now, it's it's used in the interface.

The icon list is still in bitmaps.h. This has the side effect that's
it's now easier to automatically generate this file.

Many classes in pcbnew and eeschema needed some functions moved
to the implementaitons from the headers too.
2017-02-21 09:50:15 -05:00
Maciej Suminski 6fdccc1829 PAD_TOOL: enable 'Apply' after copying a pad 2017-02-20 11:09:00 +01:00
John Beard 2fa17b4460 Put pad enumerate tool in PAD_TOOL submenu
Prior to this, it was in the top level of the selection
menu, and was always shown, even if the module editor
didn't have a loaded footprint.
2017-02-20 11:08:34 +01:00
John Beard ca91c27852 Adjust pad sub-menu enablements
The apply settings and push settings options now take account of the
validity of the global pad settings when deciding whether to show or
not.

Global pad push now requires a source pad and doesn't push from the
global pad setting when there is no selection.

The whole submenu is hidden when there are no enabled items.

Fixes: lp:1664016
* https://bugs.launchpad.net/kicad/+bug/1664016
2017-02-20 11:08:34 +01:00
Julius Schmidt 877a65dcc7 Fix ratsnest calculation for pads connected with zones (GAL)
This patch fixes a problem with GAL where zones are ignored in ratsnest
calculation.
The problem is that calling RN_DATA::Update on a zone with no polygons
(an unfilled zone) will remove the zone successfully, but then
RN_DATA::Add is a no-op.
From this point on, because ::Update refuses to work on items that have
not been ::Add'ed, the zone is removed entirely from ratsnest
calculation and will only be reconsidered once it is explicitly ::Add'ed
again.
The fix is to explicitly create an empty RN_ZONE_DATA object for every
zone that is ::Add'ed.

A second problem is that the point editor forgot to call
RN_DATA::Recalculate after calling Fill_Zone.

Fixes: lp:1537120
* https://bugs.launchpad.net/kicad/+bug/1537120
2017-02-14 00:39:41 +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
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 1f9c483535 Allow delete whole track in GAL
This commit wires up the as-yet-unused "remove alternate" tool action
and uses it to select copper connections (normally 'U') before deleting
segments.

THis also reverses the sense of Delete and Backspace (Delete used to be
'remove' and Backpace was 'remove alt', now it is reversed). This means
that backspace is the key that removes a segment and Delete removes the
track. This is the same as legacy behaviour. Other delete actions are,
for now, the same between Delete and Backspace.

Fixes: lp:1517213
* https://bugs.launchpad.net/kicad/+bug/1517213
2017-02-10 22:42:55 +01: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
Aurabindo J 112c10fbd9 Pcbnew: Update Ratsnest immediately after rotation/flip/mirror
Provide a visual feedback to the user how each rotation
will affect the routing by immediately reflecting the
change in ratsnest orientation.

Signed-off-by: Aurabindo J <mail@aurabindo.in>

Fixes: lp:1663488
* https://bugs.launchpad.net/kicad/+bug/1663488
2017-02-10 22:25:47 +01:00
jean-pierre charras dd5b024903 Pad export/import settings functions: remove duplicate code. 2017-02-10 20:44:35 +01:00
jean-pierre charras 9d43817db8 Make a debug message not translatable. 2017-02-10 20:44:35 +01:00
Maciej Suminski 5f90c0e8b8 Capitalized menu labels to follow the UI policy 2017-02-10 00:08:48 +01:00
John Beard bed0ad142d Add zone duplicate onto layer to GAL
This adds it into the PCB_EDITOR_CONTROL tool, alongside the zone merge
tool.
2017-02-09 12:50:48 +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 7806cb7bca Drag tracks/vias menu entry (GAL) 2017-02-09 12:03:28 +01:00
Maciej Suminski a16586756f Moved EDIT_TOOL::hoverSelection() code to SELECTION_TOOL::CursorSelection() 2017-02-09 12:03:28 +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
Maciej Suminski 6c5e5c27e2 Fixed bounding box computation for EDIT_POINTS class 2017-02-09 12:03:28 +01:00
Nick Østergaard 1cb171acf0 Rename bitmaps to match the new pad tool naming 2017-02-07 23:08:09 +01:00
Nick Østergaard 45a8c2e27f Rename pad copy actions in the pad tool
Import becomes apply and export becomes copy.

The term "push" to apply settings globally has not been renamed.

Swap the order of the copy and apply in the context menu.
2017-02-07 23:08:09 +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
jean-pierre charras 9a6e5734bf Minor fixes: fix UI capitalization issues, and better comment in a menu. 2017-02-04 10:21:41 +01:00
Maciej Suminski 8dadc18429 Check if selection is not empty before modifying it in EDIT_TOOL
Fixes: lp:1661311
* https://bugs.launchpad.net/kicad/+bug/1661311
2017-02-02 23:32:11 +01:00
John Beard fb6de689b9 Factor an EDIT_TOOL selection routine
Also add some commentary to other EDIT_TOOL selection functions.
2017-02-01 09:57:58 +01:00
John Beard 45b60b1bb0 Add exchange modules GAL tool (in EDIT_TOOL)
Includes tool action and the transistion binding in EDIT_TOOL.

Fixes: lp:1541460
* https://bugs.launchpad.net/kicad/+bug/1541460
2017-02-01 09:57:36 +01:00
Maciej Suminski 9627f063ff Added missing handler for 'activate' events in EDIT_TOOL
Fixes: lp:1660306
* https://bugs.launchpad.net/kicad/+bug/1660306
2017-01-30 14:05:44 +01:00
Maciej Suminski 4b9243e0bf Allow registering TOOLs in any order. 2017-01-30 13:21:43 +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
Maciej Suminski 24d63fb5d9 Removed redundant calls to wxUpdateUIEvent handlers
This is done automatically by wxWidgets
and does not need to be called explicitly.
2017-01-27 15:39:51 +01:00
Maciej Suminski 750eed7ff5 Renamed MODULE_TOOLS to MODULE_EDITOR_TOOLS 2017-01-27 15:39:41 +01:00
John Beard 0f5bfdb156 Add mirror tool action for GAL module editor
This is basically a simple clone of the legacy tool with a few minor
tidy-ups for GAL mode.

Fixes: lp:1619301
* https://bugs.launchpad.net/kicad/+bug/1619301
2017-01-25 20:17:28 +01:00
John Beard beed72ffbb Add pad import/export/push to GAL canvas
This implements the pad import/export to the board's master pad setting
in the GAL canvases.

Implemented as a new GAL tool: PAD_TOOL.

It uses the same dialog, which has been split out into its own files in
pcbnew/dialogs, rather than along with frame methods in
pcbnew/globaleditpad.cpp.

Fixes: lp:1619304
* https://bugs.launchpad.net/kicad/+bug/1619304
2017-01-25 20:17:28 +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 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
Maciej Suminski 59346a6ef1 Alternative way for setting icons for align/distribute actions. 2017-01-23 11:41:00 +01:00
Maciej Suminski f0a7c1715e Fixed warning 'cast pointer from integer of a different size' 2017-01-23 11:40:59 +01:00
Maciej Suminski 682da70a86 Fixed the issue of creating and event handling in context menus (GAL).
When creating a copy of CONTEXT_MENU, always a CONTEXT_MENU instance was
constructed, whereas an inherited type should be used. Solved with
CONTEXT_MENU::create() that has to be overridden in inheriting classes.

Event & update handlers are now virtual functions, instead of setting
the handlers with Set{Event,Update}Handler().
2017-01-23 11:40:59 +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
jean-pierre charras 2de913797a Fix a UI policy issue. Very minor cosmetic change: give same look to Zoom and Grid selection in 2 menus. 2017-01-20 11:35:24 +01:00
jean-pierre charras e710b8b370 Fix incorrect parameter type when appending zoom and grid menuitems 2017-01-19 20:26:57 +01: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
Maciej Suminski ee2b1ac321 Shortened code using VIEW & PAINTER classes in MODULE_TOOLS methods 2017-01-18 13:22:18 +01:00
Maciej Suminski 004ca3c6f9 Fixed a memory leak in VIEW_ITEM (proper way of doing 9bc2bb2)
The problem with simple deleting VIEW_ITEM_DATA upon VIEW_ITEM removal was
caused by the default copy constructors that copied pointers.
Once a copy of an item was destroyed, the VIEW_ITEM_DATA has been
destroyed, effectively invalidating m_viewPrivData for the other item.
2017-01-16 14:57:50 +01:00
John Beard c50d28d94d Access tools' TOOL_MENUs rather than CONDITIONAL_MENUs
This means that non-top-level tools, for example EDIT_TOOL and
PCB_EDITOR_CONTROL can submit their own menus to the top-level tool's
TOOL_MENU, which will then retain a reference to it and make it
available for the CONTEXT_MENU that is shown.
2017-01-12 14:34:03 +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
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
jean-pierre charras 2972f6fbc7 Fix shadowed local variable 2016-12-20 17:51:55 +01:00
jean-pierre charras 9be5398cd2 Add bitmaps to Align/distribute menu ans menu items 2016-12-20 17:50:29 +01:00
Tomasz Włostowski b20323dc63 SELECTION: fixed pointer arithmetic-related segfault in operator[] 2016-12-20 12:01:09 +01:00
Maciej Suminski c8676db84e Fixed panning & cursor control with arrow keys in flipped view 2016-12-12 16:45:52 +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 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
jean-pierre charras bcfc1e7a3f fix shadowed local variables 2016-11-25 16:00:42 +01:00
jean-pierre charras d167407d1a Pcbnew: add "edit all tracks and vias" command in edit menu.
Previously, this command was accessible only by right clicking on a track and only in the legacy mode.
2016-10-14 21:07:39 +02:00
Simon Richter b0f9864bc4 Clean up warnings from exception handlers
The exception objects caught are either not referenced at all, or only in
debug builds. This avoids the warnings for the unused variables.
2016-10-10 11:08:49 -04: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
Simon Richter ad088db6d2 Add more "override" markers. 2016-09-25 13:59:41 -04:00
Simon Richter 59c81976dc Explicitly mark overriding functions. 2016-09-24 14:53:15 -04: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
Gustav Bergquist 061a7b8450 Cast TOOL_EVENT parameter type to intptr_t 2016-09-21 21:22:19 +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
Dick Hollenbeck 9ad49dc2d1 Split IO_ERROR out of richio.* and store Problem() and Where() separately 2016-09-20 11:56:18 -04: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 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
Maciej Suminski edf64afa3e Fixed freezes after appending a board. 2016-09-12 13:45:57 +02:00
Maciej Suminski 6701b80f77 Converted global deletion, global text size setting & module exchange to BOARD_COMMIT. 2016-09-12 13:45:57 +02:00
Maciej Suminski 91ea4242ca Fixed freeze after adding a module 2016-09-12 13:45:57 +02:00
Maciej Suminski 303a6928ab Changed pointEditorUpdate to editModifiedSelection. 2016-09-12 13:45:57 +02:00
Maciej Suminski ad1111748e Removed 'undo inhibit' in EDIT_TOOL 2016-09-12 13:45:57 +02:00
Maciej Suminski 5a1f52bf30 Modified tools to use BOARD_COMMIT. 2016-09-12 13:45:57 +02:00
Maciej Suminski b815ea7865 Removed remaining m_editModules flags. 2016-09-12 11:50:06 +02:00
Maciej Suminski 9861b35707 EDIT_TOOL::hoverSelection() works with current selection. 2016-09-12 11:50:06 +02:00
Maciej Suminski b661993427 Removed SELECTION_TOOL::EditModules()
as there is already PCB_TOOL::SetEditModules() and
SELECTION_TOOL::m_editModules shadows PCB_TOOL::m_editModules.
2016-09-12 11:50:06 +02:00
Tomasz Wlostowski a5b7a7ca0a Changed DuplicateAndAddItem() to parametrized Duplicate(). 2016-09-12 11:50:06 +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
Tomasz Wlostowski 0700178d07 P&S: enable delete & backspace shortcuts while router is active 2016-08-15 17:16:47 +02:00
Wayne Stambaugh 4ed346ea64 Eeschema: initial schematic I/O plugin.
* Factor out PROPERTIES object from the PCB plugin code and move it into
  common so it can be used by both the Pcbnew and Eeschema plugins.

* Add schematic I/O plugin manager for loading and saving schematic and
  component library files.

* Add initial attempt at a parser for current schematic file format.  This
  parser will be infinitely more strict than the current parser which is very
  forgiving in what it parses.

* Make minor changes to the base bitmap class to support the new parser.

* Add find root sheet support to sheet object to allow fetching the root
  sheet from any sheet in the stack.
2016-07-06 05:22:56 -04: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
Chris Pavlina 5285962775 Remove option to not show footprint ratsnest when moving
This option only exists in legacy, with no real plan to port it to GAL. Nobody
seems to use this; there isn't really much of a point to it. Bye!
2016-06-11 22:34:07 -04:00
Chris Pavlina 8c01318141 Add zoom-to-selection tool 2016-06-08 07:19:53 -04:00
jean-pierre charras a4658ab6be Fix a few compil warnings (not used vars, shadowed local vars) 2016-06-01 14:22:05 +02:00
jean-pierre charras e2cc78b2b5 Code cleanup: remove dead code (some removed methods were broken), and update or add comments. 2016-06-01 11:28:07 +02:00
Simon Richter 96ec9db5d6 Add missing C++ stdlib headers
The GCC standard library headers often include other headers, which makes
some code compile that forgets to include several headers.
2016-05-28 12:46:29 -04:00
Maciej Suminski a30c8d7848 Coverity fixes. 2016-05-11 11:18:27 +02:00
Chris Pavlina 445db7da58 Fix uninitialized fields
Coverity: CIDs 102698, 147347, 147349, 147350
2016-05-10 22:36:23 -04:00
Maciej Suminski ad66af66af Highlight an item when context menu is displayed (GAL). 2016-05-09 10:41:11 +02:00
Maciej Suminski ce8f400645 Added menu for locking tracks & vias (GAL). 2016-05-09 10:29:06 +02:00
Maciej Suminski dd10c577ec Added SELECTION_CONDITIONS::OnlyTypes() variant that takes KICAD_T[]4 2016-05-04 18:35:20 +02:00
Maciej Suminski 06637a17d6 Added 'Reset Grid Origin' hot key (GAL). 2016-05-04 14:59:14 +02:00
Maciej Suminski b735f57fa4 Refresh pads after enumeration in Footprint Editor. 2016-05-04 14:06:10 +02:00
unknown b8a91c7a98 Enhancements in Create array tool (bad parameters detection and disable parms when not applicable) 2016-04-02 14:52:29 +02:00
Chris Pavlina 60d93d024c pcbnew: don't pick up selection after unsuccessful Duplicate
Following rev 6627 (git 2777182), if a non-duplicatable item was the object of
a Duplicate action, the original item would be picked up, potentially
misleading the user into thinking something was actually duplicated.
2016-03-18 07:15:50 -04:00
jean-pierre charras b237d81b75 Create Array dialog: some fixes:
*  No initial copied object changed (this was a serious bug to modify these objects. Previous version modified references and other texts using a very stupid algorithm).
  It also fixes bug 1549231
* only new pads are numbered (therefore renumbering is used only in footprint editor)
*  remove not working and useless feature in circular array: now  only use number for pads (others options using alphabetical letters are removed: did not work corectly, and were useless)
* a more clear option is used to choose if the pads are numbered from a choosen value, or from the first avaible value
* Adding a warning messsage if a parameter is incorrect.
2016-03-07 08:13:06 +01:00
Tomasz Wlostowski 5349eb4179 fixed segfault in selection tool 2016-02-08 15:12:59 +01: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
Maciej Suminski 1d39a2a44b Highlight net tool is not deactivated after a single use. 2016-01-29 10:56:29 +01:00
Maciej Suminski e51adaeefd Highlight a net when crossprobing with eeschema and highlight net tool is enabled. 2016-01-25 16:16:05 +01:00
Maciej Suminski 75c8094b5a Make DRC markers not editable with the standard tools (GAL). 2016-01-20 15:22:09 +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
Simon Richter ef582c07f3 Drop some debug output
This was apparently left in from debugging earlier, and should no longer be
needed. Since it uses a GCC extension, it makes compilation on others fail.
2016-01-17 10:59:17 -05:00
Simon Wells a88e61a6e0 Fix uninitialized variable in PCBNEW_CONTROL::CursorControl 2016-01-11 17:12:49 -05:00
Simon Wells 712ff51d3f Clarify assignment as conditional in EDIT_TOOL::Main 2016-01-11 17:12:11 -05:00
Simon Wells dbb7b38bae Delete unused variables in GRID_HELPER::AlignToSegment 2016-01-11 17:06:11 -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
Maciej Suminski 203e8156a1 pcbnew asks before rotating/flipping a locked item (GAL). 2016-01-05 17:01:59 +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
Maciej Suminski 0caa47e73c Fixed crash on undo pad placement in the footprint editor (GAL). 2015-12-15 13:39:53 +01:00
Cirilo Bernardo 2128594a85 Coding policy fixes: remove trailing white space. 2015-12-14 16:20:54 -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
jean-pierre charras 21d700facc Replace "module" by "footprint" in a few messages. 2015-11-17 17:18:00 +01:00
Thomasz Wlostowski 6e470ece1d Pcbnew: fix push and shove router segfault bug. 2015-11-03 11:19:42 -05: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 db8560f055 Fixed crash when placing 45-degree lines in the footprint editor (GAL). 2015-10-01 15:52:45 +02:00
Maciej Suminski 25d5a2fbfb Disable capture cursor & autopanning for tools in idle state (GAL). 2015-09-21 10:16:23 +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 6e23979253 Removal tool asks for confirmation only for modules (GAL). 2015-09-08 11:17:30 +02:00
Brian Sidebotham 34aab6f687 Add axis origin to the Footprint Editor to align with the Legacy canvas 2015-09-05 20:47:35 +01:00
Maciej Suminski b1d241c271 Net highlighting mode is toggled when used on the same net (GAL). 2015-09-03 17:56:30 +02:00
Maciej Suminski 9f41fe0bda Added a hot key for (un)locking modules (GAL). 2015-09-03 17:35:41 +02:00
Maciej Suminski 24e7f961b9 Fix a Coverity report (catches an unhandled exception). 2015-09-01 11:32:23 +02:00
Tomasz Wlostowski 0723ac5bef enumeratePads: fix segfault when no module is loaded in the editor 2015-08-25 10:22:52 +02:00
Maciej Suminski 0cad702fc7 Fixed footprint editor crash on ref/val text layer change (GAL). 2015-08-15 16:00:34 +02:00
Henrik Nyberg 5486104e8d Fixed the missing remove zone corner menu entry. 2015-08-15 15:28:48 +02:00
Henrik Nyberg a6c94e26f6 Improved code for handling zone corner dragging (GAL). 2015-08-12 10:15:45 +02:00
Maciej Suminski f43510739c Append board in GAL. 2015-08-07 18:24:42 +02:00
Maciej Suminski 0bd85fd8d1 Fixed a minor memleak. 2015-08-07 18:20:49 +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
Tomasz Wlostowski 9c2bcb2f3c Fixed crash on right click on zone with GAL mode. 2015-08-03 11:53:58 +02:00
Maciej Suminski e3cbfb0609 Better way of handling changes in EDIT_TOOL (GAL). 2015-07-31 17:40:19 +02:00