Commit Graph

32 Commits

Author SHA1 Message Date
Jeff Young 9b61b350fe Don't commit changes on paint events or updateUI events.
Also use std::numeric_limits::epsilon for comparing doubles.

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

(cherry picked from commit d714ff8549)
2023-03-04 00:10:39 +00:00
Jeff Young c216ed2d1f Make SME prop-grid hack Mac-only.
Fixes https://gitlab.com/kicad/code/kicad/issues/13852

(cherry picked from commit dcba555d44)
2023-03-02 14:59:57 +00:00
Jeff Young b3c6f559b2 Don't eval empty string.
Fixes https://gitlab.com/kicad/code/kicad/issues/13756

(cherry picked from commit 79f13ea9c7)
2023-02-26 23:14:40 +00:00
Jeff Young 4aba595b2b Add second instance of "don't mess up user formatting" fix.
Fixes https://gitlab.com/kicad/code/kicad/issues/13989

(cherry picked from commit 4b427b2d0c)
2023-02-26 22:00:20 +00:00
Jeff Young eccf9eb4a4 Change strategy for committing values from SIM_MODEL propGrid.
Note that the PCB editor's propGrid doesn't seem to need this workaround,
but I haven't yet figured out what's different between it and the sim model
propGrid.

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

(cherry picked from commit c188318174)
2023-02-24 20:47:22 +00:00
Jeff Young 39403fa885 Cleanup some dead code, and add a potentially needed fix for non-Mac.
(The Mac bug is fixed in 4e5b1da81fce7cd9ffedaec878ed07bfcfff4fe2 in
our wxWidgets fork.)

(cherry picked from commit 200a06a677)
2023-02-24 20:47:22 +00:00
Jeff Young 5e7cc30564 Don't mess up user formatting if eval'ing didn't actually change value.
Fixes https://gitlab.com/kicad/code/kicad/issues/13989

(cherry picked from commit 8059edff0e)
2023-02-24 20:47:22 +00:00
Jeff Young 7f6cb9b07b Remove most of SIM_VALUE in favour of good old wxString.
This allows us to save the user's intent, including units, formatting,
and crucially variable references.

(cherry picked from commit 68fe146861)
2023-02-24 20:47:22 +00:00
Jeff Young 572c10b2c4 If we don't recognize a var then it's an error, not 0.0. 2022-12-27 13:50:44 +00:00
Jeff Young 39a23fa9bc Only eval numeric properties.
Fixes https://gitlab.com/kicad/code/kicad/issues/13201
2022-12-27 13:50:44 +00:00
Jeff Young cbb70f0da1 Formatting and CLang-Tidy warning reduction. 2022-12-19 13:51:49 +00:00
Jeff Young 8324c0b0cc Fix event order bugs in Sim Model Editor dialog.
onParamGridChanged was firing before CommitPendingChanges which meant
the edited value didn't get saved if the editor was still open when
OK was clicked.
2022-12-17 22:33:00 +00:00
Jeff Young b7d41e0e56 Update simulator with NUMERIC_EVAL, decimal separator processing, etc.
Also includes fixes for instance data and resolving of textvar
references.

Also includes virtual d'tors for IBIS parser to get rid of all the
compile warnings on CLang.

Fixes https://gitlab.com/kicad/code/kicad/issues/12357
2022-12-05 12:40:29 +00:00
jean-pierre charras b9ac486000 simulator: remove unused includes, and reorder a few includes to fix conflicts
Conflicts happen only on msys2 with wxWidgets 3.0. But this minor reorder
allows me to test Kicad compilation with "old" wxWidgets, used on Linux.
2022-11-16 10:09:54 +01:00
jean-pierre charras 7c9f3981ef Revert "Reorder includes is some simulator files to fix issues on msys2 (no code change)"
This reverts commit 78e45fa1b9.
Looks like it creates a compil issue on MSVC
2022-11-12 20:47:36 +01:00
jean-pierre charras 78e45fa1b9 Reorder includes is some simulator files to fix issues on msys2 (no code change)
Due to pegtl.hpp included in some files, reordering include fix some conflicts:
wxWidgets files must be included before pegtl.hpp, to compile with wxWidgets 3.0
I sometimes use wxWidgets 3.0 for debugging purposes.
2022-11-12 19:54:26 +01:00
Mikolaj Wielgus fef6eaa8ba Sim Model Editor: Don't use shared_ptr to hack around lifetimes 2022-11-12 03:15:27 +01:00
Mikolaj Wielgus e8762da4f4 Revert "Support for variable references in SPICE models."
This reverts commit 95ebfeeed1.
This reverts commit 672ce650a9.
2022-11-07 19:37:40 +01:00
Jeff Young 95ebfeeed1 Support for variable references in SPICE models.
Also fixes a couple of bugs where sheet instance data wasn't being
handled correctly.
2022-11-07 10:57:34 +00:00
Jeff Young 9eef638f0b Don't validate on keystrokes.
KiCad policy is to validate on focus-loss so that you can make changes
which have intermediate states that are not valid.
2022-10-31 14:09:30 +00:00
Mikolaj Wielgus c857e533a9 Sim: Fix crash when a field tries to set an inexistent parameter
Refactored SetParamValue() and friends to use exceptions instead of
return values.
2022-10-12 04:27:48 +02:00
Mikolaj Wielgus e4865ce543 Excise wxString from simulation 2022-09-22 07:41:52 +02:00
Mikolaj Wielgus 4ae2225b6d Sim: Replace all wxStrings with std::strings in SIM_VALUE 2022-09-16 06:11:14 +02:00
Mikolaj Wielgus 91358dfcac Sim Model Editor: Fix Enable/Disable of parameters
Only SIM_STRING_PROPERTY-based parameters were updated.
2022-09-11 15:24:16 +02:00
Marek Roszko ae637296cd Fix MSVC compile 2022-08-30 07:24:58 -04:00
Mikolaj Wielgus bd6c153ad9 Sim: Implement "enum" model parameters for switches
Displayed in Sim Model Dialog parameter grid as a dropdown
(wxEnumProperty).
2022-08-30 09:45:49 +02:00
jean-pierre charras 488a53e71b Fix a few minor Coverity warnings 2022-08-12 10:51:36 +02:00
Mikolaj Wielgus 7cf5138c63 Sim: Bugfixes, mostly for MS Windows compilation errors
Unfortunately, Windows headers define a lot of macros for common words,
so we had to rename some enums to not collide.

We also fix some of the many bugs related to the new simulation
architecture and the Spice Model Editor dialog.
2022-07-30 02:25:34 +00:00
Mikolaj Wielgus 739b9255d9 Sim Model Editor improvements
- Tab-switching,
- Automatic expansion of categories on tab-switch,
- Various minor simulation improvements,
- Various new simulation-related bugfixes.
2022-07-30 02:25:34 +00:00
Mikolaj Wielgus 6450ec6b85 Sim: Spice netlist exporter rewrite
Rewrite the spice exporter to work with the new simulation model
architecture and data model, with many bugfixes related to the latter
two along the way.
2022-07-30 02:25:34 +00:00
Mikolaj Wielgus ce84a48037 Sim: Implement loading Spice library files
Implement parsing and loading Spice libraries into KiCad. This is done
without any involvement of Ngspice -- we create our own in-tree parser
using PEGTL -- because Ngspice doesn't offer any intermediate output we
could plug ourselves into. We don't parse everything -- just the library
content, so this won't be that much effort.

We implement some basic Spice code preview to give the user a hint what
Spice code eir model will correspond to.
2022-07-30 02:25:34 +00:00
Mikolaj Wielgus 978f01553b Sim Model Editor: Serialize models in fields
Implemented serialization and deserialization of models in symbol fields
through the SIM_VALUE class. We don't carry the Spice legacy of
case-insensitive suffixes, instead we conform to the SI standard (i.e. M
is Mega, not milli, P is peta, p is pico).

Parameter grid value validation is implemented by simply not allowing
any characters that will make the value invalid (instead of highlighting
the field in a red color). This will likely be changed at some point in
the future.
2022-07-30 02:25:34 +00:00