Commit Graph

1323 Commits

Author SHA1 Message Date
Ian McInerney 565bb268bb gerbview: Move more items to actions and tools
* Create a new inspection tool to hold the measure tool and
  the other inspection items
* Move some control functions from the frame to a tool and
  rearrange the code to be cleaner.
2020-10-09 01:55:31 +01:00
Ian McInerney a697690ebb gerbview: Give the tools menu a tool to use
Without this it can't actually dispatch any actions, so the
measure tool wasn't working when selected from the menu.
2020-10-09 01:55:31 +01:00
Marek Roszko f5e0754f65 Use the setCursor lambda pattern and fix up the initial cursor states 2020-10-07 23:26:14 -04:00
Mark Roszko d9485129c8 Implement more context specific cursors using both stock and custom cursors. 2020-10-08 00:50:28 +00:00
Ian McInerney 50405b558e Make the gerbview ruler tool more like the pcb ruler tool
* Allow the ruler to persist after clicking once on the canvas
2020-10-08 00:45:47 +01:00
jean-pierre charras 4b73db90a4 Gerbview: fix incorrect Gerber test files 2020-10-06 17:35:16 +02:00
Jeff Young 0bc7bbbadb Report silk/edge collisions.
Fixes https://gitlab.com/kicad/code/kicad/issues/5854

Fixes https://gitlab.com/kicad/code/kicad/issues/4892
2020-10-06 14:21:18 +01:00
Jeff Young ee95d8fe2e Improve SNR in status bar (and use common code). 2020-10-06 12:08:31 +01:00
jean-pierre charras 61f1f7d948 Gerber, aperture macros: use different apertures primitives in macro defs.
To avoid issues with broken Gerber readers use aperture macros with shapes
without rotation when more than one primitive is required.
In many gerber readers, rotation of a set of primitives is broken
(do not follow Gerber requirements)
2020-10-06 11:08:07 +02:00
Ian McInerney 43c14face0 Switch to showing metric/imperial units in comboboxes and menus
This will always show 1 unit from each system, with the primary unit
being the current frame unit and the secondary unit being the
most recent unit used from the other system. These are saved in
the settings, so they are saved between runs.
2020-10-05 20:26:33 +01:00
Ian McInerney 8b0fb9f4cf Remove units and polar settings from the preferences panels
These options are already available in menus, toolbars and hotkeys,
so having them in the preferences pane is more trouble than it is
worth.
2020-10-04 17:53:55 +01:00
Ian McInerney c9dc326a09 gerbview: Cleanup tool header 2020-10-04 17:53:55 +01:00
Ian McInerney 3a570c27f0 Update unit handling in the preview ruler
* Make the ruler able to switch to mils after creation
* Cleanup an unused flag in Pcbnew dimensions
* Move unit changed notification into EDA_DRAW_FRAME so more
  frames to use it.
* Allow switching units when GerbView ruler tool is active
2020-10-04 17:53:55 +01:00
Ian McInerney 122bd7ca7c Make the statubar aware of mils units
Switch Eeschema to use the built-in printing routines
because its precisions are close to those and it is
cleaner.

Give mils a precision of 2 decimal places to match
the precision shown in inches.
2020-10-04 17:53:55 +01:00
Ian McInerney ad29a2f3b4 Update more places to properly display mils 2020-10-04 17:53:55 +01:00
Ian McInerney b1bd1f2a97 Introduce new action to switch to mils as a unit 2020-10-04 17:53:55 +01:00
Jeff Young bb753aaadf Clean up terminology around active & high contrast layers. 2020-10-03 22:55:34 +01:00
jean-pierre charras 0b23cb7dbb more cleanup about removing useless include 2020-10-03 15:26:03 +02:00
jean-pierre charras b38cef409b Rename CopyFile() to KiCopyFile() to avoid name colliding with a windows header.
Using CopyFile() that can collide with a windows header create hard to
understand errors, including link errors.

Renaming this function avoids these strange errors.
2020-10-03 10:08:21 +02:00
Jeff Young 4c5db9681c Naming conventions. 2020-10-02 21:25:14 +01:00
Jeff Young cc617b715f Implement hypertext links for intersheet references. 2020-10-02 21:18:34 +01:00
jean-pierre charras 13304d0870 more cleanup about removing useless include 2020-10-02 13:40:00 +02:00
jean-pierre charras 84363c8e06 Gerbview test file: fix incorrect file. 2020-09-30 12:56:55 +02:00
jean-pierre charras 04aa5519d0 Gerbview: code cleanup. Remove many include, now useless. 2020-09-30 12:56:55 +02:00
Ian McInerney fc565edb33 Add a palette to the toolbars to display groups of actions
This adds a palette to toolbar items that displays groups
of actions when long-pressed on a button.
2020-09-27 01:00:44 +01:00
PJM d1322e7d1d Refactor GetDocumentExtents()
CHANGED: GetDocumentExtents() in 'eda_draw_frame.h' now has a bool
parameter "aIncludeAllVisible" with a default value "true" which makes
it behave as it did before adding parameter.  If "aIncludeAllVisible"
is false, the returned bbox ignores some items depending on which
program it is running in.

CHANGED: Made "Zoom to Objects" use only PCB edge in Pcbnew.  This
allows text, notes, etc outside the PCB edge to be excluded in the
zoom calculation.

CHANGED: Added "Zoom to Objects" to Pcbnew main menu, and to RMB context
menus for Eeschema and Pcbnew.

Fixes https://gitlab.com/kicad/code/kicad/issues/5787
2020-09-25 00:31:56 -07:00
PJM e77b7e3360 Make MMB double click perform 'Zoom to Fit'
ADDED: Make middle mouse button double click do a 'Zoom to Fit'
in Eeschema, Pcbnew, and Gerbview.  Ctrl-MMB does a 'Zoom to Objects'
in Eeschema.

Fixes https://gitlab.com/kicad/code/kicad/issues/1988
2020-09-22 23:21:44 +00:00
jean-pierre charras 456735f803 VIEW::ViewGetLOD() returns double now instead of int.
ViewGetLOD() returns the minimal value of a zoom to show an item.
However a zoom is a double, and using int as minimal value does not
allows setting a correct value in some cases.
2020-09-21 17:55:24 +02:00
Ian McInerney 70a7d1bc7c Cleanup variable usage and assignment in gerber reader 2020-09-21 12:19:49 +01:00
Ian McInerney 7dfbb3cb18 Cleanup formatting 2020-09-21 12:15:03 +01:00
Seth Hillbrand f493e270ea ADDED: Menu option to enable/disable snap to grid
You can now enable and disable snap to grid when drawing/editing across
all apps.  You can also tie snap to grid to the visibility of the grid
to allow rapid enable/disable via grid display.
2020-09-10 20:09:30 -07:00
Seth Hillbrand 4026904cc4 Make grid snapping depend on grid visibility
Turning the grid view on enables snapping to the grid.  Turning it off
removes the snap and allows free draw
2020-09-09 10:18:15 -07:00
Seth Hillbrand 173b4ff588 Add snapping to eeschema
This generalizes both the SetPosition() function and ORIGIN_VIEWITEM
class away from the pcbnew-centric.
2020-09-09 10:18:15 -07:00
Ian McInerney f28b60896c Allow toolbar items to cancel tools when pressed
There was a regression in v6 where the zoom to selection toolbar
item wasn't canceling the tool when pressed and the tool was active
(it was in v5). This implements a more generic framework for canceling
tools on button presses.

Fixes https://gitlab.com/kicad/code/kicad/issues/5103
2020-09-05 01:49:38 +01:00
Seth Hillbrand d6a4ab0eec Shortening filenames in titlebar
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2096
2020-09-03 06:38:34 -07:00
Michael Kavanagh de03d3d427 Application title bar: app name after filename
Fixes https://gitlab.com/kicad/code/kicad/issues/2096
2020-09-03 06:35:48 -07:00
Jeff Young 2697fc3864 Remove canvas-switching from OSX.
The Cairo renderer doesn't work on Retina displays.

Fixes https://gitlab.com/kicad/code/kicad/issues/4788
2020-08-31 18:48:25 +01:00
Jeff Young 88635ee5b6 Clean up error messages.
Convert a lot of nags to InfoBar errors/warnings/messages, and some
that never should have been exposed to wxFAIL_MSGs.
2020-08-31 14:19:57 +01:00
Jeff Young cc64709407 Reimplement skip-parent-page to work with MacHack.
This prevents the "leaking" pages where the layers panel is shown
in the background of all other panels.

Fixes https://gitlab.com/kicad/code/kicad/issues/5182
2020-08-29 20:53:53 +01:00
Mark Roszko 1082402b33 Convert UNDO_REDO_T to an enum class 2020-08-26 18:04:32 +00:00
Jeff Young d1371e513d Make sure Gerber print options have a color settings.
We probably don't need it, but some code attempts to dereference
it so safer to have one then to start checking everywhere for
dereferences.

Fixes https://gitlab.com/kicad/code/kicad/issues/5353
2020-08-25 14:08:09 +01:00
Mark Roszko 89e74140eb Save file / window states for kicad project locally 2020-08-24 02:01:14 +00:00
Ian McInerney 92fd3d7119 Gerbview: Fix open menu items
These were broken due to a copy-paste error when rebuilding
the menu infrastructure.

Fixes https://gitlab.com/kicad/code/kicad/issues/5258
2020-08-19 11:35:00 +01:00
Ian McInerney e44c44f62c Update layer codes in gerbview to be correct
The worksheet now has its own layer code in GerbView for coloring,
so it must be referenced using that new code (otherwise an assert
triggers).
2020-08-18 19:27:41 +01:00
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00
Ian McInerney 4491f24d5e Ripout the old SyncToolbars infrastructure reminants
The tool framework no longer needs to request updates of the UI
state for the controls, wxWidgets will do it for us.
2020-08-16 19:10:26 +00:00
Ian McInerney fd4388710d Migrate eeschema, libview and libedit to the UI condition framework
Also, fix some issues in other frames identified along the way.
2020-08-16 19:10:25 +00:00
Ian McInerney 45fb030b9b Rename and shorten the names in ACTION_CONDITIONS 2020-08-16 19:10:25 +00:00
Ian McInerney 3b05d7cddd Move more frames to the new UI condition framework
* Frames moved: cvpcb, cvpcb footprints frame, gerbview, pagelayout editor

This also introduces new EDITOR_CONDITIONS that are used to set the
conditions of very common editor settings.

Also, some IDs were converted to tools in the pagelayout editor.
2020-08-16 19:10:25 +00:00
Ian McInerney d01e22232a Remove unused GerbView IDs for items that were already actions
All these IDs were for commands that have already been transitioned
to actions and there was no wxCommandEvent interface for them.
2020-08-16 12:37:51 +01:00
Ian McInerney 61cdf3436b Ensure PAINTER::Draw routines properly handle EDA_ITEM casting
EDA_ITEM is a child of VIEW_ITEM, so a static_cast is not appropriate,
since in some cases it could be called with a non-EDA_ITEM argument.
This was triggering an ASAN heap-buffer-overflow in GerbView.
2020-08-16 12:37:51 +01:00
Jon Evans bd14f8a82a ADDED: New appearance control widget for PcbNew
Featuring:
- Layer view presets
- Per-type opacity for tracks, vias, pads, zones
- Net and netclass color and visibility controls

CHANGED: Simplified object visibilty controls

Fixes https://gitlab.com/kicad/code/kicad/-/issues/1951
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1981
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2003
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2173
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2254
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4325
2020-08-15 15:24:28 -04:00
PJM e28c882ce2 GerbView #4872 : Map loaded X2 Gerbers or Gerbers using KiCad naming conventions when exporting to Pcbnew
This Merge Request creates a function called 'findKnownGerbersLoaded()'.  That function in turn
calls the existing 'findNumAltiumGerbersLoaded()' and two new functions:

findNumX2GerbersLoaded()
findNumKiCadGerbersLoaded()

This approach allows a single call to detect Altium/Protel Gerbers, X2 Gerbers, and Gerbers using
KiCad naming conventions.

If it's desired to add detection of Gerbers from other EDA programs, new functions can be written
and then called from 'findKnownGerbersLoaded()'.

Fixes issue https://gitlab.com/kicad/code/kicad/-/issues/4872
2020-07-29 16:45:04 +00:00
PJM 4d2bc1fa54 GerbView #2501 - Add mirror display function to GerbView
Adds the ability to flip (mirror) the display, just like "Flip
Board View" does in Pcbnew.

Also added this to vertical toolbar since it's handy to not
have to go into the menu system to flip the display back and
forth.

Fixes issue https://gitlab.com/kicad/code/kicad/-/issues/2501
2020-07-25 21:20:07 -07:00
Simon Richter 95c2b261e8 Don't mandate ownership semantics in API
This API doesn't transfer ownership, so no smart pointers are required --
this just needlessly tightens requirements on the user of the interface.

(Fixes five instances of MSVC C26410 warning)
2020-07-26 02:45:27 +00:00
Peter Montgomery 33af2d9a95 Disable 'Get Stored Choice' button when no choices have been stored 2020-07-24 22:22:38 +00:00
Peter Montgomery 5fd7064f76 Add Gerber filename to 'Select Layer:' dialog
The 'Select Layer:' dialog pops up directly over the dialog with the loaded
Gerbers and hides all Gerber file names.  This is just an aid so users remember
exactly which Gerber layer they're working on without having to move the dialog.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4893
2020-07-22 02:03:43 +00:00
Mark Roszko 3b727b5d16 Make preference groups not selectable 2020-07-20 13:45:46 +00:00
Ian McInerney 7b705af038 Refactor common QA components to create a single common library
This moves the program-specific code (e.g. BIU files) into
the program tests.

Also, create title_block.cpp to break a dependency that pulled
in eda_text.cpp when using the TITLE_BLOCK object.
2020-07-18 16:21:15 +01:00
Jeff Young 3fd0a3f842 Update text variables even when they're changed from other binary.
For instance, you might have PCBNew open but change the variable
value through EEschema > Schematic Setup.

Fixes https://gitlab.com/kicad/code/kicad/issues/4918
2020-07-17 21:05:11 +01:00
Seth Hillbrand 7f991ce855 Revert "Set DoubleBuffering to reduce flicker"
This reverts commit 106259f6e6.
2020-07-13 20:23:12 -07:00
Seth Hillbrand e19a7910f8 Revert "Revert "Set DoubleBuffering to reduce flicker""
This reverts commit c18cab6154.
2020-07-13 20:19:10 -07:00
Seth Hillbrand c18cab6154 Revert "Set DoubleBuffering to reduce flicker"
This reverts commit 106259f6e6.

In its place, we set double buffering to only menubars in an attempt to
find a soluton to #4785

Fixes https://gitlab.com/kicad/code/kicad/issues/4863
2020-07-11 09:43:30 -07:00
Peter Montgomery 73168a9405 Gerbview: Keep existing layer selected if user clicks Cancel on 'Select Layer' dialog
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4752
2020-07-11 09:40:46 +00:00
jean-pierre charras a1a8eca844 Gerbview: fix crash in LAYERS_MAP_DIALOG when trying to use a stored choice,
if no choice exists (new install for instance)

Fixes #4862
https://gitlab.com/kicad/code/kicad/issues/4862
2020-07-11 09:36:59 +02:00
Seth Hillbrand 106259f6e6 Set DoubleBuffering to reduce flicker
This sets double buffering for GTK and MSW to minimize flicker when
redrawing window elements.

Fixes https://gitlab.com/kicad/code/kicad/issues/4785
2020-07-10 09:29:42 -07:00
jean-pierre charras ef0ae8a8ee Gerbview: show a message instead of an error when trying to open a job file as plot file.
Fixes #4844
https://gitlab.com/kicad/code/kicad/issues/4844
2020-07-10 14:20:35 +02:00
jean-pierre charras 8c15ecf8e4 Gerbview: fix issues when setting the grid color and the worksheet color.
The issue for the grid color was due to the fact there are 2 places to
store the color: the color settings and the m_gridColor GERBVIEW_FRAME member.
The worksheet color (color set to RED after a color change in layer render)
is a bit strange: looks like LAYER_GERBVIEW_WORKSHEET and LAYER_WORKSHEET
are both used to draw the worksheet.
2020-07-08 18:49:12 +02:00
Ian McInerney 4fe4870d86 Gerbview: Empty highlight menu before building the new menu
Fixes https://gitlab.com/kicad/code/kicad/issues/4716
2020-07-07 23:12:17 +01:00
Tomasz Wlostowski c1d5394e46 properties: post-rebase fixes 2020-07-05 22:44:38 +02:00
PJM 06599d8d46 GerbView issue #4729 : Map loaded Gerbers with Altium file extensions to matching KiCad layers when exporting to PCBNew 2020-07-04 15:12:49 -07:00
Peter Montgomery 3c0de2b542 Gerbview: Set 'Do Not Export' as default for all layers when exporting to PCBNew
CHANGED: Gerbview to Pcbnew export now defaults to setting all layers to Do Not Export

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4753
2020-07-04 01:21:24 +00:00
Jeff Young 7b042f4a75 Add rectangle tool to PCBNew toolbar in favour of Aux Origin.
ADDED new rectangle graphics tool for PCBNew and Footprint Editor.

Also adds rectangle tool to both Footprint Editor and PCBNew Place
menus.

The Aux Origin tool can come back once we have multi-select toobar
buttons.

Also collapses an unnecessary level out of the auxOrigin and gridOrigin
settings.

Fixes https://gitlab.com/kicad/code/kicad/issues/2246
2020-07-01 13:31:30 +01:00
Ian McInerney 659c0ecfcc Gerbview: Fix print toolbar button
Fixes https://gitlab.com/kicad/code/kicad/issues/4762
2020-06-30 15:38:21 +01:00
jean-pierre charras f420396990 Cleanup a change I made for debug purposes for commit cd2dea7 2020-06-28 08:11:54 +02:00
jean-pierre charras cd2dea7df2 Gerbview: fix issues (crash) after commit fb10406e
The m_auxiliaryToolBar manage controls, not tools, and controls need specific
management after a wxToolbar->Clear() call.
wxToolbar->Clear() does not delete controls, but stop their management.
2020-06-27 20:35:54 +02:00
Ian McInerney fb10406e67 Add right-click context menus for toolbar items 2020-06-26 21:29:03 +00:00
Ian McInerney 52856a8ce4 Move scaled toolbar separator into ACTION_TOOLBAR
* Ensure all separators are scaled separators
* Clean up toolbar creation functions
2020-06-26 21:29:03 +00:00
Jeff Young ad12c42e8b Push grid settings dialogs down into common.
This also gives support for fast grid switching and a user grid
to eeschema.

Fixes https://gitlab.com/kicad/code/kicad/issues/2200
2020-06-14 19:26:37 +01:00
Jeff Young c48f4272f3 Collapse a level out of the zoom settings.
The APP_SETTINGS_BASE now holds the list of zoom factors, and
the old legacy (screen-based) code has been removed.
2020-06-13 22:44:16 +01:00
Jeff Young f84406009b Push a couple of layers of indirection out of grid settings. 2020-06-13 11:35:56 +01:00
Ian McInerney 9d0ea66a96 Don't use the accelerator table in the menubars
It seems that the accelerator table causes issues with
keyboard events on MSW.

Fixes https://gitlab.com/kicad/code/kicad/issues/1941
2020-06-06 22:50:35 +00:00
Jeff Young 39d4e422ea Better approximation for pads in Export Gerber to Pcbnew
We can't get all the way there because we can't create pads outside
of modules and the Gerbers don't store any grouping/footprint info.
This change moves us from outputing a via for every flashed item
(some of which don't even have holes) to synthesizing pads from
flashed items using a via (when they have holes) and a copper polygon.

This is much better for SMD pads, perhaps better for regular pads,
and no worse for vias.
2020-06-06 16:38:14 +01:00
Jon Evans a52435bbb0 ADDED: New mouse settings panel, expanded mouse settings
You can now choose the behavior of dragging with the
middle and right mouse buttons.

You can also choose which modifier keys to use for
panning and zooming with the scroll wheel or trackpad.

You can also customize the zoom speed, which makes
it possible to have a good zoom experience on a wider
range of input devices.

You can also now zoom by dragging with the right or
middle button if desired.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/3885
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4348
2020-05-24 14:38:28 -04:00
Jeff Young 2043c8da8f Fix handling of flashed items in Gerber export to Pcbnew. 2020-05-20 19:50:39 +01:00
Ian McInerney 2bc57ade28 Cleanup parentage inside the draw panels 2020-05-20 02:23:46 +01:00
Ian McInerney 613c020920 Move the file history into the frames 2020-05-17 00:12:49 +01:00
jean-pierre charras 54caebb04a Fix translation issues and a typo 2020-05-06 20:41:29 +02:00
Jon Evans 528ebf8d7d Don't try to close empty polygon
Fixes #4337
2020-05-06 11:51:12 -04:00
Ian McInerney e4b6487fca Overhaul compiler warnings infrastructure
* Track our warnings separate from normal flags
* Remove all warnings from the SWIG code
* Add more GCC warnings
2020-05-06 01:47:20 +01:00
Jeff Young 67bccaf465 Make indeterminate control states clearer for the user.
Fixes https://gitlab.com/kicad/code/kicad/issues/4313
2020-05-05 20:26:51 +01:00
Jeff Young ed3e366715 Actionize Gerber file commands.
Fixes https://gitlab.com/kicad/code/kicad/issues/2408
2020-05-03 23:02:24 +01:00
Jeff Young b8e0b9759a Don't reset active layer to 0 after loading Gerber job file.
Fixes https://gitlab.com/kicad/code/kicad/issues/3388
2020-05-03 22:01:39 +01:00
Jeff Young cf7ffda5f6 Performance improvements for Gerber loading.
The entire issue (at least on OSX) was the layers palette.  Go
figure.

Fixes https://gitlab.com/kicad/code/kicad/issues/1892
2020-05-02 21:10:40 +01:00
Ian McInerney 99dcadf7e6 Introduce new KI_FALLTHROUGH macro
Annotate purposeful fallthroughs in switch statements with the
KI_FALLTHROUGH macro.
2020-04-25 00:44:09 +01:00
Jeff Young 1535c83b88 Lay some groundwork for adding distances to DRC errors.
modified:   eeschema/lib_rectangle.cpp
2020-04-24 14:46:22 +01:00
Ian McInerney 3b67e3d0a4 Rewrite window positioning logic
Now only reposition a window if it is completely on a
disconnected display or if only one corner is on screen
and it is within a region close to the screen border.

CHANGED: Window position on startup should be preserved more
2020-04-18 00:47:38 +01:00
jean-pierre charras 9e656fe5eb Gerbview: fix incorrect rendering of oval vertical standard aperture with hole.
Fix also incorrect display of dcode size in toolbal: was Y size  X size.
Now is X size Y size, as expected.
2020-04-10 16:02:15 +02:00
jean-pierre charras 4bfd5f8197 typo 2020-04-10 13:41:33 +02:00
jean-pierre charras d146839f0f Gerbview: add a error message for invalid files missing G74 or G75 commands.
They are mandatory to read arc coordinates.
2020-04-10 12:57:29 +02:00