Commit Graph

186 Commits

Author SHA1 Message Date
Jeff Young 129042f8a6 Convert timestamps to UUIDs. 2020-02-20 21:29:52 +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 f17f10d2a6 Eeschema, DIALOG_UPDATE_FIELDS: ensure mandatory fields are put in list.
Add also a comment in common.cpp about using wxLocale instead of setlocale.

DIALOG_UPDATE_FIELDS has issues in non English languages, due to its design.
The fix for mandatory fields is only a partial fix that avoid major issues.
2020-02-14 13:07:13 +01:00
jean-pierre charras feab56f6e7 LOCALE_IO: replace the call to setlocale by a call to wxLocale to switch to "C" locale.
Previously we call only setlocale( xx, "C" ), but it was not enough on Windows.
Now we call wxLocale("C")
wxLocale calls setlocale, but also make some others initialization in wxWidgets.
It fixes some issues related to comma versus point as fp separator.
Especially wxWidgets warnings are no longer thrown, and a one case of incorrect
conversion is fixed.
2020-02-11 16:19:00 +01:00
Jon Evans fe375b4419 Allow sheet pins to be strong drivers if they don't conflict with anything
Also try harder to match bus members in case one was renamed by a higher
priority label.

Fixes https://gitlab.com/kicad/code/kicad/issues/3797
2020-02-05 14:23:55 +00:00
Jeff Young 1bdcb33f75 Handle error returns from lstat. 2020-01-13 20:16:42 +00:00
Ian McInerney f896043067 Fix comments for switch statement fall throughs
This cleans up all GCC warnings (-Wimplicit-fallthrough=2) about
implicitly falling through switch cases.
2020-01-11 19:16:32 +00:00
Seth Hillbrand 49e3542662 Remove unused common defines 2020-01-06 05:55:06 -08:00
Seth Hillbrand 850ca98e7b Remove outdated RoundTo0
With internal units in 100nm, there are no rounding errors when
representing mm coordinates in eeschema.
2020-01-06 05:15:14 -08:00
Ian McInerney 18dbe51d66 Remove WINCE check
We don't actually support Win CE
2019-12-17 15:38:38 +00:00
Mark Roszko bf32122134 common: Remove out of bounds and erroenous array access 2019-12-17 14:10:52 +00:00
John Beard 6b4b2d61f8 Common: do not conditionally define wxPoint/Size operator<<
Due to an interaction with old (<1.59) versions of Boost, the ostream
operator<< for wxPoint and wxSize is requried to use
BOOST_CHECK_EQUAL_COLLECTIONS (the print_log_value<T> function is not
used by this macro until 1.59).

Because these functions are available in Debug builds, unit tests that
use such functions will break when compiled as Release or
RelWithDebugInfo.

The change here is to not disable these functions in Release builds.

Also, the functions are moved to common.h, to go with other generic
WX "polyfill" functions. Although they might be commonly used by the
EDA_ITEM::Show functions, they are not specifically related to that
class.

Fixes: lp:1830612
* https://bugs.launchpad.net/kicad/+bug/1830612
2019-05-28 13:52:36 +01:00
Ian McInerney 9e6e9d0910 Replace remaining Boost mutexs with std::mutex
CHANGED: Replaced all MUTEX types with std::mutex
         Replaced all MUTLOCK types with std::lock_guard
2019-05-03 17:13:20 -07:00
Seth Hillbrand 2048114512 Reduce chance for wxPoint hash collision
Hash collisions reduce the speed of unordered maps by increasing the
comparison time of underlying values.  This implements the inverse
golden ration offset into the x value to ensure that consecutive points
are far from each other in the map.
2019-04-09 20:40:04 -07:00
Seth Hillbrand 257d9b5fe9 Allow setting the kicad config dir
This allows setting the config dir at build time, providing packagers a
method of controlling where the configuration files are placed.

Fixes: lp:1780601
* https://bugs.launchpad.net/kicad/+bug/1780601
2019-04-08 12:33:49 -07:00
jean-pierre charras a1ee5405aa Fix missing definition of std::hash<wxPoint> when using wxWidgets 3.1.x
it was not compiled for wxWidgets 3.1.x, but it does not exist in 3.1.x
2019-03-14 17:33:25 +01:00
Wayne Stambaugh aef0221d3b Replace isdigit() with wxIsdigit() when testing wxString characters.
This is a continuation of commit 8a03025a.  All known instances of
using isdigit() to test a character in a wxString have been replaced
by wxIsdigit().
2019-03-14 09:47:14 -04:00
Wayne Stambaugh 47492f9452 Coding policy fixes in common/common.cpp. 2019-01-15 12:23:26 -05:00
Wayne Stambaugh 69d90a4e84 Do not set wxSetAssertHandler on non-debug builds.
Fixes lp:1809622

https://bugs.launchpad.net/kicad/+bug/1809622
2019-01-15 09:29:33 -05:00
Maciej Suminski ad07b4a251 Added an explanation for using wxFileConfig in GetNewConfig() 2018-12-29 19:22:07 +01:00
John Beard e919ded35f Use wxFileConfig, not wxConfig
The wrong class is called for the ctor of the wxConfigBase - this should
be a wxFileConfig, just like the bare new used to be.

Fixes: lp:1810002
* https://bugs.launchpad.net/kicad/+bug/1810002
2018-12-29 08:16:40 -05:00
Maciej Suminski 24f9bfa13b Fixed memory leaks
This is commit a9efbf47 with a fix for SWIG to deal with unique_ptr.
2018-12-20 10:05:58 +01:00
Seth Hillbrand e307d9318b Revert "Fixed memory leaks"
This reverts commit a9efbf4716.

The commit broke compiles with scripting
2018-12-11 10:12:44 -08:00
Maciej Suminski a9efbf4716 Fixed memory leaks 2018-12-11 16:21:43 +01:00
jean-pierre charras 4b44cbe695 Kicad, Windows specific: disable a overzealous wxWidgets assert when reading a file.
When reading (and writing) a file, we must switch the current locale to "C" for LC_NUMERIC.
Unfortunately, on Windows, a wxWidgets assert was shown when reading some items (bitmaps images).
This wxWidgets assert (related to decimal separator) is overzealous and is now hidden only when reading/writing files.
2018-10-27 19:59:18 +02:00
Jeff Young 0bd0558833 Auto-select reference numbers in PcbNew like we do in Eeschema. 2018-10-14 00:06:41 +01:00
jean-pierre charras de793aa43d Fix a side effect of our LOCALE_IO by using setlocale( LC_NUMERIC, "C" ) instead of setlocale( LC_ALL, "C" )
LC_NUMERIC is the right option to use in LOCALE_IO because only the floating point separator must be modified
When using LC_ALL, the Env var expansion wxGetEnv() was not working when the env var contains non ascii7 codes after a call to LOCALE_IO.
When using setlocale( LC_NUMERIC, "C" ) in LOCALE_IO, wxGetEnv() works fine.

Fixes: lp:1795990
https://bugs.launchpad.net/kicad/+bug/1795990
2018-10-07 16:26:10 +02:00
Jeff Young bc2481a9be Don't leak file descriptors. 2018-08-21 19:44:42 +01:00
Jeff Young f6f1c1e944 Performance optimization for MSW directory time-stamping. 2018-08-08 20:07:26 +02:00
Jeff Young 80f713f366 Revert accidental commit. 2018-08-08 12:51:31 +01:00
Jeff Young d63d0c40ef Performance optimisation for MSW direcotry timestamping. 2018-08-07 20:16:25 +01:00
Wayne Stambaugh bbfce129bb Fix windows build error. 2018-08-06 10:26:22 -04:00
Jeff Young be1d6113d6 More performance enhancements.
Be more intelligent about sorting lib tree items.  (Footprint
entries, for instance, come out of an already-sorted list.)

Don't recreate menus twice when laoding Footprint Editor.

More pervasive use of WX_FILENAME to avoid expensive calls to
wxFileName::SplitPath() and string concatenation.

For POSIX kernels do all the work on the file-system side so we
don't have to keep converting back and forth between encodings.
2018-08-06 13:49:27 +01:00
jean-pierre charras c32fcd1403 Fix commit f3f814e622 that breaks the compilation on Windows.
Fiw also a minor compil warning
2018-08-04 17:18:15 +02:00
Jeff Young 345f57ccb8 Fix bug in optimization of wxExpandEnvVars.
Fixes: lp:1785228
* https://bugs.launchpad.net/kicad/+bug/1785228
2018-08-04 11:29:24 +01:00
Jeff Young f3f814e622 Performance enhancements for footprint info list.
Cache the footprint info on disk (in the project).
Move timestamp-generation (and checking) to the filesystem so the
above will be bullet-proof.
Rewrite some wxWidgets classes for performance (see common.h).
2018-08-04 10:29:17 +01:00
Jeff Young f8a5e2c1c8 Performance enhancements in fp loading, string cmp, etc.
Knocks about 1/3 off the first footprint load, and more than 1/2
off subsequent loads.
2018-08-01 09:35:46 +01:00
Jeff Young d5e88f574f Clean up units infrastructure after g_UserUnit removal.
Fixes: lp:1538239
* https://bugs.launchpad.net/kicad/+bug/1538239

(cherry picked from commit 96d7178)
2018-07-17 15:12:36 +01:00
Wayne Stambaugh 5c5b74b29e Fix user configuration path bug on Linux.
Recent versions of wxWidgets wxStandardPaths::GetUserConfigDir() correctly
append ".config" on Linux build which was incorrect as the current code
already appended it to the path.  Add a check to see if ".config" is the
last path and append as required.

Check for XDG_CONFIG_HOME environment variable on all platforms not just
Linux.

Fixes lp:1769145

https://bugs.launchpad.net/kicad/+bug/1769145
2018-05-07 18:23:41 -04:00
Steven A. Falco e0ca5bab11 Fix comment typo.
Comment has XDG_CONFIG_HOME, but it should be KICAD_CONFIG_HOME.
2018-05-04 08:28:48 -07:00
Wayne Stambaugh a7528df198 Allow for multiple user configurations.
Use KICAD_CONFIG_HOME environment variable on all platforms so users can
maintain multiple configurations of KiCad.
2018-04-26 08:29:37 -04:00
jean-pierre charras e57435c0fc Fix compil issue (created by commit "Added std::less specialization for wxPoint") with wxWidgets 3.1.1 2018-04-13 11:06:46 +02:00
Maciej Suminski b766dbc7a4 Added std::less specialization for wxPoint
Requried to use wxPoint as key type in maps
2018-04-12 18:09:18 +02:00
Jeff Young 4693fd6200 Resolve env vars when looking up documentation files.
Fixes: lp:1729276
* https://bugs.launchpad.net/kicad/+bug/1729276
2018-03-08 23:51:10 +00:00
jean-pierre charras 5d72aebd22 Fix code after renaming files 2018-01-29 16:40:22 +01:00
jean-pierre charras 1f78de409f Define "template<> struct hash<wxString>" in Kicad only if wxWidgets version < 3.1.0, because it is already defined in 3.1.0 2017-12-18 09:53:14 +01:00
Maciej Suminski 812b8b081d Implemented std::hash<wxString> specialization
Thanks to that wxString objects can be stored in certain
STL containers, e.g. unordered_map.
2017-12-17 18:45:40 +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
Henner Zeller 3f57fa5d24 Change time_t in the functions that deal with timestamps to a new typedef timestamp_t (defined as a long).
that makes sure the c++ side and swigged Python side agree on the type, because time_t create problems in Python scripts.
2017-12-07 13:16:33 +01:00
John Beard 5aa1610362 Remove unused g_ShowPageLimits global variable
This variable was only defined, not declared in any header.
2017-03-23 12:47:05 -04:00