Compare commits
455 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 61a17e4c8b | |||
| 67dda92437 | |||
| 4dfe564243 | |||
| 5b3c0028ea | |||
| 53d219e9d5 | |||
| a4da356ac7 | |||
| 2915a9d1a2 | |||
| 6778eb8352 | |||
| bdf8c04daf | |||
| a32ca5d0c4 | |||
| 992bee7ec9 | |||
| 7216527224 | |||
| 09bbabeef3 | |||
| 3ee74e2966 | |||
| 312356c284 | |||
| 6b9dba3d45 | |||
| 02c03ba2b6 | |||
| c35ba8f4cd | |||
| c344e170b9 | |||
| 5b5253b6e2 | |||
| 2954378f58 | |||
| eea71b9209 | |||
| 8eb98a2094 | |||
| 85d9feefff | |||
| c059cbce12 | |||
| a84aa449b2 | |||
| a4a2ec07c4 | |||
| d5557caa33 | |||
| 47717ca779 | |||
| d7f742f911 | |||
| 86ebc85404 | |||
| 5d4ed4b21a | |||
| 1ca0737c34 | |||
| 3a29fa44e3 | |||
| 3517d25aec | |||
| 8d62a5fd3f | |||
| 9e5876df5c | |||
| fdc3806ed1 | |||
| 798b827a12 | |||
| 4ade0ac73d | |||
| 65fd8d22ed | |||
| 481c1592ae | |||
| 9af12e60d2 | |||
| 048448296d | |||
| e03308e5ca | |||
| 16691c8d03 | |||
| dac0296e3a | |||
| 52ce4c0313 | |||
| 1956204635 | |||
| b4bd14ba10 | |||
| 8f7f6739c3 | |||
| 4eebd8ad6c | |||
| 4b3d67ffda | |||
| f3e3236a43 | |||
| 82ee4a81ed | |||
| 55fbdddbb7 | |||
| 7cce1901b2 | |||
| 0f4f1c0d3b | |||
| 78849ba5c0 | |||
| a066c57fcc | |||
| 8684c0f9be | |||
| db94f8c8ef | |||
| db0f7ec457 | |||
| 2bf4cca58a | |||
| 4470f4e6d8 | |||
| e516ab5114 | |||
| 0282b142b8 | |||
| 676108952e | |||
| 8470091a4b | |||
| 3302ef537f | |||
| 366f7aea6b | |||
| eed2221651 | |||
| 90093c0fdd | |||
| 2adccce3b8 | |||
| 6bf9653bef | |||
| 04c083ac48 | |||
| 9a236e5972 | |||
| 521e773f2c | |||
| e28aa6d16c | |||
| 001c90c69f | |||
| cba73e6cea | |||
| 5af4f3f9df | |||
| e1b922ae19 | |||
| f1d988788a | |||
| 8e6cb7b350 | |||
| 6685eefc8e | |||
| 8d231b8c96 | |||
| 313e09cfd3 | |||
| 5a05a1337e | |||
| a40929fa71 | |||
| 37eb5f4a8d | |||
| b7d1fb944c | |||
| 9797d2d133 | |||
| e34bb98ba1 | |||
| 60440094ba | |||
| c198e5ee15 | |||
| ceedfd9b7e | |||
| a4fbbaaa0b | |||
| 6cbdac5bf1 | |||
| 26629928c3 | |||
| 55c864ec45 | |||
| 07b5fd342a | |||
| 4481fcc75e | |||
| a155dd32e8 | |||
| c4c804edf7 | |||
| b26ca0e21a | |||
| 97b15a1708 | |||
| e808ab7409 | |||
| 7dc8527022 | |||
| f7765ea5b9 | |||
| f1d687cfdb | |||
| 57468c29f9 | |||
| 30df673ffa | |||
| 55b7852a65 | |||
| 026685ee48 | |||
| 8b5c292397 | |||
| 941420abed | |||
| a042d1aab4 | |||
| 53c2543474 | |||
| bac0820864 | |||
| e0381f25f7 | |||
| ce2ea3f3ae | |||
| c0d38de280 | |||
| 9a728c37df | |||
| 6be6210b67 | |||
| b21165722b | |||
| fd5d68ca9b | |||
| 9f26cbb89a | |||
| 0dc894356b | |||
| 6b5acdea1f | |||
| 892c5726f5 | |||
| 6c7261a223 | |||
| ae11213622 | |||
| 4bf35cbed8 | |||
| 7916e56963 | |||
| b9b4ff6f5e | |||
| 734222bd88 | |||
| 01590385c7 | |||
| 9be4bf0d14 | |||
| b1677d5f47 | |||
| 1e13a7640e | |||
| 804283877c | |||
| 65ace8d03d | |||
| 890376d04f | |||
| 18990587b9 | |||
| 75ef003747 | |||
| b9a6f47929 | |||
| 857219d70d | |||
| 92275c41cc | |||
| 09985988e7 | |||
| 524d431438 | |||
| ccd052cc99 | |||
| 1f461c7508 | |||
| 4bea619855 | |||
| f3621496fb | |||
| 1238c081c6 | |||
| 663e857df6 | |||
| 92ffd898f5 | |||
| 76e0f94532 | |||
| ff2d0cfb10 | |||
| 1cc10be443 | |||
| d2db96886d | |||
| 3d4a7c7c3f | |||
| d46139d5e3 | |||
| 40f938dc75 | |||
| 30dbafaf7c | |||
| 05dedbd892 | |||
| c0dba1e00d | |||
| cc3e57b52f | |||
| 70a6697c16 | |||
| 869f30e291 | |||
| 4c78652690 | |||
| afcda88ee3 | |||
| 605fe4ce99 | |||
| a3ee317277 | |||
| f7bce264bb | |||
| dfe6cb7afa | |||
| 8bdc62c111 | |||
| 350687f355 | |||
| 3a5a911012 | |||
| b40d19eb79 | |||
| 3e4ca3a1c7 | |||
| 663918107e | |||
| 1ac1f0445f | |||
| bce982877c | |||
| 9704543b7a | |||
| f90c3ef075 | |||
| 11177bf658 | |||
| 81f55dfc9c | |||
| c935ef890a | |||
| 71af5b106a | |||
| d24012bef5 | |||
| e904731e28 | |||
| dcd304c5d8 | |||
| 8275176792 | |||
| 8589bd3773 | |||
| c07604bb03 | |||
| b4131f2575 | |||
| b718c228fe | |||
| 3d04d78f76 | |||
| 6ebccdecc6 | |||
| 4e8d6de1de | |||
| 8b281b4d1c | |||
| 8ce12fb1af | |||
| 9e4efe5d72 | |||
| ab6c64b49a | |||
| dd71173263 | |||
| 89ed09744b | |||
| ddec1d5317 | |||
| 50dd6185bb | |||
| 6df17bba99 | |||
| ed89827908 | |||
| b61f6c35c7 | |||
| f9253485da | |||
| 7dc554ec34 | |||
| c7608c4bad | |||
| 10ca34e2a7 | |||
| e4fc918b11 | |||
| c1a21c9ab1 | |||
| 4ac848f18a | |||
| 46faa0f678 | |||
| 4072bc05af | |||
| e196f71d58 | |||
| b9d3b571bc | |||
| 816e3efbd5 | |||
| 8afbe544a3 | |||
| c7b7830495 | |||
| af3654d389 | |||
| 838cefaf48 | |||
| 4dca966c5d | |||
| 2609882346 | |||
| 36fc9191b9 | |||
| 4583522ea2 | |||
| f0e2adc3df | |||
| 091b34c05f | |||
| 09bc9cd77a | |||
| e893ed4590 | |||
| c0ad519e53 | |||
| 03af8dcc88 | |||
| 45e17307a1 | |||
| 357226eb71 | |||
| ac408046cf | |||
| 1b3cf70eef | |||
| d295014a8c | |||
| c0fd138706 | |||
| 2af35ac4f1 | |||
| b7a193dc3a | |||
| 79e264249c | |||
| 51d335c0e8 | |||
| 2f010e77ea | |||
| 848dbb4d43 | |||
| 6384e7aea5 | |||
| 519e7bbfd4 | |||
| 1ad15075f8 | |||
| e21b4517d6 | |||
| 31c756addb | |||
| 4ea53e045b | |||
| 4ceb03a9ce | |||
| d0b840697b | |||
| 57b6e5cb85 | |||
| fb3790398d | |||
| 2a3e2d8f9f | |||
| 0f260d51c5 | |||
| 28afbe37ec | |||
| 13aafe828f | |||
| 1769b565f7 | |||
| a4ecb998aa | |||
| a54af04f4e | |||
| 4a260f74fa | |||
| 984c777286 | |||
| 33ced12295 | |||
| be6d07e962 | |||
| d0de1723ed | |||
| 39378fec87 | |||
| e8bf38fb24 | |||
| d27f17cef8 | |||
| c43892814e | |||
| 41b8e704b7 | |||
| b55c04ddfa | |||
| 587c9f8a27 | |||
| a8768b7a20 | |||
| 10e8dfaca5 | |||
| f2d9df65ff | |||
| 749ada552e | |||
| 044e7090be | |||
| 3a2b633e28 | |||
| 6ced4f72d0 | |||
| 0f8dac81cb | |||
| 1f1b97212b | |||
| aff3064187 | |||
| d1867bd728 | |||
| 1b5e18d95f | |||
| b57184efe0 | |||
| 8a66a7eab0 | |||
| e769fdfab0 | |||
| 31ae825b9d | |||
| 98d26e77c9 | |||
| 03120161d3 | |||
| ec7abb7bff | |||
| fa2ccdd083 | |||
| 4096c073b7 | |||
| 2ad3ccc4d8 | |||
| 3bab589405 | |||
| fab52bd95a | |||
| 27e4b2276b | |||
| 64f8310a94 | |||
| e765de6b3d | |||
| 742529da26 | |||
| b728eae651 | |||
| 676e70ec18 | |||
| 13fabb0564 | |||
| 4dc4b2bd51 | |||
| 32e6f424ec | |||
| 3890278505 | |||
| 1664e02fa6 | |||
| 63ffca0173 | |||
| ff4b59afeb | |||
| 64382a85fa | |||
| 4c51391cf6 | |||
| 5add7a0ca0 | |||
| 8340779f5b | |||
| 01cc91850c | |||
| 091f9c82e1 | |||
| f7ddd211d9 | |||
| 8dce6c0b67 | |||
| 655cee523b | |||
| fa4d759fcb | |||
| 25b033df2a | |||
| a0905ac87d | |||
| 3d67ab72c6 | |||
| ecb0c9b5d4 | |||
| 53d8e2c8c3 | |||
| 22f66fdf2f | |||
| a7c09964ba | |||
| 1e03266dfe | |||
| 09f32d8c86 | |||
| 67208df602 | |||
| 8047eed6f8 | |||
| dafd62ddba | |||
| 41f9baf9dc | |||
| 1cd5827078 | |||
| b07d43a24a | |||
| 985c3ad92a | |||
| 978fa63490 | |||
| c59fac4089 | |||
| 0dab086f0c | |||
| 7d1adff071 | |||
| 38df918993 | |||
| f45df48498 | |||
| 898b5bd992 | |||
| 100023e36f | |||
| d8ca6eda7e | |||
| 4d02817415 | |||
| ef281317ee | |||
| 16ea51fe5c | |||
| b70ff8a120 | |||
| b3572c4ba2 | |||
| b8859df610 | |||
| a26ed45b55 | |||
| cd3c2899d8 | |||
| 74f1fadcf2 | |||
| 6de3859d2c | |||
| 04440d8506 | |||
| 9508b79cc3 | |||
| bec068324e | |||
| b4e993e6e8 | |||
| 57b9b1b6b6 | |||
| fce4ec6a9b | |||
| c4a7af8a47 | |||
| d359fb8ab9 | |||
| 5618a6925d | |||
| e383c67e7f | |||
| 12dcdc8bbe | |||
| bbd4cfd3d4 | |||
| a9e6031ae6 | |||
| 0b5c0ef639 | |||
| 60dbd0ce0d | |||
| 1fc79b9a46 | |||
| aba24ec781 | |||
| 952c154422 | |||
| ffa1d19216 | |||
| 5b303b268f | |||
| 50c5b56781 | |||
| 35192f5bd4 | |||
| d84a5e6f03 | |||
| d94b0771ca | |||
| 2f8f7c11f1 | |||
| 81c22542e4 | |||
| c1755835eb | |||
| 11593a7c04 | |||
| 46555ab975 | |||
| 74339e9a9f | |||
| 2b09653abb | |||
| 1c639714f3 | |||
| 45910bc7c1 | |||
| 87944e06ac | |||
| b37c7afa8a | |||
| 5713384f35 | |||
| 99f9941067 | |||
| 339646a267 | |||
| 97ff48b426 | |||
| badc4e7411 | |||
| 764de7257f | |||
| 14d71c8ca6 | |||
| 7d5583f687 | |||
| ffd470d94d | |||
| 0184dfb625 | |||
| 711c6141a8 | |||
| fdf38256e8 | |||
| 7eeb1a19cf | |||
| e68df8e1d1 | |||
| 3e26e7b646 | |||
| a13e4e7d9f | |||
| 6feafedfbe | |||
| ed115075ce | |||
| be51c2ba73 | |||
| 78b38cc75f | |||
| c8495d81bb | |||
| 6aaf2411f6 | |||
| 3f47e03317 | |||
| 9004f92689 | |||
| a928299ae0 | |||
| 1a7237f38b | |||
| b3b6637b44 | |||
| ad311c33c6 | |||
| adae4de438 | |||
| c8b06d54cb | |||
| 51848a0b43 | |||
| 2d7f4faf72 | |||
| c75bb5d01a | |||
| df8f043c16 | |||
| 01d668c09d | |||
| f4a3613561 | |||
| 12922d9434 | |||
| b6036f368e | |||
| 25291d6e3a | |||
| f4a085575a | |||
| a34b242f4e | |||
| 8a3cbce8f8 | |||
| a9c4a17c38 | |||
| 1a7152d3eb | |||
| 08da9a4494 | |||
| baaed8ed84 | |||
| 7446fba70a | |||
| d36f189192 | |||
| 152c458b9c | |||
| 7ae14f9630 | |||
| a610542a19 | |||
| 2ab492474e | |||
| 3caede3799 | |||
| 9d40374baf | |||
| 0ead8a14a1 | |||
| e8b16fc64f | |||
| 162e8962f7 | |||
| fc66cb6805 |
+2
-6
@@ -17,6 +17,8 @@ include/fp_lib_table_lexer.h
|
||||
include/lib_table_lexer.h
|
||||
include/netlist_lexer.h
|
||||
include/page_layout_reader_lexer.h
|
||||
eeschema/cmp_library_lexer.h
|
||||
eeschema/cmp_library_keywords.*
|
||||
eeschema/dialogs/dialog_bom_cfg_keywords.cpp
|
||||
eeschema/dialogs/dialog_bom_cfg_lexer.h
|
||||
common/template_fieldnames_keywords.cpp
|
||||
@@ -101,9 +103,7 @@ __pycache__
|
||||
.editorconfig
|
||||
CMakeSettings.json
|
||||
.vscode/
|
||||
compile_commands.json
|
||||
/vcpkg_installed
|
||||
CMakePresets.json
|
||||
|
||||
# Sublime Text
|
||||
*.sublime-*
|
||||
@@ -112,10 +112,6 @@ CMakePresets.json
|
||||
.kdev4/
|
||||
*.kdev4
|
||||
|
||||
# Qt Creator
|
||||
CMakeLists.txt.user
|
||||
*.autosave
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
i18n_status.svg
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
-DKICAD_BUILD_I18N=ON
|
||||
-DKICAD_TEST_XML_OUTPUT=ON
|
||||
-DKICAD_BUILD_PNS_DEBUG_TOOL=ON
|
||||
-DKICAD_USE_CMAKE_FINDPROTOBUF=ON
|
||||
../../
|
||||
- ninja 2>&1 | tee compilation_log.txt
|
||||
- cd ../../
|
||||
@@ -40,7 +39,6 @@
|
||||
when: always
|
||||
paths:
|
||||
- build/linux/3d-viewer/
|
||||
- build/linux/api/libkiapi.so*
|
||||
- build/linux/common/libkicommon.so*
|
||||
- build/linux/common/gal/libkigal.so*
|
||||
- build/linux/eeschema/_eeschema.kiface
|
||||
@@ -65,8 +63,6 @@ fedora_build_linux_kicad:
|
||||
|
||||
fedora_build_linux_public:
|
||||
extends: .fedora_build_linux_base
|
||||
tags:
|
||||
- saas-linux-medium-amd64
|
||||
except:
|
||||
variables:
|
||||
- $CI_PROJECT_ROOT_NAMESPACE == "kicad"
|
||||
@@ -154,7 +150,7 @@ fedora_report_metrics_public:
|
||||
parallel:
|
||||
matrix:
|
||||
# The name of the test without the qa_ prefix
|
||||
- TEST: [python, cli, common, gerbview, pcbnew, pns_regressions, eeschema, kimath, sexpr, kicad2step, spice, api]
|
||||
- TEST: [python, cli, common, gerbview, pcbnew, pns_regressions, eeschema, kimath, sexpr, kicad2step, spice]
|
||||
|
||||
fedora_qa_kicad:
|
||||
extends: .fedora_qa
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ build_doxygen_docker:
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULED_JOB_NAME == "doxygen"
|
||||
tags:
|
||||
- gitlab-org-docker
|
||||
- docker
|
||||
before_script:
|
||||
- docker info
|
||||
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
|
||||
|
||||
+19
-1
@@ -15,7 +15,25 @@ macos_build:
|
||||
- cd build/macos
|
||||
- cmake
|
||||
-G Ninja
|
||||
-DCMAKE_TOOLCHAIN_FILE=/Users/ci/kicad-mac-builder/toolchain/kicad-mac-builder.cmake
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
-DDEFAULT_INSTALL_PATH=/Library/Application\ Support /kicad
|
||||
-DOCC_INCLUDE_DIR=/opt/homebrew/Cellar/opencascade/7.7.2_2/include/opencascade
|
||||
-DOCC_LIBRARY_DIR=/opt/homebrew/Cellar/opencascade/7.7.2_2/Lib
|
||||
-DCMAKE_INSTALL_PREFIX=/Users/ci/kicad-mac-builder/build/kicad-dest
|
||||
-DCMAKE_C_COMPILER=/usr/bin/clang
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/clang++
|
||||
-DwxWidgets_CONFIG_EXECUTABLE=/Users/ci/kicad-mac-builder/build/wxwidgets-dest/bin/wx-config
|
||||
-DKICAD_BUILD_I18N=ON
|
||||
-DKICAD_SCRIPTING_WXPYTHON=ON
|
||||
-DKICAD_BUILD_PNS_DEBUG_TOOL=ON
|
||||
-DPYTHON_EXECUTABLE=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/bin/python3
|
||||
-DPYTHON_INCLUDE_DIR=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/include/python3.9/
|
||||
-DPYTHON_LIBRARY=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/lib/libpython3.9.dylib
|
||||
-DPYTHON_SITE_PACKAGE_PATH=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/lib/python3.9/site-packages
|
||||
-DPYTHON_FRAMEWORK=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework
|
||||
-DNGSPICE_INCLUDE_DIR=/Users/ci/kicad-mac-builder/build/ngspice-dest/include
|
||||
-DNGSPICE_LIBRARY=/Users/ci/kicad-mac-builder/build/ngspice-dest/lib/libngspice.dylib
|
||||
-DKICAD_USE_3DCONNEXION=ON
|
||||
../../
|
||||
- cmake --build . 2>&1 | tee compilation_log.txt
|
||||
- cd ../../
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
stage: test
|
||||
when: on_success
|
||||
variables:
|
||||
BOOST_TEST_LOGGER: 'JUNIT,warning,test_results.${TEST}.xml:HRF,message'
|
||||
BOOST_TEST_LOGGER: 'JUNIT,warning,test_results.${TEST}.xml:HRF,warning'
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
script:
|
||||
- cd build/linux/qa
|
||||
|
||||
@@ -155,47 +155,13 @@ void S3D_PLUGIN_MANAGER::loadPlugins( void )
|
||||
fn.AssignDir( PATHS::GetStockPlugins3DPath() );
|
||||
checkPluginPath( std::string( fn.GetPathWithSep().ToUTF8() ), searchpaths );
|
||||
#else
|
||||
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
|
||||
{
|
||||
// Exe will be at <build_dir>/pcbnew/pcbnew.app/Contents/MacOS/pcbnew for standalone
|
||||
// Plugin will be at <build_dir>/kicad/KiCad.app/Contents/PlugIns/3d
|
||||
fn.Assign( wxStandardPaths::Get().GetExecutablePath() );
|
||||
// Search path on OS X is
|
||||
// (1) Machine /Library/Application Support/kicad/PlugIns/3d
|
||||
checkPluginPath( PATHS::GetOSXKicadMachineDataDir() + wxT( "/PlugIns/3d" ), searchpaths );
|
||||
|
||||
if( fn.GetName() == wxT( "kicad" ) )
|
||||
{
|
||||
fn.AppendDir( wxT( ".." ) ); // Contents
|
||||
}
|
||||
else
|
||||
{
|
||||
fn.AppendDir( wxT( ".." ) ); // Contents
|
||||
fn.AppendDir( wxT( ".." ) ); // pcbnew.app
|
||||
fn.AppendDir( wxT( ".." ) ); // pcbnew
|
||||
fn.AppendDir( wxT( ".." ) ); // Build root
|
||||
fn.AppendDir( wxT( "kicad" ) );
|
||||
fn.AppendDir( wxT( "KiCad.app" ) );
|
||||
fn.AppendDir( wxT( "Contents" ) );
|
||||
}
|
||||
|
||||
fn.AppendDir( wxT( "PlugIns" ) );
|
||||
fn.AppendDir( wxT( "3d" ) );
|
||||
fn.MakeAbsolute();
|
||||
|
||||
std::string testpath = std::string( fn.GetPathWithSep().ToUTF8() );
|
||||
checkPluginPath( testpath, searchpaths );
|
||||
|
||||
// Also check when running KiCad manager from build dir
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Search path on OS X is
|
||||
// (1) Machine /Library/Application Support/kicad/PlugIns/3d
|
||||
checkPluginPath( PATHS::GetOSXKicadMachineDataDir() + wxT( "/PlugIns/3d" ), searchpaths );
|
||||
|
||||
// (2) Bundle kicad.app/Contents/PlugIns/3d
|
||||
fn.AssignDir( PATHS::GetStockPlugins3DPath() );
|
||||
checkPluginPath( fn.GetPathWithSep(), searchpaths );
|
||||
}
|
||||
// (2) Bundle kicad.app/Contents/PlugIns/3d
|
||||
fn.AssignDir( PATHS::GetStockPlugins3DPath() );
|
||||
checkPluginPath( fn.GetPathWithSep(), searchpaths );
|
||||
#endif
|
||||
|
||||
std::list< wxString >::iterator sPL = searchpaths.begin();
|
||||
@@ -236,7 +202,7 @@ void S3D_PLUGIN_MANAGER::loadPlugins( void )
|
||||
char const* cp = pp->GetFileFilter( i );
|
||||
|
||||
if( cp )
|
||||
addFilterString( cp );
|
||||
addFilterString( wxString::FromUTF8Unchecked( cp ) );
|
||||
}
|
||||
|
||||
addExtensionMap( pp );
|
||||
@@ -328,7 +294,7 @@ void S3D_PLUGIN_MANAGER::checkPluginName( const wxString& aPath,
|
||||
++bl;
|
||||
}
|
||||
|
||||
// prevent loading non-plugin dlls
|
||||
// prevent loading non-plugin dlls
|
||||
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
|
||||
{
|
||||
if( !path.GetName().StartsWith( "s3d_plugin" )
|
||||
@@ -416,7 +382,7 @@ void S3D_PLUGIN_MANAGER::addExtensionMap( KICAD_PLUGIN_LDR_3D* aPlugin )
|
||||
wxString ws;
|
||||
|
||||
if( cp )
|
||||
ws = wxString( cp );
|
||||
ws = wxString::FromUTF8Unchecked( cp );
|
||||
|
||||
if( !ws.empty() )
|
||||
{
|
||||
|
||||
@@ -476,7 +476,7 @@ SGVECTOR S3D::CalcTriNorm( const SGPOINT& p1, const SGPOINT& p2, const SGPOINT&
|
||||
|
||||
// normal
|
||||
tri = glm::cross( pts[1] - pts[0], pts[2] - pts[0] );
|
||||
(void)glm::normalize( tri );
|
||||
glm::normalize( tri );
|
||||
|
||||
return SGVECTOR( tri.x, tri.y, tri.z );
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
BOX2I bbbox;
|
||||
|
||||
if( m_board )
|
||||
bbbox = m_board->ComputeBoundingBox( !m_board->IsFootprintHolder() && haveOutline, false );
|
||||
bbbox = m_board->ComputeBoundingBox( !m_board->IsFootprintHolder() && haveOutline );
|
||||
|
||||
// Gives a non null size to avoid issues in zoom / scale calculations
|
||||
if( ( bbbox.GetWidth() == 0 ) && ( bbbox.GetHeight() == 0 ) )
|
||||
@@ -698,10 +698,6 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
}
|
||||
|
||||
colors[ LAYER_3D_COPPER_BOTTOM ] = colors[ LAYER_3D_COPPER_TOP ];
|
||||
|
||||
for( const auto& [layer, val] : m_ColorOverrides )
|
||||
colors[layer] = val;
|
||||
|
||||
return colors;
|
||||
}
|
||||
|
||||
@@ -712,8 +708,6 @@ void BOARD_ADAPTER::SetLayerColors( const std::map<int, COLOR4D>& aColors )
|
||||
|
||||
for( const auto& [ layer, color ] : aColors )
|
||||
settings->SetColor( layer, color );
|
||||
|
||||
Pgm().GetSettingsManager().SaveColorSettings( settings, "3d_viewer" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "../3d_rendering/raytracing/accelerators/container_3d.h"
|
||||
#include "../3d_rendering/raytracing/shapes3D/bbox_3d.h"
|
||||
#include <gal/3d/camera.h>
|
||||
#include <3d_enums.h>
|
||||
#include "../3d_enums.h"
|
||||
#include "../3d_cache/3d_cache.h"
|
||||
#include "../common_ogl/ogl_attr_list.h"
|
||||
#include "../3d_viewer/eda_3d_viewer_settings.h"
|
||||
@@ -42,8 +42,6 @@
|
||||
#include <pcb_track.h>
|
||||
#include <pcb_base_frame.h>
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <pcb_table.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <pcb_dimension.h>
|
||||
#include <zone.h>
|
||||
@@ -379,9 +377,6 @@ private:
|
||||
void addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM* aOwner );
|
||||
|
||||
void addTable( const PCB_TABLE* aTable, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM* aOwner );
|
||||
|
||||
void addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayerId );
|
||||
|
||||
@@ -430,8 +425,6 @@ public:
|
||||
SFVEC4F m_ECO1Color;
|
||||
SFVEC4F m_ECO2Color;
|
||||
|
||||
std::map<int, COLOR4D> m_ColorOverrides; ///< allows to override color scheme colors
|
||||
|
||||
private:
|
||||
BOARD* m_board;
|
||||
S3D_CACHE* m_3dModelManager;
|
||||
|
||||
@@ -34,12 +34,10 @@
|
||||
#include "../3d_rendering/raytracing/shapes2D/round_segment_2d.h"
|
||||
#include "../3d_rendering/raytracing/shapes2D/triangle_2d.h"
|
||||
#include <board_adapter.h>
|
||||
#include <board.h>
|
||||
#include <footprint.h>
|
||||
#include <pad.h>
|
||||
#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>
|
||||
@@ -227,17 +225,12 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
|
||||
if( textbox->GetLayer() == aLayerId )
|
||||
addShape( textbox, aContainer, aFootprint );
|
||||
{
|
||||
if( textbox->IsBorderEnabled() )
|
||||
addShape( textbox, aContainer, aFootprint );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TABLE_T:
|
||||
{
|
||||
PCB_TABLE* table = static_cast<PCB_TABLE*>( item );
|
||||
|
||||
if( table->GetLayer() == aLayerId )
|
||||
addTable( table, aContainer, aFootprint );
|
||||
addText( textbox, aContainer, aFootprint );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -733,9 +726,7 @@ void BOARD_ADAPTER::addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aC
|
||||
// So for polygon, we use PCB_SHAPE::TransformShapeToPolygon
|
||||
|
||||
if( aTextBox->GetShape() == SHAPE_T::RECTANGLE )
|
||||
{
|
||||
addShape( static_cast<const PCB_SHAPE*>( aTextBox ), aContainer, aOwner );
|
||||
}
|
||||
else
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
@@ -748,17 +739,6 @@ void BOARD_ADAPTER::addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aC
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::addTable( const PCB_TABLE* aTable, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM* aOwner )
|
||||
{
|
||||
// JEY TODO: tables
|
||||
// add borders
|
||||
|
||||
for( PCB_TABLECELL* cell : aTable->GetCells() )
|
||||
addText( cell, aContainer, aOwner );
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* aContainer,
|
||||
PCB_LAYER_ID aLayerId )
|
||||
{
|
||||
|
||||
@@ -36,12 +36,10 @@
|
||||
#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 <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>
|
||||
@@ -624,10 +622,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
addShape( static_cast<PCB_TEXTBOX*>( item ), layerContainer, item );
|
||||
break;
|
||||
|
||||
case PCB_TABLE_T:
|
||||
addTable( static_cast<PCB_TABLE*>( item ), layerContainer, item );
|
||||
break;
|
||||
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
@@ -692,10 +686,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TABLE_T:
|
||||
// JEY TODO: tables
|
||||
break;
|
||||
|
||||
default:
|
||||
wxLogTrace( m_logTrace, wxT( "createLayers: item type: %d not implemented" ),
|
||||
item->Type() );
|
||||
@@ -857,10 +847,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
addShape( static_cast<PCB_TEXTBOX*>( item ), layerContainer, item );
|
||||
break;
|
||||
|
||||
case PCB_TABLE_T:
|
||||
// JEY TODO: tables
|
||||
break;
|
||||
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
@@ -875,15 +861,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
}
|
||||
|
||||
// Add via tech layers
|
||||
if( ( layer == F_Mask || layer == B_Mask ) )
|
||||
if( ( layer == F_Mask || layer == B_Mask ) && !m_board->GetTentVias() )
|
||||
{
|
||||
int maskExpansion = GetBoard()->GetDesignSettings().m_SolderMaskExpansion;
|
||||
|
||||
for( PCB_TRACK* track : m_board->Tracks() )
|
||||
{
|
||||
if( track->Type() == PCB_VIA_T
|
||||
&& static_cast<const PCB_VIA*>( track )->FlashLayer( layer )
|
||||
&& !static_cast<const PCB_VIA*>( track )->IsTented( layer ) )
|
||||
&& static_cast<const PCB_VIA*>( track )->FlashLayer( layer ) )
|
||||
{
|
||||
createViaWithMargin( track, layerContainer, maskExpansion );
|
||||
}
|
||||
@@ -957,25 +942,20 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TABLE_T:
|
||||
// JEY TODO: tables
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// NON-TENTED VIAS
|
||||
if( ( layer == F_Mask || layer == B_Mask ) )
|
||||
if( ( layer == F_Mask || layer == B_Mask ) && !m_board->GetTentVias() )
|
||||
{
|
||||
int maskExpansion = GetBoard()->GetDesignSettings().m_SolderMaskExpansion;
|
||||
|
||||
for( PCB_TRACK* track : m_board->Tracks() )
|
||||
{
|
||||
if( track->Type() == PCB_VIA_T
|
||||
&& static_cast<const PCB_VIA*>( track )->FlashLayer( layer )
|
||||
&& !static_cast<const PCB_VIA*>( track )->IsTented( layer ) )
|
||||
&& static_cast<const PCB_VIA*>( track )->FlashLayer( layer ) )
|
||||
{
|
||||
track->TransformShapeToPolygon( *layerPoly, layer, maskExpansion, maxError,
|
||||
ERROR_INSIDE );
|
||||
|
||||
@@ -29,11 +29,10 @@
|
||||
#include "../common_ogl/ogl_utils.h"
|
||||
#include "eda_3d_canvas.h"
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <3d_rendering/raytracing/render_3d_raytrace_gl.h>
|
||||
#include <3d_rendering/raytracing/render_3d_raytrace.h>
|
||||
#include <3d_rendering/opengl/render_3d_opengl.h>
|
||||
#include <3d_viewer_id.h>
|
||||
#include <advanced_config.h>
|
||||
#include <build_version.h>
|
||||
#include <board.h>
|
||||
#include <reporter.h>
|
||||
#include <gal/opengl/gl_context_mgr.h>
|
||||
@@ -73,11 +72,6 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, HIDPI_GL_3D_CANVAS )
|
||||
EVT_MOTION( EDA_3D_CANVAS::OnMouseMove )
|
||||
EVT_MAGNIFY( EDA_3D_CANVAS::OnMagnify )
|
||||
|
||||
// touch gesture events
|
||||
EVT_GESTURE_ZOOM( wxID_ANY, EDA_3D_CANVAS::OnZoomGesture )
|
||||
EVT_GESTURE_PAN( wxID_ANY, EDA_3D_CANVAS::OnPanGesture )
|
||||
EVT_GESTURE_ROTATE( wxID_ANY, EDA_3D_CANVAS::OnRotateGesture )
|
||||
|
||||
// other events
|
||||
EVT_ERASE_BACKGROUND( EDA_3D_CANVAS::OnEraseBackground )
|
||||
EVT_CUSTOM(wxEVT_REFRESH_CUSTOM_COMMAND, ID_CUSTOM_EVENT_1, EDA_3D_CANVAS::OnRefreshRequest )
|
||||
@@ -87,11 +81,11 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, HIDPI_GL_3D_CANVAS )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const wxGLAttributes& aGLAttribs,
|
||||
EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
|
||||
BOARD_ADAPTER& aBoardAdapter, CAMERA& aCamera,
|
||||
S3D_CACHE* a3DCachePointer ) :
|
||||
HIDPI_GL_3D_CANVAS( EDA_DRAW_PANEL_GAL::GetVcSettings(), aCamera, aParent, aGLAttribs,
|
||||
wxID_ANY, wxDefaultPosition,
|
||||
HIDPI_GL_3D_CANVAS( EDA_DRAW_PANEL_GAL::GetVcSettings(), aCamera, aParent, wxID_ANY,
|
||||
aAttribList, wxDefaultPosition,
|
||||
wxDefaultSize, wxFULL_REPAINT_ON_RESIZE ),
|
||||
m_eventDispatcher( nullptr ),
|
||||
m_parentStatusBar( nullptr ),
|
||||
@@ -125,7 +119,7 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const wxGLAttributes& aGLAttrib
|
||||
|
||||
m_is_currently_painting.clear();
|
||||
|
||||
m_3d_render_raytracing = new RENDER_3D_RAYTRACE_GL( this, m_boardAdapter, m_camera );
|
||||
m_3d_render_raytracing = new RENDER_3D_RAYTRACE( this, m_boardAdapter, m_camera );
|
||||
m_3d_render_opengl = new RENDER_3D_OPENGL( this, m_boardAdapter, m_camera );
|
||||
|
||||
wxASSERT( m_3d_render_raytracing != nullptr );
|
||||
@@ -149,10 +143,6 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const wxGLAttributes& aGLAttrib
|
||||
wxASSERT( a3DCachePointer != nullptr );
|
||||
m_boardAdapter.Set3dCacheManager( a3DCachePointer );
|
||||
|
||||
#ifdef __WXMSW__
|
||||
EnableTouchEvents( wxTOUCH_ZOOM_GESTURE | wxTOUCH_PAN_GESTURES | wxTOUCH_ROTATE_GESTURE );
|
||||
#endif
|
||||
|
||||
const wxEventType events[] =
|
||||
{
|
||||
// Binding both EVT_CHAR and EVT_CHAR_HOOK ensures that all key events,
|
||||
@@ -239,9 +229,6 @@ bool EDA_3D_CANVAS::initializeOpenGL()
|
||||
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
|
||||
}
|
||||
|
||||
SetOpenGLInfo( (const char*) glGetString( GL_VENDOR ), (const char*) glGetString( GL_RENDERER ),
|
||||
(const char*) glGetString( GL_VERSION ) );
|
||||
|
||||
wxString version = From_UTF8( (char *) glGetString( GL_VERSION ) );
|
||||
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::%s OpenGL version string %s." ),
|
||||
@@ -640,75 +627,6 @@ void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event )
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::OnZoomGesture( wxZoomGestureEvent& aEvent )
|
||||
{
|
||||
SetFocus();
|
||||
|
||||
if( aEvent.IsGestureStart() )
|
||||
{
|
||||
m_gestureLastZoomFactor = 1.0;
|
||||
m_camera.SetCurMousePosition( aEvent.GetPosition() );
|
||||
}
|
||||
|
||||
if( m_camera_is_moving )
|
||||
return;
|
||||
|
||||
restart_editingTimeOut_Timer();
|
||||
|
||||
m_camera.Pan( aEvent.GetPosition() );
|
||||
m_camera.SetCurMousePosition( aEvent.GetPosition() );
|
||||
|
||||
m_camera.Zoom( aEvent.GetZoomFactor() / m_gestureLastZoomFactor );
|
||||
|
||||
m_gestureLastZoomFactor = aEvent.GetZoomFactor();
|
||||
|
||||
DisplayStatus();
|
||||
Request_refresh();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::OnPanGesture( wxPanGestureEvent& aEvent )
|
||||
{
|
||||
SetFocus();
|
||||
|
||||
if( aEvent.IsGestureStart() )
|
||||
m_camera.SetCurMousePosition( aEvent.GetPosition() );
|
||||
|
||||
if( m_camera_is_moving )
|
||||
return;
|
||||
|
||||
m_camera.Pan( aEvent.GetPosition() );
|
||||
m_camera.SetCurMousePosition( aEvent.GetPosition() );
|
||||
|
||||
DisplayStatus();
|
||||
Request_refresh();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::OnRotateGesture( wxRotateGestureEvent& aEvent )
|
||||
{
|
||||
SetFocus();
|
||||
|
||||
if( aEvent.IsGestureStart() )
|
||||
{
|
||||
m_gestureLastAngle = 0;
|
||||
m_camera.SetCurMousePosition( aEvent.GetPosition() );
|
||||
|
||||
// We don't want to process the first angle
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_camera_is_moving )
|
||||
return;
|
||||
|
||||
m_camera.RotateScreen( m_gestureLastAngle - aEvent.GetRotationAngle() );
|
||||
m_gestureLastAngle = aEvent.GetRotationAngle();
|
||||
|
||||
DisplayStatus();
|
||||
Request_refresh();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
|
||||
{
|
||||
if( m_3d_render && m_3d_render->IsReloadRequestPending() )
|
||||
@@ -1061,24 +979,66 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_RIGHT:
|
||||
case VIEW3D_TYPE::VIEW3D_LEFT:
|
||||
case VIEW3D_TYPE::VIEW3D_FRONT:
|
||||
case VIEW3D_TYPE::VIEW3D_BACK:
|
||||
case VIEW3D_TYPE::VIEW3D_FLIP:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.ViewCommand_T1( aRequestedView );
|
||||
m_camera.Reset_T1();
|
||||
m_camera.RotateZ_T1( glm::radians( -90.0f ) );
|
||||
m_camera.RotateX_T1( glm::radians( -90.0f ) );
|
||||
request_start_moving_camera();
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_LEFT:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Reset_T1();
|
||||
m_camera.RotateZ_T1( glm::radians( 90.0f ) );
|
||||
m_camera.RotateX_T1( glm::radians( -90.0f ) );
|
||||
request_start_moving_camera();
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_FRONT:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Reset_T1();
|
||||
m_camera.RotateX_T1( glm::radians( -90.0f ) );
|
||||
request_start_moving_camera();
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_BACK:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Reset_T1();
|
||||
m_camera.RotateX_T1( glm::radians( -90.0f ) );
|
||||
|
||||
// The rotation angle should be 180.
|
||||
// We use 179.999 (180 - epsilon) to avoid a full 360 deg rotation when
|
||||
// using 180 deg if the previous rotated position was already 180 deg
|
||||
m_camera.RotateZ_T1( glm::radians( 179.999f ) );
|
||||
request_start_moving_camera();
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_TOP:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Reset_T1();
|
||||
request_start_moving_camera( glm::min( glm::max( m_camera.GetZoom(), 0.5f ), 1.125f ) );
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_BOTTOM:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.ViewCommand_T1( aRequestedView );
|
||||
m_camera.Reset_T1();
|
||||
m_camera.RotateY_T1( glm::radians( 179.999f ) ); // Rotation = 180 - epsilon
|
||||
request_start_moving_camera( glm::min( glm::max( m_camera.GetZoom(), 0.5f ), 1.125f ) );
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_FLIP:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.RotateY_T1( glm::radians( 179.999f ) );
|
||||
request_start_moving_camera();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2021 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
|
||||
@@ -38,7 +38,7 @@
|
||||
class WX_INFOBAR;
|
||||
class wxStatusBar;
|
||||
class BOARD;
|
||||
class RENDER_3D_RAYTRACE_GL;
|
||||
class RENDER_3D_RAYTRACE;
|
||||
class RENDER_3D_OPENGL;
|
||||
|
||||
|
||||
@@ -52,12 +52,12 @@ public:
|
||||
* Create a new 3D Canvas with an attribute list.
|
||||
*
|
||||
* @param aParent the parent creator of this canvas.
|
||||
* @param aGLAttribs openGL attributes created by #OGL_ATT_LIST::GetAttributesList.
|
||||
* @param aAttribList a list of openGL options created by GetOpenGL_AttributesList.
|
||||
* @param aBoard The board.
|
||||
* @param aSettings the settings options to be used by this canvas.
|
||||
*/
|
||||
EDA_3D_CANVAS( wxWindow* aParent, const wxGLAttributes& aGLAttribs, BOARD_ADAPTER& aSettings,
|
||||
CAMERA& aCamera, S3D_CACHE* a3DCachePointer );
|
||||
EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
|
||||
BOARD_ADAPTER& aSettings, CAMERA& aCamera, S3D_CACHE* a3DCachePointer );
|
||||
|
||||
~EDA_3D_CANVAS();
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current render ( a RENDER_3D_RAYTRACE_GL* or a RENDER_3D_OPENGL* render )
|
||||
* @return the current render ( a RENDER_3D_RAYTRACE* or a RENDER_3D_OPENGL* render )
|
||||
*/
|
||||
RENDER_3D_BASE* GetCurrentRender() const { return m_3d_render; }
|
||||
|
||||
@@ -237,10 +237,6 @@ private:
|
||||
void OnResize( wxSizeEvent& event );
|
||||
void OnTimerTimeout_Redraw( wxTimerEvent& event );
|
||||
|
||||
void OnZoomGesture( wxZoomGestureEvent& event );
|
||||
void OnPanGesture( wxPanGestureEvent& event );
|
||||
void OnRotateGesture( wxRotateGestureEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
/**
|
||||
@@ -315,7 +311,7 @@ private:
|
||||
|
||||
BOARD_ADAPTER& m_boardAdapter; // Pre-computed 3D info and settings
|
||||
RENDER_3D_BASE* m_3d_render;
|
||||
RENDER_3D_RAYTRACE_GL* m_3d_render_raytracing;
|
||||
RENDER_3D_RAYTRACE* m_3d_render_raytracing;
|
||||
RENDER_3D_OPENGL* m_3d_render_opengl;
|
||||
|
||||
bool m_opengl_supports_raytracing;
|
||||
@@ -328,10 +324,6 @@ private:
|
||||
bool m_render3dmousePivot = false; // Render the 3dmouse pivot
|
||||
SFVEC3F m_3dmousePivotPos; // The position of the 3dmouse pivot
|
||||
|
||||
///< Used to track gesture events.
|
||||
double m_gestureLastZoomFactor = 1.0;
|
||||
double m_gestureLastAngle = 0.0;
|
||||
|
||||
/**
|
||||
* Trace mask used to enable or disable the trace output of this class.
|
||||
* The debug output can be turned on by setting the WXTRACE environment variable to
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2021 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
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "../3d_cache/3d_cache.h"
|
||||
#include <wx/dcclient.h>
|
||||
#include <base_units.h>
|
||||
#include <build_version.h>
|
||||
#include <gal/opengl/gl_context_mgr.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <pgm_base.h>
|
||||
@@ -86,9 +85,9 @@ END_EVENT_TABLE()
|
||||
#define RANGE_SCALE_3D 8.0f
|
||||
|
||||
|
||||
EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER( wxWindow* aParent, const wxGLAttributes& aGLAttribs,
|
||||
EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER( wxWindow* aParent, const int* aAttribList,
|
||||
S3D_CACHE* aCacheManager ) :
|
||||
HIDPI_GL_CANVAS( EDA_DRAW_PANEL_GAL::GetVcSettings(), aParent, aGLAttribs, wxID_ANY,
|
||||
HIDPI_GL_CANVAS( EDA_DRAW_PANEL_GAL::GetVcSettings(), aParent, wxID_ANY, aAttribList,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxFULL_REPAINT_ON_RESIZE ),
|
||||
m_trackBallCamera( RANGE_SCALE_3D * 4.0f ),
|
||||
@@ -103,6 +102,11 @@ EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER( wxWindow* aParent, const wxGLAttribute
|
||||
m_BiuTo3dUnits = 1.0;
|
||||
|
||||
m_glRC = nullptr;
|
||||
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
||||
SetScaleFactor( dpi.GetScaleFactor() );
|
||||
}
|
||||
|
||||
|
||||
@@ -196,9 +200,6 @@ void EDA_3D_MODEL_VIEWER::ogl_initialize()
|
||||
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
|
||||
}
|
||||
|
||||
SetOpenGLInfo( (const char*) glGetString( GL_VENDOR ), (const char*) glGetString( GL_RENDERER ),
|
||||
(const char*) glGetString( GL_VERSION ) );
|
||||
|
||||
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
|
||||
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
|
||||
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
|
||||
@@ -301,7 +302,7 @@ void EDA_3D_MODEL_VIEWER::OnPaint( wxPaintEvent& event )
|
||||
|
||||
// clear color and depth buffers
|
||||
glEnable( GL_DEPTH_TEST );
|
||||
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
|
||||
glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
glClearDepth( 1.0f );
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
|
||||
|
||||
@@ -49,9 +49,9 @@ public:
|
||||
* Create a new 3D Canvas with a attribute list.
|
||||
*
|
||||
* @param aParent the parent creator of this canvas.
|
||||
* @param aGLAttribs openGL attributes created by #OGL_ATT_LIST::GetAttributesList.
|
||||
* @param aAttribList a list of openGL options created by #OGL_ATT_LIST::GetAttributesList.
|
||||
*/
|
||||
EDA_3D_MODEL_VIEWER( wxWindow* aParent, const wxGLAttributes& aGLAttribs,
|
||||
EDA_3D_MODEL_VIEWER( wxWindow* aParent, const int* aAttribList = nullptr,
|
||||
S3D_CACHE* aCacheManager = nullptr );
|
||||
|
||||
~EDA_3D_MODEL_VIEWER();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2016-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2020 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
|
||||
@@ -46,19 +46,6 @@ static void dbg_save_rgb_buffer( const wxString& aFileName, unsigned char *aRGBp
|
||||
}
|
||||
|
||||
|
||||
static void dbg_save_rgb_a_buffer( const wxString& aFileName, unsigned char* aRGBpixelBuffer,
|
||||
unsigned char* aAlphaBuffer, unsigned int aXSize,
|
||||
unsigned int aYSize )
|
||||
{
|
||||
wxImage image( aXSize, aYSize );
|
||||
image.SetData( aRGBpixelBuffer );
|
||||
image.SetAlpha( aAlphaBuffer );
|
||||
image = image.Mirror( false );
|
||||
image.SaveFile( aFileName + wxT( ".png" ), wxBITMAP_TYPE_PNG );
|
||||
image.Destroy();
|
||||
}
|
||||
|
||||
|
||||
void DBG_SaveBuffer( const wxString& aFileName, const unsigned char *aInBuffer,
|
||||
unsigned int aXSize, unsigned int aYSize )
|
||||
{
|
||||
@@ -123,31 +110,6 @@ void DBG_SaveBuffer( const wxString& aFileName, const SFVEC3F *aInBuffer,
|
||||
}
|
||||
|
||||
|
||||
void DBG_SaveBuffer( const wxString& aFileName, const SFVEC4F *aInBuffer,
|
||||
unsigned int aXSize, unsigned int aYSize )
|
||||
{
|
||||
const unsigned int wxh = aXSize * aYSize;
|
||||
|
||||
unsigned char *pixelbuffer = (unsigned char*) malloc( wxh * 4 );
|
||||
unsigned char *alphabuffer = (unsigned char*) malloc( wxh );
|
||||
|
||||
for( unsigned int i = 0; i < wxh; ++i )
|
||||
{
|
||||
const SFVEC4F &v = aInBuffer[i];
|
||||
const unsigned int ix3 = i * 3;
|
||||
|
||||
// Set RGB value with all same values intensities
|
||||
pixelbuffer[ix3 + 0] = (unsigned char) glm::min( (int) ( v.r * 255.0f ), 255 );
|
||||
pixelbuffer[ix3 + 1] = (unsigned char) glm::min( (int) ( v.g * 255.0f ), 255 );
|
||||
pixelbuffer[ix3 + 2] = (unsigned char) glm::min( (int) ( v.b * 255.0f ), 255 );
|
||||
|
||||
alphabuffer[i] = (unsigned char) glm::min( (int) ( v.a * 255.0f ), 255 );
|
||||
}
|
||||
|
||||
dbg_save_rgb_a_buffer( aFileName, pixelbuffer, alphabuffer, aXSize, aYSize );
|
||||
}
|
||||
|
||||
|
||||
void DBG_SaveNormalsBuffer( const wxString& aFileName, const SFVEC3F *aInNormalsBuffer,
|
||||
unsigned int aXSize, unsigned int aYSize )
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2016-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2020 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
|
||||
@@ -42,9 +42,6 @@ void DBG_SaveBuffer( const wxString& aFileName, const float *aInBuffer,
|
||||
void DBG_SaveBuffer( const wxString& aFileName, const SFVEC3F *aInBuffer,
|
||||
unsigned int aXSize, unsigned int aYSize );
|
||||
|
||||
void DBG_SaveBuffer( const wxString& aFileName, const SFVEC4F *aInBuffer,
|
||||
unsigned int aXSize, unsigned int aYSize );
|
||||
|
||||
void DBG_SaveNormalsBuffer( const wxString& aFileName, const SFVEC3F *aInNormalsBuffer,
|
||||
unsigned int aXSize, unsigned int aYSize );
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -23,60 +23,47 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file color_rgba.cpp
|
||||
* @file color_rgb.cpp
|
||||
*/
|
||||
|
||||
|
||||
#include "color_rgba.h"
|
||||
#include "color_rgb.h"
|
||||
|
||||
|
||||
COLOR_RGBA::COLOR_RGBA( const SFVEC3F& aColor )
|
||||
COLOR_RGB::COLOR_RGB( const SFVEC3F& aColor )
|
||||
{
|
||||
r = (unsigned int) glm::clamp( (int) ( aColor.r * 255 ), 0, 255 );
|
||||
g = (unsigned int) glm::clamp( (int) ( aColor.g * 255 ), 0, 255 );
|
||||
b = (unsigned int) glm::clamp( (int) ( aColor.b * 255 ), 0, 255 );
|
||||
a = 255;
|
||||
}
|
||||
|
||||
|
||||
COLOR_RGBA::COLOR_RGBA( const SFVEC4F& aColor )
|
||||
{
|
||||
r = (unsigned int) glm::clamp( (int) ( aColor.r * 255 ), 0, 255 );
|
||||
g = (unsigned int) glm::clamp( (int) ( aColor.g * 255 ), 0, 255 );
|
||||
b = (unsigned int) glm::clamp( (int) ( aColor.b * 255 ), 0, 255 );
|
||||
a = (unsigned int) glm::clamp( (int) ( aColor.a * 255 ), 0, 255 );
|
||||
}
|
||||
|
||||
|
||||
COLOR_RGBA BlendColor( const COLOR_RGBA& aC1, const COLOR_RGBA& aC2 )
|
||||
COLOR_RGB BlendColor( const COLOR_RGB& aC1, const COLOR_RGB& aC2 )
|
||||
{
|
||||
const unsigned int r = aC1.r + aC2.r;
|
||||
const unsigned int g = aC1.g + aC2.g;
|
||||
const unsigned int b = aC1.b + aC2.b;
|
||||
const unsigned int a = aC1.a + aC2.a;
|
||||
|
||||
return COLOR_RGBA( ( r >> 1 ), ( g >> 1 ), ( b >> 1 ), ( a >> 1 ) );
|
||||
return COLOR_RGB( ( r >> 1 ), ( g >> 1 ), ( b >> 1 ) );
|
||||
}
|
||||
|
||||
|
||||
COLOR_RGBA BlendColor( const COLOR_RGBA& aC1, const COLOR_RGBA& aC2, const COLOR_RGBA& aC3 )
|
||||
COLOR_RGB BlendColor( const COLOR_RGB& aC1, const COLOR_RGB& aC2, const COLOR_RGB& aC3 )
|
||||
{
|
||||
const unsigned int r = aC1.r + aC2.r + aC3.r;
|
||||
const unsigned int g = aC1.g + aC2.g + aC3.g;
|
||||
const unsigned int b = aC1.b + aC2.b + aC3.b;
|
||||
const unsigned int a = aC1.a + aC2.a + aC3.a;
|
||||
|
||||
return COLOR_RGBA( ( r / 3 ), ( g / 3 ), ( b / 3 ), ( a / 3 ) );
|
||||
return COLOR_RGB( ( r / 3 ), ( g / 3 ), ( b / 3 ) );
|
||||
}
|
||||
|
||||
|
||||
COLOR_RGBA BlendColor( const COLOR_RGBA& aC1, const COLOR_RGBA& aC2, const COLOR_RGBA& aC3,
|
||||
const COLOR_RGBA& aC4 )
|
||||
COLOR_RGB BlendColor( const COLOR_RGB& aC1, const COLOR_RGB& aC2, const COLOR_RGB& aC3,
|
||||
const COLOR_RGB& aC4 )
|
||||
{
|
||||
const unsigned int r = aC1.r + aC2.r + aC3.r + aC4.r;
|
||||
const unsigned int g = aC1.g + aC2.g + aC3.g + aC4.g;
|
||||
const unsigned int b = aC1.b + aC2.b + aC3.b + aC4.b;
|
||||
const unsigned int a = aC1.a + aC2.a + aC3.a + aC4.a;
|
||||
|
||||
return COLOR_RGBA( ( r >> 2 ), ( g >> 2 ), ( b >> 2 ), ( a >> 2 ) );
|
||||
return COLOR_RGB( ( r >> 2 ), ( g >> 2 ), ( b >> 2 ) );
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -23,49 +23,39 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file color_rgba.h
|
||||
* @file color_rgb.h
|
||||
*/
|
||||
|
||||
#ifndef COLOR_RGBA_H
|
||||
#define COLOR_RGBA_H
|
||||
#ifndef COLOR_RGB_H
|
||||
#define COLOR_RGB_H
|
||||
|
||||
#include <plugins/3dapi/xv3d_types.h>
|
||||
|
||||
union COLOR_RGBA
|
||||
union COLOR_RGB
|
||||
{
|
||||
unsigned char c[4];
|
||||
unsigned char c[3];
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
unsigned char b;
|
||||
unsigned char a;
|
||||
};
|
||||
|
||||
COLOR_RGBA( const SFVEC3F& aColor );
|
||||
COLOR_RGBA( const SFVEC4F& aColor );
|
||||
COLOR_RGBA() { r = 0; g = 0; b = 0; a = 0; }
|
||||
COLOR_RGBA( unsigned char aR, unsigned char aG, unsigned char aB )
|
||||
COLOR_RGB( const SFVEC3F& aColor );
|
||||
COLOR_RGB() { r = 0; g = 0; b = 0; }
|
||||
COLOR_RGB( unsigned char aR, unsigned char aG, unsigned char aB )
|
||||
{
|
||||
r = aR;
|
||||
g = aG;
|
||||
b = aB;
|
||||
}
|
||||
|
||||
COLOR_RGBA( unsigned char aR, unsigned char aG, unsigned char aB, unsigned char aA )
|
||||
{
|
||||
r = aR;
|
||||
g = aG;
|
||||
b = aB;
|
||||
a = aA;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
COLOR_RGBA BlendColor( const COLOR_RGBA& aC1, const COLOR_RGBA& aC2 );
|
||||
COLOR_RGBA BlendColor( const COLOR_RGBA& aC1, const COLOR_RGBA& aC2, const COLOR_RGBA& aC3 );
|
||||
COLOR_RGBA BlendColor( const COLOR_RGBA& aC1, const COLOR_RGBA& aC2, const COLOR_RGBA& aC3,
|
||||
const COLOR_RGBA& aC4 );
|
||||
COLOR_RGB BlendColor( const COLOR_RGB& aC1, const COLOR_RGB& aC2 );
|
||||
COLOR_RGB BlendColor( const COLOR_RGB& aC1, const COLOR_RGB& aC2, const COLOR_RGB& aC3 );
|
||||
COLOR_RGB BlendColor( const COLOR_RGB& aC1, const COLOR_RGB& aC2, const COLOR_RGB& aC3,
|
||||
const COLOR_RGB& aC4 );
|
||||
|
||||
#endif // COLOR_RGBA_H
|
||||
#endif // COLOR_RGB_H
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2020 Oleg Endo <olegendo@gcc.gnu.org>
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <plugins/3dapi/c3dmodel.h>
|
||||
#include "../../common_ogl/openGL_includes.h"
|
||||
#include "../raytracing/shapes3D/bbox_3d.h"
|
||||
#include <3d_enums.h>
|
||||
#include "../../3d_enums.h"
|
||||
|
||||
#include <wx/chartype.h>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2015-2020 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2023 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
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "render_3d_opengl.h"
|
||||
#include "opengl_utils.h"
|
||||
#include "common_ogl/ogl_utils.h"
|
||||
#include <board.h>
|
||||
#include <footprint.h>
|
||||
#include <3d_math.h>
|
||||
#include <glm/geometric.hpp>
|
||||
@@ -48,8 +47,7 @@
|
||||
|
||||
RENDER_3D_OPENGL::RENDER_3D_OPENGL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter,
|
||||
CAMERA& aCamera ) :
|
||||
RENDER_3D_BASE( aAdapter, aCamera ),
|
||||
m_canvas( aCanvas )
|
||||
RENDER_3D_BASE( aCanvas, aAdapter, aCamera )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "RENDER_3D_OPENGL::RENDER_3D_OPENGL" ) );
|
||||
|
||||
@@ -446,17 +444,11 @@ void RENDER_3D_OPENGL::renderBoardBody( bool aSkipRenderHoles )
|
||||
}
|
||||
|
||||
|
||||
static inline SFVEC4F premultiplyAlpha( const SFVEC4F& aInput )
|
||||
{
|
||||
return SFVEC4F( aInput.r * aInput.a, aInput.g * aInput.a, aInput.b * aInput.a, aInput.a );
|
||||
}
|
||||
|
||||
|
||||
bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
|
||||
REPORTER* aWarningReporter )
|
||||
{
|
||||
// Initialize OpenGL
|
||||
if( !m_canvasInitialized )
|
||||
if( !m_is_opengl_initialized )
|
||||
{
|
||||
if( !initializeOpenGL() )
|
||||
return false;
|
||||
@@ -503,7 +495,7 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
|
||||
glEnable( GL_MULTISAMPLE );
|
||||
|
||||
// clear color and depth buffers
|
||||
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
|
||||
glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
glClearDepth( 1.0f );
|
||||
glClearStencil( 0x00 );
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||
@@ -511,8 +503,8 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
|
||||
OglResetTextureState();
|
||||
|
||||
// Draw the background ( rectangle with color gradient)
|
||||
OglDrawBackground( premultiplyAlpha( m_boardAdapter.m_BgColorTop ),
|
||||
premultiplyAlpha( m_boardAdapter.m_BgColorBot ) );
|
||||
OglDrawBackground( SFVEC3F( m_boardAdapter.m_BgColorTop ),
|
||||
SFVEC3F( m_boardAdapter.m_BgColorBot ) );
|
||||
|
||||
glEnable( GL_DEPTH_TEST );
|
||||
|
||||
@@ -825,7 +817,7 @@ bool RENDER_3D_OPENGL::initializeOpenGL()
|
||||
|
||||
// Use this mode if you want see the triangle lines (debug proposes)
|
||||
//glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
||||
m_canvasInitialized = true;
|
||||
m_is_opengl_initialized = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1023,7 +1015,7 @@ void RENDER_3D_OPENGL::get3dModelsFromFootprint( std::list<MODELTORENDER> &aDstR
|
||||
const SFVEC3F offset = SFVEC3F( sM.m_Offset.x, sM.m_Offset.y, sM.m_Offset.z );
|
||||
const SFVEC3F rotation = SFVEC3F( sM.m_Rotation.x, sM.m_Rotation.y, sM.m_Rotation.z );
|
||||
const SFVEC3F scale = SFVEC3F( sM.m_Scale.x, sM.m_Scale.y, sM.m_Scale.z );
|
||||
|
||||
|
||||
std::vector<float> key = { offset.x, offset.y, offset.z,
|
||||
rotation.x, rotation.y, rotation.z,
|
||||
scale.x, scale.y, scale.z };
|
||||
@@ -1136,7 +1128,7 @@ void RENDER_3D_OPENGL::renderTransparentModels( const glm::mat4 &aCameraViewMatr
|
||||
const SFVEC3F bBoxWorld = mtr.m_modelWorldMat * glm::vec4( bBoxCenter, 1.0f );
|
||||
|
||||
const float distanceToCamera = glm::length( cameraPos - bBoxWorld );
|
||||
|
||||
|
||||
transparentModelList.emplace_back( &mtr, distanceToCamera );
|
||||
}
|
||||
|
||||
@@ -1226,7 +1218,7 @@ void RENDER_3D_OPENGL::renderModel( const glm::mat4 &aCameraViewMatrix,
|
||||
aModelToRender.m_model->DrawBbox();
|
||||
|
||||
glEnable( GL_LIGHTING );
|
||||
|
||||
|
||||
if( !wasBlendEnabled )
|
||||
glDisable( GL_BLEND );
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2021 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
|
||||
@@ -208,8 +208,6 @@ private:
|
||||
SMATERIAL m_GrayMaterial;
|
||||
} m_materials;
|
||||
|
||||
EDA_3D_CANVAS* m_canvas;
|
||||
|
||||
MAP_OGL_DISP_LISTS m_layers;
|
||||
OPENGL_RENDER_LIST* m_platedPadsFront;
|
||||
OPENGL_RENDER_LIST* m_platedPadsBack;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -63,7 +63,7 @@ void POST_SHADER::UpdateSize( unsigned int xSize, unsigned int ySize )
|
||||
const unsigned int n_elements = xSize * ySize;
|
||||
|
||||
m_normals = new SFVEC3F[n_elements];
|
||||
m_color = new SFVEC4F[n_elements];
|
||||
m_color = new SFVEC3F[n_elements];
|
||||
m_depth = new float[n_elements];
|
||||
m_wc_hitposition = new SFVEC3F[n_elements];
|
||||
m_shadow_att_factor = new float[n_elements];
|
||||
@@ -77,7 +77,7 @@ void POST_SHADER::UpdateSize( const SFVEC2UI& aSize )
|
||||
|
||||
|
||||
void POST_SHADER::SetPixelData( unsigned int x, unsigned int y, const SFVEC3F& aNormal,
|
||||
const SFVEC4F& aColor, const SFVEC3F& aHitPosition,
|
||||
const SFVEC3F& aColor, const SFVEC3F& aHitPosition,
|
||||
float aDepth, float aShadowAttFactor )
|
||||
{
|
||||
wxASSERT( x < m_size.x );
|
||||
@@ -125,7 +125,7 @@ const SFVEC3F& POST_SHADER::GetNormalAt( const SFVEC2F& aPos ) const
|
||||
}
|
||||
|
||||
|
||||
const SFVEC4F& POST_SHADER::GetColorAt( const SFVEC2F& aPos ) const
|
||||
const SFVEC3F& POST_SHADER::GetColorAt( const SFVEC2F& aPos ) const
|
||||
{
|
||||
return m_color[GetIndex( aPos )];
|
||||
}
|
||||
@@ -149,13 +149,13 @@ const SFVEC3F& POST_SHADER::GetNormalAt( const SFVEC2I& aPos ) const
|
||||
}
|
||||
|
||||
|
||||
const SFVEC4F& POST_SHADER::GetColorAt( const SFVEC2I& aPos ) const
|
||||
const SFVEC3F& POST_SHADER::GetColorAt( const SFVEC2I& aPos ) const
|
||||
{
|
||||
return m_color[GetIndex( aPos )];
|
||||
}
|
||||
|
||||
|
||||
const SFVEC4F& POST_SHADER::GetColorAtNotProtected( const SFVEC2I& aPos ) const
|
||||
const SFVEC3F& POST_SHADER::GetColorAtNotProtected( const SFVEC2I& aPos ) const
|
||||
{
|
||||
return m_color[ aPos.x + m_size.x * aPos.y ];
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
* @param aShadeColor The result of the shader.
|
||||
* @return the result of the shade process
|
||||
*/
|
||||
virtual SFVEC4F ApplyShadeColor( const SFVEC2I& aShaderPos, const SFVEC4F& aInputColor,
|
||||
virtual SFVEC3F ApplyShadeColor( const SFVEC2I& aShaderPos, const SFVEC3F& aInputColor,
|
||||
const SFVEC3F& aShadeColor ) const = 0;
|
||||
|
||||
void UpdateSize( const SFVEC2UI& aSize );
|
||||
@@ -56,10 +56,10 @@ public:
|
||||
void InitFrame() { m_tmin = FLT_MAX; m_tmax = 0.0f; }
|
||||
|
||||
void SetPixelData( unsigned int x, unsigned int y, const SFVEC3F& aNormal,
|
||||
const SFVEC4F& aColor, const SFVEC3F& aHitPosition,
|
||||
const SFVEC3F& aColor, const SFVEC3F& aHitPosition,
|
||||
float aDepth, float aShadowAttFactor );
|
||||
|
||||
const SFVEC4F& GetColorAtNotProtected( const SFVEC2I& aPos ) const;
|
||||
const SFVEC3F& GetColorAtNotProtected( const SFVEC2I& aPos ) const;
|
||||
|
||||
void DebugBuffersOutputAsImages() const;
|
||||
|
||||
@@ -88,12 +88,12 @@ public:
|
||||
|
||||
protected:
|
||||
const SFVEC3F& GetNormalAt( const SFVEC2F& aPos ) const;
|
||||
const SFVEC4F& GetColorAt( const SFVEC2F& aPos ) const;
|
||||
const SFVEC3F& GetColorAt( const SFVEC2F& aPos ) const;
|
||||
const SFVEC3F& GetPositionAt( const SFVEC2F& aPos ) const;
|
||||
float GetDepthAt( const SFVEC2F& aPos ) const;
|
||||
|
||||
const SFVEC3F& GetNormalAt( const SFVEC2I& aPos ) const;
|
||||
const SFVEC4F& GetColorAt( const SFVEC2I& aPos ) const;
|
||||
const SFVEC3F& GetColorAt( const SFVEC2I& aPos ) const;
|
||||
const SFVEC3F& GetPositionAt( const SFVEC2I& aPos ) const;
|
||||
const float& GetShadowFactorAt( const SFVEC2I& aPos ) const;
|
||||
|
||||
@@ -109,7 +109,7 @@ protected:
|
||||
|
||||
SFVEC2UI m_size;
|
||||
SFVEC3F* m_normals;
|
||||
SFVEC4F* m_color;
|
||||
SFVEC3F* m_color;
|
||||
SFVEC3F* m_wc_hitposition;
|
||||
float* m_depth;
|
||||
float* m_shadow_att_factor;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -187,21 +187,21 @@ SFVEC3F POST_SHADER_SSAO::Shade( const SFVEC2I& aShaderPos ) const
|
||||
ao += aoFF( aShaderPos, ddiff8, n, shadowAt8, shadowAt0, -npw, ph );
|
||||
|
||||
gi += giFF( aShaderPos, ddiff , n, shadowAt1, npw, nph) *
|
||||
giColorCurveShade( GetColorAt( aShaderPos + SFVEC2I( npw, nph ) ) );
|
||||
giColorCurve( GetColorAt( aShaderPos + SFVEC2I( npw, nph ) ) );
|
||||
gi += giFF( aShaderPos, ddiff2, n, shadowAt2, npw, -nph) *
|
||||
giColorCurveShade( GetColorAt( aShaderPos + SFVEC2I( npw,-nph ) ) );
|
||||
giColorCurve( GetColorAt( aShaderPos + SFVEC2I( npw,-nph ) ) );
|
||||
gi += giFF( aShaderPos, ddiff3, n, shadowAt3, -npw, nph) *
|
||||
giColorCurveShade( GetColorAt( aShaderPos + SFVEC2I( -npw, nph ) ) );
|
||||
giColorCurve( GetColorAt( aShaderPos + SFVEC2I( -npw, nph ) ) );
|
||||
gi += giFF( aShaderPos, ddiff4, n, shadowAt4, -npw, -nph) *
|
||||
giColorCurveShade( GetColorAt( aShaderPos + SFVEC2I( -npw,-nph ) ) );
|
||||
giColorCurve( GetColorAt( aShaderPos + SFVEC2I( -npw,-nph ) ) );
|
||||
gi += giFF( aShaderPos, ddiff5, n, shadowAt5 , pw, nph) *
|
||||
giColorCurveShade( GetColorAt( aShaderPos + SFVEC2I( pw, nph ) ) );
|
||||
giColorCurve( GetColorAt( aShaderPos + SFVEC2I( pw, nph ) ) );
|
||||
gi += giFF( aShaderPos, ddiff6, n, shadowAt6, pw,-nph) *
|
||||
giColorCurveShade( GetColorAt( aShaderPos + SFVEC2I( pw,-nph ) ) );
|
||||
giColorCurve( GetColorAt( aShaderPos + SFVEC2I( pw,-nph ) ) );
|
||||
gi += giFF( aShaderPos, ddiff7, n, shadowAt7, npw, ph) *
|
||||
giColorCurveShade( GetColorAt( aShaderPos + SFVEC2I( npw, ph ) ) );
|
||||
giColorCurve( GetColorAt( aShaderPos + SFVEC2I( npw, ph ) ) );
|
||||
gi += giFF( aShaderPos, ddiff8, n, shadowAt8, -npw, ph) *
|
||||
giColorCurveShade( GetColorAt( aShaderPos + SFVEC2I( -npw, ph ) ) );
|
||||
giColorCurve( GetColorAt( aShaderPos + SFVEC2I( -npw, ph ) ) );
|
||||
}
|
||||
|
||||
// If it received direct light, it shouldn't consider much AO
|
||||
@@ -227,20 +227,18 @@ SFVEC3F POST_SHADER_SSAO::Shade( const SFVEC2I& aShaderPos ) const
|
||||
}
|
||||
|
||||
|
||||
SFVEC4F POST_SHADER_SSAO::ApplyShadeColor( const SFVEC2I& aShaderPos, const SFVEC4F& aInputColor,
|
||||
SFVEC3F POST_SHADER_SSAO::ApplyShadeColor( const SFVEC2I& aShaderPos, const SFVEC3F& aInputColor,
|
||||
const SFVEC3F& aShadeColor ) const
|
||||
{
|
||||
SFVEC4F outColor;
|
||||
SFVEC3F inColor( aInputColor );
|
||||
SFVEC3F outColor;
|
||||
|
||||
const SFVEC3F subtracted = inColor - aShadeColor;
|
||||
const SFVEC3F mixed = glm::mix( inColor, inColor * 0.50f - aShadeColor * 0.05f,
|
||||
const SFVEC3F subtracted = aInputColor - aShadeColor;
|
||||
const SFVEC3F mixed = glm::mix( aInputColor, aInputColor * 0.50f - aShadeColor * 0.05f,
|
||||
glm::min( aShadeColor, 1.0f ) );
|
||||
|
||||
outColor.r = ( aShadeColor.r < 0.0f ) ? subtracted.r : mixed.r;
|
||||
outColor.g = ( aShadeColor.g < 0.0f ) ? subtracted.g : mixed.g;
|
||||
outColor.b = ( aShadeColor.b < 0.0f ) ? subtracted.b : mixed.b;
|
||||
outColor.a = std::max( aInputColor.a, ( aShadeColor.r + aShadeColor.g + aShadeColor.b ) / 3 );
|
||||
|
||||
return outColor;
|
||||
}
|
||||
@@ -258,18 +256,6 @@ SFVEC3F POST_SHADER_SSAO::giColorCurve( const SFVEC3F& aColor ) const
|
||||
}
|
||||
|
||||
|
||||
SFVEC4F POST_SHADER_SSAO::giColorCurve( const SFVEC4F& aColor ) const
|
||||
{
|
||||
return SFVEC4F( giColorCurve( SFVEC3F( aColor ) ), aColor.a );
|
||||
}
|
||||
|
||||
|
||||
SFVEC3F POST_SHADER_SSAO::giColorCurveShade( const SFVEC4F& aColor ) const
|
||||
{
|
||||
return giColorCurve( SFVEC3F( aColor ) );
|
||||
}
|
||||
|
||||
|
||||
SFVEC3F POST_SHADER_SSAO::Blur( const SFVEC2I& aShaderPos ) const
|
||||
{
|
||||
const float dCenter = GetDepthAt( aShaderPos );
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
explicit POST_SHADER_SSAO( const CAMERA& aCamera );
|
||||
|
||||
SFVEC3F Shade(const SFVEC2I& aShaderPos ) const override;
|
||||
SFVEC4F ApplyShadeColor( const SFVEC2I& aShaderPos, const SFVEC4F& aInputColor,
|
||||
SFVEC3F ApplyShadeColor( const SFVEC2I& aShaderPos, const SFVEC3F& aInputColor,
|
||||
const SFVEC3F& aShadeColor ) const override;
|
||||
|
||||
SFVEC3F Blur( const SFVEC2I& aShaderPos ) const;
|
||||
@@ -77,8 +77,6 @@ private:
|
||||
* @return transformed color.
|
||||
*/
|
||||
SFVEC3F giColorCurve( const SFVEC3F& aColor ) const;
|
||||
SFVEC4F giColorCurve( const SFVEC4F& aColor ) const;
|
||||
SFVEC3F giColorCurveShade( const SFVEC4F& aColor ) const;
|
||||
|
||||
SFVEC3F* m_shadedBuffer;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2015-2022 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2023 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
|
||||
@@ -23,7 +23,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "render_3d_raytrace_base.h"
|
||||
#include "render_3d_raytrace.h"
|
||||
#include "shapes3D/plane_3d.h"
|
||||
#include "shapes3D/round_segment_3d.h"
|
||||
#include "shapes3D/layer_item_3d.h"
|
||||
@@ -72,7 +72,7 @@ static float TransparencyControl( float aGrayColorValue, float aTransparency )
|
||||
#define UNITS3D_TO_UNITSPCB ( pcbIUScale.IU_PER_MM )
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::setupMaterials()
|
||||
void RENDER_3D_RAYTRACE::setupMaterials()
|
||||
{
|
||||
MATERIAL::SetDefaultRefractionRayCount( m_boardAdapter.m_Cfg->m_Render.raytrace_nrsamples_refractions );
|
||||
MATERIAL::SetDefaultReflectionRayCount( m_boardAdapter.m_Cfg->m_Render.raytrace_nrsamples_reflections );
|
||||
@@ -170,13 +170,13 @@ void RENDER_3D_RAYTRACE_BASE::setupMaterials()
|
||||
|
||||
m_materials.m_Floor = BLINN_PHONG_MATERIAL( bgTop * 0.125f, SFVEC3F( 0.0f, 0.0f, 0.0f ),
|
||||
( SFVEC3F( 1.0f ) - bgTop ) / 3.0f,
|
||||
0.10f * 128.0f, 1.0f, 0.50f );
|
||||
0.10f * 128.0f, 0.0f, 0.50f );
|
||||
m_materials.m_Floor.SetCastShadows( false );
|
||||
m_materials.m_Floor.SetReflectionRecursionCount( 1 );
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::createObject( CONTAINER_3D& aDstContainer, const OBJECT_2D* aObject2D,
|
||||
void RENDER_3D_RAYTRACE::createObject( CONTAINER_3D& aDstContainer, const OBJECT_2D* aObject2D,
|
||||
float aZMin, float aZMax, const MATERIAL* aMaterial,
|
||||
const SFVEC3F& aObjColor )
|
||||
{
|
||||
@@ -227,7 +227,7 @@ void RENDER_3D_RAYTRACE_BASE::createObject( CONTAINER_3D& aDstContainer, const O
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::createItemsFromContainer( const BVH_CONTAINER_2D* aContainer2d,
|
||||
void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aContainer2d,
|
||||
PCB_LAYER_ID aLayer_id,
|
||||
const MATERIAL* aMaterialLayer,
|
||||
const SFVEC3F& aLayerColor,
|
||||
@@ -358,7 +358,7 @@ void RENDER_3D_RAYTRACE_BASE::createItemsFromContainer( const BVH_CONTAINER_2D*
|
||||
extern void buildBoardBoundingBoxPoly( const BOARD* aBoard, SHAPE_POLY_SET& aOutline );
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningReporter,
|
||||
void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningReporter,
|
||||
bool aOnlyLoadCopperAndShapes )
|
||||
{
|
||||
m_reloadRequested = false;
|
||||
@@ -817,7 +817,7 @@ void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarn
|
||||
const SFVEC3F v2 = SFVEC3F( v1.x, v3.y, v1.z );
|
||||
const SFVEC3F v4 = SFVEC3F( v3.x, v1.y, v1.z );
|
||||
|
||||
SFVEC3F floorColor = ConvertSRGBToLinear( m_boardAdapter.m_BgColorTop );
|
||||
SFVEC3F backgroundColor = ConvertSRGBToLinear( m_boardAdapter.m_BgColorTop );
|
||||
|
||||
TRIANGLE* newTriangle1 = new TRIANGLE( v1, v2, v3 );
|
||||
TRIANGLE* newTriangle2 = new TRIANGLE( v3, v4, v1 );
|
||||
@@ -828,8 +828,8 @@ void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarn
|
||||
newTriangle1->SetMaterial( &m_materials.m_Floor );
|
||||
newTriangle2->SetMaterial( &m_materials.m_Floor );
|
||||
|
||||
newTriangle1->SetColor( floorColor );
|
||||
newTriangle2->SetColor( floorColor );
|
||||
newTriangle1->SetColor( backgroundColor );
|
||||
newTriangle2->SetColor( backgroundColor );
|
||||
|
||||
// Ceiling triangles
|
||||
const float maxZ = glm::max( containerBBox.Max().z, boardBBox.Max().z );
|
||||
@@ -848,8 +848,8 @@ void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarn
|
||||
newTriangle3->SetMaterial( &m_materials.m_Floor );
|
||||
newTriangle4->SetMaterial( &m_materials.m_Floor );
|
||||
|
||||
newTriangle3->SetColor( floorColor );
|
||||
newTriangle4->SetColor( floorColor );
|
||||
newTriangle3->SetColor( backgroundColor );
|
||||
newTriangle4->SetColor( backgroundColor );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -962,7 +962,7 @@ void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarn
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::insertHole( const PCB_VIA* aVia )
|
||||
void RENDER_3D_RAYTRACE::insertHole( const PCB_VIA* aVia )
|
||||
{
|
||||
PCB_LAYER_ID top_layer, bottom_layer;
|
||||
int radiusBUI = ( aVia->GetDrillValue() / 2 );
|
||||
@@ -993,7 +993,7 @@ void RENDER_3D_RAYTRACE_BASE::insertHole( const PCB_VIA* aVia )
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::insertHole( const PAD* aPad )
|
||||
void RENDER_3D_RAYTRACE::insertHole( const PAD* aPad )
|
||||
{
|
||||
const OBJECT_2D* object2d_A = nullptr;
|
||||
|
||||
@@ -1164,7 +1164,7 @@ void RENDER_3D_RAYTRACE_BASE::insertHole( const PAD* aPad )
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::addPadsAndVias()
|
||||
void RENDER_3D_RAYTRACE::addPadsAndVias()
|
||||
{
|
||||
if( !m_boardAdapter.GetBoard() )
|
||||
return;
|
||||
@@ -1193,7 +1193,7 @@ void RENDER_3D_RAYTRACE_BASE::addPadsAndVias()
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::load3DModels( CONTAINER_3D& aDstContainer, bool aSkipMaterialInformation )
|
||||
void RENDER_3D_RAYTRACE::load3DModels( CONTAINER_3D& aDstContainer, bool aSkipMaterialInformation )
|
||||
{
|
||||
if( !m_boardAdapter.GetBoard() )
|
||||
return;
|
||||
@@ -1315,7 +1315,7 @@ void RENDER_3D_RAYTRACE_BASE::load3DModels( CONTAINER_3D& aDstContainer, bool aS
|
||||
}
|
||||
|
||||
|
||||
MODEL_MATERIALS* RENDER_3D_RAYTRACE_BASE::getModelMaterial( const S3DMODEL* a3DModel )
|
||||
MODEL_MATERIALS* RENDER_3D_RAYTRACE::getModelMaterial( const S3DMODEL* a3DModel )
|
||||
{
|
||||
MODEL_MATERIALS* materialVector;
|
||||
|
||||
@@ -1418,7 +1418,7 @@ MODEL_MATERIALS* RENDER_3D_RAYTRACE_BASE::getModelMaterial( const S3DMODEL* a3DM
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::addModels( CONTAINER_3D& aDstContainer, const S3DMODEL* a3DModel,
|
||||
void RENDER_3D_RAYTRACE::addModels( CONTAINER_3D& aDstContainer, const S3DMODEL* a3DModel,
|
||||
const glm::mat4& aModelMatrix, float aFPOpacity,
|
||||
bool aSkipMaterialInformation, BOARD_ITEM* aBoardItem )
|
||||
{
|
||||
|
||||
+318
-137
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2020 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2023 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
|
||||
@@ -22,28 +22,32 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "render_3d_raytrace_base.h"
|
||||
#include "render_3d_raytrace.h"
|
||||
#include "mortoncodes.h"
|
||||
#include "../color_rgba.h"
|
||||
#include "../color_rgb.h"
|
||||
#include "3d_fastmath.h"
|
||||
#include "3d_math.h"
|
||||
#include "../common_ogl/ogl_utils.h"
|
||||
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
|
||||
#include <wx/log.h>
|
||||
|
||||
|
||||
RENDER_3D_RAYTRACE_BASE::RENDER_3D_RAYTRACE_BASE( BOARD_ADAPTER& aAdapter, CAMERA& aCamera ) :
|
||||
RENDER_3D_BASE( aAdapter, aCamera ),
|
||||
m_postShaderSsao( aCamera )
|
||||
RENDER_3D_RAYTRACE::RENDER_3D_RAYTRACE( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter, CAMERA& aCamera ) :
|
||||
RENDER_3D_BASE( aCanvas, aAdapter, aCamera ),
|
||||
m_postShaderSsao( aCamera )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "RENDER_3D_RAYTRACE_BASE::RENDER_3D_RAYTRACE_BASE" ) );
|
||||
wxLogTrace( m_logTrace, wxT( "RENDER_3D_RAYTRACE::RENDER_3D_RAYTRACE" ) );
|
||||
|
||||
//m_pboId = GL_NONE;
|
||||
//m_pboDataSize = 0;
|
||||
m_openglSupportsVertexBufferObjects = false;
|
||||
m_pboId = GL_NONE;
|
||||
m_pboDataSize = 0;
|
||||
m_accelerator = nullptr;
|
||||
m_convertedDummyBlockCount = 0;
|
||||
m_converted2dRoundSegmentCount = 0;
|
||||
@@ -58,7 +62,6 @@ RENDER_3D_RAYTRACE_BASE::RENDER_3D_RAYTRACE_BASE( BOARD_ADAPTER& aAdapter, CAMER
|
||||
m_xoffset = 0;
|
||||
m_yoffset = 0;
|
||||
|
||||
m_is_canvas_initialized = false;
|
||||
m_isPreview = false;
|
||||
m_renderState = RT_RENDER_STATE_MAX; // Set to an initial invalid state
|
||||
m_renderStartTime = 0;
|
||||
@@ -66,9 +69,9 @@ RENDER_3D_RAYTRACE_BASE::RENDER_3D_RAYTRACE_BASE( BOARD_ADAPTER& aAdapter, CAMER
|
||||
}
|
||||
|
||||
|
||||
RENDER_3D_RAYTRACE_BASE::~RENDER_3D_RAYTRACE_BASE()
|
||||
RENDER_3D_RAYTRACE::~RENDER_3D_RAYTRACE()
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "RENDER_3D_RAYTRACE_BASE::~RENDER_3D_RAYTRACE_BASE" ) );
|
||||
wxLogTrace( m_logTrace, wxT( "RENDER_3D_RAYTRACE::~RENDER_3D_RAYTRACE" ) );
|
||||
|
||||
delete m_accelerator;
|
||||
m_accelerator = nullptr;
|
||||
@@ -81,16 +84,43 @@ RENDER_3D_RAYTRACE_BASE::~RENDER_3D_RAYTRACE_BASE()
|
||||
|
||||
delete[] m_shaderBuffer;
|
||||
m_shaderBuffer = nullptr;
|
||||
|
||||
deletePbo();
|
||||
}
|
||||
|
||||
|
||||
int RENDER_3D_RAYTRACE_BASE::GetWaitForEditingTimeOut()
|
||||
int RENDER_3D_RAYTRACE::GetWaitForEditingTimeOut()
|
||||
{
|
||||
return 200; // ms
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::restartRenderState()
|
||||
void RENDER_3D_RAYTRACE::deletePbo()
|
||||
{
|
||||
// Delete PBO if it was created
|
||||
if( m_openglSupportsVertexBufferObjects )
|
||||
{
|
||||
if( glIsBufferARB( m_pboId ) )
|
||||
glDeleteBuffers( 1, &m_pboId );
|
||||
|
||||
m_pboId = GL_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE::SetCurWindowSize( const wxSize& aSize )
|
||||
{
|
||||
if( m_windowSize != aSize )
|
||||
{
|
||||
m_windowSize = aSize;
|
||||
glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
|
||||
|
||||
initializeNewWindowSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE::restartRenderState()
|
||||
{
|
||||
m_renderStartTime = GetRunningMicroSecs();
|
||||
|
||||
@@ -106,22 +136,154 @@ void RENDER_3D_RAYTRACE_BASE::restartRenderState()
|
||||
}
|
||||
|
||||
|
||||
static inline void SetPixel( GLubyte* p, const COLOR_RGBA& v )
|
||||
static inline void SetPixel( GLubyte* p, const COLOR_RGB& v )
|
||||
{
|
||||
p[0] = v.c[0];
|
||||
p[1] = v.c[1];
|
||||
p[2] = v.c[2];
|
||||
p[3] = v.c[3];
|
||||
p[3] = 255;
|
||||
}
|
||||
|
||||
|
||||
SFVEC4F RENDER_3D_RAYTRACE_BASE::premultiplyAlpha( const SFVEC4F& aInput )
|
||||
bool RENDER_3D_RAYTRACE::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
|
||||
REPORTER* aWarningReporter )
|
||||
{
|
||||
return SFVEC4F( aInput.r * aInput.a, aInput.g * aInput.a, aInput.b * aInput.a, aInput.a );
|
||||
bool requestRedraw = false;
|
||||
|
||||
// Initialize openGL if need
|
||||
if( !m_is_opengl_initialized )
|
||||
{
|
||||
if( !initializeOpenGL() )
|
||||
return false;
|
||||
|
||||
//aIsMoving = true;
|
||||
requestRedraw = true;
|
||||
|
||||
// It will assign the first time the windows size, so it will now
|
||||
// revert to preview mode the first time the Redraw is called
|
||||
m_oldWindowsSize = m_windowSize;
|
||||
initializeBlockPositions();
|
||||
}
|
||||
|
||||
std::unique_ptr<BUSY_INDICATOR> busy = CreateBusyIndicator();
|
||||
|
||||
// Reload board if it was requested
|
||||
if( m_reloadRequested )
|
||||
{
|
||||
if( aStatusReporter )
|
||||
aStatusReporter->Report( _( "Loading..." ) );
|
||||
|
||||
//aIsMoving = true;
|
||||
requestRedraw = true;
|
||||
Reload( aStatusReporter, aWarningReporter, false );
|
||||
}
|
||||
|
||||
|
||||
// Recalculate constants if windows size was changed
|
||||
if( m_windowSize != m_oldWindowsSize )
|
||||
{
|
||||
m_oldWindowsSize = m_windowSize;
|
||||
aIsMoving = true;
|
||||
requestRedraw = true;
|
||||
|
||||
initializeBlockPositions();
|
||||
}
|
||||
|
||||
|
||||
// Clear buffers
|
||||
glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
glClearDepth( 1.0f );
|
||||
glClearStencil( 0x00 );
|
||||
glClear( GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||
|
||||
// 4-byte pixel alignment
|
||||
glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
|
||||
|
||||
glDisable( GL_STENCIL_TEST );
|
||||
glDisable( GL_LIGHTING );
|
||||
glDisable( GL_COLOR_MATERIAL );
|
||||
glDisable( GL_DEPTH_TEST );
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
glDisable( GL_BLEND );
|
||||
glDisable( GL_MULTISAMPLE );
|
||||
|
||||
const bool was_camera_changed = m_camera.ParametersChanged();
|
||||
|
||||
if( requestRedraw || aIsMoving || was_camera_changed )
|
||||
m_renderState = RT_RENDER_STATE_MAX; // Set to an invalid state,
|
||||
// so it will restart again latter
|
||||
|
||||
// This will only render if need, otherwise it will redraw the PBO on the screen again
|
||||
if( aIsMoving || was_camera_changed )
|
||||
{
|
||||
// Set head light (camera view light) with the opposite direction of the camera
|
||||
if( m_cameraLight )
|
||||
m_cameraLight->SetDirection( -m_camera.GetDir() );
|
||||
|
||||
OglDrawBackground( SFVEC3F( m_boardAdapter.m_BgColorTop),
|
||||
SFVEC3F( m_boardAdapter.m_BgColorBot) );
|
||||
|
||||
// Bind PBO
|
||||
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, m_pboId );
|
||||
|
||||
// Get the PBO pixel pointer to write the data
|
||||
GLubyte* ptrPBO = (GLubyte *)glMapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
|
||||
GL_WRITE_ONLY_ARB );
|
||||
|
||||
if( ptrPBO )
|
||||
{
|
||||
renderPreview( ptrPBO );
|
||||
|
||||
// release pointer to mapping buffer, this initialize the coping to PBO
|
||||
glUnmapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB );
|
||||
}
|
||||
|
||||
glWindowPos2i( m_xoffset, m_yoffset );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Bind PBO
|
||||
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, m_pboId );
|
||||
|
||||
if( m_renderState != RT_RENDER_STATE_FINISH )
|
||||
{
|
||||
// Get the PBO pixel pointer to write the data
|
||||
GLubyte* ptrPBO = (GLubyte *)glMapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
|
||||
GL_WRITE_ONLY_ARB );
|
||||
|
||||
if( ptrPBO )
|
||||
{
|
||||
render( ptrPBO, aStatusReporter );
|
||||
|
||||
if( m_renderState != RT_RENDER_STATE_FINISH )
|
||||
requestRedraw = true;
|
||||
|
||||
// release pointer to mapping buffer, this initialize the coping to PBO
|
||||
glUnmapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_renderState == RT_RENDER_STATE_FINISH )
|
||||
{
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
}
|
||||
|
||||
glWindowPos2i( m_xoffset, m_yoffset );
|
||||
}
|
||||
|
||||
// This way it will blend the progress rendering with the last buffer. eg:
|
||||
// if it was called after a openGL.
|
||||
glEnable( GL_BLEND );
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
glEnable( GL_ALPHA_TEST );
|
||||
glDrawPixels( m_realBufferSize.x, m_realBufferSize.y, GL_RGBA, GL_UNSIGNED_BYTE, 0 );
|
||||
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, 0 );
|
||||
|
||||
return requestRedraw;
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::render( GLubyte* ptrPBO, REPORTER* aStatusReporter )
|
||||
void RENDER_3D_RAYTRACE::render( GLubyte* ptrPBO, REPORTER* aStatusReporter )
|
||||
{
|
||||
if( ( m_renderState == RT_RENDER_STATE_FINISH ) || ( m_renderState >= RT_RENDER_STATE_MAX ) )
|
||||
{
|
||||
@@ -145,10 +307,8 @@ void RENDER_3D_RAYTRACE_BASE::render( GLubyte* ptrPBO, REPORTER* aStatusReporter
|
||||
}
|
||||
}
|
||||
|
||||
m_backgroundColorTop =
|
||||
ConvertSRGBAToLinear( premultiplyAlpha( m_boardAdapter.m_BgColorTop ) );
|
||||
m_backgroundColorBottom =
|
||||
ConvertSRGBAToLinear( premultiplyAlpha( m_boardAdapter.m_BgColorBot ) );
|
||||
m_backgroundColorTop = ConvertSRGBToLinear( (SFVEC3F)m_boardAdapter.m_BgColorTop );
|
||||
m_backgroundColorBottom = ConvertSRGBToLinear( (SFVEC3F)m_boardAdapter.m_BgColorBot );
|
||||
}
|
||||
|
||||
switch( m_renderState )
|
||||
@@ -174,14 +334,14 @@ void RENDER_3D_RAYTRACE_BASE::render( GLubyte* ptrPBO, REPORTER* aStatusReporter
|
||||
if( aStatusReporter && ( m_renderState == RT_RENDER_STATE_FINISH ) )
|
||||
{
|
||||
// Calculation time in seconds
|
||||
const double elapsed_time = (double) ( GetRunningMicroSecs() - m_renderStartTime ) / 1e6;
|
||||
const double elapsed_time = (double)( GetRunningMicroSecs() - m_renderStartTime ) / 1e6;
|
||||
|
||||
aStatusReporter->Report( wxString::Format( _( "Rendering time %.3f s" ), elapsed_time ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::renderTracing( GLubyte* ptrPBO, REPORTER* aStatusReporter )
|
||||
void RENDER_3D_RAYTRACE::renderTracing( GLubyte* ptrPBO, REPORTER* aStatusReporter )
|
||||
{
|
||||
m_isPreview = false;
|
||||
|
||||
@@ -196,8 +356,6 @@ void RENDER_3D_RAYTRACE_BASE::renderTracing( GLubyte* ptrPBO, REPORTER* aStatusR
|
||||
std::max<size_t>( std::thread::hardware_concurrency(), 2 ),
|
||||
m_blockPositions.size() );
|
||||
|
||||
const int timeLimit = m_blockPositions.size() > 40000 ? 500 : 200;
|
||||
|
||||
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
||||
{
|
||||
std::thread t = std::thread( [&]()
|
||||
@@ -214,10 +372,8 @@ void RENDER_3D_RAYTRACE_BASE::renderTracing( GLubyte* ptrPBO, REPORTER* aStatusR
|
||||
|
||||
// Check if it spend already some time render and request to exit
|
||||
// to display the progress
|
||||
auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::steady_clock::now() - startTime );
|
||||
|
||||
if( diff.count() > timeLimit )
|
||||
if( std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::steady_clock::now() - startTime ).count() > 150 )
|
||||
breakLoop = true;
|
||||
}
|
||||
}
|
||||
@@ -268,11 +424,6 @@ static SFVEC3F convertLinearToSRGB( const SFVEC3F& aRGBcolor )
|
||||
glm::lessThan( clampedColor, SFVEC3F(0.0031308f) ) );
|
||||
}
|
||||
|
||||
static SFVEC4F convertLinearToSRGBA( const SFVEC4F& aRGBAcolor )
|
||||
{
|
||||
return SFVEC4F( convertLinearToSRGB( SFVEC3F( aRGBAcolor ) ), aRGBAcolor.a );
|
||||
}
|
||||
|
||||
|
||||
// This function implements the conversion from sRGB to linear RGB
|
||||
// https://github.com/g-truc/glm/blob/master/glm/gtc/color_space.inl#L35
|
||||
@@ -287,18 +438,13 @@ SFVEC3F ConvertSRGBToLinear( const SFVEC3F& aSRGBcolor )
|
||||
glm::lessThanEqual( aSRGBcolor, SFVEC3F( 0.04045f ) ) );
|
||||
}
|
||||
|
||||
SFVEC4F ConvertSRGBAToLinear( const SFVEC4F& aSRGBAcolor )
|
||||
{
|
||||
return SFVEC4F( ConvertSRGBToLinear( SFVEC3F( aSRGBAcolor ) ), aSRGBAcolor.a );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::renderFinalColor( GLubyte* ptrPBO, const SFVEC4F& rgbColor,
|
||||
void RENDER_3D_RAYTRACE::renderFinalColor( GLubyte* ptrPBO, const SFVEC3F& rgbColor,
|
||||
bool applyColorSpaceConversion )
|
||||
{
|
||||
SFVEC4F color = rgbColor;
|
||||
SFVEC3F color = rgbColor;
|
||||
|
||||
#ifdef USE_SRGB_SPACE
|
||||
/// @note This should be used in future when the KiCad support a greater version of glm lib.
|
||||
@@ -312,7 +458,7 @@ void RENDER_3D_RAYTRACE_BASE::renderFinalColor( GLubyte* ptrPBO, const SFVEC4F&
|
||||
ptrPBO[0] = (unsigned int) glm::clamp( (int) ( color.r * 255 ), 0, 255 );
|
||||
ptrPBO[1] = (unsigned int) glm::clamp( (int) ( color.g * 255 ), 0, 255 );
|
||||
ptrPBO[2] = (unsigned int) glm::clamp( (int) ( color.b * 255 ), 0, 255 );
|
||||
ptrPBO[3] = (unsigned int) glm::clamp( (int) ( color.a * 255 ), 0, 255 );
|
||||
ptrPBO[3] = 255;
|
||||
}
|
||||
|
||||
|
||||
@@ -330,9 +476,9 @@ static void HITINFO_PACKET_init( HITINFO_PACKET* aHitPacket )
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::renderRayPackets( const SFVEC4F* bgColorY, const RAY* aRayPkt,
|
||||
void RENDER_3D_RAYTRACE::renderRayPackets( const SFVEC3F* bgColorY, const RAY* aRayPkt,
|
||||
HITINFO_PACKET* aHitPacket, bool is_testShadow,
|
||||
SFVEC4F* aOutHitColor )
|
||||
SFVEC3F* aOutHitColor )
|
||||
{
|
||||
for( unsigned int y = 0, i = 0; y < RAYPACKET_DIM; ++y )
|
||||
{
|
||||
@@ -352,10 +498,10 @@ void RENDER_3D_RAYTRACE_BASE::renderRayPackets( const SFVEC4F* bgColorY, const R
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::renderAntiAliasPackets( const SFVEC4F* aBgColorY,
|
||||
void RENDER_3D_RAYTRACE::renderAntiAliasPackets( const SFVEC3F* aBgColorY,
|
||||
const HITINFO_PACKET* aHitPck_X0Y0,
|
||||
const HITINFO_PACKET* aHitPck_AA_X1Y1,
|
||||
const RAY* aRayPck, SFVEC4F* aOutHitColor )
|
||||
const RAY* aRayPck, SFVEC3F* aOutHitColor )
|
||||
{
|
||||
const bool is_testShadow = m_boardAdapter.m_Cfg->m_Render.raytrace_shadows;
|
||||
|
||||
@@ -476,7 +622,7 @@ void RENDER_3D_RAYTRACE_BASE::renderAntiAliasPackets( const SFVEC4F* aBgColorY,
|
||||
#define DISP_FACTOR 0.075f
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( GLubyte* ptrPBO, signed int iBlock )
|
||||
void RENDER_3D_RAYTRACE::renderBlockTracing( GLubyte* ptrPBO, signed int iBlock )
|
||||
{
|
||||
// Initialize ray packets
|
||||
const SFVEC2UI& blockPos = m_blockPositions[iBlock];
|
||||
@@ -491,14 +637,14 @@ void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( GLubyte* ptrPBO, signed int iB
|
||||
HITINFO_PACKET_init( hitPacket_X0Y0 );
|
||||
|
||||
// Calculate background gradient color
|
||||
SFVEC4F bgColor[RAYPACKET_DIM];// Store a vertical gradient color
|
||||
SFVEC3F bgColor[RAYPACKET_DIM];// Store a vertical gradient color
|
||||
|
||||
for( unsigned int y = 0; y < RAYPACKET_DIM; ++y )
|
||||
{
|
||||
const float posYfactor = (float) ( blockPosI.y + y ) / (float) m_windowSize.y;
|
||||
|
||||
bgColor[y] = m_backgroundColorTop * SFVEC4F(posYfactor) +
|
||||
m_backgroundColorBottom * ( SFVEC4F(1.0f) - SFVEC4F(posYfactor) );
|
||||
bgColor[y] = m_backgroundColorTop * SFVEC3F(posYfactor) +
|
||||
m_backgroundColorBottom * ( SFVEC3F(1.0f) - SFVEC3F(posYfactor) );
|
||||
}
|
||||
|
||||
// Intersect ray packets (calculate the intersection with rays and objects)
|
||||
@@ -509,7 +655,7 @@ void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( GLubyte* ptrPBO, signed int iB
|
||||
{
|
||||
for( unsigned int y = 0; y < RAYPACKET_DIM; ++y )
|
||||
{
|
||||
const SFVEC4F& outColor = bgColor[y];
|
||||
const SFVEC3F& outColor = bgColor[y];
|
||||
|
||||
const unsigned int yBlockPos = blockPos.y + y;
|
||||
|
||||
@@ -529,7 +675,7 @@ void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( GLubyte* ptrPBO, signed int iB
|
||||
|
||||
for( unsigned int y = 0; y < RAYPACKET_DIM; ++y )
|
||||
{
|
||||
const SFVEC4F& outColor = bgColor[y];
|
||||
const SFVEC3F& outColor = bgColor[y];
|
||||
|
||||
const unsigned int yConst = blockPos.x + ( ( y + blockPos.y ) * m_realBufferSize.x );
|
||||
|
||||
@@ -546,7 +692,7 @@ void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( GLubyte* ptrPBO, signed int iB
|
||||
return;
|
||||
}
|
||||
|
||||
SFVEC4F hitColor_X0Y0[RAYPACKET_RAYS_PER_PACKET];
|
||||
SFVEC3F hitColor_X0Y0[RAYPACKET_RAYS_PER_PACKET];
|
||||
|
||||
// Shade original (0, 0) hits ("paint" the intersected objects)
|
||||
renderRayPackets( bgColor, blockPacket.m_ray, hitPacket_X0Y0,
|
||||
@@ -554,7 +700,7 @@ void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( GLubyte* ptrPBO, signed int iB
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.raytrace_anti_aliasing )
|
||||
{
|
||||
SFVEC4F hitColor_AA_X1Y1[RAYPACKET_RAYS_PER_PACKET];
|
||||
SFVEC3F hitColor_AA_X1Y1[RAYPACKET_RAYS_PER_PACKET];
|
||||
|
||||
// Intersect one blockPosI + (0.5, 0.5) used for anti aliasing calculation
|
||||
HITINFO_PACKET hitPacket_AA_X1Y1[RAYPACKET_RAYS_PER_PACKET];
|
||||
@@ -568,7 +714,7 @@ void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( GLubyte* ptrPBO, signed int iB
|
||||
// Missed all the package
|
||||
for( unsigned int y = 0, i = 0; y < RAYPACKET_DIM; ++y )
|
||||
{
|
||||
const SFVEC4F& outColor = bgColor[y];
|
||||
const SFVEC3F& outColor = bgColor[y];
|
||||
|
||||
for( unsigned int x = 0; x < RAYPACKET_DIM; ++x, ++i )
|
||||
hitColor_AA_X1Y1[i] = outColor;
|
||||
@@ -580,13 +726,13 @@ void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( GLubyte* ptrPBO, signed int iB
|
||||
m_boardAdapter.m_Cfg->m_Render.raytrace_shadows, hitColor_AA_X1Y1 );
|
||||
}
|
||||
|
||||
SFVEC4F hitColor_AA_X1Y0[RAYPACKET_RAYS_PER_PACKET];
|
||||
SFVEC4F hitColor_AA_X0Y1[RAYPACKET_RAYS_PER_PACKET];
|
||||
SFVEC4F hitColor_AA_X0Y1_half[RAYPACKET_RAYS_PER_PACKET];
|
||||
SFVEC3F hitColor_AA_X1Y0[RAYPACKET_RAYS_PER_PACKET];
|
||||
SFVEC3F hitColor_AA_X0Y1[RAYPACKET_RAYS_PER_PACKET];
|
||||
SFVEC3F hitColor_AA_X0Y1_half[RAYPACKET_RAYS_PER_PACKET];
|
||||
|
||||
for( unsigned int i = 0; i < RAYPACKET_RAYS_PER_PACKET; ++i )
|
||||
{
|
||||
SFVEC4F color_average = ( hitColor_X0Y0[i] + hitColor_AA_X1Y1[i] ) * SFVEC4F( 0.5f );
|
||||
SFVEC3F color_average = ( hitColor_X0Y0[i] + hitColor_AA_X1Y1[i] ) * SFVEC3F( 0.5f );
|
||||
|
||||
hitColor_AA_X1Y0[i] = color_average;
|
||||
hitColor_AA_X0Y1[i] = color_average;
|
||||
@@ -623,7 +769,7 @@ void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( GLubyte* ptrPBO, signed int iB
|
||||
{
|
||||
hitColor_X0Y0[i] = ( hitColor_X0Y0[i] + hitColor_AA_X1Y1[i] + hitColor_AA_X1Y0[i] +
|
||||
hitColor_AA_X0Y1[i] + hitColor_AA_X0Y1_half[i] ) *
|
||||
SFVEC4F( 1.0f / 5.0f );
|
||||
SFVEC3F( 1.0f / 5.0f );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,7 +789,7 @@ void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( GLubyte* ptrPBO, signed int iB
|
||||
|
||||
for( unsigned int x = 0; x < RAYPACKET_DIM; ++x, ++i )
|
||||
{
|
||||
const SFVEC4F& hColor = hitColor_X0Y0[i];
|
||||
const SFVEC3F& hColor = hitColor_X0Y0[i];
|
||||
|
||||
if( hitPacket_X0Y0[i].m_hitresult == true )
|
||||
{
|
||||
@@ -687,7 +833,7 @@ void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( GLubyte* ptrPBO, signed int iB
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::postProcessShading( GLubyte* /* ptrPBO */, REPORTER* aStatusReporter )
|
||||
void RENDER_3D_RAYTRACE::postProcessShading( GLubyte* /* ptrPBO */, REPORTER* aStatusReporter )
|
||||
{
|
||||
if( m_boardAdapter.m_Cfg->m_Render.raytrace_post_processing )
|
||||
{
|
||||
@@ -739,7 +885,7 @@ void RENDER_3D_RAYTRACE_BASE::postProcessShading( GLubyte* /* ptrPBO */, REPORTE
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::postProcessBlurFinish( GLubyte* ptrPBO, REPORTER* /* aStatusReporter */ )
|
||||
void RENDER_3D_RAYTRACE::postProcessBlurFinish( GLubyte* ptrPBO, REPORTER* /* aStatusReporter */ )
|
||||
{
|
||||
if( m_boardAdapter.m_Cfg->m_Render.raytrace_post_processing )
|
||||
{
|
||||
@@ -763,13 +909,13 @@ void RENDER_3D_RAYTRACE_BASE::postProcessBlurFinish( GLubyte* ptrPBO, REPORTER*
|
||||
const SFVEC3F bluredShadeColor = m_postShaderSsao.Blur( SFVEC2I( x, y ) );
|
||||
|
||||
#ifdef USE_SRGB_SPACE
|
||||
const SFVEC4F originColor = convertLinearToSRGBA(
|
||||
const SFVEC3F originColor = convertLinearToSRGB(
|
||||
m_postShaderSsao.GetColorAtNotProtected( SFVEC2I( x, y ) ) );
|
||||
#else
|
||||
const SFVEC4F originColor =
|
||||
const SFVEC3F originColor =
|
||||
m_postShaderSsao.GetColorAtNotProtected( SFVEC2I( x, y ) );
|
||||
#endif
|
||||
const SFVEC4F shadedColor = m_postShaderSsao.ApplyShadeColor(
|
||||
const SFVEC3F shadedColor = m_postShaderSsao.ApplyShadeColor(
|
||||
SFVEC2I( x, y ), originColor, bluredShadeColor );
|
||||
|
||||
renderFinalColor( ptr, shadedColor, false );
|
||||
@@ -796,7 +942,7 @@ void RENDER_3D_RAYTRACE_BASE::postProcessBlurFinish( GLubyte* ptrPBO, REPORTER*
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
void RENDER_3D_RAYTRACE::renderPreview( GLubyte* ptrPBO )
|
||||
{
|
||||
m_isPreview = true;
|
||||
|
||||
@@ -834,47 +980,45 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
m_accelerator->Intersect( blockPacket, hitPacket );
|
||||
|
||||
// Calculate background gradient color
|
||||
SFVEC4F bgColor[RAYPACKET_DIM];
|
||||
|
||||
SFVEC4F bgTopColor = premultiplyAlpha( m_boardAdapter.m_BgColorTop );
|
||||
SFVEC4F bgBotColor = premultiplyAlpha( m_boardAdapter.m_BgColorBot );
|
||||
SFVEC3F bgColor[RAYPACKET_DIM];
|
||||
|
||||
for( unsigned int y = 0; y < RAYPACKET_DIM; ++y )
|
||||
{
|
||||
const float posYfactor =
|
||||
(float) ( windowsPos.y + y * 4.0f ) / (float) m_windowSize.y;
|
||||
|
||||
bgColor[y] = bgTopColor * SFVEC4F( posYfactor )
|
||||
+ bgBotColor * ( SFVEC4F( 1.0f ) - SFVEC4F( posYfactor ) );
|
||||
bgColor[y] = (SFVEC3F) m_boardAdapter.m_BgColorTop * SFVEC3F( posYfactor )
|
||||
+ (SFVEC3F) m_boardAdapter.m_BgColorBot
|
||||
* ( SFVEC3F( 1.0f ) - SFVEC3F( posYfactor ) );
|
||||
}
|
||||
|
||||
COLOR_RGBA hitColorShading[RAYPACKET_RAYS_PER_PACKET];
|
||||
COLOR_RGB hitColorShading[RAYPACKET_RAYS_PER_PACKET];
|
||||
|
||||
for( unsigned int i = 0; i < RAYPACKET_RAYS_PER_PACKET; ++i )
|
||||
{
|
||||
const SFVEC4F bhColorY = bgColor[i / RAYPACKET_DIM];
|
||||
const SFVEC3F bhColorY = bgColor[i / RAYPACKET_DIM];
|
||||
|
||||
if( hitPacket[i].m_hitresult == true )
|
||||
{
|
||||
const SFVEC4F hitColor = shadeHit( bhColorY, blockPacket.m_ray[i],
|
||||
const SFVEC3F hitColor = shadeHit( bhColorY, blockPacket.m_ray[i],
|
||||
hitPacket[i].m_HitInfo, false,
|
||||
0, false );
|
||||
|
||||
hitColorShading[i] = COLOR_RGBA( hitColor );
|
||||
hitColorShading[i] = COLOR_RGB( hitColor );
|
||||
}
|
||||
else
|
||||
hitColorShading[i] = bhColorY;
|
||||
}
|
||||
|
||||
COLOR_RGBA cLRB_old[(RAYPACKET_DIM - 1)];
|
||||
COLOR_RGB cLRB_old[(RAYPACKET_DIM - 1)];
|
||||
|
||||
for( unsigned int y = 0; y < (RAYPACKET_DIM - 1); ++y )
|
||||
{
|
||||
const SFVEC4F bgColorY = bgColor[y];
|
||||
const COLOR_RGBA bgColorYRGB = COLOR_RGBA( bgColorY );
|
||||
const SFVEC3F bgColorY = bgColor[y];
|
||||
const COLOR_RGB bgColorYRGB = COLOR_RGB( bgColorY );
|
||||
|
||||
// This stores cRTB from the last block to be reused next time in a cLTB pixel
|
||||
COLOR_RGBA cRTB_old;
|
||||
COLOR_RGB cRTB_old;
|
||||
|
||||
//RAY cRTB_ray;
|
||||
//HITINFO cRTB_hitInfo;
|
||||
@@ -897,13 +1041,13 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
const unsigned int iRB = ( ( x + 1 ) + RAYPACKET_DIM * ( y + 1 ) );
|
||||
|
||||
// !TODO: skip when there are no hits
|
||||
const COLOR_RGBA& cLT = hitColorShading[ iLT ];
|
||||
const COLOR_RGBA& cRT = hitColorShading[ iRT ];
|
||||
const COLOR_RGBA& cLB = hitColorShading[ iLB ];
|
||||
const COLOR_RGBA& cRB = hitColorShading[ iRB ];
|
||||
const COLOR_RGB& cLT = hitColorShading[ iLT ];
|
||||
const COLOR_RGB& cRT = hitColorShading[ iRT ];
|
||||
const COLOR_RGB& cLB = hitColorShading[ iLB ];
|
||||
const COLOR_RGB& cRB = hitColorShading[ iRB ];
|
||||
|
||||
// Trace and shade cC
|
||||
COLOR_RGBA cC = bgColorYRGB;
|
||||
COLOR_RGB cC = bgColorYRGB;
|
||||
|
||||
const SFVEC3F& oriLT = blockPacket.m_ray[ iLT ].m_Origin;
|
||||
const SFVEC3F& oriRB = blockPacket.m_ray[ iRB ].m_Origin;
|
||||
@@ -955,7 +1099,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
|
||||
if( hittedC )
|
||||
{
|
||||
cC = COLOR_RGBA( shadeHit( bgColorY, centerRay, centerHitInfo,
|
||||
cC = COLOR_RGB( shadeHit( bgColorY, centerRay, centerHitInfo,
|
||||
false, 0, false ) );
|
||||
}
|
||||
else
|
||||
@@ -964,13 +1108,13 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
hittedC = m_accelerator->Intersect( centerRay, centerHitInfo );
|
||||
|
||||
if( hittedC )
|
||||
cC = COLOR_RGBA( shadeHit( bgColorY, centerRay, centerHitInfo,
|
||||
cC = COLOR_RGB( shadeHit( bgColorY, centerRay, centerHitInfo,
|
||||
false, 0, false ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Trace and shade cLRT
|
||||
COLOR_RGBA cLRT = bgColorYRGB;
|
||||
COLOR_RGB cLRT = bgColorYRGB;
|
||||
|
||||
const SFVEC3F& oriRT = blockPacket.m_ray[ iRT ].m_Origin;
|
||||
const SFVEC3F& dirRT = blockPacket.m_ray[ iRT ].m_Dir;
|
||||
@@ -996,7 +1140,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
glm::normalize( ( hitPacket[ iLT ].m_HitInfo.m_HitNormal +
|
||||
hitPacket[ iRT ].m_HitInfo.m_HitNormal ) * 0.5f );
|
||||
|
||||
cLRT = COLOR_RGBA( shadeHit( bgColorY, rayLRT, hitInfoLRT, false,
|
||||
cLRT = COLOR_RGB( shadeHit( bgColorY, rayLRT, hitInfoLRT, false,
|
||||
0, false ) );
|
||||
cLRT = BlendColor( cLRT, BlendColor( cLT, cRT ) );
|
||||
}
|
||||
@@ -1021,14 +1165,14 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
nodeRT );
|
||||
|
||||
if( hittedLRT )
|
||||
cLRT = COLOR_RGBA( shadeHit( bgColorY, rayLRT, hitInfoLRT,
|
||||
cLRT = COLOR_RGB( shadeHit( bgColorY, rayLRT, hitInfoLRT,
|
||||
false, 0, false ) );
|
||||
else
|
||||
{
|
||||
hitInfoLRT.m_tHit = std::numeric_limits<float>::infinity();
|
||||
|
||||
if( m_accelerator->Intersect( rayLRT,hitInfoLRT ) )
|
||||
cLRT = COLOR_RGBA( shadeHit( bgColorY, rayLRT,
|
||||
cLRT = COLOR_RGB( shadeHit( bgColorY, rayLRT,
|
||||
hitInfoLRT, false,
|
||||
0, false ) );
|
||||
}
|
||||
@@ -1041,7 +1185,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
}
|
||||
|
||||
// Trace and shade cLTB
|
||||
COLOR_RGBA cLTB = bgColorYRGB;
|
||||
COLOR_RGB cLTB = bgColorYRGB;
|
||||
|
||||
if( x == 0 )
|
||||
{
|
||||
@@ -1066,7 +1210,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
hitInfoLTB.m_HitNormal =
|
||||
glm::normalize( ( hitPacket[ iLT ].m_HitInfo.m_HitNormal +
|
||||
hitPacket[ iLB ].m_HitInfo.m_HitNormal ) * 0.5f );
|
||||
cLTB = COLOR_RGBA( shadeHit( bgColorY, rayLTB, hitInfoLTB, false,
|
||||
cLTB = COLOR_RGB( shadeHit( bgColorY, rayLTB, hitInfoLTB, false,
|
||||
0, false ) );
|
||||
cLTB = BlendColor( cLTB, BlendColor( cLT, cLB) );
|
||||
}
|
||||
@@ -1091,14 +1235,14 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
nodeLB );
|
||||
|
||||
if( hittedLTB )
|
||||
cLTB = COLOR_RGBA( shadeHit( bgColorY, rayLTB, hitInfoLTB,
|
||||
cLTB = COLOR_RGB( shadeHit( bgColorY, rayLTB, hitInfoLTB,
|
||||
false, 0, false ) );
|
||||
else
|
||||
{
|
||||
hitInfoLTB.m_tHit = std::numeric_limits<float>::infinity();
|
||||
|
||||
if( m_accelerator->Intersect( rayLTB, hitInfoLTB ) )
|
||||
cLTB = COLOR_RGBA( shadeHit( bgColorY, rayLTB,
|
||||
cLTB = COLOR_RGB( shadeHit( bgColorY, rayLTB,
|
||||
hitInfoLTB, false,
|
||||
0, false ) );
|
||||
}
|
||||
@@ -1111,7 +1255,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
}
|
||||
|
||||
// Trace and shade cRTB
|
||||
COLOR_RGBA cRTB = bgColorYRGB;
|
||||
COLOR_RGB cRTB = bgColorYRGB;
|
||||
|
||||
// Trace the center ray
|
||||
RAY rayRTB;
|
||||
@@ -1134,7 +1278,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
glm::normalize( ( hitPacket[ iRT ].m_HitInfo.m_HitNormal +
|
||||
hitPacket[ iRB ].m_HitInfo.m_HitNormal ) * 0.5f );
|
||||
|
||||
cRTB = COLOR_RGBA( shadeHit( bgColorY, rayRTB, hitInfoRTB, false, 0,
|
||||
cRTB = COLOR_RGB( shadeHit( bgColorY, rayRTB, hitInfoRTB, false, 0,
|
||||
false ) );
|
||||
cRTB = BlendColor( cRTB, BlendColor( cRT, cRB ) );
|
||||
}
|
||||
@@ -1160,7 +1304,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
|
||||
if( hittedRTB )
|
||||
{
|
||||
cRTB = COLOR_RGBA( shadeHit( bgColorY, rayRTB, hitInfoRTB,
|
||||
cRTB = COLOR_RGB( shadeHit( bgColorY, rayRTB, hitInfoRTB,
|
||||
false, 0, false) );
|
||||
}
|
||||
else
|
||||
@@ -1168,7 +1312,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
hitInfoRTB.m_tHit = std::numeric_limits<float>::infinity();
|
||||
|
||||
if( m_accelerator->Intersect( rayRTB, hitInfoRTB ) )
|
||||
cRTB = COLOR_RGBA( shadeHit( bgColorY, rayRTB, hitInfoRTB,
|
||||
cRTB = COLOR_RGB( shadeHit( bgColorY, rayRTB, hitInfoRTB,
|
||||
false, 0, false ) );
|
||||
}
|
||||
}
|
||||
@@ -1177,7 +1321,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
cRTB_old = cRTB;
|
||||
|
||||
// Trace and shade cLRB
|
||||
COLOR_RGBA cLRB = bgColorYRGB;
|
||||
COLOR_RGB cLRB = bgColorYRGB;
|
||||
|
||||
const SFVEC3F& oriLB = blockPacket.m_ray[ iLB ].m_Origin;
|
||||
const SFVEC3F& dirLB = blockPacket.m_ray[ iLB ].m_Dir;
|
||||
@@ -1203,7 +1347,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
glm::normalize( ( hitPacket[ iLB ].m_HitInfo.m_HitNormal +
|
||||
hitPacket[ iRB ].m_HitInfo.m_HitNormal ) * 0.5f );
|
||||
|
||||
cLRB = COLOR_RGBA( shadeHit( bgColorY, rayLRB, hitInfoLRB, false, 0,
|
||||
cLRB = COLOR_RGB( shadeHit( bgColorY, rayLRB, hitInfoLRB, false, 0,
|
||||
false ) );
|
||||
cLRB = BlendColor( cLRB, BlendColor( cLB, cRB ) );
|
||||
}
|
||||
@@ -1229,7 +1373,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
|
||||
if( hittedLRB )
|
||||
{
|
||||
cLRB = COLOR_RGBA( shadeHit( bgColorY, rayLRB, hitInfoLRB,
|
||||
cLRB = COLOR_RGB( shadeHit( bgColorY, rayLRB, hitInfoLRB,
|
||||
false, 0, false ) );
|
||||
}
|
||||
else
|
||||
@@ -1237,7 +1381,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
hitInfoLRB.m_tHit = std::numeric_limits<float>::infinity();
|
||||
|
||||
if( m_accelerator->Intersect( rayLRB, hitInfoLRB ) )
|
||||
cLRB = COLOR_RGBA( shadeHit( bgColorY, rayLRB, hitInfoLRB,
|
||||
cLRB = COLOR_RGB( shadeHit( bgColorY, rayLRB, hitInfoLRB,
|
||||
false, 0, false ) );
|
||||
}
|
||||
}
|
||||
@@ -1246,7 +1390,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
cLRB_old[x] = cLRB;
|
||||
|
||||
// Trace and shade cLTC
|
||||
COLOR_RGBA cLTC = BlendColor( cLT , cC );
|
||||
COLOR_RGB cLTC = BlendColor( cLT , cC );
|
||||
|
||||
if( hitPacket[ iLT ].m_hitresult || hittedC )
|
||||
{
|
||||
@@ -1268,12 +1412,12 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
hitInfoLTC );
|
||||
|
||||
if( hitted )
|
||||
cLTC = COLOR_RGBA( shadeHit( bgColorY, rayLTC, hitInfoLTC, false,
|
||||
cLTC = COLOR_RGB( shadeHit( bgColorY, rayLTC, hitInfoLTC, false,
|
||||
0, false ) );
|
||||
}
|
||||
|
||||
// Trace and shade cRTC
|
||||
COLOR_RGBA cRTC = BlendColor( cRT , cC );
|
||||
COLOR_RGB cRTC = BlendColor( cRT , cC );
|
||||
|
||||
if( hitPacket[ iRT ].m_hitresult || hittedC )
|
||||
{
|
||||
@@ -1294,12 +1438,12 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
hitInfoRTC );
|
||||
|
||||
if( hitted )
|
||||
cRTC = COLOR_RGBA( shadeHit( bgColorY, rayRTC, hitInfoRTC, false,
|
||||
cRTC = COLOR_RGB( shadeHit( bgColorY, rayRTC, hitInfoRTC, false,
|
||||
0, false ) );
|
||||
}
|
||||
|
||||
// Trace and shade cLBC
|
||||
COLOR_RGBA cLBC = BlendColor( cLB , cC );
|
||||
COLOR_RGB cLBC = BlendColor( cLB , cC );
|
||||
|
||||
if( hitPacket[ iLB ].m_hitresult || hittedC )
|
||||
{
|
||||
@@ -1320,12 +1464,12 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
hitInfoLBC );
|
||||
|
||||
if( hitted )
|
||||
cLBC = COLOR_RGBA( shadeHit( bgColorY, rayLBC, hitInfoLBC, false,
|
||||
cLBC = COLOR_RGB( shadeHit( bgColorY, rayLBC, hitInfoLBC, false,
|
||||
0, false ) );
|
||||
}
|
||||
|
||||
// Trace and shade cRBC
|
||||
COLOR_RGBA cRBC = BlendColor( cRB , cC );
|
||||
COLOR_RGB cRBC = BlendColor( cRB , cC );
|
||||
|
||||
if( hitPacket[ iRB ].m_hitresult || hittedC )
|
||||
{
|
||||
@@ -1346,7 +1490,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
hitInfoRBC );
|
||||
|
||||
if( hitted )
|
||||
cRBC = COLOR_RGBA( shadeHit( bgColorY, rayRBC, hitInfoRBC, false,
|
||||
cRBC = COLOR_RGB( shadeHit( bgColorY, rayRBC, hitInfoRBC, false,
|
||||
0, false ) );
|
||||
}
|
||||
|
||||
@@ -1394,15 +1538,14 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( GLubyte* ptrPBO )
|
||||
|
||||
#define USE_EXPERIMENTAL_SOFT_SHADOWS 1
|
||||
|
||||
SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& aRay, HITINFO& aHitInfo,
|
||||
SFVEC3F RENDER_3D_RAYTRACE::shadeHit( const SFVEC3F& aBgColor, const RAY& aRay, HITINFO& aHitInfo,
|
||||
bool aIsInsideObject, unsigned int aRecursiveLevel,
|
||||
bool is_testShadow ) const
|
||||
{
|
||||
const MATERIAL* objMaterial = aHitInfo.pHitObject->GetMaterial();
|
||||
wxASSERT( objMaterial != nullptr );
|
||||
|
||||
SFVEC4F outColor =
|
||||
SFVEC4F( objMaterial->GetEmissiveColor() + objMaterial->GetAmbientColor(), 1.0f );
|
||||
SFVEC3F outColor = objMaterial->GetEmissiveColor() + objMaterial->GetAmbientColor();
|
||||
|
||||
if( aRecursiveLevel > 7 )
|
||||
return outColor;
|
||||
@@ -1411,8 +1554,7 @@ SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& a
|
||||
|
||||
hitPoint += aHitInfo.m_HitNormal * m_boardAdapter.GetNonCopperLayerThickness() * 0.6f;
|
||||
|
||||
const SFVEC4F diffuseColorObj =
|
||||
SFVEC4F( aHitInfo.pHitObject->GetDiffuseColor( aHitInfo ), 1.0f );
|
||||
const SFVEC3F diffuseColorObj = aHitInfo.pHitObject->GetDiffuseColor( aHitInfo );
|
||||
|
||||
#if USE_EXPERIMENTAL_SOFT_SHADOWS
|
||||
bool is_aa_enabled = m_boardAdapter.m_Cfg->m_Render.raytrace_anti_aliasing && !m_isPreview;
|
||||
@@ -1496,10 +1638,8 @@ SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& a
|
||||
shadow_att_factor_sum += shadow_att_factor_light;
|
||||
}
|
||||
|
||||
outColor += SFVEC4F( objMaterial->Shade( aRay, aHitInfo, NdotL, diffuseColorObj,
|
||||
vectorToLight, colorOfLight,
|
||||
shadow_att_factor_light ),
|
||||
1.0 );
|
||||
outColor += objMaterial->Shade( aRay, aHitInfo, NdotL, diffuseColorObj, vectorToLight,
|
||||
colorOfLight, shadow_att_factor_light );
|
||||
}
|
||||
|
||||
// Only use the headlight for preview
|
||||
@@ -1519,7 +1659,7 @@ SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& a
|
||||
}
|
||||
|
||||
// Clamp color to not be brighter than 1.0f
|
||||
outColor = glm::min( outColor, SFVEC4F( 1.0f ) );
|
||||
outColor = glm::min( outColor, SFVEC3F( 1.0f ) );
|
||||
|
||||
if( !m_isPreview )
|
||||
{
|
||||
@@ -1531,7 +1671,7 @@ SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& a
|
||||
const unsigned int reflection_number_of_samples =
|
||||
objMaterial->GetReflectionRayCount();
|
||||
|
||||
SFVEC4F sum_color = SFVEC4F( 0.0f );
|
||||
SFVEC3F sum_color = SFVEC3F( 0.0f );
|
||||
|
||||
const SFVEC3F reflectVector = aRay.m_Dir - 2.0f *
|
||||
glm::dot( aRay.m_Dir, aHitInfo.m_HitNormal ) * aHitInfo.m_HitNormal;
|
||||
@@ -1560,19 +1700,17 @@ SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& a
|
||||
|
||||
if( m_accelerator->Intersect( reflectedRay, reflectedHit ) )
|
||||
{
|
||||
SFVEC4F add = ( diffuseColorObj + SFVEC4F( objMaterial->GetSpecularColor(), 1.0f ) ) *
|
||||
sum_color += ( diffuseColorObj + objMaterial->GetSpecularColor() ) *
|
||||
shadeHit( aBgColor, reflectedRay, reflectedHit, false,
|
||||
aRecursiveLevel + 1, is_testShadow ) *
|
||||
SFVEC4F( objMaterial->GetReflection() *
|
||||
SFVEC3F( objMaterial->GetReflection() *
|
||||
// Falloff factor
|
||||
(1.0f / ( 1.0f + 0.75f * reflectedHit.m_tHit *
|
||||
reflectedHit.m_tHit) ) );
|
||||
|
||||
sum_color += add;
|
||||
}
|
||||
}
|
||||
|
||||
outColor += (sum_color / SFVEC4F( (float)reflection_number_of_samples) );
|
||||
outColor += (sum_color / SFVEC3F( (float)reflection_number_of_samples) );
|
||||
}
|
||||
|
||||
// Refraction
|
||||
@@ -1601,7 +1739,7 @@ SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& a
|
||||
const unsigned int refractions_number_of_samples =
|
||||
objMaterial->GetRefractionRayCount();
|
||||
|
||||
SFVEC4F sum_color = SFVEC4F( 0.0f );
|
||||
SFVEC3F sum_color = SFVEC3F(0.0f);
|
||||
|
||||
for( unsigned int i = 0; i < refractions_number_of_samples; ++i )
|
||||
{
|
||||
@@ -1625,19 +1763,19 @@ SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& a
|
||||
HITINFO refractedHit;
|
||||
refractedHit.m_tHit = std::numeric_limits<float>::infinity();
|
||||
|
||||
SFVEC4F refractedColor = aBgColor;
|
||||
SFVEC3F refractedColor = aBgColor;
|
||||
|
||||
if( m_accelerator->Intersect( refractedRay, refractedHit ) )
|
||||
{
|
||||
refractedColor = shadeHit( aBgColor, refractedRay, refractedHit,
|
||||
!aIsInsideObject, aRecursiveLevel + 1, false );
|
||||
|
||||
const SFVEC4F absorbance = ( SFVEC4F(1.0f) - diffuseColorObj ) *
|
||||
const SFVEC3F absorbance = ( SFVEC3F(1.0f) - diffuseColorObj ) *
|
||||
(1.0f - objTransparency ) *
|
||||
objMaterial->GetAbsorvance() *
|
||||
refractedHit.m_tHit;
|
||||
|
||||
const SFVEC4F transparency = 1.0f / ( absorbance + 1.0f );
|
||||
const SFVEC3F transparency = 1.0f / ( absorbance + 1.0f );
|
||||
|
||||
sum_color += refractedColor * transparency;
|
||||
}
|
||||
@@ -1648,7 +1786,7 @@ SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& a
|
||||
}
|
||||
|
||||
outColor = outColor * ( 1.0f - objTransparency ) + objTransparency * sum_color
|
||||
/ SFVEC4F( (float) refractions_number_of_samples );
|
||||
/ SFVEC3F( (float) refractions_number_of_samples );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1661,6 +1799,49 @@ SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& a
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE::initializeNewWindowSize()
|
||||
{
|
||||
initPbo();
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE::initPbo()
|
||||
{
|
||||
if( GLEW_ARB_pixel_buffer_object )
|
||||
{
|
||||
m_openglSupportsVertexBufferObjects = true;
|
||||
|
||||
// Try to delete vbo if it was already initialized
|
||||
deletePbo();
|
||||
|
||||
// Learn about Pixel buffer objects at:
|
||||
// http://www.songho.ca/opengl/gl_pbo.html
|
||||
// http://web.eecs.umich.edu/~sugih/courses/eecs487/lectures/25-PBO+Mipmapping.pdf
|
||||
// "create 2 pixel buffer objects, you need to delete them when program exits.
|
||||
// glBufferDataARB with NULL pointer reserves only memory space."
|
||||
|
||||
// This sets the number of RGBA pixels
|
||||
m_pboDataSize = m_realBufferSize.x * m_realBufferSize.y * 4;
|
||||
|
||||
glGenBuffersARB( 1, &m_pboId );
|
||||
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, m_pboId );
|
||||
glBufferDataARB( GL_PIXEL_UNPACK_BUFFER_ARB, m_pboDataSize, 0, GL_STREAM_DRAW_ARB );
|
||||
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, 0 );
|
||||
|
||||
wxLogTrace( m_logTrace,
|
||||
wxT( "RENDER_3D_RAYTRACE:: GLEW_ARB_pixel_buffer_object is supported" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool RENDER_3D_RAYTRACE::initializeOpenGL()
|
||||
{
|
||||
m_is_opengl_initialized = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static float distance( const SFVEC2UI& a, const SFVEC2UI& b )
|
||||
{
|
||||
const float dx = (float) a.x - (float) b.x;
|
||||
@@ -1669,7 +1850,7 @@ static float distance( const SFVEC2UI& a, const SFVEC2UI& b )
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_BASE::initializeBlockPositions()
|
||||
void RENDER_3D_RAYTRACE::initializeBlockPositions()
|
||||
{
|
||||
m_realBufferSize = SFVEC2UI( 0 );
|
||||
|
||||
@@ -1752,7 +1933,7 @@ void RENDER_3D_RAYTRACE_BASE::initializeBlockPositions()
|
||||
}
|
||||
|
||||
|
||||
BOARD_ITEM* RENDER_3D_RAYTRACE_BASE::IntersectBoardItem( const RAY& aRay )
|
||||
BOARD_ITEM* RENDER_3D_RAYTRACE::IntersectBoardItem( const RAY& aRay )
|
||||
{
|
||||
HITINFO hitInfo;
|
||||
hitInfo.m_tHit = std::numeric_limits<float>::infinity();
|
||||
+28
-25
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2020 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2021 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
|
||||
@@ -22,9 +22,10 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef RENDER_3D_RAYTRACE_BASE_H
|
||||
#define RENDER_3D_RAYTRACE_BASE_H
|
||||
#ifndef RENDER_3D_RAYTRACE_H
|
||||
#define RENDER_3D_RAYTRACE_H
|
||||
|
||||
#include "../../common_ogl/openGL_includes.h"
|
||||
#include "accelerators/container_3d.h"
|
||||
#include "accelerators/accelerator_3d.h"
|
||||
#include "../render_3d_base.h"
|
||||
@@ -51,16 +52,19 @@ typedef enum
|
||||
} RT_RENDER_STATE;
|
||||
|
||||
|
||||
class RENDER_3D_RAYTRACE_BASE : public RENDER_3D_BASE
|
||||
class RENDER_3D_RAYTRACE : public RENDER_3D_BASE
|
||||
{
|
||||
public:
|
||||
// TODO: Take into account board thickness so that the camera won't move inside of the board
|
||||
// when facing it perpendicularly.
|
||||
static constexpr float MIN_DISTANCE_IU = 4 * PCB_IU_PER_MM;
|
||||
|
||||
explicit RENDER_3D_RAYTRACE_BASE( BOARD_ADAPTER& aAdapter, CAMERA& aCamera );
|
||||
explicit RENDER_3D_RAYTRACE( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter, CAMERA& aCamera );
|
||||
|
||||
~RENDER_3D_RAYTRACE_BASE();
|
||||
~RENDER_3D_RAYTRACE();
|
||||
|
||||
void SetCurWindowSize( const wxSize& aSize ) override;
|
||||
bool Redraw( bool aIsMoving, REPORTER* aStatusReporter, REPORTER* aWarningReporter ) override;
|
||||
|
||||
int GetWaitForEditingTimeOut() override;
|
||||
|
||||
@@ -69,9 +73,11 @@ public:
|
||||
|
||||
BOARD_ITEM *IntersectBoardItem( const RAY& aRay );
|
||||
|
||||
protected:
|
||||
virtual void initPbo() = 0;
|
||||
virtual void deletePbo() = 0;
|
||||
private:
|
||||
bool initializeOpenGL();
|
||||
void initializeNewWindowSize();
|
||||
void initPbo();
|
||||
void deletePbo();
|
||||
void createItemsFromContainer( const BVH_CONTAINER_2D* aContainer2d, PCB_LAYER_ID aLayer_id,
|
||||
const MATERIAL* aMaterialLayer, const SFVEC3F& aLayerColor,
|
||||
float aLayerZOffset );
|
||||
@@ -81,20 +87,20 @@ protected:
|
||||
void postProcessShading( GLubyte* ptrPBO, REPORTER* aStatusReporter );
|
||||
void postProcessBlurFinish( GLubyte* ptrPBO, REPORTER* aStatusReporter );
|
||||
void renderBlockTracing( GLubyte* ptrPBO , signed int iBlock );
|
||||
void renderFinalColor( GLubyte* ptrPBO, const SFVEC4F& rgbColor,
|
||||
void renderFinalColor( GLubyte* ptrPBO, const SFVEC3F& rgbColor,
|
||||
bool applyColorSpaceConversion );
|
||||
|
||||
void renderRayPackets( const SFVEC4F* bgColorY, const RAY* aRayPkt, HITINFO_PACKET* aHitPacket,
|
||||
bool is_testShadow, SFVEC4F* aOutHitColor );
|
||||
void renderRayPackets( const SFVEC3F* bgColorY, const RAY* aRayPkt, HITINFO_PACKET* aHitPacket,
|
||||
bool is_testShadow, SFVEC3F* aOutHitColor );
|
||||
|
||||
void renderAntiAliasPackets( const SFVEC4F* aBgColorY, const HITINFO_PACKET* aHitPck_X0Y0,
|
||||
void renderAntiAliasPackets( const SFVEC3F* aBgColorY, const HITINFO_PACKET* aHitPck_X0Y0,
|
||||
const HITINFO_PACKET* aHitPck_AA_X1Y1, const RAY* aRayPck,
|
||||
SFVEC4F* aOutHitColor );
|
||||
SFVEC3F* aOutHitColor );
|
||||
|
||||
// Materials
|
||||
void setupMaterials();
|
||||
|
||||
SFVEC4F shadeHit( const SFVEC4F& aBgColor, const RAY& aRay, HITINFO& aHitInfo,
|
||||
SFVEC3F shadeHit( const SFVEC3F& aBgColor, const RAY& aRay, HITINFO& aHitInfo,
|
||||
bool aIsInsideObject, unsigned int aRecursiveLevel,
|
||||
bool is_testShadow ) const;
|
||||
|
||||
@@ -122,8 +128,6 @@ protected:
|
||||
void render( GLubyte* ptrPBO, REPORTER* aStatusReporter );
|
||||
void renderPreview( GLubyte* ptrPBO );
|
||||
|
||||
static SFVEC4F premultiplyAlpha( const SFVEC4F& aInput );
|
||||
|
||||
struct
|
||||
{
|
||||
BLINN_PHONG_MATERIAL m_Paste;
|
||||
@@ -144,7 +148,6 @@ protected:
|
||||
BRUSHED_METAL_NORMAL m_brushedMetalMaterial;
|
||||
SILK_SCREEN_NORMAL m_silkScreenMaterial;
|
||||
|
||||
bool m_is_canvas_initialized;
|
||||
bool m_isPreview;
|
||||
|
||||
/// State used on quality render
|
||||
@@ -162,8 +165,10 @@ protected:
|
||||
|
||||
DIRECTIONAL_LIGHT* m_cameraLight;
|
||||
|
||||
/*GLuint m_pboId;
|
||||
GLuint m_pboDataSize;*/
|
||||
bool m_openglSupportsVertexBufferObjects;
|
||||
|
||||
GLuint m_pboId;
|
||||
GLuint m_pboDataSize;
|
||||
|
||||
CONTAINER_3D m_objectContainer;
|
||||
|
||||
@@ -175,8 +180,8 @@ protected:
|
||||
|
||||
ACCELERATOR_3D* m_accelerator;
|
||||
|
||||
SFVEC4F m_backgroundColorTop;
|
||||
SFVEC4F m_backgroundColorBottom;
|
||||
SFVEC3F m_backgroundColorTop;
|
||||
SFVEC3F m_backgroundColorBottom;
|
||||
|
||||
///< Used to see if the windows size changed.
|
||||
wxSize m_oldWindowsSize;
|
||||
@@ -213,10 +218,8 @@ protected:
|
||||
|
||||
#ifdef USE_SRGB_SPACE
|
||||
extern SFVEC3F ConvertSRGBToLinear( const SFVEC3F& aSRGBcolor );
|
||||
extern SFVEC4F ConvertSRGBAToLinear( const SFVEC4F& aSRGBAcolor );
|
||||
#else
|
||||
#define ConvertSRGBToLinear( v ) ( v )
|
||||
#define ConvertSRGBAToLinear( v ) ( v )
|
||||
#endif
|
||||
|
||||
#endif // RENDER_3D_RAYTRACE_BASE_H
|
||||
#endif // RENDER_3D_RAYTRACE_H
|
||||
@@ -1,243 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2020 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2024 Alex Shvartzkop <dudesuchamazing@gmail.com>
|
||||
* Copyright (C) 2015-2024 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 <algorithm>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "render_3d_raytrace_gl.h"
|
||||
#include "../common_ogl/ogl_utils.h"
|
||||
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
|
||||
#include <wx/log.h>
|
||||
|
||||
|
||||
RENDER_3D_RAYTRACE_GL::RENDER_3D_RAYTRACE_GL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter, CAMERA& aCamera ) :
|
||||
RENDER_3D_RAYTRACE_BASE( aAdapter, aCamera )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "RENDER_3D_RAYTRACE_GL::RENDER_3D_RAYTRACE_GL" ) );
|
||||
|
||||
m_openglSupportsVertexBufferObjects = false;
|
||||
m_pboId = GL_NONE;
|
||||
m_pboDataSize = 0;
|
||||
}
|
||||
|
||||
|
||||
RENDER_3D_RAYTRACE_GL::~RENDER_3D_RAYTRACE_GL()
|
||||
{
|
||||
deletePbo();
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_GL::deletePbo()
|
||||
{
|
||||
// Delete PBO if it was created
|
||||
if( m_openglSupportsVertexBufferObjects )
|
||||
{
|
||||
if( glIsBufferARB( m_pboId ) )
|
||||
glDeleteBuffers( 1, &m_pboId );
|
||||
|
||||
m_pboId = GL_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_GL::SetCurWindowSize( const wxSize& aSize )
|
||||
{
|
||||
if( m_windowSize != aSize )
|
||||
{
|
||||
m_windowSize = aSize;
|
||||
glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
|
||||
|
||||
initPbo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool RENDER_3D_RAYTRACE_GL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
|
||||
REPORTER* aWarningReporter )
|
||||
{
|
||||
bool requestRedraw = false;
|
||||
|
||||
// Initialize openGL if need
|
||||
if( !m_canvasInitialized )
|
||||
{
|
||||
m_canvasInitialized = true;
|
||||
|
||||
//aIsMoving = true;
|
||||
requestRedraw = true;
|
||||
|
||||
// It will assign the first time the windows size, so it will now
|
||||
// revert to preview mode the first time the Redraw is called
|
||||
m_oldWindowsSize = m_windowSize;
|
||||
initializeBlockPositions();
|
||||
}
|
||||
|
||||
std::unique_ptr<BUSY_INDICATOR> busy = CreateBusyIndicator();
|
||||
|
||||
// Reload board if it was requested
|
||||
if( m_reloadRequested )
|
||||
{
|
||||
if( aStatusReporter )
|
||||
aStatusReporter->Report( _( "Loading..." ) );
|
||||
|
||||
//aIsMoving = true;
|
||||
requestRedraw = true;
|
||||
Reload( aStatusReporter, aWarningReporter, false );
|
||||
}
|
||||
|
||||
|
||||
// Recalculate constants if windows size was changed
|
||||
if( m_windowSize != m_oldWindowsSize )
|
||||
{
|
||||
m_oldWindowsSize = m_windowSize;
|
||||
aIsMoving = true;
|
||||
requestRedraw = true;
|
||||
|
||||
initializeBlockPositions();
|
||||
}
|
||||
|
||||
// Clear buffers
|
||||
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
|
||||
glClearDepth( 1.0f );
|
||||
glClearStencil( 0x00 );
|
||||
glClear( GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||
|
||||
// 4-byte pixel alignment
|
||||
glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
|
||||
|
||||
glDisable( GL_STENCIL_TEST );
|
||||
glDisable( GL_LIGHTING );
|
||||
glDisable( GL_COLOR_MATERIAL );
|
||||
glDisable( GL_DEPTH_TEST );
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
glDisable( GL_BLEND );
|
||||
glDisable( GL_MULTISAMPLE );
|
||||
|
||||
const bool was_camera_changed = m_camera.ParametersChanged();
|
||||
|
||||
if( requestRedraw || aIsMoving || was_camera_changed )
|
||||
m_renderState = RT_RENDER_STATE_MAX; // Set to an invalid state,
|
||||
// so it will restart again latter
|
||||
|
||||
// This will only render if need, otherwise it will redraw the PBO on the screen again
|
||||
if( aIsMoving || was_camera_changed )
|
||||
{
|
||||
// Set head light (camera view light) with the opposite direction of the camera
|
||||
if( m_cameraLight )
|
||||
m_cameraLight->SetDirection( -m_camera.GetDir() );
|
||||
|
||||
OglDrawBackground( premultiplyAlpha( m_boardAdapter.m_BgColorTop ),
|
||||
premultiplyAlpha( m_boardAdapter.m_BgColorBot ) );
|
||||
|
||||
// Bind PBO
|
||||
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, m_pboId );
|
||||
|
||||
// Get the PBO pixel pointer to write the data
|
||||
GLubyte* ptrPBO = (GLubyte *)glMapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
|
||||
GL_WRITE_ONLY_ARB );
|
||||
|
||||
if( ptrPBO )
|
||||
{
|
||||
renderPreview( ptrPBO );
|
||||
|
||||
// release pointer to mapping buffer, this initialize the coping to PBO
|
||||
glUnmapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB );
|
||||
}
|
||||
|
||||
glWindowPos2i( m_xoffset, m_yoffset );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Bind PBO
|
||||
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, m_pboId );
|
||||
|
||||
if( m_renderState != RT_RENDER_STATE_FINISH )
|
||||
{
|
||||
// Get the PBO pixel pointer to write the data
|
||||
GLubyte* ptrPBO = (GLubyte *)glMapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB,
|
||||
GL_WRITE_ONLY_ARB );
|
||||
|
||||
if( ptrPBO )
|
||||
{
|
||||
render( ptrPBO, aStatusReporter );
|
||||
|
||||
if( m_renderState != RT_RENDER_STATE_FINISH )
|
||||
requestRedraw = true;
|
||||
|
||||
// release pointer to mapping buffer, this initialize the coping to PBO
|
||||
glUnmapBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_renderState == RT_RENDER_STATE_FINISH )
|
||||
{
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
}
|
||||
|
||||
glWindowPos2i( m_xoffset, m_yoffset );
|
||||
}
|
||||
|
||||
// This way it will blend the progress rendering with the last buffer. eg:
|
||||
// if it was called after a openGL.
|
||||
glEnable( GL_BLEND );
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
glEnable( GL_ALPHA_TEST );
|
||||
glDrawPixels( m_realBufferSize.x, m_realBufferSize.y, GL_RGBA, GL_UNSIGNED_BYTE, 0 );
|
||||
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, 0 );
|
||||
|
||||
return requestRedraw;
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_GL::initPbo()
|
||||
{
|
||||
if( GLEW_ARB_pixel_buffer_object )
|
||||
{
|
||||
m_openglSupportsVertexBufferObjects = true;
|
||||
|
||||
// Try to delete vbo if it was already initialized
|
||||
deletePbo();
|
||||
|
||||
// Learn about Pixel buffer objects at:
|
||||
// http://www.songho.ca/opengl/gl_pbo.html
|
||||
// http://web.eecs.umich.edu/~sugih/courses/eecs487/lectures/25-PBO+Mipmapping.pdf
|
||||
// "create 2 pixel buffer objects, you need to delete them when program exits.
|
||||
// glBufferDataARB with NULL pointer reserves only memory space."
|
||||
|
||||
// This sets the number of RGBA pixels
|
||||
m_pboDataSize = m_realBufferSize.x * m_realBufferSize.y * 4;
|
||||
|
||||
glGenBuffersARB( 1, &m_pboId );
|
||||
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, m_pboId );
|
||||
glBufferDataARB( GL_PIXEL_UNPACK_BUFFER_ARB, m_pboDataSize, 0, GL_STREAM_DRAW_ARB );
|
||||
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, 0 );
|
||||
|
||||
wxLogTrace( m_logTrace,
|
||||
wxT( "RENDER_3D_RAYTRACE_GL:: GLEW_ARB_pixel_buffer_object is supported" ) );
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2020 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2024 Alex Shvartzkop <dudesuchamazing@gmail.com>
|
||||
* Copyright (C) 2015-2024 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 RENDER_3D_RAYTRACE_GL_H
|
||||
#define RENDER_3D_RAYTRACE_GL_H
|
||||
|
||||
#include "../../common_ogl/openGL_includes.h"
|
||||
#include "render_3d_raytrace_base.h"
|
||||
|
||||
|
||||
class RENDER_3D_RAYTRACE_GL : public RENDER_3D_RAYTRACE_BASE
|
||||
{
|
||||
public:
|
||||
explicit RENDER_3D_RAYTRACE_GL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter,
|
||||
CAMERA& aCamera );
|
||||
|
||||
~RENDER_3D_RAYTRACE_GL();
|
||||
|
||||
void SetCurWindowSize( const wxSize& aSize ) override;
|
||||
bool Redraw( bool aIsMoving, REPORTER* aStatusReporter, REPORTER* aWarningReporter ) override;
|
||||
|
||||
protected:
|
||||
void initPbo() override;
|
||||
void deletePbo() override;
|
||||
|
||||
bool m_openglSupportsVertexBufferObjects;
|
||||
GLuint m_pboId;
|
||||
GLuint m_pboDataSize;
|
||||
};
|
||||
|
||||
|
||||
#endif // RENDER_3D_RAYTRACE_GL_H
|
||||
@@ -1,159 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2020 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2024 Alex Shvartzkop <dudesuchamazing@gmail.com>
|
||||
* Copyright (C) 2015-2024 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 "render_3d_raytrace_ram.h"
|
||||
#include <wx/log.h>
|
||||
|
||||
|
||||
RENDER_3D_RAYTRACE_RAM::RENDER_3D_RAYTRACE_RAM( BOARD_ADAPTER& aAdapter, CAMERA& aCamera ) :
|
||||
RENDER_3D_RAYTRACE_BASE( aAdapter, aCamera ),
|
||||
m_outputBuffer( nullptr ),
|
||||
m_pboDataSize( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
RENDER_3D_RAYTRACE_RAM::~RENDER_3D_RAYTRACE_RAM()
|
||||
{
|
||||
deletePbo();
|
||||
}
|
||||
|
||||
|
||||
GLubyte* RENDER_3D_RAYTRACE_RAM::GetBuffer()
|
||||
{
|
||||
return m_outputBuffer;
|
||||
}
|
||||
|
||||
|
||||
wxSize RENDER_3D_RAYTRACE_RAM::GetRealBufferSize()
|
||||
{
|
||||
return wxSize( m_realBufferSize.x, m_realBufferSize.y );
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_RAM::deletePbo()
|
||||
{
|
||||
delete[] m_outputBuffer;
|
||||
m_outputBuffer = nullptr;
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_RAM::SetCurWindowSize( const wxSize& aSize )
|
||||
{
|
||||
if( m_windowSize != aSize )
|
||||
{
|
||||
m_windowSize = aSize;
|
||||
|
||||
initPbo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool RENDER_3D_RAYTRACE_RAM::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
|
||||
REPORTER* aWarningReporter )
|
||||
{
|
||||
bool requestRedraw = false;
|
||||
|
||||
// Initialize openGL if need
|
||||
if( !m_canvasInitialized )
|
||||
{
|
||||
m_canvasInitialized = true;
|
||||
|
||||
//aIsMoving = true;
|
||||
requestRedraw = true;
|
||||
|
||||
// It will assign the first time the windows size, so it will now
|
||||
// revert to preview mode the first time the Redraw is called
|
||||
m_oldWindowsSize = m_windowSize;
|
||||
initializeBlockPositions();
|
||||
}
|
||||
|
||||
std::unique_ptr<BUSY_INDICATOR> busy = CreateBusyIndicator();
|
||||
|
||||
// Reload board if it was requested
|
||||
if( m_reloadRequested )
|
||||
{
|
||||
if( aStatusReporter )
|
||||
aStatusReporter->Report( _( "Loading..." ) );
|
||||
|
||||
//aIsMoving = true;
|
||||
requestRedraw = true;
|
||||
Reload( aStatusReporter, aWarningReporter, false );
|
||||
}
|
||||
|
||||
|
||||
// Recalculate constants if windows size was changed
|
||||
if( m_windowSize != m_oldWindowsSize )
|
||||
{
|
||||
m_oldWindowsSize = m_windowSize;
|
||||
aIsMoving = true;
|
||||
requestRedraw = true;
|
||||
|
||||
initializeBlockPositions();
|
||||
}
|
||||
|
||||
const bool was_camera_changed = m_camera.ParametersChanged();
|
||||
|
||||
if( requestRedraw || aIsMoving || was_camera_changed )
|
||||
m_renderState = RT_RENDER_STATE_MAX; // Set to an invalid state,
|
||||
// so it will restart again latter
|
||||
|
||||
// This will only render if need, otherwise it will redraw the PBO on the screen again
|
||||
if( aIsMoving || was_camera_changed )
|
||||
{
|
||||
// Set head light (camera view light) with the opposite direction of the camera
|
||||
if( m_cameraLight )
|
||||
m_cameraLight->SetDirection( -m_camera.GetDir() );
|
||||
|
||||
if( m_outputBuffer )
|
||||
{
|
||||
renderPreview( m_outputBuffer );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_renderState != RT_RENDER_STATE_FINISH )
|
||||
{
|
||||
if( m_outputBuffer )
|
||||
{
|
||||
render( m_outputBuffer, aStatusReporter );
|
||||
|
||||
if( m_renderState != RT_RENDER_STATE_FINISH )
|
||||
requestRedraw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return requestRedraw;
|
||||
}
|
||||
|
||||
|
||||
void RENDER_3D_RAYTRACE_RAM::initPbo()
|
||||
{
|
||||
deletePbo();
|
||||
|
||||
m_pboDataSize = m_realBufferSize.x * m_realBufferSize.y * 4;
|
||||
m_outputBuffer = new GLubyte[m_pboDataSize]();
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2020 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2024 Alex Shvartzkop <dudesuchamazing@gmail.com>
|
||||
* Copyright (C) 2015-2024 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 RENDER_3D_RAYTRACE_RAM_H
|
||||
#define RENDER_3D_RAYTRACE_RAM_H
|
||||
|
||||
#include "render_3d_raytrace_base.h"
|
||||
|
||||
|
||||
class RENDER_3D_RAYTRACE_RAM : public RENDER_3D_RAYTRACE_BASE
|
||||
{
|
||||
public:
|
||||
// TODO: Take into account board thickness so that the camera won't move inside of the board
|
||||
// when facing it perpendicularly.
|
||||
static constexpr float MIN_DISTANCE_IU = 4 * PCB_IU_PER_MM;
|
||||
|
||||
explicit RENDER_3D_RAYTRACE_RAM( BOARD_ADAPTER& aAdapter, CAMERA& aCamera );
|
||||
|
||||
~RENDER_3D_RAYTRACE_RAM();
|
||||
|
||||
GLubyte* GetBuffer();
|
||||
wxSize GetRealBufferSize();
|
||||
|
||||
void SetCurWindowSize( const wxSize& aSize ) override;
|
||||
bool Redraw( bool aIsMoving, REPORTER* aStatusReporter, REPORTER* aWarningReporter ) override;
|
||||
|
||||
private:
|
||||
void initPbo() override;
|
||||
void deletePbo() override;
|
||||
|
||||
GLubyte* m_outputBuffer;
|
||||
GLuint m_pboDataSize;
|
||||
};
|
||||
|
||||
|
||||
#endif // RENDER_3D_RAYTRACE_RAM_H
|
||||
@@ -31,7 +31,6 @@
|
||||
#define _BBOX_3D_H_
|
||||
|
||||
#include <plugins/3dapi/xv3d_types.h> // SFVEC2F
|
||||
#include <glm/mat4x4.hpp>
|
||||
|
||||
struct RAY;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2016 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
|
||||
@@ -44,12 +44,13 @@
|
||||
const wxChar* RENDER_3D_BASE::m_logTrace = wxT( "KI_TRACE_3D_RENDER" );
|
||||
|
||||
|
||||
RENDER_3D_BASE::RENDER_3D_BASE( BOARD_ADAPTER& aBoardAdapter, CAMERA& aCamera ) :
|
||||
RENDER_3D_BASE::RENDER_3D_BASE( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aBoardAdapter, CAMERA& aCamera ) :
|
||||
m_boardAdapter( aBoardAdapter ),
|
||||
m_camera( aCamera )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "RENDER_3D_BASE::RENDER_3D_BASE" ) );
|
||||
m_canvasInitialized = false;
|
||||
m_canvas = aCanvas;
|
||||
m_is_opengl_initialized = false;
|
||||
m_windowSize = wxSize( -1, -1 );
|
||||
m_reloadRequested = true;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2016 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
|
||||
@@ -42,7 +42,7 @@
|
||||
class RENDER_3D_BASE
|
||||
{
|
||||
public:
|
||||
explicit RENDER_3D_BASE( BOARD_ADAPTER& aBoardAdapter, CAMERA& aCamera );
|
||||
explicit RENDER_3D_BASE( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aBoardAdapter, CAMERA& aCamera );
|
||||
|
||||
virtual ~RENDER_3D_BASE() = 0;
|
||||
|
||||
@@ -98,13 +98,16 @@ protected:
|
||||
*/
|
||||
std::unique_ptr<BUSY_INDICATOR> CreateBusyIndicator() const;
|
||||
|
||||
///< the canvas to display the scene
|
||||
EDA_3D_CANVAS* m_canvas;
|
||||
|
||||
///< Settings reference in use for this render.
|
||||
BOARD_ADAPTER& m_boardAdapter;
|
||||
|
||||
CAMERA& m_camera;
|
||||
|
||||
///< Flag if the canvas specific for this render was already initialized.
|
||||
bool m_canvasInitialized;
|
||||
///< Flag if the opengl specific for this render was already initialized.
|
||||
bool m_is_opengl_initialized;
|
||||
|
||||
///< @todo This must be reviewed in order to flag change types.
|
||||
bool m_reloadRequested;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -38,24 +38,11 @@
|
||||
// stdlib
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
TRACK_BALL::TRACK_BALL( float aInitialDistance ) : CAMERA( aInitialDistance )
|
||||
TRACK_BALL::TRACK_BALL( float aInitialDistance ) :
|
||||
CAMERA( aInitialDistance )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "TRACK_BALL::TRACK_BALL" ) );
|
||||
initQuat();
|
||||
}
|
||||
|
||||
|
||||
TRACK_BALL::TRACK_BALL( SFVEC3F aInitPos, SFVEC3F aLookat, PROJECTION_TYPE aProjectionType ) :
|
||||
CAMERA( aInitPos, aLookat, aProjectionType )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "TRACK_BALL::TRACK_BALL" ) );
|
||||
initQuat();
|
||||
}
|
||||
|
||||
|
||||
void TRACK_BALL::initQuat()
|
||||
{
|
||||
memset( m_quat_t0, 0, sizeof( m_quat_t0 ) );
|
||||
memset( m_quat_t1, 0, sizeof( m_quat_t1 ) );
|
||||
|
||||
@@ -63,7 +50,6 @@ void TRACK_BALL::initQuat()
|
||||
trackball( m_quat_t1, 0.0, 0.0, 0.0, 0.0 );
|
||||
}
|
||||
|
||||
|
||||
void TRACK_BALL::Drag( const wxPoint& aNewMousePosition )
|
||||
{
|
||||
m_parametersChanged = true;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
@@ -37,7 +37,6 @@ class TRACK_BALL : public CAMERA
|
||||
{
|
||||
public:
|
||||
explicit TRACK_BALL( float aInitialDistance );
|
||||
explicit TRACK_BALL( SFVEC3F aInitPos, SFVEC3F aLookat, PROJECTION_TYPE aProjectionType );
|
||||
|
||||
virtual ~TRACK_BALL()
|
||||
{
|
||||
@@ -58,8 +57,6 @@ public:
|
||||
void Interpolate( float t ) override;
|
||||
|
||||
private:
|
||||
void initQuat();
|
||||
|
||||
/**
|
||||
* interpolate quaternions of the trackball
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
@@ -54,17 +54,16 @@ void EDA_3D_VIEWER_FRAME::ReCreateMainToolbar()
|
||||
|
||||
// Set up toolbar
|
||||
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
||||
KiBitmapBundle( BITMAPS::import3d ),
|
||||
_( "Reload board" ) );
|
||||
KiScaledBitmap( BITMAPS::import3d, this ), _( "Reload board" ) );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
||||
KiBitmapBundle( BITMAPS::copy ),
|
||||
KiScaledBitmap( BITMAPS::copy, this ),
|
||||
_( "Copy 3D image to clipboard" ) );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString,
|
||||
KiBitmapBundle( BITMAPS::render_mode ),
|
||||
KiScaledBitmap( BITMAPS::render_mode, this ),
|
||||
_( "Render current view using Raytracing" ), wxITEM_CHECK );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <3d_viewer/tools/eda_3d_actions.h>
|
||||
#include <3d_viewer/tools/eda_3d_controller.h>
|
||||
#include <3d_viewer/tools/eda_3d_conditions.h>
|
||||
#include <board.h>
|
||||
#include <advanced_config.h>
|
||||
#include <bitmaps.h>
|
||||
#include <board_design_settings.h>
|
||||
@@ -117,8 +116,8 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
|
||||
ANTIALIASING_MODE 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,
|
||||
m_canvas = new EDA_3D_CANVAS( this, OGL_ATT_LIST::GetAttributesList( aaMode ), m_boardAdapter,
|
||||
m_currentCamera,
|
||||
PROJECT_PCB::Get3DCacheManager( &Prj() ) );
|
||||
|
||||
m_appearancePanel = new APPEARANCE_CONTROLS_3D( this, GetCanvas() );
|
||||
@@ -659,6 +658,8 @@ void EDA_3D_VIEWER_FRAME::ShowChangedLanguage()
|
||||
{
|
||||
wxAuiPaneInfo& lm_pane_info = m_auimgr.GetPane( m_appearancePanel );
|
||||
lm_pane_info.Caption( _( "Appearance" ) );
|
||||
|
||||
m_appearancePanel->OnLanguageChanged();
|
||||
}
|
||||
|
||||
SetStatusText( wxEmptyString, ACTIVITY );
|
||||
@@ -811,6 +812,9 @@ void EDA_3D_VIEWER_FRAME::loadCommonSettings()
|
||||
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
||||
m_canvas->SetScaleFactor( dpi.GetScaleFactor() );
|
||||
|
||||
// TODO(JE) use all control options
|
||||
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
m_params.emplace_back( new PARAM_LAYER_PRESET_3D( "layer_presets",
|
||||
&m_LayerPresets ) );
|
||||
m_params.emplace_back( new PARAM<wxString>( "current_layer_preset",
|
||||
&m_CurrentPreset, FOLLOW_PLOT_SETTINGS ) );
|
||||
&m_CurrentPreset, LEGACY_PRESET_FLAG ) );
|
||||
|
||||
registerMigration( 0, 1, std::bind( &EDA_3D_VIEWER_SETTINGS::migrateSchema0to1, this ) );
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2023 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
|
||||
@@ -23,6 +23,7 @@
|
||||
#define EDA_3D_VIEWER_SETTINGS_H_
|
||||
|
||||
#include <3d_enums.h>
|
||||
#include <common_ogl/ogl_attr_list.h>
|
||||
#include <plugins/3dapi/xv3d_types.h>
|
||||
#include <settings/app_settings.h>
|
||||
#include <settings/parameters.h>
|
||||
@@ -33,8 +34,6 @@
|
||||
#define FOLLOW_PLOT_SETTINGS wxT( "follow_plot_settings" )
|
||||
#define LEGACY_PRESET_FLAG wxT( "legacy_preset_flag" )
|
||||
|
||||
enum class ANTIALIASING_MODE;
|
||||
|
||||
|
||||
struct LAYER_PRESET_3D
|
||||
{
|
||||
|
||||
@@ -45,9 +45,7 @@ set(3D-VIEWER_SRCS
|
||||
${DIR_RAY_ACC}/container_2d.cpp
|
||||
${DIR_RAY}/PerlinNoise.cpp
|
||||
${DIR_RAY}/create_scene.cpp
|
||||
${DIR_RAY}/render_3d_raytrace_base.cpp
|
||||
${DIR_RAY}/render_3d_raytrace_gl.cpp
|
||||
${DIR_RAY}/render_3d_raytrace_ram.cpp
|
||||
${DIR_RAY}/render_3d_raytrace.cpp
|
||||
${DIR_RAY}/frustum.cpp
|
||||
${DIR_RAY}/material.cpp
|
||||
${DIR_RAY}/mortoncodes.cpp
|
||||
@@ -73,7 +71,7 @@ set(3D-VIEWER_SRCS
|
||||
${DIR_RAY_3D}/triangle_3d.cpp
|
||||
3d_rendering/buffers_debug.cpp
|
||||
3d_rendering/render_3d_base.cpp
|
||||
3d_rendering/color_rgba.cpp
|
||||
3d_rendering/color_rgb.cpp
|
||||
3d_rendering/image.cpp
|
||||
3d_rendering/post_shader.cpp
|
||||
3d_rendering/post_shader_ssao.cpp
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2020 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
|
||||
@@ -33,45 +33,94 @@
|
||||
#include <core/arraydim.h>
|
||||
|
||||
|
||||
const wxGLAttributes OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE aAntiAliasingMode,
|
||||
bool aAlpha )
|
||||
const int OGL_ATT_LIST::m_openGL_attributes_list[] = {
|
||||
|
||||
// Boolean attributes (using itself at padding):
|
||||
|
||||
// 0 1
|
||||
WX_GL_RGBA, WX_GL_RGBA,
|
||||
// 2 3
|
||||
WX_GL_DOUBLEBUFFER, WX_GL_DOUBLEBUFFER,
|
||||
|
||||
|
||||
// Normal attributes with values:
|
||||
|
||||
// 4 5
|
||||
WX_GL_DEPTH_SIZE, 16,
|
||||
// 6 7
|
||||
WX_GL_STENCIL_SIZE, 8,
|
||||
|
||||
|
||||
// This ones need to be the last in the list (as the tags will set to 0 if AA fails)
|
||||
|
||||
// 8 9
|
||||
WX_GL_SAMPLES, 0, // Disable AA for the start.
|
||||
//10 11
|
||||
WX_GL_SAMPLE_BUFFERS, 1, // Enable multisampling support (antialiasing).
|
||||
|
||||
0, 0 // NULL termination
|
||||
};
|
||||
|
||||
#define ATT_WX_GL_SAMPLES_OFFSET 8
|
||||
#define ATT_WX_GL_SAMPLES_OFFSET_DATA 9
|
||||
#define ATT_WX_GL_SAMPLE_BUFFERS_OFFSET 10
|
||||
#define ATT_WX_GL_SAMPLE_BUFFERS_DATA 11
|
||||
|
||||
int OGL_ATT_LIST::m_openGL_attributes_list_to_use[
|
||||
arrayDim( OGL_ATT_LIST::m_openGL_attributes_list ) ] = { 0 };
|
||||
|
||||
|
||||
const int* OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE aAntiAliasingMode )
|
||||
{
|
||||
wxASSERT( aAntiAliasingMode <= ANTIALIASING_MODE::AA_8X );
|
||||
|
||||
auto makeAttribs = [aAlpha]( int aSamplers )
|
||||
{
|
||||
wxGLAttributes dispAttrs;
|
||||
|
||||
dispAttrs.RGBA()
|
||||
.DoubleBuffer()
|
||||
.Depth( 16 )
|
||||
.Stencil( 8 )
|
||||
.Samplers( aSamplers )
|
||||
.SampleBuffers( aSamplers >= 0 ? 1 : -1 )
|
||||
.MinRGBA( 8, 8, 8, aAlpha ? 8 : -1 )
|
||||
.EndList();
|
||||
|
||||
return dispAttrs;
|
||||
};
|
||||
|
||||
int maxSamples = -1;
|
||||
memcpy( m_openGL_attributes_list_to_use, m_openGL_attributes_list,
|
||||
sizeof( m_openGL_attributes_list_to_use ) );
|
||||
|
||||
if( aAntiAliasingMode > ANTIALIASING_MODE::AA_NONE )
|
||||
{
|
||||
// There is a bug on wxGLCanvas that makes IsDisplaySupported fail
|
||||
// while testing for antialiasing.
|
||||
// http://trac.wxwidgets.org/ticket/16909
|
||||
// this next code will only work after this bug is fixed
|
||||
//
|
||||
// On my experience (Mario) it was only working on Linux but failing on
|
||||
// Windows, so there was no AA.
|
||||
|
||||
|
||||
// Check if the canvas supports multisampling.
|
||||
if( wxGLCanvas::IsDisplaySupported( makeAttribs( 0 ) ) )
|
||||
if( wxGLCanvas::IsDisplaySupported( m_openGL_attributes_list_to_use ) )
|
||||
{
|
||||
static const int aaSamples[4] = { 0, 2, 4, 8 };
|
||||
static const int aaSamples[4] = {0, 2, 4, 8};
|
||||
|
||||
// Check for possible sample sizes, start form the requested.
|
||||
maxSamples = aaSamples[static_cast<int>( aAntiAliasingMode )];
|
||||
int maxSamples = aaSamples[static_cast<int>( aAntiAliasingMode )];
|
||||
|
||||
while( maxSamples > 0 && !wxGLCanvas::IsDisplaySupported( makeAttribs( maxSamples ) ) )
|
||||
m_openGL_attributes_list_to_use[ATT_WX_GL_SAMPLES_OFFSET_DATA] = maxSamples;
|
||||
|
||||
for( ; (maxSamples > 0) &&
|
||||
( !wxGLCanvas::IsDisplaySupported( m_openGL_attributes_list_to_use ) );
|
||||
maxSamples = maxSamples >> 1 )
|
||||
{
|
||||
maxSamples = maxSamples >> 1;
|
||||
m_openGL_attributes_list_to_use[ATT_WX_GL_SAMPLES_OFFSET_DATA] = maxSamples;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aAntiAliasingMode = ANTIALIASING_MODE::AA_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
return makeAttribs( maxSamples );
|
||||
// Disable antialiasing if it failed or was not requested
|
||||
if( aAntiAliasingMode == ANTIALIASING_MODE::AA_NONE )
|
||||
{
|
||||
// Remove multisampling information
|
||||
// (hoping that the GPU driver will decide what is best)
|
||||
m_openGL_attributes_list_to_use[ATT_WX_GL_SAMPLES_OFFSET] = 0;
|
||||
m_openGL_attributes_list_to_use[ATT_WX_GL_SAMPLES_OFFSET_DATA] = 0;
|
||||
m_openGL_attributes_list_to_use[ATT_WX_GL_SAMPLE_BUFFERS_OFFSET] = 0;
|
||||
m_openGL_attributes_list_to_use[ATT_WX_GL_SAMPLE_BUFFERS_DATA] = 0;
|
||||
}
|
||||
|
||||
return m_openGL_attributes_list_to_use;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2020 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
|
||||
@@ -30,8 +30,6 @@
|
||||
#ifndef _OGL_ATT_LIST_H
|
||||
#define _OGL_ATT_LIST_H
|
||||
|
||||
#include <wx/glcanvas.h>
|
||||
|
||||
/// Anti-aliasing options
|
||||
enum class ANTIALIASING_MODE
|
||||
{
|
||||
@@ -53,12 +51,29 @@ public:
|
||||
* Get a list of attributes to pass to wxGLCanvas.
|
||||
*
|
||||
* @param aAntiAliasingMode = 0 - disabled; try to initialize (if is supported) the
|
||||
* list with anti aliasing capabilities.
|
||||
* @param aAlpha set to enable alpha channel.
|
||||
* @return wxGLAttributes to be passed in the creation of a EDA_3D_CANVAS class
|
||||
* list with anti aliasing capabilities
|
||||
* @return a list of options to be passed in the creation of a EDA_3D_CANVAS class
|
||||
*/
|
||||
static const wxGLAttributes GetAttributesList( ANTIALIASING_MODE aAntiAliasingMode,
|
||||
bool aAlpha = false );
|
||||
static const int* GetAttributesList( ANTIALIASING_MODE aAntiAliasingMode );
|
||||
|
||||
private:
|
||||
/**
|
||||
* Attributes list to be passed to a wxGLCanvas creation.
|
||||
*
|
||||
* This array should be 2*n+1
|
||||
* Sadly wxwidgets / glx < 13 allowed
|
||||
* a thing named "boolean attributes" that don't take a value.
|
||||
* (See src/unix/glx11.cpp -> wxGLCanvasX11::ConvertWXAttrsToGL() ).
|
||||
* To avoid problems due to this, just specify those attributes twice.
|
||||
* Only WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_STEREO are such boolean
|
||||
* attributes.
|
||||
*/
|
||||
static const int m_openGL_attributes_list[];
|
||||
|
||||
/**
|
||||
* Attributes list that was (eventually) changed and are passed to creation.
|
||||
*/
|
||||
static int m_openGL_attributes_list_to_use[];
|
||||
};
|
||||
|
||||
#endif // _OGL_ATT_LIST_H
|
||||
|
||||
@@ -46,7 +46,7 @@ void OglGetScreenshot( wxImage& aDstImage )
|
||||
|
||||
glGetIntegerv( GL_VIEWPORT, (GLint*) &viewport );
|
||||
|
||||
unsigned char* pixelbuffer = (unsigned char*) malloc( viewport.x * viewport.y * 4 );
|
||||
unsigned char* pixelbuffer = (unsigned char*) malloc( viewport.x * viewport.y * 3 );
|
||||
|
||||
// Call glFinish before screenshot to ensure everything is fully drawn.
|
||||
glFinish();
|
||||
@@ -54,40 +54,15 @@ void OglGetScreenshot( wxImage& aDstImage )
|
||||
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
|
||||
glReadBuffer( GL_BACK_LEFT );
|
||||
|
||||
glReadPixels( viewport.originX, viewport.originY, viewport.x, viewport.y, GL_RGBA,
|
||||
glReadPixels( viewport.originX, viewport.originY, viewport.x, viewport.y, GL_RGB,
|
||||
GL_UNSIGNED_BYTE, pixelbuffer );
|
||||
|
||||
unsigned char* rgbBuffer = (unsigned char*) malloc( viewport.x * viewport.y * 3 );
|
||||
unsigned char* alphaBuffer = (unsigned char*) malloc( viewport.x * viewport.y );
|
||||
|
||||
unsigned char* rgbaPtr = pixelbuffer;
|
||||
unsigned char* rgbPtr = rgbBuffer;
|
||||
unsigned char* alphaPtr = alphaBuffer;
|
||||
|
||||
for( int y = 0; y < viewport.y; y++ )
|
||||
{
|
||||
for( int x = 0; x < viewport.x; x++ )
|
||||
{
|
||||
rgbPtr[0] = rgbaPtr[0];
|
||||
rgbPtr[1] = rgbaPtr[1];
|
||||
rgbPtr[2] = rgbaPtr[2];
|
||||
alphaPtr[0] = rgbaPtr[3];
|
||||
|
||||
rgbaPtr += 4;
|
||||
rgbPtr += 3;
|
||||
alphaPtr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// "Sets the image data without performing checks.
|
||||
// The data given must have the size (width*height*3)
|
||||
// The data must have been allocated with malloc()
|
||||
// If static_data is false, after this call the pointer to the data is owned
|
||||
// by the wxImage object, that will be responsible for deleting it."
|
||||
aDstImage.SetData( rgbBuffer, viewport.x, viewport.y, false );
|
||||
aDstImage.SetAlpha( alphaBuffer, false );
|
||||
|
||||
free( pixelbuffer );
|
||||
aDstImage.SetData( pixelbuffer, viewport.x, viewport.y, false );
|
||||
|
||||
aDstImage = aDstImage.Mirror( false );
|
||||
}
|
||||
@@ -182,7 +157,7 @@ void OglSetDiffuseMaterial( const SFVEC3F &aMaterialDiffuse, float aOpacity,
|
||||
}
|
||||
|
||||
|
||||
void OglDrawBackground( const SFVEC4F& aTopColor, const SFVEC4F& aBotColor )
|
||||
void OglDrawBackground( const SFVEC3F& aTopColor, const SFVEC3F& aBotColor )
|
||||
{
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
@@ -198,14 +173,14 @@ void OglDrawBackground( const SFVEC4F& aTopColor, const SFVEC4F& aBotColor )
|
||||
glDisable( GL_ALPHA_TEST );
|
||||
|
||||
glBegin( GL_QUADS );
|
||||
glColor4f( aTopColor.r, aTopColor.g, aTopColor.b, aTopColor.a );
|
||||
glColor4f( aTopColor.x, aTopColor.y, aTopColor.z, 1.0f );
|
||||
glVertex2f( -1.0, 1.0 ); // Top left corner
|
||||
|
||||
glColor4f( aBotColor.r, aBotColor.g, aBotColor.b, aBotColor.a );
|
||||
glColor4f( aBotColor.x, aBotColor.y, aBotColor.z, 1.0f );
|
||||
glVertex2f( -1.0,-1.0 ); // bottom left corner
|
||||
glVertex2f( 1.0,-1.0 ); // bottom right corner
|
||||
|
||||
glColor4f( aTopColor.r, aTopColor.g, aTopColor.b, aTopColor.a);
|
||||
glColor4f( aTopColor.x, aTopColor.y, aTopColor.z, 1.0f );
|
||||
glVertex2f( 1.0, 1.0 ); // top right corner
|
||||
glEnd();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ GLuint OglLoadTexture( const IMAGE& aImage );
|
||||
*/
|
||||
void OglGetScreenshot( wxImage& aDstImage );
|
||||
|
||||
void OglDrawBackground( const SFVEC4F& aTopColor, const SFVEC4F& aBotColor );
|
||||
void OglDrawBackground( const SFVEC3F& aTopColor, const SFVEC3F& aBotColor );
|
||||
|
||||
/**
|
||||
* Reset to default state the texture settings.
|
||||
|
||||
@@ -100,6 +100,7 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
|
||||
{
|
||||
DPI_SCALING_COMMON dpi( nullptr, m_frame );
|
||||
|
||||
int indicatorSize = ConvertDialogToPixels( wxSize( 6, 6 ) ).x / dpi.GetContentScaleFactor();
|
||||
int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
|
||||
m_pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
|
||||
|
||||
@@ -152,21 +153,18 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
|
||||
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ),
|
||||
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) );
|
||||
|
||||
if( screenHeight <= 900 && m_pointSize >= FromDIP( KIUI::c_IndicatorSizeDIP ) )
|
||||
if( screenHeight <= 900 && m_pointSize >= indicatorSize )
|
||||
m_pointSize = m_pointSize * 8 / 10;
|
||||
|
||||
m_cbLayerPresets->Bind( wxEVT_CHOICE, &APPEARANCE_CONTROLS_3D::onLayerPresetChanged, this );
|
||||
|
||||
m_toggleGridRenderer = new GRID_BITMAP_TOGGLE_RENDERER(
|
||||
KiBitmapBundle( BITMAPS::visibility ), KiBitmapBundle( BITMAPS::visibility_off ) );
|
||||
|
||||
m_frame->Bind( EDA_LANG_CHANGED, &APPEARANCE_CONTROLS_3D::OnLanguageChanged, this );
|
||||
m_toggleGridRenderer = new GRID_BITMAP_TOGGLE_RENDERER( KiBitmap( BITMAPS::visibility ),
|
||||
KiBitmap( BITMAPS::visibility_off ) );
|
||||
}
|
||||
|
||||
|
||||
APPEARANCE_CONTROLS_3D::~APPEARANCE_CONTROLS_3D()
|
||||
{
|
||||
m_frame->Unbind( EDA_LANG_CHANGED, &APPEARANCE_CONTROLS_3D::OnLanguageChanged, this );
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +199,7 @@ void APPEARANCE_CONTROLS_3D::OnSize( wxSizeEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::rebuildControls()
|
||||
void APPEARANCE_CONTROLS_3D::OnLanguageChanged()
|
||||
{
|
||||
Freeze();
|
||||
|
||||
@@ -215,14 +213,6 @@ void APPEARANCE_CONTROLS_3D::rebuildControls()
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::OnLanguageChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
rebuildControls();
|
||||
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::OnDarkModeToggle()
|
||||
{
|
||||
// This is essentially a list of hacks because DarkMode isn't yet implemented inside
|
||||
@@ -246,7 +236,7 @@ void APPEARANCE_CONTROLS_3D::OnDarkModeToggle()
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::CommonSettingsChanged()
|
||||
{
|
||||
rebuildControls();
|
||||
OnLanguageChanged();
|
||||
|
||||
UpdateLayerCtls();
|
||||
syncLayerPresetSelection();
|
||||
@@ -520,9 +510,10 @@ 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,
|
||||
KiBitmap( BITMAPS::visibility ),
|
||||
KiBitmap( BITMAPS::visibility_off ),
|
||||
aSetting->m_Visible );
|
||||
|
||||
btn_visible->Bind( TOGGLE_CHANGED,
|
||||
[this]( wxCommandEvent& aEvent )
|
||||
|
||||
@@ -114,6 +114,8 @@ public:
|
||||
~APPEARANCE_CONTROLS_3D();
|
||||
|
||||
wxSize GetBestSize() const;
|
||||
|
||||
void OnLanguageChanged();
|
||||
void OnDarkModeToggle();
|
||||
void OnLayerVisibilityChanged( int aLayer, bool isVisible );
|
||||
|
||||
@@ -138,11 +140,8 @@ public:
|
||||
protected:
|
||||
void OnSetFocus( wxFocusEvent& aEvent ) override;
|
||||
void OnSize( wxSizeEvent& aEvent ) override;
|
||||
void OnLanguageChanged( wxCommandEvent& aEvent );
|
||||
|
||||
private:
|
||||
void rebuildControls();
|
||||
|
||||
void rebuildLayers();
|
||||
|
||||
void rebuildLayerPresetsWidget();
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include <settings/common_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <widgets/wx_infobar.h>
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
#include <eda_3d_viewer_settings.h>
|
||||
#include <board_design_settings.h>
|
||||
|
||||
@@ -124,8 +123,7 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
// Create the 3D canvas
|
||||
m_previewPane = new EDA_3D_CANVAS( this,
|
||||
OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ),
|
||||
m_boardAdapter, m_currentCamera,
|
||||
PROJECT_PCB::Get3DCacheManager( &aFrame->Prj() ) );
|
||||
m_boardAdapter, m_currentCamera, PROJECT_PCB::Get3DCacheManager( &aFrame->Prj() ) );
|
||||
|
||||
m_boardAdapter.SetBoard( m_dummyBoard );
|
||||
m_boardAdapter.m_IsBoardView = false;
|
||||
@@ -163,6 +161,26 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
aFrame->Connect( EDA_EVT_UNITS_CHANGED,
|
||||
wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
|
||||
nullptr, this );
|
||||
|
||||
#ifdef __WXOSX__
|
||||
// Call layout once to get the proper button sizes after the bitmaps have been set
|
||||
Layout();
|
||||
|
||||
// The rounded-button style used has a small border on the left/right sides.
|
||||
// This is automatically fixed in wx for buttons with a bitmap < 20, but not
|
||||
// when the bitmap is set to be 26x26.
|
||||
wxSize borderFix = wxSize( 4, 4 );
|
||||
|
||||
m_bpvTop->SetMinSize( m_bpvTop->GetSize() + borderFix );
|
||||
m_bpvFront->SetMinSize( m_bpvFront->GetSize() + borderFix );
|
||||
m_bpvBack->SetMinSize( m_bpvBack->GetSize() + borderFix );
|
||||
m_bpvLeft->SetMinSize( m_bpvLeft->GetSize() + borderFix );
|
||||
m_bpvRight->SetMinSize( m_bpvRight->GetSize() + borderFix );
|
||||
m_bpvBottom->SetMinSize( m_bpvBottom->GetSize() + borderFix );
|
||||
m_bpvISO->SetMinSize( m_bpvISO->GetSize() + borderFix );
|
||||
m_bpUpdate->SetMinSize( m_bpUpdate->GetSize() + borderFix );
|
||||
m_bpSettings->SetMinSize( m_bpSettings->GetSize() + borderFix );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -192,6 +210,9 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
|
||||
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
||||
m_previewPane->SetScaleFactor( dpi.GetScaleFactor() );
|
||||
|
||||
// TODO(JE) use all control options
|
||||
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
||||
|
||||
@@ -253,10 +274,6 @@ wxString PANEL_PREVIEW_3D_MODEL::formatScaleValue( double aValue )
|
||||
|
||||
wxString PANEL_PREVIEW_3D_MODEL::formatRotationValue( double aValue )
|
||||
{
|
||||
// Sigh. Did we really need differentiated +/- 0.0?
|
||||
if( aValue == -0.0 )
|
||||
aValue = 0.0;
|
||||
|
||||
return wxString::Format( wxT( "%.2f%s" ),
|
||||
aValue,
|
||||
EDA_UNIT_UTILS::GetText( EDA_UNITS::DEGREES ) );
|
||||
@@ -290,11 +307,9 @@ void PANEL_PREVIEW_3D_MODEL::SetSelectedModel( int idx )
|
||||
yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
|
||||
zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
|
||||
|
||||
// Rotation is stored in the file as postive-is-CW, but we use postive-is-CCW in the GUI
|
||||
// to match the rest of KiCad
|
||||
xrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.x ) );
|
||||
yrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.y ) );
|
||||
zrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.z ) );
|
||||
xrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.x ) );
|
||||
yrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.y ) );
|
||||
zrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.z ) );
|
||||
|
||||
xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
|
||||
yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
|
||||
@@ -337,11 +352,9 @@ void PANEL_PREVIEW_3D_MODEL::updateOrientation( wxCommandEvent &event )
|
||||
modelInfo->m_Scale.z = EDA_UNIT_UTILS::UI::DoubleValueFromString(
|
||||
pcbIUScale, EDA_UNITS::UNSCALED, zscale->GetValue() );
|
||||
|
||||
// Rotation is stored in the file as postive-is-CW, but we use postive-is-CCW in the GUI
|
||||
// to match the rest of KiCad
|
||||
modelInfo->m_Rotation.x = -rotationFromString( xrot->GetValue() );
|
||||
modelInfo->m_Rotation.y = -rotationFromString( yrot->GetValue() );
|
||||
modelInfo->m_Rotation.z = -rotationFromString( zrot->GetValue() );
|
||||
modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
|
||||
modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
|
||||
modelInfo->m_Rotation.z = rotationFromString( zrot->GetValue() );
|
||||
|
||||
modelInfo->m_Offset.x = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
||||
xoff->GetValue() )
|
||||
@@ -431,15 +444,10 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign
|
||||
else if( spinCtrl == m_spinZscale )
|
||||
textCtrl = zscale;
|
||||
|
||||
double step = SCALE_INCREMENT;
|
||||
|
||||
if( wxGetMouseState().ShiftDown( ) )
|
||||
step = SCALE_INCREMENT_FINE;
|
||||
|
||||
double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
|
||||
textCtrl->GetValue() );
|
||||
|
||||
curr_value += ( step * aSign );
|
||||
curr_value += ( SCALE_INCREMENT * aSign );
|
||||
curr_value = std::max( 1/MAX_SCALE, curr_value );
|
||||
curr_value = std::min( curr_value, MAX_SCALE );
|
||||
|
||||
@@ -457,15 +465,10 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aS
|
||||
else if( spinCtrl == m_spinZrot )
|
||||
textCtrl = zrot;
|
||||
|
||||
double step = ROTATION_INCREMENT;
|
||||
|
||||
if( wxGetMouseState().ShiftDown( ) )
|
||||
step = ROTATION_INCREMENT_FINE;
|
||||
|
||||
double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, EDA_UNITS::DEGREES,
|
||||
textCtrl->GetValue() );
|
||||
|
||||
curr_value += ( step * aSign );
|
||||
curr_value += ( ROTATION_INCREMENT * aSign );
|
||||
curr_value = std::max( -MAX_ROTATION, curr_value );
|
||||
curr_value = std::min( curr_value, MAX_ROTATION );
|
||||
|
||||
@@ -485,22 +488,16 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign
|
||||
textCtrl = zoff;
|
||||
|
||||
double step_mm = OFFSET_INCREMENT_MM;
|
||||
|
||||
if( wxGetMouseState().ShiftDown( ) )
|
||||
step_mm = OFFSET_INCREMENT_MM_FINE;
|
||||
double curr_value_mm =
|
||||
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
||||
textCtrl->GetValue() )
|
||||
/ pcbIUScale.IU_PER_MM;
|
||||
|
||||
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
|
||||
{
|
||||
step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
|
||||
|
||||
if( wxGetMouseState().ShiftDown( ) )
|
||||
step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000;;
|
||||
}
|
||||
|
||||
double curr_value_mm = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
||||
textCtrl->GetValue() )
|
||||
/ pcbIUScale.IU_PER_MM;
|
||||
|
||||
curr_value_mm += ( step_mm * aSign );
|
||||
curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
|
||||
curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
|
||||
@@ -536,10 +533,10 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelRot( wxMouseEvent& event )
|
||||
{
|
||||
wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
|
||||
|
||||
double step = ROTATION_INCREMENT;
|
||||
double step = ROTATION_INCREMENT_WHEEL;
|
||||
|
||||
if( event.ShiftDown( ) )
|
||||
step = ROTATION_INCREMENT_FINE;
|
||||
step = ROTATION_INCREMENT_WHEEL_FINE;
|
||||
|
||||
if( event.GetWheelRotation() >= 0 )
|
||||
step = -step;
|
||||
|
||||
@@ -43,8 +43,9 @@
|
||||
#define SCALE_INCREMENT_FINE 0.02
|
||||
#define SCALE_INCREMENT 0.1
|
||||
|
||||
#define ROTATION_INCREMENT 90 // in degrees
|
||||
#define ROTATION_INCREMENT_FINE 1 // in degrees
|
||||
#define ROTATION_INCREMENT 90 // in degrees, for spin button command
|
||||
#define ROTATION_INCREMENT_WHEEL 90 // in degrees, for mouse wheel command
|
||||
#define ROTATION_INCREMENT_WHEEL_FINE 1 // in degrees, for mouse wheel command
|
||||
|
||||
#define OFFSET_INCREMENT_MM 0.5
|
||||
#define OFFSET_INCREMENT_MM_FINE 0.1
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/std_bitmap_button.h"
|
||||
|
||||
#include "panel_preview_3d_model_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -23,7 +21,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
sbSizerScale = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scale") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerScale;
|
||||
fgSizerScale = new wxFlexGridSizer( 0, 3, 1, 3 );
|
||||
fgSizerScale = new wxFlexGridSizer( 0, 3, 2, 3 );
|
||||
fgSizerScale->AddGrowableCol( 1 );
|
||||
fgSizerScale->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerScale->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
@@ -59,16 +57,16 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
fgSizerScale->Add( m_spinZscale, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sbSizerScale->Add( fgSizerScale, 0, wxBOTTOM|wxEXPAND|wxRIGHT, 2 );
|
||||
sbSizerScale->Add( fgSizerScale, 0, wxBOTTOM|wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizerLeft->Add( sbSizerScale, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
bSizerLeft->Add( sbSizerScale, 0, wxLEFT|wxRIGHT|wxEXPAND, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerRotation;
|
||||
sbSizerRotation = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Rotation") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerRotate;
|
||||
fgSizerRotate = new wxFlexGridSizer( 0, 3, 1, 3 );
|
||||
fgSizerRotate = new wxFlexGridSizer( 0, 3, 2, 3 );
|
||||
fgSizerRotate->AddGrowableCol( 1 );
|
||||
fgSizerRotate->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerRotate->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
@@ -104,7 +102,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
fgSizerRotate->Add( m_spinZrot, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sbSizerRotation->Add( fgSizerRotate, 0, wxBOTTOM|wxRIGHT|wxEXPAND, 2 );
|
||||
sbSizerRotation->Add( fgSizerRotate, 0, wxBOTTOM|wxRIGHT|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerLeft->Add( sbSizerRotation, 0, wxLEFT|wxRIGHT|wxEXPAND, 5 );
|
||||
@@ -113,7 +111,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
sbSizerOffset = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Offset") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerOffset;
|
||||
fgSizerOffset = new wxFlexGridSizer( 0, 3, 1, 3 );
|
||||
fgSizerOffset = new wxFlexGridSizer( 0, 3, 2, 3 );
|
||||
fgSizerOffset->AddGrowableCol( 1 );
|
||||
fgSizerOffset->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerOffset->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
@@ -149,7 +147,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
fgSizerOffset->Add( m_spinZoffset, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sbSizerOffset->Add( fgSizerOffset, 0, wxBOTTOM|wxRIGHT|wxEXPAND, 2 );
|
||||
sbSizerOffset->Add( fgSizerOffset, 0, wxBOTTOM|wxRIGHT|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerLeft->Add( sbSizerOffset, 0, wxLEFT|wxRIGHT|wxEXPAND, 5 );
|
||||
@@ -157,8 +155,8 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
wxStaticBoxSizer* sbSizer4;
|
||||
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, 2 );
|
||||
m_opacity = new wxSlider( sbSizer4->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
|
||||
sbSizer4->Add( m_opacity, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizerLeft->Add( sbSizer4, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
@@ -176,7 +174,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
m_previewLabel->Wrap( -1 );
|
||||
m_previewLabel->SetFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
|
||||
|
||||
bSizer6->Add( m_previewLabel, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
bSizer6->Add( m_previewLabel, 1, wxEXPAND|wxLEFT|wxRIGHT, 10 );
|
||||
|
||||
|
||||
bSizerRight->Add( bSizer6, 0, wxEXPAND, 5 );
|
||||
@@ -195,53 +193,53 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
|
||||
bSizer3DButtons->Add( 0, 10, 0, 0, 5 );
|
||||
|
||||
m_bpvISO = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpvISO = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpvISO->SetToolTip( _("Enable/disable orthographic projection") );
|
||||
|
||||
bSizer3DButtons->Add( m_bpvISO, 0, wxTOP, 5 );
|
||||
|
||||
m_bpvBodyStyle = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpvBodyStyle = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpvBodyStyle->SetToolTip( _("Show or hide the board body\nIf hidden, show only copper and silkscreen layers.") );
|
||||
|
||||
bSizer3DButtons->Add( m_bpvBodyStyle, 0, wxTOP, 5 );
|
||||
bSizer3DButtons->Add( m_bpvBodyStyle, 0, wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_bpvLeft = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpvLeft = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
bSizer3DButtons->Add( m_bpvLeft, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_bpvRight = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpvRight = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
bSizer3DButtons->Add( m_bpvRight, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_bpvFront = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpvFront = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
bSizer3DButtons->Add( m_bpvFront, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_bpvBack = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpvBack = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
bSizer3DButtons->Add( m_bpvBack, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_bpvTop = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpvTop = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
bSizer3DButtons->Add( m_bpvTop, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_bpvBottom = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpvBottom = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
bSizer3DButtons->Add( m_bpvBottom, 0, 0, 5 );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_bpUpdate = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpUpdate = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
m_bpUpdate->SetToolTip( _("Reload board and 3D models") );
|
||||
|
||||
bSizer3DButtons->Add( m_bpUpdate, 0, wxTOP, 5 );
|
||||
bSizer3DButtons->Add( m_bpUpdate, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_bpSettings = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizer3DButtons->Add( m_bpSettings, 0, wxTOP, 5 );
|
||||
m_bpSettings = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizer3DButtons->Add( m_bpSettings, 0, wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( 0, 10, 0, 0, 5 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizer3DButtons, 0, wxEXPAND|wxTOP, 5 );
|
||||
bSizermain->Add( bSizer3DButtons, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizermain );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -10,8 +10,6 @@
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class STD_BITMAP_BUTTON;
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
@@ -70,16 +68,16 @@ class PANEL_PREVIEW_3D_MODEL_BASE : public wxPanel
|
||||
wxSlider* m_opacity;
|
||||
wxStaticText* m_previewLabel;
|
||||
wxBoxSizer* m_SizerPanelView;
|
||||
STD_BITMAP_BUTTON* m_bpvISO;
|
||||
STD_BITMAP_BUTTON* m_bpvBodyStyle;
|
||||
STD_BITMAP_BUTTON* m_bpvLeft;
|
||||
STD_BITMAP_BUTTON* m_bpvRight;
|
||||
STD_BITMAP_BUTTON* m_bpvFront;
|
||||
STD_BITMAP_BUTTON* m_bpvBack;
|
||||
STD_BITMAP_BUTTON* m_bpvTop;
|
||||
STD_BITMAP_BUTTON* m_bpvBottom;
|
||||
STD_BITMAP_BUTTON* m_bpUpdate;
|
||||
STD_BITMAP_BUTTON* m_bpSettings;
|
||||
wxBitmapButton* m_bpvISO;
|
||||
wxBitmapButton* m_bpvBodyStyle;
|
||||
wxBitmapButton* m_bpvLeft;
|
||||
wxBitmapButton* m_bpvRight;
|
||||
wxBitmapButton* m_bpvFront;
|
||||
wxBitmapButton* m_bpvBack;
|
||||
wxBitmapButton* m_bpvTop;
|
||||
wxBitmapButton* m_bpvBottom;
|
||||
wxBitmapButton* m_bpUpdate;
|
||||
wxBitmapButton* m_bpSettings;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void onMouseWheelScale( wxMouseEvent& event ) { event.Skip(); }
|
||||
|
||||
@@ -51,7 +51,6 @@ Thomas Pointhuber <thomas.pointhuber[at]gmx-dot-at>
|
||||
Roberto Fernandez Bautista <roberto.fer.bau[at]gmail-dot-com>
|
||||
Mikołaj Wielgus <wielgusmikolaj[at]gmail-dot-com>
|
||||
Mike Williams <mike[at]mikebwilliams-dot-com>
|
||||
Emile Cormier <emile.cormier.jr[at]gmail-dot-com>
|
||||
|
||||
See git repo on GitLab for contributors at
|
||||
https://gitlab.com/kicad/code/kicad/-/graphs/master
|
||||
|
||||
+15
-94
@@ -31,11 +31,6 @@ cmake_policy( SET CMP0116 OLD )
|
||||
# The current structure requires the add_custom_command to get called twice, the NEW behavior deduplicates it
|
||||
cmake_policy( SET CMP0113 OLD )
|
||||
|
||||
# Enable CMAKE_MSVC_DEBUG_INFORMATION_FORMAT to override the cmake pdb flags easily
|
||||
if (POLICY CMP0141)
|
||||
cmake_policy(SET CMP0141 NEW)
|
||||
endif (POLICY CMP0141)
|
||||
|
||||
# Default to CMAKE_BUILD_TYPE = Release unless overridden on command line
|
||||
# http://www.cmake.org/pipermail/cmake/2008-September/023808.html
|
||||
if( DEFINED CMAKE_BUILD_TYPE )
|
||||
@@ -165,17 +160,6 @@ cmake_dependent_option( KICAD_APPLE_MAKE_RELOCATEABLE_BUNDLE
|
||||
"On macOS, post-process the build to make it relocateable (default ON)"
|
||||
ON "APPLE" OFF )
|
||||
|
||||
# CMake's FindProtobuf module doesn't work correctly on MacOS or Windows but is
|
||||
# required for Linux
|
||||
if( UNIX_NOT_APPLE )
|
||||
set( KICAD_CMAKE_PROTOBUF_DEFAULT ON )
|
||||
else()
|
||||
set( KICAD_CMAKE_PROTOBUF_DEFAULT OFF )
|
||||
endif()
|
||||
|
||||
option( KICAD_USE_CMAKE_FINDPROTOBUF "Use FindProtobuf provided by CMake" ${KICAD_CMAKE_PROTOBUF_DEFAULT} )
|
||||
mark_as_advanced( KICAD_USE_CMAKE_FINDPROTOBUF )
|
||||
|
||||
####################################
|
||||
# Installation options
|
||||
####################################
|
||||
@@ -263,14 +247,6 @@ option( KICAD_GAL_PROFILE
|
||||
"Enable profiling info for GAL"
|
||||
OFF )
|
||||
|
||||
option( KICAD_IPC_API
|
||||
"Enable experimental IPC API"
|
||||
OFF )
|
||||
|
||||
option( KICAD_IDF_TOOLS
|
||||
"Build additional idf tools"
|
||||
ON )
|
||||
|
||||
# Global setting: exports are explicit
|
||||
set( CMAKE_CXX_VISIBILITY_PRESET "hidden" )
|
||||
set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )
|
||||
@@ -278,8 +254,8 @@ set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )
|
||||
# Global setting: build everything position independent
|
||||
set( CMAKE_POSITION_INDEPENDENT_CODE ON )
|
||||
|
||||
# Global setting: Use C++20
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
# Global setting: Use C++17
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
@@ -302,10 +278,6 @@ if( KICAD_WAYLAND )
|
||||
add_compile_definitions( KICAD_WAYLAND )
|
||||
endif()
|
||||
|
||||
if( KICAD_IPC_API )
|
||||
add_definitions( -DKICAD_IPC_API )
|
||||
endif()
|
||||
|
||||
# Ensure DEBUG is defined for all platforms in Debug builds
|
||||
add_compile_definitions( $<$<CONFIG:Debug>:DEBUG> )
|
||||
|
||||
@@ -359,9 +331,13 @@ add_compile_definitions( $<$<BOOL:${KICAD_BUILD_ARCH_ARM64}>:KICAD_BUILD_ARCH_AR
|
||||
if (USE_CCACHE)
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if(CCACHE_FOUND)
|
||||
# Set ccache on the actual lang
|
||||
list(PREPEND CMAKE_C_COMPILER_LAUNCHER ${CCACHE_FOUND})
|
||||
list(PREPEND CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_FOUND})
|
||||
get_property(RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
|
||||
set(RULE_LAUNCH_COMPILE "${RULE_LAUNCH_COMPILE} ${CCACHE_FOUND}")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${RULE_LAUNCH_COMPILE})
|
||||
|
||||
get_property(RULE_LAUNCH_LINK GLOBAL PROPERTY RULE_LAUNCH_LINK)
|
||||
set(RULE_LAUNCH_LINK "${RULE_LAUNCH_LINK} ${CCACHE_FOUND}")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${RULE_LAUNCH_LINK})
|
||||
|
||||
message(STATUS "Used ${CCACHE_FOUND} for compilation.")
|
||||
else(CCACHE_FOUND)
|
||||
@@ -376,9 +352,9 @@ endif(USE_CCACHE)
|
||||
if (USE_DISTCC)
|
||||
find_program(DISTCC_FOUND distcc)
|
||||
if(DISTCC_FOUND)
|
||||
list(APPEND CMAKE_C_COMPILER_LAUNCHER ${DISTCC_FOUND})
|
||||
list(APPEND CMAKE_CXX_COMPILER_LAUNCHER ${DISTCC_FOUND})
|
||||
|
||||
get_property(RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
|
||||
set(RULE_LAUNCH_COMPILE "${RULE_LAUNCH_COMPILE} ${DISTCC_FOUND}")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${RULE_LAUNCH_COMPILE})
|
||||
message(STATUS "Using ${DISTCC_FOUND} for distributed build.")
|
||||
else(DISTCC_FOUND)
|
||||
message(INFO "Distcc was requested but not found.")
|
||||
@@ -536,18 +512,8 @@ if( MSVC )
|
||||
string( APPEND CMAKE_CXX_FLAGS " /wd4290" )
|
||||
# C4800: non-bool is explicitly cast to bool, forcing value of 0 or 1
|
||||
string( APPEND CMAKE_CXX_FLAGS " /wd4800" )
|
||||
|
||||
# cmake 3.25 or higher requried for MSVC, should be fine
|
||||
if( USE_CCACHE AND CCACHE_FOUND )
|
||||
# Equivalent to /Z7, ensures cmake doesn't fight over the default
|
||||
# ccache may encounter external PDB file write errors due to paralleism
|
||||
# Using the embedded PDB mode is ok for development use of ccache
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "Embedded")
|
||||
else()
|
||||
# Equivalent to /Zi, ensures cmake doesn't fight over the default
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase")
|
||||
endif()
|
||||
|
||||
# /Zi: create PDB
|
||||
string( APPEND CMAKE_CXX_FLAGS " /Zi" )
|
||||
# /Zc:__cplusplus: define this macro according to C++ standard version
|
||||
string( APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus" )
|
||||
# /GF: enable string pooling
|
||||
@@ -876,27 +842,6 @@ if( OCC_VERSION_STRING VERSION_LESS 7.5.0 )
|
||||
endif()
|
||||
include_directories( SYSTEM ${OCC_INCLUDE_DIR} )
|
||||
|
||||
if( KICAD_USE_CMAKE_FINDPROTOBUF )
|
||||
include( FindProtobuf )
|
||||
find_package( Protobuf REQUIRED )
|
||||
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()
|
||||
endif()
|
||||
|
||||
if( NOT Protobuf_INCLUDE_DIR )
|
||||
get_target_property( Protobuf_INCLUDE_DIR protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES )
|
||||
endif()
|
||||
|
||||
|
||||
# Assist with header file searching optimization:
|
||||
# INC_BEFORE and INC_AFTER are two lists which go at the front and back of the
|
||||
# header file search lists, respectively.
|
||||
@@ -1058,25 +1003,6 @@ find_package( wxWidgets ${wxWidgets_REQ_VERSION} COMPONENTS gl aui adv html core
|
||||
# Include wxWidgets macros.
|
||||
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}")
|
||||
|
||||
if( KICAD_WX_PORT STREQUAL "qt" )
|
||||
add_compile_definitions( __WXQT__ )
|
||||
elseif( KICAD_WX_PORT STREQUAL "gtk" )
|
||||
add_compile_definitions( __WXGTK__ )
|
||||
endif()
|
||||
elseif( _wx_selected_config )
|
||||
string(REGEX MATCH "^[msw|qt|gtk|osx]*" KICAD_WX_PORT "${_wx_selected_config}")
|
||||
endif()
|
||||
|
||||
if( KICAD_WX_PORT )
|
||||
message( STATUS "Detected wxWidgets port: ${KICAD_WX_PORT}")
|
||||
else()
|
||||
message( FATAL_ERROR "Unable to detect wxWidgets port")
|
||||
endif()
|
||||
|
||||
if( NOT MSVC )
|
||||
if( ${wxWidgets_VERSION_STRING} VERSION_LESS 3.2 )
|
||||
message( FATAL_ERROR "wxWidgets 3.2.0 or greater is required" )
|
||||
@@ -1125,10 +1051,6 @@ if( KICAD_USE_SENTRY )
|
||||
add_compile_definitions( KICAD_USE_SENTRY )
|
||||
endif()
|
||||
|
||||
if( KICAD_IPC_API )
|
||||
find_package( nng REQUIRED )
|
||||
endif()
|
||||
|
||||
#================================================
|
||||
# Add the doxygen target
|
||||
#================================================
|
||||
@@ -1167,7 +1089,6 @@ list( APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure" )
|
||||
#================================================
|
||||
|
||||
# Binaries ( CMake targets )
|
||||
add_subdirectory( api )
|
||||
add_subdirectory( resources )
|
||||
add_subdirectory( thirdparty )
|
||||
add_subdirectory( libs )
|
||||
@@ -1182,7 +1103,7 @@ add_subdirectory( bitmap2component )
|
||||
add_subdirectory( pcb_calculator )
|
||||
add_subdirectory( plugins ) # 3D plugins must be built before kicad
|
||||
add_subdirectory( cvpcb ) # must be after pcbnew
|
||||
add_subdirectory( kicad ) # should follow pcbnew, eeschema, api
|
||||
add_subdirectory( kicad ) # should follow pcbnew, eeschema
|
||||
add_subdirectory( tools )
|
||||
add_subdirectory( utils )
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"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": "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"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-debug",
|
||||
"displayName": "x64 Debug",
|
||||
"description": "Sets debug build type and x64 arch",
|
||||
"inherits": "win64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64-release",
|
||||
"displayName": "x64 Release",
|
||||
"description": "Sets release build type",
|
||||
"inherits": "win64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
# This program source code file is part of KiCad, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2023 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/>.
|
||||
|
||||
# Search paths for protoc when generating code
|
||||
set( Protobuf_IMPORT_DIRS ${Protobuf_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/proto )
|
||||
|
||||
set( KIAPI_PROTO_SRCS
|
||||
common/envelope.proto
|
||||
|
||||
common/types/base_types.proto
|
||||
common/types/enums.proto
|
||||
common/types/project_settings.proto
|
||||
|
||||
common/commands/base_commands.proto
|
||||
common/commands/editor_commands.proto
|
||||
common/commands/project_commands.proto
|
||||
|
||||
board/board.proto
|
||||
board/board_commands.proto
|
||||
board/board_types.proto
|
||||
|
||||
schematic/schematic_types.proto
|
||||
schematic/schematic_commands.proto
|
||||
)
|
||||
|
||||
# Generated C++ code must be in the build dir; it is dependent on the version of protoc installed
|
||||
set( KIAPI_CPP_BASEPATH ${CMAKE_CURRENT_BINARY_DIR}/cpp/api )
|
||||
|
||||
foreach( PROTO_SRC ${KIAPI_PROTO_SRCS} )
|
||||
string( REGEX REPLACE "\.proto$" ".pb.cc" CPP_SRC ${PROTO_SRC} )
|
||||
string( REGEX REPLACE "\.proto$" ".pb.h" CPP_HEADER ${PROTO_SRC} )
|
||||
set( KIAPI_CPP_SRCS ${KIAPI_CPP_SRCS} ${KIAPI_CPP_BASEPATH}/${CPP_SRC} )
|
||||
set( KIAPI_CPP_HEADERS ${KIAPI_CPP_HEADERS} ${KIAPI_CPP_BASEPATH}/${CPP_HEADER} )
|
||||
set( KIAPI_PROTO_SRC_FULLPATHS ${KIAPI_PROTO_SRC_FULLPATHS} ${CMAKE_CURRENT_SOURCE_DIR}/proto/${PROTO_SRC} )
|
||||
endforeach ()
|
||||
|
||||
add_custom_command( COMMAND ${CMAKE_COMMAND} -E make_directory ${KIAPI_CPP_BASEPATH}
|
||||
COMMAND ${Protobuf_PROTOC_EXECUTABLE}
|
||||
--cpp_out=dllexport_decl=KIAPI_IMPORTEXPORT:${KIAPI_CPP_BASEPATH}
|
||||
--proto_path=${CMAKE_CURRENT_SOURCE_DIR}/proto
|
||||
${KIAPI_PROTO_SRCS}
|
||||
COMMENT "Generating API protobuf source files from proto definitions..."
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${KIAPI_PROTO_SRC_FULLPATHS}
|
||||
OUTPUT ${KIAPI_CPP_SRCS} ${KIAPI_CPP_HEADERS}
|
||||
)
|
||||
|
||||
# kiapi must be a shared DLL because the protobuf messages can only be initialized once
|
||||
add_library( kiapi SHARED
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include/import_export.h
|
||||
${KIAPI_CPP_SRCS}
|
||||
${KIAPI_CPP_HEADERS}
|
||||
)
|
||||
|
||||
target_compile_definitions( kiapi PRIVATE KIAPI_IMPORTEXPORT=APIEXPORT )
|
||||
target_compile_definitions( kiapi INTERFACE KIAPI_IMPORTEXPORT=APIIMPORT )
|
||||
|
||||
# https://groups.google.com/g/protobuf/c/PDR1bqRazts
|
||||
if(MSVC)
|
||||
target_compile_options( kiapi PRIVATE /FI${CMAKE_CURRENT_SOURCE_DIR}/../include/import_export.h )
|
||||
else()
|
||||
add_definitions( -include ${CMAKE_CURRENT_SOURCE_DIR}/../include/import_export.h )
|
||||
endif()
|
||||
|
||||
if( APPLE )
|
||||
# puts library into the main kicad.app bundle in build tree
|
||||
set_target_properties( kiapi PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY "${OSX_BUNDLE_BUILD_LIB_DIR}"
|
||||
INSTALL_NAME_DIR "${OSX_BUNDLE_BUILD_LIB_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
install( TARGETS
|
||||
kiapi
|
||||
RUNTIME DESTINATION ${KICAD_LIB}
|
||||
LIBRARY DESTINATION ${KICAD_LIB}
|
||||
COMPONENT binary
|
||||
)
|
||||
|
||||
if( KICAD_WIN32_INSTALL_PDBS )
|
||||
# Get the PDBs to copy over for MSVC
|
||||
install(FILES $<TARGET_PDB_FILE:kiapi> DESTINATION ${KICAD_BIN})
|
||||
endif()
|
||||
|
||||
# Because CMake doesn't guess this from the .cc extension generated by protoc
|
||||
set_target_properties( kiapi PROPERTIES LINKER_LANGUAGE CXX )
|
||||
|
||||
include( ${KICAD_CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
||||
|
||||
# Extract the major and minor build version as a string
|
||||
string( REGEX MATCH
|
||||
"([0-9]+)\\.([0-9]+)\\.([0-9]+)"
|
||||
KICAD_MAJOR_MINOR_PATCH_VERSION
|
||||
"${KICAD_VERSION}"
|
||||
)
|
||||
|
||||
set_target_properties( kiapi PROPERTIES SOVERSION ${KICAD_MAJOR_MINOR_PATCH_VERSION} )
|
||||
|
||||
target_include_directories( kiapi SYSTEM PUBLIC ${Protobuf_INCLUDE_DIRS} )
|
||||
|
||||
target_link_libraries( kiapi protobuf::libprotobuf )
|
||||
|
||||
target_include_directories( kiapi INTERFACE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cpp # Leaving off the /api/ to make #include statments less ambiguous
|
||||
)
|
||||
|
||||
# Because when building internally, the generated files do not include the "api" base path
|
||||
target_include_directories( kiapi PUBLIC ${KIAPI_CPP_BASEPATH} )
|
||||
|
||||
if( APPLE )
|
||||
# puts library into the main kicad.app bundle in build tree
|
||||
set_target_properties( kiapi PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY "${OSX_BUNDLE_BUILD_LIB_DIR}"
|
||||
INSTALL_NAME_DIR "${OSX_BUNDLE_BUILD_LIB_DIR}"
|
||||
)
|
||||
set_target_properties( kiapi PROPERTIES INSTALL_RPATH
|
||||
"@executable_path/../Frameworks" )
|
||||
set_target_properties( kiapi PROPERTIES BUILD_WITH_INSTALL_RPATH 1 )
|
||||
endif()
|
||||
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.board;
|
||||
|
||||
import "common/types/base_types.proto";
|
||||
import "board/board_types.proto";
|
||||
|
||||
message BoardFinish
|
||||
{
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message BoardImpedanceControl
|
||||
{
|
||||
bool is_controlled = 1;
|
||||
}
|
||||
|
||||
message BoardEdgeConnector
|
||||
{
|
||||
}
|
||||
|
||||
message Castellation
|
||||
{
|
||||
bool has_castellated_pads = 1;
|
||||
}
|
||||
|
||||
message EdgePlating
|
||||
{
|
||||
bool has_edge_plating = 1;
|
||||
}
|
||||
|
||||
message BoardEdgeSettings
|
||||
{
|
||||
BoardEdgeConnector connector = 1;
|
||||
Castellation castellation = 2;
|
||||
EdgePlating plating = 3;
|
||||
}
|
||||
|
||||
message BoardStackupCopperLayer
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
message BoardStackupLayer
|
||||
{
|
||||
kiapi.common.types.Distance thickness = 1;
|
||||
kiapi.board.types.BoardLayer layer = 2;
|
||||
bool enabled = 3;
|
||||
oneof item {
|
||||
BoardStackupCopperLayer copper = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message BoardStackup
|
||||
{
|
||||
BoardFinish finish = 1;
|
||||
BoardImpedanceControl impedance = 2;
|
||||
// NOTE: m_HasThicknessConstrains appears to be unused
|
||||
BoardEdgeSettings edge = 3;
|
||||
repeated BoardStackupLayer layers = 4;
|
||||
}
|
||||
|
||||
// LAYER_CLASS_* in BOARD_DESIGN_SETTINGS -- needs to become an enum class
|
||||
enum BoardLayerClass
|
||||
{
|
||||
BLC_UNKNOWN = 0;
|
||||
BLC_SILKSCREEN = 1;
|
||||
BLC_COPPER = 2;
|
||||
BLC_EDGES = 3;
|
||||
BLC_COURTYARD = 4;
|
||||
BLC_FABRICATION = 5;
|
||||
BLC_OTHER = 6;
|
||||
}
|
||||
|
||||
message BoardLayerGraphicsDefaults
|
||||
{
|
||||
BoardLayerClass layer = 1;
|
||||
kiapi.common.types.TextAttributes text = 2;
|
||||
kiapi.common.types.Distance line_thickness = 3;
|
||||
}
|
||||
|
||||
message GraphicsDefaults
|
||||
{
|
||||
repeated BoardLayerGraphicsDefaults layers = 1;
|
||||
}
|
||||
|
||||
// Anything that isn't stackup or design rules
|
||||
message BoardSettings
|
||||
{
|
||||
GraphicsDefaults graphics_defaults = 1;
|
||||
// Dimension default settings
|
||||
}
|
||||
|
||||
message BoardDesignRules
|
||||
{
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.board.commands;
|
||||
|
||||
import "common/types/base_types.proto";
|
||||
import "common/types/enums.proto";
|
||||
import "board/board.proto";
|
||||
import "board/board_types.proto";
|
||||
|
||||
/*
|
||||
* Board stackup and properties
|
||||
*/
|
||||
|
||||
message GetBoardStackup
|
||||
{
|
||||
kiapi.common.types.DocumentSpecifier board = 1;
|
||||
}
|
||||
|
||||
message BoardStackupResponse
|
||||
{
|
||||
kiapi.board.BoardStackup stackup = 1;
|
||||
}
|
||||
|
||||
message UpdateBoardStackup
|
||||
{
|
||||
kiapi.common.types.DocumentSpecifier board = 1;
|
||||
kiapi.board.BoardStackup stackup = 2;
|
||||
}
|
||||
|
||||
message GetGraphicsDefaults
|
||||
{
|
||||
kiapi.common.types.DocumentSpecifier board = 1;
|
||||
}
|
||||
|
||||
message GraphicsDefaultsResponse
|
||||
{
|
||||
kiapi.board.GraphicsDefaults defaults = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Net management
|
||||
*/
|
||||
|
||||
message GetNets
|
||||
{
|
||||
kiapi.common.types.DocumentSpecifier board = 1;
|
||||
|
||||
// If provided, will only return nets that belong to the given netclass.
|
||||
// If more than one netclass_filter is given, nets belonging to any of the given classes will
|
||||
// be returned.
|
||||
repeated string netclass_filter = 2;
|
||||
}
|
||||
|
||||
message NetsResponse
|
||||
{
|
||||
repeated kiapi.board.types.Net nets = 1;
|
||||
}
|
||||
|
||||
// Retrieve all the copper items belonging to a certain net or set of nets
|
||||
// returns kiapi.common.commands.GetItemsResponse
|
||||
message GetItemsByNet
|
||||
{
|
||||
// Specifies which document to query, which fields to return, etc.
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
// List of one or more types of items to retreive
|
||||
repeated kiapi.common.types.KiCadObjectType types = 2;
|
||||
|
||||
// A list of net codes to filter items by
|
||||
repeated kiapi.board.types.NetCode net_codes = 3;
|
||||
}
|
||||
|
||||
// Retrieve all the copper items belonging to a certain net class or set of net classes
|
||||
// returns kiapi.common.commands.GetItemsResponse
|
||||
message GetItemsByNetClass
|
||||
{
|
||||
// Specifies which document to query, which fields to return, etc.
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
// List of one or more types of items to retreive
|
||||
repeated kiapi.common.types.KiCadObjectType types = 2;
|
||||
|
||||
// A list of net class names to filter items by
|
||||
repeated string net_classes = 3;
|
||||
}
|
||||
|
||||
/*
|
||||
* Blocking operations
|
||||
*/
|
||||
|
||||
// Refills some or all zones on the board.
|
||||
// This is a blocking operation; it will return Empty immediately, but KiCad will return
|
||||
// ApiStatusCode.AS_BUSY to all future API requests until the zone fill has completed.
|
||||
message RefillZones
|
||||
{
|
||||
kiapi.common.types.DocumentSpecifier board = 1;
|
||||
|
||||
// A list of zones to refill. If empty, all zones are refilled.
|
||||
repeated kiapi.common.types.KIID zones = 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Utilities
|
||||
*/
|
||||
|
||||
// returns kiapi.common.commands.BoundingBoxResponse
|
||||
message GetTextExtents
|
||||
{
|
||||
// A temporary text item to calculate the bounding box for
|
||||
kiapi.board.types.Text text = 1;
|
||||
}
|
||||
|
||||
//// Interactive commands ////
|
||||
// These commands begin an interactive operation in the editor.
|
||||
// They return a response immediately, but the editor will become busy
|
||||
// and will not reply to further API commands until the user has finished
|
||||
// the operation.
|
||||
// These commands will return an error if received in a non-interactive context.
|
||||
|
||||
// Selects and begins an interactive move of the given item(s).
|
||||
// NOTE: Takes ownership of the active commit, if one exists:
|
||||
// the move tool will push the commit when the user confirms the move,
|
||||
// or roll back the commit if the user cancels the move. Keep this in
|
||||
// mind if using this command in combination with commands that create
|
||||
// or modify items using an explicit commit.
|
||||
message InteractiveMoveItems
|
||||
{
|
||||
kiapi.common.types.DocumentSpecifier board = 1;
|
||||
|
||||
repeated kiapi.common.types.KIID items = 2;
|
||||
}
|
||||
@@ -1,515 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.board.types;
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
import "common/types/base_types.proto";
|
||||
|
||||
enum BoardLayer
|
||||
{
|
||||
BL_UNKNOWN = 0;
|
||||
BL_UNDEFINED = 1;
|
||||
BL_UNSELECTED = 2;
|
||||
BL_F_Cu = 3;
|
||||
BL_In1_Cu = 4;
|
||||
BL_In2_Cu = 5;
|
||||
BL_In3_Cu = 6;
|
||||
BL_In4_Cu = 7;
|
||||
BL_In5_Cu = 8;
|
||||
BL_In6_Cu = 9;
|
||||
BL_In7_Cu = 10;
|
||||
BL_In8_Cu = 11;
|
||||
BL_In9_Cu = 12;
|
||||
BL_In10_Cu = 13;
|
||||
BL_In11_Cu = 14;
|
||||
BL_In12_Cu = 15;
|
||||
BL_In13_Cu = 16;
|
||||
BL_In14_Cu = 17;
|
||||
BL_In15_Cu = 18;
|
||||
BL_In16_Cu = 19;
|
||||
BL_In17_Cu = 20;
|
||||
BL_In18_Cu = 21;
|
||||
BL_In19_Cu = 22;
|
||||
BL_In20_Cu = 23;
|
||||
BL_In21_Cu = 24;
|
||||
BL_In22_Cu = 25;
|
||||
BL_In23_Cu = 26;
|
||||
BL_In24_Cu = 27;
|
||||
BL_In25_Cu = 28;
|
||||
BL_In26_Cu = 29;
|
||||
BL_In27_Cu = 30;
|
||||
BL_In28_Cu = 31;
|
||||
BL_In29_Cu = 32;
|
||||
BL_In30_Cu = 33;
|
||||
BL_B_Cu = 34;
|
||||
BL_B_Adhes = 35;
|
||||
BL_F_Adhes = 36;
|
||||
BL_B_Paste = 37;
|
||||
BL_F_Paste = 38;
|
||||
BL_B_SilkS = 39;
|
||||
BL_F_SilkS = 40;
|
||||
BL_B_Mask = 41;
|
||||
BL_F_Mask = 42;
|
||||
BL_Dwgs_User = 43;
|
||||
BL_Cmts_User = 44;
|
||||
BL_Eco1_User = 45;
|
||||
BL_Eco2_User = 46;
|
||||
BL_Edge_Cuts = 47;
|
||||
BL_Margin = 48;
|
||||
BL_B_CrtYd = 49;
|
||||
BL_F_CrtYd = 50;
|
||||
BL_B_Fab = 51;
|
||||
BL_F_Fab = 52;
|
||||
BL_User_1 = 53;
|
||||
BL_User_2 = 54;
|
||||
BL_User_3 = 55;
|
||||
BL_User_4 = 56;
|
||||
BL_User_5 = 57;
|
||||
BL_User_6 = 58;
|
||||
BL_User_7 = 59;
|
||||
BL_User_8 = 60;
|
||||
BL_User_9 = 61;
|
||||
}
|
||||
|
||||
message NetCode
|
||||
{
|
||||
int32 value = 1;
|
||||
}
|
||||
|
||||
// Describes a copper item's net
|
||||
message Net
|
||||
{
|
||||
// A unique code representing this net
|
||||
NetCode code = 1;
|
||||
|
||||
// Human-readable net name
|
||||
string name = 2;
|
||||
}
|
||||
|
||||
// Represents a track segment on a board
|
||||
message Track
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.Vector2 start = 2;
|
||||
kiapi.common.types.Vector2 end = 3;
|
||||
kiapi.common.types.Distance width = 4;
|
||||
kiapi.common.types.LockedState locked = 5;
|
||||
BoardLayer layer = 6;
|
||||
Net net = 7;
|
||||
}
|
||||
|
||||
// Represents an arc track (not a PCB_SHAPE in arc shape)
|
||||
// Arc tracks in KiCad store start, midpoint, and end.
|
||||
// All other values (center point, angles, etc) are inferred.
|
||||
message Arc
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.Vector2 start = 2;
|
||||
kiapi.common.types.Vector2 mid = 3; // Arc midpoint
|
||||
kiapi.common.types.Vector2 end = 4;
|
||||
kiapi.common.types.Distance width = 5;
|
||||
kiapi.common.types.LockedState locked = 6;
|
||||
BoardLayer layer = 7;
|
||||
Net net = 8;
|
||||
}
|
||||
|
||||
// What copper layer shape mode the padstack uses
|
||||
enum PadStackType
|
||||
{
|
||||
PST_UNKNOWN = 0;
|
||||
|
||||
// The same shape is used on all copper layers
|
||||
PST_NORMAL = 1;
|
||||
|
||||
// The padstack uses up to three different shapes (F_Cu, inner layers, B_Cu)
|
||||
PST_TOP_INNER_BOTTOM = 2;
|
||||
|
||||
// The padstack's shape may differ on arbitrary copper layers
|
||||
PST_CUSTOM = 3;
|
||||
}
|
||||
|
||||
enum UnconnectedLayerRemoval
|
||||
{
|
||||
ULR_UNKNOWN = 0;
|
||||
|
||||
// Keep annular rings on all layers
|
||||
ULR_KEEP = 1;
|
||||
|
||||
// Remove annular rings on unconnected layers, including start and end layers.
|
||||
ULR_REMOVE = 2;
|
||||
|
||||
// Remove annular rings on unconnected layers, but preserve start and end layers even if unconnected.
|
||||
ULR_REMOVE_EXCEPT_START_AND_END = 3;
|
||||
}
|
||||
|
||||
// The shape of a pad on a given layer
|
||||
enum PadStackShape
|
||||
{
|
||||
PSS_UNKNOWN = 0;
|
||||
PSS_CIRCLE = 1;
|
||||
PSS_RECTANGLE = 2;
|
||||
PSS_OVAL = 3;
|
||||
PSS_TRAPEZOID = 4;
|
||||
PSS_ROUNDRECT = 5;
|
||||
PSS_CHAMFEREDRECT = 6;
|
||||
PSS_CUSTOM = 7;
|
||||
}
|
||||
|
||||
// Which corners are chamfered in a PSS_CHAMFEREDRECT
|
||||
message ChamferedRectCorners
|
||||
{
|
||||
bool top_left = 1;
|
||||
bool top_right = 2;
|
||||
bool bottom_left = 3;
|
||||
bool bottom_right = 4;
|
||||
}
|
||||
|
||||
// The defintion of a padstack on a single layer
|
||||
message PadStackLayer
|
||||
{
|
||||
// The board layers of this padstack entry
|
||||
repeated BoardLayer layers = 1;
|
||||
|
||||
// The shape of the pad on this layer
|
||||
PadStackShape shape = 2;
|
||||
|
||||
// The size (x and y) of the shape on this layer
|
||||
kiapi.common.types.Vector2 size = 3;
|
||||
|
||||
// How much to round the corners of the shape by, as a fraction of min(size.x, size.y)
|
||||
// Only used for PSS_ROUNDRECT or PSS_CHAMFEREDRECT
|
||||
double corner_rounding_ratio = 4;
|
||||
|
||||
// How much to round the corners of the shape by, as a fraction of min(size.x, size.y)
|
||||
// Only used for PSS_CHAMFEREDRECT
|
||||
double chamfer_ratio = 5;
|
||||
|
||||
ChamferedRectCorners chamfered_corners = 6;
|
||||
|
||||
repeated GraphicShape custom_shapes = 7;
|
||||
|
||||
// If shape == PSS_CUSTOM, defines the shape of the anchor (only PSS_CIRCLE and PSS_RECTANGLE supported at present)
|
||||
PadStackShape custom_anchor_shape = 8;
|
||||
}
|
||||
|
||||
// A pad stack definition for a multilayer pad or via.
|
||||
message PadStack
|
||||
{
|
||||
// What type of pad stack this represents.
|
||||
PadStackType type = 1;
|
||||
|
||||
// Lowest (closest to F_Cu) layer this stack exists on. Ignored if type == PST_THROUGH.
|
||||
BoardLayer start_layer = 2;
|
||||
|
||||
// Highest (closest to B_Cu) layer this stack exists on. Ignored if type == PST_THROUGH.
|
||||
BoardLayer end_layer = 3;
|
||||
|
||||
// How to treat pad shapes on unconnected layers.
|
||||
UnconnectedLayerRemoval unconnected_layer_removal = 4;
|
||||
|
||||
// The diameter, in x and y, of the pad's drilled hole, if this pad has a hole.
|
||||
// x and y will be the same value if the hole is round.
|
||||
kiapi.common.types.Vector2 drill_diameter = 5;
|
||||
|
||||
repeated PadStackLayer layers = 6;
|
||||
|
||||
// The overall rotation of this padstack (affects all layers)
|
||||
kiapi.common.types.Angle angle = 7;
|
||||
}
|
||||
|
||||
enum ViaType
|
||||
{
|
||||
VT_UNKNOWN = 0;
|
||||
|
||||
// Through vias always start on F_Cu and end on B_Cu
|
||||
VT_THROUGH = 1;
|
||||
|
||||
// Blind/buried vias can have arbitrary start and end layers
|
||||
VT_BLIND_BURIED = 2;
|
||||
|
||||
// Microvias, blind/buried vias, can have arbitrary start and end layers, but also have different
|
||||
// size defaults and design rules
|
||||
VT_MICRO = 3;
|
||||
}
|
||||
|
||||
// Represents a via
|
||||
message Via
|
||||
{
|
||||
// The unique identifier of the via
|
||||
kiapi.common.types.KIID id = 1;
|
||||
|
||||
// The location of the via's center point
|
||||
kiapi.common.types.Vector2 position = 2;
|
||||
|
||||
// The pad stack definition for this via.
|
||||
PadStack pad_stack = 3;
|
||||
|
||||
kiapi.common.types.LockedState locked = 4;
|
||||
|
||||
Net net = 5;
|
||||
|
||||
ViaType type = 6;
|
||||
}
|
||||
|
||||
message GraphicSegmentAttributes
|
||||
{
|
||||
kiapi.common.types.Vector2 start = 1;
|
||||
kiapi.common.types.Vector2 end = 2;
|
||||
}
|
||||
|
||||
message GraphicRectangleAttributes
|
||||
{
|
||||
kiapi.common.types.Vector2 top_left = 1;
|
||||
kiapi.common.types.Vector2 bottom_right = 2;
|
||||
}
|
||||
|
||||
message GraphicArcAttributes
|
||||
{
|
||||
kiapi.common.types.Vector2 start = 1;
|
||||
kiapi.common.types.Vector2 mid = 2;
|
||||
kiapi.common.types.Vector2 end = 3;
|
||||
}
|
||||
|
||||
message GraphicCircleAttributes
|
||||
{
|
||||
kiapi.common.types.Vector2 center = 1;
|
||||
|
||||
// A point on the radius of the circle. This is stored instead of just a radius so that the point
|
||||
// by which the user can adjust the circle radius is persisted.
|
||||
kiapi.common.types.Vector2 radius_point = 2;
|
||||
}
|
||||
|
||||
message GraphicBezierAttributes
|
||||
{
|
||||
kiapi.common.types.Vector2 start = 1;
|
||||
kiapi.common.types.Vector2 control1 = 2;
|
||||
kiapi.common.types.Vector2 control2 = 3;
|
||||
kiapi.common.types.Vector2 end = 4;
|
||||
}
|
||||
|
||||
message GraphicShape
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.LockedState locked = 2;
|
||||
BoardLayer layer = 3;
|
||||
Net net = 4;
|
||||
kiapi.common.types.GraphicAttributes attributes = 5;
|
||||
|
||||
oneof geometry {
|
||||
GraphicSegmentAttributes segment = 6;
|
||||
GraphicRectangleAttributes rectangle = 7;
|
||||
GraphicArcAttributes arc = 8;
|
||||
GraphicCircleAttributes circle = 9;
|
||||
kiapi.common.types.PolySet polygon = 10;
|
||||
GraphicBezierAttributes bezier = 11;
|
||||
}
|
||||
}
|
||||
|
||||
// A board-specific text object, existing on a board layer
|
||||
message Text
|
||||
{
|
||||
kiapi.common.types.Text text = 1;
|
||||
BoardLayer layer = 2;
|
||||
}
|
||||
|
||||
// A board-specific textbox, existing on a board layer
|
||||
message TextBox
|
||||
{
|
||||
kiapi.common.types.TextBox textbox = 1;
|
||||
BoardLayer layer = 2;
|
||||
}
|
||||
|
||||
// NOTE: There has been some discussion about what to do with pad attributes and properties.
|
||||
// This may be considered somewhat unstable until we decide what to do with the KiCad side.
|
||||
// It is not clear what the set of mutually-exclusive pad types will be at the end of the day,
|
||||
// versus what will be non-exclusive attributes/properties.
|
||||
// For now, this maps to PAD_ATTRIB in KiCad.
|
||||
enum PadType
|
||||
{
|
||||
PT_UNKNOWN = 0;
|
||||
PT_PTH = 1;
|
||||
PT_SMD = 2;
|
||||
PT_EDGE_CONNECTOR = 3;
|
||||
PT_NPTH = 4;
|
||||
}
|
||||
|
||||
enum CustomPadShapeZoneFillStrategy
|
||||
{
|
||||
CPSZ_UNKNOWN = 0;
|
||||
CPSZ_OUTLINE = 1;
|
||||
CPSZ_CONVEXHULL = 2;
|
||||
}
|
||||
|
||||
message ThermalSpokeSettings
|
||||
{
|
||||
int64 width = 1;
|
||||
kiapi.common.types.Angle angle = 2;
|
||||
int64 gap = 3;
|
||||
}
|
||||
|
||||
message Pad
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.LockedState locked = 2;
|
||||
string number = 3;
|
||||
Net net = 4;
|
||||
PadType type = 5;
|
||||
PadStack pad_stack = 6;
|
||||
|
||||
// A pad's position is always relative to the parent footprint's origin
|
||||
kiapi.common.types.Vector2 position = 7;
|
||||
|
||||
DesignRuleOverrides overrides = 8;
|
||||
|
||||
ThermalSpokeSettings thermal_spokes = 9;
|
||||
}
|
||||
|
||||
// Copper zone, non-copper zone, or rule area
|
||||
message Zone
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
message Dimension
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
message ReferenceImage
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
message Group
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
message FieldId
|
||||
{
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message Field
|
||||
{
|
||||
FieldId id = 1;
|
||||
string name = 2;
|
||||
Text text = 3;
|
||||
}
|
||||
|
||||
message Model3D
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
enum FootprintMountingStyle
|
||||
{
|
||||
FMS_UNKNOWN = 0;
|
||||
FMS_THROUGH_HOLE = 1;
|
||||
FMS_SMD = 2;
|
||||
FMS_UNSPECIFIED = 3;
|
||||
}
|
||||
|
||||
|
||||
message FootprintAttributes
|
||||
{
|
||||
string description = 1;
|
||||
string keywords = 2;
|
||||
bool not_in_schematic = 3;
|
||||
bool exclude_from_position_files = 4;
|
||||
bool exclude_from_bill_of_materials = 5;
|
||||
bool exempt_from_courtyard_requirement = 6;
|
||||
bool do_not_populate = 7;
|
||||
FootprintMountingStyle mounting_style = 8;
|
||||
}
|
||||
|
||||
// enum class ZONE_CONNECTION
|
||||
enum ZoneConnectionStyle
|
||||
{
|
||||
ZCS_UNKNOWN = 0;
|
||||
ZCS_INHERITED = 1;
|
||||
ZCS_NONE = 2;
|
||||
ZCS_THERMAL = 3;
|
||||
ZCS_FULL = 4;
|
||||
ZCS_PTH_THERMAL = 5; // Thermal reliefs for plated through holes, solid for SMD pads
|
||||
}
|
||||
|
||||
message DesignRuleOverrides
|
||||
{
|
||||
// Copper-to-copper clearance override
|
||||
kiapi.common.types.Distance clearance = 1;
|
||||
|
||||
// Solder mask expansion/contraction
|
||||
kiapi.common.types.Distance solder_mask_margin = 2;
|
||||
|
||||
// Solder paste expansion/contraction
|
||||
kiapi.common.types.Distance solder_paste_margin = 3;
|
||||
|
||||
// Solder paste expansion/contraction ratio
|
||||
kiapi.common.types.Ratio solder_paste_margin_ratio = 4;
|
||||
|
||||
ZoneConnectionStyle zone_connection = 5;
|
||||
}
|
||||
|
||||
message NetTieDefinition
|
||||
{
|
||||
repeated string pad_number = 1;
|
||||
}
|
||||
|
||||
// A footprint definition (i.e. what would be in a library)
|
||||
message Footprint
|
||||
{
|
||||
kiapi.common.types.LibraryIdentifier id = 1;
|
||||
kiapi.common.types.Vector2 anchor = 2;
|
||||
FootprintAttributes attributes = 3;
|
||||
DesignRuleOverrides overrides = 4;
|
||||
repeated NetTieDefinition net_ties = 5;
|
||||
repeated BoardLayer private_layers = 6;
|
||||
|
||||
Field reference_field = 7;
|
||||
Field value_field = 8;
|
||||
Field datasheet_field = 9;
|
||||
Field description_field = 10;
|
||||
|
||||
// All footprint items except for mandatory fields
|
||||
repeated google.protobuf.Any items = 11;
|
||||
}
|
||||
|
||||
// An instance of a footprint on a board
|
||||
message FootprintInstance
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.Vector2 position = 2;
|
||||
kiapi.common.types.Angle orientation = 3;
|
||||
BoardLayer layer = 4;
|
||||
kiapi.common.types.LockedState locked = 5;
|
||||
Footprint definition = 6;
|
||||
|
||||
Field reference_field = 7;
|
||||
Field value_field = 8;
|
||||
Field datasheet_field = 9;
|
||||
Field description_field = 10;
|
||||
|
||||
FootprintAttributes attributes = 11;
|
||||
DesignRuleOverrides overrides = 12;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.common.commands;
|
||||
|
||||
import "common/types/base_types.proto";
|
||||
|
||||
message GetVersion
|
||||
{
|
||||
}
|
||||
|
||||
message GetVersionResponse
|
||||
{
|
||||
kiapi.common.types.KiCadVersion version = 1;
|
||||
}
|
||||
|
||||
// A command to check if the connection to KiCad is OK
|
||||
message Ping
|
||||
{
|
||||
}
|
||||
@@ -1,299 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Commands and responses related to manipulating editor windows
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.common.commands;
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
import "common/types/base_types.proto";
|
||||
import "common/types/enums.proto";
|
||||
|
||||
// Refreshes the given frame, if that frame is open
|
||||
message RefreshEditor
|
||||
{
|
||||
kiapi.common.types.FrameType frame = 1;
|
||||
}
|
||||
|
||||
// Retrieves a list of open documents of the given type
|
||||
message GetOpenDocuments
|
||||
{
|
||||
// Which type of documents to query
|
||||
kiapi.common.types.DocumentType type = 1;
|
||||
}
|
||||
|
||||
message GetOpenDocumentsResponse
|
||||
{
|
||||
repeated kiapi.common.types.DocumentSpecifier documents = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Runs a TOOL_ACTION using the TOOL_MANAGER of a given frame.
|
||||
* WARNING: The TOOL_ACTIONs are specifically *not* an API.
|
||||
* Command names may change as code is refactored, and commands may disappear.
|
||||
* This API method is provided for low-level prototyping purposes only.
|
||||
*/
|
||||
message RunAction
|
||||
{
|
||||
string action = 1; // Action name, like "eeschema.InteractiveSelection.ClearSelection"
|
||||
}
|
||||
|
||||
enum RunActionStatus
|
||||
{
|
||||
RAS_UNKNOWN = 0;
|
||||
RAS_OK = 1; // The action was submitted successfully.
|
||||
RAS_INVALID = 2; // The action was unknown for the targeted frame.
|
||||
RAS_FRAME_NOT_OPEN = 3; // The targeted frame was not open when the call was submitted.
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: At the moment, RAS_FRAME_NOT_OPEN won't be returned as the handler is inside the frame.
|
||||
*/
|
||||
message RunActionResponse
|
||||
{
|
||||
RunActionStatus status = 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Begins a staged set of changes. Any modifications made to a document through the API after this
|
||||
* call will be saved to a pending commit, and will not appear in KiCad until a matching call to
|
||||
* END_COMMIT.
|
||||
*/
|
||||
message BeginCommit
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
message BeginCommitResponse
|
||||
{
|
||||
// Opaque identifier tracking a commit
|
||||
kiapi.common.types.KIID id = 1;
|
||||
}
|
||||
|
||||
|
||||
enum CommitAction
|
||||
{
|
||||
CMA_UNKNOWN = 0;
|
||||
CMA_COMMIT = 1; // Commit the changes to the design
|
||||
CMA_DROP = 2; // Cancel this commit
|
||||
}
|
||||
|
||||
|
||||
message EndCommit
|
||||
{
|
||||
// The ID that was given by BeginCommit
|
||||
kiapi.common.types.KIID id = 1;
|
||||
|
||||
// What to do with this commit
|
||||
CommitAction action = 2;
|
||||
|
||||
// Optional message describing this changeset
|
||||
string message = 3;
|
||||
}
|
||||
|
||||
|
||||
message EndCommitResponse
|
||||
{
|
||||
}
|
||||
|
||||
// Creates new items on a given document
|
||||
message CreateItems
|
||||
{
|
||||
// Specifies which document to create on, which fields are included, etc.
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
// List of items to create
|
||||
repeated google.protobuf.Any items = 2;
|
||||
|
||||
// Items may be created on a top-level document (sheet, board, etc) or inside a container
|
||||
// (symbol, footprint). If this field is not empty, it holds the ID of a symbol or footprint
|
||||
// that the items should be added to. This ID must be an existing symbol (for schematic
|
||||
// documents) or footprint (for board documents). If the given container does not exist or is
|
||||
// not the correct item type, the CreateItems call will fail.
|
||||
kiapi.common.types.KIID container = 3;
|
||||
}
|
||||
|
||||
enum ItemStatusCode
|
||||
{
|
||||
ISC_UNKNOWN = 0;
|
||||
ISC_OK = 1; // The item was created or updated
|
||||
ISC_INVALID_TYPE = 2; // The item's type is not valid for the given document
|
||||
ISC_EXISTING = 3; // The item to be created had a specified KIID and that KIID was already in use
|
||||
ISC_NONEXISTENT = 4; // The item to be updated did not exist in the given document
|
||||
ISC_IMMUTABLE = 5; // The item to be updated is not allowed to be modified by the API
|
||||
ISC_INVALID_DATA = 7; // The item to be created does not have valid data for the given document
|
||||
}
|
||||
|
||||
// Per-item status feedback for creation and update calls
|
||||
message ItemStatus
|
||||
{
|
||||
ItemStatusCode code = 1;
|
||||
|
||||
string error_message = 2;
|
||||
}
|
||||
|
||||
message ItemCreationResult
|
||||
{
|
||||
ItemStatus status = 1;
|
||||
|
||||
// The created version of the item, including an updated KIID as applicable
|
||||
google.protobuf.Any item = 2;
|
||||
}
|
||||
|
||||
message CreateItemsResponse
|
||||
{
|
||||
// Specifies which document was modified, which fields are included in created_items, etc.
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
// Status of the overall request; may return IRS_OK even if no items were created
|
||||
kiapi.common.types.ItemRequestStatus status = 2;
|
||||
|
||||
// Status of each item to be created
|
||||
repeated ItemCreationResult created_items = 3;
|
||||
}
|
||||
|
||||
message GetItems
|
||||
{
|
||||
// Specifies which document to query, which fields to return, etc.
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
// List of one or more types of items to retreive
|
||||
repeated kiapi.common.types.KiCadObjectType types = 2;
|
||||
}
|
||||
|
||||
message GetItemsResponse
|
||||
{
|
||||
// Specifies which document was modified, which fields are included in items, etc.
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
// Status of the overall request; may return IRS_OK even if no items were retrieved
|
||||
kiapi.common.types.ItemRequestStatus status = 2;
|
||||
|
||||
repeated google.protobuf.Any items = 3;
|
||||
}
|
||||
|
||||
// Updates items in a given document
|
||||
message UpdateItems
|
||||
{
|
||||
// Specifies which document to modify, which fields are included, etc.
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
// List of items to modify
|
||||
repeated google.protobuf.Any items = 2;
|
||||
}
|
||||
|
||||
|
||||
message ItemUpdateResult
|
||||
{
|
||||
ItemStatus status = 1;
|
||||
|
||||
// The update version of the item
|
||||
google.protobuf.Any item = 2;
|
||||
}
|
||||
|
||||
message UpdateItemsResponse
|
||||
{
|
||||
// Specifies which document was modified, which fields are included in updated_items, etc.
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
// Status of the overall request; may return IRS_OK even if no items were modified
|
||||
kiapi.common.types.ItemRequestStatus status = 2;
|
||||
|
||||
// Status of each item to be created
|
||||
repeated ItemUpdateResult updated_items = 3;
|
||||
}
|
||||
|
||||
// Deletes items in a given document
|
||||
message DeleteItems
|
||||
{
|
||||
// Specifies which document to modify
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
// List of item KIIDs to delete
|
||||
repeated kiapi.common.types.KIID item_ids = 2;
|
||||
}
|
||||
|
||||
enum ItemDeletionStatus
|
||||
{
|
||||
IDS_UNKNOWN = 0;
|
||||
IDS_OK = 1;
|
||||
IDS_NONEXISTENT = 2; // The item did not exist in the given document
|
||||
IDS_IMMUTABLE = 3; // The item is not allowed to be modified by the API
|
||||
}
|
||||
|
||||
message ItemDeletionResult
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
|
||||
ItemDeletionStatus status = 2;
|
||||
}
|
||||
|
||||
message DeleteItemsResponse
|
||||
{
|
||||
// Specifies which document was modified, etc.
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
// Status of the overall request; may return IRS_OK even if no items were deleted
|
||||
kiapi.common.types.ItemRequestStatus status = 2;
|
||||
|
||||
// Status of each item requested to be deleted
|
||||
repeated ItemDeletionResult deleted_items = 3;
|
||||
}
|
||||
|
||||
message GetItemBoundingBox
|
||||
{
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
kiapi.common.types.KIID id = 2;
|
||||
}
|
||||
|
||||
message BoundingBoxResponse
|
||||
{
|
||||
kiapi.common.types.Vector2 position = 1;
|
||||
kiapi.common.types.Vector2 size = 2;
|
||||
}
|
||||
|
||||
// Tests if a certain point falls within tolerance of an item's geometry
|
||||
message HitTest
|
||||
{
|
||||
kiapi.common.types.ItemHeader header = 1;
|
||||
|
||||
kiapi.common.types.KIID id = 2;
|
||||
|
||||
kiapi.common.types.Vector2 position = 3;
|
||||
|
||||
int32 tolerance = 4;
|
||||
}
|
||||
|
||||
enum HitTestResult
|
||||
{
|
||||
HTR_UNKNOWN = 0;
|
||||
HTR_NO_HIT = 1;
|
||||
HTR_HIT = 2;
|
||||
}
|
||||
|
||||
message HitTestResponse
|
||||
{
|
||||
HitTestResult result = 1;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.common.commands;
|
||||
|
||||
import "common/types/project_settings.proto";
|
||||
|
||||
|
||||
message GetNetClasses
|
||||
{
|
||||
}
|
||||
|
||||
message NetClassesResponse
|
||||
{
|
||||
repeated kiapi.common.project.NetClass net_classes = 1;
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.common;
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
|
||||
enum ApiStatusCode
|
||||
{
|
||||
AS_UNKNOWN = 0;
|
||||
AS_OK = 1; // Request succeeded
|
||||
AS_TIMEOUT = 2; // Request timed out
|
||||
AS_BAD_REQUEST = 3; // The request had invalid parameters or otherwise was illegal
|
||||
AS_NOT_READY = 4; // KiCad has recently started and cannot handle API requests yet
|
||||
AS_UNHANDLED = 5; // The request was not handled by KiCad
|
||||
AS_TOKEN_MISMATCH = 6; // The kicad_token in the request didn't match this KiCad's token
|
||||
AS_BUSY = 7; // KiCad is busy performing an operation and can't accept API commands
|
||||
AS_UNIMPLEMENTED = 8; // The requested API call has not yet been implemented
|
||||
}
|
||||
|
||||
/*
|
||||
* For future expansion: any header fields that should be sent with a request
|
||||
*/
|
||||
message ApiRequestHeader
|
||||
{
|
||||
// An opaque string identifying a running instance of KiCad. If this is set to a non-empty
|
||||
// string in an API request, KiCad will reject the request if the value doesn't match its own
|
||||
// token. This can be used to let API clients make sure they are still talking to the same
|
||||
// instance of KiCad if they are long-running.
|
||||
string kicad_token = 1;
|
||||
|
||||
// A string identifying an API client. Should be set by the client to a value that is unique
|
||||
// to a specific instance of a client, for example the package name of the client plus its
|
||||
// process ID or a random string, e.g. "com.github.me.my_awesome_plugin-73951". The main purpose
|
||||
// of this name is to identify the client in debug logs.
|
||||
string client_name = 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* The top-level envelope container for an API request (message from a client to the KiCad API server)
|
||||
*/
|
||||
message ApiRequest
|
||||
{
|
||||
ApiRequestHeader header = 1;
|
||||
|
||||
google.protobuf.Any message = 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* For future expansion: any header fields that should be sent with a response
|
||||
*/
|
||||
message ApiResponseHeader
|
||||
{
|
||||
/// An opaque string identifying a running instance of KiCad.
|
||||
string kicad_token = 1;
|
||||
}
|
||||
|
||||
message ApiResponse
|
||||
{
|
||||
ApiResponseHeader header = 1;
|
||||
|
||||
ApiResponseStatus status = 2;
|
||||
|
||||
google.protobuf.Any message = 3;
|
||||
}
|
||||
|
||||
message ApiResponseStatus
|
||||
{
|
||||
/// A code describing the category of error (or AS_OK if no error)
|
||||
ApiStatusCode status = 1;
|
||||
|
||||
/// A human-readable description of the error, if any
|
||||
string error_message = 2;
|
||||
}
|
||||
@@ -1,334 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* base_types.proto
|
||||
* Includes types used in many parts of the API
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.common.types;
|
||||
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "common/types/enums.proto";
|
||||
|
||||
enum CommandStatus
|
||||
{
|
||||
CS_UNKNOWN = 0;
|
||||
CS_OK = 1; // Command succeeded
|
||||
CS_FAILED = 2; // Command failed
|
||||
}
|
||||
|
||||
message CommandStatusResponse
|
||||
{
|
||||
CommandStatus status = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes a particular version of KiCad
|
||||
*/
|
||||
message KiCadVersion
|
||||
{
|
||||
uint32 major = 1;
|
||||
uint32 minor = 2;
|
||||
uint32 patch = 3;
|
||||
|
||||
// Full identifier string, potentially containing git hashes, packager-added info, etc.
|
||||
string full_version = 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some commands are specific to a KiCad window (frame). This list contains all addressable frames.
|
||||
*/
|
||||
enum FrameType
|
||||
{
|
||||
FT_UNKNOWN = 0;
|
||||
FT_PROJECT_MANAGER = 1;
|
||||
FT_SCHEMATIC_EDITOR = 2;
|
||||
FT_PCB_EDITOR = 3;
|
||||
FT_SPICE_SIMULATOR = 4;
|
||||
FT_SYMBOL_EDITOR = 5;
|
||||
FT_FOOTPRINT_EDITOR = 6;
|
||||
FT_DRAWING_SHEET_EDITOR = 7;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes a KIID, or UUID of an object in a KiCad editor model.
|
||||
*/
|
||||
message KIID
|
||||
{
|
||||
// The KIID's value in standard UUID format, stored as a string for easy portability
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier for the type of document being targeted by a request
|
||||
*/
|
||||
enum DocumentType
|
||||
{
|
||||
DOCTYPE_UNKNOWN = 0;
|
||||
DOCTYPE_SCHEMATIC = 1;
|
||||
DOCTYPE_SYMBOL = 2;
|
||||
DOCTYPE_PCB = 3;
|
||||
DOCTYPE_FOOTPRINT = 4;
|
||||
DOCTYPE_DRAWING_SHEET = 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes a KiCad LIB_ID; a unique identifier for a loaded symbol or footprint
|
||||
*/
|
||||
message LibraryIdentifier
|
||||
{
|
||||
// The library portion of the LIB_ID
|
||||
string library_nickname = 1;
|
||||
|
||||
// The symbol or footprint name
|
||||
string entry_name = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes a unique sheet in a schematic
|
||||
*/
|
||||
message SheetPath
|
||||
{
|
||||
// The canonical path to the sheet. The first KIID will be the root sheet, etc.
|
||||
repeated KIID path = 1;
|
||||
|
||||
// The path converted to a human readable form such as "/", "/child", or "/child/grandchild"
|
||||
string path_human_readable = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes a KiCad project
|
||||
*/
|
||||
message ProjectSpecifier
|
||||
{
|
||||
// The name of the project (without the kicad_pro extension)
|
||||
string name = 1;
|
||||
|
||||
// The path to the project directory
|
||||
string path = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes a document that will be the target of a request
|
||||
*/
|
||||
message DocumentSpecifier
|
||||
{
|
||||
DocumentType type = 1;
|
||||
|
||||
oneof identifier
|
||||
{
|
||||
// If type == DT_SYMBOL or DT_FOOTPRINT, identifies a certain library entry
|
||||
LibraryIdentifier lib_id = 2;
|
||||
|
||||
// If type == DT_SCHEMATIC, identifies a sheet with a given path
|
||||
SheetPath sheet_path = 3;
|
||||
|
||||
// If type == DT_PCB, identifies a PCB with a given filename, e.g. "board.kicad_pcb"
|
||||
string board_filename = 4;
|
||||
}
|
||||
|
||||
ProjectSpecifier project = 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* This header is included in requests and responses about item(s) in a document
|
||||
*/
|
||||
message ItemHeader
|
||||
{
|
||||
// Which document is this request targeting?
|
||||
DocumentSpecifier document = 1;
|
||||
|
||||
// Which container within the document is this request targeting?
|
||||
// If container is omitted or empty, the document is used as the container.
|
||||
KIID container = 2;
|
||||
|
||||
// Which fields on the item(s) are included with this request or response
|
||||
google.protobuf.FieldMask field_mask = 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Status of a request that included an ItemHeader
|
||||
*/
|
||||
enum ItemRequestStatus
|
||||
{
|
||||
IRS_UNKNOWN = 0;
|
||||
IRS_OK = 1;
|
||||
IRS_DOCUMENT_NOT_FOUND = 2; // The given document is not open in KiCad
|
||||
IRS_FIELD_MASK_INVALID = 3; // The given field_mask contains invalid specifiers
|
||||
}
|
||||
|
||||
// Describes a point or distance in 2D space. All coordinates are in nanometers.
|
||||
message Vector2
|
||||
{
|
||||
int64 x_nm = 1;
|
||||
int64 y_nm = 2;
|
||||
}
|
||||
|
||||
// Describes a point or distance in 3D space. All coordinates are in nanometers.
|
||||
message Vector3
|
||||
{
|
||||
int64 x_nm = 1;
|
||||
int64 y_nm = 2;
|
||||
int64 z_nm = 3;
|
||||
}
|
||||
|
||||
// Describes a quantity of distance (size, length, etc). All coordinates are in nanometers.
|
||||
message Distance
|
||||
{
|
||||
int64 value_nm = 1;
|
||||
}
|
||||
|
||||
// Corresponds to EDA_ANGLE, where the underlying storage is degrees
|
||||
message Angle
|
||||
{
|
||||
double value_degrees = 1;
|
||||
}
|
||||
|
||||
// Represents a value from 0.0 to 1.0
|
||||
message Ratio
|
||||
{
|
||||
double value = 1;
|
||||
}
|
||||
|
||||
// Corresponds to COLOR4D. Each color channel is a double from 0.0 to 1.0.
|
||||
message Color
|
||||
{
|
||||
double r = 1;
|
||||
double g = 2;
|
||||
double b = 3;
|
||||
double a = 4;
|
||||
}
|
||||
|
||||
// The formulation of arc that is used in KiCad core geometry code.
|
||||
// Start, midpoint (on the arc) and end are stored. Angle, center point, etc are calculated.
|
||||
message ArcStartMidEnd
|
||||
{
|
||||
Vector2 start = 1;
|
||||
Vector2 mid = 2;
|
||||
Vector2 end = 3;
|
||||
}
|
||||
|
||||
message PolyLineNode
|
||||
{
|
||||
oneof geometry {
|
||||
Vector2 point = 1;
|
||||
ArcStartMidEnd arc = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Corresponds to class SHAPE_LINE_CHAIN: A closed or open polyline that can include arcs.
|
||||
// For non-arc cases, each node is a point along the line. An implicit line segment exists
|
||||
// between the last and first node if closed is true. When arcs are present, the arc start and
|
||||
// end points are not duplicated by point nodes (meaning, for example, a rectangle with rounded
|
||||
// corners could be represented with four arc nodes and no point nodes).
|
||||
message PolyLine
|
||||
{
|
||||
repeated PolyLineNode nodes = 1;
|
||||
bool closed = 2;
|
||||
}
|
||||
|
||||
message PolygonWithHoles
|
||||
{
|
||||
PolyLine outline = 1;
|
||||
repeated PolyLine holes = 2;
|
||||
}
|
||||
|
||||
// Corresponds to SHAPE_POLY_SET: a set of polygons or polylines
|
||||
message PolySet
|
||||
{
|
||||
repeated PolygonWithHoles polygons = 1;
|
||||
}
|
||||
|
||||
// Describes whether or not an item is locked for editing or movement
|
||||
enum LockedState
|
||||
{
|
||||
LS_UNKNOWN = 0;
|
||||
LS_UNLOCKED = 1;
|
||||
LS_LOCKED = 2;
|
||||
}
|
||||
|
||||
message TextAttributes
|
||||
{
|
||||
string font_name = 1;
|
||||
HorizontalAlignment horizontal_alignment = 2;
|
||||
VerticalAlignment vertical_alignment = 3;
|
||||
kiapi.common.types.Angle angle = 4;
|
||||
double line_spacing = 5;
|
||||
kiapi.common.types.Distance stroke_width = 6;
|
||||
bool italic = 7;
|
||||
bool bold = 8;
|
||||
bool underlined = 9;
|
||||
bool visible = 10;
|
||||
bool mirrored = 11;
|
||||
bool multiline = 12;
|
||||
bool keep_upright = 13;
|
||||
kiapi.common.types.Vector2 size = 14;
|
||||
}
|
||||
|
||||
message Text
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.Vector2 position = 2;
|
||||
kiapi.common.types.TextAttributes attributes = 3;
|
||||
kiapi.common.types.LockedState locked = 4;
|
||||
string text = 5;
|
||||
string hyperlink = 6;
|
||||
bool knockout = 7;
|
||||
}
|
||||
|
||||
message TextBox
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.Vector2 top_left = 2;
|
||||
kiapi.common.types.Vector2 bottom_right = 3;
|
||||
kiapi.common.types.TextAttributes attributes = 4;
|
||||
kiapi.common.types.LockedState locked = 5;
|
||||
string text = 6;
|
||||
}
|
||||
|
||||
message StrokeAttributes
|
||||
{
|
||||
Distance width = 1;
|
||||
StrokeLineStyle style = 2;
|
||||
Color color = 3;
|
||||
}
|
||||
|
||||
enum GraphicFillType
|
||||
{
|
||||
GFT_UNKNOWN = 0;
|
||||
GFT_UNFILLED = 1;
|
||||
GFT_FILLED = 2;
|
||||
}
|
||||
|
||||
message GraphicFillAttributes
|
||||
{
|
||||
GraphicFillType fill_type = 1;
|
||||
|
||||
// Color of the fill (not used in board and footprints)
|
||||
Color color = 2;
|
||||
}
|
||||
|
||||
message GraphicAttributes
|
||||
{
|
||||
StrokeAttributes stroke = 1;
|
||||
GraphicFillAttributes fill = 2;
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* enums.proto
|
||||
* Includes protobuf versions of common KiCad enums
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.common.types;
|
||||
|
||||
// The set of object types (from KICAD_T) that are exposed to the API.
|
||||
enum KiCadObjectType
|
||||
{
|
||||
KOT_UNKNOWN = 0;
|
||||
|
||||
KOT_PCB_FOOTPRINT = 1;
|
||||
KOT_PCB_PAD = 2;
|
||||
KOT_PCB_SHAPE = 3;
|
||||
KOT_PCB_REFERENCE_IMAGE = 4;
|
||||
KOT_PCB_FIELD = 5;
|
||||
KOT_PCB_GENERATOR = 6;
|
||||
KOT_PCB_TEXT = 7;
|
||||
KOT_PCB_TEXTBOX = 8;
|
||||
KOT_PCB_TABLE = 9;
|
||||
KOT_PCB_TABLECELL = 10;
|
||||
KOT_PCB_TRACE = 11;
|
||||
KOT_PCB_VIA = 12;
|
||||
KOT_PCB_ARC = 13;
|
||||
KOT_PCB_MARKER = 14;
|
||||
KOT_PCB_DIMENSION = 15;
|
||||
KOT_PCB_ZONE = 16;
|
||||
KOT_PCB_GROUP = 17;
|
||||
|
||||
KOT_SCH_MARKER = 18;
|
||||
KOT_SCH_JUNCTION = 19;
|
||||
KOT_SCH_NO_CONNECT = 20;
|
||||
KOT_SCH_BUS_WIRE_ENTRY = 21;
|
||||
KOT_SCH_BUS_BUS_ENTRY = 22;
|
||||
KOT_SCH_LINE = 23;
|
||||
KOT_SCH_SHAPE = 24;
|
||||
KOT_SCH_BITMAP = 25;
|
||||
KOT_SCH_TEXTBOX = 26;
|
||||
KOT_SCH_TEXT = 27;
|
||||
KOT_SCH_TABLE = 28;
|
||||
KOT_SCH_TABLECELL = 29;
|
||||
KOT_SCH_LABEL = 30;
|
||||
KOT_SCH_GLOBAL_LABEL = 31;
|
||||
KOT_SCH_HIER_LABEL = 32;
|
||||
KOT_SCH_DIRECTIVE_LABEL = 33;
|
||||
KOT_SCH_FIELD = 34;
|
||||
KOT_SCH_SYMBOL = 35;
|
||||
KOT_SCH_SHEET_PIN = 36;
|
||||
KOT_SCH_SHEET = 37;
|
||||
KOT_SCH_PIN = 38;
|
||||
|
||||
KOT_LIB_SYMBOL = 39;
|
||||
// KOT_LIB_SHAPE = 40;
|
||||
// KOT_LIB_TEXT = 41;
|
||||
// KOT_LIB_TEXTBOX = 42;
|
||||
// KOT_LIB_PIN = 43;
|
||||
// KOT_LIB_FIELD = 44;
|
||||
|
||||
KOT_WSG_LINE = 45;
|
||||
KOT_WSG_RECT = 46;
|
||||
KOT_WSG_POLY = 47;
|
||||
KOT_WSG_TEXT = 48;
|
||||
KOT_WSG_BITMAP = 49;
|
||||
KOT_WSG_PAGE = 50;
|
||||
}
|
||||
|
||||
// Mapped to GR_TEXT_H_ALIGN_T
|
||||
enum HorizontalAlignment
|
||||
{
|
||||
HA_UNKNOWN = 0;
|
||||
HA_LEFT = 1;
|
||||
HA_CENTER = 2;
|
||||
HA_RIGHT = 3;
|
||||
HA_INDETERMINATE = 4;
|
||||
}
|
||||
|
||||
// Mapped to GR_TEXT_V_ALIGN_T
|
||||
enum VerticalAlignment
|
||||
{
|
||||
VA_UNKNOWN = 0;
|
||||
VA_TOP = 1;
|
||||
VA_CENTER = 2;
|
||||
VA_BOTTOM = 3;
|
||||
VA_INDETERMINATE = 4;
|
||||
}
|
||||
|
||||
// Mapped to LINE_STYLE
|
||||
enum StrokeLineStyle
|
||||
{
|
||||
SLS_UNKNOWN = 0;
|
||||
SLS_DEFAULT = 1;
|
||||
SLS_SOLID = 2;
|
||||
SLS_DASH = 3;
|
||||
SLS_DOT = 4;
|
||||
SLS_DASHDOT = 5;
|
||||
SLS_DASHDOTDOT = 6;
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* project_settings.proto
|
||||
* Messages that describes project settings shared between schematics and boards
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.common.project;
|
||||
|
||||
|
||||
message NetClass
|
||||
{
|
||||
// The name of the netclass (the literal string "Default" for the default netclass)
|
||||
string name = 1;
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.schematic.types;
|
||||
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package kiapi.schematic.types;
|
||||
|
||||
import "common/types/base_types.proto";
|
||||
|
||||
enum SchematicLayer
|
||||
{
|
||||
SL_UNKNOWN = 0;
|
||||
}
|
||||
|
||||
/// Represents a schematic line segment, which may be a wire, bus, or graphical line
|
||||
message Line
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.Vector2 start = 2;
|
||||
kiapi.common.types.Vector2 end = 3;
|
||||
|
||||
/**
|
||||
* One of: LAYER_BUS, LAYER_WIRE, LAYER_NOTES
|
||||
*/
|
||||
SchematicLayer layer = 4;
|
||||
}
|
||||
|
||||
message Text
|
||||
{
|
||||
kiapi.common.types.Text text = 1;
|
||||
}
|
||||
|
||||
message LocalLabel
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.Vector2 position = 2;
|
||||
Text text = 3;
|
||||
}
|
||||
|
||||
message GlobalLabel
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.Vector2 position = 2;
|
||||
Text text = 3;
|
||||
}
|
||||
|
||||
message HierarchicalLabel
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.Vector2 position = 2;
|
||||
Text text = 3;
|
||||
}
|
||||
|
||||
message DirectiveLabel
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
kiapi.common.types.Vector2 position = 2;
|
||||
Text text = 3;
|
||||
}
|
||||
@@ -52,7 +52,6 @@ add_executable( bitmap2component WIN32 MACOSX_BUNDLE
|
||||
|
||||
target_link_libraries( bitmap2component
|
||||
common
|
||||
kicommon
|
||||
${wxWidgets_LIBRARIES}
|
||||
potrace
|
||||
)
|
||||
|
||||
@@ -138,7 +138,7 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( BITMAP2CMP_FRAME, KIWAY_PLAYER )
|
||||
BEGIN_EVENT_TABLE( BITMAP2CMP_FRAME, EDA_BASE_FRAME )
|
||||
EVT_MENU( wxID_CLOSE, BITMAP2CMP_FRAME::OnExit )
|
||||
EVT_MENU( wxID_EXIT, BITMAP2CMP_FRAME::OnExit )
|
||||
|
||||
@@ -193,7 +193,6 @@ BITMAP2CMP_FRAME::BITMAP2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
m_toolManager->InitTools();
|
||||
|
||||
ReCreateMenuBar();
|
||||
setupUIConditions();
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
|
||||
@@ -69,6 +69,8 @@ static struct IFACE : public KIFACE_BASE
|
||||
|
||||
using namespace BMP2CMP;
|
||||
|
||||
static PGM_BASE* process;
|
||||
|
||||
|
||||
KIFACE_BASE& Kiface()
|
||||
{
|
||||
@@ -80,10 +82,27 @@ KIFACE_BASE& Kiface()
|
||||
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
|
||||
KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
|
||||
{
|
||||
process = (PGM_BASE*) aProgram;
|
||||
return &kiface;
|
||||
}
|
||||
|
||||
|
||||
#if defined(BUILD_KIWAY_DLLS)
|
||||
PGM_BASE& Pgm()
|
||||
{
|
||||
wxASSERT( process ); // KIFACE_GETTER has already been called.
|
||||
return *process;
|
||||
}
|
||||
|
||||
|
||||
// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from a python script.
|
||||
PGM_BASE* PgmOrNull()
|
||||
{
|
||||
return process;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway )
|
||||
{
|
||||
return start_common( aCtlBits );
|
||||
|
||||
@@ -36,9 +36,7 @@ endfunction()
|
||||
get_kicad_doc_version(KICAD_DOC_VERSION)
|
||||
|
||||
# copy and modify the "normal" Doxyfile
|
||||
cmake_path(GET DOCSET_DOXYFILE PARENT_PATH OUTPUT_DIR)
|
||||
file(MAKE_DIRECTORY ${OUTPUT_DIR})
|
||||
file(COPY_FILE ${SRC_DOXYFILE} ${DOCSET_DOXYFILE})
|
||||
file(COPY ${SRC_DOXYFILE} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(APPEND ${DOCSET_DOXYFILE} "
|
||||
|
||||
# Added for DocSet generation
|
||||
|
||||
@@ -53,9 +53,6 @@ if( MSVC )
|
||||
# This is a workaround borrowed from https://github.com/dotnet/runtime/blob/main/eng/native/configurecompiler.cmake
|
||||
# CMake currently cannot handle the fact that "armasm" is used in combination with standard MSVC "cl" for ARM targets
|
||||
# So this is basically a hack (incombination with the MSVCAssemblyHelper.cmake) to make this all work
|
||||
|
||||
# This workaround can be removed when https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9326 is finally part of a
|
||||
# cmake release AND when MSVC ships said cmake release
|
||||
if(KICAD_BUILD_ARCH_ARM)
|
||||
message( "Configuring ARM assembler" )
|
||||
# Explicitly specify the assembler to be used for Arm32 compile
|
||||
|
||||
@@ -86,7 +86,6 @@ set( OCC_LIBS_POST_78
|
||||
TKDEGLTF
|
||||
TKDESTEP
|
||||
TKDESTL
|
||||
TKDEVRML
|
||||
)
|
||||
|
||||
set(OCC_TYPE "OpenCASCADE Standard Edition")
|
||||
|
||||
@@ -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.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.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.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.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]+.*)?$")
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
find_package(PkgConfig)
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_NNG nng)
|
||||
endif (PKG_CONFIG_FOUND)
|
||||
|
||||
FIND_PATH(NNG_INCLUDE_DIR
|
||||
NAMES
|
||||
nng/nng.h
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(NNG_LIBRARY
|
||||
NAMES
|
||||
nng
|
||||
PATH_SUFFIXES
|
||||
"lib"
|
||||
"local/lib"
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(nng
|
||||
REQUIRED_VARS NNG_INCLUDE_DIR NNG_LIBRARY)
|
||||
|
||||
MARK_AS_ADVANCED(NNG_INCLUDE_DIR NNG_LIBRARY)
|
||||
@@ -523,8 +523,6 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
|
||||
if(BUILD_SHARED_LIBS)
|
||||
find_path(wxWidgets_LIB_DIR
|
||||
NAMES
|
||||
qtu/wx/setup.h
|
||||
qtud/wx/setup.h
|
||||
msw/wx/setup.h
|
||||
mswd/wx/setup.h
|
||||
mswu/wx/setup.h
|
||||
@@ -542,8 +540,6 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
|
||||
else()
|
||||
find_path(wxWidgets_LIB_DIR
|
||||
NAMES
|
||||
qtu/wx/setup.h
|
||||
qtud/wx/setup.h
|
||||
msw/wx/setup.h
|
||||
mswd/wx/setup.h
|
||||
mswu/wx/setup.h
|
||||
@@ -575,7 +571,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
|
||||
endif()
|
||||
|
||||
# Search for available configuration types.
|
||||
foreach(CFG mswunivud mswunivd mswud mswd mswunivu mswuniv mswu msw qt qtd qtu qtud)
|
||||
foreach(CFG mswunivud mswunivd mswud mswd mswunivu mswuniv mswu msw)
|
||||
set(WX_${CFG}_FOUND FALSE)
|
||||
if(EXISTS ${WX_LIB_DIR}/${CFG})
|
||||
list(APPEND WX_CONFIGURATION_LIST ${CFG})
|
||||
|
||||
@@ -62,7 +62,7 @@ if( KICAD_TEST_XML_OUTPUT )
|
||||
# Due to Boost issue in 1.62, have to use the --logger parameter, rather than
|
||||
# separate --log_format, --log_sink, etc parameter
|
||||
# https://svn.boost.org/trac10/ticket/12507
|
||||
set(BOOST_TEST_PARAMS --logger=JUNIT,warning,${TEST_NAME}.boost-results.xml:HRF,message)
|
||||
set(BOOST_TEST_PARAMS --logger=JUNIT,warning,${TEST_NAME}.boost-results.xml:HRF,warning)
|
||||
endif()
|
||||
|
||||
# Add the test to the CTest registry
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2016 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
# Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
# Copyright (C) 2016-2024 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
|
||||
@@ -37,7 +37,7 @@
|
||||
# KiCad.
|
||||
#
|
||||
# Note: This version string should follow the semantic versioning system
|
||||
set( KICAD_SEMANTIC_VERSION "8.99.0-unknown" )
|
||||
set( KICAD_SEMANTIC_VERSION "8.0.2" )
|
||||
|
||||
# Default the version to the semantic version.
|
||||
# This is overridden by the git repository tag though (if using git)
|
||||
|
||||
@@ -272,6 +272,4 @@ if( MSVC )
|
||||
string( APPEND WARN_FLAGS_CXX " /wd4668" )
|
||||
# disable "definition of implicit copy constructor for 'X' is deprecated because it has a user-provided destructor"
|
||||
string( APPEND WARN_FLAGS_CXX " /wd5267" )
|
||||
# disable "reinterpret_cast used between related classes"
|
||||
string( APPEND WARN_FLAGS_CXX " /wd4946" )
|
||||
endif()
|
||||
|
||||
+71
-120
@@ -41,11 +41,24 @@ add_custom_target(
|
||||
-DSRC_PATH=${PROJECT_SOURCE_DIR}
|
||||
-DKICAD_CMAKE_MODULE_PATH=${KICAD_CMAKE_MODULE_PATH}
|
||||
-P ${KICAD_CMAKE_MODULE_PATH}/BuildSteps/WriteVersionHeader.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} BYPRODUCTS ${CMAKE_BINARY_DIR}/kicad_build_version.h
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
BYPRODUCTS ${CMAKE_BINARY_DIR}/kicad_build_version.h
|
||||
DEPENDS ${KICAD_CMAKE_MODULE_PATH}/BuildSteps/WriteVersionHeader.cmake
|
||||
COMMENT "Generating version string header"
|
||||
)
|
||||
|
||||
# A shared library subsetted from common which restricts what can go into
|
||||
# a single_top link image. By not linking to common, we control what does
|
||||
# statically go into single_top link images. My current thinking is that only
|
||||
# wxWidgets should be a shared link from single top, everything else should be
|
||||
# statically bound into it. Otherwise you will have DSO loading probs. After it
|
||||
# sets the LIB PATHS however, we want the *.kiface modules to use shared linking.
|
||||
add_library( singletop STATIC EXCLUDE_FROM_ALL
|
||||
eda_doc.cpp
|
||||
kiway.cpp
|
||||
kiway_holder.cpp )
|
||||
|
||||
|
||||
# A shared library used by multiple *.kiface files and one or two program
|
||||
# launchers. Object files can migrate into here over time, but only if they are
|
||||
# surely needed and certainly used from more than one place without recompilation.
|
||||
@@ -75,7 +88,6 @@ set( KICOMMON_SRCS
|
||||
jobs/job_export_sch_pythonbom.cpp
|
||||
jobs/job_fp_export_svg.cpp
|
||||
jobs/job_fp_upgrade.cpp
|
||||
jobs/job_pcb_render.cpp
|
||||
jobs/job_pcb_drc.cpp
|
||||
jobs/job_sch_erc.cpp
|
||||
jobs/job_sym_export_svg.cpp
|
||||
@@ -84,111 +96,45 @@ set( KICOMMON_SRCS
|
||||
kicad_curl/kicad_curl.cpp
|
||||
kicad_curl/kicad_curl_easy.cpp
|
||||
|
||||
settings/app_settings.cpp
|
||||
settings/aui_settings.cpp
|
||||
settings/bom_settings.cpp
|
||||
settings/color_settings.cpp
|
||||
settings/common_settings.cpp
|
||||
settings/grid_settings.cpp
|
||||
settings/json_settings.cpp
|
||||
settings/kicad_settings.cpp
|
||||
settings/nested_settings.cpp
|
||||
settings/parameters.cpp
|
||||
settings/settings_manager.cpp
|
||||
|
||||
project/board_project_settings.cpp
|
||||
project/net_settings.cpp
|
||||
project/project_archiver.cpp
|
||||
project/project_file.cpp
|
||||
project/project_local_settings.cpp
|
||||
|
||||
dialogs/dialog_migrate_settings.cpp
|
||||
dialogs/dialog_migrate_settings_base.cpp
|
||||
|
||||
widgets/bitmap_button.cpp
|
||||
widgets/kistatusbar.cpp
|
||||
widgets/progress_reporter_base.cpp
|
||||
widgets/std_bitmap_button.cpp
|
||||
widgets/ui_common.cpp
|
||||
|
||||
database/database_lib_settings.cpp
|
||||
|
||||
advanced_config.cpp
|
||||
asset_archive.cpp
|
||||
array_axis.cpp
|
||||
array_options.cpp
|
||||
background_jobs_monitor.cpp
|
||||
bitmap.cpp
|
||||
bitmap_info.cpp
|
||||
bitmap_store.cpp
|
||||
build_version.cpp
|
||||
common.cpp
|
||||
config_params.cpp
|
||||
confirm.cpp
|
||||
dialog_shim.cpp
|
||||
dsnlexer.cpp
|
||||
eda_pattern_match.cpp
|
||||
eda_units.cpp
|
||||
env_vars.cpp
|
||||
exceptions.cpp
|
||||
gestfich.cpp
|
||||
json_conversions.cpp
|
||||
kidialog.cpp
|
||||
kiid.cpp
|
||||
kiway.cpp
|
||||
kiway_express.cpp
|
||||
kiway_holder.cpp
|
||||
launch_ext.cpp
|
||||
lib_table_base.cpp
|
||||
layer_id.cpp
|
||||
lib_id.cpp
|
||||
locale_io.cpp
|
||||
lset.cpp
|
||||
markup_parser.cpp
|
||||
netclass.cpp
|
||||
notifications_manager.cpp
|
||||
page_info.cpp
|
||||
paths.cpp
|
||||
project.cpp
|
||||
richio.cpp
|
||||
search_stack.cpp
|
||||
searchhelpfilefullpath.cpp
|
||||
string_utils.cpp
|
||||
systemdirsappend.cpp
|
||||
ui_events.cpp
|
||||
trace_helpers.cpp
|
||||
wildcards_and_files_ext.cpp
|
||||
wx_filename.cpp
|
||||
|
||||
pgm_base.cpp
|
||||
|
||||
../scripting/python_scripting.cpp
|
||||
|
||||
io/kicad/kicad_io_utils.cpp # needed by richio
|
||||
)
|
||||
|
||||
if( KICAD_IPC_API )
|
||||
set( KICOMMON_SRCS
|
||||
${KICOMMON_SRCS}
|
||||
api/api_handler.cpp
|
||||
api/api_handler_common.cpp
|
||||
api/api_plugin.cpp
|
||||
api/api_plugin_manager.cpp
|
||||
api/api_server.cpp
|
||||
|
||||
../scripting/python_manager.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library( kicommon SHARED
|
||||
${KICOMMON_SRCS}
|
||||
)
|
||||
|
||||
set_target_properties(kicommon PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
target_link_libraries( kicommon
|
||||
core
|
||||
kiapi
|
||||
kimath
|
||||
kiplatform
|
||||
nlohmann_json
|
||||
@@ -204,25 +150,8 @@ target_link_libraries( kicommon
|
||||
${FREETYPE_LIBRARIES}
|
||||
${HarfBuzz_LIBRARIES}
|
||||
${Fontconfig_LIBRARIES}
|
||||
|
||||
# needed because of python_scripting.cpp
|
||||
${PYTHON_LIBRARIES}
|
||||
)
|
||||
|
||||
|
||||
if( KICAD_USE_SENTRY )
|
||||
target_link_libraries( kicommon
|
||||
sentry )
|
||||
|
||||
set_property(SOURCE pgm_base.cpp APPEND PROPERTY COMPILE_DEFINITIONS KICAD_SENTRY_DSN="${KICAD_SENTRY_DSN}")
|
||||
endif()
|
||||
|
||||
if( KICAD_IPC_API )
|
||||
target_link_libraries( kicommon
|
||||
kinng
|
||||
)
|
||||
endif()
|
||||
|
||||
include( ${KICAD_CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
||||
include( ${KICAD_CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
||||
create_git_version_header(${CMAKE_SOURCE_DIR})
|
||||
@@ -262,10 +191,7 @@ target_include_directories( kicommon
|
||||
PUBLIC
|
||||
.
|
||||
${CMAKE_BINARY_DIR}
|
||||
$<TARGET_PROPERTY:magic_enum,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:pegtl,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:expected,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:kiapi,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
add_dependencies( kicommon pegtl version_header )
|
||||
@@ -313,6 +239,8 @@ set( COMMON_DLG_SRCS
|
||||
dialogs/dialog_import_choose_project_base.cpp
|
||||
dialogs/dialog_locked_items_query.cpp
|
||||
dialogs/dialog_locked_items_query_base.cpp
|
||||
dialogs/dialog_migrate_settings.cpp
|
||||
dialogs/dialog_migrate_settings_base.cpp
|
||||
dialogs/dialog_page_settings_base.cpp
|
||||
dialogs/dialog_paste_special.cpp
|
||||
dialogs/dialog_paste_special_base.cpp
|
||||
@@ -347,8 +275,6 @@ set( COMMON_DLG_SRCS
|
||||
dialogs/panel_mouse_settings_base.cpp
|
||||
dialogs/panel_packages_and_updates.cpp
|
||||
dialogs/panel_packages_and_updates_base.cpp
|
||||
dialogs/panel_plugin_settings.cpp
|
||||
dialogs/panel_plugin_settings_base.cpp
|
||||
dialogs/panel_setup_netclasses.cpp
|
||||
dialogs/panel_setup_netclasses_base.cpp
|
||||
dialogs/panel_setup_severities.cpp
|
||||
@@ -364,6 +290,7 @@ endif()
|
||||
|
||||
set( COMMON_WIDGET_SRCS
|
||||
widgets/app_progress_dialog.cpp
|
||||
widgets/bitmap_button.cpp
|
||||
widgets/bitmap_toggle.cpp
|
||||
widgets/button_row_panel.cpp
|
||||
widgets/color_swatch.cpp
|
||||
@@ -384,6 +311,7 @@ set( COMMON_WIDGET_SRCS
|
||||
widgets/html_window.cpp
|
||||
widgets/indicator_icon.cpp
|
||||
widgets/wx_infobar.cpp
|
||||
widgets/kistatusbar.cpp
|
||||
widgets/layer_box_selector.cpp
|
||||
widgets/lib_tree.cpp
|
||||
widgets/mathplot.cpp
|
||||
@@ -397,6 +325,7 @@ set( COMMON_WIDGET_SRCS
|
||||
widgets/split_button.cpp
|
||||
widgets/stepped_slider.cpp
|
||||
widgets/text_ctrl_eval.cpp
|
||||
widgets/ui_common.cpp
|
||||
widgets/unit_binder.cpp
|
||||
widgets/widget_save_restore.cpp
|
||||
widgets/widget_hotkey_list.cpp
|
||||
@@ -515,12 +444,17 @@ set( COMMON_SRCS
|
||||
${COMMON_IMPORT_GFX_SRCS}
|
||||
${COMMON_GIT_SRCS}
|
||||
jobs/job_dispatcher.cpp
|
||||
background_jobs_monitor.cpp
|
||||
base_screen.cpp
|
||||
bin_mod.cpp
|
||||
bitmap.cpp
|
||||
bitmap_base.cpp
|
||||
bitmap_store.cpp
|
||||
board_printout.cpp
|
||||
cli_progress_reporter.cpp
|
||||
commit.cpp
|
||||
common.cpp
|
||||
dialog_shim.cpp
|
||||
dpi_scaling_common.cpp
|
||||
draw_panel_gal.cpp
|
||||
gal_display_options_common.cpp
|
||||
@@ -534,6 +468,7 @@ set( COMMON_SRCS
|
||||
eda_text.cpp
|
||||
eda_tools.cpp
|
||||
env_paths.cpp
|
||||
env_vars.cpp
|
||||
executable_names.cpp
|
||||
filename_resolver.cpp
|
||||
file_history.cpp
|
||||
@@ -541,27 +476,38 @@ set( COMMON_SRCS
|
||||
footprint_filter.cpp
|
||||
footprint_info.cpp
|
||||
gbr_metadata.cpp
|
||||
gestfich.cpp
|
||||
gr_basic.cpp
|
||||
grid_tricks.cpp
|
||||
hotkey_store.cpp
|
||||
hotkeys_basic.cpp
|
||||
kiface_base.cpp
|
||||
kiway.cpp
|
||||
kiway_express.cpp
|
||||
kiway_holder.cpp
|
||||
kiway_player.cpp
|
||||
launch_ext.cpp
|
||||
lib_table_base.cpp
|
||||
lib_table_grid_tricks.cpp
|
||||
lib_tree_model.cpp
|
||||
lib_tree_model_adapter.cpp
|
||||
marker_base.cpp
|
||||
notifications_manager.cpp
|
||||
origin_transforms.cpp
|
||||
printout.cpp
|
||||
project.cpp
|
||||
ptree.cpp
|
||||
rc_item.cpp
|
||||
refdes_utils.cpp
|
||||
render_settings.cpp
|
||||
reporter.cpp
|
||||
scintilla_tricks.cpp
|
||||
search_stack.cpp
|
||||
searchhelpfilefullpath.cpp
|
||||
status_popup.cpp
|
||||
string_utf8_map.cpp
|
||||
stroke_params.cpp
|
||||
systemdirsappend.cpp
|
||||
template_fieldnames.cpp
|
||||
textentry_tricks.cpp
|
||||
title_block.cpp
|
||||
@@ -572,6 +518,16 @@ set( COMMON_SRCS
|
||||
view/wx_view_controls.cpp
|
||||
)
|
||||
|
||||
if( TRUE OR NOT USE_KIWAY_DLLS )
|
||||
#if( NOT USE_KIWAY_DLLS )
|
||||
# We DO NOT want pgm_base.cpp linked into the KIFACE, only into the KIWAY.
|
||||
# Check the map files to verify eda_pgm.o not being linked in.
|
||||
list( APPEND COMMON_SRCS pgm_base.cpp )
|
||||
if( KICAD_USE_SENTRY )
|
||||
set_property(SOURCE pgm_base.cpp APPEND PROPERTY COMPILE_DEFINITIONS KICAD_SENTRY_DSN="${KICAD_SENTRY_DSN}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set( COMMON_SRCS
|
||||
${COMMON_SRCS}
|
||||
|
||||
@@ -582,7 +538,6 @@ set( COMMON_SRCS
|
||||
tool/action_toolbar.cpp
|
||||
tool/actions.cpp
|
||||
tool/common_control.cpp
|
||||
tool/library_editor_control.cpp
|
||||
tool/common_tools.cpp
|
||||
tool/conditional_menu.cpp
|
||||
tool/edit_constraints.cpp
|
||||
@@ -606,7 +561,24 @@ set( COMMON_SRCS
|
||||
tool/zoom_menu.cpp
|
||||
tool/zoom_tool.cpp
|
||||
|
||||
settings/app_settings.cpp
|
||||
settings/aui_settings.cpp
|
||||
settings/bom_settings.cpp
|
||||
settings/color_settings.cpp
|
||||
settings/cvpcb_settings.cpp
|
||||
settings/common_settings.cpp
|
||||
settings/grid_settings.cpp
|
||||
settings/json_settings.cpp
|
||||
settings/nested_settings.cpp
|
||||
settings/parameters.cpp
|
||||
settings/settings_manager.cpp
|
||||
settings/kicad_settings.cpp
|
||||
|
||||
project/board_project_settings.cpp
|
||||
project/net_settings.cpp
|
||||
project/project_archiver.cpp
|
||||
project/project_file.cpp
|
||||
project/project_local_settings.cpp
|
||||
|
||||
properties/color4d_variant.cpp
|
||||
properties/eda_angle_variant.cpp
|
||||
@@ -617,21 +589,13 @@ set( COMMON_SRCS
|
||||
properties/std_optional_variants.cpp
|
||||
|
||||
database/database_connection.cpp
|
||||
database/database_lib_settings.cpp
|
||||
|
||||
http_lib/http_lib_connection.cpp
|
||||
http_lib/http_lib_settings.cpp
|
||||
|
||||
api/api_enums.cpp
|
||||
api/api_utils.cpp
|
||||
)
|
||||
|
||||
if( KICAD_IPC_API )
|
||||
set( COMMON_SRCS
|
||||
${COMMON_SRCS}
|
||||
api/api_handler_editor.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library( common STATIC
|
||||
${COMMON_SRCS}
|
||||
)
|
||||
@@ -671,32 +635,28 @@ if( KICAD_USE_SENTRY )
|
||||
sentry )
|
||||
endif()
|
||||
|
||||
if( KICAD_IPC_API )
|
||||
target_link_libraries( common
|
||||
kinng
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories( common
|
||||
PUBLIC
|
||||
.
|
||||
${CMAKE_BINARY_DIR}
|
||||
$<TARGET_PROPERTY:argparse::argparse,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:kiapi,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
# text markup support
|
||||
add_dependencies( common pegtl )
|
||||
|
||||
target_include_directories( common PUBLIC
|
||||
$<TARGET_PROPERTY:pegtl,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:magic_enum,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
target_include_directories( common SYSTEM PUBLIC
|
||||
$<TARGET_PROPERTY:nanodbc,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
target_include_directories( common PUBLIC
|
||||
$<TARGET_PROPERTY:magic_enum,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
|
||||
set( PCB_COMMON_SRCS
|
||||
fp_lib_table.cpp
|
||||
hash_eda.cpp
|
||||
@@ -719,12 +679,9 @@ set( PCB_COMMON_SRCS
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/netinfo_item.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/netinfo_list.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pad.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/padstack.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_target.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_reference_image.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_field.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_table.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_tablecell.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_text.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_textbox.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/project_pcb.cpp
|
||||
@@ -785,12 +742,6 @@ set( PCB_COMMON_SRCS
|
||||
widgets/net_selector.cpp
|
||||
)
|
||||
|
||||
set( PCB_COMMON_SRCS
|
||||
${PCB_COMMON_SRCS}
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/api/api_pcb_enums.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/api/api_pcb_utils.cpp
|
||||
)
|
||||
|
||||
# add -DPCBNEW to compilation of these PCBNEW sources
|
||||
set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES
|
||||
COMPILE_DEFINITIONS "PCBNEW"
|
||||
@@ -817,7 +768,7 @@ add_dependencies( pcbcommon delaunator )
|
||||
|
||||
# The lemon grammar for the numeric evaluator
|
||||
generate_lemon_grammar(
|
||||
kicommon
|
||||
common
|
||||
libeval
|
||||
libeval/numeric_evaluator.cpp
|
||||
libeval/grammar.lemon
|
||||
@@ -825,7 +776,7 @@ generate_lemon_grammar(
|
||||
|
||||
# The lemon grammar for the expression compiler
|
||||
generate_lemon_grammar(
|
||||
kicommon
|
||||
common
|
||||
libeval_compiler
|
||||
libeval_compiler/libeval_compiler.cpp
|
||||
libeval_compiler/grammar.lemon
|
||||
|
||||
@@ -100,7 +100,6 @@ static const wxChar V3DRT_BevelExtentFactor[] = wxT( "V3DRT_BevelExtentFactor" )
|
||||
static const wxChar UseClipper2[] = wxT( "UseClipper2" );
|
||||
static const wxChar EnableGenerators[] = wxT( "EnableGenerators" );
|
||||
static const wxChar EnableGit[] = wxT( "EnableGit" );
|
||||
static const wxChar EnableLibWithText[] = wxT( "EnableLibWithText" );
|
||||
static const wxChar EnableEeschemaPrintCairo[] = wxT( "EnableEeschemaPrintCairo" );
|
||||
static const wxChar DisambiguationTime[] = wxT( "DisambiguationTime" );
|
||||
static const wxChar PcbSelectionVisibilityRatio[] = wxT( "PcbSelectionVisibilityRatio" );
|
||||
@@ -110,9 +109,6 @@ static const wxChar OcePluginAngularDeflection[] = wxT( "OcePluginAngularDeflect
|
||||
static const wxChar TriangulateSimplificationLevel[] = wxT( "TriangulateSimplificationLevel" );
|
||||
static const wxChar TriangulateMinimumArea[] = wxT( "TriangulateMinimumArea" );
|
||||
static const wxChar EnableCacheFriendlyFracture[] = wxT( "EnableCacheFriendlyFracture" );
|
||||
static const wxChar EnableAPILogging[] = wxT( "EnableAPILogging" );
|
||||
static const wxChar MaxFileSystemWatchers[] = wxT( "MaxFileSystemWatchers" );
|
||||
static const wxChar MinorSchematicGraphSize[] = wxT( "MinorSchematicGraphSize" );
|
||||
} // namespace KEYS
|
||||
|
||||
|
||||
@@ -239,7 +235,6 @@ ADVANCED_CFG::ADVANCED_CFG()
|
||||
m_ShowRepairSchematic = false;
|
||||
m_EnableGenerators = false;
|
||||
m_EnableGit = false;
|
||||
m_EnableLibWithText = false;
|
||||
|
||||
m_EnableEeschemaPrintCairo = true;
|
||||
|
||||
@@ -247,7 +242,6 @@ ADVANCED_CFG::ADVANCED_CFG()
|
||||
m_3DRT_BevelExtentFactor = 1.0 / 16.0;
|
||||
|
||||
m_UseClipper2 = true;
|
||||
m_EnableAPILogging = false;
|
||||
|
||||
m_Use3DConnexionDriver = true;
|
||||
|
||||
@@ -267,10 +261,6 @@ ADVANCED_CFG::ADVANCED_CFG()
|
||||
|
||||
m_EnableCacheFriendlyFracture = true;
|
||||
|
||||
m_MaxFilesystemWatchers = 16384;
|
||||
|
||||
m_MinorSchematicGraphSize = 10000;
|
||||
|
||||
loadFromConfigFile();
|
||||
}
|
||||
|
||||
@@ -452,15 +442,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableGenerators,
|
||||
&m_EnableGenerators, m_EnableGenerators ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableAPILogging,
|
||||
&m_EnableAPILogging, m_EnableAPILogging ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableGit,
|
||||
&m_EnableGit, m_EnableGit ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableLibWithText,
|
||||
&m_EnableLibWithText, m_EnableLibWithText ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableEeschemaPrintCairo,
|
||||
&m_EnableEeschemaPrintCairo,
|
||||
m_EnableEeschemaPrintCairo ) );
|
||||
@@ -493,14 +477,6 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
&m_EnableCacheFriendlyFracture,
|
||||
m_EnableCacheFriendlyFracture ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::MaxFileSystemWatchers,
|
||||
&m_MaxFilesystemWatchers, m_MaxFilesystemWatchers,
|
||||
0, 2147483647 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::MinorSchematicGraphSize,
|
||||
&m_MinorSchematicGraphSize, m_MinorSchematicGraphSize,
|
||||
0, 2147483647 ) );
|
||||
|
||||
// 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;
|
||||
|
||||
@@ -1,426 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
#include <api/api_enums.h>
|
||||
#include <import_export.h>
|
||||
#include <api/common/types/enums.pb.h>
|
||||
#include <api/board/board_types.pb.h>
|
||||
#include <api/schematic/schematic_types.pb.h>
|
||||
|
||||
#include <core/typeinfo.h>
|
||||
#include <font/text_attributes.h>
|
||||
#include <layer_ids.h>
|
||||
#include <stroke_params.h>
|
||||
|
||||
using namespace kiapi;
|
||||
using namespace kiapi::common;
|
||||
|
||||
template<>
|
||||
KICAD_T FromProtoEnum( types::KiCadObjectType aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case types::KiCadObjectType::KOT_PCB_FOOTPRINT: return PCB_FOOTPRINT_T;
|
||||
case types::KiCadObjectType::KOT_PCB_PAD: return PCB_PAD_T;
|
||||
case types::KiCadObjectType::KOT_PCB_SHAPE: return PCB_SHAPE_T;
|
||||
case types::KiCadObjectType::KOT_PCB_REFERENCE_IMAGE: return PCB_REFERENCE_IMAGE_T;
|
||||
case types::KiCadObjectType::KOT_PCB_FIELD: return PCB_FIELD_T;
|
||||
case types::KiCadObjectType::KOT_PCB_GENERATOR: return PCB_GENERATOR_T;
|
||||
case types::KiCadObjectType::KOT_PCB_TEXT: return PCB_TEXT_T;
|
||||
case types::KiCadObjectType::KOT_PCB_TEXTBOX: return PCB_TEXTBOX_T;
|
||||
case types::KiCadObjectType::KOT_PCB_TABLE: return PCB_TABLE_T;
|
||||
case types::KiCadObjectType::KOT_PCB_TABLECELL: return PCB_TABLECELL_T;
|
||||
case types::KiCadObjectType::KOT_PCB_TRACE: return PCB_TRACE_T;
|
||||
case types::KiCadObjectType::KOT_PCB_VIA: return PCB_VIA_T;
|
||||
case types::KiCadObjectType::KOT_PCB_ARC: return PCB_ARC_T;
|
||||
case types::KiCadObjectType::KOT_PCB_MARKER: return PCB_MARKER_T;
|
||||
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_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;
|
||||
case types::KiCadObjectType::KOT_SCH_BUS_WIRE_ENTRY: return SCH_BUS_WIRE_ENTRY_T;
|
||||
case types::KiCadObjectType::KOT_SCH_BUS_BUS_ENTRY: return SCH_BUS_BUS_ENTRY_T;
|
||||
case types::KiCadObjectType::KOT_SCH_LINE: return SCH_LINE_T;
|
||||
case types::KiCadObjectType::KOT_SCH_SHAPE: return SCH_SHAPE_T;
|
||||
case types::KiCadObjectType::KOT_SCH_BITMAP: return SCH_BITMAP_T;
|
||||
case types::KiCadObjectType::KOT_SCH_TEXTBOX: return SCH_TEXTBOX_T;
|
||||
case types::KiCadObjectType::KOT_SCH_TEXT: return SCH_TEXT_T;
|
||||
case types::KiCadObjectType::KOT_SCH_TABLE: return SCH_TABLE_T;
|
||||
case types::KiCadObjectType::KOT_SCH_TABLECELL: return SCH_TABLECELL_T;
|
||||
case types::KiCadObjectType::KOT_SCH_LABEL: return SCH_LABEL_T;
|
||||
case types::KiCadObjectType::KOT_SCH_GLOBAL_LABEL: return SCH_GLOBAL_LABEL_T;
|
||||
case types::KiCadObjectType::KOT_SCH_HIER_LABEL: return SCH_HIER_LABEL_T;
|
||||
case types::KiCadObjectType::KOT_SCH_DIRECTIVE_LABEL: return SCH_DIRECTIVE_LABEL_T;
|
||||
case types::KiCadObjectType::KOT_SCH_FIELD: return SCH_FIELD_T;
|
||||
case types::KiCadObjectType::KOT_SCH_SYMBOL: return SCH_SYMBOL_T;
|
||||
case types::KiCadObjectType::KOT_SCH_SHEET_PIN: return SCH_SHEET_PIN_T;
|
||||
case types::KiCadObjectType::KOT_SCH_SHEET: return SCH_SHEET_T;
|
||||
case types::KiCadObjectType::KOT_SCH_PIN: return SCH_PIN_T;
|
||||
case types::KiCadObjectType::KOT_LIB_SYMBOL: return LIB_SYMBOL_T;
|
||||
case types::KiCadObjectType::KOT_WSG_LINE: return WSG_LINE_T;
|
||||
case types::KiCadObjectType::KOT_WSG_RECT: return WSG_RECT_T;
|
||||
case types::KiCadObjectType::KOT_WSG_POLY: return WSG_POLY_T;
|
||||
case types::KiCadObjectType::KOT_WSG_TEXT: return WSG_TEXT_T;
|
||||
case types::KiCadObjectType::KOT_WSG_BITMAP: return WSG_BITMAP_T;
|
||||
case types::KiCadObjectType::KOT_WSG_PAGE: return WSG_PAGE_T;
|
||||
|
||||
case types::KiCadObjectType::KOT_UNKNOWN: return TYPE_NOT_INIT;
|
||||
default:
|
||||
wxCHECK_MSG( false, TYPE_NOT_INIT,
|
||||
"Unhandled case in FromProtoEnum<types::KiCadObjectType>" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
types::KiCadObjectType ToProtoEnum( KICAD_T aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case PCB_FOOTPRINT_T: return types::KiCadObjectType::KOT_PCB_FOOTPRINT;
|
||||
case PCB_PAD_T: return types::KiCadObjectType::KOT_PCB_PAD;
|
||||
case PCB_SHAPE_T: return types::KiCadObjectType::KOT_PCB_SHAPE;
|
||||
case PCB_REFERENCE_IMAGE_T: return types::KiCadObjectType::KOT_PCB_REFERENCE_IMAGE;
|
||||
case PCB_FIELD_T: return types::KiCadObjectType::KOT_PCB_FIELD;
|
||||
case PCB_GENERATOR_T: return types::KiCadObjectType::KOT_PCB_GENERATOR;
|
||||
case PCB_TEXT_T: return types::KiCadObjectType::KOT_PCB_TEXT;
|
||||
case PCB_TEXTBOX_T: return types::KiCadObjectType::KOT_PCB_TEXTBOX;
|
||||
case PCB_TABLE_T: return types::KiCadObjectType::KOT_PCB_TABLE;
|
||||
case PCB_TABLECELL_T: return types::KiCadObjectType::KOT_PCB_TABLECELL;
|
||||
case PCB_TRACE_T: return types::KiCadObjectType::KOT_PCB_TRACE;
|
||||
case PCB_VIA_T: return types::KiCadObjectType::KOT_PCB_VIA;
|
||||
case PCB_ARC_T: return types::KiCadObjectType::KOT_PCB_ARC;
|
||||
case PCB_MARKER_T: return types::KiCadObjectType::KOT_PCB_MARKER;
|
||||
case PCB_DIMENSION_T: return types::KiCadObjectType::KOT_PCB_DIMENSION;
|
||||
case PCB_ZONE_T: return types::KiCadObjectType::KOT_PCB_ZONE;
|
||||
case PCB_GROUP_T: return types::KiCadObjectType::KOT_PCB_GROUP;
|
||||
case SCH_MARKER_T: return types::KiCadObjectType::KOT_SCH_MARKER;
|
||||
case SCH_JUNCTION_T: return types::KiCadObjectType::KOT_SCH_JUNCTION;
|
||||
case SCH_NO_CONNECT_T: return types::KiCadObjectType::KOT_SCH_NO_CONNECT;
|
||||
case SCH_BUS_WIRE_ENTRY_T: return types::KiCadObjectType::KOT_SCH_BUS_WIRE_ENTRY;
|
||||
case SCH_BUS_BUS_ENTRY_T: return types::KiCadObjectType::KOT_SCH_BUS_BUS_ENTRY;
|
||||
case SCH_LINE_T: return types::KiCadObjectType::KOT_SCH_LINE;
|
||||
case SCH_SHAPE_T: return types::KiCadObjectType::KOT_SCH_SHAPE;
|
||||
case SCH_BITMAP_T: return types::KiCadObjectType::KOT_SCH_BITMAP;
|
||||
case SCH_TEXTBOX_T: return types::KiCadObjectType::KOT_SCH_TEXTBOX;
|
||||
case SCH_TEXT_T: return types::KiCadObjectType::KOT_SCH_TEXT;
|
||||
case SCH_TABLE_T: return types::KiCadObjectType::KOT_SCH_TABLE;
|
||||
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_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;
|
||||
case SCH_SYMBOL_T: return types::KiCadObjectType::KOT_SCH_SYMBOL;
|
||||
case SCH_SHEET_PIN_T: return types::KiCadObjectType::KOT_SCH_SHEET_PIN;
|
||||
case SCH_SHEET_T: return types::KiCadObjectType::KOT_SCH_SHEET;
|
||||
case SCH_PIN_T: return types::KiCadObjectType::KOT_SCH_PIN;
|
||||
case LIB_SYMBOL_T: return types::KiCadObjectType::KOT_LIB_SYMBOL;
|
||||
case WSG_LINE_T: return types::KiCadObjectType::KOT_WSG_LINE;
|
||||
case WSG_RECT_T: return types::KiCadObjectType::KOT_WSG_RECT;
|
||||
case WSG_POLY_T: return types::KiCadObjectType::KOT_WSG_POLY;
|
||||
case WSG_TEXT_T: return types::KiCadObjectType::KOT_WSG_TEXT;
|
||||
case WSG_BITMAP_T: return types::KiCadObjectType::KOT_WSG_BITMAP;
|
||||
case WSG_PAGE_T: return types::KiCadObjectType::KOT_WSG_PAGE;
|
||||
default:
|
||||
wxCHECK_MSG( false, types::KiCadObjectType::KOT_UNKNOWN,
|
||||
"Unhandled case in ToProtoEnum<KICAD_T>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
PCB_LAYER_ID FromProtoEnum( board::types::BoardLayer aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case board::types::BoardLayer::BL_UNDEFINED: return UNDEFINED_LAYER;
|
||||
case board::types::BoardLayer::BL_UNSELECTED: return UNSELECTED_LAYER;
|
||||
case board::types::BoardLayer::BL_F_Cu: return F_Cu;
|
||||
case board::types::BoardLayer::BL_In1_Cu: return In1_Cu;
|
||||
case board::types::BoardLayer::BL_In2_Cu: return In2_Cu;
|
||||
case board::types::BoardLayer::BL_In3_Cu: return In3_Cu;
|
||||
case board::types::BoardLayer::BL_In4_Cu: return In4_Cu;
|
||||
case board::types::BoardLayer::BL_In5_Cu: return In5_Cu;
|
||||
case board::types::BoardLayer::BL_In6_Cu: return In6_Cu;
|
||||
case board::types::BoardLayer::BL_In7_Cu: return In7_Cu;
|
||||
case board::types::BoardLayer::BL_In8_Cu: return In8_Cu;
|
||||
case board::types::BoardLayer::BL_In9_Cu: return In9_Cu;
|
||||
case board::types::BoardLayer::BL_In10_Cu: return In10_Cu;
|
||||
case board::types::BoardLayer::BL_In11_Cu: return In11_Cu;
|
||||
case board::types::BoardLayer::BL_In12_Cu: return In12_Cu;
|
||||
case board::types::BoardLayer::BL_In13_Cu: return In13_Cu;
|
||||
case board::types::BoardLayer::BL_In14_Cu: return In14_Cu;
|
||||
case board::types::BoardLayer::BL_In15_Cu: return In15_Cu;
|
||||
case board::types::BoardLayer::BL_In16_Cu: return In16_Cu;
|
||||
case board::types::BoardLayer::BL_In17_Cu: return In17_Cu;
|
||||
case board::types::BoardLayer::BL_In18_Cu: return In18_Cu;
|
||||
case board::types::BoardLayer::BL_In19_Cu: return In19_Cu;
|
||||
case board::types::BoardLayer::BL_In20_Cu: return In20_Cu;
|
||||
case board::types::BoardLayer::BL_In21_Cu: return In21_Cu;
|
||||
case board::types::BoardLayer::BL_In22_Cu: return In22_Cu;
|
||||
case board::types::BoardLayer::BL_In23_Cu: return In23_Cu;
|
||||
case board::types::BoardLayer::BL_In24_Cu: return In24_Cu;
|
||||
case board::types::BoardLayer::BL_In25_Cu: return In25_Cu;
|
||||
case board::types::BoardLayer::BL_In26_Cu: return In26_Cu;
|
||||
case board::types::BoardLayer::BL_In27_Cu: return In27_Cu;
|
||||
case board::types::BoardLayer::BL_In28_Cu: return In28_Cu;
|
||||
case board::types::BoardLayer::BL_In29_Cu: return In29_Cu;
|
||||
case board::types::BoardLayer::BL_In30_Cu: return In30_Cu;
|
||||
case board::types::BoardLayer::BL_B_Cu: return B_Cu;
|
||||
case board::types::BoardLayer::BL_B_Adhes: return B_Adhes;
|
||||
case board::types::BoardLayer::BL_F_Adhes: return F_Adhes;
|
||||
case board::types::BoardLayer::BL_B_Paste: return B_Paste;
|
||||
case board::types::BoardLayer::BL_F_Paste: return F_Paste;
|
||||
case board::types::BoardLayer::BL_B_SilkS: return B_SilkS;
|
||||
case board::types::BoardLayer::BL_F_SilkS: return F_SilkS;
|
||||
case board::types::BoardLayer::BL_B_Mask: return B_Mask;
|
||||
case board::types::BoardLayer::BL_F_Mask: return F_Mask;
|
||||
case board::types::BoardLayer::BL_Dwgs_User: return Dwgs_User;
|
||||
case board::types::BoardLayer::BL_Cmts_User: return Cmts_User;
|
||||
case board::types::BoardLayer::BL_Eco1_User: return Eco1_User;
|
||||
case board::types::BoardLayer::BL_Eco2_User: return Eco2_User;
|
||||
case board::types::BoardLayer::BL_Edge_Cuts: return Edge_Cuts;
|
||||
case board::types::BoardLayer::BL_Margin: return Margin;
|
||||
case board::types::BoardLayer::BL_B_CrtYd: return B_CrtYd;
|
||||
case board::types::BoardLayer::BL_F_CrtYd: return F_CrtYd;
|
||||
case board::types::BoardLayer::BL_B_Fab: return B_Fab;
|
||||
case board::types::BoardLayer::BL_F_Fab: return F_Fab;
|
||||
case board::types::BoardLayer::BL_User_1: return User_1;
|
||||
case board::types::BoardLayer::BL_User_2: return User_2;
|
||||
case board::types::BoardLayer::BL_User_3: return User_3;
|
||||
case board::types::BoardLayer::BL_User_4: return User_4;
|
||||
case board::types::BoardLayer::BL_User_5: return User_5;
|
||||
case board::types::BoardLayer::BL_User_6: return User_6;
|
||||
case board::types::BoardLayer::BL_User_7: return User_7;
|
||||
case board::types::BoardLayer::BL_User_8: return User_8;
|
||||
case board::types::BoardLayer::BL_User_9: return User_9;
|
||||
|
||||
case board::types::BoardLayer::BL_UNKNOWN: return UNDEFINED_LAYER;
|
||||
default:
|
||||
wxCHECK_MSG( false, UNDEFINED_LAYER,
|
||||
"Unhandled case in FromProtoEnum<board::types::BoardLayer>" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
board::types::BoardLayer ToProtoEnum( PCB_LAYER_ID aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case UNDEFINED_LAYER: return board::types::BoardLayer::BL_UNDEFINED;
|
||||
case UNSELECTED_LAYER: return board::types::BoardLayer::BL_UNSELECTED;
|
||||
case F_Cu: return board::types::BoardLayer::BL_F_Cu;
|
||||
case In1_Cu: return board::types::BoardLayer::BL_In1_Cu;
|
||||
case In2_Cu: return board::types::BoardLayer::BL_In2_Cu;
|
||||
case In3_Cu: return board::types::BoardLayer::BL_In3_Cu;
|
||||
case In4_Cu: return board::types::BoardLayer::BL_In4_Cu;
|
||||
case In5_Cu: return board::types::BoardLayer::BL_In5_Cu;
|
||||
case In6_Cu: return board::types::BoardLayer::BL_In6_Cu;
|
||||
case In7_Cu: return board::types::BoardLayer::BL_In7_Cu;
|
||||
case In8_Cu: return board::types::BoardLayer::BL_In8_Cu;
|
||||
case In9_Cu: return board::types::BoardLayer::BL_In9_Cu;
|
||||
case In10_Cu: return board::types::BoardLayer::BL_In10_Cu;
|
||||
case In11_Cu: return board::types::BoardLayer::BL_In11_Cu;
|
||||
case In12_Cu: return board::types::BoardLayer::BL_In12_Cu;
|
||||
case In13_Cu: return board::types::BoardLayer::BL_In13_Cu;
|
||||
case In14_Cu: return board::types::BoardLayer::BL_In14_Cu;
|
||||
case In15_Cu: return board::types::BoardLayer::BL_In15_Cu;
|
||||
case In16_Cu: return board::types::BoardLayer::BL_In16_Cu;
|
||||
case In17_Cu: return board::types::BoardLayer::BL_In17_Cu;
|
||||
case In18_Cu: return board::types::BoardLayer::BL_In18_Cu;
|
||||
case In19_Cu: return board::types::BoardLayer::BL_In19_Cu;
|
||||
case In20_Cu: return board::types::BoardLayer::BL_In20_Cu;
|
||||
case In21_Cu: return board::types::BoardLayer::BL_In21_Cu;
|
||||
case In22_Cu: return board::types::BoardLayer::BL_In22_Cu;
|
||||
case In23_Cu: return board::types::BoardLayer::BL_In23_Cu;
|
||||
case In24_Cu: return board::types::BoardLayer::BL_In24_Cu;
|
||||
case In25_Cu: return board::types::BoardLayer::BL_In25_Cu;
|
||||
case In26_Cu: return board::types::BoardLayer::BL_In26_Cu;
|
||||
case In27_Cu: return board::types::BoardLayer::BL_In27_Cu;
|
||||
case In28_Cu: return board::types::BoardLayer::BL_In28_Cu;
|
||||
case In29_Cu: return board::types::BoardLayer::BL_In29_Cu;
|
||||
case In30_Cu: return board::types::BoardLayer::BL_In30_Cu;
|
||||
case B_Cu: return board::types::BoardLayer::BL_B_Cu;
|
||||
case B_Adhes: return board::types::BoardLayer::BL_B_Adhes;
|
||||
case F_Adhes: return board::types::BoardLayer::BL_F_Adhes;
|
||||
case B_Paste: return board::types::BoardLayer::BL_B_Paste;
|
||||
case F_Paste: return board::types::BoardLayer::BL_F_Paste;
|
||||
case B_SilkS: return board::types::BoardLayer::BL_B_SilkS;
|
||||
case F_SilkS: return board::types::BoardLayer::BL_F_SilkS;
|
||||
case B_Mask: return board::types::BoardLayer::BL_B_Mask;
|
||||
case F_Mask: return board::types::BoardLayer::BL_F_Mask;
|
||||
case Dwgs_User: return board::types::BoardLayer::BL_Dwgs_User;
|
||||
case Cmts_User: return board::types::BoardLayer::BL_Cmts_User;
|
||||
case Eco1_User: return board::types::BoardLayer::BL_Eco1_User;
|
||||
case Eco2_User: return board::types::BoardLayer::BL_Eco2_User;
|
||||
case Edge_Cuts: return board::types::BoardLayer::BL_Edge_Cuts;
|
||||
case Margin: return board::types::BoardLayer::BL_Margin;
|
||||
case B_CrtYd: return board::types::BoardLayer::BL_B_CrtYd;
|
||||
case F_CrtYd: return board::types::BoardLayer::BL_F_CrtYd;
|
||||
case B_Fab: return board::types::BoardLayer::BL_B_Fab;
|
||||
case F_Fab: return board::types::BoardLayer::BL_F_Fab;
|
||||
case User_1: return board::types::BoardLayer::BL_User_1;
|
||||
case User_2: return board::types::BoardLayer::BL_User_2;
|
||||
case User_3: return board::types::BoardLayer::BL_User_3;
|
||||
case User_4: return board::types::BoardLayer::BL_User_4;
|
||||
case User_5: return board::types::BoardLayer::BL_User_5;
|
||||
case User_6: return board::types::BoardLayer::BL_User_6;
|
||||
case User_7: return board::types::BoardLayer::BL_User_7;
|
||||
case User_8: return board::types::BoardLayer::BL_User_8;
|
||||
case User_9: return board::types::BoardLayer::BL_User_9;
|
||||
default:
|
||||
wxCHECK_MSG( false, board::types::BoardLayer::BL_UNKNOWN,
|
||||
"Unhandled case in ToProtoEnum<PCB_LAYER_ID>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
SCH_LAYER_ID FromProtoEnum( schematic::types::SchematicLayer aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
|
||||
default:
|
||||
wxCHECK_MSG( false, SCH_LAYER_ID_START,
|
||||
"Unhandled case in FromProtoEnum<schematic::types::SchematicLayer>" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
schematic::types::SchematicLayer ToProtoEnum( SCH_LAYER_ID aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
|
||||
default:
|
||||
wxCHECK_MSG( false, schematic::types::SchematicLayer::SL_UNKNOWN,
|
||||
"Unhandled case in ToProtoEnum<SCH_LAYER_ID>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
GR_TEXT_H_ALIGN_T FromProtoEnum( types::HorizontalAlignment aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case types::HorizontalAlignment::HA_LEFT: return GR_TEXT_H_ALIGN_LEFT;
|
||||
case types::HorizontalAlignment::HA_CENTER: return GR_TEXT_H_ALIGN_CENTER;
|
||||
case types::HorizontalAlignment::HA_RIGHT: return GR_TEXT_H_ALIGN_RIGHT;
|
||||
case types::HorizontalAlignment::HA_INDETERMINATE: return GR_TEXT_H_ALIGN_INDETERMINATE;
|
||||
|
||||
case types::HorizontalAlignment::HA_UNKNOWN: return GR_TEXT_H_ALIGN_CENTER;
|
||||
default:
|
||||
wxCHECK_MSG( false, GR_TEXT_H_ALIGN_CENTER,
|
||||
"Unhandled case in FromProtoEnum<types::HorizontalAlignment>" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
types::HorizontalAlignment ToProtoEnum( GR_TEXT_H_ALIGN_T aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case GR_TEXT_H_ALIGN_LEFT: return types::HorizontalAlignment::HA_LEFT;
|
||||
case GR_TEXT_H_ALIGN_CENTER: return types::HorizontalAlignment::HA_CENTER;
|
||||
case GR_TEXT_H_ALIGN_RIGHT: return types::HorizontalAlignment::HA_RIGHT;
|
||||
case GR_TEXT_H_ALIGN_INDETERMINATE: return types::HorizontalAlignment::HA_INDETERMINATE;
|
||||
default:
|
||||
wxCHECK_MSG( false, types::HorizontalAlignment::HA_UNKNOWN,
|
||||
"Unhandled case in ToProtoEnum<GR_TEXT_H_ALIGN_T>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
GR_TEXT_V_ALIGN_T FromProtoEnum( types::VerticalAlignment aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case types::VerticalAlignment::VA_TOP: return GR_TEXT_V_ALIGN_TOP;
|
||||
case types::VerticalAlignment::VA_CENTER: return GR_TEXT_V_ALIGN_CENTER;
|
||||
case types::VerticalAlignment::VA_BOTTOM: return GR_TEXT_V_ALIGN_BOTTOM;
|
||||
case types::VerticalAlignment::VA_INDETERMINATE: return GR_TEXT_V_ALIGN_INDETERMINATE;
|
||||
|
||||
case types::VerticalAlignment::VA_UNKNOWN: return GR_TEXT_V_ALIGN_CENTER;
|
||||
default:
|
||||
wxCHECK_MSG( false, GR_TEXT_V_ALIGN_CENTER,
|
||||
"Unhandled case in FromProtoEnum<types::VerticalAlignment>" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
types::VerticalAlignment ToProtoEnum( GR_TEXT_V_ALIGN_T aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case GR_TEXT_V_ALIGN_TOP: return types::VerticalAlignment::VA_TOP;
|
||||
case GR_TEXT_V_ALIGN_CENTER: return types::VerticalAlignment::VA_CENTER;
|
||||
case GR_TEXT_V_ALIGN_BOTTOM: return types::VerticalAlignment::VA_BOTTOM;
|
||||
case GR_TEXT_V_ALIGN_INDETERMINATE: return types::VerticalAlignment::VA_INDETERMINATE;
|
||||
default:
|
||||
wxCHECK_MSG( false, types::VerticalAlignment::VA_UNKNOWN,
|
||||
"Unhandled case in ToProtoEnum<GR_TEXT_V_ALIGN_T>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
LINE_STYLE FromProtoEnum( types::StrokeLineStyle aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case types::StrokeLineStyle::SLS_DEFAULT: return LINE_STYLE::DEFAULT;
|
||||
case types::StrokeLineStyle::SLS_SOLID: return LINE_STYLE::SOLID;
|
||||
case types::StrokeLineStyle::SLS_DASH: return LINE_STYLE::DASH;
|
||||
case types::StrokeLineStyle::SLS_DOT: return LINE_STYLE::DOT;
|
||||
case types::StrokeLineStyle::SLS_DASHDOT: return LINE_STYLE::DASHDOT;
|
||||
case types::StrokeLineStyle::SLS_DASHDOTDOT: return LINE_STYLE::DASHDOTDOT;
|
||||
case types::StrokeLineStyle::SLS_UNKNOWN:
|
||||
default:
|
||||
wxCHECK_MSG( false, LINE_STYLE::DEFAULT,
|
||||
"Unhandled case in FromProtoEnum<types::StrokeLineStyle>" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
types::StrokeLineStyle ToProtoEnum( LINE_STYLE aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case LINE_STYLE::DEFAULT: return types::StrokeLineStyle::SLS_DEFAULT;
|
||||
case LINE_STYLE::SOLID: return types::StrokeLineStyle::SLS_SOLID;
|
||||
case LINE_STYLE::DASH: return types::StrokeLineStyle::SLS_DASH;
|
||||
case LINE_STYLE::DOT: return types::StrokeLineStyle::SLS_DOT;
|
||||
case LINE_STYLE::DASHDOT: return types::StrokeLineStyle::SLS_DASHDOT;
|
||||
case LINE_STYLE::DASHDOTDOT: return types::StrokeLineStyle::SLS_DASHDOTDOT;
|
||||
default:
|
||||
wxCHECK_MSG( false, types::StrokeLineStyle::SLS_UNKNOWN,
|
||||
"Unhandled case in ToProtoEnum<LINE_STYLE>");
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2023 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/>.
|
||||
*/
|
||||
|
||||
#include <api/api_handler.h>
|
||||
#include <wx/wx.h>
|
||||
|
||||
using kiapi::common::ApiRequest, kiapi::common::ApiResponse, kiapi::common::ApiResponseStatus;
|
||||
|
||||
|
||||
const wxString API_HANDLER::m_defaultCommitMessage = _( "Modification from API" );
|
||||
|
||||
|
||||
API_RESULT API_HANDLER::Handle( ApiRequest& aMsg )
|
||||
{
|
||||
ApiResponseStatus status;
|
||||
|
||||
if( !aMsg.has_message() )
|
||||
{
|
||||
status.set_status( ApiStatusCode::AS_BAD_REQUEST );
|
||||
status.set_error_message( "request has no inner message" );
|
||||
return tl::unexpected( status );
|
||||
}
|
||||
|
||||
std::string typeName;
|
||||
|
||||
if( !google::protobuf::Any::ParseAnyTypeUrl( aMsg.message().type_url(), &typeName ) )
|
||||
{
|
||||
status.set_status( ApiStatusCode::AS_BAD_REQUEST );
|
||||
status.set_error_message( "could not parse inner message type" );
|
||||
return tl::unexpected( status );
|
||||
}
|
||||
|
||||
auto it = m_handlers.find( typeName );
|
||||
|
||||
if( it != m_handlers.end() )
|
||||
{
|
||||
REQUEST_HANDLER& handler = it->second;
|
||||
return handler( aMsg );
|
||||
}
|
||||
|
||||
status.set_status( ApiStatusCode::AS_UNHANDLED );
|
||||
// This response is used internally; no need for an error message
|
||||
return tl::unexpected( status );
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2023 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/>.
|
||||
*/
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#include <api/api_handler_common.h>
|
||||
#include <build_version.h>
|
||||
#include <google/protobuf/empty.pb.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project/net_settings.h>
|
||||
#include <project/project_file.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <wx/string.h>
|
||||
|
||||
using namespace kiapi::common::commands;
|
||||
using namespace kiapi::common::types;
|
||||
using google::protobuf::Empty;
|
||||
|
||||
|
||||
API_HANDLER_COMMON::API_HANDLER_COMMON() :
|
||||
API_HANDLER()
|
||||
{
|
||||
registerHandler<commands::GetVersion, GetVersionResponse>( &API_HANDLER_COMMON::handleGetVersion );
|
||||
registerHandler<GetNetClasses, NetClassesResponse>( &API_HANDLER_COMMON::handleGetNetClasses );
|
||||
registerHandler<Ping, Empty>( &API_HANDLER_COMMON::handlePing );
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<GetVersionResponse> API_HANDLER_COMMON::handleGetVersion( commands::GetVersion&,
|
||||
const HANDLER_CONTEXT& )
|
||||
{
|
||||
GetVersionResponse reply;
|
||||
|
||||
reply.mutable_version()->set_full_version( GetBuildVersion().ToStdString() );
|
||||
|
||||
std::tuple<int, int, int> version = GetMajorMinorPatchTuple();
|
||||
reply.mutable_version()->set_major( std::get<0>( version ) );
|
||||
reply.mutable_version()->set_minor( std::get<1>( version ) );
|
||||
reply.mutable_version()->set_patch( std::get<2>( version ) );
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<NetClassesResponse> API_HANDLER_COMMON::handleGetNetClasses( GetNetClasses& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx )
|
||||
{
|
||||
NetClassesResponse reply;
|
||||
|
||||
std::shared_ptr<NET_SETTINGS>& netSettings =
|
||||
Pgm().GetSettingsManager().Prj().GetProjectFile().m_NetSettings;
|
||||
|
||||
for( const auto& [name, netClass] : netSettings->m_NetClasses )
|
||||
{
|
||||
reply.add_net_classes()->set_name( name.ToStdString() );
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<Empty> API_HANDLER_COMMON::handlePing( Ping& aMsg, const HANDLER_CONTEXT& aCtx )
|
||||
{
|
||||
return Empty();
|
||||
}
|
||||
@@ -1,353 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
#include <api/api_handler_editor.h>
|
||||
#include <api/api_utils.h>
|
||||
#include <eda_base_frame.h>
|
||||
#include <eda_item.h>
|
||||
#include <wx/wx.h>
|
||||
|
||||
using namespace kiapi::common::commands;
|
||||
|
||||
|
||||
API_HANDLER_EDITOR::API_HANDLER_EDITOR( EDA_BASE_FRAME* aFrame ) :
|
||||
API_HANDLER(),
|
||||
m_frame( aFrame )
|
||||
{
|
||||
registerHandler<BeginCommit, BeginCommitResponse>( &API_HANDLER_EDITOR::handleBeginCommit );
|
||||
registerHandler<EndCommit, EndCommitResponse>( &API_HANDLER_EDITOR::handleEndCommit );
|
||||
registerHandler<CreateItems, CreateItemsResponse>( &API_HANDLER_EDITOR::handleCreateItems );
|
||||
registerHandler<UpdateItems, UpdateItemsResponse>( &API_HANDLER_EDITOR::handleUpdateItems );
|
||||
registerHandler<DeleteItems, DeleteItemsResponse>( &API_HANDLER_EDITOR::handleDeleteItems );
|
||||
registerHandler<HitTest, HitTestResponse>( &API_HANDLER_EDITOR::handleHitTest );
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<BeginCommitResponse> API_HANDLER_EDITOR::handleBeginCommit( BeginCommit& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx )
|
||||
{
|
||||
if( std::optional<ApiResponseStatus> busy = checkForBusy() )
|
||||
return tl::unexpected( *busy );
|
||||
|
||||
if( m_commits.count( aCtx.ClientName ) )
|
||||
{
|
||||
ApiResponseStatus e;
|
||||
e.set_status( ApiStatusCode::AS_BAD_REQUEST );
|
||||
e.set_error_message( fmt::format( "the client {} already has a commit in progress",
|
||||
aCtx.ClientName ) );
|
||||
return tl::unexpected( e );
|
||||
}
|
||||
|
||||
wxASSERT( !m_activeClients.count( aCtx.ClientName ) );
|
||||
|
||||
BeginCommitResponse response;
|
||||
|
||||
KIID id;
|
||||
m_commits[aCtx.ClientName] = std::make_pair( id, createCommit() );
|
||||
response.mutable_id()->set_value( id.AsStdString() );
|
||||
|
||||
m_activeClients.insert( aCtx.ClientName );
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<EndCommitResponse> API_HANDLER_EDITOR::handleEndCommit( EndCommit& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx )
|
||||
{
|
||||
if( std::optional<ApiResponseStatus> busy = checkForBusy() )
|
||||
return tl::unexpected( *busy );
|
||||
|
||||
if( !m_commits.count( aCtx.ClientName ) )
|
||||
{
|
||||
ApiResponseStatus e;
|
||||
e.set_status( ApiStatusCode::AS_BAD_REQUEST );
|
||||
e.set_error_message( fmt::format( "the client {} does not has a commit in progress",
|
||||
aCtx.ClientName ) );
|
||||
return tl::unexpected( e );
|
||||
}
|
||||
|
||||
wxASSERT( m_activeClients.count( aCtx.ClientName ) );
|
||||
|
||||
const std::pair<KIID, std::unique_ptr<COMMIT>>& pair = m_commits.at( aCtx.ClientName );
|
||||
const KIID& id = pair.first;
|
||||
const std::unique_ptr<COMMIT>& commit = pair.second;
|
||||
|
||||
EndCommitResponse response;
|
||||
|
||||
// Do not check IDs with drop; it is a safety net in case the id was lost on the client side
|
||||
switch( aMsg.action() )
|
||||
{
|
||||
case kiapi::common::commands::CMA_DROP:
|
||||
{
|
||||
commit->Revert();
|
||||
m_commits.erase( aCtx.ClientName );
|
||||
m_activeClients.erase( aCtx.ClientName );
|
||||
break;
|
||||
}
|
||||
|
||||
case kiapi::common::commands::CMA_COMMIT:
|
||||
{
|
||||
if( aMsg.id().value().compare( id.AsStdString() ) != 0 )
|
||||
{
|
||||
ApiResponseStatus e;
|
||||
e.set_status( ApiStatusCode::AS_BAD_REQUEST );
|
||||
e.set_error_message( fmt::format( "the id {} does not match the commit in progress",
|
||||
aMsg.id().value() ) );
|
||||
return tl::unexpected( e );
|
||||
}
|
||||
|
||||
pushCurrentCommit( aCtx, wxString( aMsg.message().c_str(), wxConvUTF8 ) );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
COMMIT* API_HANDLER_EDITOR::getCurrentCommit( const HANDLER_CONTEXT& aCtx )
|
||||
{
|
||||
if( !m_commits.count( aCtx.ClientName ) )
|
||||
{
|
||||
KIID id;
|
||||
m_commits[aCtx.ClientName] = std::make_pair( id, createCommit() );
|
||||
}
|
||||
|
||||
return m_commits.at( aCtx.ClientName ).second.get();
|
||||
}
|
||||
|
||||
|
||||
void API_HANDLER_EDITOR::pushCurrentCommit( const HANDLER_CONTEXT& aCtx, const wxString& aMessage )
|
||||
{
|
||||
auto it = m_commits.find( aCtx.ClientName );
|
||||
|
||||
if( it == m_commits.end() )
|
||||
return;
|
||||
|
||||
it->second.second->Push( aMessage.IsEmpty() ? m_defaultCommitMessage : aMessage );
|
||||
m_commits.erase( it );
|
||||
m_activeClients.erase( aCtx.ClientName );
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<bool> API_HANDLER_EDITOR::validateDocument(
|
||||
const kiapi::common::types::DocumentSpecifier& aDocument )
|
||||
{
|
||||
if( !validateDocumentInternal( aDocument ) )
|
||||
{
|
||||
ApiResponseStatus e;
|
||||
e.set_status( ApiStatusCode::AS_BAD_REQUEST );
|
||||
e.set_error_message( fmt::format( "the requested document {} is not open",
|
||||
aDocument.board_filename() ) );
|
||||
return tl::unexpected( e );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<std::optional<KIID>> API_HANDLER_EDITOR::validateItemHeaderDocument(
|
||||
const kiapi::common::types::ItemHeader& aHeader )
|
||||
{
|
||||
if( !aHeader.has_document() || aHeader.document().type() != thisDocumentType() )
|
||||
{
|
||||
ApiResponseStatus e;
|
||||
e.set_status( ApiStatusCode::AS_UNHANDLED );
|
||||
// No error message, this is a flag that the server should try a different handler
|
||||
return tl::unexpected( e );
|
||||
}
|
||||
|
||||
HANDLER_RESULT<bool> documentValidation = validateDocument( aHeader.document() );
|
||||
|
||||
if( !documentValidation )
|
||||
return tl::unexpected( documentValidation.error() );
|
||||
|
||||
if( !validateDocumentInternal( aHeader.document() ) )
|
||||
{
|
||||
ApiResponseStatus e;
|
||||
e.set_status( ApiStatusCode::AS_BAD_REQUEST );
|
||||
e.set_error_message( fmt::format( "the requested document {} is not open",
|
||||
aHeader.document().board_filename() ) );
|
||||
return tl::unexpected( e );
|
||||
}
|
||||
|
||||
if( aHeader.has_container() )
|
||||
{
|
||||
return KIID( aHeader.container().value() );
|
||||
}
|
||||
|
||||
// Valid header, but no container provided
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
std::optional<ApiResponseStatus> API_HANDLER_EDITOR::checkForBusy()
|
||||
{
|
||||
if( !m_frame->CanAcceptApiCommands() )
|
||||
{
|
||||
ApiResponseStatus e;
|
||||
e.set_status( ApiStatusCode::AS_BUSY );
|
||||
e.set_error_message( "KiCad is busy and cannot respond to API requests right now" );
|
||||
return e;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<CreateItemsResponse> API_HANDLER_EDITOR::handleCreateItems( CreateItems& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx )
|
||||
{
|
||||
if( std::optional<ApiResponseStatus> busy = checkForBusy() )
|
||||
return tl::unexpected( *busy );
|
||||
|
||||
CreateItemsResponse response;
|
||||
|
||||
HANDLER_RESULT<ItemRequestStatus> result = handleCreateUpdateItemsInternal( true, aCtx,
|
||||
aMsg.header(), aMsg.items(),
|
||||
[&]( const ItemStatus& aStatus, const google::protobuf::Any& aItem )
|
||||
{
|
||||
ItemCreationResult itemResult;
|
||||
itemResult.mutable_status()->CopyFrom( aStatus );
|
||||
itemResult.mutable_item()->CopyFrom( aItem );
|
||||
response.mutable_created_items()->Add( std::move( itemResult ) );
|
||||
} );
|
||||
|
||||
if( !result.has_value() )
|
||||
return tl::unexpected( result.error() );
|
||||
|
||||
response.set_status( *result );
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<UpdateItemsResponse> API_HANDLER_EDITOR::handleUpdateItems( UpdateItems& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx )
|
||||
{
|
||||
if( std::optional<ApiResponseStatus> busy = checkForBusy() )
|
||||
return tl::unexpected( *busy );
|
||||
|
||||
UpdateItemsResponse response;
|
||||
|
||||
HANDLER_RESULT<ItemRequestStatus> result = handleCreateUpdateItemsInternal( false, aCtx,
|
||||
aMsg.header(), aMsg.items(),
|
||||
[&]( const ItemStatus& aStatus, const google::protobuf::Any& aItem )
|
||||
{
|
||||
ItemUpdateResult itemResult;
|
||||
itemResult.mutable_status()->CopyFrom( aStatus );
|
||||
itemResult.mutable_item()->CopyFrom( aItem );
|
||||
response.mutable_updated_items()->Add( std::move( itemResult ) );
|
||||
} );
|
||||
|
||||
if( !result.has_value() )
|
||||
return tl::unexpected( result.error() );
|
||||
|
||||
response.set_status( *result );
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<DeleteItemsResponse> API_HANDLER_EDITOR::handleDeleteItems( DeleteItems& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx )
|
||||
{
|
||||
if( std::optional<ApiResponseStatus> busy = checkForBusy() )
|
||||
return tl::unexpected( *busy );
|
||||
|
||||
if( !validateItemHeaderDocument( aMsg.header() ) )
|
||||
{
|
||||
ApiResponseStatus e;
|
||||
// No message needed for AS_UNHANDLED; this is an internal flag for the API server
|
||||
e.set_status( ApiStatusCode::AS_UNHANDLED );
|
||||
return tl::unexpected( e );
|
||||
}
|
||||
|
||||
std::map<KIID, ItemDeletionStatus> itemsToDelete;
|
||||
|
||||
for( const kiapi::common::types::KIID& kiidBuf : aMsg.item_ids() )
|
||||
{
|
||||
if( !kiidBuf.value().empty() )
|
||||
{
|
||||
KIID kiid( kiidBuf.value() );
|
||||
itemsToDelete[kiid] = ItemDeletionStatus::IDS_NONEXISTENT;
|
||||
}
|
||||
}
|
||||
|
||||
if( itemsToDelete.empty() )
|
||||
{
|
||||
ApiResponseStatus e;
|
||||
e.set_status( ApiStatusCode::AS_BAD_REQUEST );
|
||||
e.set_error_message( "no valid items to delete were given" );
|
||||
return tl::unexpected( e );
|
||||
}
|
||||
|
||||
deleteItemsInternal( itemsToDelete, aCtx );
|
||||
|
||||
DeleteItemsResponse response;
|
||||
|
||||
for( const auto& [id, status] : itemsToDelete )
|
||||
{
|
||||
ItemDeletionResult result;
|
||||
result.mutable_id()->set_value( id.AsStdString() );
|
||||
result.set_status( status );
|
||||
}
|
||||
|
||||
response.set_status( kiapi::common::types::ItemRequestStatus::IRS_OK );
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<HitTestResponse> API_HANDLER_EDITOR::handleHitTest( HitTest& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx )
|
||||
{
|
||||
if( std::optional<ApiResponseStatus> busy = checkForBusy() )
|
||||
return tl::unexpected( *busy );
|
||||
|
||||
if( !validateItemHeaderDocument( aMsg.header() ) )
|
||||
{
|
||||
ApiResponseStatus e;
|
||||
// No message needed for AS_UNHANDLED; this is an internal flag for the API server
|
||||
e.set_status( ApiStatusCode::AS_UNHANDLED );
|
||||
return tl::unexpected( e );
|
||||
}
|
||||
|
||||
HitTestResponse response;
|
||||
|
||||
std::optional<EDA_ITEM*> item = getItemFromDocument( aMsg.header().document(),
|
||||
KIID( aMsg.id().value() ) );
|
||||
|
||||
if( !item )
|
||||
{
|
||||
ApiResponseStatus e;
|
||||
e.set_status( ApiStatusCode::AS_BAD_REQUEST );
|
||||
e.set_error_message( "the requested item ID is not present in the given document" );
|
||||
return tl::unexpected( e );
|
||||
}
|
||||
|
||||
if( ( *item )->HitTest( kiapi::common::UnpackVector2( aMsg.position() ), aMsg.tolerance() ) )
|
||||
response.set_result( HitTestResult::HTR_HIT );
|
||||
else
|
||||
response.set_result( HitTestResult::HTR_NO_HIT );
|
||||
|
||||
return response;
|
||||
}
|
||||
@@ -1,332 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <wx/log.h>
|
||||
#include <wx/regex.h>
|
||||
#include <wx/stdstream.h>
|
||||
#include <wx/wfstream.h>
|
||||
|
||||
#include <api/api_plugin.h>
|
||||
#include <api/api_plugin_manager.h>
|
||||
#include <json_conversions.h>
|
||||
|
||||
|
||||
bool PLUGIN_RUNTIME::FromJson( const nlohmann::json& aJson )
|
||||
{
|
||||
// TODO move to tl::expected and give user feedback about parse errors
|
||||
|
||||
try
|
||||
{
|
||||
type = magic_enum::enum_cast<PLUGIN_RUNTIME_TYPE>( aJson.at( "type" ).get<std::string>(),
|
||||
magic_enum::case_insensitive )
|
||||
.value_or( PLUGIN_RUNTIME_TYPE::INVALID );
|
||||
|
||||
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return type != PLUGIN_RUNTIME_TYPE::INVALID;
|
||||
}
|
||||
|
||||
|
||||
struct API_PLUGIN_CONFIG
|
||||
{
|
||||
API_PLUGIN_CONFIG( API_PLUGIN& aParent, const wxFileName& aConfigFile );
|
||||
|
||||
bool valid;
|
||||
wxString identifier;
|
||||
wxString name;
|
||||
wxString description;
|
||||
PLUGIN_RUNTIME runtime;
|
||||
std::vector<PLUGIN_ACTION> actions;
|
||||
|
||||
API_PLUGIN& parent;
|
||||
};
|
||||
|
||||
|
||||
API_PLUGIN_CONFIG::API_PLUGIN_CONFIG( API_PLUGIN& aParent, const wxFileName& aConfigFile ) :
|
||||
parent( aParent )
|
||||
{
|
||||
valid = false;
|
||||
|
||||
if( !aConfigFile.IsFileReadable() )
|
||||
return;
|
||||
|
||||
wxLogTrace( traceApi, "Plugin: parsing config file" );
|
||||
|
||||
wxFFileInputStream fp( aConfigFile.GetFullPath(), wxT( "rt" ) );
|
||||
wxStdInputStream fstream( fp );
|
||||
|
||||
nlohmann::json js;
|
||||
|
||||
try
|
||||
{
|
||||
js = nlohmann::json::parse( fstream, nullptr,
|
||||
/* allow_exceptions = */ true,
|
||||
/* ignore_comments = */ true );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
wxLogTrace( traceApi, "Plugin: exception during parse" );
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO add schema and validate
|
||||
|
||||
// All of these are required; any exceptions here leave us with valid == false
|
||||
try
|
||||
{
|
||||
identifier = js.at( "identifier" ).get<wxString>();
|
||||
name = js.at( "name" ).get<wxString>();
|
||||
description = js.at( "description" ).get<wxString>();
|
||||
|
||||
if( !runtime.FromJson( js.at( "runtime" ) ) )
|
||||
{
|
||||
wxLogTrace( traceApi, "Plugin: error parsing runtime section" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
wxLogTrace( traceApi, "Plugin: exception while parsing required keys" );
|
||||
return;
|
||||
}
|
||||
|
||||
// At minimum, we need a reverse-DNS style identifier with two dots and a 2+ character TLD
|
||||
wxRegEx identifierRegex( wxS( "[\\w\\d]{2,}\\.[\\w\\d]+\\.[\\w\\d]+" ) );
|
||||
|
||||
if( !identifierRegex.Matches( identifier ) )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Plugin: identifier %s does not meet requirements",
|
||||
identifier ) );
|
||||
return;
|
||||
}
|
||||
|
||||
wxLogTrace( traceApi, wxString::Format( "Plugin: %s (%s)", identifier, name ) );
|
||||
|
||||
try
|
||||
{
|
||||
const nlohmann::json& actionsJs = js.at( "actions" );
|
||||
|
||||
if( actionsJs.is_array() )
|
||||
{
|
||||
for( const nlohmann::json& actionJs : actionsJs )
|
||||
{
|
||||
if( std::optional<PLUGIN_ACTION> a = parent.createActionFromJson( actionJs ) )
|
||||
{
|
||||
a->identifier = wxString::Format( "%s.%s", identifier, a->identifier );
|
||||
wxLogTrace( traceApi, wxString::Format( "Plugin: loaded action %s",
|
||||
a->identifier ) );
|
||||
actions.emplace_back( *a );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
wxLogTrace( traceApi, "Plugin: exception while parsing actions" );
|
||||
}
|
||||
|
||||
valid = true;
|
||||
}
|
||||
|
||||
|
||||
API_PLUGIN::API_PLUGIN( const wxFileName& aConfigFile ) :
|
||||
m_configFile( aConfigFile ),
|
||||
m_config( std::make_unique<API_PLUGIN_CONFIG>( *this, aConfigFile ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
API_PLUGIN::~API_PLUGIN()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool API_PLUGIN::IsOk() const
|
||||
{
|
||||
return m_config->valid;
|
||||
}
|
||||
|
||||
|
||||
const wxString& API_PLUGIN::Identifier() const
|
||||
{
|
||||
return m_config->identifier;
|
||||
}
|
||||
|
||||
|
||||
const wxString& API_PLUGIN::Name() const
|
||||
{
|
||||
return m_config->name;
|
||||
}
|
||||
|
||||
|
||||
const wxString& API_PLUGIN::Description() const
|
||||
{
|
||||
return m_config->description;
|
||||
}
|
||||
|
||||
|
||||
const PLUGIN_RUNTIME& API_PLUGIN::Runtime() const
|
||||
{
|
||||
return m_config->runtime;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<PLUGIN_ACTION>& API_PLUGIN::Actions() const
|
||||
{
|
||||
return m_config->actions;
|
||||
}
|
||||
|
||||
|
||||
wxString API_PLUGIN::BasePath() const
|
||||
{
|
||||
return m_configFile.GetPath();
|
||||
}
|
||||
|
||||
|
||||
std::optional<PLUGIN_ACTION> API_PLUGIN::createActionFromJson( const nlohmann::json& aJson )
|
||||
{
|
||||
// TODO move to tl::expected and give user feedback about parse errors
|
||||
PLUGIN_ACTION action( *this );
|
||||
|
||||
try
|
||||
{
|
||||
action.identifier = aJson.at( "identifier" ).get<wxString>();
|
||||
wxLogTrace( traceApi, wxString::Format( "Plugin: load action %s", action.identifier ) );
|
||||
action.name = aJson.at( "name" ).get<wxString>();
|
||||
action.description = aJson.at( "description" ).get<wxString>();
|
||||
action.entrypoint = aJson.at( "entrypoint" ).get<wxString>();
|
||||
action.show_button = aJson.contains( "show-button" ) && aJson.at( "show-button" ).get<bool>();
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
wxLogTrace( traceApi, "Plugin: exception while parsing action required keys" );
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
wxFileName f( action.entrypoint );
|
||||
|
||||
if( !f.IsRelative() )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Plugin: action contains abs path %s; skipping",
|
||||
action.entrypoint ) );
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
f.Normalize( wxPATH_NORM_ABSOLUTE, m_configFile.GetPath() );
|
||||
|
||||
if( !f.IsFileReadable() )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "WARNING: action entrypoint %s is not readable",
|
||||
f.GetFullPath() ) );
|
||||
}
|
||||
|
||||
if( aJson.contains( "args" ) && aJson.at( "args" ).is_array() )
|
||||
{
|
||||
for( const nlohmann::json& argJs : aJson.at( "args" ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
action.args.emplace_back( argJs.get<wxString>() );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
wxLogTrace( traceApi, "Plugin: exception while parsing action args" );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( aJson.contains( "scopes" ) && aJson.at( "scopes" ).is_array() )
|
||||
{
|
||||
for( const nlohmann::json& scopeJs : aJson.at( "scopes" ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
action.scopes.insert( magic_enum::enum_cast<PLUGIN_ACTION_SCOPE>(
|
||||
scopeJs.get<std::string>(), magic_enum::case_insensitive )
|
||||
.value_or( PLUGIN_ACTION_SCOPE::INVALID ) );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
wxLogTrace( traceApi, "Plugin: exception while parsing action scopes" );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto handleBitmap =
|
||||
[&]( const std::string& aKey, wxBitmapBundle& aDest )
|
||||
{
|
||||
if( aJson.contains( aKey ) && aJson.at( aKey ).is_array() )
|
||||
{
|
||||
wxVector<wxBitmap> bitmaps;
|
||||
|
||||
for( const nlohmann::json& iconJs : aJson.at( aKey ) )
|
||||
{
|
||||
wxFileName iconFile;
|
||||
|
||||
try
|
||||
{
|
||||
iconFile = iconJs.get<wxString>();
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
iconFile.Normalize( wxPATH_NORM_ABSOLUTE, m_configFile.GetPath() );
|
||||
|
||||
wxLogTrace( traceApi,
|
||||
wxString::Format( "Plugin: action %s: loading icon %s",
|
||||
action.identifier, iconFile.GetFullPath() ) );
|
||||
|
||||
|
||||
if( !iconFile.IsFileReadable() )
|
||||
{
|
||||
wxLogTrace( traceApi, "Plugin: icon file could not be read" );
|
||||
continue;
|
||||
}
|
||||
|
||||
wxBitmap bmp;
|
||||
// TODO: If necessary; support types other than PNG
|
||||
bmp.LoadFile( iconFile.GetFullPath(), wxBITMAP_TYPE_PNG );
|
||||
|
||||
if( bmp.IsOk() )
|
||||
bitmaps.push_back( bmp );
|
||||
else
|
||||
wxLogTrace( traceApi, "Plugin: icon file not a valid bitmap" );
|
||||
}
|
||||
|
||||
aDest = wxBitmapBundle::FromBitmaps( bitmaps );
|
||||
}
|
||||
};
|
||||
|
||||
handleBitmap( "icons-light", action.icon_light );
|
||||
handleBitmap( "icons-dark", action.icon_dark );
|
||||
|
||||
return action;
|
||||
}
|
||||
@@ -1,420 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/utils.h>
|
||||
|
||||
#include <api/api_plugin_manager.h>
|
||||
#include <api/api_server.h>
|
||||
#include <paths.h>
|
||||
#include <pgm_base.h>
|
||||
#include <python_manager.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <settings/common_settings.h>
|
||||
|
||||
const wxChar* const traceApi = wxT( "KICAD_API" );
|
||||
|
||||
|
||||
wxDEFINE_EVENT( EDA_EVT_PLUGIN_MANAGER_JOB_FINISHED, wxCommandEvent );
|
||||
wxDEFINE_EVENT( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, wxCommandEvent );
|
||||
|
||||
|
||||
API_PLUGIN_MANAGER::API_PLUGIN_MANAGER( wxEvtHandler* aEvtHandler ) :
|
||||
wxEvtHandler(),
|
||||
m_parent( aEvtHandler )
|
||||
{
|
||||
Bind( EDA_EVT_PLUGIN_MANAGER_JOB_FINISHED, &API_PLUGIN_MANAGER::processNextJob, this );
|
||||
}
|
||||
|
||||
|
||||
class PLUGIN_TRAVERSER : public wxDirTraverser
|
||||
{
|
||||
private:
|
||||
std::function<void( const wxFileName& )> m_action;
|
||||
|
||||
public:
|
||||
explicit PLUGIN_TRAVERSER( std::function<void( const wxFileName& )> aAction )
|
||||
: m_action( std::move( aAction ) )
|
||||
{
|
||||
}
|
||||
|
||||
wxDirTraverseResult OnFile( const wxString& aFilePath ) override
|
||||
{
|
||||
wxFileName file( aFilePath );
|
||||
|
||||
if( file.GetFullName() == wxS( "plugin.json" ) )
|
||||
m_action( file );
|
||||
|
||||
return wxDIR_CONTINUE;
|
||||
}
|
||||
|
||||
wxDirTraverseResult OnDir( const wxString& dirPath ) override
|
||||
{
|
||||
return wxDIR_CONTINUE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void API_PLUGIN_MANAGER::ReloadPlugins()
|
||||
{
|
||||
m_plugins.clear();
|
||||
m_pluginsCache.clear();
|
||||
m_actionsCache.clear();
|
||||
m_environmentCache.clear();
|
||||
m_buttonBindings.clear();
|
||||
m_menuBindings.clear();
|
||||
m_readyPlugins.clear();
|
||||
|
||||
// TODO support system-provided plugins
|
||||
wxDir userPluginsDir( PATHS::GetUserPluginsPath() );
|
||||
|
||||
PLUGIN_TRAVERSER loader(
|
||||
[&]( const wxFileName& aFile )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: loading plugin from %s",
|
||||
aFile.GetFullPath() ) );
|
||||
|
||||
auto plugin = std::make_unique<API_PLUGIN>( aFile );
|
||||
|
||||
if( plugin->IsOk() )
|
||||
{
|
||||
if( m_pluginsCache.count( plugin->Identifier() ) )
|
||||
{
|
||||
wxLogTrace( traceApi,
|
||||
wxString::Format( "Manager: identifier %s already present!",
|
||||
plugin->Identifier() ) );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pluginsCache[plugin->Identifier()] = plugin.get();
|
||||
}
|
||||
|
||||
for( const PLUGIN_ACTION& action : plugin->Actions() )
|
||||
m_actionsCache[action.identifier] = &action;
|
||||
|
||||
m_plugins.insert( std::move( plugin ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( traceApi, "Manager: loading failed" );
|
||||
}
|
||||
} );
|
||||
|
||||
if( userPluginsDir.IsOpened() )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: scanning user path (%s) for plugins...",
|
||||
userPluginsDir.GetName() ) );
|
||||
userPluginsDir.Traverse( loader );
|
||||
processPluginDependencies();
|
||||
}
|
||||
|
||||
wxCommandEvent* evt = new wxCommandEvent( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, wxID_ANY );
|
||||
m_parent->QueueEvent( evt );
|
||||
}
|
||||
|
||||
|
||||
void API_PLUGIN_MANAGER::InvokeAction( const wxString& aIdentifier )
|
||||
{
|
||||
if( !m_actionsCache.count( aIdentifier ) )
|
||||
return;
|
||||
|
||||
const PLUGIN_ACTION* action = m_actionsCache.at( aIdentifier );
|
||||
const API_PLUGIN& plugin = action->plugin;
|
||||
|
||||
if( !m_readyPlugins.count( plugin.Identifier() ) )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: Plugin %s is not ready",
|
||||
plugin.Identifier() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
wxFileName pluginFile( plugin.BasePath(), action->entrypoint );
|
||||
pluginFile.Normalize( wxPATH_NORM_ABSOLUTE | wxPATH_NORM_SHORTCUT | wxPATH_NORM_DOTS
|
||||
| wxPATH_NORM_TILDE, plugin.BasePath() );
|
||||
wxString pluginPath = pluginFile.GetFullPath();
|
||||
|
||||
std::vector<const wchar_t*> args;
|
||||
std::optional<wxString> py;
|
||||
|
||||
switch( plugin.Runtime().type )
|
||||
{
|
||||
case PLUGIN_RUNTIME_TYPE::PYTHON:
|
||||
{
|
||||
py = PYTHON_MANAGER::GetVirtualPython( plugin.Identifier() );
|
||||
|
||||
if( !py )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: Python interpreter for %s not found",
|
||||
plugin.Identifier() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
args.push_back( py->wc_str() );
|
||||
|
||||
if( !pluginFile.IsFileReadable() )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: Python entrypoint %s is not readable",
|
||||
pluginFile.GetFullPath() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PLUGIN_RUNTIME_TYPE::EXEC:
|
||||
{
|
||||
if( !pluginFile.IsFileExecutable() )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: Exec entrypoint %s is not executable",
|
||||
pluginFile.GetFullPath() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
};
|
||||
|
||||
default:
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: unhandled runtime for action %s",
|
||||
action->identifier ) );
|
||||
return;
|
||||
}
|
||||
|
||||
args.emplace_back( pluginPath.wc_str() );
|
||||
|
||||
for( const wxString& arg : action->args )
|
||||
args.emplace_back( arg.wc_str() );
|
||||
|
||||
args.emplace_back( nullptr );
|
||||
|
||||
wxExecuteEnv env;
|
||||
wxGetEnvMap( &env.env );
|
||||
env.env[ wxS( "KICAD_API_SOCKET" ) ] = Pgm().GetApiServer().SocketPath();
|
||||
env.env[ wxS( "KICAD_API_TOKEN" ) ] = Pgm().GetApiServer().Token();
|
||||
env.cwd = pluginFile.GetPath();
|
||||
|
||||
long p = wxExecute( const_cast<wchar_t**>( args.data() ), wxEXEC_ASYNC, nullptr, &env );
|
||||
|
||||
if( !p )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: launching action %s failed",
|
||||
action->identifier ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: launching action %s -> pid %ld",
|
||||
action->identifier, p ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::vector<const PLUGIN_ACTION*> API_PLUGIN_MANAGER::GetActionsForScope( PLUGIN_ACTION_SCOPE aScope )
|
||||
{
|
||||
std::vector<const PLUGIN_ACTION*> actions;
|
||||
|
||||
for( auto& [identifier, action] : m_actionsCache )
|
||||
{
|
||||
if( !m_readyPlugins.count( action->plugin.Identifier() ) )
|
||||
continue;
|
||||
|
||||
if( action->scopes.count( aScope ) )
|
||||
actions.emplace_back( action );
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
void API_PLUGIN_MANAGER::processPluginDependencies()
|
||||
{
|
||||
for( const std::unique_ptr<API_PLUGIN>& plugin : m_plugins )
|
||||
{
|
||||
m_environmentCache[plugin->Identifier()] = wxEmptyString;
|
||||
|
||||
if( plugin->Runtime().type != PLUGIN_RUNTIME_TYPE::PYTHON )
|
||||
{
|
||||
m_readyPlugins.insert( plugin->Identifier() );
|
||||
continue;
|
||||
}
|
||||
|
||||
std::optional<wxString> env = PYTHON_MANAGER::GetPythonEnvironment( plugin->Identifier() );
|
||||
|
||||
if( !env )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: could not create env for %s",
|
||||
plugin->Identifier() ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
wxFileName envConfigPath( *env, wxS( "pyvenv.cfg" ) );
|
||||
|
||||
if( envConfigPath.IsFileReadable() )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: Python env for %s exists at %s",
|
||||
plugin->Identifier(), *env ) );
|
||||
JOB job;
|
||||
job.type = JOB_TYPE::INSTALL_REQUIREMENTS;
|
||||
job.identifier = plugin->Identifier();
|
||||
job.plugin_path = plugin->BasePath();
|
||||
job.env_path = *env;
|
||||
m_jobs.emplace_back( job );
|
||||
continue;
|
||||
}
|
||||
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: will create Python env for %s at %s",
|
||||
plugin->Identifier(), *env ) );
|
||||
JOB job;
|
||||
job.type = JOB_TYPE::CREATE_ENV;
|
||||
job.identifier = plugin->Identifier();
|
||||
job.plugin_path = plugin->BasePath();
|
||||
job.env_path = *env;
|
||||
m_jobs.emplace_back( job );
|
||||
}
|
||||
|
||||
wxCommandEvent evt;
|
||||
processNextJob( evt );
|
||||
}
|
||||
|
||||
|
||||
void API_PLUGIN_MANAGER::processNextJob( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( m_jobs.empty() )
|
||||
{
|
||||
wxLogTrace( traceApi, "Manager: cleared job queue" );
|
||||
return;
|
||||
}
|
||||
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: begin processing; %zu jobs left in queue",
|
||||
m_jobs.size() ) );
|
||||
|
||||
JOB& job = m_jobs.front();
|
||||
|
||||
if( job.type == JOB_TYPE::CREATE_ENV )
|
||||
{
|
||||
wxLogTrace( traceApi, "Manager: Python exe '%s'",
|
||||
Pgm().GetCommonSettings()->m_Api.python_interpreter );
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: creating Python env at %s",
|
||||
job.env_path ) );
|
||||
PYTHON_MANAGER manager( Pgm().GetCommonSettings()->m_Api.python_interpreter );
|
||||
|
||||
manager.Execute(
|
||||
wxString::Format( wxS( "-m venv %s" ), job.env_path ),
|
||||
[this]( int aRetVal, const wxString& aOutput, const wxString& aError )
|
||||
{
|
||||
wxLogTrace( traceApi,
|
||||
wxString::Format( "Manager: venv (%d): %s", aRetVal, aOutput ) );
|
||||
|
||||
if( !aError.IsEmpty() )
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: venv err: %s", aError ) );
|
||||
|
||||
wxCommandEvent* evt =
|
||||
new wxCommandEvent( EDA_EVT_PLUGIN_MANAGER_JOB_FINISHED, wxID_ANY );
|
||||
QueueEvent( evt );
|
||||
} );
|
||||
}
|
||||
else if( job.type == JOB_TYPE::INSTALL_REQUIREMENTS )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: installing dependencies for %s",
|
||||
job.plugin_path ) );
|
||||
|
||||
std::optional<wxString> pythonHome = PYTHON_MANAGER::GetPythonEnvironment( job.identifier );
|
||||
std::optional<wxString> python = PYTHON_MANAGER::GetVirtualPython( job.identifier );
|
||||
wxFileName reqs = wxFileName( job.plugin_path, "requirements.txt" );
|
||||
|
||||
if( !python )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: error: python not found at %s",
|
||||
job.env_path ) );
|
||||
}
|
||||
else if( !reqs.IsFileReadable() )
|
||||
{
|
||||
wxLogTrace( traceApi,
|
||||
wxString::Format( "Manager: error: requirements.txt not found at %s",
|
||||
job.plugin_path ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( traceApi, "Manager: Python exe '%s'", *python );
|
||||
|
||||
PYTHON_MANAGER manager( *python );
|
||||
wxExecuteEnv env;
|
||||
|
||||
if( pythonHome )
|
||||
env.env[wxS( "VIRTUAL_ENV" )] = *pythonHome;
|
||||
|
||||
wxString cmd = wxS( "-m ensurepip" );
|
||||
wxLogTrace( traceApi, "Manager: calling python `%s`", cmd );
|
||||
|
||||
manager.Execute( cmd,
|
||||
[=]( int aRetVal, const wxString& aOutput, const wxString& aError )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: ensurepip (%d): %s",
|
||||
aRetVal, aOutput ) );
|
||||
|
||||
if( !aError.IsEmpty() )
|
||||
{
|
||||
wxLogTrace( traceApi,
|
||||
wxString::Format( "Manager: ensurepip err: %s", aError ) );
|
||||
}
|
||||
}, &env );
|
||||
|
||||
cmd = wxString::Format(
|
||||
wxS( "-m pip install --no-input --isolated --require-virtualenv "
|
||||
"--exists-action i -r '%s'" ),
|
||||
reqs.GetFullPath() );
|
||||
|
||||
wxLogTrace( traceApi, "Manager: calling python `%s`", cmd );
|
||||
|
||||
manager.Execute( cmd,
|
||||
[this, job]( int aRetVal, const wxString& aOutput, const wxString& aError )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: pip (%d): %s",
|
||||
aRetVal, aOutput ) );
|
||||
|
||||
if( !aError.IsEmpty() )
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: pip err: %s", aError ) );
|
||||
|
||||
if( aRetVal == 0 )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: marking %s as ready",
|
||||
job.identifier ) );
|
||||
m_readyPlugins.insert( job.identifier );
|
||||
wxCommandEvent* availabilityEvt =
|
||||
new wxCommandEvent( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, wxID_ANY );
|
||||
wxTheApp->QueueEvent( availabilityEvt );
|
||||
}
|
||||
|
||||
wxCommandEvent* evt = new wxCommandEvent( EDA_EVT_PLUGIN_MANAGER_JOB_FINISHED,
|
||||
wxID_ANY );
|
||||
|
||||
QueueEvent( evt );
|
||||
}, &env );
|
||||
}
|
||||
|
||||
wxCommandEvent* evt = new wxCommandEvent( EDA_EVT_PLUGIN_MANAGER_JOB_FINISHED, wxID_ANY );
|
||||
QueueEvent( evt );
|
||||
}
|
||||
|
||||
m_jobs.pop_front();
|
||||
wxLogTrace( traceApi, wxString::Format( "Manager: done processing; %zu jobs left in queue",
|
||||
m_jobs.size() ) );
|
||||
}
|
||||
@@ -1,274 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2023 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/>.
|
||||
*/
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/datetime.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
#include <advanced_config.h>
|
||||
#include <api/api_plugin_manager.h> // traceApi
|
||||
#include <api/api_server.h>
|
||||
#include <api/api_handler_common.h>
|
||||
#include <kiid.h>
|
||||
#include <kinng.h>
|
||||
#include <paths.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <string_utils.h>
|
||||
|
||||
#include <api/common/envelope.pb.h>
|
||||
|
||||
using kiapi::common::ApiRequest, kiapi::common::ApiResponse, kiapi::common::ApiStatusCode;
|
||||
|
||||
|
||||
wxString KICAD_API_SERVER::s_logFileName = "api.log";
|
||||
|
||||
|
||||
wxDEFINE_EVENT( API_REQUEST_EVENT, wxCommandEvent );
|
||||
|
||||
|
||||
KICAD_API_SERVER::KICAD_API_SERVER() :
|
||||
wxEvtHandler(),
|
||||
m_token( KIID().AsStdString() ),
|
||||
m_readyToReply( false )
|
||||
{
|
||||
m_commonHandler = std::make_unique<API_HANDLER_COMMON>();
|
||||
RegisterHandler( m_commonHandler.get() );
|
||||
|
||||
if( !Pgm().GetCommonSettings()->m_Api.enable_server )
|
||||
{
|
||||
wxLogTrace( traceApi, "Server: disabled by user preferences." );
|
||||
return;
|
||||
}
|
||||
|
||||
Start();
|
||||
}
|
||||
|
||||
|
||||
KICAD_API_SERVER::~KICAD_API_SERVER()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void KICAD_API_SERVER::Start()
|
||||
{
|
||||
if( Running() )
|
||||
return;
|
||||
|
||||
wxFileName socket;
|
||||
#ifdef __WXMAC__
|
||||
socket.AssignDir( wxS( "/tmp" ) );
|
||||
#else
|
||||
socket.AssignDir( wxStandardPaths::Get().GetTempDir() );
|
||||
#endif
|
||||
socket.AppendDir( wxS( "kicad" ) );
|
||||
socket.SetFullName( wxS( "api.sock" ) );
|
||||
|
||||
if( !PATHS::EnsurePathExists( socket.GetPath() ) )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Server: socket path %s could not be created",
|
||||
socket.GetPath() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( socket.FileExists() )
|
||||
{
|
||||
socket.SetFullName( wxString::Format( wxS( "api-%ul.sock" ), ::wxGetProcessId() ) );
|
||||
|
||||
if( socket.FileExists() )
|
||||
{
|
||||
wxLogTrace( traceApi, wxString::Format( "Server: PID socket path %s already exists!",
|
||||
socket.GetFullPath() ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_server = std::make_unique<KINNG_REQUEST_SERVER>(
|
||||
fmt::format( "ipc://{}", socket.GetFullPath().ToStdString() ) );
|
||||
m_server->SetCallback( [&]( std::string* aRequest ) { onApiRequest( aRequest ); } );
|
||||
|
||||
m_logFilePath.AssignDir( PATHS::GetLogsPath() );
|
||||
m_logFilePath.SetName( s_logFileName );
|
||||
|
||||
if( ADVANCED_CFG::GetCfg().m_EnableAPILogging )
|
||||
{
|
||||
PATHS::EnsurePathExists( PATHS::GetLogsPath() );
|
||||
log( fmt::format( "--- KiCad API server started at {} ---\n", SocketPath() ) );
|
||||
}
|
||||
|
||||
wxLogTrace( traceApi, wxString::Format( "Server: listening at %s", SocketPath() ) );
|
||||
|
||||
Bind( API_REQUEST_EVENT, &KICAD_API_SERVER::handleApiEvent, this );
|
||||
}
|
||||
|
||||
|
||||
void KICAD_API_SERVER::Stop()
|
||||
{
|
||||
if( !Running() )
|
||||
return;
|
||||
|
||||
wxLogTrace( traceApi, "Stopping server" );
|
||||
Unbind( API_REQUEST_EVENT, &KICAD_API_SERVER::handleApiEvent, this );
|
||||
|
||||
m_server->Stop();
|
||||
m_server.reset( nullptr );
|
||||
}
|
||||
|
||||
|
||||
bool KICAD_API_SERVER::Running() const
|
||||
{
|
||||
return m_server && m_server->Running();
|
||||
}
|
||||
|
||||
|
||||
void KICAD_API_SERVER::RegisterHandler( API_HANDLER* aHandler )
|
||||
{
|
||||
wxCHECK( aHandler, /* void */ );
|
||||
m_handlers.insert( aHandler );
|
||||
}
|
||||
|
||||
|
||||
void KICAD_API_SERVER::DeregisterHandler( API_HANDLER* aHandler )
|
||||
{
|
||||
m_handlers.erase( aHandler );
|
||||
}
|
||||
|
||||
|
||||
std::string KICAD_API_SERVER::SocketPath() const
|
||||
{
|
||||
return m_server ? m_server->SocketPath() : "";
|
||||
}
|
||||
|
||||
|
||||
void KICAD_API_SERVER::onApiRequest( std::string* aRequest )
|
||||
{
|
||||
if( !m_readyToReply )
|
||||
{
|
||||
ApiResponse notHandled;
|
||||
notHandled.mutable_status()->set_status( ApiStatusCode::AS_NOT_READY );
|
||||
notHandled.mutable_status()->set_error_message( "KiCad is not ready to reply" );
|
||||
m_server->Reply( notHandled.SerializeAsString() );
|
||||
log( "Got incoming request but was not yet ready to reply." );
|
||||
return;
|
||||
}
|
||||
|
||||
wxCommandEvent* evt = new wxCommandEvent( API_REQUEST_EVENT );
|
||||
|
||||
// We don't actually need write access to this string, but client data is non-const
|
||||
evt->SetClientData( static_cast<void*>( aRequest ) );
|
||||
|
||||
// Takes ownership and frees the wxCommandEvent
|
||||
QueueEvent( evt );
|
||||
}
|
||||
|
||||
|
||||
void KICAD_API_SERVER::handleApiEvent( wxCommandEvent& aEvent )
|
||||
{
|
||||
std::string& requestString = *static_cast<std::string*>( aEvent.GetClientData() );
|
||||
ApiRequest request;
|
||||
|
||||
if( !request.ParseFromString( requestString ) )
|
||||
{
|
||||
ApiResponse error;
|
||||
error.mutable_header()->set_kicad_token( m_token );
|
||||
error.mutable_status()->set_status( ApiStatusCode::AS_BAD_REQUEST );
|
||||
error.mutable_status()->set_error_message( "request could not be parsed" );
|
||||
m_server->Reply( error.SerializeAsString() );
|
||||
|
||||
if( ADVANCED_CFG::GetCfg().m_EnableAPILogging )
|
||||
log( "Response (ERROR): " + error.Utf8DebugString() );
|
||||
}
|
||||
|
||||
if( ADVANCED_CFG::GetCfg().m_EnableAPILogging )
|
||||
log( "Request: " + request.Utf8DebugString() );
|
||||
|
||||
if( !request.header().kicad_token().empty() &&
|
||||
request.header().kicad_token().compare( m_token ) != 0 )
|
||||
{
|
||||
ApiResponse error;
|
||||
error.mutable_header()->set_kicad_token( m_token );
|
||||
error.mutable_status()->set_status( ApiStatusCode::AS_TOKEN_MISMATCH );
|
||||
error.mutable_status()->set_error_message(
|
||||
"the provided kicad_token did not match this KiCad instance's token" );
|
||||
m_server->Reply( error.SerializeAsString() );
|
||||
|
||||
if( ADVANCED_CFG::GetCfg().m_EnableAPILogging )
|
||||
log( "Response (ERROR): " + error.Utf8DebugString() );
|
||||
}
|
||||
|
||||
API_RESULT result;
|
||||
|
||||
for( API_HANDLER* handler : m_handlers )
|
||||
{
|
||||
result = handler->Handle( request );
|
||||
|
||||
if( result.has_value() )
|
||||
break;
|
||||
else if( result.error().status() != ApiStatusCode::AS_UNHANDLED )
|
||||
break;
|
||||
}
|
||||
|
||||
// Note: at the point we call Reply(), we no longer own requestString.
|
||||
|
||||
if( result.has_value() )
|
||||
{
|
||||
result->mutable_header()->set_kicad_token( m_token );
|
||||
m_server->Reply( result->SerializeAsString() );
|
||||
|
||||
if( ADVANCED_CFG::GetCfg().m_EnableAPILogging )
|
||||
log( "Response: " + result->Utf8DebugString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
ApiResponse error;
|
||||
error.mutable_status()->CopyFrom( result.error() );
|
||||
error.mutable_header()->set_kicad_token( m_token );
|
||||
|
||||
if( result.error().status() == ApiStatusCode::AS_UNHANDLED )
|
||||
{
|
||||
std::string type = "<unparseable Any>";
|
||||
google::protobuf::Any::ParseAnyTypeUrl( request.message().type_url(), &type );
|
||||
std::string msg = fmt::format( "no handler available for request of type {}", type );
|
||||
error.mutable_status()->set_error_message( msg );
|
||||
}
|
||||
|
||||
m_server->Reply( error.SerializeAsString() );
|
||||
|
||||
if( ADVANCED_CFG::GetCfg().m_EnableAPILogging )
|
||||
log( "Response (ERROR): " + error.Utf8DebugString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KICAD_API_SERVER::log( const std::string& aOutput )
|
||||
{
|
||||
FILE* fp = wxFopen( m_logFilePath.GetFullPath(), wxT( "a" ) );
|
||||
|
||||
if( !fp )
|
||||
return;
|
||||
|
||||
wxString out;
|
||||
wxDateTime now = wxDateTime::Now();
|
||||
|
||||
fprintf( fp, "%s", TO_UTF8( out.Format( wxS( "%s: %s" ),
|
||||
now.FormatISOCombined(), aOutput ) ) );
|
||||
fclose( fp );
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2023 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/>.
|
||||
*/
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <api/api_utils.h>
|
||||
|
||||
namespace kiapi::common
|
||||
{
|
||||
|
||||
std::optional<KICAD_T> TypeNameFromAny( const google::protobuf::Any& aMessage )
|
||||
{
|
||||
static const std::map<std::string, KICAD_T> s_types = {
|
||||
{ "type.googleapis.com/kiapi.board.types.Track", PCB_TRACE_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.Arc", PCB_ARC_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.Via", PCB_VIA_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.Text", PCB_TEXT_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.TextBox", PCB_TEXTBOX_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.GraphicShape", PCB_SHAPE_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.Pad", PCB_PAD_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.Zone", PCB_ZONE_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.Dimension", PCB_DIMENSION_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.ReferenceImage", PCB_REFERENCE_IMAGE_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.Group", PCB_GROUP_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.Field", PCB_FIELD_T },
|
||||
{ "type.googleapis.com/kiapi.board.types.FootprintInstance", PCB_FOOTPRINT_T },
|
||||
};
|
||||
|
||||
auto it = s_types.find( aMessage.type_url() );
|
||||
|
||||
if( it != s_types.end() )
|
||||
return it->second;
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
LIB_ID LibIdFromProto( const types::LibraryIdentifier& aId )
|
||||
{
|
||||
return LIB_ID( aId.library_nickname(), aId.entry_name() );
|
||||
}
|
||||
|
||||
|
||||
types::LibraryIdentifier LibIdToProto( const LIB_ID& aId )
|
||||
{
|
||||
types::LibraryIdentifier msg;
|
||||
msg.set_library_nickname( aId.GetLibNickname() );
|
||||
msg.set_entry_name( aId.GetLibItemName() );
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
void PackVector2( kiapi::common::types::Vector2& aOutput, const VECTOR2I aInput )
|
||||
{
|
||||
aOutput.set_x_nm( aInput.x );
|
||||
aOutput.set_y_nm( aInput.y );
|
||||
}
|
||||
|
||||
VECTOR2I UnpackVector2( const types::Vector2& aInput )
|
||||
{
|
||||
return VECTOR2I( aInput.x_nm(), aInput.y_nm() );
|
||||
}
|
||||
|
||||
|
||||
void PackPolyLine( kiapi::common::types::PolyLine& aOutput, const SHAPE_LINE_CHAIN& aSlc )
|
||||
{
|
||||
for( int vertex = 0; vertex < aSlc.PointCount(); vertex = aSlc.NextShape( vertex ) )
|
||||
{
|
||||
if( vertex < 0 )
|
||||
break;
|
||||
|
||||
kiapi::common::types::PolyLineNode* node = aOutput.mutable_nodes()->Add();
|
||||
|
||||
if( aSlc.IsPtOnArc( vertex ) )
|
||||
{
|
||||
const SHAPE_ARC& arc = aSlc.Arc( aSlc.ArcIndex( vertex ) );
|
||||
node->mutable_arc()->mutable_start()->set_x_nm( arc.GetP0().x );
|
||||
node->mutable_arc()->mutable_start()->set_y_nm( arc.GetP0().y );
|
||||
node->mutable_arc()->mutable_mid()->set_x_nm( arc.GetArcMid().x );
|
||||
node->mutable_arc()->mutable_mid()->set_y_nm( arc.GetArcMid().y );
|
||||
node->mutable_arc()->mutable_end()->set_x_nm( arc.GetP1().x );
|
||||
node->mutable_arc()->mutable_end()->set_y_nm( arc.GetP1().y );
|
||||
}
|
||||
else
|
||||
{
|
||||
node->mutable_point()->set_x_nm( aSlc.CPoint( vertex ).x );
|
||||
node->mutable_point()->set_y_nm( aSlc.CPoint( vertex ).y );
|
||||
}
|
||||
}
|
||||
|
||||
aOutput.set_closed( aSlc.IsClosed() );
|
||||
}
|
||||
|
||||
|
||||
SHAPE_LINE_CHAIN UnpackPolyLine( const kiapi::common::types::PolyLine& aInput )
|
||||
{
|
||||
SHAPE_LINE_CHAIN slc;
|
||||
|
||||
for( const kiapi::common::types::PolyLineNode& node : aInput.nodes() )
|
||||
{
|
||||
if( node.has_point() )
|
||||
{
|
||||
slc.Append( VECTOR2I( node.point().x_nm(), node.point().y_nm() ) );
|
||||
}
|
||||
else if( node.has_arc() )
|
||||
{
|
||||
slc.Append( SHAPE_ARC( VECTOR2I( node.arc().start().x_nm(), node.arc().start().y_nm() ),
|
||||
VECTOR2I( node.arc().mid().x_nm(), node.arc().mid().y_nm() ),
|
||||
VECTOR2I( node.arc().end().x_nm(), node.arc().end().y_nm() ),
|
||||
0 /* don't care about width here */ ) );
|
||||
}
|
||||
}
|
||||
|
||||
slc.SetClosed( aInput.closed() );
|
||||
|
||||
return slc;
|
||||
}
|
||||
|
||||
} // namespace kiapi::common
|
||||
@@ -209,7 +209,7 @@ void BACKGROUND_JOB_REPORTER::AdvancePhase()
|
||||
}
|
||||
|
||||
|
||||
BACKGROUND_JOBS_MONITOR::BACKGROUND_JOBS_MONITOR()
|
||||
BACKGROUND_JOBS_MONITOR::BACKGROUND_JOBS_MONITOR() : m_jobListDialog( nullptr )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -86,9 +86,9 @@ const wxString& BASE_SCREEN::GetPageNumber() const
|
||||
void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) const
|
||||
{
|
||||
// for now, make it look like XML, expand on this later.
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << wxS( ">\n" );
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << wxS( ">\n" );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -455,7 +455,7 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
|
||||
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONX, resX);
|
||||
m_image->SetOption( wxIMAGE_OPTION_RESOLUTIONY, resY);
|
||||
|
||||
m_rotation += ( aRotateCCW ? ANGLE_90 : -ANGLE_90 );
|
||||
m_rotation += ( aRotateCCW ? -ANGLE_90 : ANGLE_90 );
|
||||
rebuildBitmap( false );
|
||||
UpdateImageDataBuffer();
|
||||
}
|
||||
|
||||
+42
-171
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2022 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
|
||||
@@ -17,10 +17,9 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************************
|
||||
* This file is auto-generated by CMake when MAINTAIN_PNGS is on. Do not edit by hand! *
|
||||
* See resources/bitmap.png/CMakeLists.txt to build/see/edit the actual list of icons *
|
||||
***************************************************************************************/
|
||||
/**
|
||||
* This file is auto-generated by CMake when MAINTAIN_PNGS is on. Do not edit by hand!
|
||||
*/
|
||||
|
||||
#include <bitmaps/bitmaps_list.h>
|
||||
#include <bitmaps/bitmap_info.h>
|
||||
@@ -447,10 +446,8 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::directory].emplace_back( BITMAPS::directory, wxT( "directory_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_browser].emplace_back( BITMAPS::directory_browser, wxT( "directory_browser_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_open].emplace_back( BITMAPS::directory_open, wxT( "directory_open_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_centers].emplace_back( BITMAPS::distribute_horizontal_centers, wxT( "distribute_horizontal_centers_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_gaps].emplace_back( BITMAPS::distribute_horizontal_gaps, wxT( "distribute_horizontal_gaps_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_centers].emplace_back( BITMAPS::distribute_vertical_centers, wxT( "distribute_vertical_centers_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_gaps].emplace_back( BITMAPS::distribute_vertical_gaps, wxT( "distribute_vertical_gaps_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal].emplace_back( BITMAPS::distribute_horizontal, wxT( "distribute_horizontal_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical].emplace_back( BITMAPS::distribute_vertical, wxT( "distribute_vertical_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::down].emplace_back( BITMAPS::down, wxT( "down_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag].emplace_back( BITMAPS::drag, wxT( "drag_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag_segment].emplace_back( BITMAPS::drag_segment, wxT( "drag_segment_24.png" ), 24, wxT( "light" ) );
|
||||
@@ -527,17 +524,9 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::hole_to_hole_clearance].emplace_back( BITMAPS::hole_to_hole_clearance, wxT( "hole_to_hole_clearance_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::hole_to_copper_clearance].emplace_back( BITMAPS::hole_to_copper_clearance, wxT( "hole_to_copper_clearance_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::hv45mode].emplace_back( BITMAPS::hv45mode, wxT( "hv45mode_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb_24].emplace_back( BITMAPS::icon_cvpcb_24, wxT( "icon_cvpcb_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_footprint_browser].emplace_back( BITMAPS::icon_footprint_browser, wxT( "icon_footprint_browser_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm_24].emplace_back( BITMAPS::icon_pcm_24, wxT( "icon_pcm_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::import3d].emplace_back( BITMAPS::import3d, wxT( "import3d_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::image].emplace_back( BITMAPS::image, wxT( "image_24.png" ), 24, wxT( "light" ) );
|
||||
@@ -766,10 +755,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::zoom_center_on_screen].emplace_back( BITMAPS::zoom_center_on_screen, wxT( "zoom_center_on_screen_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in].emplace_back( BITMAPS::zoom_in, wxT( "zoom_in_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out].emplace_back( BITMAPS::zoom_out, wxT( "zoom_out_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_horizontally].emplace_back( BITMAPS::zoom_in_horizontally, wxT( "zoom_in_horizontally_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_horizontally].emplace_back( BITMAPS::zoom_out_horizontally, wxT( "zoom_out_horizontally_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_vertically].emplace_back( BITMAPS::zoom_in_vertically, wxT( "zoom_in_vertically_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_vertically].emplace_back( BITMAPS::zoom_out_vertically, wxT( "zoom_out_vertically_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_selection].emplace_back( BITMAPS::zoom_selection, wxT( "zoom_selection_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::about].emplace_back( BITMAPS::about, wxT( "about_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::add_aligned_dimension].emplace_back( BITMAPS::add_aligned_dimension, wxT( "add_aligned_dimension_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
@@ -863,10 +848,8 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::directory].emplace_back( BITMAPS::directory, wxT( "directory_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_browser].emplace_back( BITMAPS::directory_browser, wxT( "directory_browser_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_open].emplace_back( BITMAPS::directory_open, wxT( "directory_open_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_centers].emplace_back( BITMAPS::distribute_horizontal_centers, wxT( "distribute_horizontal_centers_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_gaps].emplace_back( BITMAPS::distribute_horizontal_gaps, wxT( "distribute_horizontal_gaps_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_centers].emplace_back( BITMAPS::distribute_vertical_centers, wxT( "distribute_vertical_centers_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_gaps].emplace_back( BITMAPS::distribute_vertical_gaps, wxT( "distribute_vertical_gaps_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal].emplace_back( BITMAPS::distribute_horizontal, wxT( "distribute_horizontal_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical].emplace_back( BITMAPS::distribute_vertical, wxT( "distribute_vertical_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::down].emplace_back( BITMAPS::down, wxT( "down_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag].emplace_back( BITMAPS::drag, wxT( "drag_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag_segment].emplace_back( BITMAPS::drag_segment, wxT( "drag_segment_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
@@ -943,17 +926,9 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::hole_to_hole_clearance].emplace_back( BITMAPS::hole_to_hole_clearance, wxT( "hole_to_hole_clearance_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::hole_to_copper_clearance].emplace_back( BITMAPS::hole_to_copper_clearance, wxT( "hole_to_copper_clearance_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::hv45mode].emplace_back( BITMAPS::hv45mode, wxT( "hv45mode_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb_24].emplace_back( BITMAPS::icon_cvpcb_24, wxT( "icon_cvpcb_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_footprint_browser].emplace_back( BITMAPS::icon_footprint_browser, wxT( "icon_footprint_browser_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm_24].emplace_back( BITMAPS::icon_pcm_24, wxT( "icon_pcm_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::import3d].emplace_back( BITMAPS::import3d, wxT( "import3d_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::image].emplace_back( BITMAPS::image, wxT( "image_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
@@ -1182,10 +1157,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::zoom_center_on_screen].emplace_back( BITMAPS::zoom_center_on_screen, wxT( "zoom_center_on_screen_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in].emplace_back( BITMAPS::zoom_in, wxT( "zoom_in_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out].emplace_back( BITMAPS::zoom_out, wxT( "zoom_out_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_horizontally].emplace_back( BITMAPS::zoom_in_horizontally, wxT( "zoom_in_horizontally_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_horizontally].emplace_back( BITMAPS::zoom_out_horizontally, wxT( "zoom_out_horizontally_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_vertically].emplace_back( BITMAPS::zoom_in_vertically, wxT( "zoom_in_vertically_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_vertically].emplace_back( BITMAPS::zoom_out_vertically, wxT( "zoom_out_vertically_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_selection].emplace_back( BITMAPS::zoom_selection, wxT( "zoom_selection_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::about].emplace_back( BITMAPS::about, wxT( "about_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::add_aligned_dimension].emplace_back( BITMAPS::add_aligned_dimension, wxT( "add_aligned_dimension_16.png" ), 16, wxT( "light" ) );
|
||||
@@ -1279,10 +1250,8 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::directory].emplace_back( BITMAPS::directory, wxT( "directory_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_browser].emplace_back( BITMAPS::directory_browser, wxT( "directory_browser_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_open].emplace_back( BITMAPS::directory_open, wxT( "directory_open_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_centers].emplace_back( BITMAPS::distribute_horizontal_centers, wxT( "distribute_horizontal_centers_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_gaps].emplace_back( BITMAPS::distribute_horizontal_gaps, wxT( "distribute_horizontal_gaps_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_centers].emplace_back( BITMAPS::distribute_vertical_centers, wxT( "distribute_vertical_centers_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_gaps].emplace_back( BITMAPS::distribute_vertical_gaps, wxT( "distribute_vertical_gaps_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal].emplace_back( BITMAPS::distribute_horizontal, wxT( "distribute_horizontal_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical].emplace_back( BITMAPS::distribute_vertical, wxT( "distribute_vertical_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::down].emplace_back( BITMAPS::down, wxT( "down_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag].emplace_back( BITMAPS::drag, wxT( "drag_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag_segment].emplace_back( BITMAPS::drag_segment, wxT( "drag_segment_16.png" ), 16, wxT( "light" ) );
|
||||
@@ -1359,17 +1328,9 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::hole_to_hole_clearance].emplace_back( BITMAPS::hole_to_hole_clearance, wxT( "hole_to_hole_clearance_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::hole_to_copper_clearance].emplace_back( BITMAPS::hole_to_copper_clearance, wxT( "hole_to_copper_clearance_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::hv45mode].emplace_back( BITMAPS::hv45mode, wxT( "hv45mode_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb_24].emplace_back( BITMAPS::icon_cvpcb_24, wxT( "icon_cvpcb_24_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_footprint_browser].emplace_back( BITMAPS::icon_footprint_browser, wxT( "icon_footprint_browser_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm_24].emplace_back( BITMAPS::icon_pcm_24, wxT( "icon_pcm_24_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::import3d].emplace_back( BITMAPS::import3d, wxT( "import3d_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::image].emplace_back( BITMAPS::image, wxT( "image_16.png" ), 16, wxT( "light" ) );
|
||||
@@ -1598,10 +1559,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::zoom_center_on_screen].emplace_back( BITMAPS::zoom_center_on_screen, wxT( "zoom_center_on_screen_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in].emplace_back( BITMAPS::zoom_in, wxT( "zoom_in_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out].emplace_back( BITMAPS::zoom_out, wxT( "zoom_out_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_horizontally].emplace_back( BITMAPS::zoom_in_horizontally, wxT( "zoom_in_horizontally_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_horizontally].emplace_back( BITMAPS::zoom_out_horizontally, wxT( "zoom_out_horizontally_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_vertically].emplace_back( BITMAPS::zoom_in_vertically, wxT( "zoom_in_vertically_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_vertically].emplace_back( BITMAPS::zoom_out_vertically, wxT( "zoom_out_vertically_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_selection].emplace_back( BITMAPS::zoom_selection, wxT( "zoom_selection_16.png" ), 16, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::about].emplace_back( BITMAPS::about, wxT( "about_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::add_aligned_dimension].emplace_back( BITMAPS::add_aligned_dimension, wxT( "add_aligned_dimension_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
@@ -1695,10 +1652,8 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::directory].emplace_back( BITMAPS::directory, wxT( "directory_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_browser].emplace_back( BITMAPS::directory_browser, wxT( "directory_browser_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_open].emplace_back( BITMAPS::directory_open, wxT( "directory_open_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_centers].emplace_back( BITMAPS::distribute_horizontal_centers, wxT( "distribute_horizontal_centers_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_gaps].emplace_back( BITMAPS::distribute_horizontal_gaps, wxT( "distribute_horizontal_gaps_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_centers].emplace_back( BITMAPS::distribute_vertical_centers, wxT( "distribute_vertical_centers_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_gaps].emplace_back( BITMAPS::distribute_vertical_gaps, wxT( "distribute_vertical_gaps_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal].emplace_back( BITMAPS::distribute_horizontal, wxT( "distribute_horizontal_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical].emplace_back( BITMAPS::distribute_vertical, wxT( "distribute_vertical_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::down].emplace_back( BITMAPS::down, wxT( "down_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag].emplace_back( BITMAPS::drag, wxT( "drag_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag_segment].emplace_back( BITMAPS::drag_segment, wxT( "drag_segment_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
@@ -1775,17 +1730,9 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::hole_to_hole_clearance].emplace_back( BITMAPS::hole_to_hole_clearance, wxT( "hole_to_hole_clearance_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::hole_to_copper_clearance].emplace_back( BITMAPS::hole_to_copper_clearance, wxT( "hole_to_copper_clearance_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::hv45mode].emplace_back( BITMAPS::hv45mode, wxT( "hv45mode_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb_24].emplace_back( BITMAPS::icon_cvpcb_24, wxT( "icon_cvpcb_24_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_footprint_browser].emplace_back( BITMAPS::icon_footprint_browser, wxT( "icon_footprint_browser_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm_24].emplace_back( BITMAPS::icon_pcm_24, wxT( "icon_pcm_24_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::import3d].emplace_back( BITMAPS::import3d, wxT( "import3d_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::image].emplace_back( BITMAPS::image, wxT( "image_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
@@ -2014,10 +1961,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::zoom_center_on_screen].emplace_back( BITMAPS::zoom_center_on_screen, wxT( "zoom_center_on_screen_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in].emplace_back( BITMAPS::zoom_in, wxT( "zoom_in_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out].emplace_back( BITMAPS::zoom_out, wxT( "zoom_out_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_horizontally].emplace_back( BITMAPS::zoom_in_horizontally, wxT( "zoom_in_horizontally_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_horizontally].emplace_back( BITMAPS::zoom_out_horizontally, wxT( "zoom_out_horizontally_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_vertically].emplace_back( BITMAPS::zoom_in_vertically, wxT( "zoom_in_vertically_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_vertically].emplace_back( BITMAPS::zoom_out_vertically, wxT( "zoom_out_vertically_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_selection].emplace_back( BITMAPS::zoom_selection, wxT( "zoom_selection_dark_16.png" ), 16, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::about].emplace_back( BITMAPS::about, wxT( "about_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::add_aligned_dimension].emplace_back( BITMAPS::add_aligned_dimension, wxT( "add_aligned_dimension_32.png" ), 32, wxT( "light" ) );
|
||||
@@ -2111,10 +2054,8 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::directory].emplace_back( BITMAPS::directory, wxT( "directory_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_browser].emplace_back( BITMAPS::directory_browser, wxT( "directory_browser_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_open].emplace_back( BITMAPS::directory_open, wxT( "directory_open_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_centers].emplace_back( BITMAPS::distribute_horizontal_centers, wxT( "distribute_horizontal_centers_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_gaps].emplace_back( BITMAPS::distribute_horizontal_gaps, wxT( "distribute_horizontal_gaps_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_centers].emplace_back( BITMAPS::distribute_vertical_centers, wxT( "distribute_vertical_centers_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_gaps].emplace_back( BITMAPS::distribute_vertical_gaps, wxT( "distribute_vertical_gaps_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal].emplace_back( BITMAPS::distribute_horizontal, wxT( "distribute_horizontal_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical].emplace_back( BITMAPS::distribute_vertical, wxT( "distribute_vertical_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::down].emplace_back( BITMAPS::down, wxT( "down_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag].emplace_back( BITMAPS::drag, wxT( "drag_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag_segment].emplace_back( BITMAPS::drag_segment, wxT( "drag_segment_32.png" ), 32, wxT( "light" ) );
|
||||
@@ -2191,17 +2132,9 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::hole_to_hole_clearance].emplace_back( BITMAPS::hole_to_hole_clearance, wxT( "hole_to_hole_clearance_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::hole_to_copper_clearance].emplace_back( BITMAPS::hole_to_copper_clearance, wxT( "hole_to_copper_clearance_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::hv45mode].emplace_back( BITMAPS::hv45mode, wxT( "hv45mode_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb_24].emplace_back( BITMAPS::icon_cvpcb_24, wxT( "icon_cvpcb_24_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_footprint_browser].emplace_back( BITMAPS::icon_footprint_browser, wxT( "icon_footprint_browser_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm_24].emplace_back( BITMAPS::icon_pcm_24, wxT( "icon_pcm_24_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::import3d].emplace_back( BITMAPS::import3d, wxT( "import3d_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::image].emplace_back( BITMAPS::image, wxT( "image_32.png" ), 32, wxT( "light" ) );
|
||||
@@ -2430,10 +2363,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::zoom_center_on_screen].emplace_back( BITMAPS::zoom_center_on_screen, wxT( "zoom_center_on_screen_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in].emplace_back( BITMAPS::zoom_in, wxT( "zoom_in_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out].emplace_back( BITMAPS::zoom_out, wxT( "zoom_out_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_horizontally].emplace_back( BITMAPS::zoom_in_horizontally, wxT( "zoom_in_horizontally_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_horizontally].emplace_back( BITMAPS::zoom_out_horizontally, wxT( "zoom_out_horizontally_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_vertically].emplace_back( BITMAPS::zoom_in_vertically, wxT( "zoom_in_vertically_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_vertically].emplace_back( BITMAPS::zoom_out_vertically, wxT( "zoom_out_vertically_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_selection].emplace_back( BITMAPS::zoom_selection, wxT( "zoom_selection_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::about].emplace_back( BITMAPS::about, wxT( "about_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::add_aligned_dimension].emplace_back( BITMAPS::add_aligned_dimension, wxT( "add_aligned_dimension_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
@@ -2527,10 +2456,8 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::directory].emplace_back( BITMAPS::directory, wxT( "directory_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_browser].emplace_back( BITMAPS::directory_browser, wxT( "directory_browser_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_open].emplace_back( BITMAPS::directory_open, wxT( "directory_open_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_centers].emplace_back( BITMAPS::distribute_horizontal_centers, wxT( "distribute_horizontal_centers_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_gaps].emplace_back( BITMAPS::distribute_horizontal_gaps, wxT( "distribute_horizontal_gaps_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_centers].emplace_back( BITMAPS::distribute_vertical_centers, wxT( "distribute_vertical_centers_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_gaps].emplace_back( BITMAPS::distribute_vertical_gaps, wxT( "distribute_vertical_gaps_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal].emplace_back( BITMAPS::distribute_horizontal, wxT( "distribute_horizontal_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical].emplace_back( BITMAPS::distribute_vertical, wxT( "distribute_vertical_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::down].emplace_back( BITMAPS::down, wxT( "down_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag].emplace_back( BITMAPS::drag, wxT( "drag_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag_segment].emplace_back( BITMAPS::drag_segment, wxT( "drag_segment_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
@@ -2607,17 +2534,9 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::hole_to_hole_clearance].emplace_back( BITMAPS::hole_to_hole_clearance, wxT( "hole_to_hole_clearance_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::hole_to_copper_clearance].emplace_back( BITMAPS::hole_to_copper_clearance, wxT( "hole_to_copper_clearance_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::hv45mode].emplace_back( BITMAPS::hv45mode, wxT( "hv45mode_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb_24].emplace_back( BITMAPS::icon_cvpcb_24, wxT( "icon_cvpcb_24_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_footprint_browser].emplace_back( BITMAPS::icon_footprint_browser, wxT( "icon_footprint_browser_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm_24].emplace_back( BITMAPS::icon_pcm_24, wxT( "icon_pcm_24_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::import3d].emplace_back( BITMAPS::import3d, wxT( "import3d_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::image].emplace_back( BITMAPS::image, wxT( "image_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
@@ -2846,10 +2765,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::zoom_center_on_screen].emplace_back( BITMAPS::zoom_center_on_screen, wxT( "zoom_center_on_screen_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in].emplace_back( BITMAPS::zoom_in, wxT( "zoom_in_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out].emplace_back( BITMAPS::zoom_out, wxT( "zoom_out_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_horizontally].emplace_back( BITMAPS::zoom_in_horizontally, wxT( "zoom_in_horizontally_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_horizontally].emplace_back( BITMAPS::zoom_out_horizontally, wxT( "zoom_out_horizontally_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_vertically].emplace_back( BITMAPS::zoom_in_vertically, wxT( "zoom_in_vertically_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_vertically].emplace_back( BITMAPS::zoom_out_vertically, wxT( "zoom_out_vertically_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_selection].emplace_back( BITMAPS::zoom_selection, wxT( "zoom_selection_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::about].emplace_back( BITMAPS::about, wxT( "about_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::add_aligned_dimension].emplace_back( BITMAPS::add_aligned_dimension, wxT( "add_aligned_dimension_48.png" ), 48, wxT( "light" ) );
|
||||
@@ -2943,10 +2858,8 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::directory].emplace_back( BITMAPS::directory, wxT( "directory_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_browser].emplace_back( BITMAPS::directory_browser, wxT( "directory_browser_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_open].emplace_back( BITMAPS::directory_open, wxT( "directory_open_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_centers].emplace_back( BITMAPS::distribute_horizontal_centers, wxT( "distribute_horizontal_centers_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_gaps].emplace_back( BITMAPS::distribute_horizontal_gaps, wxT( "distribute_horizontal_gaps_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_centers].emplace_back( BITMAPS::distribute_vertical_centers, wxT( "distribute_vertical_centers_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_gaps].emplace_back( BITMAPS::distribute_vertical_gaps, wxT( "distribute_vertical_gaps_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal].emplace_back( BITMAPS::distribute_horizontal, wxT( "distribute_horizontal_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical].emplace_back( BITMAPS::distribute_vertical, wxT( "distribute_vertical_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::down].emplace_back( BITMAPS::down, wxT( "down_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag].emplace_back( BITMAPS::drag, wxT( "drag_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag_segment].emplace_back( BITMAPS::drag_segment, wxT( "drag_segment_48.png" ), 48, wxT( "light" ) );
|
||||
@@ -3023,17 +2936,9 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::hole_to_hole_clearance].emplace_back( BITMAPS::hole_to_hole_clearance, wxT( "hole_to_hole_clearance_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::hole_to_copper_clearance].emplace_back( BITMAPS::hole_to_copper_clearance, wxT( "hole_to_copper_clearance_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::hv45mode].emplace_back( BITMAPS::hv45mode, wxT( "hv45mode_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb_24].emplace_back( BITMAPS::icon_cvpcb_24, wxT( "icon_cvpcb_24_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_footprint_browser].emplace_back( BITMAPS::icon_footprint_browser, wxT( "icon_footprint_browser_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm_24].emplace_back( BITMAPS::icon_pcm_24, wxT( "icon_pcm_24_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::import3d].emplace_back( BITMAPS::import3d, wxT( "import3d_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::image].emplace_back( BITMAPS::image, wxT( "image_48.png" ), 48, wxT( "light" ) );
|
||||
@@ -3262,10 +3167,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::zoom_center_on_screen].emplace_back( BITMAPS::zoom_center_on_screen, wxT( "zoom_center_on_screen_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in].emplace_back( BITMAPS::zoom_in, wxT( "zoom_in_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out].emplace_back( BITMAPS::zoom_out, wxT( "zoom_out_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_horizontally].emplace_back( BITMAPS::zoom_in_horizontally, wxT( "zoom_in_horizontally_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_horizontally].emplace_back( BITMAPS::zoom_out_horizontally, wxT( "zoom_out_horizontally_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_vertically].emplace_back( BITMAPS::zoom_in_vertically, wxT( "zoom_in_vertically_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_vertically].emplace_back( BITMAPS::zoom_out_vertically, wxT( "zoom_out_vertically_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_selection].emplace_back( BITMAPS::zoom_selection, wxT( "zoom_selection_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::about].emplace_back( BITMAPS::about, wxT( "about_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::add_aligned_dimension].emplace_back( BITMAPS::add_aligned_dimension, wxT( "add_aligned_dimension_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
@@ -3359,10 +3260,8 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::directory].emplace_back( BITMAPS::directory, wxT( "directory_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_browser].emplace_back( BITMAPS::directory_browser, wxT( "directory_browser_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_open].emplace_back( BITMAPS::directory_open, wxT( "directory_open_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_centers].emplace_back( BITMAPS::distribute_horizontal_centers, wxT( "distribute_horizontal_centers_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_gaps].emplace_back( BITMAPS::distribute_horizontal_gaps, wxT( "distribute_horizontal_gaps_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_centers].emplace_back( BITMAPS::distribute_vertical_centers, wxT( "distribute_vertical_centers_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_gaps].emplace_back( BITMAPS::distribute_vertical_gaps, wxT( "distribute_vertical_gaps_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal].emplace_back( BITMAPS::distribute_horizontal, wxT( "distribute_horizontal_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical].emplace_back( BITMAPS::distribute_vertical, wxT( "distribute_vertical_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::down].emplace_back( BITMAPS::down, wxT( "down_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag].emplace_back( BITMAPS::drag, wxT( "drag_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag_segment].emplace_back( BITMAPS::drag_segment, wxT( "drag_segment_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
@@ -3439,17 +3338,9 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::hole_to_hole_clearance].emplace_back( BITMAPS::hole_to_hole_clearance, wxT( "hole_to_hole_clearance_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::hole_to_copper_clearance].emplace_back( BITMAPS::hole_to_copper_clearance, wxT( "hole_to_copper_clearance_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::hv45mode].emplace_back( BITMAPS::hv45mode, wxT( "hv45mode_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb_24].emplace_back( BITMAPS::icon_cvpcb_24, wxT( "icon_cvpcb_24_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_footprint_browser].emplace_back( BITMAPS::icon_footprint_browser, wxT( "icon_footprint_browser_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm_24].emplace_back( BITMAPS::icon_pcm_24, wxT( "icon_pcm_24_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::import3d].emplace_back( BITMAPS::import3d, wxT( "import3d_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::image].emplace_back( BITMAPS::image, wxT( "image_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
@@ -3678,10 +3569,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::zoom_center_on_screen].emplace_back( BITMAPS::zoom_center_on_screen, wxT( "zoom_center_on_screen_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in].emplace_back( BITMAPS::zoom_in, wxT( "zoom_in_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out].emplace_back( BITMAPS::zoom_out, wxT( "zoom_out_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_horizontally].emplace_back( BITMAPS::zoom_in_horizontally, wxT( "zoom_in_horizontally_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_horizontally].emplace_back( BITMAPS::zoom_out_horizontally, wxT( "zoom_out_horizontally_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_vertically].emplace_back( BITMAPS::zoom_in_vertically, wxT( "zoom_in_vertically_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_vertically].emplace_back( BITMAPS::zoom_out_vertically, wxT( "zoom_out_vertically_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_selection].emplace_back( BITMAPS::zoom_selection, wxT( "zoom_selection_dark_48.png" ), 48, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::about].emplace_back( BITMAPS::about, wxT( "about_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::add_aligned_dimension].emplace_back( BITMAPS::add_aligned_dimension, wxT( "add_aligned_dimension_64.png" ), 64, wxT( "light" ) );
|
||||
@@ -3775,10 +3662,8 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::directory].emplace_back( BITMAPS::directory, wxT( "directory_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_browser].emplace_back( BITMAPS::directory_browser, wxT( "directory_browser_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_open].emplace_back( BITMAPS::directory_open, wxT( "directory_open_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_centers].emplace_back( BITMAPS::distribute_horizontal_centers, wxT( "distribute_horizontal_centers_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_gaps].emplace_back( BITMAPS::distribute_horizontal_gaps, wxT( "distribute_horizontal_gaps_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_centers].emplace_back( BITMAPS::distribute_vertical_centers, wxT( "distribute_vertical_centers_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_gaps].emplace_back( BITMAPS::distribute_vertical_gaps, wxT( "distribute_vertical_gaps_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal].emplace_back( BITMAPS::distribute_horizontal, wxT( "distribute_horizontal_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical].emplace_back( BITMAPS::distribute_vertical, wxT( "distribute_vertical_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::down].emplace_back( BITMAPS::down, wxT( "down_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag].emplace_back( BITMAPS::drag, wxT( "drag_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag_segment].emplace_back( BITMAPS::drag_segment, wxT( "drag_segment_64.png" ), 64, wxT( "light" ) );
|
||||
@@ -3855,17 +3740,9 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::hole_to_hole_clearance].emplace_back( BITMAPS::hole_to_hole_clearance, wxT( "hole_to_hole_clearance_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::hole_to_copper_clearance].emplace_back( BITMAPS::hole_to_copper_clearance, wxT( "hole_to_copper_clearance_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::hv45mode].emplace_back( BITMAPS::hv45mode, wxT( "hv45mode_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb_24].emplace_back( BITMAPS::icon_cvpcb_24, wxT( "icon_cvpcb_24_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_footprint_browser].emplace_back( BITMAPS::icon_footprint_browser, wxT( "icon_footprint_browser_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm_24].emplace_back( BITMAPS::icon_pcm_24, wxT( "icon_pcm_24_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::import3d].emplace_back( BITMAPS::import3d, wxT( "import3d_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::image].emplace_back( BITMAPS::image, wxT( "image_64.png" ), 64, wxT( "light" ) );
|
||||
@@ -4094,10 +3971,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::zoom_center_on_screen].emplace_back( BITMAPS::zoom_center_on_screen, wxT( "zoom_center_on_screen_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in].emplace_back( BITMAPS::zoom_in, wxT( "zoom_in_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out].emplace_back( BITMAPS::zoom_out, wxT( "zoom_out_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_horizontally].emplace_back( BITMAPS::zoom_in_horizontally, wxT( "zoom_in_horizontally_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_horizontally].emplace_back( BITMAPS::zoom_out_horizontally, wxT( "zoom_out_horizontally_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_vertically].emplace_back( BITMAPS::zoom_in_vertically, wxT( "zoom_in_vertically_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_vertically].emplace_back( BITMAPS::zoom_out_vertically, wxT( "zoom_out_vertically_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_selection].emplace_back( BITMAPS::zoom_selection, wxT( "zoom_selection_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::about].emplace_back( BITMAPS::about, wxT( "about_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::add_aligned_dimension].emplace_back( BITMAPS::add_aligned_dimension, wxT( "add_aligned_dimension_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
@@ -4191,10 +4064,8 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::directory].emplace_back( BITMAPS::directory, wxT( "directory_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_browser].emplace_back( BITMAPS::directory_browser, wxT( "directory_browser_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::directory_open].emplace_back( BITMAPS::directory_open, wxT( "directory_open_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_centers].emplace_back( BITMAPS::distribute_horizontal_centers, wxT( "distribute_horizontal_centers_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal_gaps].emplace_back( BITMAPS::distribute_horizontal_gaps, wxT( "distribute_horizontal_gaps_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_centers].emplace_back( BITMAPS::distribute_vertical_centers, wxT( "distribute_vertical_centers_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical_gaps].emplace_back( BITMAPS::distribute_vertical_gaps, wxT( "distribute_vertical_gaps_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_horizontal].emplace_back( BITMAPS::distribute_horizontal, wxT( "distribute_horizontal_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::distribute_vertical].emplace_back( BITMAPS::distribute_vertical, wxT( "distribute_vertical_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::down].emplace_back( BITMAPS::down, wxT( "down_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag].emplace_back( BITMAPS::drag, wxT( "drag_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::drag_segment].emplace_back( BITMAPS::drag_segment, wxT( "drag_segment_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
@@ -4271,17 +4142,9 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::hole_to_hole_clearance].emplace_back( BITMAPS::hole_to_hole_clearance, wxT( "hole_to_hole_clearance_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::hole_to_copper_clearance].emplace_back( BITMAPS::hole_to_copper_clearance, wxT( "hole_to_copper_clearance_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::hv45mode].emplace_back( BITMAPS::hv45mode, wxT( "hv45mode_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb_24].emplace_back( BITMAPS::icon_cvpcb_24, wxT( "icon_cvpcb_24_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_footprint_browser].emplace_back( BITMAPS::icon_footprint_browser, wxT( "icon_footprint_browser_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm_24].emplace_back( BITMAPS::icon_pcm_24, wxT( "icon_pcm_24_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::import3d].emplace_back( BITMAPS::import3d, wxT( "import3d_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::image].emplace_back( BITMAPS::image, wxT( "image_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
@@ -4510,10 +4373,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::zoom_center_on_screen].emplace_back( BITMAPS::zoom_center_on_screen, wxT( "zoom_center_on_screen_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in].emplace_back( BITMAPS::zoom_in, wxT( "zoom_in_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out].emplace_back( BITMAPS::zoom_out, wxT( "zoom_out_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_horizontally].emplace_back( BITMAPS::zoom_in_horizontally, wxT( "zoom_in_horizontally_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_horizontally].emplace_back( BITMAPS::zoom_out_horizontally, wxT( "zoom_out_horizontally_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_in_vertically].emplace_back( BITMAPS::zoom_in_vertically, wxT( "zoom_in_vertically_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_out_vertically].emplace_back( BITMAPS::zoom_out_vertically, wxT( "zoom_out_vertically_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::zoom_selection].emplace_back( BITMAPS::zoom_selection, wxT( "zoom_selection_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_32].emplace_back( BITMAPS::icon_bitmap2component_32, wxT( "icon_bitmap2component_32_32.png" ), 32, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_32].emplace_back( BITMAPS::icon_eeschema_32, wxT( "icon_eeschema_32_32.png" ), 32, wxT( "light" ) );
|
||||
@@ -4535,6 +4394,24 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_32].emplace_back( BITMAPS::icon_pagelayout_editor_32, wxT( "icon_pagelayout_editor_32_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_32].emplace_back( BITMAPS::icon_pcbcalculator_32, wxT( "icon_pcbcalculator_32_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_32].emplace_back( BITMAPS::icon_pcbnew_32, wxT( "icon_pcbnew_32_dark_32.png" ), 32, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_24.png" ), 24, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component_24].emplace_back( BITMAPS::icon_bitmap2component_24, wxT( "icon_bitmap2component_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema_24].emplace_back( BITMAPS::icon_eeschema_24, wxT( "icon_eeschema_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview_24].emplace_back( BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_kicad_24].emplace_back( BITMAPS::icon_kicad_24, wxT( "icon_kicad_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_libedit_24].emplace_back( BITMAPS::icon_libedit_24, wxT( "icon_libedit_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_modedit_24].emplace_back( BITMAPS::icon_modedit_24, wxT( "icon_modedit_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor_24].emplace_back( BITMAPS::icon_pagelayout_editor_24, wxT( "icon_pagelayout_editor_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator_24].emplace_back( BITMAPS::icon_pcbcalculator_24, wxT( "icon_pcbcalculator_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbnew_24].emplace_back( BITMAPS::icon_pcbnew_24, wxT( "icon_pcbnew_24_dark_24.png" ), 24, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb].emplace_back( BITMAPS::icon_cvpcb, wxT( "icon_cvpcb_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema].emplace_back( BITMAPS::icon_eeschema, wxT( "icon_eeschema_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview].emplace_back( BITMAPS::icon_gerbview, wxT( "icon_gerbview_64.png" ), 64, wxT( "light" ) );
|
||||
@@ -4546,7 +4423,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor].emplace_back( BITMAPS::icon_pagelayout_editor, wxT( "icon_pagelayout_editor_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component].emplace_back( BITMAPS::icon_bitmap2component, wxT( "icon_bitmap2component_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator].emplace_back( BITMAPS::icon_pcbcalculator, wxT( "icon_pcbcalculator_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm].emplace_back( BITMAPS::icon_pcm, wxT( "icon_pcm_64.png" ), 64, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb].emplace_back( BITMAPS::icon_cvpcb, wxT( "icon_cvpcb_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema].emplace_back( BITMAPS::icon_eeschema, wxT( "icon_eeschema_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview].emplace_back( BITMAPS::icon_gerbview, wxT( "icon_gerbview_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
@@ -4558,7 +4434,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor].emplace_back( BITMAPS::icon_pagelayout_editor, wxT( "icon_pagelayout_editor_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component].emplace_back( BITMAPS::icon_bitmap2component, wxT( "icon_bitmap2component_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator].emplace_back( BITMAPS::icon_pcbcalculator, wxT( "icon_pcbcalculator_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm].emplace_back( BITMAPS::icon_pcm, wxT( "icon_pcm_dark_64.png" ), 64, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb].emplace_back( BITMAPS::icon_cvpcb, wxT( "icon_cvpcb_128.png" ), 128, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema].emplace_back( BITMAPS::icon_eeschema, wxT( "icon_eeschema_128.png" ), 128, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview].emplace_back( BITMAPS::icon_gerbview, wxT( "icon_gerbview_128.png" ), 128, wxT( "light" ) );
|
||||
@@ -4570,7 +4445,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor].emplace_back( BITMAPS::icon_pagelayout_editor, wxT( "icon_pagelayout_editor_128.png" ), 128, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component].emplace_back( BITMAPS::icon_bitmap2component, wxT( "icon_bitmap2component_128.png" ), 128, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator].emplace_back( BITMAPS::icon_pcbcalculator, wxT( "icon_pcbcalculator_128.png" ), 128, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm].emplace_back( BITMAPS::icon_pcm, wxT( "icon_pcm_128.png" ), 128, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb].emplace_back( BITMAPS::icon_cvpcb, wxT( "icon_cvpcb_dark_128.png" ), 128, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema].emplace_back( BITMAPS::icon_eeschema, wxT( "icon_eeschema_dark_128.png" ), 128, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview].emplace_back( BITMAPS::icon_gerbview, wxT( "icon_gerbview_dark_128.png" ), 128, wxT( "dark" ) );
|
||||
@@ -4582,7 +4456,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor].emplace_back( BITMAPS::icon_pagelayout_editor, wxT( "icon_pagelayout_editor_dark_128.png" ), 128, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component].emplace_back( BITMAPS::icon_bitmap2component, wxT( "icon_bitmap2component_dark_128.png" ), 128, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator].emplace_back( BITMAPS::icon_pcbcalculator, wxT( "icon_pcbcalculator_dark_128.png" ), 128, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm].emplace_back( BITMAPS::icon_pcm, wxT( "icon_pcm_dark_128.png" ), 128, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb].emplace_back( BITMAPS::icon_cvpcb, wxT( "icon_cvpcb_256.png" ), 256, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema].emplace_back( BITMAPS::icon_eeschema, wxT( "icon_eeschema_256.png" ), 256, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview].emplace_back( BITMAPS::icon_gerbview, wxT( "icon_gerbview_256.png" ), 256, wxT( "light" ) );
|
||||
@@ -4594,7 +4467,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor].emplace_back( BITMAPS::icon_pagelayout_editor, wxT( "icon_pagelayout_editor_256.png" ), 256, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component].emplace_back( BITMAPS::icon_bitmap2component, wxT( "icon_bitmap2component_256.png" ), 256, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator].emplace_back( BITMAPS::icon_pcbcalculator, wxT( "icon_pcbcalculator_256.png" ), 256, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm].emplace_back( BITMAPS::icon_pcm, wxT( "icon_pcm_256.png" ), 256, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb].emplace_back( BITMAPS::icon_cvpcb, wxT( "icon_cvpcb_dark_256.png" ), 256, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_eeschema].emplace_back( BITMAPS::icon_eeschema, wxT( "icon_eeschema_dark_256.png" ), 256, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_gerbview].emplace_back( BITMAPS::icon_gerbview, wxT( "icon_gerbview_dark_256.png" ), 256, wxT( "dark" ) );
|
||||
@@ -4606,7 +4478,6 @@ void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBi
|
||||
aBitmapInfoCache[BITMAPS::icon_pagelayout_editor].emplace_back( BITMAPS::icon_pagelayout_editor, wxT( "icon_pagelayout_editor_dark_256.png" ), 256, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_bitmap2component].emplace_back( BITMAPS::icon_bitmap2component, wxT( "icon_bitmap2component_dark_256.png" ), 256, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcbcalculator].emplace_back( BITMAPS::icon_pcbcalculator, wxT( "icon_pcbcalculator_dark_256.png" ), 256, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_pcm].emplace_back( BITMAPS::icon_pcm, wxT( "icon_pcm_dark_256.png" ), 256, wxT( "dark" ) );
|
||||
aBitmapInfoCache[BITMAPS::dialog_warning].emplace_back( BITMAPS::dialog_warning, wxT( "dialog_warning_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_3d].emplace_back( BITMAPS::icon_3d, wxT( "icon_3d_48.png" ), 48, wxT( "light" ) );
|
||||
aBitmapInfoCache[BITMAPS::icon_cvpcb].emplace_back( BITMAPS::icon_cvpcb, wxT( "icon_cvpcb_48.png" ), 48, wxT( "light" ) );
|
||||
|
||||
@@ -51,19 +51,6 @@ extern std::string GetCurlLibVersion();
|
||||
#include <kicad_build_version.h>
|
||||
#undef INCLUDE_KICAD_VERSION
|
||||
|
||||
// Remember OpenGL info
|
||||
static wxString s_glVendor;
|
||||
static wxString s_glRenderer;
|
||||
static wxString s_glVersion;
|
||||
|
||||
void SetOpenGLInfo( const char* aVendor, const char* aRenderer, const char* aVersion )
|
||||
{
|
||||
s_glVendor = wxString::FromUTF8( aVendor );
|
||||
s_glRenderer = wxString::FromUTF8( aRenderer );
|
||||
s_glVersion = wxString::FromUTF8( aVersion );
|
||||
}
|
||||
|
||||
|
||||
wxString GetPlatformGetBitnessName()
|
||||
{
|
||||
wxPlatformInfo platform;
|
||||
@@ -213,12 +200,6 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
|
||||
<< ", " << wxGetenv( "XDG_SESSION_TYPE" );
|
||||
#endif
|
||||
|
||||
if( !s_glVendor.empty() || !s_glRenderer.empty() || !s_glVersion.empty() )
|
||||
{
|
||||
aMsg << eol;
|
||||
aMsg << "OpenGL: " << s_glVendor << ", " << s_glRenderer << ", " << s_glVersion;
|
||||
}
|
||||
|
||||
aMsg << eol << eol;
|
||||
|
||||
if( !aBrief )
|
||||
@@ -286,11 +267,10 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
|
||||
aMsg << " without C++ ABI" << eol;
|
||||
#endif
|
||||
|
||||
// Add build settings config (build options):
|
||||
#if defined( KICAD_USE_EGL ) || ! defined( NDEBUG )
|
||||
aMsg << eol;
|
||||
|
||||
// Add build settings config (build options):
|
||||
aMsg << "Build settings:" << eol;
|
||||
#endif
|
||||
|
||||
#ifdef KICAD_USE_EGL
|
||||
aMsg << indent4 << "KICAD_USE_EGL=" << ON;
|
||||
@@ -325,19 +305,5 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
wxLocale* locale = wxGetLocale();
|
||||
|
||||
if( locale )
|
||||
{
|
||||
aMsg << eol;
|
||||
aMsg << "Locale: " << eol;
|
||||
aMsg << indent4 << "Lang: " << locale->GetCanonicalName() << eol;
|
||||
aMsg << indent4 << "Enc: " << locale->GetSystemEncodingName() << eol;
|
||||
aMsg << indent4 << "Num: "
|
||||
<< wxString::Format( "%d%s%.1f", 1,
|
||||
locale->GetInfo( wxLocaleInfo::wxLOCALE_THOUSANDS_SEP ), 234.5 )
|
||||
<< eol;
|
||||
}
|
||||
|
||||
return aMsg;
|
||||
}
|
||||
|
||||
+124
-14
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
@@ -22,23 +22,134 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <confirm.h>
|
||||
|
||||
#include <functional>
|
||||
#include <wx/app.h>
|
||||
#include <wx/stockitem.h>
|
||||
#include <wx/richmsgdlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/choicdlg.h>
|
||||
#include <wx/crt.h>
|
||||
#include <confirm.h>
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
|
||||
// Set of dialogs that have been chosen not to be shown again
|
||||
static std::unordered_map<unsigned long, int> doNotShowAgainDlgs;
|
||||
|
||||
|
||||
/**
|
||||
* Flag to enable confirmation dialog debugging output.
|
||||
*
|
||||
* @ingroup trace_env_vars
|
||||
*/
|
||||
static const wxChar traceConfirm[] = wxT( "KICAD_CONFIRM" );
|
||||
KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption,
|
||||
long aStyle )
|
||||
: wxRichMessageDialog( aParent, aMessage, aCaption, aStyle | wxCENTRE | wxSTAY_ON_TOP ),
|
||||
m_hash( 0 ),
|
||||
m_cancelMeansCancel( true )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType,
|
||||
const wxString& aCaption )
|
||||
: wxRichMessageDialog( aParent, aMessage, getCaption( aType, aCaption ), getStyle( aType ) ),
|
||||
m_hash( 0 ),
|
||||
m_cancelMeansCancel( true )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void KIDIALOG::DoNotShowCheckbox( wxString aUniqueId, int line )
|
||||
{
|
||||
ShowCheckBox( _( "Do not show again" ), false );
|
||||
|
||||
m_hash = std::hash<wxString>{}( aUniqueId ) + line;
|
||||
}
|
||||
|
||||
|
||||
bool KIDIALOG::DoNotShowAgain() const
|
||||
{
|
||||
return doNotShowAgainDlgs.count( m_hash ) > 0;
|
||||
}
|
||||
|
||||
|
||||
void KIDIALOG::ForceShowAgain()
|
||||
{
|
||||
doNotShowAgainDlgs.erase( m_hash );
|
||||
}
|
||||
|
||||
|
||||
bool KIDIALOG::Show( bool aShow )
|
||||
{
|
||||
// We should check the do-not-show-again setting only when the dialog is displayed
|
||||
if( aShow )
|
||||
{
|
||||
// Check if this dialog should be shown to the user
|
||||
auto it = doNotShowAgainDlgs.find( m_hash );
|
||||
|
||||
if( it != doNotShowAgainDlgs.end() )
|
||||
return it->second;
|
||||
}
|
||||
|
||||
int ret = wxRichMessageDialog::Show( aShow );
|
||||
|
||||
// Has the user asked not to show the dialog again?
|
||||
// Note that we don't save a Cancel value unless the Cancel button is being used for some
|
||||
// other function (which is actually more common than it being used for Cancel).
|
||||
if( IsCheckBoxChecked() && (!m_cancelMeansCancel || ret != wxID_CANCEL ) )
|
||||
doNotShowAgainDlgs[m_hash] = ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int KIDIALOG::ShowModal()
|
||||
{
|
||||
// Check if this dialog should be shown to the user
|
||||
auto it = doNotShowAgainDlgs.find( m_hash );
|
||||
|
||||
if( it != doNotShowAgainDlgs.end() )
|
||||
return it->second;
|
||||
|
||||
int ret = wxRichMessageDialog::ShowModal();
|
||||
|
||||
// Has the user asked not to show the dialog again?
|
||||
// Note that we don't save a Cancel value unless the Cancel button is being used for some
|
||||
// other function (which is actually more common than it being used for Cancel).
|
||||
if( IsCheckBoxChecked() && (!m_cancelMeansCancel || ret != wxID_CANCEL ) )
|
||||
doNotShowAgainDlgs[m_hash] = ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
wxString KIDIALOG::getCaption( KD_TYPE aType, const wxString& aCaption )
|
||||
{
|
||||
if( !aCaption.IsEmpty() )
|
||||
return aCaption;
|
||||
|
||||
switch( aType )
|
||||
{
|
||||
case KD_NONE: /* fall through */
|
||||
case KD_INFO: return _( "Message" );
|
||||
case KD_QUESTION: return _( "Question" );
|
||||
case KD_WARNING: return _( "Warning" );
|
||||
case KD_ERROR: return _( "Error" );
|
||||
}
|
||||
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
|
||||
long KIDIALOG::getStyle( KD_TYPE aType )
|
||||
{
|
||||
long style = wxOK | wxCENTRE | wxSTAY_ON_TOP;
|
||||
|
||||
switch( aType )
|
||||
{
|
||||
case KD_NONE: break;
|
||||
case KD_INFO: style |= wxICON_INFORMATION; break;
|
||||
case KD_QUESTION: style |= wxICON_QUESTION; break;
|
||||
case KD_WARNING: style |= wxICON_WARNING; break;
|
||||
case KD_ERROR: style |= wxICON_ERROR; break;
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
|
||||
bool AskOverrideLock( wxWindow* aParent, const wxString& aMessage )
|
||||
@@ -100,8 +211,7 @@ int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage )
|
||||
// wxMessageDialog on windows invokes TaskDialogIndirect which is a native function for a dialog
|
||||
// As a result it skips wxWidgets for modal management...and we don't parent frames properly
|
||||
// among other things for Windows to do the right thing by default
|
||||
// Disable all the windows manually to avoid being able to hit this dialog from the tool frame
|
||||
// and kicad frame at the same time.
|
||||
// Disable all the windows manually to avoid being able to hit this dialog from the tool frame and kicad frame at the same time
|
||||
wxWindowDisabler disable( true );
|
||||
#endif
|
||||
|
||||
@@ -223,7 +333,7 @@ void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxSt
|
||||
{
|
||||
if( !wxTheApp || !wxTheApp->GetTopWindow() )
|
||||
{
|
||||
wxLogTrace( traceConfirm, wxS( "%s %s" ), aMessage, aExtraInfo );
|
||||
wxLogDebug( "%s %s", aMessage, aExtraInfo );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user