Commit Graph

218 Commits

Author SHA1 Message Date
Jeff Young 27b047ab3f Cache project text vars as properties in the PCB board file.
Fixes https://gitlab.com/kicad/code/kicad/issues/5255

Fixes https://gitlab.com/kicad/code/kicad/issues/5005
2020-08-19 19:32:20 +01:00
Jon Evans 4dbbe1cf68 Project settings fixes from review
- Fix file extension for new project
- Fixes for exceptions on MSW
- Fix some ASAN issues
- Allow SETTINGS_MANAGER to run headless
- Don't flag schematic as modified after schematic setup is closed
- Don't automatically unload projects when LoadProject is called
- Don't unload project if it's the same as the current one
- Make sure to properly init/de-init template field names
2020-07-02 22:08:54 -04:00
Wayne Stambaugh 169f63a6c0 Eeschema: make schematic sharing truly safe across all designs.
There has been a long standing (since the beginning of the project?)
issue with sharing schematics between projects.  It has been somewhat
supported for complex hierarchies (a sheet shared multiple times in a
single design) but it has not been well supported for simple hierarchies
(the symbol references cannot be changed in the shared schematic).  This
issue has been resolved by moving all of the symbol instance sheet paths
from the symbol definitions in the all of the project files and save all
symbol path instances in the root sheet.  This ensures that orphaned
symbol instance paths do not accumulate in shared schematic files and
that designs that reuse schematic in simple hierarchies can how have
different references.  It also allows the root schematic from one project
to be uses as a sub-sheet in another project.

When legacy schematics are loaded, all sheet and symbol UUIDs are
converted from time stamps to true UUIDs.  This is done to ensure there
are no sheet path instance clashes between projects.  That being said,
there are no checks for this.  It is assumed that the probability of
UUID clashes is so low that it doesn't make sense to test for them.
2020-05-04 12:40:03 +00:00
jean-pierre charras 6d16762df9 Better python scripting compatibility. 2020-04-21 12:46:22 +02:00
Jeff Young cc9ac37a0e Add text variable support to envVar processing. 2020-04-05 20:52:26 +01:00
Jeff Young 3047cf5419 Fix Linux compile issue. 2020-03-30 17:35:11 +01:00
Jeff Young 4990d1e7b2 Variable substitution framework.
This implements editing of variables and moving SCH_FIELDs,
TEXTE_MODULEs, TEXTE_PCB and worksheet items over to the new
framework.
2020-03-30 14:15:59 +01:00
Jeff Young ea025a35e5 Change KUUID to KIID. 2020-02-21 22:20:42 +00:00
Jon Evans e8e3b4f11e Rename UUID to KUUID to fix MSVC build
Also add another newly-required boost flag
2020-02-20 22:07:17 -05:00
Jon Evans cd86dd516c Fix signed vs unsigned warnings 2020-02-20 18:54:45 -05:00
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 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
Ian McInerney 6b8d81e95d Add zone area to message panel
ADDED: Area of zone fill is displayed in the message panel

Fixes https://gitlab.com/kicad/code/kicad/issues/2412
2020-02-05 09:44:53 +00:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
Seth Hillbrand 49e3542662 Remove unused common defines 2020-01-06 05:55:06 -08:00
Seth Hillbrand 84048262bd Descope KB defines
The 3d viewer is the last component to not use the action framework, so
we descope the common defines to its canvas.  Once the 3d viewer is
converted, we can remove these entirely.
2020-01-06 05:43:18 -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
Mark Roszko 11ff16be4e Switch to scoped enums 2019-12-20 14:11:39 +00:00
Seth Hillbrand 857355d537 Fix return mixup in previous commit 2019-09-04 16:15:46 -07:00
Seth Hillbrand ac0df06312 Fix compile issue with wx inline asm
The wxAssert compile path on msw includes inline assembly which is
illegal for constexpr routines.  This replaces the wxAssert with
wxLogDebug as suggested by Ian
2019-09-04 15:37:21 -07:00
Seth Hillbrand c8a6878eb8 pcbnew: Allow tuning length to be longer than INT_MAX
The INT_MAX limit for most elements makes sense only for single-segment,
straight line elements.  For elements that accumulate lengths, we should
utilize the long long int (64 bits) to allow for greater lengths.

Fixes: lp:1842367
* https://bugs.launchpad.net/kicad/+bug/1842367
2019-09-03 16:41:09 -07:00
Seth Hillbrand 5151cd0bfe C++14: Remove unused make_unique.h
Also removes header references now that we are in C++14, this is
built-in to the std
2019-08-07 09:27:31 -07:00
Seth Hillbrand d650cca088 Enforcing rational limits on length tuner
The length tuning dialog needed validators on close to prevent negative
and percentages >100%

Fixes: lp:1834734
* https://bugs.launchpad.net/kicad/+bug/1834734

(cherry picked from commit 3974c6fd89)
2019-06-29 09:38:27 -07: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
jean-pierre charras 175a2bc0b4 Force time stamp to 32 bits unsigned values, and make it tolerant to files using 64 bits values.
define timestamp_t as uint32_t.

Fixes: lp:1821476
https://bugs.launchpad.net/kicad/+bug/1821476
2019-03-26 14:28:14 +01: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
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
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 c8a89ee25a Remove dead code. 2018-09-27 13:17:48 +02: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 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 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
Jeff Young eacaa39aa2 Remove global units usage from GetSelectionText...
... and GetMsgPanelInfo.

Step 4 in the g_UserUnit eradication effort.

Also removes a couple of conversion routines that were close
enough to extinction.

(cherry picked from commit c75da51)
2018-07-17 15:11:09 +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
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
Seth Hillbrand 0f3fc4b6eb Avoid doubling-up std namespace 2018-04-12 09:38:45 -07: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 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
jean-pierre charras bfc3804115 Minor fixes related to timestamp_t. Move timestamp_t definition to base_struct.h 2017-12-07 13:33:59 +01: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
Tomasz Włostowski 81d1e17f02 refactoring: renamed pcbstruct.h to pcb_display_options.h, DISPLAY_OPTIONS->PCB_DISPLAY_OPTIONS 2017-11-03 20:02:06 +01:00
John Beard f723a5319c Move some unit related util function to base_units.h 2017-03-23 12:47:05 -04:00
John Beard e98ae3e463 Move executable name constants to own file
The executable name constants are only used by two files, they do not
have to be in common.h.

Also converted to const wxString for better type-safety and removed
old-style wxT macros.
2017-03-23 09:23:45 -04:00
John Beard ece7eeb280 Move SystemDirsAppend to own header
This function is called only from three sites, it doesn't need to be in
common.h.

The implementation was already in systemdirsappend.cpp, so a matching
header was created for it.

This reduces the visibility of the function to only the files that need
it and slightly shrinks common.h.
2017-03-23 09:23:45 -04:00