Compare commits
390 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 77588e0d0f | |||
| 80e45b2f1d | |||
| dfea0b4dd5 | |||
| b6b3245cfc | |||
| aa4d019efb | |||
| cbdad19566 | |||
| 299ed49de6 | |||
| 8ecbdb4f3d | |||
| f8f905025d | |||
| a14830b796 | |||
| 537e3e625b | |||
| 1d6a67d2b2 | |||
| 285c549394 | |||
| c2c915c98c | |||
| 1c894f0e9a | |||
| 4ea24a4d39 | |||
| 817aa5670e | |||
| eddd925269 | |||
| 61bcf85fb3 | |||
| 8c5e98ee03 | |||
| 20138d20f9 | |||
| 57fc76cb22 | |||
| de9fa7bdb1 | |||
| 6b5525f946 | |||
| a9e29a957a | |||
| ee1951cd58 | |||
| d66879cafa | |||
| 3c6631bdb2 | |||
| f40be70e07 | |||
| 151d745922 | |||
| bd3cc02b18 | |||
| 8acf694129 | |||
| 348700eb1d | |||
| c0d20fce9e | |||
| bf0bd05c75 | |||
| d2550138bc | |||
| 029f72161b | |||
| 87457cfdaf | |||
| c258b99d2f | |||
| b436a4fd2a | |||
| 98becb9814 | |||
| 49c352a95e | |||
| 96541f9ef7 | |||
| 0dfe8ce154 | |||
| bcf992f22f | |||
| a8d79ec4be | |||
| a38a76791f | |||
| 44c66225e7 | |||
| c973fa7ad0 | |||
| 3993e6dcb0 | |||
| e1436d3597 | |||
| 28ba36129a | |||
| c6abc5fdd0 | |||
| 6104651613 | |||
| 5b88f2509e | |||
| 6768e34e0e | |||
| 372b704844 | |||
| 3648c8c31a | |||
| 2df3924ea0 | |||
| 48d194a0fc | |||
| 8a3d7d66a1 | |||
| d7c9c8aeca | |||
| 48d3b67686 | |||
| a4ac97d5de | |||
| bb525e3c68 | |||
| d4002b95d4 | |||
| ae4978502f | |||
| c4ad3456f4 | |||
| c521dabcf0 | |||
| b5716ef54b | |||
| 9515bf9038 | |||
| 38dcfdc350 | |||
| 55aeca477d | |||
| 572fcdfa22 | |||
| 234994bf53 | |||
| 49d8fc900f | |||
| 27b55eb32f | |||
| cf118f142c | |||
| be0c8c88e5 | |||
| de953b0fdb | |||
| 3ea0191954 | |||
| f835591c8b | |||
| 12fcf31dc5 | |||
| 31b65a241f | |||
| 2bf369793c | |||
| 12680cfecb | |||
| ff578d9866 | |||
| 48e254fe4c | |||
| 222bfda5c3 | |||
| c93d8115cb | |||
| 5c1d7f11d7 | |||
| 90d64e3eb1 | |||
| 8cbd172c3c | |||
| 69de87675a | |||
| 33492efb01 | |||
| e22e2c5109 | |||
| 8937a7cc82 | |||
| 141eb9d1b7 | |||
| f291629c64 | |||
| b4dbba2f5f | |||
| bafa055114 | |||
| 2ca4f60729 | |||
| 9451214ecf | |||
| 635974cfcc | |||
| a40c4c68d1 | |||
| b422281eb8 | |||
| 5e3eda108f | |||
| 5bd28c9569 | |||
| fc562ba229 | |||
| e3ab4b066c | |||
| edfba6ce84 | |||
| 7f7b023c19 | |||
| 2e9c197f09 | |||
| f8db7a2aca | |||
| 34138ffc42 | |||
| 10d34f5b9b | |||
| 7cb85e2dd1 | |||
| 34906f0871 | |||
| 2fa818b002 | |||
| 9e98bb68d7 | |||
| 4b26e737c0 | |||
| bcb8c2097c | |||
| 028721f3ed | |||
| b837dc1d3b | |||
| 3446dbbf27 | |||
| aee836d722 | |||
| 5d9908647c | |||
| 631c5ec01d | |||
| d92f42cdcb | |||
| a4893523e4 | |||
| 4dc0a31071 | |||
| c65a1139cb | |||
| 71aae415a4 | |||
| 7061b64319 | |||
| 03da07767d | |||
| f3c5b21b1b | |||
| 69eb81196d | |||
| f23b06de27 | |||
| badaac9366 | |||
| 215c3fdf77 | |||
| b658031b8c | |||
| 02b756189b | |||
| d2af56597e | |||
| f862eea1b9 | |||
| 73f495c67d | |||
| b46780ad46 | |||
| 9762fb855d | |||
| 9d156891c6 | |||
| b73b154abc | |||
| 1d9a5c33ca | |||
| 12dac14ba6 | |||
| 116aa3d344 | |||
| 7219a5dd77 | |||
| 729d14827e | |||
| e8ec50e04c | |||
| 8b2e70afb0 | |||
| 21384b64f7 | |||
| 184798b770 | |||
| f93a954c7b | |||
| a69d6a129a | |||
| 491af0df39 | |||
| 34458cf738 | |||
| 809948333e | |||
| 1a6160b132 | |||
| 51f588b55b | |||
| 1effbe5d01 | |||
| 50711b1294 | |||
| b3ba8d78b5 | |||
| 11df4b32eb | |||
| 1de9a83ff0 | |||
| 25de338bdd | |||
| 4df101b94e | |||
| cf78215276 | |||
| ed5ec0f749 | |||
| 2da1294492 | |||
| 04733511fc | |||
| 1414e90ce9 | |||
| 5c492429be | |||
| e9e2c9399b | |||
| 58422f2c97 | |||
| 618077bbf2 | |||
| 6aa274bc0d | |||
| 12f460cc7a | |||
| cbe22a23b8 | |||
| 0f8f9214b0 | |||
| 4f63cb6a26 | |||
| 64d8bbd1d9 | |||
| f957dfa218 | |||
| 0d18ad188b | |||
| bf189855f8 | |||
| 81658cb2c9 | |||
| 5e80f4bf32 | |||
| 684b92dfa6 | |||
| 22e2850cdc | |||
| be7b69172f | |||
| 07f74ab56e | |||
| 89bbaa6d2e | |||
| ce8737936e | |||
| 8c45d3621e | |||
| bae042b934 | |||
| 5e724a2909 | |||
| 4810f50083 | |||
| 771c6b21df | |||
| 5f1feb4532 | |||
| 759b279009 | |||
| 456fc581f1 | |||
| d18d47fbeb | |||
| efae811143 | |||
| f7eb925bfe | |||
| f92c46d585 | |||
| 648c3aec39 | |||
| 46ef12ff4d | |||
| 477f856e9a | |||
| 3a1cb402ad | |||
| 9c50f208af | |||
| 0d9daa372e | |||
| 91a2edd16f | |||
| 765c4ffce6 | |||
| 50b8b797f7 | |||
| 9025f04f20 | |||
| ce2b4a7b16 | |||
| ed76b543a0 | |||
| 622a3f5bad | |||
| f125ab95c9 | |||
| d52811d367 | |||
| 549258a5cc | |||
| 2ae04b32b4 | |||
| ab0d02b322 | |||
| 9e163b7480 | |||
| d69e7c579c | |||
| 2a1de79916 | |||
| 7116be4ae0 | |||
| 66bf97bc0f | |||
| 42a18ad3b6 | |||
| afd35001cb | |||
| cbc964fb94 | |||
| d033859596 | |||
| c7a6f3c63b | |||
| 984b872c28 | |||
| a246a96d18 | |||
| 12d3f54da4 | |||
| 97b0e6d403 | |||
| 89226575c6 | |||
| 6febb9ddde | |||
| 47150649b7 | |||
| ae6c865a77 | |||
| 154c89765f | |||
| 341818306e | |||
| 87a0106c57 | |||
| 2504195e6e | |||
| 3f5195de3d | |||
| 31fe178504 | |||
| e44e3ae25e | |||
| ae96cf1715 | |||
| 203ddb7b47 | |||
| 0ec82b65be | |||
| 09c63ea1ec | |||
| 0c2edf8e5c | |||
| d9a779d8ce | |||
| e56894ccc2 | |||
| 5c624dacd2 | |||
| 3ad740c920 | |||
| 9055821db6 | |||
| d08cb55d94 | |||
| 240a7bb238 | |||
| e453da97af | |||
| 140f92b1d7 | |||
| 51ec75e565 | |||
| 4c13ca2bea | |||
| a638ca22c2 | |||
| 6526fe75ea | |||
| 3c41c33e39 | |||
| d267f46c21 | |||
| a47298b72f | |||
| 41c3607512 | |||
| d7ba90c573 | |||
| 3f984704be | |||
| 2bb2f1398c | |||
| 9b1b2c626a | |||
| ff74d7b24a | |||
| 9a3ae62b70 | |||
| 2e17848d3f | |||
| 36b4bab5cc | |||
| 3a91fc8c2b | |||
| f4f92b0184 | |||
| 87532491e1 | |||
| 5cdca70bf1 | |||
| cb7ea2f117 | |||
| 1c0769ce27 | |||
| c7afa8ce87 | |||
| cc2ca441fa | |||
| 8d1f1fd4f5 | |||
| 377476df1d | |||
| 5465ff8143 | |||
| 969c28864f | |||
| fd202d7b8d | |||
| 7e79a99cea | |||
| ad2c243220 | |||
| fb02d02698 | |||
| a10ab54bf2 | |||
| 72454180c1 | |||
| 5909fc1c8f | |||
| 82ead56d9a | |||
| 798e9999c2 | |||
| a752dd5105 | |||
| da8dcab1de | |||
| b707b305ac | |||
| 038b927cfa | |||
| bdd4a88127 | |||
| f60313367c | |||
| a4e2d54221 | |||
| 8ef8ca4d39 | |||
| ae0396ee3c | |||
| b97bd36b44 | |||
| f3523b6ad9 | |||
| 0fccad7183 | |||
| 337689a69e | |||
| a3e3c0384e | |||
| 36924926de | |||
| ec1353168b | |||
| 1712f5f8e7 | |||
| 6485465301 | |||
| 87f7ed7846 | |||
| f8993933a9 | |||
| b135491d35 | |||
| 2aa9d4851e | |||
| 4cd8833687 | |||
| 870807fbad | |||
| a844554443 | |||
| d6f10f9f88 | |||
| dcc09a9e77 | |||
| 45bb1da77a | |||
| a153e4fc63 | |||
| f3371f9c21 | |||
| 8a3086652a | |||
| 2103f303b7 | |||
| 17cac94c6a | |||
| c4c32aa7bb | |||
| 8162896bd5 | |||
| 92a605385b | |||
| b948611c6f | |||
| ba2156a0f1 | |||
| 966c7e40e5 | |||
| 89b4adc042 | |||
| ff3687420f | |||
| 7aafe9efe9 | |||
| e6f6e7b2f0 | |||
| 68b590cadb | |||
| 1ec7051f97 | |||
| 866a5722f6 | |||
| 4e7da6169d | |||
| ebb8682dde | |||
| 812bbe8919 | |||
| fd2932bc06 | |||
| 1b6621d898 | |||
| 4aa11830e4 | |||
| 91f5096ecc | |||
| 4dbf39743b | |||
| c7d62a23be | |||
| b81f0b4377 | |||
| f45e2b2252 | |||
| db44690460 | |||
| f8c0109c6e | |||
| a60f0b3782 | |||
| 7cc2b47d2e | |||
| 71ebe394d5 | |||
| 9d27f5526c | |||
| bf1daeab64 | |||
| 5693ba1432 | |||
| a60307340f | |||
| 5a6793f9fb | |||
| b3463dce71 | |||
| 58b8e9736d | |||
| a1dd583696 | |||
| 6429246ce0 | |||
| aaca5d820b | |||
| 2579165733 | |||
| 93fdd52d14 | |||
| 079636ad18 | |||
| f6148f10e1 | |||
| 2a93af1348 | |||
| ee2039b531 | |||
| cc77cb4252 | |||
| 072a2b6305 | |||
| 3cae075945 | |||
| 900b6bfffb | |||
| 0c68ab4556 | |||
| 1a41387a50 | |||
| e602e0bdbd | |||
| f2e814c330 |
@@ -0,0 +1,57 @@
|
||||
# minimum clang-format 10
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllConstructorInitializersOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: InlineOnly
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: None
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 100
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ForEachMacros: [ BOOST_FOREACH ]
|
||||
IndentCaseLabels: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
Language: Cpp
|
||||
MaxEmptyLinesToKeep: 2
|
||||
NamespaceIndentation: Inner
|
||||
PointerAlignment: Left
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: Never
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: true
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: c++11
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
@@ -24,7 +24,6 @@ common/template_fieldnames_lexer.h
|
||||
eeschema/schematic_keywords.*
|
||||
pcbnew/pcb_plot_params_keywords.cpp
|
||||
pcbnew/pcb_plot_params_lexer.h
|
||||
pcbnew/dialogs/panel_setup_rules_help_*.h
|
||||
Makefile
|
||||
CMakeUserPresets.json
|
||||
CMakeCache.txt
|
||||
@@ -89,9 +88,6 @@ pcbnew/Info.plist
|
||||
*.orig
|
||||
*.patch
|
||||
|
||||
# _clang-format is used, .clang-format is not
|
||||
.clang-format
|
||||
|
||||
# These CMake files are wanted
|
||||
!cmake/**/*.cmake
|
||||
|
||||
@@ -130,11 +126,9 @@ i18n_status.csv
|
||||
# Project local settings files and backups (in demos and qa tests)
|
||||
*.kicad_prl
|
||||
*-backups
|
||||
~*.lck
|
||||
|
||||
# QA dataoutput
|
||||
qa/data/**/*.csv
|
||||
qa/data/**/*.spice
|
||||
|
||||
# Don't actually ignore any of these files, since we need them in the tree
|
||||
!resources/linux/icons/hicolor/**/**/*
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
# Despite the unfortunate naming convention of this file, KiCad does not have code "owners".
|
||||
# All parts of KiCad are worked on by all developers, and we do not require explicit approval
|
||||
# from any particular person in order to accept contributions or fixes to sections of KiCad.
|
||||
|
||||
# This file is used to generate suggested reviewers for pull requests that touch certain parts
|
||||
# of the KiCad codebase based on the development history of those parts. Most of KiCad does not
|
||||
# have a particular set of reviewers defined in this file, and in general, it is a good thing if
|
||||
# entries can be removed from this file over time, because it indicates that expertise about
|
||||
# parts of the codebase that once were only familiar to one or two developers is now shared among
|
||||
# a wider set of the core development team.
|
||||
|
||||
# Contributors: despite this file, the KiCad team still primarily matches up new merge requests
|
||||
# with reviewers based on developer availability. If a change you propose touches files that
|
||||
# are covered by entries in this file, the relevant developer(s) may or may not be the final
|
||||
# reviewer(s) for your merge request.
|
||||
|
||||
# Core team developers: consider adding yourself to places where you are commonly asked for
|
||||
# review feedback by the rest of the team. Consider removing yourself if you are stepping back
|
||||
# from participating in KiCad code review, or if you notice that an area you were previously
|
||||
# listed as a reviewer because not many others were familiar with it is now familiar with the
|
||||
# larger team.
|
||||
|
||||
^[Suggested Reviewers]
|
||||
|
||||
/vcpkg*.json @mroszko
|
||||
|
||||
/api/ @craftyjon
|
||||
|
||||
/cmake/InstallSteps/*MacOS.cmake @craftyjon
|
||||
|
||||
/common/api/ @craftyjon
|
||||
/common/git/ @sethhillbrand
|
||||
/common/database/ @craftyjon
|
||||
/common/io/eagle/ @stambaughw
|
||||
/common/jobs/ @mroszko
|
||||
|
||||
/cmake/KiCadVersion.cmake @stambaughw
|
||||
|
||||
/eeschema/api/ @craftyjon
|
||||
/eeschema/erc/ @jeffyoung
|
||||
/eeschema/connection_graph.* @craftyjon @sethhillbrand
|
||||
/eeschema/sch_io/database/ @craftyjon
|
||||
/eeschema/sch_io/kicad_sexpr/ @stambaughw
|
||||
/eeschema/sch_io/eagle/ @stambaughw
|
||||
|
||||
/libs/kinng/ @craftyjon
|
||||
|
||||
/pcbnew/api/ @craftyjon
|
||||
/pcbnew/drc/ @jeffyoung
|
||||
/pcbnew/pcb_io/easyeda* @dsa-t
|
||||
/pcbnew/pcb_io/ipc2581/ @sethhillbrand
|
||||
/pcbnew/pcb_io/odbpp/ @SYSUeric66 @sethhillbrand @craftyjon
|
||||
/pcbnew/router/ @twlostow @craftyjon @sethhillbrand
|
||||
/pcbnew/zone_filler* @jeffyoung
|
||||
|
||||
/scripting/ @craftyjon @sethhillbrand
|
||||
|
||||
/thirdparty/nanodbc/ @craftyjon
|
||||
@@ -37,8 +37,6 @@ win64_build:
|
||||
../../
|
||||
- cmake --build . 2>&1 | tee compilation_log.txt
|
||||
- cd ../../
|
||||
after_script:
|
||||
- Get-Content -Path C:\builder\vcpkg\buildtrees\wxpython-33\python3-tool-post-install-err.log
|
||||
artifacts:
|
||||
# Only save the artifacts that are needed for running the tests in the next stage
|
||||
# and the compilation log. The entire build directory is too large to save as an
|
||||
|
||||
@@ -141,13 +141,12 @@ S3D_CACHE::~S3D_CACHE()
|
||||
|
||||
|
||||
SCENEGRAPH* S3D_CACHE::load( const wxString& aModelFile, const wxString& aBasePath,
|
||||
S3D_CACHE_ENTRY** aCachePtr,
|
||||
std::vector<const EMBEDDED_FILES*> aEmbeddedFilesStack )
|
||||
S3D_CACHE_ENTRY** aCachePtr, const EMBEDDED_FILES* aEmbeddedFiles )
|
||||
{
|
||||
if( aCachePtr )
|
||||
*aCachePtr = nullptr;
|
||||
|
||||
wxString full3Dpath = m_FNResolver->ResolvePath( aModelFile, aBasePath, std::move( aEmbeddedFilesStack ) );
|
||||
wxString full3Dpath = m_FNResolver->ResolvePath( aModelFile, aBasePath, aEmbeddedFiles );
|
||||
|
||||
if( full3Dpath.empty() )
|
||||
{
|
||||
@@ -213,9 +212,9 @@ SCENEGRAPH* S3D_CACHE::load( const wxString& aModelFile, const wxString& aBasePa
|
||||
|
||||
|
||||
SCENEGRAPH* S3D_CACHE::Load( const wxString& aModelFile, const wxString& aBasePath,
|
||||
std::vector<const EMBEDDED_FILES*> aEmbeddedFilesStack )
|
||||
const EMBEDDED_FILES* aEmbeddedFiles )
|
||||
{
|
||||
return load( aModelFile, aBasePath, nullptr, std::move( aEmbeddedFilesStack ) );
|
||||
return load( aModelFile, aBasePath, nullptr, aEmbeddedFiles );
|
||||
}
|
||||
|
||||
|
||||
@@ -549,10 +548,10 @@ void S3D_CACHE::ClosePlugins()
|
||||
|
||||
|
||||
S3DMODEL* S3D_CACHE::GetModel( const wxString& aModelFileName, const wxString& aBasePath,
|
||||
std::vector<const EMBEDDED_FILES*> aEmbeddedFilesStack )
|
||||
const EMBEDDED_FILES* aEmbeddedFiles )
|
||||
{
|
||||
S3D_CACHE_ENTRY* cp = nullptr;
|
||||
SCENEGRAPH* sp = load( aModelFileName, aBasePath, &cp, std::move( aEmbeddedFilesStack ) );
|
||||
SCENEGRAPH* sp = load( aModelFileName, aBasePath, &cp, aEmbeddedFiles );
|
||||
|
||||
if( !sp )
|
||||
return nullptr;
|
||||
|
||||
@@ -95,12 +95,11 @@ public:
|
||||
*
|
||||
* @param aModelFile is the partial or full path to the model to be loaded.
|
||||
* @param aBasePath is the path to search for any relative files
|
||||
* @param aEmbeddedFilesStack is a list of pointers to the embedded files list. They will
|
||||
* be searched from the front of the list.
|
||||
* @param aEmbeddedFiles is a pointer to the embedded files list.
|
||||
* @return true if the model was successfully loaded, otherwise false.
|
||||
*/
|
||||
SCENEGRAPH* Load( const wxString& aModelFile, const wxString& aBasePath,
|
||||
std::vector<const EMBEDDED_FILES*> aEmbeddedFilesStack );
|
||||
const EMBEDDED_FILES* aEmbeddedFiles );
|
||||
|
||||
FILENAME_RESOLVER* GetResolver() noexcept;
|
||||
|
||||
@@ -129,12 +128,11 @@ public:
|
||||
*
|
||||
* @param aModelFileName is the full path to the model to be loaded.
|
||||
* @param aBasePath is the path to search for any relative files.
|
||||
* @param aEmbeddedFilesStack is a stack of pointers to the embedded files lists. They will
|
||||
* be searched from the bottom of the stack.
|
||||
* @param aEmbeddedFiles is a pointer to the embedded files list.
|
||||
* @return is a pointer to the render data or NULL if not available.
|
||||
*/
|
||||
S3DMODEL* GetModel( const wxString& aModelFileName, const wxString& aBasePath,
|
||||
std::vector<const EMBEDDED_FILES*> aEmbeddedFilesStack );
|
||||
const EMBEDDED_FILES* aEmbeddedFiles );
|
||||
|
||||
/**
|
||||
* Delete up old cache files in cache directory.
|
||||
@@ -176,7 +174,7 @@ private:
|
||||
// the real load function (can supply a cache entry pointer to member functions)
|
||||
SCENEGRAPH* load( const wxString& aModelFile, const wxString& aBasePath,
|
||||
S3D_CACHE_ENTRY** aCachePtr = nullptr,
|
||||
std::vector<const EMBEDDED_FILES*> aEmbeddedFilesStack = {} );
|
||||
const EMBEDDED_FILES* aEmbeddedFiles = nullptr );
|
||||
|
||||
/// Cache entries.
|
||||
std::list< S3D_CACHE_ENTRY* > m_CacheList;
|
||||
|
||||
@@ -752,9 +752,7 @@ bool SGSHAPE::Prepare( const glm::dmat4* aTransform, S3D::MATLIST& materials,
|
||||
for( unsigned int i = 0; i < nvidx; ++i )
|
||||
{
|
||||
mit = indexmap.find( lv[i] );
|
||||
|
||||
if( mit != indexmap.end() )
|
||||
lvidx[i] = mit->second;
|
||||
lvidx[i] = mit->second;
|
||||
}
|
||||
|
||||
m.m_FaceIdxSize = (unsigned int )nvidx;
|
||||
|
||||
@@ -91,6 +91,7 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
||||
m_IsPreviewer( false ),
|
||||
m_board( nullptr ),
|
||||
m_3dModelManager( nullptr ),
|
||||
m_colors( nullptr ),
|
||||
m_layerZcoordTop(),
|
||||
m_layerZcoordBottom()
|
||||
{
|
||||
@@ -113,8 +114,6 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
||||
m_frontCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
|
||||
m_backCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
|
||||
m_nonCopperLayerThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_frontMaskThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_backMaskThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_solderPasteLayerThickness3DU = SOLDERPASTE_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
|
||||
m_trackCount = 0;
|
||||
@@ -138,14 +137,13 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
||||
m_ECO1Color = SFVEC4F( 0.70, 0.10, 0.10, 1.0 );
|
||||
m_ECO2Color = SFVEC4F( 0.70, 0.10, 0.10, 1.0 );
|
||||
|
||||
for( int ii = 0; ii < 45; ++ii )
|
||||
m_UserDefinedLayerColor[ii] = SFVEC4F( 0.70, 0.10, 0.10, 1.0 );
|
||||
|
||||
m_platedPadsFront = nullptr;
|
||||
m_platedPadsBack = nullptr;
|
||||
m_offboardPadsFront = nullptr;
|
||||
m_offboardPadsBack = nullptr;
|
||||
|
||||
m_frontPlatedPadAndGraphicPolys = nullptr;
|
||||
m_backPlatedPadAndGraphicPolys = nullptr;
|
||||
m_frontPlatedCopperPolys = nullptr;
|
||||
m_backPlatedCopperPolys = nullptr;
|
||||
|
||||
@@ -227,11 +225,16 @@ BOARD_ADAPTER::~BOARD_ADAPTER()
|
||||
|
||||
void BOARD_ADAPTER::ReloadColorSettings() noexcept
|
||||
{
|
||||
PCBNEW_SETTINGS* cfg = GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
|
||||
COLOR_SETTINGS* cs = ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
|
||||
wxCHECK( PgmOrNull(), /* void */ );
|
||||
|
||||
for( int layer = F_Cu; layer < PCB_LAYER_ID_COUNT; ++layer )
|
||||
m_BoardEditorColors[ layer ] = cs->GetColor( layer );
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
m_colors = Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
|
||||
GetBoardEditorCopperLayerColors( cfg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -259,15 +262,7 @@ bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer,
|
||||
case Cmts_User: return aVisibilityFlags.test( LAYER_3D_USER_COMMENTS );
|
||||
case Eco1_User: return aVisibilityFlags.test( LAYER_3D_USER_ECO1 );
|
||||
case Eco2_User: return aVisibilityFlags.test( LAYER_3D_USER_ECO2 );
|
||||
default:
|
||||
{
|
||||
int layer3D = MapPCBLayerTo3DLayer( aLayer );
|
||||
|
||||
if( layer3D != UNDEFINED_LAYER )
|
||||
return aVisibilityFlags.test( layer3D );
|
||||
|
||||
return m_board && m_board->IsLayerVisible( aLayer );
|
||||
}
|
||||
default: return m_board && m_board->IsLayerVisible( aLayer );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +313,7 @@ unsigned int BOARD_ADAPTER::GetCircleSegmentCount( int aDiameterBIU ) const
|
||||
{
|
||||
wxASSERT( aDiameterBIU > 0 );
|
||||
|
||||
return GetArcToSegmentCount( aDiameterBIU / 2, m_board->GetDesignSettings().m_MaxError, FULL_CIRCLE );
|
||||
return GetArcToSegmentCount( aDiameterBIU / 2, ARC_HIGH_DEF, FULL_CIRCLE );
|
||||
}
|
||||
|
||||
|
||||
@@ -377,8 +372,6 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
m_frontCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
|
||||
m_backCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
|
||||
m_nonCopperLayerThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_frontMaskThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_backMaskThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_solderPasteLayerThickness3DU = SOLDERPASTE_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
|
||||
g_BevelThickness3DU = pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_3DRT_BevelHeight_um / 1000.0 )
|
||||
@@ -390,7 +383,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
|
||||
if( bds.GetStackupDescriptor().GetCount() )
|
||||
{
|
||||
int body_thickness = 0;
|
||||
int thickness = 0;
|
||||
|
||||
for( BOARD_STACKUP_ITEM* item : bds.GetStackupDescriptor().GetList() )
|
||||
{
|
||||
@@ -398,44 +391,31 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
{
|
||||
case BS_ITEM_TYPE_DIELECTRIC:
|
||||
for( int sublayer = 0; sublayer < item->GetSublayersCount(); sublayer++ )
|
||||
body_thickness += item->GetThickness( sublayer );
|
||||
|
||||
thickness += item->GetThickness( sublayer );
|
||||
break;
|
||||
|
||||
case BS_ITEM_TYPE_COPPER:
|
||||
{
|
||||
// The copper thickness must be > 0 to avoid draw issues (divide by 0 for
|
||||
// instance). We use a minimal arbitrary value = 1 micrometer here:
|
||||
int copper_thickness = std::max( item->GetThickness(), pcbIUScale.mmToIU( 0.001 ) );
|
||||
int copper_thickness = std::max( item->GetThickness(),
|
||||
pcbIUScale.mmToIU( 0.001 ) );
|
||||
|
||||
if( item->GetBrdLayerId() == F_Cu )
|
||||
m_frontCopperThickness3DU = copper_thickness * m_biuTo3Dunits;
|
||||
else if( item->GetBrdLayerId() == B_Cu )
|
||||
m_backCopperThickness3DU = copper_thickness * m_biuTo3Dunits;
|
||||
else if( item->IsEnabled() )
|
||||
body_thickness += copper_thickness;
|
||||
|
||||
thickness += copper_thickness;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BS_ITEM_TYPE_SOLDERMASK:
|
||||
{
|
||||
// The mask thickness must be > 0 to avoid draw issues (divide by 0 for
|
||||
// instance). We use a minimal arbitrary value = 1 micrometer here:
|
||||
int mask_thickness = std::max( item->GetThickness(), pcbIUScale.mmToIU( 0.001 ) );
|
||||
|
||||
if( item->GetBrdLayerId() == F_Mask )
|
||||
m_frontMaskThickness3DU = mask_thickness * m_biuTo3Dunits;
|
||||
else if( item->GetBrdLayerId() == B_Mask )
|
||||
m_backMaskThickness3DU = mask_thickness * m_biuTo3Dunits;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_boardBodyThickness3DU = body_thickness * m_biuTo3Dunits;
|
||||
m_boardBodyThickness3DU = thickness * m_biuTo3Dunits;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,7 +449,8 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
};
|
||||
|
||||
m_layerZcoordBottom[layer_id] = m_boardBodyThickness3DU / 2.0
|
||||
- ( m_boardBodyThickness3DU * layer_pos / ( m_copperLayersCount - 1 ) );
|
||||
- ( m_boardBodyThickness3DU * layer_pos
|
||||
/ ( m_copperLayersCount - 1 ) );
|
||||
|
||||
if( layer_pos < (m_copperLayersCount / 2) )
|
||||
m_layerZcoordTop[layer_id] = m_layerZcoordBottom[layer_id] + m_frontCopperThickness3DU;
|
||||
@@ -507,7 +488,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
|
||||
case B_Mask:
|
||||
zposBottom = zpos_copperTop_back;
|
||||
zposTop = zpos_copperTop_back - m_backMaskThickness3DU;
|
||||
zposTop = zpos_copperTop_back - m_nonCopperLayerThickness3DU;
|
||||
break;
|
||||
|
||||
case B_Paste:
|
||||
@@ -517,7 +498,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
|
||||
case F_Mask:
|
||||
zposBottom = zpos_copperTop_front;
|
||||
zposTop = zpos_copperTop_front + m_frontMaskThickness3DU;
|
||||
zposTop = zpos_copperTop_front + m_nonCopperLayerThickness3DU;
|
||||
break;
|
||||
|
||||
case F_Paste:
|
||||
@@ -545,7 +526,8 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
|
||||
m_boardCenter = SFVEC3F( m_boardPos.x * m_biuTo3Dunits, m_boardPos.y * m_biuTo3Dunits, 0.0f );
|
||||
|
||||
SFVEC3F boardSize = SFVEC3F( m_boardSize.x * m_biuTo3Dunits, m_boardSize.y * m_biuTo3Dunits, 0.0f );
|
||||
SFVEC3F boardSize = SFVEC3F( m_boardSize.x * m_biuTo3Dunits, m_boardSize.y * m_biuTo3Dunits,
|
||||
0.0f );
|
||||
boardSize /= 2.0f;
|
||||
|
||||
SFVEC3F boardMin = ( m_boardCenter - boardSize );
|
||||
@@ -586,9 +568,6 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
m_UserCommentsColor = to_SFVEC4F( colors[ LAYER_3D_USER_COMMENTS ] );
|
||||
m_ECO1Color = to_SFVEC4F( colors[ LAYER_3D_USER_ECO1 ] );
|
||||
m_ECO2Color = to_SFVEC4F( colors[ LAYER_3D_USER_ECO2 ] );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
m_UserDefinedLayerColor[ layer - LAYER_3D_USER_1 ] = to_SFVEC4F( colors[ layer ] );
|
||||
}
|
||||
|
||||
|
||||
@@ -611,15 +590,28 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetDefaultColors() const
|
||||
colors[ LAYER_3D_USER_ECO1 ] = BOARD_ADAPTER::g_DefaultECOs;
|
||||
colors[ LAYER_3D_USER_ECO2 ] = BOARD_ADAPTER::g_DefaultECOs;
|
||||
|
||||
COLOR_SETTINGS* settings = ::GetColorSettings( DEFAULT_THEME );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
colors[ layer ] = settings->GetColor( layer );
|
||||
|
||||
return colors;
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::GetBoardEditorCopperLayerColors( PCBNEW_SETTINGS* aCfg )
|
||||
{
|
||||
m_BoardEditorColors.clear();
|
||||
|
||||
if( m_copperLayersCount <= 0 )
|
||||
return;
|
||||
|
||||
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings( aCfg->m_ColorTheme );
|
||||
|
||||
LSET copperLayers = LSET::AllCuMask();
|
||||
|
||||
for( auto layer : LAYER_RANGE( F_Cu, B_Cu, m_copperLayersCount ) )
|
||||
{
|
||||
m_BoardEditorColors[ layer ] = settings->GetColor( layer );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
{
|
||||
std::map<int, COLOR4D> colors;
|
||||
@@ -630,7 +622,7 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
}
|
||||
else
|
||||
{
|
||||
COLOR_SETTINGS* settings = ::GetColorSettings( DEFAULT_THEME );
|
||||
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
for( const auto& [ layer, defaultColor /* unused */ ] : GetDefaultColors() )
|
||||
colors[ layer ] = settings->GetColor( layer );
|
||||
@@ -740,16 +732,11 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
|
||||
void BOARD_ADAPTER::SetLayerColors( const std::map<int, COLOR4D>& aColors )
|
||||
{
|
||||
COLOR_SETTINGS* settings = ::GetColorSettings( DEFAULT_THEME );
|
||||
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
for( const auto& [ layer, color ] : aColors )
|
||||
{
|
||||
settings->SetColor( layer, color );
|
||||
|
||||
if( layer >= LAYER_3D_USER_1 && layer <= LAYER_3D_USER_45 )
|
||||
m_UserDefinedLayerColor[ layer - LAYER_3D_USER_1 ] = GetColor( color );
|
||||
}
|
||||
|
||||
Pgm().GetSettingsManager().SaveColorSettings( settings, "3d_viewer" );
|
||||
}
|
||||
|
||||
@@ -770,9 +757,6 @@ void BOARD_ADAPTER::SetVisibleLayers( const std::bitset<LAYER_3D_END>& aLayers )
|
||||
m_Cfg->m_Render.show_eco1 = aLayers.test( LAYER_3D_USER_ECO1 );
|
||||
m_Cfg->m_Render.show_eco2 = aLayers.test( LAYER_3D_USER_ECO2 );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
m_Cfg->m_Render.show_user[ layer - LAYER_3D_USER_1 ] = aLayers.test( layer );
|
||||
|
||||
m_Cfg->m_Render.show_footprints_normal = aLayers.test( LAYER_3D_TH_MODELS );
|
||||
m_Cfg->m_Render.show_footprints_insert = aLayers.test( LAYER_3D_SMD_MODELS );
|
||||
m_Cfg->m_Render.show_footprints_virtual = aLayers.test( LAYER_3D_VIRTUAL_MODELS );
|
||||
@@ -785,7 +769,7 @@ void BOARD_ADAPTER::SetVisibleLayers( const std::bitset<LAYER_3D_END>& aLayers )
|
||||
|
||||
m_Cfg->m_Render.show_model_bbox = aLayers.test( LAYER_3D_BOUNDING_BOXES );
|
||||
m_Cfg->m_Render.show_off_board_silk = aLayers.test( LAYER_3D_OFF_BOARD_SILK );
|
||||
m_Cfg->m_Render.show_navigator = aLayers.test( LAYER_3D_NAVIGATOR );
|
||||
m_Cfg->m_Render.show_axis = aLayers.test( LAYER_3D_AXES );
|
||||
}
|
||||
|
||||
|
||||
@@ -793,46 +777,6 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
|
||||
{
|
||||
std::bitset<LAYER_3D_END> ret;
|
||||
|
||||
if( m_IsPreviewer )
|
||||
{
|
||||
if( m_Cfg->m_Render.preview_show_board_body )
|
||||
{
|
||||
ret.set( LAYER_3D_BOARD, m_Cfg->m_Render.show_board_body );
|
||||
ret.set( LAYER_3D_SOLDERMASK_TOP, m_Cfg->m_Render.show_soldermask_top );
|
||||
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, m_Cfg->m_Render.show_soldermask_bottom );
|
||||
ret.set( LAYER_3D_SOLDERPASTE, m_Cfg->m_Render.show_solderpaste );
|
||||
ret.set( LAYER_3D_ADHESIVE, m_Cfg->m_Render.show_adhesive );
|
||||
}
|
||||
|
||||
ret.set( LAYER_3D_COPPER_TOP, true );
|
||||
ret.set( LAYER_3D_COPPER_BOTTOM, true );
|
||||
ret.set( LAYER_3D_SILKSCREEN_TOP, true );
|
||||
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, true );
|
||||
ret.set( LAYER_3D_USER_COMMENTS, true );
|
||||
ret.set( LAYER_3D_USER_DRAWINGS, true );
|
||||
ret.set( LAYER_3D_USER_ECO1, true );
|
||||
ret.set( LAYER_3D_USER_ECO2, true );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
ret.set( layer, true );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, true );
|
||||
ret.set( LAYER_FP_VALUES, true );
|
||||
ret.set( LAYER_FP_TEXT, true );
|
||||
|
||||
ret.set( LAYER_3D_TH_MODELS, true );
|
||||
ret.set( LAYER_3D_SMD_MODELS, true );
|
||||
ret.set( LAYER_3D_VIRTUAL_MODELS, true );
|
||||
ret.set( LAYER_3D_MODELS_NOT_IN_POS, true );
|
||||
ret.set( LAYER_3D_MODELS_MARKED_DNP, true );
|
||||
|
||||
ret.set( LAYER_3D_BOUNDING_BOXES, m_Cfg->m_Render.show_model_bbox );
|
||||
ret.set( LAYER_3D_OFF_BOARD_SILK, m_Cfg->m_Render.show_off_board_silk );
|
||||
ret.set( LAYER_3D_NAVIGATOR, m_Cfg->m_Render.show_navigator );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret.set( LAYER_3D_BOARD, m_Cfg->m_Render.show_board_body );
|
||||
ret.set( LAYER_3D_COPPER_TOP, m_Cfg->m_Render.show_copper_top );
|
||||
ret.set( LAYER_3D_COPPER_BOTTOM, m_Cfg->m_Render.show_copper_bottom );
|
||||
@@ -847,9 +791,6 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
|
||||
ret.set( LAYER_3D_USER_ECO1, m_Cfg->m_Render.show_eco1 );
|
||||
ret.set( LAYER_3D_USER_ECO2, m_Cfg->m_Render.show_eco2 );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
ret.set( layer, m_Cfg->m_Render.show_user[ layer - LAYER_3D_USER_1 ] );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, m_Cfg->m_Render.show_fp_references );
|
||||
ret.set( LAYER_FP_VALUES, m_Cfg->m_Render.show_fp_values );
|
||||
ret.set( LAYER_FP_TEXT, m_Cfg->m_Render.show_fp_text );
|
||||
@@ -862,7 +803,7 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
|
||||
|
||||
ret.set( LAYER_3D_BOUNDING_BOXES, m_Cfg->m_Render.show_model_bbox );
|
||||
ret.set( LAYER_3D_OFF_BOARD_SILK, m_Cfg->m_Render.show_off_board_silk );
|
||||
ret.set( LAYER_3D_NAVIGATOR, m_Cfg->m_Render.show_navigator );
|
||||
ret.set( LAYER_3D_AXES, m_Cfg->m_Render.show_axis );
|
||||
|
||||
if( m_Cfg->m_CurrentPreset == FOLLOW_PCB )
|
||||
{
|
||||
@@ -911,12 +852,9 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
|
||||
ret.set( LAYER_3D_USER_ECO1, layers.test( Eco1_User ) );
|
||||
ret.set( LAYER_3D_USER_ECO2, layers.test( Eco2_User ) );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
ret.set( layer, layers.test( Map3DLayerToPCBLayer( layer ) ) );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, plotParams.GetPlotReference() );
|
||||
ret.set( LAYER_FP_VALUES, plotParams.GetPlotValue() );
|
||||
ret.set( LAYER_FP_TEXT, plotParams.GetPlotFPText() );
|
||||
ret.set( LAYER_FP_REFERENCES, plotParams.GetPlotReference() );
|
||||
ret.set( LAYER_FP_VALUES, plotParams.GetPlotValue() );
|
||||
ret.set( LAYER_FP_TEXT, plotParams.GetPlotFPText() );
|
||||
}
|
||||
else if( LAYER_PRESET_3D* preset = m_Cfg->FindPreset( m_Cfg->m_CurrentPreset ) )
|
||||
{
|
||||
@@ -945,9 +883,6 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetDefaultVisibleLayers() const
|
||||
ret.set( LAYER_3D_USER_ECO1, false );
|
||||
ret.set( LAYER_3D_USER_ECO2, false );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
ret.set( layer, false );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, true );
|
||||
ret.set( LAYER_FP_VALUES, true );
|
||||
ret.set( LAYER_FP_TEXT, true );
|
||||
@@ -960,18 +895,12 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetDefaultVisibleLayers() const
|
||||
|
||||
ret.set( LAYER_3D_BOUNDING_BOXES, false );
|
||||
ret.set( LAYER_3D_OFF_BOARD_SILK, false );
|
||||
ret.set( LAYER_3D_NAVIGATOR, true );
|
||||
ret.set( LAYER_3D_AXES, true );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool BOARD_ADAPTER::GetUseBoardEditorCopperLayerColors() const
|
||||
{
|
||||
return m_Cfg->m_Render.use_board_editor_copper_colors && !m_board->IsFootprintHolder();
|
||||
}
|
||||
|
||||
|
||||
bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
|
||||
{
|
||||
m_board_poly.RemoveAllContours();
|
||||
@@ -1034,14 +963,19 @@ float BOARD_ADAPTER::GetFootprintZPos( bool aIsFlipped ) const
|
||||
}
|
||||
|
||||
|
||||
SFVEC4F BOARD_ADAPTER::GetLayerColor( int aLayerId ) const
|
||||
SFVEC4F BOARD_ADAPTER::GetLayerColor( PCB_LAYER_ID aLayerId ) const
|
||||
{
|
||||
if( aLayerId >= LAYER_3D_USER_1 && aLayerId <= LAYER_3D_USER_45 )
|
||||
aLayerId = Map3DLayerToPCBLayer( aLayerId );
|
||||
|
||||
wxASSERT( aLayerId < PCB_LAYER_ID_COUNT );
|
||||
|
||||
return GetColor( m_BoardEditorColors.at( aLayerId ) );
|
||||
const COLOR4D color = m_colors->GetColor( aLayerId );
|
||||
|
||||
return SFVEC4F( color.r, color.g, color.b, color.a );
|
||||
}
|
||||
|
||||
|
||||
SFVEC4F BOARD_ADAPTER::GetItemColor( int aItemId ) const
|
||||
{
|
||||
return GetColor( m_colors->GetColor( aItemId ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -1053,8 +987,9 @@ SFVEC4F BOARD_ADAPTER::GetColor( const COLOR4D& aColor ) const
|
||||
|
||||
SFVEC2F BOARD_ADAPTER::GetSphericalCoord( int i ) const
|
||||
{
|
||||
SFVEC2F sphericalCoord = SFVEC2F( ( m_Cfg->m_Render.raytrace_lightElevation[i] + 90.0f ) / 180.0f,
|
||||
m_Cfg->m_Render.raytrace_lightAzimuth[i] / 180.0f );
|
||||
SFVEC2F sphericalCoord =
|
||||
SFVEC2F( ( m_Cfg->m_Render.raytrace_lightElevation[i] + 90.0f ) / 180.0f,
|
||||
m_Cfg->m_Render.raytrace_lightAzimuth[i] / 180.0f );
|
||||
|
||||
sphericalCoord.x = glm::clamp( sphericalCoord.x, 0.0f, 1.0f );
|
||||
sphericalCoord.y = glm::clamp( sphericalCoord.y, 0.0f, 2.0f );
|
||||
|
||||
@@ -112,6 +112,11 @@ public:
|
||||
*/
|
||||
std::map<int, COLOR4D> GetLayerColors() const;
|
||||
|
||||
/**
|
||||
* Build the copper color list used by the board editor, and store it in m_BoardEditorColors
|
||||
*/
|
||||
void GetBoardEditorCopperLayerColors( PCBNEW_SETTINGS* aCfg );
|
||||
|
||||
std::map<int, COLOR4D> GetDefaultColors() const;
|
||||
void SetLayerColors( const std::map<int, COLOR4D>& aColors );
|
||||
|
||||
@@ -119,8 +124,6 @@ public:
|
||||
std::bitset<LAYER_3D_END> GetDefaultVisibleLayers() const;
|
||||
void SetVisibleLayers( const std::bitset<LAYER_3D_END>& aLayers );
|
||||
|
||||
bool GetUseBoardEditorCopperLayerColors() const;
|
||||
|
||||
/**
|
||||
* Function to be called by the render when it need to reload the settings for the board.
|
||||
*
|
||||
@@ -207,7 +210,15 @@ public:
|
||||
* @param aLayerId the layer to get the color information.
|
||||
* @return the color in SFVEC3F format.
|
||||
*/
|
||||
SFVEC4F GetLayerColor( int aLayerId ) const;
|
||||
SFVEC4F GetLayerColor( PCB_LAYER_ID aLayerId ) const;
|
||||
|
||||
/**
|
||||
* Get the technical color of a layer.
|
||||
*
|
||||
* @param aItemId the item id to get the color information.
|
||||
* @return the color in SFVEC3F format.
|
||||
*/
|
||||
SFVEC4F GetItemColor( int aItemId ) const;
|
||||
|
||||
/**
|
||||
* @param[in] aColor is the color mapped.
|
||||
@@ -341,14 +352,14 @@ public:
|
||||
*/
|
||||
const MAP_POLY& GetPolyMap() const noexcept { return m_layers_poly; }
|
||||
|
||||
const SHAPE_POLY_SET* GetFrontPlatedCopperPolys()
|
||||
const SHAPE_POLY_SET* GetFrontPlatedPadAndGraphicPolys()
|
||||
{
|
||||
return m_frontPlatedCopperPolys;
|
||||
return m_frontPlatedPadAndGraphicPolys;
|
||||
}
|
||||
|
||||
const SHAPE_POLY_SET* GetBackPlatedCopperPolys()
|
||||
const SHAPE_POLY_SET* GetBackPlatedPadAndGraphicPolys()
|
||||
{
|
||||
return m_backPlatedCopperPolys;
|
||||
return m_backPlatedPadAndGraphicPolys;
|
||||
}
|
||||
|
||||
const MAP_POLY& GetHoleIdPolysMap() const noexcept { return m_layerHoleIdPolys; }
|
||||
@@ -375,7 +386,7 @@ private:
|
||||
int aInflateValue );
|
||||
|
||||
void addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayerId );
|
||||
PCB_LAYER_ID aLayerId, bool aSkipPlatedPads, bool aSkipNonPlatedPads );
|
||||
|
||||
void addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayerId,
|
||||
@@ -444,7 +455,6 @@ public:
|
||||
SFVEC4F m_UserCommentsColor;
|
||||
SFVEC4F m_ECO1Color;
|
||||
SFVEC4F m_ECO2Color;
|
||||
SFVEC4F m_UserDefinedLayerColor[45];
|
||||
|
||||
std::map<int, COLOR4D> m_ColorOverrides; ///< allows to override color scheme colors
|
||||
std::map<int, COLOR4D> m_BoardEditorColors; ///< list of colors used by the board editor
|
||||
@@ -452,6 +462,7 @@ public:
|
||||
private:
|
||||
BOARD* m_board;
|
||||
S3D_CACHE* m_3dModelManager;
|
||||
COLOR_SETTINGS* m_colors;
|
||||
|
||||
VECTOR2I m_boardPos; ///< Board center position in board internal units.
|
||||
VECTOR2I m_boardSize; ///< Board size in board internal units.
|
||||
@@ -461,6 +472,8 @@ private:
|
||||
MAP_POLY m_layers_poly; ///< Amalgamated polygon contours for various types
|
||||
///< of items
|
||||
|
||||
SHAPE_POLY_SET* m_frontPlatedPadAndGraphicPolys;
|
||||
SHAPE_POLY_SET* m_backPlatedPadAndGraphicPolys;
|
||||
SHAPE_POLY_SET* m_frontPlatedCopperPolys;
|
||||
SHAPE_POLY_SET* m_backPlatedCopperPolys;
|
||||
|
||||
@@ -492,15 +505,16 @@ private:
|
||||
double m_biuTo3Dunits; ///< Scale factor to convert board internal units
|
||||
///< to 3D units normalized between -1.0 and 1.0.
|
||||
|
||||
std::map<PCB_LAYER_ID, float> m_layerZcoordTop; ///< Top (End) Z pos of each layer in 3D units.
|
||||
std::map<PCB_LAYER_ID, float> m_layerZcoordBottom; ///< Bottom (Start) Z pos of each layer.
|
||||
std::map<PCB_LAYER_ID, float> m_layerZcoordTop; ///< Top (End) Z position of each
|
||||
///< layer in 3D units.
|
||||
|
||||
std::map<PCB_LAYER_ID, float> m_layerZcoordBottom; ///< Bottom (Start) Z position of
|
||||
///< each layer in 3D units.
|
||||
|
||||
float m_frontCopperThickness3DU;
|
||||
float m_backCopperThickness3DU;
|
||||
float m_boardBodyThickness3DU;
|
||||
float m_nonCopperLayerThickness3DU;
|
||||
float m_frontMaskThickness3DU;
|
||||
float m_backMaskThickness3DU;
|
||||
float m_solderPasteLayerThickness3DU;
|
||||
|
||||
unsigned int m_trackCount;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <pcb_table.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <pcb_painter.h> // for PCB_RENDER_SETTINGS
|
||||
#include <zone.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
@@ -109,7 +110,8 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
|
||||
SHAPE_POLY_SET finalPoly;
|
||||
const PCB_TEXT* pcbText = static_cast<const PCB_TEXT*>( aOwner );
|
||||
|
||||
pcbText->TransformTextToPolySet( finalPoly, 0, aOwner->GetMaxError(), ERROR_INSIDE );
|
||||
pcbText->TransformTextToPolySet( finalPoly, 0, m_board->GetDesignSettings().m_MaxError,
|
||||
ERROR_INSIDE );
|
||||
|
||||
// Do not call finalPoly.Fracture() here: ConvertPolygonToTriangles() call it
|
||||
// if needed, and Fracture() called twice can create bad results and is useless
|
||||
@@ -190,7 +192,7 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
|
||||
for( PCB_FIELD* field : aFootprint->GetFields() )
|
||||
for( PCB_FIELD* field : aFootprint->GetFields( true /* visibleOnly */ ) )
|
||||
{
|
||||
if( !aFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
@@ -201,7 +203,7 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
||||
if( field->IsValue() && !aFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
|
||||
if( field->GetLayer() == aLayerId && field->IsVisible() )
|
||||
if( field->GetLayer() == aLayerId )
|
||||
addText( field, aContainer, field );
|
||||
}
|
||||
|
||||
@@ -279,8 +281,9 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayer, int aMargin )
|
||||
void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack,
|
||||
CONTAINER_2D_BASE* aDstContainer, PCB_LAYER_ID aLayer,
|
||||
int aMargin )
|
||||
{
|
||||
SFVEC2F start3DU = TO_SFVEC2F( aTrack->GetStart() );
|
||||
SFVEC2F end3DU = TO_SFVEC2F( aTrack->GetEnd() );
|
||||
@@ -316,7 +319,7 @@ void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack, CONTAINER_2D
|
||||
VECTOR2I center( arc->GetCenter() );
|
||||
EDA_ANGLE arc_angle = arc->GetAngle();
|
||||
double radius = arc->GetRadius();
|
||||
int arcsegcount = GetArcToSegmentCount( KiROUND( radius ), arc->GetMaxError(), arc_angle );
|
||||
int arcsegcount = GetArcToSegmentCount( KiROUND( radius ), ARC_HIGH_DEF, arc_angle );
|
||||
int circlesegcount;
|
||||
|
||||
// Avoid arcs that cannot be drawn
|
||||
@@ -336,7 +339,8 @@ void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack, CONTAINER_2D
|
||||
}
|
||||
|
||||
createArcSegments( center, arc->GetStart(), arc_angle, circlesegcount,
|
||||
arc->GetWidth() + aMargin * 2, aDstContainer, *arc );
|
||||
arc->GetWidth() + aMargin * 2,
|
||||
aDstContainer, *arc );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -357,6 +361,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
PCB_LAYER_ID aLayer, const VECTOR2I& aMargin ) const
|
||||
{
|
||||
SHAPE_POLY_SET poly;
|
||||
int maxError = GetBoard()->GetDesignSettings().m_MaxError;
|
||||
VECTOR2I clearance = aMargin;
|
||||
|
||||
// Our shape-based builder can't handle negative or differing x:y clearance values (the
|
||||
@@ -366,7 +371,8 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
// Of course being a hack it falls down when dealing with custom shape pads (where the size
|
||||
// is only the size of the anchor), so for those we punt and just use aMargin.x.
|
||||
|
||||
if( ( clearance.x < 0 || clearance.x != clearance.y ) && aPad->GetShape( aLayer ) != PAD_SHAPE::CUSTOM )
|
||||
if( ( clearance.x < 0 || clearance.x != clearance.y )
|
||||
&& aPad->GetShape( aLayer ) != PAD_SHAPE::CUSTOM )
|
||||
{
|
||||
VECTOR2I dummySize = VECTOR2I( aPad->GetSize( aLayer ) ) + clearance + clearance;
|
||||
|
||||
@@ -375,19 +381,23 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
|
||||
PAD dummy( *aPad );
|
||||
dummy.SetSize( aLayer, VECTOR2I( dummySize.x, dummySize.y ) );
|
||||
dummy.TransformShapeToPolygon( poly, aLayer, 0, aPad->GetMaxError(), ERROR_INSIDE );
|
||||
dummy.TransformShapeToPolygon( poly, aLayer, 0, maxError, ERROR_INSIDE );
|
||||
clearance = { 0, 0 };
|
||||
|
||||
// Remove group membership from dummy item before deleting
|
||||
dummy.SetParentGroup( nullptr );
|
||||
}
|
||||
else if( aPad->GetShape( aLayer ) == PAD_SHAPE::CUSTOM )
|
||||
{
|
||||
// A custom pad can have many complex subshape items. To avoid issues, use its
|
||||
// final polygon shape, not its basic shape set. One cannot apply the clearance
|
||||
// to each subshape: it does no work
|
||||
aPad->TransformShapeToPolygon( poly, aLayer, 0, aPad->GetMaxError() );
|
||||
aPad->TransformShapeToPolygon( poly, aLayer, 0, maxError );
|
||||
}
|
||||
else
|
||||
{
|
||||
auto padShapes = std::static_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape( aLayer ) );
|
||||
auto padShapes =
|
||||
std::static_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape( aLayer ) );
|
||||
|
||||
for( const SHAPE* shape : padShapes->Shapes() )
|
||||
{
|
||||
@@ -439,7 +449,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
case SH_ARC:
|
||||
{
|
||||
const SHAPE_ARC* arc = static_cast<const SHAPE_ARC*>( shape );
|
||||
SHAPE_LINE_CHAIN l = arc->ConvertToPolyline( aPad->GetMaxError() );
|
||||
SHAPE_LINE_CHAIN l = arc->ConvertToPolyline( maxError );
|
||||
|
||||
for( int i = 0; i < l.SegmentCount(); i++ )
|
||||
{
|
||||
@@ -465,7 +475,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
if( !poly.IsEmpty() )
|
||||
{
|
||||
if( clearance.x )
|
||||
poly.Inflate( clearance.x, CORNER_STRATEGY::ROUND_ALL_CORNERS, aPad->GetMaxError() );
|
||||
poly.Inflate( clearance.x, CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError );
|
||||
|
||||
// Add the PAD polygon
|
||||
ConvertPolygonToTriangles( poly, *aContainer, m_biuTo3Dunits, *aPad );
|
||||
@@ -493,7 +503,7 @@ void BOARD_ADAPTER::createPadWithHole( const PAD* aPad, CONTAINER_2D_BASE* aDstC
|
||||
|
||||
|
||||
void BOARD_ADAPTER::addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aContainer,
|
||||
PCB_LAYER_ID aLayerId )
|
||||
PCB_LAYER_ID aLayerId, bool aSkipPlatedPads, bool aSkipNonPlatedPads )
|
||||
{
|
||||
for( PAD* pad : aFootprint->Pads() )
|
||||
{
|
||||
@@ -517,6 +527,24 @@ void BOARD_ADAPTER::addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aCo
|
||||
|
||||
switch( aLayerId )
|
||||
{
|
||||
case F_Cu:
|
||||
if( aSkipPlatedPads && pad->FlashLayer( F_Mask ) )
|
||||
continue;
|
||||
|
||||
if( aSkipNonPlatedPads && !pad->FlashLayer( F_Mask ) )
|
||||
continue;
|
||||
|
||||
break;
|
||||
|
||||
case B_Cu:
|
||||
if( aSkipPlatedPads && pad->FlashLayer( B_Mask ) )
|
||||
continue;
|
||||
|
||||
if( aSkipNonPlatedPads && !pad->FlashLayer( B_Mask ) )
|
||||
continue;
|
||||
|
||||
break;
|
||||
|
||||
case F_Mask:
|
||||
case B_Mask:
|
||||
margin.x += pad->GetSolderMaskExpansion( aLayerId );
|
||||
@@ -589,29 +617,22 @@ void BOARD_ADAPTER::createArcSegments( const VECTOR2I& aCentre, const VECTOR2I&
|
||||
void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM* aOwner, PCB_LAYER_ID aLayer )
|
||||
{
|
||||
LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle();
|
||||
int linewidth = aShape->GetWidth();
|
||||
int margin = 0;
|
||||
bool isSolidFill = aShape->IsSolidFill();
|
||||
bool isHatchedFill = aShape->IsHatchedFill();
|
||||
// The full width of the lines to create
|
||||
int linewidth = aShape->GetWidth();
|
||||
int margin = 0;
|
||||
|
||||
if( IsSolderMaskLayer( aLayer )
|
||||
&& aShape->HasSolderMask()
|
||||
&& IsExternalCopperLayer( aShape->GetLayer() ) )
|
||||
&& aShape->HasSolderMask()
|
||||
&& IsExternalCopperLayer( aShape->GetLayer() ) )
|
||||
{
|
||||
margin = aShape->GetSolderMaskExpansion();
|
||||
linewidth += margin * 2;
|
||||
lineStyle = LINE_STYLE::SOLID;
|
||||
|
||||
if( isHatchedFill )
|
||||
{
|
||||
isSolidFill = true;
|
||||
isHatchedFill = false;
|
||||
}
|
||||
}
|
||||
|
||||
float linewidth3DU = TO_3DU( linewidth );
|
||||
|
||||
LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle();
|
||||
|
||||
if( lineStyle <= LINE_STYLE::FIRST_TYPE )
|
||||
{
|
||||
switch( aShape->GetShape() )
|
||||
@@ -622,7 +643,7 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
float innerR3DU = TO_3DU( aShape->GetRadius() ) - linewidth3DU / 2.0;
|
||||
float outerR3DU = TO_3DU( aShape->GetRadius() ) + linewidth3DU / 2.0;
|
||||
|
||||
if( isSolidFill || innerR3DU <= 0.0 )
|
||||
if( aShape->IsFilled() || innerR3DU <= 0.0 )
|
||||
addFILLED_CIRCLE_2D( aContainer, center3DU, outerR3DU, *aOwner );
|
||||
else
|
||||
addRING_2D( aContainer, center3DU, innerR3DU, outerR3DU, *aOwner );
|
||||
@@ -631,18 +652,19 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
}
|
||||
|
||||
case SHAPE_T::RECTANGLE:
|
||||
if( isSolidFill )
|
||||
if( aShape->IsFilled() )
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
aShape->TransformShapeToPolySet( polyList, UNDEFINED_LAYER, 0, aShape->GetMaxError(),
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF,
|
||||
ERROR_INSIDE );
|
||||
|
||||
polyList.Simplify();
|
||||
|
||||
if( margin != 0 )
|
||||
{
|
||||
polyList.Inflate( margin, CORNER_STRATEGY::ROUND_ALL_CORNERS, aShape->GetMaxError() );
|
||||
polyList.Inflate( margin, CORNER_STRATEGY::ROUND_ALL_CORNERS,
|
||||
GetBoard()->GetDesignSettings().m_MaxError );
|
||||
}
|
||||
|
||||
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
@@ -677,10 +699,11 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, aShape->GetMaxError(),
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF,
|
||||
ERROR_INSIDE );
|
||||
|
||||
// Some polygons can be a bit complex (especially when coming from a
|
||||
@@ -696,56 +719,13 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
CORNER_STRATEGY cornerStr = margin >= 0 ? CORNER_STRATEGY::ROUND_ALL_CORNERS
|
||||
: CORNER_STRATEGY::ALLOW_ACUTE_CORNERS;
|
||||
|
||||
polyList.Inflate( margin, cornerStr, aShape->GetMaxError() );
|
||||
polyList.Inflate( margin, cornerStr, GetBoard()->GetDesignSettings().m_MaxError );
|
||||
}
|
||||
|
||||
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
if( isSolidFill )
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, aShape->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
|
||||
// Some polygons can be a bit complex (especially when coming from a
|
||||
// picture of a text converted to a polygon
|
||||
// So call Simplify before calling ConvertPolygonToTriangles, just in case.
|
||||
polyList.Simplify();
|
||||
|
||||
if( polyList.IsEmpty() ) // Just for caution
|
||||
break;
|
||||
|
||||
if( margin != 0 )
|
||||
{
|
||||
CORNER_STRATEGY cornerStr = margin >= 0 ? CORNER_STRATEGY::ROUND_ALL_CORNERS
|
||||
: CORNER_STRATEGY::ALLOW_ACUTE_CORNERS;
|
||||
|
||||
polyList.Inflate( margin, cornerStr, aShape->GetMaxError() );
|
||||
}
|
||||
|
||||
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<VECTOR2I> pts = aShape->GetCorners();
|
||||
|
||||
for( int i = 0; i < pts.size() - 1; i++ )
|
||||
{
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[i] ), TO_SFVEC2F( pts[i + 1] ), linewidth3DU,
|
||||
*aOwner );
|
||||
}
|
||||
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[pts.size() - 1] ), TO_SFVEC2F( pts[0] ), linewidth3DU,
|
||||
*aOwner );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxT( "BOARD_ADAPTER::addShape no implementation for " )
|
||||
+ aShape->SHAPE_T_asString() );
|
||||
@@ -777,9 +757,6 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
for( SHAPE* shape : shapes )
|
||||
delete shape;
|
||||
}
|
||||
|
||||
if( isHatchedFill )
|
||||
ConvertPolygonToTriangles( aShape->GetHatching(), *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
}
|
||||
|
||||
|
||||
@@ -803,7 +780,7 @@ void BOARD_ADAPTER::addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aC
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
aTextBox->PCB_SHAPE::TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, aTextBox->GetMaxError(),
|
||||
aTextBox->PCB_SHAPE::TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF,
|
||||
ERROR_INSIDE );
|
||||
|
||||
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
@@ -833,7 +810,8 @@ void BOARD_ADAPTER::addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* a
|
||||
PCB_LAYER_ID aLayerId )
|
||||
{
|
||||
// This convert the poly in outline and holes
|
||||
ConvertPolygonToTriangles( *aZone->GetFilledPolysList( aLayerId ), *aContainer, m_biuTo3Dunits, *aZone );
|
||||
ConvertPolygonToTriangles( *aZone->GetFilledPolysList( aLayerId ), *aContainer, m_biuTo3Dunits,
|
||||
*aZone );
|
||||
}
|
||||
|
||||
|
||||
@@ -852,7 +830,8 @@ void BOARD_ADAPTER::buildPadOutlineAsSegments( const PAD* aPad, PCB_LAYER_ID aLa
|
||||
else
|
||||
{
|
||||
// For other shapes, add outlines as thick segments in polygon buffer
|
||||
const std::shared_ptr<SHAPE_POLY_SET>& corners = aPad->GetEffectivePolygon( aLayer, ERROR_INSIDE );
|
||||
const std::shared_ptr<SHAPE_POLY_SET>& corners = aPad->GetEffectivePolygon( aLayer,
|
||||
ERROR_INSIDE );
|
||||
const SHAPE_LINE_CHAIN& path = corners->COutline( 0 );
|
||||
|
||||
for( int j = 0; j < path.PointCount(); j++ )
|
||||
|
||||
@@ -23,17 +23,34 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file create_layer_items.cpp
|
||||
* @brief This file implements the creation of the pcb board.
|
||||
*
|
||||
* It is based on the function found in the files:
|
||||
* board_items_to_polygon_shape_transform.cpp
|
||||
* board_items_to_polygon_shape_transform.cpp
|
||||
*/
|
||||
|
||||
#include "board_adapter.h"
|
||||
#include "../3d_rendering/raytracing/shapes2D/filled_circle_2d.h"
|
||||
#include "raytracing/shapes2D/triangle_2d.h"
|
||||
#include <board_design_settings.h>
|
||||
#include <board.h>
|
||||
#include <footprint.h>
|
||||
#include <layer_range.h>
|
||||
#include <lset.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <pcb_table.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <zone.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <trigo.h>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include <core/arraydim.h>
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <wx/log.h>
|
||||
@@ -42,6 +59,9 @@
|
||||
#include <core/profile.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is used to draw pad outlines on silk layers.
|
||||
*/
|
||||
@@ -77,7 +97,7 @@ void transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLaye
|
||||
if( item->Type() == PCB_SHAPE_T || BaseType( item->Type() ) == PCB_DIMENSION_T )
|
||||
{
|
||||
if( item->GetLayer() == aLayer )
|
||||
item->TransformShapeToPolySet( aBuffer, aLayer, 0, aMaxError, aErrorLoc );
|
||||
item->TransformShapeToPolygon( aBuffer, aLayer, 0, aMaxError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,7 +137,10 @@ void transformFPTextToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
|
||||
{
|
||||
// border
|
||||
if( textbox->IsBorderEnabled() )
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( aBuffer, aLayer, 0, aMaxError, aErrorLoc );
|
||||
{
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( aBuffer, aLayer, 0, aMaxError,
|
||||
aErrorLoc );
|
||||
}
|
||||
|
||||
// text
|
||||
textbox->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc );
|
||||
@@ -125,7 +148,7 @@ void transformFPTextToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
|
||||
}
|
||||
}
|
||||
|
||||
for( const PCB_FIELD* field : aFootprint->GetFields() )
|
||||
for( const PCB_FIELD* field : aFootprint->GetFields( true /* visibleOnly */ ) )
|
||||
{
|
||||
if( !aFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
@@ -136,7 +159,7 @@ void transformFPTextToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
|
||||
if( field->IsValue() && !aFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
|
||||
if( field->GetLayer() == aLayer && field->IsVisible() )
|
||||
if( field && field->GetLayer() == aLayer )
|
||||
field->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
@@ -160,6 +183,8 @@ void BOARD_ADAPTER::destroyLayers()
|
||||
|
||||
DELETE_AND_FREE_MAP( m_layers_poly );
|
||||
|
||||
DELETE_AND_FREE( m_frontPlatedPadAndGraphicPolys )
|
||||
DELETE_AND_FREE( m_backPlatedPadAndGraphicPolys )
|
||||
DELETE_AND_FREE( m_frontPlatedCopperPolys )
|
||||
DELETE_AND_FREE( m_backPlatedCopperPolys )
|
||||
|
||||
@@ -219,10 +244,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
trackList.clear();
|
||||
trackList.reserve( m_board->Tracks().size() );
|
||||
|
||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
|
||||
for( PCB_TRACK* track : m_board->Tracks() )
|
||||
{
|
||||
// Skip tracks (not vias theyt are on more than one layer ) on disabled layers
|
||||
if( track->Type() != PCB_VIA_T && !Is3dLayerEnabled( track->GetLayer(), visibilityFlags ) )
|
||||
if( track->Type() != PCB_VIA_T
|
||||
&& !Is3dLayerEnabled( track->GetLayer(), visibilityFlags ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -274,6 +302,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
if( cfg.DifferentiatePlatedCopper() )
|
||||
{
|
||||
m_frontPlatedPadAndGraphicPolys = new SHAPE_POLY_SET;
|
||||
m_backPlatedPadAndGraphicPolys = new SHAPE_POLY_SET;
|
||||
m_frontPlatedCopperPolys = new SHAPE_POLY_SET;
|
||||
m_backPlatedCopperPolys = new SHAPE_POLY_SET;
|
||||
|
||||
@@ -293,7 +323,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
// Create tracks as objects and add it to container
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layerMap.contains( layer ) );
|
||||
wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() );
|
||||
|
||||
BVH_CONTAINER_2D *layerContainer = m_layerMap[layer];
|
||||
|
||||
@@ -304,8 +334,11 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
continue;
|
||||
|
||||
// Skip vias annulus when not flashed on this layer
|
||||
if( track->Type() == PCB_VIA_T && !static_cast<const PCB_VIA*>( track )->FlashLayer( layer ) )
|
||||
if( track->Type() == PCB_VIA_T
|
||||
&& !static_cast<const PCB_VIA*>( track )->FlashLayer( layer ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add object item to layer container
|
||||
createTrackWithMargin( track, layerContainer, layer );
|
||||
@@ -348,7 +381,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
BVH_CONTAINER_2D *layerHoleContainer = nullptr;
|
||||
|
||||
// Check if the layer is already created
|
||||
if( !m_layerHoleMap.contains( layer ) )
|
||||
if( m_layerHoleMap.find( layer ) == m_layerHoleMap.end() )
|
||||
{
|
||||
// not found, create a new container
|
||||
layerHoleContainer = new BVH_CONTAINER_2D;
|
||||
@@ -361,14 +394,17 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
}
|
||||
|
||||
// Add a hole for this layer
|
||||
layerHoleContainer->Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness,
|
||||
layerHoleContainer->Add( new FILLED_CIRCLE_2D( via_center,
|
||||
hole_inner_radius + thickness,
|
||||
*track ) );
|
||||
}
|
||||
else if( layer == layer_ids[0] ) // it only adds once the THT holes
|
||||
{
|
||||
// Add through hole object
|
||||
m_TH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness, *track ) );
|
||||
m_viaTH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness, *track ) );
|
||||
m_TH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness,
|
||||
*track ) );
|
||||
m_viaTH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness,
|
||||
*track ) );
|
||||
|
||||
if( cfg.clip_silk_on_via_annuli && ring_radius > 0.0 )
|
||||
m_viaAnnuli.Add( new FILLED_CIRCLE_2D( via_center, ring_radius, *track ) );
|
||||
@@ -380,12 +416,12 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
if( cfg.DifferentiatePlatedCopper() && layer == F_Cu )
|
||||
{
|
||||
track->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, track->GetMaxError(),
|
||||
track->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
else if( cfg.DifferentiatePlatedCopper() && layer == B_Cu )
|
||||
{
|
||||
track->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, track->GetMaxError(),
|
||||
track->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
@@ -419,13 +455,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
SHAPE_POLY_SET *layerInnerHolesPoly = nullptr;
|
||||
|
||||
// Check if the layer is already created
|
||||
if( !m_layerHoleOdPolys.contains( layer ) )
|
||||
if( m_layerHoleOdPolys.find( layer ) == m_layerHoleOdPolys.end() )
|
||||
{
|
||||
// not found, create a new container
|
||||
layerOuterHolesPoly = new SHAPE_POLY_SET;
|
||||
m_layerHoleOdPolys[layer] = layerOuterHolesPoly;
|
||||
|
||||
wxASSERT( !m_layerHoleIdPolys.contains( layer ) );
|
||||
wxASSERT( m_layerHoleIdPolys.find( layer ) == m_layerHoleIdPolys.end() );
|
||||
|
||||
layerInnerHolesPoly = new SHAPE_POLY_SET;
|
||||
m_layerHoleIdPolys[layer] = layerInnerHolesPoly;
|
||||
@@ -435,7 +471,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
// found
|
||||
layerOuterHolesPoly = m_layerHoleOdPolys[layer];
|
||||
|
||||
wxASSERT( m_layerHoleIdPolys.contains( layer ) );
|
||||
wxASSERT( m_layerHoleIdPolys.find( layer ) != m_layerHoleIdPolys.end() );
|
||||
|
||||
layerInnerHolesPoly = m_layerHoleIdPolys[layer];
|
||||
}
|
||||
@@ -443,11 +479,11 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
const int holediameter = via->GetDrillValue();
|
||||
const int hole_outer_radius = (holediameter / 2) + GetHolePlatingThickness();
|
||||
|
||||
TransformCircleToPolygon( *layerOuterHolesPoly, via->GetStart(), hole_outer_radius,
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
TransformCircleToPolygon( *layerOuterHolesPoly, via->GetStart(),
|
||||
hole_outer_radius, maxError, ERROR_INSIDE );
|
||||
|
||||
TransformCircleToPolygon( *layerInnerHolesPoly, via->GetStart(), holediameter / 2,
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
TransformCircleToPolygon( *layerInnerHolesPoly, via->GetStart(),
|
||||
holediameter / 2, maxError, ERROR_INSIDE );
|
||||
}
|
||||
else if( layer == layer_ids[0] ) // it only adds once the THT holes
|
||||
{
|
||||
@@ -457,16 +493,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
// Add through hole contours
|
||||
TransformCircleToPolygon( m_TH_ODPolys, via->GetStart(), hole_outer_radius,
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
maxError, ERROR_INSIDE );
|
||||
|
||||
// Add same thing for vias only
|
||||
TransformCircleToPolygon( m_viaTH_ODPolys, via->GetStart(), hole_outer_radius,
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
maxError, ERROR_INSIDE );
|
||||
|
||||
if( cfg.clip_silk_on_via_annuli )
|
||||
{
|
||||
TransformCircleToPolygon( m_viaAnnuliPolys, via->GetStart(), hole_outer_ring_radius,
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
TransformCircleToPolygon( m_viaAnnuliPolys, via->GetStart(),
|
||||
hole_outer_ring_radius, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -478,7 +514,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layers_poly.contains( layer ) );
|
||||
wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() );
|
||||
|
||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[layer];
|
||||
|
||||
@@ -493,11 +529,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
continue;
|
||||
|
||||
// Skip vias annulus when not flashed on this layer
|
||||
if( track->Type() == PCB_VIA_T && !static_cast<const PCB_VIA*>( track )->FlashLayer( layer ) )
|
||||
if( track->Type() == PCB_VIA_T
|
||||
&& !static_cast<const PCB_VIA*>( track )->FlashLayer( layer ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the track/via contour
|
||||
track->TransformShapeToPolygon( *layerPoly, layer, 0, track->GetMaxError(), ERROR_INSIDE );
|
||||
track->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -515,7 +554,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
// The hole in the body is inflated by copper thickness, if not plated, no copper
|
||||
int inflate = 0;
|
||||
|
||||
if( pad->GetAttribute() != PAD_ATTRIB::NPTH )
|
||||
if( pad->GetAttribute () != PAD_ATTRIB::NPTH )
|
||||
inflate = KiROUND( GetHolePlatingThickness() / 2.0 );
|
||||
|
||||
m_holeCount++;
|
||||
@@ -547,56 +586,72 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
// The hole in the body is inflated by copper thickness.
|
||||
const int inflate = GetHolePlatingThickness();
|
||||
|
||||
if( pad->GetAttribute() != PAD_ATTRIB::NPTH )
|
||||
if( pad->GetAttribute () != PAD_ATTRIB::NPTH )
|
||||
{
|
||||
if( cfg.clip_silk_on_via_annuli )
|
||||
pad->TransformHoleToPolygon( m_viaAnnuliPolys, inflate, pad->GetMaxError(), ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( m_viaAnnuliPolys, inflate, maxError, ERROR_INSIDE );
|
||||
|
||||
pad->TransformHoleToPolygon( m_TH_ODPolys, inflate, pad->GetMaxError(), ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( m_TH_ODPolys, inflate, maxError, ERROR_INSIDE );
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not plated, no copper.
|
||||
if( cfg.clip_silk_on_via_annuli )
|
||||
pad->TransformHoleToPolygon( m_viaAnnuliPolys, 0, pad->GetMaxError(), ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( m_viaAnnuliPolys, 0, maxError, ERROR_INSIDE );
|
||||
|
||||
pad->TransformHoleToPolygon( m_NPTH_ODPolys, 0, pad->GetMaxError(), ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( m_NPTH_ODPolys, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add footprints copper items (pads, shapes and text) to containers
|
||||
// Add footprints PADs objects to containers
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layerMap.contains( layer ) );
|
||||
wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() );
|
||||
|
||||
BVH_CONTAINER_2D *layerContainer = m_layerMap[layer];
|
||||
|
||||
for( FOOTPRINT* fp : m_board->Footprints() )
|
||||
// ADD PADS
|
||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||
{
|
||||
addPads( fp, layerContainer, layer );
|
||||
addFootprintShapes( fp, layerContainer, layer, visibilityFlags );
|
||||
addPads( footprint, layerContainer, layer, cfg.DifferentiatePlatedCopper(), false );
|
||||
|
||||
// Add copper item to the plated copper polygon list if required
|
||||
if( cfg.DifferentiatePlatedCopper() && IsExternalCopperLayer( layer ) )
|
||||
// Micro-wave footprints may have items on copper layers
|
||||
addFootprintShapes( footprint, layerContainer, layer, visibilityFlags );
|
||||
}
|
||||
}
|
||||
|
||||
// Add footprints PADs poly contours (vertical outlines)
|
||||
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL )
|
||||
{
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() );
|
||||
|
||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[layer];
|
||||
|
||||
// Add pads to polygon list
|
||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||
{
|
||||
SHAPE_POLY_SET* layerPoly = layer == F_Cu ? m_frontPlatedCopperPolys : m_backPlatedCopperPolys;
|
||||
// Note: NPTH pads are not drawn on copper layers when the pad has same shape as
|
||||
// its hole
|
||||
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE,
|
||||
true, cfg.DifferentiatePlatedCopper(), false );
|
||||
|
||||
fp->TransformPadsToPolySet( *layerPoly, layer, 0, fp->GetMaxError(), ERROR_INSIDE );
|
||||
transformFPTextToPolySet( fp, layer, visibilityFlags, *layerPoly, fp->GetMaxError(), ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( fp, layer, *layerPoly, fp->GetMaxError(), ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
|
||||
// Add copper item to poly contours (vertical outlines) if required
|
||||
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL )
|
||||
if( cfg.DifferentiatePlatedCopper() )
|
||||
{
|
||||
// ADD PLATED PADS contours
|
||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||
{
|
||||
wxASSERT( m_layers_poly.contains( layer ) );
|
||||
footprint->TransformPadsToPolySet( *m_frontPlatedPadAndGraphicPolys, F_Cu, 0, maxError,
|
||||
ERROR_INSIDE, true, false, true );
|
||||
|
||||
SHAPE_POLY_SET* layerPoly = m_layers_poly[layer];
|
||||
|
||||
fp->TransformPadsToPolySet( *layerPoly, layer, 0, fp->GetMaxError(), ERROR_INSIDE );
|
||||
transformFPTextToPolySet( fp, layer, visibilityFlags, *layerPoly, fp->GetMaxError(), ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( fp, layer, *layerPoly, fp->GetMaxError(), ERROR_INSIDE );
|
||||
footprint->TransformPadsToPolySet( *m_backPlatedPadAndGraphicPolys, B_Cu, 0, maxError,
|
||||
ERROR_INSIDE, true, false, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -604,7 +659,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
// Add graphic item on copper layers to object containers
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layerMap.contains( layer ) );
|
||||
wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() );
|
||||
|
||||
BVH_CONTAINER_2D *layerContainer = m_layerMap[layer];
|
||||
|
||||
@@ -640,59 +695,72 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
addShape( static_cast<PCB_DIMENSION_BASE*>( item ), layerContainer, item );
|
||||
break;
|
||||
|
||||
case PCB_REFERENCE_IMAGE_T: // ignore
|
||||
break;
|
||||
|
||||
default:
|
||||
wxLogTrace( m_logTrace, wxT( "createLayers: item type: %d not implemented" ), item->Type() );
|
||||
wxLogTrace( m_logTrace, wxT( "createLayers: item type: %d not implemented" ),
|
||||
item->Type() );
|
||||
break;
|
||||
}
|
||||
|
||||
// Add copper item to the plated copper polygon list if required
|
||||
if( cfg.DifferentiatePlatedCopper() && IsExternalCopperLayer( layer ) )
|
||||
// add also this shape to the plated copper polygon list if required
|
||||
if( cfg.DifferentiatePlatedCopper() )
|
||||
{
|
||||
SHAPE_POLY_SET* copperPolys = layer == F_Cu ? m_frontPlatedCopperPolys : m_backPlatedCopperPolys;
|
||||
|
||||
// Note: for TEXT and TEXTBOX, TransformShapeToPolygon returns the bounding
|
||||
// box shape, not the exact text shape. So it is not used for these items
|
||||
if( item->Type() == PCB_TEXTBOX_T )
|
||||
if( layer == F_Cu || layer == B_Cu )
|
||||
{
|
||||
PCB_TEXTBOX* text_box = static_cast<PCB_TEXTBOX*>( item );
|
||||
text_box->TransformTextToPolySet( *copperPolys, 0, text_box->GetMaxError(), ERROR_INSIDE );
|
||||
SHAPE_POLY_SET* platedCopperPolys = layer == F_Cu
|
||||
? m_frontPlatedCopperPolys
|
||||
: m_backPlatedCopperPolys;
|
||||
|
||||
// Add box outlines
|
||||
text_box->PCB_SHAPE::TransformShapeToPolygon( *copperPolys, layer, 0, text_box->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
else if( item->Type() == PCB_TEXT_T )
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
text->TransformTextToPolySet( *copperPolys, 0, text->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
else if( item->Type() != PCB_REFERENCE_IMAGE_T )
|
||||
{
|
||||
item->TransformShapeToPolySet( *copperPolys, layer, 0, item->GetMaxError(), ERROR_INSIDE );
|
||||
if( item->Type() == PCB_TEXTBOX_T )
|
||||
{
|
||||
PCB_TEXTBOX* text_box = static_cast<PCB_TEXTBOX*>( item );
|
||||
text_box->TransformTextToPolySet( *platedCopperPolys,
|
||||
0, maxError, ERROR_INSIDE );
|
||||
// Add box outlines
|
||||
text_box->PCB_SHAPE::TransformShapeToPolygon( *platedCopperPolys, layer,
|
||||
0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
else if( item->Type() == PCB_TEXT_T )
|
||||
{
|
||||
static_cast<PCB_TEXT*>( item )->TransformTextToPolySet(
|
||||
*platedCopperPolys,
|
||||
0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
else
|
||||
item->TransformShapeToPolygon( *platedCopperPolys, layer,
|
||||
0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add copper item to poly contours (vertical outlines) if required
|
||||
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL )
|
||||
// Add graphic item on copper layers to poly contours (vertical outlines)
|
||||
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL )
|
||||
{
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() );
|
||||
|
||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[layer];
|
||||
|
||||
// Add graphic items on copper layers (texts and other )
|
||||
for( BOARD_ITEM* item : m_board->Drawings() )
|
||||
{
|
||||
wxASSERT( m_layers_poly.contains( layer ) );
|
||||
|
||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[layer];
|
||||
if( !item->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_SHAPE_T:
|
||||
item->TransformShapeToPolySet( *layerPoly, layer, 0, item->GetMaxError(), ERROR_INSIDE );
|
||||
item->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
text->TransformTextToPolySet( *layerPoly, 0, text->GetMaxError(), ERROR_INSIDE );
|
||||
text->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -700,54 +768,17 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
|
||||
if( textbox->IsBorderEnabled() )
|
||||
{
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, textbox->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
textbox->TransformTextToPolySet( *layerPoly, 0, textbox->GetMaxError(), ERROR_INSIDE );
|
||||
textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TABLE_T:
|
||||
{
|
||||
PCB_TABLE* table = static_cast<PCB_TABLE*>( item );
|
||||
|
||||
for( PCB_TABLECELL* cell : table->GetCells() )
|
||||
cell->TransformTextToPolySet( *layerPoly, 0, cell->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
table->DrawBorders(
|
||||
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB,
|
||||
const STROKE_PARAMS& stroke )
|
||||
{
|
||||
SHAPE_SEGMENT seg( ptA, ptB, stroke.GetWidth() );
|
||||
seg.TransformToPolygon( *layerPoly, table->GetMaxError(), ERROR_INSIDE );
|
||||
} );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
{
|
||||
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
|
||||
|
||||
dimension->TransformTextToPolySet( *layerPoly, 0, dimension->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
for( const std::shared_ptr<SHAPE>& shape : dimension->GetShapes() )
|
||||
shape->TransformToPolygon( *layerPoly, dimension->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_REFERENCE_IMAGE_T: // ignore
|
||||
// JEY TODO: tables
|
||||
break;
|
||||
|
||||
default:
|
||||
wxLogTrace( m_logTrace, wxT( "createLayers: item type: %d not implemented" ), item->Type() );
|
||||
wxLogTrace( m_logTrace, wxT( "createLayers: item type: %d not implemented" ),
|
||||
item->Type() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -769,11 +800,15 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
zones.emplace_back( std::make_pair( zone, layer ) );
|
||||
layer_lock.emplace( layer, std::make_unique<std::mutex>() );
|
||||
|
||||
if( cfg.DifferentiatePlatedCopper() && IsExternalCopperLayer( layer ) )
|
||||
if( cfg.DifferentiatePlatedCopper() && layer == F_Cu )
|
||||
{
|
||||
SHAPE_POLY_SET* copperPolys = layer == F_Cu ? m_frontPlatedCopperPolys : m_backPlatedCopperPolys;
|
||||
|
||||
zone->TransformShapeToPolygon( *copperPolys, layer, 0, zone->GetMaxError(), ERROR_INSIDE );
|
||||
zone->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
else if( cfg.DifferentiatePlatedCopper() && layer == B_Cu )
|
||||
{
|
||||
zone->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -800,19 +835,19 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
PCB_LAYER_ID layer = zones[areaId].second;
|
||||
|
||||
if( m_layerMap.contains( layer ) )
|
||||
addSolidAreasShapes( zone, m_layerMap[layer], layer );
|
||||
auto layerContainer = m_layerMap.find( layer );
|
||||
auto layerPolyContainer = m_layers_poly.find( layer );
|
||||
|
||||
if( layerContainer != m_layerMap.end() )
|
||||
addSolidAreasShapes( zone, layerContainer->second, layer );
|
||||
|
||||
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL
|
||||
&& m_layers_poly.contains( layer ) )
|
||||
&& layerPolyContainer != m_layers_poly.end() )
|
||||
{
|
||||
auto mut_it = layer_lock.find( layer );
|
||||
|
||||
if( mut_it != layer_lock.end() )
|
||||
{
|
||||
std::lock_guard< std::mutex > lock( *( mut_it->second ) );
|
||||
zone->TransformSolidAreasShapesToPolygon( layer, *m_layers_poly[layer] );
|
||||
}
|
||||
std::lock_guard< std::mutex > lock( *( mut_it->second ) );
|
||||
zone->TransformSolidAreasShapesToPolygon( layer, *layerPolyContainer->second );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -855,52 +890,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
Dwgs_User,
|
||||
Cmts_User,
|
||||
Eco1_User,
|
||||
Eco2_User,
|
||||
User_1,
|
||||
User_2,
|
||||
User_3,
|
||||
User_4,
|
||||
User_5,
|
||||
User_6,
|
||||
User_7,
|
||||
User_8,
|
||||
User_9,
|
||||
User_10,
|
||||
User_11,
|
||||
User_12,
|
||||
User_13,
|
||||
User_14,
|
||||
User_15,
|
||||
User_16,
|
||||
User_17,
|
||||
User_18,
|
||||
User_19,
|
||||
User_20,
|
||||
User_21,
|
||||
User_22,
|
||||
User_23,
|
||||
User_24,
|
||||
User_25,
|
||||
User_26,
|
||||
User_27,
|
||||
User_28,
|
||||
User_29,
|
||||
User_30,
|
||||
User_31,
|
||||
User_32,
|
||||
User_33,
|
||||
User_34,
|
||||
User_35,
|
||||
User_36,
|
||||
User_37,
|
||||
User_38,
|
||||
User_39,
|
||||
User_40,
|
||||
User_41,
|
||||
User_42,
|
||||
User_43,
|
||||
User_44,
|
||||
User_45,
|
||||
Eco2_User
|
||||
} );
|
||||
|
||||
std::bitset<LAYER_3D_END> enabledFlags = visibilityFlags;
|
||||
@@ -973,15 +963,11 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
continue;
|
||||
|
||||
// Only vias on a external copper layer can have a solder mask
|
||||
PCB_LAYER_ID copper_layer = ( layer == F_Mask ) ? F_Cu : B_Cu;
|
||||
PCB_LAYER_ID copper_layer = layer == F_Mask ? F_Cu : B_Cu;
|
||||
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
{
|
||||
const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
|
||||
|
||||
if( !via->FlashLayer( copper_layer ) )
|
||||
continue;
|
||||
}
|
||||
if( track->Type() == PCB_VIA_T
|
||||
&& !static_cast<const PCB_VIA*>( track )->FlashLayer( copper_layer ) )
|
||||
continue;
|
||||
|
||||
int maskExpansion = track->GetSolderMaskExpansion();
|
||||
createTrackWithMargin( track, layerContainer, layer, maskExpansion );
|
||||
@@ -1005,7 +991,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
}
|
||||
else
|
||||
{
|
||||
addPads( footprint, layerContainer, layer );
|
||||
addPads( footprint, layerContainer, layer, false, false );
|
||||
}
|
||||
|
||||
addFootprintShapes( footprint, layerContainer, layer, visibilityFlags );
|
||||
@@ -1036,14 +1022,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_SHAPE_T:
|
||||
item->TransformShapeToPolySet( *layerPoly, layer, 0, item->GetMaxError(), ERROR_INSIDE );
|
||||
item->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
text->TransformTextToPolySet( *layerPoly, 0, text->GetMaxError(), ERROR_INSIDE );
|
||||
text->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1051,33 +1037,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
|
||||
if( textbox->IsBorderEnabled() )
|
||||
{
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, textbox->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
textbox->TransformTextToPolySet( *layerPoly, 0, textbox->GetMaxError(), ERROR_INSIDE );
|
||||
textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TABLE_T:
|
||||
{
|
||||
PCB_TABLE* table = static_cast<PCB_TABLE*>( item );
|
||||
|
||||
for( PCB_TABLECELL* cell : table->GetCells() )
|
||||
cell->TransformTextToPolySet( *layerPoly, 0, cell->GetMaxError(), ERROR_INSIDE );
|
||||
|
||||
table->DrawBorders(
|
||||
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB,
|
||||
const STROKE_PARAMS& stroke )
|
||||
{
|
||||
SHAPE_SEGMENT seg( ptA, ptB, stroke.GetWidth() );
|
||||
seg.TransformToPolygon( *layerPoly, table->GetMaxError(), ERROR_INSIDE );
|
||||
} );
|
||||
|
||||
// JEY TODO: tables
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -1091,23 +1057,12 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
for( PCB_TRACK* track : m_board->Tracks() )
|
||||
{
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
if( track->Type() == PCB_VIA_T
|
||||
&& static_cast<const PCB_VIA*>( track )->FlashLayer( layer )
|
||||
&& !static_cast<const PCB_VIA*>( track )->IsTented( layer ) )
|
||||
{
|
||||
const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
|
||||
|
||||
if( via->FlashLayer( layer ) && !via->IsTented( layer ) )
|
||||
{
|
||||
track->TransformShapeToPolygon( *layerPoly, layer, maskExpansion, track->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( track->HasSolderMask() )
|
||||
{
|
||||
track->TransformShapeToPolySet( *layerPoly, layer, maskExpansion, track->GetMaxError(),
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
track->TransformShapeToPolygon( *layerPoly, layer, maskExpansion, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1123,19 +1078,21 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
if( pad->IsOnLayer( layer ) )
|
||||
{
|
||||
buildPadOutlineAsPolygon( pad, layer, *layerPoly, linewidth, pad->GetMaxError(),
|
||||
buildPadOutlineAsPolygon( pad, layer, *layerPoly, linewidth, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, footprint->GetMaxError(), ERROR_INSIDE );
|
||||
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
transformFPTextToPolySet( footprint, layer, visibilityFlags, *layerPoly, footprint->GetMaxError(),
|
||||
transformFPTextToPolySet( footprint, layer, visibilityFlags, *layerPoly, maxError,
|
||||
ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( footprint, layer, *layerPoly, footprint->GetMaxError(), ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
if( cfg.show_zones || layer == F_Mask || layer == B_Mask )
|
||||
@@ -1164,9 +1121,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
if( !footprint->GetBoundingBox().Intersects( boardBBox ) )
|
||||
{
|
||||
if( footprint->IsFlipped() )
|
||||
addPads( footprint, m_offboardPadsBack, B_Cu );
|
||||
addPads( footprint, m_offboardPadsBack, B_Cu, false, false );
|
||||
else
|
||||
addPads( footprint, m_offboardPadsFront, F_Cu );
|
||||
addPads( footprint, m_offboardPadsFront, F_Cu, false, false );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1185,25 +1142,59 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
aStatusReporter->Report( _( "Calculating plated copper" ) );
|
||||
|
||||
// TRIM PLATED COPPER TO SOLDERMASK
|
||||
if( m_layers_poly.contains( F_Mask ) )
|
||||
if( m_layers_poly.find( F_Mask ) != m_layers_poly.end() )
|
||||
{
|
||||
m_frontPlatedCopperPolys->BooleanIntersection( *m_layers_poly.at( F_Mask ) );
|
||||
}
|
||||
|
||||
if( m_layers_poly.contains( B_Mask ))
|
||||
if( m_layers_poly.find( B_Mask ) != m_layers_poly.end() )
|
||||
{
|
||||
m_backPlatedCopperPolys->BooleanIntersection( *m_layers_poly.at( B_Mask ) );
|
||||
}
|
||||
|
||||
// Subtract plated copper from unplated copper
|
||||
if( m_layers_poly.contains( F_Cu ) )
|
||||
m_layers_poly[F_Cu]->BooleanSubtract( *m_frontPlatedCopperPolys );
|
||||
bool hasF_Cu = false;
|
||||
bool hasB_Cu = false;
|
||||
|
||||
if( m_layers_poly.contains( B_Cu ) )
|
||||
if( m_layers_poly.find( F_Cu ) != m_layers_poly.end() )
|
||||
{
|
||||
m_layers_poly[F_Cu]->BooleanSubtract( *m_frontPlatedPadAndGraphicPolys );
|
||||
m_layers_poly[F_Cu]->BooleanSubtract( *m_frontPlatedCopperPolys );
|
||||
hasF_Cu = true;
|
||||
}
|
||||
|
||||
if( m_layers_poly.find( B_Cu ) != m_layers_poly.end() )
|
||||
{
|
||||
m_layers_poly[B_Cu]->BooleanSubtract( *m_backPlatedPadAndGraphicPolys );
|
||||
m_layers_poly[B_Cu]->BooleanSubtract( *m_backPlatedCopperPolys );
|
||||
hasB_Cu = true;
|
||||
}
|
||||
|
||||
// Add plated graphic items to build vertical walls
|
||||
if( hasF_Cu && m_frontPlatedCopperPolys->OutlineCount() )
|
||||
m_frontPlatedPadAndGraphicPolys->Append( *m_frontPlatedCopperPolys );
|
||||
|
||||
if( hasB_Cu && m_backPlatedCopperPolys->OutlineCount() )
|
||||
m_backPlatedPadAndGraphicPolys->Append( *m_backPlatedCopperPolys );
|
||||
|
||||
m_frontPlatedPadAndGraphicPolys->Simplify();
|
||||
m_backPlatedPadAndGraphicPolys->Simplify();
|
||||
m_frontPlatedCopperPolys->Simplify();
|
||||
m_backPlatedCopperPolys->Simplify();
|
||||
|
||||
// ADD PLATED PADS
|
||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||
{
|
||||
addPads( footprint, m_platedPadsFront, F_Cu, false, true );
|
||||
addPads( footprint, m_platedPadsBack, B_Cu, false, true );
|
||||
}
|
||||
|
||||
// ADD PLATED COPPER
|
||||
ConvertPolygonToTriangles( *m_frontPlatedCopperPolys, *m_platedPadsFront, m_biuTo3Dunits,
|
||||
*DELETED_BOARD_ITEM::GetInstance() );
|
||||
*m_board->GetItem( niluuid ) );
|
||||
|
||||
ConvertPolygonToTriangles( *m_backPlatedCopperPolys, *m_platedPadsBack, m_biuTo3Dunits,
|
||||
*DELETED_BOARD_ITEM::GetInstance() );
|
||||
*m_board->GetItem( niluuid ) );
|
||||
|
||||
m_platedPadsFront->BuildBVH();
|
||||
m_platedPadsBack->BuildBVH();
|
||||
@@ -1252,11 +1243,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
i < selected_layer_id.size();
|
||||
i = nextItem.fetch_add( 1 ) )
|
||||
{
|
||||
if( m_layers_poly.contains( selected_layer_id[i] ) )
|
||||
auto layerPoly = m_layers_poly.find( selected_layer_id[i] );
|
||||
|
||||
if( layerPoly != m_layers_poly.end() )
|
||||
{
|
||||
// This will make a union of all added contours
|
||||
m_layers_poly[ selected_layer_id[i] ]->ClearArcs();
|
||||
m_layers_poly[ selected_layer_id[i] ]->Simplify();
|
||||
layerPoly->second->ClearArcs();
|
||||
layerPoly->second->Simplify();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1277,13 +1270,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
if( m_layerHoleOdPolys.contains( layer ) )
|
||||
if( m_layerHoleOdPolys.find( layer ) != m_layerHoleOdPolys.end() )
|
||||
{
|
||||
// found
|
||||
SHAPE_POLY_SET *polyLayer = m_layerHoleOdPolys[layer];
|
||||
polyLayer->Simplify();
|
||||
|
||||
wxASSERT( m_layerHoleIdPolys.contains( layer ) );
|
||||
wxASSERT( m_layerHoleIdPolys.find( layer ) != m_layerHoleIdPolys.end() );
|
||||
|
||||
polyLayer = m_layerHoleIdPolys[layer];
|
||||
polyLayer->Simplify();
|
||||
|
||||
@@ -451,7 +451,7 @@ void EDA_3D_CANVAS::DoRePaint()
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't attempt to ray trace if OpenGL doesn't support it.
|
||||
// Don't attend to ray trace if OpenGL doesn't support it.
|
||||
if( !m_opengl_supports_raytracing )
|
||||
{
|
||||
m_3d_render = m_3d_render_opengl;
|
||||
@@ -459,7 +459,7 @@ void EDA_3D_CANVAS::DoRePaint()
|
||||
m_boardAdapter.m_Cfg->m_Render.engine = RENDER_ENGINE::OPENGL;
|
||||
}
|
||||
|
||||
// Check if a raytracing was requested and need to switch to raytracing mode
|
||||
// Check if a raytacing was requested and need to switch to raytracing mode
|
||||
if( m_boardAdapter.m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||
{
|
||||
const bool was_camera_changed = m_camera.ParametersChanged();
|
||||
@@ -583,19 +583,6 @@ void EDA_3D_CANVAS::DoRePaint()
|
||||
Request_refresh( false );
|
||||
}
|
||||
|
||||
static constexpr std::array<VIEW3D_TYPE, static_cast<int>( SPHERES_GIZMO::GizmoSphereSelection::Count )>
|
||||
viewTable = { VIEW3D_TYPE::VIEW3D_RIGHT, VIEW3D_TYPE::VIEW3D_LEFT, VIEW3D_TYPE::VIEW3D_BACK,
|
||||
VIEW3D_TYPE::VIEW3D_FRONT, VIEW3D_TYPE::VIEW3D_TOP, VIEW3D_TYPE::VIEW3D_BOTTOM };
|
||||
|
||||
SPHERES_GIZMO::GizmoSphereSelection selectedGizmoSphere = m_3d_render_opengl->getSelectedGizmoSphere();
|
||||
int index = static_cast<int>( selectedGizmoSphere );
|
||||
if( index >= 0 && index < static_cast<int>( viewTable.size() ) )
|
||||
{
|
||||
SetView3D( viewTable[index] );
|
||||
}
|
||||
|
||||
m_3d_render_opengl->resetSelectedGizmoSphere();
|
||||
|
||||
m_is_currently_painting.clear();
|
||||
}
|
||||
|
||||
@@ -872,22 +859,6 @@ void EDA_3D_CANVAS::OnLeftUp( wxMouseEvent& event )
|
||||
m_mouse_is_moving = false;
|
||||
restart_editingTimeOut_Timer();
|
||||
}
|
||||
|
||||
wxSize logicalSize = GetClientSize();
|
||||
int logicalW = logicalSize.GetWidth();
|
||||
int logicalH = logicalSize.GetHeight();
|
||||
|
||||
int gizmo_x, gizmo_y, gizmo_width, gizmo_height;
|
||||
std::tie( gizmo_x, gizmo_y, gizmo_width, gizmo_height ) = m_3d_render_opengl->getGizmoViewport();
|
||||
|
||||
float scaleX = static_cast<float>( gizmo_width ) / logicalW;
|
||||
float scaleY = static_cast<float>( gizmo_height ) / logicalH;
|
||||
|
||||
int scaledMouseX = static_cast<int>( event.GetX() * scaleX );
|
||||
int scaledMouseY = static_cast<int>( ( logicalH - event.GetY() ) * scaleY );
|
||||
|
||||
m_3d_render_opengl->handleGizmoMouseInput( scaledMouseX, scaledMouseY );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -1124,14 +1095,14 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
|
||||
|
||||
void EDA_3D_CANVAS::RenderEngineChanged()
|
||||
{
|
||||
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
|
||||
switch( cfg->m_Render.engine )
|
||||
{
|
||||
switch( cfg->m_Render.engine )
|
||||
{
|
||||
case RENDER_ENGINE::OPENGL: m_3d_render = m_3d_render_opengl; break;
|
||||
case RENDER_ENGINE::RAYTRACING: m_3d_render = m_3d_render_raytracing; break;
|
||||
default: m_3d_render = nullptr; break;
|
||||
}
|
||||
case RENDER_ENGINE::OPENGL: m_3d_render = m_3d_render_opengl; break;
|
||||
case RENDER_ENGINE::RAYTRACING: m_3d_render = m_3d_render_raytracing; break;
|
||||
default: m_3d_render = nullptr; break;
|
||||
}
|
||||
|
||||
if( m_3d_render )
|
||||
|
||||
@@ -157,7 +157,7 @@ void EDA_3D_MODEL_VIEWER::Set3DModel( const wxString& aModelPathName)
|
||||
|
||||
if( m_cacheManager )
|
||||
{
|
||||
const S3DMODEL* model = m_cacheManager->GetModel( aModelPathName, wxEmptyString, {} );
|
||||
const S3DMODEL* model = m_cacheManager->GetModel( aModelPathName, wxEmptyString, nullptr );
|
||||
|
||||
if( model )
|
||||
Set3DModel( (const S3DMODEL &)*model );
|
||||
|
||||
@@ -1,368 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright 2025, Damjan Prerad <damjanovmail@gmail.com>
|
||||
* Copyright (C) The KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <glm/geometric.hpp>
|
||||
|
||||
#include "3d_spheres_gizmo.h"
|
||||
|
||||
|
||||
SPHERES_GIZMO::~SPHERES_GIZMO()
|
||||
{
|
||||
if( m_quadric )
|
||||
{
|
||||
gluDeleteQuadric( m_quadric );
|
||||
m_quadric = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SPHERES_GIZMO::SPHERES_GIZMO( int aGizmoPosX, int aGizmoPosY )
|
||||
{
|
||||
m_gizmoPosX = aGizmoPosX;
|
||||
m_gizmoPosY = aGizmoPosY;
|
||||
|
||||
m_quadric = gluNewQuadric();
|
||||
gluQuadricNormals( m_quadric, GLU_SMOOTH );
|
||||
}
|
||||
|
||||
|
||||
void SPHERES_GIZMO::setViewport( int ax, int ay, int aWidth, int aHeight )
|
||||
{
|
||||
m_viewportX = ax;
|
||||
m_viewportY = ay;
|
||||
m_viewportW = aWidth;
|
||||
m_viewportH = aHeight;
|
||||
}
|
||||
|
||||
|
||||
std::tuple<int, int, int, int> SPHERES_GIZMO::getViewport() const
|
||||
{
|
||||
return std::make_tuple( m_viewportX, m_viewportY, m_viewportW, m_viewportH );
|
||||
}
|
||||
|
||||
|
||||
void SPHERES_GIZMO::setGizmoPosition( int ax, int ay )
|
||||
{
|
||||
m_gizmoPosX = ax;
|
||||
m_gizmoPosY = ay;
|
||||
}
|
||||
|
||||
|
||||
void SPHERES_GIZMO::setGizmoMaterial()
|
||||
{
|
||||
glEnable( GL_COLOR_MATERIAL );
|
||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||
|
||||
const SFVEC4F ambient = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
const SFVEC4F diffuse = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
const SFVEC4F emissive = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
const SFVEC4F specular = SFVEC4F( 0.1f, 0.1f, 0.1f, 1.0f );
|
||||
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r );
|
||||
glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, 96.0f );
|
||||
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r );
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r );
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.r );
|
||||
}
|
||||
|
||||
void SPHERES_GIZMO::handleMouseInput( int aMouseX, int aMouseY )
|
||||
{
|
||||
int smallViewportW = m_viewportH / 8;
|
||||
int smallViewportH = m_viewportH / 8;
|
||||
|
||||
bool inside = ( aMouseX >= m_gizmoPosX && aMouseX <= m_gizmoPosX + smallViewportW && aMouseY >= m_gizmoPosY
|
||||
&& aMouseY <= m_gizmoPosY + smallViewportH );
|
||||
|
||||
if( inside )
|
||||
{
|
||||
m_ndcX = 2.0f * static_cast<float>( aMouseX - m_gizmoPosX ) / smallViewportW - 1.0f;
|
||||
m_ndcY = 2.0f * static_cast<float>( aMouseY - m_gizmoPosY ) / smallViewportH - 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ndcX = -1.0f;
|
||||
m_ndcY = -1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SPHERES_GIZMO::render3dSpheresGizmo( glm::mat4 aCameraRotationMatrix )
|
||||
{
|
||||
float fov = 60.0f;
|
||||
|
||||
glDisable( GL_CULL_FACE );
|
||||
|
||||
// Set up a square viewport (Y x Y)
|
||||
glViewport( m_gizmoPosX, m_gizmoPosY, m_viewportH / 8, m_viewportH / 8 );
|
||||
glClear( GL_DEPTH_BUFFER_BIT );
|
||||
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
|
||||
gluPerspective( fov, 1.0f, 0.001f, 2.0f * RANGE_SCALE_3D );
|
||||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
glm::mat4 TranslationMatrix = glm::translate( glm::mat4( 1.0f ), SFVEC3F( 0.0f, 0.0f, -( m_arrowSize * 2.75f ) ) );
|
||||
glm::mat4 ViewMatrix = TranslationMatrix * aCameraRotationMatrix;
|
||||
glLoadMatrixf( glm::value_ptr( ViewMatrix ) );
|
||||
|
||||
setGizmoMaterial();
|
||||
|
||||
// Intersection test
|
||||
glm::mat4 proj = glm::perspective( glm::radians( fov ), 1.0f, 0.001f, 2.0f * RANGE_SCALE_3D );
|
||||
glm::mat4 invVP = glm::inverse( proj * ViewMatrix );
|
||||
|
||||
glm::vec4 rayStartNDC( m_ndcX, m_ndcY, -1.0f, 1.0f );
|
||||
glm::vec4 rayEndNDC( m_ndcX, m_ndcY, 1.0f, 1.0f );
|
||||
|
||||
glm::vec4 rayStartWorld = invVP * rayStartNDC;
|
||||
rayStartWorld /= rayStartWorld.w;
|
||||
|
||||
glm::vec4 rayEndWorld = invVP * rayEndNDC;
|
||||
rayEndWorld /= rayEndWorld.w;
|
||||
|
||||
glm::vec3 rayOrigin = glm::vec3( rayStartWorld );
|
||||
glm::vec3 rayDirection = glm::normalize( glm::vec3( rayEndWorld - rayStartWorld ) );
|
||||
|
||||
auto intersects =
|
||||
[]( const glm::vec3& aRayOrigin, const glm::vec3& aRayDir, const glm::vec3& aSphereCenter, float aRadius )
|
||||
{
|
||||
glm::vec3 L = aSphereCenter - aRayOrigin;
|
||||
float tca = glm::dot( L, aRayDir );
|
||||
float d2 = glm::dot( L, L ) - tca * tca;
|
||||
return d2 <= aRadius * aRadius;
|
||||
};
|
||||
|
||||
int clickedIndex = -1;
|
||||
m_selectedGizmoSphere = GizmoSphereSelection::None;
|
||||
for( size_t i = 0; i < m_spheres.size(); ++i )
|
||||
{
|
||||
const auto& sphere = m_spheres[i];
|
||||
if( intersects( rayOrigin, rayDirection, sphere.m_position, sphere.m_radius ) )
|
||||
{
|
||||
clickedIndex = static_cast<int>( i );
|
||||
|
||||
m_selectedGizmoSphere = static_cast<GizmoSphereSelection>( i );
|
||||
break; // only pick the first intersected sphere
|
||||
}
|
||||
}
|
||||
|
||||
// Update colors
|
||||
for( size_t i = 0; i < m_spheres.size(); ++i )
|
||||
{
|
||||
if( static_cast<int>( i ) == clickedIndex )
|
||||
{
|
||||
m_spheres[i].m_color = { 1.0f, 1.0f, 1.0f }; // White
|
||||
}
|
||||
else
|
||||
{
|
||||
m_spheres[i].m_color = m_spheres[i].m_originalColor; // Restore default
|
||||
}
|
||||
}
|
||||
|
||||
// Intersection test done
|
||||
|
||||
auto drawBillboardCircle = []( const glm::vec3& aCenter, float aRadius, const glm::vec3& aColor,
|
||||
const glm::vec3& aCamRight, const glm::vec3& aCamUp, int aSegments = 64 )
|
||||
{
|
||||
float thickness = aRadius * 0.4f;
|
||||
glColor3f( aColor.r, aColor.g, aColor.b );
|
||||
|
||||
glBegin( GL_TRIANGLE_STRIP );
|
||||
for( int i = 0; i <= aSegments; ++i )
|
||||
{
|
||||
float angle = 2.0f * glm::pi<float>() * i / aSegments;
|
||||
glm::vec3 dir = cos( angle ) * aCamRight + sin( angle ) * aCamUp;
|
||||
|
||||
glm::vec3 outer = aCenter + dir * ( aRadius + thickness * 0.5f );
|
||||
glm::vec3 inner = aCenter + dir * ( aRadius - thickness * 0.5f );
|
||||
|
||||
glVertex3f( outer.x, outer.y, outer.z );
|
||||
glVertex3f( inner.x, inner.y, inner.z );
|
||||
}
|
||||
glEnd();
|
||||
};
|
||||
|
||||
glm::vec3 camRight( aCameraRotationMatrix[0][0], aCameraRotationMatrix[1][0], aCameraRotationMatrix[2][0] );
|
||||
glm::vec3 camUp( aCameraRotationMatrix[0][1], aCameraRotationMatrix[1][1], aCameraRotationMatrix[2][1] );
|
||||
|
||||
glEnable( GL_BLEND );
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
|
||||
for( const auto& sphere : m_spheres )
|
||||
{
|
||||
glColor4f( sphere.m_color.r, sphere.m_color.g, sphere.m_color.b, 0.3f );
|
||||
glPushMatrix();
|
||||
glTranslatef( sphere.m_position.x, sphere.m_position.y, sphere.m_position.z );
|
||||
if( m_quadric )
|
||||
{
|
||||
gluSphere( m_quadric, sphere.m_radius, 32, 32 );
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
drawBillboardCircle( sphere.m_position, sphere.m_radius, sphere.m_color, camRight, camUp );
|
||||
}
|
||||
|
||||
// Draw sphere labels
|
||||
|
||||
glDisable( GL_DEPTH_TEST );
|
||||
glDisable( GL_LIGHTING );
|
||||
|
||||
std::array<std::string, 6> labels = { "X", "", "Y", "", "Z", "" };
|
||||
|
||||
// View direction (camera looks along negative Z in view space)
|
||||
// So we offset a little toward the camera to avoid z-fighting
|
||||
glm::vec3 offset = glm::normalize( -rayDirection ) * 0.02f;
|
||||
|
||||
glColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
|
||||
auto drawX = []( const glm::vec3& aPos, float aSize, const glm::vec3& aColor, const glm::vec3& aCamRight,
|
||||
const glm::vec3& aCamUp )
|
||||
{
|
||||
glColor3f( aColor.r, aColor.g, aColor.b );
|
||||
glLineWidth( 3.0f );
|
||||
|
||||
float h = aSize * 0.5f;
|
||||
|
||||
// Define two diagonal line directions in camera-facing plane
|
||||
glm::vec3 dir1 = ( -aCamRight + aCamUp ) * h; // one diagonal
|
||||
glm::vec3 dir2 = ( -aCamRight - aCamUp ) * h; // other diagonal
|
||||
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( ( aPos - dir1 ).x, ( aPos - dir1 ).y, ( aPos - dir1 ).z );
|
||||
glVertex3f( ( aPos + dir1 ).x, ( aPos + dir1 ).y, ( aPos + dir1 ).z );
|
||||
|
||||
glVertex3f( ( aPos - dir2 ).x, ( aPos - dir2 ).y, ( aPos - dir2 ).z );
|
||||
glVertex3f( ( aPos + dir2 ).x, ( aPos + dir2 ).y, ( aPos + dir2 ).z );
|
||||
glEnd();
|
||||
};
|
||||
|
||||
auto drawY = []( const glm::vec3& aPos, float aSize, const glm::vec3& aColor, const glm::vec3& aCamRight,
|
||||
const glm::vec3& aCamUp )
|
||||
{
|
||||
glColor3f( aColor.r, aColor.g, aColor.b );
|
||||
glLineWidth( 3.0f );
|
||||
|
||||
float h = aSize * 0.5f;
|
||||
|
||||
// Top-left and top-right in screen plane
|
||||
glm::vec3 topLeft = aPos + aCamUp * h - aCamRight * h;
|
||||
glm::vec3 topRight = aPos + aCamUp * h + aCamRight * h;
|
||||
glm::vec3 bottom = aPos - aCamUp * h;
|
||||
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( topLeft.x, topLeft.y, topLeft.z );
|
||||
glVertex3f( aPos.x, aPos.y, aPos.z );
|
||||
|
||||
glVertex3f( topRight.x, topRight.y, topRight.z );
|
||||
glVertex3f( aPos.x, aPos.y, aPos.z );
|
||||
|
||||
glVertex3f( aPos.x, aPos.y, aPos.z );
|
||||
glVertex3f( bottom.x, bottom.y, bottom.z );
|
||||
glEnd();
|
||||
};
|
||||
|
||||
auto drawZ = []( const glm::vec3& aPos, float aSize, const glm::vec3& aColor, const glm::vec3& aCamRight,
|
||||
const glm::vec3& aCamUp )
|
||||
{
|
||||
glColor3f( aColor.r, aColor.g, aColor.b );
|
||||
glLineWidth( 3.0f );
|
||||
|
||||
float h = aSize * 0.5f;
|
||||
|
||||
// Define corners in screen plane relative to camera
|
||||
glm::vec3 topLeft = aPos + aCamUp * h - aCamRight * h;
|
||||
glm::vec3 topRight = aPos + aCamUp * h + aCamRight * h;
|
||||
glm::vec3 bottomLeft = aPos - aCamUp * h - aCamRight * h;
|
||||
glm::vec3 bottomRight = aPos - aCamUp * h + aCamRight * h;
|
||||
|
||||
glBegin( GL_LINE_STRIP );
|
||||
glVertex3f( topLeft.x, topLeft.y, topLeft.z );
|
||||
glVertex3f( topRight.x, topRight.y, topRight.z );
|
||||
glVertex3f( bottomLeft.x, bottomLeft.y, bottomLeft.z );
|
||||
glVertex3f( bottomRight.x, bottomRight.y, bottomRight.z );
|
||||
glEnd();
|
||||
};
|
||||
|
||||
for( size_t i = 0; i < m_spheres.size(); ++i )
|
||||
{
|
||||
if( labels[i].empty() )
|
||||
continue;
|
||||
|
||||
glm::vec3 textPos = m_spheres[i].m_position + offset;
|
||||
const std::string& label = labels[i];
|
||||
|
||||
if( label == "X" )
|
||||
{
|
||||
drawX( textPos, 0.30f, glm::vec3( 0.0f ), camRight, camUp );
|
||||
}
|
||||
else if( label == "Y" )
|
||||
{
|
||||
drawY( textPos, 0.30f, glm::vec3( 0.0f ), camRight, camUp );
|
||||
}
|
||||
else if( label == "Z" )
|
||||
{
|
||||
drawZ( textPos, 0.30f, glm::vec3( 0.0f ), camRight, camUp );
|
||||
}
|
||||
}
|
||||
|
||||
glEnable( GL_LIGHTING );
|
||||
glEnable( GL_DEPTH_TEST );
|
||||
|
||||
// Draw lines only to the positive axis spheres
|
||||
glLineWidth( 2.0f );
|
||||
glBegin( GL_LINES );
|
||||
|
||||
glColor3f( 0.9f, 0.0f, 0.0f ); // X+
|
||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||
glVertex3f( m_arrowSize, 0.0f, 0.0f );
|
||||
|
||||
glColor3f( 0.0f, 0.9f, 0.0f ); // Y+
|
||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||
glVertex3f( 0.0f, m_arrowSize, 0.0f );
|
||||
|
||||
glColor3f( 0.0f, 0.0f, 0.9f ); // Z+
|
||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||
glVertex3f( 0.0f, 0.0f, m_arrowSize );
|
||||
|
||||
glEnd();
|
||||
|
||||
glEnable( GL_CULL_FACE );
|
||||
}
|
||||
|
||||
SPHERES_GIZMO::GizmoSphereSelection SPHERES_GIZMO::getSelectedGizmoSphere() const
|
||||
{
|
||||
return m_selectedGizmoSphere;
|
||||
}
|
||||
|
||||
void SPHERES_GIZMO::resetSelectedGizmoSphere()
|
||||
{
|
||||
m_selectedGizmoSphere = GizmoSphereSelection::None;
|
||||
m_ndcX = -1.0f;
|
||||
m_ndcY = -1.0f;
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright 2025, Damjan Prerad <damjanovmail@gmail.com>
|
||||
* Copyright (C) The KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _3D_SPHERES_GIZMO_H_
|
||||
#define _3D_SPHERES_GIZMO_H_
|
||||
|
||||
#include "../render_3d_base.h"
|
||||
|
||||
/**
|
||||
* @class SPHERES_GIZMO
|
||||
* @brief Renders a set of colored spheres in 3D space that act as a directional orientation gizmo.
|
||||
*/
|
||||
class SPHERES_GIZMO
|
||||
{
|
||||
public:
|
||||
SPHERES_GIZMO( int aGizmoPosX, int aGizmoPosY );
|
||||
~SPHERES_GIZMO();
|
||||
|
||||
void setViewport( int ax, int ay, int aWidth, int aHeight );
|
||||
std::tuple<int, int, int, int> getViewport() const;
|
||||
void setGizmoPosition( int ax, int ay );
|
||||
|
||||
void handleMouseInput( int aMouseX, int aMouseY );
|
||||
|
||||
/**
|
||||
* @enum GizmoSphereSelection
|
||||
* @brief Enum to indicate which sphere (direction) is selected.
|
||||
*/
|
||||
enum class GizmoSphereSelection
|
||||
{
|
||||
None = -1, ///< No sphere selected.
|
||||
Right = 0, ///< +X direction.
|
||||
Left, ///< -X direction.
|
||||
Back, ///< +Y direction.
|
||||
Front, ///< -Y direction.
|
||||
Top, ///< +Z direction.
|
||||
Bottom, ///< -Z direction.
|
||||
Count ///< Number of selectable spheres.
|
||||
};
|
||||
|
||||
GizmoSphereSelection getSelectedGizmoSphere() const;
|
||||
void resetSelectedGizmoSphere();
|
||||
void render3dSpheresGizmo( glm::mat4 aCameraRotationMatrix );
|
||||
|
||||
private:
|
||||
void setGizmoMaterial();
|
||||
|
||||
GLUquadric* m_quadric = nullptr;
|
||||
|
||||
int m_gizmoPosX = 0;
|
||||
int m_gizmoPosY = 0;
|
||||
|
||||
int m_viewportX = 0;
|
||||
int m_viewportY = 0;
|
||||
int m_viewportW = 0;
|
||||
int m_viewportH = 0;
|
||||
|
||||
float m_ndcX = -1.0f;
|
||||
float m_ndcY = -1.0f;
|
||||
|
||||
struct GizmoSphere
|
||||
{
|
||||
glm::vec3 m_position;
|
||||
float m_radius;
|
||||
glm::vec3 m_labelPosition;
|
||||
glm::vec3 m_color;
|
||||
glm::vec3 m_originalColor;
|
||||
};
|
||||
|
||||
// Define sphere positions
|
||||
const float m_arrowSize = RANGE_SCALE_3D * 0.20f;
|
||||
const float m_sphereRadius = 0.05f * RANGE_SCALE_3D;
|
||||
|
||||
/**
|
||||
* @brief List of all directional gizmo spheres.
|
||||
* The order follows the GizmoSphereSelection enum.
|
||||
*/
|
||||
std::array<GizmoSphere, 6> m_spheres = { { { { m_arrowSize, 0.0f, 0.0f },
|
||||
m_sphereRadius,
|
||||
{ m_arrowSize + 0.02f, 0.0f, 0.0f },
|
||||
{ 0.9f, 0.0f, 0.0f },
|
||||
{ 0.9f, 0.0f, 0.0f } },
|
||||
{ { -m_arrowSize, 0.0f, 0.0f },
|
||||
m_sphereRadius,
|
||||
{ -m_arrowSize - 0.02f, 0.0f, 0.0f },
|
||||
{ 0.4f, 0.0f, 0.0f },
|
||||
{ 0.4f, 0.0f, 0.0f } },
|
||||
{ { 0.0f, m_arrowSize, 0.0f },
|
||||
m_sphereRadius,
|
||||
{ 0.0f, m_arrowSize + 0.02f, 0.0f },
|
||||
{ 0.0f, 0.9f, 0.0f },
|
||||
{ 0.0f, 0.9f, 0.0f } },
|
||||
{ { 0.0f, -m_arrowSize, 0.0f },
|
||||
m_sphereRadius,
|
||||
{ 0.0f, -m_arrowSize - 0.02f, 0.0f },
|
||||
{ 0.0f, 0.4f, 0.0f },
|
||||
{ 0.0f, 0.4f, 0.0f } },
|
||||
{ { 0.0f, 0.0f, m_arrowSize },
|
||||
m_sphereRadius,
|
||||
{ 0.0f, 0.0f, m_arrowSize + 0.02f },
|
||||
{ 0.0f, 0.0f, 0.9f },
|
||||
{ 0.0f, 0.0f, 0.9f } },
|
||||
{ { 0.0f, 0.0f, -m_arrowSize },
|
||||
m_sphereRadius,
|
||||
{ 0.0f, 0.0f, -m_arrowSize - 0.02f },
|
||||
{ 0.0f, 0.0f, 0.4f },
|
||||
{ 0.0f, 0.0f, 0.4f } } } };
|
||||
|
||||
GizmoSphereSelection m_selectedGizmoSphere = GizmoSphereSelection::None;
|
||||
};
|
||||
|
||||
#endif // _3D_SPHERES_GIZMO_H_
|
||||
@@ -481,8 +481,9 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
SHAPE_POLY_SET board_poly_with_holes = m_boardAdapter.GetBoardPoly().CloneDropTriangulation();
|
||||
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetTH_ODPolys() );
|
||||
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys() );
|
||||
|
||||
m_boardWithHoles = createBoard( board_poly_with_holes, &m_boardAdapter.GetTH_IDs() );
|
||||
m_boardWithHoles = createBoard( board_poly_with_holes );
|
||||
|
||||
if( m_antiBoard )
|
||||
m_antiBoard->SetItIsTransparent( true );
|
||||
@@ -566,7 +567,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.opengl_copper_thickness )
|
||||
{
|
||||
if( map_poly.contains( layer ) )
|
||||
if( map_poly.find( layer ) != map_poly.end() )
|
||||
{
|
||||
polyListSubtracted = *map_poly.at( layer );
|
||||
|
||||
@@ -583,11 +584,11 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk )
|
||||
{
|
||||
if( layer == B_SilkS && map_poly.contains( B_Mask ) )
|
||||
if( layer == B_SilkS && map_poly.find( B_Mask ) != map_poly.end() )
|
||||
{
|
||||
polyListSubtracted.BooleanSubtract( *map_poly.at( B_Mask ) );
|
||||
}
|
||||
else if( layer == F_SilkS && map_poly.contains( F_Mask ) )
|
||||
else if( layer == F_SilkS && map_poly.find( F_Mask ) != map_poly.end() )
|
||||
{
|
||||
polyListSubtracted.BooleanSubtract( *map_poly.at( F_Mask ) );
|
||||
}
|
||||
@@ -606,12 +607,14 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.DifferentiatePlatedCopper() )
|
||||
{
|
||||
const SHAPE_POLY_SET* frontPlatedCopperPolys = m_boardAdapter.GetFrontPlatedCopperPolys();
|
||||
const SHAPE_POLY_SET* backPlatedCopperPolys = m_boardAdapter.GetBackPlatedCopperPolys();
|
||||
const SHAPE_POLY_SET* frontPlatedPadAndGraphicPolys =
|
||||
m_boardAdapter.GetFrontPlatedPadAndGraphicPolys();
|
||||
const SHAPE_POLY_SET* backPlatedPadAndGraphicPolys =
|
||||
m_boardAdapter.GetBackPlatedPadAndGraphicPolys();
|
||||
|
||||
if( frontPlatedCopperPolys )
|
||||
if( frontPlatedPadAndGraphicPolys )
|
||||
{
|
||||
SHAPE_POLY_SET poly = frontPlatedCopperPolys->CloneDropTriangulation();
|
||||
SHAPE_POLY_SET poly = frontPlatedPadAndGraphicPolys->CloneDropTriangulation();
|
||||
poly.BooleanIntersection( m_boardAdapter.GetBoardPoly() );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetTH_ODPolys() );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys() );
|
||||
@@ -624,9 +627,9 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
m_layers[F_Cu] = generateEmptyLayerList( F_Cu );
|
||||
}
|
||||
|
||||
if( backPlatedCopperPolys )
|
||||
if( backPlatedPadAndGraphicPolys )
|
||||
{
|
||||
SHAPE_POLY_SET poly = backPlatedCopperPolys->CloneDropTriangulation();
|
||||
SHAPE_POLY_SET poly = backPlatedPadAndGraphicPolys->CloneDropTriangulation();
|
||||
poly.BooleanIntersection( m_boardAdapter.GetBoardPoly() );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetTH_ODPolys() );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys() );
|
||||
@@ -771,12 +774,13 @@ void RENDER_3D_OPENGL::generateViasAndPads()
|
||||
|
||||
wxASSERT( zbot < ztop );
|
||||
|
||||
generateCylinder( via_center, hole_inner_radius, hole_inner_radius + platingThickness3d,
|
||||
generateCylinder( via_center, hole_inner_radius,
|
||||
hole_inner_radius + platingThickness3d,
|
||||
ztop, zbot, nrSegments, layerTriangleVIA );
|
||||
}
|
||||
}
|
||||
|
||||
m_microviaHoles = new OPENGL_RENDER_LIST( *layerTriangleVIA, 0, 0.0f, 0.0f );
|
||||
m_vias = new OPENGL_RENDER_LIST( *layerTriangleVIA, 0, 0.0f, 0.0f );
|
||||
|
||||
delete layerTriangleVIA;
|
||||
}
|
||||
@@ -801,10 +805,10 @@ void RENDER_3D_OPENGL::generateViasAndPads()
|
||||
{
|
||||
TransformCircleToPolygon( tht_outer_holes_poly, via->GetPosition(),
|
||||
via->GetDrill() / 2 + platingThickness,
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
||||
|
||||
TransformCircleToPolygon( tht_inner_holes_poly, via->GetPosition(), via->GetDrill() / 2,
|
||||
via->GetMaxError(), ERROR_INSIDE );
|
||||
TransformCircleToPolygon( tht_inner_holes_poly, via->GetPosition(),
|
||||
via->GetDrill() / 2, ARC_HIGH_DEF, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -823,9 +827,9 @@ void RENDER_3D_OPENGL::generateViasAndPads()
|
||||
continue;
|
||||
|
||||
pad->TransformHoleToPolygon( tht_outer_holes_poly, platingThickness,
|
||||
pad->GetMaxError(), ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( tht_inner_holes_poly, 0,
|
||||
pad->GetMaxError(), ERROR_INSIDE );
|
||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
||||
pad->TransformHoleToPolygon( tht_inner_holes_poly, 0, ARC_HIGH_DEF,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -924,8 +928,8 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
|
||||
// Go for all footprints
|
||||
for( const FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
|
||||
{
|
||||
wxString libraryName = footprint->GetFPID().GetLibNickname();
|
||||
wxString footprintBasePath = wxEmptyString;
|
||||
wxString libraryName = footprint->GetFPID().GetLibNickname();
|
||||
wxString footprintBasePath = wxEmptyString;
|
||||
|
||||
if( m_boardAdapter.GetBoard()->GetProject() )
|
||||
{
|
||||
@@ -960,16 +964,13 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
|
||||
|
||||
// Check if the fp_model is not present in our cache map
|
||||
// (Not already loaded in memory)
|
||||
if( !m_3dModelMap.contains( fp_model.m_Filename ) )
|
||||
if( m_3dModelMap.find( fp_model.m_Filename ) == m_3dModelMap.end() )
|
||||
{
|
||||
// It is not present, try get it from cache
|
||||
std::vector<const EMBEDDED_FILES*> embeddedFilesStack;
|
||||
embeddedFilesStack.push_back( footprint->GetEmbeddedFiles() );
|
||||
embeddedFilesStack.push_back( m_boardAdapter.GetBoard()->GetEmbeddedFiles() );
|
||||
|
||||
const S3DMODEL* modelPtr = m_boardAdapter.Get3dCacheManager()->GetModel( fp_model.m_Filename,
|
||||
footprintBasePath,
|
||||
embeddedFilesStack );
|
||||
const S3DMODEL* modelPtr =
|
||||
m_boardAdapter.Get3dCacheManager()->GetModel( fp_model.m_Filename,
|
||||
footprintBasePath,
|
||||
footprint );
|
||||
|
||||
// only add it if the return is not NULL
|
||||
if( modelPtr )
|
||||
|
||||
@@ -49,7 +49,8 @@
|
||||
*/
|
||||
#define UNITS3D_TO_UNITSPCB ( pcbIUScale.IU_PER_MM )
|
||||
|
||||
RENDER_3D_OPENGL::RENDER_3D_OPENGL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter, CAMERA& aCamera ) :
|
||||
RENDER_3D_OPENGL::RENDER_3D_OPENGL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter,
|
||||
CAMERA& aCamera ) :
|
||||
RENDER_3D_BASE( aAdapter, aCamera ),
|
||||
m_canvas( aCanvas )
|
||||
{
|
||||
@@ -70,7 +71,7 @@ RENDER_3D_OPENGL::RENDER_3D_OPENGL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdap
|
||||
m_outerThroughHoles = nullptr;
|
||||
m_outerThroughHoleRings = nullptr;
|
||||
m_outerViaThroughHoles = nullptr;
|
||||
m_microviaHoles = nullptr;
|
||||
m_vias = nullptr;
|
||||
m_padHoles = nullptr;
|
||||
|
||||
m_circleTexture = 0;
|
||||
@@ -80,8 +81,6 @@ RENDER_3D_OPENGL::RENDER_3D_OPENGL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdap
|
||||
m_boardWithHoles = nullptr;
|
||||
|
||||
m_3dModelMap.clear();
|
||||
|
||||
m_spheres_gizmo = new SPHERES_GIZMO( 4, 4 );
|
||||
}
|
||||
|
||||
|
||||
@@ -92,8 +91,6 @@ RENDER_3D_OPENGL::~RENDER_3D_OPENGL()
|
||||
freeAllLists();
|
||||
|
||||
glDeleteTextures( 1, &m_circleTexture );
|
||||
|
||||
delete m_spheres_gizmo;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,13 +104,9 @@ void RENDER_3D_OPENGL::SetCurWindowSize( const wxSize& aSize )
|
||||
{
|
||||
if( m_windowSize != aSize )
|
||||
{
|
||||
int viewport[4];
|
||||
int fbWidth, fbHeight;
|
||||
glGetIntegerv( GL_VIEWPORT, viewport );
|
||||
|
||||
m_windowSize = aSize;
|
||||
glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
|
||||
setGizmoViewport( 0, 0, m_windowSize.x, m_windowSize.y );
|
||||
|
||||
// Initialize here any screen dependent data here
|
||||
}
|
||||
}
|
||||
@@ -146,33 +139,42 @@ void RENDER_3D_OPENGL::setLightBottom( bool enabled )
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_OPENGL::resetSelectedGizmoSphere()
|
||||
void RENDER_3D_OPENGL::render3dArrows()
|
||||
{
|
||||
m_spheres_gizmo->resetSelectedGizmoSphere();
|
||||
}
|
||||
const float arrow_size = RANGE_SCALE_3D * 0.30f;
|
||||
|
||||
glDisable( GL_CULL_FACE );
|
||||
|
||||
SPHERES_GIZMO::GizmoSphereSelection RENDER_3D_OPENGL::getSelectedGizmoSphere() const
|
||||
{
|
||||
return m_spheres_gizmo->getSelectedGizmoSphere();
|
||||
}
|
||||
// YxY squared view port, this is on propose
|
||||
glViewport( 4, 4, m_windowSize.y / 8 , m_windowSize.y / 8 );
|
||||
glClear( GL_DEPTH_BUFFER_BIT );
|
||||
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
gluPerspective( 45.0f, 1.0f, 0.001f, RANGE_SCALE_3D );
|
||||
|
||||
void RENDER_3D_OPENGL::setGizmoViewport( int x, int y, int width, int height )
|
||||
{
|
||||
m_spheres_gizmo->setViewport( x, y, width, height );
|
||||
}
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
const glm::mat4 TranslationMatrix =
|
||||
glm::translate( glm::mat4( 1.0f ), SFVEC3F( 0.0f, 0.0f, -( arrow_size * 2.75f ) ) );
|
||||
|
||||
std::tuple<int, int, int, int> RENDER_3D_OPENGL::getGizmoViewport() const
|
||||
{
|
||||
return m_spheres_gizmo->getViewport();
|
||||
}
|
||||
const glm::mat4 ViewMatrix = TranslationMatrix * m_camera.GetRotationMatrix();
|
||||
|
||||
glLoadMatrixf( glm::value_ptr( ViewMatrix ) );
|
||||
|
||||
void RENDER_3D_OPENGL::handleGizmoMouseInput( int mouseX, int mouseY )
|
||||
{
|
||||
m_spheres_gizmo->handleMouseInput( mouseX, mouseY );
|
||||
setArrowMaterial();
|
||||
|
||||
glColor3f( 0.9f, 0.0f, 0.0f );
|
||||
DrawRoundArrow( SFVEC3F( 0.0f, 0.0f, 0.0f ), SFVEC3F( arrow_size, 0.0f, 0.0f ), 0.275f );
|
||||
|
||||
glColor3f( 0.0f, 0.9f, 0.0f );
|
||||
DrawRoundArrow( SFVEC3F( 0.0f, 0.0f, 0.0f ), SFVEC3F( 0.0f, arrow_size, 0.0f ), 0.275f );
|
||||
|
||||
glColor3f( 0.0f, 0.0f, 0.9f );
|
||||
DrawRoundArrow( SFVEC3F( 0.0f, 0.0f, 0.0f ), SFVEC3F( 0.0f, 0.0f, arrow_size ), 0.275f );
|
||||
|
||||
glEnable( GL_CULL_FACE );
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +271,9 @@ void RENDER_3D_OPENGL::setupMaterials()
|
||||
|
||||
void RENDER_3D_OPENGL::setLayerMaterial( PCB_LAYER_ID aLayerID )
|
||||
{
|
||||
if( m_boardAdapter.GetUseBoardEditorCopperLayerColors() && IsCopperLayer( aLayerID ) )
|
||||
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
|
||||
|
||||
if( cfg.use_board_editor_copper_colors && IsCopperLayer( aLayerID ) )
|
||||
{
|
||||
COLOR4D copper_color = m_boardAdapter.m_BoardEditorColors[aLayerID];
|
||||
m_materials.m_Copper.m_Diffuse = SFVEC3F( copper_color.r, copper_color.g,
|
||||
@@ -358,34 +362,10 @@ void RENDER_3D_OPENGL::setLayerMaterial( PCB_LAYER_ID aLayerID )
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
int layer3D = MapPCBLayerTo3DLayer( aLayerID );
|
||||
|
||||
// Note: MUST do this in LAYER_3D space; User_1..User_45 are NOT contiguous
|
||||
if( layer3D >= LAYER_3D_USER_1 && layer3D <= LAYER_3D_USER_45 )
|
||||
{
|
||||
int user_idx = layer3D - LAYER_3D_USER_1;
|
||||
|
||||
m_materials.m_Plastic.m_Diffuse = m_boardAdapter.m_UserDefinedLayerColor[ user_idx ];
|
||||
m_materials.m_Plastic.m_Ambient = SFVEC3F( m_materials.m_Plastic.m_Diffuse.r * 0.05f,
|
||||
m_materials.m_Plastic.m_Diffuse.g * 0.05f,
|
||||
m_materials.m_Plastic.m_Diffuse.b * 0.05f );
|
||||
|
||||
m_materials.m_Plastic.m_Specular = SFVEC3F( m_materials.m_Plastic.m_Diffuse.r * 0.7f,
|
||||
m_materials.m_Plastic.m_Diffuse.g * 0.7f,
|
||||
m_materials.m_Plastic.m_Diffuse.b * 0.7f );
|
||||
|
||||
m_materials.m_Plastic.m_Shininess = 0.078125f * 128.0f;
|
||||
m_materials.m_Plastic.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
OglSetMaterial( m_materials.m_Plastic, 1.0f );
|
||||
break;
|
||||
}
|
||||
|
||||
m_materials.m_Copper.m_Diffuse = m_boardAdapter.m_CopperColor;
|
||||
OglSetMaterial( m_materials.m_Copper, 1.0f );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -593,15 +573,15 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
|
||||
|
||||
bool skipThickness = aIsMoving && cfg.opengl_thickness_disableOnMove;
|
||||
bool skipRenderHoles = aIsMoving && cfg.opengl_holes_disableOnMove;
|
||||
bool skipRenderMicroVias = aIsMoving && cfg.opengl_microvias_disableOnMove;
|
||||
bool skipRenderVias = aIsMoving && cfg.opengl_vias_disableOnMove;
|
||||
bool showThickness = !skipThickness;
|
||||
|
||||
std::bitset<LAYER_3D_END> layerFlags = m_boardAdapter.GetVisibleLayers();
|
||||
|
||||
setLayerMaterial( B_Cu );
|
||||
|
||||
if( !( skipRenderMicroVias || skipRenderHoles ) && m_microviaHoles )
|
||||
m_microviaHoles->DrawAll();
|
||||
if( !( skipRenderVias || skipRenderHoles ) && m_vias )
|
||||
m_vias->DrawAll();
|
||||
|
||||
if( !skipRenderHoles && m_padHoles )
|
||||
m_padHoles->DrawAll();
|
||||
@@ -684,6 +664,10 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
|
||||
|
||||
unsetDepthOffset();
|
||||
}
|
||||
else if( isPasteLayer && skipRenderHoles )
|
||||
{
|
||||
// Do not render paste layers when skipRenderHoles is enabled or we get z-fight issues
|
||||
}
|
||||
else
|
||||
{
|
||||
setLayerMaterial( layer );
|
||||
@@ -692,13 +676,10 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
|
||||
OPENGL_RENDER_LIST* anti_board = nullptr;
|
||||
OPENGL_RENDER_LIST* solder_mask = nullptr;
|
||||
|
||||
if( !skipRenderHoles )
|
||||
{
|
||||
if( isSilkLayer && cfg.clip_silk_on_via_annuli )
|
||||
throughHolesOuter = m_outerThroughHoleRings;
|
||||
else
|
||||
throughHolesOuter = m_outerThroughHoles;
|
||||
}
|
||||
if( isSilkLayer && cfg.clip_silk_on_via_annuli )
|
||||
throughHolesOuter = m_outerThroughHoleRings;
|
||||
else
|
||||
throughHolesOuter = m_outerThroughHoles;
|
||||
|
||||
if( isSilkLayer && cfg.show_off_board_silk )
|
||||
anti_board = nullptr;
|
||||
@@ -824,8 +805,8 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
|
||||
}
|
||||
|
||||
// Render 3D arrows
|
||||
if( cfg.show_navigator )
|
||||
m_spheres_gizmo->render3dSpheresGizmo( m_camera.GetRotationMatrix() );
|
||||
if( cfg.show_axis )
|
||||
render3dArrows();
|
||||
|
||||
// Return back to the original viewport (this is important if we want
|
||||
// to take a screenshot after the render)
|
||||
@@ -945,7 +926,7 @@ void RENDER_3D_OPENGL::freeAllLists()
|
||||
DELETE_AND_FREE( m_outerViaThroughHoles )
|
||||
DELETE_AND_FREE( m_outerThroughHoleRings )
|
||||
|
||||
DELETE_AND_FREE( m_microviaHoles )
|
||||
DELETE_AND_FREE( m_vias )
|
||||
DELETE_AND_FREE( m_padHoles )
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "../render_3d_base.h"
|
||||
#include "layer_triangles.h"
|
||||
#include "3d_spheres_gizmo.h"
|
||||
|
||||
#include "../raytracing/shapes2D/polygon_2d.h"
|
||||
#include "../raytracing/shapes2D/triangle_2d.h"
|
||||
@@ -71,11 +70,6 @@ public:
|
||||
* Load footprint models if they are not already loaded, i.e. if m_3dModelMap is empty
|
||||
*/
|
||||
void Load3dModelsIfNeeded();
|
||||
void handleGizmoMouseInput( int mouseX, int mouseY );
|
||||
void setGizmoViewport( int x, int y, int width, int height );
|
||||
std::tuple<int, int, int, int> getGizmoViewport() const;
|
||||
SPHERES_GIZMO::GizmoSphereSelection getSelectedGizmoSphere() const;
|
||||
void resetSelectedGizmoSphere();
|
||||
|
||||
private:
|
||||
OPENGL_RENDER_LIST* generateHoles( const LIST_OBJECT2D& aListHolesObject2d,
|
||||
@@ -174,6 +168,8 @@ private:
|
||||
void setLightTop( bool enabled );
|
||||
void setLightBottom( bool enabled );
|
||||
|
||||
void render3dArrows();
|
||||
|
||||
/**
|
||||
* Create a 3D grid to an OpenGL display list.
|
||||
*
|
||||
@@ -234,7 +230,7 @@ private:
|
||||
GLuint m_grid; ///< oGL list that stores current grid
|
||||
GRID3D_TYPE m_lastGridType; ///< Stores the last grid type.
|
||||
|
||||
OPENGL_RENDER_LIST* m_microviaHoles;
|
||||
OPENGL_RENDER_LIST* m_vias;
|
||||
OPENGL_RENDER_LIST* m_padHoles;
|
||||
|
||||
// Caches
|
||||
@@ -243,9 +239,8 @@ private:
|
||||
|
||||
BOARD_ITEM* m_currentRollOverItem;
|
||||
|
||||
SHAPE_POLY_SET m_antiBoardPolys; ///< The negative polygon representation of the board
|
||||
///< outline.
|
||||
SPHERES_GIZMO* m_spheres_gizmo;
|
||||
SHAPE_POLY_SET m_antiBoardPolys; ///< The negative polygon representation of the board
|
||||
///< outline.
|
||||
};
|
||||
|
||||
#endif // RENDER_3D_OPENGL_H
|
||||
|
||||
@@ -632,15 +632,7 @@ void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarn
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
int layer3D = MapPCBLayerTo3DLayer( layer_id );
|
||||
|
||||
// Note: MUST do this in LAYER_3D space; User_1..User_45 are NOT contiguous
|
||||
if( layer3D >= LAYER_3D_USER_1 && layer3D <= LAYER_3D_USER_45 )
|
||||
{
|
||||
layerColor = m_boardAdapter.m_UserDefinedLayerColor[ layer3D - LAYER_3D_USER_1 ];
|
||||
}
|
||||
else if( m_boardAdapter.m_Cfg->m_Render.differentiate_plated_copper )
|
||||
if( m_boardAdapter.m_Cfg->m_Render.differentiate_plated_copper )
|
||||
{
|
||||
layerColor = SFVEC3F( 184.0f / 255.0f, 115.0f / 255.0f, 50.0f / 255.0f );
|
||||
materialLayer = &m_materials.m_NonPlatedCopper;
|
||||
@@ -653,7 +645,6 @@ void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarn
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
createItemsFromContainer( container2d, layer_id, materialLayer, layerColor, 0.0f );
|
||||
} // for each layer on map
|
||||
@@ -1291,12 +1282,8 @@ void RENDER_3D_RAYTRACE_BASE::load3DModels( CONTAINER_3D& aDstContainer,
|
||||
continue;
|
||||
|
||||
// get it from cache
|
||||
std::vector<const EMBEDDED_FILES*> embeddedFilesStack;
|
||||
embeddedFilesStack.push_back( fp->GetEmbeddedFiles() );
|
||||
embeddedFilesStack.push_back( m_boardAdapter.GetBoard()->GetEmbeddedFiles() );
|
||||
|
||||
const S3DMODEL* modelPtr = cacheMgr->GetModel( model.m_Filename, footprintBasePath,
|
||||
std::move( embeddedFilesStack ) );
|
||||
const S3DMODEL* modelPtr =
|
||||
cacheMgr->GetModel( model.m_Filename, footprintBasePath, fp );
|
||||
|
||||
// only add it if the return is not NULL.
|
||||
if( modelPtr )
|
||||
|
||||
@@ -274,12 +274,10 @@ void RENDER_3D_RAYTRACE_BASE::renderTracing( uint8_t* ptrPBO, REPORTER* aStatusR
|
||||
}
|
||||
};
|
||||
|
||||
BS::multi_future<void> futures;
|
||||
for( size_t i = 0; i < tp.get_thread_count() + 1; ++i )
|
||||
tp.push_task( processBlocks );
|
||||
|
||||
for( size_t i = 0; i < tp.get_thread_count(); ++i )
|
||||
futures.push_back( tp.submit( processBlocks ) );
|
||||
|
||||
futures.wait();
|
||||
tp.wait_for_tasks();
|
||||
|
||||
m_blockRenderProgressCount += numBlocksRendered;
|
||||
|
||||
|
||||
@@ -48,8 +48,15 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
|
||||
//
|
||||
ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
|
||||
|
||||
fileMenu->Add( EDA_3D_ACTIONS::exportAsPNG );
|
||||
fileMenu->Add( EDA_3D_ACTIONS::exportAsJPEG );
|
||||
fileMenu->Add( _( "Export Current View as PNG..." ),
|
||||
wxEmptyString,
|
||||
ID_MENU_SCREENCOPY_PNG,
|
||||
BITMAPS::export_png );
|
||||
|
||||
fileMenu->Add( _( "Export Current View as JPEG..." ),
|
||||
wxEmptyString,
|
||||
ID_MENU_SCREENCOPY_JPEG,
|
||||
BITMAPS::export_file );
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->AddClose( _( "3D Viewer" ) );
|
||||
@@ -60,7 +67,10 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
|
||||
// The translated modifiers do not always work
|
||||
ACTION_MENU* editMenu = new ACTION_MENU( false, tool );
|
||||
|
||||
editMenu->Add( EDA_3D_ACTIONS::copyToClipboard );
|
||||
editMenu->Add( _( "Copy 3D Image" ),
|
||||
wxEmptyString,
|
||||
ID_TOOL_SCREENCOPY_TOCLIBBOARD,
|
||||
BITMAPS::copy );
|
||||
|
||||
|
||||
//-- View menu -------------------------------------------------------
|
||||
@@ -112,7 +122,10 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
|
||||
//
|
||||
ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
|
||||
|
||||
prefsMenu->Add( EDA_3D_ACTIONS::toggleRaytacing, ACTION_MENU::CHECK );
|
||||
prefsMenu->Add( _( "Raytracing" ), "",
|
||||
ID_RENDER_CURRENT_VIEW,
|
||||
BITMAPS::tools,
|
||||
ACTION_MENU::CHECK );
|
||||
|
||||
prefsMenu->Add( ACTIONS::openPreferences );
|
||||
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/choice.h>
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <dialogs/eda_view_switcher.h>
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <tool/action_toolbar.h>
|
||||
#include <tools/eda_3d_actions.h>
|
||||
#include <3d_viewer_id.h>
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::ReCreateMainToolbar()
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::ReCreateMainToolbar" ) );
|
||||
|
||||
wxWindowUpdateLocker dummy( this );
|
||||
|
||||
if( m_mainToolBar )
|
||||
{
|
||||
m_mainToolBar->ClearToolbar();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT |
|
||||
wxAUI_TB_HORIZONTAL );
|
||||
m_mainToolBar->SetAuiManager( &m_auimgr );
|
||||
}
|
||||
|
||||
// Set up toolbar
|
||||
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
||||
KiBitmapBundle( BITMAPS::import3d ),
|
||||
_( "Reload board" ) );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
||||
KiBitmapBundle( BITMAPS::copy ),
|
||||
_( "Copy 3D image to clipboard" ) );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString,
|
||||
KiBitmapBundle( BITMAPS::ray_tracing ),
|
||||
_( "Render current view using Raytracing" ), wxITEM_CHECK );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( ACTIONS::zoomRedraw );
|
||||
m_mainToolBar->Add( ACTIONS::zoomInCenter );
|
||||
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
|
||||
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCW );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCCW );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCW );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCCW );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCW );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCCW );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::flipView );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::moveLeft );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::moveRight );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::moveUp );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::moveDown );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::toggleOrtho, ACTION_TOOLBAR::TOGGLE );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE );
|
||||
|
||||
m_mainToolBar->KiRealize();
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
#include <widgets/wx_aui_utils.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <project_pcb.h>
|
||||
#include <toolbars_3d.h>
|
||||
|
||||
#include <3d_navlib/nl_3d_viewer_plugin.h>
|
||||
|
||||
@@ -81,6 +80,7 @@ BEGIN_EVENT_TABLE( EDA_3D_VIEWER_FRAME, KIWAY_PLAYER )
|
||||
EDA_3D_VIEWER_FRAME::Process_Special_Functions )
|
||||
|
||||
EVT_MENU( wxID_CLOSE, EDA_3D_VIEWER_FRAME::Exit3DFrame )
|
||||
EVT_MENU( ID_RENDER_CURRENT_VIEW, EDA_3D_VIEWER_FRAME::onRenderEngineSelection )
|
||||
EVT_MENU( ID_DISABLE_RAY_TRACING, EDA_3D_VIEWER_FRAME::onDisableRayTracing )
|
||||
|
||||
EVT_CLOSE( EDA_3D_VIEWER_FRAME::OnCloseWindow )
|
||||
@@ -91,6 +91,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
const wxString& aTitle, long style ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle, wxDefaultPosition,
|
||||
wxDefaultSize, style, QUALIFIED_VIEWER3D_FRAMENAME( aParent ), unityScale ),
|
||||
m_mainToolBar( nullptr ),
|
||||
m_canvas( nullptr ),
|
||||
m_currentCamera( m_trackBallCamera ),
|
||||
m_trackBallCamera( 2 * RANGE_SCALE_3D )
|
||||
@@ -111,26 +112,24 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
wxStatusBar *status_bar = CreateStatusBar( arrayDim( status_dims ) );
|
||||
SetStatusWidths( arrayDim( status_dims ), status_dims );
|
||||
|
||||
ANTIALIASING_MODE aaMode = ANTIALIASING_MODE::AA_NONE;
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
ANTIALIASING_MODE aaMode = static_cast<ANTIALIASING_MODE>( cfg->m_Render.opengl_AA_mode );
|
||||
|
||||
if( cfg )
|
||||
aaMode = static_cast<ANTIALIASING_MODE>( cfg->m_Render.opengl_AA_mode );
|
||||
|
||||
m_canvas = new EDA_3D_CANVAS( this, OGL_ATT_LIST::GetAttributesList( aaMode, true ), m_boardAdapter,
|
||||
m_currentCamera, PROJECT_PCB::Get3DCacheManager( &Prj() ) );
|
||||
m_canvas = new EDA_3D_CANVAS( this, OGL_ATT_LIST::GetAttributesList( aaMode, true ),
|
||||
m_boardAdapter, m_currentCamera,
|
||||
PROJECT_PCB::Get3DCacheManager( &Prj() ) );
|
||||
|
||||
m_appearancePanel = new APPEARANCE_CONTROLS_3D( this, GetCanvas() );
|
||||
|
||||
LoadSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
|
||||
LoadSettings( cfg );
|
||||
loadCommonSettings();
|
||||
|
||||
m_appearancePanel->SetUserViewports( Prj().GetProjectFile().m_Viewports3D );
|
||||
|
||||
// Create the manager
|
||||
m_toolManager = new TOOL_MANAGER;
|
||||
m_toolManager->SetEnvironment( GetBoard(), nullptr, nullptr,
|
||||
GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ), this );
|
||||
m_toolManager->SetEnvironment( GetBoard(), nullptr, nullptr, cfg, this );
|
||||
|
||||
m_actions = new EDA_3D_ACTIONS();
|
||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
|
||||
@@ -144,22 +143,19 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
setupUIConditions();
|
||||
|
||||
if( EDA_3D_CONTROLLER* ctrlTool = GetToolManager()->GetTool<EDA_3D_CONTROLLER>() )
|
||||
ctrlTool->SetRotationIncrement( cfg ? cfg->m_Camera.rotation_increment : 10.0 );
|
||||
ctrlTool->SetRotationIncrement( cfg->m_Camera.rotation_increment );
|
||||
|
||||
// Run the viewer control tool, it is supposed to be always active
|
||||
m_toolManager->InvokeTool( "3DViewer.Control" );
|
||||
|
||||
ReCreateMenuBar();
|
||||
|
||||
m_toolbarSettings = Pgm().GetSettingsManager().GetToolbarSettings<EDA_3D_VIEWER_TOOLBAR_SETTINGS>( "3d_viewer-toolbars" );
|
||||
configureToolbars();
|
||||
RecreateToolbars();
|
||||
ReCreateMainToolbar();
|
||||
|
||||
m_infoBar = new WX_INFOBAR( this, &m_auimgr );
|
||||
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
|
||||
m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
|
||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxS( "MainToolbar" ) )
|
||||
.Top().Layer( 6 ) );
|
||||
m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( wxS( "InfoBar" ) )
|
||||
.Top().Layer( 1 ) );
|
||||
@@ -172,11 +168,10 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
|
||||
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
|
||||
|
||||
if( cfg && cfg->m_AuiPanels.right_panel_width > 0 )
|
||||
if( cfg->m_AuiPanels.right_panel_width > 0 )
|
||||
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
|
||||
|
||||
if( cfg )
|
||||
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
|
||||
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
|
||||
|
||||
// Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
|
||||
// hiding it.
|
||||
@@ -260,9 +255,10 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
|
||||
{
|
||||
return m_boardAdapter.m_Cfg->m_Render.show_model_bbox;
|
||||
};
|
||||
auto showNavig = [this]( const SELECTION& aSel )
|
||||
auto showAxes =
|
||||
[this]( const SELECTION& aSel )
|
||||
{
|
||||
return m_boardAdapter.m_Cfg->m_Render.show_navigator;
|
||||
return m_boardAdapter.m_Cfg->m_Render.show_axis;
|
||||
};
|
||||
auto ortho =
|
||||
[this]( const SELECTION& )
|
||||
@@ -276,7 +272,7 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
|
||||
return m_boardAdapter.m_Cfg->m_AuiPanels.show_layer_manager;
|
||||
};
|
||||
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::toggleRaytacing, ACTION_CONDITIONS().Check( raytracing ) );
|
||||
RegisterUIUpdateHandler( ID_RENDER_CURRENT_VIEW, ACTION_CONDITIONS().Check( raytracing ) );
|
||||
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showTHT, ACTION_CONDITIONS().Check( showTH ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showSMD, ACTION_CONDITIONS().Check( showSMD ) );
|
||||
@@ -286,7 +282,7 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showDNP, ACTION_CONDITIONS().Check( show_DNP ) );
|
||||
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showBBoxes, ACTION_CONDITIONS().Check( showBBoxes ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showNavigator, ACTION_CONDITIONS().Check( showNavig ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showAxis, ACTION_CONDITIONS().Check( showAxes ) );
|
||||
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::noGrid, GridSizeCheck( GRID3D_TYPE::NONE ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::show10mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_10MM ) );
|
||||
@@ -458,25 +454,43 @@ void EDA_3D_VIEWER_FRAME::OnCloseWindow( wxCloseEvent &event )
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::Process_Special_Functions( wxCommandEvent &event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
bool isChecked = event.IsChecked();
|
||||
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::Process_Special_Functions id %d "
|
||||
"isChecked %d" ),
|
||||
id,
|
||||
isChecked );
|
||||
|
||||
if( m_canvas == nullptr )
|
||||
return;
|
||||
|
||||
switch( event.GetId() )
|
||||
switch( id )
|
||||
{
|
||||
case ID_RELOAD3D_BOARD:
|
||||
NewDisplay( true );
|
||||
break;
|
||||
|
||||
case ID_TOOL_SCREENCOPY_TOCLIBBOARD:
|
||||
case ID_MENU_SCREENCOPY_PNG:
|
||||
case ID_MENU_SCREENCOPY_JPEG:
|
||||
takeScreenshot( event );
|
||||
return;
|
||||
|
||||
case ID_MENU3D_RESET_DEFAULTS:
|
||||
{
|
||||
m_boardAdapter.SetLayerColors( m_boardAdapter.GetDefaultColors() );
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
|
||||
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
|
||||
cfg->ResetToDefaults();
|
||||
|
||||
LoadSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
|
||||
cfg->ResetToDefaults();
|
||||
LoadSettings( cfg );
|
||||
|
||||
// Tell canvas that we (may have) changed the render engine
|
||||
RenderEngineChanged();
|
||||
|
||||
NewDisplay( true );
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxT( "Invalid event in EDA_3D_VIEWER_FRAME::Process_Special_Functions()" ) );
|
||||
@@ -485,9 +499,28 @@ void EDA_3D_VIEWER_FRAME::Process_Special_Functions( wxCommandEvent &event )
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::onRenderEngineSelection( wxCommandEvent &event )
|
||||
{
|
||||
RENDER_ENGINE& engine = m_boardAdapter.m_Cfg->m_Render.engine;
|
||||
RENDER_ENGINE old_engine = engine;
|
||||
|
||||
if( old_engine == RENDER_ENGINE::OPENGL )
|
||||
engine = RENDER_ENGINE::RAYTRACING;
|
||||
else
|
||||
engine = RENDER_ENGINE::OPENGL;
|
||||
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::OnRenderEngineSelection type %s " ),
|
||||
engine == RENDER_ENGINE::RAYTRACING ? wxT( "raytracing" ) : wxT( "realtime" ) );
|
||||
|
||||
if( old_engine != engine )
|
||||
RenderEngineChanged();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::onDisableRayTracing( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::%s disabling ray tracing." ), __WXFUNCTION__ );
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::%s disabling ray tracing." ),
|
||||
__WXFUNCTION__ );
|
||||
|
||||
m_disable_ray_tracing = true;
|
||||
m_boardAdapter.m_Cfg->m_Render.engine = RENDER_ENGINE::OPENGL;
|
||||
@@ -539,6 +572,9 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
|
||||
{
|
||||
applySettings( cfg );
|
||||
|
||||
if( !GetBoard()->GetProject() )
|
||||
GetBoard()->SetProject( &Prj() );
|
||||
|
||||
m_boardAdapter.SetBoard( GetBoard() );
|
||||
|
||||
// When opening the 3D viewer, we use the OpenGL mode, never the ray tracing engine
|
||||
@@ -572,9 +608,19 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE *aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::SaveSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
|
||||
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
|
||||
EDA_BASE_FRAME::SaveSettings( cfg );
|
||||
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::SaveSettings" ) );
|
||||
|
||||
wxLogTrace( m_logTrace, m_boardAdapter.m_Cfg->m_Render.engine == RENDER_ENGINE::RAYTRACING ?
|
||||
wxT( "EDA_3D_VIEWER_FRAME::SaveSettings render setting Ray Trace" )
|
||||
:
|
||||
wxT( "EDA_3D_VIEWER_FRAME::SaveSettings render setting OpenGL" ) );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
|
||||
|
||||
@@ -595,8 +641,12 @@ void EDA_3D_VIEWER_FRAME::CommonSettingsChanged( int aFlags )
|
||||
// Regen menu bars, etc
|
||||
EDA_BASE_FRAME::CommonSettingsChanged( aFlags );
|
||||
|
||||
// There is no base class that handles toolbars for this frame
|
||||
ReCreateMainToolbar();
|
||||
|
||||
loadCommonSettings();
|
||||
applySettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
|
||||
applySettings(
|
||||
Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
|
||||
|
||||
m_appearancePanel->CommonSettingsChanged();
|
||||
|
||||
@@ -609,7 +659,7 @@ void EDA_3D_VIEWER_FRAME::ShowChangedLanguage()
|
||||
EDA_BASE_FRAME::ShowChangedLanguage();
|
||||
|
||||
SetTitle( _( "3D Viewer" ) );
|
||||
RecreateToolbars();
|
||||
ReCreateMainToolbar();
|
||||
|
||||
if( m_appearancePanel )
|
||||
{
|
||||
@@ -624,24 +674,23 @@ void EDA_3D_VIEWER_FRAME::ShowChangedLanguage()
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::ToggleAppearanceManager()
|
||||
{
|
||||
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
|
||||
|
||||
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
|
||||
// show auxiliary Vertical layers and visibility manager toolbar
|
||||
cfg->m_AuiPanels.show_layer_manager = !cfg->m_AuiPanels.show_layer_manager;
|
||||
|
||||
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
|
||||
|
||||
if( cfg->m_AuiPanels.show_layer_manager )
|
||||
{
|
||||
// show auxiliary Vertical layers and visibility manager toolbar
|
||||
cfg->m_AuiPanels.show_layer_manager = !cfg->m_AuiPanels.show_layer_manager;
|
||||
|
||||
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
|
||||
|
||||
if( cfg->m_AuiPanels.show_layer_manager )
|
||||
{
|
||||
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
|
||||
m_auimgr.Update();
|
||||
}
|
||||
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
|
||||
m_auimgr.Update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,15 +702,15 @@ void EDA_3D_VIEWER_FRAME::OnDarkModeToggle()
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::TakeScreenshot( EDA_3D_VIEWER_EXPORT_FORMAT aFormat )
|
||||
void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
|
||||
{
|
||||
wxString fullFileName;
|
||||
bool fmt_is_jpeg = false;
|
||||
|
||||
if( aFormat == EDA_3D_VIEWER_EXPORT_FORMAT::JPEG )
|
||||
if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
|
||||
fmt_is_jpeg = true;
|
||||
|
||||
if( aFormat != EDA_3D_VIEWER_EXPORT_FORMAT::CLIPBOARD )
|
||||
if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
||||
{
|
||||
// Remember path between saves during this session only.
|
||||
const wxString wildcard =
|
||||
@@ -725,7 +774,7 @@ void EDA_3D_VIEWER_FRAME::TakeScreenshot( EDA_3D_VIEWER_EXPORT_FORMAT aFormat )
|
||||
|
||||
cfg.highlight_on_rollover = allow_highlight;
|
||||
|
||||
if( aFormat == EDA_3D_VIEWER_EXPORT_FORMAT::CLIPBOARD )
|
||||
if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
||||
{
|
||||
wxBitmap bitmap( screenshotImage );
|
||||
|
||||
|
||||
@@ -57,13 +57,6 @@ enum EDA_3D_VIEWER_STATUSBAR
|
||||
ZOOM_LEVEL,
|
||||
};
|
||||
|
||||
enum class EDA_3D_VIEWER_EXPORT_FORMAT
|
||||
{
|
||||
CLIPBOARD,
|
||||
PNG,
|
||||
JPEG
|
||||
};
|
||||
|
||||
/**
|
||||
* Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard
|
||||
*/
|
||||
@@ -130,12 +123,6 @@ public:
|
||||
|
||||
void OnDarkModeToggle();
|
||||
|
||||
/**
|
||||
* Create a Screenshot of the current 3D view.
|
||||
* Output file format is png or jpeg, or image is copied to the clipboard
|
||||
*/
|
||||
void TakeScreenshot( EDA_3D_VIEWER_EXPORT_FORMAT aFormat );
|
||||
|
||||
protected:
|
||||
void setupUIConditions() override;
|
||||
|
||||
@@ -151,12 +138,20 @@ private:
|
||||
|
||||
void Process_Special_Functions( wxCommandEvent& event );
|
||||
|
||||
void onRenderEngineSelection( wxCommandEvent& event );
|
||||
void onDisableRayTracing( wxCommandEvent& aEvent );
|
||||
|
||||
void OnActivate( wxActivateEvent& event );
|
||||
void OnSetFocus( wxFocusEvent& event );
|
||||
|
||||
void doReCreateMenuBar() override;
|
||||
void ReCreateMainToolbar();
|
||||
|
||||
/**
|
||||
* Create a Screenshot of the current 3D view.
|
||||
* Output file format is png or jpeg, or image is copied to the clipboard
|
||||
*/
|
||||
void takeScreenshot( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* @brief RenderEngineChanged - Update toolbar icon and call canvas RenderEngineChanged
|
||||
@@ -177,6 +172,7 @@ private:
|
||||
private:
|
||||
wxFileName m_defaultSaveScreenshotFileName;
|
||||
|
||||
ACTION_TOOLBAR* m_mainToolBar;
|
||||
EDA_3D_CANVAS* m_canvas;
|
||||
BOARD_ADAPTER m_boardAdapter;
|
||||
CAMERA& m_currentCamera;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <3d_enums.h>
|
||||
#include <common_ogl/ogl_attr_list.h>
|
||||
#include <settings/parameters.h>
|
||||
@@ -103,7 +102,7 @@ PARAM_LAYER_PRESET_3D::PARAM_LAYER_PRESET_3D( const std::string& aPath,
|
||||
LAYER( "user_drawings", LAYER_3D_USER_DRAWINGS );
|
||||
LAYER( "user_eco1", LAYER_3D_USER_ECO1 );
|
||||
LAYER( "user_eco2", LAYER_3D_USER_ECO2 );
|
||||
LAYER( "3d_navigator", LAYER_3D_NAVIGATOR );
|
||||
LAYER( "3d_axes", LAYER_3D_AXES );
|
||||
LAYER( "th_models", LAYER_3D_TH_MODELS );
|
||||
LAYER( "smd_models", LAYER_3D_SMD_MODELS );
|
||||
LAYER( "virtual_models", LAYER_3D_VIRTUAL_MODELS );
|
||||
@@ -253,7 +252,7 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
m_params.emplace_back( new PARAM<bool>( "render.opengl_thickness_disableOnMove",
|
||||
&m_Render.opengl_thickness_disableOnMove, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.opengl_vias_disableOnMove",
|
||||
&m_Render.opengl_microvias_disableOnMove, false ) );
|
||||
&m_Render.opengl_vias_disableOnMove, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.opengl_holes_disableOnMove",
|
||||
&m_Render.opengl_holes_disableOnMove, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.opengl_render_bbox_only_OnMove",
|
||||
@@ -320,7 +319,7 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
|
||||
m_params.emplace_back( new PARAM_LIST<COLOR4D>( "render.raytrace_lightColor",
|
||||
&m_Render.raytrace_lightColor,
|
||||
std::move( default_colors ) ) );
|
||||
default_colors ) );
|
||||
|
||||
const std::vector<int> default_elevation =
|
||||
{
|
||||
@@ -329,7 +328,7 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
|
||||
m_params.emplace_back( new PARAM_LIST<int>( "render.raytrace_lightElevation",
|
||||
&m_Render.raytrace_lightElevation,
|
||||
std::move( default_elevation ) ) );
|
||||
default_elevation ) );
|
||||
|
||||
const std::vector<int> default_azimuth =
|
||||
{
|
||||
@@ -338,12 +337,12 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
|
||||
m_params.emplace_back( new PARAM_LIST<int>( "render.raytrace_lightAzimuth",
|
||||
&m_Render.raytrace_lightAzimuth,
|
||||
std::move( default_azimuth ) ) );
|
||||
default_azimuth ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_adhesive",
|
||||
&m_Render.show_adhesive, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_navigator",
|
||||
&m_Render.show_navigator, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_axis",
|
||||
&m_Render.show_axis, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_board_body",
|
||||
&m_Render.show_board_body, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_comments",
|
||||
@@ -354,13 +353,6 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
&m_Render.show_eco1, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_eco2",
|
||||
&m_Render.show_eco2, true ) );
|
||||
|
||||
for( int layer = 0; layer < 45; ++layer )
|
||||
{
|
||||
m_params.emplace_back( new PARAM<bool>( fmt::format( "render.show_user{}", layer + 1 ),
|
||||
&m_Render.show_user[layer], false ) );
|
||||
}
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_insert",
|
||||
&m_Render.show_footprints_insert, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_normal",
|
||||
@@ -401,8 +393,6 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
&m_Render.differentiate_plated_copper, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.use_board_editor_copper_colors",
|
||||
&m_Render.use_board_editor_copper_colors, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.preview_show_board_body",
|
||||
&m_Render.preview_show_board_body, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "camera.animation_enabled",
|
||||
&m_Camera.animation_enabled, true ) );
|
||||
m_params.emplace_back( new PARAM<int>( "camera.moving_speed_multiplier",
|
||||
@@ -489,7 +479,7 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
legacyColorMap[483] = "virtual_models";
|
||||
legacyColorMap[484] = "non_pos_file_models";
|
||||
legacyColorMap[485] = "dnp_models";
|
||||
legacyColorMap[486] = "3d_navigator";
|
||||
legacyColorMap[486] = "3d_axes";
|
||||
legacyColorMap[487] = "bounding_boxes";
|
||||
legacyColorMap[488] = "off_board_silk";
|
||||
|
||||
@@ -579,7 +569,7 @@ bool EDA_3D_VIEWER_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
||||
ret &= fromLegacy<bool>( aCfg, "Render_RAY_Shadows", "render.raytrace_shadows" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowRealisticMode", "render.realistic" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowAdhesiveLayers", "render.show_adhesive" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowNavigator", "render.show_navigator" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowAxis", "render.show_axis" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowBoardBody", "render.show_board_body" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowCommentsLayers", "render.show_comments" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowEcoLayers", "render.show_eco" );
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
|
||||
bool opengl_AA_disableOnMove;
|
||||
bool opengl_thickness_disableOnMove;
|
||||
bool opengl_microvias_disableOnMove;
|
||||
bool opengl_vias_disableOnMove;
|
||||
bool opengl_holes_disableOnMove;
|
||||
bool opengl_render_bbox_only_OnMove;
|
||||
bool opengl_copper_thickness;
|
||||
@@ -126,13 +126,12 @@ public:
|
||||
std::vector<int> raytrace_lightAzimuth; // 0 .. 359
|
||||
|
||||
bool show_adhesive;
|
||||
bool show_navigator;
|
||||
bool show_axis;
|
||||
bool show_board_body;
|
||||
bool show_comments;
|
||||
bool show_drawings;
|
||||
bool show_eco1;
|
||||
bool show_eco2;
|
||||
bool show_user[45];
|
||||
bool show_footprints_insert;
|
||||
bool show_footprints_normal;
|
||||
bool show_footprints_virtual;
|
||||
@@ -152,19 +151,21 @@ public:
|
||||
bool subtract_mask_from_silk;
|
||||
bool clip_silk_on_via_annuli;
|
||||
bool differentiate_plated_copper;
|
||||
bool use_board_editor_copper_colors; // OpenGL only
|
||||
bool preview_show_board_body;
|
||||
// Board editor copper colors are used only in OpenGL mode if
|
||||
// use_board_editor_copper_colors is true
|
||||
bool use_board_editor_copper_colors;
|
||||
|
||||
/**
|
||||
* return true if platted copper aeras and non platted copper areas must be drawn
|
||||
* using a different color
|
||||
* in OPENGL mode, if use_board_editor_copper_colors, always false
|
||||
* in RAYTRACING mode, use_board_editor_copper_colors is ignored (board editor copper
|
||||
* colors are ignored)
|
||||
*/
|
||||
bool DifferentiatePlatedCopper()
|
||||
{
|
||||
if( engine == RENDER_ENGINE::OPENGL && use_board_editor_copper_colors )
|
||||
return false;
|
||||
|
||||
return differentiate_plated_copper;
|
||||
return engine == RENDER_ENGINE::RAYTRACING ? differentiate_plated_copper
|
||||
: differentiate_plated_copper && !use_board_editor_copper_colors;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/choice.h>
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <dialogs/eda_view_switcher.h>
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <tool/action_toolbar.h>
|
||||
#include <tools/eda_3d_actions.h>
|
||||
#include <3d_viewer_id.h>
|
||||
|
||||
#include <toolbars_3d.h>
|
||||
|
||||
|
||||
std::optional<TOOLBAR_CONFIGURATION> EDA_3D_VIEWER_TOOLBAR_SETTINGS::DefaultToolbarConfig( TOOLBAR_LOC aToolbar )
|
||||
{
|
||||
TOOLBAR_CONFIGURATION config;
|
||||
|
||||
// clang-format off
|
||||
switch( aToolbar )
|
||||
{
|
||||
case TOOLBAR_LOC::LEFT:
|
||||
case TOOLBAR_LOC::RIGHT:
|
||||
case TOOLBAR_LOC::TOP_AUX:
|
||||
return std::nullopt;
|
||||
case TOOLBAR_LOC::TOP_MAIN:
|
||||
config.AppendAction( EDA_3D_ACTIONS::reloadBoard );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::copyToClipboard );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::toggleRaytacing );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( ACTIONS::zoomRedraw )
|
||||
.AppendAction( ACTIONS::zoomInCenter )
|
||||
.AppendAction( ACTIONS::zoomOutCenter )
|
||||
.AppendAction( ACTIONS::zoomFitScreen );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateXCW )
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateXCCW );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateYCW )
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateYCCW );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateZCW )
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateZCCW );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::flipView );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::moveLeft )
|
||||
.AppendAction( EDA_3D_ACTIONS::moveRight )
|
||||
.AppendAction( EDA_3D_ACTIONS::moveUp )
|
||||
.AppendAction( EDA_3D_ACTIONS::moveDown );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::toggleOrtho );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::showLayersManager );
|
||||
break;
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
return config;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TOOLBARS_3D_H_
|
||||
#define TOOLBARS_3D_H_
|
||||
|
||||
#include <tool/ui/toolbar_configuration.h>
|
||||
|
||||
/**
|
||||
* Toolbar configuration for the 3D viewer.
|
||||
*/
|
||||
class EDA_3D_VIEWER_TOOLBAR_SETTINGS : public TOOLBAR_SETTINGS
|
||||
{
|
||||
public:
|
||||
EDA_3D_VIEWER_TOOLBAR_SETTINGS() :
|
||||
TOOLBAR_SETTINGS( "3d_viewer-toolbars" )
|
||||
{}
|
||||
|
||||
~EDA_3D_VIEWER_TOOLBAR_SETTINGS() {}
|
||||
|
||||
std::optional<TOOLBAR_CONFIGURATION> DefaultToolbarConfig( TOOLBAR_LOC aToolbar ) override;
|
||||
};
|
||||
|
||||
#endif /* TOOLBARS_3D_H_ */
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <bitmaps.h>
|
||||
#include <3d_viewer_id.h>
|
||||
#include <3d_enums.h>
|
||||
#include <3d-viewer/3d_viewer/eda_3d_viewer_frame.h>
|
||||
#include "eda_3d_actions.h"
|
||||
#include "tool/tool_action.h"
|
||||
|
||||
@@ -39,47 +38,7 @@
|
||||
TOOL_ACTION EDA_3D_ACTIONS::controlActivate( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.Flags( AF_ACTIVATE )
|
||||
.ToolbarState( TOOLBAR_STATE::HIDDEN) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS:: reloadBoard( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.reloadBoard" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Reload board" ) )
|
||||
.Tooltip( _( "Reload board and refresh 3D view" ) )
|
||||
.Icon( BITMAPS::import3d ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleRaytacing( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.toggleRaytacing" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Use raytracing" ) )
|
||||
.Tooltip( _( "Render current view using Raytracing" ) )
|
||||
.Icon( BITMAPS::ray_tracing )
|
||||
.ToolbarState( TOOLBAR_STATE::TOGGLE) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::copyToClipboard( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.copyToClipboard" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Copy 3D image to clipboard" ) )
|
||||
.Tooltip( _( "Copy the current 3D image to the clipboard" ) )
|
||||
.Icon( BITMAPS::copy )
|
||||
.Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>( EDA_3D_VIEWER_EXPORT_FORMAT::CLIPBOARD ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::exportAsPNG( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.exportAsPNG" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Export Current View as PNG..." ) )
|
||||
.Tooltip( _( "Export the Current View as a PNG image" ) )
|
||||
.Icon( BITMAPS::export_png )
|
||||
.Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>( EDA_3D_VIEWER_EXPORT_FORMAT::PNG ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::exportAsJPEG( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.exportAsJPEG" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Export Current View as JPEG..." ) )
|
||||
.Tooltip( _( "Export the Current View as a JPEG image" ) )
|
||||
.Icon( BITMAPS::export_file )
|
||||
.Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>( EDA_3D_VIEWER_EXPORT_FORMAT::JPEG ) );
|
||||
.Flags( AF_ACTIVATE ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::pivotCenter( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.pivotCenter" )
|
||||
@@ -125,7 +84,6 @@ TOOL_ACTION EDA_3D_ACTIONS::rotateYCCW( TOOL_ACTION_ARGS()
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateZclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.DefaultHotkey( MD_SHIFT + 'R' )
|
||||
.FriendlyName( _( "Rotate Z Clockwise" ) )
|
||||
.Icon( BITMAPS::rotate_cw_z )
|
||||
.Flags( AF_NONE )
|
||||
@@ -134,7 +92,6 @@ TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( TOOL_ACTION_ARGS()
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateZCCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateZcounterclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.DefaultHotkey( 'R' )
|
||||
.FriendlyName( _( "Rotate Z Counterclockwise" ) )
|
||||
.Icon( BITMAPS::rotate_ccw_z )
|
||||
.Flags( AF_NONE )
|
||||
@@ -200,8 +157,7 @@ TOOL_ACTION EDA_3D_ACTIONS::toggleOrtho( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Toggle Orthographic Projection" ) )
|
||||
.Tooltip( _( "Enable/disable orthographic projection" ) )
|
||||
.Icon( BITMAPS::ortho )
|
||||
.ToolbarState( TOOLBAR_STATE::TOGGLE ) );
|
||||
.Icon( BITMAPS::ortho ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewFront( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.viewFront" )
|
||||
@@ -363,16 +319,16 @@ TOOL_ACTION EDA_3D_ACTIONS::showDNP( TOOL_ACTION_ARGS()
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showBBoxes( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.showBoundingBoxes" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Show Model Bounding Boxes" ) )
|
||||
.Tooltip( _( "Show 3D model bounding boxes in realtime renderer" ) )
|
||||
.Icon( BITMAPS::ortho )
|
||||
.Flags( AF_NONE ) );
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Show Model Bounding Boxes" ) )
|
||||
.Tooltip( _( "Show 3D model bounding boxes in realtime renderer" ) )
|
||||
.Icon( BITMAPS::ortho )
|
||||
.Flags( AF_NONE ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showNavigator( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.showNavigator" )
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showAxis( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.showAxis" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Show 3D Navigator" ) )
|
||||
.FriendlyName( _( "Show 3D Axis" ) )
|
||||
.Icon( BITMAPS::axis3d_front )
|
||||
.Flags( AF_NONE ) );
|
||||
|
||||
@@ -381,6 +337,5 @@ TOOL_ACTION EDA_3D_ACTIONS::showLayersManager( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Show Appearance Manager" ) )
|
||||
.Tooltip( _( "Show/hide the appearance manager" ) )
|
||||
.Icon( BITMAPS::layers_manager )
|
||||
.ToolbarState( TOOLBAR_STATE::TOGGLE ) );
|
||||
.Icon( BITMAPS::layers_manager ) );
|
||||
|
||||
|
||||
@@ -42,13 +42,6 @@ class EDA_3D_ACTIONS : public ACTIONS
|
||||
public:
|
||||
static TOOL_ACTION controlActivate;
|
||||
|
||||
static TOOL_ACTION reloadBoard;
|
||||
static TOOL_ACTION toggleRaytacing;
|
||||
|
||||
static TOOL_ACTION copyToClipboard;
|
||||
static TOOL_ACTION exportAsPNG;
|
||||
static TOOL_ACTION exportAsJPEG;
|
||||
|
||||
static TOOL_ACTION pivotCenter;
|
||||
static TOOL_ACTION rotateXCW;
|
||||
static TOOL_ACTION rotateXCCW;
|
||||
@@ -87,7 +80,7 @@ public:
|
||||
static TOOL_ACTION showNotInPosFile;
|
||||
static TOOL_ACTION showDNP;
|
||||
static TOOL_ACTION showBBoxes;
|
||||
static TOOL_ACTION showNavigator;
|
||||
static TOOL_ACTION showAxis;
|
||||
static TOOL_ACTION showLayersManager;
|
||||
};
|
||||
|
||||
|
||||
@@ -256,8 +256,8 @@ int EDA_3D_CONTROLLER::ToggleVisibility( const TOOL_EVENT& aEvent )
|
||||
flipLayer( LAYER_3D_MODELS_NOT_IN_POS );
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showDNP ) )
|
||||
flipLayer( LAYER_3D_MODELS_MARKED_DNP );
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showNavigator ) )
|
||||
flipLayer( LAYER_3D_NAVIGATOR );
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showAxis ) )
|
||||
flipLayer( LAYER_3D_AXES );
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showBBoxes ) )
|
||||
flipLayer( LAYER_3D_BOUNDING_BOXES );
|
||||
}
|
||||
@@ -334,65 +334,11 @@ int EDA_3D_CONTROLLER::ZoomFitScreen( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
|
||||
|
||||
int EDA_3D_CONTROLLER::ReloadBoard( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EDA_BASE_FRAME* frame = dynamic_cast<EDA_BASE_FRAME*>( m_toolMgr->GetToolHolder() );
|
||||
|
||||
if( frame && frame->GetFrameType() == FRAME_PCB_DISPLAY3D )
|
||||
static_cast<EDA_3D_VIEWER_FRAME*>( frame )->NewDisplay( true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int EDA_3D_CONTROLLER::ToggleRaytracing( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EDA_BASE_FRAME* frame = dynamic_cast<EDA_BASE_FRAME*>( m_toolMgr->GetToolHolder() );
|
||||
|
||||
if( frame && frame->GetFrameType() == FRAME_PCB_DISPLAY3D )
|
||||
{
|
||||
EDA_3D_VIEWER_FRAME* frame3d = static_cast<EDA_3D_VIEWER_FRAME*>( frame );
|
||||
|
||||
RENDER_ENGINE& engine = frame3d->GetAdapter().m_Cfg->m_Render.engine;
|
||||
RENDER_ENGINE old_engine = engine;
|
||||
|
||||
if( old_engine == RENDER_ENGINE::OPENGL )
|
||||
engine = RENDER_ENGINE::RAYTRACING;
|
||||
else
|
||||
engine = RENDER_ENGINE::OPENGL;
|
||||
|
||||
// Directly tell the canvas the rendering engine changed
|
||||
if( old_engine != engine )
|
||||
frame3d->GetCanvas()->RenderEngineChanged();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int EDA_3D_CONTROLLER::ExportImage( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EDA_BASE_FRAME* frame = dynamic_cast<EDA_BASE_FRAME*>( m_toolMgr->GetToolHolder() );
|
||||
|
||||
if( frame && frame->GetFrameType() == FRAME_PCB_DISPLAY3D )
|
||||
static_cast<EDA_3D_VIEWER_FRAME*>( frame )->TakeScreenshot( aEvent.Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>() );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CONTROLLER::setTransitions()
|
||||
{
|
||||
Go( &EDA_3D_CONTROLLER::Main, EDA_3D_ACTIONS::controlActivate.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
|
||||
|
||||
// Miscellaneous control
|
||||
Go( &EDA_3D_CONTROLLER::ReloadBoard, EDA_3D_ACTIONS::reloadBoard.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleRaytracing, EDA_3D_ACTIONS::toggleRaytacing.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ExportImage, EDA_3D_ACTIONS::copyToClipboard.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ExportImage, EDA_3D_ACTIONS::exportAsPNG.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ExportImage, EDA_3D_ACTIONS::exportAsJPEG.MakeEvent() );
|
||||
|
||||
// Pan control
|
||||
Go( &EDA_3D_CONTROLLER::PanControl, ACTIONS::panUp.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::PanControl, ACTIONS::panDown.MakeEvent() );
|
||||
|
||||
@@ -96,10 +96,6 @@ public:
|
||||
int ToggleVisibility( const TOOL_EVENT& aEvent );
|
||||
int ToggleLayersManager( const TOOL_EVENT& aEvent );
|
||||
|
||||
int ReloadBoard( const TOOL_EVENT& aEvent );
|
||||
int ToggleRaytracing( const TOOL_EVENT& aEvent );
|
||||
int ExportImage( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
/// Set up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
@@ -34,12 +34,20 @@
|
||||
enum id_3dview_frm
|
||||
{
|
||||
ID_START_COMMAND_3D = ID_KICAD_3D_VIEWER_START,
|
||||
ID_RELOAD3D_BOARD,
|
||||
ID_TOOL_SCREENCOPY_TOCLIBBOARD,
|
||||
|
||||
ID_MENU_SCREENCOPY_PNG,
|
||||
ID_MENU_SCREENCOPY_JPEG,
|
||||
ID_MENU_SCREENCOPY_TOCLIBBOARD,
|
||||
|
||||
ID_MENU3D_RESET_DEFAULTS,
|
||||
|
||||
// Help
|
||||
ID_MENU_COMMAND_END,
|
||||
|
||||
ID_RENDER_CURRENT_VIEW,
|
||||
|
||||
ID_DISABLE_RAY_TRACING,
|
||||
|
||||
ID_CUSTOM_EVENT_1, // A id for a custom event (canvas refresh request)
|
||||
|
||||
@@ -38,7 +38,6 @@ set(3D-VIEWER_SRCS
|
||||
3d_rendering/opengl/create_scene.cpp
|
||||
3d_rendering/opengl/render_3d_opengl.cpp
|
||||
3d_rendering/opengl/layer_triangles.cpp
|
||||
3d_rendering/opengl/3d_spheres_gizmo.cpp
|
||||
${DIR_RAY_ACC}/accelerator_3d.cpp
|
||||
${DIR_RAY_ACC}/bvh_packet_traversal.cpp
|
||||
${DIR_RAY_ACC}/bvh_pbrt.cpp
|
||||
@@ -82,7 +81,7 @@ set(3D-VIEWER_SRCS
|
||||
3d_rendering/test_cases.cpp
|
||||
3d_rendering/trackball.cpp
|
||||
3d_viewer/3d_menubar.cpp
|
||||
3d_viewer/toolbars_3d.cpp
|
||||
3d_viewer/3d_toolbar.cpp
|
||||
3d_viewer/tools/eda_3d_actions.cpp
|
||||
3d_viewer/tools/eda_3d_conditions.cpp
|
||||
3d_viewer/tools/eda_3d_controller.cpp
|
||||
|
||||
@@ -31,12 +31,18 @@
|
||||
#define OPENGL_INCLUDES_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifndef GL_SILENCE_DEPRECATION
|
||||
// Apple, in their infinite wisdom, has decided to mark OpenGL as deprecated.
|
||||
// Luckily we can silence warnings about its deprecation.
|
||||
#define GL_SILENCE_DEPRECATION 1
|
||||
#endif
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
|
||||
#ifdef _WIN32
|
||||
// required for the windows gl.h to work
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <project.h>
|
||||
#include <board.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/eda_3d_actions.h>
|
||||
@@ -50,93 +51,52 @@
|
||||
/// Template for object appearance settings
|
||||
const APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D APPEARANCE_CONTROLS_3D::s_layerSettings[] = {
|
||||
|
||||
// text id tooltip
|
||||
RR( _HKI( "Board Body" ), LAYER_3D_BOARD, _HKI( "Show board body" ) ),
|
||||
RR( wxS( "F.Cu" ), LAYER_3D_COPPER_TOP, _HKI( "Show front copper / surface finish color" ) ),
|
||||
RR( wxS( "B.Cu" ), LAYER_3D_COPPER_BOTTOM, _HKI( "Show back copper / surface finish color" ) ),
|
||||
RR( _HKI( "Adhesive" ), LAYER_3D_ADHESIVE, _HKI( "Show adhesive" ) ),
|
||||
RR( _HKI( "Solder Paste" ), LAYER_3D_SOLDERPASTE, _HKI( "Show solder paste" ) ),
|
||||
RR( wxS( "F.Silkscreen" ), LAYER_3D_SILKSCREEN_TOP, _HKI( "Show front silkscreen" ) ),
|
||||
RR( wxS( "B.Silkscreen" ), LAYER_3D_SILKSCREEN_BOTTOM, _HKI( "Show back silkscreen" ) ),
|
||||
RR( wxS( "F.Mask" ), LAYER_3D_SOLDERMASK_TOP, _HKI( "Show front solder mask" ) ),
|
||||
RR( wxS( "B.Mask" ), LAYER_3D_SOLDERMASK_BOTTOM, _HKI( "Show back solder mask" ) ),
|
||||
RR( wxS( "User.Drawings" ), LAYER_3D_USER_DRAWINGS, _HKI( "Show user drawings layer" ) ),
|
||||
RR( wxS( "User.Comments" ), LAYER_3D_USER_COMMENTS, _HKI( "Show user comments layer" ) ),
|
||||
RR( wxS( "User.Eco1" ), LAYER_3D_USER_ECO1, _HKI( "Show user ECO1 layer" ) ),
|
||||
RR( wxS( "User.Eco2" ), LAYER_3D_USER_ECO2, _HKI( "Show user ECO2 layer" ) ),
|
||||
RR( wxS( "User.1" ), LAYER_3D_USER_1, _HKI( "Show user defined layer 1" ) ),
|
||||
RR( wxS( "User.2" ), LAYER_3D_USER_2, _HKI( "Show user defined layer 2" ) ),
|
||||
RR( wxS( "User.3" ), LAYER_3D_USER_3, _HKI( "Show user defined layer 3" ) ),
|
||||
RR( wxS( "User.4" ), LAYER_3D_USER_4, _HKI( "Show user defined layer 4" ) ),
|
||||
RR( wxS( "User.5" ), LAYER_3D_USER_5, _HKI( "Show user defined layer 5" ) ),
|
||||
RR( wxS( "User.6" ), LAYER_3D_USER_6, _HKI( "Show user defined layer 6" ) ),
|
||||
RR( wxS( "User.7" ), LAYER_3D_USER_7, _HKI( "Show user defined layer 7" ) ),
|
||||
RR( wxS( "User.8" ), LAYER_3D_USER_8, _HKI( "Show user defined layer 8" ) ),
|
||||
RR( wxS( "User.9" ), LAYER_3D_USER_9, _HKI( "Show user defined layer 9" ) ),
|
||||
RR( wxS( "User.10" ), LAYER_3D_USER_10, _HKI( "Show user defined layer 10" ) ),
|
||||
RR( wxS( "User.11" ), LAYER_3D_USER_11, _HKI( "Show user defined layer 11" ) ),
|
||||
RR( wxS( "User.12" ), LAYER_3D_USER_12, _HKI( "Show user defined layer 12" ) ),
|
||||
RR( wxS( "User.13" ), LAYER_3D_USER_13, _HKI( "Show user defined layer 13" ) ),
|
||||
RR( wxS( "User.14" ), LAYER_3D_USER_14, _HKI( "Show user defined layer 14" ) ),
|
||||
RR( wxS( "User.15" ), LAYER_3D_USER_15, _HKI( "Show user defined layer 15" ) ),
|
||||
RR( wxS( "User.16" ), LAYER_3D_USER_16, _HKI( "Show user defined layer 16" ) ),
|
||||
RR( wxS( "User.17" ), LAYER_3D_USER_17, _HKI( "Show user defined layer 17" ) ),
|
||||
RR( wxS( "User.18" ), LAYER_3D_USER_18, _HKI( "Show user defined layer 18" ) ),
|
||||
RR( wxS( "User.19" ), LAYER_3D_USER_19, _HKI( "Show user defined layer 19" ) ),
|
||||
RR( wxS( "User.20" ), LAYER_3D_USER_20, _HKI( "Show user defined layer 20" ) ),
|
||||
RR( wxS( "User.21" ), LAYER_3D_USER_21, _HKI( "Show user defined layer 21" ) ),
|
||||
RR( wxS( "User.22" ), LAYER_3D_USER_22, _HKI( "Show user defined layer 22" ) ),
|
||||
RR( wxS( "User.23" ), LAYER_3D_USER_23, _HKI( "Show user defined layer 23" ) ),
|
||||
RR( wxS( "User.24" ), LAYER_3D_USER_24, _HKI( "Show user defined layer 24" ) ),
|
||||
RR( wxS( "User.25" ), LAYER_3D_USER_25, _HKI( "Show user defined layer 25" ) ),
|
||||
RR( wxS( "User.26" ), LAYER_3D_USER_26, _HKI( "Show user defined layer 26" ) ),
|
||||
RR( wxS( "User.27" ), LAYER_3D_USER_27, _HKI( "Show user defined layer 27" ) ),
|
||||
RR( wxS( "User.28" ), LAYER_3D_USER_28, _HKI( "Show user defined layer 28" ) ),
|
||||
RR( wxS( "User.29" ), LAYER_3D_USER_29, _HKI( "Show user defined layer 29" ) ),
|
||||
RR( wxS( "User.30" ), LAYER_3D_USER_30, _HKI( "Show user defined layer 30" ) ),
|
||||
RR( wxS( "User.31" ), LAYER_3D_USER_31, _HKI( "Show user defined layer 31" ) ),
|
||||
RR( wxS( "User.32" ), LAYER_3D_USER_32, _HKI( "Show user defined layer 32" ) ),
|
||||
RR( wxS( "User.33" ), LAYER_3D_USER_33, _HKI( "Show user defined layer 33" ) ),
|
||||
RR( wxS( "User.34" ), LAYER_3D_USER_34, _HKI( "Show user defined layer 34" ) ),
|
||||
RR( wxS( "User.35" ), LAYER_3D_USER_35, _HKI( "Show user defined layer 35" ) ),
|
||||
RR( wxS( "User.36" ), LAYER_3D_USER_36, _HKI( "Show user defined layer 36" ) ),
|
||||
RR( wxS( "User.37" ), LAYER_3D_USER_37, _HKI( "Show user defined layer 37" ) ),
|
||||
RR( wxS( "User.38" ), LAYER_3D_USER_38, _HKI( "Show user defined layer 38" ) ),
|
||||
RR( wxS( "User.39" ), LAYER_3D_USER_39, _HKI( "Show user defined layer 39" ) ),
|
||||
RR( wxS( "User.40" ), LAYER_3D_USER_40, _HKI( "Show user defined layer 40" ) ),
|
||||
RR( wxS( "User.41" ), LAYER_3D_USER_41, _HKI( "Show user defined layer 41" ) ),
|
||||
RR( wxS( "User.42" ), LAYER_3D_USER_42, _HKI( "Show user defined layer 42" ) ),
|
||||
RR( wxS( "User.43" ), LAYER_3D_USER_43, _HKI( "Show user defined layer 43" ) ),
|
||||
RR( wxS( "User.44" ), LAYER_3D_USER_44, _HKI( "Show user defined layer 44" ) ),
|
||||
RR( wxS( "User.45" ), LAYER_3D_USER_45, _HKI( "Show user defined layer 45" ) ),
|
||||
// text id tooltip
|
||||
RR( _HKI( "Board Body" ), LAYER_3D_BOARD, _HKI( "Show board body" ) ),
|
||||
RR( _HKI( "F.Cu" ), LAYER_3D_COPPER_TOP, _HKI( "Show front copper / surface finish color" ) ),
|
||||
RR( _HKI( "B.Cu" ), LAYER_3D_COPPER_BOTTOM, _HKI( "Show back copper / surface finish color" ) ),
|
||||
RR( _HKI( "Adhesive" ), LAYER_3D_ADHESIVE, _HKI( "Show adhesive" ) ),
|
||||
RR( _HKI( "Solder Paste" ), LAYER_3D_SOLDERPASTE, _HKI( "Show solder paste" ) ),
|
||||
RR( _HKI( "F.Silkscreen" ), LAYER_3D_SILKSCREEN_TOP, _HKI( "Show front silkscreen" ) ),
|
||||
RR( _HKI( "B.Silkscreen" ), LAYER_3D_SILKSCREEN_BOTTOM, _HKI( "Show back silkscreen" ) ),
|
||||
RR( _HKI( "F.Mask" ), LAYER_3D_SOLDERMASK_TOP, _HKI( "Show front solder mask" ) ),
|
||||
RR( _HKI( "B.Mask" ), LAYER_3D_SOLDERMASK_BOTTOM, _HKI( "Show back solder mask" ) ),
|
||||
RR( _HKI( "User.Drawings" ), LAYER_3D_USER_DRAWINGS, _HKI( "Show user drawings layer" ) ),
|
||||
RR( _HKI( "User.Comments" ), LAYER_3D_USER_COMMENTS, _HKI( "Show user comments layer" ) ),
|
||||
RR( _HKI( "User.Eco1" ), LAYER_3D_USER_ECO1, _HKI( "Show user ECO1 layer" ) ),
|
||||
RR( _HKI( "User.Eco2" ), LAYER_3D_USER_ECO2, _HKI( "Show user ECO2 layer" ) ),
|
||||
RR(),
|
||||
RR( _HKI( "Through-hole Models" ), LAYER_3D_TH_MODELS, EDA_3D_ACTIONS::showTHT ),
|
||||
RR( _HKI( "SMD Models" ), LAYER_3D_SMD_MODELS, EDA_3D_ACTIONS::showSMD ),
|
||||
RR( _HKI( "Virtual Models" ), LAYER_3D_VIRTUAL_MODELS, EDA_3D_ACTIONS::showVirtual ),
|
||||
RR( _HKI( "Models not in POS File" ), LAYER_3D_MODELS_NOT_IN_POS, EDA_3D_ACTIONS::showNotInPosFile ),
|
||||
RR( _HKI( "Models marked DNP" ), LAYER_3D_MODELS_MARKED_DNP, EDA_3D_ACTIONS::showDNP ),
|
||||
RR( _HKI( "Model Bounding Boxes" ), LAYER_3D_BOUNDING_BOXES, EDA_3D_ACTIONS::showBBoxes ),
|
||||
RR( _HKI( "Through-hole Models" ), LAYER_3D_TH_MODELS, EDA_3D_ACTIONS::showTHT ),
|
||||
RR( _HKI( "SMD Models" ), LAYER_3D_SMD_MODELS, EDA_3D_ACTIONS::showSMD ),
|
||||
RR( _HKI( "Virtual Models" ), LAYER_3D_VIRTUAL_MODELS, EDA_3D_ACTIONS::showVirtual ),
|
||||
RR( _HKI( "Models not in POS File" ), LAYER_3D_MODELS_NOT_IN_POS,
|
||||
EDA_3D_ACTIONS::showNotInPosFile ),
|
||||
RR( _HKI( "Models marked DNP" ), LAYER_3D_MODELS_MARKED_DNP, EDA_3D_ACTIONS::showDNP ),
|
||||
RR( _HKI( "Model Bounding Boxes" ), LAYER_3D_BOUNDING_BOXES, EDA_3D_ACTIONS::showBBoxes ),
|
||||
RR(),
|
||||
RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ),
|
||||
RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ),
|
||||
RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ),
|
||||
RR( _HKI( "Off-board Silkscreen" ), LAYER_3D_OFF_BOARD_SILK, _HKI( "Do not clip silk layers to board outline" ) ),
|
||||
RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ),
|
||||
RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ),
|
||||
RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ),
|
||||
RR( _HKI( "Off-board Silkscreen" ), LAYER_3D_OFF_BOARD_SILK,
|
||||
_HKI( "Do not clip silk layers to board outline" ) ),
|
||||
RR(),
|
||||
RR( _HKI( "3D Navigator" ), LAYER_3D_NAVIGATOR, EDA_3D_ACTIONS::showNavigator ),
|
||||
RR( _HKI( "Background Start" ), LAYER_3D_BACKGROUND_TOP, _HKI( "Background gradient start color" ) ),
|
||||
RR( _HKI( "Background End" ), LAYER_3D_BACKGROUND_BOTTOM, _HKI( "Background gradient end color" ) ),
|
||||
RR( _HKI( "3D Axis" ), LAYER_3D_AXES, EDA_3D_ACTIONS::showAxis ),
|
||||
RR( _HKI( "Background Start" ), LAYER_3D_BACKGROUND_TOP,
|
||||
_HKI( "Background gradient start color" ) ),
|
||||
RR( _HKI( "Background End" ), LAYER_3D_BACKGROUND_BOTTOM,
|
||||
_HKI( "Background gradient end color" ) ),
|
||||
};
|
||||
|
||||
// The list of IDs that can have colors coming from the board stackup, and cannot be
|
||||
// modified if use colors from stackup is activated
|
||||
static std::vector<int> inStackupColors{ LAYER_3D_BOARD,
|
||||
LAYER_3D_COPPER_TOP, LAYER_3D_COPPER_BOTTOM,
|
||||
LAYER_3D_SOLDERPASTE,
|
||||
static std::vector<int> inStackupColors{ LAYER_3D_BOARD, LAYER_3D_COPPER_TOP,
|
||||
LAYER_3D_COPPER_BOTTOM, LAYER_3D_SOLDERPASTE,
|
||||
LAYER_3D_SILKSCREEN_TOP, LAYER_3D_SILKSCREEN_BOTTOM,
|
||||
LAYER_3D_SOLDERMASK_TOP, LAYER_3D_SOLDERMASK_BOTTOM
|
||||
};
|
||||
|
||||
APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, wxWindow* aFocusOwner ) :
|
||||
APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
|
||||
wxWindow* aFocusOwner ) :
|
||||
APPEARANCE_CONTROLS_3D_BASE( aParent ),
|
||||
m_frame( aParent ),
|
||||
m_focusOwner( aFocusOwner ),
|
||||
@@ -175,6 +135,7 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, wx
|
||||
cfg->m_UseStackupColors = aEvent.IsChecked();
|
||||
|
||||
UpdateLayerCtls();
|
||||
syncLayerPresetSelection();
|
||||
m_frame->NewDisplay( true );
|
||||
} );
|
||||
|
||||
@@ -191,6 +152,7 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, wx
|
||||
cfg->m_Render.use_board_editor_copper_colors = aEvent.IsChecked();
|
||||
|
||||
UpdateLayerCtls();
|
||||
syncLayerPresetSelection();
|
||||
m_frame->NewDisplay( true );
|
||||
} );
|
||||
|
||||
@@ -198,17 +160,18 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, wx
|
||||
m_panelLayersSizer->Add( m_cbUseBoardEditorCopperColors, 0,
|
||||
wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore color and visibility combinations.\n"
|
||||
m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore color and visibility "
|
||||
"combinations.\n"
|
||||
"Use %s+Tab to activate selector.\n"
|
||||
"Successive Tabs while holding %s down will cycle through "
|
||||
"presets in the popup." ),
|
||||
"Successive Tabs while holding %s down will "
|
||||
"cycle through presets in the popup." ),
|
||||
KeyNameFromKeyCode( PRESET_SWITCH_KEY ),
|
||||
KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) );
|
||||
|
||||
m_cbViewports->SetToolTip( wxString::Format( _( "Save and restore camera position and zoom.\n"
|
||||
"Use %s+Tab to activate selector.\n"
|
||||
"Successive Tabs while holding %s down will cycle through "
|
||||
"viewports in the popup." ),
|
||||
"Successive Tabs while holding %s down will "
|
||||
"cycle through viewports in the popup." ),
|
||||
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ),
|
||||
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) );
|
||||
|
||||
@@ -309,13 +272,7 @@ void APPEARANCE_CONTROLS_3D::CommonSettingsChanged()
|
||||
rebuildControls();
|
||||
|
||||
UpdateLayerCtls();
|
||||
|
||||
const wxString& currentPreset = m_frame->GetAdapter().m_Cfg->m_CurrentPreset;
|
||||
|
||||
if( currentPreset == FOLLOW_PCB || currentPreset == FOLLOW_PLOT_SETTINGS )
|
||||
updateLayerPresetWidget( currentPreset );
|
||||
else
|
||||
syncLayerPresetSelection();
|
||||
syncLayerPresetSelection();
|
||||
}
|
||||
|
||||
|
||||
@@ -453,10 +410,6 @@ void APPEARANCE_CONTROLS_3D::OnLayerVisibilityChanged( int aLayer, bool isVisibl
|
||||
|
||||
default:
|
||||
visibleLayers.set( aLayer, isVisible );
|
||||
|
||||
if( aLayer >= LAYER_3D_USER_1 && aLayer <= LAYER_3D_USER_45 )
|
||||
killFollow = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -472,7 +425,8 @@ void APPEARANCE_CONTROLS_3D::OnLayerVisibilityChanged( int aLayer, bool isVisibl
|
||||
|
||||
if( doFastRefresh && m_frame->GetAdapter().m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||
{
|
||||
RENDER_3D_OPENGL* renderer = static_cast<RENDER_3D_OPENGL*>( m_frame->GetCanvas()->GetCurrentRender() );
|
||||
RENDER_3D_OPENGL* renderer =
|
||||
static_cast<RENDER_3D_OPENGL*>( m_frame->GetCanvas()->GetCurrentRender() );
|
||||
renderer->Load3dModelsIfNeeded();
|
||||
m_frame->GetCanvas()->Request_refresh();
|
||||
}
|
||||
@@ -489,6 +443,7 @@ void APPEARANCE_CONTROLS_3D::onColorSwatchChanged( COLOR_SWATCH* aSwatch )
|
||||
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
|
||||
|
||||
m_frame->GetAdapter().SetVisibleLayers( visibleLayers );
|
||||
m_frame->GetAdapter().SetLayerColors( colors );
|
||||
|
||||
int layer = aSwatch->GetId();
|
||||
COLOR4D newColor = aSwatch->GetSwatchColor();
|
||||
@@ -502,12 +457,7 @@ void APPEARANCE_CONTROLS_3D::onColorSwatchChanged( COLOR_SWATCH* aSwatch )
|
||||
|
||||
m_frame->GetAdapter().SetLayerColors( colors );
|
||||
|
||||
const wxString& currentPreset = m_frame->GetAdapter().m_Cfg->m_CurrentPreset;
|
||||
|
||||
if( currentPreset == FOLLOW_PCB || currentPreset == FOLLOW_PLOT_SETTINGS )
|
||||
updateLayerPresetWidget( currentPreset );
|
||||
else
|
||||
syncLayerPresetSelection();
|
||||
syncLayerPresetSelection();
|
||||
|
||||
m_frame->NewDisplay( true );
|
||||
}
|
||||
@@ -520,7 +470,6 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers()
|
||||
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
|
||||
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
|
||||
std::map<int, COLOR4D> defaultColors = m_frame->GetAdapter().GetDefaultColors();
|
||||
LSET enabled = m_frame->GetBoard()->GetEnabledLayers();
|
||||
|
||||
m_layerSettings.clear();
|
||||
m_layersOuterSizer->Clear( true );
|
||||
@@ -575,13 +524,8 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers()
|
||||
|
||||
sizer->AddSpacer( 5 );
|
||||
|
||||
wxString layerName = aSetting->GetLabel();
|
||||
PCB_LAYER_ID boardLayer = Map3DLayerToPCBLayer( layer );
|
||||
|
||||
if( boardLayer != UNDEFINED_LAYER )
|
||||
layerName = m_frame->GetBoard()->GetLayerName( boardLayer );
|
||||
|
||||
wxStaticText* label = new wxStaticText( m_windowLayers, layer, layerName );
|
||||
wxStaticText* label = new wxStaticText( m_windowLayers, layer,
|
||||
aSetting->GetLabel() );
|
||||
label->Wrap( -1 );
|
||||
label->SetToolTip( aSetting->GetTooltip() );
|
||||
|
||||
@@ -591,10 +535,9 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers()
|
||||
}
|
||||
else
|
||||
{
|
||||
BITMAP_TOGGLE* btn_visible = new BITMAP_TOGGLE( m_windowLayers, layer,
|
||||
KiBitmapBundle( BITMAPS::visibility ),
|
||||
KiBitmapBundle( BITMAPS::visibility_off ),
|
||||
aSetting->m_Visible );
|
||||
BITMAP_TOGGLE* btn_visible = new BITMAP_TOGGLE(
|
||||
m_windowLayers, layer, KiBitmapBundle( BITMAPS::visibility ),
|
||||
KiBitmapBundle( BITMAPS::visibility_off ), aSetting->m_Visible );
|
||||
|
||||
btn_visible->Bind( TOGGLE_CHANGED,
|
||||
[this]( wxCommandEvent& aEvent )
|
||||
@@ -627,18 +570,9 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers()
|
||||
std::unique_ptr<APPEARANCE_SETTING_3D>& setting = m_layerSettings.back();
|
||||
|
||||
if( setting->m_Spacer )
|
||||
{
|
||||
m_layersOuterSizer->AddSpacer( m_pointSize );
|
||||
}
|
||||
else if( setting->m_Id >= LAYER_3D_USER_1 && setting->m_Id <= LAYER_3D_USER_45 )
|
||||
{
|
||||
if( enabled.test( Map3DLayerToPCBLayer( setting->m_Id ) ) )
|
||||
appendLayer( setting );
|
||||
}
|
||||
else
|
||||
{
|
||||
appendLayer( setting );
|
||||
}
|
||||
|
||||
m_layerSettingsMap[setting->m_Id] = setting.get();
|
||||
}
|
||||
@@ -667,8 +601,12 @@ void APPEARANCE_CONTROLS_3D::UpdateLayerCtls()
|
||||
|
||||
// if cfg->m_UseStackupColors is set, board colors cannot be modified locally, but
|
||||
// other colors can be
|
||||
if( alg::contains( inStackupColors, setting->m_Id ) && cfg )
|
||||
setting->m_Ctl_color->SetReadOnly( cfg->m_UseStackupColors );
|
||||
if( std::find( inStackupColors.begin(), inStackupColors.end(), setting->m_Id )
|
||||
!= inStackupColors.end() )
|
||||
{
|
||||
if( cfg )
|
||||
setting->m_Ctl_color->SetReadOnly( cfg->m_UseStackupColors );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,8 +653,11 @@ void APPEARANCE_CONTROLS_3D::syncLayerPresetSelection()
|
||||
presets.begin(), presets.end(),
|
||||
[&]( const LAYER_PRESET_3D& aPreset )
|
||||
{
|
||||
if( aPreset.name.Lower() == _( "legacy colors" ) && m_cbUseBoardStackupColors->GetValue() )
|
||||
if( aPreset.name.Lower() == _( "legacy colors" )
|
||||
&& m_cbUseBoardStackupColors->GetValue() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for( int layer = LAYER_3D_BOARD; layer < LAYER_3D_END; ++layer )
|
||||
{
|
||||
@@ -864,8 +805,7 @@ void APPEARANCE_CONTROLS_3D::onLayerPresetChanged( wxCommandEvent& aEvent )
|
||||
if( cfg->m_CurrentPreset == name )
|
||||
cfg->m_CurrentPreset = wxEmptyString;
|
||||
|
||||
if( m_presetMRU.Index( name ) >= 0 )
|
||||
m_presetMRU.Remove( name );
|
||||
m_presetMRU.Remove( name );
|
||||
}
|
||||
|
||||
resetSelection();
|
||||
@@ -977,7 +917,8 @@ void APPEARANCE_CONTROLS_3D::onViewportChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_viewports[name] = VIEWPORT3D( name, m_frame->GetCurrentCamera().GetViewMatrix() );
|
||||
|
||||
index = m_cbViewports->Insert( name, index-1, static_cast<void*>( &m_viewports[name] ) );
|
||||
index = m_cbViewports->Insert( name, index-1,
|
||||
static_cast<void*>( &m_viewports[name] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -64,28 +64,32 @@ void PANEL_3D_DISPLAY_OPTIONS::loadViewSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
|
||||
|
||||
bool PANEL_3D_DISPLAY_OPTIONS::TransferDataToWindow()
|
||||
{
|
||||
loadViewSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
|
||||
loadViewSettings( cfg );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_3D_DISPLAY_OPTIONS::TransferDataFromWindow()
|
||||
{
|
||||
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
|
||||
{
|
||||
// Set visibility of items
|
||||
cfg->m_Render.show_zones = m_checkBoxAreas->GetValue();
|
||||
cfg->m_Render.subtract_mask_from_silk = m_checkBoxSubtractMaskFromSilk->GetValue();
|
||||
cfg->m_Render.clip_silk_on_via_annuli = m_checkBoxClipSilkOnViaAnnulus->GetValue();
|
||||
cfg->m_Render.differentiate_plated_copper = m_checkBoxRenderPlatedPadsAsPlated->GetValue();
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
|
||||
cfg->m_Render.material_mode = static_cast<MATERIAL_MODE>( m_materialProperties->GetSelection() );
|
||||
// Set visibility of items
|
||||
cfg->m_Render.show_zones = m_checkBoxAreas->GetValue();
|
||||
cfg->m_Render.subtract_mask_from_silk = m_checkBoxSubtractMaskFromSilk->GetValue();
|
||||
cfg->m_Render.clip_silk_on_via_annuli = m_checkBoxClipSilkOnViaAnnulus->GetValue();
|
||||
cfg->m_Render.differentiate_plated_copper = m_checkBoxRenderPlatedPadsAsPlated->GetValue();
|
||||
|
||||
// Camera Options
|
||||
cfg->m_Camera.animation_enabled = m_checkBoxEnableAnimation->GetValue();
|
||||
cfg->m_Camera.moving_speed_multiplier = m_sliderAnimationSpeed->GetValue();
|
||||
cfg->m_Camera.rotation_increment = m_spinCtrlRotationAngle->GetValue();
|
||||
}
|
||||
cfg->m_Render.material_mode = static_cast<MATERIAL_MODE>( m_materialProperties->GetSelection() );
|
||||
|
||||
// Camera Options
|
||||
cfg->m_Camera.animation_enabled = m_checkBoxEnableAnimation->GetValue();
|
||||
cfg->m_Camera.moving_speed_multiplier = m_sliderAnimationSpeed->GetValue();
|
||||
cfg->m_Camera.rotation_increment = m_spinCtrlRotationAngle->GetValue();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -25,7 +25,7 @@ PANEL_3D_DISPLAY_OPTIONS_BASE::PANEL_3D_DISPLAY_OPTIONS_BASE( wxWindow* parent,
|
||||
bSizeLeft->Add( m_renderOptionsLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
|
||||
|
||||
m_staticline4 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizeLeft->Add( m_staticline4, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 );
|
||||
bSizeLeft->Add( m_staticline4, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizer2;
|
||||
fgSizer2 = new wxFlexGridSizer( 0, 1, 5, 0 );
|
||||
@@ -33,7 +33,7 @@ PANEL_3D_DISPLAY_OPTIONS_BASE::PANEL_3D_DISPLAY_OPTIONS_BASE( wxWindow* parent,
|
||||
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_checkBoxClipSilkOnViaAnnulus = new wxCheckBox( this, wxID_ANY, _("Clip silkscreen at via annuli"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_checkBoxClipSilkOnViaAnnulus, 0, wxTOP|wxLEFT, 5 );
|
||||
fgSizer2->Add( m_checkBoxClipSilkOnViaAnnulus, 0, wxLEFT, 5 );
|
||||
|
||||
m_checkBoxSubtractMaskFromSilk = new wxCheckBox( this, wxID_ANY, _("Clip silkscreen at solder mask edges"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_checkBoxSubtractMaskFromSilk, 0, wxLEFT, 5 );
|
||||
@@ -76,22 +76,22 @@ PANEL_3D_DISPLAY_OPTIONS_BASE::PANEL_3D_DISPLAY_OPTIONS_BASE( wxWindow* parent,
|
||||
bSizerRight->Add( m_cameraOptionsLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 );
|
||||
|
||||
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerRight->Add( m_staticline5, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 );
|
||||
bSizerRight->Add( m_staticline5, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* bSizerRotAngle;
|
||||
bSizerRotAngle = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticTextRotAngle = new wxStaticText( this, wxID_ANY, _("Rotation increment:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextRotAngle->Wrap( -1 );
|
||||
bSizerRotAngle->Add( m_staticTextRotAngle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
bSizerRotAngle->Add( m_staticTextRotAngle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_spinCtrlRotationAngle = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 359, 10, 1 );
|
||||
m_spinCtrlRotationAngle->SetDigits( 0 );
|
||||
bSizerRotAngle->Add( m_spinCtrlRotationAngle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
bSizerRotAngle->Add( m_spinCtrlRotationAngle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextRotAngleUnits = new wxStaticText( this, wxID_ANY, _("deg"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextRotAngleUnits->Wrap( -1 );
|
||||
bSizerRotAngle->Add( m_staticTextRotAngleUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
|
||||
bSizerRotAngle->Add( m_staticTextRotAngleUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizerRight->Add( bSizerRotAngle, 0, wxTOP|wxLEFT, 5 );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_3D_DISPLAY_OPTIONS_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -49,34 +49,39 @@ void PANEL_3D_OPENGL_OPTIONS::loadSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
|
||||
|
||||
m_checkBoxDisableAAMove->SetValue( aCfg->m_Render.opengl_AA_disableOnMove );
|
||||
m_checkBoxDisableMoveThickness->SetValue( aCfg->m_Render.opengl_thickness_disableOnMove );
|
||||
m_checkBoxDisableMoveVias->SetValue( aCfg->m_Render.opengl_microvias_disableOnMove );
|
||||
m_checkBoxDisableMoveVias->SetValue( aCfg->m_Render.opengl_vias_disableOnMove );
|
||||
m_checkBoxDisableMoveHoles->SetValue( aCfg->m_Render.opengl_holes_disableOnMove );
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_3D_OPENGL_OPTIONS::TransferDataToWindow()
|
||||
{
|
||||
loadSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
|
||||
loadSettings( cfg );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_3D_OPENGL_OPTIONS::TransferDataFromWindow()
|
||||
{
|
||||
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
|
||||
{
|
||||
cfg->m_Render.opengl_copper_thickness = m_checkBoxCuThickness->GetValue();
|
||||
cfg->m_Render.show_model_bbox = m_checkBoxBoundingBoxes->GetValue();
|
||||
cfg->m_Render.highlight_on_rollover = m_checkBoxHighlightOnRollOver->GetValue();
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
|
||||
cfg->m_Render.opengl_AA_mode = static_cast<ANTIALIASING_MODE>( m_choiceAntiAliasing->GetSelection() );
|
||||
cfg->m_Render.opengl_selection_color = m_selectionColorSwatch->GetSwatchColor();
|
||||
cfg->m_Render.opengl_copper_thickness = m_checkBoxCuThickness->GetValue();
|
||||
cfg->m_Render.show_model_bbox = m_checkBoxBoundingBoxes->GetValue();
|
||||
cfg->m_Render.highlight_on_rollover = m_checkBoxHighlightOnRollOver->GetValue();
|
||||
|
||||
cfg->m_Render.opengl_AA_disableOnMove = m_checkBoxDisableAAMove->GetValue();
|
||||
cfg->m_Render.opengl_thickness_disableOnMove = m_checkBoxDisableMoveThickness->GetValue();
|
||||
cfg->m_Render.opengl_microvias_disableOnMove = m_checkBoxDisableMoveVias->GetValue();
|
||||
cfg->m_Render.opengl_holes_disableOnMove = m_checkBoxDisableMoveHoles->GetValue();
|
||||
}
|
||||
cfg->m_Render.opengl_AA_mode =
|
||||
static_cast<ANTIALIASING_MODE>( m_choiceAntiAliasing->GetSelection() );
|
||||
cfg->m_Render.opengl_selection_color = m_selectionColorSwatch->GetSwatchColor();
|
||||
|
||||
cfg->m_Render.opengl_AA_disableOnMove = m_checkBoxDisableAAMove->GetValue();
|
||||
cfg->m_Render.opengl_thickness_disableOnMove = m_checkBoxDisableMoveThickness->GetValue();
|
||||
cfg->m_Render.opengl_vias_disableOnMove = m_checkBoxDisableMoveVias->GetValue();
|
||||
cfg->m_Render.opengl_holes_disableOnMove = m_checkBoxDisableMoveHoles->GetValue();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ PANEL_3D_OPENGL_OPTIONS_BASE::PANEL_3D_OPENGL_OPTIONS_BASE( wxWindow* parent, wx
|
||||
m_checkBoxBoundingBoxes = new wxCheckBox( this, wxID_ANY, _("Show model bounding boxes"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerMargins->Add( m_checkBoxBoundingBoxes, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkBoxCuThickness = new wxCheckBox( this, wxID_ANY, _("Show copper and tech layers thickness (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkBoxCuThickness = new wxCheckBox( this, wxID_ANY, _("Show copper and tech layers thickness (very slow)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerMargins->Add( m_checkBoxCuThickness, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkBoxHighlightOnRollOver = new wxCheckBox( this, wxID_ANY, _("Highlight items on rollover"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
@@ -88,10 +88,10 @@ PANEL_3D_OPENGL_OPTIONS_BASE::PANEL_3D_OPENGL_OPTIONS_BASE( wxWindow* parent, wx
|
||||
m_checkBoxDisableMoveThickness = new wxCheckBox( this, wxID_ANY, _("Disable thickness"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer3->Add( m_checkBoxDisableMoveThickness, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkBoxDisableMoveVias = new wxCheckBox( this, wxID_ANY, _("Disable uVia holes"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkBoxDisableMoveVias = new wxCheckBox( this, wxID_ANY, _("Disable vias"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer3->Add( m_checkBoxDisableMoveVias, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkBoxDisableMoveHoles = new wxCheckBox( this, wxID_ANY, _("Disable all plated holes"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkBoxDisableMoveHoles = new wxCheckBox( this, wxID_ANY, _("Disable holes"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer3->Add( m_checkBoxDisableMoveHoles, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show copper and tech layers thickness (slow)</property>
|
||||
<property name="label">Show copper and tech layers thickness (very slow)</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -977,7 +977,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Disable uVia holes</property>
|
||||
<property name="label">Disable vias</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -1042,7 +1042,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Disable all plated holes</property>
|
||||
<property name="label">Disable holes</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
||||
@@ -110,78 +110,85 @@ void PANEL_3D_RAYTRACING_OPTIONS::loadSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
|
||||
|
||||
bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataToWindow()
|
||||
{
|
||||
loadSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
|
||||
loadSettings( cfg );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataFromWindow()
|
||||
{
|
||||
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
|
||||
{
|
||||
cfg->m_Render.raytrace_shadows = m_cbRaytracing_renderShadows->GetValue();
|
||||
cfg->m_Render.raytrace_backfloor = m_cbRaytracing_addFloor->GetValue();
|
||||
cfg->m_Render.raytrace_refractions = m_cbRaytracing_showRefractions->GetValue();
|
||||
cfg->m_Render.raytrace_reflections = m_cbRaytracing_showReflections->GetValue();
|
||||
cfg->m_Render.raytrace_post_processing = m_cbRaytracing_postProcessing->GetValue();
|
||||
cfg->m_Render.raytrace_anti_aliasing = m_cbRaytracing_antiAliasing->GetValue();
|
||||
cfg->m_Render.raytrace_procedural_textures = m_cbRaytracing_proceduralTextures->GetValue();
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
|
||||
cfg->m_Render.raytrace_nrsamples_shadows = m_numSamples_Shadows->GetValue();
|
||||
cfg->m_Render.raytrace_nrsamples_reflections = m_numSamples_Reflections->GetValue();
|
||||
cfg->m_Render.raytrace_nrsamples_refractions = m_numSamples_Refractions->GetValue();
|
||||
cfg->m_Render.raytrace_shadows = m_cbRaytracing_renderShadows->GetValue();
|
||||
cfg->m_Render.raytrace_backfloor = m_cbRaytracing_addFloor->GetValue();
|
||||
cfg->m_Render.raytrace_refractions = m_cbRaytracing_showRefractions->GetValue();
|
||||
cfg->m_Render.raytrace_reflections = m_cbRaytracing_showReflections->GetValue();
|
||||
cfg->m_Render.raytrace_post_processing = m_cbRaytracing_postProcessing->GetValue();
|
||||
cfg->m_Render.raytrace_anti_aliasing = m_cbRaytracing_antiAliasing->GetValue();
|
||||
cfg->m_Render.raytrace_procedural_textures = m_cbRaytracing_proceduralTextures->GetValue();
|
||||
|
||||
cfg->m_Render.raytrace_spread_shadows =
|
||||
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
|
||||
m_spreadFactor_Shadows->GetValue() ) / 100.0f;
|
||||
cfg->m_Render.raytrace_spread_reflections =
|
||||
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
|
||||
m_spreadFactor_Reflections->GetValue() ) / 100.0f;
|
||||
cfg->m_Render.raytrace_spread_refractions =
|
||||
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
|
||||
m_spreadFactor_Refractions->GetValue() ) / 100.0f;
|
||||
cfg->m_Render.raytrace_nrsamples_shadows = m_numSamples_Shadows->GetValue();
|
||||
cfg->m_Render.raytrace_nrsamples_reflections = m_numSamples_Reflections->GetValue();
|
||||
cfg->m_Render.raytrace_nrsamples_refractions = m_numSamples_Refractions->GetValue();
|
||||
|
||||
cfg->m_Render.raytrace_recursivelevel_reflections = m_recursiveLevel_Reflections->GetValue();
|
||||
cfg->m_Render.raytrace_recursivelevel_refractions = m_recursiveLevel_Refractions->GetValue();
|
||||
cfg->m_Render.raytrace_spread_shadows =
|
||||
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
|
||||
m_spreadFactor_Shadows->GetValue() )
|
||||
/ 100.0f;
|
||||
cfg->m_Render.raytrace_spread_reflections =
|
||||
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
|
||||
m_spreadFactor_Reflections->GetValue() )
|
||||
/ 100.0f;
|
||||
cfg->m_Render.raytrace_spread_refractions =
|
||||
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
|
||||
m_spreadFactor_Refractions->GetValue() )
|
||||
/ 100.0f;
|
||||
|
||||
cfg->m_Render.raytrace_lightColorCamera = m_colourPickerCameraLight->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColorTop = m_colourPickerTopLight->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColorBottom = m_colourPickerBottomLight->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_recursivelevel_reflections = m_recursiveLevel_Reflections->GetValue();
|
||||
cfg->m_Render.raytrace_recursivelevel_refractions = m_recursiveLevel_Refractions->GetValue();
|
||||
|
||||
cfg->m_Render.raytrace_lightColor[0] = m_colourPickerLight1->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[1] = m_colourPickerLight2->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[2] = m_colourPickerLight3->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[3] = m_colourPickerLight4->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[4] = m_colourPickerLight5->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[5] = m_colourPickerLight6->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[6] = m_colourPickerLight7->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[7] = m_colourPickerLight8->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColorCamera = m_colourPickerCameraLight->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColorTop = m_colourPickerTopLight->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColorBottom = m_colourPickerBottomLight->GetSwatchColor();
|
||||
|
||||
auto get_value =
|
||||
[]( wxTextCtrl* aCtrl )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
|
||||
aCtrl->GetValue() );
|
||||
};
|
||||
cfg->m_Render.raytrace_lightColor[0] = m_colourPickerLight1->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[1] = m_colourPickerLight2->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[2] = m_colourPickerLight3->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[3] = m_colourPickerLight4->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[4] = m_colourPickerLight5->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[5] = m_colourPickerLight6->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[6] = m_colourPickerLight7->GetSwatchColor();
|
||||
cfg->m_Render.raytrace_lightColor[7] = m_colourPickerLight8->GetSwatchColor();
|
||||
|
||||
cfg->m_Render.raytrace_lightElevation[0] = get_value( m_lightElevation1 );
|
||||
cfg->m_Render.raytrace_lightElevation[1] = get_value( m_lightElevation2 );
|
||||
cfg->m_Render.raytrace_lightElevation[2] = get_value( m_lightElevation3 );
|
||||
cfg->m_Render.raytrace_lightElevation[3] = get_value( m_lightElevation4 );
|
||||
cfg->m_Render.raytrace_lightElevation[4] = get_value( m_lightElevation5 );
|
||||
cfg->m_Render.raytrace_lightElevation[5] = get_value( m_lightElevation6 );
|
||||
cfg->m_Render.raytrace_lightElevation[6] = get_value( m_lightElevation7 );
|
||||
cfg->m_Render.raytrace_lightElevation[7] = get_value( m_lightElevation8 );
|
||||
auto get_value =
|
||||
[]( wxTextCtrl* aCtrl )
|
||||
{
|
||||
return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
|
||||
aCtrl->GetValue() );
|
||||
};
|
||||
|
||||
cfg->m_Render.raytrace_lightAzimuth[0] = get_value( m_lightAzimuth1 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[1] = get_value( m_lightAzimuth2 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[2] = get_value( m_lightAzimuth3 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[3] = get_value( m_lightAzimuth4 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[4] = get_value( m_lightAzimuth5 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[5] = get_value( m_lightAzimuth6 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[6] = get_value( m_lightAzimuth7 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[7] = get_value( m_lightAzimuth8 );
|
||||
}
|
||||
cfg->m_Render.raytrace_lightElevation[0] = get_value( m_lightElevation1 );
|
||||
cfg->m_Render.raytrace_lightElevation[1] = get_value( m_lightElevation2 );
|
||||
cfg->m_Render.raytrace_lightElevation[2] = get_value( m_lightElevation3 );
|
||||
cfg->m_Render.raytrace_lightElevation[3] = get_value( m_lightElevation4 );
|
||||
cfg->m_Render.raytrace_lightElevation[4] = get_value( m_lightElevation5 );
|
||||
cfg->m_Render.raytrace_lightElevation[5] = get_value( m_lightElevation6 );
|
||||
cfg->m_Render.raytrace_lightElevation[6] = get_value( m_lightElevation7 );
|
||||
cfg->m_Render.raytrace_lightElevation[7] = get_value( m_lightElevation8 );
|
||||
|
||||
cfg->m_Render.raytrace_lightAzimuth[0] = get_value( m_lightAzimuth1 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[1] = get_value( m_lightAzimuth2 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[2] = get_value( m_lightAzimuth3 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[3] = get_value( m_lightAzimuth4 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[4] = get_value( m_lightAzimuth5 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[5] = get_value( m_lightAzimuth6 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[6] = get_value( m_lightAzimuth7 );
|
||||
cfg->m_Render.raytrace_lightAzimuth[7] = get_value( m_lightAzimuth8 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -19,25 +19,22 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
|
||||
bSizerMain->Add( m_renderingLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 );
|
||||
|
||||
|
||||
bSizerMain->Add( 0, 5, 0, wxEXPAND, 5 );
|
||||
bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
wxGridSizer* gSizer1;
|
||||
gSizer1 = new wxGridSizer( 0, 1, 0, 20 );
|
||||
|
||||
m_cbRaytracing_proceduralTextures = new wxCheckBox( this, wxID_ANY, _("Procedural textures (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbRaytracing_proceduralTextures->SetValue(true);
|
||||
gSizer1->Add( m_cbRaytracing_proceduralTextures, 0, wxRIGHT|wxLEFT, 5 );
|
||||
gSizer1->Add( m_cbRaytracing_proceduralTextures, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_cbRaytracing_addFloor = new wxCheckBox( this, wxID_ANY, _("Add floor (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbRaytracing_addFloor->SetValue(true);
|
||||
gSizer1->Add( m_cbRaytracing_addFloor, 0, wxRIGHT|wxLEFT, 5 );
|
||||
gSizer1->Add( m_cbRaytracing_addFloor, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_cbRaytracing_antiAliasing = new wxCheckBox( this, wxID_ANY, _("Anti-aliasing (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbRaytracing_antiAliasing->SetValue(true);
|
||||
gSizer1->Add( m_cbRaytracing_antiAliasing, 0, wxRIGHT|wxLEFT, 5 );
|
||||
gSizer1->Add( m_cbRaytracing_antiAliasing, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_cbRaytracing_postProcessing = new wxCheckBox( this, wxID_ANY, _("Screen space ambient occlusions and global illumination reflections (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbRaytracing_postProcessing->SetValue(true);
|
||||
@@ -126,7 +123,7 @@ PANEL_3D_RAYTRACING_OPTIONS_BASE::PANEL_3D_RAYTRACING_OPTIONS_BASE( wxWindow* pa
|
||||
bSizerMain->Add( m_lightsLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerMain->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 );
|
||||
bSizerMain->Add( m_staticline2, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* bLightsSizer;
|
||||
bLightsSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_3D_RAYTRACING_OPTIONS_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "panel_preview_3d_model.h"
|
||||
#include <dialogs/dialog_unit_entry.h>
|
||||
#include <3d_canvas/eda_3d_canvas.h>
|
||||
#include <3d_rendering/opengl/render_3d_opengl.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
#include <tools/eda_3d_actions.h>
|
||||
@@ -65,11 +64,12 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
m_dummyBoard = new BOARD();
|
||||
|
||||
m_dummyBoard->SetProject( &aFrame->Prj(), true );
|
||||
m_dummyBoard->SetEmbeddedFilesDelegate( aFrame->GetBoard() );
|
||||
|
||||
// This board will only be used to hold a footprint for viewing
|
||||
m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
|
||||
|
||||
m_bodyStyleShowAll = true;
|
||||
|
||||
BOARD_DESIGN_SETTINGS parent_bds = aFrame->GetDesignSettings();
|
||||
BOARD_DESIGN_SETTINGS& dummy_bds = m_dummyBoard->GetDesignSettings();
|
||||
dummy_bds.SetBoardThickness( parent_bds.GetBoardThickness() );
|
||||
@@ -212,7 +212,10 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
|
||||
// TODO(JE) use all control options
|
||||
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
||||
|
||||
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
// Save the 3D viewer render settings, to restore it after closing the preview
|
||||
m_initialRender = cfg->m_Render;
|
||||
@@ -222,6 +225,16 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
|
||||
m_previewPane->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
|
||||
m_previewPane->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
|
||||
m_previewPane->SetProjectionMode( cfg->m_Camera.projection_mode );
|
||||
|
||||
// Ensure the board body is always shown, and do not use the settings of the 3D viewer
|
||||
cfg->m_Render.show_copper_top = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_copper_bottom = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_soldermask_top = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_soldermask_bottom = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_solderpaste = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_zones = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_board_body = m_bodyStyleShowAll;
|
||||
cfg->m_Render.use_board_editor_copper_colors = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +405,13 @@ void PANEL_PREVIEW_3D_MODEL::setBodyStyleView( wxCommandEvent& event )
|
||||
if( !cfg )
|
||||
return;
|
||||
|
||||
cfg->m_Render.preview_show_board_body = !cfg->m_Render.preview_show_board_body;
|
||||
m_bodyStyleShowAll = !m_bodyStyleShowAll;
|
||||
|
||||
cfg->m_Render.show_soldermask_top = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_soldermask_bottom = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_solderpaste = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_zones = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_board_body = m_bodyStyleShowAll;
|
||||
|
||||
m_previewPane->ReloadRequest();
|
||||
m_previewPane->Refresh();
|
||||
@@ -425,9 +444,7 @@ void PANEL_PREVIEW_3D_MODEL::View3DSettings( wxCommandEvent& event )
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign )
|
||||
{
|
||||
wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( event.GetEventObject() );
|
||||
|
||||
wxCHECK( spinCtrl, /* void */ );
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
|
||||
|
||||
wxTextCtrl * textCtrl = xscale;
|
||||
|
||||
@@ -454,10 +471,7 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
|
||||
{
|
||||
wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( aEvent.GetEventObject() );
|
||||
|
||||
wxCHECK( spinCtrl, /* void */ );
|
||||
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
|
||||
wxTextCtrl* textCtrl = xrot;
|
||||
|
||||
if( spinCtrl == m_spinYrot )
|
||||
@@ -483,9 +497,7 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aS
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign )
|
||||
{
|
||||
wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( event.GetEventObject() );
|
||||
|
||||
wxCHECK( spinCtrl, /* void */ );
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
|
||||
|
||||
wxTextCtrl * textCtrl = xoff;
|
||||
|
||||
@@ -521,9 +533,7 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::onMouseWheelScale( wxMouseEvent& event )
|
||||
{
|
||||
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
|
||||
|
||||
wxCHECK( textCtrl, /* void */ );
|
||||
wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
|
||||
|
||||
double step = SCALE_INCREMENT;
|
||||
|
||||
@@ -546,9 +556,7 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelScale( wxMouseEvent& event )
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::onMouseWheelRot( wxMouseEvent& event )
|
||||
{
|
||||
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
|
||||
|
||||
wxCHECK( textCtrl, /* void */ );
|
||||
wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
|
||||
|
||||
double step = ROTATION_INCREMENT;
|
||||
|
||||
@@ -571,9 +579,7 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelRot( wxMouseEvent& event )
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::onMouseWheelOffset( wxMouseEvent& event )
|
||||
{
|
||||
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
|
||||
|
||||
wxCHECK( textCtrl, /* void */ );
|
||||
wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
|
||||
|
||||
double step_mm = OFFSET_INCREMENT_MM;
|
||||
|
||||
|
||||
@@ -222,11 +222,11 @@ private:
|
||||
int m_selected; /// Index into m_parentInfoList
|
||||
|
||||
EDA_UNITS m_userUnits;
|
||||
|
||||
bool m_bodyStyleShowAll; /// true if the board body is show
|
||||
/// The 3d viewer Render initial settings (must be saved and restored)
|
||||
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender;
|
||||
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender;
|
||||
|
||||
std::unique_ptr<NL_FOOTPRINT_PROPERTIES_PLUGIN> m_spaceMouse;
|
||||
std::unique_ptr<NL_FOOTPRINT_PROPERTIES_PLUGIN> m_spaceMouse;
|
||||
};
|
||||
|
||||
#endif // PANEL_PREVIEW_3D_MODEL_H
|
||||
|
||||
@@ -158,7 +158,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Opacity") ), wxVERTICAL );
|
||||
|
||||
m_opacity = new wxSlider( sbSizer4->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
|
||||
sbSizer4->Add( m_opacity, 0, wxRIGHT|wxLEFT|wxEXPAND, 2 );
|
||||
sbSizer4->Add( m_opacity, 0, wxRIGHT|wxLEFT, 2 );
|
||||
|
||||
|
||||
bSizerLeft->Add( sbSizer4, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
@@ -1889,7 +1889,7 @@
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">2</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxSlider" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
||||
+2
-3
@@ -168,9 +168,9 @@
|
||||
Thomas Gambier
|
||||
Ashutosh Gangwar
|
||||
Alessandro Gatti
|
||||
Zenn Geeraerts
|
||||
Alex Gellen
|
||||
Robert Antoni Buj Gelonch
|
||||
Robert Antoni Buj Genlonch
|
||||
Hal Gentz
|
||||
Lucas Gerads
|
||||
Davide Gerhard
|
||||
@@ -228,7 +228,6 @@
|
||||
Mario Hros
|
||||
Hubert Hu
|
||||
Josue Huaroto
|
||||
Eli Hughes
|
||||
Huibean
|
||||
Matt Huszagh
|
||||
José Ignacio
|
||||
@@ -622,7 +621,7 @@
|
||||
欠陥電気
|
||||
木 王
|
||||
郝弘毅
|
||||
Damjan Prerad
|
||||
Eli Hughes
|
||||
|
||||
See git repo on GitLab for contributors at
|
||||
https://gitlab.com/kicad/code/kicad/-/graphs/master
|
||||
+70
-96
@@ -22,7 +22,7 @@
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#
|
||||
|
||||
cmake_minimum_required( VERSION 3.22 FATAL_ERROR )
|
||||
cmake_minimum_required( VERSION 3.21 FATAL_ERROR )
|
||||
|
||||
# Generate DEPFILES without transforming relative paths
|
||||
cmake_policy( SET CMP0116 OLD )
|
||||
@@ -62,21 +62,6 @@ set( CMAKE_MODULE_PATH "${KICAD_CMAKE_MODULE_PATH}" )
|
||||
|
||||
include( ConfigurePlatform )
|
||||
|
||||
if( WIN32 )
|
||||
# Without WIN32_LEAN_AND_MEAN defined including windows.h pulls in legacy
|
||||
# winsocks.h which conflicts with winsocks2.h used by modern libraries such
|
||||
# as curl.
|
||||
# There is no harm in defining this globally, at worst some additional
|
||||
# headers have to be included explicitly.
|
||||
add_compile_definitions( WIN32_LEAN_AND_MEAN )
|
||||
endif()
|
||||
|
||||
if( APPLE )
|
||||
# Apple, in their infinite wisdom, has decided to mark OpenGL as deprecated.
|
||||
# Luckily we can silence warnings about its deprecation.
|
||||
add_compile_definitions( GL_SILENCE_DEPRECATION=1 )
|
||||
endif()
|
||||
|
||||
# Create a flag to identify the non-Apple unix systems
|
||||
if( UNIX AND NOT APPLE )
|
||||
set( UNIX_NOT_APPLE ON )
|
||||
@@ -130,6 +115,12 @@ option( KICAD_UPDATE_CHECK
|
||||
"Build in update check"
|
||||
ON )
|
||||
|
||||
# EGL is only needed on Linux with Wayland
|
||||
cmake_dependent_option( KICAD_USE_EGL
|
||||
"Build KiCad with EGL backend support for Wayland."
|
||||
OFF "UNIX_NOT_APPLE"
|
||||
OFF)
|
||||
|
||||
cmake_dependent_option( KICAD_USE_BUNDLED_GLEW
|
||||
"Use the bundled version of GLEW - only available when KICAD_USE_EGL is set"
|
||||
ON "KICAD_USE_EGL"
|
||||
@@ -295,6 +286,16 @@ add_compile_definitions( $<$<BOOL:${KICAD_GAL_PROFILE}>:KICAD_GAL_PROFILE> )
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_WIN32_VERIFY_CODESIGN}>:KICAD_WIN32_VERIFY_CODESIGN> )
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_UPDATE_CHECK}>:KICAD_UPDATE_CHECK> )
|
||||
|
||||
if( KICAD_USE_EGL )
|
||||
message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" )
|
||||
add_compile_definitions( KICAD_USE_EGL )
|
||||
endif()
|
||||
|
||||
if( KICAD_WAYLAND )
|
||||
message( STATUS "Configuring KiCad to support Wayland features" )
|
||||
add_compile_definitions( KICAD_WAYLAND )
|
||||
endif()
|
||||
|
||||
if( KICAD_IPC_API )
|
||||
add_definitions( -DKICAD_IPC_API )
|
||||
endif()
|
||||
@@ -754,6 +755,43 @@ if( KICAD_BUILD_I18N )
|
||||
find_package( Gettext REQUIRED )
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find OpenGL library, required
|
||||
#
|
||||
if( KICAD_USE_EGL )
|
||||
find_package( OpenGL REQUIRED COMPONENTS OpenGL EGL )
|
||||
else()
|
||||
set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
|
||||
find_package( OpenGL REQUIRED )
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find GLEW library, required
|
||||
#
|
||||
# The EGL canvas on GTK requires the use of a GLEW version compiled with an EGL flag.
|
||||
# The one built in the thirdparty directory has the flag for EGL set, so we use it unless told
|
||||
# otherwise. Then we search for the system GLEW version and use that instead.
|
||||
#
|
||||
if( KICAD_USE_EGL AND KICAD_USE_BUNDLED_GLEW AND UNIX AND NOT APPLE )
|
||||
if( OpenGL_EGL_FOUND )
|
||||
message( STATUS "Found OpenGL EGL library: ${OPENGL_egl_LIBRARY}" )
|
||||
else()
|
||||
message( FATAL_ERROR "OpenGL EGL library not found" )
|
||||
endif()
|
||||
|
||||
# Add the custom GLEW target
|
||||
add_subdirectory( thirdparty/glew )
|
||||
|
||||
# Set the standard package variables to point to our custom target to mimic the system version.
|
||||
set( GLEW_LIBRARIES glew )
|
||||
set( GLEW_FOUND TRUE )
|
||||
include_directories( SYSTEM $<TARGET_PROPERTY:glew,INCLUDE_DIRECTORIES> )
|
||||
else()
|
||||
find_package( GLEW REQUIRED )
|
||||
check_find_package_result( GLEW_FOUND "GLEW" )
|
||||
include_directories( SYSTEM ${GLEW_INCLUDE_DIR} )
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find GLM library, required
|
||||
#
|
||||
@@ -786,7 +824,7 @@ find_package( Pixman 0.30 REQUIRED )
|
||||
include_directories( SYSTEM ${PIXMAN_INCLUDE_DIR} )
|
||||
|
||||
# Find libgit2, required
|
||||
find_package( libgit2 1.5 REQUIRED )
|
||||
find_package( libgit2 REQUIRED )
|
||||
|
||||
# Set include directories for libgit
|
||||
include_directories(${LIBGIT2_INCLUDE_DIRS})
|
||||
@@ -838,37 +876,24 @@ if( OCC_VERSION_STRING VERSION_LESS 7.5.0 )
|
||||
endif()
|
||||
include_directories( SYSTEM ${OCC_INCLUDE_DIR} )
|
||||
|
||||
# Try to find Protobuf with modern approach first, fallback to legacy if needed
|
||||
set( _protobuf_found FALSE )
|
||||
|
||||
if( NOT KICAD_USE_CMAKE_FINDPROTOBUF )
|
||||
message( STATUS "Attempting to find Protobuf using CONFIG mode..." )
|
||||
find_package( Protobuf QUIET CONFIG )
|
||||
if( Protobuf_FOUND )
|
||||
set( Protobuf_LIBRARY "protobuf::libprotobuf" )
|
||||
set( _protobuf_found TRUE )
|
||||
message( STATUS "Found Protobuf using CONFIG mode" )
|
||||
else()
|
||||
message( STATUS "CONFIG mode failed, falling back to FindProtobuf.cmake" )
|
||||
set( KICAD_USE_CMAKE_FINDPROTOBUF ON )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( NOT _protobuf_found )
|
||||
message( STATUS "Using FindProtobuf.cmake to locate Protobuf..." )
|
||||
if( KICAD_USE_CMAKE_FINDPROTOBUF )
|
||||
include( FindProtobuf )
|
||||
find_package( Protobuf REQUIRED )
|
||||
if( Protobuf_FOUND )
|
||||
message( STATUS "Found Protobuf using FindProtobuf.cmake" )
|
||||
endif()
|
||||
else()
|
||||
find_package( Protobuf REQUIRED CONFIG )
|
||||
set( Protobuf_LIBRARY "protobuf::libprotobuf" )
|
||||
endif()
|
||||
|
||||
if( NOT Protobuf_PROTOC_EXECUTABLE )
|
||||
if( NOT KICAD_USE_CMAKE_FINDPROTOBUF)
|
||||
set( Protobuf_PROTOC_EXECUTABLE "protobuf::protoc" )
|
||||
else()
|
||||
MESSAGE( FATAL_ERROR "Protobuf compiler not found. Please install protobuf-compiler." )
|
||||
endif()
|
||||
if( NOT KICAD_USE_CMAKE_FINDPROTOBUF)
|
||||
set( Protobuf_PROTOC_EXECUTABLE "protobuf::protoc" )
|
||||
else()
|
||||
MESSAGE( FATAL_ERROR "Protobuf compiler not found. Please install protobuf-compiler." )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( NOT Protobuf_INCLUDE_DIR )
|
||||
get_target_property( Protobuf_INCLUDE_DIR protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES )
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1035,7 +1060,7 @@ include( ${wxWidgets_USE_FILE} )
|
||||
|
||||
# Detect wxWidgets port being used
|
||||
if( wxWidgets_FIND_STYLE STREQUAL "win32" )
|
||||
string(REGEX MATCH "(msw|qt|gtk)" KICAD_WX_PORT "${WX_CONFIGURATION}")
|
||||
string(REGEX MATCH "^[msw|qt|gtk]*" KICAD_WX_PORT "${WX_CONFIGURATION}")
|
||||
|
||||
if( KICAD_WX_PORT STREQUAL "qt" )
|
||||
add_compile_definitions( __WXQT__ )
|
||||
@@ -1043,7 +1068,7 @@ if( wxWidgets_FIND_STYLE STREQUAL "win32" )
|
||||
add_compile_definitions( __WXGTK__ )
|
||||
endif()
|
||||
elseif( _wx_selected_config )
|
||||
string(REGEX MATCH "(msw|qt|gtk|osx)" KICAD_WX_PORT "${_wx_selected_config}")
|
||||
string(REGEX MATCH "^[msw|qt|gtk|osx]*" KICAD_WX_PORT "${_wx_selected_config}")
|
||||
endif()
|
||||
|
||||
if( KICAD_WX_PORT )
|
||||
@@ -1052,8 +1077,6 @@ else()
|
||||
message( FATAL_ERROR "Unable to detect wxWidgets port")
|
||||
endif()
|
||||
|
||||
message(STATUS "wxUSE_GLCANVAS_EGL=${wxWidgets_GLCANVAS_EGL}")
|
||||
|
||||
if( NOT MSVC )
|
||||
if( ${wxWidgets_VERSION_STRING} VERSION_LESS 3.2 )
|
||||
message( FATAL_ERROR "wxWidgets 3.2.0 or greater is required" )
|
||||
@@ -1070,55 +1093,6 @@ if( MINGW )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find OpenGL library, required
|
||||
#
|
||||
if( wxWidgets_GLCANVAS_EGL EQUAL 1 )
|
||||
set( KICAD_USE_EGL ON )
|
||||
find_package( OpenGL REQUIRED COMPONENTS OpenGL EGL )
|
||||
else()
|
||||
set( KICAD_USE_EGL OFF )
|
||||
set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
|
||||
find_package( OpenGL REQUIRED )
|
||||
endif()
|
||||
|
||||
if( KICAD_USE_EGL )
|
||||
message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" )
|
||||
add_compile_definitions( KICAD_USE_EGL )
|
||||
endif()
|
||||
|
||||
if( KICAD_WAYLAND )
|
||||
message( STATUS "Configuring KiCad to support Wayland features" )
|
||||
add_compile_definitions( KICAD_WAYLAND )
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find GLEW library, required
|
||||
#
|
||||
# The EGL canvas on GTK requires the use of a GLEW version compiled with an EGL flag.
|
||||
# The one built in the thirdparty directory has the flag for EGL set, so we use it unless told
|
||||
# otherwise. Then we search for the system GLEW version and use that instead.
|
||||
#
|
||||
if( KICAD_USE_EGL AND KICAD_USE_BUNDLED_GLEW )
|
||||
if( OpenGL_EGL_FOUND )
|
||||
message( STATUS "Found OpenGL EGL library: ${OPENGL_egl_LIBRARY}" )
|
||||
else()
|
||||
message( FATAL_ERROR "OpenGL EGL library not found" )
|
||||
endif()
|
||||
|
||||
# Add the custom GLEW target
|
||||
add_subdirectory( thirdparty/glew )
|
||||
|
||||
# Set the standard package variables to point to our custom target to mimic the system version.
|
||||
set( GLEW_LIBRARIES glew )
|
||||
set( GLEW_FOUND TRUE )
|
||||
include_directories( SYSTEM $<TARGET_PROPERTY:glew,INCLUDE_DIRECTORIES> )
|
||||
else()
|
||||
find_package( GLEW REQUIRED )
|
||||
check_find_package_result( GLEW_FOUND "GLEW" )
|
||||
include_directories( SYSTEM ${GLEW_INCLUDE_DIR} )
|
||||
endif()
|
||||
|
||||
if( APPLE )
|
||||
# Remove app bundles in ${KICAD_BIN} before installing anything new.
|
||||
# Must be defined before all includes so that it is executed first.
|
||||
|
||||
+47
-74
@@ -1,83 +1,56 @@
|
||||
{
|
||||
"version": 9,
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"KICAD_BUILD_QA_TESTS": "OFF",
|
||||
"KICAD_BUILD_I18N": "ON",
|
||||
"KICAD_SCRIPTING_WXPYTHON": "ON"
|
||||
}
|
||||
{
|
||||
"name": "base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
},
|
||||
{
|
||||
"name": "win64",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"KICAD_WIN32_DPI_AWARE": "ON",
|
||||
"CMAKE_INSTALL_PREFIX": "out",
|
||||
"CMAKE_PDB_OUTPUT_DIRECTORY": "out/pdb"
|
||||
},
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"inherits": [
|
||||
"base"
|
||||
]
|
||||
"cacheVariables": {
|
||||
"KICAD_BUILD_QA_TESTS": "OFF",
|
||||
"KICAD_BUILD_I18N": "ON",
|
||||
"KICAD_SCRIPTING_WXPYTHON": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "win64",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"KICAD_WIN32_DPI_AWARE": "ON",
|
||||
"CMAKE_INSTALL_PREFIX": "out",
|
||||
"CMAKE_PDB_OUTPUT_DIRECTORY": "out/pdb"
|
||||
},
|
||||
{
|
||||
"name": "x64-debug",
|
||||
"displayName": "x64 Debug",
|
||||
"description": "Sets debug build type and x64 arch",
|
||||
"inherits": "win64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
{
|
||||
"name": "x64-release",
|
||||
"displayName": "x64 Release",
|
||||
"description": "Sets release build type",
|
||||
"inherits": "win64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||
}
|
||||
"inherits": [
|
||||
"base"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-debug",
|
||||
"displayName": "x64 Debug",
|
||||
"description": "Sets debug build type and x64 arch",
|
||||
"inherits": "win64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "kicad",
|
||||
"configurePreset": "x64-debug",
|
||||
"configuration": "Debug",
|
||||
"targets": [
|
||||
"install"
|
||||
]
|
||||
}
|
||||
],
|
||||
"workflowPresets": [
|
||||
{
|
||||
"name": "kicad",
|
||||
"description": "kicad",
|
||||
"displayName": "kicad",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "x64-debug"
|
||||
},
|
||||
{
|
||||
"type": "build",
|
||||
"name": "kicad"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-release",
|
||||
"displayName": "x64 Release",
|
||||
"description": "Sets release build type",
|
||||
"inherits": "win64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+3
-2
@@ -6,6 +6,7 @@ AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllConstructorInitializersOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
@@ -23,7 +24,8 @@ BreakBeforeBraces: Allman
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 120
|
||||
ColumnLimit: 100
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: false
|
||||
@@ -37,7 +39,6 @@ KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
Language: Cpp
|
||||
MaxEmptyLinesToKeep: 2
|
||||
NamespaceIndentation: Inner
|
||||
PackConstructorInitializers: Never
|
||||
PointerAlignment: Left
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
|
||||
@@ -189,42 +189,6 @@ message PadShapeAsPolygonResponse
|
||||
repeated kiapi.common.types.PolygonWithHoles polygons = 2;
|
||||
}
|
||||
|
||||
// Tests if the given set of items with padstacks (pads or vias) has content on the given set of layers.
|
||||
// This is a dynamic call rather than a property of the padstack because pads and vias can be set to only include
|
||||
// shapes on connected copper layers, and whether or not the pad is connected can't be determined in isolation.
|
||||
// To optimize API call performance, multiple items and multiple layers to test may be passed in with this
|
||||
// command message. The return will include the results for each valid item on each valid layer.
|
||||
// Note that not all layers make sense for a given item (for example, testing against BL_UNDEFINED never makes
|
||||
// sense). In general, the internal KiCad APIs will not return an error when testing non-sensical layers for a given
|
||||
// item, and instead will return a default of "true" for any such layers.
|
||||
message CheckPadstackPresenceOnLayers
|
||||
{
|
||||
kiapi.common.types.DocumentSpecifier board = 1;
|
||||
|
||||
repeated kiapi.common.types.KIID items = 2;
|
||||
|
||||
repeated kiapi.board.types.BoardLayer layers = 3;
|
||||
}
|
||||
|
||||
enum PadstackPresence
|
||||
{
|
||||
PSP_UNKNOWN = 0;
|
||||
PSP_PRESENT = 1; // The padstack has a shape on a given layer (is flashed)
|
||||
PSP_NOT_PRESENT = 2; // The padstack has no shape on a given layer (is not flashed)
|
||||
}
|
||||
|
||||
message PadstackPresenceEntry
|
||||
{
|
||||
kiapi.common.types.KIID item = 1;
|
||||
kiapi.board.types.BoardLayer layer = 2;
|
||||
PadstackPresence presence = 3;
|
||||
}
|
||||
|
||||
message PadstackPresenceResponse
|
||||
{
|
||||
repeated PadstackPresenceEntry entries = 1;
|
||||
}
|
||||
|
||||
// PCB editor commands
|
||||
|
||||
// returns BoardLayers
|
||||
|
||||
@@ -294,31 +294,15 @@ message PadStackLayer
|
||||
|
||||
enum SolderMaskMode
|
||||
{
|
||||
SMM_UNKNOWN = 0;
|
||||
SMM_UNKOWN = 0;
|
||||
SMM_MASKED = 1;
|
||||
SMM_UNMASKED = 2;
|
||||
SMM_FROM_DESIGN_RULES = 3;
|
||||
}
|
||||
|
||||
enum ViaCoveringMode
|
||||
{
|
||||
VCM_UNKNOWN = 0;
|
||||
VCM_COVERED = 1;
|
||||
VCM_UNCOVERED = 2;
|
||||
VCM_FROM_DESIGN_RULES = 3;
|
||||
}
|
||||
|
||||
enum ViaPluggingMode
|
||||
{
|
||||
VPM_UNKNOWN = 0;
|
||||
VPM_PLUGGED = 1;
|
||||
VPM_UNPLUGGED = 2;
|
||||
VPM_FROM_DESIGN_RULES = 3;
|
||||
}
|
||||
|
||||
enum SolderPasteMode
|
||||
{
|
||||
SPM_UNKNOWN = 0;
|
||||
SPM_UNKOWN = 0;
|
||||
SPM_PASTE = 1;
|
||||
SPM_NO_PASTE = 2;
|
||||
SPM_FROM_DESIGN_RULES = 3;
|
||||
@@ -335,9 +319,6 @@ message PadStackOuterLayer
|
||||
|
||||
// NOTE: At present, KiCad does not support different solder paste expansion settings for the top and bottom layers
|
||||
SolderPasteOverrides solder_paste_settings = 4;
|
||||
|
||||
ViaPluggingMode plugging_mode = 5;
|
||||
ViaCoveringMode covering_mode = 6;
|
||||
}
|
||||
|
||||
enum DrillShape
|
||||
@@ -348,22 +329,6 @@ enum DrillShape
|
||||
DS_UNDEFINED = 3;
|
||||
}
|
||||
|
||||
enum ViaDrillCappingMode
|
||||
{
|
||||
VDCM_UNKNOWN = 0;
|
||||
VDCM_CAPPED = 1;
|
||||
VDCM_UNCAPPED = 2;
|
||||
VDCM_FROM_DESIGN_RULES = 3;
|
||||
}
|
||||
|
||||
enum ViaDrillFillingMode
|
||||
{
|
||||
VDFM_UNKNOWN = 0;
|
||||
VDFM_FILLED = 1;
|
||||
VDFM_UNFILLED = 2;
|
||||
VDFM_FROM_DESIGN_RULES = 3;
|
||||
}
|
||||
|
||||
message DrillProperties
|
||||
{
|
||||
// Lowest (closest to F_Cu) layer this drill exists on.
|
||||
@@ -377,10 +342,6 @@ message DrillProperties
|
||||
kiapi.common.types.Vector2 diameter = 3;
|
||||
|
||||
DrillShape shape = 4;
|
||||
|
||||
ViaDrillCappingMode capped = 5;
|
||||
|
||||
ViaDrillFillingMode filled = 6;
|
||||
}
|
||||
|
||||
// A pad stack definition for a multilayer pad or via.
|
||||
@@ -609,7 +570,6 @@ enum PlacementRuleSourceType
|
||||
PRST_UNKNOWN = 0;
|
||||
PRST_SHEET_NAME = 1;
|
||||
PRST_COMPONENT_CLASS = 2;
|
||||
PRST_GROUP = 3;
|
||||
}
|
||||
|
||||
message RuleAreaSettings
|
||||
@@ -648,14 +608,6 @@ message ZoneFilledPolygons
|
||||
kiapi.common.types.PolySet shapes = 2;
|
||||
}
|
||||
|
||||
message ZoneLayerProperties
|
||||
{
|
||||
BoardLayer layer = 1;
|
||||
|
||||
kiapi.common.types.Vector2 hatching_offset = 2;
|
||||
}
|
||||
|
||||
|
||||
message Zone
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
@@ -682,8 +634,6 @@ message Zone
|
||||
ZoneBorderSettings border = 11;
|
||||
|
||||
kiapi.common.types.LockedState locked = 12;
|
||||
|
||||
repeated ZoneLayerProperties layer_properties = 13;
|
||||
}
|
||||
|
||||
// An aligned dimension is drawn parallel to the line segment between the start and end points
|
||||
@@ -841,9 +791,7 @@ message ReferenceImage
|
||||
|
||||
message Group
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
string name = 2;
|
||||
repeated kiapi.common.types.KIID items = 3;
|
||||
// TODO
|
||||
}
|
||||
|
||||
message FieldId
|
||||
@@ -912,19 +860,6 @@ message Footprint3DModel
|
||||
double opacity = 6;
|
||||
}
|
||||
|
||||
message JumperGroup
|
||||
{
|
||||
repeated string pad_names = 1;
|
||||
}
|
||||
|
||||
message JumperSettings
|
||||
{
|
||||
/// If true, duplicate pad names in this footprint are jumpered together
|
||||
bool duplicate_names_are_jumpered = 1;
|
||||
|
||||
repeated JumperGroup groups = 2;
|
||||
}
|
||||
|
||||
// A footprint definition (i.e. what would be in a library)
|
||||
message Footprint
|
||||
{
|
||||
@@ -942,8 +877,6 @@ message Footprint
|
||||
|
||||
// All footprint items except for mandatory fields
|
||||
repeated google.protobuf.Any items = 11;
|
||||
|
||||
JumperSettings jumpers = 12;
|
||||
}
|
||||
|
||||
// An instance of a footprint on a board
|
||||
@@ -963,7 +896,4 @@ message FootprintInstance
|
||||
|
||||
FootprintAttributes attributes = 11;
|
||||
FootprintDesignRuleOverrides overrides = 12;
|
||||
|
||||
// The sheet path to the associated symbol for this footprint instance, if one exists
|
||||
kiapi.common.types.SheetPath symbol_path = 13;
|
||||
}
|
||||
|
||||
@@ -222,14 +222,6 @@ message GetItems
|
||||
repeated kiapi.common.types.KiCadObjectType types = 2;
|
||||
}
|
||||
|
||||
message GetItemsById
|
||||
{
|
||||
// Specifies which document to query, which fields to return, etc.
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
repeated kiapi.common.types.KIID items = 2;
|
||||
}
|
||||
|
||||
message GetItemsResponse
|
||||
{
|
||||
// Specifies which document was modified, which fields are included in items, etc.
|
||||
|
||||
@@ -84,8 +84,6 @@ enum KiCadObjectType
|
||||
KOT_WSG_TEXT = 48;
|
||||
KOT_WSG_BITMAP = 49;
|
||||
KOT_WSG_PAGE = 50;
|
||||
|
||||
KOT_SCH_GROUP = 51;
|
||||
}
|
||||
|
||||
// Mapped to GR_TEXT_H_ALIGN_T
|
||||
|
||||
@@ -30,15 +30,11 @@
|
||||
#include <common.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <potracelib.h>
|
||||
#include <vector>
|
||||
#include <wx/arrstr.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/dnd.h>
|
||||
#include <wx/rawbmp.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/string.h>
|
||||
|
||||
#define DEFAULT_DPI 300 // the image DPI used in formats that do not define a DPI
|
||||
|
||||
@@ -62,12 +58,9 @@ BITMAP2CMP_PANEL::BITMAP2CMP_PANEL( BITMAP2CMP_FRAME* aParent ) :
|
||||
|
||||
m_buttonExportFile->Enable( false );
|
||||
m_buttonExportClipboard->Enable( false );
|
||||
|
||||
m_InitialPicturePanel->SetDropTarget( new DROP_FILE( this ) );
|
||||
m_GreyscalePicturePanel->SetDropTarget( new DROP_FILE( this ) );
|
||||
m_BNPicturePanel->SetDropTarget( new DROP_FILE( this ) );
|
||||
}
|
||||
|
||||
|
||||
wxWindow* BITMAP2CMP_PANEL::GetCurrentPage()
|
||||
{
|
||||
return m_Notebook->GetCurrentPage();
|
||||
@@ -569,33 +562,3 @@ void BITMAP2CMP_PANEL::OnFormatChange( wxCommandEvent& event )
|
||||
m_layerLabel->Enable( m_rbFootprint->GetValue() );
|
||||
m_layerCtrl->Enable( m_rbFootprint->GetValue() );
|
||||
}
|
||||
|
||||
|
||||
DROP_FILE::DROP_FILE( BITMAP2CMP_PANEL* panel ) :
|
||||
m_panel( panel )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool DROP_FILE::OnDropFiles( wxCoord x, wxCoord y, const wxArrayString& filenames )
|
||||
{
|
||||
m_panel->SetFocus();
|
||||
|
||||
// If a file is already loaded
|
||||
if( m_panel->GetOutputSizeX().GetOriginalSizePixels() != 0 )
|
||||
{
|
||||
wxString cap = _( "Replace Loaded File?" );
|
||||
wxString msg = _( "There is already a file loaded. Do you want to replace it?" );
|
||||
wxMessageDialog acceptFileDlg( m_panel, msg, cap, wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
|
||||
int replace = acceptFileDlg.ShowModal();
|
||||
|
||||
if( replace == wxID_NO )
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<wxString> fNameVec;
|
||||
fNameVec.insert( fNameVec.begin(), filenames.begin(), filenames.end() );
|
||||
m_panel->OpenProjectFiles( fNameVec );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <bitmap2cmp_panel_base.h>
|
||||
#include <eda_units.h>
|
||||
#include <wx/dnd.h>
|
||||
|
||||
|
||||
class BITMAP2CMP_FRAME;
|
||||
class BITMAP2CMP_SETTINGS;
|
||||
@@ -134,18 +134,4 @@ private:
|
||||
bool m_negative;
|
||||
double m_aspectRatio;
|
||||
};
|
||||
|
||||
|
||||
class DROP_FILE : public wxFileDropTarget
|
||||
{
|
||||
public:
|
||||
DROP_FILE( BITMAP2CMP_PANEL* panel );
|
||||
DROP_FILE() = delete;
|
||||
|
||||
bool OnDropFiles( wxCoord x, wxCoord y, const wxArrayString& filenames ) override;
|
||||
|
||||
private:
|
||||
BITMAP2CMP_PANEL* m_panel;
|
||||
};
|
||||
|
||||
#endif// BITMAP2CMP_PANEL
|
||||
|
||||
+2
-1
@@ -48,7 +48,9 @@ set( OCC_LIBS_COMMON
|
||||
TKLCAF
|
||||
TKMath
|
||||
TKMesh
|
||||
TKMeshVS
|
||||
TKOffset
|
||||
TKOpenGl
|
||||
TKPrim
|
||||
TKRWMesh
|
||||
TKService
|
||||
@@ -136,7 +138,6 @@ else(WIN32)
|
||||
HINTS
|
||||
${OCC_LIBRARY_DIR}
|
||||
/usr
|
||||
/usr/opencascade
|
||||
/usr/local
|
||||
/usr/local/opencascade
|
||||
/opt/opencascade
|
||||
|
||||
@@ -37,7 +37,7 @@ unset(_Python_NAMES)
|
||||
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.14 3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
set(_PYTHON3_VERSIONS 3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
|
||||
# Disabling the "search every possible place" code for now
|
||||
# see https://gitlab.com/kicad/code/kicad/-/issues/8553
|
||||
|
||||
@@ -44,7 +44,7 @@ cmake_find_frameworks(Python)
|
||||
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.14 3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
set(_PYTHON3_VERSIONS 3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
|
||||
if(PythonLibs_FIND_VERSION)
|
||||
if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
||||
|
||||
@@ -520,15 +520,6 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
|
||||
set(WX_LIB_DIR_PREFIX vc)
|
||||
endif()
|
||||
|
||||
set( EXTRA_LIB_PATH "" )
|
||||
if(VCPKG_TOOLCHAIN)
|
||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
|
||||
set( EXTRA_LIB_PATH "${WX_ROOT_DIR}/debug/lib" )
|
||||
else()
|
||||
set( EXTRA_LIB_PATH "${WX_ROOT_DIR}/lib" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
find_path(wxWidgets_LIB_DIR
|
||||
NAMES
|
||||
@@ -545,7 +536,6 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
|
||||
PATHS
|
||||
${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll # prefer shared
|
||||
${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib
|
||||
${EXTRA_LIB_PATH}
|
||||
DOC "Path to wxWidgets libraries"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
@@ -565,7 +555,6 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
|
||||
PATHS
|
||||
${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib # prefer static
|
||||
${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll
|
||||
${EXTRA_LIB_PATH}
|
||||
DOC "Path to wxWidgets libraries"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
@@ -625,10 +614,6 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
|
||||
set(WX_USE_REL_AND_DBG FALSE)
|
||||
endif()
|
||||
|
||||
if( VCPKG_TOOLCHAIN )
|
||||
set(WX_USE_REL_AND_DBG FALSE)
|
||||
endif()
|
||||
|
||||
# Get configuration parameters from the name.
|
||||
WX_GET_NAME_COMPONENTS(${wxWidgets_CONFIGURATION} PF UNV UCD DBG)
|
||||
|
||||
@@ -799,14 +784,6 @@ else()
|
||||
|
||||
DBG_MSG_V("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
|
||||
|
||||
execute_process(
|
||||
COMMAND sh -c "echo '#include <wx/platform.h>' ; echo CMAKE_WXTEST_RESULT wxUSE_GLCANVAS_EGL"
|
||||
COMMAND ${CMAKE_CXX_COMPILER} ${wxWidgets_CXX_FLAGS} -E -
|
||||
COMMAND grep CMAKE_WXTEST_RESULT
|
||||
COMMAND cut "-d " -f2
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE wxWidgets_GLCANVAS_EGL )
|
||||
|
||||
# parse definitions from cxxflags;
|
||||
# drop -D* from CXXFLAGS and the -D prefix
|
||||
string(REGEX MATCHALL "-D[^;]+"
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
# KiCad.
|
||||
#
|
||||
# Note: This version string should follow the semantic versioning system
|
||||
set( KICAD_SEMANTIC_VERSION "9.99.0-unknown" )
|
||||
set( KICAD_SEMANTIC_VERSION "9.0.1-rc2" )
|
||||
|
||||
# Default the version to the semantic version.
|
||||
# This is overridden by the git repository tag though (if using git)
|
||||
|
||||
@@ -259,8 +259,6 @@ if( MSVC )
|
||||
string( APPEND WARN_FLAGS_CXX " /wd5204 /wd4265" )
|
||||
# disable "layout of class may have changed from a previous version of the compiler"
|
||||
string( APPEND WARN_FLAGS_CXX " /wd4371" )
|
||||
# disable "'this': used in base member initializer list"
|
||||
string( APPEND WARN_FLAGS_CXX " /wd4355" )
|
||||
# disable "relative include path contains '..'"
|
||||
string( APPEND WARN_FLAGS_CXX " /wd4464" )
|
||||
# disable "'const' variable is not used"
|
||||
|
||||
+4
-47
@@ -71,14 +71,12 @@ set( KICOMMON_SRCS
|
||||
jobs/job_export_pcb_dxf.cpp
|
||||
jobs/job_export_pcb_gerber.cpp
|
||||
jobs/job_export_pcb_gerbers.cpp
|
||||
jobs/job_export_pcb_hpgl.cpp
|
||||
jobs/job_export_pcb_ipc2581.cpp
|
||||
jobs/job_export_pcb_ipcd356.cpp
|
||||
jobs/job_export_pcb_odb.cpp
|
||||
jobs/job_export_pcb_pdf.cpp
|
||||
jobs/job_export_pcb_plot.cpp
|
||||
jobs/job_export_pcb_pos.cpp
|
||||
jobs/job_export_pcb_ps.cpp
|
||||
jobs/job_export_pcb_svg.cpp
|
||||
jobs/job_export_pcb_gencad.cpp
|
||||
jobs/job_export_pcb_3d.cpp
|
||||
@@ -115,15 +113,10 @@ set( KICOMMON_SRCS
|
||||
settings/settings_manager.cpp
|
||||
|
||||
project/board_project_settings.cpp
|
||||
project/component_class_settings.cpp
|
||||
project/net_settings.cpp
|
||||
project/project_archiver.cpp
|
||||
project/project_file.cpp
|
||||
project/project_local_settings.cpp
|
||||
project/time_domain_parameters.cpp
|
||||
|
||||
# This is basically a settings object, but for the toolbar
|
||||
tool/ui/toolbar_configuration.cpp
|
||||
|
||||
dialogs/dialog_migrate_settings.cpp
|
||||
dialogs/dialog_migrate_settings_base.cpp
|
||||
@@ -148,7 +141,6 @@ set( KICOMMON_SRCS
|
||||
design_block_info_impl.cpp
|
||||
|
||||
advanced_config.cpp
|
||||
app_monitor.cpp
|
||||
asset_archive.cpp
|
||||
array_axis.cpp
|
||||
array_options.cpp
|
||||
@@ -245,7 +237,6 @@ target_link_libraries( kicommon
|
||||
fmt::fmt
|
||||
CURL::libcurl
|
||||
picosha2
|
||||
rapidcsv
|
||||
${ZSTD_LIBRARY}
|
||||
${wxWidgets_LIBRARIES}
|
||||
${LIBGIT2_LIBRARIES}
|
||||
@@ -267,7 +258,7 @@ if( KICAD_USE_SENTRY )
|
||||
target_link_libraries( kicommon
|
||||
sentry )
|
||||
|
||||
set_property(SOURCE app_monitor.cpp APPEND PROPERTY COMPILE_DEFINITIONS KICAD_SENTRY_DSN="${KICAD_SENTRY_DSN}")
|
||||
set_property(SOURCE pgm_base.cpp APPEND PROPERTY COMPILE_DEFINITIONS KICAD_SENTRY_DSN="${KICAD_SENTRY_DSN}")
|
||||
endif()
|
||||
|
||||
if( KICAD_IPC_API )
|
||||
@@ -358,8 +349,6 @@ set( COMMON_DLG_SRCS
|
||||
dialogs/dialog_color_picker_base.cpp
|
||||
dialogs/dialog_configure_paths.cpp
|
||||
dialogs/dialog_configure_paths_base.cpp
|
||||
dialogs/dialog_design_block_properties.cpp
|
||||
dialogs/dialog_design_block_properties_base.cpp
|
||||
dialogs/dialog_display_html_text_base.cpp
|
||||
dialogs/dialog_edit_library_tables.cpp
|
||||
dialogs/dialog_embed_files.cpp
|
||||
@@ -368,8 +357,6 @@ set( COMMON_DLG_SRCS
|
||||
dialogs/dialog_global_design_block_lib_table_config.cpp
|
||||
dialogs/dialog_grid_settings.cpp
|
||||
dialogs/dialog_grid_settings_base.cpp
|
||||
dialogs/dialog_group_properties.cpp
|
||||
dialogs/dialog_group_properties_base.cpp
|
||||
dialogs/dialog_hotkey_list.cpp
|
||||
dialogs/dialog_HTML_reporter_base.cpp
|
||||
dialogs/dialog_import_choose_project.cpp
|
||||
@@ -418,15 +405,10 @@ set( COMMON_DLG_SRCS
|
||||
dialogs/panel_plugin_settings.cpp
|
||||
dialogs/panel_plugin_settings_base.cpp
|
||||
dialogs/panel_setup_netclasses.cpp
|
||||
dialogs/panel_printer_list.cpp
|
||||
dialogs/panel_printer_list_base.cpp
|
||||
|
||||
dialogs/panel_setup_netclasses_base.cpp
|
||||
dialogs/panel_setup_severities.cpp
|
||||
dialogs/panel_text_variables.cpp
|
||||
dialogs/panel_text_variables_base.cpp
|
||||
dialogs/panel_toolbar_customization.cpp
|
||||
dialogs/panel_toolbar_customization_base.cpp
|
||||
)
|
||||
|
||||
if( KICAD_USE_SENTRY )
|
||||
@@ -437,11 +419,9 @@ endif()
|
||||
|
||||
set( COMMON_WIDGET_SRCS
|
||||
widgets/app_progress_dialog.cpp
|
||||
widgets/wx_bitmap_combobox.cpp
|
||||
widgets/bitmap_toggle.cpp
|
||||
widgets/button_row_panel.cpp
|
||||
widgets/color_swatch.cpp
|
||||
widgets/design_block_pane.cpp
|
||||
widgets/filter_combobox.cpp
|
||||
widgets/font_choice.cpp
|
||||
widgets/footprint_choice.cpp
|
||||
@@ -452,7 +432,6 @@ set( COMMON_WIDGET_SRCS
|
||||
widgets/gal_options_panel_base.cpp
|
||||
widgets/grid_bitmap_toggle.cpp
|
||||
widgets/grid_button.cpp
|
||||
widgets/grid_checkbox.cpp
|
||||
widgets/grid_color_swatch_helpers.cpp
|
||||
widgets/grid_combobox.cpp
|
||||
widgets/grid_icon_text_helpers.cpp
|
||||
@@ -467,7 +446,6 @@ set( COMMON_WIDGET_SRCS
|
||||
widgets/mathplot.cpp
|
||||
widgets/msgpanel.cpp
|
||||
widgets/paged_dialog.cpp
|
||||
widgets/panel_design_block_chooser.cpp
|
||||
widgets/properties_panel.cpp
|
||||
widgets/search_pane.cpp
|
||||
widgets/search_pane_base.cpp
|
||||
@@ -530,6 +508,7 @@ set( PLOTTERS_CONTROL_SRCS
|
||||
plotters/plotter.cpp
|
||||
plotters/DXF_plotter.cpp
|
||||
plotters/GERBER_plotter.cpp
|
||||
plotters/HPGL_plotter.cpp
|
||||
plotters/PDF_plotter.cpp
|
||||
plotters/PS_plotter.cpp
|
||||
plotters/SVG_plotter.cpp
|
||||
@@ -558,16 +537,6 @@ set( COMMON_IO_SRCS
|
||||
# EasyEDA pro
|
||||
io/easyedapro/easyedapro_parser.cpp
|
||||
io/easyedapro/easyedapro_import_utils.cpp
|
||||
|
||||
io/csv.cpp
|
||||
)
|
||||
|
||||
set ( COMMON_TRANSLINE_CALCULATION_SRCS
|
||||
transline_calculations/transline_calculation_base.cpp
|
||||
transline_calculations/microstrip.cpp
|
||||
transline_calculations/coupled_microstrip.cpp
|
||||
transline_calculations/stripline.cpp
|
||||
transline_calculations/coupled_stripline.cpp
|
||||
)
|
||||
|
||||
set( COMMON_IMPORT_GFX_SRCS
|
||||
@@ -604,7 +573,6 @@ set( COMMON_SRCS
|
||||
${FONT_SRCS}
|
||||
${COMMON_IMPORT_GFX_SRCS}
|
||||
${COMMON_GIT_SRCS}
|
||||
${COMMON_TRANSLINE_CALCULATION_SRCS}
|
||||
base_screen.cpp
|
||||
bin_mod.cpp
|
||||
bitmap_base.cpp
|
||||
@@ -618,7 +586,6 @@ set( COMMON_SRCS
|
||||
eda_dde.cpp
|
||||
eda_doc.cpp
|
||||
eda_draw_frame.cpp
|
||||
eda_group.cpp
|
||||
eda_item.cpp
|
||||
eda_shape.cpp
|
||||
eda_text.cpp
|
||||
@@ -640,7 +607,6 @@ set( COMMON_SRCS
|
||||
lib_table_grid_tricks.cpp
|
||||
lib_tree_model.cpp
|
||||
lib_tree_model_adapter.cpp
|
||||
design_block_tree_model_adapter.cpp
|
||||
marker_base.cpp
|
||||
origin_transforms.cpp
|
||||
printout.cpp
|
||||
@@ -674,14 +640,12 @@ set( COMMON_SRCS
|
||||
tool/construction_manager.cpp
|
||||
tool/common_tools.cpp
|
||||
tool/conditional_menu.cpp
|
||||
tool/design_block_control.cpp
|
||||
tool/edit_constraints.cpp
|
||||
tool/edit_points.cpp
|
||||
tool/editor_conditions.cpp
|
||||
tool/embed_tool.cpp
|
||||
tool/grid_helper.cpp
|
||||
tool/grid_menu.cpp
|
||||
tool/group_tool.cpp
|
||||
tool/library_editor_control.cpp
|
||||
tool/picker_tool.cpp
|
||||
tool/point_editor_behavior.cpp
|
||||
@@ -803,10 +767,7 @@ set( PCB_COMMON_SRCS
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/teardrop/teardrop_parameters.cpp #needed by board_design_settings.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/router/pns_meander.cpp #needed by board_design_settings.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/board.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/component_classes/component_class.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/component_classes/component_class_assignment_rule.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/component_classes/component_class_cache_proxy.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/component_classes/component_class_manager.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/component_class_manager.cpp #needed by board.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/board_item.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_dimension.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_shape.cpp
|
||||
@@ -850,6 +811,7 @@ set( PCB_COMMON_SRCS
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/kicad_netlist_reader.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/legacy_netlist_reader.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/netlist_reader.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pad_custom_shape_functions.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_draw_panel_gal.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/pcb_netlist.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_origin_transforms.cpp
|
||||
@@ -865,7 +827,6 @@ set( PCB_COMMON_SRCS
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/teardrop/teardrop_parameters.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/teardrop/teardrop_utils.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/zone_settings.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_board_outline.cpp
|
||||
|
||||
# IO files
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_io/pcb_io.cpp
|
||||
@@ -881,10 +842,6 @@ set( PCB_COMMON_SRCS
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_editor_conditions.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_viewer_tools.cpp
|
||||
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/length_delay_calculation/length_delay_calculation.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/length_delay_calculation/length_delay_calculation_item.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/length_delay_calculation/time_domain_parameters_user_defined.cpp
|
||||
|
||||
widgets/net_selector.cpp
|
||||
)
|
||||
|
||||
|
||||
+20
-21
@@ -98,10 +98,12 @@ static const wxChar AllowManualCanvasScale[] = wxT( "AllowManualCanvasScale" );
|
||||
static const wxChar UpdateUIEventInterval[] = wxT( "UpdateUIEventInterval" );
|
||||
static const wxChar V3DRT_BevelHeight_um[] = wxT( "V3DRT_BevelHeight_um" );
|
||||
static const wxChar V3DRT_BevelExtentFactor[] = wxT( "V3DRT_BevelExtentFactor" );
|
||||
static const wxChar EnablePcbDesignBlocks[] = wxT( "EnablePcbDesignBlocks" );
|
||||
static const wxChar EnableDesignBlocks[] = wxT( "EnableDesignBlocks" );
|
||||
static const wxChar EnableGenerators[] = wxT( "EnableGenerators" );
|
||||
static const wxChar EnableLibWithText[] = wxT( "EnableLibWithText" );
|
||||
static const wxChar EnableLibDir[] = wxT( "EnableLibDir" );
|
||||
static const wxChar EnableEeschemaPrintCairo[] = wxT( "EnableEeschemaPrintCairo" );
|
||||
static const wxChar EnableEeschemaExportClipboardCairo[] = wxT( "EnableEeschemaExportClipboardCairo" );
|
||||
static const wxChar DisambiguationTime[] = wxT( "DisambiguationTime" );
|
||||
static const wxChar PcbSelectionVisibilityRatio[] = wxT( "PcbSelectionVisibilityRatio" );
|
||||
static const wxChar FontErrorSize[] = wxT( "FontErrorSize" );
|
||||
@@ -126,8 +128,6 @@ static const wxChar NetInspectorBulkUpdateOptimisationThreshold[] =
|
||||
wxT( "NetInspectorBulkUpdateOptimisationThreshold" );
|
||||
static const wxChar ExcludeFromSimulationLineWidth[] = wxT( "ExcludeFromSimulationLineWidth" );
|
||||
static const wxChar GitIconRefreshInterval[] = wxT( "GitIconRefreshInterval" );
|
||||
static const wxChar ConfigurableToolbars[] = wxT( "ConfigurableToolbars" );
|
||||
static const wxChar MaxPastedTextLength[] = wxT( "MaxPastedTextLength" );
|
||||
|
||||
} // namespace KEYS
|
||||
|
||||
@@ -256,11 +256,14 @@ ADVANCED_CFG::ADVANCED_CFG()
|
||||
m_CompactSave = false;
|
||||
m_UpdateUIEventInterval = 0;
|
||||
m_ShowRepairSchematic = false;
|
||||
m_EnablePcbDesignBlocks = false;
|
||||
m_EnableDesignBlocks = true;
|
||||
m_EnableGenerators = false;
|
||||
m_EnableLibWithText = false;
|
||||
m_EnableLibDir = false;
|
||||
|
||||
m_EnableEeschemaPrintCairo = true;
|
||||
m_EnableEeschemaExportClipboardCairo = true;
|
||||
|
||||
m_3DRT_BevelHeight_um = 30;
|
||||
m_3DRT_BevelExtentFactor = 1.0 / 16.0;
|
||||
|
||||
@@ -302,16 +305,12 @@ ADVANCED_CFG::ADVANCED_CFG()
|
||||
|
||||
m_MinimumMarkerSeparationDistance = 0.15;
|
||||
|
||||
m_NetInspectorBulkUpdateOptimisationThreshold = 100;
|
||||
m_NetInspectorBulkUpdateOptimisationThreshold = 25;
|
||||
|
||||
m_ExcludeFromSimulationLineWidth = 25;
|
||||
|
||||
m_GitIconRefreshInterval = 10000;
|
||||
|
||||
m_ConfigurableToolbars = false;
|
||||
|
||||
m_MaxPastedTextLength = 100;
|
||||
|
||||
loadFromConfigFile();
|
||||
}
|
||||
|
||||
@@ -492,8 +491,8 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
m_DisambiguationMenuDelay,
|
||||
50, 10000 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnablePcbDesignBlocks, &m_EnablePcbDesignBlocks,
|
||||
m_EnablePcbDesignBlocks ) );
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableDesignBlocks,
|
||||
&m_EnableDesignBlocks, m_EnableDesignBlocks ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableGenerators,
|
||||
&m_EnableGenerators, m_EnableGenerators ) );
|
||||
@@ -507,6 +506,14 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableLibDir,
|
||||
&m_EnableLibDir, m_EnableLibDir ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableEeschemaPrintCairo,
|
||||
&m_EnableEeschemaPrintCairo,
|
||||
m_EnableEeschemaPrintCairo ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableEeschemaExportClipboardCairo,
|
||||
&m_EnableEeschemaExportClipboardCairo,
|
||||
m_EnableEeschemaExportClipboardCairo ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::PcbSelectionVisibilityRatio,
|
||||
&m_PcbSelectionVisibilityRatio,
|
||||
m_PcbSelectionVisibilityRatio, 0.0, 1.0 ) );
|
||||
@@ -525,11 +532,11 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::TriangulateSimplificationLevel,
|
||||
&m_TriangulateSimplificationLevel,
|
||||
m_TriangulateSimplificationLevel, 5, 1000 ) );
|
||||
m_TriangulateSimplificationLevel, 0, 1000 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::TriangulateMinimumArea,
|
||||
&m_TriangulateMinimumArea,
|
||||
m_TriangulateMinimumArea, 25, 100000 ) );
|
||||
m_TriangulateMinimumArea, 0, 100000 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableCacheFriendlyFracture,
|
||||
&m_EnableCacheFriendlyFracture,
|
||||
@@ -594,14 +601,6 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
&m_GitIconRefreshInterval,
|
||||
m_GitIconRefreshInterval, 0, 100000 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ConfigurableToolbars,
|
||||
&m_ConfigurableToolbars,
|
||||
m_ConfigurableToolbars ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::MaxPastedTextLength,
|
||||
&m_MaxPastedTextLength,
|
||||
m_MaxPastedTextLength, 0, 100000 ) );
|
||||
|
||||
// Special case for trace mask setting...we just grab them and set them immediately
|
||||
// Because we even use wxLogTrace inside of advanced config
|
||||
wxString traceMasks;
|
||||
|
||||
@@ -53,7 +53,6 @@ KICAD_T FromProtoEnum( types::KiCadObjectType aValue )
|
||||
case types::KiCadObjectType::KOT_PCB_DIMENSION: return PCB_DIMENSION_T;
|
||||
case types::KiCadObjectType::KOT_PCB_ZONE: return PCB_ZONE_T;
|
||||
case types::KiCadObjectType::KOT_PCB_GROUP: return PCB_GROUP_T;
|
||||
case types::KiCadObjectType::KOT_SCH_GROUP: return SCH_GROUP_T;
|
||||
case types::KiCadObjectType::KOT_SCH_MARKER: return SCH_MARKER_T;
|
||||
case types::KiCadObjectType::KOT_SCH_JUNCTION: return SCH_JUNCTION_T;
|
||||
case types::KiCadObjectType::KOT_SCH_NO_CONNECT: return SCH_NO_CONNECT_T;
|
||||
@@ -127,7 +126,6 @@ types::KiCadObjectType ToProtoEnum( KICAD_T aValue )
|
||||
case SCH_TABLECELL_T: return types::KiCadObjectType::KOT_SCH_TABLECELL;
|
||||
case SCH_LABEL_T: return types::KiCadObjectType::KOT_SCH_LABEL;
|
||||
case SCH_GLOBAL_LABEL_T: return types::KiCadObjectType::KOT_SCH_GLOBAL_LABEL;
|
||||
case SCH_GROUP_T: return types::KiCadObjectType::KOT_SCH_GROUP;
|
||||
case SCH_HIER_LABEL_T: return types::KiCadObjectType::KOT_SCH_HIER_LABEL;
|
||||
case SCH_DIRECTIVE_LABEL_T: return types::KiCadObjectType::KOT_SCH_DIRECTIVE_LABEL;
|
||||
case SCH_FIELD_T: return types::KiCadObjectType::KOT_SCH_FIELD;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <json_common.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <wx/log.h>
|
||||
#include <wx/regex.h>
|
||||
#include <wx/stdstream.h>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <magic_enum.hpp>
|
||||
#include <api/api_utils.h>
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <kiid.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
const wxChar* const traceApi = wxT( "KICAD_API" );
|
||||
@@ -233,12 +232,4 @@ KICOMMON_API KIGFX::COLOR4D UnpackColor( const types::Color& aInput )
|
||||
return KIGFX::COLOR4D( r, g, b, a );
|
||||
}
|
||||
|
||||
KICOMMON_API void PackSheetPath( types::SheetPath& aOutput, const KIID_PATH& aInput )
|
||||
{
|
||||
aOutput.clear_path();
|
||||
|
||||
for( const KIID& entry : aInput )
|
||||
aOutput.add_path()->set_value( entry.AsStdString() );
|
||||
}
|
||||
|
||||
} // namespace kiapi::common
|
||||
|
||||
@@ -1,480 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <app_monitor.h>
|
||||
#include <pgm_base.h>
|
||||
#include <magic_enum.hpp>
|
||||
#include <kiplatform/policy.h>
|
||||
#include <policy_keys.h>
|
||||
#include <paths.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/ffile.h>
|
||||
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
#include <boost/uuid/uuid_generators.hpp>
|
||||
#include <build_version.h>
|
||||
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
#include <sentry.h>
|
||||
#endif
|
||||
|
||||
using namespace APP_MONITOR;
|
||||
|
||||
SENTRY::SENTRY() :
|
||||
m_isOptedIn( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void SENTRY::Init()
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
sentryInit();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SENTRY::Cleanup()
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
sentry_close();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SENTRY::AddTag( const wxString& aKey, const wxString& aValue )
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
sentry_set_tag( aKey.c_str(), aValue.c_str() );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SENTRY::SetSentryOptIn( bool aOptIn )
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
if( aOptIn )
|
||||
{
|
||||
// Opting in (when not opted in before) may require reading the uid off disk
|
||||
// as it was skipped previously.
|
||||
readOrCreateUid();
|
||||
|
||||
if( !m_sentry_optin_fn.Exists() )
|
||||
{
|
||||
wxFFile sentryInitFile( m_sentry_optin_fn.GetFullPath(), "w" );
|
||||
sentryInitFile.Write( "" );
|
||||
sentryInitFile.Close();
|
||||
}
|
||||
|
||||
m_isOptedIn = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_sentry_optin_fn.Exists() )
|
||||
{
|
||||
wxRemoveFile( m_sentry_optin_fn.GetFullPath() );
|
||||
sentry_close();
|
||||
}
|
||||
|
||||
m_isOptedIn = false;
|
||||
}
|
||||
#else
|
||||
m_isOptedIn = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
wxString SENTRY::sentryCreateUid()
|
||||
{
|
||||
boost::uuids::uuid uuid = boost::uuids::random_generator()();
|
||||
wxString userGuid = boost::uuids::to_string( uuid );
|
||||
|
||||
wxFFile sentryInitFile( m_sentry_uid_fn.GetFullPath(), "w" );
|
||||
sentryInitFile.Write( userGuid );
|
||||
sentryInitFile.Close();
|
||||
|
||||
return userGuid;
|
||||
}
|
||||
|
||||
|
||||
void SENTRY::ResetSentryId()
|
||||
{
|
||||
m_sentryUid = sentryCreateUid();
|
||||
}
|
||||
|
||||
|
||||
const wxString& SENTRY::GetSentryId()
|
||||
{
|
||||
return m_sentryUid;
|
||||
}
|
||||
|
||||
|
||||
void SENTRY::readOrCreateUid()
|
||||
{
|
||||
wxFFile sentryInitFile( m_sentry_uid_fn.GetFullPath() );
|
||||
sentryInitFile.ReadAll( &m_sentryUid );
|
||||
sentryInitFile.Close();
|
||||
|
||||
if( m_sentryUid.IsEmpty() || m_sentryUid.length() != 36 )
|
||||
{
|
||||
ResetSentryId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SENTRY::sentryInit()
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
m_sentry_optin_fn = wxFileName( PATHS::GetUserCachePath(), "sentry-opt-in" );
|
||||
m_sentry_uid_fn = wxFileName( PATHS::GetUserCachePath(), "sentry-uid" );
|
||||
|
||||
if( isConfiguredOptedIn() )
|
||||
{
|
||||
m_isOptedIn = true;
|
||||
|
||||
readOrCreateUid();
|
||||
|
||||
sentry_options_t* options = sentry_options_new();
|
||||
|
||||
#ifndef KICAD_SENTRY_DSN
|
||||
#error "Project configuration error, missing KICAD_SENTRY_DSN"
|
||||
#endif
|
||||
// only capture 5% of transactions
|
||||
sentry_options_set_traces_sample_rate( options, 0.05 );
|
||||
sentry_options_set_dsn( options, KICAD_SENTRY_DSN );
|
||||
|
||||
wxFileName tmp;
|
||||
tmp.AssignDir( PATHS::GetUserCachePath() );
|
||||
tmp.AppendDir( "sentry" );
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
sentry_options_set_database_pathw( options, tmp.GetPathWithSep().wc_str() );
|
||||
#else
|
||||
sentry_options_set_database_path( options, tmp.GetPathWithSep().c_str() );
|
||||
#endif
|
||||
sentry_options_set_symbolize_stacktraces( options, true );
|
||||
sentry_options_set_auto_session_tracking( options, false );
|
||||
|
||||
sentry_options_set_release( options, GetCommitHash().ToStdString().c_str() );
|
||||
|
||||
// This just gives us more filtering within sentry, issues still get grouped across
|
||||
// environments.
|
||||
sentry_options_set_environment( options, GetMajorMinorVersion().c_str() );
|
||||
|
||||
sentry_init( options );
|
||||
|
||||
sentry_value_t user = sentry_value_new_object();
|
||||
sentry_value_set_by_key( user, "id", sentry_value_new_string( m_sentryUid.c_str() ) );
|
||||
sentry_set_user( user );
|
||||
|
||||
sentry_set_tag( "kicad.version", GetBuildVersion().ToStdString().c_str() );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool SENTRY::isConfiguredOptedIn()
|
||||
{
|
||||
// policy takes precedence
|
||||
KIPLATFORM::POLICY::PBOOL policyState = KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_DATACOLLECTION );
|
||||
if( policyState != KIPLATFORM::POLICY::PBOOL::NOT_CONFIGURED )
|
||||
{
|
||||
return policyState == KIPLATFORM::POLICY::PBOOL::ENABLED;
|
||||
}
|
||||
|
||||
return m_sentry_optin_fn.Exists();
|
||||
}
|
||||
|
||||
|
||||
bool SENTRY::IsOptedIn()
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
// always override with policy, just in case
|
||||
KIPLATFORM::POLICY::PBOOL policyState = KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_DATACOLLECTION );
|
||||
if( policyState != KIPLATFORM::POLICY::PBOOL::NOT_CONFIGURED )
|
||||
{
|
||||
return policyState == KIPLATFORM::POLICY::PBOOL::ENABLED;
|
||||
}
|
||||
|
||||
return m_isOptedIn;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SENTRY::LogAssert( const ASSERT_CACHE_KEY& aKey, const wxString& aAssertMsg )
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
if( !APP_MONITOR::SENTRY::Instance()->IsOptedIn() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// We use an assert cache to avoid collecting too many events
|
||||
// Because they can come from functions that are called hundreds of times in loops
|
||||
if( m_assertCache.find( aKey ) == m_assertCache.end() )
|
||||
{
|
||||
sentry_value_t exc = sentry_value_new_exception( "assert", aAssertMsg.c_str() );
|
||||
sentry_value_set_stacktrace( exc, NULL, 0 );
|
||||
|
||||
sentry_value_t sentryEvent = sentry_value_new_event();
|
||||
sentry_event_add_exception( sentryEvent, exc );
|
||||
sentry_capture_event( sentryEvent );
|
||||
m_assertCache.insert( aKey );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SENTRY::LogException( const wxString& aMsg )
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
if( !APP_MONITOR::SENTRY::Instance()->IsOptedIn() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sentry_value_t exc = sentry_value_new_exception( "exception", aMsg.c_str() );
|
||||
sentry_value_set_stacktrace( exc, NULL, 0 );
|
||||
|
||||
sentry_value_t sentryEvent = sentry_value_new_event();
|
||||
sentry_event_add_exception( sentryEvent, exc );
|
||||
sentry_capture_event( sentryEvent );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
static std::string GetSentryBreadCrumbType( BREADCRUMB_TYPE aType )
|
||||
{
|
||||
// the only special case due to collisions with defines
|
||||
if( aType == BREADCRUMB_TYPE::DBG )
|
||||
return "debug";
|
||||
|
||||
if( aType == BREADCRUMB_TYPE::ERR )
|
||||
return "error";
|
||||
|
||||
std::string ret( magic_enum::enum_name( aType ) );
|
||||
|
||||
std::transform( ret.begin(), ret.end(), ret.begin(),
|
||||
[]( unsigned char c )
|
||||
{
|
||||
return std::tolower( c );
|
||||
} );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static std::string GetSentryBreadCrumbLevel( BREADCRUMB_LEVEL aLevel )
|
||||
{
|
||||
// the only special case due to collisions with defines
|
||||
if( aLevel == BREADCRUMB_LEVEL::DBG )
|
||||
return "debug";
|
||||
|
||||
if( aLevel == BREADCRUMB_LEVEL::ERR )
|
||||
return "error";
|
||||
|
||||
std::string ret( magic_enum::enum_name( aLevel ) );
|
||||
|
||||
std::transform( ret.begin(), ret.end(), ret.begin(),
|
||||
[]( unsigned char c )
|
||||
{
|
||||
return std::tolower( c );
|
||||
} );
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace APP_MONITOR
|
||||
{
|
||||
SENTRY* SENTRY::m_instance = nullptr;
|
||||
|
||||
|
||||
bool operator<( const ASSERT_CACHE_KEY& aKey1, const ASSERT_CACHE_KEY& aKey2 )
|
||||
{
|
||||
return aKey1.file < aKey2.file || aKey1.line < aKey2.line || aKey1.func < aKey2.func || aKey1.cond < aKey2.cond;
|
||||
}
|
||||
|
||||
|
||||
void AddBreadcrumb( BREADCRUMB_TYPE aType, const wxString& aMsg, const wxString& aCategory, BREADCRUMB_LEVEL aLevel )
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
if( !SENTRY::Instance()->IsOptedIn() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::string type = GetSentryBreadCrumbType( aType );
|
||||
sentry_value_t crumb = sentry_value_new_breadcrumb( type.c_str(), aMsg.c_str() );
|
||||
|
||||
sentry_value_set_by_key( crumb, "category", sentry_value_new_string( aCategory.c_str() ) );
|
||||
|
||||
if( aType == BREADCRUMB_TYPE::ERR )
|
||||
{
|
||||
std::string level = GetSentryBreadCrumbLevel( aLevel );
|
||||
sentry_value_set_by_key( crumb, "level", sentry_value_new_string( level.c_str() ) );
|
||||
}
|
||||
|
||||
sentry_add_breadcrumb( crumb );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void AddNavigationBreadcrumb( const wxString& aMsg, const wxString& aCategory )
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
AddBreadcrumb( BREADCRUMB_TYPE::NAVIGATION, aMsg, aCategory, BREADCRUMB_LEVEL::INFO );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void AddTransactionBreadcrumb( const wxString& aMsg, const wxString& aCategory )
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
AddBreadcrumb( BREADCRUMB_TYPE::TRANSACTION, aMsg, aCategory, BREADCRUMB_LEVEL::INFO );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
class TRANSACTION_IMPL
|
||||
{
|
||||
public:
|
||||
TRANSACTION_IMPL( const std::string& aName, const std::string& aOperation )
|
||||
{
|
||||
m_ctx = sentry_transaction_context_new( aName.c_str(), aOperation.c_str() );
|
||||
}
|
||||
|
||||
~TRANSACTION_IMPL() {
|
||||
Finish();
|
||||
|
||||
// note m_ctx is handled by sentry
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
m_tx = sentry_transaction_start( m_ctx, sentry_value_new_null() );
|
||||
}
|
||||
|
||||
void Finish()
|
||||
{
|
||||
FinishSpan();
|
||||
|
||||
if( m_tx )
|
||||
{
|
||||
sentry_transaction_finish( m_tx );
|
||||
m_tx = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void StartSpan( const std::string& aOperation, const std::string& aDescription )
|
||||
{
|
||||
if( m_span )
|
||||
return;
|
||||
|
||||
if( !m_tx )
|
||||
return;
|
||||
|
||||
m_span = sentry_transaction_start_child( m_tx, aOperation.c_str(), aDescription.c_str() );
|
||||
}
|
||||
|
||||
void FinishSpan()
|
||||
{
|
||||
if( m_span )
|
||||
{
|
||||
sentry_span_finish( m_span );
|
||||
m_span = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
sentry_transaction_context_t* m_ctx = nullptr;
|
||||
sentry_transaction_t* m_tx = nullptr;
|
||||
sentry_span_t* m_span = nullptr;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
TRANSACTION::TRANSACTION( const std::string& aName, const std::string& aOperation )
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
if( SENTRY::Instance()->IsOptedIn() )
|
||||
{
|
||||
m_impl = new TRANSACTION_IMPL( aName, aOperation );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
TRANSACTION::~TRANSACTION()
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
delete m_impl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void TRANSACTION::Start()
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
if( m_impl )
|
||||
{
|
||||
m_impl->Start();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void TRANSACTION::StartSpan( const std::string& aOperation, const std::string& aDescription )
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
if( m_impl )
|
||||
{
|
||||
m_impl->StartSpan( aOperation, aDescription );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void TRANSACTION::Finish()
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
if( m_impl )
|
||||
{
|
||||
m_impl->Finish();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void TRANSACTION::FinishSpan()
|
||||
{
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
if( m_impl )
|
||||
{
|
||||
m_impl->FinishSpan();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -134,6 +134,7 @@ void ARRAY_AXIS::SetStep( int aStep )
|
||||
|
||||
wxString ARRAY_AXIS::GetItemNumber( int n ) const
|
||||
{
|
||||
wxString itemNum;
|
||||
const wxString& alphabet = GetAlphabet();
|
||||
const bool nonUnitColsStartAt0 = schemeNonUnitColsStartAt0( m_type );
|
||||
|
||||
|
||||
@@ -133,11 +133,6 @@ ARRAY_OPTIONS::TRANSFORM ARRAY_CIRCULAR_OPTIONS::GetTransform( int n, const VECT
|
||||
// n'th step
|
||||
angle = EDA_ANGLE( m_angle.AsDegrees() * n, DEGREES_T );
|
||||
|
||||
angle += m_angleOffset;
|
||||
|
||||
if( m_clockwise )
|
||||
angle = -angle;
|
||||
|
||||
VECTOR2I new_pos = aPos;
|
||||
RotatePoint( new_pos, m_centre, angle );
|
||||
|
||||
|
||||
@@ -173,10 +173,9 @@ private:
|
||||
|
||||
|
||||
BACKGROUND_JOB_REPORTER::BACKGROUND_JOB_REPORTER( BACKGROUND_JOBS_MONITOR* aMonitor,
|
||||
const std::shared_ptr<BACKGROUND_JOB>& aJob ) :
|
||||
std::shared_ptr<BACKGROUND_JOB> aJob ) :
|
||||
PROGRESS_REPORTER_BASE( 1 ),
|
||||
m_monitor( aMonitor ),
|
||||
m_job( aJob )
|
||||
m_monitor( aMonitor ), m_job( aJob )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -306,8 +305,10 @@ void BACKGROUND_JOBS_MONITOR::ShowList( wxWindow* aParent, wxPoint aPos )
|
||||
|
||||
std::shared_lock<std::shared_mutex> lock( m_mutex, std::try_to_lock );
|
||||
|
||||
for( const std::shared_ptr<BACKGROUND_JOB>& job : m_jobs )
|
||||
for( std::shared_ptr<BACKGROUND_JOB> job : m_jobs )
|
||||
{
|
||||
list->Add( job );
|
||||
}
|
||||
|
||||
lock.unlock();
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ bool BITMAP_BASE::SaveImageData( wxOutputStream& aOutStream ) const
|
||||
else
|
||||
{
|
||||
// Write the contents of m_imageData to the stream.
|
||||
aOutStream.Write( m_imageData.GetData(), m_imageData.GetDataLen() );
|
||||
aOutStream.Write( m_imageData.GetData(), m_imageData.GetBufSize() );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -102,8 +102,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::text_valign_top].emplace_back( BITMAPS::text_valign_top, wxT( "text_valign_top_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_valign_center].emplace_back( BITMAPS::text_valign_center, wxT( "text_valign_center_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_valign_bottom].emplace_back( BITMAPS::text_valign_bottom, wxT( "text_valign_bottom_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_visibility].emplace_back( BITMAPS::text_visibility, wxT( "text_visibility_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_visibility_off].emplace_back( BITMAPS::text_visibility_off, wxT( "text_visibility_off_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_bold].emplace_back( BITMAPS::text_bold, wxT( "text_bold_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_italic].emplace_back( BITMAPS::text_italic, wxT( "text_italic_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_mirrored].emplace_back( BITMAPS::text_mirrored, wxT( "text_mirrored_16.png" ), 16, wxT( "light" ) );
|
||||
@@ -187,8 +185,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::text_valign_top].emplace_back( BITMAPS::text_valign_top, wxT( "text_valign_top_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_valign_center].emplace_back( BITMAPS::text_valign_center, wxT( "text_valign_center_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_valign_bottom].emplace_back( BITMAPS::text_valign_bottom, wxT( "text_valign_bottom_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_visibility].emplace_back( BITMAPS::text_visibility, wxT( "text_visibility_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_visibility_off].emplace_back( BITMAPS::text_visibility_off, wxT( "text_visibility_off_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_bold].emplace_back( BITMAPS::text_bold, wxT( "text_bold_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_italic].emplace_back( BITMAPS::text_italic, wxT( "text_italic_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_mirrored].emplace_back( BITMAPS::text_mirrored, wxT( "text_mirrored_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
@@ -272,8 +268,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::text_valign_top].emplace_back( BITMAPS::text_valign_top, wxT( "text_valign_top_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_valign_center].emplace_back( BITMAPS::text_valign_center, wxT( "text_valign_center_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_valign_bottom].emplace_back( BITMAPS::text_valign_bottom, wxT( "text_valign_bottom_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_visibility].emplace_back( BITMAPS::text_visibility, wxT( "text_visibility_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_visibility_off].emplace_back( BITMAPS::text_visibility_off, wxT( "text_visibility_off_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_bold].emplace_back( BITMAPS::text_bold, wxT( "text_bold_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_italic].emplace_back( BITMAPS::text_italic, wxT( "text_italic_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_mirrored].emplace_back( BITMAPS::text_mirrored, wxT( "text_mirrored_32.png" ), 32, wxT( "light" ) );
|
||||
@@ -357,8 +351,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::text_valign_top].emplace_back( BITMAPS::text_valign_top, wxT( "text_valign_top_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_valign_center].emplace_back( BITMAPS::text_valign_center, wxT( "text_valign_center_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_valign_bottom].emplace_back( BITMAPS::text_valign_bottom, wxT( "text_valign_bottom_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_visibility].emplace_back( BITMAPS::text_visibility, wxT( "text_visibility_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_visibility_off].emplace_back( BITMAPS::text_visibility_off, wxT( "text_visibility_off_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_bold].emplace_back( BITMAPS::text_bold, wxT( "text_bold_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_italic].emplace_back( BITMAPS::text_italic, wxT( "text_italic_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::text_mirrored].emplace_back( BITMAPS::text_mirrored, wxT( "text_mirrored_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
@@ -4901,7 +4893,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::color_code_tolerance].emplace_back( BITMAPS::color_code_tolerance, wxT( "color_code_tolerance.png" ), -1, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::color_code_value].emplace_back( BITMAPS::color_code_value, wxT( "color_code_value.png" ), -1, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::color_code_value_and_name].emplace_back( BITMAPS::color_code_value_and_name, wxT( "color_code_value_and_name.png" ), -1, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::coupled_stripline].emplace_back( BITMAPS::coupled_stripline, wxT( "coupled_stripline.png" ), -1, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::creepage_clearance].emplace_back( BITMAPS::creepage_clearance, wxT( "creepage_clearance.png" ), -1, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::cpw].emplace_back( BITMAPS::cpw, wxT( "cpw.png" ), -1, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::cpw_back].emplace_back( BITMAPS::cpw_back, wxT( "cpw_back.png" ), -1, wxT( "light" ) );
|
||||
@@ -4937,7 +4928,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::color_code_tolerance].emplace_back( BITMAPS::color_code_tolerance, wxT( "color_code_tolerance_dark.png" ), -1, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::color_code_value].emplace_back( BITMAPS::color_code_value, wxT( "color_code_value_dark.png" ), -1, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::color_code_value_and_name].emplace_back( BITMAPS::color_code_value_and_name, wxT( "color_code_value_and_name_dark.png" ), -1, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::coupled_stripline].emplace_back( BITMAPS::coupled_stripline, wxT( "coupled_stripline_dark.png" ), -1, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::creepage_clearance].emplace_back( BITMAPS::creepage_clearance, wxT( "creepage_clearance_dark.png" ), -1, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::cpw].emplace_back( BITMAPS::cpw, wxT( "cpw_dark.png" ), -1, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::cpw_back].emplace_back( BITMAPS::cpw_back, wxT( "cpw_back_dark.png" ), -1, wxT( "dark" ) );
|
||||
|
||||
+14
-28
@@ -31,7 +31,6 @@
|
||||
#include <build_version.h>
|
||||
|
||||
#include <tuple>
|
||||
#include <mutex>
|
||||
|
||||
// kicad_curl.h must be included before wx headers, to avoid
|
||||
// conflicts for some defines, at least on Windows
|
||||
@@ -52,9 +51,6 @@ extern std::string GetCurlLibVersion();
|
||||
#include <kicad_build_version.h>
|
||||
#undef INCLUDE_KICAD_VERSION
|
||||
|
||||
// Mutex for wxPlatformInfo
|
||||
static std::recursive_mutex s_platformInfoMutex;
|
||||
|
||||
// Remember OpenGL info
|
||||
static wxString s_glVendor;
|
||||
static wxString s_glRenderer;
|
||||
@@ -70,10 +66,8 @@ void SetOpenGLInfo( const char* aVendor, const char* aRenderer, const char* aVer
|
||||
|
||||
wxString GetPlatformGetBitnessName()
|
||||
{
|
||||
// wxPlatformInfo is not thread-safe, so protect it
|
||||
std::unique_lock lock(s_platformInfoMutex);
|
||||
|
||||
return wxPlatformInfo().GetBitnessName();
|
||||
wxPlatformInfo platform;
|
||||
return platform.GetBitnessName();
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +157,7 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
|
||||
#endif
|
||||
<< " build";
|
||||
|
||||
wxPlatformInfo platform;
|
||||
aMsg << "Application: " << aTitle;
|
||||
aMsg << " " << wxGetCpuArchitectureName() << " on " << wxGetNativeCpuArchitectureName();
|
||||
|
||||
@@ -192,19 +187,14 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
|
||||
// Linux uses the lsb-release program to get the description of the OS, if lsb-release
|
||||
// isn't installed, then the string will be empty and we fallback to the method used on
|
||||
// the other platforms (to at least get the kernel/uname info).
|
||||
if( osDescription.empty() )
|
||||
osDescription = wxGetOsDescription();
|
||||
if( osDescription.empty() )
|
||||
osDescription = wxGetOsDescription();
|
||||
|
||||
{
|
||||
// wxPlatformInfo is not thread-safe, so protect it
|
||||
std::unique_lock lock( s_platformInfoMutex );
|
||||
|
||||
aMsg << "Platform: "
|
||||
<< osDescription << ", "
|
||||
<< GetPlatformGetBitnessName() << ", "
|
||||
<< wxPlatformInfo().GetEndiannessName() << ", "
|
||||
<< wxPlatformInfo().GetPortIdName();
|
||||
}
|
||||
aMsg << "Platform: "
|
||||
<< osDescription << ", "
|
||||
<< GetPlatformGetBitnessName() << ", "
|
||||
<< platform.GetEndiannessName() << ", "
|
||||
<< platform.GetPortIdName();
|
||||
|
||||
#ifdef __WXGTK__
|
||||
if( wxTheApp && wxTheApp->IsGUI() )
|
||||
@@ -250,15 +240,11 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
|
||||
|
||||
// Get the GTK+ version where possible.
|
||||
#ifdef __WXGTK__
|
||||
{
|
||||
// wxPlatformInfo is not thread-safe, so protect it
|
||||
std::unique_lock lock( s_platformInfoMutex );
|
||||
int major, minor;
|
||||
int major, minor;
|
||||
|
||||
major = wxPlatformInfo().GetToolkitMajorVersion();
|
||||
minor = wxPlatformInfo().GetToolkitMinorVersion();
|
||||
aMsg << " GTK+ " << major << "." << minor;
|
||||
}
|
||||
major = wxPlatformInfo().Get().GetToolkitMajorVersion();
|
||||
minor = wxPlatformInfo().Get().GetToolkitMinorVersion();
|
||||
aMsg << " GTK+ " << major << "." << minor;
|
||||
#endif
|
||||
|
||||
aMsg << eol;
|
||||
|
||||
+1
-69
@@ -26,12 +26,6 @@
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/sstream.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <io/csv.h>
|
||||
|
||||
|
||||
bool SaveClipboard( const std::string& aTextUTF8 )
|
||||
@@ -112,66 +106,4 @@ std::unique_ptr<wxImage> GetImageFromClipboard()
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
bool SaveTabularDataToClipboard( const std::vector<std::vector<wxString>>& aData )
|
||||
{
|
||||
wxLogNull doNotLog; // disable logging of failed clipboard actions
|
||||
|
||||
if( wxTheClipboard->Open() )
|
||||
{
|
||||
wxDataObjectComposite* data = new wxDataObjectComposite();
|
||||
|
||||
// Set plain text CSV
|
||||
{
|
||||
wxStringOutputStream os;
|
||||
CSV_WRITER writer( os );
|
||||
writer.WriteLines( aData );
|
||||
|
||||
data->Add( new wxTextDataObject( os.GetString() ), true );
|
||||
}
|
||||
|
||||
// At this point, it would be great if we could add some format that spreadsheet
|
||||
// programs can understand without asking the user for options: perhaps SYLK or DIF.
|
||||
// But it doesn't seem like WX allows to put arbitrary MIME types on the clipboard,
|
||||
// even with wxCustomDataObject( wxDataFormat( "mime/type" ) ), which just ends up as
|
||||
// wxDF_PRIVATE, and wxDF_SYLK/DIF aren't mapped on GTK.
|
||||
|
||||
wxTheClipboard->SetData( data );
|
||||
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
|
||||
wxTheClipboard->Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool GetTabularDataFromClipboard( std::vector<std::vector<wxString>>& aData )
|
||||
{
|
||||
// Again, it would be ideal if we could detect a spreadsheet mimetype here,
|
||||
// but WX doesn't seem to do that on Linux, at least.
|
||||
|
||||
bool ok = false;
|
||||
|
||||
// First try for text data
|
||||
if( wxTheClipboard->Open() )
|
||||
{
|
||||
if( wxTheClipboard->IsSupported( wxDF_TEXT ) )
|
||||
{
|
||||
wxTextDataObject data;
|
||||
if( wxTheClipboard->GetData( data ) )
|
||||
{
|
||||
ok = AutoDecodeCSV( data.GetText(), aData );
|
||||
}
|
||||
}
|
||||
|
||||
// We could also handle .csv wxDF_FILENAMEs here
|
||||
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
+28
-13
@@ -28,7 +28,6 @@
|
||||
#include <core/kicad_algo.h>
|
||||
#include <commit.h>
|
||||
#include <eda_item.h>
|
||||
#include <eda_group.h>
|
||||
#include <macros.h>
|
||||
|
||||
COMMIT::COMMIT()
|
||||
@@ -39,12 +38,14 @@ COMMIT::COMMIT()
|
||||
COMMIT::~COMMIT()
|
||||
{
|
||||
for( COMMIT_LINE& ent : m_changes )
|
||||
delete ent.m_copy;
|
||||
{
|
||||
if( ent.m_copy )
|
||||
delete ent.m_copy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
COMMIT& COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType, BASE_SCREEN* aScreen,
|
||||
RECURSE_MODE aRecurse )
|
||||
COMMIT& COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType, BASE_SCREEN* aScreen )
|
||||
{
|
||||
// CHT_MODIFY and CHT_DONE are not compatible
|
||||
wxASSERT( ( aChangeType & ( CHT_MODIFY | CHT_DONE ) ) != ( CHT_MODIFY | CHT_DONE ) );
|
||||
@@ -55,25 +56,32 @@ COMMIT& COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType, BASE_SCREEN* aS
|
||||
{
|
||||
case CHT_ADD:
|
||||
makeEntry( aItem, CHT_ADD | flag, nullptr, aScreen );
|
||||
break;
|
||||
return *this;
|
||||
|
||||
case CHT_REMOVE:
|
||||
wxASSERT( m_deletedItems.find( aItem ) == m_deletedItems.end() );
|
||||
m_deletedItems.insert( aItem );
|
||||
makeEntry( aItem, CHT_REMOVE | flag, makeImage( aItem ), aScreen );
|
||||
|
||||
if( EDA_GROUP* parentGroup = aItem->GetParentGroup() )
|
||||
Modify( parentGroup->AsEdaItem(), aScreen, RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
break;
|
||||
makeEntry( aItem, CHT_REMOVE | flag, nullptr, aScreen );
|
||||
return *this;
|
||||
|
||||
case CHT_MODIFY:
|
||||
{
|
||||
EDA_ITEM* parent = parentObject( aItem );
|
||||
createModified( parent, makeImage( parent ), flag, aScreen );
|
||||
EDA_ITEM* clone = makeImage( parent );
|
||||
|
||||
wxASSERT( clone );
|
||||
|
||||
if( clone )
|
||||
return createModified( parent, clone, flag, aScreen );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case CHT_GROUP:
|
||||
case CHT_UNGROUP:
|
||||
makeEntry( aItem, aChangeType, nullptr, aScreen );
|
||||
return *this;
|
||||
|
||||
default:
|
||||
wxFAIL;
|
||||
}
|
||||
@@ -83,7 +91,7 @@ COMMIT& COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType, BASE_SCREEN* aS
|
||||
|
||||
|
||||
COMMIT& COMMIT::Stage( std::vector<EDA_ITEM*> &container, CHANGE_TYPE aChangeType,
|
||||
BASE_SCREEN *aScreen )
|
||||
BASE_SCREEN *aScreen )
|
||||
{
|
||||
for( EDA_ITEM* item : container )
|
||||
Stage( item, aChangeType, aScreen);
|
||||
@@ -146,6 +154,9 @@ COMMIT& COMMIT::createModified( EDA_ITEM* aItem, EDA_ITEM* aCopy, int aExtraFlag
|
||||
|
||||
void COMMIT::makeEntry( EDA_ITEM* aItem, CHANGE_TYPE aType, EDA_ITEM* aCopy, BASE_SCREEN *aScreen )
|
||||
{
|
||||
// Expect an item copy if it is going to be modified
|
||||
wxASSERT( !!aCopy == ( ( aType & CHT_TYPE ) == CHT_MODIFY ) );
|
||||
|
||||
COMMIT_LINE ent;
|
||||
|
||||
ent.m_item = aItem;
|
||||
@@ -179,6 +190,8 @@ CHANGE_TYPE COMMIT::convert( UNDO_REDO aType ) const
|
||||
{
|
||||
case UNDO_REDO::NEWITEM: return CHT_ADD;
|
||||
case UNDO_REDO::DELETED: return CHT_REMOVE;
|
||||
case UNDO_REDO::REGROUP: return CHT_GROUP;
|
||||
case UNDO_REDO::UNGROUP: return CHT_UNGROUP;
|
||||
case UNDO_REDO::CHANGED: return CHT_MODIFY;
|
||||
default: wxASSERT( false ); return CHT_MODIFY;
|
||||
}
|
||||
@@ -191,6 +204,8 @@ UNDO_REDO COMMIT::convert( CHANGE_TYPE aType ) const
|
||||
{
|
||||
case CHT_ADD: return UNDO_REDO::NEWITEM;
|
||||
case CHT_REMOVE: return UNDO_REDO::DELETED;
|
||||
case CHT_GROUP: return UNDO_REDO::REGROUP;
|
||||
case CHT_UNGROUP: return UNDO_REDO::UNGROUP;
|
||||
case CHT_MODIFY: return UNDO_REDO::CHANGED;
|
||||
default: wxASSERT( false ); return UNDO_REDO::CHANGED;
|
||||
}
|
||||
|
||||
+5
-7
@@ -40,7 +40,7 @@
|
||||
#include <wx/regex.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -118,12 +118,11 @@ wxString ExpandTextVars( const wxString& aSource,
|
||||
}
|
||||
|
||||
|
||||
wxString GetGeneratedFieldDisplayName( const wxString& aSource )
|
||||
wxString GetTextVars( const wxString& aSource )
|
||||
{
|
||||
std::function<bool( wxString* )> tokenExtractor =
|
||||
[&]( wxString* token ) -> bool
|
||||
{
|
||||
*token = *token; // token value is the token name
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -131,10 +130,9 @@ wxString GetGeneratedFieldDisplayName( const wxString& aSource )
|
||||
}
|
||||
|
||||
|
||||
bool IsGeneratedField( const wxString& aSource )
|
||||
bool IsTextVar( const wxString& aSource )
|
||||
{
|
||||
static wxRegEx expr( wxS( "^\\$\\{\\w*\\}$" ) );
|
||||
return expr.Matches( aSource );
|
||||
return aSource.StartsWith( wxS( "${" ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -433,7 +431,7 @@ wxString EnsureFileExtension( const wxString& aFilename, const wxString& aExtens
|
||||
// extension, such as "Schematic_1.1".
|
||||
if( newFilename.Lower().AfterLast( '.' ) != aExtension )
|
||||
{
|
||||
if( !newFilename.EndsWith( '.' ) )
|
||||
if( newFilename.Last() != '.' )
|
||||
newFilename.Append( '.' );
|
||||
|
||||
newFilename.Append( aExtension );
|
||||
|
||||
+23
-25
@@ -31,6 +31,8 @@
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/choicdlg.h>
|
||||
#include <wx/crt.h>
|
||||
|
||||
|
||||
/**
|
||||
* Flag to enable confirmation dialog debugging output.
|
||||
*
|
||||
@@ -51,7 +53,7 @@ bool AskOverrideLock( wxWindow* aParent, const wxString& aMessage )
|
||||
+ wxS( "\n" ) );
|
||||
dlg.SetYesNoLabels( _( "&Cancel" ), _( "&Open Anyway" ) );
|
||||
#else
|
||||
KICAD_MESSAGE_DIALOG_BASE dlg( aParent, aMessage, _( "File Open Warning" ),
|
||||
wxMessageDialog dlg( aParent, aMessage, _( "File Open Warning" ),
|
||||
wxYES_NO | wxICON_ERROR | wxCENTER );
|
||||
dlg.SetExtendedMessage( _( "Interleaved saves may produce very unexpected results." ) );
|
||||
dlg.SetYesNoLabels( _( "&Cancel" ), _( "&Open Anyway" ) );
|
||||
@@ -65,9 +67,8 @@ int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage, bool* aApp
|
||||
{
|
||||
static bool s_apply_to_all = false;
|
||||
|
||||
KICAD_RICH_MESSAGE_DIALOG_BASE dlg( parent, aMessage, _( "Save Changes?" ),
|
||||
wxYES_NO | wxCANCEL |
|
||||
wxYES_DEFAULT | wxICON_WARNING | wxCENTER );
|
||||
wxRichMessageDialog dlg( parent, aMessage, _( "Save Changes?" ),
|
||||
wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_WARNING | wxCENTER );
|
||||
dlg.SetExtendedMessage( _( "If you don't save, all your changes will be permanently lost." )
|
||||
+ wxS( "\n" ) );
|
||||
dlg.SetYesNoLabels( _( "&Save" ), _( "&Discard Changes" ) );
|
||||
@@ -104,7 +105,7 @@ int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage )
|
||||
wxWindowDisabler disable( true );
|
||||
#endif
|
||||
|
||||
KICAD_MESSAGE_DIALOG_BASE dlg( parent, aMessage, _( "Save Changes?" ),
|
||||
wxMessageDialog dlg( parent, aMessage, _( "Save Changes?" ),
|
||||
wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_WARNING | wxCENTER );
|
||||
dlg.SetExtendedMessage( _( "If you don't save, all your changes will be permanently lost." ) );
|
||||
dlg.SetYesNoLabels( _( "&Save" ), _( "&Discard Changes" ) );
|
||||
@@ -117,8 +118,8 @@ int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage )
|
||||
|
||||
bool ConfirmRevertDialog( wxWindow* parent, const wxString& aMessage )
|
||||
{
|
||||
KICAD_MESSAGE_DIALOG_BASE dlg( parent, aMessage, wxEmptyString,
|
||||
wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER );
|
||||
wxMessageDialog dlg( parent, aMessage, wxEmptyString,
|
||||
wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER );
|
||||
dlg.SetExtendedMessage( _( "Your current changes will be permanently lost." ) );
|
||||
dlg.SetOKCancelLabels( _( "&Revert" ), _( "&Cancel" ) );
|
||||
|
||||
@@ -143,8 +144,8 @@ int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxStrin
|
||||
const wxString& aDetailedMessage, const wxString& aOKLabel,
|
||||
const wxString& aCancelLabel, bool* aApplyToAll )
|
||||
{
|
||||
KICAD_RICH_MESSAGE_DIALOG_BASE dlg( aParent, aMessage, aWarning,
|
||||
wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER );
|
||||
wxRichMessageDialog dlg( aParent, aMessage, aWarning,
|
||||
wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER );
|
||||
|
||||
dlg.SetOKCancelLabels( ( aOKLabel.IsEmpty() ) ? _( "&OK" ) : aOKLabel,
|
||||
( aCancelLabel.IsEmpty() ) ? _( "&Cancel" ) : aCancelLabel );
|
||||
@@ -166,7 +167,7 @@ int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxStrin
|
||||
|
||||
|
||||
// DisplayError should be deprecated, use DisplayErrorMessage instead
|
||||
void DisplayError( wxWindow* aParent, const wxString& aText )
|
||||
void DisplayError( wxWindow* aParent, const wxString& aText, int aDisplayTime )
|
||||
{
|
||||
if( !wxTheApp || !wxTheApp->IsMainLoopRunning() )
|
||||
{
|
||||
@@ -180,11 +181,11 @@ void DisplayError( wxWindow* aParent, const wxString& aText )
|
||||
return;
|
||||
}
|
||||
|
||||
KICAD_MESSAGE_DIALOG_BASE* dlg;
|
||||
wxMessageDialog* dlg;
|
||||
int icon = aDisplayTime > 0 ? wxICON_INFORMATION : wxICON_ERROR;
|
||||
|
||||
dlg = new KICAD_MESSAGE_DIALOG_BASE( aParent, aText, _( "Error" ),
|
||||
wxOK | wxCENTRE | wxRESIZE_BORDER |
|
||||
wxICON_ERROR | wxSTAY_ON_TOP );
|
||||
dlg = new wxMessageDialog( aParent, aText, _( "Warning" ),
|
||||
wxOK | wxCENTRE | wxRESIZE_BORDER | icon | wxSTAY_ON_TOP );
|
||||
|
||||
dlg->ShowModal();
|
||||
dlg->Destroy();
|
||||
@@ -205,11 +206,10 @@ void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxStri
|
||||
return;
|
||||
}
|
||||
|
||||
KICAD_MESSAGE_DIALOG_BASE* dlg;
|
||||
wxMessageDialog* dlg;
|
||||
|
||||
dlg = new KICAD_MESSAGE_DIALOG_BASE( aParent, aText, _( "Error" ),
|
||||
wxOK | wxCENTRE | wxRESIZE_BORDER |
|
||||
wxICON_ERROR | wxSTAY_ON_TOP );
|
||||
dlg = new wxMessageDialog( aParent, aText, _( "Error" ),
|
||||
wxOK | wxCENTRE | wxRESIZE_BORDER | wxICON_ERROR | wxSTAY_ON_TOP );
|
||||
|
||||
if( !aExtraInfo.IsEmpty() )
|
||||
dlg->SetExtendedMessage( aExtraInfo );
|
||||
@@ -233,12 +233,11 @@ void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxSt
|
||||
return;
|
||||
}
|
||||
|
||||
KICAD_MESSAGE_DIALOG_BASE* dlg;
|
||||
wxMessageDialog* dlg;
|
||||
int icon = wxICON_INFORMATION;
|
||||
|
||||
dlg = new KICAD_MESSAGE_DIALOG_BASE( aParent, aMessage, _( "Information" ),
|
||||
wxOK | wxCENTRE | wxRESIZE_BORDER |
|
||||
icon | wxSTAY_ON_TOP );
|
||||
dlg = new wxMessageDialog( aParent, aMessage, _( "Information" ),
|
||||
wxOK | wxCENTRE | wxRESIZE_BORDER | icon | wxSTAY_ON_TOP );
|
||||
|
||||
if( !aExtraInfo.IsEmpty() )
|
||||
dlg->SetExtendedMessage( aExtraInfo );
|
||||
@@ -264,9 +263,8 @@ bool IsOK( wxWindow* aParent, const wxString& aMessage )
|
||||
#endif
|
||||
|
||||
#if !defined( __WXGTK__ )
|
||||
KICAD_RICH_MESSAGE_DIALOG_BASE dlg( aParent, aMessage, _( "Confirmation" ),
|
||||
wxOK | wxCANCEL | wxOK_DEFAULT |
|
||||
wxCENTRE | icon | wxSTAY_ON_TOP );
|
||||
wxRichMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),
|
||||
wxOK | wxCANCEL | wxOK_DEFAULT | wxCENTRE | icon | wxSTAY_ON_TOP );
|
||||
#else
|
||||
wxMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),
|
||||
wxOK | wxCANCEL | wxOK_DEFAULT | wxCENTRE | icon | wxSTAY_ON_TOP );
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
const int dblibSchemaVersion = 1;
|
||||
|
||||
|
||||
DATABASE_FIELD_MAPPING::DATABASE_FIELD_MAPPING( const std::string& aColumn, const std::string& aName,
|
||||
DATABASE_FIELD_MAPPING::DATABASE_FIELD_MAPPING( std::string aColumn, std::string aName,
|
||||
bool aVisibleOnAdd, bool aVisibleInChooser,
|
||||
bool aShowName, bool aInheritProperties ) :
|
||||
column( aColumn ),
|
||||
|
||||
+3
-13
@@ -21,13 +21,9 @@
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef DESIGN_BLOCK_H
|
||||
#define DESIGN_BLOCK_H
|
||||
|
||||
#include <kicommon.h>
|
||||
#include <lib_id.h>
|
||||
#include <json_common.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
||||
class KICOMMON_API DESIGN_BLOCK
|
||||
@@ -45,9 +41,6 @@ public:
|
||||
const wxString& GetSchematicFile() const { return m_schematicFile; }
|
||||
void SetSchematicFile( const wxString& aFile ) { m_schematicFile = aFile; }
|
||||
|
||||
const wxString& GetBoardFile() const { return m_boardFile; }
|
||||
void SetBoardFile( const wxString& aFile ) { m_boardFile = aFile; }
|
||||
|
||||
void SetFields( nlohmann::ordered_map<wxString, wxString>& aFields )
|
||||
{
|
||||
m_fields = std::move( aFields );
|
||||
@@ -62,12 +55,9 @@ public:
|
||||
|
||||
private:
|
||||
LIB_ID m_lib_id;
|
||||
wxString m_schematicFile; ///< File name and path for schematic file.
|
||||
wxString m_boardFile; ///< File name and path for board file
|
||||
wxString m_schematicFile; ///< File name and path for schematic symbol.
|
||||
wxString m_libDescription; ///< File name and path for documentation file.
|
||||
wxString m_keywords; ///< Search keywords to find design block in library.
|
||||
wxString m_keywords; ///< Search keywords to find footprint in library.
|
||||
|
||||
nlohmann::ordered_map<wxString, wxString> m_fields;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -72,9 +72,7 @@ std::vector<SEARCH_TERM> DESIGN_BLOCK_INFO::GetSearchTerms()
|
||||
{
|
||||
std::vector<SEARCH_TERM> terms;
|
||||
|
||||
terms.emplace_back( SEARCH_TERM( GetLibNickname(), 4 ) );
|
||||
terms.emplace_back( SEARCH_TERM( GetName(), 8 ) );
|
||||
terms.emplace_back( SEARCH_TERM( GetLIB_ID().Format(), 16 ) );
|
||||
|
||||
wxStringTokenizer keywordTokenizer( GetKeywords(), wxS( " " ), wxTOKEN_STRTOK );
|
||||
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
#include <design_block_info_impl.h>
|
||||
|
||||
#include <design_block.h>
|
||||
#include <design_block_info.h>
|
||||
#include <design_block_lib_table.h>
|
||||
#include <kiway.h>
|
||||
#include <locale_io.h>
|
||||
#include <lib_id.h>
|
||||
#include <progress_reporter.h>
|
||||
#include <string_utils.h>
|
||||
#include <thread_pool.h>
|
||||
@@ -31,6 +33,7 @@
|
||||
|
||||
#include <kiplatform/io.h>
|
||||
|
||||
#include <wx/textfile.h>
|
||||
#include <wx/txtstrm.h>
|
||||
#include <wx/wfstream.h>
|
||||
|
||||
@@ -41,8 +44,7 @@ void DESIGN_BLOCK_INFO_IMPL::load()
|
||||
|
||||
wxASSERT( dbtable );
|
||||
|
||||
std::unique_ptr<const DESIGN_BLOCK> design_block( dbtable->GetEnumeratedDesignBlock( m_nickname,
|
||||
m_dbname ) );
|
||||
const DESIGN_BLOCK* design_block = dbtable->GetEnumeratedDesignBlock( m_nickname, m_dbname );
|
||||
|
||||
if( design_block )
|
||||
{
|
||||
@@ -126,6 +128,7 @@ bool DESIGN_BLOCK_LIST_IMPL::ReadDesignBlockFiles( DESIGN_BLOCK_LIB_TABLE* aTabl
|
||||
m_queue.push( nickname );
|
||||
}
|
||||
|
||||
|
||||
if( m_progress_reporter )
|
||||
{
|
||||
m_progress_reporter->SetMaxProgress( (int) m_queue.size() );
|
||||
|
||||
+20
-71
@@ -267,9 +267,7 @@ void DESIGN_BLOCK_IO::DesignBlockEnumerate( wxArrayString& aDesignBlockNames,
|
||||
wxDir dir( aLibraryPath );
|
||||
|
||||
if( !dir.IsOpened() )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "Design block '%s' does not exist." ), aLibraryPath ) );
|
||||
}
|
||||
return;
|
||||
|
||||
wxString dirname;
|
||||
wxString fileSpec = wxT( "*." ) + wxString( FILEEXT::KiCadDesignBlockPathExtension );
|
||||
@@ -291,23 +289,17 @@ DESIGN_BLOCK* DESIGN_BLOCK_IO::DesignBlockLoad( const wxString& aLibraryPath,
|
||||
+ FILEEXT::KiCadDesignBlockPathExtension + wxFileName::GetPathSeparator();
|
||||
wxString dbSchPath = dbPath + aDesignBlockName + wxT( "." )
|
||||
+ FILEEXT::KiCadSchematicFileExtension;
|
||||
wxString dbPcbPath = dbPath + aDesignBlockName + wxT( "." ) + FILEEXT::KiCadPcbFileExtension;
|
||||
wxString dbMetadataPath = dbPath + aDesignBlockName + wxT( "." ) + FILEEXT::JsonFileExtension;
|
||||
|
||||
if( !wxDir::Exists( dbPath ) )
|
||||
THROW_IO_ERROR( wxString::Format( _( "Design block '%s' does not exist." ), dbPath ) );
|
||||
if( !wxFileExists( dbSchPath ) )
|
||||
return nullptr;
|
||||
|
||||
DESIGN_BLOCK* newDB = new DESIGN_BLOCK();
|
||||
|
||||
// Library name needs to be empty for when we fill it in with the correct library nickname
|
||||
// one layer above
|
||||
newDB->SetLibId( LIB_ID( wxEmptyString, aDesignBlockName ) );
|
||||
|
||||
if( wxFileExists( dbSchPath ) )
|
||||
newDB->SetSchematicFile( dbSchPath );
|
||||
|
||||
if( wxFileExists( dbPcbPath ) )
|
||||
newDB->SetBoardFile( dbPcbPath );
|
||||
newDB->SetSchematicFile( dbSchPath );
|
||||
|
||||
// Parse the JSON file if it exists
|
||||
if( wxFileExists( dbMetadataPath ) )
|
||||
@@ -343,27 +335,16 @@ DESIGN_BLOCK* DESIGN_BLOCK_IO::DesignBlockLoad( const wxString& aLibraryPath,
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
delete newDB;
|
||||
THROW_IO_ERROR( wxString::Format(
|
||||
_( "Design block metadata file '%s' could not be read." ), dbMetadataPath ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return newDB;
|
||||
}
|
||||
|
||||
|
||||
bool DESIGN_BLOCK_IO::DesignBlockExists( const wxString& aLibraryPath,
|
||||
const wxString& aDesignBlockName,
|
||||
const std::map<std::string, UTF8>* aProperties )
|
||||
{
|
||||
wxString dbPath = aLibraryPath + wxFileName::GetPathSeparator() + aDesignBlockName + wxT( "." )
|
||||
+ FILEEXT::KiCadDesignBlockPathExtension + wxFileName::GetPathSeparator();
|
||||
|
||||
return wxDir::Exists( dbPath );
|
||||
}
|
||||
|
||||
|
||||
void DESIGN_BLOCK_IO::DesignBlockSave( const wxString& aLibraryPath,
|
||||
const DESIGN_BLOCK* aDesignBlock,
|
||||
const std::map<std::string, UTF8>* aProperties )
|
||||
@@ -374,23 +355,12 @@ void DESIGN_BLOCK_IO::DesignBlockSave( const wxString& aLibra
|
||||
THROW_IO_ERROR( _( "Design block does not have a valid library ID." ) );
|
||||
}
|
||||
|
||||
if( aDesignBlock->GetSchematicFile().IsEmpty() && aDesignBlock->GetBoardFile().IsEmpty() )
|
||||
{
|
||||
THROW_IO_ERROR( _( "Design block does not have a schematic or board file." ) );
|
||||
}
|
||||
|
||||
wxFileName schematicFile( aDesignBlock->GetSchematicFile() );
|
||||
wxFileName boardFile( aDesignBlock->GetBoardFile() );
|
||||
|
||||
if( !aDesignBlock->GetSchematicFile().IsEmpty() && !schematicFile.FileExists() )
|
||||
if( !schematicFile.FileExists() )
|
||||
{
|
||||
THROW_IO_ERROR(
|
||||
wxString::Format( _( "Schematic source file '%s' does not exist." ), schematicFile.GetFullPath() ) );
|
||||
}
|
||||
|
||||
if( !aDesignBlock->GetBoardFile().IsEmpty() && !boardFile.FileExists() )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "Board source file '%s' does not exist." ), boardFile.GetFullPath() ) );
|
||||
THROW_IO_ERROR( wxString::Format( _( "Schematic source file '%s' does not exist." ),
|
||||
schematicFile.GetFullPath() ) );
|
||||
}
|
||||
|
||||
// Create the design block folder
|
||||
@@ -408,44 +378,23 @@ void DESIGN_BLOCK_IO::DesignBlockSave( const wxString& aLibra
|
||||
}
|
||||
}
|
||||
|
||||
if( !aDesignBlock->GetSchematicFile().IsEmpty() )
|
||||
{
|
||||
// The new schematic file name is based on the design block name, not the source sheet name
|
||||
wxString dbSchematicFile = dbFolder.GetFullPath() + aDesignBlock->GetLibId().GetLibItemName() + wxT( "." )
|
||||
+ FILEEXT::KiCadSchematicFileExtension;
|
||||
// The new schematic file name is based on the design block name, not the source sheet name
|
||||
wxString dbSchematicFile = dbFolder.GetFullPath() + aDesignBlock->GetLibId().GetLibItemName()
|
||||
+ wxT( "." ) + FILEEXT::KiCadSchematicFileExtension;
|
||||
|
||||
// If the source and destination files are the same, then we don't need to copy the file
|
||||
// as we are just updating the metadata
|
||||
if( schematicFile.GetFullPath() != dbSchematicFile )
|
||||
// If the source and destination files are the same, then we don't need to copy the file
|
||||
// as we are just updating the metadata
|
||||
if( schematicFile.GetFullPath() != dbSchematicFile )
|
||||
{
|
||||
// Copy the source sheet file to the design block folder, under the design block name
|
||||
if( !wxCopyFile( schematicFile.GetFullPath(), dbSchematicFile ) )
|
||||
{
|
||||
// Copy the source sheet file to the design block folder, under the design block name
|
||||
if( !wxCopyFile( schematicFile.GetFullPath(), dbSchematicFile ) )
|
||||
{
|
||||
THROW_IO_ERROR(
|
||||
wxString::Format( _( "Schematic file '%s' could not be saved as design block at '%s'." ),
|
||||
schematicFile.GetFullPath(), dbSchematicFile ) );
|
||||
}
|
||||
THROW_IO_ERROR( wxString::Format(
|
||||
_( "Schematic file '%s' could not be saved as design block at '%s'." ),
|
||||
schematicFile.GetFullPath(), dbSchematicFile ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( !aDesignBlock->GetBoardFile().IsEmpty() )
|
||||
{
|
||||
// The new Board file name is based on the design block name, not the source sheet name
|
||||
wxString dbBoardFile = dbFolder.GetFullPath() + aDesignBlock->GetLibId().GetLibItemName() + wxT( "." )
|
||||
+ FILEEXT::KiCadPcbFileExtension;
|
||||
|
||||
// If the source and destination files are the same, then we don't need to copy the file
|
||||
// as we are just updating the metadata
|
||||
if( boardFile.GetFullPath() != dbBoardFile )
|
||||
{
|
||||
// Copy the source sheet file to the design block folder, under the design block name
|
||||
if( !wxCopyFile( boardFile.GetFullPath(), dbBoardFile ) )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "Board file '%s' could not be saved as design block at '%s'." ),
|
||||
boardFile.GetFullPath(), dbBoardFile ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxString dbMetadataFile = dbFolder.GetFullPath() + aDesignBlock->GetLibId().GetLibItemName()
|
||||
+ wxT( "." ) + FILEEXT::JsonFileExtension;
|
||||
|
||||
@@ -76,7 +76,10 @@ public:
|
||||
}
|
||||
|
||||
bool DesignBlockExists( const wxString& aLibraryPath, const wxString& aDesignBlockName,
|
||||
const std::map<std::string, UTF8>* aProperties = nullptr );
|
||||
const std::map<std::string, UTF8>* aProperties = nullptr )
|
||||
{
|
||||
return DesignBlockLoad( aLibraryPath, aDesignBlockName, true, aProperties ) != nullptr;
|
||||
}
|
||||
|
||||
DESIGN_BLOCK* ImportDesignBlock( const wxString& aDesignBlockPath,
|
||||
wxString& aDesignBlockNameOut,
|
||||
|
||||
@@ -73,23 +73,6 @@ void DESIGN_BLOCK_LIB_TABLE_ROW::SetType( const wxString& aType )
|
||||
}
|
||||
|
||||
|
||||
bool DESIGN_BLOCK_LIB_TABLE_ROW::Refresh()
|
||||
{
|
||||
if( !plugin )
|
||||
{
|
||||
wxArrayString dummyList;
|
||||
|
||||
plugin.reset( DESIGN_BLOCK_IO_MGR::FindPlugin( type ) );
|
||||
SetLoaded( false );
|
||||
plugin->DesignBlockEnumerate( dummyList, GetFullURI( true ), true, GetProperties() );
|
||||
SetLoaded( true );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
DESIGN_BLOCK_LIB_TABLE::DESIGN_BLOCK_LIB_TABLE( DESIGN_BLOCK_LIB_TABLE* aFallBackTable ) :
|
||||
LIB_TABLE( aFallBackTable )
|
||||
{
|
||||
@@ -450,7 +433,7 @@ DESIGN_BLOCK_LIB_TABLE::DesignBlockSave( const wxString& aNickname,
|
||||
std::unique_ptr<DESIGN_BLOCK> design_block( row->plugin->DesignBlockLoad(
|
||||
row->GetFullURI( true ), DesignBlockname, row->GetProperties() ) );
|
||||
|
||||
if( design_block )
|
||||
if( design_block.get() )
|
||||
return SAVE_SKIPPED;
|
||||
}
|
||||
|
||||
@@ -554,11 +537,13 @@ public:
|
||||
// consider a directory to be a lib if it's name ends with the design block lib dir
|
||||
// extension it is under $KICADn_3RD_PARTY/design_blocks/<pkgid>/ i.e. has nested
|
||||
// level of at least +3.
|
||||
if( dirPath.EndsWith( wxString::Format( wxS( ".%s" ), FILEEXT::KiCadDesignBlockLibPathExtension ) )
|
||||
if( dirPath.EndsWith( wxString::Format( wxS( ".%s" ),
|
||||
FILEEXT::KiCadDesignBlockLibPathExtension ) )
|
||||
&& dir.GetDirCount() >= m_prefix_dir_count + 3 )
|
||||
{
|
||||
wxString versionedPath;
|
||||
versionedPath.Printf( wxS( "${%s}" ), ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ) );
|
||||
versionedPath.Printf( wxS( "${%s}" ),
|
||||
ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ) );
|
||||
|
||||
wxArrayString parts = dir.GetDirs();
|
||||
parts.RemoveAt( 0, m_prefix_dir_count );
|
||||
@@ -587,9 +572,9 @@ public:
|
||||
} while( m_lib_table.HasLibrary( nickname ) );
|
||||
}
|
||||
|
||||
m_lib_table.InsertRow( new DESIGN_BLOCK_LIB_TABLE_ROW( nickname, libPath, wxT( "KiCad" ),
|
||||
wxEmptyString,
|
||||
_( "Added by Plugin and Content Manager" ) ) );
|
||||
m_lib_table.InsertRow( new DESIGN_BLOCK_LIB_TABLE_ROW(
|
||||
nickname, libPath, wxT( "KiCad" ), wxEmptyString,
|
||||
_( "Added by Plugin and Content Manager" ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,7 +611,8 @@ bool DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable( DESIGN_BLOCK_LIB_TABLE& aTable )
|
||||
SystemDirsAppend( &ss );
|
||||
|
||||
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
|
||||
std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( envVars, wxT( "TEMPLATE_DIR" ) );
|
||||
std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( envVars,
|
||||
wxT( "TEMPLATE_DIR" ) );
|
||||
|
||||
if( v && !v->IsEmpty() )
|
||||
ss.AddPaths( *v, 0 );
|
||||
@@ -645,14 +631,16 @@ bool DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable( DESIGN_BLOCK_LIB_TABLE& aTable )
|
||||
aTable.clear();
|
||||
aTable.Load( fn.GetFullPath() );
|
||||
|
||||
KICAD_SETTINGS* cfg = GetAppSettings<KICAD_SETTINGS>( "kicad" );
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
|
||||
|
||||
const ENV_VAR_MAP& env = Pgm().GetLocalEnvVariables();
|
||||
wxString packagesPath;
|
||||
|
||||
if( std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( env, wxT( "3RD_PARTY" ) ) )
|
||||
packagesPath = *v;
|
||||
|
||||
if( cfg && cfg->m_PcmLibAutoAdd )
|
||||
if( settings->m_PcmLibAutoAdd )
|
||||
{
|
||||
// Scan for libraries in PCM packages directory
|
||||
|
||||
@@ -661,14 +649,15 @@ bool DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable( DESIGN_BLOCK_LIB_TABLE& aTable )
|
||||
|
||||
if( d.DirExists() )
|
||||
{
|
||||
PCM_DESIGN_BLOCK_LIB_TRAVERSER traverser( packagesPath, aTable, cfg->m_PcmLibPrefix );
|
||||
PCM_DESIGN_BLOCK_LIB_TRAVERSER traverser( packagesPath, aTable,
|
||||
settings->m_PcmLibPrefix );
|
||||
wxDir dir( d.GetPath() );
|
||||
|
||||
dir.Traverse( traverser );
|
||||
}
|
||||
}
|
||||
|
||||
if( cfg && cfg->m_PcmLibAutoRemove )
|
||||
if( settings->m_PcmLibAutoRemove )
|
||||
{
|
||||
// Remove PCM libraries that no longer exist
|
||||
std::vector<wxString> to_remove;
|
||||
|
||||
@@ -622,7 +622,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
|
||||
ADD_DEV( wxT( "Nick Østergaard" ), CONTRIB_DEV );
|
||||
ADD_DEV( wxT( "木 王" ), CONTRIB_DEV );
|
||||
ADD_DEV( wxT( "wh201906" ), CONTRIB_DEV );
|
||||
|
||||
// The document writers
|
||||
#define DOC_TEAM _( "Documentation Team" )
|
||||
|
||||
+52
-53
@@ -23,7 +23,6 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <app_monitor.h>
|
||||
#include <dialog_shim.h>
|
||||
#include <core/ignore.h>
|
||||
#include <kiway_player.h>
|
||||
@@ -43,6 +42,43 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
/// Toggle a window's "enable" status to disabled, then enabled on destruction.
|
||||
class WDO_ENABLE_DISABLE
|
||||
{
|
||||
wxWindow* m_win;
|
||||
|
||||
public:
|
||||
|
||||
WDO_ENABLE_DISABLE( wxWindow* aWindow ) :
|
||||
m_win( aWindow )
|
||||
{
|
||||
if( m_win )
|
||||
m_win->Disable();
|
||||
}
|
||||
|
||||
~WDO_ENABLE_DISABLE()
|
||||
{
|
||||
if( m_win )
|
||||
{
|
||||
m_win->Enable();
|
||||
m_win->Raise(); // let's focus back on the parent window
|
||||
}
|
||||
}
|
||||
|
||||
void SuspendForTrueModal()
|
||||
{
|
||||
if( m_win )
|
||||
m_win->Enable();
|
||||
}
|
||||
|
||||
void ResumeAfterTrueModal()
|
||||
{
|
||||
if( m_win )
|
||||
m_win->Disable();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( DIALOG_SHIM, wxDialog )
|
||||
EVT_CHAR_HOOK( DIALOG_SHIM::OnCharHook )
|
||||
END_EVENT_TABLE()
|
||||
@@ -112,9 +148,6 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl
|
||||
#endif
|
||||
|
||||
Bind( wxEVT_PAINT, &DIALOG_SHIM::OnPaint, this );
|
||||
|
||||
wxString msg = wxString::Format( "Opening dialog %s", GetTitle() );
|
||||
APP_MONITOR::AddNavigationBreadcrumb( msg, "dialog.open" );
|
||||
}
|
||||
|
||||
|
||||
@@ -488,7 +521,15 @@ int DIALOG_SHIM::ShowModal()
|
||||
|
||||
int DIALOG_SHIM::ShowQuasiModal()
|
||||
{
|
||||
NULLER raii_nuller( (void*&) m_qmodal_loop );
|
||||
// This is an exception safe way to zero a pointer before returning.
|
||||
// Yes, even though DismissModal() clears this first normally, this is
|
||||
// here in case there's an exception before the dialog is dismissed.
|
||||
struct NULLER
|
||||
{
|
||||
void*& m_what;
|
||||
NULLER( void*& aPtr ) : m_what( aPtr ) {}
|
||||
~NULLER() { m_what = nullptr; } // indeed, set it to NULL on destruction
|
||||
} clear_this( (void*&) m_qmodal_loop );
|
||||
|
||||
// release the mouse if it's currently captured as the window having it
|
||||
// will be disabled when this dialog is shown -- but will still keep the
|
||||
@@ -504,7 +545,7 @@ int DIALOG_SHIM::ShowQuasiModal()
|
||||
"window?" ) );
|
||||
|
||||
// quasi-modal: disable only my "optimal" parent
|
||||
m_qmodal_parent_disabler = new WINDOW_DISABLER( parent );
|
||||
m_qmodal_parent_disabler = new WDO_ENABLE_DISABLE( parent );
|
||||
|
||||
// Apple in its infinite wisdom will raise a disabled window before even passing
|
||||
// us the event, so we have no way to stop it. Instead, we must set an order on
|
||||
@@ -569,6 +610,8 @@ void DIALOG_SHIM::EndQuasiModal( int retCode )
|
||||
m_qmodal_loop->Exit( 0 );
|
||||
else
|
||||
m_qmodal_loop->ScheduleExit( 0 );
|
||||
|
||||
m_qmodal_loop = nullptr;
|
||||
}
|
||||
|
||||
delete m_qmodal_parent_disabler;
|
||||
@@ -580,9 +623,6 @@ void DIALOG_SHIM::EndQuasiModal( int retCode )
|
||||
|
||||
void DIALOG_SHIM::OnCloseWindow( wxCloseEvent& aEvent )
|
||||
{
|
||||
wxString msg = wxString::Format( "Closing dialog %s", GetTitle() );
|
||||
APP_MONITOR::AddNavigationBreadcrumb( msg, "dialog.close" );
|
||||
|
||||
if( IsQuasiModal() )
|
||||
{
|
||||
EndQuasiModal( wxID_CANCEL );
|
||||
@@ -658,50 +698,9 @@ void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
|
||||
return;
|
||||
}
|
||||
}
|
||||
// shift-return (Mac default) or Ctrl-Return (GTK) for new line input
|
||||
else if( ( aEvt.GetKeyCode() == WXK_RETURN || aEvt.GetKeyCode() == WXK_NUMPAD_ENTER ) && aEvt.ShiftDown() )
|
||||
{
|
||||
wxObject* eventSource = aEvt.GetEventObject();
|
||||
|
||||
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( eventSource ) )
|
||||
{
|
||||
// If the text control is not multi-line, we want to close the dialog
|
||||
if( !textCtrl->IsMultiLine() )
|
||||
{
|
||||
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined( __WXMAC__ ) || defined( __WXMSW__ )
|
||||
wxString eol = "\r\n";
|
||||
#else
|
||||
wxString eol = "\n";
|
||||
#endif
|
||||
|
||||
long pos = textCtrl->GetInsertionPoint();
|
||||
textCtrl->WriteText( eol );
|
||||
textCtrl->SetInsertionPoint( pos + eol.length() );
|
||||
return;
|
||||
}
|
||||
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( eventSource ) )
|
||||
{
|
||||
wxString eol = "\n";
|
||||
switch( scintilla->GetEOLMode() )
|
||||
{
|
||||
case wxSTC_EOL_CRLF: eol = "\r\n"; break;
|
||||
case wxSTC_EOL_CR: eol = "\r"; break;
|
||||
case wxSTC_EOL_LF: eol = "\n"; break;
|
||||
}
|
||||
|
||||
long pos = scintilla->GetCurrentPos();
|
||||
scintilla->InsertText( pos, eol );
|
||||
scintilla->GotoPos( pos + eol.length() );
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
// command-return (Mac default) or Ctrl-Return (GTK) for OK
|
||||
else if( ( aEvt.GetKeyCode() == WXK_RETURN || aEvt.GetKeyCode() == WXK_NUMPAD_ENTER ) && aEvt.ControlDown() )
|
||||
// shift-return (Mac default) or Ctrl-Return (GTK) for OK
|
||||
else if( ( aEvt.GetKeyCode() == WXK_RETURN || aEvt.GetKeyCode() == WXK_NUMPAD_ENTER )
|
||||
&& ( aEvt.ShiftDown() || aEvt.ControlDown() ) )
|
||||
{
|
||||
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
|
||||
return;
|
||||
|
||||
@@ -423,9 +423,8 @@ void DIALOG_COLOR_PICKER::drawRGBPalette()
|
||||
// Use Y axis from bottom to top and origin to center
|
||||
bitmapDC.SetAxisOrientation( true, true );
|
||||
|
||||
#if defined( __WXMSW__ ) && !wxCHECK_VERSION( 3, 3, 0 )
|
||||
#if defined( __WXMSW__ )
|
||||
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
|
||||
// It was fixed in wx >= 3.3
|
||||
bitmapDC.SetDeviceOrigin( half_size, -half_size );
|
||||
#else
|
||||
bitmapDC.SetDeviceOrigin( half_size, half_size );
|
||||
@@ -497,9 +496,8 @@ void DIALOG_COLOR_PICKER::drawHSVPalette()
|
||||
|
||||
// Use Y axis from bottom to top and origin to center
|
||||
bitmapDC.SetAxisOrientation( true, true );
|
||||
#if defined( __WXMSW__ ) && !wxCHECK_VERSION(3,3,0)
|
||||
#if defined( __WXMSW__)
|
||||
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
|
||||
// It was fixed in wx >= 3.3
|
||||
bitmapDC.SetDeviceOrigin( half_size, -half_size );
|
||||
#else
|
||||
bitmapDC.SetDeviceOrigin( half_size, half_size );
|
||||
|
||||
@@ -82,6 +82,9 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent ) :
|
||||
attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, m_EnvVars, &m_curdir, wxEmptyString ) );
|
||||
m_EnvVars->SetColAttr( TV_VALUE_COL, attr );
|
||||
|
||||
// Give a bit more room for combobox editors
|
||||
m_EnvVars->SetDefaultRowSize( m_EnvVars->GetDefaultRowSize() + FromDIP( 4 ) );
|
||||
|
||||
m_EnvVars->PushEventHandler( new GRID_TRICKS( m_EnvVars,
|
||||
[this]( wxCommandEvent& aEvent )
|
||||
{
|
||||
|
||||
@@ -1,735 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="18"/>
|
||||
<object class="Project" expanded="true">
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="cpp_class_decoration"></property>
|
||||
<property name="cpp_disconnect_events">1</property>
|
||||
<property name="cpp_event_generation">connect</property>
|
||||
<property name="cpp_help_provider">none</property>
|
||||
<property name="cpp_namespace"></property>
|
||||
<property name="cpp_precompiled_header"></property>
|
||||
<property name="cpp_use_array_enum">0</property>
|
||||
<property name="cpp_use_enum">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="file">dialog_group_properties_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="lua_skip_events">1</property>
|
||||
<property name="lua_ui_table">UI</property>
|
||||
<property name="name">dialog_group_properties</property>
|
||||
<property name="path">.</property>
|
||||
<property name="php_disconnect_events">0</property>
|
||||
<property name="php_disconnect_mode">source_name</property>
|
||||
<property name="php_skip_events">1</property>
|
||||
<property name="python_disconnect_events">0</property>
|
||||
<property name="python_disconnect_mode">source_name</property>
|
||||
<property name="python_image_path_wrapper_function_name"></property>
|
||||
<property name="python_indent_with_spaces"></property>
|
||||
<property name="python_skip_events">1</property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<property name="use_native_eol">0</property>
|
||||
<object class="Dialog" expanded="true">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center">wxBOTH</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_GROUP_PROPERTIES_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Group Properties</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="two_step_creation">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnClose">onClose</event>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerMain</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerUpper</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxFlexGridSizer" expanded="true">
|
||||
<property name="cols">2</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">1</property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">fgSizer1</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">0</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Group name:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_nameLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_nameCtrl</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Library link:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_libraryLinkLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_libraryLink</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Locked</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_locked</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Prevents group from being moved on canvas</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Group members:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_membersLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxListBox" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices"></property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">360,200</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_membersList</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnListBox">OnMemberSelected</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bMembershipButtons</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">MyButton</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bpAddMember</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnAddMember</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="true">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">10</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">MyButton</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bpRemoveMember</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnRemoveMember</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="true">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">1</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
<property name="Help">0</property>
|
||||
<property name="No">0</property>
|
||||
<property name="OK">1</property>
|
||||
<property name="Save">0</property>
|
||||
<property name="Yes">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
||||
@@ -60,17 +60,11 @@ void DIALOG_LOCKED_ITEMS_QUERY::onOverrideLocks( wxCommandEvent& event )
|
||||
|
||||
int DIALOG_LOCKED_ITEMS_QUERY::ShowModal()
|
||||
{
|
||||
static int doNotShowValue = wxID_ANY;
|
||||
|
||||
if( doNotShowValue != wxID_ANY && m_lockingOptions.m_sessionSkipPrompts )
|
||||
return doNotShowValue;
|
||||
|
||||
int ret = DIALOG_SHIM::ShowModal();
|
||||
|
||||
// Has the user asked not to show the dialog again this session?
|
||||
if( m_doNotShowBtn->IsChecked() && ret != wxID_CANCEL )
|
||||
{
|
||||
doNotShowValue = ret;
|
||||
m_lockingOptions.m_sessionSkipPrompts = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ DIALOG_LOCKED_ITEMS_QUERY_BASE::DIALOG_LOCKED_ITEMS_QUERY_BASE( wxWindow* parent
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_messageLine1 = new wxStaticText( this, wxID_ANY, _("The selection contains %zu locked items."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_messageLine1 = new wxStaticText( this, wxID_ANY, _("The selection contains %lu locked items."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_messageLine1->Wrap( -1 );
|
||||
bSizer4->Add( m_messageLine1, 0, wxALL, 5 );
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">The selection contains %zu locked items.</property>
|
||||
<property name="label">The selection contains %lu locked items.</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
||||
@@ -474,16 +474,23 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
|
||||
wxString msg;
|
||||
wxString fileName = GetWksFileName();
|
||||
|
||||
wxString fullFileName = m_filenameResolver->ResolvePath( fileName, m_projectPath, { m_embeddedFiles } );
|
||||
|
||||
BASE_SCREEN::m_DrawingSheetFileName = fileName;
|
||||
|
||||
if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( fullFileName, &msg ) )
|
||||
if( fileName != BASE_SCREEN::m_DrawingSheetFileName )
|
||||
{
|
||||
DisplayErrorMessage( this, wxString::Format( _( "Error loading drawing sheet '%s'." ), fullFileName ), msg );
|
||||
}
|
||||
wxString fullFileName = m_filenameResolver->ResolvePath( fileName, m_projectPath,
|
||||
m_embeddedFiles );
|
||||
|
||||
m_localPrjConfigChanged = true;
|
||||
BASE_SCREEN::m_DrawingSheetFileName = fileName;
|
||||
|
||||
if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( fullFileName, &msg ) )
|
||||
{
|
||||
DisplayErrorMessage( this,
|
||||
wxString::Format( _( "Error loading drawing sheet '%s'." ),
|
||||
fullFileName ),
|
||||
msg );
|
||||
}
|
||||
|
||||
m_localPrjConfigChanged = true;
|
||||
}
|
||||
|
||||
int idx = std::max( m_paperSizeComboBox->GetSelection(), 0 );
|
||||
const wxString paperType = m_pageFmt[idx];
|
||||
@@ -816,7 +823,7 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
|
||||
if( m_embeddedFiles && customize.GetEmbed() )
|
||||
{
|
||||
fn.Assign( fileName );
|
||||
EMBEDDED_FILES::EMBEDDED_FILE* result = m_embeddedFiles->AddFile( fn, true );
|
||||
EMBEDDED_FILES::EMBEDDED_FILE* result = m_embeddedFiles->AddFile( fn, false );
|
||||
shortFileName = result->GetLink();
|
||||
fileName = m_embeddedFiles->GetTemporaryFileName( result->name ).GetFullPath();
|
||||
}
|
||||
|
||||
@@ -39,19 +39,22 @@
|
||||
|
||||
|
||||
DIALOG_PLUGIN_OPTIONS::DIALOG_PLUGIN_OPTIONS( wxWindow* aParent,
|
||||
const wxString& aNickname,
|
||||
const std::map<std::string, UTF8>& aPluginOptions,
|
||||
const wxString& aFormattedOptions,
|
||||
wxString* aResult ) :
|
||||
DIALOG_PLUGIN_OPTIONS_BASE( aParent ),
|
||||
m_callers_options( aFormattedOptions ),
|
||||
m_result( aResult ),
|
||||
m_choices( aPluginOptions ),
|
||||
m_initial_help( INITIAL_HELP ),
|
||||
m_grid_widths_dirty( true )
|
||||
const wxString& aNickname,
|
||||
const std::map<std::string, UTF8>& aPluginOptions,
|
||||
const wxString& aFormattedOptions,
|
||||
wxString* aResult ) :
|
||||
DIALOG_PLUGIN_OPTIONS_BASE( aParent ),
|
||||
m_callers_options( aFormattedOptions ),
|
||||
m_result( aResult ),
|
||||
m_choices( aPluginOptions ),
|
||||
m_initial_help( INITIAL_HELP ),
|
||||
m_grid_widths_dirty( true )
|
||||
{
|
||||
SetTitle( wxString::Format( _( "Options for Library '%s'" ), aNickname ) );
|
||||
|
||||
// Give a bit more room for combobox editors
|
||||
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
|
||||
|
||||
m_grid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
|
||||
|
||||
// add Cut, Copy, and Paste to wxGrid
|
||||
@@ -62,7 +65,8 @@ DIALOG_PLUGIN_OPTIONS::DIALOG_PLUGIN_OPTIONS( wxWindow* aParent,
|
||||
{
|
||||
unsigned int row = 0;
|
||||
|
||||
for( std::map<std::string, UTF8>::const_iterator it = m_choices.begin(); it != m_choices.end(); ++it, ++row )
|
||||
for( std::map<std::string, UTF8>::const_iterator it = m_choices.begin();
|
||||
it != m_choices.end(); ++it, ++row )
|
||||
{
|
||||
wxString item = From_UTF8( it->first.c_str() );
|
||||
|
||||
@@ -107,7 +111,8 @@ bool DIALOG_PLUGIN_OPTIONS::TransferDataToWindow()
|
||||
|
||||
int row = 0;
|
||||
|
||||
for( std::map<std::string, UTF8>::const_iterator it = props->begin(); it != props->end(); ++it, ++row )
|
||||
for( std::map<std::string, UTF8>::const_iterator it = props->begin(); it != props->end();
|
||||
++it, ++row )
|
||||
{
|
||||
m_grid->SetCellValue( row, 0, From_UTF8( it->first.c_str() ) );
|
||||
m_grid->SetCellValue( row, 1, it->second );
|
||||
@@ -137,7 +142,9 @@ bool DIALOG_PLUGIN_OPTIONS::TransferDataFromWindow()
|
||||
UTF8 value = m_grid->GetCellValue( row, 1 ).Trim( false ).Trim();
|
||||
|
||||
if( name.size() )
|
||||
{
|
||||
props[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
*m_result = LIB_TABLE::FormatOptions( &props ).wx_str();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user