Compare commits

...

341 Commits

Author SHA1 Message Date
Wayne Stambaugh 3993e6dcb0 Tag stable version 9.0.1 release candidate 1. 2025-03-17 08:25:45 -04:00
Seth Hillbrand e1436d3597 Fix inheritance for git_common
Avoids repo type pointer issues when casting from void

(cherry picked from commit 676dd4ceec)
2025-03-16 18:04:47 -07:00
aris-kimi 28ba36129a Fix a git2 related crash when closing KiCad
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/20202
(cherry picked from commit bb62444fe9)
2025-03-16 18:03:16 -07:00
Seth Hillbrand c6abc5fdd0 Add ability for git to negotiate with agents
Updates the git connection dialog to reflect default agentic behavior,
followed by default keys and only then reverting to a custom selection
if the user desires

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

(cherry picked from commit 2c52f98da4)
2025-03-16 18:03:16 -07:00
Seth Hillbrand 6104651613 Adjust git handling
- Utilize scoped deletion for individual git_*_free() calls
- Protect against multiple usage when updating icons
- Reduce frequency of git update calls

(cherry picked from commit 26c331a837)
2025-03-16 18:03:16 -07:00
Jon Evans 5b88f2509e Use stable sort ordering in ERC reports
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20333


(cherry picked from commit fe22166d9f)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-16 11:22:06 -04:00
Jon Evans 6768e34e0e Use UI order for drill report stackup
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20069


(cherry picked from commit 77747aa41e)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-16 11:13:37 -04:00
Alex Shvartzkop 372b704844 Update translations 2025-03-15 19:01:17 +03:00
Marco Ciampa 3648c8c31a Translated using Weblate (Italian)
Currently translated at 96.1% (9568 of 9955 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/it/
2025-03-15 16:58:36 +01:00
İclal Gör 2df3924ea0 Translated using Weblate (Turkish)
Currently translated at 65.5% (6529 of 9955 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-15 16:58:36 +01:00
Marco Ciampa 48d194a0fc Translated using Weblate (Italian)
Currently translated at 96.1% (9569 of 9955 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/it/
2025-03-15 16:58:36 +01:00
Shuwn Hsu 8a3d7d66a1 Translated using Weblate (Chinese (Traditional Han script))
Currently translated at 91.0% (9065 of 9955 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/zh_Hant/
2025-03-15 16:58:36 +01:00
İclal Gör d7c9c8aeca Translated using Weblate (Turkish)
Currently translated at 65.5% (6524 of 9955 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-15 16:58:36 +01:00
Marco Ciampa 48d3b67686 Translated using Weblate (Italian)
Currently translated at 96.0% (9566 of 9955 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/it/
2025-03-15 16:58:35 +01:00
Henrik Kauhanen a4ac97d5de Translated using Weblate (Swedish)
Currently translated at 99.9% (9954 of 9955 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/sv/
2025-03-15 16:58:35 +01:00
dsa-t bb525e3c68 Translated using Weblate (Russian)
Currently translated at 100.0% (9955 of 9955 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ru/
2025-03-15 16:58:35 +01:00
Wayne Stambaugh d4002b95d4 Revert "Tag stable version 9.0.1 release candidate 1."
This reverts commit ae4978502f.
2025-03-15 09:00:27 -04:00
Wayne Stambaugh ae4978502f Tag stable version 9.0.1 release candidate 1. 2025-03-15 07:25:25 -04:00
Seth Hillbrand c4ad3456f4 Fix mistake in arc circle collision
Need to test nearest point from the circle center to the arc.  Add QA to
prevent regression

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

(cherry picked from commit de09403b10)
2025-03-14 18:06:54 -07:00
Eli Hughes c521dabcf0 Seeding a simple python script to create a test server for http libs.
(cherry picked from commit e972fb42ee)
2025-03-14 16:55:49 -07:00
Graham Keeth b5716ef54b improve tooltips in sync sheet pins dialog
(cherry picked from commit 89a5fadcdc)
2025-03-14 16:55:24 -07:00
Graham Keeth 9515bf9038 Add ellipses for sheet/sheet pin actions
(cherry picked from commit c57088a60c)
2025-03-14 16:55:05 -07:00
Graham Keeth 38dcfdc350 capitalize Git in display strings
(cherry picked from commit 68869f6439)
2025-03-14 16:54:45 -07:00
Seth Hillbrand 55aeca477d Unify embedded file writing
For unknown reasons, one method of writing was not working on Windows.
This is an attempt to write using the common wxFFileOutputStream to see
if that results in better output for Windows clients

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

(cherry picked from commit 03af293683)
2025-03-14 16:52:12 -07:00
Seth Hillbrand 572fcdfa22 Update fp properties even when can't update fp
When updating the footprint, we may encounter a missing footprint.  We
should still modify the netlist against the existing footprint (if one
does exist) to match the netlist.  This matches the behavior of updating
the netlist when fp are not selected for update

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

(cherry picked from commit 72411af9de)
2025-03-14 16:51:26 -07:00
Eric 234994bf53 ODB++:Fix date format in misc/info file
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20103

(cherry picked from commit 92cdca69b3)
2025-03-14 16:51:18 -07:00
Seth Hillbrand 49d8fc900f Map a full hierarchy during PDF plotting
Re-create the schematic hierarchy in PDF plots to ease navigation
relative to the on screen schematic

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

(cherry picked from commit 4a3b33df4e)
2025-03-14 16:51:18 -07:00
JamesJCode 27b55eb32f Include child SCH_PINs in SCH_RULE_AREA item caches
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20332

(cherry picked from commit 078a01976f)
2025-03-14 20:58:15 +00:00
jean-pierre charras cf118f142c plot mask layers: do not skip mask on track when solder mask min web is not 0
When solder mask min web is not 0, PlotSolderMaskLayer() uses GenerateLayerPoly(),
that skipped tracks (not updated since tracks can be on a mask layer)

(cherry picked from commit 7f1b412203)
2025-03-14 16:10:31 +01:00
Jeff Young be0c8c88e5 Don't modify selection in the middle of a move/drag.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20239
2025-03-14 14:52:04 +00:00
Jeff Young de953b0fdb Refresh preview after rotate/flip/mirror during move.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19561

(cherry picked from commit 3c32f4d31d)
2025-03-14 14:52:04 +00:00
Jeff Young 3ea0191954 Init checkboxes after reading prefs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20309

(cherry picked from commit 521b411090)
2025-03-14 14:52:04 +00:00
Jon Evans f835591c8b Simulator: Fix line offset in intermediate ngspice file
- Fixes issue #20268
- Replace the hard coded line numbers
- Search for "Value:" string instead


(cherry picked from commit 313232c9f3)

Co-authored-by: Lucas Gerads <lucas.gerads@aixcon.de>
2025-03-13 18:30:24 -04:00
Jeff Young 12fcf31dc5 Fix failure to increment job number.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20034

(cherry picked from commit 2304d10879)
2025-03-13 16:55:32 +00:00
Jeff Young 31b65a241f Don't report non-meeting line-pairs.
We're called on each line pair, so a rect would otherwise
always report to failures for the two pairs of opposite
sides.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20326
2025-03-13 16:30:48 +00:00
Alex Shvartzkop 2bf369793c Fix Eagle PCB layers handling after v9 layer changes. 2025-03-13 17:48:29 +03:00
Jeff Young 12680cfecb Render tables & their borders to 3D view.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19981

(cherry picked from commit f3f9730f2c)
2025-03-13 14:04:50 +00:00
Jeff Young ff578d9866 De-duplicate table border drawing code.
Also cleans up a misconception about table header borders,
and renames the getter/setter to be clearer.

Also makes sure that table cells are updated when the table
layer changes.

And another bug where we were writing the grey color value
back to the cell for hidden cells.
2025-03-13 13:08:30 +00:00
Jeff Young 48e254fe4c EE -> SCH (no functional changes) 2025-03-13 12:28:25 +00:00
Alex Shvartzkop 222bfda5c3 Update translations 2025-03-13 15:26:42 +03:00
Marco Ciampa c93d8115cb Translated using Weblate (Italian)
Currently translated at 95.9% (9555 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/it/
2025-03-13 13:23:35 +01:00
dsa-t 5c1d7f11d7 Translated using Weblate (Russian)
Currently translated at 100.0% (9954 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ru/
2025-03-13 13:23:35 +01:00
İclal Gör 90d64e3eb1 Translated using Weblate (Turkish)
Currently translated at 60.3% (6010 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:35 +01:00
İclal Gör 8cbd172c3c Translated using Weblate (Turkish)
Currently translated at 60.2% (5997 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:35 +01:00
İclal Gör 69de87675a Translated using Weblate (Turkish)
Currently translated at 58.7% (5845 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:35 +01:00
Argeolog 33492efb01 Translated using Weblate (Turkish)
Currently translated at 58.1% (5785 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:35 +01:00
2tama3 e22e2c5109 Translated using Weblate (Japanese)
Currently translated at 99.9% (9950 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ja/
2025-03-13 13:23:35 +01:00
Marc de Miguel 8937a7cc82 Translated using Weblate (Catalan)
Currently translated at 41.7% (4159 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ca/
2025-03-13 13:23:35 +01:00
Ahmet Saygın ÖĞÜLMÜŞ 141eb9d1b7 Translated using Weblate (Turkish)
Currently translated at 58.1% (5786 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:35 +01:00
Marc de Miguel f291629c64 Translated using Weblate (Catalan)
Currently translated at 41.6% (4141 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ca/
2025-03-13 13:23:35 +01:00
İclal Gör b4dbba2f5f Translated using Weblate (Turkish)
Currently translated at 58.0% (5775 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:35 +01:00
Marc de Miguel bafa055114 Translated using Weblate (Catalan)
Currently translated at 41.5% (4133 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ca/
2025-03-13 13:23:35 +01:00
dsa-t 2ca4f60729 Translated using Weblate (Turkish)
Currently translated at 57.2% (5699 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:35 +01:00
İclal Gör 9451214ecf Translated using Weblate (Turkish)
Currently translated at 57.2% (5699 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:35 +01:00
Marc de Miguel 635974cfcc Translated using Weblate (Catalan)
Currently translated at 41.4% (4129 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ca/
2025-03-13 13:23:35 +01:00
İclal Gör a40c4c68d1 Translated using Weblate (Turkish)
Currently translated at 55.1% (5488 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:34 +01:00
CloverGit b422281eb8 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.9% (9946 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/zh_Hans/
2025-03-13 13:23:34 +01:00
Argeolog 5e3eda108f Translated using Weblate (Turkish)
Currently translated at 54.7% (5454 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:34 +01:00
İclal Gör 5bd28c9569 Translated using Weblate (Turkish)
Currently translated at 54.7% (5454 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:34 +01:00
CloverGit fc562ba229 Translated using Weblate (Chinese (Traditional Han script))
Currently translated at 91.0% (9063 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/zh_Hant/
2025-03-13 13:23:34 +01:00
CloverGit e3ab4b066c Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.8% (9943 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/zh_Hans/
2025-03-13 13:23:34 +01:00
Ahmet Saygın ÖĞÜLMÜŞ edfba6ce84 Translated using Weblate (Turkish)
Currently translated at 54.6% (5442 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:34 +01:00
Henrik Kauhanen 7f7b023c19 Translated using Weblate (Swedish)
Currently translated at 99.9% (9953 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/sv/
2025-03-13 13:23:33 +01:00
Ettore Atalan 2e9c197f09 Translated using Weblate (German)
Currently translated at 99.9% (9949 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/de/
2025-03-13 13:23:33 +01:00
Ahmet Saygın ÖĞÜLMÜŞ f8db7a2aca Translated using Weblate (Turkish)
Currently translated at 54.4% (5423 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-13 13:23:33 +01:00
dsa-t 34138ffc42 Translated using Weblate (Russian)
Currently translated at 100.0% (9954 of 9954 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ru/
2025-03-13 13:23:33 +01:00
jean-pierre charras 10d34f5b9b Eeschema printing: ensure the flag "is first page" is correctly set.
It is mainly used to draw page layouts having different objects drawn on
first page and other pages.

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

(cherry picked from commit ddd27f2869)
2025-03-13 11:36:07 +01:00
Seth Hillbrand 7cb85e2dd1 Correct layerset calls
The Board layerset (because BOARD is a BOARD_ITEM) should return the
layers that the board contains instead of just the F.Cu.  This assigns
the common function to map to the board-specific functions

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

(cherry picked from commit 96794e94e3)
2025-03-12 11:49:11 -07:00
Seth Hillbrand 34906f0871 Be sure to clear hit cache
When re-running the DRC creepage check, we need to ensure that the
element-element hittest set is cleared to report the same errors again

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

(cherry picked from commit 1c245ad01e)
2025-03-12 11:49:08 -07:00
jean-pierre charras 2fa818b002 LISTBOX_TRICKS::listBoxDeleteSelected(): fix crash when trying to remove 0 entries.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20320

(cherry picked from commit dd604361d3)
2025-03-12 16:06:38 +01:00
Jeff Young 9e98bb68d7 Add textOnEdgeCuts to global DRC items list.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20308

(cherry picked from commit 6df9c90440)
2025-03-12 11:32:12 +00:00
Jeff Young 4b26e737c0 Don't wait for mouse move to draw selection shadows.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20309
2025-03-12 09:39:03 +00:00
jean-pierre charras bcb8c2097c BOARD::BulkRemoveStaleTeardrops(): fix bug that prevent removing a teardrop.
When a teardrop is the first zone (or the only one) in list (i.e. last tested)
it was ignored, and therefore not removed.

(cherry picked from commit ccc396a6c2)
2025-03-12 09:51:38 +01:00
Jon Evans 028721f3ed Don't use size events for persistence
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20060


(cherry picked from commit 95e6ca44c6)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-11 22:37:29 -04:00
Jon Evans b837dc1d3b Fix build with protobuf 30
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20300


(cherry picked from commit 5774338af2)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-11 17:33:47 -04:00
Jeff Young 3446dbbf27 Apply Damjan's rotated table fixes to PCB_TABLE::GetEffectiveShape().
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20143

(cherry picked from commit b7ef57a97d)
2025-03-11 20:17:47 +00:00
Jeff Young aee836d722 Don't disable first internal layer in footprint editor.
It's used as a proxy for all internal layers.

Also fixes LAYER_RANGE_ITERATOR so that it works with an odd
number of copper layers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20246
2025-03-11 18:41:35 +00:00
Seth Hillbrand 5d9908647c Don't write empty data tags
Also avoid throwing if a data stream is empty so that you can still read
the schematic/pcb/library

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

(cherry picked from commit a6fbf4bbdb)
2025-03-11 09:45:17 -07:00
Jeff Young 631c5ec01d Tables support for router.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20295

(cherry picked from commit 567da3de91)
2025-03-11 16:39:59 +00:00
Jeff Young d92f42cdcb Check parent footprint as well for component class.
Also output more descriptive text when checking inherited
rules on parent footprint.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20281
2025-03-11 16:39:59 +00:00
Tomasz Wlostowski a4893523e4 router: simplify post-walkaround lines 2025-03-11 13:40:14 +01:00
Tomasz Wlostowski 4dc0a31071 multichannel: possible fix for ghosting footprints when using grouping
(cherry picked from commit c05cc345f3)
2025-03-11 13:40:14 +01:00
Tomasz Wlostowski c65a1139cb connectivity: treat empty FPIDs as matching in TOPO_MATCH
(cherry picked from commit b1bf5127fa)
2025-03-11 13:40:14 +01:00
Tomasz Wlostowski 71aae415a4 connectivity: TOPO_MATCH now orders reference components by the lowest matching candidate count.
This heuristic seems to make the algorithm reject non-isomorphic mappings much earlier on and converges faster on a solution for typical circuits.

(cherry picked from commit 8192ba73d9)
2025-03-11 13:40:14 +01:00
Tomasz Wlostowski 7061b64319 connectivity: TOPO_MATCH now prioritizes component candidates by the ratio of matching pad nets.
This improves cloning of circuits with numerous of matching component mappings (e.g. LED matrices) by
taking preference for mappings with same order of net connections.

(cherry picked from commit 91ee987cfe)
2025-03-11 13:40:14 +01:00
Tomasz Wlostowski 03da07767d router: refine the endpoint moving logic so that it doesn't block shoving
(cherry picked from commit b4d29a98f9)
2025-03-11 13:40:14 +01:00
Tomasz Wlostowski f3c5b21b1b router: fix regression in post-shove optimization
Note to self: we keep track of the formerly pushed vias in the line stack, but pruning one from the optimizer queue should not prune the lines attached to it.

(cherry picked from commit 78fc95fd6d)
2025-03-11 13:40:14 +01:00
Tomasz Wlostowski 69eb81196d router: prevent assertion fail in MULTI_DRAGGER
Fixes https://gitlab.com/kicad/code/kicad/issues/20075

(cherry picked from commit 9e4947ed36)
2025-03-11 13:40:14 +01:00
Tomasz Wlostowski f23b06de27 router: prevent disconencting via fanout traces when shoving
Note to self: move-endpoints fallback mode must check for vias connected at the obstacle LINE's ends - fallback is only applicable for unconnected ends.

(cherry picked from commit 29a4ec0fde)
2025-03-11 13:40:14 +01:00
Tomasz Wlostowski badaac9366 router: improved shove litter fix
Note to self: managing the shove stack is quite challenging and there were a few corner cases
where reverse via/segment collisions would cause a head segment (or a via) to have multiple clones in the stack.
As SHOVE::removeHeads() took only complete head lines, sometimes it resulted with stray vias/segments.

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

(cherry picked from commit bfbdfcf872)
2025-03-11 13:40:14 +01:00
Jon Evans 215c3fdf77 Switch to operator= for item updates
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20206


(cherry picked from commit d0b22d21bb)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-10 19:19:55 -04:00
dsa-t b658031b8c Don't translate wxFileDialog "All Files" filter.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20297


(cherry picked from commit c4655da4e6)

Co-authored-by: Alex Shvartzkop <dudesuchamazing@gmail.com>
2025-03-10 16:07:01 +03:00
Jeff Young 02b756189b Formatting.
(cherry picked from commit e163c40e54)
2025-03-09 18:18:32 +00:00
Jeff Young d2af56597e DRC for tables. (And some fixes for dimensions.)
(cherry picked from commit a468c486eb)
2025-03-09 18:18:32 +00:00
Jeff Young f862eea1b9 Group members are still children of the board (not
the group).

(cherry picked from commit 4b38932129)
2025-03-09 18:18:32 +00:00
Alex Shvartzkop 73f495c67d Update translations 2025-03-09 19:05:14 +03:00
dsa-t b46780ad46 Translated using Weblate (Turkish)
Currently translated at 53.6% (5339 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-09 17:03:59 +01:00
Argeolog 9762fb855d Translated using Weblate (Turkish)
Currently translated at 53.6% (5340 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-09 17:01:51 +01:00
Argeolog 9d156891c6 Translated using Weblate (Turkish)
Currently translated at 53.4% (5324 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-09 16:37:45 +01:00
Argeolog b73b154abc Translated using Weblate (Turkish)
Currently translated at 53.4% (5315 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/tr/
2025-03-09 16:33:20 +01:00
Wellington Terumi Uemura 1d9a5c33ca Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9953 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/pt_BR/
2025-03-09 16:33:20 +01:00
ZbeeGin 12dac14ba6 Translated using Weblate (Polish)
Currently translated at 99.7% (9931 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/pl/
2025-03-09 01:47:31 +01:00
CloverGit 116aa3d344 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.8% (9942 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/zh_Hans/
2025-03-09 01:47:31 +01:00
Rigo Ligo 7219a5dd77 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.8% (9942 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/zh_Hans/
2025-03-09 01:47:31 +01:00
co8 j 729d14827e Translated using Weblate (Japanese)
Currently translated at 99.9% (9949 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ja/
2025-03-09 01:47:31 +01:00
Henrik Kauhanen e8ec50e04c Translated using Weblate (Swedish)
Currently translated at 99.9% (9952 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/sv/
2025-03-09 01:47:30 +01:00
Marco Ciampa 8b2e70afb0 Translated using Weblate (Italian)
Currently translated at 96.0% (9557 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/it/
2025-03-09 01:47:30 +01:00
Henrik Kauhanen 21384b64f7 Translated using Weblate (Finnish)
Currently translated at 99.1% (9870 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/fi/
2025-03-09 01:47:30 +01:00
CloverGit 184798b770 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.8% (9939 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/zh_Hans/
2025-03-09 01:47:30 +01:00
dsa-t f93a954c7b Translated using Weblate (Russian)
Currently translated at 100.0% (9953 of 9953 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ru/
2025-03-09 01:47:30 +01:00
JamesJCode a69d6a129a Mirror netclass DRC expression semantics for component classes
With this change, "A.Component_Class == 'SOME_CLASS'" will return
true if either SOME_CLASS exists in the list of component classes
attached o the footprint, or if SOME_CLASS is the full component
class name.

(cherry picked from commit 85e6978aa2)
2025-03-08 22:20:55 +00:00
Jeff Young 491af0df39 When following board or plot settings, write results to current config.
Also adds migration from older layer numbers to strings.
This may require users to dump their 9.0 settings files
(which will have the wrong layer numbers in them), but
those files are often useless anyway as they'll already
have messed up colours if they were migrated from 8.0.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18709
2025-03-08 19:10:39 +00:00
jean-pierre charras 34458cf738 Pcbnew: remove dead code.
The export SVG dialog was removed some time ago (merged with plot svg).
But some settings of this removed dialogs were not removed.

(cherry picked from commit 9a1cf81ca6)
2025-03-08 13:35:15 +01:00
jean-pierre charras 809948333e Fix compil warnings
(cherry picked from commit 9d1b320896)
2025-03-08 09:42:15 +01:00
Seth Hillbrand 1a6160b132 Removed shared_ptr circular references
When A references B and B references A, the shared pointer reference
count will never go to zero by just removing the parent container.  We
need to explicitly clear the shared pointer references when we are done

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

(cherry picked from commit 641e06e67c)
2025-03-07 17:31:32 -08:00
JamesJCode 51f588b55b Check for constituent netclasses in DRC netclass equality checks
This reverts previous behaviour whereby 'A.Netclass == x' compared
the full name of an effective netclass (e.g. 'Class1,Default'). This
was found to be unexpected behaviour to users, who were expecting
the equality to compare single netclasses. The equality check now
first checks for a constituent class with the given name, and then
falls back to a check of the full class name.

Inequality requires the netclass name being tested to not be a
constituent netclass and to not be the full class name.

(cherry picked from commit f0e287a87b)
2025-03-07 23:57:13 +00:00
Seth Hillbrand 1effbe5d01 Prevent ERC error with NC pin+NC marker
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20222

(cherry picked from commit 4f6a73d83c)
2025-03-07 15:26:06 -08:00
Seth Hillbrand 50711b1294 Revert "Allow a no-connect to connect to a single pin (but not multiple pins)."
This reverts commit ee4a6127c6.

(cherry picked from commit 2b557c5497)
2025-03-07 15:25:53 -08:00
Damjan b3ba8d78b5 pcbnew: table rotation: table jumps if rotation ends at 180°
(cherry picked from commit bded181ad0)
2025-03-07 20:39:59 +00:00
Jeff Young 11df4b32eb Fix merge mess-up.
(cherry picked from commit 727fc9bd06)
2025-03-07 19:00:46 +00:00
Jeff Young 1de9a83ff0 Printing is not zoom-specific.
(Some of these items don't currently get printed, but
there's no sense in leaving a latent bug around in case
we ever change our minds.)

(cherry picked from commit 877c6bce89)
2025-03-07 19:00:10 +00:00
Jeff Young 25de338bdd Support ctrl-delete for delete word forward.
(On non-Macs, anyway.  Mac doesn't appear to use this
paradigm.)

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

(cherry picked from commit ce5469b95e)
2025-03-07 19:00:05 +00:00
Seth Hillbrand 4df101b94e Ensure imported schematic sheet names are unique
Altium doesn't require sheet names to be unique but KiCad does, so we
disambiguate the names when importing

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

(cherry picked from commit ca51b0f37d)
2025-03-06 16:10:08 -08:00
Seth Hillbrand cf78215276 Fix multi-unit symbol import in Altium sch
Set the library symbol equal to total unit count so that we can assign
elements to the correct unit in the SCH_SYMBOL

(cherry picked from commit 81fcc16cc9)
2025-03-06 15:20:44 -08:00
JamesJCode ed5ec0f749 Don't dereference null COMPONENT_CLASS in testFootprintSelector
This can happen when running standalone, where component classes
have not been resolved.

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

(cherry picked from commit 54540f9e82)
2025-03-06 21:45:38 +00:00
Seth Hillbrand 2da1294492 Fix IsEffectiveLine calculation
We sometimes represent circles as 360° arcs.  These are approximately
colinear but are definitely not a line

(cherry picked from commit c24832f72b)
2025-03-06 12:45:39 -08:00
Wayne Stambaugh 04733511fc Use case insensitive comparison in symbol footprint filter match DRC.
This keeps the DRC test in line with the ERC test which is also case
insensitive.

(cherry picked from commit a1b78d170d)
2025-03-06 15:42:03 -05:00
JamesJCode 1414e90ce9 Fix Specctra export for multiple netclasses
(cherry picked from commit 57952a7a86)
2025-03-06 20:25:58 +00:00
Seth Hillbrand 5c492429be Printing should never hide small elements
Since it is effectively infinite resolution, pass the vectors to the
printer and let it decide if there should be a dot there or not.  Hiding
based on perspective is a screen optimization

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

(cherry picked from commit 8e048d0c42)
2025-03-06 12:18:57 -08:00
jean-pierre charras e9e2c9399b French translation update 2025-03-06 18:12:27 +01:00
jean-pierre charras 58422f2c97 SCH_IO_MGR::GuessPluginTypeFromLibPath(): fix issue for new .kicad_sym files
GuessPluginTypeFromLibPath() was previously testing the type, but also the
existence of the lib file of *.kicad_sym filename, but when creating a new lib,
its existence obviously must not be tested

(cherry picked from commit e54c73b516)
2025-03-06 18:12:27 +01:00
Jeff Young 618077bbf2 Resolve hotkey conflicts.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18201
2025-03-06 16:15:23 +00:00
Jeff Young 6aa274bc0d Formatting.
(cherry picked from commit 52648497b2)
2025-03-06 16:15:23 +00:00
Jeff Young 12f460cc7a Don't treat version-bumped file as modified.
But do allow Save to still work.

(cherry picked from commit 5c91a7fa3a)
2025-03-06 16:15:23 +00:00
JamesJCode cbe22a23b8 Enable use of double properties in DRC rules expression parser
Also fixes name clash with Orientation property for footprints

(cherry picked from commit 671d84562b)
2025-03-06 15:41:40 +00:00
jean-pierre charras 0f8f9214b0 Fix compil issue on mingw (missing change from OUTPUT to DESTINATION)
(cherry picked from commit a32c0a8687)
2025-03-06 15:59:58 +01:00
Jeff Young 4f63cb6a26 Move arrow direction to more appropriate section.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20208

(cherry picked from commit 124eccb710)
2025-03-06 14:26:59 +00:00
Alex Shvartzkop 64d8bbd1d9 Update translations 2025-03-06 13:54:46 +03:00
Marco Ciampa f957dfa218 Translated using Weblate (Italian)
Currently translated at 95.8% (9540 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/it/
2025-03-06 11:53:21 +01:00
CloverGit 0d18ad188b Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.8% (9939 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/zh_Hans/
2025-03-06 11:53:21 +01:00
Henrik Kauhanen bf189855f8 Translated using Weblate (Swedish)
Currently translated at 99.9% (9950 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/sv/
2025-03-06 11:53:21 +01:00
Marco Ciampa 81658cb2c9 Translated using Weblate (Italian)
Currently translated at 95.6% (9523 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/it/
2025-03-06 11:53:21 +01:00
Henrik Kauhanen 5e80f4bf32 Translated using Weblate (Finnish)
Currently translated at 99.1% (9870 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/fi/
2025-03-06 11:53:21 +01:00
Kliment 684b92dfa6 Translated using Weblate (Finnish)
Currently translated at 99.1% (9870 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/fi/
2025-03-06 11:53:20 +01:00
Henrik Kauhanen 22e2850cdc Translated using Weblate (German)
Currently translated at 99.9% (9949 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/de/
2025-03-06 11:53:20 +01:00
Pferd O be7b69172f Translated using Weblate (German)
Currently translated at 99.9% (9949 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/de/
2025-03-06 11:53:20 +01:00
Kliment 07f74ab56e Translated using Weblate (German)
Currently translated at 99.9% (9949 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/de/
2025-03-06 11:53:20 +01:00
Henrik Kauhanen 89bbaa6d2e Translated using Weblate (Swedish)
Currently translated at 99.9% (9946 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/sv/
2025-03-06 11:53:20 +01:00
Kliment ce8737936e Translated using Weblate (Finnish)
Currently translated at 98.7% (9830 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/fi/
2025-03-06 11:53:20 +01:00
Kliment 8c45d3621e Translated using Weblate (German)
Currently translated at 99.9% (9946 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/de/
2025-03-06 11:53:20 +01:00
Wellington Terumi Uemura bae042b934 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9951 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/pt_BR/
2025-03-06 11:53:20 +01:00
CloverGit 5e724a2909 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.8% (9939 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/zh_Hans/
2025-03-06 11:53:20 +01:00
Henrik Kauhanen 4810f50083 Translated using Weblate (Swedish)
Currently translated at 99.9% (9944 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/sv/
2025-03-06 11:53:20 +01:00
co8 j 771c6b21df Translated using Weblate (Japanese)
Currently translated at 99.9% (9946 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ja/
2025-03-06 11:53:20 +01:00
Pferd O 5f1feb4532 Translated using Weblate (German)
Currently translated at 99.8% (9934 of 9951 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/de/
2025-03-06 11:53:20 +01:00
Jeff Young 759b279009 Allow a no-connect to connect to a single pin (but not multiple pins).
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20222
2025-03-06 10:26:30 +00:00
Jeff Young 456fc581f1 Don't flag double no-connect annotations.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20222
2025-03-06 10:26:30 +00:00
Jon Evans d18d47fbeb Fix accidental removal of properties pane
(cherry picked from commit 984041f57e)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-05 17:45:19 -05:00
JamesJCode efae811143 Fix incorrect inequality in component class expression evaluation
(cherry picked from commit a091b6c1c9)
2025-03-05 19:11:12 +00:00
Jeff Young f7eb925bfe An arbitrary layer flip can not be done without the board.
(User-defined layers can be sided or not.)

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

(cherry picked from commit 9856cb2210)
2025-03-05 18:01:09 +00:00
Jeff Young f92c46d585 User layer bug fixes.
1) Don't set user layer count right after we've
cleared the enabled user layers.  (It will
always be 0 by then.)

2) Allow un-enabled layers in some layer
selectors.  (Currently this is just the private
layers selector.

3) Reset the appearance panel layers each time a
footprint is loaded.  Also, auto-enable any user
layers that the footprint already has.

4) Footprint editor layer visibility is stored in
the view, not in the boars (as is usual).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20022
2025-03-05 16:39:52 +00:00
Tomasz Wlostowski 648c3aec39 IO_BASE: don't try to modify the case of a temporary string in-place, work on a copy
(cherry picked from commit 6a0efe6883)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20228
2025-03-05 12:21:52 +00:00
Jeff Young 46ef12ff4d Implement severity checking for CLI_REPORTER.
(cherry picked from commit 699fd2b3ac)
2025-03-05 11:56:48 +00:00
Jon Evans 477f856e9a Fix pad edit fighting with active group
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20129


(cherry picked from commit 50507212fd)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-05 00:05:18 -05:00
Jon Evans 3a1cb402ad Improve 259e249a for macOS
(cherry picked from commit a6ef2d97fb)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-04 22:57:02 -05:00
Jon Evans 9c50f208af Improve default sizes of right panels
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19965


(cherry picked from commit 259e249aed)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-04 22:56:53 -05:00
Jeff Young 0d9daa372e Keep user-defined common layers order.
(And use it when plotting.)

(And don't shadow it with a second variable.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20214
2025-03-04 23:37:02 +00:00
Jeff Young 91a2edd16f Don't add CONSTRUCTION_GEOM to the selection.
We'll crash later after it gets freed.
2025-03-04 14:13:26 +00:00
Jeff Young 765c4ffce6 Report errors from jobset plotting.
Also fixes an out-of-scope smart-pointer access.
2025-03-04 13:26:04 +00:00
Wayne Stambaugh 50b8b797f7 Test full LIB_ID in symbol footprint filter match DRC.
Apparently newer symbol libraries are using the library nickname in the
footprint filter string.  The symbol footprint filter match DRC was only
checking the footprint name against the new filter which would always
fail.  A test against the full LIB_ID string is now performed when the
filter string contains the library separator character ':'.  The ERC test
already performed this check.

(cherry picked from commit 001d3dfd88)
2025-03-04 08:06:15 -05:00
Jeff Young 9025f04f20 Button margins.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20207
2025-03-04 12:39:33 +00:00
Damjan ce2b4a7b16 pcbnew: Plotting tables with non-90 degree rotation angles is not working
(cherry picked from commit b419058df3)
2025-03-04 12:11:05 +00:00
Jeff Young ed76b543a0 Don't render thickness walls of text we're not going to draw.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20200
2025-03-04 10:55:36 +00:00
Mark Roszko 622a3f5bad Restore the page size mode behavior
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20014


(cherry picked from commit b6743653f3)

Co-authored-by: Marek Roszko <mark.roszko@gmail.com>
2025-03-04 04:16:07 +00:00
Alex Shvartzkop f125ab95c9 Update translations 2025-03-04 06:36:48 +03:00
Arnau Llovet Vidal d52811d367 Translated using Weblate (Catalan)
Currently translated at 41.4% (4120 of 9941 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ca/
2025-03-04 04:36:01 +01:00
Henrik Kauhanen 549258a5cc Translated using Weblate (Swedish)
Currently translated at 99.9% (9934 of 9941 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/sv/
2025-03-04 04:36:01 +01:00
Pferd O 2ae04b32b4 Translated using Weblate (German)
Currently translated at 99.9% (9935 of 9941 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/de/
2025-03-04 04:36:01 +01:00
Henrik Kauhanen ab0d02b322 Translated using Weblate (Swedish)
Currently translated at 99.9% (9933 of 9941 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/sv/
2025-03-04 04:36:01 +01:00
Henrik Kauhanen 9e163b7480 Translated using Weblate (Swedish)
Currently translated at 99.8% (9930 of 9941 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/sv/
2025-03-04 04:36:01 +01:00
dsa-t d69e7c579c Translated using Weblate (Russian)
Currently translated at 100.0% (9941 of 9941 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ru/
2025-03-04 04:36:00 +01:00
Pferd O 2a1de79916 Translated using Weblate (German)
Currently translated at 99.9% (9933 of 9941 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/de/
2025-03-04 04:36:00 +01:00
Jeff Young 7116be4ae0 Put non-sided layers on front, not back of board.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20201

(cherry picked from commit 7cfa826c9a)
2025-03-03 21:38:47 +00:00
Jeff Young 66bf97bc0f Fix SCH plot to PDF for jobsets.
(Fix for CLI bug #19522 broke it for jobsets.)
2025-03-03 20:39:06 +00:00
Jeff Young 42a18ad3b6 Fix job run-log sizing issues.
wxLIST_AUTOSIZE_USEHEADER doesn't work on
some
platforms, and using OnSize was having seizures
on Mac.
2025-03-03 20:19:50 +00:00
Jeff Young afd35001cb Fix job run log sizing issues.
wxLIST_AUTOSIZE_USEHEADER doesn't work on
several platforms, and dynamic sizing of the
list columns falls apart on Mac.
2025-03-03 19:23:38 +00:00
Jeff Young cbc964fb94 Jobset Output -> Destination.
(cherry picked from commit d8cdb69831)
2025-03-03 18:36:14 +00:00
Jeff Young d033859596 Handle exporting symbols into libraries already under LIB_MGR.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17840

(cherry picked from commit afa4ebcc84)
2025-03-03 16:13:40 +00:00
Jeff Young c7a6f3c63b Restore "Export Symbol".
The workflow turns out to be slightly different
than a Save As to a new library.

(We don't assume it goes in a library table; we
flatten the symbol; and we pre-load the library
name.)

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

(cherry picked from commit 6b146874c1)
2025-03-03 16:13:40 +00:00
Jeff Young 984b872c28 Formatting.
(cherry picked from commit 1c48e97cd7)
2025-03-03 16:13:40 +00:00
Jeff Young a246a96d18 Disable multi-via dragging.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20150

(cherry picked from commit d0e86cad7c)
2025-03-03 16:13:40 +00:00
Mark Roszko 12d3f54da4 Fix compilation on mingw
(cherry picked from commit c2685ef76f)

a3c14a6e Build: fix: allow compilation on mingw

Co-authored-by: Kreijstal <rainb@tfwno.gf>
2025-03-03 01:56:46 +00:00
Jeff Young 97b0e6d403 Persist some missing jobset arguments.
Also adds some missing CLI arguments.

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

(cherry picked from commit b0eef3ee28)
2025-03-02 19:28:01 +00:00
Jeff Young 89226575c6 Deprecate (instead of remove) --plot-invisible-text
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20171

(cherry picked from commit 307798ac92)
2025-03-02 19:27:52 +00:00
Jeff Young 6febb9ddde Yet another static line issue. 2025-03-02 18:42:28 +00:00
Jeff Young 47150649b7 Yet another static line issue. 2025-03-02 18:20:42 +00:00
Jeff Young ae6c865a77 Handle circular holes with y==0.
(Because legacy code assumed this.)

(cherry picked from commit 164eff1a3b)
2025-03-02 17:55:22 +00:00
Jeff Young 154c89765f Remove extra divider from Pad Properties.
(cherry picked from commit 7d9dd50b08)
2025-03-02 17:55:19 +00:00
Jeff Young 341818306e Remove extra divider from Pad Properties.
(cherry picked from commit dc12fdfc33)
2025-03-02 17:55:15 +00:00
Jeff Young 87a0106c57 Compiler warnings. 2025-03-02 17:05:42 +00:00
jean-pierre charras 2504195e6e Fix a collision with a Windows define and our use of the same var name.
We use IN for INCH as units, but IN is defined in a Windows header

(cherry picked from commit b0fe4df3c5)
(cherry picked from commit 0acdabd1eb)
(cherry picked from commit eaa1e6d594)
2025-03-02 16:13:11 +01:00
jean-pierre charras 3f5195de3d French translation update 2025-03-02 15:16:11 +01:00
Jeff Young 31fe178504 Don't generate -1 width non-filled splines.
They serve no purpose, and will get replaced with
default-line-width non-filled splines.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20138
2025-03-02 11:33:34 +00:00
Jeff Young e44e3ae25e Windows compiler doesn't like the trailing ','? 2025-03-02 10:49:59 +00:00
Jeff Young ae96cf1715 Provide easier on-ramp for jobsets.
1) Perform initial save of new jobset.
2) Add default output folder to new jobset.

(cherry picked from commit 26871b56f0)
2025-03-02 09:10:21 +00:00
Jeff Young 203ddb7b47 Code brevity.
(cherry picked from commit f951497a4f)
2025-03-01 22:23:30 +00:00
Jeff Young 0ec82b65be Formatting; code brevity.
(cherry picked from commit 481e467968)
2025-03-01 22:18:35 +00:00
Jeff Young 09c63ea1ec Consistent spacing.
(cherry picked from commit ef75f63f10)
2025-03-01 22:18:31 +00:00
Jeff Young 0c2edf8e5c Persist generate-gerber-job-file setting.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20158

(cherry picked from commit c0e4c6a865)
2025-03-01 22:17:36 +00:00
Jon Evans d9a779d8ce Make sure to fully repaint pads when loading a board
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19896


(cherry picked from commit 547a063981)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-01 21:54:55 +00:00
Jon Evans e56894ccc2 Fixup cherry-pick 9055821d for 9.0 2025-03-01 12:05:50 -05:00
Jon Evans 5c624dacd2 Fix SCH_SHEET field layer settings
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20128

(cherry picked from commit 10cb0592ee)
2025-03-01 11:32:04 -05:00
Jon Evans 3ad740c920 Remove unused CN_ITEM m_visited
Visited flag should not be stored in the item itself
since these items are used in parallelized code and
the visited state should remain local to the thread


(cherry picked from commit e44eed6e6b)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-01 15:43:27 +00:00
Jon Evans 9055821db6 Fix inadvertent logic bug in SearchClusters
The safety changes in 3d526edc introduced a subtle
bug where aExcludeZones was not actually excluding
zones anymore because its behavior depended on the
item visited flag being set to true by a previous
call to the function.

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


(cherry picked from commit 51f56ab31c)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-03-01 15:39:57 +00:00
Alex Shvartzkop d08cb55d94 Update translations 2025-03-01 18:35:02 +03:00
Henrik Kauhanen 240a7bb238 Translated using Weblate (Swedish)
Currently translated at 99.9% (9935 of 9938 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/sv/
2025-03-01 16:32:51 +01:00
co8 j e453da97af Translated using Weblate (Japanese)
Currently translated at 99.9% (9936 of 9938 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ja/
2025-03-01 16:32:51 +01:00
Wellington Terumi Uemura 140f92b1d7 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (9938 of 9938 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/pt_BR/
2025-03-01 16:32:51 +01:00
ZbeeGin 51ec75e565 Translated using Weblate (Polish)
Currently translated at 99.9% (9936 of 9938 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/pl/
2025-03-01 16:32:51 +01:00
Pferd O 4c13ca2bea Translated using Weblate (German)
Currently translated at 99.9% (9936 of 9938 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/de/
2025-03-01 16:32:51 +01:00
CloverGit a638ca22c2 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 99.9% (9934 of 9938 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/zh_Hans/
2025-03-01 16:32:51 +01:00
dsa-t 6526fe75ea Translated using Weblate (Russian)
Currently translated at 100.0% (9938 of 9938 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/ru/
2025-03-01 16:32:51 +01:00
Marco Ciampa 3c41c33e39 Translated using Weblate (Italian)
Currently translated at 95.8% (9527 of 9938 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/it/
2025-03-01 16:32:51 +01:00
Pferd O d267f46c21 Translated using Weblate (German)
Currently translated at 99.9% (9930 of 9938 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/de/
2025-03-01 16:32:51 +01:00
109247019824 a47298b72f Translated using Weblate (Bulgarian)
Currently translated at 8.2% (823 of 9938 strings)

Translation: KiCad EDA/v9
Translate-URL: https://hosted.weblate.org/projects/kicad/v9/bg/
2025-03-01 16:32:50 +01:00
Jon Evans 41c3607512 Fix 9.0 formatting of fields
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20166
2025-03-01 08:53:32 -05:00
Fabien Corona d7ba90c573 iec60664-1 : preferred values
(cherry picked from commit 81428e14a6)

Co-authored-by: Fabien Corona <f.corona@laposte.net>
2025-03-01 07:58:19 +00:00
Seth Hillbrand 3f984704be Prevent fetch without repo
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20152

(cherry picked from commit 18ac99d838)
2025-02-28 08:35:58 -08:00
jean-pierre charras 2bb2f1398c BRDITEMS_PLOTTER::PlotFootprintTextItems(): fix a typo about Value layer.
The typo was using the reference layer to plot the value field

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

(cherry picked from commit 75bed91789)
2025-02-28 10:02:09 +01:00
Mark Roszko 9b1b2c626a Fix MSVC build error for VC 17.13+
(cherry picked from commit 7eb07c00a2)

50171749 Fix MSVC build in 17.13.2

Co-authored-by: Jan Wichmann <j-wichmann@gmx.net>
2025-02-27 23:41:53 +00:00
Jon Evans ff74d7b24a More safety against corrupted visibility settings
(cherry picked from commit 1205464472)
2025-02-27 18:18:40 -05:00
Jeff Young 9a3ae62b70 Clarifying comments. 2025-02-27 17:51:34 +00:00
Jeff Young 2e17848d3f Don't use connectivity system for Track & Via Properties dialog.
It will propagate through zones, and since we haven't
yet done a refill it will pick up a bunch of false
stuff any time the track was widened more than the
clearance.

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

(cherry picked from commit 888cbf8e7a)
2025-02-27 17:51:34 +00:00
Jeff Young 36b4bab5cc Cleanup.
(cherry picked from commit 931b1b0231)
2025-02-27 17:51:34 +00:00
Jeff Young 3a91fc8c2b Apply EEschema fixes to PCBNew and Footprint Editor.
(Symbol Editor doesn't have the issue of the properties
being overwritten.)

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

(cherry picked from commit 797de67c6c)
2025-02-27 17:51:34 +00:00
Jeff Young f4f92b0184 Treat changes in solder mask like a width change.
Also in theory keeps from losing tenting properties
on vias that are shoved, though I can't get via
shoving to work at all right now.

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

(cherry picked from commit 144e660684)
2025-02-27 17:51:34 +00:00
Jeff Young 87532491e1 Formatting.
(cherry picked from commit 8e461941c0)
2025-02-27 17:51:34 +00:00
Wayne Stambaugh 5cdca70bf1 Show the correct footprint name on footprint filter mismatch ERC warning.
The lower case variant used for internal comparison was being used which
is confusing because it doesn't match the footprint name capitalization.

(cherry picked from commit a9cea9fbb7)
2025-02-27 09:54:06 -05:00
Wayne Stambaugh cb7ea2f117 Fix git clone project dialog layout issues.
Use enable/disable instead of show/hide to prevent large areas of blank
space in the dialog.

Set the minimum dialog size after the initial launch to prevent controls
from being cut off when resizing dialog to less than the initial size.

Fix static and dialog title bar string capitalization.

Add colons (:) to the end of description static text controls as is done
elsewhere in KiCad.

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

(cherry picked from commit f538908f62)
2025-02-27 09:20:13 -05:00
jean-pierre charras 1c0769ce27 Eeschema: fix incorrect plot of SCH_TABLE items.
(cherry picked from commit ba85c54f81)
2025-02-27 14:12:08 +01:00
Seth Hillbrand c7afa8ce87 Fix windows build
(cherry picked from commit 9211136953)
2025-02-26 18:15:44 -08:00
Seth Hillbrand cc2ca441fa Adjust git timing parameters
Move most of the update firing to the file system watcher (except for
windows network shares that still need timed updated).  Gate the repo
status for sync

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

(cherry picked from commit 5027a562e4)
2025-02-26 16:17:49 -08:00
Seth Hillbrand 8d1f1fd4f5 Fix git flicker on Windows
(cherry picked from commit aa1baec062)
2025-02-26 16:17:43 -08:00
Jon Evans 377476df1d Fix export SVG mode logic
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20089


(cherry picked from commit 52e86303c0)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-26 22:31:44 +00:00
jean-pierre charras 5465ff8143 PCB_DIM_XXX::updateGeometry(): protect against re-entrance.
After calling updateText(), updateGeometry() was sometimes re-run before the
current updateGeometry() was finished, thus creating a incorrect geometry
(duplicate items)

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

(cherry picked from commit 7c067e25d9)
2025-02-26 21:07:06 +01:00
Jeff Young 969c28864f Apply List Hotkeys fix to Edit Hotkeys.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19989
2025-02-26 18:53:35 +00:00
Jeff Young fd202d7b8d Better alignment betweeen controls in Pad Properties. 2025-02-26 18:53:32 +00:00
Jeff Young 7e79a99cea There is no support (as yet) for layer-specific soldermask expansions.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20053
2025-02-26 18:53:29 +00:00
Jeff Young ad2c243220 Formatting. 2025-02-26 18:53:16 +00:00
Jeff Young fb02d02698 Don't exit DRC when one test passes.
Also adds handling for table cells.

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

(cherry picked from commit fde4aac075)
2025-02-26 18:52:39 +00:00
Jeff Young a10ab54bf2 Formatting.
(cherry picked from commit 6ccacd232e)
2025-02-26 18:52:36 +00:00
Jeff Young 72454180c1 DRC_LAST is the last index, not the size.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20049

(cherry picked from commit 956875e2f4)
2025-02-26 18:51:34 +00:00
Alex Shvartzkop 5909fc1c8f Update translations 2025-02-26 20:15:45 +03:00
Wayne Stambaugh 82ead56d9a Fix zone manager dialog layout issues.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20046

(cherry picked from commit 4e4ebe536e)
2025-02-26 08:14:07 -05:00
Jon Evans 798e9999c2 Add missing change from previous commit
See b6aac93


(cherry picked from commit de160e4af6)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-26 04:42:19 +00:00
Jon Evans a752dd5105 Fix creation of Altium compound files from IntLibs
A previous change introduced an invalid cast from
base to derived class.  To clean this up, changed
DecodeIntLibStream to have an out param and allow
two-step initialization of ALTIUM_COMPOUND_FILE

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


(cherry picked from commit b6aac9369e)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-26 03:34:49 +00:00
Jon Evans da8dcab1de Fix logic in via high contrast LOD calculation
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20093


(cherry picked from commit 41f5750be7)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-26 01:59:51 +00:00
Jon Evans b707b305ac API: Add board origin setter/getter
See https://gitlab.com/kicad/code/kicad-python/-/issues/20


(cherry picked from commit 5cec2fac9d)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-26 01:14:01 +00:00
Seth Hillbrand 038b927cfa Thread git checks
Push the git checks from the main thread into child threads to prevent
resource contention in some cases where Windows machines might have many
files in git that are _also_ being managed by Google Drive

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

(cherry picked from commit 2c54ab277b)
2025-02-25 16:09:56 -08:00
Alex Shvartzkop bdd4a88127 Simplify layer list update in PANEL_SETUP_LAYERS. 2025-02-25 23:43:48 +03:00
Alex Shvartzkop f60313367c Fix scrollbars not appearing in Appearance layers panel after board import. 2025-02-25 23:39:59 +03:00
Alex Shvartzkop a4e2d54221 Fix scrollbars not appearing initially in PANEL_SETUP_LAYERS. 2025-02-25 23:22:20 +03:00
Alex Shvartzkop 8ef8ca4d39 Auto-size PANEL_SETUP_LAYERS_BASE.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20106
2025-02-25 23:20:58 +03:00
Jon Evans ae0396ee3c API: Add new user layers
See https://gitlab.com/kicad/code/kicad-python/-/issues/23


(cherry picked from commit c4c1842bc4)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-25 00:30:37 +00:00
Damjan b97bd36b44 pcbnew: Table Rotation
(cherry picked from commit 5771467ca3)
2025-02-24 11:57:26 +00:00
Jon Evans f3523b6ad9 Re-add accidentally removed increment
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20069


(cherry picked from commit 4123f75d5a)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-24 03:42:04 +00:00
Jon Evans 0fccad7183 PCM: Prompt to enable IPC API when required
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20062


(cherry picked from commit 3525731a4e)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-23 23:07:30 +00:00
Damjan 337689a69e pcbnew: Table Cell Text Justification
(cherry picked from commit 9c6ebb44b6)
2025-02-23 22:15:40 +00:00
Jeff Young a3e3c0384e Mirror location of textbox.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20021
2025-02-23 22:08:48 +00:00
Jeff Young 36924926de Filled shapes can still have a border width. 2025-02-23 22:08:48 +00:00
Jeff Young ec1353168b Better namespacing.
Also fixes a bug with calculating eagle annular
ring sizes.
2025-02-23 22:08:48 +00:00
Jeff Young 1712f5f8e7 Cleanup stale comment. 2025-02-23 22:08:48 +00:00
Jeff Young 6485465301 Fix plot dialog layout. 2025-02-23 22:08:48 +00:00
Jon Evans 87f7ed7846 Clear render cache for hole walls on zoom change
(cherry picked from commit bacb6bf40f)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-23 18:04:27 +00:00
Jon Evans f8993933a9 Do not persist canvas type fallback due to OpenGL failure
If the user wants to always use fallback,
they can set this option explicitly


(cherry picked from commit 0e8934f887)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-23 18:04:16 +00:00
Seth Hillbrand b135491d35 Allow sim models to reference embedded files
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20024

(cherry picked from commit 157c7422b0)
2025-02-22 14:54:38 -08:00
Seth Hillbrand 2aa9d4851e Limit the size of the PTH hole walls
Should always be at least 2px thick but no larger than the minimum
thickness of the pad (walls do not extend beyond the pad itself)

(cherry picked from commit b02a449be8)
2025-02-22 14:54:38 -08:00
Jon Evans 4cd8833687 API: Refresh screen after changing selection
Required on Linux/Windows

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


(cherry picked from commit d29025ef78)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-22 21:01:52 +00:00
Connor Goss 870807fbad Add IPC-D-356 Export to kicad-cli
ADDED: Added IPC-D-356 exporting to kicad-cli.

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

(cherry picked from commit 5a5759c41a)
2025-02-22 13:01:22 -08:00
Seth Hillbrand a844554443 Quiet down the Exclude from Sim marks in Schematic
The big grey X and dimming the component made it look like the component
was no longer a part of the circuit, rather than just being excluded for
a single purpose.

The changes the display to make a more subtle grey outline with an icon
in the corner to indicate that this refers to simulation.

(cherry picked from commit 878cf768d6)
2025-02-22 13:01:16 -08:00
Jon Evans d6f10f9f88 Remove accidentally-added tree
(cherry picked from commit 5abfdac639)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-22 19:44:16 +00:00
Jon Evans dcc09a9e77 Improvements to kicad-cli test repeatability
(cherry picked from commit ca21a35bfc)
2025-02-22 14:08:55 -05:00
jean-pierre charras 45bb1da77a pcb_calculator, STRIPLINE: fix incorrect formula for conductor loss.
(cherry picked from commit fc9795e95d)
2025-02-22 17:09:16 +01:00
Jon Evans a153e4fc63 Enhance library pinning functionality to support pin/unpin multiple libraries in the library editor
(cherry picked from commit c7aaf8b6e1)

Co-authored-by: Dmitry Rezvanov <26044988+Misaka0x2730@users.noreply.github.com>
2025-02-22 15:45:55 +00:00
JamesJCode f3371f9c21 Fix m_zoneLayerOverrides data race in pad.h
From Coverity issue 542093

(cherry picked from commit 1e84d1e496)
2025-02-22 14:59:39 +00:00
Jon Evans 8a3086652a Added enum COL_ORDER for jobset panel's columns
(cherry picked from commit ee614161d7)

Co-authored-by: Dmitry Rezvanov <dmitry.rezvanov@yandex.ru>
2025-02-22 14:07:51 +00:00
Jon Evans 2103f303b7 Fixed description column number in PANEL_JOBSET::OnGridCellChange.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20030


(cherry picked from commit 0c2a5b72ec)

Co-authored-by: Dmitry Rezvanov <dmitry.rezvanov@yandex.ru>
2025-02-22 14:07:42 +00:00
Jon Evans 17cac94c6a Make sure drill layer pairs are created in odb++
fixes #20039


(cherry picked from commit 255f4aee76)

Co-authored-by: Daniel Treffenstädt <d.treffenstaedt@gmail.com>
2025-02-22 13:35:14 +00:00
Seth Hillbrand c4c32aa7bb Prevent crash when importing over existing project
If the hierarchy navigator is open and expanded, we have references to
the existing sheets.  These need to be cleared when importing a new
sheet over top

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

(cherry picked from commit 2e93fb7a24)
2025-02-21 10:34:53 -08:00
Graham Keeth 8162896bd5 Embedded files: standardize on "embedded reference"
(cherry picked from commit ac9f41baaa)
2025-02-21 10:16:21 -08:00
jean-pierre charras 92a605385b kicad-cli pcb export SVG: ensure the "C" locale is used.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20023

(cherry picked from commit aafe6157e2)
2025-02-21 17:55:15 +01:00
jean-pierre charras b948611c6f PANEL_FP_EDITOR_FIELD_DEFAULTS: fix hang when creating the panel (Windows only)
PANEL_FP_EDITOR_FIELD_DEFAULTS::loadFPSettings() was trying to add 0 rows to a
table which hang on Windows (but not on linux)

(cherry picked from commit 22a2cca312)
2025-02-21 17:10:17 +01:00
Jeff Young ba2156a0f1 parseMaybeAbsentBool's param is the naked token value, not the absent value.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20017
2025-02-21 11:17:03 +00:00
jean-pierre charras 966c7e40e5 PCB_TABLE: fix incorrect plot of tables rotated +-90 (missing segments).
This change was missing in commit 276029ee

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

(cherry picked from commit a9fb475cf2)
2025-02-21 09:52:02 +01:00
Jon Evans 89b4adc042 API: Add serialization of footprint mounting style
See https://gitlab.com/kicad/code/kicad-python/-/issues/19


(cherry picked from commit b932487f2e)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2025-02-20 23:16:55 +00:00
Jeff Young ff3687420f Write hide flag at 9.0 level (inside effects). 2025-02-20 18:10:23 +00:00
Jeff Young 7aafe9efe9 Make sure protobuf API stays consistent.
(cherry picked from commit a8a1b08013)
2025-02-20 17:48:09 +00:00
Jeff Young e6f6e7b2f0 Cleanup.
(cherry picked from commit 9ca9d7120a)
2025-02-20 17:48:06 +00:00
Jeff Young 68b590cadb Load actions from frame's actionmanager, not from singleton.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19989

(cherry picked from commit 6b3d01ead9)
2025-02-20 13:49:41 +00:00
Jeff Young 1ec7051f97 Fix comment.
(cherry picked from commit a00aeb7876)
2025-02-20 13:49:37 +00:00
Jeff Young 866a5722f6 Formatting.
(cherry picked from commit e018a33628)
2025-02-20 13:49:34 +00:00
Jeff Young 4e7da6169d Remove prohibition from clearing Value field in Symbol Fields Table.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19745

(cherry picked from commit fea659a002)
2025-02-20 13:49:23 +00:00
Jeff Young ebb8682dde Don't special case output directory label for jobsets.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19868

(cherry picked from commit be58dddcab)
2025-02-20 13:49:17 +00:00
Jeff Young 812bbe8919 Ignore negative layers when exporting Gerbers.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16871

(cherry picked from commit 6a3f52dbaf)
2025-02-20 13:47:55 +00:00
Jeff Young fd2932bc06 Better way of determining if we're reporting from the footprint editor.
(cherry picked from commit c136df247f)
2025-02-20 13:47:50 +00:00
Jeff Young 1b6621d898 Save copy of AUI config before applying it.
(It's going to do a bunch config saves, which
will otherwise overwrite all the user's preferences
with the defaults.)

(cherry picked from commit 006d8b290a)
2025-02-20 13:47:46 +00:00
Jeff Young 4aa11830e4 Write flipBoard boolean to JSON.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19852

(cherry picked from commit c8f56f24a8)
2025-02-20 13:47:14 +00:00
Jeff Young 91f5096ecc Improve control spacing.
(cherry picked from commit 4e08afd517)
2025-02-20 13:47:12 +00:00
Jeff Young 4dbf39743b No connections AND no-net is not an error
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19737

(cherry picked from commit 1ff0dfb052)
2025-02-20 13:46:31 +00:00
Jeff Young c7d62a23be Check for duplicate footprints.
Also fixes a bug where we were running Validate()
twice.

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

(cherry picked from commit c28039556d)
2025-02-20 13:46:27 +00:00
Jeff Young b81f0b4377 Pretty-print cross references in Symbol Fields Table.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19941

(cherry picked from commit f65d260961)
2025-02-20 13:46:22 +00:00
Jeff Young f45e2b2252 Switch to using unit names in property inspector.
(cherry picked from commit d921a4e916)
2025-02-20 13:37:37 +00:00
Jeff Young db44690460 Update instance reference from property inspector.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19932

(cherry picked from commit 56b8fec74b)
2025-02-20 13:37:33 +00:00
Jeff Young f8c0109c6e Improve code clarity.
(No functional change.)

(cherry picked from commit 1c848bb9fb)
2025-02-20 13:37:29 +00:00
Jeff Young a60f0b3782 MOVED subtract-mask-from-silk to general section.
(Was Gerber-specific.)

(cherry picked from commit 80e7698131)
2025-02-20 13:37:25 +00:00
Jeff Young 7cc2b47d2e REMOVED force-plot-invisible-items.
It's dangerous as the router and DRC will have been
run without regard to invisible items.

(See #19420.)

(cherry picked from commit 4fa02690f8)
2025-02-20 13:37:22 +00:00
Jeff Young 71ebe394d5 Handle clipping silk to mask when there is more than one layer.
(cherry picked from commit b44261c2bd)
2025-02-20 13:18:38 +00:00
Jeff Young 9d27f5526c Cleanup stale comments.
(cherry picked from commit 4959b480c3)
2025-02-20 13:18:34 +00:00
Jeff Young bf1daeab64 Cleanup.
(cherry picked from commit 9c0214afc0)
2025-02-20 13:18:29 +00:00
Jeff Young 5693ba1432 Performance improvements for teardrop regeneration.
Avoid O(n^2) behaviour when deleting many
zones from the board zones list.

(cherry picked from commit 281aa74f30)
2025-02-20 13:18:26 +00:00
Jeff Young a60307340f Finish eradication of visibility flag on text items.
Import/read previously-hidden symbol/footprint
text items as hidden fields.

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

(cherry picked from commit 5edae8250d)
2025-02-20 13:18:23 +00:00
Jeff Young 5a6793f9fb Formatting.
(cherry picked from commit cedb97c4c3)
2025-02-20 13:17:57 +00:00
Jeff Young b3463dce71 Don't allow creation of design blocks in recently used tree node.
(cherry picked from commit 759bfbca99)
2025-02-20 13:17:52 +00:00
Jeff Young 58b8e9736d Fix bugs in library existence checking, and add for symbol libs.
(cherry picked from commit 2a1b93a254)
2025-02-20 13:17:37 +00:00
Jeff Young a1dd583696 LIB_TREE_MODEL_ADAPTER is not symbol-specific.
(cherry picked from commit 4a35468301)
2025-02-20 13:17:31 +00:00
Jeff Young 6429246ce0 ADDED: 'Name' property for fields.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19706

(cherry picked from commit 426ac96bb7)
2025-02-20 13:15:58 +00:00
Jeff Young aaca5d820b Reduce cover types.
Also, don't use _ITEM for things that aren't EDA::ITEMs.

(cherry picked from commit bf34fe625c)
2025-02-20 13:15:52 +00:00
Jeff Young 2579165733 Resolve field references in symbol text items.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19983

(cherry picked from commit 61efe5be18)
2025-02-20 13:15:19 +00:00
Jeff Young 93fdd52d14 IPC-2581 has a hyphen in it.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19770

(cherry picked from commit 40daacbeeb)
2025-02-20 13:14:17 +00:00
Jeff Young 079636ad18 Fix inconsistent capitalisation.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19770

(cherry picked from commit 3fff89820d)
2025-02-20 13:14:13 +00:00
Jeff Young f6148f10e1 ADDED: support naked hyperlinks in tablecells and textboxes.
Also fix flickering due to IS_ROLLOVER flag getting
nuked.

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

(cherry picked from commit 072d8d55fe)
2025-02-20 12:57:16 +00:00
Jeff Young 2a93af1348 Don't disable line styles on filled shapes.
It's too much trouble to figure out what the
user wants, and not always right even then.

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

(cherry picked from commit 42acb62f6e)
2025-02-20 12:22:26 +00:00
Jeff Young ee2039b531 Auto-recognize URLs in SCH_FIELD and PCB_FIELD grids.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17066

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

(cherry picked from commit 3c71e7ab09)
2025-02-20 12:21:56 +00:00
dsa-t cc77cb4252 Vertically center text in cells in jobsets table.
(cherry picked from commit 0201e7286c)

Co-authored-by: Alex Shvartzkop <dudesuchamazing@gmail.com>
2025-02-20 11:39:00 +00:00
lucas 072a2b6305 Simulator: Bug fix quoting netnames for user defined signals
- Fixes issue: #18598
- Netnames that contained other netnames weren't quoted correctly
- E.g. /out1 and /out were in conflict in previous method
- Fixed formatting afted review

(cherry picked from commit 2559ac50a3)
2025-02-20 03:02:19 +00:00
Dmitry Rezvanov 3cae075945 Add "Route Selected From Other End" action to edit context menu
(cherry picked from commit 663f00da25)
2025-02-20 03:02:07 +00:00
Ian McInerney 900b6bfffb Ensure vme-wren demo is installed
(cherry picked from commit 0954f8ff76)
2025-02-20 03:01:28 +00:00
Andrej Valek 0c68ab4556 KiwayPlayer(FRAME_FOOTPRINT_CHOOSER): set window parent
The FRAME_FOOTPRINT_CHOOSER dialog is always a modal window, so it
requires to have an parent. Set parent in dialog_field_properties.

(cherry picked from commit 5e64f56d54)
2025-02-19 10:17:37 -08:00
Seth Hillbrand 1a41387a50 Properly handle Altium harnesses
Altium harnesses are imported as buses in KiCad, using bus aliases to
represent the harness elements

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

(cherry picked from commit cf2827c6ec)
2025-02-19 10:07:58 -08:00
Seth Hillbrand e602e0bdbd Speed up the time it takes to GeneratePaths
The loop processes nodes but skips those nodes that share the same
parent.  Because of this, we can get strong performance improvement from
caching gains by sorting the vector first by the parents so that the
inner loop is able to skip ahead without invalidating its cache

(cherry picked from commit 9781da51e1)
2025-02-19 10:05:45 -08:00
Seth Hillbrand f2e814c330 Prevent image duplication
Duplicate ancillary clipboard needs to be tested with the existence of
an image when pasting

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

(cherry picked from commit d2f780dfb4)
2025-02-19 10:04:44 -08:00
669 changed files with 172931 additions and 159784 deletions
+1
View File
@@ -51,6 +51,7 @@ common/pcb_keywords.cpp
include/pcb_lexer.h
fp-info-cache
qa/tests/output/**
qa/tests/cli/output/**
# demo project auxiliary files
demos/**/*-bak
+9 -38
View File
@@ -465,26 +465,14 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
const float zpos_copperTop_back = m_layerZcoordTop[B_Cu];
const float zpos_copperTop_front = m_layerZcoordTop[F_Cu];
// Fill not copper layers zpos with a dummy position
// (m_layerZcoordTop[B_Cu]with a small margin)
// Some important layer position will be set later
// Fill not copper layers zpos
for( int layer_id = 0; layer_id < PCB_LAYER_ID_COUNT; layer_id++ )
{
if( IsCopperLayer( (PCB_LAYER_ID)layer_id ) )
continue;
m_layerZcoordBottom[(PCB_LAYER_ID)layer_id] = zpos_copperTop_back - 2.0f * zpos_offset;
m_layerZcoordTop[(PCB_LAYER_ID) layer_id] =
m_layerZcoordBottom[(PCB_LAYER_ID) layer_id] - m_backCopperThickness3DU;
}
// calculate z position for each technical layer
// Solder mask and Solder paste have the same Z position
for( PCB_LAYER_ID layer_id :
{ B_Adhes, B_Mask, B_Paste, F_Adhes, F_Mask, F_Paste, B_SilkS, F_SilkS } )
{
float zposTop = 0.0;
float zposBottom = 0.0;
float zposBottom = zpos_copperTop_front + 2.0f * zpos_offset;
float zposTop = zposBottom + m_frontCopperThickness3DU;
switch( layer_id )
{
@@ -532,8 +520,8 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
break;
}
m_layerZcoordTop[layer_id] = zposTop;
m_layerZcoordBottom[layer_id] = zposBottom;
m_layerZcoordTop[(PCB_LAYER_ID)layer_id] = zposTop;
m_layerZcoordBottom[(PCB_LAYER_ID)layer_id] = zposBottom;
}
m_boardCenter = SFVEC3F( m_boardPos.x * m_biuTo3Dunits, m_boardPos.y * m_biuTo3Dunits, 0.0f );
@@ -845,7 +833,10 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
return ret;
const PCB_PLOT_PARAMS& plotParams = m_board->GetPlotOptions();
LSET layers = plotParams.GetLayerSelection() | plotParams.GetPlotOnAllLayersSelection();
LSET layers = plotParams.GetLayerSelection();
for( PCB_LAYER_ID commonLayer : plotParams.GetPlotOnAllLayersSequence() )
layers.set( commonLayer );
ret.set( LAYER_3D_BOARD, true );
ret.set( LAYER_3D_COPPER_TOP, layers.test( F_Cu ) );
@@ -869,26 +860,6 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
{
ret = preset->layers;
}
else
{
ret.set( LAYER_3D_BOARD, m_Cfg->m_Render.show_board_body );
ret.set( LAYER_3D_COPPER_TOP, m_Cfg->m_Render.show_copper_top );
ret.set( LAYER_3D_COPPER_BOTTOM, m_Cfg->m_Render.show_copper_bottom );
ret.set( LAYER_3D_SILKSCREEN_TOP, m_Cfg->m_Render.show_silkscreen_top );
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, m_Cfg->m_Render.show_silkscreen_bottom );
ret.set( LAYER_3D_SOLDERMASK_TOP, m_Cfg->m_Render.show_soldermask_top );
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, m_Cfg->m_Render.show_soldermask_bottom );
ret.set( LAYER_3D_SOLDERPASTE, m_Cfg->m_Render.show_solderpaste );
ret.set( LAYER_3D_ADHESIVE, m_Cfg->m_Render.show_adhesive );
ret.set( LAYER_3D_USER_COMMENTS, m_Cfg->m_Render.show_comments );
ret.set( LAYER_3D_USER_DRAWINGS, m_Cfg->m_Render.show_drawings );
ret.set( LAYER_3D_USER_ECO1, m_Cfg->m_Render.show_eco1 );
ret.set( LAYER_3D_USER_ECO2, m_Cfg->m_Render.show_eco2 );
ret.set( LAYER_FP_REFERENCES, m_Cfg->m_Render.show_fp_references );
ret.set( LAYER_FP_VALUES, m_Cfg->m_Render.show_fp_values );
ret.set( LAYER_FP_TEXT, m_Cfg->m_Render.show_fp_text );
}
return ret;
}
@@ -188,23 +188,23 @@ void BOARD_ADAPTER::addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D
void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aContainer,
PCB_LAYER_ID aLayerId,
const std::bitset<LAYER_3D_END>& aVisibilityFlags )
const std::bitset<LAYER_3D_END>& aFlags )
{
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
for( PCB_FIELD* field : aFootprint->GetFields() )
for( PCB_FIELD* field : aFootprint->GetFields( true /* visibleOnly */ ) )
{
if( field->GetLayer() == aLayerId && field->IsVisible() )
{
if( !aVisibilityFlags.test( LAYER_FP_TEXT ) )
continue;
else if( field->IsReference() && !aVisibilityFlags.test( LAYER_FP_REFERENCES ) )
continue;
else if( field->IsValue() && !aVisibilityFlags.test( LAYER_FP_VALUES ) )
continue;
if( !aFlags.test( LAYER_FP_TEXT ) )
continue;
if( field->IsReference() && !aFlags.test( LAYER_FP_REFERENCES ) )
continue;
if( field->IsValue() && !aFlags.test( LAYER_FP_VALUES ) )
continue;
if( field->GetLayer() == aLayerId )
addText( field, aContainer, field );
}
}
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
@@ -215,19 +215,17 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
if( text->GetLayer() == aLayerId && text->IsVisible() )
{
if( !aVisibilityFlags.test( LAYER_FP_TEXT ) )
continue;
else if( text->GetText() == wxT( "${REFERENCE}" )
&& !aVisibilityFlags.test( LAYER_FP_REFERENCES ) )
continue;
else if( text->GetText() == wxT( "${VALUE}" )
&& !aVisibilityFlags.test( LAYER_FP_VALUES ) )
continue;
if( !aFlags.test( LAYER_FP_TEXT ) )
continue;
if( text->GetText() == wxT( "${REFERENCE}" ) && !aFlags.test( LAYER_FP_REFERENCES ) )
continue;
if( text->GetText() == wxT( "${VALUE}" ) && !aFlags.test( LAYER_FP_VALUES ) )
continue;
if( text->GetLayer() == aLayerId )
addText( text, aContainer, text );
}
break;
}
@@ -283,7 +281,7 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
}
void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack,
void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack,
CONTAINER_2D_BASE* aDstContainer, PCB_LAYER_ID aLayer,
int aMargin )
{
@@ -793,11 +791,18 @@ void BOARD_ADAPTER::addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aC
void BOARD_ADAPTER::addTable( const PCB_TABLE* aTable, CONTAINER_2D_BASE* aContainer,
const BOARD_ITEM* aOwner )
{
// JEY TODO: tables
// add borders
aTable->DrawBorders(
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB, const STROKE_PARAMS& stroke )
{
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( ptA ), TO_SFVEC2F( ptB ),
TO_3DU( stroke.GetWidth() ), *aOwner );
} );
for( PCB_TABLECELL* cell : aTable->GetCells() )
addText( cell, aContainer, aOwner );
{
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
addText( cell, aContainer, aOwner );
}
}
+69 -7
View File
@@ -103,6 +103,68 @@ void transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLaye
}
void transformFPTextToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
const std::bitset<LAYER_3D_END>& aFlags, SHAPE_POLY_SET& aBuffer,
int aMaxError, ERROR_LOC aErrorLoc )
{
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
{
if( item->GetLayer() != aLayer )
continue;
if( item->Type() == PCB_TEXT_T )
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
if( !aFlags.test( LAYER_FP_TEXT ) )
continue;
if( text->GetText() == wxT( "${REFERENCE}" ) && !aFlags.test( LAYER_FP_REFERENCES ) )
continue;
if( text->GetText() == wxT( "${VALUE}" ) && !aFlags.test( LAYER_FP_VALUES ) )
continue;
if( aLayer != UNDEFINED_LAYER && text->GetLayer() == aLayer )
text->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc );
}
if( item->Type() == PCB_TEXTBOX_T )
{
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
if( aLayer != UNDEFINED_LAYER && textbox->GetLayer() == aLayer )
{
// border
if( textbox->IsBorderEnabled() )
{
textbox->PCB_SHAPE::TransformShapeToPolygon( aBuffer, aLayer, 0, aMaxError,
aErrorLoc );
}
// text
textbox->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc );
}
}
}
for( const PCB_FIELD* field : aFootprint->GetFields( true /* visibleOnly */ ) )
{
if( !aFlags.test( LAYER_FP_TEXT ) )
continue;
if( field->IsReference() && !aFlags.test( LAYER_FP_REFERENCES ) )
continue;
if( field->IsValue() && !aFlags.test( LAYER_FP_VALUES ) )
continue;
if( field && field->GetLayer() == aLayer )
field->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc );
}
}
void BOARD_ADAPTER::destroyLayers()
{
#define DELETE_AND_FREE( ptr ) \
@@ -876,7 +938,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
break;
case PCB_TABLE_T:
// JEY TODO: tables
addTable( static_cast<PCB_TABLE*>( item ), layerContainer, item );
break;
case PCB_DIM_ALIGNED_T:
@@ -1023,14 +1085,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
else
{
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError,
ERROR_INSIDE );
}
// On tech layers, use a poor circle approximation, only for texts (stroke font)
footprint->TransformFPTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
// Add the remaining things with dynamic seg count for circles
transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError, ERROR_INSIDE );
transformFPTextToPolySet( footprint, layer, visibilityFlags, *layerPoly, maxError,
ERROR_INSIDE );
transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError,
ERROR_INSIDE );
}
if( cfg.show_zones || layer == F_Mask || layer == B_Mask )
+102 -16
View File
@@ -81,6 +81,35 @@ PARAM_LAYER_PRESET_3D::PARAM_LAYER_PRESET_3D( const std::string& aPath,
m_presets( aPresetList )
{
wxASSERT( aPresetList );
#define LAYER( n, l ) m_layerToLayerNameMap[l] = n; m_layerNameToLayerMap[n] = l;
LAYER( "fp_values", LAYER_FP_VALUES );
LAYER( "fp_references", LAYER_FP_REFERENCES );
LAYER( "fp_text", LAYER_FP_TEXT );
LAYER( "background_bottom", LAYER_3D_BACKGROUND_BOTTOM );
LAYER( "background_top", LAYER_3D_BACKGROUND_TOP );
LAYER( "board", LAYER_3D_BOARD );
LAYER( "copper", LAYER_3D_COPPER_TOP );
LAYER( "copper_bottom", LAYER_3D_COPPER_BOTTOM );
LAYER( "silkscreen_bottom", LAYER_3D_SILKSCREEN_BOTTOM );
LAYER( "silkscreen_top", LAYER_3D_SILKSCREEN_TOP );
LAYER( "soldermask_bottom", LAYER_3D_SOLDERMASK_BOTTOM );
LAYER( "soldermask_top", LAYER_3D_SOLDERMASK_TOP );
LAYER( "solderpaste", LAYER_3D_SOLDERPASTE );
LAYER( "adhesive", LAYER_3D_ADHESIVE );
LAYER( "user_comments", LAYER_3D_USER_COMMENTS );
LAYER( "user_drawings", LAYER_3D_USER_DRAWINGS );
LAYER( "user_eco1", LAYER_3D_USER_ECO1 );
LAYER( "user_eco2", LAYER_3D_USER_ECO2 );
LAYER( "3d_axes", LAYER_3D_AXES );
LAYER( "th_models", LAYER_3D_TH_MODELS );
LAYER( "smd_models", LAYER_3D_SMD_MODELS );
LAYER( "virtual_models", LAYER_3D_VIRTUAL_MODELS );
LAYER( "non_pos_file_models", LAYER_3D_MODELS_NOT_IN_POS );
LAYER( "dnp_models", LAYER_3D_MODELS_MARKED_DNP );
LAYER( "bounding_boxes", LAYER_3D_BOUNDING_BOXES );
LAYER( "off_board_silk", LAYER_3D_OFF_BOARD_SILK );
}
@@ -99,7 +128,7 @@ nlohmann::json PARAM_LAYER_PRESET_3D::presetsToJson()
for( int layer = 0; layer < LAYER_3D_END; ++layer )
{
if( preset.layers.test( layer ) )
layers.push_back( layer );
layers.push_back( m_layerToLayerNameMap[layer] );
}
js["layers"] = layers;
@@ -109,7 +138,7 @@ nlohmann::json PARAM_LAYER_PRESET_3D::presetsToJson()
for( const auto& [ layer, color ] : preset.colors )
{
nlohmann::json layerColor = {
{ "layer", layer },
{ "layer", m_layerToLayerNameMap[layer] },
{ "color", color.ToCSSString() }
};
@@ -144,26 +173,20 @@ void PARAM_LAYER_PRESET_3D::jsonToPresets( const nlohmann::json& aJson )
for( const nlohmann::json& layer : preset.at( "layers" ) )
{
if( layer.is_number_integer() )
{
int layerNum = layer.get<int>();
if( layerNum >= 0 && layerNum < LAYER_3D_END )
p.layers.set( layerNum );
}
if( layer.is_string() )
p.layers.set( m_layerNameToLayerMap[layer.get<wxString>()] );
}
}
if( preset.contains( "colors" ) && preset.at( "colors" ).is_array() )
{
for( const nlohmann::json& layerColor : preset.at( "colors" ) )
for( const nlohmann::json& entry : preset.at( "colors" ) )
{
if( layerColor.contains( "layer" ) && layerColor.contains( "color" )
&& layerColor.at( "layer" ).is_number_integer() )
if( entry.contains( "layer" ) && entry.contains( "color" )
&& entry.at( "layer" ).is_string() )
{
int layerNum = layerColor.at( "layer" ).get<int>();
COLOR4D color = layerColor.at( "color" ).get<COLOR4D>();
p.colors[ layerNum ] = color;
int layerNum = m_layerNameToLayerMap[entry.at( "layer" ).get<wxString>()];
p.colors[ layerNum ] = entry.at( "color" ).get<COLOR4D>();
}
}
}
@@ -175,7 +198,7 @@ void PARAM_LAYER_PRESET_3D::jsonToPresets( const nlohmann::json& aJson )
///! Update the schema version whenever a migration is required
const int viewer3dSchemaVersion = 3;
const int viewer3dSchemaVersion = 4;
EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
@@ -425,6 +448,69 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
Set( "render.show_eco2", *optval );
}
return true;
} );
registerMigration( 3, 4,
[&]() -> bool
{
std::map<int, wxString> legacyColorMap;
legacyColorMap[142] = "fp_values";
legacyColorMap[143] = "fp_references";
legacyColorMap[130] = "fp_text";
legacyColorMap[466] = "background_bottom";
legacyColorMap[467] = "background_top";
legacyColorMap[468] = "board";
legacyColorMap[469] = "copper";
legacyColorMap[470] = "copper_bottom";
legacyColorMap[471] = "silkscreen_bottom";
legacyColorMap[472] = "silkscreen_top";
legacyColorMap[473] = "soldermask_bottom";
legacyColorMap[474] = "soldermask_top";
legacyColorMap[475] = "solderpaste";
legacyColorMap[476] = "adhesive";
legacyColorMap[477] = "user_comments";
legacyColorMap[478] = "user_drawings";
legacyColorMap[479] = "user_eco1";
legacyColorMap[480] = "user_eco2";
legacyColorMap[481] = "th_models";
legacyColorMap[482] = "smd_models";
legacyColorMap[483] = "virtual_models";
legacyColorMap[484] = "non_pos_file_models";
legacyColorMap[485] = "dnp_models";
legacyColorMap[486] = "3d_axes";
legacyColorMap[487] = "bounding_boxes";
legacyColorMap[488] = "off_board_silk";
if( !Contains( "layer_presets" ) || !At( "layer_presets" ).is_array() )
return true;
for( nlohmann::json& preset : At( "layer_presets" ) )
{
if( preset.contains( "colors" ) && preset.at( "colors" ).is_array() )
{
for( nlohmann::json& color : preset.at( "colors" ) )
{
if( color.contains( "layer" ) && color.at( "layer" ).is_number_integer() )
color["layer"] = legacyColorMap[color["layer"].get<int>()];
}
}
if( preset.contains( "layers" ) && preset.at( "layers" ).is_array() )
{
nlohmann::json mappedLayers = nlohmann::json::array();
for( const nlohmann::json& layer : preset.at( "layers" ) )
{
if( layer.is_number_integer() )
mappedLayers.push_back( legacyColorMap[layer.get<int>()] );
}
preset["layers"] = mappedLayers;
}
}
return true;
} );
}
@@ -64,7 +64,11 @@ private:
void jsonToPresets( const nlohmann::json& aJson );
private:
std::vector<LAYER_PRESET_3D>* m_presets;
std::map<int, wxString> m_layerToLayerNameMap;
std::map<wxString, int> m_layerNameToLayerMap;
};
+28 -33
View File
@@ -140,10 +140,10 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
} );
m_cbUseBoardEditorCopperColors = new wxCheckBox( m_panelLayers, wxID_ANY,
_( "Use board editor copper colors" ) );
_( "Use PCB editor copper colors" ) );
m_cbUseBoardEditorCopperColors->SetFont( infoFont );
m_cbUseBoardEditorCopperColors->SetToolTip(
_( "Use the board editor copper colors (openGL only)" ) );
m_cbUseBoardEditorCopperColors->SetToolTip( _( "Use the board editor layer colors for copper "
"layers (realtime renderer only)" ) );
m_cbUseBoardEditorCopperColors->Bind( wxEVT_CHECKBOX,
[this]( wxCommandEvent& aEvent )
@@ -156,10 +156,9 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
m_frame->NewDisplay( true );
} );
m_panelLayersSizer->Add( m_cbUseBoardStackupColors, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 7 );
m_panelLayersSizer->Add( m_cbUseBoardStackupColors, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5 );
m_panelLayersSizer->Add( m_cbUseBoardEditorCopperColors, 0,
wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 7 );
wxEXPAND | wxALL, 5 );
m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore color and visibility "
"combinations.\n"
@@ -279,16 +278,7 @@ void APPEARANCE_CONTROLS_3D::CommonSettingsChanged()
void APPEARANCE_CONTROLS_3D::ApplyLayerPreset( const wxString& aPresetName )
{
if( aPresetName == FOLLOW_PCB || aPresetName == FOLLOW_PLOT_SETTINGS )
{
m_frame->GetAdapter().m_Cfg->m_CurrentPreset = aPresetName;
UpdateLayerCtls();
m_frame->NewDisplay( true );
}
else if( LAYER_PRESET_3D* preset = m_frame->GetAdapter().m_Cfg->FindPreset( aPresetName ) )
{
doApplyLayerPreset( *preset );
}
doApplyLayerPreset( aPresetName );
// Move to front of MRU list
if( m_presetMRU.Index( aPresetName ) != wxNOT_FOUND )
@@ -731,17 +721,11 @@ void APPEARANCE_CONTROLS_3D::onLayerPresetChanged( wxCommandEvent& aEvent )
if( index == 0 )
{
name = FOLLOW_PCB;
cfg->m_CurrentPreset = name;
UpdateLayerCtls();
m_frame->NewDisplay( true );
doApplyLayerPreset( FOLLOW_PCB );
}
else if( index == 1 )
{
name = FOLLOW_PLOT_SETTINGS;
cfg->m_CurrentPreset = name;
UpdateLayerCtls();
m_frame->NewDisplay( true );
doApplyLayerPreset( FOLLOW_PLOT_SETTINGS );
}
else if( index == count - 3 )
{
@@ -827,10 +811,9 @@ void APPEARANCE_CONTROLS_3D::onLayerPresetChanged( wxCommandEvent& aEvent )
resetSelection();
return;
}
else if( LAYER_PRESET_3D* preset = cfg->FindPreset( m_cbLayerPresets->GetStringSelection() ) )
else
{
name = preset->name;
doApplyLayerPreset( *preset );
doApplyLayerPreset( m_cbLayerPresets->GetStringSelection() );
}
// Move to front of MRU list
@@ -843,16 +826,28 @@ void APPEARANCE_CONTROLS_3D::onLayerPresetChanged( wxCommandEvent& aEvent )
}
void APPEARANCE_CONTROLS_3D::doApplyLayerPreset( const LAYER_PRESET_3D& aPreset )
void APPEARANCE_CONTROLS_3D::doApplyLayerPreset( const wxString& aPresetName )
{
BOARD_ADAPTER& adapter = m_frame->GetAdapter();
adapter.m_Cfg->m_CurrentPreset = aPreset.name;
adapter.SetVisibleLayers( aPreset.layers );
adapter.SetLayerColors( aPreset.colors );
if( aPresetName == FOLLOW_PCB || aPresetName == FOLLOW_PLOT_SETTINGS )
{
adapter.m_Cfg->m_CurrentPreset = aPresetName;
adapter.SetVisibleLayers( adapter.GetVisibleLayers() );
}
else if( LAYER_PRESET_3D* preset = adapter.m_Cfg->FindPreset( aPresetName ) )
{
adapter.m_Cfg->m_CurrentPreset = aPresetName;
adapter.SetVisibleLayers( preset->layers );
adapter.SetLayerColors( preset->colors );
if( aPreset.name.Lower() == _( "legacy colors" ) )
adapter.m_Cfg->m_UseStackupColors = false;
if( preset->name.Lower() == _( "legacy colors" ) )
adapter.m_Cfg->m_UseStackupColors = false;
}
else
{
return;
}
UpdateLayerCtls();
m_frame->NewDisplay( true );
+1 -1
View File
@@ -157,7 +157,7 @@ private:
void onLayerPresetChanged( wxCommandEvent& aEvent ) override;
void doApplyLayerPreset( const LAYER_PRESET_3D& aPreset );
void doApplyLayerPreset( const wxString& aPresetName );
void onViewportChanged( wxCommandEvent& aEvent ) override;
void onUpdateViewportsCb( wxUpdateUIEvent& aEvent ) override;
@@ -11,7 +11,7 @@
APPEARANCE_CONTROLS_3D_BASE::APPEARANCE_CONTROLS_3D_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WX_PANEL( parent, id, pos, size, style, name )
{
this->SetMinSize( wxSize( 200,360 ) );
this->SetMinSize( wxSize( 210,360 ) );
m_sizerOuter = new wxBoxSizer( wxVERTICAL );
@@ -45,7 +45,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">200,360</property>
<property name="minimum_size">210,360</property>
<property name="name">APPEARANCE_CONTROLS_3D_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
+3 -3
View File
@@ -286,7 +286,7 @@ wxString PANEL_PREVIEW_3D_MODEL::formatRotationValue( double aValue )
wxString PANEL_PREVIEW_3D_MODEL::formatOffsetValue( double aValue )
{
// Convert from internal units (mm) to user units
if( m_userUnits == EDA_UNITS::INCHES )
if( m_userUnits == EDA_UNITS::INCH )
aValue /= 25.4;
else if( m_userUnits == EDA_UNITS::MILS )
aValue /= 25.4 / 1e3;
@@ -511,7 +511,7 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign
if( wxGetMouseState().ShiftDown( ) )
step_mm = OFFSET_INCREMENT_MM_FINE;
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCH )
{
step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
@@ -586,7 +586,7 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelOffset( wxMouseEvent& event )
if( event.ShiftDown( ) )
step_mm = OFFSET_INCREMENT_MM_FINE;
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCH )
{
step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;
+1 -1
View File
@@ -621,7 +621,7 @@
欠陥電気
木 王
郝弘毅
Eli Hughes
See git repo on GitLab for contributors at
https://gitlab.com/kicad/code/kicad/-/graphs/master
+24
View File
@@ -58,6 +58,30 @@ message GraphicsDefaultsResponse
kiapi.board.GraphicsDefaults defaults = 1;
}
enum BoardOriginType
{
BOT_UNKNOWN = 0;
BOT_GRID = 1;
BOT_DRILL = 2;
}
// Returns a Vector2 with the specified origin point
message GetBoardOrigin
{
kiapi.common.types.DocumentSpecifier board = 1;
BoardOriginType type = 2;
}
message SetBoardOrigin
{
kiapi.common.types.DocumentSpecifier board = 1;
BoardOriginType type = 2;
kiapi.common.types.Vector2 origin = 3;
}
/*
* Net management
*/
+39
View File
@@ -89,6 +89,42 @@ enum BoardLayer
BL_User_8 = 60;
BL_User_9 = 61;
BL_Rescue = 62;
BL_User_10 = 63;
BL_User_11 = 64;
BL_User_12 = 65;
BL_User_13 = 66;
BL_User_14 = 67;
BL_User_15 = 68;
BL_User_16 = 69;
BL_User_17 = 70;
BL_User_18 = 71;
BL_User_19 = 72;
BL_User_20 = 73;
BL_User_21 = 74;
BL_User_22 = 75;
BL_User_23 = 76;
BL_User_24 = 77;
BL_User_25 = 78;
BL_User_26 = 79;
BL_User_27 = 80;
BL_User_28 = 81;
BL_User_29 = 82;
BL_User_30 = 83;
BL_User_31 = 84;
BL_User_32 = 85;
BL_User_33 = 86;
BL_User_34 = 87;
BL_User_35 = 88;
BL_User_36 = 89;
BL_User_37 = 90;
BL_User_38 = 91;
BL_User_39 = 92;
BL_User_40 = 93;
BL_User_41 = 94;
BL_User_42 = 95;
BL_User_43 = 96;
BL_User_44 = 97;
BL_User_45 = 98;
}
message NetCode
@@ -768,6 +804,9 @@ message Field
FieldId id = 1;
string name = 2;
BoardText text = 3;
// Since 9.0.1
bool visible = 4;
}
enum FootprintMountingStyle
+5 -2
View File
@@ -291,7 +291,10 @@ message TextAttributes
bool italic = 7;
bool bold = 8;
bool underlined = 9;
// Deprecated since 9.0.1 (text items are now always visible, only Fields can be hidden)
bool visible = 10;
bool mirrored = 11;
bool multiline = 12;
bool keep_upright = 13;
@@ -305,7 +308,7 @@ message Text
kiapi.common.types.Vector2 position = 2;
kiapi.common.types.TextAttributes attributes = 3;
// Reserved for future use; base objects don't support locking right nos
// Reserved for future use; base objects don't support locking right now
//kiapi.common.types.LockedState locked = 4;
string text = 5;
@@ -318,7 +321,7 @@ message TextBox
kiapi.common.types.Vector2 bottom_right = 3;
kiapi.common.types.TextAttributes attributes = 4;
// Reserved for future use; base objects don't support locking right nos
// Reserved for future use; base objects don't support locking right now
//kiapi.common.types.LockedState locked = 5;
string text = 6;
+9 -9
View File
@@ -51,7 +51,7 @@ IMAGE_SIZE::IMAGE_SIZE()
m_outputSize = 0.0;
m_originalDPI = DEFAULT_DPI;
m_originalSizePixels = 0;
m_unit = EDA_UNITS::MILLIMETRES;
m_unit = EDA_UNITS::MM;
}
@@ -61,9 +61,9 @@ void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
m_originalDPI = std::max( 1, m_originalDPI );
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
if( m_unit == EDA_UNITS::MILLIMETRES )
if( m_unit == EDA_UNITS::MM )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
else if( m_unit == EDA_UNITS::INCHES )
else if( m_unit == EDA_UNITS::INCH )
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
else
m_outputSize = m_originalDPI;
@@ -74,9 +74,9 @@ int IMAGE_SIZE::GetOutputDPI()
{
int outputDPI;
if( m_unit == EDA_UNITS::MILLIMETRES )
if( m_unit == EDA_UNITS::MM )
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
else if( m_unit == EDA_UNITS::INCHES )
else if( m_unit == EDA_UNITS::INCH )
outputDPI = GetOriginalSizePixels() / m_outputSize;
else
outputDPI = KiROUND( m_outputSize );
@@ -98,11 +98,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
// Convert m_outputSize to mm:
double size_mm;
if( m_unit == EDA_UNITS::MILLIMETRES )
if( m_unit == EDA_UNITS::MM )
{
size_mm = m_outputSize;
}
else if( m_unit == EDA_UNITS::INCHES )
else if( m_unit == EDA_UNITS::INCH )
{
size_mm = m_outputSize * 25.4;
}
@@ -117,11 +117,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
}
// Convert m_outputSize to new value:
if( aUnit == EDA_UNITS::MILLIMETRES )
if( aUnit == EDA_UNITS::MM )
{
m_outputSize = size_mm;
}
else if( aUnit == EDA_UNITS::INCHES )
else if( aUnit == EDA_UNITS::INCH )
{
m_outputSize = size_mm / 25.4;
}
+4 -4
View File
@@ -266,9 +266,9 @@ wxString BITMAP2CMP_PANEL::formatOutputSize( double aSize )
{
wxString text;
if( getUnitFromSelection() == EDA_UNITS::MILLIMETRES )
if( getUnitFromSelection() == EDA_UNITS::MM )
text.Printf( wxS( "%.1f" ), aSize );
else if( getUnitFromSelection() == EDA_UNITS::INCHES )
else if( getUnitFromSelection() == EDA_UNITS::INCH )
text.Printf( wxS( "%.2f" ), aSize );
else
text.Printf( wxT( "%d" ), KiROUND( aSize ) );
@@ -295,10 +295,10 @@ EDA_UNITS BITMAP2CMP_PANEL::getUnitFromSelection()
// return the EDA_UNITS from the m_PixelUnit choice
switch( m_PixelUnit->GetSelection() )
{
case 1: return EDA_UNITS::INCHES;
case 1: return EDA_UNITS::INCH;
case 2: return EDA_UNITS::UNSCALED;
case 0:
default: return EDA_UNITS::MILLIMETRES;
default: return EDA_UNITS::MM;
}
}
+1 -1
View File
@@ -37,7 +37,7 @@
# KiCad.
#
# Note: This version string should follow the semantic versioning system
set( KICAD_SEMANTIC_VERSION "9.0.0-unknown" )
set( KICAD_SEMANTIC_VERSION "9.0.1-rc1" )
# Default the version to the semantic version.
# This is overridden by the git repository tag though (if using git)
+1
View File
@@ -72,6 +72,7 @@ set( KICOMMON_SRCS
jobs/job_export_pcb_gerber.cpp
jobs/job_export_pcb_gerbers.cpp
jobs/job_export_pcb_ipc2581.cpp
jobs/job_export_pcb_ipcd356.cpp
jobs/job_export_pcb_odb.cpp
jobs/job_export_pcb_pdf.cpp
jobs/job_export_pcb_plot.cpp
+20
View File
@@ -127,6 +127,9 @@ static const wxChar MsgPanelShowUuids[] = wxT( "MsgPanelShowUuids" );
static const wxChar MaximumThreads[] = wxT( "MaximumThreads" );
static const wxChar NetInspectorBulkUpdateOptimisationThreshold[] =
wxT( "NetInspectorBulkUpdateOptimisationThreshold" );
static const wxChar ExcludeFromSimulationLineWidth[] = wxT( "ExcludeFromSimulationLineWidth" );
static const wxChar GitIconRefreshInterval[] = wxT( "GitIconRefreshInterval" );
static const wxChar GitProjectStatusRefreshInterval[] = wxT( "GitProjectStatusRefreshInterval" );
} // namespace KEYS
@@ -307,6 +310,11 @@ ADVANCED_CFG::ADVANCED_CFG()
m_NetInspectorBulkUpdateOptimisationThreshold = 25;
m_ExcludeFromSimulationLineWidth = 25;
m_GitIconRefreshInterval = 10000;
m_GitProjectStatusRefreshInterval = 60000;
loadFromConfigFile();
}
@@ -592,6 +600,18 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
&m_NetInspectorBulkUpdateOptimisationThreshold,
m_NetInspectorBulkUpdateOptimisationThreshold, 0, 1000 ) );
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::ExcludeFromSimulationLineWidth,
&m_ExcludeFromSimulationLineWidth,
m_ExcludeFromSimulationLineWidth, 1, 100 ) );
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::GitIconRefreshInterval,
&m_GitIconRefreshInterval,
m_GitIconRefreshInterval, 0, 100000 ) );
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::GitProjectStatusRefreshInterval,
&m_GitProjectStatusRefreshInterval,
m_GitProjectStatusRefreshInterval, 0, 100000 ) );
// Special case for trace mask setting...we just grab them and set them immediately
// Because we even use wxLogTrace inside of advanced config
wxString traceMasks;
+72
View File
@@ -214,6 +214,42 @@ PCB_LAYER_ID FromProtoEnum( board::types::BoardLayer aValue )
case board::types::BoardLayer::BL_User_8: return User_8;
case board::types::BoardLayer::BL_User_9: return User_9;
case board::types::BoardLayer::BL_Rescue: return Rescue;
case board::types::BoardLayer::BL_User_10: return User_10;
case board::types::BoardLayer::BL_User_11: return User_11;
case board::types::BoardLayer::BL_User_12: return User_12;
case board::types::BoardLayer::BL_User_13: return User_13;
case board::types::BoardLayer::BL_User_14: return User_14;
case board::types::BoardLayer::BL_User_15: return User_15;
case board::types::BoardLayer::BL_User_16: return User_16;
case board::types::BoardLayer::BL_User_17: return User_17;
case board::types::BoardLayer::BL_User_18: return User_18;
case board::types::BoardLayer::BL_User_19: return User_19;
case board::types::BoardLayer::BL_User_20: return User_20;
case board::types::BoardLayer::BL_User_21: return User_21;
case board::types::BoardLayer::BL_User_22: return User_22;
case board::types::BoardLayer::BL_User_23: return User_23;
case board::types::BoardLayer::BL_User_24: return User_24;
case board::types::BoardLayer::BL_User_25: return User_25;
case board::types::BoardLayer::BL_User_26: return User_26;
case board::types::BoardLayer::BL_User_27: return User_27;
case board::types::BoardLayer::BL_User_28: return User_28;
case board::types::BoardLayer::BL_User_29: return User_29;
case board::types::BoardLayer::BL_User_30: return User_30;
case board::types::BoardLayer::BL_User_31: return User_31;
case board::types::BoardLayer::BL_User_32: return User_32;
case board::types::BoardLayer::BL_User_33: return User_33;
case board::types::BoardLayer::BL_User_34: return User_34;
case board::types::BoardLayer::BL_User_35: return User_35;
case board::types::BoardLayer::BL_User_36: return User_36;
case board::types::BoardLayer::BL_User_37: return User_37;
case board::types::BoardLayer::BL_User_38: return User_38;
case board::types::BoardLayer::BL_User_39: return User_39;
case board::types::BoardLayer::BL_User_40: return User_40;
case board::types::BoardLayer::BL_User_41: return User_41;
case board::types::BoardLayer::BL_User_42: return User_42;
case board::types::BoardLayer::BL_User_43: return User_43;
case board::types::BoardLayer::BL_User_44: return User_44;
case board::types::BoardLayer::BL_User_45: return User_45;
case board::types::BoardLayer::BL_UNKNOWN: return UNDEFINED_LAYER;
default:
@@ -290,6 +326,42 @@ board::types::BoardLayer ToProtoEnum( PCB_LAYER_ID aValue )
case User_8: return board::types::BoardLayer::BL_User_8;
case User_9: return board::types::BoardLayer::BL_User_9;
case Rescue: return board::types::BoardLayer::BL_Rescue;
case User_10: return board::types::BoardLayer::BL_User_10;
case User_11: return board::types::BoardLayer::BL_User_11;
case User_12: return board::types::BoardLayer::BL_User_12;
case User_13: return board::types::BoardLayer::BL_User_13;
case User_14: return board::types::BoardLayer::BL_User_14;
case User_15: return board::types::BoardLayer::BL_User_15;
case User_16: return board::types::BoardLayer::BL_User_16;
case User_17: return board::types::BoardLayer::BL_User_17;
case User_18: return board::types::BoardLayer::BL_User_18;
case User_19: return board::types::BoardLayer::BL_User_19;
case User_20: return board::types::BoardLayer::BL_User_20;
case User_21: return board::types::BoardLayer::BL_User_21;
case User_22: return board::types::BoardLayer::BL_User_22;
case User_23: return board::types::BoardLayer::BL_User_23;
case User_24: return board::types::BoardLayer::BL_User_24;
case User_25: return board::types::BoardLayer::BL_User_25;
case User_26: return board::types::BoardLayer::BL_User_26;
case User_27: return board::types::BoardLayer::BL_User_27;
case User_28: return board::types::BoardLayer::BL_User_28;
case User_29: return board::types::BoardLayer::BL_User_29;
case User_30: return board::types::BoardLayer::BL_User_30;
case User_31: return board::types::BoardLayer::BL_User_31;
case User_32: return board::types::BoardLayer::BL_User_32;
case User_33: return board::types::BoardLayer::BL_User_33;
case User_34: return board::types::BoardLayer::BL_User_34;
case User_35: return board::types::BoardLayer::BL_User_35;
case User_36: return board::types::BoardLayer::BL_User_36;
case User_37: return board::types::BoardLayer::BL_User_37;
case User_38: return board::types::BoardLayer::BL_User_38;
case User_39: return board::types::BoardLayer::BL_User_39;
case User_40: return board::types::BoardLayer::BL_User_40;
case User_41: return board::types::BoardLayer::BL_User_41;
case User_42: return board::types::BoardLayer::BL_User_42;
case User_43: return board::types::BoardLayer::BL_User_43;
case User_44: return board::types::BoardLayer::BL_User_44;
case User_45: return board::types::BoardLayer::BL_User_45;
default:
wxCHECK_MSG( false, board::types::BoardLayer::BL_UNKNOWN,
"Unhandled case in ToProtoEnum<PCB_LAYER_ID>");
+3 -1
View File
@@ -74,8 +74,10 @@ DESIGN_BLOCK_IO_MGR::DESIGN_BLOCK_FILE_T
DESIGN_BLOCK_IO_MGR::GuessPluginTypeFromLibPath( const wxString& aLibPath, int aCtl )
{
if( IO_RELEASER<DESIGN_BLOCK_IO>( FindPlugin( KICAD_SEXP ) )->CanReadLibrary( aLibPath )
&& aCtl != KICTL_NONKICAD_ONLY )
&& aCtl != KICTL_NONKICAD_ONLY )
{
return KICAD_SEXP;
}
return DESIGN_BLOCK_IO_MGR::FILE_TYPE_NONE;
}
+27 -19
View File
@@ -205,7 +205,8 @@ void DESIGN_BLOCK_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
row->SetVisible();
break;
default: in->Unexpected( tok );
default:
in->Unexpected( tok );
}
in->NeedRIGHT();
@@ -253,7 +254,9 @@ bool DESIGN_BLOCK_LIB_TABLE::operator==( const DESIGN_BLOCK_LIB_TABLE& aDesignBl
{
if( (DESIGN_BLOCK_LIB_TABLE_ROW&) m_rows[i]
!= (DESIGN_BLOCK_LIB_TABLE_ROW&) aDesignBlockTable.m_rows[i] )
{
return false;
}
}
return true;
@@ -268,8 +271,8 @@ void DESIGN_BLOCK_LIB_TABLE::Format( OUTPUTFORMATTER* aOutput, int aIndentLevel
aOutput->Print( aIndentLevel, "(design_block_lib_table\n" );
aOutput->Print( aIndentLevel + 1, "(version %d)\n", m_version );
for( LIB_TABLE_ROWS_CITER it = m_rows.begin(); it != m_rows.end(); ++it )
it->Format( aOutput, aIndentLevel + 1 );
for( const LIB_TABLE_ROW& row : m_rows)
row.Format( aOutput, aIndentLevel + 1 );
aOutput->Print( aIndentLevel, ")\n" );
}
@@ -330,9 +333,9 @@ const DESIGN_BLOCK_LIB_TABLE_ROW* DESIGN_BLOCK_LIB_TABLE::FindRow( const wxStrin
if( !row )
{
wxString msg = wxString::Format(
_( "design-block-lib-table files contain no library named '%s'." ), aNickname );
THROW_IO_ERROR( msg );
THROW_IO_ERROR( wxString::Format( _( "design-block-lib-table files contain no library "
"named '%s'." ),
aNickname ) );
}
if( !row->plugin )
@@ -490,14 +493,12 @@ DESIGN_BLOCK_LIB_TABLE::DesignBlockLoadWithOptionalNickname( const LIB_ID& aDesi
// nickname is empty, sequentially search (alphabetically) all libs/nicks for first match:
else
{
std::vector<wxString> nicks = GetLogicalLibs();
// Search each library going through libraries alphabetically.
for( unsigned i = 0; i < nicks.size(); ++i )
for( const wxString& library : GetLogicalLibs() )
{
// DesignBlockLoad() returns NULL on not found, does not throw exception
// unless there's an IO_ERROR.
DESIGN_BLOCK* ret = DesignBlockLoad( nicks[i], DesignBlockname, aKeepUUID );
DESIGN_BLOCK* ret = DesignBlockLoad( library, DesignBlockname, aKeepUUID );
if( ret )
return ret;
@@ -520,7 +521,8 @@ public:
explicit PCM_DESIGN_BLOCK_LIB_TRAVERSER( const wxString& aPath, DESIGN_BLOCK_LIB_TABLE& aTable,
const wxString& aPrefix ) :
m_lib_table( aTable ),
m_path_prefix( aPath ), m_lib_prefix( aPrefix )
m_path_prefix( aPath ),
m_lib_prefix( aPrefix )
{
wxFileName f( aPath, wxS( "" ) );
m_prefix_dir_count = f.GetDirCount();
@@ -539,8 +541,9 @@ public:
FILEEXT::KiCadDesignBlockLibPathExtension ) )
&& dir.GetDirCount() >= m_prefix_dir_count + 3 )
{
wxString versionedPath = wxString::Format(
wxS( "${%s}" ), ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ) );
wxString versionedPath;
versionedPath.Printf( wxS( "${%s}" ),
ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ) );
wxArrayString parts = dir.GetDirs();
parts.RemoveAt( 0, m_prefix_dir_count );
@@ -551,16 +554,21 @@ public:
if( !m_lib_table.HasLibraryWithPath( libPath ) )
{
wxString name = parts.Last().substr( 0, parts.Last().length() - 7 );
wxString nickname = wxString::Format( wxS( "%s%s" ), m_lib_prefix, name );
wxString nickname;
nickname.Printf( wxS( "%s%s" ),
m_lib_prefix,
name );
if( m_lib_table.HasLibrary( nickname ) )
{
int increment = 1;
do
{
nickname =
wxString::Format( wxS( "%s%s_%d" ), m_lib_prefix, name, increment );
increment++;
nickname.Printf( wxS( "%s%s_%d" ),
m_lib_prefix,
name,
increment++ );
} while( m_lib_table.HasLibrary( nickname ) );
}
@@ -603,8 +611,8 @@ bool DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable( DESIGN_BLOCK_LIB_TABLE& aTable )
SystemDirsAppend( &ss );
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
std::optional<wxString> v =
ENV_VAR::GetVersionedEnvVarValue( envVars, wxT( "TEMPLATE_DIR" ) );
std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( envVars,
wxT( "TEMPLATE_DIR" ) );
if( v && !v->IsEmpty() )
ss.AddPaths( *v, 0 );
+11 -11
View File
@@ -87,17 +87,17 @@ END_EVENT_TABLE()
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style,
const wxString& name ) :
wxDialog( aParent, id, title, pos, size, style, name ),
KIWAY_HOLDER( nullptr, KIWAY_HOLDER::DIALOG ),
m_units( EDA_UNITS::MILLIMETRES ),
m_useCalculatedSize( false ),
m_firstPaintEvent( true ),
m_initialFocusTarget( nullptr ),
m_isClosing( false ),
m_qmodal_loop( nullptr ),
m_qmodal_showing( false ),
m_qmodal_parent_disabler( nullptr ),
m_parentFrame( nullptr )
wxDialog( aParent, id, title, pos, size, style, name ),
KIWAY_HOLDER( nullptr, KIWAY_HOLDER::DIALOG ),
m_units( EDA_UNITS::MM ),
m_useCalculatedSize( false ),
m_firstPaintEvent( true ),
m_initialFocusTarget( nullptr ),
m_isClosing( false ),
m_qmodal_loop( nullptr ),
m_qmodal_showing( false ),
m_qmodal_parent_disabler( nullptr ),
m_parentFrame( nullptr )
{
KIWAY_HOLDER* kiwayHolder = nullptr;
m_initialSize = size;
+6 -6
View File
@@ -77,14 +77,14 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
{
double gridX = m_gridSizeX.GetDoubleValue();
if( !m_gridSizeX.Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) )
if( !m_gridSizeX.Validate( 0.001, 1000.0, EDA_UNITS::MM ) )
{
wxMessageBox( _( "Grid size X out of range." ), _( "Error" ), wxOK | wxICON_ERROR );
return false;
}
if( !m_checkLinked->IsChecked()
&& !m_gridSizeY.Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) )
&& !m_gridSizeY.Validate( 0.001, 1000.0, EDA_UNITS::MM ) )
{
wxMessageBox( _( "Grid size Y out of range." ), _( "Error" ), wxOK | wxICON_ERROR );
return false;
@@ -94,10 +94,10 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
m_grid.name = m_textName->GetValue();
// Grid X/Y are always stored in millimeters so we can compare them easily
m_grid.x = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(),
EDA_UNITS::MILLIMETRES, gridX );
m_grid.y = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(),
EDA_UNITS::MILLIMETRES, gridY );
m_grid.x = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(), EDA_UNITS::MM,
gridX );
m_grid.y = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(), EDA_UNITS::MM,
gridY );
return true;
}
+11 -1
View File
@@ -21,11 +21,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "kicad_manager_frame.h"
#include <dialogs/dialog_hotkey_list.h>
#include <kiface_base.h>
#include <eda_base_frame.h>
#include <panel_hotkeys_editor.h>
#include <widgets/ui_common.h>
#include <tool/tool_manager.h>
#include <wx/sizer.h>
#include <wx/button.h>
@@ -39,7 +41,15 @@ DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent ):
m_hk_list = new PANEL_HOTKEYS_EDITOR( aParent, this, true );
Kiway().GetActions( m_hk_list->ActionsList() );
wxWindow* kicadMgr_window = wxWindow::FindWindowByName( KICAD_MANAGER_FRAME_NAME );
if( KICAD_MANAGER_FRAME* kicadMgr = static_cast<KICAD_MANAGER_FRAME*>( kicadMgr_window ) )
{
ACTION_MANAGER* actionMgr = kicadMgr->GetToolManager()->GetActionManager();
for( const auto& [name, action] : actionMgr->GetActions() )
m_hk_list->ActionsList().push_back( action );
}
kiface = Kiway().KiFACE( KIWAY::FACE_SCH );
kiface->GetActions( m_hk_list->ActionsList() );
+51 -75
View File
@@ -25,6 +25,8 @@
#include <confirm.h>
#include <git2.h>
#include <git/kicad_git_memory.h>
#include <git/kicad_git_common.h>
#include <gestfich.h>
#include <cerrno>
@@ -42,9 +44,6 @@ DIALOG_GIT_REPOSITORY::DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository*
DIALOG_GIT_REPOSITORY_BASE( aParent ),
m_repository( aRepository ),
m_prevFile( wxEmptyString ),
m_tested( 0 ),
m_failedTest( false ),
m_testError( wxEmptyString ),
m_tempRepo( false )
{
m_txtURL->SetFocus();
@@ -68,13 +67,18 @@ DIALOG_GIT_REPOSITORY::DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository*
if( !m_txtURL->GetValue().IsEmpty() )
updateURLData();
else
m_ConnType->SetSelection( static_cast<int>( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL ) );
SetupStandardButtons();
updateAuthControls();
SetupStandardButtons( { { wxID_HELP, _( "Test Connection" ) } } );
Layout();
finishDialogSettings();
updateAuthControls();
}
DIALOG_GIT_REPOSITORY::~DIALOG_GIT_REPOSITORY()
{
if( m_tempRepo )
@@ -140,6 +144,13 @@ void DIALOG_GIT_REPOSITORY::setDefaultSSHKey()
}
void DIALOG_GIT_REPOSITORY::onCbCustom( wxCommandEvent& event )
{
updateAuthControls();
event.Skip();
}
void DIALOG_GIT_REPOSITORY::OnUpdateUI( wxUpdateUIEvent& event )
{
// event.Enable( !m_txtName->GetValue().IsEmpty() && !m_txtURL->GetValue().IsEmpty() );
@@ -161,6 +172,7 @@ void DIALOG_GIT_REPOSITORY::SetEncrypted( bool aEncrypted )
}
}
std::tuple<bool,wxString,wxString,wxString> DIALOG_GIT_REPOSITORY::isValidHTTPS( const wxString& url )
{
wxRegEx regex( R"((https?:\/\/)(([^:]+)(:([^@]+))?@)?([^\/]+\/[^\s]+))" );
@@ -235,7 +247,6 @@ void DIALOG_GIT_REPOSITORY::updateURLData()
if( m_txtName->GetValue().IsEmpty() )
m_txtName->SetValue( get_repo_name( repoAddress ) );
}
}
else if( url.Contains( "ssh://" ) || url.Contains( "git@" ) )
@@ -259,6 +270,11 @@ void DIALOG_GIT_REPOSITORY::updateURLData()
void DIALOG_GIT_REPOSITORY::OnTestClick( wxCommandEvent& event )
{
if( m_txtURL->GetValue().Trim().Trim( false ).IsEmpty() )
return;
wxString error;
bool success = false;
git_remote* remote = nullptr;
git_remote_callbacks callbacks;
git_remote_init_callbacks( &callbacks, GIT_REMOTE_CALLBACKS_VERSION );
@@ -266,81 +282,39 @@ void DIALOG_GIT_REPOSITORY::OnTestClick( wxCommandEvent& event )
// We track if we have already tried to connect.
// If we have, the server may come back to offer another connection
// type, so we need to keep track of how many times we have tried.
m_tested = 0;
callbacks.credentials = []( git_cred** aOut, const char* aUrl, const char* aUsername,
unsigned int aAllowedTypes, void* aPayload ) -> int
{
DIALOG_GIT_REPOSITORY* dialog = static_cast<DIALOG_GIT_REPOSITORY*>( aPayload );
KIGIT_COMMON common( m_repository );
callbacks.credentials = credentials_cb;
callbacks.payload = &common;
common.SetPassword( m_txtPassword->GetValue() );
common.SetUsername( m_txtUsername->GetValue() );
common.SetSSHKey( m_fpSSHKey->GetFileName().GetFullPath() );
if( dialog->GetRepoType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL )
return GIT_PASSTHROUGH;
if( aAllowedTypes & GIT_CREDTYPE_USERNAME
&& !( dialog->GetTested() & GIT_CREDTYPE_USERNAME ) )
{
wxString username = dialog->GetUsername().Trim().Trim( false );
git_cred_username_new( aOut, username.ToStdString().c_str() );
dialog->GetTested() |= GIT_CREDTYPE_USERNAME;
}
else if( dialog->GetRepoType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_HTTPS
&& ( aAllowedTypes & GIT_CREDTYPE_USERPASS_PLAINTEXT )
&& !( dialog->GetTested() & GIT_CREDTYPE_USERPASS_PLAINTEXT ) )
{
wxString username = dialog->GetUsername().Trim().Trim( false );
wxString password = dialog->GetPassword().Trim().Trim( false );
git_cred_userpass_plaintext_new( aOut, username.ToStdString().c_str(),
password.ToStdString().c_str() );
dialog->GetTested() |= GIT_CREDTYPE_USERPASS_PLAINTEXT;
}
else if( dialog->GetRepoType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_SSH
&& ( aAllowedTypes & GIT_CREDTYPE_SSH_KEY )
&& !( dialog->GetTested() & GIT_CREDTYPE_SSH_KEY ) )
{
// SSH key authentication
wxString sshKey = dialog->GetRepoSSHPath();
wxString sshPubKey = sshKey + ".pub";
wxString username = dialog->GetUsername().Trim().Trim( false );
wxString password = dialog->GetPassword().Trim().Trim( false );
git_cred_ssh_key_new( aOut, username.ToStdString().c_str(),
sshPubKey.ToStdString().c_str(), sshKey.ToStdString().c_str(),
password.ToStdString().c_str() );
dialog->GetTested() |= GIT_CREDTYPE_SSH_KEY;
}
else
{
return GIT_PASSTHROUGH;
}
return GIT_OK;
};
callbacks.payload = this;
wxString txtURL = m_txtURL->GetValue();
git_remote_create_with_fetchspec( &remote, m_repository, "origin", txtURL.ToStdString().c_str(),
git_remote_create_with_fetchspec( &remote, m_repository, "origin", txtURL.mbc_str(),
"+refs/heads/*:refs/remotes/origin/*" );
KIGIT::GitRemotePtr remotePtr( remote );
if( git_remote_connect( remote, GIT_DIRECTION_FETCH, &callbacks, nullptr, nullptr ) != GIT_OK )
SetTestResult( true, git_error_last()->message );
if( git_remote_connect( remote, GIT_DIRECTION_FETCH, &callbacks, nullptr, nullptr ) == GIT_OK )
success = true;
else
SetTestResult( false, wxEmptyString );
error = KIGIT_COMMON::GetLastGitError();
git_remote_disconnect( remote );
git_remote_free( remote );
auto dlg = wxMessageDialog( this, wxEmptyString, _( "Test connection" ), wxOK | wxICON_INFORMATION );
auto dlg = wxMessageDialog( this, wxEmptyString, _( "Test Connection" ),
wxOK | wxICON_INFORMATION );
if( !m_failedTest )
if( success )
{
dlg.SetMessage( _( "Connection successful" ) );
}
else
{
dlg.SetMessage( wxString::Format( _( "Could not connect to '%s' " ), m_txtURL->GetValue() ) );
dlg.SetExtendedMessage( m_testError );
dlg.SetMessage( wxString::Format( _( "Could not connect to '%s' " ),
m_txtURL->GetValue() ) );
dlg.SetExtendedMessage( error );
}
dlg.ShowModal();
@@ -435,28 +409,30 @@ void DIALOG_GIT_REPOSITORY::updateAuthControls()
{
if( m_ConnType->GetSelection() == static_cast<int>( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL ) )
{
m_panelAuth->Show( false );
m_panelAuth->Enable( false );
}
else
{
m_panelAuth->Show( true );
m_panelAuth->Enable( true );
if( m_ConnType->GetSelection() == static_cast<int>( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_SSH ) )
{
m_fpSSHKey->Show( true );
m_labelSSH->Show( true );
m_labelPass1->SetLabel( _( "SSH Key Password" ) );
m_cbCustom->Enable( true );
m_fpSSHKey->Enable( m_cbCustom->IsChecked() );
m_txtUsername->Enable( m_cbCustom->IsChecked() );
m_txtPassword->Enable( m_cbCustom->IsChecked() );
m_labelPass1->SetLabel( _( "SSH key password:" ) );
}
else
{
m_fpSSHKey->Show( false );
m_labelSSH->Show( false );
m_labelPass1->SetLabel( _( "Password" ) );
m_cbCustom->Enable( false );
m_fpSSHKey->Enable( false );
m_txtUsername->Enable( true );
m_txtPassword->Enable( true );
m_labelPass1->SetLabel( _( "Password:" ) );
setDefaultSSHKey();
}
}
Layout();
}
+1 -12
View File
@@ -36,12 +36,6 @@ public:
wxString aURL = wxEmptyString );
~DIALOG_GIT_REPOSITORY() override;
void SetTestResult( bool aFailed, const wxString& aError )
{
m_failedTest = aFailed;
m_testError = aError;
}
void SetRepoType( KIGIT_COMMON::GIT_CONN_TYPE aType )
{
m_ConnType->SetSelection( static_cast<int>( aType ) );
@@ -87,8 +81,6 @@ public:
void SetRepoSSHPath( const wxString& aPath ) { m_fpSSHKey->SetFileName( aPath ); m_prevFile = aPath; }
wxString GetRepoSSHPath() const { return m_fpSSHKey->GetFileName().GetFullPath(); }
unsigned& GetTested() { return m_tested; }
void SetEncrypted( bool aEncrypted = true );
private:
@@ -100,6 +92,7 @@ private:
void OnTestClick( wxCommandEvent& event ) override;
void OnFileUpdated( wxFileDirPickerEvent& event ) override;
void onCbCustom( wxCommandEvent& event ) override;
void setDefaultSSHKey();
@@ -115,10 +108,6 @@ private:
wxString m_prevFile;
unsigned m_tested;
bool m_failedTest;
wxString m_testError;
bool m_tempRepo;
wxString m_tempPath;
};
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-254-gc2ef7767)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -13,7 +13,6 @@ DIALOG_GIT_REPOSITORY_BASE::DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWind
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Connection"), wxDefaultPosition, wxDefaultSize, 0 );
@@ -21,31 +20,37 @@ DIALOG_GIT_REPOSITORY_BASE::DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWind
bSizerMain->Add( m_staticText1, 0, wxLEFT|wxTOP, 10 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxTOP, 5 );
bSizerMain->Add( m_staticline1, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer2 = new wxFlexGridSizer( 0, 2, 5, 0 );
fgSizer2->AddGrowableCol( 1 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer2->Add( m_staticText3, 0, wxALL, 5 );
m_staticText3->Hide();
fgSizer2->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_txtName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_txtName, 0, wxALL|wxEXPAND, 5 );
m_txtName->Hide();
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Location"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_txtName, 0, wxEXPAND|wxRIGHT, 5 );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Location:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
fgSizer2->Add( m_staticText4, 0, wxALL, 5 );
fgSizer2->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
m_txtURL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_txtURL, 0, wxALL|wxEXPAND, 5 );
fgSizer2->Add( m_txtURL, 0, wxEXPAND|wxRIGHT, 5 );
m_staticText9 = new wxStaticText( this, wxID_ANY, _("Connection Type"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9 = new wxStaticText( this, wxID_ANY, _("Connection type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9->Wrap( -1 );
fgSizer2->Add( m_staticText9, 0, wxALL, 5 );
m_staticText9->Hide();
fgSizer2->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
@@ -54,97 +59,84 @@ DIALOG_GIT_REPOSITORY_BASE::DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWind
int m_ConnTypeNChoices = sizeof( m_ConnTypeChoices ) / sizeof( wxString );
m_ConnType = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ConnTypeNChoices, m_ConnTypeChoices, 0 );
m_ConnType->SetSelection( 0 );
bSizer3->Add( m_ConnType, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_ConnType->Hide();
bSizer3->Add( m_ConnType, 0, wxRIGHT, 5 );
bSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
bSizer3->Add( 0, 0, 0, wxEXPAND, 5 );
fgSizer2->Add( bSizer3, 1, wxEXPAND, 5 );
bSizerMain->Add( fgSizer2, 1, wxEXPAND, 5 );
bSizerMain->Add( fgSizer2, 0, wxEXPAND, 5 );
m_panelAuth = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_szAuth;
m_szAuth = new wxBoxSizer( wxVERTICAL );
m_szAuth->Add( 0, 0, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxHORIZONTAL );
m_staticText2 = new wxStaticText( m_panelAuth, wxID_ANY, _("Authentication"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bSizer11->Add( m_staticText2, 0, wxLEFT|wxTOP, 10 );
bSizer11->Add( 0, 0, 1, wxEXPAND, 5 );
m_szAuth->Add( bSizer11, 0, wxEXPAND, 5 );
m_szAuth->Add( m_staticText2, 0, wxLEFT|wxTOP, 10 );
m_staticline2 = new wxStaticLine( m_panelAuth, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_szAuth->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
wxFlexGridSizer* fgSshSizer;
fgSshSizer = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSshSizer->AddGrowableCol( 1 );
fgSshSizer->SetFlexibleDirection( wxBOTH );
fgSshSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxFlexGridSizer* fgSizer21;
fgSizer21 = new wxFlexGridSizer( 0, 2, 5, 0 );
fgSizer21->SetFlexibleDirection( wxBOTH );
fgSizer21->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_labelSSH = new wxStaticText( m_panelAuth, wxID_ANY, _("SSH Private Key"), wxDefaultPosition, wxDefaultSize, 0 );
m_labelSSH->Wrap( -1 );
fgSshSizer->Add( m_labelSSH, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5 );
wxBoxSizer* bSizer41;
bSizer41 = new wxBoxSizer( wxHORIZONTAL );
m_cbCustom = new wxCheckBox( m_panelAuth, wxID_ANY, _("SSH private key: "), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer21->Add( m_cbCustom, 0, wxALL, 5 );
m_fpSSHKey = new wxFilePickerCtrl( m_panelAuth, wxID_ANY, wxEmptyString, _("Select SSH private key file"), _("*"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE|wxFLP_FILE_MUST_EXIST|wxFLP_OPEN );
bSizer41->Add( m_fpSSHKey, 1, wxEXPAND|wxLEFT|wxRESERVE_SPACE_EVEN_IF_HIDDEN|wxRIGHT, 5 );
m_fpSSHKey->SetMinSize( wxSize( 250,-1 ) );
m_btnTest = new wxButton( m_panelAuth, wxID_ANY, _("Test"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer41->Add( m_btnTest, 0, wxLEFT|wxRIGHT, 5 );
fgSizer21->Add( m_fpSSHKey, 0, wxEXPAND|wxRIGHT, 5 );
fgSshSizer->Add( bSizer41, 1, wxEXPAND, 5 );
m_staticText11 = new wxStaticText( m_panelAuth, wxID_ANY, _("Username"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11 = new wxStaticText( m_panelAuth, wxID_ANY, _("User name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 );
fgSshSizer->Add( m_staticText11, 0, wxALL, 5 );
fgSizer21->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
m_txtUsername = new wxTextCtrl( m_panelAuth, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSshSizer->Add( m_txtUsername, 0, wxALL|wxEXPAND, 5 );
fgSizer21->Add( m_txtUsername, 0, wxEXPAND|wxRIGHT, 5 );
m_labelPass1 = new wxStaticText( m_panelAuth, wxID_ANY, _("SSH Key Password"), wxDefaultPosition, wxDefaultSize, 0 );
m_labelPass1 = new wxStaticText( m_panelAuth, wxID_ANY, _("SSH key password:"), wxDefaultPosition, wxDefaultSize, 0 );
m_labelPass1->Wrap( -1 );
fgSshSizer->Add( m_labelPass1, 0, wxALL, 5 );
fgSizer21->Add( m_labelPass1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
m_txtPassword = new wxTextCtrl( m_panelAuth, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSshSizer->Add( m_txtPassword, 0, wxALL|wxEXPAND, 5 );
fgSizer21->Add( m_txtPassword, 0, wxEXPAND|wxRIGHT, 5 );
m_szAuth->Add( fgSshSizer, 1, wxEXPAND, 5 );
m_szAuth->Add( fgSizer21, 1, wxBOTTOM|wxEXPAND, 5 );
m_panelAuth->SetSizer( m_szAuth );
m_panelAuth->Layout();
m_szAuth->Fit( m_panelAuth );
bSizerMain->Add( m_panelAuth, 1, wxALL|wxEXPAND|wxRESERVE_SPACE_EVEN_IF_HIDDEN, 0 );
bSizerMain->Add( m_panelAuth, 0, wxEXPAND|wxTOP, 5 );
bSizerMain->Add( 0, 0, 1, wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizerHelp = new wxButton( this, wxID_HELP );
m_sdbSizer->AddButton( m_sdbSizerHelp );
m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
bSizerMain->Add( m_sdbSizer, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH );
@@ -153,8 +145,9 @@ DIALOG_GIT_REPOSITORY_BASE::DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWind
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnUpdateUI ) );
m_txtURL->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnLocationExit ), NULL, this );
m_ConnType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnSelectConnType ), NULL, this );
m_cbCustom->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::onCbCustom ), NULL, this );
m_fpSSHKey->Connect( wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnFileUpdated ), NULL, this );
m_btnTest->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnTestClick ), NULL, this );
m_sdbSizerHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnTestClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnOKClick ), NULL, this );
}
@@ -165,8 +158,9 @@ DIALOG_GIT_REPOSITORY_BASE::~DIALOG_GIT_REPOSITORY_BASE()
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnUpdateUI ) );
m_txtURL->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnLocationExit ), NULL, this );
m_ConnType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnSelectConnType ), NULL, this );
m_cbCustom->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::onCbCustom ), NULL, this );
m_fpSSHKey->Disconnect( wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnFileUpdated ), NULL, this );
m_btnTest->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnTestClick ), NULL, this );
m_sdbSizerHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnTestClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnOKClick ), NULL, this );
}
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-254-gc2ef7767)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -21,17 +21,14 @@
#include <wx/textctrl.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/filepicker.h>
#include <wx/button.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/panel.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GIT_REPOSITORY_BASE
///////////////////////////////////////////////////////////////////////////////
@@ -40,6 +37,7 @@ class DIALOG_GIT_REPOSITORY_BASE : public DIALOG_SHIM
private:
protected:
wxBoxSizer* bSizerMain;
wxStaticText* m_staticText1;
wxStaticLine* m_staticline1;
wxStaticText* m_staticText3;
@@ -51,9 +49,8 @@ class DIALOG_GIT_REPOSITORY_BASE : public DIALOG_SHIM
wxPanel* m_panelAuth;
wxStaticText* m_staticText2;
wxStaticLine* m_staticline2;
wxStaticText* m_labelSSH;
wxCheckBox* m_cbCustom;
wxFilePickerCtrl* m_fpSSHKey;
wxButton* m_btnTest;
wxStaticText* m_staticText11;
wxTextCtrl* m_txtUsername;
wxStaticText* m_labelPass1;
@@ -61,12 +58,14 @@ class DIALOG_GIT_REPOSITORY_BASE : public DIALOG_SHIM
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
wxButton* m_sdbSizerHelp;
// Virtual event handlers, override them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnLocationExit( wxFocusEvent& event ) { event.Skip(); }
virtual void OnSelectConnType( wxCommandEvent& event ) { event.Skip(); }
virtual void onCbCustom( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFileUpdated( wxFileDirPickerEvent& event ) { event.Skip(); }
virtual void OnTestClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }
@@ -74,7 +73,7 @@ class DIALOG_GIT_REPOSITORY_BASE : public DIALOG_SHIM
public:
DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Git Repository"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 682,598 ), long style = wxCAPTION|wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Git Repository"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GIT_REPOSITORY_BASE();
+15 -13
View File
@@ -24,9 +24,13 @@
#include "dialog_git_switch.h"
#include <git/kicad_git_memory.h>
#include <trace_helpers.h>
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/listctrl.h>
#include <wx/log.h>
#include <wx/event.h>
#include <wx/sizer.h>
#include <wx/timer.h>
@@ -240,39 +244,42 @@ void DIALOG_GIT_SWITCH::GetBranches()
git_reference* currentBranchReference = nullptr;
git_repository_head( &currentBranchReference, m_repository );
// Get the current branch name
if( currentBranchReference )
if( !currentBranchReference )
{
m_currentBranch = git_reference_shorthand( currentBranchReference );
git_reference_free( currentBranchReference );
wxLogTrace( traceGit, "Failed to get current branch" );
return;
}
KIGIT::GitReferencePtr currentBranch( currentBranchReference );
m_currentBranch = git_reference_shorthand( currentBranchReference );
// Initialize branch iterator
git_branch_iterator_new( &branchIterator, m_repository, GIT_BRANCH_ALL );
KIGIT::GitBranchIteratorPtr branchIteratorPtr( branchIterator );
// Iterate over local branches
git_reference* branchReference = nullptr;
while( git_branch_next( &branchReference, &branchType, branchIterator ) == 0 )
{
KIGIT::GitReferencePtr branchReferencePtr( branchReference );
// Get the branch OID
const git_oid* branchOid = git_reference_target( branchReference );
// Skip this branch if it doesn't have an OID
if( !branchOid )
{
git_reference_free( branchReference );
continue;
}
git_commit* commit = nullptr;
if( git_commit_lookup( &commit, m_repository, branchOid ) )
{
// Skip this branch if it doesn't have a commit
git_reference_free( branchReference );
continue;
}
KIGIT::GitCommitPtr commitPtr( commit );
// Retrieve commit details
BranchData branchData;
branchData.commitString = git_commit_message( commit );
@@ -280,10 +287,5 @@ void DIALOG_GIT_SWITCH::GetBranches()
branchData.isRemote = branchType == GIT_BRANCH_REMOTE;
m_branches[git_reference_shorthand( branchReference )] = branchData;
git_commit_free( commit );
git_reference_free( branchReference );
}
git_branch_iterator_free( branchIterator );
}
+24 -20
View File
@@ -24,10 +24,12 @@
#include <kiplatform/secrets.h>
#include <pgm_base.h>
#include <settings/common_settings.h>
#include <trace_helpers.h>
#include <widgets/std_bitmap_button.h>
#include <widgets/wx_grid.h>
#include <git2.h>
#include <git/kicad_git_memory.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/checkbox.h>
@@ -67,32 +69,38 @@ static std::pair<wxString, wxString> getDefaultAuthorAndEmail()
if( git_config_open_default( &config ) != 0 )
{
printf( "Failed to open default Git config: %s\n", giterr_last()->message );
wxLogTrace( traceGit, "Failed to open default Git config: %s", KIGIT_COMMON::GetLastGitError() );
return std::make_pair( name, email );
}
KIGIT::GitConfigPtr configPtr( config );
if( git_config_get_entry( &name_c, config, "user.name" ) != 0 )
{
printf( "Failed to get user.name from Git config: %s\n", giterr_last()->message );
wxLogTrace( traceGit, "Failed to get user.name from Git config: %s", KIGIT_COMMON::GetLastGitError() );
return std::make_pair( name, email );
}
KIGIT::GitConfigEntryPtr namePtr( name_c );
if( git_config_get_entry( &email_c, config, "user.email" ) != 0 )
{
printf( "Failed to get user.email from Git config: %s\n", giterr_last()->message );
wxLogTrace( traceGit, "Failed to get user.email from Git config: %s", KIGIT_COMMON::GetLastGitError() );
return std::make_pair( name, email );
}
KIGIT::GitConfigEntryPtr emailPtr( email_c );
if( name_c )
name = name_c->value;
if( email_c )
email = email_c->value;
git_config_entry_free( name_c );
git_config_entry_free( email_c );
git_config_free( config );
return std::make_pair( name, email );
}
bool PANEL_GIT_REPOS::TransferDataFromWindow()
{
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
@@ -184,36 +192,32 @@ static bool testRepositoryConnection( COMMON_SETTINGS::GIT_REPOSITORY& repositor
// Initialize the Git repository
git_repository* repo = nullptr;
int result = git_repository_init( &repo, tempDirPath.mb_str( wxConvUTF8 ), 0 );
const char* path = tempDirPath.mb_str( wxConvUTF8 );
if (result != 0)
if( git_repository_init( &repo, path, 0 ) != 0 )
{
git_repository_free(repo);
git_libgit2_shutdown();
wxRmdir(tempDirPath);
return false;
}
git_remote* remote = nullptr;
result = git_remote_create_anonymous( &remote, repo, tempDirPath.mb_str( wxConvUTF8 ) );
KIGIT::GitRepositoryPtr repoPtr( repo );
git_remote* remote = nullptr;
if (result != 0)
if( git_remote_create_anonymous( &remote, repo, path ) != 0 )
{
git_remote_free(remote);
git_repository_free(repo);
git_libgit2_shutdown();
wxRmdir(tempDirPath);
return false;
}
KIGIT::GitRemotePtr remotePtr( remote );
// We don't really care about the result of this call, the authentication callback
// will set the return values we need
git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks, nullptr, nullptr);
git_remote_disconnect(remote);
git_remote_free(remote);
git_repository_free(repo);
git_remote_connect( remote, GIT_DIRECTION_FETCH, &callbacks, nullptr, nullptr );
git_remote_disconnect( remote );
git_libgit2_shutdown();
// Clean up the temporary directory
+9 -4
View File
@@ -36,6 +36,7 @@
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/menu.h>
#include <wx/wfstream.h>
/* ---------- GRID_TRICKS for embedded files grid ---------- */
@@ -317,7 +318,7 @@ void PANEL_EMBEDDED_FILES::onAddEmbeddedFiles( wxCommandEvent& event )
{
// TODO: Update strings to reflect that multiple files can be selected.
wxFileDialog fileDialog( this, _( "Select a file to embed" ), wxEmptyString, wxEmptyString,
_( "All files|*.*" ),
_( "All Files" ) + wxT( " (*.*)|*.*" ),
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE );
if( fileDialog.ShowModal() == wxID_OK )
@@ -445,9 +446,10 @@ void PANEL_EMBEDDED_FILES::onExportFiles( wxCommandEvent& event )
if( skip_file )
continue;
wxFFile ffile( fileName.GetFullPath(), wxT( "w" ) );
if( !ffile.IsOpened() )
wxFFileOutputStream out( fileName.GetFullPath() );
if( !out.IsOk() )
{
wxString msg = wxString::Format( _( "Failed to open file '%s'." ),
fileName.GetFullName() );
@@ -457,12 +459,15 @@ void PANEL_EMBEDDED_FILES::onExportFiles( wxCommandEvent& event )
continue;
}
if( !ffile.Write( file->decompressedData.data(), file->decompressedData.size() ) )
out.Write( file->decompressedData.data(), file->decompressedData.size() );
if( !out.IsOk() || ( out.LastWrite() != file->decompressedData.size() ) )
{
wxString msg = wxString::Format( _( "Failed to write file '%s'." ),
fileName.GetFullName() );
KIDIALOG errorDlg( m_parent, msg, _( "Error" ), wxOK | wxICON_ERROR );
errorDlg.ShowModal();
}
}
+1 -1
View File
@@ -35,7 +35,7 @@ PANEL_EMBEDDED_FILES_BASE::PANEL_EMBEDDED_FILES_BASE( wxWindow* parent, wxWindow
m_files_grid->EnableDragColMove( false );
m_files_grid->EnableDragColSize( true );
m_files_grid->SetColLabelValue( 0, _("Filename") );
m_files_grid->SetColLabelValue( 1, _("Internal Reference") );
m_files_grid->SetColLabelValue( 1, _("Embedded Reference") );
m_files_grid->SetColLabelSize( 22 );
m_files_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
+1 -1
View File
@@ -98,7 +98,7 @@
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">22</property>
<property name="col_label_values">&quot;Filename&quot; &quot;Internal Reference&quot;</property>
<property name="col_label_values">&quot;Filename&quot; &quot;Embedded Reference&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">2</property>
<property name="column_sizes">440,180</property>
+11 -2
View File
@@ -24,6 +24,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "kicad_manager_frame.h"
#include <eda_base_frame.h>
#include <advanced_config.h>
@@ -173,7 +174,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxS
wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName ),
TOOLS_HOLDER(),
KIWAY_HOLDER( aKiway, KIWAY_HOLDER::FRAME ),
UNITS_PROVIDER( aIuScale, EDA_UNITS::MILLIMETRES )
UNITS_PROVIDER( aIuScale, EDA_UNITS::MM )
{
commonInit( aFrameType );
}
@@ -1088,7 +1089,15 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
KIFACE* kiface = nullptr;
std::vector<int> expand;
Kiway().GetActions( hotkeysPanel->ActionsList() );
wxWindow* kicadMgr_window = wxWindow::FindWindowByName( KICAD_MANAGER_FRAME_NAME );
if( KICAD_MANAGER_FRAME* kicadMgr = static_cast<KICAD_MANAGER_FRAME*>( kicadMgr_window ) )
{
ACTION_MANAGER* actionMgr = kicadMgr->GetToolManager()->GetActionManager();
for( const auto& [name, action] : actionMgr->GetActions() )
hotkeysPanel->ActionsList().push_back( action );
}
book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
+16 -15
View File
@@ -96,9 +96,10 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString& aFrameName,
const EDA_IU_SCALE& aIuScale ) :
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName, aIuScale ),
m_socketServer( nullptr ),
m_lastToolbarIconSize( 0 )
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName,
aIuScale ),
m_socketServer( nullptr ),
m_lastToolbarIconSize( 0 )
{
m_mainToolBar = nullptr;
m_drawToolBar = nullptr;
@@ -125,7 +126,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_propertiesPanel = nullptr;
m_netInspectorPanel = nullptr;
SetUserUnits( EDA_UNITS::MILLIMETRES );
SetUserUnits( EDA_UNITS::MM );
m_auimgr.SetFlags( wxAUI_MGR_DEFAULT );
@@ -176,7 +177,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
{
saveCanvasTypeSetting( m_canvasType );
if( !m_openGLFailureOccured )
saveCanvasTypeSetting( m_canvasType );
delete m_actions;
delete m_toolManager;
@@ -283,8 +285,7 @@ void EDA_DRAW_FRAME::ToggleUserUnits()
}
else
{
SetUserUnits( GetUserUnits() == EDA_UNITS::INCHES ? EDA_UNITS::MILLIMETRES
: EDA_UNITS::INCHES );
SetUserUnits( GetUserUnits() == EDA_UNITS::INCH ? EDA_UNITS::MM : EDA_UNITS::INCH );
unitsChangeRefresh();
wxCommandEvent e( EDA_EVT_UNITS_CHANGED );
@@ -648,10 +649,10 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
switch( GetUserUnits() )
{
case EDA_UNITS::INCHES: msg = _( "inches" ); break;
case EDA_UNITS::MILS: msg = _( "mils" ); break;
case EDA_UNITS::MILLIMETRES: msg = _( "mm" ); break;
default: msg = _( "Units" ); break;
case EDA_UNITS::INCH: msg = _( "inches" ); break;
case EDA_UNITS::MILS: msg = _( "mils" ); break;
case EDA_UNITS::MM: msg = _( "mm" ); break;
default: msg = _( "Units" ); break;
}
SetStatusText( msg, 5 );
@@ -1276,9 +1277,9 @@ void EDA_DRAW_FRAME::setupUnits( APP_SETTINGS_BASE* aCfg )
switch( static_cast<EDA_UNITS>( aCfg->m_System.units ) )
{
default:
case EDA_UNITS::MILLIMETRES: m_toolManager->RunAction( ACTIONS::millimetersUnits ); break;
case EDA_UNITS::INCHES: m_toolManager->RunAction( ACTIONS::inchesUnits ); break;
case EDA_UNITS::MILS: m_toolManager->RunAction( ACTIONS::milsUnits ); break;
case EDA_UNITS::MM: m_toolManager->RunAction( ACTIONS::millimetersUnits ); break;
case EDA_UNITS::INCH: m_toolManager->RunAction( ACTIONS::inchesUnits ); break;
case EDA_UNITS::MILS: m_toolManager->RunAction( ACTIONS::milsUnits ); break;
}
}
@@ -1295,7 +1296,7 @@ void EDA_DRAW_FRAME::GetUnitPair( EDA_UNITS& aPrimaryUnit, EDA_UNITS& aSecondary
if( cmnTool )
aSecondaryUnits = cmnTool->GetLastMetricUnits();
else
aSecondaryUnits = EDA_UNITS::MILLIMETRES;
aSecondaryUnits = EDA_UNITS::MM;
}
else
{
+9 -16
View File
@@ -48,7 +48,7 @@
#include <font/outline_font.h>
#include <geometry/shape_poly_set.h>
#include <properties/property_validators.h>
#include <ctl_flags.h> // for CTL_OMIT_HIDE definition
#include <ctl_flags.h>
#include <api/api_enums.h>
#include <api/api_utils.h>
#include <api/common/types/base_types.pb.h>
@@ -93,9 +93,10 @@ GR_TEXT_V_ALIGN_T EDA_TEXT::MapVertJustify( int aVertJustify )
EDA_TEXT::EDA_TEXT( const EDA_IU_SCALE& aIuScale, const wxString& aText ) :
m_text( aText ),
m_IuScale( aIuScale ),
m_render_cache_font( nullptr )
m_text( aText ),
m_render_cache_font( nullptr ),
m_visible( true )
{
SetTextSize( VECTOR2I( EDA_UNIT_UTILS::Mils2IU( m_IuScale, DEFAULT_SIZE_TEXT ),
EDA_UNIT_UTILS::Mils2IU( m_IuScale, DEFAULT_SIZE_TEXT ) ) );
@@ -122,6 +123,7 @@ EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
m_attributes = aText.m_attributes;
m_pos = aText.m_pos;
m_visible = aText.m_visible;
m_render_cache_font = aText.m_render_cache_font;
m_render_cache_text = aText.m_render_cache_text;
@@ -157,6 +159,7 @@ EDA_TEXT& EDA_TEXT::operator=( const EDA_TEXT& aText )
m_attributes = aText.m_attributes;
m_pos = aText.m_pos;
m_visible = aText.m_visible;
m_render_cache_font = aText.m_render_cache_font;
m_render_cache_text = aText.m_render_cache_text;
@@ -207,7 +210,7 @@ void EDA_TEXT::Serialize( google::protobuf::Any &aContainer ) const
attrs->set_italic( IsItalic() );
attrs->set_bold( IsBold() );
attrs->set_underlined( GetAttributes().m_Underlined );
attrs->set_visible( IsVisible() );
attrs->set_visible( true );
attrs->set_mirrored( IsMirrored() );
attrs->set_multiline( IsMultilineAllowed() );
attrs->set_keep_upright( IsKeepUpright() );
@@ -236,7 +239,6 @@ bool EDA_TEXT::Deserialize( const google::protobuf::Any &aContainer )
attrs.m_Bold = text.attributes().bold();
attrs.m_Italic = text.attributes().italic();
attrs.m_Underlined = text.attributes().underlined();
attrs.m_Visible = text.attributes().visible();
attrs.m_Mirrored = text.attributes().mirrored();
attrs.m_Multiline = text.attributes().multiline();
attrs.m_KeepUpright = text.attributes().keep_upright();
@@ -376,7 +378,7 @@ void EDA_TEXT::SetBoldFlag( bool aBold )
void EDA_TEXT::SetVisible( bool aVisible )
{
m_attributes.m_Visible = aVisible;
m_visible = aVisible;
ClearRenderCache();
}
@@ -1036,8 +1038,7 @@ void EDA_TEXT::SetFontIndex( int aIdx )
bool EDA_TEXT::IsDefaultFormatting() const
{
return ( IsVisible()
&& !IsMirrored()
return ( !IsMirrored()
&& GetHorizJustify() == GR_TEXT_H_ALIGN_CENTER
&& GetVertJustify() == GR_TEXT_V_ALIGN_CENTER
&& GetTextThickness() == 0
@@ -1109,13 +1110,8 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aControlBits ) const
aFormatter->Print( ")" ); // (justify
}
if( !( aControlBits & CTL_OMIT_HIDE ) && !IsVisible() )
KICAD_FORMAT::FormatBool( aFormatter, "hide", true );
if( !( aControlBits & CTL_OMIT_HYPERLINK ) && HasHyperlink() )
{
aFormatter->Print( "(href %s)", aFormatter->Quotew( GetHyperlink() ).c_str() );
}
aFormatter->Print( ")" ); // (effects
}
@@ -1375,9 +1371,6 @@ static struct EDA_TEXT_DESC
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Mirrored" ),
&EDA_TEXT::SetMirrored, &EDA_TEXT::IsMirrored ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Visible" ),
&EDA_TEXT::SetVisible, &EDA_TEXT::IsVisible ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Width" ),
&EDA_TEXT::SetTextWidth, &EDA_TEXT::GetTextWidth,
PROPERTY_DISPLAY::PT_SIZE ),
+49 -105
View File
@@ -48,7 +48,7 @@ bool EDA_UNIT_UTILS::IsImperialUnit( EDA_UNITS aUnit )
{
switch( aUnit )
{
case EDA_UNITS::INCHES:
case EDA_UNITS::INCH:
case EDA_UNITS::MILS:
return true;
@@ -62,9 +62,9 @@ bool EDA_UNIT_UTILS::IsMetricUnit( EDA_UNITS aUnit )
{
switch( aUnit )
{
case EDA_UNITS::MICROMETRES:
case EDA_UNITS::MILLIMETRES:
case EDA_UNITS::CENTIMETRES:
case EDA_UNITS::UM:
case EDA_UNITS::MM:
case EDA_UNITS::CM:
return true;
default:
@@ -106,15 +106,15 @@ bool EDA_UNIT_UTILS::FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS
//check for um, μm (µ is MICRO SIGN) and µm (µ is GREEK SMALL LETTER MU) for micrometre
if( unit == wxT( "um" ) || unit == wxT( "\u00B5m" ) || unit == wxT( "\u03BCm" ) )
aUnits = EDA_UNITS::MICROMETRES;
aUnits = EDA_UNITS::UM;
else if( unit == wxT( "mm" ) )
aUnits = EDA_UNITS::MILLIMETRES;
aUnits = EDA_UNITS::MM;
if( unit == wxT( "cm" ) )
aUnits = EDA_UNITS::CENTIMETRES;
aUnits = EDA_UNITS::CM;
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou"
aUnits = EDA_UNITS::MILS;
else if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
aUnits = EDA_UNITS::INCHES;
aUnits = EDA_UNITS::INCH;
else if( unit == wxT( "de" ) || unit == wxT( "ra" ) ) // "deg" or "rad"
aUnits = EDA_UNITS::DEGREES;
else
@@ -130,15 +130,15 @@ wxString EDA_UNIT_UTILS::GetText( EDA_UNITS aUnits, EDA_DATA_TYPE aType )
switch( aUnits )
{
case EDA_UNITS::MICROMETRES: label = wxT( " \u00B5m" ); break; //00B5 for µ
case EDA_UNITS::MILLIMETRES: label = wxT( " mm" ); break;
case EDA_UNITS::CENTIMETRES: label = wxT( " cm" ); break;
case EDA_UNITS::DEGREES: label = wxT( "°" ); break;
case EDA_UNITS::MILS: label = wxT( " mils" ); break;
case EDA_UNITS::INCHES: label = wxT( " in" ); break;
case EDA_UNITS::PERCENT: label = wxT( "%" ); break;
case EDA_UNITS::UNSCALED: break;
default: UNIMPLEMENTED_FOR( wxS( "Unknown units" ) ); break;
case EDA_UNITS::UM: label = wxT( " \u00B5m" ); break; //00B5 for µ
case EDA_UNITS::MM: label = wxT( " mm" ); break;
case EDA_UNITS::CM: label = wxT( " cm" ); break;
case EDA_UNITS::DEGREES: label = wxT( "°" ); break;
case EDA_UNITS::MILS: label = wxT( " mils" ); break;
case EDA_UNITS::INCH: label = wxT( " in" ); break;
case EDA_UNITS::PERCENT: label = wxT( "%" ); break;
case EDA_UNITS::UNSCALED: break;
default: UNIMPLEMENTED_FOR( wxS( "Unknown units" ) ); break;
}
switch( aType )
@@ -263,26 +263,13 @@ double EDA_UNIT_UTILS::UI::ToUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS a
{
switch( aUnit )
{
case EDA_UNITS::MICROMETRES:
return IU_TO_MM( aValue, aIuScale ) * 1000;
case EDA_UNITS::MILLIMETRES:
return IU_TO_MM( aValue, aIuScale );
case EDA_UNITS::CENTIMETRES:
return IU_TO_MM( aValue, aIuScale ) / 10;
case EDA_UNITS::MILS:
return IU_TO_MILS( aValue, aIuScale );
case EDA_UNITS::INCHES:
return IU_TO_IN( aValue, aIuScale );
case EDA_UNITS::DEGREES:
return aValue;
default:
return aValue;
case EDA_UNITS::UM: return IU_TO_MM( aValue, aIuScale ) * 1000;
case EDA_UNITS::MM: return IU_TO_MM( aValue, aIuScale );
case EDA_UNITS::CM: return IU_TO_MM( aValue, aIuScale ) / 10;
case EDA_UNITS::MILS: return IU_TO_MILS( aValue, aIuScale );
case EDA_UNITS::INCH: return IU_TO_IN( aValue, aIuScale );
case EDA_UNITS::DEGREES: return aValue;
default: return aValue;
}
}
@@ -317,21 +304,10 @@ wxString EDA_UNIT_UTILS::UI::StringFromValue( const EDA_IU_SCALE& aIuScale, EDA_
switch( aUnits )
{
case EDA_UNITS::MILS:
format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" );
break;
case EDA_UNITS::INCHES:
format = is_eeschema ? wxT( "%.6f" ) : wxT( "%.8f" );
break;
case EDA_UNITS::DEGREES:
format = wxT( "%.4f" );
break;
default:
format = wxT( "%.10f" );
break;
case EDA_UNITS::MILS: format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" ); break;
case EDA_UNITS::INCH: format = is_eeschema ? wxT( "%.6f" ) : wxT( "%.8f" ); break;
case EDA_UNITS::DEGREES: format = wxT( "%.4f" ); break;
default: format = wxT( "%.10f" ); break;
}
wxString text;
@@ -414,34 +390,13 @@ wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( const EDA_IU_SCALE& aIuScale,
switch( aUnits )
{
default:
case EDA_UNITS::MICROMETRES:
format = is_eeschema ? wxT( "%.0f" ) : wxT( "%.1f" );
break;
case EDA_UNITS::MILLIMETRES:
format = is_eeschema ? wxT( "%.2f" ) : wxT( "%.4f" );
break;
case EDA_UNITS::CENTIMETRES:
format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" );
break;
case EDA_UNITS::MILS:
format = is_eeschema ? wxT( "%.0f" ) : wxT( "%.2f" );
break;
case EDA_UNITS::INCHES:
format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.4f" );
break;
case EDA_UNITS::DEGREES:
// 3 digits in mantissa should be good for rotation in degree
format = wxT( "%.3f" );
break;
case EDA_UNITS::UNSCALED:
format = wxT( "%.0f" );
break;
case EDA_UNITS::UM: format = is_eeschema ? wxT( "%.0f" ) : wxT( "%.1f" ); break;
case EDA_UNITS::MM: format = is_eeschema ? wxT( "%.2f" ) : wxT( "%.4f" ); break;
case EDA_UNITS::CM: format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.5f" ); break;
case EDA_UNITS::MILS: format = is_eeschema ? wxT( "%.0f" ) : wxT( "%.2f" ); break;
case EDA_UNITS::INCH: format = is_eeschema ? wxT( "%.3f" ) : wxT( "%.4f" ); break;
case EDA_UNITS::DEGREES: format = wxT( "%.3f" ); break;
case EDA_UNITS::UNSCALED: format = wxT( "%.0f" ); break;
}
text.Printf( format, value );
@@ -489,26 +444,15 @@ double EDA_UNIT_UTILS::UI::FromUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS
{
switch( aUnits )
{
case EDA_UNITS::MICROMETRES:
return MM_TO_IU( aValue / 1000.0, aIuScale );
case EDA_UNITS::MILLIMETRES:
return MM_TO_IU( aValue, aIuScale );
case EDA_UNITS::CENTIMETRES:
return MM_TO_IU( aValue * 10, aIuScale );
case EDA_UNITS::MILS:
return MILS_TO_IU( aValue, aIuScale );
case EDA_UNITS::INCHES:
return IN_TO_IU( aValue, aIuScale );
case EDA_UNITS::UM: return MM_TO_IU( aValue / 1000.0, aIuScale );
case EDA_UNITS::MM: return MM_TO_IU( aValue, aIuScale );
case EDA_UNITS::CM: return MM_TO_IU( aValue * 10, aIuScale );
case EDA_UNITS::MILS: return MILS_TO_IU( aValue, aIuScale );
case EDA_UNITS::INCH: return IN_TO_IU( aValue, aIuScale );
default:
case EDA_UNITS::DEGREES:
case EDA_UNITS::UNSCALED:
case EDA_UNITS::PERCENT:
return aValue;
case EDA_UNITS::PERCENT: return aValue;
}
}
@@ -584,24 +528,24 @@ double EDA_UNIT_UTILS::UI::DoubleValueFromString( const EDA_IU_SCALE& aIuScale,
// Check the optional unit designator (2 ch significant)
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
if( aUnits == EDA_UNITS::MICROMETRES
|| aUnits == EDA_UNITS::MILLIMETRES
|| aUnits == EDA_UNITS::CENTIMETRES
if( aUnits == EDA_UNITS::UM
|| aUnits == EDA_UNITS::MM
|| aUnits == EDA_UNITS::CM
|| aUnits == EDA_UNITS::MILS
|| aUnits == EDA_UNITS::INCHES )
|| aUnits == EDA_UNITS::INCH )
{
//check for um, μm (µ is MICRO SIGN) and µm (µ is GREEK SMALL LETTER MU) for micrometre
if( unit == wxT( "um" ) || unit == wxT( "\u00B5m" ) || unit == wxT( "\u03BCm" ) )
{
aUnits = EDA_UNITS::MICROMETRES;
aUnits = EDA_UNITS::UM;
}
else if( unit == wxT( "mm" ) )
{
aUnits = EDA_UNITS::MILLIMETRES;
aUnits = EDA_UNITS::MM;
}
else if( unit == wxT( "cm" ) )
{
aUnits = EDA_UNITS::CENTIMETRES;
aUnits = EDA_UNITS::CM;
}
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) )
{
@@ -609,7 +553,7 @@ double EDA_UNIT_UTILS::UI::DoubleValueFromString( const EDA_IU_SCALE& aIuScale,
}
else if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
{
aUnits = EDA_UNITS::INCHES;
aUnits = EDA_UNITS::INCH;
}
else if( unit == wxT( "oz" ) ) // 1 oz = 1.37 mils
{
+22 -1
View File
@@ -162,6 +162,13 @@ void EMBEDDED_FILES::WriteEmbeddedFiles( OUTPUTFORMATTER& aOut, bool aWriteData
{
const EMBEDDED_FILE& file = *entry;
// Skip empty files
if( file.compressedEncodedData.empty() )
{
wxLogDebug( wxT( "Error: Embedded file '%s' is empty" ), file.name );
continue;
}
aOut.Print( "(file " );
aOut.Print( "(name %s)", aOut.Quotew( file.name ).c_str() );
@@ -376,7 +383,21 @@ void EMBEDDED_FILES_PARSER::ParseEmbedded( EMBEDDED_FILES* aFiles )
break;
case T_data:
NeedBAR();
try
{
NeedBAR();
}
catch( const PARSE_ERROR& e )
{
// No data in the file -- due to bug in writer for 9.0.0
NeedRIGHT();
break;
}
catch( ... )
{
throw;
}
token = NextTok();
file->compressedEncodedData.reserve( 1 << 17 );
+1 -1
View File
@@ -78,7 +78,7 @@ bool FILENAME_RESOLVER::Set3DConfigDir( const wxString& aConfigDir )
}
bool FILENAME_RESOLVER::SetProject( PROJECT* aProject, bool* flgChanged )
bool FILENAME_RESOLVER::SetProject( const PROJECT* aProject, bool* flgChanged )
{
m_project = aProject;
+6 -8
View File
@@ -68,18 +68,16 @@ public:
std::unique_ptr<MARKUP::NODE> root;
};
typedef std::pair<wxString, ENTRY> CACHE_ENTRY;
MARKUP_CACHE( size_t aMaxSize ) :
m_maxSize( aMaxSize )
{
}
ENTRY& Put( const CACHE_ENTRY::first_type& aQuery, ENTRY&& aResult )
ENTRY& Put( const wxString& aQuery, ENTRY&& aResult )
{
auto it = m_cache.find( aQuery );
m_cacheMru.emplace_front( CACHE_ENTRY( aQuery, std::move( aResult ) ) );
m_cacheMru.emplace_front( std::make_pair( aQuery, std::move( aResult ) ) );
if( it != m_cache.end() )
{
@@ -100,7 +98,7 @@ public:
return m_cacheMru.begin()->second;
}
ENTRY* Get( const CACHE_ENTRY::first_type& aQuery )
ENTRY* Get( const wxString& aQuery )
{
auto it = m_cache.find( aQuery );
@@ -119,9 +117,9 @@ public:
}
private:
size_t m_maxSize;
std::list<CACHE_ENTRY> m_cacheMru;
std::unordered_map<wxString, std::list<CACHE_ENTRY>::iterator> m_cache;
size_t m_maxSize;
std::list<std::pair<wxString, ENTRY>> m_cacheMru;
std::unordered_map<wxString, std::list<std::pair<wxString, ENTRY>>::iterator> m_cache;
};
-5
View File
@@ -32,7 +32,6 @@ TEXT_ATTRIBUTES::TEXT_ATTRIBUTES( KIFONT::FONT* aFont ) :
m_Bold( false ),
m_Underlined( false ),
m_Color( KIGFX::COLOR4D::UNSPECIFIED ),
m_Visible( true ),
m_Mirrored( false ),
m_Multiline( true ),
m_KeepUpright( false ),
@@ -93,9 +92,6 @@ int TEXT_ATTRIBUTES::Compare( const TEXT_ATTRIBUTES& aRhs ) const
if( retv )
return retv;
if( m_Visible != aRhs.m_Visible )
return m_Visible - aRhs.m_Visible;
if( m_Mirrored != aRhs.m_Mirrored )
return m_Mirrored - aRhs.m_Mirrored;
@@ -125,7 +121,6 @@ std::ostream& operator<<( std::ostream& aStream, const TEXT_ATTRIBUTES& aAttribu
<< "Bold: " << aAttributes.m_Bold << std::endl
<< "Underline: " << aAttributes.m_Underlined << std::endl
<< "Color: " << aAttributes.m_Color << std::endl
<< "Visible " << aAttributes.m_Visible << std::endl
<< "Mirrored " << aAttributes.m_Mirrored << std::endl
<< "Multilined: " << aAttributes.m_Multiline << std::endl
<< "Size: " << aAttributes.m_Size << std::endl
+5 -6
View File
@@ -22,6 +22,7 @@
*/
#include "git_add_to_index_handler.h"
#include <git/kicad_git_memory.h>
#include <iterator>
@@ -53,15 +54,14 @@ bool GIT_ADD_TO_INDEX_HANDLER::AddToIndex( const wxString& aFilePath )
return false;
}
KIGIT::GitIndexPtr indexPtr( index );
if( git_index_find( &at_pos, index, aFilePath.ToUTF8().data() ) == GIT_OK )
{
git_index_free( index );
wxLogError( "%s already in index", aFilePath );
return false;
}
git_index_free( index );
// Add file to index if not already there
m_filesToAdd.push_back( aFilePath );
@@ -82,6 +82,8 @@ bool GIT_ADD_TO_INDEX_HANDLER::PerformAddToIndex()
return false;
}
KIGIT::GitIndexPtr indexPtr( index );
for( auto& file : m_filesToAdd )
{
if( git_index_add_bypath( index, file.ToUTF8().data() ) != 0 )
@@ -99,11 +101,8 @@ bool GIT_ADD_TO_INDEX_HANDLER::PerformAddToIndex()
m_filesFailedToAdd.clear();
std::copy( m_filesToAdd.begin(), m_filesToAdd.end(),
std::back_inserter( m_filesFailedToAdd ) );
git_index_free( index );
return false;
}
git_index_free( index );
return true;
}
+18 -7
View File
@@ -24,23 +24,31 @@
#include "git_clone_handler.h"
#include <git/kicad_git_common.h>
#include <git/kicad_git_memory.h>
#include <trace_helpers.h>
#include <git2.h>
#include <wx/filename.h>
#include <wx/log.h>
GIT_CLONE_HANDLER::GIT_CLONE_HANDLER() : KIGIT_COMMON( nullptr )
GIT_CLONE_HANDLER::GIT_CLONE_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon )
{}
GIT_CLONE_HANDLER::~GIT_CLONE_HANDLER()
{
if( m_repo )
git_repository_free( m_repo );
}
{}
bool GIT_CLONE_HANDLER::PerformClone()
{
std::unique_lock<std::mutex> lock( GetCommon()->m_gitActionMutex, std::try_to_lock );
if( !lock.owns_lock() )
{
wxLogTrace( traceGit, "GIT_CLONE_HANDLER::PerformClone() could not lock" );
return false;
}
wxFileName clonePath( m_clonePath );
if( !clonePath.DirExists() )
@@ -62,16 +70,19 @@ bool GIT_CLONE_HANDLER::PerformClone()
cloneOptions.fetch_opts.callbacks.credentials = credentials_cb;
cloneOptions.fetch_opts.callbacks.payload = this;
m_testedTypes = 0;
TestedTypes() = 0;
ResetNextKey();
git_repository* newRepo = nullptr;
if( git_clone( &m_repo, m_URL.ToStdString().c_str(), m_clonePath.ToStdString().c_str(),
if( git_clone( &newRepo, m_URL.ToStdString().c_str(), m_clonePath.ToStdString().c_str(),
&cloneOptions ) != 0 )
{
AddErrorString( wxString::Format( _( "Could not clone repository '%s'" ), m_URL ) );
return false;
}
GetCommon()->SetRepo( newRepo );
if( m_progressReporter )
m_progressReporter->Hide();
+5 -4
View File
@@ -24,13 +24,14 @@
#ifndef GIT_CLONE_HANDLER_H_
#define GIT_CLONE_HANDLER_H_
#include <git/kicad_git_common.h>
#include <git/git_progress.h>
#include "kicad_git_common.h"
#include "git_repo_mixin.h"
#include "git_progress.h"
class GIT_CLONE_HANDLER : public KIGIT_COMMON, public GIT_PROGRESS
class GIT_CLONE_HANDLER : public KIGIT_REPO_MIXIN
{
public:
GIT_CLONE_HANDLER();
GIT_CLONE_HANDLER( KIGIT_COMMON* aCommon );
~GIT_CLONE_HANDLER();
bool PerformClone();
+2
View File
@@ -62,6 +62,8 @@ public:
}
}
virtual void UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage ) {};
protected:
int m_previousProgress;
+121 -109
View File
@@ -23,31 +23,49 @@
#include "git_pull_handler.h"
#include <git/kicad_git_common.h>
#include <git/kicad_git_memory.h>
#include <trace_helpers.h>
#include <wx/log.h>
#include <iostream>
#include <time.h>
#include <memory>
GIT_PULL_HANDLER::GIT_PULL_HANDLER( KIGIT_COMMON* aRepo ) : KIGIT_COMMON( *aRepo )
{}
GIT_PULL_HANDLER::GIT_PULL_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon )
{
}
GIT_PULL_HANDLER::~GIT_PULL_HANDLER()
{}
bool GIT_PULL_HANDLER::PerformFetch()
{
// Fetch updates from remote repository
}
bool GIT_PULL_HANDLER::PerformFetch( bool aSkipLock )
{
if( !GetRepo() )
return false;
std::unique_lock<std::mutex> lock( GetCommon()->m_gitActionMutex, std::try_to_lock );
if( !aSkipLock && !lock.owns_lock() )
{
wxLogTrace( traceGit, "GIT_PULL_HANDLER::PerformFetch() - Could not lock mutex" );
return false;
}
// Fetch updates from remote repository
git_remote* remote = nullptr;
if( git_remote_lookup( &remote, m_repo, "origin" ) != 0 )
if( git_remote_lookup( &remote, GetRepo(), "origin" ) != 0 )
{
AddErrorString( wxString::Format( _( "Could not lookup remote '%s'" ), "origin" ) );
return false;
}
KIGIT::GitRemotePtr remotePtr( remote );
git_remote_callbacks remoteCallbacks;
git_remote_init_callbacks( &remoteCallbacks, GIT_REMOTE_CALLBACKS_VERSION );
remoteCallbacks.sideband_progress = progress_cb;
@@ -55,14 +73,13 @@ bool GIT_PULL_HANDLER::PerformFetch()
remoteCallbacks.credentials = credentials_cb;
remoteCallbacks.payload = this;
m_testedTypes = 0;
TestedTypes() = 0;
ResetNextKey();
if( git_remote_connect( remote, GIT_DIRECTION_FETCH, &remoteCallbacks, nullptr, nullptr ) )
{
git_remote_free( remote );
AddErrorString( wxString::Format( _( "Could not connect to remote '%s': %s" ), "origin",
git_error_last()->message ) );
KIGIT_COMMON::GetLastGitError() ) );
return false;
}
@@ -72,28 +89,33 @@ bool GIT_PULL_HANDLER::PerformFetch()
if( git_remote_fetch( remote, nullptr, &fetchOptions, nullptr ) )
{
git_remote_free( remote );
AddErrorString( wxString::Format( _( "Could not fetch data from remote '%s': %s" ),
"origin", git_error_last()->message ) );
"origin", KIGIT_COMMON::GetLastGitError() ) );
return false;
}
git_remote_free( remote );
return true;
}
PullResult GIT_PULL_HANDLER::PerformPull()
{
PullResult result = PullResult::Success;
PullResult result = PullResult::Success;
std::unique_lock<std::mutex> lock( GetCommon()->m_gitActionMutex, std::try_to_lock );
if( !PerformFetch() )
if( !lock.owns_lock() )
{
wxLogTrace( traceGit, "GIT_PULL_HANDLER::PerformPull() - Could not lock mutex" );
return PullResult::Error;
}
if( !PerformFetch( true ) )
return PullResult::Error;
git_oid pull_merge_oid = {};
if( git_repository_fetchhead_foreach( m_repo, fetchhead_foreach_cb, &pull_merge_oid ) )
if( git_repository_fetchhead_foreach( GetRepo(), fetchhead_foreach_cb,
&pull_merge_oid ) )
{
AddErrorString( _( "Could not read 'FETCH_HEAD'" ) );
return PullResult::Error;
@@ -101,26 +123,24 @@ PullResult GIT_PULL_HANDLER::PerformPull()
git_annotated_commit* fetchhead_commit;
if( git_annotated_commit_lookup( &fetchhead_commit, m_repo, &pull_merge_oid ) )
if( git_annotated_commit_lookup( &fetchhead_commit, GetRepo(), &pull_merge_oid ) )
{
AddErrorString( _( "Could not lookup commit" ) );
return PullResult::Error;
}
KIGIT::GitAnnotatedCommitPtr fetchheadCommitPtr( fetchhead_commit );
const git_annotated_commit* merge_commits[] = { fetchhead_commit };
git_merge_analysis_t merge_analysis;
git_merge_preference_t merge_preference = GIT_MERGE_PREFERENCE_NONE;
git_merge_analysis_t merge_analysis;
git_merge_preference_t merge_preference = GIT_MERGE_PREFERENCE_NONE;
if( git_merge_analysis( &merge_analysis, &merge_preference, m_repo, merge_commits, 1 ) )
if( git_merge_analysis( &merge_analysis, &merge_preference, GetRepo(), merge_commits,
1 ) )
{
AddErrorString( _( "Could not analyze merge" ) );
git_annotated_commit_free( fetchhead_commit );
return PullResult::Error;
}
if( !( merge_analysis & GIT_MERGE_ANALYSIS_NORMAL ) )
git_annotated_commit_free( fetchhead_commit );
if( merge_analysis & GIT_MERGE_ANALYSIS_UNBORN )
{
AddErrorString( _( "Invalid HEAD. Cannot merge." ) );
@@ -130,23 +150,26 @@ PullResult GIT_PULL_HANDLER::PerformPull()
// Nothing to do if the repository is up to date
if( merge_analysis & GIT_MERGE_ANALYSIS_UP_TO_DATE )
{
git_repository_state_cleanup( m_repo );
wxLogTrace( traceGit, "GIT_PULL_HANDLER::PerformPull() - Repository is up to date" );
git_repository_state_cleanup( GetRepo() );
return PullResult::UpToDate;
}
// Fast-forward is easy, just update the local reference
if( merge_analysis & GIT_MERGE_ANALYSIS_FASTFORWARD )
{
wxLogTrace( traceGit, "GIT_PULL_HANDLER::PerformPull() - Fast-forward merge" );
return handleFastForward();
}
if( merge_analysis & GIT_MERGE_ANALYSIS_NORMAL )
{
wxLogTrace( traceGit, "GIT_PULL_HANDLER::PerformPull() - Normal merge" );
PullResult ret = handleMerge( merge_commits, 1 );
git_annotated_commit_free( fetchhead_commit );
return ret;
}
wxLogTrace( traceGit, "GIT_PULL_HANDLER::PerformPull() - Merge needs resolution" );
//TODO: handle merges when they need to be resolved
return result;
@@ -172,7 +195,7 @@ std::string GIT_PULL_HANDLER::getFirstLineFromCommitMessage( const std::string&
std::string GIT_PULL_HANDLER::getFormattedCommitDate( const git_time& aTime )
{
char dateBuffer[64];
char dateBuffer[64];
time_t time = static_cast<time_t>( aTime.time );
strftime( dateBuffer, sizeof( dateBuffer ), "%Y-%b-%d %H:%M:%S", gmtime( &time ) );
return dateBuffer;
@@ -181,92 +204,80 @@ std::string GIT_PULL_HANDLER::getFormattedCommitDate( const git_time& aTime )
PullResult GIT_PULL_HANDLER::handleFastForward()
{
// Update local references with fetched data
auto git_reference_deleter =
[]( void* p )
{
git_reference_free( static_cast<git_reference*>( p ) );
};
git_reference* rawRef = nullptr;
git_reference* rawRef = nullptr;
if( git_repository_head( &rawRef, GetRepo() ) )
{
AddErrorString( _( "Could not get repository head" ) );
return PullResult::Error;
}
if( git_repository_head( &rawRef, m_repo ) )
KIGIT::GitReferencePtr headRef( rawRef );
const char* updatedRefName = git_reference_name( rawRef );
git_oid updatedRefOid;
if( git_reference_name_to_id( &updatedRefOid, GetRepo(), updatedRefName ) )
{
AddErrorString( wxString::Format( _( "Could not get reference OID for reference '%s'" ),
updatedRefName ) );
return PullResult::Error;
}
git_checkout_options checkoutOptions;
git_checkout_init_options( &checkoutOptions, GIT_CHECKOUT_OPTIONS_VERSION );
checkoutOptions.checkout_strategy = GIT_CHECKOUT_SAFE;
if( git_checkout_head( GetRepo(), &checkoutOptions ) )
{
AddErrorString( _( "Failed to perform checkout operation." ) );
return PullResult::Error;
}
// Collect commit details for updated references
git_revwalk* revWalker = nullptr;
git_revwalk_new( &revWalker, GetRepo() );
KIGIT::GitRevWalkPtr revWalkerPtr( revWalker );
git_revwalk_sorting( revWalker, GIT_SORT_TIME );
git_revwalk_push_glob( revWalker, updatedRefName );
git_oid commitOid;
while( git_revwalk_next( &commitOid, revWalker ) == 0 )
{
git_commit* commit = nullptr;
if( git_commit_lookup( &commit, GetRepo(), &commitOid ) )
{
AddErrorString( _( "Could not get repository head" ) );
AddErrorString( wxString::Format( _( "Could not lookup commit '{}'" ),
git_oid_tostr_s( &commitOid ) ) );
return PullResult::Error;
}
// Defer destruction of the git_reference until this function exits somewhere, since
// updatedRefName etc. just point to memory inside the reference
std::unique_ptr<git_reference, decltype( git_reference_deleter )> updatedRef( rawRef );
KIGIT::GitCommitPtr commitPtr( commit );
const char* updatedRefName = git_reference_name( updatedRef.get() );
CommitDetails details;
details.m_sha = git_oid_tostr_s( &commitOid );
details.m_firstLine = getFirstLineFromCommitMessage( git_commit_message( commit ) );
details.m_author = git_commit_author( commit )->name;
details.m_date = getFormattedCommitDate( git_commit_author( commit )->when );
git_oid updatedRefOid;
std::pair<std::string, std::vector<CommitDetails>>& branchCommits =
m_fetchResults.emplace_back();
branchCommits.first = updatedRefName;
branchCommits.second.push_back( details );
}
if( git_reference_name_to_id( &updatedRefOid, m_repo, updatedRefName ) )
{
AddErrorString( wxString::Format( _( "Could not get reference OID for reference '%s'" ),
updatedRefName ) );
return PullResult::Error;
}
git_checkout_options checkoutOptions;
git_checkout_init_options( &checkoutOptions, GIT_CHECKOUT_OPTIONS_VERSION );
checkoutOptions.checkout_strategy = GIT_CHECKOUT_SAFE;
if( git_checkout_head( m_repo, &checkoutOptions ) )
{
AddErrorString( _( "Failed to perform checkout operation." ) );
return PullResult::Error;
}
// Collect commit details for updated references
git_revwalk* revWalker = nullptr;
git_revwalk_new( &revWalker, m_repo );
git_revwalk_sorting( revWalker, GIT_SORT_TIME );
git_revwalk_push_glob( revWalker, updatedRefName );
git_oid commitOid;
while( git_revwalk_next( &commitOid, revWalker ) == 0 )
{
git_commit* commit = nullptr;
if( git_commit_lookup( &commit, m_repo, &commitOid ) )
{
AddErrorString( wxString::Format( _( "Could not lookup commit '{}'" ),
git_oid_tostr_s( &commitOid ) ) );
git_revwalk_free( revWalker );
return PullResult::Error;
}
CommitDetails details;
details.m_sha = git_oid_tostr_s( &commitOid );
details.m_firstLine = getFirstLineFromCommitMessage( git_commit_message( commit ) );
details.m_author = git_commit_author( commit )->name;
details.m_date = getFormattedCommitDate( git_commit_author( commit )->when );
std::pair<std::string, std::vector<CommitDetails>>& branchCommits =
m_fetchResults.emplace_back();
branchCommits.first = updatedRefName;
branchCommits.second.push_back( details );
//TODO: log these to the parent
git_commit_free( commit );
}
git_revwalk_free( revWalker );
git_repository_state_cleanup( m_repo );
return PullResult::FastForward;
git_repository_state_cleanup( GetRepo() );
return PullResult::FastForward;
}
PullResult GIT_PULL_HANDLER::handleMerge( const git_annotated_commit** aMergeHeads,
size_t aMergeHeadsCount )
{
git_merge_options merge_opts;
git_merge_options merge_opts;
git_merge_options_init( &merge_opts, GIT_MERGE_OPTIONS_VERSION );
git_checkout_options checkout_opts;
@@ -274,7 +285,7 @@ PullResult GIT_PULL_HANDLER::handleMerge( const git_annotated_commit** aMergeHea
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
if( git_merge( m_repo, aMergeHeads, aMergeHeadsCount, &merge_opts, &checkout_opts ) )
if( git_merge( GetRepo(), aMergeHeads, aMergeHeadsCount, &merge_opts, &checkout_opts ) )
{
AddErrorString( _( "Could not merge commits" ) );
return PullResult::Error;
@@ -283,12 +294,14 @@ PullResult GIT_PULL_HANDLER::handleMerge( const git_annotated_commit** aMergeHea
// Get the repository index
git_index* index = nullptr;
if( git_repository_index( &index, m_repo ) )
if( git_repository_index( &index, GetRepo() ) )
{
AddErrorString( _( "Could not get repository index" ) );
return PullResult::Error;
}
KIGIT::GitIndexPtr indexPtr( index );
// Check for conflicts
git_index_conflict_iterator* conflicts = nullptr;
@@ -298,9 +311,11 @@ PullResult GIT_PULL_HANDLER::handleMerge( const git_annotated_commit** aMergeHea
return PullResult::Error;
}
const git_index_entry* ancestor = nullptr;
const git_index_entry* our = nullptr;
const git_index_entry* their = nullptr;
KIGIT::GitIndexConflictIteratorPtr conflictsPtr( conflicts );
const git_index_entry* ancestor = nullptr;
const git_index_entry* our = nullptr;
const git_index_entry* their = nullptr;
std::vector<ConflictData> conflict_data;
while( git_index_conflict_next( &ancestor, &our, &their, conflicts ) == 0 )
@@ -359,14 +374,11 @@ PullResult GIT_PULL_HANDLER::handleMerge( const git_annotated_commit** aMergeHea
git_index_write( index );
}
git_index_conflict_iterator_free( conflicts );
git_index_free( index );
return conflict_data.empty() ? PullResult::Success : PullResult::MergeFailed;
}
void GIT_PULL_HANDLER::UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage )
{
ReportProgress( aCurrent, aTotal, aMessage );
}
+16 -26
View File
@@ -21,17 +21,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef GITPULLHANDLER_HPP
#define GITPULLHANDLER_HPP
#ifndef _GIT_PULL_HANDLER_H_
#define _GIT_PULL_HANDLER_H_
#include <git/git_repo_mixin.h>
#include <git2.h>
#include <functional>
#include <vector>
#include <string>
#include "kicad_git_common.h"
#include <git/git_progress.h>
#include <wx/string.h>
#include <git2.h>
// Structure to store commit details
struct CommitDetails
@@ -65,36 +63,28 @@ struct ConflictData
};
class GIT_PULL_HANDLER : public KIGIT_COMMON, public GIT_PROGRESS
class GIT_PULL_HANDLER : public KIGIT_REPO_MIXIN
{
public:
GIT_PULL_HANDLER( KIGIT_COMMON* aCommon );
~GIT_PULL_HANDLER();
bool PerformFetch( bool aSkipLock = false );
PullResult PerformPull();
bool PerformFetch();
const std::vector<std::pair<std::string, std::vector<CommitDetails>>>& GetFetchResults() const;
// Set the callback function for conflict resolution
void SetConflictCallback(
std::function<int( std::vector<ConflictData>& aConflicts )> aCallback )
{
m_conflictCallback = aCallback;
}
// Implementation for progress updates
void UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage ) override;
private:
std::string getFirstLineFromCommitMessage( const std::string& aMessage );
std::string getFormattedCommitDate( const git_time& aTime );private:
PullResult handleFastForward();
PullResult handleMerge( const git_annotated_commit** aMergeHeads, size_t aMergeHeadsCount);
std::vector<std::pair<std::string, std::vector<CommitDetails>>> m_fetchResults;
std::function<int( std::vector<ConflictData>& aConflicts )> m_conflictCallback;
std::string getFirstLineFromCommitMessage( const std::string& aMessage );
std::string getFormattedCommitDate( const git_time& aTime );
PullResult handleFastForward();
PullResult handleMerge( const git_annotated_commit** aMergeHeads, size_t aMergeHeadsCount );
};
#endif // GITPULLHANDLER_HPP
#endif // _GIT_PULL_HANDLER_H_
+25 -15
View File
@@ -23,32 +23,44 @@
#include "git_push_handler.h"
#include <git/kicad_git_common.h>
#include <git/kicad_git_memory.h>
#include <trace_helpers.h>
#include <iostream>
GIT_PUSH_HANDLER::GIT_PUSH_HANDLER( KIGIT_COMMON* aRepo ) : KIGIT_COMMON( *aRepo )
{}
#include <wx/log.h>
GIT_PUSH_HANDLER::GIT_PUSH_HANDLER( KIGIT_COMMON* aRepo ) : KIGIT_REPO_MIXIN( aRepo )
{}
GIT_PUSH_HANDLER::~GIT_PUSH_HANDLER()
{}
PushResult GIT_PUSH_HANDLER::PerformPush()
{
std::unique_lock<std::mutex> lock( GetCommon()->m_gitActionMutex, std::try_to_lock );
if(!lock.owns_lock())
{
wxLogTrace(traceGit, "GIT_PUSH_HANDLER::PerformPush: Could not lock mutex");
return PushResult::Error;
}
PushResult result = PushResult::Success;
// Fetch updates from remote repository
git_remote* remote = nullptr;
if( git_remote_lookup( &remote, m_repo, "origin" ) != 0 )
if(git_remote_lookup(&remote, GetRepo(), "origin") != 0)
{
AddErrorString( _( "Could not lookup remote" ) );
AddErrorString(_("Could not lookup remote"));
return PushResult::Error;
}
KIGIT::GitRemotePtr remotePtr(remote);
git_remote_callbacks remoteCallbacks;
git_remote_init_callbacks( &remoteCallbacks, GIT_REMOTE_CALLBACKS_VERSION );
git_remote_init_callbacks(&remoteCallbacks, GIT_REMOTE_CALLBACKS_VERSION);
remoteCallbacks.sideband_progress = progress_cb;
remoteCallbacks.transfer_progress = transfer_progress_cb;
remoteCallbacks.update_tips = update_cb;
@@ -56,14 +68,13 @@ PushResult GIT_PUSH_HANDLER::PerformPush()
remoteCallbacks.credentials = credentials_cb;
remoteCallbacks.payload = this;
m_testedTypes = 0;
TestedTypes() = 0;
ResetNextKey();
if( git_remote_connect( remote, GIT_DIRECTION_PUSH, &remoteCallbacks, nullptr, nullptr ) )
{
AddErrorString( wxString::Format( _( "Could not connect to remote: %s" ),
git_error_last()->message ) );
git_remote_free( remote );
KIGIT_COMMON::GetLastGitError() ) );
return PushResult::Error;
}
@@ -74,30 +85,29 @@ PushResult GIT_PUSH_HANDLER::PerformPush()
// Get the current HEAD reference
git_reference* head = nullptr;
if( git_repository_head( &head, m_repo ) != 0 )
if( git_repository_head( &head, GetRepo() ) != 0 )
{
git_remote_disconnect( remote );
AddErrorString( _( "Could not get repository head" ) );
git_remote_free( remote );
return PushResult::Error;
}
KIGIT::GitReferencePtr headPtr( head );
// Create refspec for current branch
const char* refs[1];
refs[0] = git_reference_name( head );
const git_strarray refspecs = { (char**) refs, 1 };
git_reference_free(head);
if( git_remote_push( remote, &refspecs, &pushOptions ) )
{
AddErrorString( wxString::Format( _( "Could not push to remote: %s" ),
git_error_last()->message ) );
KIGIT_COMMON::GetLastGitError() ) );
git_remote_disconnect( remote );
git_remote_free( remote );
return PushResult::Error;
}
git_remote_disconnect( remote );
git_remote_free( remote );
return result;
}
+15 -15
View File
@@ -21,37 +21,37 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef GITPUSHHANDLER_HPP
#define GITPUSHHANDLER_HPP
#ifndef _GIT_PUSH_HANDLER_H_
#define _GIT_PUSH_HANDLER_H_
#include <git2.h>
#include <functional>
#include <vector>
#include <string>
#include "kicad_git_common.h"
#include <git/git_progress.h>
#include <git/git_repo_mixin.h>
#include <git/kicad_git_errors.h>
#include <wx/string.h>
class KIGIT_COMMON;
// Enum for result codes
enum class PushResult
{
Success,
Error,
UpToDate
Error
};
class GIT_PUSH_HANDLER : public KIGIT_COMMON, public GIT_PROGRESS
class GIT_PUSH_HANDLER : public KIGIT_REPO_MIXIN
{
public:
GIT_PUSH_HANDLER( KIGIT_COMMON* aRepo );
GIT_PUSH_HANDLER( KIGIT_COMMON* aCommon );
~GIT_PUSH_HANDLER();
PushResult PerformPush();
void UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage ) override;
// Virtual method for progress reporting
virtual void ReportProgress(int aCurrent, int aTotal, const wxString& aMessage) {}
private:
// Implementation of GIT_PROGRESS's virtual method
void UpdateProgress(int aCurrent, int aTotal, const wxString& aMessage) override;
};
#endif // GITPUSHHANDLER_HPP
#endif // _GIT_PUSH_HANDLER_H_
+5 -5
View File
@@ -24,6 +24,7 @@
#include <wx/string.h>
#include <wx/log.h>
#include <git/kicad_git_memory.h>
#include "git_remove_from_index_handler.h"
GIT_REMOVE_FROM_INDEX_HANDLER::GIT_REMOVE_FROM_INDEX_HANDLER( git_repository* aRepository )
@@ -51,15 +52,14 @@ bool GIT_REMOVE_FROM_INDEX_HANDLER::RemoveFromIndex( const wxString& aFilePath )
return false;
}
KIGIT::GitIndexPtr indexPtr( index );
if( git_index_find( &at_pos, index, aFilePath.ToUTF8().data() ) != 0 )
{
git_index_free( index );
wxLogError( "Failed to find index entry for %s", aFilePath );
return false;
}
git_index_free( index );
m_filesToRemove.push_back( aFilePath );
return true;
}
@@ -78,6 +78,8 @@ void GIT_REMOVE_FROM_INDEX_HANDLER::PerformRemoveFromIndex()
return;
}
KIGIT::GitIndexPtr indexPtr( index );
if( git_index_remove_bypath( index, file.ToUTF8().data() ) != 0 )
{
wxLogError( "Failed to remove index entry for %s", file );
@@ -95,7 +97,5 @@ void GIT_REMOVE_FROM_INDEX_HANDLER::PerformRemoveFromIndex()
wxLogError( "Failed to write index tree" );
return;
}
git_index_free( index );
}
}
+188
View File
@@ -0,0 +1,188 @@
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
#ifndef GIT_REPO_MIXIN_H
#define GIT_REPO_MIXIN_H
#include "kicad_git_common.h"
#include "kicad_git_errors.h"
#include "git_progress.h"
class KIGIT_REPO_MIXIN: public KIGIT_ERRORS, public GIT_PROGRESS
{
public:
KIGIT_REPO_MIXIN( KIGIT_COMMON* aCommon ) : m_common( aCommon )
{
// Ensure m_common is initialized
wxASSERT( aCommon != nullptr );
}
virtual ~KIGIT_REPO_MIXIN()
{
// Non-owning, don't delete
}
/**
* @brief Get the current branch name
* @return The current branch name
*/
wxString GetCurrentBranchName() const
{
return m_common->GetCurrentBranchName();
}
/**
* @brief Get a list of branch names
* @return A vector of branch names
*/
std::vector<wxString> GetBranchNames() const
{
return m_common->GetBranchNames();
}
/**
* @brief Get a list of project directories
* @return A vector of project directories
*/
std::vector<wxString> GetProjectDirs()
{
return m_common->GetProjectDirs();
}
/**
* @brief Get a pointer to the git repository
* @return A pointer to the git repository
*/
git_repository* GetRepo() const
{
return m_common->GetRepo();
}
/**
* @brief Get a pair of sets of files that differ locally from the remote repository
* @return A pair of sets of files that differ locally from the remote repository
*/
std::pair<std::set<wxString>, std::set<wxString>> GetDifferentFiles() const
{
return m_common->GetDifferentFiles();
}
/**
* @brief Get the common object
* @return The common object
*/
KIGIT_COMMON* GetCommon() const
{
return m_common;
}
/**
* @brief Reset the next public key to test
*/
void ResetNextKey() { m_common->ResetNextKey(); }
/**
* @brief Get the next public key
* @return The next public key
*/
wxString GetNextPublicKey()
{
return m_common->GetNextPublicKey();
}
/**
* @brief Get the connection type
* @return The connection type
*/
KIGIT_COMMON::GIT_CONN_TYPE GetConnType() const
{
return m_common->GetConnType();
}
/**
* @brief Get the username
* @return The username
*/
wxString GetUsername() const
{
return m_common->GetUsername();
}
/**
* @brief Get the password
* @return The password
*/
wxString GetPassword() const
{
return m_common->GetPassword();
}
/**
* @brief Set the username
* @param aUsername The username
*/
void SetUsername( const wxString& aUsername )
{
m_common->SetUsername( aUsername );
}
/**
* @brief Set the password
* @param aPassword The password
*/
void SetPassword( const wxString& aPassword )
{
m_common->SetPassword( aPassword );
}
/**
* @brief Set the SSH key
* @param aSSHKey The SSH key
*/
void SetSSHKey( const wxString& aSSHKey )
{
m_common->SetSSHKey( aSSHKey );
}
/**
* @brief Get the remote name
* @return The remote name
*/
wxString GetRemotename() const
{
return m_common->GetRemotename();
}
/**
* @brief Get the git root directory
* @return The git root directory
*/
wxString GetGitRootDirectory() const
{
return m_common->GetGitRootDirectory();
}
/**
* @brief Return the connection types that have been tested for authentication
* @return The connection types that have been tested for authentication
*/
unsigned& TestedTypes() { return m_common->TestedTypes(); }
private:
KIGIT_COMMON* m_common;
};
#endif // GIT_REPO_MIXIN_H
+288 -126
View File
@@ -22,8 +22,12 @@
*/
#include "kicad_git_common.h"
#include "kicad_git_memory.h"
#include "git_repo_mixin.h"
#include <git/git_progress.h>
#include <kiplatform/secrets.h>
#include <trace_helpers.h>
#include <wx/filename.h>
#include <wx/log.h>
@@ -33,9 +37,25 @@
#include <vector>
KIGIT_COMMON::KIGIT_COMMON( git_repository* aRepo ) :
m_repo( aRepo ), m_connType( GIT_CONN_TYPE::GIT_CONN_LOCAL ), m_testedTypes( 0 )
m_repo( aRepo ), m_connType( GIT_CONN_TYPE::GIT_CONN_LOCAL ), m_testedTypes( 0 ),
m_nextPublicKey( 0 )
{}
KIGIT_COMMON::KIGIT_COMMON( const KIGIT_COMMON& aOther ) :
// Initialize base class and member variables
m_repo( aOther.m_repo ),
m_connType( aOther.m_connType ),
m_remote( aOther.m_remote ),
m_hostname( aOther.m_hostname ),
m_username( aOther.m_username ),
m_password( aOther.m_password ),
m_testedTypes( aOther.m_testedTypes ),
// The mutex is default-initialized, not copied
m_gitActionMutex(),
m_publicKeys( aOther.m_publicKeys ),
m_nextPublicKey( aOther.m_nextPublicKey )
{
}
KIGIT_COMMON::~KIGIT_COMMON()
{}
@@ -56,25 +76,24 @@ wxString KIGIT_COMMON::GetCurrentBranchName() const
if( retval && retval != GIT_EUNBORNBRANCH && retval != GIT_ENOTFOUND )
return wxEmptyString;
git_reference *branch;
KIGIT::GitReferencePtr headPtr( head );
git_reference* branch;
if( git_reference_resolve( &branch, head ) )
{
git_reference_free( head );
wxLogTrace( traceGit, "Failed to resolve branch" );
return wxEmptyString;
}
git_reference_free( head );
const char* branchName = "";
KIGIT::GitReferencePtr branchPtr( branch );
const char* branchName = "";
if( git_branch_name( &branchName, branch ) )
{
git_reference_free( branch );
wxLogTrace( traceGit, "Failed to get branch name" );
return wxEmptyString;
}
git_reference_free( branch );
return wxString( branchName );
}
@@ -91,38 +110,45 @@ std::vector<wxString> KIGIT_COMMON::GetBranchNames() const
git_branch_iterator* branchIterator = nullptr;
if( git_branch_iterator_new( &branchIterator, m_repo, GIT_BRANCH_LOCAL ) )
{
wxLogTrace( traceGit, "Failed to get branch iterator" );
return branchNames;
}
git_reference* branchReference = nullptr;
git_branch_t branchType;
KIGIT::GitBranchIteratorPtr branchIteratorPtr( branchIterator );
git_reference* branchReference = nullptr;
git_branch_t branchType;
while( git_branch_next( &branchReference, &branchType, branchIterator ) != GIT_ITEROVER )
{
const char* branchName = "";
KIGIT::GitReferencePtr branchReferencePtr( branchReference );
if( git_branch_name( &branchName, branchReference ) )
{
wxLogTrace( traceGit, "Failed to get branch name in iter loop" );
continue;
}
const git_oid* commitId = git_reference_target( branchReference );
git_commit* commit = nullptr;
if( git_commit_lookup( &commit, m_repo, commitId ) )
{
wxLogTrace( traceGit, "Failed to get commit in iter loop" );
continue;
}
git_time_t commitTime = git_commit_time( commit );
KIGIT::GitCommitPtr commitPtr( commit );
git_time_t commitTime = git_commit_time( commit );
if( git_branch_is_head( branchReference ) )
firstName = branchName;
else
branchNamesMap.emplace( commitTime, branchName );
git_commit_free( commit );
git_reference_free( branchReference );
}
git_branch_iterator_free( branchIterator );
// Add the current branch to the top of the list
if( !firstName.IsEmpty() )
branchNames.push_back( firstName );
@@ -146,22 +172,26 @@ std::vector<wxString> KIGIT_COMMON::GetProjectDirs()
if( git_reference_name_to_id( &oid, m_repo, "HEAD" ) != GIT_OK )
{
wxLogError( "An error occurred: %s", git_error_last()->message );
wxLogTrace( traceGit, "An error occurred: %s", KIGIT_COMMON::GetLastGitError() );
return projDirs;
}
if( git_commit_lookup( &commit, m_repo, &oid ) != GIT_OK )
{
wxLogError( "An error occurred: %s", git_error_last()->message );
wxLogTrace( traceGit, "An error occurred: %s", KIGIT_COMMON::GetLastGitError() );
return projDirs;
}
KIGIT::GitCommitPtr commitPtr( commit );
if( git_commit_tree( &tree, commit ) != GIT_OK )
{
wxLogError( "An error occurred: %s", git_error_last()->message );
wxLogTrace( traceGit, "An error occurred: %s", KIGIT_COMMON::GetLastGitError() );
return projDirs;
}
KIGIT::GitTreePtr treePtr( tree );
// Define callback
git_tree_walk(
tree, GIT_TREEWALK_PRE,
@@ -182,9 +212,6 @@ std::vector<wxString> KIGIT_COMMON::GetProjectDirs()
},
&projDirs );
git_tree_free( tree );
git_commit_free( commit );
std::sort( projDirs.begin(), projDirs.end(),
[]( const wxString& a, const wxString& b )
{
@@ -204,21 +231,33 @@ std::vector<wxString> KIGIT_COMMON::GetProjectDirs()
std::pair<std::set<wxString>,std::set<wxString>> KIGIT_COMMON::GetDifferentFiles() const
{
auto get_modified_files = [&]( git_oid* from_oid, git_oid* to_oid ) -> std::set<wxString>
auto get_modified_files = [&]( const git_oid* from_oid, const git_oid* to_oid ) -> std::set<wxString>
{
std::set<wxString> modified_set;
git_revwalk* walker = nullptr;
if( git_revwalk_new( &walker, m_repo ) != GIT_OK )
if( !m_repo || !from_oid )
return modified_set;
if( ( git_revwalk_push( walker, from_oid ) != GIT_OK )
|| ( git_revwalk_hide( walker, to_oid ) != GIT_OK ) )
if( git_revwalk_new( &walker, m_repo ) != GIT_OK )
{
git_revwalk_free( walker );
wxLogTrace( traceGit, "Failed to create revwalker: %s", KIGIT_COMMON::GetLastGitError() );
return modified_set;
}
KIGIT::GitRevWalkPtr walkerPtr( walker );
if( git_revwalk_push( walker, from_oid ) != GIT_OK )
{
wxLogTrace( traceGit, "Failed to set from commit: %s", KIGIT_COMMON::GetLastGitError() );
return modified_set;
}
if( to_oid && git_revwalk_hide( walker, to_oid ) != GIT_OK )
{
wxLogTrace( traceGit, "Failed to set end commit (maybe new repo): %s", KIGIT_COMMON::GetLastGitError() );
}
git_oid oid;
git_commit* commit;
@@ -226,46 +265,65 @@ std::pair<std::set<wxString>,std::set<wxString>> KIGIT_COMMON::GetDifferentFiles
while( git_revwalk_next( &oid, walker ) == GIT_OK )
{
if( git_commit_lookup( &commit, m_repo, &oid ) != GIT_OK )
continue;
git_tree *tree, *parent_tree = nullptr;
if( git_commit_tree( &tree, commit ) != GIT_OK )
{
git_commit_free( commit );
wxLogTrace( traceGit, "Failed to lookup commit: %s", KIGIT_COMMON::GetLastGitError() );
continue;
}
KIGIT::GitCommitPtr commitPtr( commit );
git_tree *tree, *parent_tree = nullptr;
if( git_commit_tree( &tree, commit ) != GIT_OK )
{
wxLogTrace( traceGit, "Failed to get commit tree: %s", KIGIT_COMMON::GetLastGitError() );
continue;
}
KIGIT::GitTreePtr treePtr( tree );
// get parent commit tree to diff against
if( !git_commit_parentcount( commit ) )
{
git_tree_free( tree );
git_commit_free( commit );
git_tree_walk(
tree, GIT_TREEWALK_PRE,
[]( const char* root, const git_tree_entry* entry, void* payload )
{
std::set<wxString>* modified_set_internal = static_cast<std::set<wxString>*>( payload );
wxString filePath = wxString::Format( "%s%s", root, git_tree_entry_name( entry ) );
modified_set_internal->insert( filePath );
return 0; // continue walking
},
&modified_set );
continue;
}
git_commit* parent;
if( git_commit_parent( &parent, commit, 0 ) != GIT_OK )
{
git_tree_free( tree );
git_commit_free( commit );
wxLogTrace( traceGit, "Failed to get parent commit: %s", KIGIT_COMMON::GetLastGitError() );
continue;
}
KIGIT::GitCommitPtr parentPtr( parent );
if( git_commit_tree( &parent_tree, parent ) != GIT_OK )
{
git_tree_free( tree );
git_commit_free( commit );
git_commit_free( parent );
wxLogTrace( traceGit, "Failed to get parent commit tree: %s", KIGIT_COMMON::GetLastGitError() );
continue;
}
KIGIT::GitTreePtr parentTreePtr( parent_tree );
git_diff* diff;
git_diff_options diff_opts;
git_diff_init_options( &diff_opts, GIT_DIFF_OPTIONS_VERSION );
if( !diff_opts.flags || !m_repo || !parent_tree || !tree )
continue;
if( git_diff_tree_to_tree( &diff, m_repo, parent_tree, tree, &diff_opts ) == GIT_OK )
{
size_t num_deltas = git_diff_num_deltas( diff );
@@ -278,14 +336,13 @@ std::pair<std::set<wxString>,std::set<wxString>> KIGIT_COMMON::GetDifferentFiles
git_diff_free( diff );
}
git_tree_free( parent_tree );
git_commit_free( parent );
git_tree_free( tree );
git_commit_free( commit );
else
{
wxLogTrace( traceGit, "Failed to diff trees: %s", KIGIT_COMMON::GetLastGitError() );
}
}
git_revwalk_free( walker );
wxLogTrace( traceGit, "Finished walking commits with end: %s", KIGIT_COMMON::GetLastGitError() );
return modified_set;
};
@@ -299,22 +356,24 @@ std::pair<std::set<wxString>,std::set<wxString>> KIGIT_COMMON::GetDifferentFiles
git_reference* remote_head = nullptr;
if( git_repository_head( &head, m_repo ) != GIT_OK )
return modified_files;
if( git_branch_upstream( &remote_head, head ) != GIT_OK )
{
git_reference_free( head );
wxLogTrace( traceGit, "Failed to get modified HEAD" );
return modified_files;
}
git_oid head_oid = *git_reference_target( head );
git_oid remote_oid = *git_reference_target( remote_head );
KIGIT::GitReferencePtr headPtr( head );
git_reference_free( head );
git_reference_free( remote_head );
if( git_branch_upstream( &remote_head, head ) != GIT_OK )
{
wxLogTrace( traceGit, "Failed to get modified remote HEAD" );
}
modified_files.first = get_modified_files( &head_oid, &remote_oid );
modified_files.second = get_modified_files( &remote_oid, &head_oid );
KIGIT::GitReferencePtr remoteHeadPtr( remote_head );
const git_oid* head_oid = git_reference_target( head );
const git_oid* remote_oid = git_reference_target( remote_head );
modified_files.first = get_modified_files( head_oid, remote_oid );
modified_files.second = get_modified_files( remote_oid, head_oid );
return modified_files;
}
@@ -329,29 +388,42 @@ bool KIGIT_COMMON::HasLocalCommits() const
git_reference* remote_head = nullptr;
if( git_repository_head( &head, m_repo ) != GIT_OK )
return false;
if( git_branch_upstream( &remote_head, head ) != GIT_OK )
{
git_reference_free( head );
wxLogTrace( traceGit, "Failed to get HEAD: %s", KIGIT_COMMON::GetLastGitError() );
return false;
}
git_oid head_oid = *git_reference_target( head );
git_oid remote_oid = *git_reference_target( remote_head );
KIGIT::GitReferencePtr headPtr( head );
git_reference_free( head );
git_reference_free( remote_head );
if( git_branch_upstream( &remote_head, head ) != GIT_OK )
{
// No remote branch, so we have local commits (new repo?)
wxLogTrace( traceGit, "Failed to get remote HEAD: %s", KIGIT_COMMON::GetLastGitError() );
return true;
}
git_revwalk* walker = nullptr;
KIGIT::GitReferencePtr remoteHeadPtr( remote_head );
const git_oid* head_oid = git_reference_target( head );
const git_oid* remote_oid = git_reference_target( remote_head );
git_revwalk* walker = nullptr;
if( git_revwalk_new( &walker, m_repo ) != GIT_OK )
return false;
if( ( git_revwalk_push( walker, &head_oid ) != GIT_OK )
|| ( git_revwalk_hide( walker, &remote_oid ) != GIT_OK ) )
{
git_revwalk_free( walker );
wxLogTrace( traceGit, "Failed to create revwalker: %s", KIGIT_COMMON::GetLastGitError() );
return false;
}
KIGIT::GitRevWalkPtr walkerPtr( walker );
if( !head_oid || git_revwalk_push( walker, head_oid ) != GIT_OK )
{
wxLogTrace( traceGit, "Failed to push commits: %s", KIGIT_COMMON::GetLastGitError() );
return false;
}
if( remote_oid && git_revwalk_hide( walker, remote_oid ) != GIT_OK )
{
wxLogTrace( traceGit, "Failed to push/hide commits: %s", KIGIT_COMMON::GetLastGitError() );
return false;
}
@@ -360,11 +432,10 @@ bool KIGIT_COMMON::HasLocalCommits() const
// If we can't walk to the next commit, then we are at or behind the remote
if( git_revwalk_next( &oid, walker ) != GIT_OK )
{
git_revwalk_free( walker );
wxLogTrace( traceGit, "Failed to walk to next commit: %s", KIGIT_COMMON::GetLastGitError() );
return false;
}
git_revwalk_free( walker );
return true;
}
@@ -376,9 +447,12 @@ bool KIGIT_COMMON::HasPushAndPullRemote() const
if( git_remote_lookup( &remote, m_repo, "origin" ) != GIT_OK )
{
wxLogTrace( traceGit, "Failed to get remote for haspushpull" );
return false;
}
KIGIT::GitRemotePtr remotePtr( remote );
// Get the URLs associated with the remote
const char* fetch_url = git_remote_url( remote );
const char* push_url = git_remote_pushurl( remote );
@@ -386,13 +460,10 @@ bool KIGIT_COMMON::HasPushAndPullRemote() const
// If no push URL is set, libgit2 defaults to using the fetch URL for pushing
if( !push_url )
{
wxLogTrace( traceGit, "No push URL set, using fetch URL" );
push_url = fetch_url;
}
// Clean up the remote object
git_remote_free( remote );
// Check if both URLs are valid (i.e., not NULL)
return fetch_url && push_url;
}
@@ -406,22 +477,63 @@ wxString KIGIT_COMMON::GetRemotename() const
git_reference* upstream = nullptr;
if( git_repository_head( &head, m_repo ) != GIT_OK )
return retval;
if( git_branch_upstream( &upstream, head ) == GIT_OK )
{
git_buf remote_name = GIT_BUF_INIT_CONST( nullptr, 0 );
if( git_branch_remote_name( &remote_name, m_repo, git_reference_name( upstream ) ) == GIT_OK )
{
retval = remote_name.ptr;
git_buf_dispose( &remote_name );
}
git_reference_free( upstream );
wxLogTrace( traceGit, "Failed to get remote name: %s", KIGIT_COMMON::GetLastGitError() );
return retval;
}
git_reference_free( head );
KIGIT::GitReferencePtr headPtr( head );
if( git_branch_upstream( &upstream, head ) != GIT_OK )
{
wxLogTrace( traceGit, "Failed to get upstream branch: %s", KIGIT_COMMON::GetLastGitError() );
git_strarray remotes = { nullptr, 0 };
if( git_remote_list( &remotes, m_repo ) == GIT_OK )
{
if( remotes.count == 1 )
retval = remotes.strings[0];
git_strarray_dispose( &remotes );
}
else
{
wxLogTrace( traceGit, "Failed to list remotes: %s", KIGIT_COMMON::GetLastGitError() );
// If we can't get the remote name from the upstream branch or the list of remotes,
// just return the default remote name
git_remote* remote = nullptr;
if( git_remote_lookup( &remote, m_repo, "origin" ) == GIT_OK )
{
retval = git_remote_name( remote );
git_remote_free( remote );
}
else
{
wxLogTrace( traceGit, "Failed to get remote name from default remote: %s",
KIGIT_COMMON::GetLastGitError() );
}
}
return retval;
}
KIGIT::GitReferencePtr upstreamPtr( upstream );
git_buf remote_name = GIT_BUF_INIT_CONST( nullptr, 0 );
if( git_branch_remote_name( &remote_name, m_repo, git_reference_name( upstream ) ) == GIT_OK )
{
retval = remote_name.ptr;
git_buf_dispose( &remote_name );
}
else
{
wxLogTrace( traceGit,
"Failed to get remote name from upstream branch: %s",
KIGIT_COMMON::GetLastGitError() );
}
return retval;
}
@@ -544,6 +656,21 @@ void KIGIT_COMMON::UpdateCurrentBranchInfo()
updatePublicKeys();
}
KIGIT_COMMON::GIT_CONN_TYPE KIGIT_COMMON::GetConnType() const
{
wxString remote = m_remote;
if( remote.IsEmpty() )
remote = GetRemotename();
if( remote.StartsWith( "https://" ) || remote.StartsWith( "http://" ) )
return GIT_CONN_TYPE::GIT_CONN_HTTPS;
else if( remote.StartsWith( "ssh://" ) || remote.StartsWith( "git@" ) || remote.StartsWith( "git+ssh://" ) )
return GIT_CONN_TYPE::GIT_CONN_SSH;
return GIT_CONN_TYPE::GIT_CONN_LOCAL;
}
void KIGIT_COMMON::updateConnectionType()
{
if( m_remote.StartsWith( "https://" ) || m_remote.StartsWith( "http://" ) )
@@ -613,6 +740,59 @@ void KIGIT_COMMON::updateConnectionType()
}
int KIGIT_COMMON::HandleSSHKeyAuthentication( git_cred** aOut, const wxString& aUsername )
{
if( !( m_testedTypes & KIGIT_CREDENTIAL_SSH_AGENT ) )
return HandleSSHAgentAuthentication( aOut, aUsername );
// SSH key authentication with password
wxString sshKey = GetNextPublicKey();
if( sshKey.IsEmpty() )
{
m_testedTypes |= GIT_CREDENTIAL_SSH_KEY;
return GIT_PASSTHROUGH;
}
wxString sshPubKey = sshKey + ".pub";
wxString password = GetPassword();
if( git_credential_ssh_key_new( aOut, aUsername.mbc_str(), sshPubKey.mbc_str(), sshKey.mbc_str(),
password.mbc_str() ) != GIT_OK )
{
wxLogTrace( traceGit, "Failed to create SSH key credential for %s: %s",
aUsername, KIGIT_COMMON::GetLastGitError() );
return GIT_ERROR;
}
return GIT_OK;
}
int KIGIT_COMMON::HandlePlaintextAuthentication( git_cred** aOut, const wxString& aUsername )
{
wxString password = GetPassword();
git_credential_userpass_plaintext_new( aOut, aUsername.mbc_str(), password.mbc_str() );
m_testedTypes |= GIT_CREDENTIAL_USERPASS_PLAINTEXT;
return GIT_OK;
}
int KIGIT_COMMON::HandleSSHAgentAuthentication( git_cred** aOut, const wxString& aUsername )
{
if( git_credential_ssh_key_from_agent( aOut, aUsername.mbc_str() ) != GIT_OK )
{
wxLogTrace( traceGit, "Failed to create SSH agent credential for %s: %s",
aUsername, KIGIT_COMMON::GetLastGitError() );
return GIT_ERROR;
}
m_testedTypes |= KIGIT_CREDENTIAL_SSH_AGENT;
return GIT_OK;
}
extern "C" int fetchhead_foreach_cb( const char*, const char*,
const git_oid* aOID, unsigned int aIsMerge, void* aPayload )
{
@@ -625,7 +805,7 @@ extern "C" int fetchhead_foreach_cb( const char*, const char*,
extern "C" void clone_progress_cb( const char* aStr, size_t aLen, size_t aTotal, void* data )
{
KIGIT_COMMON* parent = (KIGIT_COMMON*) data;
GIT_PROGRESS* parent = (GIT_PROGRESS*) data;
wxString progressMessage( aStr );
parent->UpdateProgress( aLen, aTotal, progressMessage );
@@ -634,7 +814,7 @@ extern "C" void clone_progress_cb( const char* aStr, size_t aLen, size_t aTotal,
extern "C" int progress_cb( const char* str, int len, void* data )
{
KIGIT_COMMON* parent = (KIGIT_COMMON*) data;
GIT_PROGRESS* parent = (GIT_PROGRESS*) data;
wxString progressMessage( str, len );
parent->UpdateProgress( 0, 0, progressMessage );
@@ -645,7 +825,7 @@ extern "C" int progress_cb( const char* str, int len, void* data )
extern "C" int transfer_progress_cb( const git_transfer_progress* aStats, void* aPayload )
{
KIGIT_COMMON* parent = (KIGIT_COMMON*) aPayload;
GIT_PROGRESS* parent = (GIT_PROGRESS*) aPayload;
wxString progressMessage = wxString::Format( _( "Received %u of %u objects" ),
aStats->received_objects,
aStats->total_objects );
@@ -663,7 +843,7 @@ extern "C" int update_cb( const char* aRefname, const git_oid* aFirst, const git
char a_str[cstring_len + 1];
char b_str[cstring_len + 1];
KIGIT_COMMON* parent = (KIGIT_COMMON*) aPayload;
GIT_PROGRESS* parent = (GIT_PROGRESS*) aPayload;
wxString status;
git_oid_tostr( b_str, cstring_len, aSecond );
@@ -692,7 +872,7 @@ extern "C" int push_transfer_progress_cb( unsigned int aCurrent, unsigned int aT
void* aPayload )
{
long long progress = 100;
KIGIT_COMMON* parent = (KIGIT_COMMON*) aPayload;
GIT_PROGRESS* parent = (GIT_PROGRESS*) aPayload;
if( aTotal != 0 )
{
@@ -709,7 +889,7 @@ extern "C" int push_transfer_progress_cb( unsigned int aCurrent, unsigned int aT
extern "C" int push_update_reference_cb( const char* aRefname, const char* aStatus, void* aPayload )
{
KIGIT_COMMON* parent = (KIGIT_COMMON*) aPayload;
GIT_PROGRESS* parent = (GIT_PROGRESS*) aPayload;
wxString status( aStatus );
if( !status.IsEmpty() )
@@ -730,50 +910,32 @@ extern "C" int push_update_reference_cb( const char* aRefname, const char* aStat
extern "C" int credentials_cb( git_cred** aOut, const char* aUrl, const char* aUsername,
unsigned int aAllowedTypes, void* aPayload )
{
KIGIT_COMMON* parent = static_cast<KIGIT_COMMON*>( aPayload );
KIGIT_REPO_MIXIN* parent = reinterpret_cast<KIGIT_REPO_MIXIN*>( aPayload );
KIGIT_COMMON* common = parent->GetCommon();
if( parent->GetConnType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL )
return GIT_PASSTHROUGH;
if( aAllowedTypes & GIT_CREDTYPE_USERNAME
&& !( parent->TestedTypes() & GIT_CREDTYPE_USERNAME ) )
if( aAllowedTypes & GIT_CREDENTIAL_USERNAME
&& !( parent->TestedTypes() & GIT_CREDENTIAL_USERNAME ) )
{
wxString username = parent->GetUsername().Trim().Trim( false );
git_cred_username_new( aOut, username.ToStdString().c_str() );
parent->TestedTypes() |= GIT_CREDTYPE_USERNAME;
git_credential_username_new( aOut, username.ToStdString().c_str() );
parent->TestedTypes() |= GIT_CREDENTIAL_USERNAME;
}
else if( parent->GetConnType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_HTTPS
&& ( aAllowedTypes & GIT_CREDTYPE_USERPASS_PLAINTEXT )
&& !( parent->TestedTypes() & GIT_CREDTYPE_USERPASS_PLAINTEXT ) )
&& ( aAllowedTypes & GIT_CREDENTIAL_USERPASS_PLAINTEXT )
&& !( parent->TestedTypes() & GIT_CREDENTIAL_USERPASS_PLAINTEXT ) )
{
wxString username = parent->GetUsername().Trim().Trim( false );
wxString password = parent->GetPassword().Trim().Trim( false );
git_cred_userpass_plaintext_new( aOut, username.ToStdString().c_str(),
password.ToStdString().c_str() );
parent->TestedTypes() |= GIT_CREDTYPE_USERPASS_PLAINTEXT;
// Plaintext authentication
return common->HandlePlaintextAuthentication( aOut, aUsername );
}
else if( parent->GetConnType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_SSH
&& ( aAllowedTypes & GIT_CREDTYPE_SSH_KEY )
&& !( parent->TestedTypes() & GIT_CREDTYPE_SSH_KEY ) )
&& ( aAllowedTypes & GIT_CREDENTIAL_SSH_KEY )
&& !( parent->TestedTypes() & GIT_CREDENTIAL_SSH_KEY ) )
{
// SSH key authentication
wxString sshKey = parent->GetNextPublicKey();
if( sshKey.IsEmpty() )
{
parent->TestedTypes() |= GIT_CREDTYPE_SSH_KEY;
return GIT_PASSTHROUGH;
}
wxString sshPubKey = sshKey + ".pub";
wxString username = parent->GetUsername().Trim().Trim( false );
wxString password = parent->GetPassword().Trim().Trim( false );
git_cred_ssh_key_new( aOut, username.ToStdString().c_str(),
sshPubKey.ToStdString().c_str(),
sshKey.ToStdString().c_str(),
password.ToStdString().c_str() );
return common->HandleSSHKeyAuthentication( aOut, aUsername );
}
else
{
+32 -13
View File
@@ -27,15 +27,17 @@
#include <git/kicad_git_errors.h>
#include <git2.h>
#include <mutex>
#include <set>
#include <wx/string.h>
class KIGIT_COMMON : public KIGIT_ERRORS
class KIGIT_COMMON
{
public:
KIGIT_COMMON( git_repository* aRepo );
KIGIT_COMMON( const KIGIT_COMMON& aOther );
~KIGIT_COMMON();
git_repository* GetRepo() const;
@@ -49,8 +51,6 @@ public:
std::vector<wxString> GetBranchNames() const;
virtual void UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage ) {};
/**
* Return a vector of project files in the repository. Sorted by the depth of
* the project file in the directory tree
@@ -76,6 +76,7 @@ public:
GIT_STATUS_BEHIND, // File changed in remote repository but not in local
GIT_STATUS_AHEAD, // File changed in local repository but not in remote
GIT_STATUS_CONFLICTED,
GIT_STATUS_IGNORED,
GIT_STATUS_LAST
};
@@ -89,19 +90,12 @@ public:
wxString GetUsername() const { return m_username; }
wxString GetPassword() const { return m_password; }
GIT_CONN_TYPE GetConnType() const { return m_connType; }
GIT_CONN_TYPE GetConnType() const;
void SetUsername( const wxString& aUsername ) { m_username = aUsername; }
void SetPassword( const wxString& aPassword ) { m_password = aPassword; }
void SetSSHKey( const wxString& aSSHKey );
void SetConnType( GIT_CONN_TYPE aConnType ) { m_connType = aConnType; }
void SetConnType( unsigned aConnType )
{
if( aConnType < static_cast<unsigned>( GIT_CONN_TYPE::GIT_CONN_LAST ) )
m_connType = static_cast<GIT_CONN_TYPE>( aConnType );
}
// Holds a temporary variable that can be used by the authentication callback
// to remember which types of authentication have been tested so that we
// don't loop forever.
@@ -130,6 +124,22 @@ public:
return m_publicKeys[m_nextPublicKey++];
}
int HandleSSHKeyAuthentication( git_cred** aOut, const wxString& aUsername );
int HandlePlaintextAuthentication( git_cred** aOut, const wxString& aUsername );
int HandleSSHAgentAuthentication( git_cred** aOut, const wxString& aUsername );
static wxString GetLastGitError()
{
const git_error* error = git_error_last();
if( error == nullptr )
return wxString( "No error" );
return wxString( error->message );
}
protected:
git_repository* m_repo;
@@ -141,6 +151,13 @@ protected:
unsigned m_testedTypes;
std::mutex m_gitActionMutex;
// Make git handlers friends so they can access the mutex
friend class GIT_PUSH_HANDLER;
friend class GIT_PULL_HANDLER;
friend class GIT_CLONE_HANDLER;
private:
void updatePublicKeys();
void updateConnectionType();
@@ -148,10 +165,12 @@ private:
std::vector<wxString> m_publicKeys;
int m_nextPublicKey;
// Create a dummy flag to tell if we have tested ssh agent credentials separately
// from the ssh key credentials
static const unsigned KIGIT_CREDENTIAL_SSH_AGENT = 1 << sizeof( m_testedTypes - 1 );
};
extern "C" int progress_cb( const char* str, int len, void* data );
extern "C" int progress_cb( const char* str, int len, void* data );
extern "C" void clone_progress_cb( const char* str, size_t len, size_t total, void* data );
extern "C" int transfer_progress_cb( const git_transfer_progress* aStats, void* aPayload );
extern "C" int update_cb( const char* aRefname, const git_oid* aFirst, const git_oid* aSecond,
+255
View File
@@ -0,0 +1,255 @@
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
#ifndef KICAD_GIT_MEMORY_H
#define KICAD_GIT_MEMORY_H
#include <memory>
#include <git2.h>
namespace KIGIT
{
/**
* @brief A unique pointer for git_repository objects with automatic cleanup.
*/
using GitRepositoryPtr = std::unique_ptr<git_repository,
decltype([](git_repository* aRepo) {
git_repository_free(aRepo);
})>;
/**
* @brief A unique pointer for git_reference objects with automatic cleanup.
*/
using GitReferencePtr = std::unique_ptr<git_reference,
decltype([](git_reference* aRef) {
git_reference_free(aRef);
})>;
/**
* @brief A unique pointer for git_object objects with automatic cleanup.
*/
using GitObjectPtr = std::unique_ptr<git_object,
decltype([](git_object* aObject) {
git_object_free(aObject);
})>;
/**
* @brief A unique pointer for git_commit objects with automatic cleanup.
*/
using GitCommitPtr = std::unique_ptr<git_commit,
decltype([](git_commit* aCommit) {
git_commit_free(aCommit);
})>;
/**
* @brief A unique pointer for git_tree objects with automatic cleanup.
*/
using GitTreePtr = std::unique_ptr<git_tree,
decltype([](git_tree* aTree) {
git_tree_free(aTree);
})>;
/**
* @brief A unique pointer for git_index objects with automatic cleanup.
*/
using GitIndexPtr = std::unique_ptr<git_index,
decltype([](git_index* aIndex) {
git_index_free(aIndex);
})>;
/**
* @brief A unique pointer for git_revwalk objects with automatic cleanup.
*/
using GitRevWalkPtr = std::unique_ptr<git_revwalk,
decltype([](git_revwalk* aWalker) {
git_revwalk_free(aWalker);
})>;
/**
* @brief A unique pointer for git_diff objects with automatic cleanup.
*/
using GitDiffPtr = std::unique_ptr<git_diff,
decltype([](git_diff* aDiff) {
git_diff_free(aDiff);
})>;
/**
* @brief A unique pointer for git_signature objects with automatic cleanup.
*/
using GitSignaturePtr = std::unique_ptr<git_signature,
decltype([](git_signature* aSignature) {
git_signature_free(aSignature);
})>;
/**
* @brief A unique pointer for git_config objects with automatic cleanup.
*/
using GitConfigPtr = std::unique_ptr<git_config,
decltype([](git_config* aConfig) {
git_config_free(aConfig);
})>;
/**
* @brief A unique pointer for git_remote objects with automatic cleanup.
*/
using GitRemotePtr = std::unique_ptr<git_remote,
decltype([](git_remote* aRemote) {
git_remote_free(aRemote);
})>;
/**
* @brief A unique pointer for git_annotated_commit objects with automatic cleanup.
*/
using GitAnnotatedCommitPtr = std::unique_ptr<git_annotated_commit,
decltype([](git_annotated_commit* aCommit) {
git_annotated_commit_free(aCommit);
})>;
/**
* @brief A unique pointer for git_oid objects with automatic cleanup.
*/
using GitOidPtr = std::unique_ptr<git_oid,
decltype([](git_oid* aOid) {
delete aOid;
})>;
/**
* @brief A unique pointer for git_buf objects with automatic cleanup.
*/
using GitBufPtr = std::unique_ptr<git_buf,
decltype([](git_buf* aBuf) {
git_buf_free(aBuf);
})>;
/**
* @brief A unique pointer for git_blame objects with automatic cleanup.
*/
using GitBlamePtr = std::unique_ptr<git_blame,
decltype([](git_blame* aBlame) {
git_blame_free(aBlame);
})>;
/**
* @brief A unique pointer for git_blob objects with automatic cleanup.
*/
using GitBlobPtr = std::unique_ptr<git_blob,
decltype([](git_blob* aBlob) {
git_blob_free(aBlob);
})>;
/**
* @brief A unique pointer for git_branch_iterator objects with automatic cleanup.
*/
using GitBranchIteratorPtr = std::unique_ptr<git_branch_iterator,
decltype([](git_branch_iterator* aIter) {
git_branch_iterator_free(aIter);
})>;
/**
* @brief A unique pointer for git_config_entry objects with automatic cleanup.
*/
using GitConfigEntryPtr = std::unique_ptr<git_config_entry,
decltype([](git_config_entry* aEntry) {
git_config_entry_free(aEntry);
})>;
/**
* @brief A unique pointer for git_config_iterator objects with automatic cleanup.
*/
using GitConfigIteratorPtr = std::unique_ptr<git_config_iterator,
decltype([](git_config_iterator* aIter) {
git_config_iterator_free(aIter);
})>;
/**
* @brief A unique pointer for git_credential objects with automatic cleanup.
*/
using GitCredentialPtr = std::unique_ptr<git_credential,
decltype([](git_credential* aCred) {
git_credential_free(aCred);
})>;
/**
* @brief A unique pointer for git_oidarray objects with automatic cleanup.
*/
using GitOidArrayPtr = std::unique_ptr<git_oidarray,
decltype([](git_oidarray* aArray) {
git_oidarray_free(aArray);
})>;
/**
* @brief A unique pointer for git_strarray objects with automatic cleanup.
*/
using GitStrArrayPtr = std::unique_ptr<git_strarray,
decltype([](git_strarray* aArray) {
git_strarray_free(aArray);
})>;
/**
* @brief A unique pointer for git_describe_result objects with automatic cleanup.
*/
using GitDescribeResultPtr = std::unique_ptr<git_describe_result,
decltype([](git_describe_result* aResult) {
git_describe_result_free(aResult);
})>;
/**
* @brief A unique pointer for git_diff_stats objects with automatic cleanup.
*/
using GitDiffStatsPtr = std::unique_ptr<git_diff_stats,
decltype([](git_diff_stats* aStats) {
git_diff_stats_free(aStats);
})>;
/**
* @brief A unique pointer for git_filter_list objects with automatic cleanup.
*/
using GitFilterListPtr = std::unique_ptr<git_filter_list,
decltype([](git_filter_list* aFilters) {
git_filter_list_free(aFilters);
})>;
/**
* @brief A unique pointer for git_indexer objects with automatic cleanup.
*/
using GitIndexerPtr = std::unique_ptr<git_indexer,
decltype([](git_indexer* aIdx) {
git_indexer_free(aIdx);
})>;
/**
* @brief A unique pointer for git_index_iterator objects with automatic cleanup.
*/
using GitIndexIteratorPtr = std::unique_ptr<git_index_iterator,
decltype([](git_index_iterator* aIterator) {
git_index_iterator_free(aIterator);
})>;
/**
* @brief A unique pointer for git_index_conflict_iterator objects with automatic cleanup.
*/
using GitIndexConflictIteratorPtr = std::unique_ptr<git_index_conflict_iterator,
decltype([](git_index_conflict_iterator* aIterator) {
git_index_conflict_iterator_free(aIterator);
})>;
/**
* @brief A unique pointer for git_status_list objects with automatic cleanup.
*/
using GitStatusListPtr = std::unique_ptr<git_status_list,
decltype([](git_status_list* aList) {
git_status_list_free(aList);
})>;
} // namespace KIGIT
#endif // KICAD_GIT_MEMORY_H
+1 -1
View File
@@ -323,7 +323,7 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
ret = hash_board_item( table, aFlags );
hash_combine( ret, table->StrokeExternal() );
hash_combine( ret, table->StrokeHeader() );
hash_combine( ret, table->StrokeHeaderSeparator() );
hash_combine( ret, table->StrokeColumns() );
hash_combine( ret, table->StrokeRows() );
+6 -6
View File
@@ -1006,10 +1006,10 @@ double DXF_IMPORT_PLUGIN::getCurrentUnitScale()
switch( m_currentUnit )
{
case DXF_IMPORT_UNITS::INCHES: scale = 25.4; break;
case DXF_IMPORT_UNITS::INCH: scale = 25.4; break;
case DXF_IMPORT_UNITS::FEET: scale = 304.8; break;
case DXF_IMPORT_UNITS::MILLIMETERS: scale = 1.0; break;
case DXF_IMPORT_UNITS::CENTIMETERS: scale = 10.0; break;
case DXF_IMPORT_UNITS::MM: scale = 1.0; break;
case DXF_IMPORT_UNITS::CM: scale = 10.0; break;
case DXF_IMPORT_UNITS::METERS: scale = 1000.0; break;
case DXF_IMPORT_UNITS::MICROINCHES: scale = 2.54e-5; break;
case DXF_IMPORT_UNITS::MILS: scale = 0.0254; break;
@@ -1065,10 +1065,10 @@ void DXF_IMPORT_PLUGIN::setVariableInt( const std::string& key, int value, int c
switch( value )
{
case 1: m_currentUnit = DXF_IMPORT_UNITS::INCHES; break;
case 1: m_currentUnit = DXF_IMPORT_UNITS::INCH; break;
case 2: m_currentUnit = DXF_IMPORT_UNITS::FEET; break;
case 4: m_currentUnit = DXF_IMPORT_UNITS::MILLIMETERS; break;
case 5: m_currentUnit = DXF_IMPORT_UNITS::CENTIMETERS; break;
case 4: m_currentUnit = DXF_IMPORT_UNITS::MM; break;
case 5: m_currentUnit = DXF_IMPORT_UNITS::CM; break;
case 6: m_currentUnit = DXF_IMPORT_UNITS::METERS; break;
case 8: m_currentUnit = DXF_IMPORT_UNITS::MICROINCHES; break;
case 9: m_currentUnit = DXF_IMPORT_UNITS::MILS; break;
+3 -3
View File
@@ -182,10 +182,10 @@ public:
enum class DXF_IMPORT_UNITS
{
DEFAULT = 0,
INCHES = 1,
INCH = 1,
FEET = 2,
MILLIMETERS = 4,
CENTIMETERS = 5,
MM = 4,
CM = 5,
METERS = 6,
MICROINCHES = 8,
MILS = 9,
+3 -1
View File
@@ -201,7 +201,9 @@ public:
IMPORTED_POLYGON( const std::vector<VECTOR2D>& aVertices, const IMPORTED_STROKE& aStroke,
bool aFilled, const COLOR4D& aFillColor ) :
m_vertices( aVertices ),
m_stroke( aStroke ), m_filled( aFilled ), m_fillColor( aFillColor )
m_stroke( aStroke ),
m_filled( aFilled ),
m_fillColor( aFillColor )
{
}
+6 -2
View File
@@ -195,8 +195,12 @@ bool SVG_IMPORT_PLUGIN::Import()
// *not* closed so create a filled, closed shape for the fill, and an unfilled,
// open shape for the outline
static IMPORTED_STROKE noStroke( -1, LINE_STYLE::SOLID, COLOR4D::UNSPECIFIED );
DrawPath( path->pts, path->npts, true, noStroke, true, fillColor );
DrawPath( path->pts, path->npts, false, stroke, false, COLOR4D::UNSPECIFIED );
const bool closed = true;
DrawPath( path->pts, path->npts, closed, noStroke, true, fillColor );
if( stroke.GetWidth() > 0 )
DrawPath( path->pts, path->npts, !closed, stroke, false, COLOR4D::UNSPECIFIED );
}
else
{
+20 -9
View File
@@ -47,6 +47,11 @@ std::string FormatPath( const std::vector<std::string>& aVectorPath )
}
ALTIUM_COMPOUND_FILE::ALTIUM_COMPOUND_FILE()
{
}
ALTIUM_COMPOUND_FILE::ALTIUM_COMPOUND_FILE( const wxString& aFilePath )
{
// Open file
@@ -91,6 +96,12 @@ ALTIUM_COMPOUND_FILE::ALTIUM_COMPOUND_FILE( const wxString& aFilePath )
ALTIUM_COMPOUND_FILE::ALTIUM_COMPOUND_FILE( const void* aBuffer, size_t aLen )
{
InitFromBuffer( aBuffer, aLen );
}
void ALTIUM_COMPOUND_FILE::InitFromBuffer( const void* aBuffer, size_t aLen )
{
m_buffer.resize( aLen );
memcpy( m_buffer.data(), aBuffer, aLen );
@@ -106,10 +117,11 @@ ALTIUM_COMPOUND_FILE::ALTIUM_COMPOUND_FILE( const void* aBuffer, size_t aLen )
}
std::unique_ptr<ALTIUM_COMPOUND_FILE>
ALTIUM_COMPOUND_FILE::DecodeIntLibStream( const CFB::COMPOUND_FILE_ENTRY& cfe )
bool ALTIUM_COMPOUND_FILE::DecodeIntLibStream( const CFB::COMPOUND_FILE_ENTRY& cfe,
ALTIUM_COMPOUND_FILE* aOutput )
{
wxCHECK( cfe.size >= 1, nullptr );
wxCHECK( aOutput, false );
wxCHECK( cfe.size >= 1, false );
size_t streamSize = cfe.size;
wxMemoryBuffer buffer( streamSize );
@@ -130,14 +142,13 @@ ALTIUM_COMPOUND_FILE::DecodeIntLibStream( const CFB::COMPOUND_FILE_ENTRY& cfe )
decodedPcbLibStream << zlibInputStream;
wxStreamBuffer* outStream = decodedPcbLibStream.GetOutputStreamBuffer();
return std::make_unique<ALTIUM_COMPOUND_FILE>( outStream->GetBufferStart(),
outStream->GetIntPosition() );
aOutput->InitFromBuffer( outStream->GetBufferStart(), outStream->GetIntPosition() );
return true;
}
else if( buffer[0] == 0x00 )
{
return std::make_unique<ALTIUM_COMPOUND_FILE>(
reinterpret_cast<uint8_t*>( buffer.GetData() ) + 1, streamSize - 1 );
aOutput->InitFromBuffer( static_cast<uint8_t*>( buffer.GetData() ) + 1, streamSize - 1 );
return true;
}
else
{
@@ -145,7 +156,7 @@ ALTIUM_COMPOUND_FILE::DecodeIntLibStream( const CFB::COMPOUND_FILE_ENTRY& cfe )
buffer[0], buffer[1], buffer[2], buffer[3], buffer[4] ) );
}
return nullptr;
return false;
}
+13 -1
View File
@@ -70,6 +70,9 @@ class ALTIUM_COMPOUND_FILE
friend class ALTIUM_PCB_COMPOUND_FILE;
public:
/// Create an uninitialized file for two-step initialization (e.g. with InitFromBuffer)
ALTIUM_COMPOUND_FILE();
/**
* Open a CFB file. Constructor might throw an IO_ERROR.
*
@@ -90,9 +93,18 @@ public:
ALTIUM_COMPOUND_FILE& operator=( const ALTIUM_COMPOUND_FILE& temp_obj ) = delete;
~ALTIUM_COMPOUND_FILE() = default;
/**
* Load a CFB file from memory; may throw an IO_ERROR.
* Data is copied.
*
* @param aBuffer data buffer
* @param aLen data length
*/
void InitFromBuffer( const void* aBuffer, size_t aLen );
const CFB::CompoundFileReader& GetCompoundFileReader() const { return *m_reader; }
std::unique_ptr<ALTIUM_COMPOUND_FILE> DecodeIntLibStream( const CFB::COMPOUND_FILE_ENTRY& cfe );
bool DecodeIntLibStream( const CFB::COMPOUND_FILE_ENTRY& cfe, ALTIUM_COMPOUND_FILE* aOutput );
const CFB::COMPOUND_FILE_ENTRY* FindStream( const std::vector<std::string>& aStreamPath ) const;
+3 -3
View File
@@ -1262,13 +1262,13 @@ EPOLYGON::EPOLYGON( wxXmlNode* aPolygon, IO_BASE* aIo ) :
opt_wxString s = parseOptionalAttribute<wxString>( aPolygon, "pour" );
// default pour to solid fill
pour = EPOLYGON::SOLID;
pour = EPOLYGON::ESOLID;
// (solid | hatch | cutout)
if( s == "hatch" )
pour = EPOLYGON::HATCH;
pour = EPOLYGON::EHATCH;
else if( s == "cutout" )
pour = EPOLYGON::CUTOUT;
pour = EPOLYGON::ECUTOUT;
orphans = parseOptionalAttribute<bool>( aPolygon, "orphans" );
thermals = parseOptionalAttribute<bool>( aPolygon, "thermals" );
+3 -3
View File
@@ -1168,9 +1168,9 @@ struct EPOLYGON : public EAGLE_BASE
static const int max_priority = 6;
enum { // for pour
SOLID,
HATCH,
CUTOUT,
ESOLID,
EHATCH,
ECUTOUT,
};
int pour;
+1 -1
View File
@@ -76,7 +76,7 @@ bool IO_BASE::CanReadLibrary( const wxString& aFileName ) const
{
const std::vector<std::string>& exts = desc.m_FileExtensions;
wxString fileExt = wxFileName( aFileName ).GetExt().MakeLower();
wxString fileExt = wxFileName( aFileName ).GetExt().Lower();
for( const std::string& ext : exts )
{
+21 -20
View File
@@ -25,20 +25,20 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_3D::FORMAT,
{
{ JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN, nullptr },
{ JOB_EXPORT_PCB_3D::FORMAT::STEP, "step" },
{ JOB_EXPORT_PCB_3D::FORMAT::BREP, "brep" },
{ JOB_EXPORT_PCB_3D::FORMAT::GLB, "step" },
{ JOB_EXPORT_PCB_3D::FORMAT::VRML, "vrml" },
{ JOB_EXPORT_PCB_3D::FORMAT::XAO, "xao" },
{ JOB_EXPORT_PCB_3D::FORMAT::PLY, "ply" },
{ JOB_EXPORT_PCB_3D::FORMAT::STL, "stl" },
{ JOB_EXPORT_PCB_3D::FORMAT::STEP, "step" },
{ JOB_EXPORT_PCB_3D::FORMAT::BREP, "brep" },
{ JOB_EXPORT_PCB_3D::FORMAT::GLB, "step" },
{ JOB_EXPORT_PCB_3D::FORMAT::VRML, "vrml" },
{ JOB_EXPORT_PCB_3D::FORMAT::XAO, "xao" },
{ JOB_EXPORT_PCB_3D::FORMAT::PLY, "ply" },
{ JOB_EXPORT_PCB_3D::FORMAT::STL, "stl" },
} )
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_3D::VRML_UNITS,
{
{ JOB_EXPORT_PCB_3D::VRML_UNITS::INCHES, "in" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::METERS, "m" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::MM, "mm" },
{ JOB_EXPORT_PCB_3D::VRML_UNITS::TENTHS, "tenths" },
} )
@@ -74,13 +74,13 @@ wxString EXPORTER_STEP_PARAMS::GetFormatName() const
JOB_EXPORT_PCB_3D::JOB_EXPORT_PCB_3D() :
JOB( "3d", false ),
m_hasUserOrigin( false ),
m_filename(),
m_format( JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN ),
m_vrmlUnits( JOB_EXPORT_PCB_3D::VRML_UNITS::METERS ),
m_vrmlModelDir( wxEmptyString ),
m_vrmlRelativePaths( false )
JOB( "3d", false ),
m_hasUserOrigin( false ),
m_filename(),
m_format( JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN ),
m_vrmlUnits( JOB_EXPORT_PCB_3D::VRML_UNITS::METERS ),
m_vrmlModelDir( wxEmptyString ),
m_vrmlRelativePaths( false )
{
m_params.emplace_back(
new JOB_PARAM<bool>( "overwrite", &m_3dparams.m_Overwrite, m_3dparams.m_Overwrite ) );
@@ -154,14 +154,15 @@ wxString JOB_EXPORT_PCB_3D::GetSettingsDialogTitle() const
void JOB_EXPORT_PCB_3D::SetStepFormat( EXPORTER_STEP_PARAMS::FORMAT aFormat )
{
m_3dparams.m_Format = aFormat;
switch( m_3dparams.m_Format )
{
case EXPORTER_STEP_PARAMS::FORMAT::STEP: m_format = JOB_EXPORT_PCB_3D::FORMAT::STEP; break;
case EXPORTER_STEP_PARAMS::FORMAT::GLB: m_format = JOB_EXPORT_PCB_3D::FORMAT::GLB; break;
case EXPORTER_STEP_PARAMS::FORMAT::XAO: m_format = JOB_EXPORT_PCB_3D::FORMAT::XAO; break;
case EXPORTER_STEP_PARAMS::FORMAT::GLB: m_format = JOB_EXPORT_PCB_3D::FORMAT::GLB; break;
case EXPORTER_STEP_PARAMS::FORMAT::XAO: m_format = JOB_EXPORT_PCB_3D::FORMAT::XAO; break;
case EXPORTER_STEP_PARAMS::FORMAT::BREP: m_format = JOB_EXPORT_PCB_3D::FORMAT::BREP; break;
case EXPORTER_STEP_PARAMS::FORMAT::PLY: m_format = JOB_EXPORT_PCB_3D::FORMAT::PLY; break;
case EXPORTER_STEP_PARAMS::FORMAT::STL: m_format = JOB_EXPORT_PCB_3D::FORMAT::STL; break;
case EXPORTER_STEP_PARAMS::FORMAT::PLY: m_format = JOB_EXPORT_PCB_3D::FORMAT::PLY; break;
case EXPORTER_STEP_PARAMS::FORMAT::STL: m_format = JOB_EXPORT_PCB_3D::FORMAT::STL; break;
}
}
+7 -6
View File
@@ -125,23 +125,24 @@ public:
enum class VRML_UNITS
{
INCHES,
MILLIMETERS,
INCH, // Do not use IN: it conflicts with a Windows header
MM,
METERS,
TENTHS // inches
};
public:
bool m_hasUserOrigin;
wxString m_filename;
JOB_EXPORT_PCB_3D::FORMAT m_format;
/// Despite the name; also used for other formats
EXPORTER_STEP_PARAMS m_3dparams;
EXPORTER_STEP_PARAMS m_3dparams;
VRML_UNITS m_vrmlUnits;
wxString m_vrmlModelDir;
bool m_vrmlRelativePaths;
VRML_UNITS m_vrmlUnits;
wxString m_vrmlModelDir;
bool m_vrmlRelativePaths;
};
#endif
+16 -16
View File
@@ -36,8 +36,8 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DRILL::DRILL_ORIGIN,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DRILL::DRILL_UNITS,
{
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCHES, "in" },
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MM, "mm" },
} )
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DRILL::ZEROS_FORMAT,
@@ -58,19 +58,19 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DRILL::MAP_FORMAT,
} )
JOB_EXPORT_PCB_DRILL::JOB_EXPORT_PCB_DRILL() :
JOB( "drill", true ),
m_filename(),
m_excellonMirrorY( false ),
m_excellonMinimalHeader( false ),
m_excellonCombinePTHNPTH( true ),
m_excellonOvalDrillRoute( false ),
m_format( DRILL_FORMAT::EXCELLON ),
m_drillOrigin( DRILL_ORIGIN::ABS ),
m_drillUnits( DRILL_UNITS::INCHES ),
m_zeroFormat( ZEROS_FORMAT::DECIMAL ),
m_mapFormat( MAP_FORMAT::PDF ),
m_gerberPrecision( 5 ),
m_generateMap( false )
JOB( "drill", true ),
m_filename(),
m_excellonMirrorY( false ),
m_excellonMinimalHeader( false ),
m_excellonCombinePTHNPTH( true ),
m_excellonOvalDrillRoute( false ),
m_format( DRILL_FORMAT::EXCELLON ),
m_drillOrigin( DRILL_ORIGIN::ABS ),
m_drillUnits( DRILL_UNITS::INCH ),
m_zeroFormat( ZEROS_FORMAT::DECIMAL ),
m_mapFormat( MAP_FORMAT::PDF ),
m_gerberPrecision( 5 ),
m_generateMap( false )
{
m_params.emplace_back( new JOB_PARAM<bool>( "excellon.mirror_y",
&m_excellonMirrorY,
@@ -129,5 +129,5 @@ wxString JOB_EXPORT_PCB_DRILL::GetSettingsDialogTitle() const
return _( "Export Drill Data Job Settings" );
}
REGISTER_JOB( pcb_export_drill, _HKI( "PCB: Export drill data" ), KIWAY::FACE_PCB,
REGISTER_JOB( pcb_export_drill, _HKI( "PCB: Export Drill Data" ), KIWAY::FACE_PCB,
JOB_EXPORT_PCB_DRILL );
+16 -20
View File
@@ -34,37 +34,24 @@ public:
wxString GetDefaultDescription() const override;
wxString GetSettingsDialogTitle() const override;
wxString m_filename;
bool m_excellonMirrorY;
bool m_excellonMinimalHeader;
bool m_excellonCombinePTHNPTH;
bool m_excellonOvalDrillRoute;
enum class DRILL_FORMAT
{
EXCELLON,
GERBER
};
DRILL_FORMAT m_format;
enum class DRILL_ORIGIN
{
ABS,
PLOT
};
DRILL_ORIGIN m_drillOrigin;
enum class DRILL_UNITS
{
INCHES,
MILLIMETERS
INCH, // Do not use IN: it conflicts with a Windows header
MM
};
DRILL_UNITS m_drillUnits;
enum class ZEROS_FORMAT
{
DECIMAL,
@@ -73,8 +60,6 @@ public:
KEEP_ZEROS
};
ZEROS_FORMAT m_zeroFormat;
enum class MAP_FORMAT
{
POSTSCRIPT,
@@ -84,11 +69,22 @@ public:
PDF
};
MAP_FORMAT m_mapFormat;
public:
wxString m_filename;
int m_gerberPrecision;
bool m_excellonMirrorY;
bool m_excellonMinimalHeader;
bool m_excellonCombinePTHNPTH;
bool m_excellonOvalDrillRoute;
bool m_generateMap;
DRILL_FORMAT m_format;
DRILL_ORIGIN m_drillOrigin;
DRILL_UNITS m_drillUnits;
ZEROS_FORMAT m_zeroFormat;
MAP_FORMAT m_mapFormat;
int m_gerberPrecision;
bool m_generateMap;
};
#endif
+9 -10
View File
@@ -30,22 +30,21 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DXF::GEN_MODE,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_DXF::DXF_UNITS,
{
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::INCHES, "in" },
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_DXF::DXF_UNITS::MM, "mm" },
} )
JOB_EXPORT_PCB_DXF::JOB_EXPORT_PCB_DXF() :
JOB_EXPORT_PCB_PLOT( JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::DXF, "dxf", false ),
m_plotGraphicItemsUsingContours( true ),
m_polygonMode( true ),
m_dxfUnits( DXF_UNITS::INCHES ),
m_genMode( GEN_MODE::MULTI )
JOB_EXPORT_PCB_PLOT( JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::DXF, "dxf", false ),
m_plotGraphicItemsUsingContours( true ),
m_polygonMode( true ),
m_dxfUnits( DXF_UNITS::INCH ),
m_genMode( GEN_MODE::MULTI )
{
m_plotDrawingSheet = false;
m_params.emplace_back(
new JOB_PARAM<bool>( "plot_footprint_values", &m_plotFootprintValues, m_plotFootprintValues ) );
m_params.emplace_back( new JOB_PARAM<bool>( "plot_graphic_items_using_contours", &m_plotGraphicItemsUsingContours,
m_params.emplace_back( new JOB_PARAM<bool>( "plot_graphic_items_using_contours",
&m_plotGraphicItemsUsingContours,
m_plotGraphicItemsUsingContours ) );
m_params.emplace_back( new JOB_PARAM<DXF_UNITS>( "units", &m_dxfUnits, m_dxfUnits ) );
m_params.emplace_back( new JOB_PARAM<bool>( "polygon_mode", &m_polygonMode, m_polygonMode ) );
+4 -3
View File
@@ -37,8 +37,8 @@ public:
enum class DXF_UNITS
{
INCHES,
MILLIMETERS
INCH, // Do not use IN: it conflicts with a Windows header
MM
};
enum class GEN_MODE
@@ -47,11 +47,12 @@ public:
MULTI
};
public:
bool m_plotGraphicItemsUsingContours;
bool m_polygonMode;
DXF_UNITS m_dxfUnits;
GEN_MODE m_genMode;
GEN_MODE m_genMode;
};
#endif
+2 -14
View File
@@ -25,7 +25,6 @@
JOB_EXPORT_PCB_GERBER::JOB_EXPORT_PCB_GERBER( const std::string& aType ) :
JOB_EXPORT_PCB_PLOT( JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::GERBER, aType, false ),
m_subtractSolderMaskFromSilk( false ),
m_includeNetlistAttributes( true ),
m_useX2Format( true ),
m_disableApertureMacros( false ),
@@ -34,24 +33,13 @@ JOB_EXPORT_PCB_GERBER::JOB_EXPORT_PCB_GERBER( const std::string& aType ) :
{
m_plotDrawingSheet = false;
m_params.emplace_back( new JOB_PARAM<wxString>( "drawing_sheet",
&m_drawingSheet,
m_drawingSheet ) );
m_params.emplace_back( new JOB_PARAM<bool>( "plot_footprint_values",
&m_plotFootprintValues,
m_plotFootprintValues ) );
m_params.emplace_back( new JOB_PARAM<bool>( "subtract_solder_mask_from_silk",
&m_subtractSolderMaskFromSilk,
m_subtractSolderMaskFromSilk ) );
m_params.emplace_back( new JOB_PARAM<bool>( "include_netlist_attributes",
&m_includeNetlistAttributes,
m_includeNetlistAttributes ) );
m_params.emplace_back( new JOB_PARAM<bool>( "use_x2_format", &m_useX2Format, m_useX2Format ) );
m_params.emplace_back( new JOB_PARAM<bool>( "disable_aperture_macros", &m_disableApertureMacros,
m_params.emplace_back( new JOB_PARAM<bool>( "disable_aperture_macros",
&m_disableApertureMacros,
m_disableApertureMacros ) );
m_params.emplace_back( new JOB_PARAM<bool>( "use_protel_file_extension",
&m_useProtelFileExtension,
-1
View File
@@ -35,7 +35,6 @@ public:
wxString GetDefaultDescription() const override;
wxString GetSettingsDialogTitle() const override;
bool m_subtractSolderMaskFromSilk;
bool m_includeNetlistAttributes;
bool m_useX2Format;
bool m_disableApertureMacros;
+2 -7
View File
@@ -24,16 +24,11 @@
JOB_EXPORT_PCB_GERBERS::JOB_EXPORT_PCB_GERBERS() :
JOB_EXPORT_PCB_GERBER( "gerbers" ),
m_layersIncludeOnAll(),
m_layersIncludeOnAllSet( false ),
m_useBoardPlotParams( false ),
m_createJobsFile( true )
{
m_params.emplace_back( new JOB_PARAM<bool>( "layers_include_on_all_set", &m_layersIncludeOnAllSet,
m_layersIncludeOnAllSet ) );
m_params.emplace_back( new JOB_PARAM_LSEQ( "layers_include_on_all", &m_layersIncludeOnAll,
m_layersIncludeOnAll ) );
m_params.emplace_back( new JOB_PARAM<bool>( "create_gerber_job_file", &m_createJobsFile,
m_createJobsFile ) );
}
-3
View File
@@ -35,9 +35,6 @@ public:
wxString GetDefaultDescription() const override;
wxString GetSettingsDialogTitle() const override;
LSEQ m_layersIncludeOnAll;
bool m_layersIncludeOnAllSet;
bool m_useBoardPlotParams;
bool m_createJobsFile;
+17 -17
View File
@@ -25,8 +25,8 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS,
{
{ JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::INCHES, "in" },
{ JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MM, "mm" },
} )
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION,
@@ -36,18 +36,18 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION,
} )
JOB_EXPORT_PCB_IPC2581::JOB_EXPORT_PCB_IPC2581() :
JOB( "ipc2581", false ),
m_filename(),
m_drawingSheet(),
m_units( IPC2581_UNITS::MILLIMETERS ),
m_version( IPC2581_VERSION::C ),
m_precision( 6 ),
m_compress( false ),
m_colInternalId(),
m_colMfgPn(),
m_colMfg(),
m_colDistPn(),
m_colDist()
JOB( "ipc2581", false ),
m_filename(),
m_drawingSheet(),
m_units( IPC2581_UNITS::MM ),
m_version( IPC2581_VERSION::C ),
m_precision( 6 ),
m_compress( false ),
m_colInternalId(),
m_colMfgPn(),
m_colMfg(),
m_colDistPn(),
m_colDist()
{
m_params.emplace_back( new JOB_PARAM<wxString>( "drawing_sheet", &m_drawingSheet, m_drawingSheet ) );
m_params.emplace_back( new JOB_PARAM<IPC2581_UNITS>( "units", &m_units, m_units ) );
@@ -69,13 +69,13 @@ JOB_EXPORT_PCB_IPC2581::JOB_EXPORT_PCB_IPC2581() :
wxString JOB_EXPORT_PCB_IPC2581::GetDefaultDescription() const
{
return _( "Export IPC2581" );
return _( "Export IPC-2581" );
}
wxString JOB_EXPORT_PCB_IPC2581::GetSettingsDialogTitle() const
{
return _( "Export IPC2581 Job Settings" );
return _( "Export IPC-2581 Job Settings" );
}
@@ -88,5 +88,5 @@ void JOB_EXPORT_PCB_IPC2581::SetDefaultOutputPath( const wxString& aReferenceNam
SetConfiguredOutputPath( fn.GetFullName() );
}
REGISTER_JOB( pcb_export_ipc2581, _HKI( "PCB: Export IPC2581" ), KIWAY::FACE_PCB,
REGISTER_JOB( pcb_export_ipc2581, _HKI( "PCB: Export IPC-2581" ), KIWAY::FACE_PCB,
JOB_EXPORT_PCB_IPC2581 );
+13 -12
View File
@@ -36,8 +36,8 @@ public:
enum class IPC2581_UNITS
{
INCHES,
MILLIMETERS
INCH,
MM
};
enum class IPC2581_VERSION
@@ -46,20 +46,21 @@ public:
C
};
wxString m_filename;
wxString m_drawingSheet;
public:
wxString m_filename;
wxString m_drawingSheet;
IPC2581_UNITS m_units;
IPC2581_UNITS m_units;
IPC2581_VERSION m_version;
int m_precision;
int m_precision;
bool m_compress;
bool m_compress;
wxString m_colInternalId;
wxString m_colMfgPn;
wxString m_colMfg;
wxString m_colDistPn;
wxString m_colDist;
wxString m_colInternalId;
wxString m_colMfgPn;
wxString m_colMfg;
wxString m_colDistPn;
wxString m_colDist;
};
#endif
+53
View File
@@ -0,0 +1,53 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2025 Connor Goss <connor.goss@acroname.com>
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <jobs/job_export_pcb_ipcd356.h>
#include <jobs/job_registry.h>
#include <i18n_utility.h>
#include <wildcards_and_files_ext.h>
JOB_EXPORT_PCB_IPCD356::JOB_EXPORT_PCB_IPCD356() : JOB( "ipcd356", false ), m_filename()
{
}
wxString JOB_EXPORT_PCB_IPCD356::GetDefaultDescription() const
{
return _( "Export IPC-D-356" );
}
wxString JOB_EXPORT_PCB_IPCD356::GetSettingsDialogTitle() const
{
return _( "Export IPC-D-356 Job Settings" );
}
void JOB_EXPORT_PCB_IPCD356::SetDefaultOutputPath( const wxString& aReferenceName )
{
wxFileName fn = aReferenceName;
fn.SetExt( FILEEXT::IpcD356FileExtension );
SetConfiguredOutputPath( fn.GetFullName() );
}
REGISTER_JOB( pcb_export_ipcd356, _HKI( "PCB: Export IPC-D-356" ), KIWAY::FACE_PCB,
JOB_EXPORT_PCB_IPCD356 );
+40
View File
@@ -0,0 +1,40 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2025 Connor Goss <connor.goss@acroname.com>
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef JOB_EXPORT_PCB_IPCD356_H
#define JOB_EXPORT_PCB_IPCD356_H
#include <kicommon.h>
#include <wx/string.h>
#include "job.h"
class KICOMMON_API JOB_EXPORT_PCB_IPCD356 : public JOB
{
public:
JOB_EXPORT_PCB_IPCD356();
wxString GetDefaultDescription() const override;
wxString GetSettingsDialogTitle() const override;
void SetDefaultOutputPath( const wxString& aReferenceName );
wxString m_filename;
};
#endif
+8 -8
View File
@@ -24,8 +24,8 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_ODB::ODB_UNITS,
{
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::INCHES, "in" },
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_ODB::ODB_UNITS::MM, "mm" },
} )
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_ODB::ODB_COMPRESSION,
@@ -37,12 +37,12 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_ODB::ODB_COMPRESSION,
JOB_EXPORT_PCB_ODB::JOB_EXPORT_PCB_ODB() :
JOB( "odb", false ),
m_filename(),
m_drawingSheet(),
m_units( ODB_UNITS::MILLIMETERS ),
m_precision( 2 ),
m_compressionMode( ODB_COMPRESSION::ZIP )
JOB( "odb", false ),
m_filename(),
m_drawingSheet(),
m_units( ODB_UNITS::MM ),
m_precision( 2 ),
m_compressionMode( ODB_COMPRESSION::ZIP )
{
m_params.emplace_back( new JOB_PARAM<wxString>( "drawing_sheet", &m_drawingSheet, m_drawingSheet ) );
m_params.emplace_back( new JOB_PARAM<ODB_UNITS>( "units", &m_units, m_units ) );
+7 -6
View File
@@ -35,8 +35,8 @@ public:
enum class ODB_UNITS
{
MILLIMETERS,
INCHES,
MM,
INCH, // Do not use IN: it conflicts with a Windows header
};
enum class ODB_COMPRESSION
@@ -46,11 +46,12 @@ public:
TGZ,
};
wxString m_filename;
wxString m_drawingSheet;
public:
wxString m_filename;
wxString m_drawingSheet;
ODB_UNITS m_units;
int m_precision;
ODB_UNITS m_units;
int m_precision;
ODB_COMPRESSION m_compressionMode;
};
+12 -21
View File
@@ -44,28 +44,19 @@ JOB_EXPORT_PCB_PDF::JOB_EXPORT_PCB_PDF() :
{
m_plotDrawingSheet = false;
m_params.emplace_back( new JOB_PARAM<wxString>( "color_theme", &m_colorTheme, m_colorTheme ) );
m_params.emplace_back( new JOB_PARAM<bool>( "mirror", &m_mirror, m_mirror ) );
m_params.emplace_back(
new JOB_PARAM<bool>( "black_and_white", &m_blackAndWhite, m_blackAndWhite ) );
m_params.emplace_back( new JOB_PARAM<bool>( "negative", &m_negative, m_negative ) );
m_params.emplace_back( new JOB_PARAM<bool>( "plot_footprint_values", &m_plotFootprintValues,
m_plotFootprintValues ) );
m_params.emplace_back( new JOB_PARAM<bool>( "plot_pad_numbers", &m_plotPadNumbers, m_plotPadNumbers ) );
m_params.emplace_back( new JOB_PARAM<bool>( "plot_invisible_text", &m_plotInvisibleText,
m_plotInvisibleText ) );
m_params.emplace_back( new JOB_PARAM<bool>(
"sketch_pads_on_fab_layers", &m_sketchPadsOnFabLayers, m_sketchPadsOnFabLayers ) );
m_params.emplace_back(
new JOB_PARAM<DRILL_MARKS>( "drill_shape", &m_drillShapeOption, m_drillShapeOption ) );
m_params.emplace_back( new JOB_PARAM<wxString>( "color_theme",
&m_colorTheme, m_colorTheme ) );
m_params.emplace_back( new JOB_PARAM<bool>( "pdf_metadata", &m_pdfMetadata, m_pdfMetadata ) );
m_params.emplace_back( new JOB_PARAM<bool>( "single_document", &m_pdfSingle, m_pdfSingle ) );
m_params.emplace_back( new JOB_PARAM<bool>(
"front_fp_property_popups", &m_pdfFrontFPPropertyPopups, m_pdfFrontFPPropertyPopups ) );
m_params.emplace_back( new JOB_PARAM<bool>(
"back_fp_property_popups", &m_pdfBackFPPropertyPopups, m_pdfBackFPPropertyPopups ) );
m_params.emplace_back( new JOB_PARAM<GEN_MODE>( "pdf_gen_mode", &m_pdfGenMode, m_pdfGenMode ) );
m_params.emplace_back( new JOB_PARAM<bool>( "pdf_metadata",
&m_pdfMetadata, m_pdfMetadata ) );
m_params.emplace_back( new JOB_PARAM<bool>( "single_document",
&m_pdfSingle, m_pdfSingle ) );
m_params.emplace_back( new JOB_PARAM<bool>( "front_fp_property_popups",
&m_pdfFrontFPPropertyPopups, m_pdfFrontFPPropertyPopups ) );
m_params.emplace_back( new JOB_PARAM<bool>( "back_fp_property_popups",
&m_pdfBackFPPropertyPopups, m_pdfBackFPPropertyPopups ) );
m_params.emplace_back( new JOB_PARAM<GEN_MODE>( "pdf_gen_mode",
&m_pdfGenMode, m_pdfGenMode ) );
}
+65 -36
View File
@@ -20,48 +20,77 @@
#include <jobs/job_export_pcb_plot.h>
JOB_EXPORT_PCB_PLOT::JOB_EXPORT_PCB_PLOT( PLOT_FORMAT aFormat, const std::string& aType,
bool aOutputIsDirectory )
: JOB( aType, aOutputIsDirectory ),
m_plotFormat( aFormat ),
m_filename(),
m_colorTheme(),
m_drawingSheet(),
m_mirror( false ),
m_blackAndWhite( false ),
m_negative( false ),
m_sketchPadsOnFabLayers( false ),
m_hideDNPFPsOnFabLayers( false ),
m_sketchDNPFPsOnFabLayers( true ),
m_crossoutDNPFPsOnFabLayers( true ),
m_plotFootprintValues( true ),
m_plotRefDes( true ),
m_plotDrawingSheet( true ),
m_plotPadNumbers( false ),
m_plotInvisibleText( false ),
m_printMaskLayer(),
m_printMaskLayersToIncludeOnAllLayers(),
m_drillShapeOption( DRILL_MARKS::FULL_DRILL_SHAPE ),
m_useDrillOrigin( false )
bool aOutputIsDirectory ) :
JOB( aType, aOutputIsDirectory ),
m_plotFormat( aFormat ),
m_filename(),
m_colorTheme(),
m_drawingSheet(),
m_mirror( false ),
m_blackAndWhite( false ),
m_negative( false ),
m_sketchPadsOnFabLayers( false ),
m_hideDNPFPsOnFabLayers( false ),
m_sketchDNPFPsOnFabLayers( true ),
m_crossoutDNPFPsOnFabLayers( true ),
m_plotFootprintValues( true ),
m_plotRefDes( true ),
m_plotDrawingSheet( true ),
m_subtractSolderMaskFromSilk( false ),
m_plotPadNumbers( false ),
m_plotLayerSequence(),
m_plotOnAllLayersSequence(),
m_drillShapeOption( DRILL_MARKS::FULL_DRILL_SHAPE ),
m_useDrillOrigin( false )
{
m_params.emplace_back( new JOB_PARAM_LSEQ( "layers", &m_printMaskLayer, m_printMaskLayer ) );
m_params.emplace_back( new JOB_PARAM_LSEQ( "layers",
&m_plotLayerSequence, m_plotLayerSequence ) );
m_params.emplace_back( new JOB_PARAM_LSEQ( "layers_to_include_on_all_layers",
&m_printMaskLayersToIncludeOnAllLayers,
m_printMaskLayersToIncludeOnAllLayers ) );
&m_plotOnAllLayersSequence,
m_plotOnAllLayersSequence ) );
m_params.emplace_back( new JOB_PARAM<bool>( "mirror",
&m_mirror, m_mirror ) );
m_params.emplace_back( new JOB_PARAM<bool>( "black_and_white",
&m_blackAndWhite, m_blackAndWhite ) );
m_params.emplace_back( new JOB_PARAM<bool>( "negative",
&m_negative, m_negative ) );
m_params.emplace_back(
new JOB_PARAM<bool>( "plot_pad_numbers", &m_plotPadNumbers, m_plotPadNumbers ) );
m_params.emplace_back( new JOB_PARAM<bool>( "plot_invisible_text", &m_plotInvisibleText,
m_plotInvisibleText ) );
m_params.emplace_back( new JOB_PARAM<bool>( "plot_footprint_values",
&m_plotFootprintValues, m_plotFootprintValues ) );
m_params.emplace_back( new JOB_PARAM<bool>( "plot_ref_des",
&m_plotRefDes, m_plotRefDes ) );
m_params.emplace_back(
new JOB_PARAM<bool>( "plot_drawing_sheet", &m_plotDrawingSheet, m_plotDrawingSheet ) );
m_params.emplace_back( new JOB_PARAM<bool>( "hide_dnp_footprints_on_fab_layers",
&m_hideDNPFPsOnFabLayers,
m_hideDNPFPsOnFabLayers ) );
m_params.emplace_back( new JOB_PARAM<bool>( "sketch_dnp_footprints_on_fab_layers",
&m_sketchDNPFPsOnFabLayers,
m_sketchDNPFPsOnFabLayers ) );
m_params.emplace_back( new JOB_PARAM<bool>( "crossout_dnp_footprints_on_fab_layers",
&m_crossoutDNPFPsOnFabLayers,
m_crossoutDNPFPsOnFabLayers ) );
m_params.emplace_back( new JOB_PARAM<bool>( "plot_ref_des", &m_plotRefDes, m_plotRefDes ) );
m_params.emplace_back( new JOB_PARAM<bool>( "sketch_pads_on_fab_layers",
&m_sketchPadsOnFabLayers,
m_sketchPadsOnFabLayers ) );
m_params.emplace_back( new JOB_PARAM<bool>( "plot_pad_numbers",
&m_plotPadNumbers, m_plotPadNumbers ) );
m_params.emplace_back(
new JOB_PARAM<bool>( "use_drill_origin", &m_useDrillOrigin, m_useDrillOrigin ) );
m_params.emplace_back( new JOB_PARAM<bool>( "plot_drawing_sheet",
&m_plotDrawingSheet, m_plotDrawingSheet ) );
m_params.emplace_back(
new JOB_PARAM<wxString>( "drawing_sheet", &m_drawingSheet, m_drawingSheet ) );
m_params.emplace_back( new JOB_PARAM<bool>( "subtract_solder_mask_from_silk",
&m_subtractSolderMaskFromSilk,
m_subtractSolderMaskFromSilk ) );
m_params.emplace_back( new JOB_PARAM<bool>( "use_drill_origin",
&m_useDrillOrigin, m_useDrillOrigin ) );
m_params.emplace_back( new JOB_PARAM<DRILL_MARKS>( "drill_shape",
&m_drillShapeOption, m_drillShapeOption ) );
m_params.emplace_back( new JOB_PARAM<wxString>( "drawing_sheet",
&m_drawingSheet, m_drawingSheet ) );
}
+3 -3
View File
@@ -63,12 +63,12 @@ public:
bool m_plotFootprintValues;
bool m_plotRefDes;
bool m_plotDrawingSheet;
bool m_subtractSolderMaskFromSilk;
bool m_plotPadNumbers;
bool m_plotInvisibleText;
LSEQ m_printMaskLayer;
LSEQ m_plotLayerSequence;
///< Layers to include on all individual layer prints
LSEQ m_printMaskLayersToIncludeOnAllLayers;
LSEQ m_plotOnAllLayersSequence;
enum class DRILL_MARKS
{
+15 -15
View File
@@ -39,24 +39,24 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_POS::SIDE,
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_POS::UNITS,
{
{ JOB_EXPORT_PCB_POS::UNITS::INCHES, "in" },
{ JOB_EXPORT_PCB_POS::UNITS::MILLIMETERS, "mm" },
{ JOB_EXPORT_PCB_POS::UNITS::INCH, "in" },
{ JOB_EXPORT_PCB_POS::UNITS::MM, "mm" },
} )
JOB_EXPORT_PCB_POS::JOB_EXPORT_PCB_POS() :
JOB( "pos", false ),
m_filename(),
m_useDrillPlaceFileOrigin( true ),
m_smdOnly( false ),
m_excludeFootprintsWithTh( false ),
m_excludeDNP( false ),
m_negateBottomX( false ),
m_singleFile( false ),
m_nakedFilename( false ),
m_side( SIDE::BOTH ),
m_units( UNITS::MILLIMETERS ),
m_format( FORMAT::ASCII ),
m_gerberBoardEdge( true )
JOB( "pos", false ),
m_filename(),
m_useDrillPlaceFileOrigin( true ),
m_smdOnly( false ),
m_excludeFootprintsWithTh( false ),
m_excludeDNP( false ),
m_negateBottomX( false ),
m_singleFile( false ),
m_nakedFilename( false ),
m_side( SIDE::BOTH ),
m_units( UNITS::MM ),
m_format( FORMAT::ASCII ),
m_gerberBoardEdge( true )
{
m_params.emplace_back( new JOB_PARAM<bool>( "use_drill_place_file_origin",
&m_useDrillPlaceFileOrigin,
+15 -19
View File
@@ -35,16 +35,6 @@ public:
void SetDefaultOutputPath( const wxString& aReferenceName );
wxString m_filename;
bool m_useDrillPlaceFileOrigin;
bool m_smdOnly;
bool m_excludeFootprintsWithTh;
bool m_excludeDNP;
bool m_negateBottomX;
bool m_singleFile;
bool m_nakedFilename;
enum class SIDE
{
FRONT,
@@ -52,17 +42,12 @@ public:
BOTH
};
SIDE m_side;
enum class UNITS
{
INCHES,
MILLIMETERS
INCH, // Do not use IN: it conflicts with a Windows header
MM
};
UNITS m_units;
enum class FORMAT
{
ASCII,
@@ -70,9 +55,20 @@ public:
GERBER
};
FORMAT m_format;
public:
wxString m_filename;
bool m_gerberBoardEdge;
bool m_useDrillPlaceFileOrigin;
bool m_smdOnly;
bool m_excludeFootprintsWithTh;
bool m_excludeDNP;
bool m_negateBottomX;
bool m_singleFile;
bool m_nakedFilename;
SIDE m_side;
UNITS m_units;
FORMAT m_format;
bool m_gerberBoardEdge;
};
#endif
+4 -12
View File
@@ -30,23 +30,15 @@ NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_SVG::GEN_MODE,
JOB_EXPORT_PCB_SVG::JOB_EXPORT_PCB_SVG() :
JOB_EXPORT_PCB_PLOT( JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::SVG, "svg", false ),
m_pageSizeMode( 0 ),
m_fitPageToBoard( false ),
m_precision( 4 ),
m_genMode( GEN_MODE::SINGLE )
m_genMode( GEN_MODE::SINGLE ) // TODO change to MULTI for V10
{
m_plotDrawingSheet = true;
m_params.emplace_back( new JOB_PARAM<wxString>( "color_theme", &m_colorTheme, m_colorTheme ) );
m_params.emplace_back( new JOB_PARAM<bool>( "mirror", &m_mirror, m_mirror ) );
m_params.emplace_back(
new JOB_PARAM<bool>( "black_and_white", &m_blackAndWhite, m_blackAndWhite ) );
m_params.emplace_back( new JOB_PARAM<bool>( "negative", &m_negative, m_negative ) );
m_params.emplace_back( new JOB_PARAM<bool>(
"sketch_pads_on_fab_layers", &m_sketchPadsOnFabLayers, m_sketchPadsOnFabLayers ) );
m_params.emplace_back(
new JOB_PARAM<int>( "page_size_mode", &m_pageSizeMode, m_pageSizeMode ) );
m_params.emplace_back(
new JOB_PARAM<DRILL_MARKS>( "drill_shape", &m_drillShapeOption, m_drillShapeOption ) );
new JOB_PARAM<bool>( "fit_page_to_board", &m_fitPageToBoard, m_fitPageToBoard ) );
m_params.emplace_back( new JOB_PARAM<unsigned int>( "precision", &m_precision, m_precision ) );
m_params.emplace_back( new JOB_PARAM<GEN_MODE>( "gen_mode", &m_genMode, m_genMode ) );
}
@@ -64,4 +56,4 @@ wxString JOB_EXPORT_PCB_SVG::GetSettingsDialogTitle() const
}
REGISTER_JOB( pcb_export_svg, _HKI( "PCB: Export SVG" ), KIWAY::FACE_PCB, JOB_EXPORT_PCB_SVG );
REGISTER_JOB( pcb_export_svg, _HKI( "PCB: Export SVG" ), KIWAY::FACE_PCB, JOB_EXPORT_PCB_SVG );
+1 -1
View File
@@ -35,7 +35,7 @@ public:
wxString GetDefaultDescription() const override;
wxString GetSettingsDialogTitle() const override;
int m_pageSizeMode;
bool m_fitPageToBoard;
unsigned int m_precision;
enum class GEN_MODE
+2 -2
View File
@@ -129,8 +129,8 @@ JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aOutputIsDirectory ) :
}
JOB_EXPORT_SCH_PLOT_PDF::JOB_EXPORT_SCH_PLOT_PDF() :
JOB_EXPORT_SCH_PLOT( false )
JOB_EXPORT_SCH_PLOT_PDF::JOB_EXPORT_SCH_PLOT_PDF( bool aOutputIsDirectory ) :
JOB_EXPORT_SCH_PLOT( aOutputIsDirectory )
{
m_plotFormat = SCH_PLOT_FORMAT::PDF;
}
+1 -1
View File
@@ -103,7 +103,7 @@ public:
class KICOMMON_API JOB_EXPORT_SCH_PLOT_PDF : public JOB_EXPORT_SCH_PLOT
{
public:
JOB_EXPORT_SCH_PLOT_PDF();
JOB_EXPORT_SCH_PLOT_PDF( bool aOutputIsDirectory = true );
wxString GetDefaultDescription() const override;
wxString GetSettingsDialogTitle() const override;
};
+6 -6
View File
@@ -22,21 +22,21 @@
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_RC::UNITS, {
{ JOB_RC::UNITS::INCHES, "in" },
{ JOB_RC::UNITS::MILLIMETERS, "mm" },
{ JOB_RC::UNITS::INCH, "in" },
{ JOB_RC::UNITS::MM, "mm" },
{ JOB_RC::UNITS::MILS, "mils" },
} )
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_RC::OUTPUT_FORMAT,
{
{ JOB_RC::OUTPUT_FORMAT::REPORT, "report" },
{ JOB_RC::OUTPUT_FORMAT::JSON, "json" },
{ JOB_RC::OUTPUT_FORMAT::JSON, "json" },
} )
JOB_RC::JOB_RC( const std::string& aType )
: JOB( aType, false ),
JOB_RC::JOB_RC( const std::string& aType ) :
JOB( aType, false ),
m_filename(),
m_units( JOB_RC::UNITS::MILLIMETERS ),
m_units( JOB_RC::UNITS::MM ),
m_severity( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ),
m_format( OUTPUT_FORMAT::REPORT ),
m_exitCodeViolations( false )
+7 -8
View File
@@ -30,18 +30,13 @@ class KICOMMON_API JOB_RC : public JOB
public:
JOB_RC( const std::string& aType );
wxString m_filename;
enum class UNITS
{
INCHES,
MILLIMETERS,
INCH, // Do not use IN: it conflicts with a Windows header
MM,
MILS
};
UNITS m_units;
int m_severity;
enum class OUTPUT_FORMAT
{
@@ -49,7 +44,11 @@ public:
JSON
};
public:
wxString m_filename;
UNITS m_units;
int m_severity;
OUTPUT_FORMAT m_format;
bool m_exitCodeViolations;
bool m_exitCodeViolations;
};
+1 -1
View File
@@ -43,5 +43,5 @@ wxString JOB_SPECIAL_COPYFILES::GetDefaultDescription() const
}
REGISTER_JOB( special_copyfiles, _HKI( "Special: Copy files" ), KIWAY::KIWAY_FACE_COUNT,
REGISTER_JOB( special_copyfiles, _HKI( "Special: Copy Files" ), KIWAY::KIWAY_FACE_COUNT,
JOB_SPECIAL_COPYFILES );
+50 -51
View File
@@ -36,18 +36,19 @@
const int jobsFileSchemaVersion = 1;
KICOMMON_API std::map<JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO> JobsetOutputTypeInfos = {
{ JOBSET_OUTPUT_TYPE::FOLDER,
KICOMMON_API std::map<JOBSET_DESTINATION_T, JOBSET_DESTINATION_T_INFO> JobsetDestinationTypeInfos =
{
{ JOBSET_DESTINATION_T::FOLDER,
{ _HKI( "Folder" ), BITMAPS::small_folder, true, "" } },
{ JOBSET_OUTPUT_TYPE::ARCHIVE,
{ JOBSET_DESTINATION_T::ARCHIVE,
{ _HKI( "Archive" ), BITMAPS::zip, false, FILEEXT::ZipFileWildcard() } },
};
NLOHMANN_JSON_SERIALIZE_ENUM( JOBSET_OUTPUT_TYPE,
NLOHMANN_JSON_SERIALIZE_ENUM( JOBSET_DESTINATION_T,
{
{ JOBSET_OUTPUT_TYPE::FOLDER, "folder" },
{ JOBSET_OUTPUT_TYPE::ARCHIVE, "archive" }
{ JOBSET_DESTINATION_T::FOLDER, "folder" },
{ JOBSET_DESTINATION_T::ARCHIVE, "archive" }
} )
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_JOB& f )
@@ -79,44 +80,42 @@ KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_JOB& f )
}
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_OUTPUT& f )
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_DESTINATION& destination )
{
j = nlohmann::json{ { "id", f.m_id },
{ "type", f.m_type },
{ "only", f.m_only },
{ "description", f.m_description },
j = nlohmann::json{ { "id", destination.m_id },
{ "type", destination.m_type },
{ "only", destination.m_only },
{ "description", destination.m_description },
{ "settings", nlohmann::json::object( {} ) }
};
f.m_outputHandler->ToJson( j.at( "settings" ) );
destination.m_outputHandler->ToJson( j.at( "settings" ) );
}
KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_OUTPUT& f )
KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_DESTINATION& destination )
{
// During 9.0 development outputs didn't get ids.
if( j.contains( "id" ) )
j.at( "id" ).get_to( f.m_id );
j.at( "id" ).get_to( destination.m_id );
else
f.m_id = KIID().AsString();
destination.m_id = KIID().AsString();
j.at( "type" ).get_to( f.m_type );
f.m_only = j.value( "only", std::vector<wxString>() );
f.m_description = j.value( "description", "" );
j.at( "type" ).get_to( destination.m_type );
destination.m_only = j.value( "only", std::vector<wxString>() );
destination.m_description = j.value( "description", "" );
const nlohmann::json& settings_obj = j.at( "settings" );
f.InitOutputHandler();
destination.InitOutputHandler();
if( f.m_outputHandler != nullptr )
{
f.m_outputHandler->FromJson( settings_obj );
}
if( destination.m_outputHandler != nullptr )
destination.m_outputHandler->FromJson( settings_obj );
}
JOBSET_OUTPUT::JOBSET_OUTPUT() :
m_type( JOBSET_OUTPUT_TYPE::FOLDER ),
JOBSET_DESTINATION::JOBSET_DESTINATION() :
m_type( JOBSET_DESTINATION_T::FOLDER ),
m_outputHandler( nullptr ),
m_lastRunSuccess(),
m_lastRunReporters()
@@ -124,7 +123,7 @@ JOBSET_OUTPUT::JOBSET_OUTPUT() :
}
JOBSET_OUTPUT::JOBSET_OUTPUT( const wxString& id, JOBSET_OUTPUT_TYPE type ) :
JOBSET_DESTINATION::JOBSET_DESTINATION( const wxString& id, JOBSET_DESTINATION_T type ) :
m_id( id ),
m_type( type ),
m_outputHandler( nullptr ),
@@ -135,7 +134,7 @@ JOBSET_OUTPUT::JOBSET_OUTPUT( const wxString& id, JOBSET_OUTPUT_TYPE type ) :
}
JOBSET_OUTPUT::~JOBSET_OUTPUT()
JOBSET_DESTINATION::~JOBSET_DESTINATION()
{
for( auto& [name, reporter] : m_lastRunReporters )
delete reporter;
@@ -144,26 +143,26 @@ JOBSET_OUTPUT::~JOBSET_OUTPUT()
}
void JOBSET_OUTPUT::InitOutputHandler()
void JOBSET_DESTINATION::InitOutputHandler()
{
if( m_type == JOBSET_OUTPUT_TYPE::FOLDER )
if( m_type == JOBSET_DESTINATION_T::FOLDER )
{
m_outputHandler = new JOBS_OUTPUT_FOLDER();
}
else if( m_type == JOBSET_OUTPUT_TYPE::ARCHIVE )
else if( m_type == JOBSET_DESTINATION_T::ARCHIVE )
{
m_outputHandler = new JOBS_OUTPUT_ARCHIVE();
}
}
wxString JOBSET_OUTPUT::GetDescription() const
wxString JOBSET_DESTINATION::GetDescription() const
{
return m_description.IsEmpty() ? m_outputHandler->GetDefaultDescription() : m_description;
}
void JOBSET_OUTPUT::SetDescription( const wxString& aDescription )
void JOBSET_DESTINATION::SetDescription( const wxString& aDescription )
{
if( aDescription == m_outputHandler->GetDefaultDescription() )
m_description = wxEmptyString;
@@ -193,7 +192,7 @@ void JOBSET_JOB::SetDescription( const wxString& aDescription )
}
bool JOBSET_OUTPUT::operator==( const JOBSET_OUTPUT& rhs ) const
bool JOBSET_DESTINATION::operator==( const JOBSET_DESTINATION& rhs ) const
{
return rhs.m_type == m_type;
}
@@ -204,7 +203,7 @@ JOBSET::JOBSET( const wxString& aFilename ) :
m_dirty( false )
{
m_params.emplace_back( new PARAM_LIST<JOBSET_JOB>( "jobs", &m_jobs, {} ) );
m_params.emplace_back( new PARAM_LIST<JOBSET_OUTPUT>( "outputs", &m_outputs, {} ) );
m_params.emplace_back( new PARAM_LIST<JOBSET_DESTINATION>( "outputs", &m_destinations, {} ) );
m_fileNameWithoutPath = wxFileName( aFilename ).GetFullName();
}
@@ -223,21 +222,21 @@ void JOBSET::AddNewJob( wxString aType, JOB* aJob )
}
JOBSET_OUTPUT* JOBSET::AddNewJobOutput( JOBSET_OUTPUT_TYPE aType )
JOBSET_DESTINATION* JOBSET::AddNewDestination( JOBSET_DESTINATION_T aType )
{
m_outputs.emplace_back( KIID().AsString(), aType);
m_destinations.emplace_back( KIID().AsString(), aType );
SetDirty();
return &m_outputs.back();
return &m_destinations.back();
}
void JOBSET::RemoveOutput( JOBSET_OUTPUT* aOutput )
void JOBSET::RemoveDestination( JOBSET_DESTINATION* aDestination )
{
std::erase_if( m_outputs,
[&]( JOBSET_OUTPUT const& output )
std::erase_if( m_destinations,
[&]( JOBSET_DESTINATION const& destination )
{
return output.m_id == aOutput->m_id;
return destination.m_id == aDestination->m_id;
} );
}
@@ -281,35 +280,35 @@ bool JOBSET::SaveToFile( const wxString& aDirectory, bool aForce )
}
JOBSET_OUTPUT* JOBSET::GetOutput( wxString& aOutput )
JOBSET_DESTINATION* JOBSET::GetDestination( wxString& aDestination )
{
auto it = std::find_if( m_outputs.begin(), m_outputs.end(),
[&]( const JOBSET_OUTPUT& output )
auto it = std::find_if( m_destinations.begin(), m_destinations.end(),
[&]( const JOBSET_DESTINATION& destination )
{
if( output.m_id == aOutput )
if( destination.m_id == aDestination )
return true;
return false;
} );
if( it != m_outputs.end() )
if( it != m_destinations.end() )
return &(*it);
return nullptr;
}
std::vector<JOBSET_JOB> JOBSET::GetJobsForOutput( JOBSET_OUTPUT* aOutput )
std::vector<JOBSET_JOB> JOBSET::GetJobsForDestination( JOBSET_DESTINATION* aDestination )
{
wxASSERT( aOutput != nullptr );
wxASSERT( aDestination != nullptr );
if( aOutput->m_only.size() == 0 )
if( aDestination->m_only.size() == 0 )
{
return m_jobs;
}
std::vector<JOBSET_JOB> result;
for( wxString& onlyId : aOutput->m_only )
for( wxString& onlyId : aDestination->m_only )
{
auto it = std::find_if( m_jobs.begin(), m_jobs.end(),
[&]( const JOBSET_JOB& job )
@@ -330,5 +329,5 @@ std::vector<JOBSET_JOB> JOBSET::GetJobsForOutput( JOBSET_OUTPUT* aOutput )
#if !defined( __MINGW32__ )
template class KICOMMON_API PARAM_LIST<JOBSET_JOB>;
template class KICOMMON_API PARAM_LIST<JOBSET_OUTPUT>;
template class KICOMMON_API PARAM_LIST<JOBSET_DESTINATION>;
#endif
+24 -22
View File
@@ -55,13 +55,13 @@ struct KICOMMON_API JOBSET_JOB
};
enum class KICOMMON_API JOBSET_OUTPUT_TYPE
enum class KICOMMON_API JOBSET_DESTINATION_T
{
FOLDER,
ARCHIVE
};
struct KICOMMON_API JOBSET_OUTPUT_TYPE_INFO
struct KICOMMON_API JOBSET_DESTINATION_T_INFO
{
wxString name;
BITMAPS bitmap;
@@ -69,21 +69,22 @@ struct KICOMMON_API JOBSET_OUTPUT_TYPE_INFO
wxString fileWildcard;
};
extern KICOMMON_API std::map<JOBSET_OUTPUT_TYPE, JOBSET_OUTPUT_TYPE_INFO> JobsetOutputTypeInfos;
extern KICOMMON_API
std::map<JOBSET_DESTINATION_T, JOBSET_DESTINATION_T_INFO> JobsetDestinationTypeInfos;
struct KICOMMON_API JOBSET_OUTPUT
struct KICOMMON_API JOBSET_DESTINATION
{
JOBSET_OUTPUT();
JOBSET_DESTINATION();
JOBSET_OUTPUT( const wxString& id, JOBSET_OUTPUT_TYPE type );
JOBSET_DESTINATION( const wxString& id, JOBSET_DESTINATION_T type );
~JOBSET_OUTPUT();
~JOBSET_DESTINATION();
void InitOutputHandler();
wxString m_id;
JOBSET_OUTPUT_TYPE m_type;
JOBSET_DESTINATION_T m_type;
wxString m_description;
JOBS_OUTPUT_HANDLER* m_outputHandler;
std::vector<wxString> m_only;
@@ -96,7 +97,7 @@ struct KICOMMON_API JOBSET_OUTPUT
std::unordered_map<wxString, std::optional<bool>> m_lastRunSuccessMap;
std::unordered_map<wxString, REPORTER*> m_lastRunReporters;
bool operator==( const JOBSET_OUTPUT& rhs ) const;
bool operator==( const JOBSET_DESTINATION& rhs ) const;
};
@@ -113,11 +114,11 @@ public:
return m_jobs;
}
std::vector<JOBSET_JOB> GetJobsForOutput( JOBSET_OUTPUT* aOutput );
std::vector<JOBSET_JOB> GetJobsForDestination( JOBSET_DESTINATION* aDestination );
std::vector<JOBSET_OUTPUT>& GetOutputs() { return m_outputs; }
std::vector<JOBSET_DESTINATION>& GetDestinations() { return m_destinations; }
JOBSET_OUTPUT* GetOutput( wxString& aOutput );
JOBSET_DESTINATION* GetDestination( wxString& aDestination );
bool SaveToFile( const wxString& aDirectory = "", bool aForce = false ) override;
@@ -127,9 +128,9 @@ public:
wxString GetFullName() const { return m_fileNameWithoutPath; }
void AddNewJob( wxString aType, JOB* aJob );
JOBSET_OUTPUT* AddNewJobOutput( JOBSET_OUTPUT_TYPE aType );
JOBSET_DESTINATION* AddNewDestination( JOBSET_DESTINATION_T aType );
void RemoveOutput( JOBSET_OUTPUT* aOutput );
void RemoveDestination( JOBSET_DESTINATION* aDestination );
void MoveJobUp( size_t aJobIdx );
void MoveJobDown( size_t aJobIdx );
void RemoveJob( size_t aJobIdx );
@@ -138,25 +139,26 @@ protected:
wxString getFileExt() const override;
private:
std::vector<JOBSET_JOB> m_jobs;
std::vector<JOBSET_OUTPUT> m_outputs;
std::vector<JOBSET_JOB> m_jobs;
std::vector<JOBSET_DESTINATION> m_destinations;
bool m_dirty;
wxString m_fileNameWithoutPath;
bool m_dirty;
wxString m_fileNameWithoutPath;
};
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_JOB& f );
KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_JOB& f );
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_OUTPUT& f );
KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_OUTPUT& f );
KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_DESTINATION& f );
KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_DESTINATION& f );
#if defined( __MINGW32__ )
template class KICOMMON_API PARAM_LIST<struct JOBSET_JOB>;
template class KICOMMON_API PARAM_LIST<struct JOBSET_OUTPUT>;
template class KICOMMON_API PARAM_LIST<struct JOBSET_DESTINATION>;
#else
extern template class APIVISIBLE PARAM_LIST<JOBSET_JOB>;
extern template class APIVISIBLE PARAM_LIST<JOBSET_OUTPUT>;
extern template class APIVISIBLE PARAM_LIST<JOBSET_DESTINATION>;
#endif
#endif
+1 -1
View File
@@ -85,7 +85,7 @@ wxString LayerName( int aLayer )
case LAYER_RULE_AREAS: return _( "Rule areas" );
case LAYER_DEVICE: return _( "Symbol body outlines" );
case LAYER_DEVICE_BACKGROUND: return _( "Symbol body fills" );
case LAYER_SHAPES_BACKGROUND: return _( "Shape fills" );
case LAYER_SHAPES_BACKGROUND: return _( "Shape fills" );
case LAYER_NOTES: return _( "Schematic text && graphics" );
case LAYER_PRIVATE_NOTES: return _( "Symbol private text && graphics" );
case LAYER_NOTES_BACKGROUND: return _( "Schematic text && graphics backgrounds" );
+6 -6
View File
@@ -82,12 +82,12 @@ void NUMERIC_EVALUATOR::SetDefaultUnits( EDA_UNITS aUnits )
{
switch( aUnits )
{
case EDA_UNITS::MILLIMETRES: m_defaultUnits = Unit::MM; break;
case EDA_UNITS::MILS: m_defaultUnits = Unit::Mil; break;
case EDA_UNITS::INCHES: m_defaultUnits = Unit::Inch; break;
case EDA_UNITS::DEGREES: m_defaultUnits = Unit::Degrees; break;
case EDA_UNITS::UNSCALED: m_defaultUnits = Unit::SI; break;
default: m_defaultUnits = Unit::MM; break;
case EDA_UNITS::MM: m_defaultUnits = Unit::MM; break;
case EDA_UNITS::MILS: m_defaultUnits = Unit::Mil; break;
case EDA_UNITS::INCH: m_defaultUnits = Unit::Inch; break;
case EDA_UNITS::DEGREES: m_defaultUnits = Unit::Degrees; break;
case EDA_UNITS::UNSCALED: m_defaultUnits = Unit::SI; break;
default: m_defaultUnits = Unit::MM; break;
}
}
+11 -2
View File
@@ -466,7 +466,7 @@ LSEQ LSET::SeqStackupForPlotting() const
}
LSET& LSET::Flip( int aCopperLayersCount )
LSET& LSET::FlipStandardLayers( int aCopperLayersCount )
{
LSET oldMask = *this;
@@ -495,6 +495,8 @@ LSET& LSET::Flip( int aCopperLayersCount )
{
if( oldMask.test( pair.first ) )
set( pair.second );
oldMask.set( pair.first, false );
}
if( aCopperLayersCount >= 4 )
@@ -511,6 +513,12 @@ LSET& LSET::Flip( int aCopperLayersCount )
}
}
oldMask.ClearCopperLayers();
// Copy across any remaining, non-side-specific layers
for( PCB_LAYER_ID layer : oldMask )
set( layer );
return *this;
}
@@ -695,7 +703,8 @@ LSET LSET::SideSpecificMask()
LSET LSET::ForbiddenFootprintLayers()
{
static const LSET saved = InternalCuMask();
static LSET saved = InternalCuMask();
saved.set( In1_Cu, false );
return saved;
}

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