Compare commits

...

169 Commits

Author SHA1 Message Date
Wayne Stambaugh 3abcdb7e63 Tag release version 6.0.8. 2022-09-26 21:06:50 -04:00
Seth Hillbrand c45aa734b0 Fix missing DRC via/track check
Depending on pointer ordering, the via/track clearance check might not
run as we were only checking when the first element was a track not via.

Re-written version of 0150655ed3 for v6
2022-09-20 15:32:55 -07:00
Wayne Stambaugh a35b89258a Eeschema: fix schematic symbol library cache refresh bug.
Please note that this changes the LIB_PIN object name comparison from case
insensitive to case sensitive.

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

(cherry picked from commit 26e7261b20)
2022-09-19 07:20:44 -04:00
Seth Hillbrand 408bf85cf5 Update Translations 2022-09-18 19:34:42 -07:00
Petter Reinholdtsen ba34cd629e Translated using Weblate (Norwegian Bokmål)
Currently translated at 73.1% (5238 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/nb_NO/
2022-09-19 04:30:16 +02:00
Jan Straka 81dba33c8f Translated using Weblate (Czech)
Currently translated at 92.7% (6638 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/cs/
2022-09-19 04:30:14 +02:00
Henrik Kauhanen 2b238de012 Translated using Weblate (Swedish)
Currently translated at 99.8% (7148 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/sv/
2022-09-19 04:30:11 +02:00
Mark Roszko c0ce4cb0bc Bump vcpkg python3 to 3.9.14 2022-09-18 18:04:31 +00:00
jean-pierre charras f379fa4f7f Fix a UTF8 convert issue in some BOM python scripts.
Fixes #12435
https://gitlab.com/kicad/code/kicad/issues/12435
2022-09-16 11:35:09 +02:00
Seth Hillbrand 4e67b94b00 Update Translations 2022-09-12 13:21:16 -07:00
Grzegorz Szymaszek bb0f3550e0 Translated using Weblate (Polish)
Currently translated at 100.0% (7157 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/pl/
2022-09-12 13:21:16 -07:00
Tokita, Hiroshi ce1f166aa8 Translated using Weblate (Japanese)
Currently translated at 100.0% (7157 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ja/
2022-09-12 13:21:16 -07:00
Mark Roszko 437cd8b1e5 Trim down 3d viewer search paths
(cherry picked from commit 17bec365db)
2022-09-09 17:05:47 +00:00
Eduardo Behr 3e8532264e Fix severe simulation memory leaks 2022-09-08 01:52:32 +02:00
Seth Hillbrand 9b15717349 Update Translations 2022-09-07 14:37:32 -07:00
Seth Hillbrand 73d00cc5d7 Remove extra new string 2022-09-07 14:36:34 -07:00
lê văn lập 295aa15c3d Translated using Weblate (Vietnamese)
Currently translated at 17.0% (1218 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/vi/
2022-09-07 22:50:41 +02:00
Zoran 50adb45c33 Translated using Weblate (Serbian)
Currently translated at 14.0% (1007 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/sr/
2022-09-07 22:50:41 +02:00
Vitan Košpenda a1a44db01d Translated using Weblate (Slovenian)
Currently translated at 3.2% (233 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/sl/
2022-09-07 22:50:41 +02:00
Konstantin Baranovskiy b2f68854b2 Translated using Weblate (Russian)
Currently translated at 100.0% (7157 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ru/
2022-09-07 22:50:41 +02:00
Jan Straka 42f844826d Translated using Weblate (Czech)
Currently translated at 92.7% (6637 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/cs/
2022-09-07 22:50:41 +02:00
Henrik Kauhanen 52ca321b11 Translated using Weblate (Swedish)
Currently translated at 99.8% (7147 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/sv/
2022-09-07 22:50:41 +02:00
Toni Laiho 5af5511dfe Translated using Weblate (Finnish)
Currently translated at 99.9% (7154 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/fi/
2022-09-07 22:50:41 +02:00
jean-pierre charras f06f205886 orcadpcb2 netlist export: fix an issue with duplicated pins in multi-unit symbols.
Due to some changes in code, pins common to units were written more than once.
From master branch
2022-09-07 17:56:38 +02:00
Mark Roszko 030a562ba6 Fix autopan sticking on Windows due to lost events
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11425
2022-09-07 14:30:59 +00:00
Roberto Fernandez Bautista 2393165ada CADSTAR PCB: Fix regression when loading pads in footprints
Zero sized pads can be valid - e.g. a through hole pad

(cherry picked from commit fa5dc23797)
2022-09-06 20:29:49 +02:00
Tomasz Wlostowski e593e0b014 router: somewhat improved stop-if-walk-path-is-too-long heuristic in the walkaround algorithm 2022-09-06 11:06:38 -07:00
Tomasz Wlostowski 42dae1504a router: fix negative chamfer value for hulls generated for 0-length segments 2022-09-06 11:06:31 -07:00
Seth Hillbrand 440d324c9e Don't prevent immediate actions while router active
Immediate actions that can take place are useful.  We should only be
preventing immediate actions while actively routing or dragging

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

(cherry picked from commit 91fbb5c957)
2022-09-06 11:04:33 -07:00
Seth Hillbrand 29cadaf54e Force removal of zero-sized pads on load.
Pads with zero width or height cause issues when rendering and
selecting.  KiCad has never allowed these elements but hasn't prevented
importing systems where they exist.  This prevents their import and
cleans existing designs where the pads are placed

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

(cherry picked from commit 2ee65b2d83)
2022-09-06 11:03:41 -07:00
Seth Hillbrand 83eb9e03b1 Keep the reset text correct
Ensures that after setting the initial dialog page, we also set the
proper text in the reset button as the event does not get fired

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

(cherry picked from commit 9faff78258)
2022-09-06 10:42:02 -07:00
Seth Hillbrand b324abefe5 Handle cases where Simplify removes all outlines
This could theoretically happen for a fully degenerate polygon

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

(cherry picked from commit 5a37211fdb)
2022-09-06 10:42:02 -07:00
Seth Hillbrand b72675ba92 Allow board saves without modifying project files
Without the project files, certain settings will not be saved by this
python call.  This defaults to false (current behavior) but setting the
`aSkipSettings` to true will revert to v5 behavior

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

(cherry picked from commit 8418fe12d8)
2022-09-06 10:18:24 -07:00
Seth Hillbrand 70b69af313 Hide cursor while warping on Wayland
Based on https://gitlab.freedesktop.org/xorg/xserver/-/issues/734 we
hide the window cursor prior to warping, which allows XWayland to
reposition the cursor.  This is only performed when Wayland is detected;
all other configurations call the standard warp routine

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

(cherry picked from commit a118f20464)
2022-09-06 10:13:40 -07:00
jean-pierre charras 83f135315c 3D models list in footprint properties: fix issue when a lot of 3D models is added
From master branch
2022-09-06 17:33:09 +02:00
Jeff Young c276280e5c Remove curly brace from string encoding.
It causes issues with formatting constructs and text variable refs,
and it's not a reserved character even in filenames.

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

(cherry picked from commit 71724bea0c)
2022-09-04 10:37:32 +01:00
Roberto Fernandez Bautista 07481cd4ca CADSTAR PCB: Invert logic for guessing which layer is top / bottom
Ensures correct automatic layer mapping is applied to the design in
https://gitlab.com/kicad/code/kicad/-/issues/12349

(cherry picked from commit 9abf3438b8)
2022-09-04 01:03:55 +02:00
Roberto Fernandez Bautista 8a9ee0f9e1 CADSTAR PCB: Load 2-point polygons as line segments
Fixes asserts when loading design from https://gitlab.com/kicad/code/kicad/-/issues/12349

(cherry picked from commit c961624d43)
2022-09-04 01:03:55 +02:00
Roberto Fernandez Bautista 9a823ca61b CADSTAR PCB: Parse Teardrops
Todo: We need to figure out how we will load teardrops. For now
just drop them on import.

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

(cherry picked from commit 21b3753e9b)
Edited to remove string changes
2022-09-04 01:03:51 +02:00
Wayne Stambaugh 5afeb45a84 Eeschema: fix crash when attempting to edit missing library symbol.
Disable the edit symbol buttons in the symbol properties dialog when
there is no library symbol to edit.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11318
2022-09-02 15:48:10 -04:00
Seth Hillbrand 45da795668 Units are stored in the instance data
At the moment, units are stored in the instance data, so when loading
the file, all symbols will have bbox for the first unit.  After calling
`UpdateUnit()`, we need to recache the rtree bounding boxes to get
correct hit tests

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


(cherry picked from commit 939313088e)
2022-09-02 12:06:24 +00:00
Mark Roszko 87a8e69632 Move the PCM download cache to PATHS::GetUserCachePath
Second commit for https://gitlab.com/kicad/code/kicad/-/issues/10165

(cherry picked from commit 097f30a272)
2022-09-02 13:44:00 +02:00
Marek Roszko d57caf2ad7 Move the PCM cache to PATHS::GetUserCachePath
It still remains that on Windows, Documents can be bounded to network or cloud storage.
AppData\Local is intended for local PC caching.

Fix https://gitlab.com/kicad/code/kicad/-/issues/10165

(cherry picked from commit a855be28fa)
2022-09-02 13:44:00 +02:00
passionateengineer 7f1c2461b5 Fixes inverted Y position in pin table.
Fixes https://gitlab.com/kicad/code/kicad/issues/11988


(cherry picked from commit 3389e456b1)
2022-09-02 10:49:14 +00:00
Roberto Fernandez Bautista 26104c83ba Fix wxWidgets sizer assert in SYMBOL_PREVIEW_WIDGET 2022-09-02 12:29:23 +02:00
BugRepellentExtraStrong 6d14ce24aa eeschema: Fixes wrong displayed secondary worksheet
Fixes https://gitlab.com/kicad/code/kicad/issues/12017


(cherry picked from commit 02a6566438)
2022-09-02 10:03:44 +00:00
Roberto Fernandez Bautista e760579828 Fix annotation of incomplete multi-unit symbols and re-annotation of duplicates
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11496

(cherry picked from commit 55f22c526a)
2022-09-02 12:01:33 +02:00
Roberto Fernandez Bautista 7640246097 Assign default hotkey to Flip Board in 3D viewer
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12337


(cherry picked from commit ad45b81dee)
2022-09-02 09:30:43 +00:00
Jeff Young e25d937fd8 Null-ptr safety for diff-pair-coupling test.
Fixes https://gitlab.com/kicad/code/kicad/issues/12329

(cherry picked from commit 854acd4c77)
2022-09-02 01:18:18 +01:00
Jeff Young ea3f6c8406 Make sure dirty flag gets set, and leave save enabled regardless.
Fixes https://gitlab.com/kicad/code/kicad/issues/11824

(cherry picked from commit 09773e3e2e)
2022-09-02 01:11:20 +01:00
Jeff Young bf272e379f Run hole-to-hole checks on Edge_Cuts layer.
Also makes the flashing logic inside PAD::GetEffectiveShape() easier
to understand.

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

(cherry picked from commit e0f6a6e475)
2022-09-02 01:11:20 +01:00
Jeff Young 0acea2e386 Make sure via-gap-same-as-trace-gap gets turned off for board settings.
Fixes https://gitlab.com/kicad/code/kicad/issues/12236

(cherry picked from commit 7baa56528a)
2022-09-02 00:55:53 +01:00
Roberto Fernandez Bautista 83305dd407 Re-route m_last_head after routing fails
This should ensure the shove state gets reverted

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9023
2022-09-01 22:06:06 +00:00
Seth Hillbrand 1d5db513a1 Ensure arcs are handled in topology
Use the connection-independent `Anchor()` function to get connection
points for either arcs or segments in topology.  This allows the
ratsnest to be correctly drawn between nets with arcs

Fixes https://gitlab.com/kicad/code/kicad/issues/12205
2022-09-01 22:06:06 +00:00
Jeff Young 9d0d45450b Account for groups in undo of Position Relative To.
Also fixes a bug were pads weren't correctly being found for anchoring
the selection before the Position Relative To.

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

(cherry picked from commit 1e68c353f1)
2022-09-01 16:25:41 +01:00
Jeff Young 9bce3c243a Fix typo.
Fixes https://gitlab.com/kicad/code/kicad/issues/12140

(cherry picked from commit e3e24322bb)
2022-09-01 14:35:36 +01:00
Roberto Fernandez Bautista ace0032c82 Fix build error & just completely remove the string instead of guarding 2022-09-01 13:45:40 +02:00
Roberto Fernandez Bautista cd30711cf8 Remove additional string from a3da0b9af6 2022-09-01 11:35:22 +02:00
Roberto Fernandez Bautista a3da0b9af6 CADSTAR Schematic: Load symbols even if part definition is incomplete
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11671


(cherry picked from commit 8725c3a35f)
2022-09-01 09:25:14 +00:00
Wayne Stambaugh 32a11e4df0 Eeschema: fix broken instance data when adding new symbol.
Pass the current SCHEMATIC object pointer in SCH_SYMBOL ctor so that
newly created symbols will update the current instance data on creation
when the current sheet instance is being displayed.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12190
2022-08-26 12:47:13 -04:00
Roberto Fernandez Bautista 5606714952 DIALOG_PASTE_SPECIAL: Set focus on OK button
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12285


(cherry picked from commit 8a02f2f809)
2022-08-25 19:26:20 +00:00
jean-pierre charras 9af666ba34 Eeschema: ensure reference field is initialized when adding a new symbol in schematic 2022-08-24 14:30:14 +02:00
jean-pierre charras 4d9802760e Set locale in SaveToFile routine before calling json stuff.
It avoid wxWidgets alerts about locale when running some python scripts
2022-08-24 09:30:05 +02:00
Seth Hillbrand c3496d61eb Set locale in python save routine
Fixes https://gitlab.com/kicad/code/kicad/issues/11006
2022-08-23 09:41:55 -07:00
Wayne Stambaugh 1e09f0e8b0 Fix Eagle plugin footprint QA test issue.
Apparently mapping Eagle footprint layers to the KiCad Dwg_User
that were previously mapped to UNDEFINED_LAYER breaks the QA test
and causes the footprint editor to crash when opening Eagle
footprints.  This means that the potential data loss issue when
loading Eagle footprints is still in play.

(cherry picked from commit c72457482c)
2022-08-22 11:40:15 -04:00
Wayne Stambaugh c2c4609272 Fix Eagle plugin board layer mapping issue.
The Eagle plugin layers have to be mapped differently depending on
whether a board is being imported or a footprint library is being
cached.  Footprint libraries can bypass the manual layer remapping
step that happens when importing a board.

Please note that when loading footprints in the footprint editor
and viewer, all layers that do not directly map to KiCad layers are
put on the Dwg_User layer so that there is data loss.  Users will
have to manually remap objects to the correct layer as required.
This is less than ideal but until the footprint library table parser
supports prompting users to remap unknown layers, it will have to do.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/11839
(cherry picked from commit 0bc1188897)
2022-08-22 11:40:15 -04:00
Seth Hillbrand 9328cf42c5 Don't close blocking dialog in backannotate
Back annotate is called from a dialog, so this will close itself but not
exit, locking the UI

(cherry picked from commit 28876bef90)

Fixes https://gitlab.com/kicad/code/kicad/issues/12255
2022-08-22 07:05:30 -07:00
Seth Hillbrand 93f23dbdcd Update translations 2022-08-20 20:10:29 -07:00
Seth Hillbrand 9e9b38ef6a Revert "cadstar: Report warning that imported text may be different"
This reverts commit f637a820b6.

New strings are not allowed in v6
2022-08-20 20:09:40 -07:00
Seth Hillbrand 5e409f0f6c Remove string change and associated new feature
String changes are not allowed in v6 branch
2022-08-20 20:06:26 -07:00
Seth Hillbrand 408e7fed29 Translated using Weblate (German)
Currently translated at 100.0% (7157 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/de/
2022-08-21 04:53:12 +02:00
boonchai k 85ce1a2a20 Translated using Weblate (Thai)
Currently translated at 99.5% (7123 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/th/
2022-08-21 04:53:12 +02:00
김랑기 c1947c108b Translated using Weblate (Korean)
Currently translated at 100.0% (7157 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ko/
2022-08-21 04:53:12 +02:00
Arnau Llovet Vidal d2916bf399 Translated using Weblate (Catalan)
Currently translated at 65.6% (4695 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ca/
2022-08-21 04:53:12 +02:00
김랑기 93f973d825 Translated using Weblate (Korean)
Currently translated at 100.0% (7157 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ko/
2022-08-21 04:53:11 +02:00
Henrik Kauhanen 72503c47c6 Translated using Weblate (Swedish)
Currently translated at 99.8% (7147 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/sv/
2022-08-21 04:53:11 +02:00
김랑기 db96624990 Translated using Weblate (Korean)
Currently translated at 100.0% (7157 of 7157 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ko/
2022-08-21 04:53:11 +02:00
jean-pierre charras 962df45b65 Fix some issues in PCB_SELECTION_TOOL::selectAllItemsOnSheet():
especially a typo that prevent working on root sheet.
Clearly, commit 6b2bb4d8 was very poorly designed and (or not even) tested.
2022-08-20 13:04:06 +02:00
Roberto Fernandez Bautista f92d25e00b Fix SHAPE_LINE_CHAIN::Simplify() when there are only 3 points in the chain
We weren't updating m_shapes properly.

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

(cherry picked from commit 1fa1b44d02)
2022-08-19 20:58:28 +01:00
Marek Roszko 64220656e9 Avoid missing null check in RC_TREE_MODEL::DeleteItems
(cherry picked from commit 19e27ef587)
2022-08-17 22:08:59 +00:00
Wayne Stambaugh 39940fe5ab Fix missing legacy value and footprint field instance data.
The legacy and s-expression (prior to version 20200828) file formats only
supported symbol unit and reference fields so the newly added value and
footprint fields must be updated from the original symbol fields.

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

(cherry picked from commit 797827b833)
2022-08-17 14:24:13 -04:00
Wayne Stambaugh 40977514ce Fix more wxWidgets 3.1 and later deprecated build warnings. 2022-08-17 14:13:33 -04:00
Wayne Stambaugh cfde5300d7 Fix wxWidgets 3.1 and later deprecated build warnings.
wxWidgets 3.1 has deprecated wxPATH_NORM_ALL when normalizing file
paths when calling wxFileName::Normalize().  This change keeps the
existing behavior except in places where our own internal
ExpandEnvVarSubstitutions() to expand environment variables.

(cherry picked from commit 898ec0d094)
2022-08-17 14:07:06 -04:00
Forrest Voight 30c83ed055 kiid.cpp: Fix Boost version incompatibility and use of boost::*::detail
Fix compile with Boost 1.65.1 (and possibly some or all of the 1.59-1.66
range); remove dependence on private boost::*::detail members.

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

Comment tweaks by Mark Roszko @mroszko

(cherry picked from commit bbc0c61ccb)
2022-08-17 11:37:12 -04:00
Marek Roszko 64acd8bd47 Throw in default initializers for MINOPTMAX to silence coverity 2022-08-16 23:53:42 -04:00
Marek Roszko ca4da4706a Fix reserve call with the wrong source for size 2022-08-16 23:53:42 -04:00
Roberto Fernandez Bautista 1005f75cdb CADSTAR PCB: Allow remapping all non-electrical layers
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12196


(cherry picked from commit 6b349fdb0a)
2022-08-14 21:26:37 +00:00
Roberto Fernandez Bautista f637a820b6 cadstar: Report warning that imported text may be different
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12195


(cherry picked from commit 69d696660b)
2022-08-14 21:25:46 +00:00
Wayne Stambaugh 47cb817a86 Fix compile warnings. 2022-08-11 15:48:49 -04:00
jean-pierre charras 7769069078 DIALOG_COLOR_PICKER: fix an issue in DC.SetDeviceOrigin() due to changes in wxWidgets.
DC.SetDeviceOrigin() behavior has changed in version 3.1.7 (or 3.1.6), and the settings
needs a small change.
From master branch
Fixes #12204
https://gitlab.com/kicad/code/kicad/issues/12204
2022-08-11 10:20:46 +02:00
jean-pierre charras 411d57396c eeschema: Fix issue when saving labels having more than 50 chars
These labels (or global label...) were saved with a erroneous angle.
Fixes #12151
https://gitlab.com/kicad/code/kicad/issues/12151
2022-08-05 13:33:35 +02:00
jean-pierre charras 5f00847a86 Eeschema: another trial to fix bitmap printing in wx version > 3.1.5
We had on a regular basis problems when printing bitmaps.
Probably due to issues both in wx and in our code.
From master branch
2022-08-04 14:56:37 +02:00
Jeff Young 36a0c2a9cc Fix issue with caches not being initialized when printing msg bar.
(cherry picked from commit 43df863df2)
2022-08-04 13:04:21 +01:00
Jeff Young 4ac48ad829 Cherry-pick of 2bf33321d1. 2022-08-04 09:29:45 +01:00
Jeff Young 3bca4f8835 Fix another case of the instance data getting messed up.
(Or, more accurately in this case, of the instance data not getting
applied to the current view.)

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

(cherry picked from commit 5295342f42)
2022-08-04 09:22:23 +01:00
Jeff Young afc491c5a5 58f553a9ca requires that cache be layer-sensitive.
Fixes https://gitlab.com/kicad/code/kicad/issues/11814

(cherry picked from commit 5e80e2a421)
2022-08-04 00:48:18 +01:00
Jeff Young f75104d456 Performance improvements for CvPCB.
Fixes https://gitlab.com/kicad/code/kicad/issues/12063

(cherry picked from commit 66d6a5a9dd)
2022-08-04 00:31:51 +01:00
Jeff Young 1f3bb83a06 Make EEschema highlight net consistent with PCBNew.
In particular, highlight net on an already highlighted net clears
highlight.

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

(cherry picked from commit e36491f231)
2022-08-04 00:08:12 +01:00
Jeff Young efc75047c1 Pay attention to units for page frames.
Fixes https://gitlab.com/kicad/code/kicad/issues/11408

(cherry picked from commit 404015b0a5)
2022-08-04 00:07:24 +01:00
Jeff Young 7b5e3feb19 By-hand cherry-pick of 004abcd370. 2022-08-04 00:05:48 +01:00
Jeff Young fec9331b48 Handle rotation while moving from move tool.
This keeps us from getting CancelInteractive events in the move tool
when the EditTool runs to do the rotate.

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

(cherry picked from commit bdffbbd43b)
2022-08-04 00:00:43 +01:00
Seth Hillbrand a12ae5050a Cleanup unused code
(cherry picked from commit 76b9e25143)
2022-08-02 08:51:04 -07:00
Seth Hillbrand 82e8e38054 PNS: Handle via-in-pad distances when tuning
Tuning with a via in pad, the via isn't a part of the full line.  But we
still need to account for the line length distance of the
starting/ending vias.  To do this, we simply measure the height from
the ending track to the ending pad and starting track to starting pad
2022-08-01 20:23:07 -07:00
Seth Hillbrand 57de5a6b65 Net Inspector: Handle via layers
Rather than measuring the total via height, measure from the entry to
exit track height to get a more accurate distance
2022-08-01 20:22:13 -07:00
Seth Hillbrand 675a5a6e7b Fix simplify routine
The change in c9c31fcbc2 missed a number of cases.  This reverts back to
the system as it existed before 2be352b9f9
but using the revised method of determining A-B-C distance and avoiding
resizing the arrays
2022-08-01 09:48:29 -07:00
Seth Hillbrand 6c617d84ca Prevent drag index from exceeding full line count
Simplification removes segments, so we might lose our valid index.
Ideally, we would simplify during the assembly or pass the input index
to the simplify routine to maintain the proper value.

Fixes https://gitlab.com/kicad/code/kicad/issues/12137
2022-08-01 08:57:45 -07:00
Seth Hillbrand 7f71eef45b Move sheetpins by their connection point
Need to calculate the sheet pin anchor position in order to get it
aligned to the grid while moving

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

(cherry picked from commit 225b03d702)
2022-07-31 20:04:29 -07:00
Seth Hillbrand b50d7adaeb Update translations 2022-07-31 13:00:56 -07:00
Seth Hillbrand 027b745124 Merge remote-tracking branch 'weblate/6.0' into 6.0
Resolves conflicts
2022-07-31 12:59:51 -07:00
Seth Hillbrand c9c31fcbc2 Don't resize vectors in hot loops
Fixes a slowdown caused by erasing elements from the middle of a vector
during a hot loop in SHAPE_LINE_CHAIN::Simplify().  This gets called
quite a bit when loading boards and updating lines, so it needs to be as
fast as possible

Fixes https://gitlab.com/kicad/code/kicad/issues/12115
2022-07-31 12:48:25 -07:00
김세영 45c20bec49 Translated using Weblate (Korean)
Currently translated at 100.0% (7155 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ko/
2022-07-31 21:18:59 +02:00
Tokita, Hiroshi fe0d09222d Translated using Weblate (Japanese)
Currently translated at 100.0% (7155 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ja/
2022-07-31 21:18:58 +02:00
Toni Laiho 28d755ac27 Translated using Weblate (Finnish)
Currently translated at 100.0% (7155 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/fi/
2022-07-31 21:18:57 +02:00
김랑기 37d9186e2d Translated using Weblate (Korean)
Currently translated at 99.9% (7154 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ko/
2022-07-30 14:01:42 +02:00
minsu kim (0xGabriel) c076239915 Translated using Weblate (Korean)
Currently translated at 99.9% (7154 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ko/
2022-07-30 14:01:42 +02:00
김낙환 ca34cea2c1 Translated using Weblate (Korean)
Currently translated at 99.9% (7154 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ko/
2022-07-30 02:45:40 +02:00
박세훈 4c064e41f6 Translated using Weblate (Korean)
Currently translated at 99.9% (7154 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ko/
2022-07-30 02:45:39 +02:00
jean-pierre charras 650caae323 Avoid changing a translated string when not mandatory. 2022-07-29 20:04:52 +02:00
jean-pierre charras 06e612661c Kicad2step: fix STEP export from Pcbnew, broken by changes in commit 8456d6c
also: DIALOG_EXPORT_STEP: remember tolerance option during a session.
From Master branch.
Fixes #12119
https://gitlab.com/kicad/code/kicad/issues/12119
2022-07-29 19:46:34 +02:00
Alex ee4e4d0773 Don't recalculate constants at every call in isqrt.
(cherry picked from commit 27869b1a37)
2022-07-29 08:55:43 -07:00
jean-pierre charras 147b11abe0 Fix an issue when printing bitmaps when not on wxWidgets 3.1.6 and 3.1.7
This this a hack to fix a bug in wxWidgets.
From Master branch
2022-07-29 13:35:51 +02:00
Seth Hillbrand df9cf0a0c3 Fix crash in PNS walkaround
Placing via in walkaround mode and colliding with an arc triggered an
unneeded assertion.

Also fixes the bad assertion format that did not receive strings
2022-07-28 09:36:31 -07:00
Henrik Kauhanen b1ce6be634 Translated using Weblate (Swedish)
Currently translated at 99.8% (7142 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/sv/
2022-07-28 12:15:13 +02:00
Jeff Young 3f448a7eaa Clear dimension pointer after committing.
Fixes https://gitlab.com/kicad/code/kicad/issues/11864

(cherry picked from commit b80fd5329d)
2022-07-28 10:46:02 +01:00
Jeff Young 5214290000 Get rid of error-prone reverse logic.
Fixes https://gitlab.com/kicad/code/kicad/issues/12049

(cherry picked from commit 012d861aab)
2022-07-28 10:45:56 +01:00
Jeff Young fcd7e827e6 Hook up ID_GRID_SETTINGS for footprint viewers.
Fixes https://gitlab.com/kicad/code/kicad/issues/12030

(cherry picked from commit 6a9c6e8599)
2022-07-28 10:44:03 +01:00
Jeff Young 466f1283c1 DXF parameters are for DXF (only).
Fixes https://gitlab.com/kicad/code/kicad/issues/12021

(cherry picked from commit 763c77eab8)
2022-07-28 10:43:56 +01:00
Seth Hillbrand 39dd51490d Protect against double-refresh
The wxtimer can fire multiple times and there exists the possiblity for
this to happen before the flags are properly set to prevent it.  This
creates a concurrency mutex to skip the EDA_DRAW_PANEL_GAL refresh if
one is already underway.

Fixes https://gitlab.com/kicad/code/kicad/issues/12094
2022-07-27 20:28:18 -07:00
Seth Hillbrand 120ceade06 Update Translations 2022-07-27 19:48:56 -07:00
Jeff Young f3caac5bfd Ensure no string changes for 6.0.x. 2022-07-28 01:14:58 +01:00
Jeff Young 7bd073b5cb Make sure there are no translation changes for 6.0.x. 2022-07-28 01:08:42 +01:00
Jeff Young af40ddd0e1 Make sure strings are either 6.0.7 values or 5.1 values. 2022-07-28 00:25:45 +01:00
Jeff Young e59d8b0a2d Fix up merge errors. 2022-07-28 00:12:25 +01:00
Seth Hillbrand 7113f1f879 Fix through via drawing width
Related to fix for https://gitlab.com/kicad/code/kicad/-/issues/11851
2022-07-27 12:09:35 -07:00
Peter B 31db2b8525 Translated using Weblate (Romanian)
Currently translated at 38.7% (2774 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ro/
2022-07-27 01:55:22 +02:00
maksz42 3363fdb248 Translated using Weblate (Polish)
Currently translated at 100.0% (7155 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/pl/
2022-07-27 01:55:20 +02:00
kmn4555 983f389b24 Translated using Weblate (Korean)
Currently translated at 100.0% (7155 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ko/
2022-07-27 01:55:18 +02:00
YunJiSang 8d48a56b4a Translated using Weblate (Korean)
Currently translated at 100.0% (7155 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ko/
2022-07-27 01:55:16 +02:00
Tokita, Hiroshi 2460276e85 Translated using Weblate (Japanese)
Currently translated at 100.0% (7155 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ja/
2022-07-27 01:55:14 +02:00
Jan Straka 70f2e80dd1 Translated using Weblate (Czech)
Currently translated at 92.7% (6635 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/cs/
2022-07-27 01:55:11 +02:00
Peter B 8a5233912f Translated using Weblate (Romanian)
Currently translated at 37.7% (2698 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ro/
2022-07-27 01:55:08 +02:00
ZbeeGin c2a6906c31 Translated using Weblate (Polish)
Currently translated at 100.0% (7155 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/pl/
2022-07-27 01:55:07 +02:00
kmn4555 b05fd8f209 Translated using Weblate (Korean)
Currently translated at 100.0% (7155 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ko/
2022-07-27 01:55:05 +02:00
Tokita, Hiroshi f3a906dc86 Translated using Weblate (Japanese)
Currently translated at 100.0% (7155 of 7155 strings)

Translation: KiCad EDA/v6
Translate-URL: https://hosted.weblate.org/projects/kicad/v6/ja/
2022-07-27 01:55:03 +02:00
jean-pierre charras a5b676fa0e Avoid crashes when, for some reason, a dll cannot be loaded.
In this case a null pointer was returned by the internal code.
This pointer is now tested against nullptr to avoid the application crashing.
Fixes #12080
https://gitlab.com/kicad/code/kicad/issues/12080
2022-07-26 16:04:27 +02:00
Jeff Young 38b75db12c Fix merge breakage.
Fixes https://gitlab.com/kicad/code/kicad/issues/12088
2022-07-26 14:42:36 +01:00
Wayne Stambaugh fb2cf7b8be Begin version 6.0.8 development. 2022-07-25 19:32:38 -04:00
Jeff Young ac28ed9888 Cherry-pick fix for pad clearances from master. 2022-07-25 21:50:23 +01:00
Jeff Young d9fef3da72 Don't allow 0 line-width for unfilled shapes.
Fixes https://gitlab.com/kicad/code/kicad/issues/12010

(cherry picked from commit d0547cbde7)
2022-07-25 21:46:27 +01:00
Jeff Young 61bb793324 Save fp browser list widths and apply known hack to work around wxWidgets bug.
Fixes https://gitlab.com/kicad/code/kicad/issues/11744

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

(cherry picked from commit 0a623bff9f)
2022-07-25 21:21:23 +01:00
Jeff Young ccb416eead Bring symbol editor in line with eeschema for empty text.
Fixes https://gitlab.com/kicad/code/kicad/issues/11799

(cherry picked from commit d07c6699ce)
2022-07-25 21:12:15 +01:00
Jeff Young 6e10a496ef Honour m_resolveTextVars flag for properties as well as fields.
Fixes https://gitlab.com/kicad/code/kicad/issues/11937

(cherry picked from commit 5479514819)
2022-07-25 21:03:47 +01:00
Jeff Young e06e65cdde Add newly-drawn objects to any entered group.
Fixes https://gitlab.com/kicad/code/kicad/issues/11912

(cherry picked from commit 654740b90d)
2022-07-25 21:02:26 +01:00
Jeff Young 832c689345 Labels can connect directly to symbols, other labels, etc.
Fixes https://gitlab.com/kicad/code/kicad/issues/11768

(cherry picked from commit c6604e3576)
2022-07-25 20:56:11 +01:00
Jeff Young 0580fc6819 Add create-wire logic to labels.
Fixes https://gitlab.com/kicad/code/kicad/issues/11768

(cherry picked from commit 29900cad34)
2022-07-25 20:44:50 +01:00
Jeff Young 0f882d91e5 Add proper collision test to via placer.
Also moves DISALLOW constraint processing outside the loop as it
performs it's own loop over any objects referenced by the rules.

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

(cherry picked from commit 73836b50fc)
2022-07-25 20:16:01 +01:00
Jeff Young 2fdddb970f Bug fixes for printing vias.
Blind/buried and microvias didn't get their layers trimmed properly,
nor did through vias with dropped pads.

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

(cherry picked from commit 231ac567b8)
2022-07-25 20:05:40 +01:00
Jeff Young 0321d96b1e Fill in missing bits of LAYER variable for printing/plotting.
Fixes https://gitlab.com/kicad/code/kicad/issues/11788

(cherry picked from commit f22cf1cc3a)
2022-07-25 19:49:09 +01:00
Jeff Young ce92c676e6 Use unit references in status bar.
Fixes https://gitlab.com/kicad/code/kicad/issues/11854

(cherry picked from commit 45ab15dc95)
2022-07-25 19:40:08 +01:00
Jeff Young bb5fd5a2ec Fix broken logic for hidden pins.
Fixes https://gitlab.com/kicad/code/kicad/issues/11771

(cherry picked from commit b710982875)
2022-07-25 19:36:58 +01:00
Jeff Young 41a9293106 Update grid attributes after sorting.
Fixes https://gitlab.com/kicad/code/kicad/issues/11753

(cherry picked from commit 46fd32b738)
2022-07-25 19:36:13 +01:00
Jeff Young 3c4f8a335f Save selection *before* clearing it. Saving after doesn't do much good.
Fixes https://gitlab.com/kicad/code/kicad/issues/11242

(cherry picked from commit 1751c8e1cf)
2022-07-25 19:35:06 +01:00
Jeff Young 1a6e9538cd Handle empty directories in template projects.
Fixes https://gitlab.com/kicad/code/kicad/issues/10191

(cherry picked from commit cff52c70d0)
2022-07-25 19:33:52 +01:00
Jeff Young 06baaa33fa Rely on DRC rules when items might overlap.
Fixes https://gitlab.com/kicad/code/kicad/issues/1790

(cherry picked from commit f48ed79039)
2022-07-25 19:31:05 +01:00
Jeff Young cd5b4ec8f2 Add edge-exclusions to router (for castellated pads).
Fixes https://gitlab.com/kicad/code/kicad/issues/1790

(cherry picked from commit 833dc70bff)
2022-07-25 19:30:49 +01:00
Jeff Young 58451335cb Apply DRC fixes to ERC.
Fixes https://gitlab.com/kicad/code/kicad/issues/11844

(cherry picked from commit 83a2f43661)
2022-07-25 19:23:57 +01:00
Jeff Young e7dd9f9337 Don't reset Footprint Tests Run if the board didn't change.
Fixes https://gitlab.com/kicad/code/kicad/issues/11844

(cherry picked from commit 048f277b1e)
2022-07-25 18:41:48 +01:00
Jeff Young 7bf66be2ac Don't clear marker counts when closing DRC dialog.
Fixes https://gitlab.com/kicad/code/kicad/issues/11844

(cherry picked from commit 801a98a302)
2022-07-25 18:41:21 +01:00
Jeff Young 0bc97b7952 Handle double-click in dimension drawing tool.
Fixes https://gitlab.com/kicad/code/kicad/issues/11815

(cherry picked from commit d40664d171)
2022-07-25 18:35:29 +01:00
240 changed files with 37906 additions and 31313 deletions
+3 -3
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2018-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-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
@@ -29,7 +29,6 @@
#include <wx/datetime.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/stdpaths.h>
@@ -55,6 +54,7 @@
#include <project.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <wx_filename.h>
#define MASK_3D_CACHE "3D_CACHE"
@@ -514,7 +514,7 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
wxFileName cfgdir( ExpandEnvVarSubstitutions( aConfigDir, m_project ), wxEmptyString );
cfgdir.Normalize();
cfgdir.Normalize( FN_NORMALIZE_FLAGS );
if( !cfgdir.DirExists() )
{
+6 -16
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-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
@@ -29,13 +29,13 @@
#include <wx/dir.h>
#include <wx/dynlib.h>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/stdpaths.h>
#include <wx/string.h>
#include <common.h>
#include <paths.h>
#include <wx_filename.h>
#include "3d_plugin_manager.h"
#include "plugins/3d/3d_plugin.h"
#include "3d_cache/sg/scenegraph.h"
@@ -153,24 +153,14 @@ void S3D_PLUGIN_MANAGER::loadPlugins( void )
fn.AssignDir( PATHS::GetStockPlugins3DPath() );
checkPluginPath( std::string( fn.GetPathWithSep().ToUTF8() ), searchpaths );
// check for per-user third party plugins
// note: GetUserDataDir() gives '.pcbnew' rather than '.kicad' since it uses the exe name;
fn.AssignDir( PATHS::GetUserPlugins3DPath() );
checkPluginPath( fn.GetPathWithSep(), searchpaths );
#else
// Search path on OS X is
// (1) User ~/Library/Application Support/kicad/PlugIns/3d
checkPluginPath( PATHS::GetOSXKicadUserDataDir() + wxT( "/PlugIns/3d" ), searchpaths );
// (2) Machine /Library/Application Support/kicad/PlugIns/3d
// (1) Machine /Library/Application Support/kicad/PlugIns/3d
checkPluginPath( PATHS::GetOSXKicadMachineDataDir() + wxT( "/PlugIns/3d" ), searchpaths );
// (3) Bundle kicad.app/Contents/PlugIns/3d
// (2) Bundle kicad.app/Contents/PlugIns/3d
fn.AssignDir( PATHS::GetStockPlugins3DPath() );
checkPluginPath( fn.GetPathWithSep(), searchpaths );
#endif
std::list< wxString >::iterator sPL = searchpaths.begin();
@@ -288,7 +278,7 @@ void S3D_PLUGIN_MANAGER::checkPluginName( const wxString& aPath,
wxFileName path( ExpandEnvVarSubstitutions( aPath, nullptr ) );
path.Normalize();
path.Normalize( FN_NORMALIZE_FLAGS );
// determine if the path is already in the list
wxString wxpath = path.GetFullPath();
@@ -326,7 +316,7 @@ void S3D_PLUGIN_MANAGER::checkPluginPath( const wxString& aPath,
else
path.Assign( aPath, wxEmptyString );
path.Normalize();
path.Normalize( FN_NORMALIZE_FLAGS );
if( !wxFileName::DirExists( path.GetFullPath() ) )
return;
+1 -1
View File
@@ -111,7 +111,7 @@ TOOL_ACTION EDA_3D_ACTIONS::resetView( "3DViewer.Control.resetView",
TOOL_ACTION EDA_3D_ACTIONS::flipView( "3DViewer.Control.flipView",
AS_ACTIVE,
0, "",
'F', "",
_( "Flip Board" ), _( "Flip the board view" ),
BITMAPS::flip_board, AF_NONE, (void*) ID_VIEW3D_FLIP );
+3 -2
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-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
@@ -34,6 +34,7 @@
#include <common_ogl/ogl_attr_list.h>
#include <filename_resolver.h>
#include <pcbnew/footprint.h>
#include <wx_filename.h>
#include <wx/filedlg.h>
@@ -164,7 +165,7 @@ bool DIALOG_SELECT_3DMODEL::TransferDataFromWindow()
// file selection mode: retrieve the filename and specify a
// path relative to one of the config paths
wxFileName fname = m_FileTree->GetFilePath();
fname.Normalize();
fname.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
m_model->m_Filename = m_resolver->ShortenPath( fname.GetFullPath() );
return true;
+1 -1
View File
@@ -37,7 +37,7 @@
# KiCad.
#
# Note: This version string should follow the semantic versioning system
set( KICAD_SEMANTIC_VERSION "6.0.6-unknown" )
set( KICAD_SEMANTIC_VERSION "6.0.8" )
# Default the version to the semantic version.
# This is overridden by the git repository tag though (if using git)
+14 -13
View File
@@ -503,21 +503,22 @@ void BITMAPCONV_INFO::createOutputData( BMP2CMP_MOD_LAYER aModLayer )
polyset_areas.BooleanSubtract( polyset_holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Ensure there are no self intersecting polygons
polyset_areas.NormalizeAreaOutlines();
// Convert polygon with holes to a unique polygon
polyset_areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Output current resulting polygon(s)
for( int ii = 0; ii < polyset_areas.OutlineCount(); ii++ )
if( polyset_areas.NormalizeAreaOutlines() )
{
SHAPE_LINE_CHAIN& poly = polyset_areas.Outline( ii );
outputOnePolygon( poly, getBoardLayerName( aModLayer ));
}
// Convert polygon with holes to a unique polygon
polyset_areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
polyset_areas.RemoveAllContours();
polyset_holes.RemoveAllContours();
main_outline = true;
// Output current resulting polygon(s)
for( int ii = 0; ii < polyset_areas.OutlineCount(); ii++ )
{
SHAPE_LINE_CHAIN& poly = polyset_areas.Outline( ii );
outputOnePolygon( poly, getBoardLayerName( aModLayer ));
}
polyset_areas.RemoveAllContours();
polyset_holes.RemoveAllContours();
main_outline = true;
}
}
paths = paths->next;
+14
View File
@@ -251,6 +251,16 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const wxPoint& aPos )
aDC->GetLogicalOrigin( &logicalOriginX, &logicalOriginY );
bool useTransform = aDC->CanUseTransformMatrix();
// We already have issues to draw a bitmap on the wxDC, depending on wxWidgets version.
// Now we have an issue on wxWidgets 3.1.6 and later to fix the clipboard
// and the bitmap position when using TransformMatrix
// So for version >= 3.1.6 do not use it
// Be carefull before changing the code.
#if wxCHECK_VERSION( 3, 1, 6 )
useTransform = false;
#endif
wxAffineMatrix2D init_matrix = aDC->GetTransformMatrix();
wxPoint clipAreaPos;
@@ -261,8 +271,12 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const wxPoint& aPos )
matrix.Translate( pos.x, pos.y );
matrix.Scale( GetScalingFactor(), GetScalingFactor() );
aDC->SetTransformMatrix( matrix );
// Needed on wx <= 3.1.5, and this is strange...
// Nevertheless, this code has problem (the bitmap is not seen)
// with wx version > 3.1.5
clipAreaPos.x = pos.x;
clipAreaPos.y = pos.y;
pos.x = pos.y = 0;
}
else
+3
View File
@@ -136,6 +136,9 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
setupPainter( *painter );
setupViewLayers( *view, m_settings.m_LayerSet );
dstSettings->SetPrintLayers( m_settings.m_LayerSet );
dstSettings->SetLayerName( aLayerName );
wxSize sheetSizeMils = m_settings.m_pageInfo.GetSizeMils();
VECTOR2I sheetSizeIU( milsToIU( sheetSizeMils.GetWidth() ),
+13 -3
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-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
@@ -396,13 +396,18 @@ void DIALOG_COLOR_PICKER::drawRGBPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 )
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else
bitmapDC.SetDeviceOrigin( half_size, half_size );
#endif
// Reserve room to draw cursors inside the bitmap
half_size -= m_cursorsSize/2;
// Draw the 3 RGB cursors, using white color to make them always visible:
wxPen pen( wxColor( 255, 255, 255 ) );
wxPen pen( wxColor( 255, 255, 255 ), 2 ); // use 2 pixels for pen size
wxBrush brush( wxColor( 0, 0, 0 ), wxBRUSHSTYLE_TRANSPARENT );
bitmapDC.SetPen( pen );
bitmapDC.SetBrush( brush );
@@ -461,7 +466,12 @@ void DIALOG_COLOR_PICKER::drawHSVPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 )
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else
bitmapDC.SetDeviceOrigin( half_size, half_size );
#endif
// Reserve room to draw cursors inside the bitmap
half_size -= m_cursorsSize / 2;
@@ -470,7 +480,7 @@ void DIALOG_COLOR_PICKER::drawHSVPalette()
m_cursorBitmapHSV.x = cos( m_hue * M_PI / 180.0 ) * half_size * m_sat;
m_cursorBitmapHSV.y = sin( m_hue * M_PI / 180.0 ) * half_size * m_sat;
wxPen pen( wxColor( 0, 0, 0 ) );
wxPen pen( wxColor( 0, 0, 0 ), 2 ); // Use 2 pixels as pensize
wxBrush brush( wxColor( 0, 0, 0 ), wxBRUSHSTYLE_TRANSPARENT );
bitmapDC.SetPen( pen );
bitmapDC.SetBrush( brush );
+2
View File
@@ -45,6 +45,8 @@ DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL( wxWindow* aParent,
"with '%s'." ),
aReplacement ) );
m_sdbSizerOK->SetFocus();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
+5
View File
@@ -174,6 +174,11 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
void EDA_DRAW_PANEL_GAL::DoRePaint()
{
if( !m_refreshMutex.try_lock() )
return;
std::lock_guard<std::mutex> lock( m_refreshMutex, std::adopt_lock );
// Repaint the canvas, and fix scrollbar cursors
// Usually called by a OnPaint event, but because it does not use a wxPaintDC,
// it can be called outside a wxPaintEvent.
@@ -83,6 +83,7 @@ void DS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView, DS_DRAW_ITEM_LIST* aDrawLis
aDrawList->SetSheetCount( m_sheetCount );
aDrawList->SetFileName( fileName );
aDrawList->SetSheetName( sheetName );
aDrawList->SetSheetLayer( settings->GetLayerName() );
aDrawList->SetProject( m_project );
aDrawList->BuildDrawItemsList( *m_pageInfo, *m_titleBlock );
+1 -1
View File
@@ -365,7 +365,7 @@ void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight )
void EDA_SHAPE::RebuildBezierToSegmentsPointsList( int aMinSegLen )
{
// Has meaning only for S_CURVE DRAW_SEGMENT shape
// Has meaning only for SHAPE_T::BEZIER
if( m_shape != SHAPE_T::BEZIER )
{
m_bezierPoints.clear();
+15 -11
View File
@@ -26,7 +26,6 @@
#include <mutex>
#include <sstream>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/msgdlg.h>
#include <pgm_base.h>
@@ -34,6 +33,7 @@
#include "common.h"
#include "filename_resolver.h"
#include <wx_filename.h>
// configuration file version
#define CFGFILE_VERSION 1
@@ -66,7 +66,7 @@ bool FILENAME_RESOLVER::Set3DConfigDir( const wxString& aConfigDir )
wxFileName cfgdir( ExpandEnvVarSubstitutions( aConfigDir, m_project ), wxEmptyString );
cfgdir.Normalize();
cfgdir.Normalize( FN_NORMALIZE_FLAGS );
if( !cfgdir.DirExists() )
return false;
@@ -87,7 +87,7 @@ bool FILENAME_RESOLVER::SetProject( PROJECT* aProject, bool* flgChanged )
wxFileName projdir( ExpandEnvVarSubstitutions( aProject->GetProjectPath(), aProject ), wxEmptyString );
projdir.Normalize();
projdir.Normalize( FN_NORMALIZE_FLAGS );
if( !projdir.DirExists() )
return false;
@@ -189,7 +189,7 @@ bool FILENAME_RESOLVER::createPathList()
else
{
fndummy.Assign( pathVal, wxEmptyString );
fndummy.Normalize();
fndummy.Normalize( FN_NORMALIZE_FLAGS );
lpath.m_Pathexp = fndummy.GetFullPath();
}
@@ -269,7 +269,7 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
// working directory (which is not necessarily the current project directory)
if( tmpFN.FileExists() )
{
tmpFN.Normalize();
tmpFN.Normalize( FN_NORMALIZE_FLAGS );
tname = tmpFN.GetFullPath();
// special case: if a path begins with ${ENV_VAR} but is not in the resolver's path list
@@ -316,7 +316,7 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
if( wxFileName::FileExists( fullPath ) )
{
tmpFN.Assign( fullPath );
tmpFN.Normalize();
tmpFN.Normalize( FN_NORMALIZE_FLAGS );
tname = tmpFN.GetFullPath();
return tname;
}
@@ -333,7 +333,7 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
fullPath = ExpandEnvVarSubstitutions( fullPath, m_project );
fpath.Assign( fullPath );
if( fpath.Normalize() && fpath.FileExists() )
if( fpath.Normalize( FN_NORMALIZE_FLAGS ) && fpath.FileExists() )
{
tname = fpath.GetFullPath();
return tname;
@@ -381,7 +381,7 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
wxFileName tmp( fullPath );
if( tmp.Normalize() )
if( tmp.Normalize( FN_NORMALIZE_FLAGS ) )
tname = tmp.GetFullPath();
return tname;
@@ -422,7 +422,7 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
wxFileName path( ExpandEnvVarSubstitutions( tpath.m_Pathvar, m_project ), wxEmptyString );
path.Normalize();
path.Normalize( FN_NORMALIZE_FLAGS );
if( !path.DirExists() )
{
@@ -496,7 +496,11 @@ bool FILENAME_RESOLVER::readPathList()
}
wxFileName cfgpath( m_configDir, RESOLVER_CONFIG );
cfgpath.Normalize();
// This should be the same as wxWidgets 3.0 wxPATH_NORM_ALL which is deprecated in 3.1.
// There are known issues with environment variable expansion so maybe we should be using
// our own ExpandEnvVarSubstitutions() here instead.
cfgpath.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
wxString cfgname = cfgpath.GetFullPath();
size_t nitems = m_paths.size();
@@ -716,7 +720,7 @@ void FILENAME_RESOLVER::checkEnvVarPath( const wxString& aPath )
wxFileName tmpFN( ExpandEnvVarSubstitutions( lpath.m_Alias, m_project ), wxEmptyString );
wxUniChar psep = tmpFN.GetPathSeparator();
tmpFN.Normalize();
tmpFN.Normalize( FN_NORMALIZE_FLAGS );
if( !tmpFN.DirExists() )
return;
+6 -8
View File
@@ -41,14 +41,11 @@
static std::mutex rng_mutex;
// Static rng and generators are used because the overhead of constant seeding is expensive
// We break out the rng separately from the generator because we want to control seeding in cases like unit tests
#if BOOST_VERSION >= 106700
static boost::uuids::detail::random_provider seeder; // required to ensure the rng has a random initial seed
#else
static boost::uuids::detail::seed_rng seeder; // required to ensure the rng has a random initial seed
#endif
static boost::mt19937 rng( seeder );
static boost::uuids::basic_random_generator<boost::mt19937> randomGenerator( rng );
// We rely on the default non-arg constructor of basic_random_generator to provide a random seed.
// We use a separate rng object for cases where we want to control the basic_random_generator
// initial seed by calling SeedGenerator from unit tests and other special cases.
static boost::mt19937 rng;
static boost::uuids::basic_random_generator<boost::mt19937> randomGenerator;
// These don't have the same performance penalty, but we might as well be consistent
static boost::uuids::string_generator stringGenerator;
@@ -279,6 +276,7 @@ void KIID::CreateNilUuids( bool aNil )
void KIID::SeedGenerator( unsigned int aSeed )
{
rng.seed( aSeed );
randomGenerator = boost::uuids::basic_random_generator<boost::mt19937>( rng );
}
@@ -84,6 +84,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
drawList.SetSheetCount( aSheetCount );
drawList.SetFileName( fn.GetFullName() ); // Print only the short filename
drawList.SetSheetName( aSheetDesc );
drawList.SetSheetLayer( plotter->RenderSettings()->GetLayerName() );
drawList.SetProject( aProject );
drawList.SetIsFirstPage( aIsFirstPage );
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -273,7 +273,7 @@ const wxString PROJECT::AbsolutePath( const wxString& aFileName ) const
if( !fn.IsAbsolute() )
{
wxString pro_dir = wxPathOnly( GetProjectFullName() );
fn.Normalize( wxPATH_NORM_ALL, pro_dir );
fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS, pro_dir );
}
return fn.GetFullPath();
+1 -1
View File
@@ -466,7 +466,7 @@ void RC_TREE_MODEL::DeleteCurrentItem( bool aDeep )
void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, bool aDeep )
{
RC_TREE_NODE* current_node = ToNode( m_view->GetCurrentItem() );
RC_TREE_NODE* current_node = m_view ? ToNode( m_view->GetCurrentItem() ) : nullptr;
const std::shared_ptr<RC_ITEM> current_item = current_node ? current_node->m_RcItem : nullptr;
/// Keep a vector of elements to free after wxWidgets is definitely done accessing them
+3
View File
@@ -22,6 +22,7 @@
#include <settings/json_settings_internals.h>
#include <settings/nested_settings.h>
#include <locale_io.h>
NESTED_SETTINGS::NESTED_SETTINGS( const std::string& aName, int aVersion, JSON_SETTINGS* aParent,
const std::string& aPath ) :
@@ -116,6 +117,8 @@ bool NESTED_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce )
if( !m_parent )
return false;
LOCALE_IO dummy;
try
{
bool modified = Store();
+2 -15
View File
@@ -145,13 +145,6 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
wxString converted;
std::vector<bool> braceStack; // true == formatting construct
auto hasFormattingPrefix =
[&]()
{
static wxString prefixes = wxT( "~_^" );
return !converted.IsEmpty() && prefixes.Find( converted.Last() ) >= 0;
};
converted.reserve( aSource.length() );
for( wxUniChar c: aSource )
@@ -167,9 +160,7 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
}
else if( aContext == CTX_LIBID )
{
if( c == '{' && !hasFormattingPrefix() )
converted += wxT( "{brace}" );
else if( c == '/' )
if( c == '/' )
converted += wxT( "{slash}" );
else if( c == '\\' )
converted += wxT( "{backslash}" );
@@ -202,9 +193,7 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
}
else if( aContext == CTX_FILENAME )
{
if( c == '{' )
converted += wxT( "{brace}" );
else if( c == '/' )
if( c == '/' )
converted += wxT( "{slash}" );
else if( c == '\\' )
converted += wxT( "{backslash}" );
@@ -229,8 +218,6 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
{
if( c == ' ' )
converted += wxT( "{space}" );
else if( c == '{' )
converted += wxT( "{brace}" );
else
converted += c;
}
+7
View File
@@ -242,6 +242,13 @@ bool TOOL_EVENT::IsMoveTool() const
}
bool TOOL_EVENT::IsEditorTool() const
{
return ( m_commandStr
&& m_commandStr.value().find( "InteractiveEdit" ) != GetCommandStr()->npos );
}
bool TOOL_EVENT::IsSimulator() const
{
return( m_commandStr.is_initialized()
+19 -7
View File
@@ -248,7 +248,7 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
{
if( !justWarped )
{
m_parentPanel->WarpPointer( x + warpX, y + warpY );
KIPLATFORM::UI::WarpPointer( m_parentPanel, x + warpX, y + warpY );
m_dragStartPoint += VECTOR2D( warpX, warpY );
justWarped = true;
}
@@ -288,7 +288,7 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
{
if( !justWarped )
{
m_parentPanel->WarpPointer( x, y + warpY );
KIPLATFORM::UI::WarpPointer( m_parentPanel, x, y + warpY );
m_dragStartPoint += VECTOR2D( 0, warpY );
justWarped = true;
}
@@ -507,6 +507,18 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
return;
}
#ifdef __WXMSW__
// Hackfix: It's possible for the mouse to leave the canvas
// without triggering any leave events on windows
// Use a MSW only wx function
if( !m_parentPanel->IsMouseInWindow() )
{
m_panTimer.Stop();
m_state = IDLE;
return;
}
#endif
if( !m_parentPanel->HasFocus() )
break;
@@ -741,17 +753,17 @@ void WX_VIEW_CONTROLS::WarpCursor( const VECTOR2D& aPosition, bool aWorldCoordin
if( aWarpView )
{
m_view->SetCenter( clampedPosition );
m_parentPanel->WarpPointer( screenSize.x / 2, screenSize.y / 2 );
KIPLATFORM::UI::WarpPointer( m_parentPanel, screenSize.x / 2, screenSize.y / 2 );
}
}
else
{
m_parentPanel->WarpPointer( screenPos.x, screenPos.y );
KIPLATFORM::UI::WarpPointer( m_parentPanel, screenPos.x, screenPos.y );
}
}
else
{
m_parentPanel->WarpPointer( aPosition.x, aPosition.y );
KIPLATFORM::UI::WarpPointer( m_parentPanel, aPosition.x, aPosition.y );
}
refreshMouse();
@@ -766,7 +778,7 @@ void WX_VIEW_CONTROLS::CenterOnCursor() const
if( GetMousePosition( false ) != screenCenter )
{
m_view->SetCenter( GetCursorPosition() );
m_parentPanel->WarpPointer( KiROUND( screenSize.x / 2 ), KiROUND( screenSize.y / 2 ) );
KIPLATFORM::UI::WarpPointer( m_parentPanel, KiROUND( screenSize.x / 2 ), KiROUND( screenSize.y / 2 ) );
}
}
@@ -877,7 +889,7 @@ void WX_VIEW_CONTROLS::handleCursorCapture( int x, int y )
}
if( warp )
m_parentPanel->WarpPointer( x, y );
KIPLATFORM::UI::WarpPointer( m_parentPanel, x, y );
}
}
+25 -17
View File
@@ -237,7 +237,9 @@ bool PAGED_DIALOG::TransferDataToWindow()
}
}
m_treebook->SetSelection( (unsigned) std::max( 0, lastPageIndex ) );
lastPageIndex = std::max( 0, lastPageIndex );
m_treebook->ChangeSelection( lastPageIndex );
UpdateResetButton( lastPageIndex );
return true;
}
@@ -360,18 +362,17 @@ void PAGED_DIALOG::OnUpdateUI( wxUpdateUIEvent& event )
}
void PAGED_DIALOG::OnPageChange( wxBookCtrlEvent& event )
void PAGED_DIALOG::UpdateResetButton( int aPage )
{
size_t page = event.GetSelection();
// Enable the reset button only if the page is re-settable
if( m_resetButton )
{
if( auto panel = dynamic_cast<RESETTABLE_PANEL*>( m_treebook->GetPage( page ) ) )
if( auto panel = dynamic_cast<RESETTABLE_PANEL*>( m_treebook->GetPage( aPage ) ) )
{
m_resetButton->SetLabel( wxString::Format( _( "Reset %s to Defaults" ),
m_treebook->GetPageText( page ) ) );
m_resetButton->SetToolTip( panel->GetResetTooltip() );
m_treebook->GetPageText( aPage ) ) );
m_resetButton->SetToolTip( panel->GetHelpTextAtPoint( wxPoint( -INT_MAX, INT_MAX ),
wxHelpEvent::Origin_Unknown ) );
m_resetButton->Enable( true );
}
else
@@ -382,20 +383,27 @@ void PAGED_DIALOG::OnPageChange( wxBookCtrlEvent& event )
}
}
}
// Work around an OSX bug where the wxGrid children don't get placed correctly until
// the first resize event
#ifdef __WXMAC__
if( page + 1 <= m_macHack.size() && m_macHack[ page ] )
void PAGED_DIALOG::OnPageChange( wxBookCtrlEvent& event )
{
int page = event.GetSelection();
// Use the first sub-page when a tree level node is selected.
if( m_treebook->GetCurrentPage()->GetChildren().IsEmpty() )
{
wxSize pageSize = m_treebook->GetPage( page )->GetSize();
pageSize.x -= 5;
pageSize.y += 2;
unsigned next = page + 1;
m_treebook->GetPage( page )->SetSize( pageSize );
m_macHack[ page ] = false;
if( next < m_treebook->GetPageCount() )
m_treebook->ChangeSelection( next );
}
#endif
UpdateResetButton( page );
wxSizeEvent evt( wxDefaultSize );
wxQueueEvent( m_treebook, evt.Clone() );
}
+56 -13
View File
@@ -60,8 +60,9 @@
#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME ),
m_viewerPendingUpdate( false )
{
m_symbolsListBox = nullptr;
m_footprintListBox = nullptr;
@@ -420,11 +421,20 @@ void CVPCB_MAINFRAME::OnEnterFilteringText( wxCommandEvent& aEvent )
// If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
// of available footprints which match the filter
long pos = m_tcFilterString->GetInsertionPoint();
wxListEvent l_event;
OnSelectComponent( l_event );
m_tcFilterString->SetFocus();
m_tcFilterString->SetInsertionPoint( pos );
COMPONENT* symbol = GetSelectedComponent();
wxString libraryName = m_librariesListBox->GetSelectedLibrary();
m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
m_tcFilterString->GetValue(), m_filteringOptions );
if( symbol && symbol->GetFPID().IsValid() )
m_footprintListBox->SetSelectedFootprint( symbol->GetFPID() );
else if( m_footprintListBox->GetSelection() >= 0 )
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
RefreshFootprintViewer();
DisplayStatus();
}
@@ -433,22 +443,58 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
if( m_skipComponentSelect )
return;
wxString libraryName;
COMPONENT* symbol = GetSelectedComponent();
libraryName = m_librariesListBox->GetSelectedLibrary();
wxString libraryName = m_librariesListBox->GetSelectedLibrary();
m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
m_tcFilterString->GetValue(), m_filteringOptions );
if( symbol && symbol->GetFPID().IsValid() )
m_footprintListBox->SetSelectedFootprint( symbol->GetFPID() );
else
else if( m_footprintListBox->GetSelection() >= 0 )
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
RefreshFootprintViewer();
refreshAfterSymbolSearch( symbol );
}
void CVPCB_MAINFRAME::RefreshFootprintViewer()
{
if( GetFootprintViewerFrame() && !m_viewerPendingUpdate )
{
Bind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
m_viewerPendingUpdate = true;
}
}
void CVPCB_MAINFRAME::updateFootprintViewerOnIdle( wxIdleEvent& aEvent )
{
Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
m_viewerPendingUpdate = false;
// On some plateforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
// are opened and refreshed when a new footprint is selected.
// If the listbox has the focus before selecting a new footprint, it will be forced
// after selection.
bool footprintListHasFocus = m_footprintListBox->HasFocus();
bool symbolListHasFocus = m_symbolsListBox->HasFocus();
// If the footprint view window is displayed, update the footprint.
if( GetFootprintViewerFrame() )
GetToolManager()->RunAction( CVPCB_ACTIONS::showFootprintViewer, true );
DisplayStatus();
if( footprintListHasFocus )
m_footprintListBox->SetFocus();
else if( symbolListHasFocus )
m_symbolsListBox->SetFocus();
}
void CVPCB_MAINFRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_BASE_FRAME::LoadSettings( aCfg );
@@ -652,9 +698,6 @@ void CVPCB_MAINFRAME::refreshAfterSymbolSearch( COMPONENT* aSymbol )
break;
}
}
if( GetFootprintViewerFrame() )
m_toolManager->RunAction( CVPCB_ACTIONS::showFootprintViewer, true );
}
SendMessageToEESCHEMA();
+11 -3
View File
@@ -330,6 +330,8 @@ public:
*/
wxString GetSelectedFootprint();
void RefreshFootprintViewer();
void SetStatusText( const wxString& aText, int aNumber = 0 ) override;
protected:
@@ -351,6 +353,10 @@ private:
*/
void setupEventHandlers();
void onTextFilterChanged( wxCommandEvent& event );
void updateFootprintViewerOnIdle( wxIdleEvent& aEvent );
/**
* Read the .equ files and populate the list of equivalents.
*
@@ -398,9 +404,11 @@ private:
ACTION_MENU* m_footprintContextMenu;
ACTION_MENU* m_symbolsContextMenu;
// Undo/Redo item lists
CVPCB_UNDO_REDO_LIST m_undoList;
CVPCB_UNDO_REDO_LIST m_redoList;
CVPCB_UNDO_REDO_LIST m_undoList;
CVPCB_UNDO_REDO_LIST m_redoList;
bool m_viewerPendingUpdate;
};
#endif //#ifndef _CVPCB_MAINFRAME_H_
+17 -12
View File
@@ -62,13 +62,15 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
EVT_CHOICE( ID_ON_ZOOM_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectZoom )
EVT_CHOICE( ID_ON_GRID_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectGrid )
EVT_MENU( ID_GRID_SETTINGS, DISPLAY_FOOTPRINTS_FRAME::OnGridSettings )
END_EVENT_TABLE()
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
wxDefaultPosition, wxDefaultSize,
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME )
PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
wxDefaultPosition, wxDefaultSize,
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME ),
m_currentComp( nullptr )
{
// Give an icon
wxIcon icon;
@@ -451,21 +453,20 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
{
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
COMPONENT* comp = parentframe->GetSelectedComponent();
FOOTPRINT* footprint = nullptr;
const FOOTPRINT_INFO* fpInfo = nullptr;
GetBoard()->DeleteAllFootprints();
GetCanvas()->GetView()->Clear();
wxString footprintName = parentframe->GetSelectedFootprint();
if( footprintName.IsEmpty() )
{
COMPONENT* comp = parentframe->GetSelectedComponent();
if( footprintName.IsEmpty() && comp )
footprintName = comp->GetFPID().Format();
if( comp )
footprintName = comp->GetFPID().GetUniStringLibId();
}
if( m_currentFootprint == footprintName && m_currentComp == comp )
return;
GetBoard()->DeleteAllFootprints();
GetCanvas()->GetView()->Clear();
INFOBAR_REPORTER infoReporter( m_infoBar );
m_infoBar->Dismiss();
@@ -480,7 +481,11 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
}
if( footprint )
{
GetBoard()->Add( footprint );
m_currentFootprint = footprintName;
m_currentComp = comp;
}
if( fpInfo )
SetStatusText( wxString::Format( _( "Lib: %s" ), fpInfo->GetLibNickname() ), 0 );
+4
View File
@@ -114,6 +114,10 @@ public:
protected:
void setupUIConditions() override;
private:
wxString m_currentFootprint;
COMPONENT* m_currentComp;
};
#endif // DISPLAY_FOOTPRINTS_FRAME_H
+8 -24
View File
@@ -99,15 +99,15 @@ wxString FOOTPRINTS_LISTBOX::OnGetItemText( long item, long column ) const
}
void FOOTPRINTS_LISTBOX::SetSelection( int index, bool State )
void FOOTPRINTS_LISTBOX::SetSelection( int aIndex, bool aState )
{
if( index >= GetCount() )
index = GetCount() - 1;
if( aIndex >= GetCount() )
aIndex = GetCount() - 1;
if( (index >= 0) && (GetCount() > 0) )
if(( aIndex >= 0) && ( GetCount() > 0) )
{
Select( index, State );
EnsureVisible( index );
Select( aIndex, aState );
EnsureVisible( aIndex );
Refresh();
}
}
@@ -156,7 +156,7 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
if( GetSelection() >= 0 && GetSelection() < (int)m_footprintList.GetCount() )
oldSelection = m_footprintList[ GetSelection() ];
for( auto& i: filter )
for( const FOOTPRINT_INFO& i : filter )
{
msg.Printf( wxT( "%3d %s:%s" ),
int( newList.GetCount() + 1 ),
@@ -199,23 +199,7 @@ END_EVENT_TABLE()
void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
{
if( m_footprintList.IsEmpty() )
return;
// On some plateforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
// are opened and refreshed when a new footprint is selected.
// If the listbox has the focus before selecting a new footprint, it will be forced
// after selection.
bool hasFocus = HasFocus();
// If the footprint view window is displayed, update the footprint.
if( GetParent()->GetFootprintViewerFrame() )
GetParent()->GetToolManager()->RunAction( CVPCB_ACTIONS::showFootprintViewer, true );
GetParent()->DisplayStatus();
if( hasFocus )
SetFocus();
GetParent()->RefreshFootprintViewer();
}
+1 -1
View File
@@ -100,7 +100,7 @@ public:
~FOOTPRINTS_LISTBOX();
int GetCount();
void SetSelection( int index, bool State = true );
void SetSelection( int aIndex, bool aState = true );
void SetSelectedFootprint( const LIB_ID& aFPID );
void SetString( unsigned linecount, const wxString& text );
void AppendLine( const wxString& text );
+2 -2
View File
@@ -161,8 +161,8 @@ int CVPCB_CONTROL::ShowFootprintViewer( const TOOL_EVENT& aEvent )
if( !fpframe )
{
fpframe = (DISPLAY_FOOTPRINTS_FRAME*) m_frame->Kiway().Player(
FRAME_CVPCB_DISPLAY, true, m_frame );
fpframe = (DISPLAY_FOOTPRINTS_FRAME*) m_frame->Kiway().Player( FRAME_CVPCB_DISPLAY, true,
m_frame );
fpframe->Show( true );
}
else
File diff suppressed because it is too large Load Diff
+7 -5
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-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
@@ -182,10 +182,6 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
// Store previous annotations for building info messages
mapExistingAnnotation( previousAnnotation );
// If it is an annotation for all the symbols, reset previous annotation.
if( aResetAnnotation )
DeleteAnnotation( aAnnotateScope, &appendUndo );
// Set sheet number and number of sheets.
SetSheetNumberAndCount();
@@ -205,6 +201,12 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
break;
}
// Remove annotation only updates the "new" flag to indicate to the algorithm
// that these references must be reannotated, but keeps the original reference
// so that we can reannotate multi-unit symbols together.
if( aResetAnnotation )
references.RemoveAnnotation();
// Build additional list of references to be used during reannotation
// to avoid duplicate designators (no additional references when annotating
// the full schematic)
+124 -95
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 1992-2018 jean-pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 1992-2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -29,6 +29,7 @@
*/
#include <sch_reference_list.h>
#include <core/kicad_algo.h>
#include <wx/regex.h>
#include <algorithm>
@@ -48,7 +49,7 @@ void SCH_REFERENCE_LIST::RemoveItem( unsigned int aIndex )
}
bool SCH_REFERENCE_LIST::Contains( const SCH_REFERENCE& aItem )
bool SCH_REFERENCE_LIST::Contains( const SCH_REFERENCE& aItem ) const
{
for( unsigned ii = 0; ii < GetCount(); ii++ )
{
@@ -154,14 +155,14 @@ bool SCH_REFERENCE_LIST::sortByTimeStamp( const SCH_REFERENCE& item1,
}
int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit ) const
int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit, bool aIncludeNew ) const
{
int NumRef = flatList[aIndex].m_numRef;
for( size_t ii = 0; ii < flatList.size(); ii++ )
{
if( ( aIndex == ii )
|| ( flatList[ii].m_isNew )
|| ( flatList[ii].m_isNew && !aIncludeNew )
|| ( flatList[ii].m_numRef != NumRef )
|| ( flatList[aIndex].CompareRef( flatList[ii] ) != 0 ) )
continue;
@@ -210,34 +211,98 @@ void SCH_REFERENCE_LIST::GetRefsInUse( int aIndex, std::vector< int >& aIdList,
aIdList.push_back( ref.m_numRef );
}
sort( aIdList.begin(), aIdList.end() );
std::sort( aIdList.begin(), aIdList.end() );
// Ensure each reference number appears only once. If there are symbols with
// multiple parts per package the same number will be stored for each part.
std::vector< int >::iterator it = unique( aIdList.begin(), aIdList.end() );
// Using the C++ unique algorithm only moves the duplicate entries to the end of
// of the array. This removes the duplicate entries from the array.
aIdList.resize( it - aIdList.begin() );
alg::remove_duplicates( aIdList );
}
int SCH_REFERENCE_LIST::GetLastReference( int aIndex, int aMinValue ) const
std::vector<int> SCH_REFERENCE_LIST::GetUnitsMatchingRef( const SCH_REFERENCE& aRef ) const
{
int lastNumber = aMinValue;
std::vector<int> unitsList;
// Always add this reference to the list
unitsList.push_back( aRef.m_unit );
for( SCH_REFERENCE ref : flatList )
{
if( ref.CompareValue( aRef ) != 0 )
continue;
if( ref.CompareLibName( aRef ) != 0 )
continue;
// Split if needed before comparing ref and number
if( ref.IsSplitNeeded() )
ref.Split();
if( ref.CompareRef( aRef ) != 0 )
continue;
if( ref.m_numRef != aRef.m_numRef )
continue;
unitsList.push_back( ref.m_unit );
}
std::sort( unitsList.begin(), unitsList.end() );
// Ensure each reference number appears only once. If there are symbols with
// multiple parts per package the same number will be stored for each part.
alg::remove_duplicates( unitsList );
return unitsList;
}
int SCH_REFERENCE_LIST::FindFirstUnusedReference( const SCH_REFERENCE& aRef, int aMinValue,
const std::vector<int>& aRequiredUnits ) const
{
// Create a map of references indexed by reference number, only including those with the same
// reference prefix as aRef
std::map<int, std::vector<SCH_REFERENCE>> refNumberMap;
for( const SCH_REFERENCE& ref : flatList )
{
// search only for the current reference prefix:
if( flatList[aIndex].CompareRef( ref ) != 0 )
if( ref.CompareRef( aRef ) != 0 )
continue;
// update max value for the current reference prefix
if( lastNumber < ref.m_numRef )
lastNumber = ref.m_numRef;
if( ref.m_isNew )
continue; // It will be reannotated
refNumberMap[ref.m_numRef].push_back( ref );
}
return lastNumber;
// Start at the given minimum value
int minFreeNumber = aMinValue;
for( ; refNumberMap[minFreeNumber].size() > 0; ++minFreeNumber )
{
auto isNumberInUse = [&]() -> bool
{
for( const int& unit : aRequiredUnits )
{
for( const SCH_REFERENCE& ref : refNumberMap[minFreeNumber] )
{
if( ref.CompareLibName( aRef ) || ref.CompareValue( aRef )
|| ref.GetUnit() == unit )
{
return true;
}
}
}
return false;
};
if( !isNumberInUse() )
return minFreeNumber;
}
return minFreeNumber;
}
@@ -261,7 +326,7 @@ std::vector<SYMBOL_INSTANCE_REFERENCE> SCH_REFERENCE_LIST::GetSymbolInstances()
}
int SCH_REFERENCE_LIST::CreateFirstFreeRefId( std::vector<int>& aIdList, int aFirstValue )
int SCH_REFERENCE_LIST::createFirstFreeRefId( std::vector<int>& aIdList, int aFirstValue )
{
int expectedId = aFirstValue;
@@ -327,9 +392,9 @@ void SCH_REFERENCE_LIST::ReannotateDuplicates( const SCH_REFERENCE_LIST& aAdditi
if( refstr[refstr.Len() - 1] == '?' )
continue;
lockedSymbols[refstr].AddItem( ref );
ref.m_isNew = true; // We want to reannotate all references
lockedSymbols[refstr].AddItem( ref );
}
Annotate( false, 0, 0, lockedSymbols, aAdditionalReferences, true );
@@ -390,10 +455,6 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
else
minRefId = aStartNumber + 1;
// This is the list of all Id already in use for a given reference prefix.
// Will be refilled for each new reference prefix.
std::vector<int>idList;
GetRefsInUse( first, idList, minRefId );
for( unsigned ii = 0; ii < flatList.size(); ii++ )
{
@@ -435,23 +496,20 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
minRefId = ref_unit.m_sheetNum * aSheetIntervalId + 1;
else
minRefId = aStartNumber + 1;
GetRefsInUse( first, idList, minRefId );
}
// Find references greater than current reference (unless not annotated)
if( aStartAtCurrent && ref_unit.m_numRef > 0 )
{
minRefId = ref_unit.m_numRef;
GetRefsInUse( first, idList, minRefId );
}
// Annotation of one part per package symbols (trivial case).
if( ref_unit.GetLibPart()->GetUnitCount() <= 1 )
{
if( ref_unit.m_isNew )
{
LastReferenceNumber = CreateFirstFreeRefId( idList, minRefId );
std::vector<int> idList;
GetRefsInUse( first, idList, minRefId );
LastReferenceNumber = createFirstFreeRefId( idList, minRefId );
ref_unit.m_numRef = LastReferenceNumber;
}
@@ -463,45 +521,46 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
// Annotation of multi-unit parts ( n units per part ) (complex case)
NumberOfUnits = ref_unit.GetLibPart()->GetUnitCount();
if( ref_unit.m_isNew )
{
LastReferenceNumber = CreateFirstFreeRefId( idList, minRefId );
ref_unit.m_numRef = LastReferenceNumber;
ref_unit.m_flag = 1;
}
// If this symbol is in aLockedUnitMap, copy the annotation to all
// symbols that are not it
if( lockedList != nullptr )
{
unsigned n_refs = lockedList->GetCount();
std::vector<int> units = lockedList->GetUnitsMatchingRef( ref_unit );
for( unsigned thisRefI = 0; thisRefI < n_refs; ++thisRefI )
if( ref_unit.m_isNew )
{
SCH_REFERENCE &thisRef = (*lockedList)[thisRefI];
LastReferenceNumber = FindFirstUnusedReference( ref_unit, minRefId, units );
ref_unit.m_numRef = LastReferenceNumber;
ref_unit.m_isNew = false;
ref_unit.m_flag = 1;
}
if( thisRef.IsSameInstance( ref_unit ) )
for( unsigned lockedRefI = 0; lockedRefI < n_refs; ++lockedRefI )
{
SCH_REFERENCE& lockedRef = ( *lockedList )[lockedRefI];
if( lockedRef.IsSameInstance( ref_unit ) )
{
// This is the symbol we're currently annotating. Hold the unit!
ref_unit.m_unit = thisRef.m_unit;
ref_unit.m_unit = lockedRef.m_unit;
// lock this new full reference
inUseRefs.insert( buildFullReference( ref_unit ) );
}
if( thisRef.CompareValue( ref_unit ) != 0 )
if( lockedRef.CompareValue( ref_unit ) != 0 )
continue;
if( thisRef.CompareLibName( ref_unit ) != 0 )
if( lockedRef.CompareLibName( ref_unit ) != 0 )
continue;
// Find the matching symbol
for( unsigned jj = ii + 1; jj < flatList.size(); jj++ )
{
if( ! thisRef.IsSameInstance( flatList[jj] ) )
if( !lockedRef.IsSameInstance( flatList[jj] ) )
continue;
wxString ref_candidate = buildFullReference( ref_unit, thisRef.m_unit );
wxString ref_candidate = buildFullReference( ref_unit, lockedRef.m_unit );
// propagate the new reference and unit selection to the "old" symbol,
// if this new full reference is not already used (can happens when initial
@@ -518,56 +577,16 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
}
}
}
else
else if( ref_unit.m_isNew )
{
/* search for others units of this symbol.
* we search for others parts that have the same value and the same
* reference prefix (ref without ref number)
*/
for( Unit = 1; Unit <= NumberOfUnits; Unit++ )
{
if( ref_unit.m_unit == Unit )
continue;
int found = FindUnit( ii, Unit );
if( found >= 0 )
continue; // this unit exists for this reference (unit already annotated)
// Search a symbol to annotate ( same prefix, same value, not annotated)
for( unsigned jj = ii + 1; jj < flatList.size(); jj++ )
{
auto& cmp_unit = flatList[jj];
if( cmp_unit.m_flag ) // already tested
continue;
if( cmp_unit.CompareRef( ref_unit ) != 0 )
continue;
if( cmp_unit.CompareValue( ref_unit ) != 0 )
continue;
if( cmp_unit.CompareLibName( ref_unit ) != 0 )
continue;
if( aUseSheetNum &&
cmp_unit.GetSheetPath().Cmp( ref_unit.GetSheetPath() ) != 0 )
continue;
if( !cmp_unit.m_isNew )
continue;
// Symbol without reference number found, annotate it if possible.
if( cmp_unit.m_unit == Unit )
{
cmp_unit.m_numRef = ref_unit.m_numRef;
cmp_unit.m_flag = 1;
cmp_unit.m_isNew = false;
break;
}
}
}
// Reference belonging to multi-unit symbol that has not yet been annotated. We don't
// know what group this might belong to, so just find the first unused reference for
// this specific unit. The other units will be annotated in the following passes.
std::vector<int> units = { ref_unit.GetUnit() };
LastReferenceNumber = FindFirstUnusedReference( ref_unit, minRefId, units );
ref_unit.m_numRef = LastReferenceNumber;
ref_unit.m_isNew = false;
ref_unit.m_flag = 1;
}
}
@@ -824,6 +843,16 @@ void SCH_REFERENCE::Split()
}
bool SCH_REFERENCE::IsSplitNeeded()
{
std::string refText = GetRefStr();
int ll = refText.length() - 1;
return ( refText[ll] == '?' ) || isdigit( refText[ll] );
}
wxString SCH_REFERENCE_LIST::Shorthand( std::vector<SCH_REFERENCE> aList )
{
wxString retVal;
-145
View File
@@ -1,145 +0,0 @@
// Do not edit this file, it is autogenerated by CMake from the .md file
_HKI( "# 1 - Full documentation\n"
"\n"
"The Eeschema documentation (*eeschema.html*) describes this intermediate netlist and gives examples(chapter ***creating customized netlists and bom files***).\n"
"\n"
"# 2 - The intermediate Netlist File\n"
"\n"
"BOM files (and netlist files) can be created from an *Intermediate netlist file* created by Eeschema.\n"
"\n"
"This file uses XML syntax and is called the intermediate netlist. The intermediate netlist includes a large amount of data about your board and because of this, it can be used with post-processing to create a BOM or other reports.\n"
"\n"
"Depending on the output (BOM or netlist), different subsets of the complete Intermediate Netlist file will be used in the post-processing.\n"
"\n"
"# 3 - Conversion to a new format\n"
"\n"
"By applying a post-processing filter to the Intermediate netlist file you can generate foreign netlist files as well as BOM files. Because this conversion is a text to text transformation, this post-processing filter can be written using *Python*, *XSLT*, or any other tool capable of taking XML as input.\n"
"\n"
"XSLT itself is a XML language suitable for XML transformations. There is a free program called `xsltproc` that you can download and install. The `xsltproc` program can be used to read the Intermediate XML netlist input file, apply a style-sheet to transform the input, and save the results in an output file. Use of `xsltproc` requires a style-sheet file using XSLT conventions. The full conversion process is handled by Eeschema, after it is configured once to run `xsltproc` in a specific way.\n"
"\n"
"A Python script is somewhat more easy to create.\n"
"\n"
"# 4 - Initialization of the dialog window\n"
"\n"
"You should add a new plugin (a script) in the plugin list by clicking on the Add Plugin button.\n"
"\n"
"## 4.1 - Plugin Configuration Parameters\n"
"\n"
"The Eeschema plug-in configuration dialog requires the following information:\n"
"\n"
" * The title: for instance, the name of the netlist format.\n"
" * The command line to launch the converter (usually a script).\n"
"\n"
"***Note (Windows only):***\n"
"*By default, the command line runs with hidden console window and output is redirected to \"Plugin info\" field. To show the window of the running command, set the checkbox \"Show console window\".*\n"
"\n"
"Once you click on the generate button the following will happen:\n"
"\n"
"1. Eeschema creates an intermediate netlist file \\*.xml, for instance `test.xml`.\n"
"2. Eeschema runs the script from the command line to create the final output file.\n"
"\n"
"## 4.2 - Generate netlist files with the command line\n"
"\n"
"Assuming we are using the program `xsltproc.exe` to apply the sheet style to the intermediate file, `xsltproc.exe` is executed with the following command.\n"
"\n"
"```\n"
"xsltproc.exe -o <output filename> <style-sheet filename> <input XML file to convert>\n"
"```\n"
"\n"
"On Windows the command line is the following.\n"
"\n"
"```\n"
"f:/kicad/bin/xsltproc.exe -o \"%O\" f:/kicad/bin/plugins/myconverter.xsl \"%I\"\n"
"```\n"
"\n"
"On Linux the command becomes as following.\n"
"\n"
"```\n"
"xsltproc -o \"%O\" /usr/local/kicad/bin/plugins/myconverter .xsl \"%I\"\n"
"```\n"
"where `myconverter.xsl` is the style-sheet that you are applying.\n"
"\n"
"Do not forget the double quotes around the file names, this allows them to have spaces after the substitution by Eeschema.\n"
"\n"
"If a Python script is used, the command line is something like (depending on the Python script):\n"
"\n"
"```\n"
"python f:/kicad/bin/plugins/bom-in-python/myconverter.py \"%I\" \"%O\"\n"
"```\n"
"\n"
"or\n"
"\n"
"```\n"
"python /usr/local/kicad/bin/plugins/bom-in-python/myconverter .xsl \"%I\" \"%O\"\n"
"```\n"
"\n"
"The command line format accepts parameters for filenames. The supported formatting parameters are:\n"
"\n"
" * `%B`: base filename of selected output file, minus path and extension.\n"
" * `%P`: project directory, without name and without trailing '/'.\n"
" * `%I`: complete filename and path of the temporary input file\n"
"(the intermediate net file).\n"
" * `%O`: complete filename and path (but without extension) of the user\n"
"chosen output file.\n"
"\n"
"`%I` will be replaced by the actual intermediate file name (usually the full root sheet filename with extension \".xml\").\n"
"`%O` will be replaced by the actual output file name (the full root sheet filename minus extension).\n"
"`%B` will be replaced by the actual output short file name (the short root sheet filename minus extension).\n"
"`%P` will be replaced by the actual current project path.\n"
"\n"
"## 4.3 - Command line format:\n"
"\n"
"### 4.3.1 - Remark:\n"
"\n"
"Most of time, the created file must have an extension, depending on its type.\n"
"Therefore you have to add to the option ***%O*** the right file extension.\n"
"\n"
"For instance:\n"
"\n"
" * **%O.csv** to create a .csv file (comma separated value file).\n"
" * **%O.htm** to create a .html file.\n"
" * **%O.bom** to create a .bom file.\n"
"\n"
"### 4.3.2 Example for xsltproc:\n"
"\n"
"The command line format for xsltproc is the following:\n"
"\n"
"```\n"
"<path of xsltproc> xsltproc <xsltproc parameters>\n"
"```\n"
"\n"
"On Windows:\n"
"```\n"
"f:/kicad/bin/xsltproc.exe -o \"%O.bom\" f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl \"%I\"\n"
"```\n"
"\n"
"On Linux:\n"
"```\n"
"xsltproc -o \"%O.bom\" /usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl \"%I\"\n"
"```\n"
"\n"
"The above examples assume `xsltproc` is installed on your PC under Windows and xsl files located in `<path_to_kicad>/kicad/bin/plugins/`.\n"
"\n"
"\n"
"### 4.3.3 Example for Python scripts:\n"
"\n"
"Assuming python is installed on your PC, and python scripts are located in\n"
"\n"
" `<path_to_kicad>/kicad/bin/plugins/bom-in-python/`,\n"
"\n"
"the command line format for python is something like:\n"
"\n"
"```\n"
"python <script file name> <input filename> <output filename>\n"
"```\n"
"\n"
"On Windows:\n"
"```\n"
"python.exe f:/kicad/bin/plugins/bom-in-python/my_python_script.py \"%I\" \"%O.html\"\n"
"```\n"
"\n"
"On Linux:\n"
"```\n"
"python /usr/local/kicad/bin/plugins/bom-in-python/my_python_script.py \"%I\" \"%O.csv\"\n"
"```\n"
"" );
+52 -7
View File
@@ -49,6 +49,10 @@
#include <string_utils.h>
#include <kiplatform/ui.h>
static SCHEMATIC* g_lastERCSchematic = nullptr;
static bool g_lastERCRun = false;
DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
DIALOG_ERC_BASE( parent ),
PROGRESS_REPORTER_BASE( 1 ),
@@ -57,6 +61,8 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
m_ercRun( false ),
m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING )
{
m_currentSchematic = &parent->Schematic();
SetName( DIALOG_ERC_WINDOW_NAME ); // Set a window name to be able to find it
EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
@@ -70,8 +76,9 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
m_markerTreeModel->SetSeverities( m_severities );
m_markerTreeModel->SetProvider( m_markerProvider );
syncCheckboxes();
updateDisplayedCounts();
if( m_currentSchematic == g_lastERCSchematic )
m_ercRun = g_lastERCRun;
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
@@ -81,12 +88,24 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
m_sdbSizer1OK->SetDefault();
m_violationsTitleTemplate = m_notebook->GetPageText( 1 );
// Hack to keep from changing translated string in 6.0.x
m_violationsTitleTemplate.Append( wxT( " (%s)" ) );
m_errorsBadge->SetMaximumNumber( 999 );
m_warningsBadge->SetMaximumNumber( 999 );
m_exclusionsBadge->SetMaximumNumber( 999 );
UpdateAnnotationWarning();
Layout();
SetFocus();
syncCheckboxes();
updateDisplayedCounts();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
@@ -94,6 +113,9 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
DIALOG_ERC::~DIALOG_ERC()
{
g_lastERCSchematic = m_currentSchematic;
g_lastERCRun = m_ercRun;
EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxASSERT( settings );
@@ -176,18 +198,41 @@ void DIALOG_ERC::updateDisplayedCounts()
int numWarnings = 0;
int numExcluded = 0;
int numMarkers = 0;
if( m_markerProvider )
{
numMarkers += m_markerProvider->GetCount();
numErrors += m_markerProvider->GetCount( RPT_SEVERITY_ERROR );
numWarnings += m_markerProvider->GetCount( RPT_SEVERITY_WARNING );
numExcluded += m_markerProvider->GetCount( RPT_SEVERITY_EXCLUSION );
}
if( !m_ercRun )
bool markersOverflowed = false;
// We don't currently have a limit on ERC violations, so the above is always false.
wxString num;
wxString msg;
if( m_ercRun )
{
numErrors = -1;
numWarnings = -1;
num.Printf( markersOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numMarkers );
msg.Printf( m_violationsTitleTemplate, num );
}
else
{
msg = m_violationsTitleTemplate;
msg.Replace( wxT( "(%s)" ), wxEmptyString );
}
m_notebook->SetPageText( 1, msg );
if( !m_ercRun && numErrors == 0 )
numErrors = -1;
if( !m_ercRun && numWarnings == 0 )
numWarnings = -1;
m_errorsBadge->UpdateNumber( numErrors, RPT_SEVERITY_ERROR );
m_warningsBadge->UpdateNumber( numWarnings, RPT_SEVERITY_WARNING );
@@ -221,9 +266,9 @@ void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
deleteAllMarkers( includeExclusions );
m_ercRun = false;
// redraw the schematic
redrawDrawPanel();
updateDisplayedCounts();
m_parent->GetCanvas()->Refresh();
}
+3
View File
@@ -91,6 +91,9 @@ private:
private:
SCH_EDIT_FRAME* m_parent;
SCHEMATIC* m_currentSchematic;
wxString m_violationsTitleTemplate;
RC_ITEMS_PROVIDER* m_markerProvider;
RC_TREE_MODEL* m_markerTreeModel;
+1 -1
View File
@@ -309,7 +309,7 @@
</object>
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Violations</property>
<property name="label">Violations (%d)</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
@@ -132,7 +132,7 @@ public:
val = StringFromValue( aUserUnits, pin->GetPosition().x, true );
break;
case COL_POSY:
val = StringFromValue( aUserUnits, pin->GetPosition().y, true );
val = StringFromValue( aUserUnits, -pin->GetPosition().y, true );
break;
case COL_VISIBLE:
val = StringFromBool( pin->IsVisible() );
@@ -216,7 +216,7 @@ public:
case COL_POSY:
pin->SetPosition( wxPoint( pin->GetPosition().x,
ValueFromString( m_frame->GetUserUnits(), aValue ) ) );
-ValueFromString( m_frame->GetUserUnits(), aValue ) ) );
break;
case COL_VISIBLE:
@@ -28,7 +28,7 @@
#include <dialog_lib_text_properties.h>
#include <symbol_editor/symbol_editor_settings.h>
#include <tools/symbol_editor_drawing_tools.h>
#include "confirm.h"
DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
LIB_TEXT* aText ) :
@@ -116,9 +116,15 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow()
if( m_graphicText )
{
if( m_TextCtrl->GetValue().IsEmpty() )
m_graphicText->SetText( wxT( "[null]" ) );
{
// Other text items do not have defined extents, and so will disappear if empty
DisplayError( this, _( "Value may not be empty." ) );
return false;
}
else
{
m_graphicText->SetText( m_TextCtrl->GetValue() );
}
m_graphicText->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
+4 -3
View File
@@ -4,7 +4,7 @@
* Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2010 Lorenzo Marcantonio
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -38,6 +38,7 @@
#include <trace_helpers.h>
#include <settings/settings_manager.h>
#include <drawing_sheet/ds_painter.h>
#include <wx_filename.h>
#include <sch_edit_frame.h>
#include <sch_painter.h>
@@ -1283,7 +1284,7 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
fn.SetName( wxEmptyString );
fn.SetExt( wxEmptyString );
if( fn.Normalize() )
if( fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS ) )
{
path = fn.GetPath();
}
@@ -1318,7 +1319,7 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
// Build the absolute path of current output directory and the project path.
fn.SetPath( Prj().GetProjectPath() + path );
if( fn.Normalize() )
if( fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS ) )
{
path = fn.GetPath();
}
+3 -1
View File
@@ -29,6 +29,7 @@
#include <wx/tooltip.h>
#include <confirm.h>
#include <validators.h>
#include <wx_filename.h>
#include <wildcards_and_files_ext.h>
#include <widgets/tab_traversal.h>
#include <sch_edit_frame.h>
@@ -425,7 +426,8 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
// SCH_SCREEN file names are always absolute.
wxFileName currentScreenFileName = currentScreen->GetFileName();
if( !screenFileName.Normalize( wxPATH_NORM_ALL, currentScreenFileName.GetPath() ) )
if( !screenFileName.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS,
currentScreenFileName.GetPath() ) )
{
msg = wxString::Format( _( "Cannot normalize new sheet schematic file path:\n"
"'%s'\n"
+29 -1
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-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
@@ -89,6 +89,14 @@ public:
void BuildAttrs()
{
for( wxGridCellAttr* attr : m_nameAttrs )
attr->DecRef();
m_nameAttrs.clear();
if( m_readOnlyAttr )
m_readOnlyAttr->DecRef();
m_readOnlyAttr = new wxGridCellAttr;
m_readOnlyAttr->SetReadOnly( true );
@@ -117,11 +125,17 @@ public:
m_nameAttrs.push_back( attr );
}
if( m_typeAttr )
m_typeAttr->DecRef();
m_typeAttr = new wxGridCellAttr;
m_typeAttr->SetRenderer( new GRID_CELL_ICON_TEXT_RENDERER( PinTypeIcons(),
PinTypeNames() ) );
m_typeAttr->SetReadOnly( true );
if( m_shapeAttr )
m_shapeAttr->DecRef();
m_shapeAttr = new wxGridCellAttr;
m_shapeAttr->SetRenderer( new GRID_CELL_ICON_TEXT_RENDERER( PinShapeIcons(),
PinShapeNames() ) );
@@ -1024,6 +1038,7 @@ void DIALOG_SYMBOL_PROPERTIES::OnPinTableColSort( wxGridEvent& aEvent )
ascending = true;
m_dataModel->SortRows( sortCol, ascending );
m_dataModel->BuildAttrs();
}
@@ -1139,3 +1154,16 @@ void DIALOG_SYMBOL_PROPERTIES::OnChoice( wxCommandEvent& event )
{
OnModify();
}
void DIALOG_SYMBOL_PROPERTIES::onUpdateEditSymbol( wxUpdateUIEvent& event )
{
event.Enable( m_symbol && m_symbol->GetLibSymbolRef() );
}
void DIALOG_SYMBOL_PROPERTIES::onUpdateEditLibrarySymbol( wxUpdateUIEvent& event )
{
event.Enable( m_symbol && m_symbol->GetLibSymbolRef() );
}
+4 -1
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -88,6 +88,9 @@ private:
void OnUpdateSymbol( wxCommandEvent& ) override;
void OnExchangeSymbol( wxCommandEvent& ) override;
virtual void onUpdateEditSymbol( wxUpdateUIEvent& event ) override;
virtual void onUpdateEditLibrarySymbol( wxUpdateUIEvent& event ) override;
void AdjustGridColumns( int aWidth );
private:
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -49,7 +49,6 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent,
m_fieldsGrid->SetColSize( 10, 84 );
m_fieldsGrid->EnableDragColMove( false );
m_fieldsGrid->EnableDragColSize( true );
m_fieldsGrid->SetColLabelSize( 22 );
m_fieldsGrid->SetColLabelValue( 0, _("Name") );
m_fieldsGrid->SetColLabelValue( 1, _("Value") );
m_fieldsGrid->SetColLabelValue( 2, _("Show") );
@@ -61,6 +60,7 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent,
m_fieldsGrid->SetColLabelValue( 8, _("Orientation") );
m_fieldsGrid->SetColLabelValue( 9, _("X Position") );
m_fieldsGrid->SetColLabelValue( 10, _("Y Position") );
m_fieldsGrid->SetColLabelSize( 22 );
m_fieldsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
@@ -260,12 +260,12 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent,
m_pinGrid->SetColSize( 4, 140 );
m_pinGrid->EnableDragColMove( false );
m_pinGrid->EnableDragColSize( true );
m_pinGrid->SetColLabelSize( 24 );
m_pinGrid->SetColLabelValue( 0, _("Pin Number") );
m_pinGrid->SetColLabelValue( 1, _("Base Pin Name") );
m_pinGrid->SetColLabelValue( 2, _("Alternate Assignment") );
m_pinGrid->SetColLabelValue( 3, _("Electrical Type") );
m_pinGrid->SetColLabelValue( 4, _("Graphic Style") );
m_pinGrid->SetColLabelSize( 24 );
m_pinGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
@@ -353,7 +353,9 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent,
m_updateSymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnUpdateSymbol ), NULL, this );
m_changeSymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnExchangeSymbol ), NULL, this );
m_editSchematicSymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSymbol ), NULL, this );
m_editSchematicSymbolBtn->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditSymbol ), NULL, this );
m_editLibrarySymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditLibrarySymbol ), NULL, this );
m_editLibrarySymbolBtn->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditLibrarySymbol ), NULL, this );
m_pinGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnPinTableCellEdited ), NULL, this );
m_spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSpiceModel ), NULL, this );
m_stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCancelButtonClick ), NULL, this );
@@ -381,7 +383,9 @@ DIALOG_SYMBOL_PROPERTIES_BASE::~DIALOG_SYMBOL_PROPERTIES_BASE()
m_updateSymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnUpdateSymbol ), NULL, this );
m_changeSymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnExchangeSymbol ), NULL, this );
m_editSchematicSymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSymbol ), NULL, this );
m_editSchematicSymbolBtn->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditSymbol ), NULL, this );
m_editLibrarySymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditLibrarySymbol ), NULL, this );
m_editLibrarySymbolBtn->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditLibrarySymbol ), NULL, this );
m_pinGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnPinTableCellEdited ), NULL, this );
m_spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSpiceModel ), NULL, this );
m_stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCancelButtonClick ), NULL, this );
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
@@ -14,6 +14,7 @@
<property name="file">dialog_symbol_properties_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_edit_component_in_schematic_base</property>
@@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@@ -50,6 +52,7 @@
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Symbol Properties</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@@ -301,6 +304,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -374,6 +378,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -447,6 +452,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -530,6 +536,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1429,6 +1436,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1502,6 +1510,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1575,6 +1584,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1633,6 +1643,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnEditSymbol</event>
<event name="OnUpdateUI">onUpdateEditSymbol</event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -1658,6 +1669,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1716,6 +1728,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnEditLibrarySymbol</event>
<event name="OnUpdateUI">onUpdateEditLibrarySymbol</event>
</object>
</object>
</object>
@@ -2058,6 +2071,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -77,7 +77,7 @@ class DIALOG_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM
wxButton* m_stdDialogButtonSizerOK;
wxButton* m_stdDialogButtonSizerCancel;
// Virtual event handlers, overide them in your derived class
// Virtual event handlers, override them in your derived class
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnGridEditorShown( wxGridEvent& event ) { event.Skip(); }
@@ -91,7 +91,9 @@ class DIALOG_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM
virtual void OnUpdateSymbol( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExchangeSymbol( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEditSymbol( wxCommandEvent& event ) { event.Skip(); }
virtual void onUpdateEditSymbol( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnEditLibrarySymbol( wxCommandEvent& event ) { event.Skip(); }
virtual void onUpdateEditLibrarySymbol( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnPinTableCellEdited( wxGridEvent& event ) { event.Skip(); }
virtual void OnEditSpiceModel( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
@@ -100,6 +102,7 @@ class DIALOG_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM
public:
DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Symbol Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_SYMBOL_PROPERTIES_BASE();
};
+3 -2
View File
@@ -6,7 +6,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-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
@@ -29,6 +29,7 @@
#include <confirm.h>
#include <reporter.h>
#include <wildcards_and_files_ext.h>
#include <wx_filename.h>
#include <wx_html_report_panel.h>
#include <symbol_library.h>
@@ -201,7 +202,7 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
wxFileName tmpFn = fullFileName;
// Don't add symbol libraries that do not exist.
if( tmpFn.Normalize() && tmpFn.FileExists() )
if( tmpFn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS ) && tmpFn.FileExists() )
{
msg.Printf( _( "Adding library '%s', file '%s' to project symbol library table." ),
libName,
+3
View File
@@ -456,6 +456,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// Legacy schematic can have duplicate time stamps so fix that before converting
// to the s-expression format.
schematic.ReplaceDuplicateTimeStamps();
schematic.SetLegacySymbolInstanceData();
// Allow the schematic to be saved to new file format without making any edits.
OnModify();
@@ -516,6 +517,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
SyncView();
GetScreen()->ClearDrawingState();
TestDanglingEnds();
UpdateHierarchyNavigator();
UpdateTitle();
+2 -2
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras at wanadoo.fr
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2022 KiCad Developers, see change_log.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
@@ -49,7 +49,7 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
if( m_unit == 0 )
msg = _( "All" );
else
msg.Printf( wxT( "%d" ), m_unit );
msg = LIB_SYMBOL::SubReference( m_unit, false );
aList.emplace_back( _( "Unit" ), msg );
+1 -1
View File
@@ -886,7 +886,7 @@ int LIB_PIN::compare( const LIB_ITEM& aOther, int aCompareFlags ) const
if( !( aCompareFlags & COMPARE_FLAGS::UNIT ) && m_number != tmp->m_number )
return m_number.Cmp( tmp->m_number );
int result = m_name.CmpNoCase( tmp->m_name );
int result = m_name.Cmp( tmp->m_name );
if( result )
return result;
+11 -6
View File
@@ -500,7 +500,9 @@ wxString LIB_SYMBOL::SubReference( int aUnit, bool aAddSeparator )
subRef << wxChar( m_subpartIdSeparator );
if( m_subpartFirstId >= '0' && m_subpartFirstId <= '9' )
{
subRef << aUnit;
}
else
{
// use letters as notation. To allow more than 26 units, the sub ref
@@ -932,13 +934,16 @@ const EDA_RECT LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aConvert, bool aIn
{
const LIB_PIN& pin = static_cast<const LIB_PIN&>( item );
// Note: the roots of the pins are always included for symbols that don't have a
// well-defined body.
if( pin.IsVisible() )
{
// Note: the roots of the pins are always included for symbols that don't have
// a well-defined body.
if( aIncludePins && pin.IsVisible() )
bbox.Merge( pin.GetBoundingBox( false, true ) );
else
bbox.Merge( pin.GetPinRoot() );
if( aIncludePins )
bbox.Merge( pin.GetBoundingBox( false, true ) );
else
bbox.Merge( pin.GetPinRoot() );
}
}
else
{
@@ -107,6 +107,9 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
// Write pin list:
for( const PIN_INFO& pin : m_sortedSymbolPinList )
{
if( pin.num.IsEmpty() ) // Erased pin in list
continue;
netName = pin.netName;
netName.Replace( wxT( " " ), wxT( "_" ) );
@@ -317,16 +317,24 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
for( size_t jj = MANDATORY_FIELDS; jj < fields.size(); ++jj )
{
xcomp->AddChild( xproperty = node( "property" ) );
xproperty->AddAttribute( "name", fields[jj].GetCanonicalName() );
xproperty->AddAttribute( "value", fields[jj].GetText() );
xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
xproperty->AddAttribute( wxT( "name" ), fields[jj].GetCanonicalName() );
if( m_resolveTextVars )
xproperty->AddAttribute( wxT( "value" ), fields[jj].GetShownText() );
else
xproperty->AddAttribute( wxT( "value" ), fields[jj].GetText() );
}
for( const SCH_FIELD& sheetField : sheet.Last()->GetFields() )
{
xcomp->AddChild( xproperty = node( "property" ) );
xproperty->AddAttribute( "name", sheetField.GetCanonicalName() );
xproperty->AddAttribute( "value", sheetField.GetText() );
xcomp->AddChild( xproperty = node( wxT( "property" ) ) );
xproperty->AddAttribute( wxT( "name" ), sheetField.GetCanonicalName() );
if( m_resolveTextVars )
xproperty->AddAttribute( wxT( "value" ), sheetField.GetShownText() );
else
xproperty->AddAttribute( wxT( "value" ), sheetField.GetText() );
}
if( !symbol->GetIncludeInBom() )
@@ -350,12 +358,13 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
XNODE* xunits; // Node for extra units
xcomp->AddChild( xunits = node( "tstamps" ) );
auto range = extra_units.equal_range( symbol );
auto range = extra_units.equal_range( symbol );
wxString uuid;
// Output a series of children with all UUIDs associated with the REFDES
for( auto it = range.first; it != range.second; ++it )
{
wxString uuid = ( *it )->m_Uuid.AsString();
uuid = ( *it )->m_Uuid.AsString();
// Add a space between UUIDs, if not in KICAD mode (i.e.
// using wxXmlDocument::Save()). KICAD MODE has its own XNODE::Format function.
@@ -366,8 +375,8 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
}
// Output the primary UUID
xunits->AddChild(
new XNODE( wxXML_TEXT_NODE, wxEmptyString, symbol->m_Uuid.AsString() ) );
uuid = symbol->m_Uuid.AsString();
xunits->AddChild( new XNODE( wxXML_TEXT_NODE, wxEmptyString, uuid ) );
}
}
@@ -25,19 +25,10 @@ import kicad_utils
import csv
import sys
# A helper function to convert a UTF8/Unicode/locale string read in netlist
# for python2 or python3 (Windows/unix)
# A helper function to filter/convert a string read in netlist
#currently: do nothing
def fromNetlistText( aText ):
currpage = sys.stdout.encoding #the current code page. can be none
if currpage is None:
return aText
if currpage != 'utf-8':
try:
return aText.encode('utf-8').decode(currpage)
except UnicodeDecodeError:
return aText
else:
return aText
return aText
def myEqu(self, other):
"""myEqu is a more advanced equivalence function for components which is
@@ -74,7 +65,7 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
# Open a file to write to, if the file cannot be opened output to stdout
# instead
try:
f = kicad_utils.open_file_write(sys.argv[2], 'w')
f = kicad_utils.open_file_writeUTF8(sys.argv[2], 'w')
except IOError:
e = "Can't open output file for writing: " + sys.argv[2]
print( __file__, ":", e, sys.stderr )
@@ -21,16 +21,10 @@ import kicad_utils
import csv
import sys
# A helper function to convert a UTF8/Unicode/locale string read in netlist
# for python2 or python3
# A helper function to filter/convert a string read in netlist
#currently: do nothing
def fromNetlistText( aText ):
if sys.platform.startswith('win32'):
try:
return aText.encode('utf-8').decode('cp1252')
except UnicodeDecodeError:
return aText
else:
return aText
return aText
# Generate an instance of a generic netlist, and load the netlist tree from
# the command line option. If the file doesn't exist, execution will stop
@@ -39,7 +33,7 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
# Open a file to write to, if the file cannot be opened output to stdout
# instead
try:
f = kicad_utils.open_file_write(sys.argv[2], 'w')
f = kicad_utils.open_file_writeUTF8(sys.argv[2], 'w')
except IOError:
e = "Can't open output file for writing: " + sys.argv[2]
print(__file__, ":", e, sys.stderr)
@@ -23,16 +23,10 @@ import kicad_utils
import csv
import sys
# A helper function to convert a UTF8/Unicode/locale string read in netlist
# for python2 or python3
# A helper function to filter/convert a string read in netlist
#currently: do nothing
def fromNetlistText( aText ):
if sys.platform.startswith('win32'):
try:
return aText.encode('utf-8').decode('cp1252')
except UnicodeDecodeError:
return aText
else:
return aText
return aText
# Generate an instance of a generic netlist, and load the netlist tree from
# the command line option. If the file doesn't exist, execution will stop
@@ -41,7 +35,7 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
# Open a file to write to, if the file cannot be opened output to stdout
# instead
try:
f = kicad_utils.open_file_write(sys.argv[2], 'w')
f = kicad_utils.open_file_writeUTF8(sys.argv[2], 'w')
except IOError:
e = "Can't open output file for writing: " + sys.argv[2]
print( __file__, ":", e, sys.stderr )
@@ -21,16 +21,11 @@ import kicad_utils
import csv
import sys
# A helper function to convert a UTF8/Unicode/locale string read in netlist
# for python2 or python3 (Windows/unix)
# A helper function to filter/convert a string read in netlist
#currently: do nothing
def fromNetlistText( aText ):
if sys.platform.startswith('win32'):
try:
return aText.encode('utf-8').decode('cp1252')
except UnicodeDecodeError:
return aText
else:
return aText
return aText
# Generate an instance of a generic netlist, and load the netlist tree from
# the command line option. If the file doesn't exist, execution will stop
@@ -39,7 +34,7 @@ net = kicad_netlist_reader.netlist(sys.argv[1])
# Open a file to write to, if the file cannot be opened output to stdout
# instead
try:
f = kicad_utils.open_file_write(sys.argv[2], 'w')
f = kicad_utils.open_file_writeUTF8(sys.argv[2], 'w' )
except IOError:
e = "Can't open output file for writing: " + sys.argv[2]
print(__file__, ":", e, sys.stderr)
+13 -1
View File
@@ -12,4 +12,16 @@ def open_file_write(path, mode):
if not os.path.isdir(dir_path):
os.makedirs(dir_path)
return open(path, mode)
return open(path, mode)
def open_file_writeUTF8(path, mode):
'''
Open "path" for writing, creating any parent directories as needed.
Use it only for text files. Force text encoding in UTF-8.
'''
dir_path = os.path.dirname(path)
if not os.path.isdir(dir_path):
os.makedirs(dir_path)
return open(path, mode, encoding='utf-8')
+18
View File
@@ -869,6 +869,12 @@ void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
fn.SetExt( PcbFileExtension );
frame = Kiway().Player( FRAME_PCB_EDITOR, true );
// If Kiway() cannot create the Pcbnew frame, it shows a error message, and
// frame is null
if( !frame )
return;
frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
}
@@ -1043,6 +1049,12 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
if( !frame )
{
frame = Kiway().Player( FRAME_PCB_EDITOR, true );
// frame can be null if Cvpcb cannot be run. No need to show a warning
// Kiway() generates the error messages
if( !frame )
return;
frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
}
@@ -1080,6 +1092,12 @@ void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
if( !player )
{
player = Kiway().Player( FRAME_CVPCB, true );
// player can be null if Cvpcb cannot be run. No need to show a warning
// Kiway() generates the error messages
if( !player )
return;
player->Show( true );
}
+2
View File
@@ -1507,6 +1507,8 @@ void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
if( symbolPin->IsDangling() )
tempPin->SetFlags( IS_DANGLING );
else
tempPin->ClearFlags( IS_DANGLING );
}
draw( &tempSymbol, aLayer, false, aSymbol->GetUnit(), aSymbol->GetConvert() );
-7
View File
@@ -193,13 +193,6 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
aList.emplace_back( _( "Type" ), _( "Pin" ) );
if( m_libPin->GetUnit() == 0 )
msg = _( "All" );
else
msg.Printf( wxT( "%d" ), m_libPin->GetUnit() );
aList.emplace_back( _( "Unit" ), msg );
if( m_libPin->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE )
msg = _( "no" );
else if( m_libPin->GetConvert() == LIB_ITEM::LIB_CONVERT::DEMORGAN )
@@ -369,9 +369,6 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary()
PART_ID partID = partPair.first;
PART part = partPair.second;
if( part.Definition.GateSymbols.size() == 0 )
continue;
wxString escapedPartName = EscapeString( part.Name, CTX_LIBID );
LIB_SYMBOL* kiPart = new LIB_SYMBOL( escapedPartName );
@@ -383,7 +380,6 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary()
GATE_ID gateID = gatePair.first;
PART::DEFINITION::GATE gate = gatePair.second;
SYMDEF_ID symbolID = getSymDefFromName( gate.Name, gate.Alternate );
m_partSymbolsMap.insert( { { partID, gateID }, symbolID } );
if( symbolID.IsEmpty() )
{
@@ -400,10 +396,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary()
break;
}
m_partSymbolsMap.insert( { { partID, gateID }, symbolID } );
loadSymDefIntoLibrary( symbolID, &part, gateID, kiPart );
}
if( ok )
if( ok && part.Definition.GateSymbols.size() != 0 )
{
( *m_plugin )->SaveSymbol( m_libraryFileName.GetFullPath(), kiPart );
@@ -414,8 +411,12 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary()
}
else
{
// We can't add new strings onto 6.0 branch, so no error reporting
// Don't save in the library, but still keep it cached as some of the units might have
// been loaded correctly (saving us time later on)
// been loaded correctly (saving us time later on), plus the part definition contains
// the part name, which is important to load
m_partMap.insert( { partID, kiPart } );
}
@@ -1602,17 +1603,19 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
loadLibraryField( attrVal );
}
wxString fpNameInLibrary = generateLibName( footprintRefName, footprintAlternateName );
wxArrayString fpFilters;
fpFilters.Add( fpNameInLibrary );
wxString fpNameInLibrary = generateLibName( footprintRefName, footprintAlternateName );
aSymbol->SetFPFilters( fpFilters );
if( !fpNameInLibrary.IsEmpty() )
{
wxArrayString fpFilters;
fpFilters.Add( fpNameInLibrary );
aSymbol->SetFPFilters( fpFilters );
// Assume that the PCB footprint library name will be the same as the schematic filename
wxFileName schFilename( Filename );
wxString libName = schFilename.GetName();
aSymbol->GetFootprintField().SetText( libName + wxT( ":" ) + fpNameInLibrary );
// Assume that the PCB footprint library name will be the same as the schematic filename
wxFileName schFilename( Filename );
wxString libName = schFilename.GetName();
aSymbol->GetFootprintField().SetText( libName + wxT( ":" ) + fpNameInLibrary );
}
}
if( aCadstarPart && aCadstarPart->Definition.HidePinNames )
@@ -1744,6 +1744,7 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_S
for( LIB_ITEM* item : frameItems )
{
item->SetParent( aSymbol.get() );
item->SetUnit( aGateNumber );
aSymbol->AddDrawItem( item );
}
}
@@ -2193,6 +2193,9 @@ void SCH_SEXPR_PARSER::ParseSchematic( SCH_SHEET* aSheet, bool aIsCopyableOnly,
}
screen->UpdateLocalLibSymbolLinks();
if( m_requiredVersion < 20200828 )
screen->SetLegacySymbolInstanceData();
}
@@ -1463,7 +1463,7 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
m_out->Print( aNestLevel + 1, "(at %s %s %s)",
FormatInternalUnits( aText->GetPosition().x ).c_str(),
FormatInternalUnits( aText->GetPosition().y ).c_str(),
FormatAngle( aText->GetTextAngle() ).c_str() );
FormatAngle( angle * 10.0 ).c_str() );
}
if( aText->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO )
@@ -1692,7 +1692,6 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
symbol->AddHierarchicalReference( path, reference, (int)tmp );
symbol->GetField( REFERENCE_FIELD )->SetText( reference );
}
else if( strCompare( "F", line, &line ) )
{
+37 -8
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 1992-2011 jean-pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -97,6 +97,13 @@ public:
*/
void Split();
/**
* Determine if this reference needs to be split or if it likely already has been
*
* @return true if this reference hasn't been split yet
*/
bool IsSplitNeeded();
void SetRef( const wxString& aReference ) { m_ref = aReference; }
wxString GetRef() const { return m_ref; }
@@ -245,7 +252,7 @@ public:
* @param aItem Reference to check
* @return true if aItem exists in this list
*/
bool Contains( const SCH_REFERENCE& aItem );
bool Contains( const SCH_REFERENCE& aItem ) const;
/* Sort functions:
* Sort functions are used to sort symbols for annotation or BOM generation. Because
@@ -269,6 +276,17 @@ public:
flatList[ii].Split();
}
/**
* Treat all symbols in this list as non-annotated. Does not update annotation state of the
* symbols.
* @see SCH_REFERENCE_LIST::UpdateAnnotation
*/
void RemoveAnnotation()
{
for( unsigned ii = 0; ii < GetCount(); ii++ )
flatList[ii].m_isNew = true;
}
/**
* Update the symbol references for the schematic project (or the current sheet).
*
@@ -410,9 +428,10 @@ public:
*
* @param aIndex is the index in aSymbolsList for of given #SCH_REFERENCE item to test.
* @param aUnit is the given unit number to search.
* @param aIncludeNew true to include references with the "new" flag in the search.
* @return index in aSymbolsList if found or -1 if not found.
*/
int FindUnit( size_t aIndex, int aUnit ) const;
int FindUnit( size_t aIndex, int aUnit, bool aIncludeNew = false ) const;
/**
* Search the list for a symbol with the given KIID path.
@@ -430,16 +449,26 @@ public:
* @param aIdList is the buffer to fill.
* @param aMinRefId is the minimum ID value to store. All values < aMinRefId are ignored.
*/
void GetRefsInUse( int aIndex, std::vector< int >& aIdList, int aMinRefId ) const;
void GetRefsInUse( int aIndex, std::vector<int>& aIdList, int aMinRefId ) const;
/**
* Return the last used (greatest) reference number in the reference list for the prefix
* used by the symbol pointed to by \a aIndex. The symbol list must be sorted.
* Return all the unit numbers for a given reference, comparing library reference, value,
* reference number and reference prefix.
*
* @param aRef is the index of a symbol to use for reference prefix and number filtering.
*/
std::vector<int> GetUnitsMatchingRef( const SCH_REFERENCE& aRef ) const;
/**
* Return the first unused reference number from the properties given in aRef, ensuring
* all of the units in aRequiredUnits are also unused.
*
* @param aIndex The index of the reference item used for the search pattern.
* @param aMinValue The minimum value for the current search.
* @param aRequiredUnits List of units to ensure are free
*/
int GetLastReference( int aIndex, int aMinValue ) const;
int FindFirstUnusedReference( const SCH_REFERENCE& aRef, int aMinValue,
const std::vector<int>& aRequiredUnits ) const;
std::vector<SYMBOL_INSTANCE_REFERENCE> GetSymbolInstances() const;
@@ -492,7 +521,7 @@ private:
* @param aFirstValue The first expected free value
* @return The first free (not yet used) value.
*/
int CreateFirstFreeRefId( std::vector<int>& aIdList, int aFirstValue );
static int createFirstFreeRefId( std::vector<int>& aIdList, int aFirstValue );
// Used for sorting static sortByTimeStamp function
friend class BACK_ANNOTATE;
+26
View File
@@ -1179,6 +1179,24 @@ void SCH_SCREEN::AddBusAlias( std::shared_ptr<BUS_ALIAS> aAlias )
}
void SCH_SCREEN::SetLegacySymbolInstanceData()
{
for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
{
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
// Add missing value and footprint instance data for legacy schematics.
for( const SYMBOL_INSTANCE_REFERENCE& instance : symbol->GetInstanceReferences() )
{
symbol->AddHierarchicalReference( instance.m_Path, instance.m_Reference,
instance.m_Unit,
symbol->GetField( VALUE_FIELD )->GetText(),
symbol->GetField( FOOTPRINT_FIELD )->GetText() );
}
}
}
#if defined(DEBUG)
void SCH_SCREEN::Show( int nestLevel, std::ostream& os ) const
{
@@ -1569,3 +1587,11 @@ void SCH_SCREENS::BuildClientSheetPathList()
}
}
}
void SCH_SCREENS::SetLegacySymbolInstanceData()
{
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
screen->SetLegacySymbolInstanceData();
}
+10
View File
@@ -497,6 +497,11 @@ public:
void AssignNewUuid() { m_uuid = KIID(); }
/**
* Update the symbol value and footprint instance data for legacy designs.
*/
void SetLegacySymbolInstanceData();
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override;
#endif
@@ -715,6 +720,11 @@ public:
*/
bool CanCauseCaseSensitivityIssue( const wxString& aSchematicFileName ) const;
/**
* Update the symbol value and footprint instance data for legacy designs.
*/
void SetLegacySymbolInstanceData();
private:
void addScreenToList( SCH_SCREEN* aScreen, SCH_SHEET* aSheet );
void buildScreenList( SCH_SHEET* aSheet);
+12 -1
View File
@@ -293,13 +293,24 @@ wxString SCH_SHEET_PATH::PathHumanReadable( bool aUseShortRootName ) const
void SCH_SHEET_PATH::UpdateAllScreenReferences()
{
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
std::vector<SCH_ITEM*> symbols;
std::copy_if( LastScreen()->Items().begin(),
LastScreen()->Items().end(),
std::back_inserter( symbols ),
[]( SCH_ITEM* aItem )
{
return ( aItem->Type() == SCH_SYMBOL_T );
} );
for( SCH_ITEM* item : symbols )
{
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
symbol->GetField( REFERENCE_FIELD )->SetText( symbol->GetRef( this ) );
symbol->GetField( VALUE_FIELD )->SetText( symbol->GetValue( this, false ) );
symbol->GetField( FOOTPRINT_FIELD )->SetText( symbol->GetFootprint( this, false ) );
symbol->UpdateUnit( symbol->GetUnitSelection( this ) );
LastScreen()->Update( item );
}
}
+51 -23
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -95,21 +95,22 @@ static LIB_SYMBOL* dummy()
}
SCH_SYMBOL::SCH_SYMBOL( const wxPoint& aPos, SCH_ITEM* aParent ) :
SCH_SYMBOL::SCH_SYMBOL( const wxPoint& aPosition, EDA_ITEM* aParent ) :
SCH_ITEM( aParent, SCH_SYMBOL_T )
{
Init( aPos );
Init( aPosition );
}
SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
const SCH_SHEET_PATH* aSheet, int unit, int convert, const wxPoint& pos ) :
SCH_ITEM( nullptr, SCH_SYMBOL_T )
const SCH_SHEET_PATH* aSheet, int aUnit, int aConvert,
const wxPoint& aPosition, EDA_ITEM* aParent ) :
SCH_ITEM( aParent, SCH_SYMBOL_T )
{
Init( pos );
Init( aPosition );
m_unit = unit;
m_convert = convert;
m_unit = aUnit;
m_convert = aConvert;
m_lib_id = aLibId;
std::unique_ptr< LIB_SYMBOL > part;
@@ -146,8 +147,8 @@ SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet,
const PICKED_SYMBOL& aSel, const wxPoint& pos ) :
SCH_SYMBOL( aSymbol, aSel.LibId, aSheet, aSel.Unit, aSel.Convert, pos )
const PICKED_SYMBOL& aSel, const wxPoint& aPosition, EDA_ITEM* aParent ) :
SCH_SYMBOL( aSymbol, aSel.LibId, aSheet, aSel.Unit, aSel.Convert, aPosition, aParent )
{
// Set any fields that were modified as part of the symbol selection
for( const std::pair<int, wxString>& i : aSel.Fields )
@@ -226,6 +227,15 @@ EDA_ITEM* SCH_SYMBOL::Clone() const
}
bool SCH_SYMBOL::IsMissingLibSymbol() const
{
if( !m_part )
return true;
return false;
}
void SCH_SYMBOL::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 4;
@@ -504,27 +514,29 @@ bool SCH_SYMBOL::IsReferenceStringValid( const wxString& aReferenceString )
void SCH_SYMBOL::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
{
KIID_PATH path = sheet->Path();
bool notInArray = true;
bool found = false;
// check to see if it is already there before inserting it
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
{
if( instance.m_Path == path )
{
found = true;
instance.m_Reference = ref;
notInArray = false;
break;
}
}
if( notInArray )
AddHierarchicalReference( path, ref, m_unit );
if( !found )
AddHierarchicalReference( path, ref, m_unit, GetField( VALUE_FIELD )->GetText(),
GetField( FOOTPRINT_FIELD )->GetText() );
for( std::unique_ptr<SCH_PIN>& pin : m_pins )
pin->ClearDefaultNetName( sheet );
SCH_FIELD* rf = GetField( REFERENCE_FIELD );
rf->SetText( ref ); // for drawing.
// Schematic() is null for new components just added
if( !Schematic() || *sheet == Schematic()->CurrentSheet() )
m_fields[ REFERENCE_FIELD ].SetText( ref );
// Reinit the m_prefix member if needed
m_prefix = UTIL::GetRefDesPrefix( ref );
@@ -634,20 +646,28 @@ void SCH_SYMBOL::SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValue )
}
KIID_PATH path = sheet->Path();
bool found = false;
// check to see if it is already there before inserting it
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
{
if( instance.m_Path == path )
{
found = true;
instance.m_Value = aValue;
return;
break;
}
}
// didn't find it; better add it
AddHierarchicalReference( path, UTIL::GetRefDesUnannotated( m_prefix ), m_unit,
aValue, wxEmptyString );
if( !found )
{
AddHierarchicalReference( path, UTIL::GetRefDesUnannotated( m_prefix ), m_unit, aValue,
wxEmptyString );
}
if( Schematic() && *sheet == Schematic()->CurrentSheet() )
m_fields[ VALUE_FIELD ].SetText( aValue );
}
@@ -685,20 +705,28 @@ void SCH_SYMBOL::SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& aFoo
}
KIID_PATH path = sheet->Path();
bool found = false;
// check to see if it is already there before inserting it
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
{
if( instance.m_Path == path )
{
found = true;
instance.m_Footprint = aFootprint;
return;
break;
}
}
// didn't find it; better add it
AddHierarchicalReference( path, UTIL::GetRefDesUnannotated( m_prefix ), m_unit,
wxEmptyString, aFootprint );
if( !found )
{
AddHierarchicalReference( path, UTIL::GetRefDesUnannotated( m_prefix ), m_unit,
wxEmptyString, aFootprint );
}
if( Schematic() && *sheet == Schematic()->CurrentSheet() )
m_fields[ FOOTPRINT_FIELD ].SetText( aFootprint );
}
+23 -8
View File
@@ -4,7 +4,7 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -78,7 +78,7 @@ extern std::string toUTFTildaText( const wxString& txt );
class SCH_SYMBOL : public SCH_ITEM
{
public:
SCH_SYMBOL( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = nullptr );
SCH_SYMBOL( const wxPoint& aPosition = wxPoint( 0, 0 ), EDA_ITEM* aParent = nullptr );
/**
* Create schematic symbol from library symbol object.
@@ -86,16 +86,16 @@ public:
* @param aSymbol is the library symbol to create schematic symbol from.
* @param aLibId is the #LIB_ID of alias to create.
* @param aSheet is the schematic sheet the symbol is place into.
* @param unit is unit for symbols that have multiple parts per package.
* @param convert is the alternate body style for the schematic symbols.
* @param pos is the position of the symbol.
* @param setNewItemFlag is used to set the symbol #IS_NEW and #IS_MOVING flags.
* @param aUnit is unit for symbols that have multiple parts per package.
* @param aConvert is the alternate body style for the schematic symbols.
* @param aPositions is the position of the symbol.
*/
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
int unit, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ) );
int aUnit, int aConvert = 0, const wxPoint& aPosition = wxPoint( 0, 0 ),
EDA_ITEM* aParent = nullptr );
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
const wxPoint& pos = wxPoint( 0, 0 ) );
const wxPoint& aPosition = wxPoint( 0, 0 ), EDA_ITEM* aParent = nullptr );
/**
* Clone \a aSymbol into a new schematic symbol object.
@@ -120,6 +120,21 @@ public:
return wxT( "SCH_SYMBOL" );
}
/**
* Check to see if the library symbol is set to the dummy library symbol.
*
* When the library symbol is missing (which technically should not happen now that the
* library symbols are cached in the schematic file), a dummy library symbol is substituted
* for the missing symbol as an indicator that something is amiss. The dummy symbol cannot
* be edited so a check for this symbol must be performed before attempting to edit the
* library symbol with the library editor or it will crash KiCad.
*
* @see dummy()
*
* @return true if the library symbol is missing or false if it is valid.
*/
bool IsMissingLibSymbol() const;
const std::vector<SYMBOL_INSTANCE_REFERENCE>& GetInstanceReferences()
{
return m_instanceReferences;
+60 -6
View File
@@ -306,8 +306,26 @@ public:
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
switch( aItem->Type() )
{
case SCH_LINE_T:
return aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS;
case SCH_BUS_WIRE_ENTRY_T:
return true;
case SCH_SYMBOL_T:
return true;
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_SHEET_PIN_T:
return true;
default:
return false;
}
}
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
@@ -400,8 +418,26 @@ public:
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
switch( aItem->Type() )
{
case SCH_LINE_T:
return aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS;
case SCH_BUS_WIRE_ENTRY_T:
return true;
case SCH_SYMBOL_T:
return true;
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_SHEET_PIN_T:
return true;
default:
return false;
}
}
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
@@ -473,8 +509,26 @@ public:
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
switch( aItem->Type() )
{
case SCH_LINE_T:
return aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS;
case SCH_BUS_WIRE_ENTRY_T:
return true;
case SCH_SYMBOL_T:
return true;
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_SHEET_PIN_T:
return true;
default:
return false;
}
}
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
+9 -1
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-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
@@ -401,3 +401,11 @@ SCH_SHEET_LIST& SCHEMATIC::GetFullHierarchy() const
return hierarchy;
}
void SCHEMATIC::SetLegacySymbolInstanceData()
{
SCH_SCREENS screens( m_rootSheet );
screens.SetLegacySymbolInstanceData();
}
+9 -1
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-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
@@ -169,6 +169,14 @@ public:
*/
SCH_SHEET_LIST& GetFullHierarchy() const;
/**
* Update the symbol value and footprint instance data for legacy designs.
*
* Prior to schematic file format version 20200828 and legacy file format version, only
* symbol reference field and unit were saved in the instance data. The value and footprint
* fields must be carried forward from the original symbol to prevent data loss.
*/
void SetLegacySymbolInstanceData();
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override {}
+6
View File
@@ -680,4 +680,10 @@ void NGSPICE::validate()
}
void NGSPICE::Clean()
{
Command( "destroy all" );
}
bool NGSPICE::m_initialized = false;
+3
View File
@@ -93,6 +93,9 @@ public:
///< @copydoc SPICE_SIMULATOR::GetNetlist()
virtual const std::string GetNetlist() const override;
///< @copydoc SIMULATOR::Clean()
void Clean() override final;
private:
void init();
+6 -2
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 CERN
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@@ -52,6 +52,7 @@
#include <wx/ffile.h>
#include <wx/filedlg.h>
#include <dialog_shim.h>
#include <wx_filename.h>
SIM_PLOT_TYPE operator|( SIM_PLOT_TYPE aFirst, SIM_PLOT_TYPE aSecond )
@@ -479,6 +480,7 @@ void SIM_PLOT_FRAME::StartSimulation( const wxString& aSimCommand )
m_simulator->LoadNetlist( formatter.GetString() );
updateTuners();
applyTuners();
m_simulator->Clean();
m_simulator->Run();
}
@@ -1123,7 +1125,7 @@ wxString SIM_PLOT_FRAME::getDefaultPath()
{
wxFileName path = m_simulator->Settings()->GetWorkbookFilename();
path.Normalize( wxPATH_NORM_ALL, Prj().GetProjectPath() );
path.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS, Prj().GetProjectPath() );
return path.GetPath();
}
@@ -1648,6 +1650,8 @@ void SIM_PLOT_FRAME::doCloseWindow()
if( m_simulator->IsRunning() )
m_simulator->Stop();
m_simulator->Clean();
// Cancel a running simProbe or simTune tool
m_schematicFrame->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
+5
View File
@@ -91,6 +91,11 @@ public:
*/
virtual bool IsRunning() = 0;
/**
* Clear simulation data (i.e. all vectors).
*/
virtual void Clean() = 0;
/**
* Execute a Spice command as if it was typed into console.
*
@@ -263,6 +263,7 @@ SYMBOL_EDIT_FRAME::~SYMBOL_EDIT_FRAME()
delete screen;
m_isSymbolFromSchematic = false;
}
// current screen is destroyed in EDA_DRAW_FRAME
SetScreen( m_dummyScreen );
@@ -31,6 +31,7 @@
#include <pgm_base.h>
#include <kiway.h>
#include <profile.h>
#include <wx_filename.h>
#include <sch_io_mgr.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <symbol_lib_table.h>
@@ -210,10 +211,10 @@ bool SYMBOL_LIBRARY_MANAGER::SaveLibrary( const wxString& aLibrary, const wxStri
if( row )
{
original = row->GetFullURI( true );
original.Normalize();
original.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
}
destination.Normalize();
destination.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
if( res && original == destination )
libBuf.ClearDeletedBuffer();
+47 -8
View File
@@ -181,11 +181,10 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAM
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxT( "MsgPanel" ) )
.Bottom().Layer( 6 ) );
m_auimgr.AddPane( m_libList, EDA_PANE().Palette().Name( wxT( "Libraries" ) ).Left().Layer(3)
.CaptionVisible( false ).MinSize( 80, -1 ).BestSize( m_libListWidth, -1 ) );
m_auimgr.AddPane( m_libList, EDA_PANE().Palette().Name( wxT( "Libraries" ) ).Left().Layer(2)
.CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 200, -1 ) );
m_auimgr.AddPane( m_symbolList, EDA_PANE().Palette().Name( wxT( "Symbols" ) ).Left().Layer(1)
.CaptionVisible( false ).MinSize( 80, -1 )
.BestSize( m_symbolListWidth, -1 ) );
.CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 300, -1 ) );
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxT( "DrawFrame" ) ).Center() );
@@ -193,6 +192,44 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAM
m_auimgr.Update();
if( m_libListWidth > 0 )
{
wxAuiPaneInfo& treePane = m_auimgr.GetPane( wxT( "Libraries" ) );
// wxAUI hack: force width by setting MinSize() and then Fixed()
// thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
treePane.MinSize( m_libListWidth, -1 );
treePane.Fixed();
m_auimgr.Update();
// now make it resizable again
treePane.Resizable();
m_auimgr.Update();
// Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
// back to minimum.
treePane.MinSize( 100, -1 );
}
if( m_symbolListWidth > 0 )
{
wxAuiPaneInfo& treePane = m_auimgr.GetPane( wxT( "Symbols" ) );
// wxAUI hack: force width by setting MinSize() and then Fixed()
// thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
treePane.MinSize( m_symbolListWidth, -1 );
treePane.Fixed();
m_auimgr.Update();
// now make it resizable again
treePane.Resizable();
m_auimgr.Update();
// Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
// back to minimum.
treePane.MinSize( 100, -1 );
}
if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
{
Raise();
@@ -705,11 +742,13 @@ void SYMBOL_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_LibViewPanel.show_pin_electrical_type;
// Set parameters to a reasonable value.
if( m_libListWidth > m_frameSize.x / 2 )
m_libListWidth = m_frameSize.x / 2;
int maxWidth = cfg->m_LibViewPanel.window.state.size_x - 80;
if( m_symbolListWidth > m_frameSize.x / 2 )
m_symbolListWidth = m_frameSize.x / 2;
if( m_libListWidth + m_symbolListWidth > maxWidth )
{
m_libListWidth = maxWidth * ( m_libListWidth / ( m_libListWidth + m_symbolListWidth ) );
m_symbolListWidth = maxWidth - m_libListWidth;
}
}
-3
View File
@@ -112,9 +112,6 @@ bool BACK_ANNOTATE::FetchNetlistFromPCB( std::string& aNetlist )
frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
}
if( wxWindow* blocking_win = frame->Kiway().GetBlockingDialog() )
blocking_win->Close( true );
m_frame->Kiway().ExpressMail( FRAME_PCB_EDITOR, MAIL_PCB_GET_NETLIST, aNetlist );
return true;
}
+1
View File
@@ -294,6 +294,7 @@ void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, b
case SCH_HIER_LABEL_T:
case SCH_LABEL_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_SHEET_PIN_T:
{
std::vector<wxPoint> pts = aItem->GetConnectionPoints();
+2 -1
View File
@@ -269,7 +269,8 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
continue;
wxPoint pos( cursorPos );
symbol = new SCH_SYMBOL( *libSymbol, &m_frame->GetCurrentSheet(), sel, pos );
symbol = new SCH_SYMBOL( *libSymbol, &m_frame->GetCurrentSheet(), sel, pos,
&m_frame->Schematic() );
addSymbol( symbol );
// Update cursor now that we have a symbol
+7 -2
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 CERN
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-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
@@ -668,10 +668,11 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
}
else
{
EE_SELECTION selectionCopy = selection;
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
EE_SELECTION selectionCopy = selection;
m_toolMgr->RunAction( EE_ACTIONS::trimOverlappingWires, true, &selectionCopy );
m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selectionCopy );
@@ -1397,6 +1398,10 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
if( wxWindow* blocking_win = editor->Kiway().GetBlockingDialog() )
blocking_win->Close( true );
// The broken library symbol link indicator cannot be edited.
if( symbol->IsMissingLibSymbol() )
return 0;
editor->LoadSymbolFromSchematic( symbol );
editor->Show( true );
+9 -12
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 CERN
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -62,6 +62,7 @@
#include <eda_list_dialog.h>
#include <wildcards_and_files_ext.h>
#include <wx_filename.h>
#include <sch_sheet_path.h>
#include <wx/filedlg.h>
@@ -499,18 +500,12 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
continue;
}
sheet->UpdateAllScreenReferences();
item = nextMatch( sheet->LastScreen(), sheet, nullptr, data );
if( item )
{
m_frame->Schematic().SetCurrentSheet( *sheet );
sheet->LastScreen()->TestDanglingEnds();
m_frame->SetScreen( sheet->LastScreen() );
m_frame->UpdateHierarchyNavigator();
m_frame->DisplayCurrentSheet();
UpdateFind( ACTIONS::updateFind.MakeEvent() );
break;
@@ -1020,17 +1015,18 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
}
}
if( !conn )
if( !conn || conn == editFrame->GetHighlightedConnection() )
{
editFrame->SetStatusText( wxEmptyString );
editFrame->SendCrossProbeClearHighlight();
editFrame->SetHighlightedConnection( nullptr );
}
else
{
editFrame->SetCrossProbeConnection( conn );
editFrame->SetHighlightedConnection( conn );
}
editFrame->SetHighlightedConnection( conn );
editFrame->UpdateNetHighlightStatus();
TOOL_EVENT dummy;
@@ -1841,7 +1837,8 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
if( !fn.IsAbsolute() )
{
wxFileName currentSheetFileName = pasteRoot.LastScreen()->GetFileName();
fn.Normalize( wxPATH_NORM_ALL, currentSheetFileName.GetPath() );
fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS,
currentSheetFileName.GetPath() );
}
// Try to find the screen for the pasted sheet by several means
@@ -1986,7 +1983,7 @@ int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
if( selection.GetSize() >= 1 )
symbol = (SCH_SYMBOL*) selection.Front();
if( !symbol || symbol->GetEditFlags() != 0 )
if( !symbol || symbol->GetEditFlags() != 0 || symbol->IsMissingLibSymbol() )
return 0;
m_toolMgr->RunAction( ACTIONS::showSymbolEditor, true );
+34 -5
View File
@@ -438,6 +438,14 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
chain_commands = true;
break;
}
else if( evt->IsAction( &EE_ACTIONS::rotateCW ) )
{
m_toolMgr->RunAction( EE_ACTIONS::rotateCW, true );
}
else if( evt->IsAction( &EE_ACTIONS::rotateCCW ) )
{
m_toolMgr->RunAction( EE_ACTIONS::rotateCCW, true );
}
else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
{
if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
@@ -544,6 +552,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoin
EE_RTREE& items = m_frame->GetScreen()->Items();
EE_RTREE::EE_TYPE itemsOverlapping = items.Overlapping( aOriginalItem->GetBoundingBox() );
bool ptHasUnselectedJunction = false;
SCH_LINE* newWire = nullptr;
for( SCH_ITEM* item : itemsOverlapping )
{
@@ -625,19 +634,19 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoin
case SCH_SHEET_T:
case SCH_SYMBOL_T:
case SCH_JUNCTION_T:
if( test->IsConnected( aPoint ) )
if( test->IsConnected( aPoint ) && !newWire )
{
// Add a new wire between the symbol or junction and the selected item so
// the selected item can be dragged.
SCH_LINE* newWire = nullptr;
if( test->GetLayer() == LAYER_BUS_JUNCTION ||
aOriginalItem->GetLayer() == LAYER_BUS )
if( test->GetLayer() == LAYER_BUS_JUNCTION
|| aOriginalItem->GetLayer() == LAYER_BUS )
{
newWire = new SCH_LINE( aPoint, LAYER_BUS );
}
else
{
newWire = new SCH_LINE( aPoint, LAYER_WIRE );
}
newWire->SetFlags( IS_NEW );
m_frame->AddToScreen( newWire, m_frame->GetScreen() );
@@ -685,6 +694,26 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoin
}
}
}
else if( test->IsConnected( aPoint ) && !newWire )
{
// Add a new wire between the label and the selected item so the selected item
// can be dragged.
if( test->GetLayer() == LAYER_BUS_JUNCTION
|| aOriginalItem->GetLayer() == LAYER_BUS )
{
newWire = new SCH_LINE( aPoint, LAYER_BUS );
}
else
{
newWire = new SCH_LINE( aPoint, LAYER_WIRE );
}
newWire->SetFlags( IS_NEW );
m_frame->AddToScreen( newWire, m_frame->GetScreen() );
newWire->SetFlags( TEMP_SELECTED | STARTPOINT );
aList.push_back( newWire );
}
break;
+1 -1
View File
@@ -52,7 +52,7 @@ SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway,
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
}
m_preview = new SCH_PREVIEW_PANEL( aParent, wxID_ANY, wxDefaultPosition, wxSize( -1, -1 ),
m_preview = new SCH_PREVIEW_PANEL( this, wxID_ANY, wxDefaultPosition, wxSize( -1, -1 ),
m_galDisplayOptions, canvasType );
m_preview->SetStealsFocus( false );
m_preview->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
+3
View File
@@ -35,6 +35,7 @@
#include <math/vector2d.h>
#include <widgets/msgpanel.h>
#include <memory>
#include <mutex>
#include <gal/cursors.h>
@@ -253,6 +254,8 @@ protected:
bool m_pendingRefresh; ///< Is there a redraw event requested?
wxTimer m_refreshTimer; ///< Timer to prevent too-frequent refreshing
std::mutex m_refreshMutex; ///< Blocks multiple calls to the draw
/// True if GAL is currently redrawing the view
bool m_drawing;
+8
View File
@@ -175,6 +175,14 @@ void delete_if( _Container& __c, _Function&& __f )
__c.erase( std::remove_if( __c.begin(), __c.end(), std::forward<_Function>( __f ) ), __c.end() );
}
/**
* @brief Deletes all duplicate values from \a __c.
*/
template <class _Container>
void remove_duplicates( _Container& __c )
{
__c.erase( std::unique( __c.begin(), __c.end() ), __c.end() );
}
} // namespace alg
+3 -3
View File
@@ -46,9 +46,9 @@ public:
private:
bool m_isNull;
T m_min;
T m_opt;
T m_max;
T m_min{};
T m_opt{};
T m_max{};
bool m_hasMin = false;
bool m_hasOpt = false;
bool m_hasMax = false;
@@ -60,6 +60,11 @@ public:
*/
void SetSheetName( const std::string& aSheetName ) { m_sheetName = aSheetName; }
/**
* Set the sheet path displayed in the title block.
*/
void SetSheetPath( const std::string& aSheetPath ) { m_sheetPath = aSheetPath; }
/**
* Changes the page number displayed in the title block.
*/
@@ -132,6 +137,7 @@ protected:
std::string m_fileName;
std::string m_sheetName;
std::string m_sheetPath;
const TITLE_BLOCK* m_titleBlock;
const PAGE_INFO* m_pageInfo;
std::string m_pageNumber;
+1 -1
View File
@@ -42,7 +42,7 @@
#define TR_OP_DIV 0x202
#define TR_OP_ADD 0x203
#define TR_OP_SUB 0x204
#define TR_OP_LESS 0x25
#define TR_OP_LESS 0x205
#define TR_OP_GREATER 0x206
#define TR_OP_LESS_EQUAL 0x207
#define TR_OP_GREATER_EQUAL 0x208
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -29,8 +29,8 @@
#include <map>
#include <vector>
#include <kiid.h>
#include <wx_filename.h>
#include <wx/string.h>
#include <wx/filename.h>
#include <core/typeinfo.h>
/// A variable name whose value holds the current project directory.
+9 -1
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.TXT for contributors.
* Copyright (C) 2019-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
@@ -112,6 +112,12 @@ public:
PCB_LAYER_ID GetActiveLayer() const { return m_activeLayer; }
void SetActiveLayer( PCB_LAYER_ID aLayer ) { m_activeLayer = aLayer; }
const wxString& GetLayerName() const { return m_layerName; }
void SetLayerName( const wxString& aLayerName ) { m_layerName = aLayerName; }
LSET GetPrintLayers() const { return m_printLayers; }
void SetPrintLayers( LSET aLayerSet ) { m_printLayers = aLayerSet; }
/**
* Clear the list of active layers.
*/
@@ -283,6 +289,7 @@ protected:
virtual void update();
PCB_LAYER_ID m_activeLayer; // The active layer (as shown by appearance mgr)
wxString m_layerName;
std::set<unsigned int> m_highContrastLayers; // High-contrast layers (both board layers and
// synthetic GAL layers)
COLOR4D m_layerColors[LAYER_ID_COUNT]; // Layer colors
@@ -311,6 +318,7 @@ protected:
// lines. This sets an absolute minimum.
bool m_showPageLimits;
bool m_isPrinting;
LSET m_printLayers;
wxDC* m_printDC; // This can go away once the drawing sheet is moved to
// Cairo-based printing.
+7
View File
@@ -419,6 +419,13 @@ public:
*/
bool IsMoveTool() const;
/**
* Indicate if the event is asking for an editor tool.
*
* Used to allow deleting an element without de-activating the current tool.
*/
bool IsEditorTool() const;
/**
* Indicate if the event is from the simulator.
*/
+2
View File
@@ -46,6 +46,8 @@ public:
void SetError( const wxString& aMessage, wxWindow* aPage, wxWindow* aCtrl, int aRow = -1,
int aCol = -1 );
void UpdateResetButton( int aPage );
protected:
void finishInitialization();
+13 -1
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -26,6 +26,18 @@
#include <wx/filename.h>
/**
* Default flags to pass to wxFileName::Normalize().
*
* @note wxPATH_NORM_ALL is deprecated in wxWidgets 3.1 and later. wxPATH_NORM_ENV_VARS
* is not included because it has some known issues and we typically use our own
* ExpandEnvVarSubstitutions() for handling environment variable expansion. If
* ExpandEnvVarSubstitutions() is not used, logically or wxPATH_NORM_ENV_VARS to
* this.
*/
#define FN_NORMALIZE_FLAGS ( wxPATH_NORM_DOTS | wxPATH_NORM_TILDE | wxPATH_NORM_ABSOLUTE | \
wxPATH_NORM_LONG | wxPATH_NORM_SHORTCUT )
/**
* A wrapper around a wxFileName which is much more performant with a subset of the API.
*
+4 -3
View File
@@ -24,6 +24,7 @@
#include "dialog_template_selector.h"
#include <bitmaps.h>
#include <wx_filename.h>
#include <wx/dir.h>
#include <wx/dirdlg.h>
#include <wx/settings.h>
@@ -178,7 +179,7 @@ void DIALOG_TEMPLATE_SELECTOR::AddTemplatesPage( const wxString& aTitle, wxFileN
{
wxNotebookPage* newPage = new wxNotebookPage( m_notebook, wxID_ANY );
aPath.Normalize();
aPath.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
wxString path = aPath.GetFullPath(); // caller ensures this ends with file separator.
TEMPLATE_SELECTION_PANEL* tpanel = new TEMPLATE_SELECTION_PANEL( newPage, path );
@@ -239,7 +240,7 @@ void DIALOG_TEMPLATE_SELECTOR::onDirectoryBrowseClicked( wxCommandEvent& event )
{
wxFileName fn;
fn.AssignDir( m_tcTemplatePath->GetValue() );
fn.Normalize();
fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
wxString currPath = fn.GetFullPath();
wxDirDialog dirDialog( this, _( "Select Templates Directory" ), currPath,
@@ -268,7 +269,7 @@ void DIALOG_TEMPLATE_SELECTOR::onReload( wxCommandEvent& event )
wxFileName fn;
fn.AssignDir( m_tcTemplatePath->GetValue() );
fn.Normalize();
fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
currPath = fn.GetFullPath();
m_tcTemplatePath->SetValue( currPath );

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