Commit Graph

280 Commits

Author SHA1 Message Date
Jeff Young d69ebfae49 Push tool framework base down into TOOL_HOLDER.
This allows us to use it outside of EDA_BASE_FRAMEs (in this case, in
PANEL_PREVIEW_3D.)
2020-03-24 19:00:25 +00:00
Jeff Young 93b7eacfb2 Fixup some Coverity issues. 2020-03-21 16:32:22 +00:00
jean-pierre charras 0f0b9bdf87 SIM_PLOT_FRAME_BASE: gives a minimal size for right panels.
On KDE, a too small size can hang wxWidgets.
2020-03-17 08:27:34 +01:00
jean-pierre charras b7cd0c54c2 Fix compil issues, especially on Windows:
Replace SEVERITY_ERROR by RPT_SEVERITY_ERROR to avoid collision with a system definition.
Replace other SEVERITY_XXX by RPT_SEVERITY_XX for consistency.
Fix compil warnings and some other compil issues.
2020-03-04 10:48:18 +01:00
Jeff Young 85c2e0d23a Add user-defined severities, exclusions and colors to DRC markers.
Exclusions are currently persisted in the project file.

Fixes https://gitlab.com/kicad/code/kicad/issues/1989
2020-03-04 00:39:28 +00:00
Jon Evans e59a3d981e Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme

Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
2020-02-19 23:44:56 -05:00
jean-pierre charras 0e51ed32f9 ADDED: Sim plot panel: option to plot on a white background or a black background. 2020-02-01 18:20:18 +01:00
Ian McInerney 0d017e262c Update documentation and comment 2020-01-22 08:47:14 +00:00
Simon Richter f87dc08801 Readd <config.h> to ngspice.cpp
This file should really be included first from any source file, because it
contains platform specific workarounds.

This also groups includes a bit by source.
2020-01-22 08:38:45 +00:00
Jeff Young 384ff2539a Fix uninitialized variables. 2020-01-21 09:29:33 +00:00
Ian McInerney 00e58cd974 Fix unintialized values (from coverity scan) 2020-01-12 13:00:42 +00:00
Jonatan Liljedahl 4378290094 Fix menu string capitalization for simulator Dotted Current/Phase 2020-01-07 19:45:44 +00:00
Jonatan Liljedahl f433037dcd Eeschema: simulator: allow dotted traces for current and phase.
ADD: Allow drawing of current and phase traces with dotted style
for easier differentiation from voltage and magnitude. The option
is available in the View menu of the simulator.
2020-01-07 19:45:44 +00:00
Jonatan Liljedahl 90d2ea5dd5 Eeschema: simulator: add keyboard shortcuts for add signal, etc
(cherry picked from commit bc4caa8913ceff15391f6347a9edb8acbc60172e)
2019-12-11 04:34:22 +00:00
Seth Hillbrand c6f5df134c Minor speed cleanup
This adjusts iterators to use const reference when only used for
copy.  It also ensures pre-allocation of vectors when size is known
ahead of time.
2019-12-05 14:20:59 -08:00
Seth Hillbrand b5f021ff9f Cleanup: Replace push_back with emplace_back
In cases where we create a new item and immediately push into a
container, the emplace idiom is faster and more efficient.
2019-12-05 13:41:21 -08:00
Jonatan Liljedahl 7c7d9c3e3f Eeschema: simulator plot: allow standard mac pan and pinch to zoom 2019-11-25 09:24:31 -05:00
jean-pierre charras c5290de6ec housekeeping:
Remove not used files:
- markdown2html is not used (we are using "Sundown" tool)
- newstroke_font_without_CJK.cpp is removed.
Due to code optimization the full font works fine without memory issues
-fix also a few very minor compil warnings
2019-11-16 09:39:36 +01:00
Jonatan Liljedahl fa14d5b9fa Eeschema: simulator: more trace colors, smarter color allocation
NEW: The simulator plot now avoids colors already in use, if possible.
The palette is replaced with a larger one with less saturated colors.

Fixes: lp:1851372
* https://bugs.launchpad.net/kicad/+bug/1851372
2019-11-11 17:20:56 +00:00
Sylwester Kocjan 1c01cc001d eeschema: fixed recognizing SPICE sim directive 2019-10-20 12:08:01 -07:00
Adam Wolf c7c49cee5a Add additional ngspice codemodel path for launching from standalone eeschema on macOS. 2019-10-04 13:41:50 -04:00
Jeff Young 67915b6a96 Add a warning message for attempting to current probe a subckt.
Fixes: lp:1843159
* https://bugs.launchpad.net/kicad/+bug/1843159
2019-09-12 14:45:01 +01:00
Jeff Young a25368cc6b Improve spelling.
The groundwork here is thanks to kunda1.

Fixes: lp:1831510
* https://bugs.launchpad.net/kicad/+bug/1831510
2019-08-20 19:14:05 +01:00
Jeff Young 23d824de66 Simulator improvements.
1) Add highlighting to simProbe and simTune tools.
2) Probe tool should accept wires and pins, not wires and components.
3) Give simulator window a flat look to match rest of Kicad.
4) Collapse whitespace out of simulator window.
5) Add some error messages.
6) Add some whitespace to simulation setting dialog.
2019-08-05 16:48:18 -06:00
Jeff Young 97d70d7844 Fix cursor bugs in simulation.
1) cancel simProbe or simTune when simulator window closed
2) handle non-stock cursors through SetCurrentCursor()

Fixes: lp:1833583
* https://bugs.launchpad.net/kicad/+bug/1833583
2019-08-04 16:25:36 -06:00
Simon Richter 05353049b5 Pull in macro definition for strncasecmp on MSVC 2019-07-17 08:10:47 -04:00
jean-pierre charras d92396341e Simulation: do not add .save V(0) and/or .save V(GND) to ngspice.
These 2 nets are internally added by ngspice (info from Holger Vogt)
2019-07-07 17:55:43 +02:00
jean-pierre charras bc27b0ed5f Sim spice: fix unescaped netnames in spice netlist and simulator dialogs.
Net names in eeschema that include '/' are escaped ('/' replaced by "{slash}")
Escaped netnames are only for internal use, and must be unescaped in spice netlist and dialogs.
2019-06-09 17:48:01 +02:00
Jeff Young 568c8c336b Move DRC control to a tool; move assorted commands to ACTIONS. 2019-06-03 21:08:30 +01:00
Jeff Young 39b91c90dd Moved more operations to ACTIONs. 2019-06-01 23:03:24 +01:00
Jon Evans 5287ab6e4f Eeschema: improve simulator behavior for two-source DC analysis
Fixes: lp:1830478
* https://bugs.launchpad.net/kicad/+bug/1830478

(cherry picked from commit 356ccd0314)
2019-05-27 18:23:56 -04:00
jean-pierre charras 6cdde97e6f ngspice dll search: add auxiliary search paths on Linux, like on other platforms 2019-04-15 11:04:59 +02:00
jean-pierre charras 6d4fbcd5bb SIM_PLOT_FRAME_BASE: very minor fix. 2019-04-15 10:13:47 +02:00
jean-pierre charras ad5a1fd963 SIM_PLOT_FRAME: cosmetic enhancement: add icons in main menu.
Fix also Upeer/lower case issues in main menu strings.
2019-04-14 15:31:46 +02:00
Jeff Young d8cc2f8280 More cleanup from non-reference return from GetText(). 2019-04-03 19:35:25 +01:00
John Beard 6f1c3f5ef8 Eeschema: construct simulator cursors on demand
Statically constructing wxCursors as used for the probe
and tune cursors crashes the qa_eagle_plugin test
instantly.

Fix this by introducing a new class CURSOR_STORE,
which allows to abstract the platform wierdness of wxCursors
and allow the simulator to laziliy init its own cursors
at runtime.

This code isn't properly tested, as these cursors are never
actually used. However, it does allow the eeschema unit test
to run.

Fixes: lp:1781191
* https://bugs.launchpad.net/kicad/+bug/1781191
2019-04-02 18:26:33 +01:00
Maciej Suminski b445b0fab2 Link eeschema with ngspice DLL
Adds a link-time dependency for libngspice, so that other tools may
detect ngspice as a KiCad dependency.

The library is still loaded with dlopen() as it gives a way to reload it
in case of problems. The DLL name is recognized during CMake
configuration and used to load the library at runtime.
2018-10-30 08:32:38 +01:00
Stefan Brüns d1db2c7621 Use fixed version for libngspice.so.0
CanonicalizeName only adds the lib prefix and .so suffix, so loading
libngspice.so fails until the development package is installed.
MAC/Windows code paths lookup soversion 0 of ngspice as well, as this
is the only compatible version.
2018-10-27 10:20:09 +02:00
Maciej Suminski 85ef058458 Spice simulator: change gain units to dBV 2018-09-22 19:05:04 +02:00
jean-pierre charras e750382e75 Fix a few wxWidgets minor asserts 2018-07-29 17:27:11 +02:00
Jeff Young 7841f8a466 Unified preferences dialog framework.
(cherry picked from commit 8ee3e77)
2018-07-17 15:11:17 +01:00
Carsten Schoenert 9f7109826d fix misspelled 'allows to' -> 'allows one to'
Fixup small grammar issues around used 'allows to ...' almost in
code comments.
2018-07-11 10:35:03 -04:00
jean-pierre charras da392728d4 spice_value.cpp: replace std::invalid_argument by KI_PARAM_ERROR (replacement forgotten in commit a288d6199)
see commit a288d6199 for the reasons of this replacement.
2018-06-05 16:07:47 +02:00
jean-pierre charras a288d6199e Add KI_PARAM_ERROR, similar to std::invalid_argument but using wxString instead of std::string to throw errors.
std::invalid_argument does not work fine with translated strings as argument for message.
(the translated message is incorrectly or not displayed if it contains non ascii8 chars, at least on Windows).
KI_PARAM_ERROR can be throw-ed with a translatable/translated string (a wxString)
2018-06-05 13:29:51 +02:00
Wayne Stambaugh 7343e78347 Fix some Coverity uninitialized field warnings.
Fixes Coverity CIDs:

- 175824
- 169337
- 163191
- 175827
- 175440
- 175438
- 157136
2018-06-04 13:48:57 -04:00
Marco Ciampa 2cb65f9c19 Make the Simulator error strings translatable 2018-05-28 14:51:10 +02:00
Maciej Suminski 61597db12d Make the Simulator dialog strings translatable 2018-05-25 11:24:25 +02:00
Maciej Suminski 9960416e32 Spice simulator: plot currents in DC sweep simulation
Fixes: lp:1767457
* https://bugs.launchpad.net/kicad/+bug/1767457
2018-04-28 01:14:00 +02:00
Maciej Suminski 539d12b08f Spice simulator: more elegant approach to generating Spice device names
Code fixing Spice device names (prefixing reference with a character
corresponding to the assigned device model type) that was duplicated in
a few places has been moved to a function (NETLIST_EXPORTER_PSPICE::GetSpiceDevice()).
2018-04-28 01:14:00 +02:00
jean-pierre charras 502bed083d Fix a minimal size for the spice simulator frame.
For an obscure reason, the minimal frame size fixed in EDA_BASE_FRAME was not working.
2018-04-27 20:35:23 +02:00
jean-pierre charras a9dd5b5335 Sim spice fix: the frame size was not the last stored size (like for other frames) but a default fixed value.
The frame size (and its subframes) is now the last used.
2018-04-27 18:33:13 +02:00
Maciej Suminski e3a06dca70 Fallback to system ngspice library when libngspice is not found in other paths on macOS 2018-04-19 14:48:31 +02:00
Maciej Suminski 4526f40fe1 ngspice: add extra paths to search for libngspice
The main purpose of the patch is to load libngspice from macOS bundle.
There are also some additional paths that could make Windows developers
easier.

Fixes: lp:1630675
* https://bugs.launchpad.net/kicad/+bug/1630675
2018-04-19 11:43:29 +02:00
Maciej Suminski a8ef222517 ngspice: keep the ngspice DLL handle as an automatic variable 2018-04-19 11:44:48 +02:00
Maciej Suminski cb2c447c23 Spice Simulator: add close buttons to plot tabs
Fixes: lp:1761902
* https://bugs.launchpad.net/kicad/+bug/1761902
2018-04-07 22:53:50 +02:00
Maciej Suminski 058f2bffd0 Spice simulator: safety check 2018-03-22 18:20:02 +01:00
Maciej Suminski bad462a228 Spice simulator: reload ngSpice dll on error
ngSpice frequently ends up a simulation with an error:
"Error: ngspice.dll cannot recover and awaits to be detached"
The only way forward is to reload the shared library and
reinitialize ngSpice.

Fixes: lp:1753101
* https://bugs.launchpad.net/kicad/+bug/1753101
2018-03-21 18:01:38 +01:00
Maciej Suminski 61e42ba392 Spice simulator: changed NGSPICE instance type to shared_ptr
It was yet another time when I tried to free a singleton pointer.
Let's make clear it is not meant to be freed manually.
2018-03-21 18:01:38 +01:00
Maciej Suminski 50053e7f27 Spice simulator: code formatting 2018-03-21 18:01:38 +01:00
Maciej Suminski 33620ecc85 Revert "libngspice is linked at compile time"
This reverts commit 75f8b20493.
In case of problems, ngspice demands to be detached which is not
possible when it is linked at compile time.
2018-03-21 18:01:38 +01:00
Tomasz Włostowski 919b449595 Added 'show spice netlist' menu option in the simulator
Fixes: lp:1745887
* https://bugs.launchpad.net/kicad/+bug/1745887
2018-03-03 17:38:28 +01:00
jean-pierre charras af1281433b fix minor compil warning 2018-02-18 21:22:16 +01:00
Jeff Young b3884669cf Proper error reporting for Annotate dialog.
Also fixes:
- forcing the annotation scope to "full schematic" when run
  as a prerequisite to Generate Netlist.

- a long-standing bug where displaying extra items in a dialog
  would mess up the height of the HTML_REPORT_PANEL (becasue
  we were setting the html window's height rather than its
  parent flexgrid.

- initializing the annotation radio buttons to safe values
  (full schematic and keep existing)

Fixes: lp:1750062
* https://bugs.launchpad.net/kicad/+bug/1750062
2018-02-18 15:08:24 -05:00
Jeff Young 1afbfad44a Use "..." uniformly in menus.
See the bug report for some wording changes and a couple of
menu restructurings that were also cleaned up.

Fixes: lp:1597827
* https://bugs.launchpad.net/kicad/+bug/1597827
2018-02-10 17:32:28 -05:00
jean-pierre charras 8022f1cc01 fix code after renamin files 2018-01-30 11:49:51 +01:00
Chris Pavlina c5b2ad9595 simulator: DPI-independent default size 2018-01-06 22:23:58 -07:00
Dan Weatherill 0dcf95ee1a automatically add extension to sim workbook files
CHANGED: When a workbook file is saved from the simulation dialog
in eeschema, the extension is automatically added if it is not
specified. This behaviour is consistent with the workbook loading
dialog, which filters the filelist for only ".wbk" files with no
"all files" option.
2018-01-06 12:04:53 -05:00
Mark Roszko b98cc0b937 Some coverity fixes 2018-01-05 22:51:03 -07:00
Christian Jacobsen ff4829eee6 Added a validity check in SIM_PLOT_PANEL::IsGridShown()
Fixes: lp:1712086
* https://bugs.launchpad.net/kicad/+bug/1712086
2017-12-18 09:34:25 +01:00
Simon Richter a9ccf1161b Fix quotes in UI messages
This replaces all single and angle bracket quotes in UI messages with
double quotes, for consistency.

Sorry to all translators.
2017-12-15 07:33:07 -05:00
Maciej Suminski 33cf082c41 Fixed library path resolution in Spice netlist exporter
SEARCH_STACK is a deprecated method for getting the list of paths where
one could look for a file. Instead it tries the project path and
environmental variables.
2017-11-19 11:38:57 +01:00
Wayne Stambaugh 652b969193 GTK+ file dialog wildcard improvements.
The GTK+ file dialog is case sensitive however it does support regular
expressions.  Most of the file dialog wildcards are lower case so only
files with the lower case extensions will show up in the file dialog.
This code adds a method to convert file extensions of any case to the
appropriate (sch -> [sS][cC][hH]) regular expression on GTK+ builds so
all file extension case combinations will show up in the file dialog.

A note to developers: make sure to add a file extension when setting
when setting the default file argument.  If you do don't set an
extension, the GTK+ file dialog will happily append the regular
expression as the file extension which is surely not what you want.

There are still a few known places (mostly gerbview) where there are
some complex wildcard code that has not been converted.

Fixes lp:1720542

https://bugs.launchpad.net/kicad/+bug/1720542
2017-11-11 19:32:26 -05:00
Wayne Stambaugh 36f6d4a1f4 Convert symbol library editor over to use symbol library table.
Simplify some of the library editing code.  There have been a few minor
changes in the behavior of the editor.  If the current symbol is deleted
from the library, the next symbol in the library is not loaded.  The
deleted symbol is cleared and the current symbol is empty.

Change component to symbol to align with the preferred terminology
discussed on the developer's mailing list.

Add separate update UI event for save library as to enable the menu entry
whenever a library is selected.

Change the select symbol list dialog to a single column using the LIB_ID
format LIB_NICKNAME:LIB_ITEM_NAME so that the selection can be parsed by
LIB_ID.

Add method to expand URI to LIB_TABLE_BASE.

Override wxApp::OnExceptionInMainLoop() in debug builds to make debugging
easier when an unhandled exception occurs in a wxUpdateUIEvent handler.

Change SCH_SCREENS::HasNoFullyDefinedLibIds() to return false when the
schematic has no symbols to prevent the remapping dialog from being run.

Use SCH_COMPONENT part reference when creating netlist rather than looking
up the library symbol.
2017-11-09 18:50:20 -05:00
Tomasz Włostowski b945d2a708 cleanup: replace CLASS_MIRE with CLASS_PCB_TARGET for naming clarity 2017-11-03 20:02:06 +01:00
jean-pierre charras 1466d0cee6 Fix a few doxygen warnings 2017-06-18 09:18:41 +02:00
Maciej Suminski 2018d48946 Fixed removal order in SIM_PLOT_PANEL::DeleteTrace() 2017-06-16 23:17:34 +02:00
Wayne Stambaugh 66e97fa905 Doxygen comment improvements.
Fix lots of Doxygen warnings.

Fix Doxygen comment for IO_MGR::FootprintEnumerate() which was recently
changed.
2017-06-13 19:47:46 -04:00
Chris Pavlina ef12f0bcbc Fix warning: shadowed wxWindow::IsShown in sim_plot_panel.h 2017-03-19 09:18:28 -04:00
Chris Pavlina bfa22c6ce8 Fix warning: uninitialized constant in sim_plot_panel.h 2017-03-19 09:18:23 -04:00
Maciej Suminski d7e1152aa3 Correct way of freeing memory in NGSPICE class
Strings created with strdup() should be deleted using free(), not
delete.
2017-03-01 13:56:24 +01:00
Jon Evans a52250a91e Change from EDA_COLOR_T to COLOR4D globally; arbitrary color support
eeschema now supports arbitrary colors for all object types, and
pcbnew does in GAL canvas.  When switching from GAL to legacy canvas,
pcbnew will convert colors to the nearest legacy color.
2017-02-22 17:35:00 +01:00
jean-pierre charras 54c5f6bbb0 Simulator frame: fix a min size for panels, and now stores in config the position and size of the frame and panels 2016-12-02 15:34:23 +01:00
Marco Inacio c6cbc9ec95 Fixes: lp:1646224 (Simulation: small tune field)
https://bugs.launchpad.net/kicad/+bug/1646224
2016-12-02 08:58:01 +01:00
Maciej Suminski af3d5befa7 Solve codemodel libraries loading problem in ngspice
Fixes: lp:1630675
* https://bugs.launchpad.net/kicad/+bug/1630675
2016-10-17 10:11:27 +02:00
Maciej Suminski 26ee676278 Handle Spice_Netlist_Enabled attribute in Spice netlist exporter
Fixes: lp:1630502
* https://bugs.launchpad.net/kicad/+bug/1630502
2016-10-07 16:50:47 +02:00
jean-pierre charras 673b094b2b Fix a few missing override qualifiers and shadowed vars. 2016-09-27 10:58:05 +02:00
Maciej Suminski 9e587a1ea2 Fixed an assertion in SIM_PLOT_FRAME
wxListCtrl cannot have wxLC_REPORT and wxLC_SMALL_ICON enabled at the same time (Windows)
2016-09-22 18:27:56 +02:00
jean-pierre charras 0719f8d214 Fixes: lp:1624659 (fix some issues in countries which are not using a point as decimal separator)
https://bugs.launchpad.net/kicad/+bug/1624659
Small enhancement in dialog_spice_model_base.cpp: add comments about spice values notation.
2016-09-17 18:34:44 +02:00
jean-pierre charras 48f916bd63 Kicad manger: add .cir netlist files to the list of files to show in project tree.
Simulator: open/save worbook file dialog: the dialog opens the current project folder by default.
2016-09-17 09:34:16 +02:00
jean-pierre charras cd94da7972 Spice simulator and netlist generation: use only netnames (outdated option "use net numbers as net names removed" removed)
netlist generation: remove option "replace IC and U ref by X" (broken option).
All component refs are now prefixed by the Spice_Primitive field value.
Therefore the netlist used by Kicad ngsipce simulator and the spice netlist generated from dialog are the same.
(note: like previously, forbidden chars like ( and ) are replaced by _ in netnames)
2016-09-16 20:36:19 +02:00
Maciej Suminski fcedef836a Revert "Do not use double component primitives in Spice netlist exporter"
This commit creates more issues than resolves. It could happen that
there are components with different reference types (e.g. U1 and IC1)
that would be later converted to X1, causing a conflict.
2016-08-31 11:51:17 +02:00
Maciej Suminski 81e015036e Fixes for drawing color labels in simulator's signal list 2016-08-30 14:25:59 +02:00
Maciej Suminski 67573f15be Do not use double component primitives in Spice netlist exporter
Fixes: lp:1617768
* https://bugs.launchpad.net/kicad/+bug/1617768
2016-08-30 14:25:56 +02:00
Johannes Maibaum b87bac22c7 Simulator: Fix probe and tune cursors on OSX. 2016-08-30 10:48:40 +02:00
jp-charras 26b1c732de Simulator: add simulator icon, and colored icons to identify more easily traces in trace list and cursor list. 2016-08-29 11:39:54 +02:00
jean-pierre charras 7e3aedda82 Slightly modify the way DIALOG_SIM_SETTINGS m_settingsDlg is created in SIM_PLOT_FRAME frame: for an obscure reason, if it is created in ctor SIM_PLOT_FRAME, m_settingsDlg has an annoying issue on Windows: when shown, the parent SIM_PLOT_FRAME is sent to the background. When created outside the ctor, this issue is gone. 2016-08-20 19:51:33 +02:00
jean-pierre charras 2456db3817 Simulator: Make a few strings translatable. 2016-08-20 17:37:51 +02:00
Maciej Suminski 42f6cf33a1 Unbind REPORTER from NGSPICE before deleting 2016-08-19 16:39:46 +02:00
Maciej Suminski fe30985742 Do not delete the NGSPICE singleton 2016-08-19 16:33:31 +02:00
Maciej Suminski 2a6b8f153b NGSPICE as a singleton
One cannot call ngSpice_Init() twice without unloading the dll. When calling
ngSpice_Init, we pass a pointer to a NGSPICE instance and thus it cannot be changed.
When any of the callback function is called with a stale pointer everything crashes.
2016-08-19 15:51:19 +02:00