Commit Graph

214 Commits

Author SHA1 Message Date
Marek Roszko 1167862c86 Split wx_filename out of common 2020-10-25 20:01:13 -04:00
Marek Roszko 14c18b7e64 Move ui functions out of common and into ui_common 2020-10-25 20:01:12 -04:00
Marek Roszko e928b2d8fd Split EDA_UNITS out from common. 2020-10-25 00:02:52 -04:00
Marek Roszko 64484f5fc4 Split KIID out of common.h 2020-10-24 00:17:08 -04:00
Marek Roszko 304e5faf36 Move wxStringSplit to kicad_string 2020-10-24 00:17:07 -04:00
Marek Roszko 1d559108c8 Move LOCALE_IO out of common.h 2020-10-23 21:49:42 -04:00
Jeff Young 41fd8293e8 Don't apply clearance to keepout zones.
Also improves the clearance and keepout reporting.

Fixes https://gitlab.com/kicad/code/kicad/issues/6118
2020-10-22 21:29:04 +01:00
jean-pierre charras f6b4b66a86 Avoid include wx/wx.h in many files that do not actually use this include.
Including wx.h includes the full set of wxWidgets include files, that is not good,
and can create some conflicts with some Windows headers on msys2.
2020-10-18 18:21:34 +02:00
Ian McInerney b1bd1f2a97 Introduce new action to switch to mils as a unit 2020-10-04 17:53:55 +01:00
jean-pierre charras f702da95c7 Minor code cleanup, step2: remove more useless include.
fix also a minor compil warning
2020-10-01 15:39:47 +02:00
jean-pierre charras 3f8c9d49f8 Revert "Code cleanup: remove useless wx/wx.h include inside a few files."
due to compil issue on Linux

This reverts commit cffccc3970.
2020-09-30 20:47:20 +02:00
jean-pierre charras cffccc3970 Code cleanup: remove useless wx/wx.h include inside a few files.
in most of files, including wx.h is not necessary, when only 2 or 3 wx files must be included.
Moreover, on windows, including wx.h sometimes create compil warnings about
shadowed vars defined in some specific windows headers.
2020-09-30 20:03:27 +02:00
Jeff Young 40d7940d52 Don't trim both back and front if there's only one char.
Fixes https://gitlab.com/kicad/code/kicad/issues/5357
2020-08-26 00:02:37 +01:00
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
Jeff Young e86fc64e7d Check envvars as well before flagging as un-resolved.
Fixes https://gitlab.com/kicad/code/kicad/issues/4644
2020-08-01 00:24:26 +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
Jeff Young 3a9746c657 Add ~ processing in env vars.
Fixes https://gitlab.com/kicad/code/kicad/issues/1829
2020-05-13 23:45:32 +01: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
Ian McInerney 99dcadf7e6 Introduce new KI_FALLTHROUGH macro
Annotate purposeful fallthroughs in switch statements with the
KI_FALLTHROUGH macro.
2020-04-25 00:44:09 +01:00
Jeff Young 2fb2eac4d5 Performance enhancements. 2020-04-24 22:17:45 +01:00
Jeff Young cc9ac37a0e Add text variable support to envVar processing. 2020-04-05 20:52:26 +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
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 21469efa63 Make sure EESCHEMA definition gets passed into common.cpp.
Also includes a fix to seed timestamps that got incorrectly
written out as '00000000' because of the above.

Fixes https://gitlab.com/kicad/code/kicad/issues/3977
2020-03-04 02:04:18 +00: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
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
Jeff Young e69c82f45f Back out changes which updated the eeschema file format.
We'll wait until we have the new eeschema format to turn on UUID
generation for Eeschema.  Right now only Pcnbew generates full UUIDs.
2020-02-20 23:40:30 +00: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 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