Compare commits

...

200 Commits

Author SHA1 Message Date
Wayne Stambaugh ff2da496af Tag release version 7.0.6. 2023-07-05 08:01:08 -04:00
Steven A. Falco 9d5f85634c Allow python 3.12
(Cherry-picked from 2c983155a4)
2023-07-05 10:45:23 +01:00
Wayne Stambaugh 7efda5fbbd Tag stable release candidate 7.0.6-rc3. 2023-07-02 07:25:23 -04:00
Jeff Young 60696a895c Add DRC testing for copper graphic to zone fill collisions. 2023-06-30 11:56:40 +01:00
Seth Hillbrand 8b26f50003 SIM_VALUE stores significants in 64-bit
stol isn't neccesarily 64-bit though, so we use stoll and catch the
overflow if we have bad input data

Fixes KICAD-2EF

(cherry picked from commit 7779a01d48)
2023-06-29 10:45:29 -07:00
Fabien Corona bf78ac7a6c IBIS: model type should not be case sensitive
Fixes #15068


(cherry picked from commit 8abb701727)
2023-06-28 21:03:49 +00:00
Seth Hillbrand f9e9ed53f9 Update translations 2023-06-27 15:33:46 -07:00
Seth Hillbrand d727063036 Reset turkish translation to Mar 18 2023-06-27 15:33:27 -07:00
Jan Straka 26f69bccef Translated using Weblate (Czech)
Currently translated at 91.5% (7334 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-06-27 15:31:00 -07:00
Jan Straka 95f991b5de Translated using Weblate (Czech)
Currently translated at 91.3% (7323 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-06-27 15:30:59 -07:00
Wellington Terumi Uemura 2a4b72246b Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-06-27 15:30:09 -07:00
Allan Nordhøy e62c9d89b1 Translated using Weblate (Norwegian Bokmål)
Currently translated at 61.1% (4900 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/nb_NO/
2023-06-27 15:29:42 -07:00
Seth Hillbrand 3926173dfe Fix zone fill issue with net ties
A mistake in the cherry-pick for a previous commit prevented footprint
graphics from being knocked out in the zone fill.  This sets the default
to knockout, allowing the assertion from the polygon generation routine
to catch invalid codes

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15069
2023-06-27 12:35:42 -07:00
Seth Hillbrand 9098a7c128 Add QA test to guard net ties
The QA checks that net-ties correctly knock out the zone fill underneath
them.
2023-06-27 12:27:34 -07:00
Wayne Stambaugh d77de385f0 Tag stable release candidate 7.0.6-rc2. 2023-06-26 16:05:47 -04:00
Seth Hillbrand 7bcd3e2262 Cherry-pick part of 14f6e32
This brings EDA_DRAW_FRAME::LockFile into compliance with the lockfile.h
status code.  This was part of a larger commit in the master branch but
the return code checking is needed for v7
2023-06-23 14:11:23 +02:00
Tomasz Wlostowski 2f35d97b27 router: when no collision search context is provided, assume differentNetsOnly is true
(cherry picked from commit a0a68d198c)
2023-06-23 07:55:50 -04:00
Tomasz Wlostowski 152dc56df4 router: provisional fix for 14926
(cherry picked from commit bd5954242e)
2023-06-22 12:54:22 -04:00
Seth Hillbrand 32930319ea Check for directory locking not file
When creating a new file lock, we need to check if the containing
directory can be written, not if the file (which may not yet exist) can
be written

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

(cherry picked from commit 6896148a10)
2023-06-21 14:53:33 +02:00
Seth Hillbrand 2e54232181 Fix LOCKFILE fallback
`throw` needs to provide an actual std::exception or it will not be
caught

(cherry picked from commit 844226e6b9)
2023-06-21 14:53:33 +02:00
Seth Hillbrand 8648017b42 Prevent ro directories from showing lockfile error
(cherry picked from commit d94fd5f979)
2023-06-21 14:53:33 +02:00
jean-pierre charras f974c8259e spice_library_parser: catch an exception thrown when a spice model cannot be built.
Fixes #15012
https://gitlab.com/kicad/code/kicad/-/issues/15012
2023-06-20 10:34:50 +02:00
jean-pierre charras f6f99e45b9 Pcbnew, graphic importer: convert arc with large radius to segment.
Arcs having a too large radius cannot be safely handled.
The criteria (not perfect) is radius < INT_MAX/2 to use arcs
Fixes #14210
https://gitlab.com/kicad/code/kicad/-/issues/14210
2023-06-19 10:46:30 +02:00
Seth Hillbrand 414fca0664 Update Translations 2023-06-18 15:39:30 +02:00
turkce 2641a0d98e Translated using Weblate (Turkish)
Currently translated at 71.9% (5764 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-06-18 15:37:56 +02:00
Henrik Kauhanen 53e8d68878 Translated using Weblate (Swedish)
Currently translated at 99.9% (8010 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/sv/
2023-06-18 15:37:56 +02:00
ZbeeGin 7a6d0c3432 Translated using Weblate (Polish)
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-06-18 15:37:56 +02:00
Toni Laiho b049902925 Translated using Weblate (Finnish)
Currently translated at 99.8% (8002 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-06-18 15:37:55 +02:00
turkce a8289c3223 Translated using Weblate (Turkish)
Currently translated at 57.9% (4647 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/tr/
2023-06-18 15:37:55 +02:00
Julian Daube e46d742d6c Translated using Weblate (German)
Currently translated at 99.6% (7986 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-06-18 15:37:55 +02:00
Jan Straka 24d996c8c4 Translated using Weblate (Czech)
Currently translated at 91.3% (7322 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-06-18 15:37:55 +02:00
Tokita, Hiroshi 8b2cdc434b Translated using Weblate (Japanese)
Currently translated at 99.9% (8010 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-06-18 15:37:55 +02:00
ZbeeGin a7c4f15fea Translated using Weblate (Polish)
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-06-18 15:37:55 +02:00
김랑기 05b0cc9e76 Translated using Weblate (Korean)
Currently translated at 99.8% (8001 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ko/
2023-06-18 15:37:55 +02:00
Hubert Hu 495aaa4c56 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-06-18 15:37:55 +02:00
Bas Wijnen b57ba269a6 Translated using Weblate (Dutch)
Currently translated at 84.1% (6742 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/nl/
2023-06-18 15:37:54 +02:00
ZbeeGin 4948eb0d45 Translated using Weblate (Polish)
Currently translated at 99.8% (8000 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pl/
2023-06-18 15:37:54 +02:00
Bas Wijnen e5e6b9e820 Translated using Weblate (Dutch)
Currently translated at 83.8% (6721 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/nl/
2023-06-18 15:37:54 +02:00
Tokita, Hiroshi 1c2b236c86 Translated using Weblate (Japanese)
Currently translated at 99.9% (8007 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/ja/
2023-06-18 15:37:54 +02:00
Toni Laiho 6ca66a04da Translated using Weblate (Finnish)
Currently translated at 99.8% (8002 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/fi/
2023-06-18 15:37:54 +02:00
Karl SCHUH 2595be63a1 Translated using Weblate (German)
Currently translated at 99.6% (7984 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/de/
2023-06-18 15:37:54 +02:00
Hubert Hu c31b36975d Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-06-18 15:37:54 +02:00
Hubert Hu 73a2fcd301 Translated using Weblate (Chinese (Simplified))
Currently translated at 99.9% (8012 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/zh_Hans/
2023-06-18 15:37:54 +02:00
Wellington Terumi Uemura 00b0a7c811 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (8014 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/pt_BR/
2023-06-18 15:37:53 +02:00
Jan Straka 2ef93cad44 Translated using Weblate (Czech)
Currently translated at 91.1% (7306 of 8014 strings)

Translation: KiCad EDA/v7
Translate-URL: https://hosted.weblate.org/projects/kicad/v7/cs/
2023-06-18 15:37:53 +02:00
Seth Hillbrand d3aa304556 Fix MSW and OSX kiplatform io libs
Takes fixes from master branch.  Includes ff072feeb4
2023-06-18 15:35:21 +02:00
Wayne Stambaugh 228927b4e9 Tag stable release candidate 7.0.6-rc1. 2023-06-17 19:33:44 -04:00
Seth Hillbrand 6fc393c7db Upgrade file locking
wxSingleInstanceChecker is meant for running programs, not file locking.
This implements an RAII class for file locking that stores the lock
files next to the file being locked, allowing it to be easily found and
removed.  Also includes the ability to override the lock, with
information about the original owner

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

(cherry picked from commit 122be418bb)
2023-06-18 01:06:40 +02:00
Seth Hillbrand 361fdcce1b Maintain file permissions when renaming
Temporary and autosave files do not neccessarily have the correct
permissions set to replace existing project files.  This updates the
permissions to match the existing values where possible

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

(cherry picked from commit 48ecd742eb)
2023-06-18 01:06:14 +02:00
Jeff Young 12cf696097 Tab-order fix provided by aris-kimi.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9406
2023-06-17 18:34:52 +01:00
Jeff Young e7ae6cd190 Recompute intersheet refs while printing.
Also fixes a bug where the schematic offset wasn't being added to
intersheet refs when printing.

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

(cherry picked from commit e3eb0abc5f)
2023-06-17 18:12:44 +01:00
Jeff Young 61dfe4ef07 Don't leave selection lying around when swapping out footprints.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14971

(cherry picked from commit da558f57d4)
2023-06-17 17:30:24 +01:00
Jeff Young d3099ecf75 Don't create 22.5-degree gateways if we're not cardinal or diagonal.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14984
2023-06-17 16:05:07 +01:00
Jeff Young c183e3f342 Cleanup. 2023-06-17 16:04:56 +01:00
Alex Shvartzkop a5ded3341a Adapt panels to PAGED_DIALOG sizing algorithm.
Also some cosmetic fixes (GTK).

(cherry picked from commit d3be62f644)
2023-06-17 15:19:26 +03:00
Alex Shvartzkop bb15c56a2d PAGED_DIALOG: make sure the dialog is big enough to contain page.
(cherry picked from commit 6ace80700e)
2023-06-17 15:19:26 +03:00
Alex Shvartzkop c61931996a PAGED_DIALOG: allow setting initial size in ctor.
(cherry picked from commit f5da58e17d)
2023-06-17 15:19:26 +03:00
Alex cb6c91be06 Center calculator grid cells, sync font styles with fbp.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14743

(cherry picked from commit d945b76c65)
2023-06-17 15:19:26 +03:00
Alex bfcdec47c1 Move bitmap setup to ctor in eeschema annotation options.
(cherry picked from commit 26c25c5475)
2023-06-17 15:19:25 +03:00
Jeff Young c0445ed857 Reset session drawing props after Board Setup.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14932

(cherry picked from commit 9ed2458f00)
2023-06-17 13:04:48 +01:00
Wayne Stambaugh 4e79d1ecdd Command line PCB gerber export fix and improvement.
The --board-plot-params argument was never parsed so it was always ignored.

[ADDED] A '--no-protel-ext' option to allow plotting gerbers with the KiCad
        file extension (gbr) instead of the Protel gerber file extensions.
2023-06-16 07:14:37 -04:00
jean-pierre charras 4306af3ef3 Plot Solder mask layer: do not add items on edge_cut, but not on mask layer
it happened only when creating a solder mask plot with a minimum thickness.
This was a legacy option, incorrect now.
Fixes #14960
https://gitlab.com/kicad/code/kicad/-/issues/14960
2023-06-16 10:01:29 +02:00
Jeff Young a01f9f99f4 More protection around an exceedingly dangerous hack.
The API is needed for wxFormBuilder, and I couldn't figure out any
way around it, but we can at least reduce the risk of someone calling
it accidentally (again).

(cherry picked from commit 46564055f4)
2023-06-14 13:57:27 +01:00
Alex Shvartzkop 08186f4131 Fix lock condition in GL_CONTEXT_MANAGER, remove unnecessary assert.
Assert handler is already being called from wxCHECK.


(cherry picked from commit dfb05c4f4b)
2023-06-14 04:46:06 +00:00
jean-pierre charras bdc9807dee Pcbnew: fix crash when selecting a footprint due to a not initialized pointer 2023-06-13 11:37:12 +02:00
Marco Ciampa d77180d9b5 Small fix in Italian translation 2023-06-12 14:32:55 +02:00
Jeff Young b0bcaa971e BoardDesignSettings are owned by FOOTPRINT_EDITOR_SETTINGS in the FP Editor.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14925
2023-06-12 10:08:09 +01:00
jean-pierre charras 4294202074 gr_basic.cpp: ensure a pen with width = 0 is transparent.
Setting its color to COLOR4D::UNSPECIFIED (i.e. opacity = 0) is not enough
for all  platforms (i.e. Windows)
From master branch
Fixes #14915
https://gitlab.com/kicad/code/kicad/-/issues/14915
2023-06-12 08:45:01 +02:00
Jeff Young 1e013274c2 Fix broken build. 2023-06-11 22:35:54 +01:00
Jeff Young 39c7024f12 Make sure infobar gets created earlier.
(restoreLastFootprint() might want it.)

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

(cherry picked from commit 3159391e28)
2023-06-11 22:32:05 +01:00
Jeff Young 375f3a7164 Remove double call to Destroy() for DISPLAY_FOOTPRINTS_FRAME.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14928

(cherry picked from commit bae8a077b9)
2023-06-11 22:31:27 +01:00
Jeff Young 370bdef8d0 Clear the playerFrame lookup cache when closing frames.
WindowIds aren't actually guaranteed to be unique, and we don't
perform a dynamic_cast on the result of FindWindowById() because
of linker issues....

This is an attempt to fix KICAD-39.

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

(cherry picked from commit d6aefc458c)
2023-06-11 22:31:24 +01:00
Jeff Young 7b1e75e6ed Don't accidentally add NULL ptrs to the LibSymbols cache.
Operator[] will add a blank element if it isn't found in the map.

Probably Sentry KICAD-23Y.

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

(cherry picked from commit 96073402ce)
2023-06-11 22:31:18 +01:00
Jeff Young 5c1a089981 Re-create missing exclusion markers if DRC was cancelled.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14919

(cherry picked from commit 93789e75b9)
2023-06-11 22:31:13 +01:00
Jeff Young cfb59094fe Make sure infobar gets created earlier.
restoreLastFootprint() might want it.

(cherry picked from commit 4fc6047f91)
2023-06-11 22:30:43 +01:00
Jeff Young 7d30a2bc54 Make FOOTPRINT_PREVIEW_PANEL a FPHOLDER.
Also makes sure it get its user_units set up.

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

(cherry picked from commit d18b0c62f6)
2023-06-11 22:30:16 +01:00
Jeff Young 472879e95a Check for proxy references and values in Selectable().
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14911

(cherry picked from commit 111d0a2c14)
2023-06-11 22:07:26 +01:00
CraftedNightmare 7027d02f94 Fix Search pane not remembering docking sizes and positions
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14120


(cherry picked from commit d94e9b31b1)
2023-06-11 20:24:41 +00:00
Salvador E. Tropea 561441b48a Adds the missing plot formats to kicad-cli sch export 2023-06-11 13:56:24 -04:00
Jon Evans fe5c7a60ab Net Inspector: clear sort ordering during rebuild
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14697


(cherry picked from commit 3a2cc8f56f)
2023-06-11 17:16:57 +00:00
Alex Shvartzkop 1a3dc72af8 Avoid deadlock when OpenGL context can't be created.
Previously, with aContext == nullptr, the mutex would lock, but not unlock.
Then it got deadlocked inside OPENGL_GAL dtor.

(cherry picked from commit eaf65f7d53)
2023-06-11 20:12:22 +03:00
Nils VAN ZUIJLEN c919694f37 cli: add an option to the pcb exports for plotting negative svg and pdf
ADDED: The -n or --negative option for exporting negative svg or pdf plots
from kicad-cli. Example usage: kicad-cli pcb export svg -n -l B.Cu board.kicad_pcb
2023-06-10 14:50:27 -04:00
Jeff Young 6fbdf8f0e2 Handle Altium dimension angles and non-unit suffixes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13751

(cherry picked from commit 97cf7c874e)
2023-06-10 10:57:14 +01:00
Jeff Young 4060ec3038 Treat canvas item as current when tree view contains no selection.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12702

(cherry picked from commit 1528f4700c)
2023-06-10 10:57:14 +01:00
Jeff Young 32626970a0 Prevent Sentry KICAD-MM crash.
It'd be nicer to know what happens, but we don't have a reproducible
case, so this "fix" will at least prevent that particular crash.

(cherry picked from commit 0091b9f897)
2023-06-10 10:57:14 +01:00
Jeff Young bc0a53a226 Increased mutex safety.
Don't even query the size() without having at least a shared_lock.

*May* prevent KICAD-4S, but seems unlikely.

(cherry picked from commit f3d3ade1dc)
2023-06-10 10:57:14 +01:00
Jeff Young b6a044111b Exclude redraws during closing (particularly of RATSNEST_VIEW_ITEM).
(cherry picked from commit 7a3a8b67c1)
2023-06-10 10:57:14 +01:00
Jeff Young 3c4286c98b Force re-word-wrapping of PCM package descriptions on Mac.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13328

(cherry picked from commit c7730eae3f)
2023-06-10 10:57:14 +01:00
Jeff Young 6d996e31b8 Don't dim SCH_FIELDs when selecting them.
(They were only getting drawn on top of the selection shadow when
drawn by their parent symbol because LIB_FIELD was correctly
setting the view layers but SCH_FIELD was not.)

(cherry picked from commit 2300b0d2a3)
2023-06-10 10:57:14 +01:00
Jeff Young ec4faad589 Don't allow setting a pad width or height of 0.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14278

(cherry picked from commit ddd2cb005b)
2023-06-10 10:57:14 +01:00
Alex 13820bc002 Support --mirror option in "kicad-cli pcb export pdf"
(cherry picked from commit 2450435131)
2023-06-10 04:58:07 +03:00
Alex 6ad9f25e7d Enable support for KICAD_SANITIZE_ADDRESS CMake flag on MSVC.
(cherry picked from commit d5edde799c)
2023-06-09 23:10:44 +00:00
Jeff Young a348fde7d1 Assertion checking for hole/parent ownership mismatch.
(This mismatch is the root of the problem in issue #14852.)
2023-06-10 01:05:00 +02:00
Tomasz Włostowski d25017dd5b router: can't add a clone of a VIA's hole when adding the via to INDEX - this will result in bogus colliding objects
This commit partially reverts deb3cbf8. VIA and SOLID operator='s introduced in it do a good job but the cloning of holes in addHole() causes bogus collisions.
2023-06-10 01:04:49 +02:00
Jeff Young 9b965f367a Prevent use-after-free crashes by not fighting over who owns a HOLE.
The diff-pair placer creates DIFF_PAIRs on the stack, which have
VIAs in them, which have HOLEs in them.  The HOLEs get put in the
NODE's index, and we then crash later when doing a collision after
the stack variable has gone out of scope.

The stack variable is also copied while doing a search for "best",
and without the operator= definitions the "best" and the "original"
both think they own the HOLE.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14852
2023-06-10 01:04:37 +02:00
Tomasz Wlostowski adca34ac6a router: invalidate items freed by PNS::NODE in the clearance cache
This was causing intermittent shove hiccups/freezes as RULE_RESOLVER::GetClearance() could return a bogus clearance value, taking
a cached value for an item that does not exist anymore. If the allocator/stack accidentally reclaimed such item's address - we were getting
very nasty and difficult to reproduce misbehaviours of the shove algorithm. Hopefully this patch fixes this. More info in the comments.

Note to self - I'm still not fully convinced I want PNS::ITEM pointers as the cache key, probably a unique counter would be better here.
2023-06-10 01:04:25 +02:00
Tomasz Wlostowski 51a4a92ec4 router: fix use-after-free crash in drag walkaround mode 2023-06-10 01:04:13 +02:00
Tomasz Wlostowski ae8ea3b938 router: correctly assign owner via/pad to its hole when committing the world state
fixes #14852
2023-06-10 00:27:38 +02:00
jean-pierre charras b57d77dd0b kicad-cli, STEP export: fix incorrect unit when user origin is specifed.
They are specified in mm (or inches), but must be stored in board units in code.
From master branch
2023-06-09 13:43:12 +02:00
Seth Hillbrand d5cbb56160 Fix builds for non-MSW 2023-06-07 08:26:27 -07:00
Seth Hillbrand e97c2a6864 Update Clipper2 to 9d946d7
Fixed a number of smaller issues as well as overlapping segment
cleaning.

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

(cherry picked from commit fe62a3f985)
2023-06-07 08:22:47 -07:00
Marek Roszko 41447e9b44 Experiment with sentry breadcrumbs to footnote kiway events to provide more crash context
(cherry picked from commit 5b5176f104)
2023-06-07 11:02:23 +00:00
David Holdeman 7aa368c2c5 use same flag, fix inversion 2023-06-06 18:20:24 +00:00
David Holdeman 6a00eaa4a3 naively add option 2023-06-06 18:20:24 +00:00
Jeff Young 9240566167 Support shape collisions between SHAPE_POLY_SET and other shapes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14890

(cherry picked from commit 0f8c5a96b2)
2023-06-06 13:41:37 +01:00
Jeff Young 9eaa5f90e0 Replace larger text bboxes now that we're not using them for knockouts.
(cherry picked from commit 570978fa7f)
2023-06-06 11:19:41 +01:00
Jeff Young 214f785c97 Use rendered text to generate bounding box for knockout text.
Don't open-code knockout text shape generation in several different
places.

Make sure triangulated knockout text gets clearance added when
specified.

Collapse duplicated footprint text item plot routine (they're no
longer any different from plotting pcb text items).

(cherry picked from commit c71cf21e2f)
2023-06-06 11:19:41 +01:00
Jeff Young ae0534cbb4 Account for changes to mimic 6.0 text positioning in bounding boxes.
This is only a partial fix as knockout text is still busted....

(cherry picked from commit dacf0b2b96)
2023-06-06 11:19:41 +01:00
Jeff Young f3c5c458c6 Formatting.
(cherry picked from commit 6b0bff2f4f)
2023-06-06 11:19:41 +01:00
Marek Roszko d6fd5598ab Use the correct printf format for the move individually status text
Fixes sentry KICAD-1ZT


(cherry picked from commit b41606ecf7)
2023-06-05 13:55:52 +00:00
Mike Williams c41b334f0a LibTree: add numpad enter as enter
Written by Andrej Valek
2023-06-05 09:22:04 -04:00
Mike Williams c3a6bf3d40 UI: Add Numpad Enter as "Return" equivalent in missing places
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/14244
2023-06-05 08:58:50 -04:00
Jeff Young cb7aa5143b Correctly handle hidden columns when pasting into grids.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14844

(cherry picked from commit f9fd37c4ca)
2023-06-04 21:24:35 +01:00
Jeff Young 8942abfc64 Handle through-hole via walls along with pads.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14757

(cherry picked from commit cb7f314f4b)
2023-06-04 21:22:37 +01:00
Jeff Young e5ef973d52 Trim solder paste (and other layers) to holes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8484

(cherry picked from commit b53bc1ae38)
2023-06-04 21:22:31 +01:00
Jeff Young 0bd45f691e Make sure 3D file browser is treated as modal by quit.
(Otherwise we crash when freeing it during the quit.)

(cherry picked from commit c36b0fcda7)
2023-06-04 21:22:19 +01:00
Jeff Young 117c70ed7d Don't double-up FUTURE_FORMAT_ERROR problem strings.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14780

(cherry picked from commit e82e4af483)
2023-06-04 21:21:18 +01:00
Jeff Young d09f88d53b Every time I search for SCH_TEXT* it doesn't work....
(cherry picked from commit b8986709bf)
2023-06-04 21:15:36 +01:00
Jeff Young 06f17d9415 Don't call OnPageSettingsChanges on Undo/Redo.
It's incredibly expensive (multiple seconds on a document with
lots of text in an outline font).

(cherry picked from commit 81d7428fd2)
2023-06-04 21:15:30 +01:00
Jeff Young c1d8e979f3 Spread the error-bar move evenly around justified text.
(cherry picked from commit 3ab9175553)
2023-06-04 21:15:22 +01:00
Jeff Young 16f286735d Cache LIB_PIN text extents for performance.
Also fixes a bug where we didn't triangulate at all when the char
count didn't warrant the likely overhead of spinning up a
thread_pool.

And fix another bug where EDA_TEXT::GetRenderCache() wasn't using
the given font.

Also reverts using the cache for drawing-sheet text.  The text
items are created from scratch from the data items each time
they're drawn, so there's never an existing cache to make use of.
Instead, we now check that the item is in the view, using a very
approximate bounding box generator (because even generating a
real bounding box shows up large in profiles).

And, lastly, fixes a bug where EndPos was never considered in
DS_DATA_ITEM::IsInsidePage().

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

(cherry picked from commit f35a88ce0b)
2023-06-04 21:11:06 +01:00
Jeff Young 45c7490180 Outline font performance improvements.
1) Don't fracture font glyphs when generating them; we're going
   to fracture during triangulation anyway.
2) Don't check for self-intersection when deciding to fracture.
   It costs nearly as much as the fracture does.
3) Cache drawing sheet text.
4) Use the current font when checking for cache validity.
5) Parallelize glyph triangulation.
6) Don't invalidate bounding box caches when offset by {0,0}
7) Use the glyph cache when generating text effective shape.
8) Short-circuit NormalizeJustification() if its center/center.
9) Don't triangulate for GuessSelectionCandidates()
10) Avoid sqrt whenever possible.
11) Pre-allocate bezier and SHAPE_LINE_CHAIN buffers.

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

(cherry picked from commit 4ed267394a)
2023-06-04 20:57:14 +01:00
Jeff Young 1566b357cb Improve appearance of stroked knockout text.
(cherry picked from commit ff37ebe61a)
2023-06-04 20:56:05 +01:00
Seth Hillbrand 7d9222926a Connectivity: Correct alias-based bus resolution
Aliases in bus resolution were being resolved without a path, making
them effectively global nets.  This applies the corrected path to the
bus members and adds a QA to catch this error
2023-06-02 14:25:26 -07:00
Alex b957d5176e Fix view shifting when infobar is shown.
(cherry picked from commit df4fefeb20)
2023-06-02 18:07:48 +03:00
Jeff Young e76a520c19 Bug fixes for handling boolean flags in DRC rules.
(cherry picked from commit cb53a18ee3)
2023-06-02 00:20:11 +01:00
Jeff Young f0d205fed9 Don't use GetValueFieldText from within text var resolution.
(It resets the recursion checker.)

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

(cherry picked from commit 5114d3b8c3)
2023-06-02 00:17:35 +01:00
Marek Roszko 42811d0602 Fix blank symbol svg export file names
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14857


(cherry picked from commit c2d56eefb9)
2023-06-01 00:56:40 +00:00
jean-pierre charras b54c03f89e Cvpcb: the footprint viewer use the settings of pcbnew, and the code in _pcbnew.dll/so
So ensure they are loaded before creating the footprint viewer.
Fixes #14850
https://gitlab.com/kicad/code/kicad/-/issues/14850
2023-05-30 20:11:15 +02:00
jean-pierre charras 5596790a6e Symbol editor: ensure a new derived symbol has the correct DeMorgan option displayed.
Derived symbols use the same graphics as their parent, so ensure the parent is
used to enable/disable the DeMorgan option and tool in toolbar
Fixes #13739
https://gitlab.com/kicad/code/kicad/-/issues/13739
2023-05-29 20:41:35 +02:00
jean-pierre charras e55263be00 Pcbnew: fix crash when trying to save a board with a text with overbar and
using a non Kicad font
PCB_PLUGIN::formatRenderCache() was considering all shapes in cache are polygons,
but this is not true: some items can be stroke shapes.
From stable branch
Fixes #14804
https://gitlab.com/kicad/code/kicad/-/issues/14804
2023-05-29 20:41:35 +02:00
Wayne Stambaugh 441c2b50b9 Fix potential stale pointer bug in schematic highlight connection code.
SCH_CONNECTION objects are temporary and can become stale any time the
connectivity is updated.  Keeping them around to reference later is a
bad idea.  Even if the object pointer is still valid in an SCH_ITEM in
the undo/redo buffers, comparing the pointer against another pointer as
a test to see if they are the same connection is not valid.  Saving the
connection name is safe and ensures the connection is the same even if
the pointers differ.

(cherry picked from commit 831a6d55fc)
2023-05-29 13:55:07 -04:00
jean-pierre charras 0a3f5b65bf Fix last changes in io.cpp for msys2.
- use the same code for msys2 and msvc
- add an option to use a fallback for msys2 if the common code does not compile
2023-05-29 13:38:52 -04:00
Marek Roszko 93c29ad15e Add a sequential read flagged fopen helper
Trying to squeeze out some kind of gain by informing the OS we will read a file sequentially.
In particular our FILE_LINE_READER just uses fgetc until the end
2023-05-29 13:36:06 -04:00
Marek Roszko 8f565ef7f0 Replace the exception handler in another spot 2023-05-28 22:31:29 -04:00
Marek Roszko d97de297af Move 3 more blocks to the common ex handler 2023-05-28 22:31:18 -04:00
Marek Roszko 18ac4c2288 Handle OnKifaceStart exceptions without crashing 2023-05-28 22:30:07 -04:00
Marek Roszko 0c6eb6dec3 Create a central exception handler we can also use to generate sentry events
(cherry picked from commit c5d5450f55)
2023-05-29 02:27:21 +00:00
Jeff Young 4a274709e7 Go back to using QuasiModal for TextBox Properties.
Also removes auto-closing of blocking dialogs when inserting
symbols from the Symbol Editor or Chooser, preventing the bug
that QuasiModel was removed for earlier.

Also fixes a non-initialized parent pointer when the TextBox
Properties dialog was called from DrawShape().

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

(cherry picked from commit 5a9ed66cfd)
2023-05-28 19:19:50 +01:00
Jeff Young c6e4f18d99 Hook up text variable auto-complete for PCBNew.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14777

(cherry picked from commit 14f004d2a5)
2023-05-28 18:46:39 +01:00
Wayne Stambaugh 0e5155ae2f Fix clipped combobox entry in board editor text box dialog.
The layer combobox color swatch was clipped when the combobox was
closed when the dialog was launched.  Setting the minimum width
resolved the issue.  This may have been a GTK only issue.

(cherry picked from commit a13a49f45a)
2023-05-28 18:43:32 +01:00
Jeff Young aa78abc649 Manual reimplementation of 84c72b087c
(cherry picked from commit 7cc55d2d3a)
2023-05-28 19:38:27 +02:00
Jeff Young 1c62fc868d Fix more SPICE case-insensitivity bugs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14793

(cherry picked from commit 03486443c7)
(cherry picked from commit e5d5335701)
2023-05-28 19:38:27 +02:00
Mark Visser f9c2f03a44 fix bug whereby spice params with capital letters no longer cause an error and data loss
Spice parameters were converted to lower-case before comparison. This is incorrect, as it
is legal and common for spice parameters to contain capital letters (e.g. potentiometers
typically use Rt and SET as their parameters).
Spice parameters are not case sensitive, so the correct behaviour is to instead do a
case-insensitive comparison on the parameter name.

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

(cherry picked from commit 0d235ac64b)
(cherry picked from commit 888a35bbde)
2023-05-28 19:38:27 +02:00
Jeff Young dfd11b7596 Reconcile PNS router with DRC.
Hole-to-hole is only for drilled holes.
NPTH slots also get EDGE_CLEARANCE applied.

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

(cherry picked from commit df763eaf88)
(cherry picked from commit ad9109cad4)
2023-05-28 19:38:27 +02:00
Jeff Young 98796f6250 Reset button applies to resolved page, not lazy page holder.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14786

(cherry picked from commit 1057483983)
(cherry picked from commit 232d0e8b6b)
2023-05-28 19:38:27 +02:00
Jeff Young b728251bcc STL is your friend... until it's not.
Operator[] was creating an empty entry in the connectivity map,
fooling us into thinking the item had already been added.

Worryingly, this bug has been in there since 2017; a recent
change in teardrops just happened to expose it.

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

(cherry picked from commit 7e51077992)
(cherry picked from commit 0d94532df9)
2023-05-28 19:38:27 +02:00
Jeff Young d894faaeaa Pin preferences dialog size.
While unfortunate (we generally frown on having fixed sizes in
favour of having everything auto-layout), in this case it's a
cost of lazy-loading the panels.

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

(cherry picked from commit cbf83c4161)
(cherry picked from commit 799302cd6d)
2023-05-28 19:38:27 +02:00
Jeff Young 8b114c81c5 Fix issue with colours in the new lazy-loaded preference panels.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14784

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

(cherry picked from commit d4c9d9d60a)
(cherry picked from commit c33b3fd314)
2023-05-28 19:38:27 +02:00
Jeff Young 97ffb60f23 Don't consider shorted items when opitmizing ratsnest.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14715

(cherry picked from commit 80aef37cc4)
(cherry picked from commit dc50b7b065)
2023-05-28 19:38:27 +02:00
Jeff Young 41b7182661 Lazy loading of stackup UI widgets.
(cherry picked from commit 9481a218c7)
(cherry picked from commit 00a82905ec)
2023-05-28 19:38:27 +02:00
Jeff Young 19e5a231a7 Don't run onPageChanged() event handler during initialization.
(cherry picked from commit 3f44c811c7)
(cherry picked from commit f35ed59868)
2023-05-28 19:38:27 +02:00
Jeff Young 01fcb2276b Move remainder of Board Setup to lazy loading.
(cherry picked from commit 03c9b1c202)
(cherry picked from commit 3cd87c2a44)
2023-05-28 19:38:27 +02:00
Jeff Young 19b4e98ee7 Lazy loading of Schematic Setup panels.
(cherry picked from commit ddc6ecf7be)
(cherry picked from commit 6cbc10db81)
2023-05-28 19:38:27 +02:00
Jeff Young 77c76bbc8a Insta-prefs.
(cherry picked from commit 9ae8255202)
(cherry picked from commit 4c28070449)
2023-05-28 19:38:27 +02:00
Jeff Young 00bb1636da Don't store sizes in panels. Let them auto-lay-out.
(cherry picked from commit 6bf43588bb)
(cherry picked from commit bf4f6cff3c)
2023-05-28 19:38:27 +02:00
jean-pierre charras 50ec496c54 Step exporter: export circular board outlines as cylinder
From master branch, commit 66651327.

(cherry picked from commit 5db9a6af9d)
2023-05-28 19:38:27 +02:00
jean-pierre charras 2b8ad1b65c Eeschema: fix block mirroring of fields attached to labels (all types)
Fix incorrect orientation of the graphic shape of SCH_DIRECTIVE_LABEL items
after mirroring the item.
Similar to commit 898d88cc, but for block mirroring.
Fixes #14758
https://gitlab.com/kicad/code/kicad/-/issues/14758

(cherry picked from commit b968bac318)
2023-05-28 19:38:27 +02:00
Wayne Stambaugh 5c5f077a4a Begin version 7.0.6 development. 2023-05-26 08:36:00 -04:00
Wayne Stambaugh b05f6f1614 Tag release version 7.0.5. 2023-05-26 08:35:08 -04:00
Tomasz Wlostowski 0180cb380f router: prevent pushout/bogus collision of via with is own hole (or copper) when dragging
The root cause was not removing the original (pre-dragging) via from the world, comparing the ITEM::Parent() pointers of the items was only hiding the main issue.
This also fixes the PNSViaCollisions test in the qa/ suite.
2023-05-24 19:47:20 -07:00
Jeff Young 882e48b457 Don't allow collisions with self.
The previous test didn't handle is-self-tests between a hole and
its override in a different NODE.  When calculating the pushout
force we don't remove the via (and its hole) from the current
node until after the calculation, so we end up checking for
collisions between the new (cloned) via's hole and the original
hole in the root node.

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

(cherry picked from commit b442d769fd)
2023-05-24 08:54:27 -07:00
Seth Hillbrand fa56b17c88 Revert "Fix clipped combobox entry in board editor text box dialog."
This reverts commit 7ea907c343.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 6b1c2da867 Revert "Eeschema: fix block mirroring of fields attached to labels (all types)"
This reverts commit b968bac318.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 84eacd13a1 Revert "Step exporter: export circular board outlines as cylinder"
This reverts commit 5db9a6af9d.
2023-05-24 08:54:16 -07:00
Seth Hillbrand b6bd1a9373 Revert "Don't store sizes in panels. Let them auto-lay-out."
This reverts commit bf4f6cff3c.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 7e39411910 Revert "Insta-prefs."
This reverts commit 4c28070449.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 2f3659e7ac Revert "Lazy loading of Schematic Setup panels."
This reverts commit 6cbc10db81.
2023-05-24 08:54:16 -07:00
Seth Hillbrand c0567aa011 Revert "Move remainder of Board Setup to lazy loading."
This reverts commit 3cd87c2a44.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 9b310ab955 Revert "Don't run onPageChanged() event handler during initialization."
This reverts commit f35ed59868.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 5226855158 Revert "Lazy loading of stackup UI widgets."
This reverts commit 00a82905ec.
2023-05-24 08:54:16 -07:00
Seth Hillbrand ee19354484 Revert "Don't consider shorted items when opitmizing ratsnest."
This reverts commit dc50b7b065.
2023-05-24 08:54:16 -07:00
Seth Hillbrand e967020ebe Revert "Fix issue with colours in the new lazy-loaded preference panels."
This reverts commit c33b3fd314.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 7b0d45402a Revert "Pin preferences dialog size."
This reverts commit 799302cd6d.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 714250d9f6 Revert "STL is your friend... until it's not."
This reverts commit 0d94532df9.
2023-05-24 08:54:16 -07:00
Seth Hillbrand b4e3ce1166 Revert "Reset button applies to resolved page, not lazy page holder."
This reverts commit 232d0e8b6b.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 1958cafbdf Revert "Reconcile PNS router with DRC."
This reverts commit ad9109cad4.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 248de56fb0 Revert "fix bug whereby spice params with capital letters no longer cause an error and data loss"
This reverts commit 888a35bbde.
2023-05-24 08:54:16 -07:00
Seth Hillbrand 89349c1084 Revert "Fix more SPICE case-insensitivity bugs."
This reverts commit e5d5335701.
2023-05-24 08:54:16 -07:00
Seth Hillbrand e2c0c6362f Revert "Manual reimplementation of 84c72b087c548829908d7fbbecfd2fa5968cc98b"
This reverts commit 7cc55d2d3a.
2023-05-24 08:54:16 -07:00
Jeff Young 7cc55d2d3a Manual reimplementation of 84c72b087c 2023-05-23 09:40:32 +01:00
Jeff Young e5d5335701 Fix more SPICE case-insensitivity bugs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14793

(cherry picked from commit 03486443c7)
2023-05-23 09:40:32 +01:00
Mark Visser 888a35bbde fix bug whereby spice params with capital letters no longer cause an error and data loss
Spice parameters were converted to lower-case before comparison. This is incorrect, as it
is legal and common for spice parameters to contain capital letters (e.g. potentiometers
typically use Rt and SET as their parameters).
Spice parameters are not case sensitive, so the correct behaviour is to instead do a
case-insensitive comparison on the parameter name.

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

(cherry picked from commit 0d235ac64b)
2023-05-23 09:40:32 +01:00
Jeff Young ad9109cad4 Reconcile PNS router with DRC.
Hole-to-hole is only for drilled holes.
NPTH slots also get EDGE_CLEARANCE applied.

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

(cherry picked from commit df763eaf88)
2023-05-23 09:40:32 +01:00
Jeff Young 232d0e8b6b Reset button applies to resolved page, not lazy page holder.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14786

(cherry picked from commit 1057483983)
2023-05-23 09:40:32 +01:00
Jeff Young 0d94532df9 STL is your friend... until it's not.
Operator[] was creating an empty entry in the connectivity map,
fooling us into thinking the item had already been added.

Worryingly, this bug has been in there since 2017; a recent
change in teardrops just happened to expose it.

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

(cherry picked from commit 7e51077992)
2023-05-23 09:40:32 +01:00
Jeff Young 799302cd6d Pin preferences dialog size.
While unfortunate (we generally frown on having fixed sizes in
favour of having everything auto-layout), in this case it's a
cost of lazy-loading the panels.

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

(cherry picked from commit cbf83c4161)
2023-05-23 09:40:32 +01:00
Jeff Young c33b3fd314 Fix issue with colours in the new lazy-loaded preference panels.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14784

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

(cherry picked from commit d4c9d9d60a)
2023-05-23 09:40:32 +01:00
Jeff Young dc50b7b065 Don't consider shorted items when opitmizing ratsnest.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14715

(cherry picked from commit 80aef37cc4)
2023-05-23 09:40:32 +01:00
Jeff Young 00a82905ec Lazy loading of stackup UI widgets.
(cherry picked from commit 9481a218c7)
2023-05-23 09:40:32 +01:00
Jeff Young f35ed59868 Don't run onPageChanged() event handler during initialization.
(cherry picked from commit 3f44c811c7)
2023-05-23 09:40:32 +01:00
Jeff Young 3cd87c2a44 Move remainder of Board Setup to lazy loading.
(cherry picked from commit 03c9b1c202)
2023-05-23 09:40:32 +01:00
Jeff Young 6cbc10db81 Lazy loading of Schematic Setup panels.
(cherry picked from commit ddc6ecf7be)
2023-05-23 09:40:32 +01:00
Jeff Young 4c28070449 Insta-prefs.
(cherry picked from commit 9ae8255202)
2023-05-23 09:40:32 +01:00
Jeff Young bf4f6cff3c Don't store sizes in panels. Let them auto-lay-out.
(cherry picked from commit 6bf43588bb)
2023-05-23 09:40:32 +01:00
jean-pierre charras 5db9a6af9d Step exporter: export circular board outlines as cylinder
From master branch, commit 66651327.
2023-05-23 10:25:58 +02:00
jean-pierre charras b968bac318 Eeschema: fix block mirroring of fields attached to labels (all types)
Fix incorrect orientation of the graphic shape of SCH_DIRECTIVE_LABEL items
after mirroring the item.
Similar to commit 898d88cc, but for block mirroring.
Fixes #14758
https://gitlab.com/kicad/code/kicad/-/issues/14758
2023-05-23 09:47:29 +02:00
Wayne Stambaugh 7ea907c343 Fix clipped combobox entry in board editor text box dialog.
The layer combobox color swatch was clipped when the combobox was
closed when the dialog was launched.  Setting the minimum width
resolved the issue.  This may have been a GTK only issue.

(cherry picked from commit a13a49f45a)
2023-05-22 12:06:13 -04:00
Jon Evans b71d66de94 Specctra: remove grouped tracks from group before cleaning up
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14763


(cherry picked from commit 27afd22bbf)
2023-05-22 14:58:56 +00:00
Wayne Stambaugh 06043b4a14 Begin version 7.0.5 development. 2023-05-21 16:36:43 -04:00
346 changed files with 42533 additions and 37188 deletions
-5
View File
@@ -657,11 +657,6 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
}
extern bool BuildFootprintPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines,
int aErrorMax, int aChainingEpsilon,
OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr );
bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
{
m_board_poly.RemoveAllContours();
+1 -1
View File
@@ -348,7 +348,7 @@ private:
PCB_LAYER_ID aLayerId );
void addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aDstContainer,
const BOARD_ITEM* aOwner );
const BOARD_ITEM* aItem );
void addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM* aOwner );
@@ -64,7 +64,7 @@
void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM* aOwner )
const BOARD_ITEM* aItem )
{
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
@@ -74,34 +74,25 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
if( !font )
font = KIFONT::FONT::GetFont( wxEmptyString, aText->IsBold(), aText->IsItalic() );
if( aOwner && aOwner->IsKnockout() )
if( aItem && aItem->IsKnockout() )
{
SHAPE_POLY_SET knockouts;
CALLBACK_GAL callback_gal( empty_opts,
// Polygon callback
[&]( const SHAPE_LINE_CHAIN& aPoly )
{
knockouts.AddOutline( aPoly );
} );
attrs.m_StrokeWidth = aText->GetEffectiveTextPenWidth();
attrs.m_Angle = aText->GetDrawRotation();
callback_gal.SetIsFill( font->IsOutline() );
callback_gal.SetIsStroke( font->IsStroke() );
callback_gal.SetLineWidth( attrs.m_StrokeWidth );
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs );
int maxError = m_board->GetDesignSettings().m_MaxError;
SHAPE_POLY_SET finalPoly;
int margin = attrs.m_StrokeWidth * 1.5 +
GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
aText->TransformBoundingBoxToPolygon( &finalPoly, margin );
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
if( aItem->Type() == PCB_FP_TEXT_T )
{
static_cast<const FP_TEXT*>( aItem )->TransformTextToPolySet( finalPoly, 0, maxError,
ERROR_INSIDE );
}
else if( aItem->Type() == PCB_TEXT_T )
{
static_cast<const PCB_TEXT*>( aItem )->TransformTextToPolySet( finalPoly, 0, maxError,
ERROR_INSIDE );
}
ConvertPolygonToTriangles( finalPoly, *aContainer, m_biuTo3Dunits, *aOwner );
// Do not call finalPoly.Fracture() here: ConvertPolygonToTriangles() call it
// if needed, and Fracture() called twice can create bad results and is useless
ConvertPolygonToTriangles( finalPoly, *aContainer, m_biuTo3Dunits, *aItem );
}
else
{
@@ -120,19 +111,19 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
{
// Cannot add segments that have the same start and end point
aContainer->Add( new FILLED_CIRCLE_2D( pt1_3DU, penWidth_3DU / 2,
*aOwner ) );
*aItem ) );
}
else
{
aContainer->Add( new ROUND_SEGMENT_2D( pt1_3DU, pt2_3DU, penWidth_3DU,
*aOwner ) );
*aItem ) );
}
},
// Triangulation callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
{
aContainer->Add( new TRIANGLE_2D( TO_SFVEC2F( aPt1 ), TO_SFVEC2F( aPt2 ),
TO_SFVEC2F( aPt3 ), *aOwner ) );
TO_SFVEC2F( aPt3 ), *aItem ) );
} );
attrs.m_Angle = aText->GetDrawRotation();
+4 -4
View File
@@ -649,7 +649,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
text->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
text->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
break;
}
@@ -657,7 +657,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
textbox->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
break;
}
@@ -958,7 +958,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
text->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
text->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
break;
}
@@ -966,7 +966,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
textbox->TransformTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
break;
}
+28 -3
View File
@@ -27,6 +27,7 @@
#include <board.h>
#include <footprint.h>
#include "../../3d_math.h"
#include "convert_basic_shapes_to_polygon.h"
#include <trigo.h>
#include <project.h>
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
@@ -775,6 +776,9 @@ void RENDER_3D_OPENGL::generateViasAndPads()
{
const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
if( via->GetViaType() == VIATYPE::THROUGH )
continue; // handle with pad holes so castellation is taken into account
const float holediameter = via->GetDrillValue() * m_boardAdapter.BiuTo3dUnits();
const int nrSegments = m_boardAdapter.GetCircleSegmentCount( via->GetDrillValue() );
const float hole_inner_radius = holediameter / 2.0f;
@@ -804,14 +808,33 @@ void RENDER_3D_OPENGL::generateViasAndPads()
}
if( m_boardAdapter.GetHoleCount() > 0 )
if( m_boardAdapter.GetHoleCount() > 0 || m_boardAdapter.GetViaCount() > 0 )
{
SHAPE_POLY_SET tht_outer_holes_poly; // Stores the outer poly of the copper holes (the pad)
SHAPE_POLY_SET tht_inner_holes_poly; // Stores the inner poly of the copper holes (the hole)
SHAPE_POLY_SET tht_outer_holes_poly; // Stores the outer poly of the copper holes
SHAPE_POLY_SET tht_inner_holes_poly; // Stores the inner poly of the copper holes
tht_outer_holes_poly.RemoveAllContours();
tht_inner_holes_poly.RemoveAllContours();
// Insert through-via holes (vertical cylinders)
for( const PCB_TRACK* track : m_boardAdapter.GetBoard()->Tracks() )
{
if( track->Type() == PCB_VIA_T )
{
const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
if( via->GetViaType() == VIATYPE::THROUGH )
{
TransformCircleToPolygon( tht_outer_holes_poly, via->GetPosition(),
via->GetDrill() / 2 + platingThickness,
ARC_HIGH_DEF, ERROR_INSIDE );
TransformCircleToPolygon( tht_inner_holes_poly, via->GetPosition(),
via->GetDrill() / 2, ARC_HIGH_DEF, ERROR_INSIDE );
}
}
}
// Insert pads holes (vertical cylinders)
for( const FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
{
@@ -903,7 +926,9 @@ void RENDER_3D_OPENGL::Load3dModelsIfNeeded()
load3dModels( &activityReporter );
}
else
{
load3dModels( nullptr );
}
}
@@ -802,11 +802,14 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
{
setLayerMaterial( layer_id );
OPENGL_RENDER_LIST* throughHolesOuter =
m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus
&& m_boardAdapter.m_Cfg->m_Render.realistic
&& ( layer_id == B_SilkS || layer_id == F_SilkS ) ? m_outerThroughHoleRings
: m_outerThroughHoles;
OPENGL_RENDER_LIST* throughHolesOuter = m_outerThroughHoles;
if( m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus
&& m_boardAdapter.m_Cfg->m_Render.realistic
&& ( layer_id == B_SilkS || layer_id == F_SilkS ) )
{
throughHolesOuter = m_outerThroughHoleRings;
}
if( throughHolesOuter )
{
@@ -824,11 +827,20 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
- pLayerDispList->GetZBot() );
}
if( !skipRenderHoles
&& m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk
&& m_boardAdapter.m_Cfg->m_Render.realistic
&& ( ( layer_id == B_SilkS && m_layers.find( B_Mask ) != m_layers.end() )
|| ( layer_id == F_SilkS && m_layers.find( F_Mask ) != m_layers.end() ) ) )
if( skipRenderHoles )
{
// Do not render Paste layers when skipRenderHoles is enabled
// otherwise it will cause z-fight issues
if( layer_id != B_Paste && layer_id != F_Paste )
{
pLayerDispList->DrawAllCameraCulledSubtractLayer( drawMiddleSegments,
anti_board );
}
}
else if( m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk
&& m_boardAdapter.m_Cfg->m_Render.realistic
&& ( ( layer_id == B_SilkS && m_layers.find( B_Mask ) != m_layers.end() )
|| ( layer_id == F_SilkS && m_layers.find( F_Mask ) != m_layers.end() ) ) )
{
const PCB_LAYER_ID layerMask_id = (layer_id == B_SilkS) ? B_Mask : F_Mask;
@@ -838,25 +850,16 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
pLayerDispListMask,
throughHolesOuter, anti_board );
}
else if( throughHolesOuter )
{
pLayerDispList->DrawAllCameraCulledSubtractLayer( drawMiddleSegments, nullptr,
throughHolesOuter,
anti_board );
}
else
{
if( !skipRenderHoles && throughHolesOuter
&& ( layer_id == B_SilkS || layer_id == F_SilkS ) )
{
pLayerDispList->DrawAllCameraCulledSubtractLayer( drawMiddleSegments, nullptr,
throughHolesOuter,
anti_board );
}
else
{
// Do not render Paste layers when skipRenderHoles is enabled
// otherwise it will cause z-fight issues
if( !( skipRenderHoles && ( layer_id == B_Paste || layer_id == F_Paste ) ) )
{
pLayerDispList->DrawAllCameraCulledSubtractLayer( drawMiddleSegments,
anti_board );
}
}
pLayerDispList->DrawAllCameraCulledSubtractLayer( drawMiddleSegments,
anti_board );
}
}
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -26,7 +26,7 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
m_cbRaytracing_proceduralTextures = new wxCheckBox( this, wxID_ANY, _("Procedural textures (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRaytracing_proceduralTextures->SetValue(true);
gSizer1->Add( m_cbRaytracing_proceduralTextures, 0, wxALL, 5 );
gSizer1->Add( m_cbRaytracing_proceduralTextures, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbRaytracing_addFloor = new wxCheckBox( this, wxID_ANY, _("Add floor (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbRaytracing_addFloor->SetValue(true);
@@ -347,6 +347,7 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
}
PANEL_3D_RAYTRACING_OPTIONS_BASE::~PANEL_3D_RAYTRACING_OPTIONS_BASE()
@@ -45,7 +45,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_3D_RAYTRACING_OPTIONS_BASE</property>
<property name="pos"></property>
<property name="size">834,514</property>
<property name="size">-1,-1</property>
<property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
@@ -190,7 +190,7 @@
<property name="vgap">0</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -103,7 +103,7 @@ class PANEL_3D_RAYTRACING_OPTIONS_BASE : public RESETTABLE_PANEL
public:
PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 834,514 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_3D_RAYTRACING_OPTIONS_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_3D_RAYTRACING_OPTIONS_BASE();
+6
View File
@@ -483,6 +483,12 @@ if( MSVC )
string( APPEND CMAKE_CXX_FLAGS " /EHs" )
endif()
if( KICAD_SANITIZE_ADDRESS )
add_definitions( -DKICAD_SANITIZE_ADDRESS )
add_definitions( -D_DISABLE_VECTOR_ANNOTATION )
string( APPEND CMAKE_CXX_FLAGS " /fsanitize=address" )
endif()
foreach( type EXE SHARED MODULE)
# /DEBUG: create PDB
string( APPEND CMAKE_${type}_LINKER_FLAGS " /DEBUG /MANIFEST:NO" )
+1
View File
@@ -147,6 +147,7 @@ END_EVENT_TABLE()
BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
BM2CMP_FRAME_BASE( aParent )
{
m_ident = FRAME_BM2CMP; // Initialized to wxID_ANY by wxFormBuilder
SetKiway( this, aKiway );
for( wxString unit : { _( "mm" ), _( "Inch" ), _( "DPI" ) } )
+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.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
set(_PYTHON3_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
# Disabling the "search every possible place" code for now
# see https://gitlab.com/kicad/code/kicad/-/issues/8553
+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.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
set(_PYTHON3_VERSIONS 3.12 3.11 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
@@ -37,7 +37,7 @@
# KiCad.
#
# Note: This version string should follow the semantic versioning system
set( KICAD_SEMANTIC_VERSION "7.0.4" )
set( KICAD_SEMANTIC_VERSION "7.0.6" )
# Default the version to the semantic version.
# This is overridden by the git repository tag though (if using git)
+1 -1
View File
@@ -216,6 +216,7 @@ set( COMMON_WIDGET_SRCS
widgets/wx_panel.cpp
widgets/wx_progress_reporters.cpp
widgets/wx_splitter_window.cpp
widgets/wx_treebook.cpp
)
set( COMMON_DRAWING_SHEET_SRCS
@@ -352,7 +353,6 @@ set( COMMON_SRCS
lib_tree_model.cpp
lib_tree_model_adapter.cpp
locale_io.cpp
lockfile.cpp
lset.cpp
marker_base.cpp
markup_parser.cpp
+2 -1
View File
@@ -49,8 +49,9 @@ void CALLBACK_GAL::DrawGlyph( const KIFONT::GLYPH& aGlyph, int aNth, int aTotal
int strokeWidth = GetLineWidth();
SHAPE_POLY_SET poly;
// Use ERROR_INSIDE because it avoids Clipper and is therefore much faster.
TransformOvalToPolygon( poly, pointList[ ii - 1 ], pointList[ ii ],
strokeWidth, strokeWidth / 48, ERROR_OUTSIDE );
strokeWidth, strokeWidth / 180, ERROR_INSIDE );
m_outlineCallback( poly.Outline( 0 ) );
}
+2 -1
View File
@@ -595,7 +595,8 @@ void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
}
}
// shift-return (Mac default) or Ctrl-Return (GTK) for OK
else if( aEvt.GetKeyCode() == WXK_RETURN && ( aEvt.ShiftDown() || aEvt.ControlDown() ) )
else if( ( aEvt.GetKeyCode() == WXK_RETURN || aEvt.GetKeyCode() == WXK_NUMPAD_ENTER )
&& ( aEvt.ShiftDown() || aEvt.ControlDown() ) )
{
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
return;
+1 -2
View File
@@ -44,9 +44,8 @@
* Ugly as it all is, it does improve our usability on various platforms.
*/
PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aParent )
PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( wxWindow* aParent )
: PANEL_COMMON_SETTINGS_BASE( aParent ),
m_dialog( aDialog ),
m_iconScaleLabel( nullptr ),
m_iconScaleSlider( nullptr ),
m_iconScaleAuto( nullptr ),
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -415,6 +415,7 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
this->SetSizer( bPanelSizer );
this->Layout();
bPanelSizer->Fit( this );
// Connect Events
m_textEditorBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnTextEditorClick ), NULL, this );
@@ -45,7 +45,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_COMMON_SETTINGS_BASE</property>
<property name="pos"></property>
<property name="size">676,655</property>
<property name="size">-1,-1</property>
<property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
+2 -2
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -113,7 +113,7 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL
public:
PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 676,655 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_COMMON_SETTINGS_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_COMMON_SETTINGS_BASE();
+2 -2
View File
@@ -37,8 +37,8 @@
#include <settings/settings_manager.h>
PANEL_DATA_COLLECTION::PANEL_DATA_COLLECTION( PAGED_DIALOG* aDialog, wxWindow* aParent ) :
PANEL_DATA_COLLECTION_BASE( aParent ), m_dialog( aDialog )
PANEL_DATA_COLLECTION::PANEL_DATA_COLLECTION( wxWindow* aParent ) :
PANEL_DATA_COLLECTION_BASE( aParent )
{
}
+4 -4
View File
@@ -26,9 +26,8 @@
#include <wx/defs.h>
PANEL_MOUSE_SETTINGS::PANEL_MOUSE_SETTINGS( PAGED_DIALOG* aDialog, wxWindow* aParent ) :
PANEL_MOUSE_SETTINGS::PANEL_MOUSE_SETTINGS( wxWindow* aParent ) :
PANEL_MOUSE_SETTINGS_BASE( aParent ),
m_dialog( aDialog ),
m_currentScrollMod( {} )
{
#ifdef __WXOSX_MAC__
@@ -82,8 +81,9 @@ bool PANEL_MOUSE_SETTINGS::TransferDataFromWindow()
if( !isScrollModSetValid( m_currentScrollMod ) )
{
m_dialog->SetError( _( "Only one action can be assigned to each vertical scroll setting" ),
this, nullptr );
PAGED_DIALOG::GetDialog( this )->SetError( _( "Only one action can be assigned to each "
"vertical scroll setting" ),
this, nullptr );
return false;
}
+2 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -316,6 +316,7 @@ PANEL_MOUSE_SETTINGS_BASE::PANEL_MOUSE_SETTINGS_BASE( wxWindow* parent, wxWindow
this->SetSizer( bSizer10 );
this->Layout();
bSizer10->Fit( this );
// Connect Events
m_rbZoomNone->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PANEL_MOUSE_SETTINGS_BASE::OnScrollRadioButton ), NULL, this );
+1 -1
View File
@@ -45,7 +45,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_MOUSE_SETTINGS_BASE</property>
<property name="pos"></property>
<property name="size">609,523</property>
<property name="size">-1,-1</property>
<property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
+2 -2
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -97,7 +97,7 @@ class PANEL_MOUSE_SETTINGS_BASE : public RESETTABLE_PANEL
public:
PANEL_MOUSE_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 609,523 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_MOUSE_SETTINGS_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_MOUSE_SETTINGS_BASE();
+14 -17
View File
@@ -39,7 +39,6 @@
#include <widgets/wx_html_report_box.h>
#include <widgets/wx_panel.h>
#include <widgets/std_bitmap_button.h>
#include <wx/treebook.h>
#include <project/net_settings.h>
@@ -70,13 +69,12 @@ std::vector<BITMAPS> g_lineStyleIcons;
wxArrayString g_lineStyleNames;
PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_FRAME* aFrame,
PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( wxWindow* aParentWindow, EDA_DRAW_FRAME* aFrame,
std::shared_ptr<NET_SETTINGS> aNetSettings,
const std::set<wxString>& aNetNames,
bool aIsEEschema ) :
PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() ),
PANEL_SETUP_NETCLASSES_BASE( aParentWindow ),
m_frame( aFrame ),
m_parent( aParent ),
m_isEEschema( aIsEEschema ),
m_netSettings( aNetSettings ),
m_netNames( aNetNames ),
@@ -121,10 +119,8 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_
// as this initial width is sometimes strange depending on the language (wxGrid bug?)
int const min_width = m_netclassGrid->GetVisibleWidth( i, true, true );
int const weighted_min_best_width =
( i == GRID_LINESTYLE )
? min_best_width * 3 / 2
: min_best_width;
int const weighted_min_best_width = ( i == GRID_LINESTYLE ) ? min_best_width * 3 / 2
: min_best_width;
m_netclassGrid->SetColMinimalWidth( i, min_width );
@@ -158,8 +154,8 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_
}
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetRenderer( new GRID_CELL_COLOR_RENDERER( aParent ) );
attr->SetEditor( new GRID_CELL_COLOR_SELECTOR( aParent, m_netclassGrid ) );
attr->SetRenderer( new GRID_CELL_COLOR_RENDERER( PAGED_DIALOG::GetDialog( this ) ) );
attr->SetEditor( new GRID_CELL_COLOR_SELECTOR( PAGED_DIALOG::GetDialog( this ), m_netclassGrid ) );
m_netclassGrid->SetColAttr( GRID_SCHEMATIC_COLOR, attr );
attr = new wxGridCellAttr;
@@ -174,7 +170,6 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_
m_netclassGrid->SetAutoEvalCols( { GRID_WIREWIDTH,
GRID_BUSWIDTH,
GRID_CLEARANCE,
GRID_TRACKSIZE,
GRID_VIASIZE,
@@ -327,6 +322,8 @@ bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
row++;
}
AdjustAssignmentGridColumns( GetSize().x * 3 / 5 );
return true;
}
@@ -428,7 +425,7 @@ bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, const wxString& aNa
if( tmp.IsEmpty() )
{
wxString msg = _( "Netclass must have a name." );
m_parent->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME );
PAGED_DIALOG::GetDialog( this )->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME );
return false;
}
@@ -437,7 +434,8 @@ bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, const wxString& aNa
if( ii != aRow && m_netclassGrid->GetCellValue( ii, GRID_NAME ).CmpNoCase( tmp ) == 0 )
{
wxString msg = _( "Netclass name already in use." );
m_parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME );
PAGED_DIALOG::GetDialog( this )->SetError( msg, this, m_netclassGrid,
focusFirst ? aRow : ii, GRID_NAME );
return false;
}
}
@@ -652,16 +650,15 @@ void PANEL_SETUP_NETCLASSES::AdjustAssignmentGridColumns( int aWidth )
// Account for scroll bars
aWidth -= ( m_assignmentGrid->GetSize().x - m_assignmentGrid->GetClientSize().x );
// Set className column width to original className width from netclasses grid
int classNameWidth = m_originalColWidths[ 0 ];
m_assignmentGrid->SetColSize( 1, m_originalColWidths[ 0 ] );
int classNameWidth = 160;
m_assignmentGrid->SetColSize( 1, classNameWidth );
m_assignmentGrid->SetColSize( 0, std::max( aWidth - classNameWidth, classNameWidth ) );
}
void PANEL_SETUP_NETCLASSES::OnSizeAssignmentGrid( wxSizeEvent& event )
{
AdjustAssignmentGridColumns( event.GetSize().GetX());
AdjustAssignmentGridColumns( event.GetSize().GetX() );
event.Skip();
}
@@ -74,7 +74,7 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
// Cell Defaults
m_netclassGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bUpperSizer->Add( m_netclassGrid, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 1 );
bUpperSizer->Add( m_netclassGrid, 1, wxEXPAND|wxFIXED_MINSIZE|wxLEFT|wxRIGHT|wxTOP, 1 );
wxBoxSizer* buttonBoxSizer;
buttonBoxSizer = new wxBoxSizer( wxHORIZONTAL );
@@ -129,7 +129,7 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
m_assignmentGrid->SetMargins( 0, 0 );
// Columns
m_assignmentGrid->SetColSize( 0, 400 );
m_assignmentGrid->SetColSize( 0, 270 );
m_assignmentGrid->SetColSize( 1, 160 );
m_assignmentGrid->EnableDragColMove( false );
m_assignmentGrid->EnableDragColSize( true );
@@ -147,7 +147,7 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
// Cell Defaults
m_assignmentGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizer14->Add( m_assignmentGrid, 2, wxEXPAND|wxLEFT, 5 );
bSizer14->Add( m_assignmentGrid, 2, wxEXPAND|wxFIXED_MINSIZE|wxLEFT, 5 );
bColumns->Add( bSizer14, 3, wxEXPAND, 5 );
@@ -186,7 +186,6 @@ PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWi
this->SetSizer( bpanelNetClassesSizer );
this->Layout();
bpanelNetClassesSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnUpdateUI ) );
@@ -45,7 +45,7 @@
<property name="minimum_size">-1,-1</property>
<property name="name">PANEL_SETUP_NETCLASSES_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">700,500</property>
<property name="subclass">; forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
@@ -258,7 +258,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">1</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="flag">wxEXPAND|wxFIXED_MINSIZE|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="0">
<property name="BottomDockable">1</property>
@@ -737,7 +737,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="flag">wxEXPAND|wxFIXED_MINSIZE|wxLEFT</property>
<property name="proportion">2</property>
<object class="wxGrid" expanded="0">
<property name="BottomDockable">1</property>
@@ -766,7 +766,7 @@
<property name="col_label_values">&quot;Pattern&quot; &quot;Net Class&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">2</property>
<property name="column_sizes">400,160</property>
<property name="column_sizes">270,160</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
+1 -1
View File
@@ -69,7 +69,7 @@ class PANEL_SETUP_NETCLASSES_BASE : public wxPanel
public:
PANEL_SETUP_NETCLASSES_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_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,500 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_SETUP_NETCLASSES_BASE();
+2 -3
View File
@@ -28,14 +28,13 @@
#include <wx/radiobut.h>
#include <wx/scrolwin.h>
#include <wx/stattext.h>
#include <wx/treebook.h>
PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( wxWindow* aParentWindow,
std::vector<std::reference_wrapper<RC_ITEM>> aItems,
std::map<int, SEVERITY>& aSeverities,
RC_ITEM* aPinMapSpecialCase ) :
wxPanel( aParent->GetTreebook() ),
wxPanel( aParentWindow ),
m_severities( aSeverities ),
m_items( aItems ),
m_pinMapSpecialCase( aPinMapSpecialCase )
+4 -1
View File
@@ -365,7 +365,10 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent )
if( m_view )
{
if( infobar && infobar->IsLocked() )
m_view->SetCenter( bottom - m_view->ToWorld( clientSize, false ) / 2.0 );
{
VECTOR2D halfScreen( std::ceil( 0.5 * clientSize.x ), std::ceil( 0.5 * clientSize.y ) );
m_view->SetCenter( bottom - m_view->ToWorld( halfScreen, false ) );
}
m_view->MarkTargetDirty( KIGFX::TARGET_CACHED );
m_view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
+15 -19
View File
@@ -106,13 +106,13 @@ void DS_DATA_ITEM::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aV
for( int j = 0; j < m_RepeatCount; j++ )
{
if( j && ! IsInsidePage( j ) )
if( j > 0 && !IsInsidePage( j ) )
continue;
if( m_type == DS_SEGMENT )
item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
item = new DS_DRAW_ITEM_LINE( this, j, GetStartPosIU( j ), GetEndPosIU( j ), pensize );
else if( m_type == DS_RECT )
item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosUi( j ), GetEndPosUi( j ), pensize );
item = new DS_DRAW_ITEM_RECT( this, j, GetStartPosIU( j ), GetEndPosIU( j ), pensize );
else
{
wxFAIL_MSG( wxS( "Unknown drawing sheet item type" ) );
@@ -162,8 +162,8 @@ void DS_DATA_ITEM::MoveTo( const VECTOR2D& aPosition )
for( DS_DRAW_ITEM_BASE* drawItem : m_drawItems )
{
drawItem->SetPosition( GetStartPosUi( drawItem->GetIndexInPeer() ) );
drawItem->SetEnd( GetEndPosUi( drawItem->GetIndexInPeer() ) );
drawItem->SetPosition( GetStartPosIU( drawItem->GetIndexInPeer() ) );
drawItem->SetEnd( GetEndPosIU( drawItem->GetIndexInPeer() ) );
}
}
@@ -294,7 +294,7 @@ const VECTOR2D DS_DATA_ITEM::GetStartPos( int ii ) const
}
const VECTOR2I DS_DATA_ITEM::GetStartPosUi( int ii ) const
const VECTOR2I DS_DATA_ITEM::GetStartPosIU( int ii ) const
{
VECTOR2D pos = GetStartPos( ii ) * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) );
@@ -331,7 +331,7 @@ const VECTOR2D DS_DATA_ITEM::GetEndPos( int ii ) const
}
const VECTOR2I DS_DATA_ITEM::GetEndPosUi( int ii ) const
const VECTOR2I DS_DATA_ITEM::GetEndPosIU( int ii ) const
{
VECTOR2D pos = GetEndPos( ii );
pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
@@ -343,17 +343,13 @@ bool DS_DATA_ITEM::IsInsidePage( int ii ) const
{
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
VECTOR2D pos = GetStartPos( ii );
for( int kk = 0; kk < 1; kk++ )
for( const VECTOR2D& pos : { GetStartPos( ii ), GetEndPos( ii ) } )
{
if( model.m_RB_Corner.x < pos.x || model.m_LT_Corner.x > pos.x )
return false;
if( model.m_RB_Corner.y < pos.y || model.m_LT_Corner.y > pos.y )
return false;
pos = GetEndPos( ii );
}
return true;
@@ -406,11 +402,11 @@ void DS_DATA_ITEM_POLYGONS::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX:
for( int j = 0; j < m_RepeatCount; j++ )
{
if( j && !IsInsidePage( j ) )
if( j > 0 && !IsInsidePage( j ) )
continue;
int pensize = GetPenSizeUi();
auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosUi( j ), pensize );
auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosIU( j ), pensize );
poly_shape->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( poly_shape );
@@ -584,7 +580,7 @@ void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE
if( j > 0 && !IsInsidePage( j ) )
continue;
text = new DS_DRAW_ITEM_TEXT( this, j, m_FullText, GetStartPosUi( j ), textsize, pensize,
text = new DS_DRAW_ITEM_TEXT( this, j, m_FullText, GetStartPosIU( j ), textsize, pensize,
m_Font, m_Italic, m_Bold, m_TextColor );
text->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( text );
@@ -595,14 +591,14 @@ void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE
if( aView )
aView->Add( text );
text->SetHorizJustify( m_Hjustify ) ;
text->SetHorizJustify( m_Hjustify );
text->SetVertJustify( m_Vjustify );
text->SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
text->SetMultilineAllowed( multilines );
// Increment label for the next text (has no meaning for multiline texts)
if( m_RepeatCount > 1 && !multilines )
IncrementLabel(( j + 1 ) * m_IncrementLabel );
IncrementLabel( ( j + 1 ) * m_IncrementLabel );
}
}
@@ -746,10 +742,10 @@ void DS_DATA_ITEM_BITMAP::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::V
for( int j = 0; j < m_RepeatCount; j++ )
{
if( j && !IsInsidePage( j ) )
if( j > 0 && !IsInsidePage( j ) )
continue;
DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosUi( j ) );
DS_DRAW_ITEM_BITMAP* bitmap = new DS_DRAW_ITEM_BITMAP( this, j, GetStartPosIU( j ) );
bitmap->SetFlags( itemFlags[ j ] );
m_drawItems.push_back( bitmap );
+31
View File
@@ -174,6 +174,37 @@ void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VEC
}
const BOX2I DS_DRAW_ITEM_TEXT::GetApproxBBox()
{
// A really dumb over-approximation because doing it for real (even with the stroke font)
// shows up large in profiles.
const TEXT_ATTRIBUTES& attrs = GetAttributes();
const wxString text = GetShownText( true );
BOX2I bbox( GetTextPos() );
bbox.SetWidth( (int) text.length() * attrs.m_Size.x * 1.3 );
bbox.SetHeight( attrs.m_Size.y );
switch( attrs.m_Halign )
{
case GR_TEXT_H_ALIGN_LEFT: break;
case GR_TEXT_H_ALIGN_CENTER: bbox.Offset( -bbox.GetWidth() / 2, 0 ); break;
case GR_TEXT_H_ALIGN_RIGHT: bbox.Offset( -bbox.GetWidth(), 0 ); break;
}
switch( GetAttributes().m_Valign )
{
case GR_TEXT_V_ALIGN_TOP: break;
case GR_TEXT_V_ALIGN_CENTER: bbox.Offset( 0, -bbox.GetHeight() / 2 ); break;
case GR_TEXT_V_ALIGN_BOTTOM: bbox.Offset( 0, -bbox.GetHeight() ); break;
}
bbox.Inflate( attrs.m_Size.x, attrs.m_Size.y / 2 );
return bbox;
}
const BOX2I DS_DRAW_ITEM_TEXT::GetBoundingBox() const
{
return EDA_TEXT::GetTextBox();
+6 -1
View File
@@ -126,8 +126,13 @@ void DS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
ws_settings->SetDefaultFont( settings->GetDefaultFont() );
// Draw all the components that make the drawing sheet
BOX2I viewport( aView->GetViewport().GetOrigin(), aView->GetViewport().GetSize() );
for( DS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
ws_painter.Draw( item, LAYER_DRAWINGSHEET );
{
if( viewport.Intersects( item->GetApproxBBox() ) )
ws_painter.Draw( item, LAYER_DRAWINGSHEET );
}
// Draw gray line that outlines the sheet size
if( settings->GetShowPageLimits() )
+82 -43
View File
@@ -56,13 +56,14 @@
#include <widgets/wx_infobar.h>
#include <widgets/wx_aui_art_providers.h>
#include <widgets/wx_grid.h>
#include <widgets/wx_treebook.h>
#include <wx/app.h>
#include <wx/config.h>
#include <wx/display.h>
#include <wx/stdpaths.h>
#include <wx/string.h>
#include <wx/treebook.h>
#include <kiplatform/app.h>
#include <kiplatform/io.h>
#include <kiplatform/ui.h>
#include <functional>
@@ -167,15 +168,28 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxS
}
wxWindow* findQuasiModalDialog( wxWindow* aParent )
{
for( wxWindow* child : aParent->GetChildren() )
{
if( DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( child ) )
{
if( dlg->IsQuasiModal() )
return dlg;
if( wxWindow* nestedDlg = findQuasiModalDialog( child ) )
return nestedDlg;
}
}
return nullptr;
}
wxWindow* EDA_BASE_FRAME::findQuasiModalDialog()
{
for( wxWindow* iter : GetChildren() )
{
DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( iter );
if( dlg && dlg->IsQuasiModal() )
return dlg;
}
if( wxWindow* dlg = ::findQuasiModalDialog( this ) )
return dlg;
// FIXME: CvPcb is currently implemented on top of KIWAY_PLAYER rather than DIALOG_SHIM,
// so we have to look for it separately.
@@ -1008,26 +1022,45 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
{
wxBeginBusyCursor( wxHOURGLASS_CURSOR );
PAGED_DIALOG dlg( this, _( "Preferences" ), true );
PAGED_DIALOG dlg( this, _( "Preferences" ), true, wxEmptyString, wxSize( 980, 560 ) );
dlg.SetEvtHandlerEnabled( false );
wxTreebook* book = dlg.GetTreebook();
WX_TREEBOOK* book = dlg.GetTreebook();
PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
KIFACE* kiface = nullptr;
std::vector<int> expand;
Kiway().GetActions( hotkeysPanel->ActionsList() );
book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) );
book->AddPage( new PANEL_MOUSE_SETTINGS( &dlg, book ), _( "Mouse and Touchpad" ) );
book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_COMMON_SETTINGS( aParent );
},
_( "Common" ) );
book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_MOUSE_SETTINGS( aParent );
}, _( "Mouse and Touchpad" ) );
book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
#ifdef KICAD_USE_SENTRY
book->AddPage( new PANEL_DATA_COLLECTION( &dlg, book ), _( "Data Collection" ) );
book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_DATA_COLLECTION( aParent );
}, _( "Data Collection" ) );
#endif
#define CREATE_PANEL( key ) kiface->CreateKiWindow( book, key, &Kiway() )
#define LAZY_CTOR( key ) \
[=]( wxWindow* aParent ) \
{ \
return kiface->CreateKiWindow( aParent, key, &Kiway() ); \
}
// If a dll is not loaded, the loader will show an error message.
@@ -1041,20 +1074,19 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_DISP_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_DISP_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_COLORS ), _( "Colors" ) );
if( GetFrameType() == FRAME_SCH )
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Schematic Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_FIELD_NAME_TEMPLATES ),
_( "Field Name Templates" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_FIELD_NAME_TEMPLATES ), _( "Field Name Templates" ) );
}
catch( ... )
{
@@ -1070,29 +1102,29 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) );
if( GetFrameType() == FRAME_PCB_EDITOR )
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "PCB Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_ACTION_PLUGINS ), _( "Action Plugins" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ACTION_PLUGINS ), _( "Action Plugins" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) );
if( GetFrameType() == FRAME_PCB_DISPLAY3D )
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "3D Viewer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_OPENGL ), _( "Realtime Renderer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_RAYTRACING ), _( "Raytracing Renderer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_OPENGL ), _( "Realtime Renderer" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_RAYTRACING ), _( "Raytracing Renderer" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_COLORS ), _( "Colors" ) );
}
catch( ... )
{
@@ -1108,9 +1140,9 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Gerber Viewer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_GBR_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) );
}
catch( ... )
{
@@ -1125,10 +1157,14 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_DS_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_DS_COLORS ), _( "Colors" ) );
book->AddPage( new PANEL_PCM_SETTINGS( book ), _( "Plugin and Content Manager" ) );
book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_PCM_SETTINGS( aParent );
}, _( "Plugin and Content Manager" ) );
}
catch( ... )
{
@@ -1156,7 +1192,7 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
dlg.Kiway().CommonSettingsChanged( false, false );
}
#undef CREATE_PANEL
#undef LAZY_CTOR
}
@@ -1268,6 +1304,9 @@ void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
// the file name.
if( response == wxYES )
{
// Preserve the permissions of the current file
KIPLATFORM::IO::DuplicatePermissions( aFileName.GetFullPath(), autoSaveFileName.GetFullPath() );
if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
{
wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
+10 -3
View File
@@ -217,15 +217,22 @@ EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
void EDA_DRAW_FRAME::ReleaseFile()
{
m_file_checker = nullptr;
if( m_file_checker.get() != nullptr )
m_file_checker->UnlockFile();
}
bool EDA_DRAW_FRAME::LockFile( const wxString& aFileName )
{
m_file_checker = ::LockFile( aFileName );
// We need to explicitly reset here to get the deletion before
// we create a new unique_ptr that may be for the same file
m_file_checker.reset();
return m_file_checker && !m_file_checker->IsAnotherRunning();
m_file_checker = std::make_unique<LOCKFILE>( aFileName );
// If the file is valid, return true. This could mean that the file is
// locked or it could mean that the file is read-only
return m_file_checker->Valid();
}
+44 -44
View File
@@ -91,6 +91,7 @@ GR_TEXT_V_ALIGN_T EDA_TEXT::MapVertJustify( int aVertJustify )
EDA_TEXT::EDA_TEXT( const EDA_IU_SCALE& aIuScale, const wxString& aText ) :
m_text( aText ),
m_IuScale( aIuScale ),
m_render_cache_font( nullptr ),
m_bounding_box_cache_valid( false ),
m_bounding_box_cache_line( -1 ),
m_bounding_box_cache_inverted( false )
@@ -111,8 +112,10 @@ EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
m_attributes = aText.m_attributes;
m_pos = aText.m_pos;
m_render_cache_font = aText.m_render_cache_font;
m_render_cache_text = aText.m_render_cache_text;
m_render_cache_angle = aText.m_render_cache_angle;
m_render_cache_offset = aText.m_render_cache_offset;
m_render_cache.clear();
@@ -145,8 +148,10 @@ EDA_TEXT& EDA_TEXT::operator=( const EDA_TEXT& aText )
m_attributes = aText.m_attributes;
m_pos = aText.m_pos;
m_render_cache_font = aText.m_render_cache_font;
m_render_cache_text = aText.m_render_cache_text;
m_render_cache_angle = aText.m_render_cache_angle;
m_render_cache_offset = aText.m_render_cache_offset;
m_render_cache.clear();
@@ -393,6 +398,9 @@ void EDA_TEXT::SetTextY( int aY )
void EDA_TEXT::Offset( const VECTOR2I& aOffset )
{
if( aOffset.x == 0 && aOffset.y == 0 )
return;
m_pos += aOffset;
for( std::unique_ptr<KIFONT::GLYPH>& glyph : m_render_cache )
@@ -461,24 +469,26 @@ std::vector<std::unique_ptr<KIFONT::GLYPH>>*
EDA_TEXT::GetRenderCache( const KIFONT::FONT* aFont, const wxString& forResolvedText,
const VECTOR2I& aOffset ) const
{
if( getDrawFont()->IsOutline() )
if( aFont->IsOutline() )
{
EDA_ANGLE resolvedAngle = GetDrawRotation();
if( m_render_cache.empty()
|| m_render_cache_font != aFont
|| m_render_cache_text != forResolvedText
|| m_render_cache_angle != resolvedAngle
|| m_render_cache_offset != aOffset )
{
m_render_cache.clear();
KIFONT::OUTLINE_FONT* font = static_cast<KIFONT::OUTLINE_FONT*>( getDrawFont() );
TEXT_ATTRIBUTES attrs = GetAttributes();
const KIFONT::OUTLINE_FONT* font = static_cast<const KIFONT::OUTLINE_FONT*>( aFont );
TEXT_ATTRIBUTES attrs = GetAttributes();
attrs.m_Angle = resolvedAngle;
font->GetLinesAsGlyphs( &m_render_cache, forResolvedText, GetDrawPos() + aOffset,
attrs );
m_render_cache_font = aFont;
m_render_cache_angle = resolvedAngle;
m_render_cache_text = forResolvedText;
m_render_cache_offset = aOffset;
@@ -553,12 +563,16 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
// bounding box will be moved later according to the actual text options
wxSize textsize = wxSize( extents.x, extents.y );
VECTOR2I pos = drawPos;
int fudgeFactor = extents.y * 0.17;
if( font->IsStroke() )
textsize.y += fudgeFactor;
if( IsMultilineAllowed() && aLine > 0 && aLine < (int) strings.GetCount() )
pos.y -= KiROUND( aLine * font->GetInterline( fontSize.y ) );
if( text.Contains( wxT( "~{" ) ) )
overbarOffset = extents.y / 14;
overbarOffset = extents.y / 6;
if( aInvertY )
pos.y = -pos.y;
@@ -566,7 +580,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
bbox.SetOrigin( pos );
// for multiline texts and aLine < 0, merge all rectangles (aLine == -1 signals all lines)
if( IsMultilineAllowed() && aLine < 0 && strings.GetCount() )
if( IsMultilineAllowed() && aLine < 0 && strings.GetCount() > 1 )
{
for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
{
@@ -580,6 +594,8 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
textsize.y += KiROUND( ( strings.GetCount() - 1 ) * font->GetInterline( fontSize.y ) );
}
textsize.y += overbarOffset;
bbox.SetSize( textsize );
/*
@@ -608,14 +624,16 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
switch( GetVertJustify() )
{
case GR_TEXT_V_ALIGN_TOP:
bbox.Offset( 0, -fudgeFactor );
break;
case GR_TEXT_V_ALIGN_CENTER:
bbox.SetY( bbox.GetY() - ( bbox.GetHeight() + overbarOffset ) / 2 );
bbox.SetY( bbox.GetY() - bbox.GetHeight() / 2 );
break;
case GR_TEXT_V_ALIGN_BOTTOM:
bbox.SetY( bbox.GetY() - ( bbox.GetHeight() + overbarOffset ) );
bbox.SetY( bbox.GetY() - bbox.GetHeight() );
bbox.Offset( 0, fudgeFactor );
break;
}
@@ -869,12 +887,23 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( bool aTriangula
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
KIFONT::FONT* font = getDrawFont();
int penWidth = GetEffectiveTextPenWidth();
wxString shownText( GetShownText( true ) );
VECTOR2I drawPos = GetDrawPos();
TEXT_ATTRIBUTES attrs = GetAttributes();
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
if( aUseTextRotation )
{
attrs.m_Angle = GetDrawRotation();
if( font->IsOutline() )
cache = GetRenderCache( font, shownText, drawPos );
}
else
{
attrs.m_Angle = ANGLE_0;
}
if( aTriangulate )
{
@@ -896,7 +925,10 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( bool aTriangula
shape->AddShape( triShape );
} );
font->Draw( &callback_gal, GetShownText( true ), GetDrawPos(), attrs );
if( cache )
callback_gal.DrawGlyphs( *cache );
else
font->Draw( &callback_gal, shownText, drawPos, attrs );
}
else
{
@@ -913,7 +945,10 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( bool aTriangula
shape->AddShape( aPoly.Clone() );
} );
font->Draw( &callback_gal, GetShownText( true ), GetDrawPos(), attrs );
if( cache )
callback_gal.DrawGlyphs( *cache );
else
font->Draw( &callback_gal, shownText, drawPos, attrs );
}
return shape;
@@ -954,41 +989,6 @@ int EDA_TEXT::Compare( const EDA_TEXT* aOther ) const
}
void EDA_TEXT::TransformBoundingBoxToPolygon( SHAPE_POLY_SET* aBuffer, int aClearance ) const
{
if( GetText().Length() == 0 )
return;
VECTOR2I corners[4]; // Buffer of polygon corners
BOX2I rect = GetTextBox();
// TrueType bounding boxes aren't guaranteed to include all descenders, diacriticals, etc.
// Since we use this for zone knockouts and DRC, we need something more accurate.
if( getDrawFont()->IsOutline() )
rect = GetEffectiveTextShape( false, false )->BBox();
rect.Inflate( aClearance );
corners[0].x = rect.GetOrigin().x;
corners[0].y = rect.GetOrigin().y;
corners[1].y = corners[0].y;
corners[1].x = rect.GetRight();
corners[2].x = corners[1].x;
corners[2].y = rect.GetBottom();
corners[3].y = corners[2].y;
corners[3].x = corners[0].x;
aBuffer->NewOutline();
for( VECTOR2I& corner : corners )
{
RotatePoint( corner, GetDrawPos(), GetDrawRotation() );
aBuffer->Append( corner.x, corner.y );
}
}
bool EDA_TEXT::ValidateHyperlink( const wxString& aURL )
{
if( aURL.IsEmpty() || IsGotoPageHref( aURL ) )
+11 -3
View File
@@ -120,10 +120,18 @@ FUTURE_FORMAT_ERROR::FUTURE_FORMAT_ERROR( const PARSE_ERROR& aParseError,
const wxString& aRequiredVersion ) :
PARSE_ERROR()
{
init( aRequiredVersion );
if( const FUTURE_FORMAT_ERROR* ffe = dynamic_cast<const FUTURE_FORMAT_ERROR*>( &aParseError ) )
{
requiredVersion = ffe->requiredVersion;
problem = ffe->Problem();
}
else
{
init( aRequiredVersion );
if( !aParseError.Problem().IsEmpty() )
problem += wxS( "\n\n" ) + _( "Full error text:" ) + wxS( "\n" ) + aParseError.Problem();
if( !aParseError.Problem().IsEmpty() )
problem += wxS( "\n\n" ) + _( "Full error text:" ) + wxS( "\n" ) + aParseError.Problem();
}
lineNumber = aParseError.lineNumber;
byteIndex = aParseError.byteIndex;
+1 -1
View File
@@ -347,7 +347,7 @@ VECTOR2I FONT::StringBoundaryLimits( const wxString& aText, const VECTOR2I& aSiz
if( IsStroke() )
{
// Inflate by a bit more than thickness/2 to catch diacriticals, descenders, etc.
boundingBox.Inflate( KiROUND( aThickness * 1.25 ) );
boundingBox.Inflate( KiROUND( aThickness * 1.5 ) );
}
else if( IsOutline() )
{
+6 -8
View File
@@ -362,6 +362,9 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
VECTOR2I cursor( 0, 0 );
if( aGlyphs )
aGlyphs->reserve( glyphCount );
for( unsigned int i = 0; i < glyphCount; i++ )
{
// Don't process glyphs that were already included in a previous cluster
@@ -380,7 +383,7 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
matrix.yx = (FT_Fixed) ( 0 * 0x10000L ); // Don't rotate in the y direction
matrix.yy = (FT_Fixed) ( 1 * 0x10000L );
FT_Set_Transform(face, &matrix,0);
FT_Set_Transform( face, &matrix, 0 );
}
FT_Load_Glyph( face, glyphInfo[i].codepoint, FT_LOAD_NO_BITMAP );
@@ -403,6 +406,8 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
GLYPH_POINTS points = c.m_Points;
SHAPE_LINE_CHAIN shape;
shape.ReservePoints( points.size() );
for( const VECTOR2D& v : points )
{
VECTOR2D pt( v + cursor );
@@ -447,13 +452,6 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
}
}
// FONT TODO we might not want to do Fracture() here;
// knockout text (eg. silkscreen labels with a background) will
// need to do that after the contours have been turned into holes
// and vice versa
if( glyph->HasHoles() )
glyph->Fracture( SHAPE_POLY_SET::PM_FAST ); // FONT TODO verify aFastMode
aGlyphs->push_back( std::move( glyph ) );
}
+29 -14
View File
@@ -47,6 +47,7 @@
#include <macros.h>
#include <geometry/geometry_utils.h>
#include <thread_pool.h>
#include <profile.h>
#include <trace_helpers.h>
@@ -259,11 +260,17 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
{
m_glMainContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this );
if( !m_glMainContext )
throw std::runtime_error( "Could not create the main OpenGL context" );
m_glPrivContext = m_glMainContext;
}
else
{
m_glPrivContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this, m_glMainContext );
if( !m_glPrivContext )
throw std::runtime_error( "Could not create a private OpenGL context" );
}
m_shader = new SHADER();
@@ -2532,16 +2539,8 @@ void OPENGL_GAL::init()
#endif /* wxCHECK_VERSION( 3, 0, 3 ) */
// Check correct initialization from the constructor
if( !m_glMainContext )
throw std::runtime_error( "Could not create the main OpenGL context" );
if( !m_glPrivContext )
throw std::runtime_error( "Could not create a private OpenGL context" );
if( m_tesselator == nullptr )
throw std::runtime_error( "Could not create the m_tesselator" );
// End initialization checks
throw std::runtime_error( "Could not create the tesselator" );
GLenum err = glewInit();
if( GLEW_OK != err )
@@ -2781,15 +2780,31 @@ void OPENGL_GAL::DrawGlyphs( const std::vector<std::unique_ptr<KIFONT::GLYPH>>&
// Optimized path for stroke fonts that pre-reserves glyph triangles.
int triangleCount = 0;
if( aGlyphs.size() > 0 )
{
thread_pool& tp = GetKiCadThreadPool();
tp.push_loop( aGlyphs.size(),
[&]( const int a, const int b)
{
for( int ii = a; ii < b; ++ii )
{
auto glyph = static_cast<KIFONT::OUTLINE_GLYPH*>( aGlyphs.at( ii ).get() );
// Only call CacheTriangulation() if it has never been done before.
// Otherwise we'll hash the triangulation to see if it has been edited,
// and all our glpyh editing ops update the triangulation anyway.
if( glyph->TriangulatedPolyCount() == 0 )
glyph->CacheTriangulation( false );
}
} );
tp.wait_for_tasks();
}
for( const std::unique_ptr<KIFONT::GLYPH>& glyph : aGlyphs )
{
const auto& outlineGlyph = static_cast<const KIFONT::OUTLINE_GLYPH&>( *glyph );
// Only call CacheTriangulation if it has never been done before. Otherwise we'll hash
// the triangulation to see if it has been edited, and glyphs after creation are read-only.
if( outlineGlyph.TriangulatedPolyCount() == 0 )
const_cast<KIFONT::OUTLINE_GLYPH&>( outlineGlyph ).CacheTriangulation( false );
for( unsigned int i = 0; i < outlineGlyph.TriangulatedPolyCount(); i++ )
{
const SHAPE_POLY_SET::TRIANGULATED_POLYGON* polygon =
+2 -2
View File
@@ -87,7 +87,7 @@ void GL_CONTEXT_MANAGER::DeleteAll()
void GL_CONTEXT_MANAGER::LockCtx( wxGLContext* aContext, wxGLCanvas* aCanvas )
{
wxCHECK( aCanvas || m_glContexts.count( aContext ) > 0, /* void */ );
wxCHECK( aContext && m_glContexts.count( aContext ) > 0, /* void */ );
m_glCtxMutex.lock();
wxGLCanvas* canvas = aCanvas ? aCanvas : m_glContexts.at( aContext );
@@ -106,7 +106,7 @@ void GL_CONTEXT_MANAGER::LockCtx( wxGLContext* aContext, wxGLCanvas* aCanvas )
void GL_CONTEXT_MANAGER::UnlockCtx( wxGLContext* aContext )
{
wxCHECK( m_glContexts.count( aContext ) > 0, /* void */ );
wxCHECK( aContext && m_glContexts.count( aContext ) > 0, /* void */ );
if( m_glCtx == aContext )
{
+3
View File
@@ -94,7 +94,10 @@ void GRSetColorPen( wxDC* DC, const COLOR4D& Color, int width, wxPenStyle style
// wxWidgets will enforce a minimum pen width when printing, so we have to make the pen
// transparent when we don't want the object stroked.
if( width == 0 )
{
color = COLOR4D::UNSPECIFIED;
style = wxPENSTYLE_TRANSPARENT;
}
const wxPen& curr_pen = DC->GetPen();
+4 -6
View File
@@ -726,18 +726,16 @@ void GRID_TRICKS::paste_text( const wxString& cb_text )
wxStringTokenizer cols( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY );
if( !is_selection )
{
end_col = cur_col + cols.CountTokens();
if( end_col > tbl->GetNumberCols() )
end_col = tbl->GetNumberCols();
}
for( int col = start_col; col < end_col; ++col )
for( int col = start_col; col < end_col && col < tbl->GetNumberCols(); ++col )
{
// Skip hidden columns
if( !m_grid->IsColShown( col ) )
{
end_col++;
continue;
}
// If number of selected cols is larger than the count of cols on the clipboard,
// paste again and again until the end of the selection is reached.
+5 -1
View File
@@ -39,6 +39,8 @@ public:
m_includeNetlistAttributes( true ),
m_useX2Format( true ),
m_disableApertureMacros( false ),
m_useAuxOrigin( false ),
m_useProtelFileExtension( true ),
m_precision( 5 ),
m_printMaskLayer()
{
@@ -59,6 +61,8 @@ public:
bool m_includeNetlistAttributes;
bool m_useX2Format;
bool m_disableApertureMacros;
bool m_useAuxOrigin;
bool m_useProtelFileExtension;
int m_precision;
@@ -66,4 +70,4 @@ public:
LSET m_printMaskLayer;
};
#endif
#endif
+5 -1
View File
@@ -33,7 +33,9 @@ public:
m_filename(),
m_outputFile(),
m_colorTheme(),
m_mirror( false ),
m_blackAndWhite( false ),
m_negative( false ),
m_plotFootprintValues( true ),
m_plotRefDes( true ),
m_plotBorderTitleBlocks( false ),
@@ -45,7 +47,9 @@ public:
wxString m_outputFile;
wxString m_colorTheme;
bool m_mirror;
bool m_blackAndWhite;
bool m_negative;
bool m_plotFootprintValues;
bool m_plotRefDes;
bool m_plotBorderTitleBlocks;
@@ -53,4 +57,4 @@ public:
LSET m_printMaskLayer;
};
#endif
#endif
+3 -1
View File
@@ -30,7 +30,8 @@ class JOB_EXPORT_PCB_SVG : public JOB
public:
JOB_EXPORT_PCB_SVG( bool aIsCli ) :
JOB( "svg", aIsCli ), m_filename(), m_outputFile(), m_colorTheme(), m_mirror( false ),
m_blackAndWhite( false ), m_plotDrawingSheet( true ), m_pageSizeMode( 0 ), m_printMaskLayer()
m_blackAndWhite( false ), m_negative( false ), m_plotDrawingSheet( true ),
m_pageSizeMode( 0 ), m_printMaskLayer()
{
}
@@ -40,6 +41,7 @@ public:
bool m_mirror;
bool m_blackAndWhite;
bool m_negative;
bool m_plotDrawingSheet;
int m_pageSizeMode;
-49
View File
@@ -1,49 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 1992-2022 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/>.
*/
#ifndef JOB_EXPORT_SCH_PDF_H
#define JOB_EXPORT_SCH_PDF_H
#include <wx/string.h>
#include "job.h"
class JOB_EXPORT_SCH_PDF : public JOB
{
public:
JOB_EXPORT_SCH_PDF( bool aIsCli ) :
JOB( "pdf", aIsCli ),
m_filename(),
m_outputFile(),
m_blackAndWhite( false ),
m_useBackgroundColor( false ),
m_plotDrawingSheet( false )
{
}
wxString m_filename;
wxString m_outputFile;
wxString m_colorTheme;
bool m_blackAndWhite;
bool m_useBackgroundColor;
bool m_plotDrawingSheet;
};
#endif
@@ -18,21 +18,24 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMMAND_EXPORT_SCH_SVG_H
#define COMMAND_EXPORT_SCH_SVG_H
#ifndef JOB_EXPORT_SCH_PLOT_H
#define JOB_EXPORT_SCH_PLOT_H
#include "command_export_pcb_base.h"
#include <wx/string.h>
#include <plotters/plotter.h>
#include "job.h"
namespace CLI
{
class EXPORT_SCH_SVG_COMMAND : public EXPORT_PCB_BASE_COMMAND
class JOB_EXPORT_SCH_PLOT : public JOB
{
public:
EXPORT_SCH_SVG_COMMAND();
JOB_EXPORT_SCH_PLOT( bool aIsCli, PLOT_FORMAT aPlotFormat, wxString aFilename ) :
JOB( "plot", aIsCli ), m_plotFormat( aPlotFormat ), m_filename( aFilename )
{
}
protected:
int doPerform( KIWAY& aKiway ) override;
PLOT_FORMAT m_plotFormat;
wxString m_filename;
SCH_PLOT_SETTINGS settings;
};
} // namespace CLI
#endif
-49
View File
@@ -1,49 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 1992-2022 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/>.
*/
#ifndef JOB_EXPORT_SCH_SVG_H
#define JOB_EXPORT_SCH_SVG_H
#include <wx/string.h>
#include "job.h"
class JOB_EXPORT_SCH_SVG : public JOB
{
public:
JOB_EXPORT_SCH_SVG( bool aIsCli ) :
JOB( "svg", aIsCli ),
m_filename(),
m_outputDirectory(),
m_blackAndWhite( false ),
m_useBackgroundColor( false ),
m_plotDrawingSheet( false )
{
}
wxString m_filename;
wxString m_outputDirectory;
wxString m_colorTheme;
bool m_blackAndWhite;
bool m_useBackgroundColor;
bool m_plotDrawingSheet;
};
#endif
+71 -19
View File
@@ -45,6 +45,10 @@
#include <wx/utils.h>
#include <confirm.h>
#ifdef KICAD_USE_SENTRY
#include <sentry.h>
#endif
KIFACE* KIWAY::m_kiface[KIWAY_FACE_COUNT];
int KIWAY::m_kiface_version[KIWAY_FACE_COUNT];
@@ -212,8 +216,6 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
if( m_kiface[aFaceId] )
return m_kiface[aFaceId];
wxString msg;
// DSO with KIFACE has not been loaded yet, does caller want to load it?
if( doLoad )
{
@@ -236,6 +238,7 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
bool codeSignOk = KIPLATFORM::ENV::VerifyFileSignature( dname );
if( !codeSignOk )
{
wxString msg;
msg.Printf( _( "Failed to verify kiface library '%s' signature." ), dname );
THROW_IO_ERROR( msg );
}
@@ -257,6 +260,14 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
setlocale( lc_new_type, user_locale.c_str() );
wxString msg = wxString::Format( "Loading kiface %d", aFaceId );
#ifdef KICAD_USE_SENTRY
sentry_value_t crumb = sentry_value_new_breadcrumb( "navigation", msg.utf8_str() );
sentry_value_set_by_key( crumb, "category", sentry_value_new_string( "kiway.kiface" ) );
sentry_value_set_by_key( crumb, "level", sentry_value_new_string( "info" ) );
sentry_add_breadcrumb( crumb );
#endif
if( !success )
{
// Failure: error reporting UI was done via wxLogSysError().
@@ -287,15 +298,38 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
wxASSERT_MSG( kiface,
wxT( "attempted DSO has a bug, failed to return a KIFACE*" ) );
wxDllType dsoHandle = dso.Detach();
bool startSuccess = false;
// Give the DSO a single chance to do its "process level" initialization.
// "Process level" specifically means stay away from any projects in there.
if( kiface->OnKifaceStart( m_program, m_ctl ) )
{
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
ignore_unused( dso.Detach() );
try
{
startSuccess = kiface->OnKifaceStart( m_program, m_ctl );
}
catch (...)
{
// OnKiFaceStart may generate an exception
// Before we continue and ultimately unload our module to retry we need
// to process the exception before we delete the free the memory space the exception resides in
Pgm().HandleException( std::current_exception() );
}
if( startSuccess )
{
return m_kiface[aFaceId] = kiface;
}
else
{
// Usually means cancelled initial global library setup
// But it could have been an exception/failure
// Let the module go out of scope to unload
dso.Attach( dsoHandle );
return nullptr;
}
}
// In any of the failure cases above, dso.Unload() should be called here
@@ -414,6 +448,14 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow
{
try
{
#ifdef KICAD_USE_SENTRY
wxString msg = wxString::Format( "Creating window type %d", aFrameType );
sentry_value_t crumb = sentry_value_new_breadcrumb( "navigation", msg.utf8_str() );
sentry_value_set_by_key( crumb, "category", sentry_value_new_string( "kiway.player" ) );
sentry_value_set_by_key( crumb, "level", sentry_value_new_string( "info" ) );
sentry_add_breadcrumb( crumb );
#endif
FACE_T face_type = KifaceType( aFrameType );
KIFACE* kiface = KiFACE( face_type );
@@ -429,18 +471,9 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow
m_playerFrameId[aFrameType].store( frame->GetId() );
return frame;
}
catch( const IO_ERROR& ioe )
{
wxLogError( ioe.What() );
wxLogError( _( "Error loading editor." ) );
}
catch( const std::exception& e )
{
wxLogError( e.what() );
wxLogError( _( "Error loading editor." ) );
}
catch( ... )
{
Pgm().HandleException( std::current_exception() );
wxLogError( _( "Error loading editor." ) );
}
}
@@ -462,11 +495,19 @@ bool KIWAY::PlayerClose( FRAME_T aFrameType, bool doForce )
return false;
}
KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
if( frame == nullptr ) // Already closed
return true;
#ifdef KICAD_USE_SENTRY
wxString msg = wxString::Format( "Closing window type %d", aFrameType );
sentry_value_t crumb = sentry_value_new_breadcrumb( "navigation", msg.utf8_str() );
sentry_value_set_by_key( crumb, "category", sentry_value_new_string( "kiway.playerclose" ) );
sentry_value_set_by_key( crumb, "level", sentry_value_new_string( "info" ) );
sentry_add_breadcrumb( crumb );
#endif
if( frame->NonUserClose( doForce ) )
{
m_playerFrameId[aFrameType] = wxID_NONE;
@@ -482,14 +523,18 @@ bool KIWAY::PlayersClose( bool doForce )
bool ret = true;
for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
{
ret = ret && PlayerClose( FRAME_T( i ), doForce );
}
return ret;
}
void KIWAY::PlayerDidClose( FRAME_T aFrameType )
{
m_playerFrameId[aFrameType] = wxID_NONE;
}
void KIWAY::ExpressMail( FRAME_T aDestination, MAIL_T aCommand, std::string& aPayload,
wxWindow* aSource )
{
@@ -599,6 +644,13 @@ void KIWAY::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
void KIWAY::ProjectChanged()
{
#ifdef KICAD_USE_SENTRY
sentry_value_t crumb = sentry_value_new_breadcrumb( "navigation", "Changing project" );
sentry_value_set_by_key( crumb, "category", sentry_value_new_string( "kiway.projectchanged" ) );
sentry_value_set_by_key( crumb, "level", sentry_value_new_string( "info" ) );
sentry_add_breadcrumb( crumb );
#endif
if( m_ctl & KFCTL_CPP_PROJECT_SUITE )
{
// A dynamic_cast could be better, but creates link issues
+8
View File
@@ -55,6 +55,12 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
}
// Don't use this one; it's only for wxFormBuilder, and it must be augmented with code to
// correct the m_ident and set the m_kiway early in derived constructor.
//
// Because of its inherent danger, it's also declared private and requires friend-class
// declarations for each usage.
//
KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
const wxPoint& aPos, const wxSize& aSize, long aStyle,
const wxString& aWdoName ) :
@@ -169,6 +175,8 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow
bool KIWAY_PLAYER::Destroy()
{
Kiway().PlayerDidClose( GetFrameType() );
return EDA_BASE_FRAME::Destroy();
}
+6
View File
@@ -416,6 +416,12 @@ wxDataViewItem LIB_TREE_MODEL_ADAPTER::FindItem( const LIB_ID& aLibId )
}
wxDataViewItem LIB_TREE_MODEL_ADAPTER::GetCurrentDataViewItem()
{
return FindItem( m_preselect_lib_id );
}
unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( const wxDataViewItem& aItem,
wxDataViewItemArray& aChildren ) const
{
+1 -1
View File
@@ -1220,7 +1220,7 @@ void UOP::Exec( CONTEXT* ctx )
result = arg1Value != 0.0 ? 0 : 1;
break;
default:
result = 0.0;
result = arg1Value != 0.0 ? 1 : 0;
break;
}
-96
View File
@@ -1,96 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014-2022 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
*/
#include <memory>
#include <build_version.h>
#include <lockfile.h>
#include <wx/filename.h>
#include <wx/snglinst.h>
std::unique_ptr<wxSingleInstanceChecker> LockFile( const wxString& aFileName )
{
// first make absolute and normalize, to avoid that different lock files
// for the same file can be created
wxFileName fn( aFileName );
fn.MakeAbsolute();
wxString lockFileName = fn.GetFullPath() + ".lock";
lockFileName.Replace( "/", "_" );
// We can have filenames coming from Windows, so also convert Windows separator
lockFileName.Replace( "\\", "_" );
auto p = std::make_unique<wxSingleInstanceChecker>( lockFileName, GetKicadLockFilePath() );
if( p->IsAnotherRunning() )
p = nullptr;
return p;
}
wxString GetKicadLockFilePath()
{
wxFileName lockpath;
lockpath.AssignDir( wxGetHomeDir() ); // Default wx behavior
#if defined( __WXMAC__ )
// In OSX use the standard per user cache directory
lockpath.AppendDir( "Library" );
lockpath.AppendDir( "Caches" );
lockpath.AppendDir( "kicad" );
#elif defined( __UNIX__ )
wxString envstr;
// Try first the standard XDG_RUNTIME_DIR, falling back to XDG_CACHE_HOME
if( wxGetEnv( "XDG_RUNTIME_DIR", &envstr ) && !envstr.IsEmpty() )
{
lockpath.AssignDir( envstr );
}
else if( wxGetEnv( "XDG_CACHE_HOME", &envstr ) && !envstr.IsEmpty() )
{
lockpath.AssignDir( envstr );
}
else
{
// If all fails, just use ~/.cache
lockpath.AppendDir( ".cache" );
}
lockpath.AppendDir( wxString::Format( "kicad_v%s", GetMajorMinorVersion() ) );
#endif
#if defined( __WXMAC__ ) || defined( __UNIX__ )
if( !lockpath.DirExists() )
{
// Lockfiles should be only readable by the user
lockpath.Mkdir( 0700, wxPATH_MKDIR_FULL );
}
#endif
return lockpath.GetPath();
}
+34 -2
View File
@@ -54,7 +54,7 @@
#include <id.h>
#include <kicad_curl/kicad_curl.h>
#include <kiplatform/policy.h>
#include <lockfile.h>
#include <macros.h>
#include <menus_helpers.h>
#include <paths.h>
#include <pgm_base.h>
@@ -880,4 +880,36 @@ bool PGM_BASE::IsGUI()
bool run_gui = wxTheApp->GetClassName() != KICAD_CLI_APP_NAME;
return run_gui;
#endif
}
}
void PGM_BASE::HandleException( std::exception_ptr aPtr )
{
try
{
if( aPtr )
std::rethrow_exception( aPtr );
}
catch( const IO_ERROR& ioe )
{
wxLogError( ioe.What() );
}
catch( const std::exception& e )
{
#ifdef KICAD_USE_SENTRY
sentry_value_t exc = sentry_value_new_exception( "exception", e.what() );
sentry_value_set_stacktrace( exc, NULL, 0 );
sentry_value_t sentryEvent = sentry_value_new_event();
sentry_event_add_exception( sentryEvent, exc );
sentry_capture_event( sentryEvent );
#endif
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
}
catch( ... )
{
wxLogError( wxT( "Unhandled exception of unknown type" ) );
}
}
+2 -1
View File
@@ -27,6 +27,7 @@
#include <config.h> // HAVE_FGETC_NOLOCK
#include <ignore.h>
#include <kiplatform/io.h>
#include <richio.h>
#include <errno.h>
@@ -209,7 +210,7 @@ FILE_LINE_READER::FILE_LINE_READER( const wxString& aFileName, unsigned aStartin
unsigned aMaxLineLength ):
LINE_READER( aMaxLineLength ), m_iOwn( true )
{
m_fp = wxFopen( aFileName, wxT( "rt" ) );
m_fp = KIPLATFORM::IO::SeqFOpen( aFileName, wxT( "rt" ) );
if( !m_fp )
{
+2 -1
View File
@@ -162,7 +162,8 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
if( !isalpha( aEvent.GetKeyCode() ) )
m_suppressAutocomplete = false;
if( aEvent.GetKeyCode() == WXK_RETURN && ( m_singleLine || aEvent.ShiftDown() ) )
if( ( aEvent.GetKeyCode() == WXK_RETURN || aEvent.GetKeyCode() == WXK_NUMPAD_ENTER )
&& ( m_singleLine || aEvent.ShiftDown() ) )
{
m_returnCallback();
}
+2 -2
View File
@@ -892,7 +892,7 @@ bool SETTINGS_MANAGER::LoadProject( const wxString& aFullPath, bool aSetActive )
return true;
bool readOnly = false;
std::unique_ptr<wxSingleInstanceChecker> lockFile = ::LockFile( fullPath );
LOCKFILE lockFile( fullPath );
if( !lockFile )
{
@@ -929,7 +929,7 @@ bool SETTINGS_MANAGER::LoadProject( const wxString& aFullPath, bool aSetActive )
project->SetReadOnly( readOnly || project->GetProjectFile().IsReadOnly() );
if( lockFile )
m_project_lock.reset( lockFile.release() );
m_project_lock.reset( new LOCKFILE( std::move( lockFile ) ) );
}
m_projects_list.push_back( std::move( project ) );
+8 -33
View File
@@ -52,6 +52,9 @@
#include <kiplatform/app.h>
#include <kiplatform/environment.h>
#ifdef KICAD_USE_SENTRY
#include <sentry.h>
#endif
// Only a single KIWAY is supported in this single_top top level component,
// which is dedicated to loading only a single DSO.
@@ -159,18 +162,9 @@ struct APP_SINGLE_TOP : public wxApp
{
return program.OnPgmInit();
}
catch( const std::exception& e )
catch( ... )
{
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
}
catch( const IO_ERROR& ioe )
{
wxLogError( ioe.What() );
}
catch(...)
{
wxLogError( wxT( "Unhandled exception of unknown type" ) );
Pgm().HandleException( std::current_exception() );
}
program.OnPgmExit();
@@ -192,18 +186,9 @@ struct APP_SINGLE_TOP : public wxApp
{
ret = wxApp::OnRun();
}
catch( const std::exception& e )
{
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
}
catch( const IO_ERROR& ioe )
{
wxLogError( ioe.What() );
}
catch(...)
{
wxLogError( wxT( "Unhandled exception of unknown type" ) );
Pgm().HandleException( std::current_exception() );
}
return ret;
@@ -254,19 +239,9 @@ struct APP_SINGLE_TOP : public wxApp
{
throw;
}
catch( const std::exception& e )
catch( ... )
{
wxLogError( "Unhandled exception class: %s what: %s",
FROM_UTF8( typeid(e).name() ),
FROM_UTF8( e.what() ) );
}
catch( const IO_ERROR& ioe )
{
wxLogError( ioe.What() );
}
catch(...)
{
wxLogError( "Unhandled exception of unknown type" );
Pgm().HandleException( std::current_exception() );
}
return false; // continue on. Return false to abort program
+6 -1
View File
@@ -491,7 +491,11 @@ void LIB_TREE::onDebounceTimer( wxTimerEvent& aEvent )
void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
{
const wxDataViewItem sel = m_tree_ctrl->GetSelection();
wxDataViewItem sel = m_tree_ctrl->GetSelection();
if( !sel.IsOk() )
sel = m_adapter->GetCurrentDataViewItem();
LIB_TREE_NODE::TYPE type = sel.IsOk() ? m_adapter->GetTypeFor( sel ) : LIB_TREE_NODE::INVALID;
switch( aKeyStroke.GetKeyCode() )
@@ -523,6 +527,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
break;
case WXK_RETURN:
case WXK_NUMPAD_ENTER:
updateRecentSearchMenu();
if( GetSelectedLibId().IsValid() )
+4 -2
View File
@@ -440,6 +440,7 @@ protected:
break;
case WXK_RETURN:
case WXK_NUMPAD_ENTER:
Accept();
break;
@@ -582,13 +583,14 @@ void NET_SELECTOR::onKeyDown( wxKeyEvent& aEvt )
}
// Shift-return accepts dialog
else if( key == WXK_RETURN && aEvt.ShiftDown() )
else if( ( key == WXK_RETURN || key == WXK_NUMPAD_ENTER ) && aEvt.ShiftDown() )
{
wxPostEvent( m_parent, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
}
// Return, arrow-down and space-bar all open popup
else if( key == WXK_RETURN || key == WXK_DOWN || key == WXK_NUMPAD_DOWN || key == WXK_SPACE )
else if( key == WXK_RETURN || key == WXK_NUMPAD_ENTER || key == WXK_DOWN
|| key == WXK_NUMPAD_DOWN || key == WXK_SPACE )
{
Popup();
}
+66 -37
View File
@@ -19,19 +19,20 @@
#include <confirm.h>
#include <widgets/resettable_panel.h>
#include <widgets/wx_infobar.h>
#include <widgets/wx_panel.h>
#include <widgets/paged_dialog.h>
#include <widgets/wx_treebook.h>
#include <wx/button.h>
#include <wx/grid.h>
#include <wx/sizer.h>
#include <wx/treebook.h>
#include <wx/treectrl.h>
#include <widgets/wx_infobar.h>
#include <widgets/paged_dialog.h>
#include <wx/listctrl.h>
#include <wx/stc/stc.h>
#include <algorithm>
#include "wx/listctrl.h"
#include "widgets/wx_panel.h"
// Maps from dialogTitle <-> pageTitle for keeping track of last-selected pages.
// This is not a simple page index because some dialogs have dynamic page sets.
@@ -40,8 +41,8 @@ std::map<wxString, wxString> g_lastParentPage;
PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aShowReset,
const wxString& aAuxiliaryAction ) :
DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
const wxString& aAuxiliaryAction, const wxSize& aInitialSize ) :
DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, aInitialSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
m_auxiliaryButton( nullptr ),
m_resetButton( nullptr ),
@@ -60,8 +61,9 @@ PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aSho
wxBoxSizer* treebookSizer = new wxBoxSizer( wxVERTICAL );
treebookPanel->SetSizer( treebookSizer );
m_treebook = new wxTreebook( treebookPanel, wxID_ANY );
m_treebook = new WX_TREEBOOK( treebookPanel, wxID_ANY );
m_treebook->SetFont( KIUI::GetControlFont( this ) );
m_treebook->SetFitToCurrentPage( true );
long treeCtrlFlags = m_treebook->GetTreeCtrl()->GetWindowStyleFlag();
treeCtrlFlags = ( treeCtrlFlags & ~wxBORDER_MASK ) | wxBORDER_NONE;
@@ -233,7 +235,7 @@ bool PAGED_DIALOG::TransferDataToWindow()
}
lastPageIndex = std::max( 0, lastPageIndex );
m_treebook->ChangeSelection( lastPageIndex );
m_treebook->SetSelection( lastPageIndex );
UpdateResetButton( lastPageIndex );
return true;
@@ -269,6 +271,20 @@ bool PAGED_DIALOG::TransferDataFromWindow()
}
PAGED_DIALOG* PAGED_DIALOG::GetDialog( wxWindow* aParent )
{
while( aParent )
{
if( PAGED_DIALOG* parentDialog = dynamic_cast<PAGED_DIALOG*>( aParent ) )
return parentDialog;
aParent = aParent->GetParent();
}
return nullptr;
}
void PAGED_DIALOG::SetError( const wxString& aMessage, const wxString& aPageName, int aCtrlId,
int aRow, int aCol )
{
@@ -279,46 +295,43 @@ void PAGED_DIALOG::SetError( const wxString& aMessage, const wxString& aPageName
void PAGED_DIALOG::SetError( const wxString& aMessage, wxWindow* aPage, wxWindow* aCtrl,
int aRow, int aCol )
{
if( aCtrl )
m_infoBar->ShowMessageFor( aMessage, 10000, wxICON_WARNING );
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( aCtrl ) )
{
m_infoBar->ShowMessageFor( aMessage, 10000, wxICON_WARNING );
textCtrl->SetSelection( -1, -1 );
textCtrl->SetFocus();
return;
}
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( aCtrl ) )
if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( aCtrl ) )
{
if( aRow > 0 )
{
textCtrl->SetSelection( -1, -1 );
textCtrl->SetFocus();
return;
int pos = scintilla->PositionFromLine( aRow - 1 ) + ( aCol - 1 );
scintilla->GotoPos( pos );
}
if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( aCtrl ) )
{
if( aRow > 0 )
{
int pos = scintilla->PositionFromLine( aRow - 1 ) + ( aCol - 1 );
scintilla->GotoPos( pos );
}
scintilla->SetFocus();
return;
}
scintilla->SetFocus();
return;
}
if( wxGrid* grid = dynamic_cast<wxGrid*>( aCtrl ) )
{
grid->SetFocus();
grid->MakeCellVisible( aRow, aCol );
grid->SetGridCursor( aRow, aCol );
if( wxGrid* grid = dynamic_cast<wxGrid*>( aCtrl ) )
{
grid->SetFocus();
grid->MakeCellVisible( aRow, aCol );
grid->SetGridCursor( aRow, aCol );
grid->EnableCellEditControl( true );
grid->ShowCellEditControl();
return;
}
grid->EnableCellEditControl( true );
grid->ShowCellEditControl();
return;
}
}
void PAGED_DIALOG::UpdateResetButton( int aPage )
{
wxWindow* panel = m_treebook->GetPage( aPage );
wxWindow* panel = m_treebook->ResolvePage( aPage );
// Enable the reset button only if the page is re-settable
if( m_resetButton )
@@ -395,6 +408,22 @@ void PAGED_DIALOG::onPageChanged( wxBookCtrlEvent& event )
UpdateResetButton( page );
// Make sure the dialog size is enough to fit the page content.
m_treebook->InvalidateBestSize();
SetMinSize( wxDefaultSize );
wxSize minSize = GetBestSize();
minSize.IncTo( wxSize( 600, 500 ) );
minSize.DecTo( wxSize( 1500, 900 ) ); // Failsafe
SetMinSize( minSize );
wxSize currentSize = GetSize();
wxSize newSize = currentSize;
newSize.IncTo( minSize );
if( newSize != currentSize )
SetSize( newSize );
#ifdef __WXMAC__
// Work around an OSX wxWidgets issue where the wxGrid children don't get placed correctly
// until the first resize event
@@ -442,7 +471,7 @@ void PAGED_DIALOG::onResetButton( wxCommandEvent& aEvent )
return;
// NB: dynamic_cast doesn't work over Kiway
wxWindow* panel = m_treebook->GetPage( sel );
wxWindow* panel = m_treebook->ResolvePage( sel );
if( panel )
{
+1
View File
@@ -382,6 +382,7 @@ void WX_COLLAPSIBLE_PANE_HEADER::onChar( wxKeyEvent& aEvent )
{
case WXK_SPACE:
case WXK_RETURN:
case WXK_NUMPAD_ENTER:
doSetCollapsed( !m_collapsed );
break;
+1 -1
View File
@@ -462,7 +462,7 @@ bool WX_GRID::CancelPendingChanges()
wxGridCellAttr* attr = GetCellAttr( row, col );
wxGridCellEditor* editor = attr->GetEditor( this, row, col );
bool changed = editor->EndEdit( row, col, this, oldval, &newval );
editor->EndEdit( row, col, this, oldval, &newval );
editor->DecRef();
attr->DecRef();
+107
View File
@@ -0,0 +1,107 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 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, 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
*/
#include <widgets/wx_treebook.h>
#include <wx/panel.h>
#include <wx/sizer.h>
class LAZY_PAGE : public wxPanel
{
public:
LAZY_PAGE( wxWindow* aParent, std::function<wxWindow*( wxWindow* aParent )> aLazyCtor ) :
wxPanel( aParent, wxID_ANY ),
m_lazyCtor( std::move( aLazyCtor ) ),
m_mainSizer( nullptr ),
m_contents( nullptr )
{
m_mainSizer = new wxBoxSizer( wxVERTICAL );
SetSizer( m_mainSizer );
}
wxWindow* Resolve()
{
if( !m_contents )
{
m_contents = m_lazyCtor( this );
m_mainSizer->Add( m_contents, 1, wxEXPAND, 5 );
m_mainSizer->Layout();
m_contents->TransferDataToWindow();
}
return m_contents;
}
bool Show( bool show ) override
{
if( show )
Resolve();
// m_contents has been created as a child window of LAZY_PAGE, and has been added to
// LAZY_PAGE's m_mainSizer. So wxPanel::Show() should call m_contents' Show() method,
// whether overridden or not. Only it doesn't, so we call it directly here.
if( show && m_contents )
m_contents->Show( true );
return wxPanel::Show( show );
}
private:
std::function<wxWindow*( wxWindow* aParent )> m_lazyCtor;
wxSizer* m_mainSizer;
wxWindow* m_contents;
};
WX_TREEBOOK::WX_TREEBOOK( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name ) :
wxTreebook( parent, id, pos, size, style, name )
{
}
bool WX_TREEBOOK::AddLazyPage( std::function<wxWindow*( wxWindow* aParent )> aLazyCtor,
const wxString& text, bool bSelect, int imageId )
{
return AddPage( new LAZY_PAGE( this, std::move( aLazyCtor ) ), text, bSelect, imageId );
}
bool WX_TREEBOOK::AddLazySubPage( std::function<wxWindow*( wxWindow* aParent )> aLazyCtor,
const wxString& text, bool bSelect, int imageId )
{
return AddSubPage( new LAZY_PAGE( this, std::move( aLazyCtor ) ), text, bSelect, imageId );
}
wxWindow* WX_TREEBOOK::ResolvePage( size_t aPage )
{
wxWindow* page = GetPage( aPage );
if( LAZY_PAGE* lazyPage = dynamic_cast<LAZY_PAGE*>( page ) )
return lazyPage->Resolve();
return page;
}
-6
View File
@@ -225,12 +225,6 @@ void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
}
void DISPLAY_FOOTPRINTS_FRAME::doCloseWindow()
{
Destroy();
}
void DISPLAY_FOOTPRINTS_FRAME::ReCreateVToolbar()
{
// Currently, no vertical right toolbar.
-2
View File
@@ -46,8 +46,6 @@ public:
DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aParent );
~DISPLAY_FOOTPRINTS_FRAME() override;
void doCloseWindow() override;
void ReCreateHToolbar() override;
void ReCreateVToolbar() override;
void ReCreateOptToolbar() override;
+22 -1
View File
@@ -2,7 +2,7 @@
* 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.
* Copyright (C) 2023 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
@@ -161,8 +161,29 @@ int CVPCB_CONTROL::ShowFootprintViewer( const TOOL_EVENT& aEvent )
if( !fpframe )
{
// DISPLAY_FOOTPRINTS_FRAME needs a PCBNEW_SETTINGS because most of its settings
// come from it, and needs _pcbnew.dll/so code. So load it if the dll is not yet loaded
// (for instance if the board editor was never loaded)
if( !m_frame->Kiway().KiFACE( KIWAY::FACE_PCB, false ) )
{
try
{
m_frame->Kiway().KiFACE( KIWAY::FACE_PCB, true );
}
catch( ... )
{
// _pcbnew.dll/so is not available (install problem).
}
}
fpframe = (DISPLAY_FOOTPRINTS_FRAME*) m_frame->Kiway().Player( FRAME_CVPCB_DISPLAY, true,
m_frame );
if( !fpframe )
{
wxMessageBox( _( "Unable to create the footprint viewer frame" ) );
return 0;
}
fpframe->Show( true );
}
else
+12 -11
View File
@@ -1300,33 +1300,34 @@ void CONNECTION_GRAPH::generateBusAliasMembers()
{
std::vector<CONNECTION_SUBGRAPH*> new_subgraphs;
SCH_CONNECTION dummy( this );
for( auto&& subgraph : m_driver_subgraphs )
for( CONNECTION_SUBGRAPH* subgraph : m_driver_subgraphs )
{
auto vec = subgraph->GetAllBusLabels();
SCH_ITEM_SET vec = subgraph->GetAllBusLabels();
for( auto& item : vec )
for( SCH_ITEM* item : vec )
{
SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( item );
SCH_CONNECTION dummy( item, subgraph->m_sheet );
dummy.SetGraph( this );
dummy.ConfigureFromLabel( label->GetText() );
wxLogTrace( ConnTrace, wxS( "new bus label (%s)" ), label->GetText() );
for( auto& conn : dummy.Members() )
for( const auto& conn : dummy.Members() )
{
wxString name = conn->FullLocalName();
CONNECTION_SUBGRAPH* new_sg = new CONNECTION_SUBGRAPH( this );
SCH_CONNECTION* new_conn = new SCH_CONNECTION( this );
SCH_CONNECTION* new_conn = new SCH_CONNECTION( item, subgraph->m_sheet );
new_conn->SetGraph( this );
new_conn->SetName( name );
new_conn->SetType( CONNECTION_TYPE::NET );
int code = assignNewNetCode( *new_conn );
wxLogTrace( ConnTrace, wxS( "SG(%ld), Adding full local name (%s) with sg (%d)" ), subgraph->m_code,
name, code );
wxLogTrace( ConnTrace, wxS( "SG(%ld), Adding full local name (%s) with sg (%d) on subsheet %s" ), subgraph->m_code,
name, code, subgraph->m_sheet.PathHumanReadable() );
new_sg->m_driver_connection = new_conn;
new_sg->m_code = m_last_subgraph_code++;
@@ -2320,8 +2321,8 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph, boo
}
else if( aSubgraph->m_hier_ports.empty() && aSubgraph->m_hier_pins.empty() )
{
wxLogTrace( ConnTrace, wxS( "%lu (%s) has no hier pins or ports; marking clean" ),
aSubgraph->m_code, conn->Name() );
wxLogTrace( ConnTrace, wxS( "%lu (%s) has no hier pins or ports on sheet %s; marking clean" ),
aSubgraph->m_code, conn->Name(), aSubgraph->m_sheet.PathHumanReadable() );
aSubgraph->m_dirty = false;
return;
}
+3 -3
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2023 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
@@ -207,9 +207,9 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
wxString netName = FROM_UTF8( text );
if( auto sg = Schematic().ConnectionGraph()->FindFirstSubgraphByName( netName ) )
m_highlightedConn = sg->m_driver_connection;
m_highlightedConn = sg->m_driver_connection->Name();
else
m_highlightedConn = nullptr;
m_highlightedConn = wxEmptyString;
GetToolManager()->RunAction( EE_ACTIONS::updateNetHighlighting, true );
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-2023 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
@@ -202,9 +202,9 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
m_netFilter->SetValue( g_netFilter );
m_netFilterOpt->SetValue( true );
}
else if( m_parent->GetHighlightedConnection() )
else if( !m_parent->GetHighlightedConnection().IsEmpty() )
{
m_netFilter->SetValue( m_parent->GetHighlightedConnection()->Name() );
m_netFilter->SetValue( m_parent->GetHighlightedConnection() );
}
else if( m_selection.GetSize() )
{
@@ -371,6 +371,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
m_parent->SetCurrentSheet( sheetList[ page - 1 ] );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
m_parent->RecomputeIntersheetRefs();
screen = m_parent->GetCurrentSheet().LastScreen();
PrintPage( screen );
m_parent->SetCurrentSheet( oldsheetpath );
@@ -430,7 +431,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
COLOR_SETTINGS* theme = mgr.GetColorSettings( cfg->m_Printing.color_theme );
// Change scale factor and offset to print the whole page.
bool printReference = cfg->m_Printing.title_block;
bool printDrawingSheet = cfg->m_Printing.title_block;
pageSizeIU = aScreen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
FitThisSizeToPaper( pageSizeIU );
@@ -519,7 +520,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
renderSettings.SetDefaultFont( cfg->m_Appearance.default_font );
if( printReference )
if( printDrawingSheet )
{
m_parent->PrintDrawingSheet( &renderSettings, aScreen, aScreen->Schematic()->GetProperties(),
schIUScale.IU_PER_MILS, aScreen->GetFileName(), wxEmptyString );
+1 -1
View File
@@ -124,7 +124,7 @@ void DIALOG_SCH_FIND::OnUpdateReplaceAllUI( wxUpdateUIEvent& aEvent )
void DIALOG_SCH_FIND::OnChar( wxKeyEvent& aEvent )
{
if( aEvent.GetKeyCode() == WXK_RETURN )
if( aEvent.GetKeyCode() == WXK_RETURN || aEvent.GetKeyCode() == WXK_NUMPAD_ENTER )
{
wxCommandEvent dummyCommand;
OnFind( dummyCommand );
+77 -38
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2023 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
@@ -34,56 +34,80 @@
#include <settings/settings_manager.h>
#include "dialog_schematic_setup.h"
#include "panel_template_fieldnames.h"
#include <wx/treebook.h>
DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
PAGED_DIALOG( aFrame, _( "Schematic Setup" ), true,
_( "Import Settings from Another Project..." ) ),
m_frame( aFrame ),
m_severities( nullptr )
_( "Import Settings from Another Project..." ), wxSize( 920, 460 ) ),
m_frame( aFrame )
{
PROJECT_FILE& project = aFrame->Prj().GetProjectFile();
SCHEMATIC& schematic = aFrame->Schematic();
SCHEMATIC_SETTINGS& settings = schematic.Settings();
SetEvtHandlerEnabled( false );
m_formatting = new PANEL_SETUP_FORMATTING( m_treebook, aFrame );
m_fieldNameTemplates = new PANEL_TEMPLATE_FIELDNAMES( m_treebook,
&settings.m_TemplateFieldNames );
m_pinMap = new PANEL_SETUP_PINMAP( m_treebook, aFrame );
m_pinToPinError = ERC_ITEM::Create( ERCE_PIN_TO_PIN_WARNING );
m_severities = new PANEL_SETUP_SEVERITIES( this, ERC_ITEM::GetItemsWithSeverities(),
schematic.ErcSettings().m_ERCSeverities,
m_pinToPinError.get() );
m_textVars = new PANEL_TEXT_VARIABLES( m_treebook, &Prj() );
m_netclasses = new PANEL_SETUP_NETCLASSES( this, aFrame, project.NetSettings(),
schematic.GetNetClassAssignmentCandidates(), true );
m_buses = new PANEL_SETUP_BUSES( m_treebook, aFrame );
/*
* WARNING: If you change page names you MUST update calls to ShowSchematicSetupDialog().
*/
m_treebook->AddPage( new wxPanel( GetTreebook() ), _( "General" ) );
m_treebook->AddSubPage( m_formatting, _( "Formatting" ) );
m_treebook->AddSubPage( m_fieldNameTemplates, _( "Field Name Templates" ) );
m_formattingPage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_SETUP_FORMATTING( aParent, m_frame );
}, _( "Formatting" ) );
m_fieldNameTemplatesPage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings();
return new PANEL_TEMPLATE_FIELDNAMES( aParent, &settings.m_TemplateFieldNames );
}, _( "Field Name Templates" ) );
m_treebook->AddPage( new wxPanel( GetTreebook() ), _( "Electrical Rules" ) );
m_treebook->AddSubPage( m_severities, _( "Violation Severity" ) );
m_treebook->AddSubPage( m_pinMap, _( "Pin Conflicts Map" ) );
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
ERC_SETTINGS& ercSettings = m_frame->Schematic().ErcSettings();
return new PANEL_SETUP_SEVERITIES( aParent, ERC_ITEM::GetItemsWithSeverities(),
ercSettings.m_ERCSeverities,
m_pinToPinError.get() );
}, _( "Violation Severity" ) );
m_pinMapPage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_SETUP_PINMAP( aParent, m_frame );
}, _( "Pin Conflicts Map" ) );
m_treebook->AddPage( new wxPanel( GetTreebook() ), _( "Project" ) );
m_treebook->AddSubPage( m_netclasses, _( "Net Classes" ) );
m_treebook->AddSubPage( m_buses, _( "Bus Alias Definitions" ) );
m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) );
m_netclassesPage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
SCHEMATIC& schematic = m_frame->Schematic();
return new PANEL_SETUP_NETCLASSES( aParent, m_frame,
m_frame->Prj().GetProjectFile().NetSettings(),
schematic.GetNetClassAssignmentCandidates(),
true );
}, _( "Net Classes" ) );
m_busesPage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_SETUP_BUSES( aParent, m_frame );
}, _( "Bus Alias Definitions" ) );
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_TEXT_VARIABLES( aParent, &Prj() );
}, _( "Text Variables" ) );
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
m_treebook->ExpandNode( i );
@@ -148,19 +172,34 @@ void DIALOG_SCHEMATIC_SETUP::onAuxiliaryAction( wxCommandEvent& event )
file.m_SchematicSettings->LoadFromFile();
if( importDlg.m_FormattingOpt->GetValue() )
m_formatting->ImportSettingsFrom( *file.m_SchematicSettings );
{
static_cast<PANEL_SETUP_FORMATTING*>( m_treebook->ResolvePage( m_formattingPage ) )
->ImportSettingsFrom( *file.m_SchematicSettings );
}
if( importDlg.m_FieldNameTemplatesOpt->GetValue() )
m_fieldNameTemplates->ImportSettingsFrom( &otherSch.Settings().m_TemplateFieldNames );
{
static_cast<PANEL_TEMPLATE_FIELDNAMES*>( m_treebook->ResolvePage( m_fieldNameTemplatesPage ) )
->ImportSettingsFrom( &otherSch.Settings().m_TemplateFieldNames );
}
if( importDlg.m_PinMapOpt->GetValue() )
m_pinMap->ImportSettingsFrom( file.m_ErcSettings->m_PinMap );
{
static_cast<PANEL_SETUP_PINMAP*>( m_treebook->ResolvePage( m_pinMapPage ) )
->ImportSettingsFrom( file.m_ErcSettings->m_PinMap );
}
if( importDlg.m_SeveritiesOpt->GetValue() )
m_severities->ImportSettingsFrom( file.m_ErcSettings->m_ERCSeverities );
{
static_cast<PANEL_SETUP_SEVERITIES*>( m_treebook->ResolvePage( m_severitiesPage ) )
->ImportSettingsFrom( file.m_ErcSettings->m_ERCSeverities );
}
if( importDlg.m_NetClassesOpt->GetValue() )
m_netclasses->ImportSettingsFrom( file.m_NetSettings );
{
static_cast<PANEL_SETUP_NETCLASSES*>( m_treebook->ResolvePage( m_netclassesPage ) )
->ImportSettingsFrom( file.m_NetSettings );
}
m_frame->GetSettingsManager()->UnloadProject( otherPrj, false );
}
+10 -10
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2023 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
@@ -45,16 +45,16 @@ protected:
void onPageChanged( wxBookCtrlEvent& aEvent ) override;
void onAuxiliaryAction( wxCommandEvent& aEvent ) override;
SCH_EDIT_FRAME* m_frame;
SCH_EDIT_FRAME* m_frame;
PANEL_SETUP_FORMATTING* m_formatting;
PANEL_TEMPLATE_FIELDNAMES* m_fieldNameTemplates;
PANEL_SETUP_PINMAP* m_pinMap;
PANEL_SETUP_SEVERITIES* m_severities;
PANEL_SETUP_NETCLASSES* m_netclasses;
PANEL_SETUP_BUSES* m_buses;
PANEL_TEXT_VARIABLES* m_textVars;
std::shared_ptr<ERC_ITEM> m_pinToPinError;
std::shared_ptr<ERC_ITEM> m_pinToPinError;
size_t m_formattingPage;
size_t m_fieldNameTemplatesPage;
size_t m_pinMapPage;
size_t m_busesPage;
size_t m_severitiesPage;
size_t m_netclassesPage;
};
+1 -1
View File
@@ -601,7 +601,7 @@ void DIALOG_SIM_COMMAND::updateDCUnits( wxChar aType, wxChoice* aSource,
void DIALOG_SIM_COMMAND::loadDirectives()
{
if( m_circuitModel )
m_customTxt->SetValue( m_circuitModel->GetSheetSimCommand() );
m_customTxt->SetValue( m_circuitModel->GetSchTextSimCommand() );
}
+4
View File
@@ -97,6 +97,10 @@ DIALOG_SIM_MODEL<T_symbol, T_field>::DIALOG_SIM_MODEL( wxWindow* aParent, T_symb
grid->DedicateKey( WXK_RETURN );
grid->AddActionTrigger( wxPG_ACTION_NEXT_PROPERTY, WXK_RETURN );
grid->AddActionTrigger( wxPG_ACTION_EDIT, WXK_NUMPAD_ENTER );
grid->DedicateKey( WXK_NUMPAD_ENTER );
grid->AddActionTrigger( wxPG_ACTION_NEXT_PROPERTY, WXK_NUMPAD_ENTER );
grid->DedicateKey( WXK_UP );
grid->DedicateKey( WXK_DOWN );
@@ -37,6 +37,8 @@ PANEL_EESCHEMA_ANNOTATION_OPTIONS::PANEL_EESCHEMA_ANNOTATION_OPTIONS(
PANEL_EESCHEMA_ANNOTATION_OPTIONS_BASE( aWindow ),
m_schSettingsProvider( schSettingsProvider )
{
annotate_down_right_bitmap->SetBitmap( KiBitmap( BITMAPS::annotate_down_right ) );
annotate_right_down_bitmap->SetBitmap( KiBitmap( BITMAPS::annotate_right_down ) );
}
@@ -72,9 +74,6 @@ void PANEL_EESCHEMA_ANNOTATION_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS*
}
m_textNumberAfter->SetValue( wxString::Format( wxT( "%d" ), annotateStartNum ) );
annotate_down_right_bitmap->SetBitmap( KiBitmap( BITMAPS::annotate_down_right ) );
annotate_right_down_bitmap->SetBitmap( KiBitmap( BITMAPS::annotate_right_down ) );
}
@@ -29,7 +29,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
bRightColumn->Add( m_appearanceLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bRightColumn->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM, 5 );
bRightColumn->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM, 7 );
wxBoxSizer* bAppearanceSizer;
bAppearanceSizer = new wxBoxSizer( wxVERTICAL );
@@ -48,7 +48,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
bSizer4->Add( m_defaultFontCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
bAppearanceSizer->Add( bSizer4, 1, wxEXPAND|wxTOP, 5 );
bAppearanceSizer->Add( bSizer4, 1, wxEXPAND, 5 );
m_checkShowHiddenPins = new wxCheckBox( this, wxID_ANY, _("S&how hidden pins"), wxDefaultPosition, wxDefaultSize, 0 );
bAppearanceSizer->Add( m_checkShowHiddenPins, 0, wxEXPAND|wxALL, 5 );
@@ -73,20 +73,20 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
bRightColumn->Add( bAppearanceSizer, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
bRightColumn->Add( 0, 15, 0, wxEXPAND, 5 );
bRightColumn->Add( 0, 7, 0, wxEXPAND, 5 );
m_selectionLabel = new wxStaticText( this, wxID_ANY, _("Selection && Highlighting"), wxDefaultPosition, wxDefaultSize, 0 );
m_selectionLabel->Wrap( -1 );
bRightColumn->Add( m_selectionLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bRightColumn->Add( m_staticline2, 0, wxEXPAND|wxBOTTOM, 5 );
bRightColumn->Add( m_staticline2, 0, wxEXPAND|wxBOTTOM, 7 );
wxBoxSizer* bSelectionSizer;
bSelectionSizer = new wxBoxSizer( wxVERTICAL );
m_checkSelDrawChildItems = new wxCheckBox( this, wxID_ANY, _("Draw selected child items"), wxDefaultPosition, wxDefaultSize, 0 );
bSelectionSizer->Add( m_checkSelDrawChildItems, 0, wxEXPAND|wxALL, 5 );
bSelectionSizer->Add( m_checkSelDrawChildItems, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkSelFillShapes = new wxCheckBox( this, wxID_ANY, _("Fill selected shapes"), wxDefaultPosition, wxDefaultSize, 0 );
bSelectionSizer->Add( m_checkSelFillShapes, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@@ -124,14 +124,14 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
bRightColumn->Add( bSelectionSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bRightColumn->Add( 0, 15, 0, wxEXPAND, 5 );
bRightColumn->Add( 0, 7, 0, wxEXPAND, 5 );
m_crossprobeLabel = new wxStaticText( this, wxID_ANY, _("Cross-probing"), wxDefaultPosition, wxDefaultSize, 0 );
m_crossprobeLabel->Wrap( -1 );
bRightColumn->Add( m_crossprobeLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bRightColumn->Add( m_staticline3, 0, wxEXPAND|wxBOTTOM, 5 );
bRightColumn->Add( m_staticline3, 0, wxEXPAND|wxBOTTOM, 7 );
wxBoxSizer* bCrossProbingSizer;
bCrossProbingSizer = new wxBoxSizer( wxVERTICAL );
@@ -140,7 +140,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
m_checkCrossProbeOnSelection->SetValue(true);
m_checkCrossProbeOnSelection->SetToolTip( _("Highlight symbols corresponding to selected footprints") );
bCrossProbingSizer->Add( m_checkCrossProbeOnSelection, 0, wxALL, 5 );
bCrossProbingSizer->Add( m_checkCrossProbeOnSelection, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkCrossProbeCenter = new wxCheckBox( this, wxID_ANY, _("Center view on cross-probed items"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkCrossProbeCenter->SetValue(true);
@@ -139,7 +139,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="border">7</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
@@ -207,7 +207,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -732,7 +732,7 @@
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">15</property>
<property name="height">7</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
@@ -799,7 +799,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="border">7</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
@@ -867,7 +867,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@@ -1343,7 +1343,7 @@
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">15</property>
<property name="height">7</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
@@ -1410,7 +1410,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="border">7</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
@@ -1478,7 +1478,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@@ -68,9 +68,11 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aC
COLOR4D schematicBackground = settings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
m_borderColorSwatch->SetDefaultColor( settings->GetDefaultColor( LAYER_SHEET ) );
m_borderColorSwatch->SetSwatchColor( aCfg->m_Drawing.default_sheet_border_color, false );
m_backgroundColorSwatch->SetSwatchBackground( schematicBackground );
m_backgroundColorSwatch->SetDefaultColor( settings->GetDefaultColor( LAYER_SHEET_BACKGROUND ) );
m_backgroundColorSwatch->SetSwatchColor( aCfg->m_Drawing.default_sheet_background_color, false );
m_choiceLineMode->SetSelection( aCfg->m_Drawing.line_mode );
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -150,6 +150,7 @@ PANEL_SYM_EDITING_OPTIONS_BASE::PANEL_SYM_EDITING_OPTIONS_BASE( wxWindow* parent
this->SetSizer( p1mainSizer );
this->Layout();
p1mainSizer->Fit( this );
}
PANEL_SYM_EDITING_OPTIONS_BASE::~PANEL_SYM_EDITING_OPTIONS_BASE()
@@ -45,7 +45,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_SYM_EDITING_OPTIONS_BASE</property>
<property name="pos"></property>
<property name="size">381,396</property>
<property name="size">-1,-1</property>
<property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -66,7 +66,7 @@ class PANEL_SYM_EDITING_OPTIONS_BASE : public RESETTABLE_PANEL
public:
PANEL_SYM_EDITING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 381,396 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_SYM_EDITING_OPTIONS_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_SYM_EDITING_OPTIONS_BASE();
+2 -2
View File
@@ -891,7 +891,7 @@ bool PANEL_SYM_LIB_TABLE::TransferDataFromWindow()
m_globalTable->Clear();
m_globalTable->m_rows.transfer( m_globalTable->m_rows.end(), global_model()->m_rows.begin(),
global_model()->m_rows.end(), global_model()->m_rows );
m_globalTable->reindex( true );
m_globalTable->reindex();
}
if( project_model() && *project_model() != *m_projectTable )
@@ -901,7 +901,7 @@ bool PANEL_SYM_LIB_TABLE::TransferDataFromWindow()
m_projectTable->Clear();
m_projectTable->m_rows.transfer( m_projectTable->m_rows.end(), project_model()->m_rows.begin(),
project_model()->m_rows.end(), project_model()->m_rows );
m_projectTable->reindex( true );
m_projectTable->reindex();
}
return true;
+12 -60
View File
@@ -19,15 +19,14 @@
*/
#include "eeschema_jobs_handler.h"
#include <pgm_base.h>
#include <cli/exit_codes.h>
#include <sch_plotter.h>
#include <jobs/job_export_sch_pythonbom.h>
#include <jobs/job_export_sch_netlist.h>
#include <jobs/job_export_sch_pdf.h>
#include <jobs/job_export_sch_svg.h>
#include <jobs/job_export_sch_plot.h>
#include <jobs/job_sym_export_svg.h>
#include <jobs/job_sym_upgrade.h>
#include <pgm_base.h>
#include <sch_plotter.h>
#include <schematic.h>
#include <wx/crt.h>
#include <wx/dir.h>
@@ -63,10 +62,8 @@ EESCHEMA_JOBS_HANDLER::EESCHEMA_JOBS_HANDLER()
std::bind( &EESCHEMA_JOBS_HANDLER::JobExportPythonBom, this, std::placeholders::_1 ) );
Register( "netlist",
std::bind( &EESCHEMA_JOBS_HANDLER::JobExportNetlist, this, std::placeholders::_1 ) );
Register( "pdf",
std::bind( &EESCHEMA_JOBS_HANDLER::JobExportPdf, this, std::placeholders::_1 ) );
Register( "svg",
std::bind( &EESCHEMA_JOBS_HANDLER::JobExportSvg, this, std::placeholders::_1 ) );
Register( "plot",
std::bind( &EESCHEMA_JOBS_HANDLER::JobExportPlot, this, std::placeholders::_1 ) );
Register( "symupgrade",
std::bind( &EESCHEMA_JOBS_HANDLER::JobSymUpgrade, this, std::placeholders::_1 ) );
Register( "symsvg",
@@ -109,14 +106,14 @@ REPORTER& EESCHEMA_JOBS_HANDLER::Report( const wxString& aText, SEVERITY aSeveri
}
int EESCHEMA_JOBS_HANDLER::JobExportPdf( JOB* aJob )
int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
{
JOB_EXPORT_SCH_PDF* aPdfJob = dynamic_cast<JOB_EXPORT_SCH_PDF*>( aJob );
JOB_EXPORT_SCH_PLOT* aPlotJob = dynamic_cast<JOB_EXPORT_SCH_PLOT*>( aJob );
if( !aPdfJob )
if( !aPlotJob )
return CLI::EXIT_CODES::ERR_UNKNOWN;
SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aPdfJob->m_filename, SCH_IO_MGR::SCH_KICAD );
SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aPlotJob->m_filename, SCH_IO_MGR::SCH_KICAD );
if( sch == nullptr )
{
@@ -126,56 +123,10 @@ int EESCHEMA_JOBS_HANDLER::JobExportPdf( JOB* aJob )
std::unique_ptr<KIGFX::SCH_RENDER_SETTINGS> renderSettings =
std::make_unique<KIGFX::SCH_RENDER_SETTINGS>();
InitRenderSettings( renderSettings.get(), aPdfJob->m_colorTheme, sch );
InitRenderSettings( renderSettings.get(), aPlotJob->settings.m_theme, sch );
std::unique_ptr<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( sch );
SCH_PLOT_SETTINGS settings;
settings.m_plotAll = true;
settings.m_plotDrawingSheet = aPdfJob->m_plotDrawingSheet;
settings.m_blackAndWhite = aPdfJob->m_blackAndWhite;
settings.m_theme = aPdfJob->m_colorTheme;
settings.m_useBackgroundColor = aPdfJob->m_useBackgroundColor;
settings.m_pageSizeSelect = PAGE_SIZE_AUTO;
settings.m_outputFile = aPdfJob->m_outputFile;
schPlotter->Plot( PLOT_FORMAT::PDF, settings, renderSettings.get(), this );
return CLI::EXIT_CODES::OK;
}
int EESCHEMA_JOBS_HANDLER::JobExportSvg( JOB* aJob )
{
JOB_EXPORT_SCH_SVG* aSvgJob = dynamic_cast<JOB_EXPORT_SCH_SVG*>( aJob );
if( !aSvgJob )
return CLI::EXIT_CODES::ERR_UNKNOWN;
SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aSvgJob->m_filename, SCH_IO_MGR::SCH_KICAD );
if( sch == nullptr )
{
wxFprintf( stderr, _( "Failed to load schematic file\n" ) );
return CLI::EXIT_CODES::ERR_INVALID_INPUT_FILE;
}
std::unique_ptr<KIGFX::SCH_RENDER_SETTINGS> renderSettings =
std::make_unique<KIGFX::SCH_RENDER_SETTINGS>();
InitRenderSettings( renderSettings.get(), aSvgJob->m_colorTheme, sch );
std::unique_ptr<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( sch );
SCH_PLOT_SETTINGS settings;
settings.m_plotAll = true;
settings.m_plotDrawingSheet = aSvgJob->m_plotDrawingSheet;
settings.m_blackAndWhite = aSvgJob->m_blackAndWhite;
settings.m_theme = aSvgJob->m_colorTheme;
settings.m_pageSizeSelect = PAGE_SIZE_AUTO;
settings.m_outputDirectory = aSvgJob->m_outputDirectory;
settings.m_useBackgroundColor = aSvgJob->m_useBackgroundColor;
schPlotter->Plot( PLOT_FORMAT::SVG, settings, renderSettings.get(), this );
schPlotter->Plot( aPlotJob->m_plotFormat, aPlotJob->settings, renderSettings.get(), this );
return CLI::EXIT_CODES::OK;
}
@@ -403,6 +354,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
if( convert == 2 )
filename += wxS( "_demorgan" );
fn.SetName( filename );
wxPrintf( _( "Plotting symbol '%s' to '%s'\n" ), symbol->GetName(), fn.GetFullPath() );
}
+1 -2
View File
@@ -43,8 +43,7 @@ public:
EESCHEMA_JOBS_HANDLER();
int JobExportPythonBom( JOB* aJob );
int JobExportNetlist( JOB* aJob );
int JobExportPdf( JOB* aJob );
int JobExportSvg( JOB* aJob );
int JobExportPlot( JOB* aJob );
int JobSymUpgrade( JOB* aJob );
int JobSymExportSvg( JOB* aJob );
+11 -1
View File
@@ -33,6 +33,7 @@
#include <id.h>
#include <kiface_base.h>
#include <kiplatform/app.h>
#include <lockfile.h>
#include <pgm_base.h>
#include <profile.h>
#include <project/project_file.h>
@@ -69,6 +70,8 @@
#include <widgets/wx_progress_reporters.h>
#include <widgets/wx_html_report_box.h>
#include <kiplatform/io.h>
#if wxCHECK_VERSION( 3, 1, 7 )
#include "widgets/filedlg_hook_save_project.h"
#else
@@ -102,6 +105,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
if( !OverrideLock( this, msg ) )
return false;
m_file_checker->OverrideLock( false );
}
if( !AskToSaveChanges() )
@@ -727,6 +732,8 @@ bool SCH_EDIT_FRAME::saveSchematicFile( SCH_SHEET* aSheet, const wxString& aSave
if( success )
{
// Preserve the permissions of the current file
KIPLATFORM::IO::DuplicatePermissions( schematicFileName.GetFullPath(), tempFile );
// Replace the original with the temporary file we just wrote
success = wxRenameFile( tempFile, schematicFileName.GetFullPath() );
@@ -1210,10 +1217,13 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
if( !LockFile( aFileName ) )
{
wxString msg;
msg.Printf( _( "Schematic '%s' is already open." ), filename.GetFullName() );
msg.Printf( _( "Schematic '%s' is already open by '%s' at '%s'." ), aFileName,
m_file_checker->GetUsername(), m_file_checker->GetHostname() );
if( !OverrideLock( this, msg ) )
return false;
m_file_checker->OverrideLock();
}
try
+44 -38
View File
@@ -1203,28 +1203,49 @@ void LIB_PIN::ViewGetLayers( int aLayers[], int& aCount ) const
}
void LIB_PIN::validateExtentsCache( KIFONT::FONT* aFont, int aSize, const wxString& aText,
EXTENTS_CACHE* aCache ) const
{
if( aCache->m_Font == aFont
&& aCache->m_FontSize == aSize
&& aCache->m_Extents != VECTOR2I() )
{
return;
}
aCache->m_Font = aFont;
aCache->m_FontSize = aSize;
// Get maximum height including ascenders and descenders
static wxString hText = wxT( "Xg" );
VECTOR2D fontSize( aSize, aSize );
int penWidth = GetPenSizeForNormal( aSize );
aCache->m_Extents.x = aFont->StringBoundaryLimits( aText, fontSize, penWidth, false, false ).x;
aCache->m_Extents.y = aFont->StringBoundaryLimits( hText, fontSize, penWidth, false, false ).y;
}
const BOX2I LIB_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNameAndNumber,
bool aIncludeElectricalType ) const
{
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
KIFONT::FONT* font = KIFONT::FONT::GetFont( cfg->m_Appearance.default_font );
BOX2I bbox;
VECTOR2I begin;
VECTOR2I end;
int pinNameOffset = 0;
int nameTextLength = 0;
int nameTextHeight = 0;
int numberTextLength = 0;
int numberTextHeight = 0;
int typeTextLength = 0;
wxString name = GetShownName();
wxString number = GetShownNumber();
bool includeName = aIncludeNameAndNumber && !name.IsEmpty();
bool includeNumber = aIncludeNameAndNumber && !number.IsEmpty();
bool includeType = aIncludeElectricalType;
int minsizeV = TARGET_PIN_RADIUS;
int penWidth = GetPenWidth();
BOX2I bbox;
VECTOR2I begin;
VECTOR2I end;
int pinNameOffset = 0;
int nameTextLength = 0;
int nameTextHeight = 0;
int numberTextLength = 0;
int numberTextHeight = 0;
int typeTextLength = 0;
bool includeName = aIncludeNameAndNumber && !GetShownName().IsEmpty();
bool includeNumber = aIncludeNameAndNumber && !GetShownNumber().IsEmpty();
bool includeType = aIncludeElectricalType;
int minsizeV = TARGET_PIN_RADIUS;
if( !aIncludeInvisiblePins && !IsVisible() )
{
@@ -1243,33 +1264,18 @@ const BOX2I LIB_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNa
includeNumber = false;
}
// Get maximum height including ascenders and descenders
wxString test = wxT( "Xg" );
if( includeNumber )
{
VECTOR2D fontSize( m_numTextSize, m_numTextSize );
numberTextLength = font->StringBoundaryLimits( number, fontSize, penWidth, false, false ).x;
numberTextHeight = font->StringBoundaryLimits( test, fontSize, penWidth, false, false ).y;
validateExtentsCache( font, m_numTextSize, GetShownNumber(), &m_numExtentsCache );
numberTextLength = m_numExtentsCache.m_Extents.x;
numberTextHeight = m_numExtentsCache.m_Extents.y;
}
if( includeName )
{
VECTOR2D fontSize( m_nameTextSize, m_nameTextSize );
nameTextLength = font->StringBoundaryLimits( name, fontSize, penWidth, false, false ).x
+ pinNameOffset;
nameTextHeight = font->StringBoundaryLimits( test, fontSize, penWidth, false, false ).y
+ schIUScale.MilsToIU( PIN_TEXT_MARGIN );
}
// KIFONT has to be rather tight on boundary limits for knockout text in PCBNew, but in truth
// the stroke font returns a vertically under-sized bounding box (even though it *does* in fact
// attempt to account for the font size being stroke centre-point to stroke centre-point).
if( font->IsStroke() )
{
numberTextHeight += 2 * penWidth;
nameTextHeight += 2 * penWidth;
validateExtentsCache( font, m_nameTextSize, GetShownName(), &m_nameExtentsCache );
nameTextLength = m_nameExtentsCache.m_Extents.x + pinNameOffset;
nameTextHeight = m_nameExtentsCache.m_Extents.y + schIUScale.MilsToIU( PIN_TEXT_MARGIN );
}
if( includeType )
@@ -1290,7 +1296,7 @@ const BOX2I LIB_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNa
// Attempt to mimic SCH_PAINTER's algorithm without actually knowing the schematic text
// offset ratio.
int PIN_TEXT_OFFSET = schIUScale.MilsToIU( 24 ) + 2 * penWidth;
int PIN_TEXT_OFFSET = schIUScale.MilsToIU( 24 );
// Calculate topLeft & bottomRight corner positions for the default pin orientation (PIN_RIGHT)
if( pinNameOffset || !includeName )
+34 -11
View File
@@ -117,6 +117,7 @@ public:
// pin name string does not support spaces
m_name.Replace( wxT( " " ), wxT( "_" ) );
m_nameExtentsCache.m_Extents = VECTOR2I();
}
const wxString& GetNumber() const { return m_number; }
@@ -127,13 +128,22 @@ public:
// pin number string does not support spaces
m_number.Replace( wxT( " " ), wxT( "_" ) );
m_numExtentsCache.m_Extents = VECTOR2I();
}
int GetNameTextSize() const { return m_nameTextSize; }
void SetNameTextSize( int aSize ) { m_nameTextSize = aSize; }
void SetNameTextSize( int aSize )
{
m_nameTextSize = aSize;
m_nameExtentsCache.m_Extents = VECTOR2I();
}
int GetNumberTextSize() const { return m_numTextSize; }
void SetNumberTextSize( int aSize ) { m_numTextSize = aSize; }
void SetNumberTextSize( int aSize )
{
m_numTextSize = aSize;
m_numExtentsCache.m_Extents = VECTOR2I();
}
std::map<wxString, ALT>& GetAlternates() { return m_alternates; }
@@ -250,12 +260,22 @@ public:
static const wxString GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType );
protected:
struct EXTENTS_CACHE
{
KIFONT::FONT* m_Font = nullptr;
int m_FontSize = 0;
VECTOR2I m_Extents;
};
void validateExtentsCache( KIFONT::FONT* aFont, int aSize, const wxString& aText,
EXTENTS_CACHE* aCache ) const;
/**
* Print the pin symbol without text.
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
*/
void printPinSymbol( const RENDER_SETTINGS *aSettings, const VECTOR2I &aPos, int aOrientation,
bool aDimmed );
bool aDimmed );
/**
* Put the pin number and pin text info, given the pin line coordinates.
@@ -287,18 +307,21 @@ private:
int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override;
protected:
VECTOR2I m_position; // Position of the pin.
int m_length; // Length of the pin.
int m_orientation; // Pin orientation (Up, Down, Left, Right)
GRAPHIC_PINSHAPE m_shape; // Shape drawn around pin
ELECTRICAL_PINTYPE m_type; // Electrical type of the pin.
int m_attributes; // Set bit 0 to indicate pin is invisible.
VECTOR2I m_position; // Position of the pin.
int m_length; // Length of the pin.
int m_orientation; // Pin orientation (Up, Down, Left, Right)
GRAPHIC_PINSHAPE m_shape; // Shape drawn around pin
ELECTRICAL_PINTYPE m_type; // Electrical type of the pin.
int m_attributes; // Set bit 0 to indicate pin is invisible.
wxString m_name;
wxString m_number;
int m_numTextSize; // Pin num and Pin name sizes
int m_numTextSize; // Pin num and Pin name sizes
int m_nameTextSize;
std::map<wxString, ALT> m_alternates; // Map of alternate name to ALT structure
std::map<wxString, ALT> m_alternates; // Map of alternate name to ALT structure
mutable EXTENTS_CACHE m_numExtentsCache;
mutable EXTENTS_CACHE m_nameExtentsCache;
};
+3
View File
@@ -133,6 +133,9 @@ void LIB_TEXT::MoveTo( const VECTOR2I& newPosition )
void LIB_TEXT::NormalizeJustification( bool inverse )
{
if( GetHorizJustify() == GR_TEXT_H_ALIGN_CENTER && GetVertJustify() == GR_TEXT_V_ALIGN_CENTER )
return;
VECTOR2I delta( 0, 0 );
BOX2I bbox = GetTextBox();
@@ -94,9 +94,12 @@ SCH_SYMBOL* NETLIST_EXPORTER_BASE::findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PA
wxCHECK( screen, nullptr );
LIB_SYMBOL* libSymbol = screen->GetLibSymbols()[ symbol->GetSchSymbolLibraryName() ];
auto it = screen->GetLibSymbols().find( symbol->GetSchSymbolLibraryName() );
wxCHECK( libSymbol, nullptr );
if( it == screen->GetLibSymbols().end() )
return nullptr;
LIB_SYMBOL* libSymbol = it->second;
// If symbol is a "multi parts per package" type
if( libSymbol->GetUnitCount() > 1 )
+21 -19
View File
@@ -115,8 +115,7 @@ END_EVENT_TABLE()
SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ), wxDefaultPosition,
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ),
m_highlightedConn( nullptr )
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME )
{
m_maximizeByDefault = true;
m_schematic = new SCHEMATIC( nullptr );
@@ -718,7 +717,7 @@ void SCH_EDIT_FRAME::HardRedraw()
for( SCH_ITEM* item : screen->Items() )
item->ClearCaches();
for( std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
for( const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
{
wxCHECK2( libSymbol.second, continue );
libSymbol.second->ClearCaches();
@@ -1442,18 +1441,11 @@ void SCH_EDIT_FRAME::initScreenZoom()
void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
{
const SCH_CONNECTION* highlight = GetHighlightedConnection();
SCH_ITEM* highlightedItem = nullptr;
SCH_SHEET_PATH highlightPath;
if( highlight )
{
highlightPath = highlight->LocalSheet();
highlightedItem = dynamic_cast<SCH_ITEM*>( GetItem( highlight->Parent()->m_Uuid ) );
}
bool highlightedConnChanged = false;
wxString highlightedConn = GetHighlightedConnection();
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
SCH_SHEET_LIST list = Schematic().GetSheets();
#ifdef PROFILE
PROF_TIMER timer;
#endif
@@ -1481,6 +1473,11 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
[&]( SCH_ITEM* aChangedItem ) -> void
{
GetCanvas()->GetView()->Update( aChangedItem, KIGFX::REPAINT );
SCH_CONNECTION* connection = aChangedItem->Connection();
if( connection && ( connection->Name() == highlightedConn ) )
highlightedConnChanged = true;
};
if( !ADVANCED_CFG::GetCfg().m_IncrementalConnectivity || aCleanupFlags == GLOBAL_CLEANUP
@@ -1607,8 +1604,13 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
return flags;
} );
if( highlightedItem )
SetHighlightedConnection( highlightedItem->Connection( &highlightPath ) );
if( !highlightedConn.IsEmpty() )
{
if( highlightedConnChanged )
wxLogDebug( wxS( "Highlighted connection \"%s\" changed." ), highlightedConn );
else if( !Schematic().ConnectionGraph()->FindFirstSubgraphByName( highlightedConn ) )
wxLogDebug( wxS( "Highlighted connection \"%s\" no longer exists." ), highlightedConn );
}
}
@@ -1662,8 +1664,8 @@ void SCH_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
for( SCH_ITEM* item : screen->Items() )
item->ClearCaches();
for( std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
libSymbol.second->ClearCaches();
for( const auto& [ libItemName, libSymbol ] : screen->GetLibSymbols() )
libSymbol->ClearCaches();
GetCanvas()->ForceRefresh();
@@ -1712,10 +1714,10 @@ void SCH_EDIT_FRAME::ShowChangedLanguage()
void SCH_EDIT_FRAME::UpdateNetHighlightStatus()
{
if( const SCH_CONNECTION* conn = GetHighlightedConnection() )
if( !GetHighlightedConnection().IsEmpty() )
{
SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
UnescapeString( conn->Name() ) ) );
UnescapeString( GetHighlightedConnection() ) ) );
}
else
{
+3 -3
View File
@@ -293,12 +293,12 @@ public:
*/
void SendCrossProbeClearHighlight();
const SCH_CONNECTION* GetHighlightedConnection() const
const wxString& GetHighlightedConnection() const
{
return m_highlightedConn;
}
void SetHighlightedConnection( const SCH_CONNECTION* aConnection )
void SetHighlightedConnection( const wxString& aConnection )
{
m_highlightedConn = aConnection;
}
@@ -916,7 +916,7 @@ private:
friend class SCH_FIND_REPLACE_TOOL;
SCHEMATIC* m_schematic; ///< The currently loaded schematic
const SCH_CONNECTION* m_highlightedConn; ///< The highlighted net or bus, or nullptr
wxString m_highlightedConn; ///< The highlighted net or bus or empty string.
wxPageSetupDialogData m_pageSetupData;
std::vector<std::unique_ptr<SCH_ITEM>> m_items_to_repeat; ///< For the repeat-last-item cmd
+21
View File
@@ -376,6 +376,12 @@ void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
*/
textpos = GetBoundingBox().Centre() + aOffset;
if( GetParent() && GetParent()->Type() == SCH_GLOBAL_LABEL_T )
{
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( GetParent() );
textpos += label->GetSchematicTextOffset( aSettings );
}
GRPrintText( DC, textpos, color, GetShownText( true ), orient, GetTextSize(),
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(),
font );
@@ -427,6 +433,21 @@ COLOR4D SCH_FIELD::GetFieldColor() const
}
void SCH_FIELD::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 2;
switch( m_id )
{
case REFERENCE_FIELD: aLayers[0] = LAYER_REFERENCEPART; break;
case VALUE_FIELD: aLayers[0] = LAYER_VALUEPART; break;
default: aLayers[0] = LAYER_FIELDS; break;
}
aLayers[1] = LAYER_SELECTION_SHADOWS;
}
EDA_ANGLE SCH_FIELD::GetDrawRotation() const
{
// Calculate the text orientation according to the symbol orientation.
+2
View File
@@ -144,6 +144,8 @@ public:
m_lastResolvedColor = aField->m_lastResolvedColor;
}
void ViewGetLayers( int aLayers[], int& aCount ) const override;
/**
* Adjusters to allow EDA_TEXT to draw/print/etc. text in absolute coords.
*/
+105 -74
View File
@@ -40,6 +40,7 @@
#include <project/project_file.h>
#include <project/net_settings.h>
#include <core/kicad_algo.h>
#include <core/mirror.h>
#include <trigo.h>
#include <sch_label.h>
@@ -402,6 +403,52 @@ void SCH_LABEL_BASE::MirrorSpinStyle( bool aLeftRight )
}
void SCH_LABEL_BASE::MirrorHorizontally( int aCenter )
{
VECTOR2I old_pos = GetPosition();
SCH_TEXT::MirrorHorizontally( aCenter );
for( SCH_FIELD& field : m_fields )
{
switch( field.GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT:
field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
break;
case GR_TEXT_H_ALIGN_CENTER:
break;
case GR_TEXT_H_ALIGN_RIGHT:
field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
break;
}
VECTOR2I pos = field.GetTextPos();
VECTOR2I delta = old_pos - pos;
pos.x = GetPosition().x + delta.x;
field.SetPosition( pos );
}
}
void SCH_LABEL_BASE::MirrorVertically( int aCenter )
{
VECTOR2I old_pos = GetPosition();
SCH_TEXT::MirrorVertically( aCenter );
for( SCH_FIELD& field : m_fields )
{
VECTOR2I pos = field.GetTextPos();
VECTOR2I delta = old_pos - pos;
pos.y = GetPosition().y + delta.y;
field.SetPosition( pos );
}
}
bool SCH_LABEL_BASE::IncrementLabel( int aIncrement )
{
wxString text = GetText();
@@ -1183,6 +1230,64 @@ void SCH_DIRECTIVE_LABEL::MirrorSpinStyle( bool aLeftRight )
}
void SCH_DIRECTIVE_LABEL::MirrorHorizontally( int aCenter )
{
VECTOR2I old_pos = GetPosition();
// The "text" is in fact a graphic shape. For a horizontal "text", it looks like a
// vertical shape (like a text reduced to only "I" letter).
// So the mirroring is not exactly similar to a SCH_TEXT item
// Text is NOT really mirrored; it is moved to a suitable horizontal position
SetTextSpinStyle( GetTextSpinStyle().MirrorX() );
SetTextX( MIRRORVAL( GetTextPos().x, aCenter ) );
for( SCH_FIELD& field : m_fields )
{
switch( field.GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT:
field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
break;
case GR_TEXT_H_ALIGN_CENTER:
break;
case GR_TEXT_H_ALIGN_RIGHT:
field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
break;
}
VECTOR2I pos = field.GetTextPos();
VECTOR2I delta = old_pos - pos;
pos.x = GetPosition().x + delta.x;
field.SetPosition( pos );
}
}
void SCH_DIRECTIVE_LABEL::MirrorVertically( int aCenter )
{
VECTOR2I old_pos = GetPosition();
// The "text" is in fact a graphic shape. For a horizontal "text", it looks like a
// vertical shape (like a text reduced to only "I" letter).
// So the mirroring is not exactly similar to a SCH_TEXT item
// Text is NOT really mirrored; it is moved to a suitable vertical position
SetTextSpinStyle( GetTextSpinStyle().MirrorY() );
SetTextY( MIRRORVAL( GetTextPos().y, aCenter ) );
for( SCH_FIELD& field : m_fields )
{
VECTOR2I pos = field.GetTextPos();
VECTOR2I delta = old_pos - pos;
pos.y = GetPosition().y + delta.y;
field.SetPosition( pos );
}
}
void SCH_DIRECTIVE_LABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
std::vector<VECTOR2I>& aPoints,
const VECTOR2I& aPos ) const
@@ -1379,80 +1484,6 @@ void SCH_GLOBALLABEL::SetTextSpinStyle( TEXT_SPIN_STYLE aSpinStyle )
}
void SCH_GLOBALLABEL::MirrorSpinStyle( bool aLeftRight )
{
SCH_TEXT::MirrorSpinStyle( aLeftRight );
for( SCH_FIELD& field : m_fields )
{
if( ( aLeftRight && field.GetTextAngle().IsHorizontal() )
|| ( !aLeftRight && field.GetTextAngle().IsVertical() ) )
{
if( field.GetHorizJustify() == GR_TEXT_H_ALIGN_LEFT )
field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else
field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
}
VECTOR2I pos = field.GetTextPos();
VECTOR2I delta = (VECTOR2I)GetPosition() - pos;
if( aLeftRight )
pos.x = GetPosition().x + delta.x;
else
pos.y = GetPosition().y + delta.y;
field.SetTextPos( pos );
}
}
void SCH_GLOBALLABEL::MirrorHorizontally( int aCenter )
{
VECTOR2I old_pos = GetPosition();
SCH_TEXT::MirrorHorizontally( aCenter );
for( SCH_FIELD& field : m_fields )
{
switch( field.GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT:
field.SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
break;
case GR_TEXT_H_ALIGN_CENTER:
break;
case GR_TEXT_H_ALIGN_RIGHT:
field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
break;
}
VECTOR2I pos = field.GetTextPos();
VECTOR2I delta = old_pos - pos;
pos.x = GetPosition().x + delta.x;
field.SetPosition( pos );
}
}
void SCH_GLOBALLABEL::MirrorVertically( int aCenter )
{
VECTOR2I old_pos = GetPosition();
SCH_TEXT::MirrorVertically( aCenter );
for( SCH_FIELD& field : m_fields )
{
VECTOR2I pos = field.GetTextPos();
VECTOR2I delta = old_pos - pos;
pos.y = GetPosition().y + delta.y;
field.SetPosition( pos );
}
}
bool SCH_GLOBALLABEL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token,
int aDepth ) const
{
+6 -5
View File
@@ -118,6 +118,9 @@ public:
void MirrorSpinStyle( bool aLeftRight ) override;
void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override;
void SetPosition( const VECTOR2I& aPosition ) override;
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
@@ -324,6 +327,9 @@ public:
void MirrorSpinStyle( bool aLeftRight ) override;
void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override;
private:
int m_pinLength;
int m_symbolSize;
@@ -356,11 +362,6 @@ public:
int GetMandatoryFieldCount() override { return 1; }
void MirrorSpinStyle( bool aLeftRight ) override;
void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override;
void SetTextSpinStyle( TEXT_SPIN_STYLE aSpinStyle ) override;
VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;

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