Compare commits

...

383 Commits

Author SHA1 Message Date
jean-pierre charras 2758acfd42 Fix compatibility with some old V4 schematic files.
From master branch, commit #bfe59581
2021-12-01 13:45:05 +01:00
jean-pierre charras 54c3031d74 Zone fill: When using the fillet outline option, in some cases the shape is strange.
Due to some bug in Fillet() incorrect zone outline happens in (rare) polygon shapes.
So clip it with the initial polygon (aSmoothedPoly must be contained in m_Poly)
Fixes #9692
https://gitlab.com/kicad/code/kicad/issues/9692
2021-11-19 13:55:05 +01:00
Christoph Moench-Tegeder 9a9c7856b3 Adapt OCE 3D plugin to OpenCascade 7.6.0 (for KiCad 5.1)
In line with
https://dev.opencascade.org/doc/overview/html/occt__upgrade.html#upgrade_occt760_poly
the Poly_Triangulation does not provide direct access to the internal
arrays anymore - use the accessor functions instead.
To keep changes minimal, switch only builds with a new (7.6+)
OpenCascade to the new API and keep everything else the same.

Related: !1013
2021-11-17 23:41:56 +01:00
Wayne Stambaugh 401b2fb524 Fix broken search stack behavior.
The overload of wxFilePath::FindValidPath() broke the normal behavior
when the file searched for existed in the current working directory.
This was causing the initial library table file to be copied from the
current working directory instead of from the list of search paths.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9599

(cherry picked from commit f4b97eca63)
2021-11-13 08:43:25 -05:00
Wayne Stambaugh 0a0a2da680 Begin version 5.1.13 development. 2021-11-04 17:24:40 -04:00
Wayne Stambaugh e4df76d986 Tag release version 5.1.12. 2021-11-04 16:41:52 -04:00
jean-pierre charras 79028f1627 Handle mandatory fields name translated and not translated in SCH_COMPONENT::GetFieldText.
Fixes #9520
https://gitlab.com/kicad/code/kicad/issues/9520
2021-11-04 18:17:51 +01:00
jean-pierre charras d87e5cb809 Revert "Revert "Apply WX_LOCALE change from master branch.""
This reverts commit 3484334d15.
2021-11-04 16:47:10 +01:00
Seth Hillbrand 3484334d15 Revert "Apply WX_LOCALE change from master branch."
This reverts commit 8e9e1a618b.
2021-11-03 15:12:37 -07:00
Wayne Stambaugh 9ab6571b3f Begin version 5.1.12 development. 2021-10-27 21:33:13 -04:00
Wayne Stambaugh dad5600e7e Tag release version 5.1.11. 2021-10-27 13:53:49 -04:00
Seth Hillbrand ee56d58173 Don't raise an error for valid microvias
When the layers are adjacent, the microvia is _probably_ valid.  This is
not the case when trying to run a microvia through the core material but
without stackup information, we cannot be certain.

Note that microvias are not required in current manufacturing techniques
to be blind.

KSC Issue '400'
2021-10-27 10:52:25 -07:00
Wayne Stambaugh 9f8f2a2449 Revert "Tag release version 5.1.11."
This reverts commit f591534a0f.
2021-10-27 13:50:01 -04:00
Wayne Stambaugh f591534a0f Tag release version 5.1.11. 2021-10-26 14:51:40 -04:00
Wayne Stambaugh 7a2e0c6632 Remove old domain name from developer documentation. 2021-10-26 14:49:50 -04:00
Wayne Stambaugh 29519c5fda Revert "Tag release version 5.1.11."
This reverts commit 4c58397949.
2021-10-26 14:45:17 -04:00
Wayne Stambaugh 4b996f6bbe Revert "Begin version 5.1.12 development."
This reverts commit e4a5bfc788.
2021-10-26 14:44:41 -04:00
Wayne Stambaugh e4a5bfc788 Begin version 5.1.12 development. 2021-10-26 07:55:07 -04:00
Wayne Stambaugh 4c58397949 Tag release version 5.1.11. 2021-10-26 07:23:58 -04:00
Mark Roszko 011b4027db Add vertexIndex bounds check 2021-10-23 15:46:58 +00:00
Seth Hillbrand a1adc59cb8 Remove all references to old website
The kicad-pcb.org website is no longer valid
2021-10-18 15:47:01 -07:00
Johannes Maibaum ee4a8fc05a kicad-pcb.org->kicad.org in kicad.appdata.xml.in
kicad-pcb.org seems to cause TLS handshake errors recently.
As kicad.org is now the official domain, switch all uses of
kicad-pcb.org to kicad.org in kicad.appdata.xml.in.
2021-10-18 22:19:34 +02:00
Adam Wolf 420a3ce498 On macOS, copy libngspice dylibs and symlinks
Now that ngspice creates soversion'ed libraries, we need to tweak
how we copy the dylibs around.

This is meant to address
https://gitlab.com/kicad/code/kicad/-/issues/9143.

(cherry picked from commit ec10b12c6a)
2021-10-15 10:40:13 -07:00
Wayne Stambaugh 9b6798c479 Eeschema: yet another attempt to fix network share editing performance.
Root out a few other areas where the hierarchy integrity test was being
performed while editing where it wasn't required.
2021-10-07 07:22:50 -04:00
Wayne Stambaugh 765816ccb1 Eeschema: fix lag on network shares when duplicating and copying objects.
The delay was due to recursion checks being performed every time a new
SCH_SHEET_LIST object was created.  The fix was to back port the optional
integrity check flag added from master.  It's similar to commit 63a0f537
by Jeff Young but it could not be cherry-picked due to the changes in
master branch.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9278
2021-10-04 16:34:30 -04:00
Seth Hillbrand f3e9e3497b Cherry-picking some external run routines
Mostly from c6bcb85562 but trees have
diverged sufficiently that there are others mixed in.  This removes the
system() call on MacOS when opening a directory
2021-09-29 11:32:25 -07:00
jean-pierre charras 8e9e1a618b Apply WX_LOCALE change from master branch.
See master branch, commits 0cf81b6 and b065ff3
2021-09-29 16:54:07 +02:00
jean-pierre charras 7272020cd3 fix use of a non const method in a const method ( from master branch) 2021-09-14 14:33:40 +02:00
jean-pierre charras 16fff71c31 Gerbview: fix incorrect bounding box of lines drawn with a rectangular aperture.
See master, commit 5abe25
2021-09-14 10:50:51 +02:00
jean-pierre charras 190223949c Gerber files: fix incorrect FileFunction attribute value for F.Fab and B.Fab layers. 2021-09-01 11:17:05 +02:00
jean-pierre charras 38d463ae49 Apply commit ddba9e2 from master: fix of not updating spice primitive field 2021-08-31 11:07:37 +02:00
jean-pierre charras 73193196d2 Cvpcb: fix possible crash when pressing the ESC key during some calculations.
From master branch, commit b1c67d9
2021-08-28 15:58:04 +02:00
Jeff Young 2975e85950 Add (a somewhat hacked) future format error for page layout files. 2021-08-27 13:16:22 +01:00
Seth Hillbrand b2fbf982a8 Don't use REALPATH to find shared/dynamic libraries
We require API compatibility in the ngspice library because we
dynamically load the library and assign function pointers to specific
names/signatures.  This should be consistent for all versions of the the
library until the soversion changes.

Fixes https://gitlab.com/kicad/code/kicad/issues/8878

(cherry picked from commit 17a17586a6)
2021-08-24 11:46:03 -07:00
Jeff Young 0843fbf904 Fix nullptr dereference.
Fixes: lp:8996
* https://bugs.launchpad.net/kicad/+bug/8996
2021-08-19 11:59:07 +01:00
jean-pierre charras 8dab9041e4 Gerbview, Excellon reader: use Leading Zeros format when not specified in file.
Some very poor files do not specify the coordinates format.
In this case, the default is INCH,LZ that looks like the more usual.
From master branch, commit b1fd462
2021-08-01 16:08:28 +02:00
jean-pierre charras 6aed98f795 Gerbview, Excellon reader: fix incorrect size of tools when the size is embedded.
From master branch, commit 70b5e26.
2021-08-01 10:26:23 +02:00
jean-pierre charras c20a76f3e2 Fix Python consoles cannot be created.
Fixes #8899
https://gitlab.com/kicad/code/kicad/issues/8899
2021-07-31 16:46:27 +02:00
Seth Hillbrand 435b1720c3 Prevent help() from blocking terminal
Ensures that the pydoc pager gets re-directed to the PyShell.  Also
keeps a copy of stdin to prevent closure in case of re-assignment

Fixes https://gitlab.com/kicad/code/kicad/issues/8047
2021-07-12 16:52:52 -07:00
Wayne Stambaugh 22bdf37fc2 Fix SPICE simulator plot bug.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1944
2021-07-09 16:44:23 -04:00
Ian McInerney 9e3ac0eafb Don't install the import library for the 3dsg library
No one on Windows should be linking to it outside of
the build process, so there is no need for it in the
installer

Fixes https://gitlab.com/kicad/code/kicad/issues/1842


(cherry picked from commit 3bb44f3804)
2021-07-01 19:31:46 +00:00
Wayne Stambaugh 5c1c24cdab Pcbnew: fix footprint selection bug.
Do not remove footprint objects from list of selected objects when there
are no drawable objects other than the reference and value text.

Increase the minimum size rectangle for footprints from 0.025mm to 1mm
when the footprint has no drawing objects so that it is easier to select
the footprint in this case.

Add debugging code to show the footprint bounding box and polygon outline
so that it's possible to tell the difference between selection areas.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8379
2021-06-24 14:13:30 -04:00
jean-pierre charras c9cc824761 Footprint editor: fix broken mirroring of custom pad shapes.
Fixes #8649
https://gitlab.com/kicad/code/kicad/issues/8649
2021-06-23 16:31:18 +02:00
Eeli Kaikkonen b3c1e0330a OCC is the default cmake flag instead of OCE.
(cherry picked from commit 168a21bb43)
2021-06-16 12:47:58 -04:00
jean-pierre charras 4506fb2022 Fix not initialized var (m_HoleToHoleMin) in DRC when starting Pcbnew in stand-alone. 2021-06-16 11:44:02 +02:00
jean-pierre charras ecec324121 Fix a link issue created by fix 959b33c, on Linux.
Fixes #8475
2021-05-25 08:59:44 +02:00
jean-pierre charras 959b33c59b Footprint editor: fix incorrect "Zoom to Fit" when the F.Cu layer is not shown.
Fixes #8420
2021-05-14 15:30:38 +02:00
Wayne Stambaugh d6646c34ef Eeschema: fix BOM path bug in stand alone mode.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8180
2021-05-07 15:44:21 -04:00
Wayne Stambaugh b56ac54cb2 KiCad: don't rename page description file on new project from template.
Doing so will break the link in the schematic and/or board file so copy
page description file(s) verbatim to the new project folder.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6524
2021-05-05 07:39:22 -04:00
Mark Roszko 5bc47a0c3b Write xml netlists explicitly via wxFFileOutputStream for performance
Fix #6944
2021-05-03 23:13:38 +00:00
Wayne Stambaugh f2db83008a Begin version 5.1.11 development. 2021-04-23 13:47:08 -04:00
Wayne Stambaugh 9a01cf1b35 Tag release version 5.1.10. 2021-04-23 13:42:36 -04:00
Seth Hillbrand 0f6f30b26e Ensure collapsed tree before update
We had been maintaining the tree collapse state for "clear" actions
where the user went back to no object search.  This was helpful in the
case where we had previous items (e.g. last placed element)

But this causes isses when a sub element was previously select on GTK.
Now we choose safety for GTK over the pretty display

Fixes https://gitlab.com/kicad/code/kicad/issues/8198
2021-04-20 11:50:08 -07:00
Marek Roszko 8219334806 Fix wrong offset in msys2 x64 libcontext implementation not saving fiber data pointer
This should have/may have been causing random crashes on calls into win32 api.
fiber data is located at offset 0x20 of the stack not 0x18.
2021-04-12 19:11:44 -04:00
Wayne Stambaugh e6997d87b3 Eeschema: fix zero length line segfault.
Clear the current draw item when line segment clean up results in no lines.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8175
2021-04-12 14:41:52 -04:00
jean-pierre charras 13b453c21e PDT plotter: fix incorrect header (from Master branch) 2021-04-06 11:34:52 +02:00
Seth Hillbrand 4ec3f18fda Return wxString for gfx importer messages
Returning a reference to a temporary value crashes when the value is
deallocated before use.  Passing a full string fixes the crash and
allows NVRO on the temporary value.
2021-04-04 06:20:14 -07:00
Jon Evans fc8ffd8421 Disable Cairo canvas for Mac
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7052
2021-04-02 18:50:21 -04:00
Seth Hillbrand 4551651777 Fix empty translated string 2021-04-02 11:12:39 -07:00
Marek Roszko 82f2e8c344 More gracefully handle tinyspline not liking a spline definition
Partial fix for #6634

(cherry picked from commit e409b04538)
2021-04-02 09:41:22 -07:00
jean-pierre charras b76c5c9433 Drill map report: use more digits in float values for diameters. 2021-03-29 11:21:24 +02:00
Jon Evans 1737927814 Fix cherry-pick error 2021-02-17 08:12:05 -05:00
Graham Keeth 38d7ac6d9c Add BOM file extension to BOM plugin command line
Attempt to parse BOM output file extension from BOM plugin header, and
append it to the "%O" argument in the BOM plugin command line.

Fixes #6943

(cherry picked from commit f54ab830f6)
2021-02-11 21:19:31 -05:00
Seth Hillbrand db1bf4351b Fix GTK crash when multiple libraries are expanded
Once more into the gtk_tree_view breach.

This may also be related to https://gitlab.com/kicad/code/kicad/-/issues/7344

Fixes https://gitlab.com/kicad/code/kicad/issues/7422

(cherry picked from commit 4657ca5d4f)
2021-02-08 14:36:08 -08:00
Seth Hillbrand 2d491f9cbd Update multi-unit symbols uniquely
This updates multi unit symbols uniquely even when the schematic is
unannotated (and therefore there are multiple symbols with the same
reference).  We attempt to enfore a single unit update per symbol and
test for both value and reference commonality before assuming that the
unit is part of the larger multi-unit symbol

Fixes https://gitlab.com/kicad/code/kicad/issues/7117
2021-01-14 14:52:55 -08:00
Johannes Maibaum a58d0f8a67 Add diode model to rectifier demo (ngspice-32 fix)
Patch by Holger Vogt

Fixes https://gitlab.com/kicad/code/kicad/issues/4453
2021-01-14 20:24:36 +01:00
Johannes Maibaum 42cd6ca4ca Fix screenshot sizes in kicad.appdata.xml.in 2021-01-13 18:14:33 +01:00
jean-pierre charras f292f1628b Spice sim: fix incorrect (very large) dialog size displaying the netlist.
It was previously fixed to 1500x900 pixels, that can be too large.
The window size and position is also now retained during a session.
From master branch, commit 60152bc
2021-01-11 10:55:51 +01:00
Seth Hillbrand 20909d4948 Fix crash when deleting symbol in GTK
So many things can go wrong with this control in GTK.  We have to
collapse the tree when updating the search string to avoid a crash when
referencing a child object but collapsing the tree will iterate over
elements and crash when we have deleted a symbol.

The temporary fix for this nonsense is to carefully order the calls.
We only need to collapse the search tree if we are not keeping our state
(in other words if we are fully re-building the tree)

Fixes https://gitlab.com/kicad/code/kicad/issues/6910

(cherry picked from commit 8af4cf88a0)
2021-01-04 09:38:51 -08:00
Jeff Young 1f6ff4a519 Fix access into empty container.
Fixes https://gitlab.com/kicad/code/kicad/issues/6840

(cherry picked from commit 359c29639f)
2021-01-04 09:26:01 -08:00
jean-pierre charras 07568f87c3 Step exporter: better values for min distance between 2 points to merge them.
- The default value is 0.01 mm (according to comments and similar to the 3D viewer
 settings that uses 0.02 mm)
- The export dialog  has now 3 values 1 micron, 0.01mm (default) and 0.1 mm

From Master branch, commits a9feb1c and 5db7580
2021-01-03 14:52:42 +01:00
Mikołaj Wielgus 267e510071 Update PCBMODEL::SetMinDistance to set BRepBuilderAPI precision
Fixes #3818
2021-01-03 13:39:38 +01:00
Marek Roszko 73b921d591 Correct assembly opcode 2021-01-02 16:20:50 -05:00
Marek Roszko 8677035989 libcontext: Call exit instead of random memory address on MSW x86_64
cherrypick of 580293c7fa

See #6820
2021-01-02 16:18:10 -05:00
jean-pierre charras a179893d70 specctra_export: fix an issue with custom pads.
From Master, commit 686254.
In some cases a created pad stack name had the same name as an other pad stack
having a slightly different shape, thus creating pads with a incorrect shape on board.

Fixes #6495 for the 5.1.10 branch.
2020-12-29 17:41:36 +01:00
Jan Mrázek 540fb91d34 Backport 93466fa1: Fix crash when adding 3D Models via Python 2020-12-28 23:22:16 +01:00
Wayne Stambaugh 591a07d2d9 Begin version 5.1.10 development. 2020-12-22 15:09:32 -05:00
Wayne Stambaugh f607e913d5 Tag release version 5.1.9. 2020-12-22 15:05:01 -05:00
jean-pierre charras 3d57de91e8 SCH_SHEET::SearchHierarchy(): fix an issue when comparing file names.
We are using the unix separator in filenames in all platforms.
However on Windows some filenames can contain native separators.
We now ensure all filenames use the unix separator before comparison.

Fix #6742
2020-12-20 14:32:25 +01:00
Marek Roszko 9fbceaa458 Nix another easily triggered infinite event loop on Windows
This infinite loop was triggered on any dynamic scaling change with KiCad open.
Either local display scale change OR Remote Desktop.
2020-12-19 17:07:22 -05:00
Jon Evans 281180512f Prevent refresh loops on GTK/MSW
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6787
2020-12-19 14:48:13 -05:00
qu1ck 50fa1937f9 Read fp-info-cache on first start of fp editor
if fp info list is not initialized
2020-12-19 00:48:42 -05:00
Jon Evans d79aee3f78 Fix refresh logic on MacOS to prevent excessive redraws
This new logic does not need to be MacOS-specific; it should
account for timer inconsistencies on any platform.

Thanks to Mark for the suggestions.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6222
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6332
2020-12-18 13:52:57 -05:00
jean-pierre charras f599185e2d fp editor: fix incorrect parent for a error message box
From master branch (commit b425889)
2020-12-17 11:25:12 +01:00
Wayne Stambaugh fd79c7ae46 Eeschema: fix assertion creating a new sheet.
Fixes https://gitlab.com/kicad/code/kicad/issues/6722
2020-12-16 16:21:15 -05:00
Marek Roszko 9de0846f3e Formatting
Because I can't use a real IDE with msys
2020-12-14 20:06:44 -05:00
Marek Roszko f168ece461 Disable the wxFileSystemWatcher on network shares
Fix #5740
Fix #4126

This is a stupid solution because SAMBA sends invalid events and wxWidgets decides to assert rather than ignore them.
Why can't people just use Windows Server shares :(
2020-12-14 20:02:18 -05:00
Ian McInerney 4100650ce1 Fix some new compiler warnings on GCC 10 2020-12-15 00:24:42 +00:00
Marek Roszko 87bb437fd3 Fix formatting 2020-12-14 08:28:57 -05:00
Marek Roszko 626c671448 Reset frame position when wxDisplay cannot find the matching display
Fix #6732
2020-12-14 08:28:04 -05:00
Wayne Stambaugh b532c4a2b8 Eeschema: fix overzealous save file update UI event handler.
Apparently wxFileName stats the file on Windows when using the == operator
which causes slow response when adding sheets in designs saved on remote
shares.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5596
2020-12-13 21:08:49 +00:00
jean-pierre charras 276cb7590d Gerber: speed up seriously solder mask creation.
Fixes https://gitlab.com/kicad/code/kicad/issues/6360
2020-12-13 18:53:17 +01:00
Marek Roszko f66aae2213 Fix flickering on msgpanel paints 2020-12-11 23:21:26 -05:00
Marek Roszko 17c4e21f34 Use a temp file for saving the fp-info-cache for now 2020-12-11 22:36:54 -05:00
Marek Roszko 3613bca5ea Read the fp-info-cache on pcb file load rather than on frame open
Otherwise in standalone mode pcbnew will never load the cache files and also later erase them :/
2020-12-11 22:36:47 -05:00
Marek Roszko eff9c46e59 Replace wxTextFile for writing fp info cache
wxTextFile uses wxFile which uses write syscalls which means its unbuffered.
This makes file IO more expensive against network shares where it will flush far too aggressively.
wxTextFile is fine for reads however.
2020-12-11 22:34:56 -05:00
jean-pierre charras c186a42a54 Replace wxFloatingPointValidator by our UNIT_BINDER in DIALOG_PAD_PROPERTIES.
the change is a try to fix an annoying issue (#6499 similar to #6670) we cannot
reproduce but is probably related to a locale issue.
2020-12-09 19:50:28 +01:00
jean-pierre charras 676d35f559 Replace wxFloatingPointValidator by our UNIT_BINDER in DIALOG_TEXT_PROPERTIES.
wxFloatingPointValidator has some limitations, but mainly the change is a try
to fix an annoying issue (#6670) we cannot reproduce but is probably related
to a locale issue.
2020-12-09 19:45:03 +01:00
Wayne Stambaugh e8bc4632b4 Minor dialog and other layout fixes.
* Fix clipped bitmap buttons.
* Remove colons from the end of wxStaticBoxSizer strings.
* Minor padding improvements.
2020-12-08 09:19:32 -05:00
Jeff Young 222158e954 Don't free part before removing from view. 2020-12-07 17:04:29 +00:00
Mark Roszko dde87b2f45 Prevent dxf imports of text from processing NaN coordinates 2020-12-05 01:55:39 +00:00
jean-pierre charras 789284f519 Pcbnew, modifiers for left click behavior.
Due to last changes fixing the ALT key problems, the highlight net is
CTRL+SHIFT + left click on Windows and Linux
CTRL+ALT + left click on OSX
Fix also a bad behavior of "remove from selection" left click option

Fixes #6599
https://gitlab.com/kicad/code/kicad/issues/6599
2020-12-04 12:05:46 +01:00
jean-pierre charras 19576ae167 Fix a compil issue 2020-12-04 10:44:23 +01:00
Mark Roszko be8fe7bdd6 Block off potential errant double activation of tree project items
Additional fix for #6606

Cherrypick from 535dbc1a06
2020-12-04 02:15:07 +00:00
Seth Hillbrand d7a6a2cc71 Fix locking scheme for double-clicks
In some cases, the events may be driven in the same thread, which can
lead to a deadlock.  Instead of waiting for the lock, simply refuse to
run if a loading system in in progress.

Fixes https://gitlab.com/kicad/code/kicad/issues/6606
2020-12-03 14:30:17 -08:00
Seth Hillbrand 7eea344f91 Fix/workaround GTK libtree issue with multi-unit symbols
When preparing for clearing the tree, GTK requires walking through
parents.  After calling "Freeze()" to protect against returning bad data
(see #6458 and #4471), we can no longer access Parent() from GTK and the
tree cannot be cleared.

The fix is to collapse the first element if it is open.  This prevents
the common case of the history elements being expanded in the tree

Fixes https://gitlab.com/kicad/code/kicad/issues/6102
2020-12-03 14:12:58 -08:00
Ian McInerney 2bd0b67591 Link kicad appdata with the desktop file
This link is needed to ensure appstream-builder finds
the icon for the program and includes it in the appstream
metadata for distribution software centers.

Fixes https://gitlab.com/kicad/code/kicad/issues/6593

(Cherry-picked from 9c968b0ef7)
2020-12-02 19:41:20 +00:00
Steven A. Falco d9307a174d Update desktop files, substituting Science for Development.
KiCad more properly fits into the Science and Engineering category.

(Cherry-picked from 675bb90128)
2020-12-02 19:40:58 +00:00
Seth Hillbrand 59c5b30f3f CMake adjust Linux build
Instead of linking the same target name and re-building, we can install
the file to a new name.  This speeds the build process and keeps linking
routines from stepping on each other.  Available now that we are at
CMake 3.0.2

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

(cherry picked from commit 51511eda85)

Fixes https://gitlab.com/kicad/code/kicad/issues/6576
2020-12-02 08:28:49 -08:00
Seth Hillbrand 938859f10a SPICE export full precision data
Saving csv files loses precision when time/data steps are smaller than
10^-6.  This switches to engineering notation when dealing with higher
precision.

Ref KiCad Services ticket 281
2020-11-30 13:26:10 -08:00
jean-pierre charras a9b53d94e8 Page layout editor: fix missing scrollbars in properties panel (GTK specific) From master branch 2020-11-30 20:24:47 +01:00
jean-pierre charras a33e2ed9b1 gendrill_file_writer_base: better algo to sort holes:
Holes were correctly sorted by size, but inside the same hole size
the holes were strangely sorted.
Now holes are sorted by hole size, and (inside the same size) by position.

From master branch
2020-11-30 20:22:30 +01:00
Wayne Stambaugh 7687ca2080 Pcbnew: change block selection and heuristic context menu modifier keys.
Do not use the alt modifier key to force the display of the heuristic
context menu.  This causes a conflict with menu selection on windows
and immediately dismisses the disambiguation context menu.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/1873
2020-11-30 11:47:15 -05:00
jean-pierre charras 2a1a6e8cbe From master branch: Make path substitutions grid read only in lib table dialog
From master branch, commit becc811.
2020-11-29 13:21:15 +01:00
jean-pierre charras 45fa9e8448 bitmap2component.cpp: ensure polygon calculation use PM_STRICTLY_SIMPLE option. 2020-11-29 13:18:01 +01:00
Steven Falco 0ca66d1af3 Add python 3.10 detection to CMake
(Cherry-picked from d85d0efdd8)
2020-11-28 22:28:10 +00:00
jean-pierre charras 63baa69342 Some fixes from master branch:
- fix environment variable changes after running Pcbnew in some cases.
- kicad manager: correct bitmap icon for gerber job files
- incorrect position of some checkboxes (not readable) when compiled with
wxWidgets 3.1.4
2020-11-21 15:56:54 +01:00
taotieren 894291faba Update Linux appdata file 2020-11-10 13:38:39 +00:00
jean-pierre charras 51708bab49 Gerbview, Legacy graphic mode: fix missing or incorrect inits related to zoom.
Fixes #6326
https://gitlab.com/kicad/code/kicad/issues/6326
2020-11-09 10:32:12 +01:00
jean-pierre charras 4497a754fb clear flags after a block placement (that previously leave moved item shown
in the selected state color)
2020-11-08 10:57:13 +01:00
taotieren 6223e7475c Add Simplified Chinese desktop file translations 2020-11-06 11:50:15 +08:00
Seth Hillbrand bf97378168 Don't allow selection of PCB_NETINFO_T
This is a version of master commit d9a94dc538
but that cannot be cherry-picked because it contains a number of
unrelated modifications

Fixes https://gitlab.com/kicad/code/kicad/issues/5729
2020-11-03 10:19:04 -08:00
Mark Roszko 5a6f291c72 Remove infinitely recursive loop on Windows (in special cases)
This looks like it was always intended for macOS but was accidentally changed for Windows as well.
If this is a requirement on windows, I'm sure theres better ways to fix it....

Cherrypick from 98ece9d
2020-11-02 13:45:14 +00:00
Roberto Fernandez Bautista 3404f4e86b Check GLEW functions exist before calling them
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6235
2020-10-30 19:45:33 +00:00
Roberto Fernandez Bautista 6c07ebe5f2 Combine return statements in OPENGL_GAL::CheckFeatures 2020-10-30 19:43:22 +00:00
Roberto Fernandez Bautista 24a4f06013 Fix OPENGL_GAL initialization sequence (Version for 5.1)
- New public static function OPENGL_GAL::CheckFeatures() gets called in EDA_DRAW_PANEL_GAL::SwitchBackend() before switching to OPENGL_GAL
- Moved all OpenGL feature checks from OPENGL_GAL constructor to OPENGL_GAL::init()

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4714
2020-10-30 17:38:19 +00:00
Seth Hillbrand 73bf4cbce7 Unselect and freeze before starting reset
In some cases, the BeforeReset() will cause an iteration over the tree
elements.  If we have deleted an element before doing this, we risk a
corruption/crash.

Fixes https://gitlab.com/kicad/code/kicad/issues/6192

(cherry picked from commit 3bd080b64e)
2020-10-30 10:00:36 -07:00
Wayne Stambaugh 67c8071bf4 Begin version 5.1.9 development. 2020-10-30 08:37:55 -04:00
Wayne Stambaugh 9b163cb444 Tag release version 5.1.8. 2020-10-28 15:28:02 -04:00
Wayne Stambaugh 83d6a77617 Eeschema: fix symbol rescue bug.
Loading the schematic symbol preserves the invalid LIB_ID characters in
the symbol name.  Unfortunately, loading the library symbol automatically
fixes the invalid characters so this caused the symbol rescue to not find
library symbols with invalid characters.  Replacing the invalid characters
in the schematic symbol name during rescue fixed the issue.  This fix
isn't perfect because there is the off chance that replacing the invalid
characters could lead to a name clash in the library resulting in the
incorrect symbol to be rescued.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2319

(cherry picked from commit d90d734166)
2020-10-28 09:45:27 -04:00
Marek Roszko e5e174a20e Avoid 3d viewer stealing back focus/activation
Fix #6184
2020-10-27 19:41:14 -04:00
Seth Hillbrand 8aede85214 Correct freeze ordering in lib_tree_model
Adapts the BeforeReset()/AfterReset() logic to the 5.1 branch

Fixes https://gitlab.com/kicad/code/kicad/issues/6102
2020-10-26 11:28:58 -07:00
Seth Hillbrand c625b9e3cc Remove errant printf
(cherry picked from commit cce11e40a1)
2020-10-23 14:47:39 -07:00
Seth Hillbrand 222d44a8d8 Fully freeze tree GUI
This is the v5 analog of 0d6684bdf

Fixes https://gitlab.com/kicad/code/kicad/issues/6102
2020-10-23 12:35:14 -07:00
Seth Hillbrand 386f827d38 Be diligent in our search for color information
Just because we find a label reference does not mean that is where the
color is stored.  We do an exhaustive search through the hierarchy for
the correct color data

Fixes https://gitlab.com/kicad/code/kicad/issues/6107

(cherry picked from commit 75c2d1a0bf)
2020-10-23 12:13:34 -07:00
Marek Roszko 831c51c875 Launch tools from Idle in the kicad manager.
Launching on a control event can allow that control to steal focus from the new windows as more events may exist intended for the control.

Fix #4479
2020-10-17 00:58:17 -04:00
Marek Roszko 2d25d37112 Fix focus theft, Windows sends mouse events to windows regardless of focus.
We need to check if the window is foreground before fight over focus which will make the window foreground if it wasn't.

Fixes #4099
Fixes #5958
2020-10-17 00:53:26 -04:00
Mark Roszko a3172d643f Add wxTimer stallout fix to tool dispatcher 2020-10-15 04:51:07 +00:00
Seth Hillbrand 02787784a4 Bump OCE Plugin version
We modified how we search for color information.  Changing the version
data will for models to reload instead of keeping the cached data with
(possibly) missing color information

(cherry picked from commit b51ca1ab0e)
2020-10-14 08:49:46 -07:00
Seth Hillbrand 967f390aec Seach full model for color information
Assemblies may not have their face information in the top level of the
file.  Search recurses to get the explicit shape in sub assemblies as
well.

Fixes https://gitlab.com/kicad/code/kicad/issues/5163

(cherry picked from commit a2168c6add)
2020-10-14 08:49:18 -07:00
jean-pierre charras 89951b01ff Fix incorrect vertical position of check boxes in some wxGrid on wxWidgets 3.1.4.
Fix also 2 compil warnings.

These fixes come from the master branch
2020-10-04 09:55:09 +02:00
Wayne Stambaugh ca8f026bc3 Begin version 5.1.8 development. 2020-09-25 16:06:11 -04:00
Wayne Stambaugh 4c14d7ef5a Tag release version 5.1.7. 2020-09-25 15:49:58 -04:00
Seth Hillbrand 8234c20e28 Remove threading from Python wrapper
Python threading can cause issues with zone filler, connectivity
calculations and many other parts.  This forces the emitted code to hold
the GIL when running.

Fixes https://gitlab.com/kicad/code/kicad/issues/4436
2020-09-15 17:11:12 -07:00
jean-pierre charras 52e272954f Fix a DRC crash if a zone is flagged as filled but has 0 filled areas
Fixes #5631
https://gitlab.com/kicad/code/kicad/issues/5631
2020-09-15 14:18:23 +02:00
Seth Hillbrand 77caf50265 Remove OGLTest
We don't use this utility nor do we have plans to

(cherry picked from commit de12d40ee6)
2020-09-12 06:49:51 -07:00
jean-pierre charras 2ab8751fd4 Drill files export: ensure the Top to Bottom PTH drill file is always created,
even if there are no hole. NPTH file is already always created.

From Master.

Fixes #5566
https://gitlab.com/kicad/code/kicad/issues/5566
2020-09-10 17:04:01 +02:00
jean-pierre charras 54589c0828 FOOTPRINT_WIZARD_FRAME::ParametersUpdated(): fix a reentering issue
On wxWidgets 3.0.5, in some cases calling ReCreateParameterList() generates
a EVT_GRID_CMD_CELL_CHANGED that call ParametersUpdated()
and creating an infinite loop
Note also it happens **only for languages using a comma** instead
of a point for floating point separator
It does not happen on wxWidgets 3.1.4

From master branch
2020-09-08 19:02:17 +02:00
Seth Hillbrand 1fdb247167 Reverts premature Python 3 calls in favor of backwards compat.
This reverts commits d8d8f4f670
and 9614f6d0d9.

(cherry picked from commit 91914f1a71)
2020-09-03 20:06:28 -07:00
Wayne Stambaugh 49cc47afd1 Eeschema: fix broken new sheet path comparison on windows.
Using wxFileName::GetPath( wxPATH_WITH_SEPARATOR ) does not include the
drive specifier (A:, B:, C:, etc.) on windows which fails the comparison
with the project path 100% of the time.  wxFileName::GetPathWithSep()
solves the issue nicely.

Fixes https://gitlab.com/kicad/code/kicad/issues/5077

(cherry picked from commit 03423f13a1)
2020-09-03 14:26:31 -04:00
Wayne Stambaugh 673677c831 Eeschema: fix segfault when auto save file is detected.
Fixes https://gitlab.com/kicad/code/kicad/issues/5068
2020-09-01 10:29:06 -04:00
Ian McInerney c30dc04571 Skip the slider event to allow the stepping to work
The stepping is in a static event handler, so it is called
after the dynamic handler and so the dynamic handler must
allow the event to continue processing.

Fixes https://gitlab.com/kicad/code/kicad/issues/5319
2020-08-29 23:32:11 +01:00
Ian McInerney f58de79ceb Provide a checkbox to use negative coordinates in the position file
ADDED: A checkbox to allow selection of positive/negative X coordinates
for bottom components.

Fixes https://gitlab.com/kicad/code/kicad/issues/4638
2020-08-29 23:17:29 +01:00
Seth Hillbrand 8d9bb7a63e libedit: Unselect before re-syncing
The library alias may change so we need to ensure that the underlying
selected lib_id is not maintained across regenerations.

Fixes https://gitlab.com/kicad/code/kicad/issues/5144
2020-08-26 10:10:43 -07:00
Marek Roszko 18490162f7 Use a local tmp file for plotting
Fix #5238

(cherry picked from commit de7a1b647c)
2020-08-20 15:28:18 -07:00
jean-pierre charras bf71a4e012 Gerbview: fix draw issue when drawing a line using a rectangular aperture.
Lines using a rectangular aperture are not common, but this is legal in Gerber files.

Fixes #5205
https://gitlab.com/kicad/code/kicad/issues/5205
2020-08-18 10:26:10 +02:00
Seth Hillbrand d29edf6381 Removing extra parameters to super() calls
The extra parameters seem to cause problems for some Python
configurations and are not needed.

Fixes https://gitlab.com/kicad/code/kicad/issues/4896

(cherry picked from commit d8d8f4f670)
2020-08-12 06:33:22 -07:00
Blake Smith b087b7743e Fix PadGridArray super call
(cherry picked from commit 9614f6d0d9)
2020-08-12 06:33:21 -07:00
Ian McInerney 8ee1a7f67f Preserve the externally defined variables in the configure paths dialog
Previously the variables that were defined externally weren't being
readded to the variable map, so they would not appear in the dialog
the next time.

(Cherry-picked from fedc6519cd)
2020-08-12 00:29:17 +01:00
Ian McInerney 475385d876 Force regeneration of the lib tree on first load
Just setting the text field is not guaranteed to fire
a text event, so we must forcefully call the regenerate
function to ensure the preselect is handled.

Fixes https://gitlab.com/kicad/code/kicad/issues/4105

(Cherry-picked from 63b53c3968)
2020-08-12 00:27:33 +01:00
Ian McInerney 1b967a07e5 Remove shadowing linewidth member from the Cairo GAL
The base GAL has the linewidth property already, and its
accessor will only return the base version. This was causing
problems with the Cairo printing GAL, since that setter wasn't
using the base class version. Also, this removes the print-specific
setter, since the actual setting of line width shouldn't be done
there and is instead done where the drawing happens.

Fixes https://gitlab.com/kicad/code/kicad/issues/5089

(Cherry-picked from 5684708b22)
2020-08-11 00:54:23 +01:00
Ian McInerney 1088d613d5 Escape all env var strings sent to the Python interpreter
Fixes https://gitlab.com/kicad/code/kicad/issues/5130

(Cherry-picked from 0a0ed9e064)
2020-08-11 00:53:48 +01:00
Ian McInerney 1b2d4d6522 Entries typed into the text size field should be read as mils
Previously, they were being interpreted as inches, and then being
displayed as mils - leading to a multiplication by 1000 if there
was no unit string included.

Fixes https://gitlab.com/kicad/code/kicad/issues/5117

(Cherry-picked from 259cacf648)
2020-08-11 00:52:05 +01:00
Seth Hillbrand 0fd1214dea pcbnew: Fix multiple issues with BOARD_CONNECTED_ITEM
Modules are not members of BOARD_CONNECTED_ITEM, so we cannot use this
as a proxy for membership in the connectivity or ratsnest calculations.

Fixes https://gitlab.com/kicad/code/kicad/issues/5140
2020-08-10 12:53:37 -07:00
Jeff Young 00547b7aac Fix compile errors on CLang. 2020-08-10 20:06:06 +01:00
Jeff Young 621bfe36a8 Convert smart quotes and dashes in reports to ASCII quotes and dashes.
Fixes https://gitlab.com/kicad/code/kicad/issues/1861
2020-08-10 18:30:46 +01:00
Jeff Young c1849f7e00 Don't throw out search hits because they have unit children.
(Cherry-picked from 6aa0ceff36)

Fixes https://gitlab.com/kicad/code/kicad/issues/3746
2020-08-10 17:04:36 +01:00
Ian McInerney b23db7c4cb Fixup the UI for the symbol preview widget
This is the proper fix for the symbole preview widget. It will ensure
there are no size changes between the two panels (preview and status),
and also ensure that the status panel has the same background color as
the preview panel.

Fixes https://gitlab.com/kicad/code/kicad/issues/4997
2020-08-10 00:52:48 +01:00
Ian McInerney b3525bc642 Hide the scrollbars on the symbol preview canvas
This canvas supports mouse interaction, and navigating using the
scrollbars is very difficult (it causes large jumps). Also, having
the scrollbars causes the background to bleed through around them,
making them appear floating in the canvas.

Fixes https://gitlab.com/kicad/code/kicad/issues/4997
2020-08-09 23:13:03 +01:00
Ian McInerney 589951eaea Ensure the environment variables are synced between Pcbnew and Python
This ensures that when the project or an environment variable is changed
in pcbnew, the Python interpreter is updated to reflect that.
This is a backport version of the master-branch commit, and will not
synchronize any changes to the environment variables if they are made
from frames other tna Pcbnew.

Fixes https://gitlab.com/kicad/code/kicad/issues/5071
2020-08-09 20:32:38 +01:00
jean-pierre charras 74adbbcc5d Ensure values with units are displayed correctly when numbers are very small.
from master branch.
see https://gitlab.com/kicad/code/kicad/issues/5074
2020-08-09 09:48:10 +02:00
Ian McInerney bab61dd249 Initialize clear annotation variable to false so they aren't cleared by accident
When it was uninitialized, cancelling the dialog could lead to the
sheet's annotations being cleared because the variable wasn't set
to false anywhere.
2020-08-08 23:24:36 +01:00
Ian McInerney 5c3bcb09fa Give the length tuning tool an inital end point that isn't the start point
Using the starting point as the end point means that the tool
initializes with 0 length traces and so nothing is visible.

Fixes https://gitlab.com/kicad/code/kicad/issues/1912
2020-08-08 22:55:18 +01:00
Ian McInerney f0b94dd0d4 Load the previous project if an empty string is the argument
Previously it would just not open any project at all. This
was a problem for some launchers, which would pass an empty string
when no file is passed by the user.

Fixes https://gitlab.com/kicad/code/kicad/issues/5055
2020-08-08 22:55:03 +01:00
jean-pierre charras ba5ab99a03 pcbnew: More about Prevent use of non-connected item in ratsnest
Another static cast was left. changed now to dyn_cast

We need to be careful in the connectivity system to always use
dyn_cast/dynamic_cast and check the return when dealing with board
items.
Fixes https://gitlab.com/kicad/code/kicad/issues/5082
2020-08-08 09:59:54 +02:00
Seth Hillbrand 9bc3028eb7 pcbnew: Prevent use of non-connected item in ratsnest
We need to be careful in the connectivity system to always use
dyn_cast/dynamic_cast and check the return when dealing with board
items.  Getting non-connected items will result in null nets when
propagated.

Fixes https://gitlab.com/kicad/code/kicad/issues/5082

(cherry picked from commit 406de56964)
2020-08-07 14:09:03 -07:00
Wayne Stambaugh 5ef9db6d67 Eeschema: fix large diffs when saving schematics.
Apparently the < operator was never implemented for SCH_JUNCTION objects
so they were not get sorted which was causing the large diffs between
schematic saves.

Fixes https://gitlab.com/kicad/code/kicad/issues/4370

(cherry picked from commit 35f3eb6220)
2020-08-06 09:27:14 -04:00
jean-pierre charras 86a710e175 Gerbview: show a message instead of an error when trying to open a job file as plot file.
From master branch, commit ef0ae8
2020-08-06 14:59:29 +02:00
Tormod Volden 1797a9c61a bom2grouped_csv.xsl: Fix sorting of grouped references
Commit a96ebe8f seems to have missed a dollar sign.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/940
hopefully for good this time.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>

(Cherry-picked from e82e30d215)
2020-08-06 10:14:26 +01:00
Frank Severinsen fd49bc5d8d Check reference designator type when comparing comp
example: prevents a 10K NTC resistor from getting grouped with a 10K SMD resistor

(Cherry-picked from 9ca61b50b6)
2020-08-06 10:12:57 +01:00
Matthias Urlichs de4c6c6fab Allow SWIG 4.0.
No other changes are necessary.

(Cherry-picked from 3bba96baa2)
2020-08-06 10:06:24 +01:00
Ian McInerney 78a7dd3269 Properly dismiss the grid combobox editor when it loses focus
The old way of checking for focus loss caused GTK to be unable to
even open the combobox. This way checks for the event sent when the
list closes and uses that to close the grid editor.

Fixes https://gitlab.com/kicad/code/kicad/issues/4617

(Cherry-picked from af24a5d5a7)
2020-08-06 02:02:32 +01:00
Wayne Stambaugh 0cf53da0fe Fix ngspice version information issue.
The config.h header for ngspice is not packaged with all platforms so
use pkg-config to fetch the version information when available.  When
pkg-config is not available, check if the ngspice/config.h file is
installed on the system before including it to build the ngspice version
string.  If neither pkg-config or ngspice/config.h is available set the
version string to "unknown".

Fixes https://gitlab.com/kicad/code/kicad/issues/4851
2020-08-02 15:49:25 +02:00
jean-pierre charras 13b8708e58 Better fix for OPENGL_GAL::DrawSegment() than initial commit 5bdc78e.
segments having a length <= 1 internal unit are not drawn in opengl gal.
So these segments are drawn as circle.
Fix from master branch.
2020-07-31 15:44:24 +02:00
Simon Richter b6d91bd28a Remove commented-out code for building cvpcb.exe 2020-07-31 14:12:32 +02:00
Seth Hillbrand 5bdc78e3ba GAL: Fix issue with small tracks being hidden
When drawing segments that are smaller than the segment width, OpenGL
did not use realistic values, leading to hidden, small tracks.  Instead,
we set the track to only draw a segment when the length is at least 1
radius long (so that we can see the full semi-circle at the track end)

Fixes https://gitlab.com/kicad/code/kicad/issues/5009

(cherry picked from commit 294dabf640)
2020-07-30 15:12:17 -07:00
Seth Hillbrand bce8fb31ab Mirror hidden text in SVG plotter
We output a 0 opacity text in the SVG plotter to allow searching.  When
this text is changed to 100 opacity, it can show up on the user screen
and so needs to be mirrored to match the stroke font output

Fixes https://gitlab.com/kicad/code/kicad/issues/5001

(cherry picked from commit b650e4568b)
2020-07-30 06:26:49 -07:00
jean-pierre charras 77d7d21130 Simulator: optimize a plot function, to support large amount of points.
Redundant points are not plotted.

From master, commit 010316457
2020-07-29 08:55:45 +02:00
Seth Hillbrand fed1520a8e Treat 0-length ovals as circles
Some buggy SVG interpreters can't handle 0-length ovals.  In this case,
they are meant to be circles, so we can export as circles in our
plotter.

Fixes https://gitlab.com/kicad/code/kicad/issues/3995

(cherry picked from commit e38ab6c699)
2020-07-28 09:53:26 -07:00
jean-pierre charras 284d5861dd Remove creation on the fly of wxPaintEvent instances, not allowed in 3.1.4 wxWidgets
From master branch
2020-07-18 08:24:58 +02:00
Urja Rannikko ee6154c842 GAL: Remove dead code regarding SHADER_LINE_B in the fragment shader
The only test for it was only called from a function
that's called if the mode is SHADER_LINE_A, not B.

(cherry picked from commit 65ceeebc71)
2020-07-17 14:10:29 -07:00
Urja Rannikko 709197c294 GAL: Round the incoming mode parameter in fragment shader
This fixes some letters being randomly boxes and some circles
being randomly triangles on the Mali T760.

(cherry picked from commit aa7ab46a06)
2020-07-17 14:07:34 -07:00
jean-pierre charras fd55b7b4ed 3D viewer: use the full board bounding box to define the visible area.
From master, commit eab98eee.
2020-07-07 11:46:46 +02:00
Ian McInerney 5bca5e2d77 eeschema: Only warn user about off-grid pins if the position has changed
(Cherry-picked from f7156a9d49)

Fixes https://gitlab.com/kicad/code/kicad/issues/4673
2020-07-03 03:02:03 +01:00
Jeff Young ee96937fd4 Scale polygon drawing guides with zoom.
Fixes https://gitlab.com/kicad/code/kicad/issues/4769

(cherry picked from commit e26625fc99)
2020-07-01 17:34:35 +01:00
jean-pierre charras a370d69542 Gerber plotter: Better object attributes handling when plotting a zone
- Clear object attributes before and after plotting a zone.
 It avoid using previously defined object attributes when plotting the next
 zone, and using therefore incorrect attributes.
- Add aperture attribute to filled zone solid polygons (regions in Gerber)

From master branch
2020-06-28 13:14:06 +02:00
Seth Hillbrand 24aad2eed4 Fix order-of-ops issue in sim plot
(cherry picked from commit 67bd49b4a8)
2020-06-27 20:00:17 -07:00
Frank Severinsen 910605cc7d Fix text rotation after flip
fixes https://gitlab.com/kicad/code/kicad/-/issues/4407

(cherry picked from commit 9cf1e61d8a)
2020-06-27 21:49:15 -04:00
Seth Hillbrand 7194e25bba pcbnew: Allow slow ratsnest to turn off
Depending on where you move the selection, the slow ratsnest might turn
on.  This prevents that setting from being sticky, reverting to smooth
movement.

(cherry picked from commit a893d19d26)

Fixes https://gitlab.com/kicad/code/kicad/issues/1909
2020-06-24 17:27:39 -07:00
Seth Hillbrand 7f287cb8f9 Remove delauney computations from dynamic ratsnest
Avoids additional calculations on movement by using cached ratsnest for
internal nets and keeping bicolored line calc for others.

Fixes https://gitlab.com/kicad/code/kicad/issues/1865

cherry-picked from 104ff29e5f
2020-06-22 20:42:12 -07:00
jean-pierre charras a0ce1491d9 Gerber plot solder mask margin: use new algo from master branch to avoid
merging pad shapes when the min width mask is not 0.

Keeping pad shapes clearly identified in Gerber files is mandatory,
so the initial algo that merged shapes in some cases was not good
from this point of view.
2020-06-21 20:47:58 +02:00
jean-pierre charras 26035d23fe Pcbnew, DIALOG_PLOT_BASE: better warning message about non null solder mask margins. 2020-06-21 20:42:37 +02:00
jean-pierre charras 835debe75e Gerber plot solder mask layer: prepare new algo to avoid merging pads in zones 2020-06-18 17:54:00 +02:00
jean-pierre charras b482deb8b0 Fix a incorrect code after a old other code change. 2020-06-18 12:53:06 +02:00
Ian McInerney 76fd1e6f5a Include the ngspice library in the bundle fixup command
This is a patch that has been carried in the kicad-mac-builder
repository that is being upstreamed into the main codebase.

(cherry-picked from 0bfe4130f5)
2020-06-15 22:47:43 +01:00
jean-pierre charras abb45fbe45 Gerber plotter: better choice of aperture attributes in internal layers.
From master branch
2020-06-14 18:18:20 +02:00
jean-pierre charras 567ce48cc1 panel lib tables: avoid crash when deleting the last entry in list.
From master branch
2020-06-14 17:51:27 +02:00
jean-pierre charras 56a17b4e68 Gerber plotter: ensure the gerber region for a round rect pad is always closed.
Due to rounding issues, sometimes (especially for rotated pads)
the region (4 segments+4 arcs) was incorrectly closed
1 unit (nanometer) mismatch between start point and end point.
Although it does not create bad shape, its breaks the round rect pad
identification in CAM tools. start point and end point are now the same.

From master.
2020-06-12 10:54:09 +02:00
jean-pierre charras c027e72439 Solder mask clearance default value: set default to 0, taking advice from
both Ucamco and Eurocircuits.
Update message in plot dialog about best solder mask clearance value.
Show a warning message in plot dialog if these values are no 0.

From master branch.
2020-06-07 15:52:12 +02:00
Seth Hillbrand 25b8da8e3b PNS: Use segment shape for all oval pads
Instead of calculating a simple polygon for the oval pads that are
rotated, we use a rotated segment.

Fixes https://gitlab.com/kicad/code/kicad/issues/4604
2020-06-04 20:28:59 -07:00
Seth Hillbrand 5b47d1a910 Prevent multiple kiway from loading simultaneously
Each KIWAY_PLAYER has some initialization elements that may take time
before the frame is raised.  If handling is returned to the UI during
that load, we can cause reentrant issues for players.

Fixes https://gitlab.com/kicad/code/kicad/issues/4284

Fixes https://gitlab.com/kicad/code/kicad/issues/3743
2020-06-04 16:37:35 -07:00
Jeff Young a844c3043c Fix offset issue when pad edited from board instead of modEdit.
(cherry picked from commit 7db4a3f702)
2020-06-03 14:42:13 +01:00
jean-pierre charras e099a82d15 eeschema: do not propagate text field change to other units for not annotated symbols
Fixes #4602
https://gitlab.com/kicad/code/kicad/issues/4602
2020-06-03 08:52:48 +02:00
Jeff Young b681af4556 Check for duplicate field names.
Fixes https://gitlab.com/kicad/code/kicad/issues/4219

(cherry picked from commit 5d493abea7)
2020-06-02 22:57:29 +01:00
Jeff Young 78d66a9ac3 Don't allow the pad preview canvas to become too large.
Also offset canvas with pad so that hole stays in centre.

Fixes https://gitlab.com/kicad/code/kicad/issues/4185

(cherry picked from commit 3bd4c0c5dc)
2020-06-02 22:57:05 +01:00
Jeff Young bfe4d9f3f4 Cherry pick fix for 4549.
Fixes: lp:4549
* https://gitlab.com/kicad/code/kicad/-/issues/4549
2020-06-01 21:57:16 +01:00
Jeff Young a02ee3719c Update membership grid when a netclass name changes.
Fixes https://gitlab.com/kicad/code/kicad/issues/4596
2020-06-01 21:57:16 +01:00
jean-pierre charras 542f713678 Fix PCBnew crash when show local ratsnest and selecting a footprint with no pads
From master, commit e3c3dae
2020-06-01 09:22:29 +02:00
jean-pierre charras 2395c6fdaa toolbars_lib_view.cpp and toolbars_libedit.cpp: do not
recreate comboboxes when clearing toolbars. Clearing toolbars delete only
tools, not other widgets. recreating comboboxes creates strange cosmetic issues.

From master, commit 598ed8b39.
2020-05-30 15:57:18 +02:00
Steven A. Falco c7f02d5e51 Add Python 3.9 compatibility
Taken from downstream Fedora commit.

Original author info:
Charalampos Stratakis <cstratak@redhat.com>  2020-05-28 12:26:59

Downstream commit: a2677c159ad529

(cherry-picked from 7fd661f06b)
2020-05-29 22:13:26 +01:00
Érico Rolim 55a726e933 Fix sg_version detection for cross compilation
Fixes https://gitlab.com/kicad/code/kicad/issues/4525

(cherry picked from commit e9e72bd8e4)
2020-05-28 13:19:10 -04:00
jean-pierre charras 601633347c Pcbnew: fix a crash when trying to edit a pad in the board editor 2020-05-28 09:51:06 +02:00
Michael Kavanagh 182973c0ee NPTH pads can have the hole offset from centre
Fixes https://gitlab.com/kicad/code/kicad/issues/3671

(cherry picked from commit e800c47406)
2020-05-26 13:35:38 -04:00
Wayne Stambaugh a16e9ac76a Symbol editor: fix crash when editing new symbol value field.
Fixes https://gitlab.com/kicad/code/kicad/issues/4471
2020-05-21 16:46:00 -04:00
emC5RgViIK 66f70e5da6 (Cherry-picked from 47297402d3) 2020-05-15 12:37:41 +01:00
Simon Richter 5a187c6ca8 Make sure that Ninja knows the version header (fixes #4209)
This is required, because Ninja otherwise doesn't properly rebuild after
updating the version string header file.

Because BYPRODUCTS requires CMake 3.2, bump the minimum version and remove
now unused compatibility code for older CMake versions.
2020-05-15 10:51:12 +00:00
Jeff Young c6042100f9 Add ~ processing in env vars.
Fixes https://gitlab.com/kicad/code/kicad/issues/1829

(cherry picked from commit 3a9746c657)
2020-05-14 00:35:10 +01:00
jean-pierre charras fde7ae4d19 Pcbnew: fix a crash due to use of invalid pointers after a list modification
from master branch, fix bug #4409
2020-05-13 14:04:20 +02:00
Jeff Young e37e13e700 If more than one text matches by text try layer and then position.
Fixes https://gitlab.com/kicad/code/kicad/issues/4187

(cherry picked from commit 8df5f70c4a)
2020-05-13 00:14:40 +01:00
Jeff Young d22003578e Use standard OK/Cancel paradigm rather than Apply/Cancel.
Apply/Cancel puts the buttons in a different order on some platforms.

Fixes https://gitlab.com/kicad/code/kicad/issues/4332

(cherry picked from commit 52d1c93777)
2020-05-13 00:04:51 +01:00
Jeff Young 52139cf0c4 Don't resync the screen before we've changed it back.
Fixes: lp:4382
* https://bugs.launchpad.net/kicad/+bug/4382
2020-05-12 22:58:15 +01:00
Jeff Young 37b723d8ae Fix pad name increment to use last edited pad.
Fixes https://gitlab.com/kicad/code/kicad/issues/1882

(cherry picked from commit 56946f4db1)
2020-05-12 22:58:15 +01:00
Jeff Young aec3649524 Add FocusOnLocation for second items in ERC markers.
Fixes: lp:4237
* https://bugs.launchpad.net/kicad/+bug/4237
2020-05-12 22:58:15 +01:00
Jeff Young 36d716bb50 Update toolbars when changing units.
Fixes: lp:4249
* https://bugs.launchpad.net/kicad/+bug/4249
2020-05-12 22:58:15 +01:00
Wayne Stambaugh f61c692929 Eeschema: fix partial schematic load bug in the legacy plugin.
Move the hierarchical sheet loading outside of the try exception block
so that any sheets that were loaded when a schematic file load fails
are loaded rather than skipped.  This allows more of the schematic to
be loaded when any parser errors occur.

(cherry picked from commit 1a8082c6d6)
2020-05-11 16:45:11 -04:00
Wayne Stambaugh 3f717f3baf Eeschema: fix sheet bug in schematic editor drawing tool.
SCH_SHEET objects can only have another SCH_SHEET object as a parent
or nullptr for the root sheet so overload EDA_ITEM::SetParent() to
prevent the parent from being set to another type of object and add
some checks to the root sheet code just in case someone gets clever
and attempts to bypass the overloaded SetParent() call.

(cherry picked from commit fa57c8a570)
2020-05-11 16:33:40 -04:00
Wayne Stambaugh ffc95090aa Begin version 5.1.7 development. 2020-05-11 14:47:14 -04:00
Wayne Stambaugh 2eaa9236f2 Tag release version 5.1.6. 2020-05-11 14:27:08 -04:00
Jeff Young e4bab37b62 Don't try and run drawing tools in ModEdit with no module selected.
Fixes: lp:1836673
* https://bugs.launchpad.net/kicad/+bug/1836673

(cherry picked from commit 02eb1d2c62)
2020-05-09 17:41:56 +01:00
Jeff Young 105c9c71ee Don't let point editor interrupt other operations.
Fixes: lp:1832416
* https://bugs.launchpad.net/kicad/+bug/1832416

(cherry picked from commit ae8daee83c)
2020-05-09 17:41:56 +01:00
Jon Evans e135229ca6 Don't try to draw a zone that has no outline
Fixes #4352

(cherry picked from commit 366673d995)
2020-05-07 17:54:00 -04:00
jean-pierre charras 97dea6ede5 Gerbview: Fix a crash Don't try to close an empty polygon on G37 command.
Can happens with malformed Gerber files.
From Master, commit 528ebf8.
2020-05-07 09:55:13 +02:00
jean-pierre charras d871a92d1c library viewers: fix a focus issue that prevent using arrow keys in lib or fp lists.
Once the gal canvas hsad the focus, it was not possible to use arrow keys in library
or symbols or fp lists even after clicking on an item.

This focus issue is now fixed.

From the fix in Master
2020-05-03 20:23:41 +02:00
jean-pierre charras a152aa125b Footprint editor: fix a crash when a graphic item is selected and the
measurement tool is active and closing the frame, or selecting a new footprint.
I am guessing it was a use after delete data.

Fixes #4302
https://gitlab.com/kicad/code/kicad/issues/4302
2020-05-03 09:03:32 +02:00
jean-pierre charras 4e217d4028 SVG plotter: fix some issues: incorrect bitmap size and missing lines in header.
From master branch.
2020-04-24 16:52:50 +02:00
Jeff Young e5da7a4606 Fix via printing.
LAYER_VIAS needs to get set for them to print at all, and GetLOD
needs too look at the view layer visibiilties, not the board layer
visibilities.

Also implements a more pad-like strategy for printing blind/buried
vias when printing one layer per page (where the top/bottom arcs
don't make sense).

Fixes https://gitlab.com/kicad/code/kicad/issues/1938

(cherry picked from commit dce42612d3)
2020-04-20 20:29:05 +01:00
Jeff Young faace3090c Add specific selection updating when adding 3D models.
This keeps us from being at the receiving end of wxWidgets' vagaries.

Fixes https://gitlab.com/kicad/code/kicad/issues/3760
2020-04-19 22:43:32 +01:00
jean-pierre charras d3e2345f94 Dxf import: fix a bug that disable import of data inside blocks 2020-04-19 13:32:59 +02:00
jean-pierre charras a3e087ab51 Pcbnew: Fix crashes when delete footprint text in some cases.
Fixes #4221
https://gitlab.com/kicad/code/kicad/issues/4221
2020-04-18 20:00:26 +02:00
jean-pierre charras 3a614a8ea1 Legacy plugin: fix incorrect number of copper layers after loading a .brd file. 2020-04-18 19:58:45 +02:00
Marcus Comstedt 9cb60dcdf5 Cairo GAL: fix incorrect use of pixman formats
Fixes https://gitlab.com/kicad/code/kicad/issues/3970

(cherry-picked from 55ac575a88)
2020-04-15 01:29:50 +01:00
Jon Evans af6db68816 Defer image surface destruction until next paint
Fixes #4043

(cherry picked from commit 23c1baae8e)
2020-04-15 01:18:55 +01:00
Adam Wolf 305ed0b65a For macOS, fix KICAD_BUNDLE_LIBS in ogltest.
(Cherry-picked from e143ecbf40)
2020-04-10 20:09:34 +01:00
jean-pierre charras 263efb41e8 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.

From master branch
2020-04-10 16:26:38 +02:00
jean-pierre charras d6312c7b92 Gerbview: add a error message for invalid files missing G74 or G75 commands.
They are mandatory to read arc coordinates.
2020-04-10 13:38:11 +02:00
Jeff Young b31af4891d Be smarter about determining if there are modules in the selection list.
The old algorithm would delete modules if another module was in the
list, which was not the intention.

Fixes https://gitlab.com/kicad/code/kicad/issues/4175
2020-04-09 00:07:07 +01:00
Adam Wolf 0ba08f57f2 Add macOS KICAD_BUNDLE_LIBS search path for bundle fixup.
(cherry-picked from ac20428b82)
2020-04-03 01:39:31 +01:00
Wayne Stambaugh a2d7881afe Fix cherry pick error on previous commit. 2020-04-02 16:09:25 -04:00
Wayne Stambaugh d79e598bf8 Eeschema: fix symbol cache library look up bug.
Use an underscore character instead of a semicolon between the library
ID library nickname and symbol name in library ID search strings when
looking up symbols in the cache library since that is how they are saved
when creating the cache library.  This fixes rescuing missing symbols
from the cache when they have been removed from the original library and
preventing a broken symbol link indicator from being shown when a symbol
is removed from the library.

Add some defensive testing to make sure the library passed to function
SchGetLibPart() is actually the cache library.

(cherry picked from commit f6d7ef367d)
2020-04-02 16:04:59 -04:00
jean-pierre charras a6a39cb842 Gerber plotter: Non horiz or vertical oval pads: better plot output:
These pads were plotted as a segment. This is not the right way:
Pads must be flashed or plotted as regions, not painted.
They are now plotted as Gerber regions round rectangle pads.
These regions are similar to flashed pads.

From Master branch, commit de7154e8e.
2020-04-02 19:50:59 +02:00
Wayne Stambaugh 5d0883c0e4 Eeschema: fix rescue multiple unit symbol bug.
The code that checked for pin conflicts to determine if a symbol needed
rescued did not check either the pin convert setting so it was possible
for a pin from the other convert on symbols that do not have identical
units to appear to not have a pin conflict.  Add tests for pin unit and
convert setting to prevent that from breaking the comparison.  This must
have always been broken.

Fix the symbol preview widget to prevent drawing all symbols on top of
each other (if we need to do this the code will have to be revised) and
also show the convert if valid.

Fix broken symbol cache library when saving alias symbols.

Fixes https://gitlab.com/kicad/code/kicad/issues/3879

(cherry picked from commit e91f1f57dd)
2020-04-02 09:31:25 -04:00
Seth Hillbrand e6d49424cf PNS: Don't link unroutable items
The joint map only works for items that are routable, so don't bother
adding unroutable items as this only takes additional time to process

Fixes #3976 | https://gitlab.com/kicad/code/kicad/issues/3976

(cherry picked from commit 9769e1020b)

Fixes https://gitlab.com/kicad/code/kicad/issues/4143
2020-04-01 08:31:57 -07:00
Seth Hillbrand 72abcd5991 Correct cyrillic 'f' in newstroke
The lowercase greek phi had been used which did not match the cyrillic
f.  We use the variant of phi that includes the full strokes instead.

Fixes #3898 | https://gitlab.com/kicad/code/kicad/issues/3898

(cherry picked from commit 39a45f2a81)
2020-04-01 08:31:14 -07:00
jean-pierre charras 9c2bb85858 3D viewer: fix a minor problem: to many rotations when typing
Shift+z or Shift+y more than once.

From master, commit 00d9e77e
2020-03-31 17:48:50 +02:00
Jeff Young e9b059ee94 Re-implement change from cbef95256b
Fixes: lp:4103
* https://bugs.launchpad.net/kicad/+bug/4103
2020-03-30 20:24:08 +01:00
Ian McInerney 7a913844e2 Fix discrepancy between ASCII and CSV fp pos files
(based on 570ea62b64)

Fixes https://gitlab.com/kicad/code/kicad/issues/3897
2020-03-30 10:42:15 +01:00
jean-pierre charras f8be7e1f57 Gerber X2 format: Set default values to Enable X2 format 2020-03-29 15:37:36 +02:00
jean-pierre charras d5c43c4675 Gerber: fix a minor issue in OBLONG standard aperture: - incorrect (too big) bounding box. - HitTest did not test the exact shape. 2020-03-27 16:19:22 +01:00
jean-pierre charras 85fa6d8025 3D viewer: apply patch from master 04d6ea982.
The 3D viewer does not show the issue on solder paste layer having
negative clearance.
However the bug was here and not seen just because some draw code was different:
The code tried to draw outlines with segments having a negative thickness.
It happens mainly on solder paste layers.
2020-03-27 10:36:14 +01:00
Ian McInerney 6b2a8f54a1 Check for file writability before saving part
This is a 5.1 only fix for this crash. Fixing in master requires
a major refactor of the library writability detection code.

Fixes https://gitlab.com/kicad/code/kicad/issues/3864
2020-03-25 13:23:49 +00:00
jean-pierre charras bd1fb845b1 3D viewer: fix a minor issue in solder paste rect pads:
the solder paste mask clearance was no taken in account
for rect and trap shapes.
2020-03-25 13:47:48 +01:00
jean-pierre charras 9c64c9af5d Kicad manager: fix an issue on Windows when killing Kicad.
For some obscure reason, on Windows, when killing Kicad from the Windows task manager
if a editor frame (schematic, library, board editor or fp editor) is open and has
some edition to save, OnCloseWindow is run twice *at the same time*, creating race
conditions between OnCloseWindow() code.

Fixes #4072
https://gitlab.com/kicad/code/kicad/issues/4072
2020-03-25 09:51:12 +01:00
jean-pierre charras 1057eceb2f Gerber plotter: plot round rectangle pads using a region with arcs.
Previously, the region was a usual polygon with arc approximated by segment.
Using a region with arcs is a better way because it allows CAM tools to
identify this region as a round-rect pad.

Similar to master branch, commit 9cb3333d05.
2020-03-22 08:31:25 +01:00
Wayne Stambaugh 445bc75319 3D Viewer: fix broken check for write image permission check.
Fixes https://gitlab.com/kicad/code/kicad/issues/4081

(cherry picked from commit d8e99dc5be)
2020-03-21 17:20:04 -04:00
jean-pierre charras 4fb7ee02cd Kicad: unzip project: fix issues: - files with no extension were skipped. - subdirs were ignored. 2020-03-21 14:08:38 +01:00
Wayne Stambaugh ad11b7ebd0 3D viewer: fix double warning attempting to save screen shot file.
Fixes https://gitlab.com/kicad/code/kicad/issues/4028.

(cherry picked from commit fc20f9f0b2)
2020-03-16 13:09:02 -04:00
Seth Hillbrand 5d9bda6f97 Partial revert of 134a7ba85
The margin fix prevented some schematics from printing.  Reverting in
favor of transitioning to the Cairo print base in eeschema

(cherry picked from commit 9de7547c25)
2020-03-13 11:54:09 -07:00
jean-pierre charras 54be07c17d Pcbnew: Set default solder mask min size to 0.
When the solder mask min size is > 0, pads are no longer flashed or regions items.
Good Gerber files need pads flashed or regions items.

Non 0 solder mask min size is reserved to special cases (home made PCBs for instance)

From master branch.
2020-03-12 20:47:21 +01:00
jean-pierre charras 2c7ab3a28e Pcbnew, Gerber output: always generates Aperture Attributes.
Previously, for historical reasons, they were added only if
Include Netlist Attributes option was on.

But Aperture Attributes have nothing to do with Netlist Attributes, and good
Gerber files must include them.

From master branch
2020-03-12 17:00:55 +01:00
jean-pierre charras 3cc3c1bbd3 Zones: fix a crash when adding a zone cutout to a zone having already holes
From master branch
2020-03-12 14:49:36 +01:00
jean-pierre charras ddedf2e046 Annotate dialog: fix incorrect list of changes in complex hierarchies
Previously, to list changes, the Reference field was used in comparisons.
In complex hierarchies, this is incorrect: the Reference field contains
only the last displayed reference, not the reference of a given sheet.

The comparison uses now the sheet paths for ref and unit selection.

From a similar fix in master branch.
2020-03-09 18:28:39 +01:00
Seth Hillbrand a60c339f85 PCAD: Handle mirrored text
Mirrored text rotates clockwise in the mirror, so we need to invert the
sign for aligning mirrored PCAD text

Fixes https://gitlab.com/kicad/code/kicad/issues/3992

(cherry picked from commit 058fb3afa1)
2020-03-05 15:29:47 -08:00
Michael Kavanagh ce2c5d6528 Remove empty choice in Via type dropdown
Fixes https://gitlab.com/kicad/code/kicad/issues/3968

(cherry picked from commit 265c1663f9)
2020-03-03 14:21:21 -08:00
Seth Hillbrand fd81f70355 Drop invalid arcs on footprint load
In the case where the footprint arc has a non-normal angle, we cannot
represent this in pcbnew and it corrupts the gerber output.  Therefore
we drop the invalid arc and continue to load the footprint/board.

Fixes #3918 | https://gitlab.com/kicad/code/kicad/issues/3918

(cherry picked from commit 3e0ff72720)
2020-03-02 15:59:35 -08:00
Seth Hillbrand 100bb7c6ca Set Module Editor flag for tools
The commit takes the module edit flag when resetting the tool.  All
tools should reset this flag when we setup the Module editor.

This is slightly different in master and v5, so  this is a rework of
7bdf71abc

Fixes #3973 | https://gitlab.com/kicad/code/kicad/issues/3973
2020-03-02 12:45:47 -08:00
Seth Hillbrand 1ffcedd9d4 libedit: Fix speed of lib check
The symbol check output the HTML message for each item.  This is _very_
slow and can lock the system reponsiveness.  Changing to a queue/flush
method is much faster

cherry-picked from 245b778454
2020-02-28 08:50:05 -08:00
Ben Dooks fc1f713106 Fix issue with DRC for through hole being applied to SMD pads
Commit d7272b7f5e fixed the use of
the eagle DRC to change the library pad shapes. This was also
applied incorrectly to SMD stacks.

Remove the references to m_rules in packageSMD() and the code
that deals with them. eagle 7.7 does not have any SMD pad options
other than rectangle with rounding.

(cherry picked from commit 070c6b8ce0)
2020-02-27 09:01:42 -08:00
Seth Hillbrand 83c3a78e6d pcbnew: Avoid wx scaling error
When drawing to a scaled DC, the window doesn't reflect the expected
size if scaled after.  This causes elements drawn on the edge to reflect
back into the drawing area instead of being cut off.

We can simply scale our own values to avoid this issue.

Fixes #3849 | https://gitlab.com/kicad/code/kicad/issues/3849

(cherry picked from commit 5b6a4d794f)
2020-02-27 09:01:18 -08:00
Ian McInerney e6a3e7024d Also verify that the .dcm is writable when saving library
Fixes https://gitlab.com/kicad/code/kicad/issues/3946

(cherry-picked from b2cc454878)
2020-02-26 19:38:30 +00:00
jean-pierre charras d62fde0d79 Pcbnew, Fix issue when trying to create a drawing (line,circle,arc,polygon):
Display a error message if no free graphic layer is enabled, to switch from
a copper layer.

Fixes #3916
https://gitlab.com/kicad/code/kicad/issues/3916
2020-02-24 19:59:07 +01:00
Jon Evans a70cf464d6 Check if scaling factor has changed when top-level window is moved
Fixes #2592

(cherry picked from commit 712ae5a953)
2020-02-23 15:55:05 -05:00
Jon Evans 546260348d Rework window size and position fixing code
Fixes #2624
Fixes #3888

(cherry picked from commit 96da45f12f)
2020-02-23 15:55:05 -05:00
jean-pierre charras 693aec949c Gerbview: Gerber attributes display: fix incorrect attributes deletion.
The Gerber attribute deletion command (%TD,xxx) always cleared all attributes,
instead of clearing xxx attribute.
Therefore some attributes were not always displayed.

From master branch, commit 7206b567
2020-02-23 10:05:00 +01:00
jean-pierre charras 5c7ac1bb7e ZONE_FILLER: fix incorrect thermal clearance of pads having "not in zone" option. Pads inside a zone of the same net having the "not in zone" option have a "antipad" clearance. The value in this case is the biggest between zone clearance and thermal clearance (the net clearance is 0 betwen items of the same net)
However a bug created a incorrect value, due to the fact the minimal zone width
was incorrectly taking in account in calculations.
2020-02-17 17:12:24 +01:00
jean-pierre charras 8862752523 Remove a fix committed in 6b78fdf by mistake. 2020-02-17 13:00:56 +01:00
jean-pierre charras 201c380925 QA tests: remove deprecated headers, already not used in master branch. 2020-02-17 12:58:04 +01:00
jean-pierre charras c7230a6f77 eeschema: fixes related to translated and not translated field names.
When searching for fields, the code was sometimes comparing
translated and not translated names. This is an issue for mandatory fields,
in non English languages.

From master branch.
2020-02-17 12:26:51 +01:00
jean-pierre charras 6b78fdf822 LOCALE_IO: replace the call to setlocale by a call to wxLocale to switch to "C" locale.
Previously we call only setlocale( xx, "C" ), but it was not enough on Windows.
Now we call wxLocale("C")
wxLocale calls setlocale, but also make some others initialization in wxWidgets.
It fixes some issues related to comma versus point as fp separator.
Especially wxWidgets warnings are no longer thrown, and a one case of incorrect
conversion is fixed.
However, wxLocale( "C" ) also switches the current translations to English, so
loading files can have a slightly different behavior
2020-02-17 09:14:18 +01:00
Jon Evans 3cb326e426 ADDED: Expose GetBuildVersion and GetBuildDate to Python
(cherry picked from commit 8fb72d8290)
2020-02-15 09:59:43 -05:00
jean-pierre charras d3f9332372 Kicad manager: Avoid crash when calling configure libraries from main menu,
when _eeschema.kiface or _pcbnew.kiface is not found.
Happen mainly when running Kicad from build tree.

From master branch.
2020-02-11 16:15:19 +01:00
jean-pierre charras be0f6a6af2 Fp editor: fix: Reference and Value default values aren't saved in Footprint Editor preferences
Fixes #3889
https://gitlab.com/kicad/code/kicad/issues/3889
2020-02-11 15:48:05 +01:00
Seth Hillbrand 25aa233cef eeschema: Temporary fix for GTK printing offset
The full fix will be Cairo printing in v6

Fixes https://gitlab.com/kicad/code/kicad/issues/1907

(cherry picked from commit 134a7ba85d)
2020-02-10 09:07:21 -08:00
Jeff Young 5fdc424202 Don't report Eagle errors on the Unrouted layer.
Fixes https://gitlab.com/kicad/code/kicad/issues/3398
2020-02-05 22:20:16 +00:00
Jeff Young 9b74bb5c92 Remove preferred layer disambiguation for multiple modules.
The preferred list isn't actually in use anymore at this point, so
it currently has no effect other than to mess things up since we
aren't keeping track of which modules have been rejected when we
check the module count.

Fixes https://gitlab.com/kicad/code/kicad/issues/3721

(cherry picked from commit d02c0da3ab)
2020-02-05 22:20:16 +00:00
Jeff Young 8bf8a649c8 Adjust justified text for mirroring and rotation.
Fixes https://gitlab.com/kicad/code/kicad/issues/3737

(cherry picked from commit 2507f985ad)
2020-02-05 22:20:16 +00:00
Ian McInerney 7ba8d8b608 Revert eeschema highlighting changes
This reverts commit 366d4d7b0b.
This reverts commit 8b3c0a941c.

Fixes https://gitlab.com/kicad/code/kicad/issues/3866
2020-02-05 11:51:46 +00:00
Drew Fustini e35328fece Update copyright year in About dialog to 2020
(Cherry-picked from f359892de3)
2020-02-04 21:42:23 +00:00
Ian McInerney 366d4d7b0b eeschema: Ignore the highlight flag when responding to dbl click
Fixes https://gitlab.com/kicad/code/kicad/issues/3855
2020-02-03 21:41:03 +00:00
jean-pierre charras 3af1e75084 Gerber plots: Add initial G01 command to the header,
to ensure linear interpolation mode.
To avoid issues, an interpolation mode must be set before first D01 command.

From master branch.
2020-02-03 17:56:02 +01:00
jean-pierre charras dabd80fe4c Dxf importer: fix issue when importing some "degenerated" splines.
(From master, commit 8f3e8cf)
Sometimes a dxf curve is a "degenerated" bezier curve having only 3 points.
(a control point is at same location as a end point)
This commit fix incorrect import of these curves.

Fixes #3845
https://gitlab.com/kicad/code/kicad/issues/3845
2020-02-03 12:49:45 +01:00
Ian McInerney cb711a648f Fix layout in color dialog on GTK
Don't initially set the minimum widget size, and instead let it be
computed at launch.

Fixes #2617

(Partial cherry-pick of 4f82939384)
2020-02-02 15:40:42 +00:00
Karl Zeilhofer 5b58dbc980 Fixes dangling ends and rotation when labels/texts are converted into each other
CHANGED: Eeschema: Preserve text justification when switching text types

Closes https://gitlab.com/kicad/code/kicad/-/merge_requests/86
2020-02-01 16:08:34 +00:00
easyw 8b3c0a941c Highlight eeschema symbol on left click
CHANGED: Highlight eeschema symbol on left click

Closes https://gitlab.com/kicad/code/kicad/-/merge_requests/83
2020-02-01 16:08:19 +00:00
Seth Hillbrand 3ce29a3d7e Eeschema: Add bit that was missing from commit 7ac83ac64
This part of the check removes recursive sheets from the schematic when
loading and notifies the user that their schematic has been repaired.

(cherry picked from commit 128ec782dd)
2020-01-27 09:43:07 -08:00
Seth Hillbrand dc3c6b2f39 Check recursion before appending
We need to ensure that the appended sheet does not already exist in the
parent hierarchy.  We do this for new sheets but need to check for
existing ones as well.

Fixes #3806 | https://gitlab.com/kicad/code/kicad/issues/3806

(cherry picked from commit 7ac83ac64d)
2020-01-27 06:31:16 -08:00
Ian McInerney 1cbee4c504 gerbview: Add default filename to export to pcbnew function
Some platforms (such as Linux) don't automatically append file
extensions, so we should ensure extensions are correct and the user is
prompted accordingly.

Fixes https://gitlab.com/kicad/code/kicad/issues/3817

(Cherry-picked from 88e0ef548d)
2020-01-26 16:26:03 +00:00
qu1ck 798e4c288a Fix polygon shape move
Move vector should not affect start/end points as they are assumed to
always be 0,0. Polygon is defined by outline only.

(cherry-picked from 32674ef360)
2020-01-23 00:40:33 +00:00
Seth Hillbrand ac39e32bc9 Recognize subckt blocks in spice
Spice lines defining circuit elements are contained in a .subckt ..
.ends block.  The intervening lines should be exported to the netlist as
well as the control lines.

(cherry picked from commit d9eaff1c99f4c6664e23f8995062cf34f92dbc6c)
2020-01-17 18:58:27 -08:00
Seth Hillbrand 52da7f931b pcbnew: Check before reading/writing cache
The open/create calls can fail so we need to account for this before
using the result that assumes success.

(cherry picked from commit 88729de68553427c7f2ca2d32cad46f959b8cc3c)
2020-01-17 18:34:28 -08:00
Ian McInerney fcb6f814de Fix macos plist version string generation
Generate these resource files similar to how it is done one Linux.

Fixes mac-builder issue https://gitlab.com/kicad/packaging/kicad-mac-builder/issues/275

(Cherry-picked from 25a302758e)
2020-01-18 01:44:01 +00:00
Seth Hillbrand 9e6b56d783 PNS: Detect collisions including newline width
The new line collision search uses BBox() to check for colliding
objects.  BBox in the SHAPE_LINE_CHAIN did not include width as the
chains were assumed to be zero-width.  This is not the case for
PNS::LINE elements.

We mostly don't notice this because DRC checks for SEGMENT collisions
but it becomes obvious/annoying when we cannot place a track for unknown
reasons and the snap-back doesn't take line width into account.

Fixes #3776 | https://gitlab.com/kicad/code/kicad/issues/3776

(cherry picked from commit fe15511d38f2e6ffb293e2e708f8e3ed89c1a4d3)
2020-01-17 11:26:02 -08:00
Seth Hillbrand 923dad6ca8 PNS: Modify MarkObstacles logic to select shorter
When routing where we hit multiple obstacles, we choose the shortest
path to allow overlapping hits to choose the shorter path, thus giving a
better chance of returning true for the DRC-compliant path.

Fixes #3773 | https://gitlab.com/kicad/code/kicad/issues/3773

(cherry picked from commit 38f13ef481cd2e5cf560b921bcaabf9cdc7d00fb)
2020-01-16 19:58:19 -08:00
Ian McInerney 9f17d91b32 Fix return type in KIDIALOG
It was returned as a bool for some reason...

(Cherry-picked from 1f8611f1988f3165d49dc3039ad9b42947b57f01)
2020-01-15 18:30:24 +00:00
Mark Roszko 2bcb04a3b1 KIDIALOG should ignore "cancel" for the do not show again option.
CHANGED: Do not remember "do not show again" when cancel button is pressed

Fix #3734

(Cherry-picked from 3ae784d97fb50bc70cc49e27b9f424958e583257)
2020-01-15 18:26:20 +00:00
Ian McInerney a530b600b8 Smoothen rotation in 3D viewer when crossing the 0-2pi line
Rotating to 0 when above pi would result in the board spinning back
through pi to get there. This led to jarring motion.

Also fix an issue added in b6f64815 where the board would rotate
2pi when crossing over the 0-2pi boundary.

(Cherry-pick of 4fc9b4e5ab63fa192ec2a7d40574f614b318668c)
2020-01-15 18:10:46 +00:00
jean-pierre charras d494a2bee2 3D viewer: normalize rotation angles between -2_PI and 2_PI.
Fixes #3761
https://gitlab.com/kicad/code/kicad/issues/3761

(Cherry-pick of b6f64815f4)
2020-01-15 16:30:41 +00:00
Ian McInerney 6a027662ae Update Linux appdata file and CMake version strings
CHANGED: Update the Linux appdata file to include new tags

* Include version tags (and others) in the appdata file
* Refactor the version string generation to clean it up

Cherry-pick of:
3370e89967
e54c954aed
2020-01-15 16:23:22 +00:00
Ian McInerney 577bb7bf31 Update AUTHORS.txt with changes from master branch
Cherry-pick of:
8fcd59ebda
037e6bc006
0857a1f5dc
07c6cfdc38

Closes !64
2020-01-15 16:17:19 +00:00
Ian McInerney df664bd55f Don't tie generic validators to a specific field
(Partial cherry-pick of 15cd13ba6e)

Fixes #3667
2020-01-15 16:12:39 +00:00
Seth Hillbrand 8a2705f81f PNS: Assume the current line is a base before optimizing
We use the cost of the current line before trying to improve the pad
breakout cost when optimizing the smart pads

Fixes #3759 | https://gitlab.com/kicad/code/kicad/issues/3759

(cherry picked from commit 52bfdb9703)
2020-01-12 11:13:19 -08:00
Seth Hillbrand fcaf11422a Fix bitmap clipping
When printing (using DC context) the bitmap will clear the full screen
unless the clipping region is set to the image itself.

Addresses KSC ticket 126

Fixes #1877 | https://gitlab.com/kicad/code/kicad/issues/1877

(cherry picked from commit 195c3d074b)
2020-01-11 10:00:57 -08:00
Seth Hillbrand 3444409554 pcbnew: Fix polygon comparison () for end
This is a v5-only fix incorporating 2c5876e and 72da237 into the 5
branch to resolve a crash when parsing invalid polygons.

Fixes #3752 | https://gitlab.com/kicad/code/kicad/issues/3752
2020-01-09 17:15:48 -08:00
jean-pierre charras 683c01b301 SVG plotter: fix an issue with mirrored texts. Mirrored texts have a size < 0. Of course, the actual value for the plotter is the absolute value. 2020-01-09 18:24:15 +01:00
jean-pierre charras e2492f773d FILENAME_RESOLVER: fix missing conversion from UTF8 to wide chars.
Fixes #3742
https://gitlab.com/kicad/code/kicad/issues/3742
2020-01-08 10:47:14 +01:00
Ian McInerney 1f3a2dcd1d Fix cherry-pick error
Fixes https://gitlab.com/kicad/code/kicad/issues/3744
2020-01-08 09:41:01 +00:00
Mario Luzeiro 4205cb32c5 3d-viewer, make ortho projection zoom similar as prespective projection
Fixes #1843
Fixes reload of Raytracing when the projection button is pressed.

(cherry picked from commit 2c00540ad6)
2020-01-06 19:33:00 -08:00
Mario Luzeiro 6ab9bdb346 3d-viewer, ray-tracing, do not add coincident segments
Fixes #1946 (lp 1852970)

(cherry picked from commit 518c1df81b)
2020-01-06 13:56:25 -05:00
Mario Luzeiro a4aec1919c 3D-viewer: raytracing, implement multiple shape board.
Fixes #1879 (lp:1820099)
Fixes #2126 (lp:1764039)

(cherry picked from commit 37c3e34486)
2020-01-06 13:55:31 -05:00
Jon Evans 5b97d70d57 Use existing pcb filename for Save As where possible 2020-01-06 10:33:00 -05:00
Ian McInerney eeeb4596c3 Properly escape spaces when opening PDFs on windows
Fixes https://gitlab.com/kicad/code/kicad/issues/2625

(cherry-picked from 20e7fc8a0e)
2020-01-03 19:09:04 +00:00
jean-pierre charras 23853cae14 Try to fix SEG::PointCloserThan(), not working for quasi H or V segments.
Quasi H or V segments are segments having the same x value or y value
(with a + or -1 max diff) for end points coordinates.
The change is a workaround, not really a fix.

Fixes #3711
https://gitlab.com/kicad/code/kicad/issues/3711
2019-12-31 15:59:45 +01:00
jean-pierre charras 87f6f33b37 fix a minor wxWidgets alert. 2019-12-27 20:03:02 +01:00
jean-pierre charras 8c03d1bdde Gerber files: update unicode coding to the 2019 06 Gerber specifications.
In gbr files, not allowed chars are coded using a 16 bit (4 hexa digits)
unicode sequence.
Previously, it was \XXXX and now is \uXXXX escape sequence.

Changes from master branch.
2019-12-27 20:03:01 +01:00
Wayne Stambaugh 7f1c7d808d Eeschema: fix sheet file name case sensitivity test.
Fix overzealous test if the new file name is the same as an existing
file name.

Fix a potential comparison bug due to missing file extension.

(cherry picked from commit b66ecf141f)
2019-12-27 12:08:13 -05:00
Wayne Stambaugh be12aece5b Eeschema: fix sheet file name case sensitivity bug.
Apparently there are some issues with wxString::CmpNoCase() that was
causing the sheet file name case sensitivity test to incorrectly fail.
Converting the name strings to lower case before comparing resolved
the issue.

(cherry picked from commit 773f45aae3)
2019-12-27 12:07:15 -05:00
Wayne Stambaugh d7605f1449 Eeschema: fix multiple sheet file name bugs.
Add missing check for root sheet when searching sheet hierarchies for
already loaded schematics.  This prevents the root sheet from being
omitted when adding new sheets using the root sheet file name.

CHANGED: Make file name tests case sensitive so that schematic sheet
file names on non-Windows systems can be uses as expected.

Warn users when attempting to use schematic file names that only vary
by case sensitivity that doing so will result in a project that is not
portable to Windows.

Fixes lp:1843415

https://bugs.launchpad.net/kicad/+bug/1843415
(cherry picked from commit d4cea0f2b7)
2019-12-27 12:05:59 -05:00
Jon Evans ef80642dec LSET: Prevent assertion in MSW when size is not a multiple of 4
(cherry picked from commit 2ea565473f)
2019-12-26 10:01:44 -05:00
Jon Evans a5622c93d4 Don't try to write fp-info-cache to a read-only directory
Fixes #1890

(cherry picked from commit 80fb3bde56)
2019-12-25 18:48:21 -05:00
Ian McInerney b6f9bfe9a5 pcbnew: Fix cmake to work with no wxPython on macOS
(cherry-picked from bf5dba847c)
2019-12-25 23:23:31 +00:00
Ian McInerney 79954657e2 eeschema: Fix return ID check in annotate dialog
Fixes https://gitlab.com/kicad/code/kicad/issues/3708

(cherry-picked from e6e2cf47fd)
2019-12-25 23:18:31 +00:00
Mark Roszko 35d3f1f72a common: Remove out of bounds and erroenous array access
(cherry-picked from bf32122134)
2019-12-19 11:35:21 +00:00
jean-pierre charras 388d74faf4 Pcbnew: graphic polygon: display the points count, instead of length,
and coordinate origin.
Previously, the meaningless length (always 0) and begin and end (@0,0)
coordinates were always displayed.

From master branch.
2019-12-18 13:21:35 +01:00
jean-pierre charras 0f8747e194 Gerber plotter: modify G02 and G03 commands.
They are now in a specific block and no longer combined with an other
command.
(combining these commands with an other command (D01 or D02) is deprecated)

Fixes #3677 | https://gitlab.com/kicad/code/kicad/issues/3677
2019-12-18 12:30:28 +01:00
Ian McInerney 93f16ba9e3 Update about dialog link to GitLab
(cherry-picked from c31c99abd1)

Fixes #3687
2019-12-17 20:21:59 +00:00
jean-pierre charras bea2d42e8c Gerbview,export to pcbnew: avoid exporting not valid polygons.
Gerber regions are exported as polygons (they are filled polygon).
The fix ensure the polygons are simple and valid.
Invalid polygons crash Pcbnew.

From master branch, commit 25504319.
2019-12-15 14:24:11 +01:00
jean-pierre charras 68d644fd28 P&S router: length tuning tool: fix a crash after trying to tune a track.
It happens on Windows, and wxWidgets 3.1.3. It is created by
PNS_TUNE_STATUS_POPUP instance used in tool. I am pretty sure this crash is
created by the stack switching when managing events, due to some changes in
wxWidgets code.
The fix creates the instance on the heap, instead of on the stack.
This is not the first time I see this kind of issue.

From master, commit 21dd8db
2019-12-12 10:26:27 +01:00
jean-pierre charras f6e33450ff Gerber object attribute: avoid trying to guess if a SMD pad is a BGA pad.
Previously, if a SMD pad was round, itb was seen as BGA pad.
But this is not always true. so use always SMD PAD attribute,
until an explicit BGA pad attribute is added in Pcbnew
2019-12-11 08:55:44 +01:00
Seth Hillbrand 65008c5c0b Eeschema: Check twice before using GAL
The windows display may through an error which we need to catch when
starting GAL under windows.  This is a reimplementation of
e39586e15 which cannot be cherry-picked into v5

Fixes #2620 | https://gitlab.com/kicad/code/kicad/issues/2620
2019-12-10 16:01:59 -08:00
Seth Hillbrand dbfaf568fc Plot SVG embedded
ADDED: embedded image support for SVG files

Fixes #3643 | https://gitlab.com/kicad/code/kicad/issues/3643

(cherry picked from commit fa133f3f5c)
2019-12-08 08:59:01 -08:00
Fabien Corona 58fd6ac03e PCBnew: placing a blind/buried via sometimes incorrectly place a through via.
From master branch commit 36fba5bd7f
2019-12-08 13:31:21 +01:00
Seth Hillbrand 1e64524afb PNS: Allow snap to temp hidden
The IFACE for kicad refers to the board hidden state, not the
temporarily hidden state used by the router.  We allow snapping to items
that have been removed by the temporary router state to provide snapping
to original track location.

Fixes #1827 | https://gitlab.com/kicad/code/kicad/issues/1827
2019-12-07 09:49:59 -08:00
Seth Hillbrand 20a5d8effd pcbnew: Handle intermediate pad on route
The length calculation wanted to find start/end pads but this was
complicated for paths that had a via on the intermediate pad.  Instead
of warning, we calculate the longest path of the three possibilities

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

Fixes #2554 | https://gitlab.com/kicad/code/kicad/issues/2554
2019-12-04 13:46:09 -08:00
jean-pierre charras 8c7e0bcb0a DIALOG_DRC_CONTROL: fix a crash on wxWidgets 3.1.3
Happens when right clicking on an item in displayed lists.
The crash was due to a bug in wxWidgets, and the fix is only a workaround

From commit 5cd7f3fd in master branch.

Also remove duplicate code.
2019-12-03 09:47:42 +01:00
Jeff Young c69080f11e Fix some issues with the previous commit. 2019-12-02 23:33:45 +00:00
Jeff Young 5a48c800ee Make sure that libraries are always sorted consistently.
Fixes #1847481 | https://gitlab.com/kicad/code/kicad/issues/1847481
2019-12-02 21:55:31 +00:00
Jeff Young c6eff4d373 Update local coords when editing EDGE_MODULEs.
Fixes: lp:1853726
* https://bugs.launchpad.net/kicad/+bug/1853726
2019-12-02 20:01:11 +00:00
Seth Hillbrand 5c056c2a3e Fix compile error for old compilers 2019-12-02 09:19:13 -08:00
M.Scholz 61f593f350 Corrects IsDirWritable check
The check for IsDirWritable needs to reference the absolute path to
return correct values.

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

(cherry picked from commit dbb9b5f64f)
2019-11-21 17:25:48 -08:00
jean-pierre charras 6cc7dc7aaa Pcbnew: fix crash on Linux (when opening Edit Spice model in component properties)
It happens when the spice library model shown in dialog is a large file.
Looks like the wxTextCtrl used to displays the library content
creates the crash ( GKT bug?) for large texts.

The fix is to replace this wxTextCtrlt by a wxStyledTextCtrl.
It has advantages (does not crash... and much faster display) and
inconvenients (cannot disable editing).

Fixes: lp:1853161
https://bugs.launchpad.net/kicad/+bug/1853161
2019-11-21 13:15:14 +01:00
jean-pierre charras 239f040a98 Fix minor wxWidgets alert (wxWidgets 3.1.3) 2019-11-20 18:29:11 +01:00
jean-pierre charras 3827c16fde Fix a wxWidgets alert 2019-11-20 10:02:09 +01:00
Fabien Corona e299343807 Pad ratsnest settings initial value
Pad ratsnest settings set to global settings during initilization.

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

(cherry picked from commit 29ce76b4e4)
(slightly modified due to settings structure difference between
master and 5.1)
2019-11-18 22:34:21 +00:00
Fabien Corona 4130ce2b93 Ratsnest default value for tracks and vias
Fixes: lp:1851611
* https://bugs.launchpad.net/kicad/+bug/1851611

(cherry picked from commit 6182133a4e)
(slightly modified due to differences between master and 5.1)
2019-11-18 22:23:00 +00:00
Seth Hillbrand d6acb64514 CMake: Fix OCE/OCC swap
unset() needs to remove the cached variable to get rid of the implicit
version

(cherry picked from commit 365f9224e7)
2019-11-18 21:20:10 +00:00
jean-pierre charras 8e233e2591 Fix compil issue due to a small incompatibility from cherry-picked code. 2019-11-18 09:13:04 +01:00
jean-pierre charras 9cda16220e Gerbview: add parsing of optional Aperture Macro parameter. AMP_CIRCLE primitive has 4 or 5 parameters (last is optional) Reading the optional parameter was missing.
Fixes: lp:1852924
https://bugs.launchpad.net/kicad/+bug/1852924
2019-11-18 09:07:32 +01:00
jean-pierre charras 36acadbd52 DIALOG_PAD_PROPERTIES: fix incorrect pad type for Aperture option.
The aperture option created a Connector pad only on the paste layer.
This is incorrect: the SMD type only is acceptable.
Connector is *only* for edge card connectors.
Moreover, The dialog did not even accept the setting defined by this dialog...
2019-11-17 18:28:08 +01:00
jean-pierre charras 37b6552c42 FIX: add parameter to GAL::DrawCurve to control the curve to polyline
conversion.
Cairo supports curves, but not Opengl, that needs a conversion to polyline.
This control allows optimization in conversion
2019-11-17 18:22:13 +01:00
jean-pierre charras 1903052d79 Bezier curves: replace previous algorithm to convert the curve to segments.
In some cases it was not working well.
Opengl was using an other algo (using the curve properties to create segments)
Now only the OpenGL algo is used,
with optimization to reduce the number of segments.
2019-11-17 18:22:13 +01:00
jean-pierre charras 2b4cfd9a60 Footprint wizard frame: rebuild the parameter grid list after any parameter change. The python footprint wizard can modify other parameters than the one that was changed by user. So the parameter grid list must be updated after every parameter change.
Fixes: lp:1846404
https://bugs.launchpad.net/kicad/+bug/1846404
2019-11-17 18:22:13 +01:00
Fabien Corona decbb65f09 High contrast color for holes in microvias and buried bias
In high contrast mode, the holes of buried vias and microvias were no darkened when not on the active layer.
In high contrast mode, the outer circle of buried vias and microvias were alway darkened.

In high contrast mode, when the selected layer is non visible through-vias are now darkend.

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

(cherry picked from commit 04edc6ceff)
2019-11-15 12:02:47 -08:00
Seth Hillbrand 8e2ca37edc pcbnew: Prevent extra selection
We want to avoid selecting items that are disabled in the item list.
Our standard method is in the GetViewLOD() that performs both size and
visibility.  This extends the check to module text and via.

Fixes: lp:1851133
* https://bugs.launchpad.net/kicad/+bug/1851133
2019-11-14 09:50:39 -08:00
Wayne Stambaugh 8fb6bcc8b1 Begin version 5.1.6 development. 2019-11-14 12:14:16 -05:00
466 changed files with 10320 additions and 16154 deletions
+19 -1
View File
@@ -1,5 +1,6 @@
boost_root
.downloads-by-cmake
.gdb_history
boost_root
Build*
build*
common/fp_lib_table_keywords.cpp
@@ -95,3 +96,20 @@ pcbnew/Info.plist
.cproject
.pydevproject
__pycache__
# Visual Studio
.vs/
.editorconfig
CMakeSettings.json
# Sublime Text
*.sublime-*
# KDevelop
.kdev4/
*.kdev4
# Translations
*.mo
i18n_status.svg
i18n_status.csv
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -9,209 +9,209 @@
///////////////////////////////////////////////////////////////////////////
PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
PANEL_PREV_3D_BASE::PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizermain;
bSizermain = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerLeft;
bSizerLeft = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerScale;
sbSizerScale = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scale") ), wxVERTICAL );
wxFlexGridSizer* fgSizerScale;
fgSizerScale = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerScale->SetFlexibleDirection( wxBOTH );
fgSizerScale->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( sbSizerScale->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
fgSizerScale->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
xscale = new wxTextCtrl( sbSizerScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerScale->Add( xscale, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_spinXscale = new wxSpinButton( sbSizerScale->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
fgSizerScale->Add( m_spinXscale, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_staticText2 = new wxStaticText( sbSizerScale->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
fgSizerScale->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
yscale = new wxTextCtrl( sbSizerScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerScale->Add( yscale, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_spinYscale = new wxSpinButton( sbSizerScale->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
fgSizerScale->Add( m_spinYscale, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_staticText3 = new wxStaticText( sbSizerScale->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizerScale->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
zscale = new wxTextCtrl( sbSizerScale->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerScale->Add( zscale, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
m_spinZscale = new wxSpinButton( sbSizerScale->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
fgSizerScale->Add( m_spinZscale, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
sbSizerScale->Add( fgSizerScale, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
bSizerLeft->Add( sbSizerScale, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxStaticBoxSizer* sbSizerRotation;
sbSizerRotation = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Rotation") ), wxVERTICAL );
wxFlexGridSizer* fgSizerRotate;
fgSizerRotate = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerRotate->SetFlexibleDirection( wxBOTH );
fgSizerRotate->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText11 = new wxStaticText( sbSizerRotation->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 );
fgSizerRotate->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
xrot = new wxTextCtrl( sbSizerRotation->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRotate->Add( xrot, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_spinXrot = new wxSpinButton( sbSizerRotation->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
fgSizerRotate->Add( m_spinXrot, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_staticText21 = new wxStaticText( sbSizerRotation->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText21->Wrap( -1 );
fgSizerRotate->Add( m_staticText21, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
yrot = new wxTextCtrl( sbSizerRotation->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRotate->Add( yrot, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_spinYrot = new wxSpinButton( sbSizerRotation->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
fgSizerRotate->Add( m_spinYrot, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_staticText31 = new wxStaticText( sbSizerRotation->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText31->Wrap( -1 );
fgSizerRotate->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
zrot = new wxTextCtrl( sbSizerRotation->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRotate->Add( zrot, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
m_spinZrot = new wxSpinButton( sbSizerRotation->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
fgSizerRotate->Add( m_spinZrot, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
sbSizerRotation->Add( fgSizerRotate, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
bSizerLeft->Add( sbSizerRotation, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxStaticBoxSizer* sbSizerOffset;
sbSizerOffset = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Offset") ), wxVERTICAL );
wxFlexGridSizer* fgSizerOffset;
fgSizerOffset = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerOffset->SetFlexibleDirection( wxBOTH );
fgSizerOffset->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText12 = new wxStaticText( sbSizerOffset->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText12->Wrap( -1 );
fgSizerOffset->Add( m_staticText12, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
xoff = new wxTextCtrl( sbSizerOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerOffset->Add( xoff, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_spinXoffset = new wxSpinButton( sbSizerOffset->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
fgSizerOffset->Add( m_spinXoffset, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_staticText22 = new wxStaticText( sbSizerOffset->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText22->Wrap( -1 );
fgSizerOffset->Add( m_staticText22, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
yoff = new wxTextCtrl( sbSizerOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerOffset->Add( yoff, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_spinYoffset = new wxSpinButton( sbSizerOffset->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
fgSizerOffset->Add( m_spinYoffset, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_staticText32 = new wxStaticText( sbSizerOffset->GetStaticBox(), wxID_ANY, _("Z:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText32->Wrap( -1 );
fgSizerOffset->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
zoff = new wxTextCtrl( sbSizerOffset->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerOffset->Add( zoff, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
m_spinZoffset = new wxSpinButton( sbSizerOffset->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_VERTICAL );
fgSizerOffset->Add( m_spinZoffset, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
sbSizerOffset->Add( fgSizerOffset, 0, wxEXPAND|wxLEFT|wxRIGHT, 10 );
bSizerLeft->Add( sbSizerOffset, 0, wxEXPAND|wxALL, 5 );
bSizermain->Add( bSizerLeft, 0, 0, 5 );
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL );
wxStaticText* staticPreviewLabel;
staticPreviewLabel = new wxStaticText( this, wxID_ANY, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 );
staticPreviewLabel->Wrap( -1 );
staticPreviewLabel->SetFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizerRight->Add( staticPreviewLabel, 0, wxLEFT, 15 );
bSizerRight->Add( staticPreviewLabel, 0, wxALL, 5 );
m_SizerPanelView = new wxBoxSizer( wxVERTICAL );
bSizerRight->Add( m_SizerPanelView, 1, wxEXPAND|wxBOTTOM, 8 );
bSizerRight->Add( m_SizerPanelView, 1, wxEXPAND|wxBOTTOM, 5 );
bSizermain->Add( bSizerRight, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 4 );
wxBoxSizer* bSizer3DButtons;
bSizer3DButtons = new wxBoxSizer( wxVERTICAL );
bSizer3DButtons->Add( 0, 0, 0, wxEXPAND|wxTOP, 4 );
m_bpvISO = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
m_bpvISO = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
m_bpvISO->SetToolTip( _("Change to isometric perspective") );
bSizer3DButtons->Add( m_bpvISO, 0, wxTOP|wxBOTTOM, 5 );
m_bpvLeft = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
m_bpvLeft = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_bpvLeft, 0, 0, 5 );
m_bpvRight = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
bSizer3DButtons->Add( m_bpvRight, 0, 0, 5 );
m_bpvFront = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
bSizer3DButtons->Add( m_bpvFront, 0, 0, 5 );
m_bpvBack = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
bSizer3DButtons->Add( m_bpvBack, 0, 0, 5 );
m_bpvTop = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
bSizer3DButtons->Add( m_bpvTop, 0, 0, 5 );
m_bpvBottom = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
bSizer3DButtons->Add( m_bpvBottom, 0, 0, 5 );
m_bpUpdate = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW );
m_bpvRight = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_bpvRight, 0, wxTOP, 5 );
m_bpvFront = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_bpvFront, 0, wxTOP, 5 );
m_bpvBack = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_bpvBack, 0, wxTOP, 5 );
m_bpvTop = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_bpvTop, 0, wxTOP, 5 );
m_bpvBottom = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
bSizer3DButtons->Add( m_bpvBottom, 0, wxTOP, 5 );
m_bpUpdate = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
m_bpUpdate->SetToolTip( _("Reload board and 3D models") );
bSizer3DButtons->Add( m_bpUpdate, 0, wxTOP, 5 );
bSizermain->Add( bSizer3DButtons, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bSizermain );
this->Layout();
bSizermain->Fit( this );
// Connect Events
xscale->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREV_3D_BASE::onMouseWheelScale ), NULL, this );
xscale->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREV_3D_BASE::updateOrientation ), NULL, this );
@@ -306,5 +306,5 @@ PANEL_PREV_3D_BASE::~PANEL_PREV_3D_BASE()
m_bpvTop->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DTop ), NULL, this );
m_bpvBottom->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DBottom ), NULL, this );
m_bpUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREV_3D_BASE::View3DUpdate ), NULL, this );
}
File diff suppressed because it is too large Load Diff
+11 -13
View File
@@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __PANEL_PREV_3D_BASE_H__
#define __PANEL_PREV_3D_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@@ -21,10 +20,10 @@
#include <wx/spinbutt.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/panel.h>
@@ -34,10 +33,10 @@
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_PREV_3D_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_PREV_3D_BASE : public wxPanel
class PANEL_PREV_3D_BASE : public wxPanel
{
private:
protected:
wxStaticText* m_staticText1;
wxTextCtrl* xscale;
@@ -74,7 +73,7 @@ class PANEL_PREV_3D_BASE : public wxPanel
wxBitmapButton* m_bpvTop;
wxBitmapButton* m_bpvBottom;
wxBitmapButton* m_bpUpdate;
// Virtual event handlers, overide them in your derived class
virtual void onMouseWheelScale( wxMouseEvent& event ) { event.Skip(); }
virtual void updateOrientation( wxCommandEvent& event ) { event.Skip(); }
@@ -94,14 +93,13 @@ class PANEL_PREV_3D_BASE : public wxPanel
virtual void View3DTop( wxCommandEvent& event ) { event.Skip(); }
virtual void View3DBottom( wxCommandEvent& event ) { event.Skip(); }
virtual void View3DUpdate( wxCommandEvent& event ) { event.Skip(); }
public:
wxTextCtrl* yoff;
PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
PANEL_PREV_3D_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_PREV_3D_BASE();
};
#endif //__PANEL_PREV_3D_BASE_H__
+6 -2
View File
@@ -44,7 +44,7 @@ if( APPLE )
endif()
find_file( S3DSG_VERSION_FILE sg_version.h
PATHS ${CMAKE_SOURCE_DIR}/include/plugins/3dapi NO_DEFAULT_PATH )
PATHS ${CMAKE_SOURCE_DIR}/include/plugins/3dapi NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
if( NOT ${S3DSG_VERSION_FILE} STREQUAL "S3DSG_VERSION_FILE-NOTFOUND" )
@@ -95,8 +95,12 @@ target_compile_definitions( kicad_3dsg PRIVATE -DCOMPILE_SGLIB )
target_link_libraries( kicad_3dsg ${wxWidgets_LIBRARIES} )
# Don't specify the ARCHIVE DESTINATION parameter to prevent
# the install of the import library on Windows
# https://cmake.org/pipermail/cmake/2011-November/047746.html
install( TARGETS
kicad_3dsg
DESTINATION ${KICAD_LIB}
RUNTIME DESTINATION ${KICAD_LIB}
LIBRARY DESTINATION ${KICAD_LIB}
COMPONENT binary
)
+3 -7
View File
@@ -272,13 +272,9 @@ void CINFO3D_VISU::InitSettings( REPORTER *aStatusTextReporter )
{
wxLogTrace( m_logTrace, wxT( "CINFO3D_VISU::InitSettings" ) );
// Calculates the board bounding box
// First, use only the board outlines
EDA_RECT bbbox = m_board->ComputeBoundingBox( true );
// If no outlines, use the board with items
if( ( bbbox.GetWidth() == 0 ) && ( bbbox.GetHeight() == 0 ) )
bbbox = m_board->ComputeBoundingBox( false );
// Calculates the board bounding box (board outlines + items)
// to ensure any item, even outside the board outlines can be seen
EDA_RECT bbbox = m_board->ComputeBoundingBox( false );
// Gives a non null size to avoid issues in zoom / scale calculations
if( ( bbbox.GetWidth() == 0 ) && ( bbbox.GetHeight() == 0 ) )
@@ -386,9 +386,22 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
case PAD_SHAPE_RECT:
{
// see pcbnew/board_items_to_polygon_shape_transform.cpp
wxPoint corners[4];
aPad->BuildPadPolygon( corners, wxSize( 0, 0), aPad->GetOrientation() );
bool drawOutline;
// For aClearanceValue.x == aClearanceValue.y and > 0 we use the pad shape
// and draw outlines with thicknes = aClearanceValue.
// Otherwise we draw only the inflated/deflated shape
if( aClearanceValue.x > 0 && aClearanceValue.x == aClearanceValue.y )
{
drawOutline = true;
aPad->BuildPadPolygon( corners, wxSize( 0, 0 ), aPad->GetOrientation() );
}
else
{
drawOutline = false;
aPad->BuildPadPolygon( corners, aClearanceValue, aPad->GetOrientation() );
}
SFVEC2F corners3DU[4];
@@ -416,20 +429,23 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
// Add the PAD contours
// Round segments cannot have 0-length elements, so we approximate them
// as a small circle
for( int i = 1; i <= 4; i++ )
if( drawOutline )
{
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
for( int i = 1; i <= 4; i++ )
{
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
aClearanceValue.x * m_biuTo3Dunits,
*aPad ) );
}
else
{
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
corners3DU[i & 3],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
{
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
aClearanceValue.x * m_biuTo3Dunits,
*aPad ) );
}
else
{
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
corners3DU[i & 3],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
}
}
}
}
+28 -26
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -57,6 +57,9 @@ const wxChar * EDA_3D_CANVAS::m_logTrace = wxT( "KI_TRACE_EDA_3D_CANVAS" );
const float EDA_3D_CANVAS::m_delta_move_step_factor = 0.7f;
// A custom event, used to call DoRePaint during an idle time
wxDEFINE_EVENT( wxEVT_REFRESH_CUSTOM_COMMAND, wxEvent);
BEGIN_EVENT_TABLE( EDA_3D_CANVAS, wxGLCanvas )
EVT_PAINT( EDA_3D_CANVAS::OnPaint )
@@ -78,6 +81,7 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, wxGLCanvas )
// other events
EVT_ERASE_BACKGROUND( EDA_3D_CANVAS::OnEraseBackground )
EVT_CUSTOM(wxEVT_REFRESH_CUSTOM_COMMAND, ID_CUSTOM_EVENT_1, EDA_3D_CANVAS::OnRefreshRequest )
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START,
ID_POPUP_3D_VIEW_END, EDA_3D_CANVAS::OnPopUpMenu )
@@ -312,17 +316,22 @@ void EDA_3D_CANVAS::DisplayStatus()
}
void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
void EDA_3D_CANVAS::OnPaint( wxPaintEvent& aEvent )
{
// Please have a look at:
// https://lists.launchpad.net/kicad-developers/msg25149.html
// wxPaintDC( this );
// event.Skip( false );
// aEvent.Skip( false );
DoRePaint();
}
void EDA_3D_CANVAS::DoRePaint()
{
// SwapBuffer requires the window to be shown before calling
if( !IsShownOnScreen() )
{
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnPaint !IsShown" );
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::DoRePaint !IsShown" );
return;
}
@@ -856,13 +865,13 @@ void EDA_3D_CANVAS::restart_editingTimeOut_Timer()
void EDA_3D_CANVAS::OnTimerTimeout_Redraw( wxTimerEvent &event )
{
(void)event;
Request_refresh( true );
}
//Refresh();
//Update();
wxPaintEvent redrawEvent;
wxPostEvent( this, redrawEvent );
void EDA_3D_CANVAS::OnRefreshRequest( wxEvent& aEvent )
{
DoRePaint();
}
@@ -870,22 +879,12 @@ void EDA_3D_CANVAS::Request_refresh( bool aRedrawImmediately )
{
if( aRedrawImmediately )
{
// On some systems, just calling Refresh does not work always
// (Issue experienced on Win7 MSYS2)
//Refresh();
//Update();
// Using PostEvent will take priority to other events, like
// mouse movements, keys, etc.
wxPaintEvent redrawEvent;
// Just calling Refresh() does not work always
// Using an event to call DoRepaint ensure the repaint code will be executed,
// and PostEvent will take priority to other events like mouse movements, keys, etc.
// and is executed during the next idle time
wxCommandEvent redrawEvent( wxEVT_REFRESH_CUSTOM_COMMAND, ID_CUSTOM_EVENT_1 );
wxPostEvent( this, redrawEvent );
// This behaves the same
// wxQueueEvent( this,
// From wxWidget documentation: "The heap-allocated and
// non-NULL event to queue, the function takes ownership of it."
// new wxPaintEvent()
// );
}
else
{
@@ -1085,7 +1084,10 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
m_settings.CameraGet().RotateZ_T1( glm::radians( -180.0f ) );
// The rotation angle should be 180.
// We use 179.999 (180 - epsilon) to avoid a full 360 deg rotation when
// using 180 deg if the previous rotated position was already 180 deg
m_settings.CameraGet().RotateZ_T1( glm::radians( -179.999f ) );
request_start_moving_camera();
return true;
@@ -1101,7 +1103,7 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
m_settings.CameraGet().RotateY_T1( glm::radians( 180.0f ) );
m_settings.CameraGet().RotateY_T1( glm::radians( 179.999f ) ); // Rotation = 180-epsilon
request_start_moving_camera(
glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
return true;
+13 -2
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -135,10 +135,21 @@ class EDA_3D_CANVAS : public HIDPI_GL_CANVAS
private:
void OnPaint( wxPaintEvent &event );
/** Called by a wxPaintEvent event
*/
void OnPaint( wxPaintEvent& aEvent );
/**
* The actual function to repaint the canvas.
* It is usually called by OnPaint() but because it does not use a wxPaintDC
* it can be called outside a wxPaintEvent
*/
void DoRePaint();
void OnEraseBackground( wxEraseEvent &event );
void OnRefreshRequest( wxEvent& aEvent );
void OnMouseWheel( wxMouseEvent &event );
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
@@ -286,7 +286,9 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
m_outlineBoard2dObjects = new CCONTAINER2D;
if( ((const SHAPE_POLY_SET &)m_settings.GetBoardPoly()).OutlineCount() == 1 )
const int outlineCount = m_settings.GetBoardPoly().OutlineCount();
if( outlineCount > 0 )
{
float divFactor = 0.0f;
@@ -299,12 +301,16 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
SHAPE_POLY_SET boardPolyCopy = m_settings.GetBoardPoly();
boardPolyCopy.Fracture( SHAPE_POLY_SET::PM_FAST );
Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
boardPolyCopy,
*m_outlineBoard2dObjects,
m_settings.BiuTo3Dunits(),
divFactor,
(const BOARD_ITEM &)*m_settings.GetBoard() );
for( int iOutlinePolyIdx = 0; iOutlinePolyIdx < outlineCount; iOutlinePolyIdx++ )
{
Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
boardPolyCopy,
*m_outlineBoard2dObjects,
m_settings.BiuTo3Dunits(),
divFactor,
*dynamic_cast<const BOARD_ITEM*>( m_settings.GetBoard() ),
iOutlinePolyIdx );
}
if( m_settings.GetFlag( FL_SHOW_BOARD_BODY ) )
{
@@ -443,6 +449,10 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
++ii )
{
PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
const CBVHCONTAINER2D *container2d = static_cast<const CBVHCONTAINER2D *>(ii->second);
if( !container2d )
continue;
// Mask kayers are not processed here because they are a special case
if( (layer_id == B_Mask) || (layer_id == F_Mask) )
@@ -503,7 +513,6 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
break;
}
const CBVHCONTAINER2D *container2d = static_cast<const CBVHCONTAINER2D *>(ii->second);
const LIST_OBJECT2D &listObject2d = container2d->GetList();
for( LIST_OBJECT2D::const_iterator itemOnLayer = listObject2d.begin();
@@ -649,6 +658,9 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
const CBVHCONTAINER2D *containerLayer2d =
static_cast<const CBVHCONTAINER2D *>(ii->second);
if( !containerLayer2d )
continue;
// Only get the Solder mask layers
if( !((layer_id == B_Mask) || (layer_id == F_Mask)) )
continue;
@@ -408,17 +408,16 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
CGENERICCONTAINER2D &aDstContainer,
float aBiuTo3DunitsScale,
float aDivFactor,
const BOARD_ITEM &aBoardItem )
const BOARD_ITEM &aBoardItem,
int aPolyIndex )
{
BOX2I pathBounds = aMainPath.BBox();
// Get the path
wxASSERT( aMainPath.OutlineCount() == 1 );
const SHAPE_POLY_SET::POLYGON& curr_polywithholes = aMainPath.CPolygon( 0 );
wxASSERT( aPolyIndex < aMainPath.OutlineCount() );
wxASSERT( curr_polywithholes.size() == 1 );
const SHAPE_LINE_CHAIN& path = curr_polywithholes[0]; // a simple polygon
const SHAPE_LINE_CHAIN& path = aMainPath.COutline( aPolyIndex );
BOX2I pathBounds = path.BBox();
// Convert the points to segments class
CBBOX2D bbox;
@@ -430,8 +429,10 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
// Contains a closed polygon used to calc if points are inside
SEGMENTS segments;
segments_and_normals.resize( path.PointCount() );
segments.resize( path.PointCount() );
segments_and_normals.reserve( path.PointCount() );
segments.reserve( path.PointCount() );
SFVEC2F prevPoint;
for( int i = 0; i < path.PointCount(); i++ )
{
@@ -440,9 +441,23 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
const SFVEC2F point ( (float)( a.x) * aBiuTo3DunitsScale,
(float)(-a.y) * aBiuTo3DunitsScale );
bbox.Union( point );
segments_and_normals[i].m_Start = point;
segments[i].m_Start = point;
// Only add points that are not coincident
if( (i == 0) ||
(fabs(prevPoint.x - point.x) > FLT_EPSILON) ||
(fabs(prevPoint.y - point.y) > FLT_EPSILON) )
{
prevPoint = point;
bbox.Union( point );
SEGMENT_WITH_NORMALS sn;
sn.m_Start = point;
segments_and_normals.push_back( sn );
POLYSEGMENT ps;
ps.m_Start = point;
segments.push_back( ps );
}
}
bbox.ScaleNextUp();
@@ -518,13 +533,13 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
segments_and_normals[i].m_Normals.m_Start = normalSeg;
else
segments_and_normals[i].m_Normals.m_Start =
glm::normalize( (((normalBeforeSeg * dotBefore ) + normalSeg) * 0.5f) );
glm::normalize( (normalBeforeSeg * dotBefore ) + normalSeg );
if( dotAfter < 0.7f )
segments_and_normals[i].m_Normals.m_End = normalSeg;
else
segments_and_normals[i].m_Normals.m_End =
glm::normalize( (((normalAfterSeg * dotAfter ) + normalSeg) * 0.5f) );
glm::normalize( (normalAfterSeg * dotAfter ) + normalSeg );
}
if( aDivFactor == 0.0f )
@@ -148,7 +148,8 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
CGENERICCONTAINER2D &aDstContainer,
float aBiuTo3DunitsScale,
float aDivFactor,
const BOARD_ITEM &aBoardItem );
const BOARD_ITEM &aBoardItem,
int aPolyIndex );
void Polygon2d_TestModule();
+38 -8
View File
@@ -31,6 +31,17 @@
#include <wx/log.h>
// A helper function to normalize aAngle between -2PI and +2PI
inline void normalise2PI( float& aAngle )
{
while( aAngle > 0.0 )
aAngle -= M_PI*2;
while( aAngle < 0.0 )
aAngle += M_PI*2;
}
/**
* Trace mask used to enable or disable the trace output of this class.
* The debug output can be turned on by setting the WXTRACE environment variable to
@@ -95,6 +106,20 @@ void CCAMERA::Reset_T1()
m_zoom_t1 = 1.0f;
m_rotate_aux_t1 = SFVEC3F( 0.0f );
m_lookat_pos_t1 = m_board_lookat_pos_init;
// Since 0 = 2pi, we want to reset the angle to be the closest
// one to where we currently are. That ensures that we rotate
// the board around the smallest distance getting there.
if( m_rotate_aux_t0.x > M_PI )
m_rotate_aux_t1.x = 2*M_PI;
if( m_rotate_aux_t0.y > M_PI )
m_rotate_aux_t1.y = 2*M_PI;
if( m_rotate_aux_t0.z > M_PI )
m_rotate_aux_t1.z = 2*M_PI;
}
@@ -111,14 +136,17 @@ void CCAMERA::updateRotationMatrix()
m_rotationMatrixAux = glm::rotate( glm::mat4( 1.0f ),
m_rotate_aux.x,
SFVEC3F( 1.0f, 0.0f, 0.0f ) );
normalise2PI( m_rotate_aux.x );
m_rotationMatrixAux = glm::rotate( m_rotationMatrixAux,
m_rotate_aux.y,
SFVEC3F( 0.0f, 1.0f, 0.0f ) );
normalise2PI( m_rotate_aux.y );
m_rotationMatrixAux = glm::rotate( m_rotationMatrixAux,
m_rotate_aux.z,
SFVEC3F( 0.0f, 0.0f, 1.0f ) );
normalise2PI( m_rotate_aux.z );
m_parametersChanged = true;
@@ -163,7 +191,7 @@ void CCAMERA::rebuildProjection()
m_projectionMatrixInv = glm::inverse( m_projectionMatrix );
m_frustum.tang = glm::tan( glm::radians( m_frustum.angle ) * 0.5f ) ;
m_frustum.tang = glm::tan( glm::radians( m_frustum.angle ) * 0.5f );
m_focalLen.x = ( (float)m_windowSize.y / (float)m_windowSize.x ) / m_frustum.tang;
m_focalLen.y = 1.0f / m_frustum.tang;
@@ -178,19 +206,21 @@ void CCAMERA::rebuildProjection()
m_frustum.nearD = -m_frustum.farD; // Use a symmetrical clip plane for ortho projection
const float orthoReductionFactor = m_zoom / 75.0f;
// This formula was found by trial and error
const float orthoReductionFactor = glm::length( m_camera_pos_init ) *
m_zoom * m_zoom * 0.5f;
// Initialize Projection Matrix for Ortographic View
m_projectionMatrix = glm::ortho( -m_windowSize.x * orthoReductionFactor,
m_windowSize.x * orthoReductionFactor,
-m_windowSize.y * orthoReductionFactor,
m_windowSize.y * orthoReductionFactor,
m_projectionMatrix = glm::ortho( -m_frustum.ratio * orthoReductionFactor,
m_frustum.ratio * orthoReductionFactor,
-orthoReductionFactor,
orthoReductionFactor,
m_frustum.nearD, m_frustum.farD );
m_projectionMatrixInv = glm::inverse( m_projectionMatrix );
m_frustum.nw = m_windowSize.x * orthoReductionFactor * 2.0f;
m_frustum.nh = m_windowSize.y * orthoReductionFactor * 2.0f;
m_frustum.nw = orthoReductionFactor * 2.0f * m_frustum.ratio;
m_frustum.nh = orthoReductionFactor * 2.0f;
m_frustum.fw = m_frustum.nw;
m_frustum.fh = m_frustum.nh;
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -12,251 +12,252 @@
DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizeLeft;
bSizeLeft = new wxBoxSizer( wxVERTICAL );
m_staticText3DRenderOpts = new wxStaticText( this, wxID_ANY, _("Render options:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3DRenderOpts->Wrap( -1 );
m_staticText3DRenderOpts->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizeLeft->Add( m_staticText3DRenderOpts, 0, wxALL, 5 );
wxFlexGridSizer* fgSizerRenderOptions;
fgSizerRenderOptions = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerRenderOptions->SetFlexibleDirection( wxBOTH );
fgSizerRenderOptions->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizerRenderOptions->Add( 0, 0, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
m_bitmapRealisticMode = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_bitmapRealisticMode, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxRealisticMode = new wxCheckBox( this, wxID_ANY, _("Realistic mode"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_checkBoxRealisticMode, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerRenderOptions->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapBoardBody = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_bitmapBoardBody, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxBoardBody = new wxCheckBox( this, wxID_ANY, _("Show board body"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_checkBoxBoardBody, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerRenderOptions->Add( 0, 0, 1, wxEXPAND, 5 );
m_bitmapCuThickness = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_bitmapCuThickness, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxCuThickness = new wxCheckBox( this, wxID_ANY, _("Show copper thickness"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_checkBoxCuThickness, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerRenderOptions->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapBoundingBoxes = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_bitmapBoundingBoxes, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxBoundingBoxes = new wxCheckBox( this, wxID_ANY, _("Show model bounding boxes"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_checkBoxBoundingBoxes, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerRenderOptions->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapAreas = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_bitmapAreas, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxAreas = new wxCheckBox( this, wxID_ANY, _("Show filled areas in zones"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_checkBoxAreas, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizerRenderOptions->Add( fgSizer3, 1, wxEXPAND, 5 );
bSizeLeft->Add( fgSizerRenderOptions, 0, wxEXPAND|wxBOTTOM, 5 );
bSizeLeft->Add( 0, 10, 0, 0, 5 );
m_staticText3DmodelVisibility = new wxStaticText( this, wxID_ANY, _("3D model visibility:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3DmodelVisibility->Wrap( -1 );
m_staticText3DmodelVisibility->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizeLeft->Add( m_staticText3DmodelVisibility, 0, wxALL, 5 );
wxFlexGridSizer* fgSizer3DVisibility;
fgSizer3DVisibility = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer3DVisibility->SetFlexibleDirection( wxBOTH );
fgSizer3DVisibility->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizer3DVisibility->Add( 0, 0, 1, wxRIGHT|wxLEFT, 10 );
m_bitmap3DshapesTH = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_bitmap3DshapesTH, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBox3DshapesTH = new wxCheckBox( this, wxID_ANY, _("Show 3D through hole models"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_checkBox3DshapesTH, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizer3DVisibility->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmap3DshapesSMD = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_bitmap3DshapesSMD, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBox3DshapesSMD = new wxCheckBox( this, wxID_ANY, _("Show 3D SMD models"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_checkBox3DshapesSMD, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizer3DVisibility->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmap3DshapesVirtual = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_bitmap3DshapesVirtual, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBox3DshapesVirtual = new wxCheckBox( this, wxID_ANY, _("Show 3D virtual models"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_checkBox3DshapesVirtual, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizeLeft->Add( fgSizer3DVisibility, 0, wxEXPAND, 5 );
bSizerUpper->Add( bSizeLeft, 1, wxEXPAND, 5 );
m_staticlineVertical = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
bSizerUpper->Add( m_staticlineVertical, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizeLayer;
bSizeLayer = new wxBoxSizer( wxVERTICAL );
m_staticTextBoardLayers = new wxStaticText( this, wxID_ANY, _("Board layers:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextBoardLayers->Wrap( -1 );
m_staticTextBoardLayers->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizeLayer->Add( m_staticTextBoardLayers, 0, wxALL, 5 );
wxFlexGridSizer* fgSizerShowBrdLayersOpts;
fgSizerShowBrdLayersOpts = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerShowBrdLayersOpts->SetFlexibleDirection( wxBOTH );
fgSizerShowBrdLayersOpts->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapSilkscreen = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapSilkscreen, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxSilkscreen = new wxCheckBox( this, wxID_ANY, _("Show silkscreen layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxSilkscreen, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapSolderMask = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapSolderMask, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxSolderMask = new wxCheckBox( this, wxID_ANY, _("Show solder mask layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxSolderMask, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapSolderPaste = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapSolderPaste, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxSolderpaste = new wxCheckBox( this, wxID_ANY, _("Show solder paste layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxSolderpaste, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapAdhesive = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapAdhesive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxAdhesive = new wxCheckBox( this, wxID_ANY, _("Show adhesive layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxAdhesive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizeLayer->Add( fgSizerShowBrdLayersOpts, 0, wxEXPAND, 5 );
bSizeLayer->Add( 0, 10, 0, 0, 5 );
m_staticTextUserLayers = new wxStaticText( this, wxID_ANY, _("User layers (not shown in realistic mode):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUserLayers->Wrap( -1 );
m_staticTextUserLayers->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizeLayer->Add( m_staticTextUserLayers, 0, wxALL, 5 );
wxFlexGridSizer* fgSizerShowUserLayersOpts;
fgSizerShowUserLayersOpts = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerShowUserLayersOpts->SetFlexibleDirection( wxBOTH );
fgSizerShowUserLayersOpts->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizerShowUserLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapComments = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_bitmapComments, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxComments = new wxCheckBox( this, wxID_ANY, _("Show comments and drawings layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_checkBoxComments, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerShowUserLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapECO = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_bitmapECO, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxECO = new wxCheckBox( this, wxID_ANY, _("Show ECO layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_checkBoxECO, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizeLayer->Add( fgSizerShowUserLayersOpts, 0, wxEXPAND, 5 );
bSizerRight->Add( bSizeLayer, 1, wxEXPAND, 5 );
bSizerUpper->Add( bSizerRight, 1, wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
m_staticlineH = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticlineH, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxALL|wxALIGN_RIGHT, 5 );
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH );
// Connect Events
m_checkBoxRealisticMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
}
@@ -265,5 +266,5 @@ DIALOG_3D_VIEW_OPTIONS_BASE::~DIALOG_3D_VIEW_OPTIONS_BASE()
{
// Disconnect Events
m_checkBoxRealisticMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
}
File diff suppressed because it is too large Load Diff
@@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_3D_VIEW_OPTION_BASE_H__
#define __DIALOG_3D_VIEW_OPTION_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@@ -37,7 +36,7 @@
class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText3DRenderOpts;
wxStaticBitmap* m_bitmapRealisticMode;
@@ -76,16 +75,15 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCheckRealisticMode( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 571,372 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_3D_VIEW_OPTIONS_BASE();
};
#endif //__DIALOG_3D_VIEW_OPTION_BASE_H__
+31 -14
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -22,11 +22,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file eda_3d_viewer.cpp
* @brief Implements a 3d viewer windows GUI
*/
#include <wx/colordlg.h>
#include <wx/colour.h>
#include <wx/filename.h>
#include <wx/string.h>
#include <wx/wupdlock.h>
#include <wx/clipbrd.h>
#include "eda_3d_viewer.h"
#include "../3d_viewer_id.h"
@@ -271,6 +272,7 @@ void EDA_3D_VIEWER::OnCloseWindow( wxCloseEvent &event )
event.Skip( true );
}
#define ROT_ANGLE 10.0
void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
@@ -292,7 +294,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
break;
case ID_ROTATE3D_X_POS:
m_settings.CameraGet().RotateX( glm::radians(ROT_ANGLE) );
m_settings.CameraGet().RotateX( glm::radians( ROT_ANGLE ) );
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
m_canvas->Request_refresh();
@@ -302,7 +304,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
break;
case ID_ROTATE3D_X_NEG:
m_settings.CameraGet().RotateX( -glm::radians(ROT_ANGLE) );
m_settings.CameraGet().RotateX( -glm::radians( ROT_ANGLE ) );
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
m_canvas->Request_refresh();
@@ -369,7 +371,11 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
case ID_ORTHO:
m_settings.CameraGet().ToggleProjection();
m_canvas->Request_refresh();
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
m_canvas->Request_refresh();
else
m_canvas->RenderRaytracingRequest();
return;
case ID_TOOL_SCREENCOPY_TOCLIBBOARD:
@@ -677,11 +683,11 @@ void EDA_3D_VIEWER::OnDisableRayTracing( wxCommandEvent& aEvent )
}
void EDA_3D_VIEWER::OnActivate( wxActivateEvent &event )
void EDA_3D_VIEWER::OnActivate( wxActivateEvent &aEvent )
{
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnActivate" );
if( m_canvas )
if( aEvent.GetActive() && m_canvas )
{
// Reload data if 3D frame shows a board,
// because it can be changed since last frame activation
@@ -692,17 +698,17 @@ void EDA_3D_VIEWER::OnActivate( wxActivateEvent &event )
m_canvas->SetFocus();
}
event.Skip(); // required under wxMAC
aEvent.Skip(); // required under wxMAC
}
void EDA_3D_VIEWER::OnSetFocus(wxFocusEvent &event)
void EDA_3D_VIEWER::OnSetFocus( wxFocusEvent& aEvent )
{
// Activates again the focus of the canvas so it will catch mouse and key events
if( m_canvas )
m_canvas->SetFocus();
event.Skip();
aEvent.Skip();
}
@@ -985,6 +991,17 @@ void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
fullFileName = m_defaultSaveScreenshotFileName.GetFullPath();
wxFileName fn = fullFileName;
if( !fn.IsDirWritable() )
{
wxString msg;
msg.Printf( _( "Insufficient permissions required to save file\n%s" ), fullFileName );
wxMessageBox( msg, _( "Error" ), wxOK | wxICON_ERROR, this );
return;
}
// Be sure the screen area destroyed by the file dialog is redrawn
// before making a screen copy.
// Without this call, under Linux the screen refresh is made to late.
+2
View File
@@ -103,6 +103,8 @@ enum id_3dview_frm
ID_DISABLE_RAY_TRACING,
ID_CUSTOM_EVENT_1, // A id for a custom event (canvas refresh request)
ID_POPUP_3D_VIEW_START,
ID_POPUP_ZOOMIN,
ID_POPUP_ZOOMOUT,
+4 -2
View File
@@ -46,9 +46,10 @@ Russell Oliver <roliver8143[at]gmail-dot-com>
Seth Hillbrand <hillbrand[at]ucdavis-dot-edu>
Jeff Young <jeff[at]rokeby-dot-ie>
Kevin Cozens <kevin[at]ve3syb-dot-ca>
Ian McInerney <ian.s.mcinerney[at]ieee-dot-org>
See git repo on launchpad for contributors at
https://code.launchpad.net/~kicad-product-committers/kicad/+git/product-git/+ref/master.
See git repo on GitLab for contributors at
https://gitlab.com/kicad/code/kicad/-/graphs/master
== Document Writers
@@ -75,6 +76,7 @@ Spanish (ES) Pedro Martin del Valle <pkicad[at]yahoo-dot-es>
Spanish (ES) Iñigo Zuluaga <inigo_zuluaga[at]yahoo-dot-es>
German (DE) Rafael Sokolowski <Rafael.Sokolowski[at]web-dot-de
Japanese (JA) Kenta Yonekura <yoneken[at]kicad-dot-jp>
Simplified Chinese (zh_CN) taotieren <admin[at]taotieren-dot-com>
Remy Halvick, David Briscoe, Dominique Laigle, Paul Burke
+24 -33
View File
@@ -21,14 +21,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
cmake_minimum_required( VERSION 2.8.12 FATAL_ERROR )
# because of http://public.kitware.com/Bug/view.php?id=10395
# See https://gitlab.kitware.com/cmake/cmake/issues/15943
# Remove as soon as 3.1 is minimum required version
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW) # CMake 3.0
endif()
cmake_minimum_required( VERSION 3.2 FATAL_ERROR )
# Default to CMAKE_BUILD_TYPE = Release unless overridden on command line
# http://www.cmake.org/pipermail/cmake/2008-September/023808.html
@@ -91,12 +84,12 @@ option( KICAD_SCRIPTING_ACTION_MENU
ON )
option( KICAD_USE_OCE
"Build tools and plugins related to OpenCascade Community Edition (default ON)"
ON )
"Build tools and plugins related to OpenCascade Community Edition (default OFF)"
OFF )
option( KICAD_USE_OCC
"Build tools and plugins related to OpenCascade Technology (overrides KICAD_USE_OCE, default OFF)"
OFF )
"Build tools and plugins related to OpenCascade Technology (overrides KICAD_USE_OCE, default ON)"
ON )
option( KICAD_INSTALL_DEMOS
"Install KiCad demos and examples (default ON)"
@@ -200,24 +193,6 @@ include( PerformFeatureChecks )
perform_feature_checks()
# Workaround: CMake < 3.1 does not support CMAKE_CXX_STANDARD
if( NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1 )
message( FATAL_ERROR "Remove compatibility code" )
endif()
if( CMAKE_VERSION VERSION_LESS 3.1 AND ( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) )
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
endif()
# Warn about missing override specifiers, if supported
if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
include(CheckCXXCompilerFlag)
@@ -413,7 +388,7 @@ endif()
if( KICAD_USE_OCC )
add_definitions( -DKICAD_USE_OCC )
remove_definitions( -DKICAD_USE_OCE )
unset( KICAD_USE_OCE )
unset( KICAD_USE_OCE CACHE )
endif()
if( KICAD_USE_CUSTOM_PADS )
@@ -894,6 +869,16 @@ add_custom_target( uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" )
#################################################
# Generate platform metadata files
#################################################
if( APPLE )
include( ${CMAKE_MODULE_PATH}/WritePlatformMetadata_macos.cmake )
elseif( UNIX )
include( ${CMAKE_MODULE_PATH}/WritePlatformMetadata_linux.cmake )
endif()
#================================================
# Installation
#================================================
@@ -919,7 +904,7 @@ if( UNIX AND NOT APPLE )
set( UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime )
set( UNIX_ICON_FILES ${UNIX_MIME_DIR}/icons )
set( UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications )
set( UNIX_APPDATA_FILES resources/linux/appdata )
set( UNIX_APPDATA_FILES ${PROJECT_BINARY_DIR}/resources/linux/appdata )
# Install Mime directory
install( DIRECTORY ${UNIX_ICON_FILES}
@@ -943,6 +928,9 @@ if( UNIX AND NOT APPLE )
install( DIRECTORY ${UNIX_APPDATA_FILES}
DESTINATION share
COMPONENT resources
FILES_MATCHING
PATTERN "*appdata.xml"
PATTERN "*.in" EXCLUDE
)
endif()
@@ -988,7 +976,10 @@ add_subdirectory( plugins ) # 3D plugins must be built before kicad
add_subdirectory( kicad ) # should follow pcbnew, eeschema
add_subdirectory( tools )
add_subdirectory( utils )
add_subdirectory( qa )
if( KICAD_BUILD_QA_TESTS )
add_subdirectory( qa )
endif()
# Resources
if ( KICAD_INSTALL_DEMOS )
@@ -27,6 +27,8 @@ macro( create_git_version_header _git_src_path )
find_package( Git )
if( GIT_FOUND )
message( STATUS "Using Git to determine build version string." )
set( _Git_SAVED_LC_ALL "$ENV{LC_ALL}" )
set( ENV{LC_ALL} C )
+1 -1
View File
@@ -37,7 +37,7 @@ unset(_Python_NAMES)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
set(_PYTHON3_VERSIONS 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
set(_PYTHON3_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonInterp_FIND_VERSION)
if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
+1 -1
View File
@@ -44,7 +44,7 @@ cmake_find_frameworks(Python)
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
set(_PYTHON3_VERSIONS 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
set(_PYTHON3_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
if(PythonLibs_FIND_VERSION)
if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
+1 -1
View File
@@ -55,7 +55,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig)
find_program(SWIG_EXECUTABLE NAMES swig4.0 swig3.0 swig2.0 swig)
if(SWIG_EXECUTABLE)
execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib
+97 -6
View File
@@ -1,6 +1,8 @@
# CMake script for finding libngspice
# Copyright (C) 2016 CERN
# Copyright (C) 2020 Kicad Developers, see AUTHORS.txt for contributors.
#
# Author: Maciej Suminski <maciej.suminski@cern.ch>
#
# This program is free software; you can redistribute it and/or
@@ -20,21 +22,108 @@
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Usage:
#
# ngspice uses pkg-config to gather the configuration information so the pkg-config
# information is used to populate the CMake find_* commands. When pkg-config is not
# available, the fallback is the default platform search paths set up by CMake. The
# default search paths can be overridden by user. The order of precedence is as
# follows:
#
# User defined root path NGSPICE_ROOT_DIR on CMake command line.
# User defined root path environment variable NGSPICE_ROOT_DIR.
# Paths generated by pkg-config.
# The default system paths configured by CMake
#
# For a specific ngspice include path not defined above set NGSPICE_INCLUDE_PATH.
#
# For a specific ngspice library path not defined above set NGSPICE_LIBRARY_PATH.
# Use pkg-config if it's available.
find_package(PkgConfig)
if( PKG_CONFIG_FOUND )
pkg_check_modules( _NGSPICE ngspice )
if( _NGSPICE_FOUND )
set( NGSPICE_BUILD_VERSION "${_NGSPICE_VERSION}" CACHE STRING
"ngspice version returned by pkg-config" )
endif()
endif()
find_path( NGSPICE_INCLUDE_DIR ngspice/sharedspice.h
PATHS ${NGSPICE_ROOT_DIR} $ENV{NGSPICE_ROOT_DIR} ${NGSPICE_INCLUDE_PATH}
${NGSPICE_ROOT_DIR}/include
PATH_SUFFIXES src/include share/ngspice/include share/ngspice/include/ngspice
PATHS
${NGSPICE_ROOT_DIR}
$ENV{NGSPICE_ROOT_DIR}
${NGSPICE_INCLUDE_PATH}
${_NGSPICE_INCLUDE_DIRS}
PATH_SUFFIXES
include
src/include
share/ngspice/include
share/ngspice/include/ngspice
)
find_library( NGSPICE_LIBRARY ngspice
PATHS ${NGSPICE_ROOT_DIR} $ENV{NGSPICE_ROOT_DIR} ${NGSPICE_LIBRARY_PATH}
PATH_SUFFIXES src/.libs lib
if( UNIX )
set( NGSPICE_LIB_NAME libngspice.so.0 CACHE STRING "Optionally versioned name of the shared library" )
else()
set( NGSPICE_LIB_NAME ngspice CACHE STRING "Optionally versioned name of the shared library" )
endif()
find_library( NGSPICE_LIBRARY ${NGSPICE_LIB_NAME}
PATHS
${NGSPICE_ROOT_DIR}
$ENV{NGSPICE_ROOT_DIR}
${NGSPICE_LIBRARY_PATH}
${_NGSPICE_LIBRARY_DIRS}
PATH_SUFFIXES
src/.libs
lib
)
# If the ngspice version is not set by pkg-config, see if ngspice/config.h is available.
if( NOT NGSPICE_BUILD_VERSION )
find_file( NGSPICE_CONFIG_H ngspice/config.h
PATHS
${NGSPICE_ROOT_DIR}
$ENV{NGSPICE_ROOT_DIR}
${NGSPICE_INCLUDE_PATH}
${_NGSPICE_INCLUDE_DIRS}
PATH_SUFFIXES
include
src/include
share/ngspice/include
share/ngspice/include/ngspice
)
if( NOT NGSPICE_CONFIG_H-NOTFOUND )
message( STATUS "ngspice configuration file ${NGSPICE_CONFIG_H} found." )
set( NGSPICE_HAVE_CONFIG_H "1" CACHE STRING "ngspice/config.h header found." )
endif()
endif()
if( WIN32 AND MSYS )
# NGSPICE_LIBRARY points to libngspice.dll.a on Windows,
# but the goal is to find out the DLL name.
find_library( NGSPICE_DLL NAMES libngspice-0.dll libngspice-1.dll )
# Some msys versions do not find xxx.dll lib files, only xxx.dll.a files
# so try a find_file in exec paths
if( NGSPICE_DLL STREQUAL "NGSPICE_DLL-NOTFOUND" )
find_file( NGSPICE_DLL NAMES libngspice-0.dll libngspice-1.dll
PATHS
${NGSPICE_ROOT_DIR}
PATH_SUFFIXES
bin
lib
)
endif()
if( NGSPICE_DLL STREQUAL "NGSPICE_DLL-NOTFOUND" )
message( ERROR ":\n***** libngspice-x.dll not found in any executable path *****\n\n" )
else()
message( STATUS ": libngspice shared lib found: ${NGSPICE_DLL}\n" )
endif()
else()
set( NGSPICE_DLL "${NGSPICE_LIBRARY}" )
endif()
@@ -62,4 +151,6 @@ mark_as_advanced(
NGSPICE_INCLUDE_DIR
NGSPICE_LIBRARY
NGSPICE_DLL
NGSPICE_BUILD_VERSION
NGSPICE_HAVE_CONFIG_H
)
+40
View File
@@ -0,0 +1,40 @@
#
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
# Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
# This file will create the full KiCad version string. The base of this string
# will be either the git tag followed by the commit hash (if built inside a git
# repository), or the version from KiCadVersion.cmake. The user-provided
# KICAD_VERSION_EXTRA is then appended to the base version string.
# Use git to determine the version string if it's available.
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
create_git_version_header( ${SRC_PATH} )
# $KICAD_VERSION is set in KiCadVersion.cmake or by git (if it is available).
set( KICAD_VERSION_FULL "${KICAD_VERSION}" )
# Optional user version information defined at configuration.
if( KICAD_VERSION_EXTRA )
set( KICAD_VERSION_FULL "${KICAD_VERSION_FULL}-${KICAD_VERSION_EXTRA}" )
endif()
+2 -2
View File
@@ -2,7 +2,7 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2016 Wayne Stambaugh <stambaughw@gmail.com>
# Copyright (C) 2016 - 2019 KiCad Developers, see AUTHORS.txt for contributors.
# Copyright (C) 2016 - 2021 KiCad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -35,4 +35,4 @@
# be set after each version tag is added to the git repo. This will
# give developers a reasonable idea where which branch was used to build
# KiCad.
set( KICAD_VERSION "5.1.5" )
set( KICAD_VERSION "5.1.12-unknown" )
@@ -0,0 +1,46 @@
#
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
# Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
# This file will configure the linux appdata.xml file to include the version
# and build date.
message( STATUS "Creating linux metadata" )
# Create the KiCad version strings
set( SRC_PATH ${PROJECT_SOURCE_DIR} )
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
include( ${CMAKE_MODULE_PATH}/KiCadFullVersion.cmake )
# Create the date of the configure
string( TIMESTAMP KICAD_CONFIG_TIMESTAMP "%Y-%m-%d" )
# Configure the KiCad appdata file
configure_file( ${PROJECT_SOURCE_DIR}/resources/linux/appdata/kicad.appdata.xml.in
${PROJECT_BINARY_DIR}/resources/linux/appdata/kicad.appdata.xml
@ONLY )
# Ensure the file was configured successfully
if( NOT EXISTS ${PROJECT_BINARY_DIR}/resources/linux/appdata/kicad.appdata.xml )
message( FATAL_ERROR "Configuration failed to write file kicad.appdata.xml." )
endif()
@@ -0,0 +1,63 @@
#
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
# Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
# This file will configure the MacOS info.plist files to include the version
# and build date.
message( STATUS "Creating MacOS metadata" )
# Create the KiCad version strings
set( SRC_PATH ${PROJECT_SOURCE_DIR} )
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
include( ${CMAKE_MODULE_PATH}/KiCadFullVersion.cmake )
# Configure each plist file from the respurces directory and store it in the build directory
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/bitmap2component.Info.plist.in
${PROJECT_BINARY_DIR}/bitmap2component/Info.plist
@ONLY )
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/eeschema.Info.plist.in
${PROJECT_BINARY_DIR}/eeschema/Info.plist
@ONLY )
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/gerbview.Info.plist.in
${PROJECT_BINARY_DIR}/gerbview/Info.plist
@ONLY )
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/kicad.Info.plist.in
${PROJECT_BINARY_DIR}/kicad/Info.plist
@ONLY )
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/pcb_calculator.Info.plist.in
${PROJECT_BINARY_DIR}/pcb_calculator/Info.plist
@ONLY )
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/pcbnew.Info.plist.in
${PROJECT_BINARY_DIR}/pcbnew/Info.plist
@ONLY )
configure_file( ${PROJECT_SOURCE_DIR}/resources/macos/plist/pleditor.Info.plist.in
${PROJECT_BINARY_DIR}/pagelayout_editor/Info.plist
@ONLY )
+2 -18
View File
@@ -22,25 +22,9 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
# Automagically create version header file if the version string was
# not defined during the build configuration. If CreateGitVersionHeader
# cannot determine the current repo version, a version.h file is still
# created with KICAD_VERSION set in KiCadVersion.cmake.
# Create the KiCad version strings
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
# Always use git if it's available to determine the version string.
message( STATUS "Using Git to determine build version string." )
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
create_git_version_header( ${SRC_PATH} )
# $KICAD_VERSION will always be set to something. Even if it is the default
# value set in KiCadVersion.cmake
set( KICAD_VERSION_FULL "${KICAD_VERSION}" )
# Optional user version information defined at configuration.
if( KICAD_VERSION_EXTRA )
set( KICAD_VERSION_FULL "${KICAD_VERSION_FULL}-${KICAD_VERSION_EXTRA}" )
endif()
include( ${CMAKE_MODULE_PATH}/KiCadFullVersion.cmake )
set( _wvh_new_version_text
"/* Do not modify this file, it was automatically generated by CMake. */
+6
View File
@@ -75,4 +75,10 @@
/// Allows scripts install directory to be referenced by the program code.
#define PYTHON_DEST "@PYTHON_DEST@"
/// ngspice version string detected by pkg-config when available.
#cmakedefine NGSPICE_BUILD_VERSION "@NGSPICE_BUILD_VERSION@"
/// When pkg-config config is not available for ngspice, use ngspice/config.h for version.
#cmakedefine NGSPICE_HAVE_CONFIG_H
#endif // CONFIG_H_
+3 -3
View File
@@ -222,7 +222,7 @@ and can cause Pcbnew to crash if Python scripts create an invalid object state w
The KiCad version string is defined by the output of `git describe --dirty` when git is available
or the version string defined in CMakeModules/KiCadVersion.cmake with the value of
KICAD_VERSION_EXTRA appended to the former. If the KICAD_VERSION_EXTRA variable is not define,
KICAD_VERSION_EXTRA appended to the former. If the KICAD_VERSION_EXTRA variable is not defined,
it is not appended to the version string. If the KICAD_VERSION_EXTRA variable is defined it
is appended along with a leading '-' to the full version string as follows:
@@ -471,8 +471,8 @@ to download and [build Boost][] from source. If you are building Boost on windo
you will have to apply the Boost patches in the KiCad source [patches folder][].
[download]: http://kicad-pcb.org/download/
[KiCad website]: http://kicad-pcb.org/
[download]: http://kicad.org/download/
[KiCad website]: http://kicad.org/
[KiCad Launchpad]: https://launchpad.net/kicad
[GNU GCC]: https://gcc.gnu.org/
[Clang]: http://clang.llvm.org/
+2 -2
View File
@@ -19,11 +19,11 @@ interpreter installed on the system.
The Pcbnew Python API can be used stand-alone, i.e. no instance of Pcbnew is
running and the board project to be manipulated is loaded and saved from and to
file. This approach is shown with some examples in the [user's
documentation](http://docs.kicad-pcb.org/stable/en/pcbnew.html#_kicad_scripting_reference).
documentation](http://docs.kicad.org/stable/en/pcbnew.html#_kicad_scripting_reference).
Another documentation source is the auto-generated Doxygen reference of the
API. It can be found
[here](http://docs.kicad-pcb.org/doxygen-python/namespacepcbnew.html).
[here](http://docs.kicad.org/doxygen-python/namespacepcbnew.html).
# `Action Plugin` Support # {#ppi_action_pi}
Besides the stand-alone usage of the generated Python plugin interface,
+2 -2
View File
@@ -101,5 +101,5 @@ capabilities.
- In progress.
[kicad-website]:http://kicad-pcb.org/
[kicad-docs]:http://ci.kicad-pcb.org/job/kicad-doxygen/ws/Documentation/doxygen/html/index.html
[kicad-website]:http://kicad.org/
[kicad-docs]:http://ci.kicad.org/job/kicad-doxygen/ws/Documentation/doxygen/html/index.html
@@ -71,7 +71,7 @@ GitHub plugin.
To provide a convenient method for system packagers to build KiCad from known stable sources,
source archives in the most common formats along with the resulting md5sum checksum will be
added to either the KiCad developer's site on Launchpad or the main website at www.kicad-pcb.org.
added to either the KiCad developer's site on Launchpad or the main website at www.kicad.org.
# Stable Release Announcement # {#announcement}
+3 -3
View File
@@ -304,6 +304,6 @@ Issues are still welcome for defects discovered.
[Boost Unit Test framework]: https://www.boost.org/doc/libs/1_68_0/libs/test/doc/html/index.html
[boost-test-functions]: https://www.boost.org/doc/libs/1_68_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref.html
[AFL fuzzing tool]: http://lcamtuf.coredump.cx/afl/
[trace mask documentation]: http://docs.kicad-pcb.org/doxygen/group__trace__env__vars.html
[trace mask documentation]: http://docs.kicad-pcb.org/doxygen/group__trace__env__vars.html
[advanced config documentation]: http://docs.kicad-pcb.org/doxygen/namespaceAC__KEYS.html
[trace mask documentation]: http://docs.kicad.org/doxygen/group__trace__env__vars.html
[trace mask documentation]: http://docs.kicad.org/doxygen/group__trace__env__vars.html
[advanced config documentation]: http://docs.kicad.org/doxygen/namespaceAC__KEYS.html
+2 -5
View File
@@ -37,7 +37,7 @@ if( APPLE )
MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE bitmap2component.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-pcb.kicad )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad.kicad )
set( MACOSX_BUNDLE_NAME bitmap2component )
endif()
@@ -54,11 +54,8 @@ target_link_libraries( bitmap2component
)
if( APPLE )
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist @ONLY )
set_target_properties( bitmap2component PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/bitmap2component/Info.plist
)
# put individual bundle outside of main bundle as a first step
-42
View File
@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array/>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>bitmap2component</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>bitmap2component.icns</string>
<key>CFBundleIdentifier</key>
<string>org.kicad-pcb.bitmap2component</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>@KICAD_VERSION_FULL@</string>
<key>CFBundleName</key>
<string>Bitmap 2 Component</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@KICAD_VERSION@</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@KICAD_VERSION_FULL@</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSRequiresAquaSystemAppearance</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>
+8 -7
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 17 2019)
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -38,7 +38,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
brightSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerInfo;
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Bitmap Info:") ), wxVERTICAL );
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Bitmap Info") ), wxVERTICAL );
wxFlexGridSizer* fgSizerInfo;
fgSizerInfo = new wxFlexGridSizer( 0, 4, 0, 0 );
@@ -99,12 +99,12 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
fgSizerInfo->Add( m_staticTextBPI, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_DPIValueX = new wxTextCtrl( sbSizerInfo->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
m_DPIValueX->SetMinSize( wxSize( 40,-1 ) );
m_DPIValueX->SetMinSize( wxSize( 45,-1 ) );
fgSizerInfo->Add( m_DPIValueX, 0, wxBOTTOM|wxRIGHT, 5 );
m_DPIValueY = new wxTextCtrl( sbSizerInfo->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
m_DPIValueY->SetMinSize( wxSize( 40,-1 ) );
m_DPIValueY->SetMinSize( wxSize( 45,-1 ) );
fgSizerInfo->Add( m_DPIValueY, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
@@ -128,12 +128,12 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
wxString m_radioBoxFormatChoices[] = { _("Eeschema (.lib file)"), _("Pcbnew (.kicad_mod file)"), _("Postscript (.ps file)"), _("Logo for title block (.kicad_wks file)") };
int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString );
m_radioBoxFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format:"), wxDefaultPosition, wxDefaultSize, m_radioBoxFormatNChoices, m_radioBoxFormatChoices, 1, wxRA_SPECIFY_COLS );
m_radioBoxFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format"), wxDefaultPosition, wxDefaultSize, m_radioBoxFormatNChoices, m_radioBoxFormatChoices, 1, wxRA_SPECIFY_COLS );
m_radioBoxFormat->SetSelection( 1 );
brightSizer->Add( m_radioBoxFormat, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Image Options:") ), wxVERTICAL );
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Image Options") ), wxVERTICAL );
m_ThresholdText = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Black / White Threshold:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThresholdText->Wrap( -1 );
@@ -152,7 +152,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
wxString m_radio_PCBLayerChoices[] = { _("Front silk screen"), _("Front solder mask"), _("User layer Eco1"), _("User layer Eco2") };
int m_radio_PCBLayerNChoices = sizeof( m_radio_PCBLayerChoices ) / sizeof( wxString );
m_radio_PCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline:"), wxDefaultPosition, wxDefaultSize, m_radio_PCBLayerNChoices, m_radio_PCBLayerChoices, 1, wxRA_SPECIFY_COLS );
m_radio_PCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline"), wxDefaultPosition, wxDefaultSize, m_radio_PCBLayerNChoices, m_radio_PCBLayerChoices, 1, wxRA_SPECIFY_COLS );
m_radio_PCBLayer->SetSelection( 3 );
m_radio_PCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe 2 invisible fields reference and value are always placed on the silk screen layer.") );
@@ -167,6 +167,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
// Connect Events
+11 -7
View File
@@ -14,6 +14,7 @@
<property name="file">bitmap2cmp_gui_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">bitmap2cmp_gui</property>
@@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Frame" expanded="1">
@@ -45,7 +47,7 @@
<property name="minimum_size"></property>
<property name="name">BM2CMP_FRAME_BASE</property>
<property name="pos"></property>
<property name="size">733,634</property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">KIWAY_PLAYER; kiway_player.h</property>
<property name="title">Bitmap to Component Converter</property>
@@ -364,7 +366,7 @@
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Bitmap Info:</property>
<property name="label">Bitmap Info</property>
<property name="minimum_size"></property>
<property name="name">sbSizerInfo</property>
<property name="orient">wxVERTICAL</property>
@@ -1166,7 +1168,7 @@
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">40,-1</property>
<property name="minimum_size">45,-1</property>
<property name="moveable">1</property>
<property name="name">m_DPIValueX</property>
<property name="pane_border">1</property>
@@ -1232,7 +1234,7 @@
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">40,-1</property>
<property name="minimum_size">45,-1</property>
<property name="moveable">1</property>
<property name="name">m_DPIValueY</property>
<property name="pane_border">1</property>
@@ -1338,6 +1340,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1411,6 +1414,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1504,7 +1508,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Format:</property>
<property name="label">Format</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -1544,7 +1548,7 @@
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Image Options:</property>
<property name="label">Image Options</property>
<property name="minimum_size"></property>
<property name="name">sbSizer2</property>
<property name="orient">wxVERTICAL</property>
@@ -1777,7 +1781,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Board Layer for Outline:</property>
<property name="label">Board Layer for Outline</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
+2 -2
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 17 2019)
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -89,7 +89,7 @@ class BM2CMP_FRAME_BASE : public KIWAY_PLAYER
public:
BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Bitmap to Component Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 733,634 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Bitmap to Component Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
~BM2CMP_FRAME_BASE();
+3 -3
View File
@@ -490,9 +490,9 @@ void BITMAPCONV_INFO::CreateOutputFile( BMP2CMP_MOD_LAYER aModLayer )
if( paths->next == NULL || paths->next->sign == '+' )
{
// Substract holes to main polygon:
polyset_areas.Simplify( SHAPE_POLY_SET::PM_FAST );
polyset_holes.Simplify( SHAPE_POLY_SET::PM_FAST );
polyset_areas.BooleanSubtract( polyset_holes, SHAPE_POLY_SET::PM_FAST );
polyset_areas.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
polyset_holes.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
polyset_areas.BooleanSubtract( polyset_holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
polyset_areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Output current resulting polygon(s)
+7 -6
View File
@@ -153,10 +153,10 @@ install( TARGETS lib_kicad
endif()
# KiCad build version string defaults to "no-vcs-found" which forces the build version header
# command to look for git to create the version string header when the .git path is found in
# the source path.
set( KICAD_BRANCH_NAME "" CACHE STRING "KiCad repository name." )
# The build version string defaults to the value in the KiCadVersion.cmake file.
# If being built inside a git repository, the git tag and commit hash are used to create
# a new version string instead. The user can supply an additional string to be appended
# to the end inside the KICAD_VERSION_EXTRA variable
set( KICAD_VERSION_EXTRA "" CACHE STRING
"User defined configuration string to append to KiCad version." )
@@ -164,14 +164,13 @@ set( KICAD_VERSION_EXTRA "" CACHE STRING
add_custom_target(
version_header ALL
COMMAND ${CMAKE_COMMAND}
-DKICAD_VERSION=${KICAD_VERSION}
-DKICAD_BRANCH_NAME=${KICAD_BRANCH_NAME}
-DKICAD_VERSION_EXTRA=${KICAD_VERSION_EXTRA}
-DOUTPUT_FILE=${CMAKE_BINARY_DIR}/kicad_build_version.h
-DSRC_PATH=${PROJECT_SOURCE_DIR}
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
-P ${CMAKE_MODULE_PATH}/WriteVersionHeader.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
BYPRODUCTS ${CMAKE_BINARY_DIR}/kicad_build_version.h
COMMENT "Generating version string header"
)
@@ -278,6 +277,7 @@ set( COMMON_SRCS
${PLOTTERS_CONTROL_SRCS}
advanced_config.cpp
array_options.cpp
base64.cpp
base_struct.cpp
bezier_curves.cpp
bin_mod.cpp
@@ -327,6 +327,7 @@ set( COMMON_SRCS
kiway_express.cpp
kiway_holder.cpp
kiway_player.cpp
launch_ext.cpp
lib_id.cpp
lib_table_base.cpp
lib_table_keywords.cpp
+157
View File
@@ -0,0 +1,157 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Seth Hillbrand <seth@kipro-pcb.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <base64.h>
#include <cstdint>
#include <cstddef>
#include <limits>
#include <vector>
namespace {
static const uint8_t ENCODE_BASE64[64] = {
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E,
0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33,
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F,
};
static const uint8_t E = -1;
static const uint8_t DECODE_BASE64[128] = {
/* 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC 0xD 0xE 0xF */
E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E,
E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E,
E, E, E, E, E, E, E, E, E, E, E, 62, E, E, E, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, E, E, E, E, E, E,
E, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, E, E, E, E, E,
E, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, E, E, E, E, E,
};
} // namespace
namespace base64
{
size_t encode_length( size_t aInputLen )
{
return 4 * ( ( aInputLen + 2 ) / 3 ) + ( aInputLen + 2 ) % 3 - 2;
}
size_t decode_length( size_t aInputLen )
{
if( aInputLen % 4 == 1 )
return 0;
else
return 3 * ( ( aInputLen + 2 ) / 4 ) + ( aInputLen + 2 ) % 4 - 2;
}
void encode( const std::vector<uint8_t>& aInput, std::vector<uint8_t>& aOutput )
{
size_t end = ( aInput.size() / 3 ) * 3;
aOutput.reserve( encode_length( aInput.size() ) );
for( size_t i = 0; i < end; i += 3 )
{
unsigned value = ( aInput[i] << 16 ) | ( aInput[i + 1] << 8 ) | aInput[i + 2] ;
aOutput.emplace_back( ENCODE_BASE64[( value >> 18 ) & 0x3F] );
aOutput.emplace_back( ENCODE_BASE64[( value >> 12 ) & 0x3F] );
aOutput.emplace_back( ENCODE_BASE64[( value >> 6 ) & 0x3F] );
aOutput.emplace_back( ENCODE_BASE64[value & 0x3F] );
}
size_t remainder = aInput.size() - end;
if( remainder )
{
unsigned value = aInput[end];
if( remainder == 2 )
{
value = ( value << 10 ) | ( aInput[end + 1] << 2 );
aOutput.emplace_back( ENCODE_BASE64[( value >> 12 ) & 0x3F] );
}
else
{
value <<= 4;
}
aOutput.emplace_back( ENCODE_BASE64[( value >> 6 ) & 0x3F] );
aOutput.emplace_back( ENCODE_BASE64[value & 0x3F] );
}
}
void decode(const std::vector<uint8_t>& aInput, std::vector<uint8_t>& aOutput )
{
size_t end = ( aInput.size() / 4 ) * 4;
size_t decode_size = decode_length( aInput.size() );
if( !decode_size )
return;
aOutput.reserve( decode_size );
for( size_t i = 0; i < end; i++ )
{
unsigned value = ( DECODE_BASE64[aInput[i] & 0x7F] << 18 ) |
( DECODE_BASE64[aInput[i + 1] & 0x7F] << 12 ) |
( DECODE_BASE64[aInput[i + 2] & 0x7F] << 6 ) |
DECODE_BASE64[aInput[i + 3] & 0x7F];
aOutput.emplace_back( ( value >> 16 ) & 0xff );
aOutput.emplace_back( ( value >> 8 ) & 0xff );
aOutput.emplace_back( value & 0xff );
}
size_t remainder = aInput.size() - end;
if( remainder )
{
unsigned value = ( ( DECODE_BASE64[aInput[end] & 0x7F] ) << 6 ) |
( DECODE_BASE64[aInput[end + 1] & 0x7F] );
if( remainder == 3 )
{
value = ( value << 6 ) | ( DECODE_BASE64[aInput[end + 2] & 0x7F] );
value >>= 2;
aOutput.emplace_back( ( value >> 8 ) & 0xff );
}
else
{
value >>= 4;
}
aOutput[0] = value & 0xff ;
}
}
} // base64
+42 -336
View File
@@ -1,8 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014-2017 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -26,362 +25,69 @@
/* routines to handle bezier curves */
/************************************/
#include <fctsys.h>
#include <bezier_curves.h>
static inline double calc_sq_distance( int x1, int y1, int x2, int y2 )
BEZIER_POLY::BEZIER_POLY( const std::vector<wxPoint>& aControlPoints )
{
int dx = x2 - x1;
int dy = y2 - y1;
for( unsigned ii = 0; ii < aControlPoints.size(); ++ii )
m_ctrlPts.emplace_back( VECTOR2D( aControlPoints[ii] ) );
return (double)dx * dx + (double)dy * dy;
}
static inline double sqrt_len( int dx, int dy )
{
return ((double)dx * dx) + ((double)dy * dy);
m_minSegLen = 0.0;
}
void BEZIER_POLY::GetPoly( std::vector<wxPoint>& aOutput, int aMinSegLen )
{
wxCHECK( !m_ctrlPts.empty(), /* void */ );
m_minSegLen = std::max( 1, aMinSegLen );
m_output = &aOutput;
m_output->clear();
m_output->push_back( wxPoint( m_ctrlPts.front() ) );
aOutput.clear();
std::vector<VECTOR2D> buffer;
GetPoly( buffer, double( aMinSegLen ) );
// Only quadratic and cubic Bezier curves are handled
if( m_ctrlPts.size() == 3 )
recursiveBezier( m_ctrlPts[0].x, m_ctrlPts[0].y,
m_ctrlPts[1].x, m_ctrlPts[1].y,
m_ctrlPts[2].x, m_ctrlPts[2].y, 0 );
else if( m_ctrlPts.size() == 4 )
recursiveBezier( m_ctrlPts[0].x, m_ctrlPts[0].y,
m_ctrlPts[1].x, m_ctrlPts[1].y,
m_ctrlPts[2].x, m_ctrlPts[2].y,
m_ctrlPts[3].x, m_ctrlPts[3].y, 0 );
m_output->push_back( wxPoint( m_ctrlPts.back() ) );
for( unsigned ii = 0; ii < buffer.size(); ++ii )
aOutput.emplace_back( wxPoint( int( buffer[ii].x ), int( buffer[ii].y ) ) );
}
void BEZIER_POLY::recursiveBezier( int x1, int y1, int x2, int y2,
int x3, int y3, unsigned int level )
void BEZIER_POLY::GetPoly( std::vector<VECTOR2D>& aOutput, double aMinSegLen )
{
if( level > recursion_limit )
return;
wxASSERT( m_ctrlPts.size() == 4 );
// FIXME Brute force method, use a better (recursive?) algorithm
// with a max error value.
// to optimize the number of segments
#define CURVE_POINTS 32
double dt = 1.0 / CURVE_POINTS;
// Calculate all the mid-points of the line segments
//----------------------
int x12 = (x1 + x2) / 2;
int y12 = (y1 + y2) / 2;
int x23 = (x2 + x3) / 2;
int y23 = (y2 + y3) / 2;
int x123 = (x12 + x23) / 2;
int y123 = (y12 + y23) / 2;
aOutput.clear();
aOutput.push_back( m_ctrlPts[0] );
int dx = x3 - x1;
int dy = y3 - y1;
double d = fabs( ((double) (x2 - x3) * dy) - ((double) (y2 - y3) * dx ) );
double da;
// If the Bezier curve is degenerated (straight line), skip intermediate points:
bool degenerated = m_ctrlPts[0] == m_ctrlPts[1] && m_ctrlPts[2] == m_ctrlPts[3];
if( d > curve_collinearity_epsilon )
if( !degenerated )
{
// Regular case
//-----------------
if( d * d <= distance_tolerance_square * (dx * dx + dy * dy) )
for( int ii = 1; ii < CURVE_POINTS; ii++ )
{
// If the curvature doesn't exceed the distance_tolerance value
// we tend to finish subdivisions.
//----------------------
if( angle_tolerance < curve_angle_tolerance_epsilon )
{
addSegment( wxPoint( x123, y123 ) );
return;
}
double t = dt * ii;
double omt = 1.0 - t;
double omt2 = omt * omt;
double omt3 = omt * omt2;
double t2 = t * t;
double t3 = t * t2;
// Angle & Cusp Condition
//----------------------
da = fabs( atan2( (double) ( y3 - y2 ), (double) ( x3 - x2 ) ) -
atan2( (double) ( y2 - y1 ), (double) ( x2 - x1 ) ) );
if( da >=M_PI )
da = 2 * M_PI - da;
VECTOR2D vertex = omt3 * m_ctrlPts[0]
+ 3.0 * t * omt2 * m_ctrlPts[1]
+ 3.0 * t2 * omt * m_ctrlPts[2]
+ t3 * m_ctrlPts[3];
if( da < angle_tolerance )
{
// Finally we can stop the recursion
//----------------------
addSegment( wxPoint( x123, y123 ) );
return;
}
}
}
else
{
// Collinear case
//------------------
da = sqrt_len(dx, dy);
if( da == 0 )
{
d = calc_sq_distance( x1, y1, x2, y2 );
}
else
{
d = ( (double)(x2 - x1) * dx + (double)(y2 - y1) * dy ) / da;
if( d > 0 && d < 1 )
{
// Simple collinear case, 1---2---3
// We can leave just two endpoints
return;
}
if( d <= 0 )
d = calc_sq_distance( x2, y2, x1, y1 );
else if( d >= 1 )
d = calc_sq_distance( x2, y2, x3, y3 );
else
d = calc_sq_distance( x2, y2, x1 + (int) d * dx,
y1 + (int) d * dy );
}
if( d < distance_tolerance_square )
{
addSegment( wxPoint( x2, y2 ) );
return;
// a minimal filter on the lenght of the segment being created:
// The offset from last point:
VECTOR2D delta = vertex - aOutput.back();
double dist = delta.EuclideanNorm();
if( dist > aMinSegLen )
aOutput.push_back( vertex );
}
}
// Continue subdivision
//----------------------
recursiveBezier( x1, y1, x12, y12, x123, y123, level + 1 );
recursiveBezier( x123, y123, x23, y23, x3, y3, level + 1 );
}
void BEZIER_POLY::recursiveBezier( int x1, int y1, int x2, int y2,
int x3, int y3, int x4, int y4, unsigned int level )
{
if( level > recursion_limit )
return;
// Calculate all the mid-points of the line segments
//----------------------
int x12 = (x1 + x2) / 2;
int y12 = (y1 + y2) / 2;
int x23 = (x2 + x3) / 2;
int y23 = (y2 + y3) / 2;
int x34 = (x3 + x4) / 2;
int y34 = (y3 + y4) / 2;
int x123 = (x12 + x23) / 2;
int y123 = (y12 + y23) / 2;
int x234 = (x23 + x34) / 2;
int y234 = (y23 + y34) / 2;
int x1234 = (x123 + x234) / 2;
int y1234 = (y123 + y234) / 2;
// Try to approximate the full cubic curve by a single straight line
//------------------
int dx = x4 - x1;
int dy = y4 - y1;
double d2 = fabs( (double) ( (x2 - x4) * dy - (y2 - y4) * dx ) );
double d3 = fabs( (double) ( (x3 - x4) * dy - (y3 - y4) * dx ) );
double da1, da2, k;
switch( (int(d2 > curve_collinearity_epsilon) << 1) +
int(d3 > curve_collinearity_epsilon) )
{
case 0:
// All collinear OR p1==p4
//----------------------
k = dx * dx + dy * dy;
if( k == 0 )
{
d2 = calc_sq_distance( x1, y1, x2, y2 );
d3 = calc_sq_distance( x4, y4, x3, y3 );
}
else
{
k = 1 / k;
da1 = x2 - x1;
da2 = y2 - y1;
d2 = k * (da1 * dx + da2 * dy);
da1 = x3 - x1;
da2 = y3 - y1;
d3 = k * (da1 * dx + da2 * dy);
if( d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1 )
{
// Simple collinear case, 1---2---3---4
// We can leave just two endpoints
return;
}
if( d2 <= 0 )
d2 = calc_sq_distance( x2, y2, x1, y1 );
else if( d2 >= 1 )
d2 = calc_sq_distance( x2, y2, x4, y4 );
else
d2 = calc_sq_distance( x2, y2, x1 + (int) d2 * dx,
y1 + (int) d2 * dy );
if( d3 <= 0 )
d3 = calc_sq_distance( x3, y3, x1, y1 );
else if( d3 >= 1 )
d3 = calc_sq_distance( x3, y3, x4, y4 );
else
d3 = calc_sq_distance( x3, y3, x1 + (int) d3 * dx,
y1 + (int) d3 * dy );
}
if( d2 > d3 )
{
if( d2 < distance_tolerance_square )
{
addSegment( wxPoint( x2, y2 ) );
return;
}
}
else
{
if( d3 < distance_tolerance_square )
{
addSegment( wxPoint( x3, y3 ) );
return;
}
}
break;
case 1:
// p1,p2,p4 are collinear, p3 is significant
//----------------------
if( d3 * d3 <= distance_tolerance_square * sqrt_len(dx, dy) )
{
if( angle_tolerance < curve_angle_tolerance_epsilon )
{
addSegment( wxPoint( x23, y23 ) );
return;
}
// Angle Condition
//----------------------
da1 = fabs( atan2( (double) ( y4 - y3 ), (double) ( x4 - x3 ) ) -
atan2( (double) ( y3 - y2 ), (double) ( x3 - x2 ) ) );
if( da1 >= M_PI )
da1 = 2 * M_PI - da1;
if( da1 < angle_tolerance )
{
addSegment( wxPoint( x2, y2 ) );
addSegment( wxPoint( x3, y3 ) );
return;
}
if( cusp_limit != 0.0 )
{
if( da1 > cusp_limit )
{
addSegment( wxPoint( x3, y3 ) );
return;
}
}
}
break;
case 2:
// p1,p3,p4 are collinear, p2 is significant
//----------------------
if( d2 * d2 <= distance_tolerance_square * sqrt_len(dx, dy) )
{
if( angle_tolerance < curve_angle_tolerance_epsilon )
{
addSegment( wxPoint( x23, y23 ) );
return;
}
// Angle Condition
//----------------------
da1 = fabs( atan2( (double) ( y3 - y2 ), (double) ( x3 - x2 ) ) -
atan2( (double) ( y2 - y1 ), (double) ( x2 - x1 ) ) );
if( da1 >= M_PI )
da1 = 2 * M_PI - da1;
if( da1 < angle_tolerance )
{
addSegment( wxPoint( x2, y2 ) );
addSegment( wxPoint( x3, y3 ) );
return;
}
if( cusp_limit != 0.0 )
{
if( da1 > cusp_limit )
{
addSegment( wxPoint( x2, y2 ) );
return;
}
}
}
break;
case 3:
// Regular case
//-----------------
if( (d2 + d3) * (d2 + d3) <= distance_tolerance_square * sqrt_len(dx, dy) )
{
// If the curvature doesn't exceed the distance_tolerance value
// we tend to finish subdivisions.
//----------------------
if( angle_tolerance < curve_angle_tolerance_epsilon )
{
addSegment( wxPoint( x23, y23 ) );
return;
}
// Angle & Cusp Condition
//----------------------
k = atan2( (double) ( y3 - y2 ), (double) ( x3 - x2 ) );
da1 = fabs( k - atan2( (double) ( y2 - y1 ),
(double) ( x2 - x1 ) ) );
da2 = fabs( atan2( (double) ( y4 - y3 ),
(double) ( x4 - x3 ) ) - k );
if( da1 >= M_PI )
da1 = 2 * M_PI - da1;
if( da2 >= M_PI )
da2 = 2 * M_PI - da2;
if( da1 + da2 < angle_tolerance )
{
// Finally we can stop the recursion
//----------------------
addSegment( wxPoint( x23, y23 ) );
return;
}
if( cusp_limit != 0.0 )
{
if( da1 > cusp_limit )
{
addSegment( wxPoint( x2, y2 ) );
return;
}
if( da2 > cusp_limit )
{
addSegment( wxPoint( x3, y3 ) );
return;
}
}
}
break;
}
// Continue subdivision
//----------------------
recursiveBezier( x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1 );
recursiveBezier( x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1 );
if( aOutput.back() != m_ctrlPts[3] )
aOutput.push_back( m_ctrlPts[3] );
}
+9 -4
View File
@@ -240,18 +240,23 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const wxPoint& aPos )
aDC->SetLogicalOrigin( logicalOriginX / GetScalingFactor(),
logicalOriginY / GetScalingFactor() );
pos.x = KiROUND( pos.x / GetScalingFactor() );
pos.y = KiROUND( pos.y / GetScalingFactor() );
size.x = KiROUND( size.x / GetScalingFactor() );
size.y = KiROUND( size.y / GetScalingFactor() );
aDC->SetClippingRegion( pos, size );
if( GetGRForceBlackPenState() )
{
wxBitmap result( m_bitmap->ConvertToImage().ConvertToGreyscale() );
aDC->DrawBitmap( result, KiROUND( pos.x / GetScalingFactor() ),
KiROUND( pos.y / GetScalingFactor() ), true );
aDC->DrawBitmap( result, pos.x, pos.y, true );
}
else
{
aDC->DrawBitmap( *m_bitmap, KiROUND( pos.x / GetScalingFactor() ),
KiROUND( pos.y / GetScalingFactor() ), true );
aDC->DrawBitmap( *m_bitmap, pos.x, pos.y, true );
}
aDC->DestroyClippingRegion();
aDC->SetUserScale( scale, scale );
aDC->SetLogicalOrigin( logicalOriginX, logicalOriginY );
}
+55 -13
View File
@@ -42,6 +42,7 @@
#include <wx/url.h>
#include <pgm_base.h>
#include <clocale>
using KIGFX::COLOR4D;
@@ -57,33 +58,63 @@ using KIGFX::COLOR4D;
COLOR4D g_GhostColor;
// When reading/writing files, we need to swtich to setlocale( LC_NUMERIC, "C" ).
// Works fine to read/write files with floating point numbers.
// We can call setlocale( LC_NUMERIC, "C" ) or wxLocale( "C", "C", "C", false )
// wxWidgets discourage a direct call to setlocale
// However, for us, calling wxLocale( "C", "C", "C", false ) has a unwanted effect:
// The I18N translations are no longer active, because the English dictionary is selected.
// To read files, this is not a major issues, but the resul can differ
// from using setlocale(xx, "C").
// Previouly, we used only setlocale( LC_NUMERIC, "C" )
//
// Known issues are
// on MSW
// using setlocale( LC_NUMERIC, "C" ) generates an alert message in debug mode,
// and this message ("Decimal separator mismatch") must be disabled.
// But calling wxLocale( "C", "C", "C", false ) works fine
// On unix:
// calling wxLocale( "C", "C", "C", false ) breaks env vars containing non ASCII7 chars.
// these env vars return a empty string from wxGetEnv() in many cases, and if such a
// var must be read after calling wxLocale( "C", "C", "C", false ), it looks like empty
//
// So use wxLocale on Windows and setlocale on unix
// set USE_WXLOCALE 0 to use setlocale, 1 to use wxLocale:
#if defined( _WIN32 )
#define USE_WXLOCALE 1
#else
#define USE_WXLOCALE 0
#endif
// On Windows, when using setlocale, a wx alert is generated
// in some cases (reading a bitmap for instance)
// So we disable alerts during the time a file is read or written
#if !USE_WXLOCALE
#if defined( _WIN32 ) && defined( DEBUG )
// a wxAssertHandler_t function to filter wxWidgets alert messages when reading/writing a file
// when switching the locale to LC_NUMERIC, "C"
// It is used in class LOCALE_IO to hide a useless (in kicad) wxWidgets alert message
void KiAssertFilter( const wxString &file, int line,
const wxString &func, const wxString &cond,
const wxString &msg)
const wxString &func, const wxString &cond,
const wxString &msg)
{
if( !msg.Contains( "Decimal separator mismatch" ) )
wxTheApp->OnAssertFailure( file, line, func, cond, msg );
wxTheApp->OnAssertFailure( file.c_str(), line, func.c_str(), cond.c_str(), msg.c_str() );
}
#endif
#endif
std::atomic<unsigned int> LOCALE_IO::m_c_count( 0 );
// Note on Windows, setlocale( LC_NUMERIC, "C" ) works fine to read/write
// files with floating point numbers, but generates a overzealous wx alert
// in some cases (reading a bitmap for instance)
// So we disable alerts during the time a file is read or written
LOCALE_IO::LOCALE_IO()
LOCALE_IO::LOCALE_IO() : m_wxLocale( nullptr )
{
// use thread safe, atomic operation
if( m_c_count++ == 0 )
{
#if USE_WXLOCALE
m_wxLocale = new wxLocale( "C", "C", "C", false );
#else
// Store the user locale name, to restore this locale later, in dtor
m_user_locale = setlocale( LC_NUMERIC, nullptr );
#if defined( _WIN32 ) && defined( DEBUG )
@@ -92,6 +123,7 @@ LOCALE_IO::LOCALE_IO()
#endif
// Switch the locale to C locale, to read/write files with fp numbers
setlocale( LC_NUMERIC, "C" );
#endif
}
}
@@ -102,10 +134,15 @@ LOCALE_IO::~LOCALE_IO()
if( --m_c_count == 0 )
{
// revert to the user locale
#if USE_WXLOCALE
delete m_wxLocale; // Deleting m_wxLocale restored previous locale
m_wxLocale = nullptr;
#else
setlocale( LC_NUMERIC, m_user_locale.c_str() );
#if defined( _WIN32 ) && defined( DEBUG )
// Enable wxWidgets alerts
wxSetDefaultAssertHandler();
#endif
#endif
}
}
@@ -425,7 +462,7 @@ wxString KIwxExpandEnvVars(const wxString& str)
if( !expanded )
strResult << (wxChar)bracket;
str_m = str[++m];
m++;
}
}
@@ -450,6 +487,11 @@ wxString KIwxExpandEnvVars(const wxString& str)
}
}
#ifndef __WINDOWS__
if( strResult.StartsWith( "~" ) )
strResult.Replace( "~", wxGetHomeDir(), false );
#endif // __WINDOWS__
return strResult;
}
+4 -4
View File
@@ -89,10 +89,10 @@ bool KIDIALOG::Show( bool aShow )
return it->second;
}
bool ret = wxRichMessageDialog::Show( aShow );
int ret = wxRichMessageDialog::Show( aShow );
// Has the user asked not to show the dialog again
if( IsCheckBoxChecked() )
// Has the user asked not to show the dialog again and it was confirmed
if( IsCheckBoxChecked() && ret != wxID_CANCEL )
doNotShowAgainDlgs[m_hash] = ret;
return ret;
@@ -110,7 +110,7 @@ int KIDIALOG::ShowModal()
int ret = wxRichMessageDialog::ShowModal();
// Has the user asked not to show the dialog again
if( IsCheckBoxChecked() )
if( IsCheckBoxChecked() && ret != wxID_CANCEL )
doNotShowAgainDlgs[m_hash] = ret;
return ret;
+4 -9
View File
@@ -64,7 +64,7 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
aInfo.SetAppName( Pgm().App().GetAppName() );
/* Copyright information */
aInfo.SetCopyright( "(C) 1992-2019 KiCad Developers Team" );
aInfo.SetCopyright( "(C) 1992-2020 KiCad Developers Team" );
/* KiCad build version */
wxString version;
@@ -130,11 +130,7 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
description << "<ul>";
description << "<li>"
<< _( "The official KiCad website - " )
<< HtmlHyperlink( "http://www.kicad-pcb.org" )
<< "</li>";
description << "<li>"
<< _( "Developer website on Launchpad - " )
<< HtmlHyperlink( "https://launchpad.net/kicad" )
<< HtmlHyperlink( "https://www.kicad.org" )
<< "</li>";
description << "<li>"
@@ -152,8 +148,7 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
description << "<ul>";
description << "<li>"
<< _( "Report or examine bugs - " )
<< HtmlHyperlink( "https://bugs.launchpad.net/kicad/+bugs?orderby=-id&start=0",
"https://bugs.launchpad.net/kicad" )
<< HtmlHyperlink( "https://gitlab.com/kicad/code/kicad/issues" )
<< "</li>";
description << "</ul></p>";
@@ -164,7 +159,7 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
description << "<ul>";
description << "<li>"
<< _( "KiCad forum - " )
<< HtmlHyperlink( "https://forum.kicad.info" )
<< HtmlHyperlink( "https://go.kicad.org/forum" )
<< "</li>";
description << "</ul></p>";
+19
View File
@@ -23,6 +23,18 @@
#define ALPHA_MAX 100 // the max value returned by the alpha (opacity) slider
// Configure the spin controls contained inside the dialog
void configureSpinCtrl( wxSpinCtrl* aCtrl )
{
wxSize textLength = aCtrl->GetTextExtent( "999" );
wxSize ctrlSize = aCtrl->GetSizeFromTextSize( textLength );
aCtrl->SetMinSize( ctrlSize );
aCtrl->SetSize( ctrlSize );
}
DIALOG_COLOR_PICKER::DIALOG_COLOR_PICKER( wxWindow* aParent, KIGFX::COLOR4D& aCurrentColor,
bool aAllowOpacityControl, CUSTOM_COLORS_LIST* aUserColors )
: DIALOG_COLOR_PICKER_BASE( aParent )
@@ -131,6 +143,13 @@ bool DIALOG_COLOR_PICKER::TransferDataToWindow()
SetEditVals( ALL_CHANGED );
drawAll();
// Configure the spin control sizes
configureSpinCtrl( m_spinCtrlGreen );
configureSpinCtrl( m_spinCtrlBlue );
configureSpinCtrl( m_spinCtrlRed );
configureSpinCtrl( m_spinCtrlHue );
configureSpinCtrl( m_spinCtrlSaturation );
m_notebook->GetPage( 0 )->Layout();
m_notebook->GetPage( 1 )->Layout();
+1 -11
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 28 2019)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -56,18 +56,12 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
fgSizerRGB->Add( m_staticTextB, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_spinCtrlRed = new wxSpinCtrl( sbSizerViewRGB->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 128 );
m_spinCtrlRed->SetMinSize( wxSize( 80,-1 ) );
fgSizerRGB->Add( m_spinCtrlRed, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_spinCtrlGreen = new wxSpinCtrl( sbSizerViewRGB->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 128 );
m_spinCtrlGreen->SetMinSize( wxSize( 80,-1 ) );
fgSizerRGB->Add( m_spinCtrlGreen, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_spinCtrlBlue = new wxSpinCtrl( sbSizerViewRGB->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 128 );
m_spinCtrlBlue->SetMinSize( wxSize( 80,-1 ) );
fgSizerRGB->Add( m_spinCtrlBlue, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@@ -103,13 +97,9 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID
fgSizerHSV->Add( m_staticTextSat, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_spinCtrlHue = new wxSpinCtrl( sbSizerViewHSV->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 359, 0 );
m_spinCtrlHue->SetMinSize( wxSize( 80,-1 ) );
fgSizerHSV->Add( m_spinCtrlHue, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_spinCtrlSaturation = new wxSpinCtrl( sbSizerViewHSV->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 128 );
m_spinCtrlSaturation->SetMinSize( wxSize( 80,-1 ) );
fgSizerHSV->Add( m_spinCtrlSaturation, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
+5 -7
View File
@@ -14,7 +14,6 @@
<property name="file">dialog_color_picker_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">DIALOG_COLOR_PICKER_BASE</property>
@@ -26,7 +25,6 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@@ -506,7 +504,7 @@
<property name="min">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">80,-1</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_spinCtrlRed</property>
<property name="pane_border">1</property>
@@ -569,7 +567,7 @@
<property name="min">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">80,-1</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_spinCtrlGreen</property>
<property name="pane_border">1</property>
@@ -632,7 +630,7 @@
<property name="min">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">80,-1</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_spinCtrlBlue</property>
<property name="pane_border">1</property>
@@ -918,7 +916,7 @@
<property name="min">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">80,-1</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_spinCtrlHue</property>
<property name="pane_border">1</property>
@@ -981,7 +979,7 @@
<property name="min">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">80,-1</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_spinCtrlSaturation</property>
<property name="pane_border">1</property>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 28 2019)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+10 -7
View File
@@ -221,14 +221,17 @@ bool DIALOG_CONFIGURE_PATHS::TransferDataFromWindow()
for( int row = 0; row < m_EnvVars->GetNumberRows(); ++row )
{
wxString name = m_EnvVars->GetCellValue( row, EV_NAME_COL );
wxString path = m_EnvVars->GetCellValue( row, EV_PATH_COL );
wxString external = m_EnvVars->GetCellValue( row, EV_FLAG_COL );
wxString name = m_EnvVars->GetCellValue( row, EV_NAME_COL );
wxString path = m_EnvVars->GetCellValue( row, EV_PATH_COL );
wxString external = m_EnvVars->GetCellValue( row, EV_FLAG_COL );
ENV_VAR_ITEM var( path );
if( external.Length() )
continue;
if( name.IsEmpty() )
{
// Don't check for consistency on external variables, just use them as-is
var.SetDefinedExternally( true );
}
else if( name.IsEmpty() )
{
m_errorGrid = m_EnvVars;
m_errorRow = row;
@@ -245,7 +248,7 @@ bool DIALOG_CONFIGURE_PATHS::TransferDataFromWindow()
return false;
}
envVarMap[ name ] = ENV_VAR_ITEM( path );
envVarMap[ name ] = var;
}
Pgm().SetLocalEnvVariables( envVarMap );
+63 -75
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -14,22 +14,22 @@
DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbEnvVars;
sbEnvVars = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Environment Variables") ), wxVERTICAL );
m_EnvVars = new WX_GRID( sbEnvVars->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_EnvVars->CreateGrid( 1, 2 );
m_EnvVars->EnableEditing( true );
m_EnvVars->EnableGridLines( true );
m_EnvVars->EnableDragGridSize( false );
m_EnvVars->SetMargins( 0, 0 );
// Columns
m_EnvVars->SetColSize( 0, 150 );
m_EnvVars->SetColSize( 1, 454 );
@@ -38,54 +38,50 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi
m_EnvVars->SetColLabelSize( 22 );
m_EnvVars->SetColLabelValue( 0, _("Name") );
m_EnvVars->SetColLabelValue( 1, _("Path") );
m_EnvVars->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_EnvVars->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_EnvVars->EnableDragRowSize( true );
m_EnvVars->SetRowLabelSize( 0 );
m_EnvVars->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_EnvVars->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_EnvVars->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_EnvVars->SetMinSize( wxSize( 604,170 ) );
sbEnvVars->Add( m_EnvVars, 1, wxEXPAND|wxBOTTOM, 5 );
sbEnvVars->Add( m_EnvVars, 1, wxBOTTOM|wxEXPAND|wxLEFT, 5 );
wxBoxSizer* bSizerEnvVarBtns;
bSizerEnvVarBtns = new wxBoxSizer( wxHORIZONTAL );
m_btnAddEnvVar = new wxBitmapButton( sbEnvVars->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_btnAddEnvVar->SetMinSize( wxSize( 30,29 ) );
bSizerEnvVarBtns->Add( m_btnAddEnvVar, 0, wxRIGHT, 5 );
m_btnAddEnvVar = new wxBitmapButton( sbEnvVars->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizerEnvVarBtns->Add( m_btnAddEnvVar, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
bSizerEnvVarBtns->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_btnDeleteEnvVar = new wxBitmapButton( sbEnvVars->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_btnDeleteEnvVar->SetMinSize( wxSize( 30,29 ) );
bSizerEnvVarBtns->Add( m_btnDeleteEnvVar, 0, wxRIGHT|wxLEFT, 5 );
m_btnDeleteEnvVar = new wxBitmapButton( sbEnvVars->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizerEnvVarBtns->Add( m_btnDeleteEnvVar, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
sbEnvVars->Add( bSizerEnvVarBtns, 0, wxEXPAND, 5 );
bSizerMain->Add( sbEnvVars, 1, wxEXPAND|wxALL, 5 );
m_sb3DSearchPaths = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("3D Search Paths") ), wxVERTICAL );
m_SearchPaths = new WX_GRID( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_SearchPaths->CreateGrid( 1, 3 );
m_SearchPaths->EnableEditing( true );
m_SearchPaths->EnableGridLines( true );
m_SearchPaths->EnableDragGridSize( false );
m_SearchPaths->SetMargins( 0, 0 );
// Columns
m_SearchPaths->SetColSize( 0, 150 );
m_SearchPaths->SetColSize( 1, 300 );
@@ -96,54 +92,46 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi
m_SearchPaths->SetColLabelValue( 0, _("Alias") );
m_SearchPaths->SetColLabelValue( 1, _("Path") );
m_SearchPaths->SetColLabelValue( 2, _("Description") );
m_SearchPaths->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_SearchPaths->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_SearchPaths->AutoSizeRows();
m_SearchPaths->EnableDragRowSize( false );
m_SearchPaths->SetRowLabelSize( 0 );
m_SearchPaths->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_SearchPaths->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_SearchPaths->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_SearchPaths->SetMinSize( wxSize( 604,150 ) );
m_sb3DSearchPaths->Add( m_SearchPaths, 1, wxEXPAND|wxBOTTOM, 5 );
m_sb3DSearchPaths->Add( m_SearchPaths, 1, wxBOTTOM|wxEXPAND|wxLEFT, 5 );
wxBoxSizer* bSizerSearchPathBtns;
bSizerSearchPathBtns = new wxBoxSizer( wxHORIZONTAL );
m_btnAddSearchPath = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_btnAddSearchPath->SetMinSize( wxSize( 30,29 ) );
bSizerSearchPathBtns->Add( m_btnAddSearchPath, 0, wxRIGHT, 5 );
m_btnMoveUp = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_btnMoveUp->SetMinSize( wxSize( 30,29 ) );
bSizerSearchPathBtns->Add( m_btnMoveUp, 0, wxRIGHT, 5 );
m_btnMoveDown = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_btnMoveDown->SetMinSize( wxSize( 30,29 ) );
bSizerSearchPathBtns->Add( m_btnMoveDown, 0, wxRIGHT, 5 );
m_btnAddSearchPath = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizerSearchPathBtns->Add( m_btnAddSearchPath, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_btnMoveUp = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizerSearchPathBtns->Add( m_btnMoveUp, 0, wxBOTTOM|wxRIGHT, 5 );
m_btnMoveDown = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizerSearchPathBtns->Add( m_btnMoveDown, 0, wxBOTTOM|wxRIGHT, 5 );
bSizerSearchPathBtns->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_btnDeleteSearchPath = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_btnDeleteSearchPath->SetMinSize( wxSize( 30,29 ) );
bSizerSearchPathBtns->Add( m_btnDeleteSearchPath, 0, wxRIGHT|wxLEFT, 5 );
m_btnDeleteSearchPath = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizerSearchPathBtns->Add( m_btnDeleteSearchPath, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_sb3DSearchPaths->Add( bSizerSearchPathBtns, 0, wxEXPAND, 5 );
bSizerMain->Add( m_sb3DSearchPaths, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
@@ -152,16 +140,16 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi
m_sdbSizerHelp = new wxButton( this, wxID_HELP );
m_sdbSizer->AddButton( m_sdbSizerHelp );
m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnUpdateUI ) );
m_EnvVars->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridCellChange ), NULL, this );
@@ -192,5 +180,5 @@ DIALOG_CONFIGURE_PATHS_BASE::~DIALOG_CONFIGURE_PATHS_BASE()
m_btnMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnSearchPathMoveDown ), NULL, this );
m_btnDeleteSearchPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnDeleteSearchPath ), NULL, this );
m_sdbSizerHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnHelp ), NULL, this );
}
+22 -14
View File
@@ -14,6 +14,7 @@
<property name="file">dialog_configure_paths_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">DIALOG_CONFIGURE_PATHS_BASE</property>
@@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@@ -73,7 +75,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="1">
<property name="BottomDockable">1</property>
@@ -172,7 +174,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -183,6 +185,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -215,7 +218,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">30,29</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_btnAddEnvVar</property>
<property name="pane_border">1</property>
@@ -255,7 +258,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -266,6 +269,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -298,7 +302,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">30,29</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_btnDeleteEnvVar</property>
<property name="pane_border">1</property>
@@ -344,7 +348,7 @@
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="1">
<property name="BottomDockable">1</property>
@@ -443,7 +447,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxRIGHT</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -454,6 +458,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -486,7 +491,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">30,29</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_btnAddSearchPath</property>
<property name="pane_border">1</property>
@@ -516,7 +521,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxRIGHT</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -527,6 +532,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -559,7 +565,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">30,29</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_btnMoveUp</property>
<property name="pane_border">1</property>
@@ -589,7 +595,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxRIGHT</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -600,6 +606,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -632,7 +639,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">30,29</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_btnMoveDown</property>
<property name="pane_border">1</property>
@@ -672,7 +679,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="0">
<property name="BottomDockable">1</property>
@@ -683,6 +690,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -715,7 +723,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">30,29</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_btnDeleteSearchPath</property>
<property name="pane_border">1</property>
+10 -12
View File
@@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_CONFIGURE_PATHS_BASE_H__
#define __DIALOG_CONFIGURE_PATHS_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@@ -20,10 +19,10 @@ class WX_GRID;
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
@@ -38,7 +37,7 @@ class WX_GRID;
class DIALOG_CONFIGURE_PATHS_BASE : public DIALOG_SHIM
{
private:
protected:
WX_GRID* m_EnvVars;
wxBitmapButton* m_btnAddEnvVar;
@@ -53,7 +52,7 @@ class DIALOG_CONFIGURE_PATHS_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
wxButton* m_sdbSizerHelp;
// Virtual event handlers, overide them in your derived class
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnGridCellChange( wxGridEvent& event ) { event.Skip(); }
@@ -66,13 +65,12 @@ class DIALOG_CONFIGURE_PATHS_BASE : public DIALOG_SHIM
virtual void OnSearchPathMoveDown( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteSearchPath( wxCommandEvent& event ) { event.Skip(); }
virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure Paths"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure Paths"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_CONFIGURE_PATHS_BASE();
};
#endif //__DIALOG_CONFIGURE_PATHS_BASE_H__
+1
View File
@@ -174,6 +174,7 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow()
void PANEL_COMMON_SETTINGS::OnScaleSlider( wxScrollEvent& aEvent )
{
m_iconScaleAuto->SetValue( false );
aEvent.Skip();
}
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 10 2018)
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -97,8 +97,6 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
gridHelperApps->Add( m_textEditorPath, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_textEditorBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_textEditorBtn->SetMinSize( wxSize( 29,29 ) );
gridHelperApps->Add( m_textEditorBtn, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_defaultPDFViewer = new wxRadioButton( sizerHelperApps->GetStaticBox(), wxID_ANY, _("System default PDF viewer"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -113,8 +111,6 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
gridHelperApps->Add( m_PDFViewerPath, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_pdfViewerBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_pdfViewerBtn->SetMinSize( wxSize( 29,29 ) );
gridHelperApps->Add( m_pdfViewerBtn, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
@@ -14,6 +14,7 @@
<property name="file">panel_common_settings_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">PanelCommonSettings</property>
@@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
@@ -846,6 +848,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -878,7 +881,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">29,29</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_textEditorBtn</property>
<property name="pane_border">1</property>
@@ -1124,6 +1127,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1156,7 +1160,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">29,29</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_pdfViewerBtn</property>
<property name="pane_border">1</property>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 10 2018)
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+5 -1
View File
@@ -26,6 +26,7 @@
#include <wildcards_and_files_ext.h>
#include <gal/color4d.h>
#include <wx/clipbrd.h>
#include <kicad_string.h>
WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent,
wxWindowID id,
@@ -402,7 +403,10 @@ void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event )
for( const REPORT_LINE& l : m_report )
{
f.Write( generatePlainText( l ) );
wxString s = generatePlainText( l );
ConvertSmartQuotesAndDashes( &s );
f.Write( s );
}
f.Close();
+5 -21
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,10 +23,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file displlst.cpp
*/
#include <fctsys.h>
#include <macros.h>
#include <draw_frame.h>
@@ -46,11 +42,9 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
const std::vector<wxArrayString>& aItemList,
const wxString& aSelection,
void( *aCallBackFunction )( wxString&, void* ),
void* aCallBackFunctionData,
bool aSortList, bool aShowHeaders ) :
void* aCallBackFunctionData ) :
EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle )
{
m_sortList = aSortList;
m_cb_func = aCallBackFunction;
m_cb_data = aCallBackFunctionData;
m_itemsListCp = &aItemList;
@@ -59,9 +53,6 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
initDialog( aItemHeaders, aSelection );
if( !aShowHeaders )
m_listBox->SetSingleStyle( wxLC_NO_HEADER, true );
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
// because so many dialogs share this same class, with different numbers of
// columns, different column names, and column widths.
@@ -111,15 +102,10 @@ void EDA_LIST_DIALOG::initDialog( const wxArrayString& aItemHeaders, const wxStr
}
void EDA_LIST_DIALOG::SetFilterHint( const wxString& aHint )
{
m_filterBox->SetHint( aHint );
}
void EDA_LIST_DIALOG::SetListLabel( const wxString& aLabel )
{
m_listLabel->SetLabel( aLabel );
m_listBox->SetSingleStyle( wxLC_NO_HEADER, true );
}
@@ -148,8 +134,7 @@ void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event )
}
}
if( m_sortList )
sortList();
sortList();
}
@@ -219,8 +204,7 @@ void EDA_LIST_DIALOG::InsertItems( const std::vector< wxArrayString >& itemList,
}
}
if( m_sortList )
sortList();
sortList();
}
+55 -40
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2017 CERN
* Copyright (C) 2013-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2013-2020 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@@ -76,7 +76,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
Connect( wxEVT_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), NULL, this );
Connect( wxEVT_ENTER_WINDOW, wxEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), NULL, this );
Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), NULL, this );
Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( EDA_DRAW_PANEL_GAL::onLostFocus ), NULL, this );
const wxEventType events[] =
@@ -132,15 +132,6 @@ EDA_DRAW_PANEL_GAL::~EDA_DRAW_PANEL_GAL()
void EDA_DRAW_PANEL_GAL::SetFocus()
{
// Windows has a strange manner on bringing up and activating windows
// containing a GAL canvas just after moving the mouse cursor into its area.
// Feel free to uncomment or extend the following #ifdef if you experience
// similar problems on your platform.
#ifdef __WINDOWS__
if( !GetParent()->IsDescendant( wxWindow::FindFocus() ) )
return;
#endif
wxScrolledCanvas::SetFocus();
m_lostFocus = false;
}
@@ -148,6 +139,16 @@ void EDA_DRAW_PANEL_GAL::SetFocus()
void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
{
DoRePaint();
}
void EDA_DRAW_PANEL_GAL::DoRePaint()
{
// Repaint the canvas, and fix scrollbar cursors
// Usually called by a OnPaint event, but because it does not use a wxPaintDC,
// it can be called outside a wxPaintEvent.
// Update current zoom settings if the canvas is managed by a EDA frame
// (i.e. not by a preview panel in a dialog)
if( GetParentEDAFrame() && GetParentEDAFrame()->GetScreen() )
@@ -231,7 +232,7 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
#ifdef __WXDEBUG__
totalRealTime.Stop();
wxLogTrace( "GAL_PROFILE", "EDA_DRAW_PANEL_GAL::onPaint(): %.1f ms", totalRealTime.msecs() );
wxLogTrace( "GAL_PROFILE", "EDA_DRAW_PANEL_GAL::DoRePaint(): %.1f ms", totalRealTime.msecs() );
#endif /* PROFILE */
m_lastRefresh = wxGetLocalTimeMillis();
@@ -255,37 +256,32 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent )
void EDA_DRAW_PANEL_GAL::Refresh( bool aEraseBackground, const wxRect* aRect )
{
if( m_pendingRefresh )
return;
m_pendingRefresh = true;
#ifdef __WXMAC__
// Timers on OS X may have a high latency (seen up to 500ms and more) which
// makes repaints jerky. No negative impact seen without throttling, so just
// do an unconditional refresh for OS X.
ForceRefresh();
#else
wxLongLong t = wxGetLocalTimeMillis();
wxLongLong delta = t - m_lastRefresh;
// If it has been too long since the last frame (possible depending on platform timer latency),
// just do a refresh. Otherwise, start the refresh timer if it hasn't already been started.
// This ensures that we will render often enough but not too often.
if( delta >= MinRefreshPeriod )
{
ForceRefresh();
if( !m_pendingRefresh )
ForceRefresh();
m_refreshTimer.Start( MinRefreshPeriod, true );
}
else
else if( !m_refreshTimer.IsRunning() )
{
// One shot timer
m_refreshTimer.Start( ( MinRefreshPeriod - delta ).ToLong(), true );
}
#endif
}
void EDA_DRAW_PANEL_GAL::ForceRefresh()
{
wxPaintEvent redrawEvent;
wxPostEvent( this, redrawEvent );
//wxPaintEvent redrawEvent;
//wxPostEvent( this, redrawEvent );
m_pendingRefresh = true;
DoRePaint();
}
@@ -377,21 +373,23 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
switch( aGalType )
{
case GAL_TYPE_OPENGL:
try
{
wxString errormsg = KIGFX::OPENGL_GAL::CheckFeatures( m_options );
if( errormsg.empty() )
{
new_gal = new KIGFX::OPENGL_GAL( m_options, this, this, this );
break;
}
catch( std::runtime_error& err )
else
{
aGalType = GAL_TYPE_CAIRO;
DisplayInfoMessage( m_parent,
_( "Could not use OpenGL, falling back to software rendering" ),
wxString( err.what() ) );
_( "Could not use OpenGL, falling back to software rendering" ), errormsg );
new_gal = new KIGFX::CAIRO_GAL( m_options, this, this, this );
}
new_gal = new KIGFX::CAIRO_GAL( m_options, this, this, this );
break;
}
case GAL_TYPE_CAIRO:
new_gal = new KIGFX::CAIRO_GAL( m_options, this, this, this );
@@ -446,7 +444,15 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
void EDA_DRAW_PANEL_GAL::OnEvent( wxEvent& aEvent )
{
if( m_lostFocus && m_stealsFocus )
bool shouldSetFocus = m_lostFocus && m_stealsFocus;
#if defined( _WIN32 )
// Ensure we are the active foreground window before we attempt to steal focus
// mouse events are generated on Win32 regardless if window is active
shouldSetFocus = shouldSetFocus && ( m_edaFrame->GetHWND() == GetForegroundWindow() );
#endif
if( shouldSetFocus )
SetFocus();
if( !m_eventDispatcher )
@@ -458,10 +464,18 @@ void EDA_DRAW_PANEL_GAL::OnEvent( wxEvent& aEvent )
}
void EDA_DRAW_PANEL_GAL::onEnter( wxEvent& aEvent )
void EDA_DRAW_PANEL_GAL::onEnter( wxMouseEvent& aEvent )
{
bool shouldSetFocus = m_stealsFocus;
#if defined( _WIN32 )
// Ensure we are the active foreground window before we attempt to steal focus
// mouse events are generated on Win32 regardless if window is active
shouldSetFocus = shouldSetFocus && ( m_edaFrame->GetHWND() == GetForegroundWindow() );
#endif
// Getting focus is necessary in order to receive key events properly
if( m_stealsFocus )
if( shouldSetFocus )
SetFocus();
aEvent.Skip();
@@ -495,8 +509,9 @@ void EDA_DRAW_PANEL_GAL::onRefreshTimer( wxTimerEvent& aEvent )
}
}
wxPaintEvent redrawEvent;
wxPostEvent( this, redrawEvent );
//wxPaintEvent redrawEvent;
//wxPostEvent( this, redrawEvent );
DoRePaint();
}
+40 -10
View File
@@ -47,7 +47,7 @@
/// The default auto save interval is 10 minutes.
#define DEFAULT_AUTO_SAVE_INTERVAL 600
#define URL_GET_INVOLVED "http://kicad-pcb.org/contribute/"
#define URL_GET_INVOLVED "https://www.kicad.org/contribute/"
///@{
/// \ingroup config
@@ -68,6 +68,12 @@ static const wxString entrySizeX = "Size_x"; ///< Width of frame, in pixels (suf
static const wxString entryMaximized = "Maximized"; ///< Nonzero iff frame is maximized (suffix)
///@}
BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame )
EVT_MOVE( EDA_BASE_FRAME::OnMove )
END_EVENT_TABLE()
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString& aFrameName ) :
@@ -279,20 +285,39 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
aCfg->Read( text, &m_autoSaveInterval, DEFAULT_AUTO_SAVE_INTERVAL );
}
// Ensure the window is on a connected display, and is visible.
// (at least a corner of the frame must be visible on screen)
// Sometimes, if a window was moved on an auxiliary display, and when this
// display is no more available, it is not the case.
wxRect rect( m_FramePos, m_FrameSize );
// Ensure window isn't bigger than can be displayed
int displayIndex = wxDisplay::GetFromPoint( m_FramePos );
if( wxDisplay::GetFromPoint( rect.GetTopLeft() ) == wxNOT_FOUND &&
wxDisplay::GetFromPoint( rect.GetTopRight() ) == wxNOT_FOUND &&
wxDisplay::GetFromPoint( rect.GetBottomLeft() ) == wxNOT_FOUND &&
wxDisplay::GetFromPoint( rect.GetBottomRight() ) == wxNOT_FOUND )
if( displayIndex == wxNOT_FOUND )
{
displayIndex = 0;
m_FramePos = wxDefaultPosition;
}
wxDisplay display( displayIndex );
wxRect clientSize = display.GetClientArea();
// The window may have been saved on a display that is no longer present.
// First, check the window origin and move it if it's off the chosen display
if( m_FramePos.x >= clientSize.x + clientSize.width ||
m_FramePos.y >= clientSize.y + clientSize.height )
m_FramePos = wxDefaultPosition;
// Now, fix up the size if needed
if( m_FrameSize.x + m_FramePos.x > clientSize.x + clientSize.width )
{
m_FrameSize.x = clientSize.width;
m_FramePos.x = 0;
}
if( m_FrameSize.y + m_FramePos.y > clientSize.y + clientSize.height )
{
m_FrameSize.y = clientSize.height;
m_FramePos.y = 0;
}
// Ensure Window title bar is visible
#if defined( __WXMAC__ )
// for macOSX, the window must be below system (macOSX) toolbar
@@ -302,7 +327,12 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
int Ypos_min = 0;
#endif
if( m_FramePos.y < Ypos_min )
{
if( m_FrameSize.y + ( Ypos_min - m_FramePos.y ) > clientSize.height)
m_FrameSize.y = clientSize.height - Ypos_min;
m_FramePos.y = Ypos_min;
}
if( maximized )
Maximize();
+10 -12
View File
@@ -185,9 +185,9 @@ bool FILENAME_RESOLVER::createPathList()
if( GetKicadPaths( epaths ) )
{
for( const auto& i : epaths )
for( const wxString& curr_path : epaths )
{
wxString pathVal = ExpandEnvVarSubstitutions( i );
wxString pathVal = ExpandEnvVarSubstitutions( curr_path );
if( pathVal.empty() )
{
@@ -200,8 +200,8 @@ bool FILENAME_RESOLVER::createPathList()
lpath.m_pathexp = fndummy.GetFullPath();
}
lpath.m_alias = i;
lpath.m_pathvar = i;
lpath.m_alias = curr_path;
lpath.m_pathvar = curr_path;
if( !lpath.m_pathexp.empty() && psep == *lpath.m_pathexp.rbegin() )
lpath.m_pathexp.erase( --lpath.m_pathexp.end() );
@@ -219,9 +219,8 @@ bool FILENAME_RESOLVER::createPathList()
#ifdef DEBUG
wxLogTrace( MASK_3D_RESOLVER, " * [3D model] search paths:\n" );
std::list< SEARCH_PATH >::const_iterator sPL = m_Paths.begin();
std::list< SEARCH_PATH >::const_iterator ePL = m_Paths.end();
while( sPL != ePL )
while( sPL != m_Paths.end() )
{
wxLogTrace( MASK_3D_RESOLVER, " + %s : '%s'\n", (*sPL).m_alias.GetData(),
(*sPL).m_pathexp.GetData() );
@@ -636,9 +635,9 @@ bool FILENAME_RESOLVER::writePathList()
// skip all ${ENV_VAR} alias names
std::list< SEARCH_PATH >::const_iterator sPL = m_Paths.begin();
std::list< SEARCH_PATH >::const_iterator ePL = m_Paths.end();
while( sPL != ePL && ( sPL->m_alias.StartsWith( "${" ) || sPL->m_alias.StartsWith( "$(" ) ) )
while( sPL != m_Paths.end() &&
( sPL->m_alias.StartsWith( "${" ) || sPL->m_alias.StartsWith( "$(" ) ) )
++sPL;
wxFileName cfgpath( m_ConfigDir, RESOLVER_CONFIG );
@@ -662,7 +661,7 @@ bool FILENAME_RESOLVER::writePathList()
cfgFile << "#V" << CFGFILE_VERSION << "\n";
std::string tstr;
while( sPL != ePL )
while( sPL != m_Paths.end() )
{
tstr = sPL->m_alias.ToUTF8();
cfgFile << "\"" << tstr.size() << ":" << tstr << "\",";
@@ -762,10 +761,9 @@ wxString FILENAME_RESOLVER::ShortenPath( const wxString& aFullPathName )
wxCriticalSectionLocker lock( lock_resolver );
std::list< SEARCH_PATH >::const_iterator sL = m_Paths.begin();
std::list< SEARCH_PATH >::const_iterator eL = m_Paths.end();
size_t idx;
while( sL != eL )
while( sL != m_Paths.end() )
{
// undefined paths do not participate in the
// file name shortening procedure
@@ -949,7 +947,7 @@ static bool getHollerith( const std::string& aString, size_t& aIndex, wxString&
if( nchars > 0 )
{
aResult = aString.substr( i2, nchars );
aResult = wxString::FromUTF8( aString.substr( i2, nchars ).c_str() );
i2 += nchars;
}
+1 -2
View File
@@ -143,8 +143,7 @@ FOOTPRINT_LIST* FOOTPRINT_LIST::GetInstance( KIWAY& aKiway )
if( !footprintInfo->GetCount() )
{
wxTextFile footprintInfoCache( aKiway.Prj().GetProjectPath() + "fp-info-cache" );
footprintInfo->ReadCacheFromFile( &footprintInfoCache );
footprintInfo->ReadCacheFromFile( aKiway.Prj().GetProjectPath() + "fp-info-cache" );
}
return footprintInfo;
+33 -7
View File
@@ -78,6 +78,9 @@ CAIRO_GAL_BASE::~CAIRO_GAL_BASE()
if( context )
cairo_destroy( context );
for( auto imageSurface : imageSurfaces )
cairo_surface_destroy( imageSurface );
}
@@ -424,8 +427,11 @@ void CAIRO_GAL_BASE::DrawPolygon( const SHAPE_LINE_CHAIN& aPolygon )
void CAIRO_GAL_BASE::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControlPointA,
const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint )
const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint,
double aFilterValue )
{
// Note: aFilterValue is not used because the cubic Bezier curve is
// supported by Cairo.
syncLineWidth();
const auto sp = roundp( xform( aStartPoint ) );
@@ -499,7 +505,9 @@ void CAIRO_GAL_BASE::DrawBitmap( const BITMAP_BASE& aBitmap )
cairo_surface_mark_dirty( image );
cairo_set_source_surface( currentContext, image, 0, 0 );
cairo_paint( currentContext );
cairo_surface_destroy( image );
// store the image handle so it can be destroyed later
imageSurfaces.push_back( image );
isElementAdded = true;
@@ -920,6 +928,11 @@ void CAIRO_GAL_BASE::EnableDepthTest( bool aEnabled )
void CAIRO_GAL_BASE::resetContext()
{
for( auto imageSurface : imageSurfaces )
cairo_surface_destroy( imageSurface );
imageSurfaces.clear();
ClearScreen();
// Compute the world <-> screen transformations
@@ -1256,10 +1269,13 @@ void CAIRO_GAL::endDrawing()
// Now translate the raw context data from the format stored
// by cairo into a format understood by wxImage.
pixman_image_t* dstImg = pixman_image_create_bits( PIXMAN_r8g8b8,
pixman_image_t* dstImg = pixman_image_create_bits(
wxPlatformInfo::Get().GetEndianness() == wxENDIAN_LITTLE ? PIXMAN_b8g8r8 :
PIXMAN_r8g8b8,
screenSize.x, screenSize.y, (uint32_t*) wxOutput, wxBufferWidth * 3 );
pixman_image_t* srcImg = pixman_image_create_bits( PIXMAN_a8b8g8r8,
screenSize.x, screenSize.y, (uint32_t*) bitmapBuffer, wxBufferWidth * 4 );
pixman_image_t* srcImg = pixman_image_create_bits( PIXMAN_a8r8g8b8, screenSize.x, screenSize.y,
(uint32_t*) bitmapBuffer, wxBufferWidth * 4 );
pixman_image_composite( PIXMAN_OP_SRC, srcImg, NULL, dstImg,
0, 0, 0, 0, 0, 0, screenSize.x, screenSize.y );
@@ -1281,6 +1297,16 @@ void CAIRO_GAL::endDrawing()
}
void CAIRO_GAL::PostPaint( wxPaintEvent& aEvent )
{
// posts an event to m_paint_listener to ask for redraw the canvas.
if( paintListener )
{
wxPostEvent( paintListener, aEvent );
}
}
void CAIRO_GAL::ResizeScreen( int aWidth, int aHeight )
{
CAIRO_GAL_BASE::ResizeScreen( aWidth, aHeight );
@@ -1486,9 +1512,9 @@ void CAIRO_GAL::setCompositor()
}
void CAIRO_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
void CAIRO_GAL::onPaint( wxPaintEvent& aEvent )
{
PostPaint();
PostPaint( aEvent );
}
-8
View File
@@ -135,14 +135,6 @@ CAIRO_PRINT_GAL::CAIRO_PRINT_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions,
}
void CAIRO_PRINT_GAL::SetLineWidth( float aLineWidth )
{
storePath();
lineWidth = aLineWidth;
cairo_set_line_width( currentContext, aLineWidth );
}
void CAIRO_PRINT_GAL::ComputeWorldScreenMatrix()
{
worldScale = screenDPI * worldUnitLength * zoomFactor;
+11 -5
View File
@@ -64,6 +64,7 @@ static const wxChar* traceGalDispOpts = wxT( "KICAD_GAL_DISPLAY_OPTIONS" );
GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS()
: gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE ),
cairo_antialiasing_mode( CAIRO_ANTIALIASING_MODE::NONE ),
m_dpi( nullptr, nullptr ),
m_gridStyle( GRID_STYLE::DOTS ),
m_gridLineWidth( 1.0 ),
m_gridMinSpacing( 10.0 ),
@@ -109,12 +110,10 @@ void GAL_DISPLAY_OPTIONS::ReadCommonConfig( wxConfigBase& aCommonConfig, wxWindo
CAIRO_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE );
cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) temp;
{
const DPI_SCALING dpi{ &aCommonConfig, aWindow };
m_scaleFactor = dpi.GetScaleFactor();
}
m_dpi = DPI_SCALING( &aCommonConfig, aWindow );
NotifyChanged();
// Also calls NotifyChanged
UpdateScaleFactor();
}
@@ -146,6 +145,13 @@ void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase& aCfg, const wxString& aBase
}
void GAL_DISPLAY_OPTIONS::UpdateScaleFactor()
{
m_scaleFactor = m_dpi.GetScaleFactor();
NotifyChanged();
}
void GAL_DISPLAY_OPTIONS::NotifyChanged()
{
wxLogTrace( traceGalDispOpts, "Change notification" );
+6 -1
View File
@@ -65,7 +65,8 @@ CACHED_CONTAINER_GPU::~CACHED_CONTAINER_GPU()
if( m_isMapped )
Unmap();
glDeleteBuffers( 1, &m_glBufferHandle );
if( glDeleteBuffers )
glDeleteBuffers( 1, &m_glBufferHandle );
}
@@ -73,6 +74,10 @@ void CACHED_CONTAINER_GPU::Map()
{
wxCHECK( !IsMapped(), /*void*/ );
// OpenGL version might suddenly stop being available in Windows when an RDP session is started
if( !glBindBuffer )
throw std::runtime_error( "OpenGL no longer available!" );
glBindBuffer( GL_ARRAY_BUFFER, m_glBufferHandle );
m_vertices = static_cast<VERTEX*>( glMapBuffer( GL_ARRAY_BUFFER, GL_READ_WRITE ) );
+3 -1
View File
@@ -51,7 +51,9 @@ CACHED_CONTAINER_RAM::CACHED_CONTAINER_RAM( unsigned int aSize ) :
CACHED_CONTAINER_RAM::~CACHED_CONTAINER_RAM()
{
glDeleteBuffers( 1, &m_verticesBuffer );
if( glDeleteBuffers )
glDeleteBuffers( 1, &m_verticesBuffer );
free( m_vertices );
}
+8 -11
View File
@@ -282,7 +282,6 @@ const float SHADER_FILLED_CIRCLE = 2.0;
const float SHADER_STROKED_CIRCLE = 3.0;
const float SHADER_FONT = 4.0;
const float SHADER_LINE_A = 5.0;
const float SHADER_LINE_B = 6.0;
varying vec4 shaderParams;
varying vec2 circleCoords;
@@ -302,12 +301,6 @@ void filledCircle( vec2 aCoord )
float pixelSegDistance( vec2 aCoord )
{
if( shaderParams[0] == SHADER_LINE_B )
{
gl_FragColor = gl_Color;
return 0.0;
}
float aspect = shaderParams[1];
float dist;
vec2 v = vec2( 1.0 - ( aspect - abs( aCoord.s ) ), aCoord.t );
@@ -361,19 +354,23 @@ float median( vec3 v )
void main()
{
if( shaderParams[0] == SHADER_LINE_A )
// VS to FS pipeline does math that means we can't rely on the mode
// parameter being bit-exact without rounding it first.
float mode = floor( shaderParams[0] + 0.5 );
if( mode == SHADER_LINE_A )
{
drawLine( gl_TexCoord[0].st );
}
else if( shaderParams[0] == SHADER_FILLED_CIRCLE )
else if( mode == SHADER_FILLED_CIRCLE )
{
filledCircle( circleCoords );
}
else if( shaderParams[0] == SHADER_STROKED_CIRCLE )
else if( mode == SHADER_STROKED_CIRCLE )
{
strokedCircle( circleCoords, shaderParams[2], shaderParams[3] );
}
else if( shaderParams[0] == SHADER_FONT )
else if( mode == SHADER_FONT )
{
vec2 tex = shaderParams.yz;
+5 -2
View File
@@ -85,8 +85,11 @@ GPU_CACHED_MANAGER::~GPU_CACHED_MANAGER()
{
if( m_buffersInitialized )
{
glBindBuffer( GL_ARRAY_BUFFER, 0 );
glDeleteBuffers( 1, &m_indicesBuffer );
if( glBindBuffer )
glBindBuffer( GL_ARRAY_BUFFER, 0 );
if( glDeleteBuffers )
glDeleteBuffers( 1, &m_indicesBuffer );
}
}
+5 -2
View File
@@ -399,8 +399,11 @@ void OPENGL_COMPOSITOR::clean()
m_buffers.clear();
glDeleteFramebuffersEXT( 1, &m_mainFbo );
glDeleteRenderbuffersEXT( 1, &m_depthBuffer );
if( glDeleteFramebuffersEXT )
glDeleteFramebuffersEXT( 1, &m_mainFbo );
if( glDeleteRenderbuffersEXT )
glDeleteRenderbuffersEXT( 1, &m_depthBuffer );
m_initialized = false;
}
+80 -46
View File
@@ -33,6 +33,7 @@
#include <geometry/shape_poly_set.h>
#include <text_utils.h>
#include <bitmap_base.h>
#include <bezier_curves.h>
#include <macros.h>
@@ -197,30 +198,16 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
isContextLocked( false ),
lockClientCookie( 0 )
{
// IsDisplayAttr() handles WX_GL_{MAJOR,MINOR}_VERSION correctly only in 3.0.4
// starting with 3.1.0 one should use wxGLContext::IsOk() (done by GL_CONTEXT_MANAGER)
#if wxCHECK_VERSION( 3, 0, 3 ) and !wxCHECK_VERSION( 3, 1, 0 )
const int attr[] = { WX_GL_MAJOR_VERSION, 2, WX_GL_MINOR_VERSION, 1, 0 };
if( !IsDisplaySupported( attr ) )
throw std::runtime_error( "OpenGL 2.1 or higher is required!" );
#endif /* wxCHECK_VERSION( 3, 0, 3 ) */
if( glMainContext == NULL )
{
glMainContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this );
if( !glMainContext )
throw std::runtime_error( "Could not create the main OpenGL context" );
glPrivContext = glMainContext;
}
else
{
glPrivContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this, glMainContext );
if( !glPrivContext )
throw std::runtime_error( "Could not create a private OpenGL context" );
}
shader = new SHADER();
@@ -271,9 +258,6 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
tesselator = gluNewTess();
InitTesselatorCallbacks( tesselator );
if( tesselator == NULL )
throw std::runtime_error( "Could not create the tesselator" );
gluTessProperty( tesselator, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE );
SetTarget( TARGET_NONCACHED );
@@ -325,6 +309,46 @@ OPENGL_GAL::~OPENGL_GAL()
}
void OPENGL_GAL::PostPaint( wxPaintEvent& aEvent )
{
// posts an event to m_paint_listener to ask for redraw the canvas.
if( paintListener )
{
wxPostEvent( paintListener, aEvent );
}
}
wxString OPENGL_GAL::CheckFeatures( GAL_DISPLAY_OPTIONS& aOptions )
{
wxString retVal = wxEmptyString;
wxFrame* testFrame = new wxFrame( NULL, wxID_ANY, wxT( "" ), wxDefaultPosition, wxSize( 1, 1 ),
wxFRAME_TOOL_WINDOW | wxNO_BORDER );
KIGFX::OPENGL_GAL* opengl_gal = new KIGFX::OPENGL_GAL( aOptions, testFrame );
testFrame->Raise();
testFrame->Show();
try
{
GAL_CONTEXT_LOCKER lock( opengl_gal );
opengl_gal->init();
}
catch( std::runtime_error& err )
{
//Test failed
retVal = wxString( err.what() );
}
delete opengl_gal;
delete testFrame;
return retVal;
}
bool OPENGL_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
{
bool refresh = false;
@@ -602,7 +626,12 @@ void OPENGL_GAL::DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoin
void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint,
double aWidth )
{
if( aStartPoint == aEndPoint ) // 0 length segments are just a circle.
VECTOR2D startEndVector = aEndPoint - aStartPoint;
double lineLength = startEndVector.EuclideanNorm();
// segments having a length <= 1 are just a circle.
// Moreover trying to draw them as a segment does not work fine.
if( lineLength <= 1 )
{
DrawCircle( aStartPoint, aWidth/2 );
return;
@@ -617,10 +646,8 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP
}
else
{
auto startEndVector = aEndPoint - aStartPoint;
auto lineAngle = startEndVector.Angle();
// Outlined tracks
double lineLength = startEndVector.EuclideanNorm();
SetLineWidth( 1.0 );
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
@@ -1034,34 +1061,21 @@ void OPENGL_GAL::DrawPolygon( const SHAPE_LINE_CHAIN& aPolygon )
void OPENGL_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControlPointA,
const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint )
const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint,
double aFilterValue )
{
// FIXME The drawing quality needs to be improved
// FIXME Perhaps choose a quad/triangle strip instead?
// FIXME Brute force method, use a better (recursive?) algorithm
std::vector<VECTOR2D> output;
std::vector<VECTOR2D> pointCtrl;
std::deque<VECTOR2D> pointList;
pointCtrl.push_back( aStartPoint );
pointCtrl.push_back( aControlPointA );
pointCtrl.push_back( aControlPointB );
pointCtrl.push_back( aEndPoint );
double t = 0.0;
double dt = 1.0 / (double) CURVE_POINTS;
BEZIER_POLY converter( pointCtrl );
converter.GetPoly( output, aFilterValue );
for( int i = 0; i <= CURVE_POINTS; i++ )
{
double omt = 1.0 - t;
double omt2 = omt * omt;
double omt3 = omt * omt2;
double t2 = t * t;
double t3 = t * t2;
VECTOR2D vertex = omt3 * aStartPoint + 3.0 * t * omt2 * aControlPointA
+ 3.0 * t2 * omt * aControlPointB + t3 * aEndPoint;
pointList.push_back( vertex );
t += dt;
}
DrawPolyline( pointList );
DrawPolyline( &output[0], output.size() );
}
@@ -1923,9 +1937,9 @@ std::pair<VECTOR2D, float> OPENGL_GAL::computeBitmapTextSize( const UTF8& aText
}
void OPENGL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
void OPENGL_GAL::onPaint( wxPaintEvent& aEvent )
{
PostPaint();
PostPaint( aEvent );
}
@@ -1989,6 +2003,26 @@ void OPENGL_GAL::init()
wxASSERT_MSG( isContextLocked, "This should only be called from within a locked context." );
// IsDisplayAttr() handles WX_GL_{MAJOR,MINOR}_VERSION correctly only in 3.0.4
// starting with 3.1.0 one should use wxGLContext::IsOk() (done by GL_CONTEXT_MANAGER)
#if wxCHECK_VERSION( 3, 0, 3 ) and !wxCHECK_VERSION( 3, 1, 0 )
const int attr[] = { WX_GL_MAJOR_VERSION, 2, WX_GL_MINOR_VERSION, 1, 0 };
if( !IsDisplaySupported( attr ) )
throw std::runtime_error( "OpenGL 2.1 or higher is required!" );
#endif /* wxCHECK_VERSION( 3, 0, 3 ) */
// Check correct initialization from the constructor
if( !glMainContext )
throw std::runtime_error( "Could not create the main OpenGL context" );
if( !glPrivContext )
throw std::runtime_error( "Could not create a private OpenGL context" );
if( tesselator == NULL )
throw std::runtime_error( "Could not create the tesselator" );
// End initialzation checks
GLenum err = glewInit();
if( GLEW_OK != err )
+14 -11
View File
@@ -59,20 +59,23 @@ SHADER::~SHADER()
if( isProgramCreated )
{
// Delete the shaders and the program
for( std::deque<GLuint>::iterator it = shaderNumbers.begin();
it != shaderNumbers.end(); ++it )
if( glIsShader )
{
GLuint shader = *it;
if( glIsShader( shader ) )
// Delete the shaders and the program
for( std::deque<GLuint>::iterator it = shaderNumbers.begin(); it != shaderNumbers.end();
++it )
{
glDetachShader( programNumber, shader );
glDeleteShader( shader );
}
}
GLuint shader = *it;
glDeleteProgram( programNumber );
if( glIsShader( shader ) )
{
glDetachShader( programNumber, shader );
glDeleteShader( shader );
}
}
glDeleteProgram( programNumber );
}
}
}
+54 -11
View File
@@ -268,33 +268,78 @@ std::string GBR_APERTURE_METADATA::FormatAttribute( GBR_APERTURE_ATTRIB aAttribu
return full_attribute_string;
}
// Helper function to convert a ascii hex char to its integer value
// If the char is not a hexa char, return -1
int char2Hex( unsigned aCode )
{
if( aCode >= '0' && aCode <= '9' )
return aCode - '0';
if( aCode >= 'A' && aCode <= 'F' )
return aCode - 'A' + 10;
if( aCode >= 'a' && aCode <= 'f' )
return aCode - 'a' + 10;
return -1;
}
wxString FormatStringFromGerber( const wxString& aString )
{
// make the inverse conversion of formatStringToGerber()
// It converts a "normalized" gerber string and convert it to a 16 bits sequence unicode
// and return a wxString (unicode 16) from the gerber string
// Note the initial gerber string can already contain unicode chars.
wxString txt;
for( unsigned ii = 0; ii < aString.Length(); ++ii )
unsigned count = aString.Length();
for( unsigned ii = 0; ii < count; ++ii )
{
unsigned code = aString[ii];
if( code == '\\' )
if( code == '\\' && ii < count-5 && aString[ii+1] == 'u' )
{
// Convert 4 hexadecimal digits to a 16 bit unicode
// Note the latest Gerber X2 spec (2019 06) uses \uXXXX to encode
// the unicode XXXX hexadecimal value
// If 4 chars next to 'u' are hexadecimal chars,
// convert these 4 hexadecimal digits to a 16 bit unicode
// (Gerber allows only 4 hexadecimal digits)
// If an error occurs, the escape sequence is not translated,
// and used "as this"
long value = 0;
bool error = false;
for( int jj = 0; jj < 4; jj++ )
{
value <<= 4;
code = aString[++ii];
// Very basic conversion, but it expects a valid gerber file
int hexa = (code <= '9' ? code - '0' : code - 'A' + 10) & 0xF;
value += hexa;
code = aString[ii+jj+2];
int hexa = char2Hex( code );
if( hexa >= 0 )
value += hexa;
else
{
error = true;
break;
}
}
txt.Append( wxChar( value ) );
if( !error )
{
if( value >= ' ' ) // Is a valid wxChar ?
txt.Append( wxChar( value ) );
ii += 5;
}
else
{
txt.Append( aString[ii] );
continue;
}
}
else
txt.Append( aString[ii] );
@@ -334,12 +379,10 @@ std::string formatStringToGerber( const wxString& aString )
if( convert || code > 0x7F )
{
txt += '\\';
// Convert code to 4 hexadecimal digit
// (Gerber allows only 4 hexadecimal digit)
char hexa[32];
sprintf( hexa,"%4.4X", code & 0xFFFF);
sprintf( hexa,"\\u%4.4X", code & 0xFFFF);
txt += hexa;
}
else
+21 -2
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -54,6 +54,25 @@ int GetArcToSegmentCount( int aRadius, int aErrorMax, double aArcAngleDegree )
}
// When creating polygons to create a clearance polygonal area, the polygon must
// be same or bigger than the original shape.
// Polygons are bigger if the original shape has arcs (round rectangles, ovals, circles...)
// In some cases (in fact only one: when building layer solder mask) modifying
// shapes when converting them to polygons is not acceptable (the modification
// can break calculations)
// so one can disable the shape expansion by calling KeepPolyInsideShape( true )
// Important: calling KeepPolyInsideShape( false ) after calculations is
// mandatory to break oher calculations
static bool s_disable_arc_correction = false;
// Enable (aInside = false) or disable (aInside = true) polygonal shape expansion
// when converting pads shapes and other items shapes to polygons:
void DisableArcRadiusCorrection( bool aDisable )
{
s_disable_arc_correction = aDisable;
}
double GetCircletoPolyCorrectionFactor( int aSegCountforCircle )
{
/* calculates the coeff to compensate radius reduction of circle
@@ -66,7 +85,7 @@ double GetCircletoPolyCorrectionFactor( int aSegCountforCircle )
if( aSegCountforCircle < MIN_SEGCOUNT_FOR_CIRCLE )
aSegCountforCircle = MIN_SEGCOUNT_FOR_CIRCLE;
return 1.0 / cos( M_PI / aSegCountforCircle );
return s_disable_arc_correction ? 1.0 : 1.0 / cos( M_PI / aSegCountforCircle );
}
+11 -2
View File
@@ -33,6 +33,7 @@ int sgn( T aVal )
bool SEG::PointCloserThan( const VECTOR2I& aP, int aDist ) const
{
// See http://geomalgorithms.com/a02-_lines.html for some explanations and ideas.
VECTOR2I d = B - A;
ecoord dist_sq = (ecoord) aDist * aDist;
@@ -44,9 +45,17 @@ bool SEG::PointCloserThan( const VECTOR2I& aP, int aDist ) const
else if( t >= l_squared )
return ( aP - B ).SquaredEuclideanNorm() < dist_sq;
int dxdy = abs( d.x ) - abs( d.y );
// JPC: This code is not trivial and is not commented
// and does not work for d.x or d.y = -1...1
// I am guessing it is here for calculation time optimization.
// if someone can understand it, please fix it.
// It can be tested with a segment having d.x or d.y value
// is -1 or +1 ("this" is a quasi vertical or horizontal segment)
int dxdy = std::abs( d.x ) - std::abs( d.y );
if( ( dxdy >= -1 && dxdy <= 1 ) || abs( d.x ) <= 1 || abs( d.y ) <= 1 )
if( ( dxdy >= -1 && dxdy <= 1 ) // quasi 45 deg segment
/*|| std::abs( d.x ) <= 1 // quasi horizontal segment
|| std::abs( d.y ) <= 1 // quasi vertical segment */ )
{
int ca = -sgn( d.y );
int cb = sgn( d.x );
+2
View File
@@ -458,6 +458,8 @@ int SHAPE_POLY_SET::AddHole( const SHAPE_LINE_CHAIN& aHole, int aOutline )
POLYGON& poly = m_polys[aOutline];
assert( aOutline < (int)m_polys.size() );
assert( poly.size() );
poly.push_back( aHole );
+5
View File
@@ -351,7 +351,12 @@ bool OpenPDF( const wxString& file )
if( !Pgm().UseSystemPdfBrowser() ) // Run the preferred PDF Browser
{
#ifdef __WXMSW__
// Windows requires double quotes around the filename to handle spaces
command = Pgm().GetPdfBrowserName() + wxT( " \"" ) + filename + wxT( "\"" );
#else
command = Pgm().GetPdfBrowserName() + wxT( " '" ) + filename + wxT( "'" );
#endif
}
else
{
+7 -36
View File
@@ -1148,45 +1148,16 @@ void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPoints[], int n )
}
void GRBezier( EDA_RECT* ClipBox,
wxDC* DC,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int width,
COLOR4D Color )
void GRBezier( EDA_RECT* aClipBox, wxDC* aDC,
std::vector<wxPoint>& aPoint,
int aWidth, COLOR4D aColor )
{
std::vector<wxPoint> points;
std::vector<wxPoint> output;
BEZIER_POLY converter( x1, y1, x2, y2, x3, y3 );
converter.GetPoly( points );
BEZIER_POLY converter( aPoint );
converter.GetPoly( output, aWidth );
GRPoly( ClipBox, DC, points.size(), &points[0], false, width, Color, Color );
}
void GRBezier( EDA_RECT* ClipBox,
wxDC* DC,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int x4,
int y4,
int width,
COLOR4D Color )
{
std::vector<wxPoint> points;
BEZIER_POLY converter( x1, y1, x2, y2, x3, y3, x4, y4 );
converter.GetPoly( points );
GRPoly( ClipBox, DC, points.size(), &points[0], false, width, Color, Color );
GRPoly( aClipBox, aDC, output.size(), &output[0], false, aWidth, aColor, aColor );
}
+1 -1
View File
@@ -500,7 +500,7 @@ void GRID_TRICKS::onUpdateUI( wxUpdateUIEvent& event )
}
}
if( !cursorInSelectedRow )
if( !cursorInSelectedRow && cursorRow >= 0 )
m_grid->SelectRow( cursorRow );
}
}
+42
View File
@@ -0,0 +1,42 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gestfich.h>
#include <launch_ext.h>
void LaunchExternal( const wxString& aPath )
{
#ifdef __WXMAC__
wxExecute( wxString::Format( "open \"%s\"", aPath ) );
#else
wxString path( aPath );
#if !wxCHECK_VERSION( 3, 1, 0 )
// Quote in case there are spaces in the path.
// Not needed on 3.1.4, but needed in 3.0 versions
// Moreover, on Linux, on 3.1.4 wx version, adding quotes breaks
// wxLaunchDefaultApplication
AddDelimiterString( path );
#endif
wxLaunchDefaultApplication( path );
#endif
}
+32
View File
@@ -268,6 +268,7 @@ bool EDA_DRAW_FRAME::LockFile( const wxString& aFileName )
void EDA_DRAW_FRAME::unitsChangeRefresh()
{
ReCreateAuxiliaryToolbar();
UpdateStatusBar();
UpdateMsgPanel();
}
@@ -298,6 +299,8 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
m_canvas->SetEnableAutoPan( option );
m_galDisplayOptions.ReadCommonConfig( *settings, this );
ReCreateAuxiliaryToolbar();
}
@@ -428,6 +431,7 @@ void EDA_DRAW_FRAME::OnUpdateUnits( wxUpdateUIEvent& aEvent )
aEvent.Check( enable );
DisplayUnitsMsg();
ReCreateAuxiliaryToolbar();
}
@@ -672,6 +676,23 @@ void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
}
void EDA_DRAW_FRAME::OnMove( wxMoveEvent& aEvent )
{
// If the window is moved to a different display, the scaling factor may change
double oldFactor = m_galDisplayOptions.m_scaleFactor;
m_galDisplayOptions.UpdateScaleFactor();
if( oldFactor != m_galDisplayOptions.m_scaleFactor )
{
wxSize clientSize = GetClientSize();
GetGalCanvas()->GetGAL()->ResizeScreen( clientSize.x, clientSize.y );
GetGalCanvas()->GetView()->MarkDirty();
}
aEvent.Skip();
}
void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
{
// Keep default cursor in toolbars
@@ -1070,6 +1091,11 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
bool EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
{
#ifdef __WXMAC__
// Cairo is unsupported on Mac
if( aCanvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO )
aCanvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
#endif
auto galCanvas = GetGalCanvas();
wxCHECK( galCanvas, false );
bool use_gal = galCanvas->SwitchBackend( aCanvasType );
@@ -1099,6 +1125,12 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
}
#ifdef __WXMAC__
// Did Cairo get saved on Mac? Force OpenGL; Cairo doesn't work on Retina displays
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO )
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
#endif
// Coerce the value into a GAL type when Legacy is not available
// Default to Cairo, and on the first, user will be prompted for OpenGL
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
+9
View File
@@ -271,6 +271,7 @@ bool EDA_DRAW_FRAME::LockFile( const wxString& aFileName )
void EDA_DRAW_FRAME::unitsChangeRefresh()
{
ReCreateAuxiliaryToolbar();
UpdateStatusBar();
UpdateMsgPanel();
}
@@ -300,6 +301,8 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
m_canvas->SetEnableAutoPan( option );
m_galDisplayOptions.ReadCommonConfig( *settings, this );
ReCreateAuxiliaryToolbar();
}
@@ -687,6 +690,12 @@ void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
}
void EDA_DRAW_FRAME::OnMove( wxMoveEvent& aEvent )
{
aEvent.Skip();
}
void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
{
// Keep default cursor in toolbars
+1
View File
@@ -21,6 +21,7 @@
#include <lib_tree_model.h>
#include <algorithm>
#include <eda_pattern_match.h>
#include <lib_tree_item.h>
#include <make_unique.h>
+45 -27
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -136,38 +136,53 @@ void LIB_TREE_MODEL_ADAPTER::DoAddLibrary( wxString const& aNodeName, wxString c
}
void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( wxString const& aSearch )
void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( wxString const& aSearch, bool aState )
{
m_tree.ResetScore();
wxStringTokenizer tokenizer( aSearch );
while( tokenizer.HasMoreTokens() )
{
const wxString term = tokenizer.GetNextToken().Lower();
EDA_COMBINED_MATCHER matcher( term );
m_tree.UpdateScore( matcher );
}
m_tree.SortNodes();
{
wxWindowUpdateLocker updateLock( m_widget );
// Even with the updateLock, wxWidgets sometimes ties its knickers in
// a knot when trying to run a wxdataview_selection_changed_callback()
// on a row that has been deleted.
// Even with the updateLock, wxWidgets sometimes ties its knickers in a knot trying to
// run a wxdataview_selection_changed_callback() on a row that has been deleted.
// https://bugs.launchpad.net/kicad/+bug/1756255
m_widget->UnselectAll();
Cleared();
#ifndef __WINDOWS__
// The fastest method to update wxDataViewCtrl is to rebuild from
// scratch by calling Cleared(). Linux requires to reassociate model to
// display data, but Windows will create multiple associations.
AttachTo( m_widget );
#endif
// This collapse is required before the call to "Freeze()" below. Once Freeze()
// is called, GetParent() will return nullptr. While this works for some calls, it
// segfaults when we have any expanded elements b/c the sub units in the tree don't
// have explicit references that are maintained over a search
// The tree will be expanded again below when we get our matches
//
// Also note that this cannot happen when we have deleted a symbol as GTK will also
// iterate over the tree in this case and find a symbol that has an invalid link
// and crash https://gitlab.com/kicad/code/kicad/-/issues/6910
if( !aState && m_tree.Children.size() )
{
for( std::unique_ptr<LIB_TREE_NODE>& child: m_tree.Children )
m_widget->Collapse( wxDataViewItem( &*child ) );
}
// DO NOT REMOVE THE FREEZE/THAW. This freeze/thaw is a flag for this model adapter
// that tells it when it shouldn't trust any of the data in the model. When set, it will
// not return invalid data to the UI, since this invalid data can cause crashes.
// This is different than the update locker, which locks the UI aspects only.
Freeze();
BeforeReset();
m_tree.ResetScore();
wxStringTokenizer tokenizer( aSearch );
while( tokenizer.HasMoreTokens() )
{
const wxString term = tokenizer.GetNextToken().Lower();
EDA_COMBINED_MATCHER matcher( term );
m_tree.UpdateScore( matcher );
}
m_tree.SortNodes();
AfterReset();
Thaw();
}
LIB_TREE_NODE* bestMatch = ShowResults();
@@ -310,6 +325,9 @@ bool LIB_TREE_MODEL_ADAPTER::IsContainer( wxDataViewItem const& aItem ) const
wxDataViewItem LIB_TREE_MODEL_ADAPTER::GetParent( wxDataViewItem const& aItem ) const
{
if( m_freeze )
return ToItem( nullptr );
auto node = ToNode( aItem );
auto parent = node ? node->Parent : nullptr;
@@ -451,7 +469,7 @@ LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
[]( LIB_TREE_NODE const* n )
{
// return leaf nodes with some level of matching
return n->Children.size() == 0 && n->Score > 1;
return n->Type == LIB_TREE_NODE::TYPE::LIBID && n->Score > 1;
},
&highScore );
+2 -1
View File
@@ -171,8 +171,9 @@ public:
* Set the search string provided by the user.
*
* @param aSearch full, unprocessed search text
* @param aState Are we keeping the selection/search state?
*/
void UpdateSearchString( wxString const& aSearch );
void UpdateSearchString( wxString const& aSearch, bool aState );
/**
* Attach to a wxDataViewCtrl and initialize it. This will set up columns
+8 -5
View File
@@ -286,17 +286,20 @@ std::string LSET::FmtHex() const
static const char hex[] = "0123456789abcdef";
int nibble_count = ( size() + 3 ) / 4;
unsigned nibble_count = ( size() + 3 ) / 4;
for( int nibble=0; nibble<nibble_count; ++nibble )
for( unsigned nibble = 0; nibble < nibble_count; ++nibble )
{
unsigned ndx = 0;
// test 4 consecutive bits and set ndx to 0-15:
for( int nibble_bit=0; nibble_bit<4; ++nibble_bit )
for( unsigned nibble_bit = 0; nibble_bit < 4; ++nibble_bit )
{
if( (*this)[nibble_bit + nibble*4] )
ndx |= (1 << nibble_bit);
if( ( nibble_bit + nibble * 4 ) >= size() )
break;
if( (*this)[nibble_bit + nibble * 4] )
ndx |= ( 1 << nibble_bit );
}
if( nibble && !( nibble % 8 ) )
+28
View File
@@ -92,6 +92,34 @@ bool MD5_HASH::operator!=( const MD5_HASH& aOther ) const
}
std::string MD5_HASH::Format( bool aCompactForm )
{
std::string data;
// Build a hexadecimal string from the 16 bytes of MD5_HASH:
for( int ii = 0; ii < 16; ++ii )
{
char lsb = ( m_hash[ii] & 0x0F ) + '0';
if( lsb > '9' )
lsb += 'A'-'9';
char msb = ( ( m_hash[ii] >> 4 ) & 0x0F ) + '0';
if( msb > '9' )
msb += 'A'-'9';
data += msb;
data += lsb;
if( !aCompactForm )
data += ' ';
}
return data;
}
void MD5_HASH::md5_transform(MD5_CTX *ctx, uint8_t data[])
{
uint32_t a,b,c,d,m[16],i,j;
+4
View File
@@ -43,6 +43,10 @@ EDA_MSG_PANEL::EDA_MSG_PANEL( wxWindow* aParent, int aId,
{
SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
// informs wx not to paint the background itself as we will paint it later in erase()
SetBackgroundStyle( wxBG_STYLE_PAINT );
m_last_x = 0;
m_fontSize = computeFontSize();
@@ -128,6 +128,14 @@ void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout )
if( token == T_LEFT )
token = NextTok();
if( token == T_kicad_wks || token == T_drawing_sheet )
{
THROW_PARSE_ERROR( _( "KiCad was unable to open this file because it was created with "
"a more recent version than the one you are running.\n\n"
"To open it you will need to upgrade KiCad to 5.99 or later." ),
CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
if( token == T_page_layout )
continue;
@@ -1,3 +1,5 @@
drawing_sheet
kicad_wks
page_layout
setup
left_margin
+222 -56
View File
@@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -170,9 +170,8 @@ bool GERBER_PLOTTER::StartPlot()
finalFile = outputFile; // the actual gerber file will be created later
// Create a temporary filename to store gerber file
// note tmpfile() does not work under Vista and W7 in user mode
m_workFilename = filename + wxT(".tmp");
// Create a temp file in system temp to avoid potential network share buffer issues for the final read and save
m_workFilename = wxFileName::CreateTempFileName( "" );
workFile = wxFopen( m_workFilename, wxT( "wt" ));
outputFile = workFile;
wxASSERT( outputFile );
@@ -217,6 +216,10 @@ bool GERBER_PLOTTER::StartPlot()
// Be sure the usual dark polarity is selected:
fputs( "%LPD*%\n", outputFile );
// Set initial interpolation mode: always G01 (linear):
fputs( "G01*\n", outputFile );
// Set aperture list starting point:
fputs( "G04 APERTURE LIST*\n", outputFile );
return true;
@@ -327,10 +330,7 @@ void GERBER_PLOTTER::selectAperture( const wxSize& aSize,
( currentAperture->m_Type != aType ) ||
( currentAperture->m_Size != aSize );
if( !m_useNetAttributes )
aApertureAttribute = 0;
else
change = change || ( currentAperture->m_ApertureAttribute != aApertureAttribute );
change = change || ( currentAperture->m_ApertureAttribute != aApertureAttribute );
if( change )
{
@@ -474,21 +474,34 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAn
{
SetCurrentLineWidth( aWidth );
// aFill is not used here.
plotArc( aCenter, aStAngle, aEndAngle, aRadius, false );
}
void GERBER_PLOTTER::plotArc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
int aRadius, bool aPlotInRegion )
{
wxPoint start, end;
start.x = aCenter.x + KiROUND( cosdecideg( aRadius, aStAngle ) );
start.y = aCenter.y - KiROUND( sindecideg( aRadius, aStAngle ) );
MoveTo( start );
if( !aPlotInRegion )
MoveTo( start );
else
LineTo( start );
end.x = aCenter.x + KiROUND( cosdecideg( aRadius, aEndAngle ) );
end.y = aCenter.y - KiROUND( sindecideg( aRadius, aEndAngle ) );
DPOINT devEnd = userToDeviceCoordinates( end );
DPOINT devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
fprintf( outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
fprintf( outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
if( aStAngle < aEndAngle )
fprintf( outputFile, "G03" );
fprintf( outputFile, "G03*\n" ); // Active circular interpolation, CCW
else
fprintf( outputFile, "G02" );
fprintf( outputFile, "G02*\n" ); // Active circular interpolation, CW
fprintf( outputFile, "X%dY%dI%dJ%dD01*\n",
KiROUND( devEnd.x ), KiROUND( devEnd.y ),
@@ -736,33 +749,28 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub
else // Plot pad as region.
// Only regions and flashed items accept a object attribute TO.P for the pin name
{
if( size.x > size.y )
{
std::swap( size.x, size.y );
if( orient < 2700 )
orient += 900;
else
orient -= 2700;
}
if( trace_mode == FILLED )
{
// TODO: use an aperture macro to declare the rotated pad
// to be able to flash the shape
// For now, the pad is drawn as segment
// The pad is reduced to an segment with dy > dx
int delta = size.y - size.x;
wxPoint p0( 0, -delta / 2 );
wxPoint p1( 0, delta / 2 );
RotatePoint( &p0.x, &p0.y, orient );
RotatePoint( &p1.x, &p1.y, orient );
ThickSegment( pos + p0, pos + p1, size.x, trace_mode, gbr_metadata );
// Draw the oval as round rect pad with a radius = 50% min size)
// In gerber file, it will be drawn as a region with arcs, and can be
// detected as pads (similar to a flashed pad)
FlashPadRoundRect( pos, aSize, std::min( aSize.x, aSize.y ) /2,
orient, FILLED, aData );
}
else
else // Non filled shape: plot outlines:
{
if( size.x > size.y )
{
std::swap( size.x, size.y );
if( orient < 2700 )
orient += 900;
else
orient -= 2700;
}
sketchOval( pos, size, orient, -1 );
}
}
}
@@ -840,36 +848,194 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
EDA_DRAW_MODE_T aTraceMode, void* aData )
{
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
// Currently, a Pad RoundRect is plotted as polygon.
// TODO: use Aperture macro and flash it
SHAPE_POLY_SET outline;
const int segmentToCircleCount = 64;
TransformRoundRectToPolygon( outline, aPadPos, aSize, aOrient,
aCornerRadius, segmentToCircleCount );
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
if( aTraceMode != FILLED )
{
SHAPE_POLY_SET outline;
const int segmentToCircleCount = 64;
TransformRoundRectToPolygon( outline, aPadPos, aSize, aOrient,
aCornerRadius, segmentToCircleCount );
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, &gbr_metadata );
outline.Inflate( -GetCurrentLineWidth()/2, 16 );
std::vector< wxPoint > cornerList;
// TransformRoundRectToPolygon creates only one convex polygon
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
cornerList.reserve( poly.PointCount() + 1 );
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
// Close polygon
cornerList.push_back( cornerList[0] );
// plot outlines
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), gbr_metadata );
}
else
{
// A Pad RoundRect is plotted as a Gerber region.
// Initialize region metadata:
bool clearTA_AperFunction = false; // true if a TA.AperFunction is used
if( gbr_metadata )
{
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
std::string attrib = gbr_metadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
if( !attrib.empty() )
{
fputs( attrib.c_str(), outputFile );
clearTA_AperFunction = true;
}
}
// Plot the region using arcs in corners.
plotRoundRectAsRegion( aPadPos, aSize, aCornerRadius, aOrient );
// Clear the TA attribute, to avoid the next item to inherit it:
if( clearTA_AperFunction )
{
if( m_useX2format )
{
fputs( "%TD.AperFunction*%\n", outputFile );
}
else
{
fputs( "G04 #@! TD.AperFunction*\n", outputFile );
}
}
}
}
void GERBER_PLOTTER::plotRoundRectAsRegion( const wxPoint& aRectCenter, const wxSize& aSize,
int aCornerRadius, double aOrient )
{
// The region outline is generated by 4 sides and 4 90 deg arcs
// 1 --- 2
// | c |
// 4 --- 3
// Note also in user coordinates the Y axis is from top to bottom
// for historical reasons.
// A helper structure to handle outlines coordinates (segments and arcs)
// in user coordinates
struct RR_EDGE
{
wxPoint m_start;
wxPoint m_end;
wxPoint m_center;
// in decidegrees: angle start. angle end = m_arc_angle_start+arc_angle
double m_arc_angle_start;
};
const double arc_angle = -900.0; // in decidegrees
int hsizeX = aSize.x/2;
int hsizeY = aSize.y/2;
RR_EDGE curr_edge;
std::vector<RR_EDGE> rr_outline;
// Build outline coordinates, relative to rectangle center, rotation 0:
// Top left corner 1 (and 4 to 1 left vertical side @ x=-hsizeX)
curr_edge.m_start.x = -hsizeX;
curr_edge.m_start.y = hsizeY - aCornerRadius;
curr_edge.m_end.x = curr_edge.m_start.x;
curr_edge.m_end.y = -hsizeY + aCornerRadius;
curr_edge.m_center.x = -hsizeX + aCornerRadius;
curr_edge.m_center.y = curr_edge.m_end.y;
curr_edge.m_arc_angle_start = aOrient + 1800.0; // En decidegree
rr_outline.push_back( curr_edge );
// Top right corner 2 (and 1 to 2 top horizontal side @ y=-hsizeY)
curr_edge.m_start.x = -hsizeX + aCornerRadius;
curr_edge.m_start.y = -hsizeY;
curr_edge.m_end.x = hsizeX - aCornerRadius;
curr_edge.m_end.y = curr_edge.m_start.y;
curr_edge.m_center.x = curr_edge.m_end.x;
curr_edge.m_center.y = -hsizeY + aCornerRadius;
curr_edge.m_arc_angle_start = aOrient + 900.0; // En decidegree
rr_outline.push_back( curr_edge );
// bottom right corner 3 (and 2 to 3 right vertical side @ x=hsizeX)
curr_edge.m_start.x = hsizeX;
curr_edge.m_start.y = -hsizeY + aCornerRadius;
curr_edge.m_end.x = curr_edge.m_start.x;
curr_edge.m_end.y = hsizeY - aCornerRadius;
curr_edge.m_center.x = hsizeX - aCornerRadius;
curr_edge.m_center.y = curr_edge.m_end.y;
curr_edge.m_arc_angle_start = aOrient + 0.0; // En decidegree
rr_outline.push_back( curr_edge );
// bottom left corner 4 (and 3 to 4 bottom horizontal side @ y=hsizeY)
curr_edge.m_start.x = hsizeX - aCornerRadius;
curr_edge.m_start.y = hsizeY;
curr_edge.m_end.x = -hsizeX + aCornerRadius;
curr_edge.m_end.y = curr_edge.m_start.y;
curr_edge.m_center.x = curr_edge.m_end.x;
curr_edge.m_center.y = hsizeY - aCornerRadius;
curr_edge.m_arc_angle_start = aOrient - 900.0; // En decidegree
rr_outline.push_back( curr_edge );
// Move relative coordinates to the actual location and rotation:
wxPoint arc_last_center;
int arc_last_angle = curr_edge.m_arc_angle_start+arc_angle;
for( RR_EDGE& rr_edge: rr_outline )
{
RotatePoint( &rr_edge.m_start, aOrient );
RotatePoint( &rr_edge.m_end, aOrient );
RotatePoint( &rr_edge.m_center, aOrient );
rr_edge.m_start += aRectCenter;
rr_edge.m_end += aRectCenter;
rr_edge.m_center += aRectCenter;
arc_last_center = rr_edge.m_center;
}
std::vector< wxPoint > cornerList;
// TransformRoundRectToPolygon creates only one convex polygon
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
cornerList.reserve( poly.PointCount() + 1 );
// Ensure the region is a closed polygon, i.e. the end point of last segment
// (end of arc) is the same as the first point. Rounding issues can create a
// small difference, mainly for rotated pads.
// calculate last point (end of last arc):
wxPoint last_pt;
last_pt.x = arc_last_center.x + KiROUND( cosdecideg( aCornerRadius, arc_last_angle ) );
last_pt.y = arc_last_center.y - KiROUND( sindecideg( aCornerRadius, arc_last_angle ) );
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
wxPoint first_pt = rr_outline[0].m_start;
// Close polygon
cornerList.push_back( cornerList[0] );
#if 0 // For test only:
if( last_pt != first_pt )
wxLogMessage( "first pt %d %d last pt %d %d",
first_pt.x, first_pt.y, last_pt.x, last_pt.y );
#endif
if( aTraceMode == SKETCH )
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), gbr_metadata );
else
PlotGerberRegion( cornerList, gbr_metadata );
fputs( "G36*\n", outputFile ); // Start region
fputs( "G01*\n", outputFile ); // Set linear interpolation.
first_pt = last_pt;
MoveTo( first_pt ); // Start point of region, must be same as end point
for( RR_EDGE& rr_edge: rr_outline )
{
if( aCornerRadius ) // Guard: ensure we do not create arcs with radius = 0
{
// LineTo( rr_edge.m_end ); // made in plotArc()
plotArc( rr_edge.m_center,
rr_edge.m_arc_angle_start, rr_edge.m_arc_angle_start+arc_angle,
aCornerRadius, true );
}
else
LineTo( rr_edge.m_end );
}
fputs( "G37*\n", outputFile ); // Close region
}
+2 -3
View File
@@ -495,7 +495,7 @@ int PDF_PLOTTER::startPdfStream(int handle)
"stream\n", handle + 1 );
// Open a temporary file to accumulate the stream
workFilename = filename + wxT(".tmp");
workFilename = wxFileName::CreateTempFileName( "" );
workFile = wxFopen( workFilename, wxT( "w+b" ));
wxASSERT( workFile );
return handle;
@@ -755,8 +755,7 @@ bool PDF_PLOTTER::EndPlot()
"/Producer (KiCAD PDF)\n"
"/CreationDate (%s)\n"
"/Creator (%s)\n"
"/Title (%s)\n"
"/Trapped false\n",
"/Title (%s)\n",
date_buf,
TO_UTF8( creator ),
TO_UTF8( title ) );
+69 -15
View File
@@ -6,8 +6,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -90,6 +90,8 @@
* flag_sweep : 0 = CCW, 1 = CW
* The center of ellipse is automatically calculated.
*/
#include <base64.h>
#include <fctsys.h>
#include <trigo.h>
#include <eda_base_frame.h>
@@ -100,6 +102,8 @@
#include <macros.h>
#include <kicad_string.h>
#include <cstdint>
#include <wx/mstream.h>
/**
@@ -499,7 +503,7 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
setFillMode( NO_FILL );
SetCurrentLineWidth( width );
fprintf( outputFile, "<path d=\"M%g %g A%g %g 0.0 %d %d %g %g \" />\n",
fprintf( outputFile, "<path d=\"M%g %g A%g %g 0.0 %d %d %g %g\" />\n",
start.x, start.y, radius_dev, radius_dev,
flg_arc, flg_sweep,
end.x, end.y );
@@ -554,12 +558,51 @@ void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
void SVG_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos,
double aScaleFactor )
{
// in svg file we must insert a link to a png image file to plot an image
// the image itself is not included in the svg file.
// So we prefer skip the image, and just draw a rectangle,
// like other plotters which do not support images
wxSize pix_size( aImage.GetWidth(), aImage.GetHeight() );
// Requested size (in IUs)
DPOINT drawsize( aScaleFactor * pix_size.x,
aScaleFactor * pix_size.y );
// calculate the bitmap start position
wxPoint start( aPos.x - drawsize.x / 2,
aPos.y - drawsize.y / 2);
// Rectangles having a 0 size value for height or width are just not drawn on Inscape,
// so use a line when happens.
if( drawsize.x == 0.0 || drawsize.y == 0.0 ) // Draw a line
{
PLOTTER::PlotImage( aImage, aPos, aScaleFactor );
}
else
{
wxMemoryOutputStream img_stream;
aImage.SaveFile( img_stream, wxBITMAP_TYPE_PNG );
size_t input_len = img_stream.GetOutputStreamBuffer()->GetBufferSize();
std::vector<uint8_t> buffer( input_len );
std::vector<uint8_t> encoded;
img_stream.CopyTo( buffer.data(), buffer.size() );
base64::encode( buffer, encoded );
fprintf( outputFile,
"<image x=\"%g\" y=\"%g\" xlink:href=\"data:image/png;base64,",
userToDeviceSize( start.x ), userToDeviceSize( start.y )
);
for( size_t i = 0; i < encoded.size(); i++ )
{
fprintf( outputFile, "%c", static_cast<char>( encoded[i] ) );
if( ( i % 64 ) == 63 )
fprintf( outputFile, "\n" );
}
fprintf( outputFile, "\"\npreserveAspectRatio=\"none\" width=\"%g\" height=\"%g\" />",
userToDeviceSize( drawsize.x ), userToDeviceSize( drawsize.y ) );
}
PLOTTER::PlotImage( aImage, aPos, aScaleFactor );
}
@@ -620,7 +663,11 @@ bool SVG_PLOTTER::StartPlot()
"<?xml version=\"1.0\" standalone=\"no\"?>\n",
" <!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"> \n",
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" \n",
"<svg\n"
" xmlns:svg=\"http://www.w3.org/2000/svg\"\n"
" xmlns=\"http://www.w3.org/2000/svg\"\n",
" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n",
" version=\"1.1\"\n",
NULL
};
@@ -633,7 +680,7 @@ bool SVG_PLOTTER::StartPlot()
// Write viewport pos and size
wxPoint origin; // TODO set to actual value
fprintf( outputFile,
" width=\"%gcm\" height=\"%gcm\" viewBox=\"%d %d %d %d \">\n",
" width=\"%fcm\" height=\"%fcm\" viewBox=\"%d %d %d %d\">\n",
(double) paperSize.x / m_IUsPerDecimil * 2.54 / 10000,
(double) paperSize.y / m_IUsPerDecimil * 2.54 / 10000,
origin.x, origin.y,
@@ -660,7 +707,7 @@ bool SVG_PLOTTER::StartPlot()
m_brush_rgb_color, opacity, m_pen_rgb_color, opacity );
// output the pen cap and line joint
fputs( "stroke-linecap:round; stroke-linejoin:round; \"\n", outputFile );
fputs( "stroke-linecap:round; stroke-linejoin:round;\"\n", outputFile );
fputs( " transform=\"translate(0 0) scale(1 1)\">\n", outputFile );
return true;
}
@@ -734,8 +781,10 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
}
wxSize text_size;
text_size.x = GraphicTextWidth( aText, aSize, aItalic, width );
text_size.y = aSize.x * 4/3; // Hershey font height to em size conversion
// aSize.x or aSize.y is < 0 for mirrored texts.
// The actual text size value is the absolue value
text_size.x = std::abs( GraphicTextWidth( aText, aSize, aItalic, width ) );
text_size.y = std::abs( aSize.x * 4/3 ); // Hershey font height to em size conversion
DPOINT anchor_pos_dev = userToDeviceCoordinates( aPos );
DPOINT text_pos_dev = userToDeviceCoordinates( text_pos );
DPOINT sz_dev = userToDeviceSize( text_size );
@@ -747,10 +796,15 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
}
fprintf( outputFile,
"<text x=\"%g\" y=\"%g\"\n"
"<text x=\"%g\" y=\"%g\"\n", text_pos_dev.x, text_pos_dev.y );
/// If the text is mirrored, we should also mirror the hidden text to match
if( aSize.x < 0 )
fprintf( outputFile, "transform=\"scale(-1 1) translate(%f 0)\"\n", -2 * text_pos_dev.x );
fprintf( outputFile,
"textLength=\"%g\" font-size=\"%g\" lengthAdjust=\"spacingAndGlyphs\"\n"
"text-anchor=\"%s\" opacity=\"0\">%s</text>\n",
text_pos_dev.x, text_pos_dev.y,
sz_dev.x, sz_dev.y,
hjust, TO_UTF8( XmlEsc( aText ) ) );
+10 -3
View File
@@ -478,9 +478,16 @@ void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width,
{
if( tracemode == FILLED )
{
SetCurrentLineWidth( width );
MoveTo( start );
FinishTo( end );
if( start == end )
{
Circle( start, width, FILLED_SHAPE, 0 );
}
else
{
SetCurrentLineWidth( width );
MoveTo( start );
FinishTo( end );
}
}
else
{
+2 -2
View File
@@ -31,7 +31,7 @@
using namespace KIGFX::PREVIEW;
const double POLYGON_ITEM::POLY_LINE_WIDTH = 150000.0;
const double POLYGON_ITEM::POLY_LINE_WIDTH = 1;
POLYGON_ITEM::POLYGON_ITEM():
SIMPLE_OVERLAY_ITEM()
@@ -61,7 +61,7 @@ void POLYGON_ITEM::drawPreviewShape( KIGFX::VIEW* aView ) const
auto& gal = *aView->GetGAL();
auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() );
gal.SetLineWidth( POLY_LINE_WIDTH );
gal.SetLineWidth( (float) aView->ToWorld( POLY_LINE_WIDTH ) );
gal.DrawPolyline( m_lockedChain );
// draw the leader line in a different color

Some files were not shown because too many files have changed in this diff Show More