Compare commits
1335 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 59f308850e | |||
| e775a7581a | |||
| ec99e10b31 | |||
| 240d7921ba | |||
| 9ac006b114 | |||
| c3fef1cae2 | |||
| ca1c99a0d1 | |||
| 06ae7a20df | |||
| f536ecdc00 | |||
| a4bdd38367 | |||
| 6fb6d3e444 | |||
| a3952c37bf | |||
| c24ee72fe3 | |||
| f988b807c4 | |||
| cb1a596b10 | |||
| c41cd75b62 | |||
| 0df48f3002 | |||
| 2d58184080 | |||
| 1ef6e69d83 | |||
| dbd4af16c6 | |||
| 2263535d3a | |||
| 3ce4a5bf7f | |||
| f62c3431ff | |||
| a652084922 | |||
| ed30599db8 | |||
| d8752970e9 | |||
| 57a4c93cf5 | |||
| a116f5783d | |||
| 2730098c42 | |||
| 836d17359f | |||
| a4406bb137 | |||
| bbb67b415a | |||
| 0842360dbb | |||
| e58b23a54b | |||
| 72342bd8a5 | |||
| fa77fc3310 | |||
| 53fe2a7203 | |||
| 480dfafb4f | |||
| f5e13c5ceb | |||
| eadc902f84 | |||
| b461a3b64d | |||
| 75c758e5f4 | |||
| 05912b0381 | |||
| fb387a2c09 | |||
| 1380feef72 | |||
| 6c91a3022e | |||
| e55989120e | |||
| 14f12ccf51 | |||
| 82a1b02b4a | |||
| e99a2fbc56 | |||
| d3d23d18fb | |||
| cbf1b2af47 | |||
| 4f5fca4e67 | |||
| e0158a8ed7 | |||
| 40e7ba67d1 | |||
| e664605c90 | |||
| 5a51a6b179 | |||
| eb7929ccb6 | |||
| e85eec2e6b | |||
| 121394c0c0 | |||
| 5ad74d58f8 | |||
| afe2516d57 | |||
| ccf6e78cd5 | |||
| fef91fc8b9 | |||
| 4156587abe | |||
| 629eccaf09 | |||
| f89803eb64 | |||
| da12746a3a | |||
| b023019b0d | |||
| 1fdaa1083e | |||
| 2f8e846b9e | |||
| e42db52d14 | |||
| d4ec455ce0 | |||
| 0547c7ba91 | |||
| 8f4b809599 | |||
| 8432fb4fea | |||
| 84df2c86ae | |||
| 49ced23ba8 | |||
| 00bf2ca36f | |||
| b92861c7e3 | |||
| a189102628 | |||
| 58a6eb653b | |||
| 9159f5a004 | |||
| f1c570d793 | |||
| 832af39f34 | |||
| 9260f58803 | |||
| 1a5c515e45 | |||
| 87c8688f70 | |||
| d13179f9e4 | |||
| 75de21314c | |||
| 239f8e0905 | |||
| f4ac624bb3 | |||
| 2be0b98135 | |||
| 36c5719535 | |||
| 1f870bf76c | |||
| d5cc334e20 | |||
| fd98188ee4 | |||
| c3446f9c2d | |||
| e6e29b6c4c | |||
| 6096b5c4d8 | |||
| 838eadd47f | |||
| afb43531e8 | |||
| 3533e8b119 | |||
| 0e6ad13db8 | |||
| 0d725fcc2c | |||
| 7e747085d3 | |||
| f1376396c2 | |||
| 4eb9281f4d | |||
| c895816cb0 | |||
| 9f814c0f6a | |||
| e14aef9bd5 | |||
| 2b106a2b34 | |||
| f6494d2980 | |||
| 78a6c1a909 | |||
| c858643100 | |||
| 17b0bdc9fe | |||
| 2e0cdebb0c | |||
| a5f8955d78 | |||
| 0eca698a39 | |||
| 16f259da81 | |||
| c3ee477a1b | |||
| 33da35db04 | |||
| 533be1ec70 | |||
| b64573f5d4 | |||
| 1d6caa9a35 | |||
| c74b0943f3 | |||
| bb579294a0 | |||
| ad9f5f4dd7 | |||
| bf2e34f32e | |||
| bd57957df7 | |||
| 093db600ff | |||
| 131013f291 | |||
| 909d199379 | |||
| 5f16f4ab99 | |||
| fff95fa4e6 | |||
| a38327a39c | |||
| 686048dcce | |||
| 330c0f86de | |||
| 83317f1b80 | |||
| a416eb2cf6 | |||
| 2959c94bd3 | |||
| 063d9c8305 | |||
| 5e97608fa5 | |||
| 50dca2d02b | |||
| cd3785744c | |||
| 357810a5d5 | |||
| 1b71bc115d | |||
| de40286e81 | |||
| 8d0ff95760 | |||
| ffddf9fec3 | |||
| 3a35d96130 | |||
| 8add678d87 | |||
| a8bcf8c9e4 | |||
| 090374a1dc | |||
| e7aa95d53d | |||
| f6ccf18cf5 | |||
| 4542ce8c70 | |||
| f80287bc27 | |||
| e10ab74917 | |||
| 23ddb99026 | |||
| efbac9e128 | |||
| 62044c2731 | |||
| 7d1a38d46f | |||
| d885bc14e1 | |||
| 886937a3ea | |||
| 99eff43ab4 | |||
| 880269780d | |||
| 7f1b891679 | |||
| ceced2a9a4 | |||
| d3a8cb84a6 | |||
| 6b43bb8fe3 | |||
| a74cffac39 | |||
| 83d2891cef | |||
| 0faad370f9 | |||
| 23fab89131 | |||
| 48189172ea | |||
| 0c9eda44d4 | |||
| f0a9ce3ab4 | |||
| ea5878a0c9 | |||
| f67382612d | |||
| 3fe7ae07ed | |||
| 8bcfa81bea | |||
| c17918d9c1 | |||
| f752df0595 | |||
| 0836b5b661 | |||
| 2cefccf7bf | |||
| 3dc86c5a4f | |||
| 05ae712e77 | |||
| 04db374326 | |||
| e3558b7dcf | |||
| 99e10c6112 | |||
| 537934339e | |||
| ee343e1263 | |||
| 6eeca9aa90 | |||
| 86beb339b7 | |||
| 67b5af23aa | |||
| 88f65f4e47 | |||
| af5b6b0eba | |||
| 57ef739404 | |||
| 584eb9f531 | |||
| 36a4d5a511 | |||
| 72737b20cd | |||
| d05093e6f7 | |||
| a7e6928f4e | |||
| 951fd2d693 | |||
| be991cfcd6 | |||
| aab36d9b85 | |||
| 3cd6935acb | |||
| 6daef080e3 | |||
| 6ee909b958 | |||
| c11ae8bd02 | |||
| c7a4ea97c3 | |||
| 81ebb1030a | |||
| 86ec36d183 | |||
| 207f2e568b | |||
| 19753719cb | |||
| 5f025dcd73 | |||
| c796eeaf8b | |||
| bdbd7f0c9c | |||
| b0e09327db | |||
| 96a3621b8e | |||
| 8f259211e7 | |||
| 0d9d8c28f1 | |||
| 058a0bbf93 | |||
| 4d46e0ceb7 | |||
| 123ff326d4 | |||
| 14d4c38979 | |||
| 9c87a52b6e | |||
| 30c2028852 | |||
| 95e6be0e81 | |||
| 955313e97d | |||
| 32c2135047 | |||
| 702e08b083 | |||
| 8f58e1a9e0 | |||
| 0cc25f10c6 | |||
| 61ef88a0ac | |||
| 02a95b958d | |||
| 5cd88dbd20 | |||
| ec53ed6a37 | |||
| 242413a334 | |||
| f88dce1627 | |||
| 5c456370d9 | |||
| 93fdd35b31 | |||
| 70d5fccb54 | |||
| 6ca7c3a3a1 | |||
| 88448ce746 | |||
| 1fee2c626b | |||
| 480a9ac77d | |||
| 889689e31a | |||
| c8e49599ce | |||
| 351cb7e104 | |||
| 5c5e41500a | |||
| 2e739e743d | |||
| 1eee3d350b | |||
| d2d7e630bd | |||
| d11cd173dc | |||
| 12e0427038 | |||
| 9bcb6f0adf | |||
| 09490e1f46 | |||
| f33120c540 | |||
| 82ed223b02 | |||
| bfdbf969c2 | |||
| 7d409b9404 | |||
| 7673f220a9 | |||
| 75daa1afec | |||
| 27657e00fe | |||
| 26b8812f15 | |||
| 07e13c51d1 | |||
| f9b59b4fdf | |||
| 76a3b3db97 | |||
| 4b0416e92a | |||
| 5d6bb4b04f | |||
| 2764f292cb | |||
| 7ca59e24c6 | |||
| e1a2d60672 | |||
| 9672390104 | |||
| 33c2005c18 | |||
| 3e1309110e | |||
| aae7d94ffd | |||
| 5b0d752e0c | |||
| 0f93752f14 | |||
| 049ecc43e3 | |||
| 2209f5e93b | |||
| a17cd9d054 | |||
| 4497aaa3fa | |||
| 00226ae40a | |||
| 45963a3443 | |||
| 4aa1a881f3 | |||
| f3dd5b73f8 | |||
| fd049ef510 | |||
| 7d389f8024 | |||
| df63f47deb | |||
| c521efa35d | |||
| af1561b848 | |||
| 691931f74d | |||
| da5e1de1c8 | |||
| 043892bdc6 | |||
| 34d2aeaac3 | |||
| 4481e89046 | |||
| 8120e47bfd | |||
| db526e581c | |||
| 246be732a1 | |||
| 27a0bd2535 | |||
| 8f57fd82a0 | |||
| 1ef90c898e | |||
| cf133975c1 | |||
| c468b68c5a | |||
| acbddc904b | |||
| 83624acfd2 | |||
| d915ddc647 | |||
| 61b741c34e | |||
| aa1910a834 | |||
| dba36c07fe | |||
| 8451e6dcf1 | |||
| 88dfe6eb9c | |||
| 800b697d06 | |||
| 2176a654cd | |||
| 2176788d1c | |||
| 6389fa2d81 | |||
| 8a0b64dd00 | |||
| 79ac207532 | |||
| c33e12b66f | |||
| 5d0dfb80d4 | |||
| 7ebab92f16 | |||
| 1a851f7c33 | |||
| 74ee8bea5d | |||
| dec1748978 | |||
| 4ef47e1040 | |||
| 42f242ce42 | |||
| c4914a64bb | |||
| 4aa05dfcf2 | |||
| 255ff5d789 | |||
| 75f5186dec | |||
| 0cf6d80705 | |||
| 2d96c6ad22 | |||
| ef7ec13861 | |||
| 8008e09918 | |||
| 75ace76c6a | |||
| 9de58a29e3 | |||
| 56aff41b7e | |||
| a8417a7e23 | |||
| 582c9b7f08 | |||
| 2eb6ca75a8 | |||
| 4918ac6307 | |||
| acc03e91f3 | |||
| 8e1466a35a | |||
| 5b73af668f | |||
| deb035c7fe | |||
| 2075a99c9b | |||
| 74b1f603df | |||
| ed1eb1c018 | |||
| 4bed2e57cb | |||
| 0629f502b5 | |||
| fd93873cc1 | |||
| dbd58dbbc6 | |||
| b2edf61588 | |||
| 96b6975deb | |||
| 9449dab0b7 | |||
| 6da9dbcc53 | |||
| d1bdea21b4 | |||
| 5ea0f3253f | |||
| b1e5c02e0c | |||
| f48d97ab04 | |||
| 8f85e04d61 | |||
| 1eab9b34fe | |||
| 13a3c44b61 | |||
| f6b106598c | |||
| f6aed13605 | |||
| 62dd8e67df | |||
| ba7620e0ee | |||
| 931f6a35dd | |||
| d3394733b1 | |||
| 0f5d175b09 | |||
| c93111bf4b | |||
| adb0f0a46f | |||
| 60454c0c39 | |||
| de35de9e00 | |||
| d5d91ae592 | |||
| 9c852af5b7 | |||
| 24fcfd125c | |||
| 1ad42519d6 | |||
| 3052dcc95a | |||
| 17089d8316 | |||
| ce919632be | |||
| f3168c3603 | |||
| a6ca88b5ac | |||
| 8625a59d4c | |||
| cb4289fd19 | |||
| 9ac5f837f7 | |||
| 033ab9ac71 | |||
| 228fe71eb4 | |||
| 80462cf559 | |||
| e5df16ba2b | |||
| b0f4d56de1 | |||
| 7bc0f8731f | |||
| b4b49a4296 | |||
| 507054e9cd | |||
| 342b8b157b | |||
| 74fc8f6db0 | |||
| 04bb3dfe9d | |||
| 7fb15269d1 | |||
| 49772d2539 | |||
| 0f4bd34bce | |||
| 2451cbddec | |||
| b7363225da | |||
| a9c0756da4 | |||
| 2652068933 | |||
| 022105cdba | |||
| 2fa05ed245 | |||
| 124be52411 | |||
| 6f8272718d | |||
| bac1fb18f0 | |||
| 391204ea0d | |||
| 810f3efcbb | |||
| e4a80d887a | |||
| 45d496bd01 | |||
| 20a5b2d4c4 | |||
| cc2637b310 | |||
| 3fc404cd25 | |||
| e016fa913f | |||
| e1c6f4f58f | |||
| c50888fc79 | |||
| 7c0a911e9f | |||
| 0562776b7a | |||
| 9cf79ffb5a | |||
| 63b0ef65e0 | |||
| 62bf6a9d57 | |||
| 4ad6244d8d | |||
| b2f72020bd | |||
| d73f96e3d8 | |||
| f8210e4a2a | |||
| 1ccaf45740 | |||
| d268ccea5b | |||
| 10efb6e55a | |||
| 171c44507a | |||
| 9514f057dc | |||
| e154857aca | |||
| 59c06bcaf1 | |||
| 17f02b2ff0 | |||
| 6316b78a5e | |||
| e53269c37f | |||
| a43adf7d4f | |||
| 16d24d4b43 | |||
| 4a3ae82748 | |||
| 60fe2ce30e | |||
| b294530716 | |||
| 0652267d00 | |||
| b857374aa2 | |||
| 480ce08d39 | |||
| 63f33a42e3 | |||
| f6d1baa50a | |||
| 0df1ec8765 | |||
| 19e128041b | |||
| 76f8b3df22 | |||
| e1e791fc75 | |||
| bbf59a731d | |||
| 803bcbbea0 | |||
| 6f384c8802 | |||
| d6eb66c738 | |||
| 7078381175 | |||
| 0ffef66cb6 | |||
| dfc17244d4 | |||
| ecb9f607ed | |||
| 35126ba22c | |||
| 5cdf03ff6d | |||
| d128b30279 | |||
| cadea90109 | |||
| 90d1695bbc | |||
| 713cb032b5 | |||
| 24ed144200 | |||
| ebc584b2a7 | |||
| dcef21676d | |||
| ff2da496af | |||
| 9d5f85634c | |||
| 7efda5fbbd | |||
| 60696a895c | |||
| 8b26f50003 | |||
| bf78ac7a6c | |||
| f9e9ed53f9 | |||
| d727063036 | |||
| 26f69bccef | |||
| 95f991b5de | |||
| 2a4b72246b | |||
| e62c9d89b1 | |||
| 3926173dfe | |||
| 9098a7c128 | |||
| d77de385f0 | |||
| 7bcd3e2262 | |||
| 2f35d97b27 | |||
| 152dc56df4 | |||
| 32930319ea | |||
| 2e54232181 | |||
| 8648017b42 | |||
| f974c8259e | |||
| f6f99e45b9 | |||
| 414fca0664 | |||
| 2641a0d98e | |||
| 53e8d68878 | |||
| 7a6d0c3432 | |||
| b049902925 | |||
| a8289c3223 | |||
| e46d742d6c | |||
| 24d996c8c4 | |||
| 8b2cdc434b | |||
| a7c4f15fea | |||
| 05b0cc9e76 | |||
| 495aaa4c56 | |||
| b57ba269a6 | |||
| 4948eb0d45 | |||
| e5e6b9e820 | |||
| 1c2b236c86 | |||
| 6ca66a04da | |||
| 2595be63a1 | |||
| c31b36975d | |||
| 73a2fcd301 | |||
| 00b0a7c811 | |||
| 2ef93cad44 | |||
| d3aa304556 | |||
| 228927b4e9 | |||
| 6fc393c7db | |||
| 361fdcce1b | |||
| 12cf696097 | |||
| e7ae6cd190 | |||
| 61dfe4ef07 | |||
| d3099ecf75 | |||
| c183e3f342 | |||
| a5ded3341a | |||
| bb15c56a2d | |||
| c61931996a | |||
| cb6c91be06 | |||
| bfcdec47c1 | |||
| c0445ed857 | |||
| 4e79d1ecdd | |||
| 4306af3ef3 | |||
| a01f9f99f4 | |||
| 08186f4131 | |||
| bdc9807dee | |||
| d77180d9b5 | |||
| b0bcaa971e | |||
| 4294202074 | |||
| 1e013274c2 | |||
| 39c7024f12 | |||
| 375f3a7164 | |||
| 370bdef8d0 | |||
| 7b1e75e6ed | |||
| 5c1a089981 | |||
| cfb59094fe | |||
| 7d30a2bc54 | |||
| 472879e95a | |||
| 7027d02f94 | |||
| 561441b48a | |||
| fe5c7a60ab | |||
| 1a3dc72af8 | |||
| c919694f37 | |||
| 6fbdf8f0e2 | |||
| 4060ec3038 | |||
| 32626970a0 | |||
| bc0a53a226 | |||
| b6a044111b | |||
| 3c4286c98b | |||
| 6d996e31b8 | |||
| ec4faad589 | |||
| 13820bc002 | |||
| 6ad9f25e7d | |||
| a348fde7d1 | |||
| d25017dd5b | |||
| 9b965f367a | |||
| adca34ac6a | |||
| 51a4a92ec4 | |||
| ae8ea3b938 | |||
| b57d77dd0b | |||
| d5cbb56160 | |||
| e97c2a6864 | |||
| 41447e9b44 | |||
| 7aa368c2c5 | |||
| 6a00eaa4a3 | |||
| 9240566167 | |||
| 9eaa5f90e0 | |||
| 214f785c97 | |||
| ae0534cbb4 | |||
| f3c5c458c6 | |||
| d6fd5598ab | |||
| c41b334f0a | |||
| c3a6bf3d40 | |||
| cb7aa5143b | |||
| 8942abfc64 | |||
| e5ef973d52 | |||
| 0bd45f691e | |||
| 117c70ed7d | |||
| d09f88d53b | |||
| 06f17d9415 | |||
| c1d8e979f3 | |||
| 16f286735d | |||
| 45c7490180 | |||
| 1566b357cb | |||
| 7d9222926a | |||
| b957d5176e | |||
| e76a520c19 | |||
| f0d205fed9 | |||
| 42811d0602 | |||
| b54c03f89e | |||
| 5596790a6e | |||
| e55263be00 | |||
| 441c2b50b9 | |||
| 0a3f5b65bf | |||
| 93c29ad15e | |||
| 8f565ef7f0 | |||
| d97de297af | |||
| 18ac4c2288 | |||
| 0c6eb6dec3 | |||
| 4a274709e7 | |||
| c6e4f18d99 | |||
| 0e5155ae2f | |||
| aa78abc649 | |||
| 1c62fc868d | |||
| f9c2f03a44 | |||
| dfd11b7596 | |||
| 98796f6250 | |||
| b728251bcc | |||
| d894faaeaa | |||
| 8b114c81c5 | |||
| 97ffb60f23 | |||
| 41b7182661 | |||
| 19e5a231a7 | |||
| 01fcb2276b | |||
| 19b4e98ee7 | |||
| 77c76bbc8a | |||
| 00bb1636da | |||
| 50ec496c54 | |||
| 2b8ad1b65c | |||
| 5c5f077a4a | |||
| b05f6f1614 | |||
| 0180cb380f | |||
| 882e48b457 | |||
| fa56b17c88 | |||
| 6b1c2da867 | |||
| 84eacd13a1 | |||
| b6bd1a9373 | |||
| 7e39411910 | |||
| 2f3659e7ac | |||
| c0567aa011 | |||
| 9b310ab955 | |||
| 5226855158 | |||
| ee19354484 | |||
| e967020ebe | |||
| 7b0d45402a | |||
| 714250d9f6 | |||
| b4e3ce1166 | |||
| 1958cafbdf | |||
| 248de56fb0 | |||
| 89349c1084 | |||
| e2c0c6362f | |||
| 7cc55d2d3a | |||
| e5d5335701 | |||
| 888a35bbde | |||
| ad9109cad4 | |||
| 232d0e8b6b | |||
| 0d94532df9 | |||
| 799302cd6d | |||
| c33b3fd314 | |||
| dc50b7b065 | |||
| 00a82905ec | |||
| f35ed59868 | |||
| 3cd87c2a44 | |||
| 6cbc10db81 | |||
| 4c28070449 | |||
| bf4f6cff3c | |||
| 5db9a6af9d | |||
| b968bac318 | |||
| 7ea907c343 | |||
| b71d66de94 | |||
| 06043b4a14 | |||
| d836d7187e | |||
| b0ecb5b62d | |||
| 09febce4ce | |||
| c5621ff44b | |||
| d58f3114cc | |||
| e1caaed3cf | |||
| 11959f5023 | |||
| 197e5f920d | |||
| e1300a9342 | |||
| 524d2572aa | |||
| 340bab73f5 | |||
| 8d1529cc48 | |||
| c501a73251 | |||
| 6b1c02526f | |||
| d8d7284c35 | |||
| a5a8b93a2e | |||
| a72fd0ebdd | |||
| d5bd1f5aea | |||
| 17c27d1176 | |||
| df698b9433 | |||
| 2ea59ac83a | |||
| 4264e5bee3 | |||
| 411bcc58c5 | |||
| f02cd717bc | |||
| 91f40ac779 | |||
| 04ffee8e82 | |||
| 54253ba8a3 | |||
| ddd533ee9c | |||
| 46133c76b2 | |||
| d4e9ace354 | |||
| 88dd914a31 | |||
| ca68d32a47 | |||
| 3c86dbe28c | |||
| 400bac868e | |||
| 7e765db562 | |||
| a993e179ab | |||
| 5253ff35f1 | |||
| cba0ec4de5 | |||
| ed0354dd06 | |||
| d255d6aeeb | |||
| 94abd0ee79 | |||
| 6a3cd9c0d7 | |||
| 81be16d058 | |||
| 3efdc963d8 | |||
| a4525bf88c | |||
| d7c7ff3dad | |||
| 987aec3fd6 | |||
| d5661c24bd | |||
| c3ee1111f9 | |||
| 9c1509b8c3 | |||
| 1020cdd7a6 | |||
| bff2f53996 | |||
| d5bf831f60 | |||
| 6c423be36f | |||
| 3c33e2c046 | |||
| 253ff41819 | |||
| 24d95b410d | |||
| db5aacf984 | |||
| 111a56dd8a | |||
| d1d0d61b4f | |||
| 640f279abe | |||
| 874191bd8d | |||
| 2066af9f28 | |||
| ef7b3c1715 | |||
| 6eb96851f9 | |||
| a42ef9de77 | |||
| fb23fe3084 | |||
| 57f0150a23 | |||
| 9b31a986b6 | |||
| 8fa46a1f9e | |||
| d805f5ceff | |||
| b4242e562d | |||
| 2effa810c1 | |||
| a78af6acc2 | |||
| fc084c84f4 | |||
| a846ab7443 | |||
| 9f53272d34 | |||
| aa53aac7be | |||
| db984fcad9 | |||
| 607713cdae | |||
| 7de0a61de3 | |||
| 1838460c38 | |||
| 3a4e00d0f5 | |||
| a9bd82150b | |||
| de5c3733d0 | |||
| 3ff662e710 | |||
| 669571799b | |||
| 81a98fc0d3 | |||
| f10157fb24 | |||
| 7d94508257 | |||
| 262a8607d0 | |||
| fd44a9552a | |||
| 8e2d6d8cb2 | |||
| 13b73cb51f | |||
| 5f730ba360 | |||
| 79dbbadf2d | |||
| cd150c265f | |||
| 7a50a91eab | |||
| b5561ee5d4 | |||
| 8dcda7fe35 | |||
| 9b679cc8dd | |||
| 674f8cc936 | |||
| 51a43ef45b | |||
| acc55d588a | |||
| d4990b30e9 | |||
| 920a8d34ea | |||
| c8dfcf4b39 | |||
| aa93632707 | |||
| cc55262cbc | |||
| f887b62a85 | |||
| 5b20781080 | |||
| 98a1efc123 | |||
| a628c1f5e4 | |||
| 6588e8fabf | |||
| 52d349538e | |||
| aad2b3a492 | |||
| 93180abf7b | |||
| e30c8d8949 | |||
| a90c5d71ad | |||
| 54f56813a5 | |||
| 8d29229c0f | |||
| dc498128be | |||
| 6d5b71b663 | |||
| 122fcbb40b | |||
| 4fc28bb65e | |||
| a7f92a3187 | |||
| dd16b68623 | |||
| df24d87245 | |||
| 6000e04c78 | |||
| 87181a8ecb | |||
| 7d0731754c | |||
| 962e63ab52 | |||
| 9f4b43f3f2 | |||
| ef722200c9 | |||
| 784f47fa86 | |||
| 90cdc28707 | |||
| 62844b321c | |||
| 8a6c7f5538 | |||
| 8c3eeb5201 | |||
| 5998fabadd | |||
| 97be02356f | |||
| e59867d479 | |||
| 8e1bcaed37 | |||
| f3c864c178 | |||
| 947923509e | |||
| 4e0f77c0f4 | |||
| 6f0505f19c | |||
| 98bf66cb25 | |||
| f9b641b24d | |||
| 3894314ab2 | |||
| edc9d38680 | |||
| ce5f72207e | |||
| ff8d009022 | |||
| 589c33ec05 | |||
| 28fe5b0df5 | |||
| 5a3dfe598f | |||
| d0c132ccd4 | |||
| 826541548c | |||
| e3adc76a72 | |||
| 2ae2d7ee1a | |||
| e28b50e8d6 | |||
| 9c78d86f58 | |||
| a6b23a751e | |||
| 34d5f1f9fe | |||
| 43ad15dc0e | |||
| d20147c79f | |||
| 7cc014cf9e | |||
| 9e735fc940 | |||
| 4fecf6c50d | |||
| c31c14e46b | |||
| 349dbb98a6 | |||
| f4fa5bb0fc | |||
| 4cdf75dc72 | |||
| 53eb39e033 | |||
| 57ae43890c | |||
| 1c59574cbf | |||
| 7ddef03aba | |||
| 4258738b89 | |||
| 594864e117 | |||
| a5698ce480 | |||
| 1a2c9011e6 | |||
| 600ac72a3d | |||
| 1118eed080 | |||
| e42c66bd0e | |||
| ff8fae377c | |||
| 6931252ed9 | |||
| ef8e549d86 | |||
| a5470029a8 | |||
| 13fb23d59d | |||
| a3197578d6 | |||
| ebc14b35f5 | |||
| b0235a2805 | |||
| d0069e0e1d | |||
| 878f136951 | |||
| bf364bf74c | |||
| 03c2850c59 | |||
| 4eddc7131d | |||
| 14be1935e8 | |||
| f08029354a | |||
| c18600b67f | |||
| 2acc0a6844 | |||
| 8ffba3a52f | |||
| 0fb2f35b10 | |||
| f8270b9cec | |||
| d3311ee231 | |||
| 21eb2c8dad | |||
| a11fd7a792 | |||
| a2ad9f8b10 | |||
| 9a0e2f3395 | |||
| cd9196ddb9 | |||
| c10fe673a2 | |||
| 105f8a1720 | |||
| 050f47daf1 | |||
| 683abd2029 | |||
| d08f937932 | |||
| 2f51742311 | |||
| b926d2f0bd | |||
| 89d1d36e79 | |||
| 999cd8cd11 | |||
| fd8b281731 | |||
| d8481b4528 | |||
| 6d93fa046c | |||
| c75672fd44 | |||
| 5484796745 | |||
| 4ed45e0515 | |||
| 9956c04526 | |||
| b74af71312 | |||
| 44640422f2 | |||
| be91f378ac | |||
| bdca18cc9f | |||
| 76cb15f545 | |||
| 4f9e754a51 | |||
| 955774a91a | |||
| e8a9485d5e | |||
| 0736c141b9 | |||
| 204549f55b | |||
| 82a5f307ed | |||
| 7a4650a1a9 | |||
| 518980d9ed | |||
| 5cc1e2e42d | |||
| c599385c8b | |||
| 1d37d3fdf7 | |||
| f3db64af05 | |||
| 3217372720 | |||
| 7a50654f3b | |||
| 9893921d76 | |||
| 5574f35473 | |||
| fd42e493c0 | |||
| 7843e6a709 | |||
| 4c129ec208 | |||
| 1bf44561da | |||
| ad612864ce | |||
| 1707436cad | |||
| b011d508f8 | |||
| f67a477f65 | |||
| 3573b97bfc | |||
| 37a42a3fb7 | |||
| 2d13ddc70c | |||
| 0be01f3c24 | |||
| eb492724c7 | |||
| 3b05d03220 | |||
| 4c04233a20 | |||
| 2b6d2fc117 | |||
| f64ef39687 | |||
| c1fb392333 | |||
| de60d5467c | |||
| c1274e24b0 | |||
| 7f593d3999 | |||
| 3a6a6097a7 | |||
| 69989e4e64 | |||
| 88999b34d3 | |||
| 582732918d | |||
| f1f69c607e | |||
| 8e82fee494 | |||
| a51475a094 | |||
| f25e2d48bd | |||
| 2bbff64a12 | |||
| 70b4503187 | |||
| 912bd4458f | |||
| d3f4494925 | |||
| 464467ae8b | |||
| 8e579ec8e0 | |||
| 4ef6cbf4fb | |||
| 68dfcddbe9 | |||
| 907761f14e | |||
| be7917c8d8 | |||
| 2e25f09ae4 | |||
| ea95d8604a | |||
| 35def3ab2e | |||
| 5527c12a8d | |||
| fb1cc72013 | |||
| 1f34883a27 | |||
| 724262651f | |||
| d7b2247878 | |||
| 372e7b6312 | |||
| 323a2d83fa | |||
| 03c3393616 | |||
| cbff011e3c | |||
| 2ba6fad633 | |||
| bc4878d71e | |||
| e991ae504b | |||
| c18181042f | |||
| 3de80d3b20 | |||
| 39dcd0a352 | |||
| 199e31ea3f | |||
| dce2247925 | |||
| 89e78c0276 | |||
| 9a57c11348 | |||
| 1dbe8b2a79 | |||
| 29fd0caf58 | |||
| d30701ed59 | |||
| e39550e77f | |||
| a21e7a5eee | |||
| 927b5ae707 | |||
| f59626004c | |||
| 2ece2719d0 | |||
| 78ee542d8d | |||
| cea9b38815 | |||
| cb8f6db68d | |||
| 85038c2b46 | |||
| 1e8055f504 | |||
| a7a5f20d1c | |||
| 0d744a4e74 | |||
| 216ec60dc1 | |||
| 3d9047bec4 | |||
| 08d65beb26 | |||
| 5cab66fb18 | |||
| 9466624f9d | |||
| 80b842a704 | |||
| d513a9fe5c | |||
| c98081cb04 | |||
| 17a1dc18be | |||
| b22ff229db | |||
| 23b03fd6ab | |||
| 97b273905a | |||
| e759c4d27a | |||
| 76685ae2d9 | |||
| 3fad3ceb35 | |||
| dede9e8549 | |||
| 97c018118d | |||
| 8b1ce36402 | |||
| 7931f315b1 | |||
| abb6404ab2 | |||
| c434542c65 | |||
| 42b7aa6450 | |||
| f2ce9cf857 | |||
| 56134d0202 | |||
| f33bbe2d5d | |||
| 59a478bdc5 | |||
| 141b332d4f | |||
| d4a312d6cb | |||
| 31d688b34c | |||
| fbef9ea600 | |||
| 0688491e1b | |||
| 434161687e | |||
| 4b3709b96b | |||
| 1fa993303d | |||
| 01897e7755 | |||
| 7040b2178d | |||
| edf23c4c18 | |||
| b0b9e66fad | |||
| 89488a43b9 | |||
| 798e13f70d | |||
| e758391a23 | |||
| 00d1e01e12 | |||
| 4f265a52a2 | |||
| 560717de76 | |||
| 0f40894317 | |||
| 3915e882a8 | |||
| c5caa23a63 | |||
| 36978d2ddc | |||
| 3f90c895b9 | |||
| 2ada171806 | |||
| 5dc683c968 | |||
| 7026cfe140 | |||
| b7cd1dd764 | |||
| 09bb8fc4f4 | |||
| 746ab49d36 | |||
| 1614dc975a | |||
| ba7598d90d | |||
| 92fc4872e8 | |||
| 30dbfc33a4 | |||
| b3de5aa08e | |||
| ba4773e448 | |||
| a713ee852c | |||
| a65accd412 | |||
| 1dc9583e06 | |||
| 3afe02ac1f | |||
| 57aa61f1ba | |||
| 121ea14fe4 | |||
| 9d457dc0ab | |||
| befd836ab4 | |||
| 044c301d64 | |||
| 94fd0df2e2 | |||
| e5087ca3db | |||
| 819a9da599 | |||
| fb02e55424 | |||
| 70e86434ef | |||
| c41b1e2f06 | |||
| 64641c28ef | |||
| 69e9f4ada2 | |||
| d28cf632e4 | |||
| b466bfa6c8 | |||
| 1c06f4cf06 | |||
| 25f40566ed | |||
| e8fa2cbc4d | |||
| 779c441e0a | |||
| e33031ee7d | |||
| ae63313b55 | |||
| ae50b8d839 | |||
| 10a27156c2 | |||
| 94057886a3 | |||
| 2d9bcb6e4f | |||
| 249bcd9e1a | |||
| b2679b7648 | |||
| 9995b8714b | |||
| 7b4dd2f7f5 | |||
| cc6b01cf88 | |||
| 3568ff72bf | |||
| e20614660b | |||
| c5a69f073c | |||
| 3025671b1a | |||
| 74da0043b4 | |||
| c0ddca12df | |||
| bf55e610b9 | |||
| 4e775a4090 | |||
| 9f7b31b5c5 | |||
| 279641df73 | |||
| 9e1fd16329 | |||
| d6ff5f0239 | |||
| 3f5d3fa0c6 | |||
| 51dc2b109e | |||
| 2358ff6f07 | |||
| 11788d2f39 | |||
| 541f7467c6 | |||
| 411c9707ee | |||
| ee0ba17c03 | |||
| 64bc850d8f | |||
| 154f64dae3 | |||
| 7fa758358f | |||
| f135881bd6 | |||
| 839301f81e | |||
| 04f4ca9772 | |||
| 525328fba1 | |||
| 471c125c1a | |||
| 8ef99137c6 | |||
| 404cad062a | |||
| d4be813f2e | |||
| ab3c0b2f03 | |||
| defcfc2962 | |||
| 267cfdf54b | |||
| a7b0231b3c | |||
| 7c19958840 | |||
| 34c3bb7d2c | |||
| b37545ee6c | |||
| c1e924c894 | |||
| 200e9e28ea | |||
| b95f958890 | |||
| fe9666bdaf | |||
| 948de5dc79 | |||
| 8800fd8250 | |||
| b1e5d8c915 | |||
| 02aec8b091 | |||
| 50517f6aa6 | |||
| a752473280 | |||
| 7e1972d483 | |||
| de48bf04bc | |||
| 228bf66cac | |||
| c986c1d26a | |||
| b0f7ea5b16 | |||
| 8b2e2ff1f8 | |||
| d00166223f | |||
| 4701b4bfc2 | |||
| e4c74c727f | |||
| f626ce29c4 | |||
| 768d8e5811 | |||
| 2ac3a4a103 | |||
| bb512f3fc0 | |||
| d6e7a89c97 | |||
| a5455da909 | |||
| 8dadc698cc | |||
| 2127712115 | |||
| d5b635027e | |||
| 9b2aeda51e | |||
| 5aba9b539f | |||
| b82020722b | |||
| b62a8fe65a | |||
| a5d85e3281 | |||
| e699bcf5a3 | |||
| 7ef5e079fd | |||
| 4076461347 | |||
| d610486c1e | |||
| 1891e2ad68 | |||
| f1e060902b | |||
| 7dbd920912 | |||
| 05ab9e3836 | |||
| a4e0f1f7aa | |||
| a8f27d13e6 | |||
| 05d425ea88 | |||
| 3cb12b5a60 | |||
| 8f1237e629 | |||
| 2c7f44f78d | |||
| a9447aa8c7 | |||
| 9b61b350fe | |||
| e3cf65fbdf | |||
| e51d43568e | |||
| 1bb6b7acdd | |||
| adc7a3ba4a | |||
| 94ec6cc362 | |||
| bbdb5eb6e3 | |||
| e487ca8bd8 | |||
| f5b0e20f78 | |||
| 6116eebbad | |||
| 8619705e44 | |||
| c216ed2d1f | |||
| e17dc25bba | |||
| d311915f9d | |||
| 3a95826b42 | |||
| dcc1009162 | |||
| d61e01ff4f | |||
| 51b9d8e7ad | |||
| 90eb5e9c31 | |||
| 17c34c88dc | |||
| ff6f658f9d | |||
| fb798a4150 | |||
| 4213bb3a62 | |||
| 8a34f91172 | |||
| 764ddd4773 | |||
| ea0dcc8ebd | |||
| 3f5db9f7f9 | |||
| a6a0bba1b7 | |||
| 5ec785e2f7 | |||
| f7d9f1f69d | |||
| 42efd2d005 | |||
| d32e13daee | |||
| e82c21e944 | |||
| 33f835a437 | |||
| 59d8110801 | |||
| d028b381fa | |||
| a1a3f810f0 | |||
| c96f0f2396 | |||
| 46c8985661 | |||
| c588639503 | |||
| b3c6f559b2 | |||
| 85544d109c | |||
| 4aba595b2b | |||
| b2241dca72 | |||
| 4ffe742b69 | |||
| 5979b8e385 | |||
| 955bd5a6d1 | |||
| 1eb8191519 | |||
| 396bda5611 | |||
| cb334be8c4 | |||
| 8845cc0556 | |||
| e34800ad49 | |||
| 5b574901b3 | |||
| 59b68154e1 | |||
| 5a501c8e48 | |||
| f927c15adf | |||
| d08157f7db | |||
| 8a9ac4f01f | |||
| 39df5f3b15 | |||
| 981bf328ae | |||
| 1f8e9727b0 | |||
| f604bcb557 | |||
| eccf9eb4a4 | |||
| 39403fa885 | |||
| 5e7cc30564 | |||
| f942b4c657 | |||
| f5aeb5b068 | |||
| 7f6cb9b07b | |||
| db3657d411 | |||
| 38e5da724d | |||
| 24a63eb304 | |||
| c1f5ae1c5a | |||
| 009211c740 | |||
| 1a208a1612 | |||
| b867e51c6c | |||
| 7693b93c50 | |||
| c3d7158669 | |||
| 9f5e50f25e | |||
| a091ab76d7 | |||
| d5eb242295 | |||
| b21e65fc5f | |||
| 1b07e81936 | |||
| 962b2d45ef | |||
| 7894b41277 | |||
| 51d0b8d2b5 | |||
| 7b992a1dc4 | |||
| 2f8615c6c4 | |||
| aee6d9d01c | |||
| fd4a0dbedf | |||
| 14381ac68a | |||
| c00a98fed4 | |||
| aab7581909 | |||
| 74dcc1b9d5 | |||
| 17241b3543 | |||
| a4a859f47b | |||
| b66ed8bc41 | |||
| 754feff5e7 | |||
| cd1b425a80 | |||
| 187947e8d8 | |||
| 6b38927123 | |||
| f46e4049b6 | |||
| 0ea8299fa7 | |||
| 5d793193e0 | |||
| 62337f75b8 | |||
| 4d4fdfff70 | |||
| b63d0a3138 | |||
| 7949c09183 | |||
| 3f535aca8c | |||
| 9f44809164 | |||
| f7ccb18af5 | |||
| cca9945867 | |||
| f23c6b0c2f | |||
| 6d22b8c6ed | |||
| 245ce7259c | |||
| f36cd60fdb | |||
| 8467e2d376 | |||
| 2529918d5f | |||
| e2711a6121 | |||
| 89d22e5f94 | |||
| f13fda9be5 | |||
| 49f6a63a06 | |||
| e078fea846 | |||
| 048c8b1670 | |||
| 3b5c38d861 | |||
| 90fb075e34 | |||
| 08c6d9ce96 | |||
| 76ccb8c31f | |||
| 3dfc502814 | |||
| df0f626283 | |||
| 1909ce9220 | |||
| 15bef82e1e | |||
| 60a45241e6 | |||
| d403e92315 | |||
| eed7ede376 | |||
| d20f49b58b | |||
| 37091df142 | |||
| 21081cf80f | |||
| c213b37e96 | |||
| d1ca84aa43 | |||
| 0f7fbc411a | |||
| f4b2b1b03f | |||
| 0ecc36c4a5 | |||
| a48eace90a | |||
| 7a2a51ad44 | |||
| f56fcb0a14 | |||
| 7816652078 | |||
| 20aacc7026 | |||
| 49938cfd09 | |||
| 53a4ed6b24 | |||
| 534000b49d | |||
| 7e2ccbf909 | |||
| b0b6968185 | |||
| 94963b5b3a | |||
| 77fa61e6fc | |||
| 94c450ad16 | |||
| a292bf7c83 | |||
| b24ee1c44f | |||
| 981b22ba49 | |||
| e1eedd3bba | |||
| b949fd4d43 |
@@ -30,7 +30,3 @@ bitmaps_png/cpp_*/*.cpp generated
|
||||
# Lemon grammars
|
||||
common/libeval/grammar.c generated
|
||||
common/libeval/grammar.h generated
|
||||
|
||||
# Scripts
|
||||
*.sh text eol=lf
|
||||
*.bat text eol=crlf
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
custom: "https://donate.kicad.org"
|
||||
community_bridge: kicad
|
||||
community_bridge: kicad
|
||||
custom: "https://donate.cernandsocietyfoundation.cern/b/my-donation?cid=4&_cv=1"
|
||||
+3
-5
@@ -1,8 +1,8 @@
|
||||
.downloads-by-cmake
|
||||
.gdb_history
|
||||
boost_root
|
||||
/Build*
|
||||
/build*
|
||||
/Build
|
||||
/build
|
||||
/cmake-build-*
|
||||
common/fp_lib_table_keywords.cpp
|
||||
common/drc_rules_keywords.cpp
|
||||
@@ -27,11 +27,11 @@ eeschema/schematic_keywords.*
|
||||
pcbnew/pcb_plot_params_keywords.cpp
|
||||
pcbnew/pcb_plot_params_lexer.h
|
||||
Makefile
|
||||
CMakeUserPresets.json
|
||||
CMakeCache.txt
|
||||
.cache/
|
||||
auto_renamed_to_cpp
|
||||
Testing
|
||||
version.h
|
||||
config.h
|
||||
install_manifest.txt
|
||||
doxygen/out
|
||||
@@ -52,7 +52,6 @@ bitmaps_png/tmp
|
||||
common/pcb_keywords.cpp
|
||||
include/pcb_lexer.h
|
||||
fp-info-cache
|
||||
qa/tests/output/**
|
||||
|
||||
# demo project auxiliary files
|
||||
demos/**/*-bak
|
||||
@@ -103,7 +102,6 @@ __pycache__
|
||||
.editorconfig
|
||||
CMakeSettings.json
|
||||
.vscode/
|
||||
/vcpkg_installed
|
||||
|
||||
# Sublime Text
|
||||
*.sublime-*
|
||||
|
||||
+30
-2
@@ -8,13 +8,41 @@ default:
|
||||
name: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:36
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Test the formatting in a merge request using clang-format
|
||||
##########################################################################
|
||||
# The variable CI_COMMIT_BEFORE_SHA is not available in normal merge requests
|
||||
# so we must build the commit hash ourselves, see:
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/12850
|
||||
test_formatting:
|
||||
stage: test
|
||||
needs: []
|
||||
only:
|
||||
- merge_requests
|
||||
allow_failure: true
|
||||
before_script:
|
||||
# We must manually add the KiCad remote to ensure it is named sensibly
|
||||
- git remote add product https://gitlab.com/kicad/code/kicad.git ||
|
||||
git remote set-url product https://gitlab.com/kicad/code/kicad.git
|
||||
- git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git ||
|
||||
git remote set-url source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git
|
||||
- git fetch -n product
|
||||
- git fetch -n source
|
||||
# Get the SHAs of the commits
|
||||
- "TARGET_HEAD_SHA=$(git rev-parse product/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME})"
|
||||
- "SOURCE_HEAD_SHA=$(git rev-parse source/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME})"
|
||||
- "MERGE_BASE_SHA=$(git merge-base ${TARGET_HEAD_SHA} ${SOURCE_HEAD_SHA})"
|
||||
script:
|
||||
- echo "Testing formatting from commit ${MERGE_BASE_SHA}"
|
||||
- ./tools/check_coding.sh --diff --ci --commit ${MERGE_BASE_SHA}
|
||||
|
||||
|
||||
include:
|
||||
- local: '/.gitlab/templates.yml'
|
||||
- local: '/.gitlab/Fedora-Linux-CI.yml'
|
||||
- local: '/.gitlab/Ubuntu-20.04-CI.yml'
|
||||
- local: '/.gitlab/Windows-CI.yml'
|
||||
- local: '/.gitlab/macOS-CI.yml'
|
||||
- local: '/.gitlab/coverity.yml'
|
||||
- local: '/.gitlab/linux-metadata-validate.yml'
|
||||
- local: '/.gitlab/doxygen.yml'
|
||||
- local: '/.gitlab/mr_formatting.yml'
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Don't tag until we have separate CI for MRs
|
||||
# tags:
|
||||
# - kicad-fedora
|
||||
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:38
|
||||
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:37
|
||||
extends: .only_code
|
||||
interruptible: false
|
||||
cache:
|
||||
@@ -25,9 +25,8 @@
|
||||
-G Ninja
|
||||
-DCMAKE_BUILD_TYPE=QABUILD
|
||||
-DKICAD_STDLIB_LIGHT_DEBUG=ON
|
||||
-DKICAD_SPICE=ON
|
||||
-DKICAD_BUILD_I18N=ON
|
||||
-DKICAD_TEST_XML_OUTPUT=ON
|
||||
-DKICAD_BUILD_PNS_DEBUG_TOOL=ON
|
||||
../../
|
||||
- ninja 2>&1 | tee compilation_log.txt
|
||||
- cd ../../
|
||||
@@ -39,10 +38,6 @@
|
||||
when: always
|
||||
paths:
|
||||
- build/linux/3d-viewer/
|
||||
- build/linux/common/libkicommon.so*
|
||||
- build/linux/common/gal/libkigal.so*
|
||||
- build/linux/eeschema/_eeschema.kiface
|
||||
- build/linux/kicad/kicad-cli
|
||||
- build/linux/pcbnew/pcbnew.py
|
||||
- build/linux/pcbnew/_pcbnew.kiface
|
||||
- build/linux/pcbnew/_pcbnew.so
|
||||
@@ -140,17 +135,14 @@ fedora_report_metrics_public:
|
||||
# Run the code unit tests.
|
||||
##########################################################################
|
||||
.fedora_qa:
|
||||
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:38
|
||||
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:37
|
||||
extends:
|
||||
- .unit_test
|
||||
- .only_code
|
||||
before_script:
|
||||
- if [ "$TEST" == "cli" ] || [ "$TEST" == "python" ]; then python3 -m pip install -r qa/tests/requirements.txt; fi
|
||||
- if [ "$TEST" == "cli" ]; then sudo dnf -y install gerbv; fi
|
||||
parallel:
|
||||
matrix:
|
||||
# The name of the test without the qa_ prefix
|
||||
- TEST: [python, cli, common, gerbview, pcbnew, pns_regressions, eeschema, kimath, sexpr, kicad2step, spice]
|
||||
- TEST: [python, common, gerbview, pcbnew, eeschema, kimath, sexpr, kicad2step]
|
||||
|
||||
fedora_qa_kicad:
|
||||
extends: .fedora_qa
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
-DKICAD_STDLIB_LIGHT_DEBUG=ON
|
||||
-DKICAD_SCRIPTING_WXPYTHON=ON
|
||||
-DKICAD_USE_OCC=ON
|
||||
-DKICAD_SPICE=ON
|
||||
-DKICAD_BUILD_I18N=ON
|
||||
-DKICAD_BUILD_PNS_DEBUG_TOOL=ON
|
||||
../../
|
||||
@@ -115,4 +116,4 @@
|
||||
parallel:
|
||||
matrix:
|
||||
# The name of the test without the qa_ prefix
|
||||
- TEST: [python, common, gerbview, pcbnew, eeschema, kimath, sexpr, kicad2step, spice]
|
||||
- TEST: [python, common, gerbview, pcbnew, eeschema, kimath, sexpr, kicad2step]
|
||||
|
||||
@@ -5,22 +5,19 @@ win64_build:
|
||||
stage: build
|
||||
tags:
|
||||
- kicad-windows-1809
|
||||
extends: .only_code
|
||||
interruptible: false
|
||||
image: registry.gitlab.com/kicad/kicad-ci/windows-build-image/win1809-msvc:latest
|
||||
variables:
|
||||
VCPKG_BINARY_SOURCES: 'nuget,kicad,readwrite'
|
||||
# Switch the compressor to fastzip and reduce the compression level
|
||||
FF_USE_FASTZIP: "true"
|
||||
CACHE_COMPRESSION_LEVEL: "fast"
|
||||
cache:
|
||||
key: win64-vcpkg-"$CI_COMMIT_REF_SLUG"
|
||||
paths:
|
||||
- build\windows\vcpkg_installed
|
||||
- .vcpkgCache
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule"
|
||||
when: never
|
||||
- if: $CI_PROJECT_ROOT_NAMESPACE == "kicad" && $CI_COMMIT_REF_PROTECTED == "true"
|
||||
only:
|
||||
- branches@kicad/code/kicad
|
||||
- tags@kicad/code/kicad
|
||||
script:
|
||||
- C:\builder\build.ps1 -Env -Arch x64
|
||||
- $vcpkgCache=Join-Path -Path (Get-Location) -ChildPath ".vcpkgCache";$env:VCPKG_DEFAULT_BINARY_CACHE=$vcpkgCache;New-Item -ItemType Directory -Force -Path $vcpkgCache
|
||||
@@ -34,6 +31,7 @@ win64_build:
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-DKICAD_SCRIPTING_WXPYTHON=OFF `
|
||||
-DKICAD_USE_OCC=ON `
|
||||
-DKICAD_SPICE=ON `
|
||||
-DKICAD_BUILD_PNS_DEBUG_TOOL=ON `
|
||||
-DKICAD_USE_3DCONNEXION=ON `
|
||||
../../
|
||||
|
||||
+12
-17
@@ -22,16 +22,13 @@
|
||||
# These results will be saved for 1 day if the build fails.
|
||||
.coverity_submit: &coverity_submit |
|
||||
echo "Creating tar file of scan results"
|
||||
export COV_INT_FILENAME=cov-int-$(date +"%Y%m%d%H%M").tar.gz
|
||||
tar cfz $COV_INT_FILENAME cov-int
|
||||
tar cfz cov-int.tar.gz cov-int
|
||||
echo "Submitting scan results"
|
||||
s5cmd/s5cmd cp $COV_INT_FILENAME s3://$KICAD_CI_R2_BUCKET/coverity/
|
||||
export FILE_URL="$KICAD_CI_R2_PUBLIC_BASE/coverity/$COV_INT_FILENAME"
|
||||
export KICAD_VERSION=$(sed 's/[()]//g' kicad_build_version.txt)
|
||||
curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME \
|
||||
--form token=$COVERITY_SCAN_TOKEN \
|
||||
--form email=$GITLAB_USER_EMAIL \
|
||||
--form url="$FILE_URL" \
|
||||
--form file=@cov-int.tar.gz \
|
||||
--form version="$KICAD_VERSION" \
|
||||
--form description="$KICAD_VERSION / $CI_COMMIT_TITLE" 2>&1 \
|
||||
| tee curl-response.txt
|
||||
@@ -42,9 +39,12 @@ Coverity:
|
||||
tags:
|
||||
- coverity
|
||||
stage: build
|
||||
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:38
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULED_JOB_NAME == "coverity"
|
||||
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:37
|
||||
only:
|
||||
refs:
|
||||
- schedules
|
||||
variables:
|
||||
- $SCHEDULED_JOB_NAME == "coverity"
|
||||
cache:
|
||||
key: coverity
|
||||
paths:
|
||||
@@ -53,23 +53,18 @@ Coverity:
|
||||
- export COVERITY_SCAN_PROJECT_NAME="kicad"
|
||||
- test "$(git rev-parse --is-shallow-repository)" = "false" || (git fetch --unshallow)
|
||||
- git fetch origin
|
||||
- curl -LO https://github.com/peak/s5cmd/releases/download/v2.0.0/s5cmd_2.0.0_Linux-64bit.tar.gz
|
||||
- mkdir s5cmd
|
||||
- tar -xvf ./s5cmd_2.0.0_Linux-64bit.tar.gz -C s5cmd
|
||||
- export AWS_ACCESS_KEY_ID=$KICAD_CI_R2_KEY_ID
|
||||
- export AWS_SECRET_ACCESS_KEY=$KICAD_CI_R2_ACCESS_KEY
|
||||
- export S3_ENDPOINT_URL=$KICAD_CI_R2_ENDPOINT
|
||||
script:
|
||||
- *coverity_cache_prep
|
||||
- cmake
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
-DCMAKE_BUILD_TYPE=Debug
|
||||
-DKICAD_STDLIB_LIGHT_DEBUG=ON
|
||||
-DKICAD_SCRIPTING_WXPYTHON=ON
|
||||
- coverity/bin/cov-build --dir cov-int make -j10
|
||||
-DKICAD_SPICE=ON
|
||||
- coverity/bin/cov-build --dir cov-int make -j8
|
||||
- *coverity_submit
|
||||
artifacts:
|
||||
expire_in: 1 year
|
||||
expose_as: 'Coverity log'
|
||||
name: "coverity_log.txt"
|
||||
paths:
|
||||
- cov-int/build-log.txt
|
||||
- cov-int/build-log.txt
|
||||
|
||||
+5
-2
@@ -3,8 +3,6 @@ build_doxygen_docker:
|
||||
services:
|
||||
- docker:dind
|
||||
stage: build
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULED_JOB_NAME == "doxygen"
|
||||
tags:
|
||||
- docker
|
||||
before_script:
|
||||
@@ -13,3 +11,8 @@ build_doxygen_docker:
|
||||
script:
|
||||
- docker build -t "${CI_REGISTRY_IMAGE}/doxygen:$CI_COMMIT_BRANCH" -f ./doxygen/doxygen.Dockerfile .
|
||||
- docker push "${CI_REGISTRY_IMAGE}/doxygen:$CI_COMMIT_BRANCH"
|
||||
only:
|
||||
refs:
|
||||
- schedules
|
||||
variables:
|
||||
- $SCHEDULED_JOB_NAME == "doxygen"
|
||||
|
||||
@@ -6,18 +6,23 @@ validate_linux_metadata:
|
||||
needs: []
|
||||
interruptible: false
|
||||
# This is the only CI image with the utilities needed for this test
|
||||
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:38
|
||||
image: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:37
|
||||
# Due to bug https://github.com/hughsie/appstream-glib/issues/381, this doesn't think our description tag
|
||||
# is localized even though it actually is.
|
||||
allow_failure: true
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule"
|
||||
when: never
|
||||
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
changes:
|
||||
- resources/linux/**/*
|
||||
- qa/resources/linux/**/*
|
||||
- translation/**/*
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
- branches
|
||||
- merge_requests
|
||||
- pushes
|
||||
changes:
|
||||
# Only run if the resources, its tests, or the translations are updated
|
||||
- resources/linux/**/*
|
||||
- qa/resources/linux/**/*
|
||||
- translation/**/*
|
||||
except:
|
||||
- schedules
|
||||
# Only build the metadata files in this CI job
|
||||
script:
|
||||
- mkdir -p build/linux
|
||||
@@ -26,6 +31,7 @@ validate_linux_metadata:
|
||||
-DCMAKE_BUILD_TYPE=Debug
|
||||
-DKICAD_STDLIB_LIGHT_DEBUG=ON
|
||||
-DKICAD_SCRIPTING_WXPYTHON=ON
|
||||
-DKICAD_SPICE=ON
|
||||
-DKICAD_BUILD_I18N=ON
|
||||
../../
|
||||
- make metadata
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
##########################################################################
|
||||
# Build KiCad on Windows and save the results
|
||||
##########################################################################
|
||||
macos_build:
|
||||
stage: build
|
||||
tags:
|
||||
- kicad-macos
|
||||
interruptible: false
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule"
|
||||
when: never
|
||||
- if: $CI_PROJECT_ROOT_NAMESPACE == "kicad" && $CI_COMMIT_REF_PROTECTED == "true"
|
||||
script:
|
||||
- mkdir -p build/macos
|
||||
- cd build/macos
|
||||
- cmake
|
||||
-G Ninja
|
||||
-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 ../../
|
||||
artifacts:
|
||||
# Only save the artifacts that are needed for running the tests in the next stage
|
||||
# and the compilation log. The entire build directory is too large to save as an
|
||||
# artifact.
|
||||
expire_in: 2 hrs
|
||||
when: always
|
||||
paths:
|
||||
- build/macos/compilation_log.txt
|
||||
@@ -12,10 +12,8 @@ test_formatting:
|
||||
allow_failure: true
|
||||
before_script:
|
||||
# We must manually add the KiCad remote to ensure it is named sensibly
|
||||
- git remote add product https://gitlab.com/kicad/code/kicad.git ||
|
||||
git remote set-url product https://gitlab.com/kicad/code/kicad.git
|
||||
- git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git ||
|
||||
git remote set-url source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git
|
||||
- git remote add product https://gitlab.com/kicad/code/kicad.git
|
||||
- git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git
|
||||
- git fetch -n product
|
||||
- git fetch -n source
|
||||
# Get the SHAs of the commits
|
||||
|
||||
+10
-10
@@ -17,21 +17,21 @@
|
||||
.unit_test:
|
||||
stage: test
|
||||
when: on_success
|
||||
variables:
|
||||
BOOST_TEST_LOGGER: 'JUNIT,warning,test_results.${TEST}.xml:HRF,warning'
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
# We define this using a before script because GitLab cannot merge variable
|
||||
# definitions across inheritance (so the variables block from this would disappear)
|
||||
before_script:
|
||||
- export BOOST_TEST_LOGGER='JUNIT,all,test_results.${TEST}.xml:HRF,warning'
|
||||
- export CTEST_OUTPUT_ON_FAILURE=1
|
||||
script:
|
||||
- cd build/linux/qa
|
||||
- ctest -R qa_${TEST}
|
||||
# GitLab supports displaying the results in the GUI through JUNIT artifacts
|
||||
# (https://docs.gitlab.com/ee/ci/junit_test_reports.html)
|
||||
# so we upload the JUNIT results.
|
||||
# so we upload the JUNIT results. Note that there is a bug with how paths
|
||||
# are processed in the junit report (https://gitlab.com/gitlab-org/gitlab/-/issues/23835)
|
||||
# so we can't use a glob and have to list out each hierarchy separately.
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- build/linux/qa/**/*.log
|
||||
- build/linux/qa/**/output/*
|
||||
- build/linux/qa/**/*.xml
|
||||
reports:
|
||||
junit:
|
||||
- build/linux/qa/**/*.xml
|
||||
- build/linux/qa/*/*.xml
|
||||
- build/linux/qa/*/*/*.xml
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#define MASK_3D_CACHE "3D_CACHE"
|
||||
|
||||
static std::mutex mutex3D_cache;
|
||||
static std::mutex mutex3D_cacheManager;
|
||||
|
||||
|
||||
static bool isSHA1Same( const unsigned char* shaA, const unsigned char* shaB ) noexcept
|
||||
@@ -696,4 +697,63 @@ void S3D_CACHE::CleanCacheDir( int aNumDaysOld )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PROJECT::Cleanup3DCache()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock( mutex3D_cacheManager );
|
||||
|
||||
// Get the existing cache from the project
|
||||
S3D_CACHE* cache = dynamic_cast<S3D_CACHE*>( GetElem( ELEM_3DCACHE ) );
|
||||
|
||||
if( cache )
|
||||
{
|
||||
// We'll delete ".3dc" cache files older than this many days
|
||||
int clearCacheInterval = 0;
|
||||
|
||||
if( Pgm().GetCommonSettings() )
|
||||
clearCacheInterval = Pgm().GetCommonSettings()->m_System.clear_3d_cache_interval;
|
||||
|
||||
// An interval of zero means the user doesn't want to ever clear the cache
|
||||
|
||||
if( clearCacheInterval > 0 )
|
||||
cache->CleanCacheDir( clearCacheInterval );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
S3D_CACHE* PROJECT::Get3DCacheManager( bool aUpdateProjDir )
|
||||
{
|
||||
std::lock_guard<std::mutex> lock( mutex3D_cacheManager );
|
||||
|
||||
// Get the existing cache from the project
|
||||
S3D_CACHE* cache = dynamic_cast<S3D_CACHE*>( GetElem( ELEM_3DCACHE ) );
|
||||
|
||||
if( !cache )
|
||||
{
|
||||
// Create a cache if there is not one already
|
||||
cache = new S3D_CACHE();
|
||||
|
||||
wxFileName cfgpath;
|
||||
cfgpath.AssignDir( SETTINGS_MANAGER::GetUserSettingsPath() );
|
||||
cfgpath.AppendDir( wxT( "3d" ) );
|
||||
|
||||
cache->SetProgramBase( &Pgm() );
|
||||
cache->Set3DConfigDir( cfgpath.GetFullPath() );
|
||||
|
||||
SetElem( ELEM_3DCACHE, cache );
|
||||
aUpdateProjDir = true;
|
||||
}
|
||||
|
||||
if( aUpdateProjDir )
|
||||
cache->SetProject( this );
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
||||
|
||||
FILENAME_RESOLVER* PROJECT::Get3DFilenameResolver()
|
||||
{
|
||||
return Get3DCacheManager()->GetResolver();
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ endif()
|
||||
unset( S3DSG_VERSION_FILE CACHE )
|
||||
|
||||
# Define a flag to expose the appropriate EXPORT macro at build time
|
||||
target_compile_definitions( kicad_3dsg PRIVATE COMPILE_SGLIB )
|
||||
target_compile_definitions( kicad_3dsg PRIVATE -DCOMPILE_SGLIB )
|
||||
|
||||
target_link_libraries( kicad_3dsg ${wxWidgets_LIBRARIES} )
|
||||
|
||||
@@ -108,4 +108,4 @@ install( TARGETS
|
||||
if( KICAD_WIN32_INSTALL_PDBS )
|
||||
# Get the PDBs to copy over for MSVC
|
||||
install(FILES $<TARGET_PDB_FILE:kicad_3dsg> DESTINATION ${KICAD_BIN})
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2022 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* 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
|
||||
@@ -23,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <gal/3d/camera.h>
|
||||
#include "../3d_rendering/camera.h"
|
||||
#include "board_adapter.h"
|
||||
#include <board_design_settings.h>
|
||||
#include <board_stackup_manager/board_stackup.h>
|
||||
@@ -50,7 +49,7 @@
|
||||
#define SOLDERPASTE_LAYER_THICKNESS pcbIUScale.mmToIU( 0.04 )
|
||||
|
||||
|
||||
CUSTOM_COLORS_LIST BOARD_ADAPTER::g_SilkColors;
|
||||
CUSTOM_COLORS_LIST BOARD_ADAPTER::g_SilkscreenColors;
|
||||
CUSTOM_COLORS_LIST BOARD_ADAPTER::g_MaskColors;
|
||||
CUSTOM_COLORS_LIST BOARD_ADAPTER::g_PasteColors;
|
||||
CUSTOM_COLORS_LIST BOARD_ADAPTER::g_FinishColors;
|
||||
@@ -63,8 +62,6 @@ KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultSolderMask;
|
||||
KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultSolderPaste;
|
||||
KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultSurfaceFinish;
|
||||
KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultBoardBody;
|
||||
KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultComments;
|
||||
KIGFX::COLOR4D BOARD_ADAPTER::g_DefaultECOs;
|
||||
|
||||
// To be used in Raytracing render to create bevels on layer items
|
||||
float g_BevelThickness3DU = 0.0f;
|
||||
@@ -89,6 +86,7 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
||||
m_IsPreviewer( false ),
|
||||
m_board( nullptr ),
|
||||
m_3dModelManager( nullptr ),
|
||||
m_renderSettings( nullptr ),
|
||||
m_colors( nullptr ),
|
||||
m_layerZcoordTop(),
|
||||
m_layerZcoordBottom()
|
||||
@@ -103,9 +101,9 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
||||
|
||||
m_boardBoundingBox.Reset();
|
||||
|
||||
m_TH_IDs.Clear();
|
||||
m_TH_ODs.Clear();
|
||||
m_viaAnnuli.Clear();
|
||||
m_throughHoleIds.Clear();
|
||||
m_throughHoleOds.Clear();
|
||||
m_throughHoleAnnularRings.Clear();
|
||||
|
||||
m_copperLayersCount = 2;
|
||||
|
||||
@@ -132,34 +130,26 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
||||
m_SilkScreenColorTop = SFVEC4F( 0.9, 0.9, 0.9, 1.0 );
|
||||
m_SilkScreenColorBot = SFVEC4F( 0.9, 0.9, 0.9, 1.0 );
|
||||
m_CopperColor = SFVEC4F( 0.75, 0.61, 0.23, 1.0 );
|
||||
m_UserDrawingsColor = SFVEC4F( 0.85, 0.85, 0.85, 1.0 );
|
||||
m_UserCommentsColor = SFVEC4F( 0.85, 0.85, 0.85, 1.0 );
|
||||
m_ECO1Color = SFVEC4F( 0.70, 0.10, 0.10, 1.0 );
|
||||
m_ECO2Color = SFVEC4F( 0.70, 0.10, 0.10, 1.0 );
|
||||
|
||||
m_platedPadsFront = nullptr;
|
||||
m_platedPadsBack = nullptr;
|
||||
m_offboardPadsFront = nullptr;
|
||||
m_offboardPadsBack = nullptr;
|
||||
|
||||
m_frontPlatedPadAndGraphicPolys = nullptr;
|
||||
m_backPlatedPadAndGraphicPolys = nullptr;
|
||||
m_frontPlatedCopperPolys = nullptr;
|
||||
m_backPlatedCopperPolys = nullptr;
|
||||
m_frontPlatedPadPolys = nullptr;
|
||||
m_backPlatedPadPolys = nullptr;
|
||||
|
||||
if( !g_ColorsLoaded )
|
||||
{
|
||||
#define ADD_COLOR( list, r, g, b, a, name ) \
|
||||
list.emplace_back( r/255.0, g/255.0, b/255.0, a, name )
|
||||
|
||||
ADD_COLOR( g_SilkColors, 245, 245, 245, 1.0, NotSpecifiedPrm() ); // White
|
||||
ADD_COLOR( g_SilkColors, 20, 51, 36, 1.0, wxT( "Green" ) );
|
||||
ADD_COLOR( g_SilkColors, 181, 19, 21, 1.0, wxT( "Red" ) );
|
||||
ADD_COLOR( g_SilkColors, 2, 59, 162, 1.0, wxT( "Blue" ) );
|
||||
ADD_COLOR( g_SilkColors, 11, 11, 11, 1.0, wxT( "Black" ) );
|
||||
ADD_COLOR( g_SilkColors, 245, 245, 245, 1.0, wxT( "White" ) );
|
||||
ADD_COLOR( g_SilkColors, 32, 2, 53, 1.0, wxT( "Purple" ) );
|
||||
ADD_COLOR( g_SilkColors, 194, 195, 0, 1.0, wxT( "Yellow" ) );
|
||||
ADD_COLOR( g_SilkscreenColors, 245, 245, 245, 1.0, NotSpecifiedPrm() ); // White
|
||||
ADD_COLOR( g_SilkscreenColors, 20, 51, 36, 1.0, wxT( "Green" ) );
|
||||
ADD_COLOR( g_SilkscreenColors, 181, 19, 21, 1.0, wxT( "Red" ) );
|
||||
ADD_COLOR( g_SilkscreenColors, 2, 59, 162, 1.0, wxT( "Blue" ) );
|
||||
ADD_COLOR( g_SilkscreenColors, 11, 11, 11, 1.0, wxT( "Black" ) );
|
||||
ADD_COLOR( g_SilkscreenColors, 245, 245, 245, 1.0, wxT( "White" ) );
|
||||
ADD_COLOR( g_SilkscreenColors, 32, 2, 53, 1.0, wxT( "Purple" ) );
|
||||
ADD_COLOR( g_SilkscreenColors, 194, 195, 0, 1.0, wxT( "Yellow" ) );
|
||||
|
||||
ADD_COLOR( g_MaskColors, 20, 51, 36, 0.83, NotSpecifiedPrm() ); // Green
|
||||
ADD_COLOR( g_MaskColors, 20, 51, 36, 0.83, wxT( "Green" ) );
|
||||
@@ -206,9 +196,6 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
||||
g_DefaultSurfaceFinish = COLOR4D( 0.75, 0.61, 0.23, 1.0 );
|
||||
g_DefaultBoardBody = COLOR4D( 0.43, 0.45, 0.30, 0.90 );
|
||||
|
||||
g_DefaultComments = COLOR4D( 0.85, 0.85, 0.85, 1.0 );
|
||||
g_DefaultECOs = COLOR4D( 0.70, 0.10, 0.10, 1.0 );
|
||||
|
||||
g_ColorsLoaded = true;
|
||||
}
|
||||
#undef ADD_COLOR
|
||||
@@ -223,51 +210,62 @@ BOARD_ADAPTER::~BOARD_ADAPTER()
|
||||
|
||||
void BOARD_ADAPTER::ReloadColorSettings() noexcept
|
||||
{
|
||||
wxCHECK( PgmOrNull(), /* void */ );
|
||||
wxASSERT( PgmOrNull() );
|
||||
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
m_colors = Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
|
||||
}
|
||||
PCBNEW_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
m_colors = Pgm().GetSettingsManager().GetColorSettings( settings->m_ColorTheme );
|
||||
}
|
||||
|
||||
|
||||
bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer,
|
||||
const std::bitset<LAYER_3D_END>& aVisibilityFlags ) const
|
||||
bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer ) const
|
||||
{
|
||||
wxASSERT( aLayer < PCB_LAYER_ID_COUNT );
|
||||
|
||||
if( m_board && !m_board->IsLayerEnabled( aLayer ) )
|
||||
return false;
|
||||
|
||||
// see if layer needs to be shown
|
||||
// check the flags
|
||||
switch( aLayer )
|
||||
{
|
||||
case B_Cu: return aVisibilityFlags.test( LAYER_3D_COPPER_BOTTOM );
|
||||
case F_Cu: return aVisibilityFlags.test( LAYER_3D_COPPER_TOP );
|
||||
case B_Adhes: return aVisibilityFlags.test( LAYER_3D_ADHESIVE );
|
||||
case F_Adhes: return aVisibilityFlags.test( LAYER_3D_ADHESIVE );
|
||||
case B_Paste: return aVisibilityFlags.test( LAYER_3D_SOLDERPASTE );
|
||||
case F_Paste: return aVisibilityFlags.test( LAYER_3D_SOLDERPASTE );
|
||||
case B_SilkS: return aVisibilityFlags.test( LAYER_3D_SILKSCREEN_BOTTOM );
|
||||
case F_SilkS: return aVisibilityFlags.test( LAYER_3D_SILKSCREEN_TOP );
|
||||
case B_Mask: return aVisibilityFlags.test( LAYER_3D_SOLDERMASK_BOTTOM );
|
||||
case F_Mask: return aVisibilityFlags.test( LAYER_3D_SOLDERMASK_TOP );
|
||||
case Dwgs_User: return aVisibilityFlags.test( LAYER_3D_USER_DRAWINGS );
|
||||
case Cmts_User: return aVisibilityFlags.test( LAYER_3D_USER_COMMENTS );
|
||||
case Eco1_User: return aVisibilityFlags.test( LAYER_3D_USER_ECO1 );
|
||||
case Eco2_User: return aVisibilityFlags.test( LAYER_3D_USER_ECO2 );
|
||||
default: return m_board && m_board->IsLayerVisible( aLayer );
|
||||
case B_Adhes:
|
||||
case F_Adhes:
|
||||
return m_Cfg->m_Render.show_adhesive;
|
||||
|
||||
case B_Paste:
|
||||
case F_Paste:
|
||||
return m_Cfg->m_Render.show_solderpaste;
|
||||
|
||||
case B_SilkS:
|
||||
case F_SilkS:
|
||||
return m_Cfg->m_Render.show_silkscreen;
|
||||
|
||||
case B_Mask:
|
||||
case F_Mask:
|
||||
return m_Cfg->m_Render.show_soldermask;
|
||||
|
||||
case Dwgs_User:
|
||||
case Cmts_User:
|
||||
return !m_Cfg->m_Render.realistic && m_Cfg->m_Render.show_comments;
|
||||
|
||||
case Eco1_User:
|
||||
case Eco2_User:
|
||||
return !m_Cfg->m_Render.realistic && m_Cfg->m_Render.show_eco;
|
||||
|
||||
case Edge_Cuts:
|
||||
return !m_Cfg->m_Render.realistic && !m_Cfg->m_Render.show_board_body;
|
||||
|
||||
case Margin:
|
||||
return !m_Cfg->m_Render.realistic;
|
||||
|
||||
case B_Cu:
|
||||
case F_Cu:
|
||||
return !m_board || m_board->IsLayerVisible( aLayer ) || m_Cfg->m_Render.realistic
|
||||
|| m_board->IsFootprintHolder();
|
||||
|
||||
default:
|
||||
// the layer is an internal copper layer, used the visibility
|
||||
return m_board && m_board->IsLayerVisible( aLayer );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,12 +281,6 @@ bool BOARD_ADAPTER::IsFootprintShown( FOOTPRINT_ATTR_T aFPAttributes ) const
|
||||
return false;
|
||||
}
|
||||
|
||||
if( aFPAttributes & FP_DNP )
|
||||
{
|
||||
if( !m_Cfg->m_Render.show_footprints_dnp )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( aFPAttributes & FP_SMD )
|
||||
return m_Cfg->m_Render.show_footprints_insert;
|
||||
|
||||
@@ -344,7 +336,11 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
BOX2I bbbox;
|
||||
|
||||
if( m_board )
|
||||
bbbox = m_board->ComputeBoundingBox( !m_board->IsFootprintHolder() && haveOutline );
|
||||
{
|
||||
bbbox = m_board->ComputeBoundingBox( !m_board->IsFootprintHolder()
|
||||
&& m_Cfg->m_Render.realistic
|
||||
&& haveOutline );
|
||||
}
|
||||
|
||||
// Gives a non null size to avoid issues in zoom / scale calculations
|
||||
if( ( bbbox.GetWidth() == 0 ) && ( bbbox.GetHeight() == 0 ) )
|
||||
@@ -367,10 +363,6 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
// Calculate the conversion to apply to all positions.
|
||||
m_biuTo3Dunits = RANGE_SCALE_3D / std::max( m_boardSize.x, m_boardSize.y );
|
||||
|
||||
// Hack to keep "home" zoom from being too small.
|
||||
if( !m_board || !m_board->IsFootprintHolder() )
|
||||
m_biuTo3Dunits *= 1.6f;
|
||||
|
||||
m_boardBodyThickness3DU = DEFAULT_BOARD_THICKNESS * m_biuTo3Dunits;
|
||||
m_frontCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
|
||||
m_backCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
|
||||
@@ -397,18 +389,13 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
break;
|
||||
|
||||
case BS_ITEM_TYPE_COPPER:
|
||||
{
|
||||
// The copper thickness must be > 0 to avoid draw issues (divide by 0 for instance)
|
||||
// We use a minimal arbitrary value = 1 micrometer here:
|
||||
int copper_thickness = std::max( item->GetThickness(), pcbIUScale.mmToIU( 0.001 ) );
|
||||
|
||||
if( item->GetBrdLayerId() == F_Cu )
|
||||
m_frontCopperThickness3DU = copper_thickness * m_biuTo3Dunits;
|
||||
m_frontCopperThickness3DU = item->GetThickness() * m_biuTo3Dunits;
|
||||
else if( item->GetBrdLayerId() == B_Cu )
|
||||
m_backCopperThickness3DU = copper_thickness * m_biuTo3Dunits;
|
||||
m_backCopperThickness3DU = item->GetThickness() * m_biuTo3Dunits;
|
||||
else if( item->IsEnabled() )
|
||||
thickness += copper_thickness;
|
||||
}
|
||||
thickness += item->GetThickness();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -454,7 +441,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
for( ; layer < MAX_CU_LAYERS; layer++ )
|
||||
{
|
||||
m_layerZcoordBottom[layer] = -( m_boardBodyThickness3DU / 2.0f );
|
||||
m_layerZcoordTop[layer] = m_layerZcoordBottom[layer] - m_backCopperThickness3DU;
|
||||
m_layerZcoordTop[layer] = -( m_boardBodyThickness3DU / 2.0f ) - m_backCopperThickness3DU;
|
||||
}
|
||||
|
||||
// This is the top of the copper layer thickness.
|
||||
@@ -510,6 +497,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
zposTop = zposBottom + m_nonCopperLayerThickness3DU;
|
||||
break;
|
||||
|
||||
// !TODO: review
|
||||
default:
|
||||
zposTop = zpos_copperTop_front + (layer_id - MAX_CU_LAYERS + 3.0f) * zpos_offset;
|
||||
zposBottom = zposTop - m_nonCopperLayerThickness3DU;
|
||||
@@ -535,7 +523,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
m_boardBoundingBox = BBOX_3D( boardMin, boardMax );
|
||||
|
||||
#ifdef PRINT_STATISTICS_3D_VIEWER
|
||||
int64_t stats_startCreateBoardPolyTime = GetRunningMicroSecs();
|
||||
unsigned stats_startCreateBoardPolyTime = GetRunningMicroSecs();
|
||||
#endif
|
||||
|
||||
if( aStatusReporter )
|
||||
@@ -543,73 +531,22 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
|
||||
createLayers( aStatusReporter );
|
||||
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
auto to_SFVEC4F =
|
||||
[]( const COLOR4D& src )
|
||||
{
|
||||
return SFVEC4F( src.r, src.g, src.b, src.a );
|
||||
};
|
||||
|
||||
std::map<int, COLOR4D> colors = GetLayerColors();
|
||||
m_BgColorTop = to_SFVEC4F( colors->GetColor( LAYER_3D_BACKGROUND_TOP ) );
|
||||
m_BgColorBot = to_SFVEC4F( colors->GetColor( LAYER_3D_BACKGROUND_BOTTOM ) );
|
||||
|
||||
m_BgColorTop = to_SFVEC4F( colors[ LAYER_3D_BACKGROUND_TOP ] );
|
||||
m_BgColorBot = to_SFVEC4F( colors[ LAYER_3D_BACKGROUND_BOTTOM ] );
|
||||
m_SolderPasteColor = to_SFVEC4F( colors[ LAYER_3D_SOLDERPASTE ] );
|
||||
m_SilkScreenColorBot = to_SFVEC4F( colors[ LAYER_3D_SILKSCREEN_BOTTOM ] );
|
||||
m_SilkScreenColorTop = to_SFVEC4F( colors[ LAYER_3D_SILKSCREEN_TOP ] );
|
||||
m_SolderMaskColorBot = to_SFVEC4F( colors[ LAYER_3D_SOLDERMASK_BOTTOM ] );
|
||||
m_SolderMaskColorTop = to_SFVEC4F( colors[ LAYER_3D_SOLDERMASK_TOP ] );
|
||||
m_CopperColor = to_SFVEC4F( colors[ LAYER_3D_COPPER_TOP ] );
|
||||
m_BoardBodyColor = to_SFVEC4F( colors[ LAYER_3D_BOARD ] );
|
||||
m_UserDrawingsColor = to_SFVEC4F( colors[ LAYER_3D_USER_DRAWINGS ] );
|
||||
m_UserCommentsColor = to_SFVEC4F( colors[ LAYER_3D_USER_COMMENTS ] );
|
||||
m_ECO1Color = to_SFVEC4F( colors[ LAYER_3D_USER_ECO1 ] );
|
||||
m_ECO2Color = to_SFVEC4F( colors[ LAYER_3D_USER_ECO2 ] );
|
||||
}
|
||||
m_SolderPasteColor = to_SFVEC4F( colors->GetColor( LAYER_3D_SOLDERPASTE ) );
|
||||
|
||||
|
||||
std::map<int, COLOR4D> BOARD_ADAPTER::GetDefaultColors() const
|
||||
{
|
||||
std::map<int, COLOR4D> colors;
|
||||
|
||||
colors[ LAYER_3D_BACKGROUND_TOP ] = BOARD_ADAPTER::g_DefaultBackgroundTop;
|
||||
colors[ LAYER_3D_BACKGROUND_BOTTOM ] = BOARD_ADAPTER::g_DefaultBackgroundBot;
|
||||
colors[ LAYER_3D_BOARD ] = BOARD_ADAPTER::g_DefaultBoardBody;
|
||||
colors[ LAYER_3D_COPPER_TOP ] = BOARD_ADAPTER::g_DefaultSurfaceFinish;
|
||||
colors[ LAYER_3D_COPPER_BOTTOM ] = BOARD_ADAPTER::g_DefaultSurfaceFinish;
|
||||
colors[ LAYER_3D_SILKSCREEN_TOP ] = BOARD_ADAPTER::g_DefaultSilkscreen;
|
||||
colors[ LAYER_3D_SILKSCREEN_BOTTOM ] = BOARD_ADAPTER::g_DefaultSilkscreen;
|
||||
colors[ LAYER_3D_SOLDERMASK_TOP ] = BOARD_ADAPTER::g_DefaultSolderMask;
|
||||
colors[ LAYER_3D_SOLDERMASK_BOTTOM ] = BOARD_ADAPTER::g_DefaultSolderMask;
|
||||
colors[ LAYER_3D_SOLDERPASTE ] = BOARD_ADAPTER::g_DefaultSolderPaste;
|
||||
colors[ LAYER_3D_USER_DRAWINGS ] = BOARD_ADAPTER::g_DefaultComments;
|
||||
colors[ LAYER_3D_USER_COMMENTS ] = BOARD_ADAPTER::g_DefaultComments;
|
||||
colors[ LAYER_3D_USER_ECO1 ] = BOARD_ADAPTER::g_DefaultECOs;
|
||||
colors[ LAYER_3D_USER_ECO2 ] = BOARD_ADAPTER::g_DefaultECOs;
|
||||
|
||||
return colors;
|
||||
}
|
||||
|
||||
|
||||
std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
{
|
||||
std::map<int, COLOR4D> colors;
|
||||
|
||||
if( LAYER_PRESET_3D* preset = m_Cfg->FindPreset( m_Cfg->m_CurrentPreset ) )
|
||||
{
|
||||
colors = preset->colors;
|
||||
}
|
||||
else
|
||||
{
|
||||
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
for( const auto& [ layer, defaultColor /* unused */ ] : GetDefaultColors() )
|
||||
colors[ layer ] = settings->GetColor( layer );
|
||||
}
|
||||
|
||||
if( m_Cfg->m_UseStackupColors && m_board )
|
||||
if( m_board && colors->GetUseBoardStackupColors() )
|
||||
{
|
||||
const BOARD_STACKUP& stackup = m_board->GetDesignSettings().GetStackupDescriptor();
|
||||
KIGFX::COLOR4D bodyColor( 0, 0, 0, 0 );
|
||||
|
||||
auto findColor =
|
||||
[]( const wxString& aColorName, const CUSTOM_COLORS_LIST& aColorSet )
|
||||
@@ -630,6 +567,13 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
return KIGFX::COLOR4D();
|
||||
};
|
||||
|
||||
m_SilkScreenColorTop = to_SFVEC4F( g_DefaultSilkscreen );
|
||||
m_SilkScreenColorBot = to_SFVEC4F( g_DefaultSilkscreen );
|
||||
m_SolderMaskColorTop = to_SFVEC4F( g_DefaultSolderMask );
|
||||
m_SolderMaskColorBot = to_SFVEC4F( g_DefaultSolderMask );
|
||||
|
||||
KIGFX::COLOR4D bodyColor( 0, 0, 0, 0 );
|
||||
|
||||
for( const BOARD_STACKUP_ITEM* stackupItem : stackup.GetList() )
|
||||
{
|
||||
wxString colorName = stackupItem->GetColor();
|
||||
@@ -638,17 +582,16 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
{
|
||||
case BS_ITEM_TYPE_SILKSCREEN:
|
||||
if( stackupItem->GetBrdLayerId() == F_SilkS )
|
||||
colors[ LAYER_3D_SILKSCREEN_TOP ] = findColor( colorName, g_SilkColors );
|
||||
m_SilkScreenColorTop = to_SFVEC4F( findColor( colorName, g_SilkscreenColors ) );
|
||||
else
|
||||
colors[ LAYER_3D_SILKSCREEN_BOTTOM ] = findColor( colorName, g_SilkColors );
|
||||
|
||||
m_SilkScreenColorBot = to_SFVEC4F( findColor( colorName, g_SilkscreenColors ) );
|
||||
break;
|
||||
|
||||
case BS_ITEM_TYPE_SOLDERMASK:
|
||||
if( stackupItem->GetBrdLayerId() == F_Mask )
|
||||
colors[ LAYER_3D_SOLDERMASK_TOP ] = findColor( colorName, g_MaskColors );
|
||||
m_SolderMaskColorTop = to_SFVEC4F( findColor( colorName, g_MaskColors ) );
|
||||
else
|
||||
colors[ LAYER_3D_SOLDERMASK_BOTTOM ] = findColor( colorName, g_MaskColors );
|
||||
m_SolderMaskColorBot = to_SFVEC4F( findColor( colorName, g_MaskColors ) );
|
||||
|
||||
break;
|
||||
|
||||
@@ -671,220 +614,46 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
}
|
||||
|
||||
if( bodyColor != COLOR4D( 0, 0, 0, 0 ) )
|
||||
colors[ LAYER_3D_BOARD ] = bodyColor;
|
||||
m_BoardBodyColor = to_SFVEC4F( bodyColor );
|
||||
else
|
||||
m_BoardBodyColor = to_SFVEC4F( g_DefaultBoardBody );
|
||||
|
||||
const wxString& finishName = stackup.m_FinishType;
|
||||
|
||||
if( finishName.EndsWith( wxT( "OSP" ) ) )
|
||||
{
|
||||
colors[ LAYER_3D_COPPER_TOP ] = findColor( wxT( "Copper" ), g_FinishColors );
|
||||
m_CopperColor = to_SFVEC4F( findColor( wxT( "Copper" ), g_FinishColors ) );
|
||||
}
|
||||
else if( finishName.EndsWith( wxT( "IG" ) )
|
||||
|| finishName.EndsWith( wxT( "gold" ) ) )
|
||||
{
|
||||
colors[ LAYER_3D_COPPER_TOP ] = findColor( wxT( "Gold" ), g_FinishColors );
|
||||
m_CopperColor = to_SFVEC4F( findColor( wxT( "Gold" ), g_FinishColors ) );
|
||||
}
|
||||
else if( finishName.StartsWith( wxT( "HAL" ) )
|
||||
|| finishName.StartsWith( wxT( "HASL" ) )
|
||||
|| finishName.EndsWith( wxT( "tin" ) )
|
||||
|| finishName.EndsWith( wxT( "nickel" ) ) )
|
||||
{
|
||||
colors[ LAYER_3D_COPPER_TOP ] = findColor( wxT( "Tin" ), g_FinishColors );
|
||||
m_CopperColor = to_SFVEC4F( findColor( wxT( "Tin" ), g_FinishColors ) );
|
||||
}
|
||||
else if( finishName.EndsWith( wxT( "silver" ) ) )
|
||||
{
|
||||
colors[ LAYER_3D_COPPER_TOP ] = findColor( wxT( "Silver" ), g_FinishColors );
|
||||
m_CopperColor = to_SFVEC4F( findColor( wxT( "Silver" ), g_FinishColors ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CopperColor = to_SFVEC4F( g_DefaultSurfaceFinish );
|
||||
}
|
||||
}
|
||||
|
||||
colors[ LAYER_3D_COPPER_BOTTOM ] = colors[ LAYER_3D_COPPER_TOP ];
|
||||
return colors;
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::SetLayerColors( const std::map<int, COLOR4D>& aColors )
|
||||
{
|
||||
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
for( const auto& [ layer, color ] : aColors )
|
||||
settings->SetColor( layer, color );
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::SetVisibleLayers( const std::bitset<LAYER_3D_END>& aLayers )
|
||||
{
|
||||
m_Cfg->m_Render.show_board_body = aLayers.test( LAYER_3D_BOARD );
|
||||
m_Cfg->m_Render.show_copper_top = aLayers.test( LAYER_3D_COPPER_TOP );
|
||||
m_Cfg->m_Render.show_copper_bottom = aLayers.test( LAYER_3D_COPPER_BOTTOM );
|
||||
m_Cfg->m_Render.show_silkscreen_top = aLayers.test( LAYER_3D_SILKSCREEN_TOP );
|
||||
m_Cfg->m_Render.show_silkscreen_bottom = aLayers.test( LAYER_3D_SILKSCREEN_BOTTOM );
|
||||
m_Cfg->m_Render.show_soldermask_top = aLayers.test( LAYER_3D_SOLDERMASK_TOP );
|
||||
m_Cfg->m_Render.show_soldermask_bottom = aLayers.test( LAYER_3D_SOLDERMASK_BOTTOM );
|
||||
m_Cfg->m_Render.show_solderpaste = aLayers.test( LAYER_3D_SOLDERPASTE );
|
||||
m_Cfg->m_Render.show_adhesive = aLayers.test( LAYER_3D_ADHESIVE );
|
||||
m_Cfg->m_Render.show_comments = aLayers.test( LAYER_3D_USER_COMMENTS );
|
||||
m_Cfg->m_Render.show_drawings = aLayers.test( LAYER_3D_USER_DRAWINGS );
|
||||
m_Cfg->m_Render.show_eco1 = aLayers.test( LAYER_3D_USER_ECO1 );
|
||||
m_Cfg->m_Render.show_eco2 = aLayers.test( LAYER_3D_USER_ECO2 );
|
||||
|
||||
m_Cfg->m_Render.show_footprints_normal = aLayers.test( LAYER_3D_TH_MODELS );
|
||||
m_Cfg->m_Render.show_footprints_insert = aLayers.test( LAYER_3D_SMD_MODELS );
|
||||
m_Cfg->m_Render.show_footprints_virtual = aLayers.test( LAYER_3D_VIRTUAL_MODELS );
|
||||
m_Cfg->m_Render.show_footprints_not_in_posfile = aLayers.test( LAYER_3D_MODELS_NOT_IN_POS );
|
||||
m_Cfg->m_Render.show_footprints_dnp = aLayers.test( LAYER_3D_MODELS_MARKED_DNP );
|
||||
|
||||
m_Cfg->m_Render.show_fp_references = aLayers.test( LAYER_FP_REFERENCES );
|
||||
m_Cfg->m_Render.show_fp_values = aLayers.test( LAYER_FP_VALUES );
|
||||
m_Cfg->m_Render.show_fp_text = aLayers.test( LAYER_FP_TEXT );
|
||||
|
||||
m_Cfg->m_Render.show_model_bbox = aLayers.test( LAYER_3D_BOUNDING_BOXES );
|
||||
m_Cfg->m_Render.show_off_board_silk = aLayers.test( LAYER_3D_OFF_BOARD_SILK );
|
||||
m_Cfg->m_Render.show_axis = aLayers.test( LAYER_3D_AXES );
|
||||
}
|
||||
|
||||
|
||||
std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
|
||||
{
|
||||
std::bitset<LAYER_3D_END> ret;
|
||||
|
||||
ret.set( LAYER_3D_BOARD, m_Cfg->m_Render.show_board_body );
|
||||
ret.set( LAYER_3D_COPPER_TOP, m_Cfg->m_Render.show_copper_top );
|
||||
ret.set( LAYER_3D_COPPER_BOTTOM, m_Cfg->m_Render.show_copper_bottom );
|
||||
ret.set( LAYER_3D_SILKSCREEN_TOP, m_Cfg->m_Render.show_silkscreen_top );
|
||||
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, m_Cfg->m_Render.show_silkscreen_bottom );
|
||||
ret.set( LAYER_3D_SOLDERMASK_TOP, m_Cfg->m_Render.show_soldermask_top );
|
||||
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, m_Cfg->m_Render.show_soldermask_bottom );
|
||||
ret.set( LAYER_3D_SOLDERPASTE, m_Cfg->m_Render.show_solderpaste );
|
||||
ret.set( LAYER_3D_ADHESIVE, m_Cfg->m_Render.show_adhesive );
|
||||
ret.set( LAYER_3D_USER_COMMENTS, m_Cfg->m_Render.show_comments );
|
||||
ret.set( LAYER_3D_USER_DRAWINGS, m_Cfg->m_Render.show_drawings );
|
||||
ret.set( LAYER_3D_USER_ECO1, m_Cfg->m_Render.show_eco1 );
|
||||
ret.set( LAYER_3D_USER_ECO2, m_Cfg->m_Render.show_eco2 );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, m_Cfg->m_Render.show_fp_references );
|
||||
ret.set( LAYER_FP_VALUES, m_Cfg->m_Render.show_fp_values );
|
||||
ret.set( LAYER_FP_TEXT, m_Cfg->m_Render.show_fp_text );
|
||||
|
||||
ret.set( LAYER_3D_TH_MODELS, m_Cfg->m_Render.show_footprints_normal );
|
||||
ret.set( LAYER_3D_SMD_MODELS, m_Cfg->m_Render.show_footprints_insert );
|
||||
ret.set( LAYER_3D_VIRTUAL_MODELS, m_Cfg->m_Render.show_footprints_virtual );
|
||||
ret.set( LAYER_3D_MODELS_NOT_IN_POS, m_Cfg->m_Render.show_footprints_not_in_posfile );
|
||||
ret.set( LAYER_3D_MODELS_MARKED_DNP, m_Cfg->m_Render.show_footprints_dnp );
|
||||
|
||||
ret.set( LAYER_3D_BOUNDING_BOXES, m_Cfg->m_Render.show_model_bbox );
|
||||
ret.set( LAYER_3D_OFF_BOARD_SILK, m_Cfg->m_Render.show_off_board_silk );
|
||||
ret.set( LAYER_3D_AXES, m_Cfg->m_Render.show_axis );
|
||||
|
||||
if( m_Cfg->m_CurrentPreset == FOLLOW_PCB )
|
||||
{
|
||||
if( !m_board )
|
||||
return ret;
|
||||
|
||||
ret.set( LAYER_3D_BOARD, true );
|
||||
ret.set( LAYER_3D_COPPER_TOP, m_board->IsLayerVisible( F_Cu ) );
|
||||
ret.set( LAYER_3D_COPPER_BOTTOM, m_board->IsLayerVisible( B_Cu ) );
|
||||
ret.set( LAYER_3D_SILKSCREEN_TOP, m_board->IsLayerVisible( F_SilkS ) );
|
||||
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, m_board->IsLayerVisible( B_SilkS ) );
|
||||
ret.set( LAYER_3D_SOLDERMASK_TOP, m_board->IsLayerVisible( F_Mask ) );
|
||||
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, m_board->IsLayerVisible( B_Mask ) );
|
||||
ret.set( LAYER_3D_SOLDERPASTE, m_board->IsLayerVisible( F_Paste ) );
|
||||
ret.set( LAYER_3D_ADHESIVE, m_board->IsLayerVisible( F_Adhes ) );
|
||||
ret.set( LAYER_3D_USER_COMMENTS, m_board->IsLayerVisible( Cmts_User ) );
|
||||
ret.set( LAYER_3D_USER_DRAWINGS, m_board->IsLayerVisible( Dwgs_User ) );
|
||||
ret.set( LAYER_3D_USER_ECO1, m_board->IsLayerVisible( Eco1_User ) );
|
||||
ret.set( LAYER_3D_USER_ECO2, m_board->IsLayerVisible( Eco2_User ) );
|
||||
|
||||
for( GAL_LAYER_ID layer : { LAYER_FP_REFERENCES, LAYER_FP_VALUES, LAYER_FP_TEXT } )
|
||||
ret.set( layer, m_board->IsElementVisible( layer ) );
|
||||
}
|
||||
else if( m_Cfg->m_CurrentPreset == FOLLOW_PLOT_SETTINGS )
|
||||
{
|
||||
if( !m_board )
|
||||
return ret;
|
||||
|
||||
const PCB_PLOT_PARAMS& plotParams = m_board->GetPlotOptions();
|
||||
LSET layers = plotParams.GetLayerSelection() | plotParams.GetPlotOnAllLayersSelection();
|
||||
|
||||
ret.set( LAYER_3D_BOARD, true );
|
||||
ret.set( LAYER_3D_COPPER_TOP, layers.test( F_Cu ) );
|
||||
ret.set( LAYER_3D_COPPER_BOTTOM, layers.test( B_Cu ) );
|
||||
ret.set( LAYER_3D_SILKSCREEN_TOP, layers.test( F_SilkS ) );
|
||||
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, layers.test( B_SilkS ) );
|
||||
ret.set( LAYER_3D_SOLDERMASK_TOP, layers.test( F_Mask ) );
|
||||
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, layers.test( B_Mask ) );
|
||||
ret.set( LAYER_3D_SOLDERPASTE, layers.test( F_Paste ) );
|
||||
ret.set( LAYER_3D_ADHESIVE, layers.test( F_Adhes ) );
|
||||
ret.set( LAYER_3D_USER_COMMENTS, layers.test( Cmts_User ) );
|
||||
ret.set( LAYER_3D_USER_DRAWINGS, layers.test( Dwgs_User ) );
|
||||
ret.set( LAYER_3D_USER_ECO1, layers.test( Eco1_User ) );
|
||||
ret.set( LAYER_3D_USER_ECO2, layers.test( Eco2_User ) );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, plotParams.GetPlotReference() );
|
||||
ret.set( LAYER_FP_VALUES, plotParams.GetPlotValue() );
|
||||
ret.set( LAYER_FP_TEXT, plotParams.GetPlotFPText() );
|
||||
}
|
||||
else if( LAYER_PRESET_3D* preset = m_Cfg->FindPreset( m_Cfg->m_CurrentPreset ) )
|
||||
{
|
||||
ret = preset->layers;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.set( LAYER_3D_BOARD, m_Cfg->m_Render.show_board_body );
|
||||
ret.set( LAYER_3D_COPPER_TOP, m_Cfg->m_Render.show_copper_top );
|
||||
ret.set( LAYER_3D_COPPER_BOTTOM, m_Cfg->m_Render.show_copper_bottom );
|
||||
ret.set( LAYER_3D_SILKSCREEN_TOP, m_Cfg->m_Render.show_silkscreen_top );
|
||||
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, m_Cfg->m_Render.show_silkscreen_bottom );
|
||||
ret.set( LAYER_3D_SOLDERMASK_TOP, m_Cfg->m_Render.show_soldermask_top );
|
||||
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, m_Cfg->m_Render.show_soldermask_bottom );
|
||||
ret.set( LAYER_3D_SOLDERPASTE, m_Cfg->m_Render.show_solderpaste );
|
||||
ret.set( LAYER_3D_ADHESIVE, m_Cfg->m_Render.show_adhesive );
|
||||
ret.set( LAYER_3D_USER_COMMENTS, m_Cfg->m_Render.show_comments );
|
||||
ret.set( LAYER_3D_USER_DRAWINGS, m_Cfg->m_Render.show_drawings );
|
||||
ret.set( LAYER_3D_USER_ECO1, m_Cfg->m_Render.show_eco1 );
|
||||
ret.set( LAYER_3D_USER_ECO2, m_Cfg->m_Render.show_eco2 );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, m_Cfg->m_Render.show_fp_references );
|
||||
ret.set( LAYER_FP_VALUES, m_Cfg->m_Render.show_fp_values );
|
||||
ret.set( LAYER_FP_TEXT, m_Cfg->m_Render.show_fp_text );
|
||||
m_SilkScreenColorBot = to_SFVEC4F( colors->GetColor( LAYER_3D_SILKSCREEN_BOTTOM ) );
|
||||
m_SilkScreenColorTop = to_SFVEC4F( colors->GetColor( LAYER_3D_SILKSCREEN_TOP ) );
|
||||
m_SolderMaskColorBot = to_SFVEC4F( colors->GetColor( LAYER_3D_SOLDERMASK_BOTTOM ) );
|
||||
m_SolderMaskColorTop = to_SFVEC4F( colors->GetColor( LAYER_3D_SOLDERMASK_TOP ) );
|
||||
m_CopperColor = to_SFVEC4F( colors->GetColor( LAYER_3D_COPPER ) );
|
||||
m_BoardBodyColor = to_SFVEC4F( colors->GetColor( LAYER_3D_BOARD ) );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetDefaultVisibleLayers() const
|
||||
{
|
||||
std::bitset<LAYER_3D_END> ret;
|
||||
|
||||
ret.set( LAYER_3D_BOARD, true );
|
||||
ret.set( LAYER_3D_COPPER_TOP, true );
|
||||
ret.set( LAYER_3D_COPPER_BOTTOM, true );
|
||||
ret.set( LAYER_3D_SILKSCREEN_TOP, true );
|
||||
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, true );
|
||||
ret.set( LAYER_3D_SOLDERMASK_TOP, true );
|
||||
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, true );
|
||||
ret.set( LAYER_3D_SOLDERPASTE, true );
|
||||
ret.set( LAYER_3D_ADHESIVE, true );
|
||||
ret.set( LAYER_3D_USER_COMMENTS, false );
|
||||
ret.set( LAYER_3D_USER_DRAWINGS, false );
|
||||
ret.set( LAYER_3D_USER_ECO1, false );
|
||||
ret.set( LAYER_3D_USER_ECO2, false );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, true );
|
||||
ret.set( LAYER_FP_VALUES, true );
|
||||
ret.set( LAYER_FP_TEXT, true );
|
||||
|
||||
ret.set( LAYER_3D_TH_MODELS, true );
|
||||
ret.set( LAYER_3D_SMD_MODELS, true );
|
||||
ret.set( LAYER_3D_VIRTUAL_MODELS, true );
|
||||
ret.set( LAYER_3D_MODELS_NOT_IN_POS, false );
|
||||
ret.set( LAYER_3D_MODELS_MARKED_DNP, false );
|
||||
|
||||
ret.set( LAYER_3D_BOUNDING_BOXES, false );
|
||||
ret.set( LAYER_3D_OFF_BOARD_SILK, false );
|
||||
ret.set( LAYER_3D_AXES, true );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -925,7 +694,7 @@ bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
|
||||
}
|
||||
else
|
||||
{
|
||||
success = m_board->GetBoardPolygonOutlines( m_board_poly, nullptr, false, true );
|
||||
success = m_board->GetBoardPolygonOutlines( m_board_poly );
|
||||
|
||||
if( !success && aErrorMsg )
|
||||
*aErrorMsg = _( "Board outline is missing or malformed. Run DRC for a full analysis." );
|
||||
@@ -938,9 +707,19 @@ bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
|
||||
float BOARD_ADAPTER::GetFootprintZPos( bool aIsFlipped ) const
|
||||
{
|
||||
if( aIsFlipped )
|
||||
return m_layerZcoordBottom[B_Paste];
|
||||
{
|
||||
if( m_Cfg->m_Render.show_solderpaste )
|
||||
return m_layerZcoordBottom[B_SilkS];
|
||||
else
|
||||
return m_layerZcoordBottom[B_Paste];
|
||||
}
|
||||
else
|
||||
return m_layerZcoordTop[F_Paste];
|
||||
{
|
||||
if( m_Cfg->m_Render.show_solderpaste )
|
||||
return m_layerZcoordTop[F_SilkS];
|
||||
else
|
||||
return m_layerZcoordTop[F_Paste];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +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) 2023 CERN
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-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
|
||||
@@ -31,7 +30,7 @@
|
||||
#include "../3d_rendering/raytracing/accelerators/container_2d.h"
|
||||
#include "../3d_rendering/raytracing/accelerators/container_3d.h"
|
||||
#include "../3d_rendering/raytracing/shapes3D/bbox_3d.h"
|
||||
#include <gal/3d/camera.h>
|
||||
#include "../3d_rendering/camera.h"
|
||||
#include "../3d_enums.h"
|
||||
#include "../3d_cache/3d_cache.h"
|
||||
#include "../common_ogl/ogl_attr_list.h"
|
||||
@@ -50,7 +49,6 @@
|
||||
#include <dialogs/dialog_color_picker.h>
|
||||
|
||||
class COLOR_SETTINGS;
|
||||
class PCB_TEXTBOX;
|
||||
|
||||
/// A type that stores a container of 2d objects for each layer id
|
||||
typedef std::map<PCB_LAYER_ID, BVH_CONTAINER_2D*> MAP_CONTAINER_2D_BASE;
|
||||
@@ -87,8 +85,7 @@ public:
|
||||
*
|
||||
* @param aLayer layer ID to get status.
|
||||
*/
|
||||
bool Is3dLayerEnabled( PCB_LAYER_ID aLayer,
|
||||
const std::bitset<LAYER_3D_END>& aVisibilityFlags ) const;
|
||||
bool Is3dLayerEnabled( PCB_LAYER_ID aLayer ) const;
|
||||
|
||||
/**
|
||||
* Test if footprint should be displayed in relation to attributes and the flags.
|
||||
@@ -105,14 +102,6 @@ public:
|
||||
|
||||
void ReloadColorSettings() noexcept;
|
||||
|
||||
std::map<int, COLOR4D> GetLayerColors() const;
|
||||
std::map<int, COLOR4D> GetDefaultColors() const;
|
||||
void SetLayerColors( const std::map<int, COLOR4D>& aColors );
|
||||
|
||||
std::bitset<LAYER_3D_END> GetVisibleLayers() const;
|
||||
std::bitset<LAYER_3D_END> GetDefaultVisibleLayers() const;
|
||||
void SetVisibleLayers( const std::bitset<LAYER_3D_END>& aLayers );
|
||||
|
||||
/**
|
||||
* Function to be called by the render when it need to reload the settings for the board.
|
||||
*
|
||||
@@ -247,12 +236,10 @@ public:
|
||||
const MAP_CONTAINER_2D_BASE& GetLayerMap() const noexcept { return m_layerMap; }
|
||||
const BVH_CONTAINER_2D* GetPlatedPadsFront() const noexcept { return m_platedPadsFront; }
|
||||
const BVH_CONTAINER_2D* GetPlatedPadsBack() const noexcept { return m_platedPadsBack; }
|
||||
const BVH_CONTAINER_2D* GetOffboardPadsFront() const noexcept { return m_offboardPadsFront; }
|
||||
const BVH_CONTAINER_2D* GetOffboardPadsBack() const noexcept { return m_offboardPadsBack; }
|
||||
|
||||
const MAP_CONTAINER_2D_BASE& GetLayerHoleMap() const noexcept { return m_layerHoleMap; }
|
||||
const BVH_CONTAINER_2D& GetTH_IDs() const noexcept { return m_TH_IDs; }
|
||||
const BVH_CONTAINER_2D& GetTH_ODs() const noexcept { return m_TH_ODs; }
|
||||
const BVH_CONTAINER_2D& GetThroughHoleIds() const noexcept { return m_throughHoleIds; }
|
||||
const BVH_CONTAINER_2D& GetThroughHoleOds() const noexcept { return m_throughHoleOds; }
|
||||
|
||||
/**
|
||||
* Get through hole outside diameter 2D polygons.
|
||||
@@ -261,37 +248,37 @@ public:
|
||||
*
|
||||
* @return a container with through hold outside diameter 2D polygons.
|
||||
*/
|
||||
const SHAPE_POLY_SET& GetTH_ODPolys() const noexcept
|
||||
const SHAPE_POLY_SET& GetThroughHoleOdPolys() const noexcept
|
||||
{
|
||||
return m_TH_ODPolys;
|
||||
return m_throughHoleOdPolys;
|
||||
}
|
||||
|
||||
const BVH_CONTAINER_2D& GetViaAnnuli() const noexcept
|
||||
const BVH_CONTAINER_2D& GetThroughHoleAnnularRings() const noexcept
|
||||
{
|
||||
return m_viaAnnuli;
|
||||
return m_throughHoleAnnularRings;
|
||||
}
|
||||
|
||||
const SHAPE_POLY_SET& GetViaAnnuliPolys() const noexcept
|
||||
const SHAPE_POLY_SET& GetThroughHoleAnnularRingPolys() const noexcept
|
||||
{
|
||||
return m_viaAnnuliPolys;
|
||||
return m_throughHoleAnnularRingPolys;
|
||||
}
|
||||
|
||||
const SHAPE_POLY_SET& GetNPTH_ODPolys() const noexcept
|
||||
const SHAPE_POLY_SET& GetOuterNonPlatedThroughHolePoly() const noexcept
|
||||
{
|
||||
return m_NPTH_ODPolys;
|
||||
return m_nonPlatedThroughHoleOdPolys;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a container with through hole via hole outside diameters.
|
||||
*/
|
||||
const BVH_CONTAINER_2D& GetViaTH_ODs() const noexcept
|
||||
const BVH_CONTAINER_2D& GetThroughHoleViaOds() const noexcept
|
||||
{
|
||||
return m_viaTH_ODs;
|
||||
return m_throughHoleViaOds;
|
||||
}
|
||||
|
||||
const SHAPE_POLY_SET& GetViaTH_ODPolys() const noexcept
|
||||
const SHAPE_POLY_SET& GetThroughHoleViaOdPolys() const noexcept
|
||||
{
|
||||
return m_viaTH_ODPolys;
|
||||
return m_throughHoleViaOdPolys;
|
||||
}
|
||||
|
||||
unsigned int GetViaCount() const noexcept { return m_viaCount; }
|
||||
@@ -331,8 +318,8 @@ public:
|
||||
*/
|
||||
const MAP_POLY& GetPolyMap() const noexcept { return m_layers_poly; }
|
||||
|
||||
const SHAPE_POLY_SET* GetFrontPlatedPadAndGraphicPolys() { return m_frontPlatedPadAndGraphicPolys; }
|
||||
const SHAPE_POLY_SET* GetBackPlatedPadAndGraphicPolys() { return m_backPlatedPadAndGraphicPolys; }
|
||||
const SHAPE_POLY_SET* GetFrontPlatedPadPolys() { return m_frontPlatedPadPolys; }
|
||||
const SHAPE_POLY_SET* GetBackPlatedPadPolys() { return m_backPlatedPadPolys; }
|
||||
const MAP_POLY& GetHoleIdPolysMap() const noexcept { return m_layerHoleIdPolys; }
|
||||
const MAP_POLY& GetHoleOdPolysMap() const noexcept { return m_layerHoleOdPolys; }
|
||||
|
||||
@@ -347,26 +334,21 @@ private:
|
||||
void destroyLayers();
|
||||
|
||||
// Helper functions to create the board
|
||||
void createViaWithMargin( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer,
|
||||
int aMargin );
|
||||
|
||||
void createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer );
|
||||
|
||||
void createPadWithMargin( const PAD *aPad, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayer, const VECTOR2I& aMargin ) const;
|
||||
|
||||
void createPadWithHole( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer,
|
||||
int aInflateValue );
|
||||
OBJECT_2D* createPadWithDrill( const PAD* aPad, int aInflateValue );
|
||||
|
||||
void addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayerId, bool aSkipPlatedPads, bool aSkipNonPlatedPads );
|
||||
|
||||
void addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayerId,
|
||||
const std::bitset<LAYER_3D_END>& aVisibilityFlags );
|
||||
PCB_LAYER_ID aLayerId );
|
||||
|
||||
void addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aDstContainer,
|
||||
const BOARD_ITEM* aOwner );
|
||||
const BOARD_ITEM* aItem );
|
||||
|
||||
void addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM* aOwner );
|
||||
@@ -374,20 +356,23 @@ private:
|
||||
void addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D_BASE* aDstContainer,
|
||||
const BOARD_ITEM* aOwner );
|
||||
|
||||
void addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM* aOwner );
|
||||
|
||||
void addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayerId );
|
||||
|
||||
void createArcSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
|
||||
void transformArcToSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
|
||||
const EDA_ANGLE& aArcAngle, int aCircleToSegmentsCount, int aWidth,
|
||||
CONTAINER_2D_BASE* aContainer, const BOARD_ITEM& aOwner );
|
||||
CONTAINER_2D_BASE* aDstContainer, const BOARD_ITEM& aOwner );
|
||||
|
||||
void buildPadOutlineAsSegments( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer, int aWidth );
|
||||
|
||||
// Helper functions to create poly contours
|
||||
void buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aBuffer, int aWidth) const;
|
||||
|
||||
void transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
|
||||
SHAPE_POLY_SET& aBuffer ) const;
|
||||
|
||||
public:
|
||||
static CUSTOM_COLORS_LIST g_SilkColors;
|
||||
static CUSTOM_COLORS_LIST g_SilkscreenColors;
|
||||
static CUSTOM_COLORS_LIST g_MaskColors;
|
||||
static CUSTOM_COLORS_LIST g_PasteColors;
|
||||
static CUSTOM_COLORS_LIST g_FinishColors;
|
||||
@@ -400,76 +385,68 @@ public:
|
||||
static KIGFX::COLOR4D g_DefaultSolderPaste;
|
||||
static KIGFX::COLOR4D g_DefaultSurfaceFinish;
|
||||
static KIGFX::COLOR4D g_DefaultBoardBody;
|
||||
static KIGFX::COLOR4D g_DefaultComments;
|
||||
static KIGFX::COLOR4D g_DefaultECOs;
|
||||
|
||||
public:
|
||||
EDA_3D_VIEWER_SETTINGS* m_Cfg;
|
||||
|
||||
bool m_IsBoardView;
|
||||
bool m_MousewheelPanning;
|
||||
bool m_IsPreviewer; ///< true if we're in a 3D preview panel, false
|
||||
///< for the standard 3D viewer
|
||||
bool m_IsPreviewer; ///< true if the board adaptater is living in a 3D
|
||||
///< preview panel, false for the standard 3D viewer
|
||||
|
||||
SFVEC4F m_BgColorBot; ///< background bottom color
|
||||
SFVEC4F m_BgColorTop; ///< background top color
|
||||
SFVEC4F m_BoardBodyColor; ///< in realistic mode: FR4 board color
|
||||
SFVEC4F m_SolderMaskColorBot; ///< in realistic mode: solder mask color ( bot )
|
||||
SFVEC4F m_SolderMaskColorTop; ///< in realistic mode: solder mask color ( top )
|
||||
SFVEC4F m_SolderPasteColor; ///< in realistic mode: solder paste color
|
||||
SFVEC4F m_SilkScreenColorBot; ///< in realistic mode: SilkScreen color ( bot )
|
||||
SFVEC4F m_SilkScreenColorTop; ///< in realistic mode: SilkScreen color ( top )
|
||||
SFVEC4F m_CopperColor; ///< in realistic mode: copper color
|
||||
SFVEC4F m_UserDrawingsColor;
|
||||
SFVEC4F m_UserCommentsColor;
|
||||
SFVEC4F m_ECO1Color;
|
||||
SFVEC4F m_ECO2Color;
|
||||
SFVEC4F m_BgColorBot; ///< background bottom color
|
||||
SFVEC4F m_BgColorTop; ///< background top color
|
||||
SFVEC4F m_BoardBodyColor; ///< in realistic mode: FR4 board color
|
||||
SFVEC4F m_SolderMaskColorBot; ///< in realistic mode: solder mask color ( bot )
|
||||
SFVEC4F m_SolderMaskColorTop; ///< in realistic mode: solder mask color ( top )
|
||||
SFVEC4F m_SolderPasteColor; ///< in realistic mode: solder paste color
|
||||
SFVEC4F m_SilkScreenColorBot; ///< in realistic mode: SilkScreen color ( bot )
|
||||
SFVEC4F m_SilkScreenColorTop; ///< in realistic mode: SilkScreen color ( top )
|
||||
SFVEC4F m_CopperColor; ///< in realistic mode: copper color
|
||||
|
||||
private:
|
||||
BOARD* m_board;
|
||||
S3D_CACHE* m_3dModelManager;
|
||||
RENDER_SETTINGS* m_renderSettings;
|
||||
COLOR_SETTINGS* m_colors;
|
||||
|
||||
VECTOR2I m_boardPos; ///< Board center position in board internal units.
|
||||
VECTOR2I m_boardSize; ///< Board size in board internal units.
|
||||
SFVEC3F m_boardCenter; ///< 3D center position of the board in 3D units.
|
||||
BBOX_3D m_boardBoundingBox; ///< 3D bounding box of the board in 3D units.
|
||||
VECTOR2I m_boardPos; ///< Board center position in board internal units.
|
||||
VECTOR2I m_boardSize; ///< Board size in board internal units.
|
||||
SFVEC3F m_boardCenter; ///< 3D center position of the board in 3D units.
|
||||
BBOX_3D m_boardBoundingBox; ///< 3D bounding box of the board in 3D units.
|
||||
|
||||
MAP_POLY m_layers_poly; ///< Amalgamated polygon contours for various types
|
||||
///< of items
|
||||
MAP_POLY m_layers_poly; ///< Amalgamated polygon contours for various types of
|
||||
///< items
|
||||
|
||||
SHAPE_POLY_SET* m_frontPlatedPadAndGraphicPolys;
|
||||
SHAPE_POLY_SET* m_backPlatedPadAndGraphicPolys;
|
||||
SHAPE_POLY_SET* m_frontPlatedCopperPolys;
|
||||
SHAPE_POLY_SET* m_backPlatedCopperPolys;
|
||||
SHAPE_POLY_SET* m_frontPlatedPadPolys;
|
||||
SHAPE_POLY_SET* m_backPlatedPadPolys;
|
||||
|
||||
MAP_POLY m_layerHoleOdPolys; ///< Hole outer diameters (per layer)
|
||||
MAP_POLY m_layerHoleIdPolys; ///< Hole inner diameters (per layer)
|
||||
MAP_POLY m_layerHoleOdPolys; ///< Hole outer diameters (per layer)
|
||||
MAP_POLY m_layerHoleIdPolys; ///< Hole inner diameters (per layer)
|
||||
|
||||
SHAPE_POLY_SET m_NPTH_ODPolys; ///< NPTH outer diameters
|
||||
SHAPE_POLY_SET m_TH_ODPolys; ///< PTH outer diameters
|
||||
SHAPE_POLY_SET m_viaTH_ODPolys; ///< Via hole outer diameters
|
||||
SHAPE_POLY_SET m_viaAnnuliPolys; ///< Via annular ring outer diameters
|
||||
SHAPE_POLY_SET m_nonPlatedThroughHoleOdPolys; ///< NPTH outer diameters
|
||||
SHAPE_POLY_SET m_throughHoleOdPolys; ///< PTH outer diameters
|
||||
SHAPE_POLY_SET m_throughHoleViaOdPolys; ///< Via hole outer diameters
|
||||
SHAPE_POLY_SET m_throughHoleAnnularRingPolys; ///< Via annular ring outer diameters
|
||||
|
||||
SHAPE_POLY_SET m_board_poly; ///< Board outline polygon.
|
||||
SHAPE_POLY_SET m_board_poly; ///< Board outline polygon.
|
||||
|
||||
MAP_CONTAINER_2D_BASE m_layerMap; ///< 2D elements for each layer.
|
||||
MAP_CONTAINER_2D_BASE m_layerHoleMap; ///< Holes for each layer.
|
||||
MAP_CONTAINER_2D_BASE m_layerMap; ///< 2D elements for each layer.
|
||||
MAP_CONTAINER_2D_BASE m_layerHoleMap; ///< Holes for each layer.
|
||||
|
||||
BVH_CONTAINER_2D* m_platedPadsFront;
|
||||
BVH_CONTAINER_2D* m_platedPadsBack;
|
||||
BVH_CONTAINER_2D* m_offboardPadsFront;
|
||||
BVH_CONTAINER_2D* m_offboardPadsBack;
|
||||
|
||||
BVH_CONTAINER_2D m_TH_ODs; ///< List of PTH outer diameters
|
||||
BVH_CONTAINER_2D m_TH_IDs; ///< List of PTH inner diameters
|
||||
BVH_CONTAINER_2D m_viaAnnuli; ///< List of via annular rings
|
||||
BVH_CONTAINER_2D m_viaTH_ODs; ///< List of via hole outer diameters
|
||||
BVH_CONTAINER_2D m_throughHoleOds; ///< List of PTH outer diameters
|
||||
BVH_CONTAINER_2D m_throughHoleIds; ///< List of PTH inner diameters
|
||||
BVH_CONTAINER_2D m_throughHoleAnnularRings; ///< List of via annular rings
|
||||
BVH_CONTAINER_2D m_throughHoleViaOds; ///< List of via hole outer diameters
|
||||
BVH_CONTAINER_2D m_throughHoleViaIds; ///< List of via hole inner diameters
|
||||
|
||||
unsigned int m_copperLayersCount;
|
||||
|
||||
double m_biuTo3Dunits; ///< Scale factor to convert board internal units
|
||||
///< to 3D units normalized between -1.0 and 1.0.
|
||||
double m_biuTo3Dunits; ///< Scale factor to convert board internal units to
|
||||
///< 3D units normalized between -1.0 and 1.0.
|
||||
|
||||
std::array<float, PCB_LAYER_ID_COUNT> m_layerZcoordTop; ///< Top (End) Z position of each
|
||||
///< layer in 3D units.
|
||||
|
||||
@@ -2,8 +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) 2023 CERN
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-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
|
||||
@@ -24,23 +23,27 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file create_3Dgraphic_brd_items.cpp
|
||||
* @file create_graphic_brd_items.cpp
|
||||
* @brief This file implements the creation of 2D graphic primitives of pcb items:
|
||||
* pads, tracks, drawsegments, texts....
|
||||
* It is based on the function found in the files:
|
||||
* board_items_to_polygon_shape_transform.cpp
|
||||
*/
|
||||
|
||||
#include "../3d_rendering/raytracing/shapes2D/ring_2d.h"
|
||||
#include "../3d_rendering/raytracing/shapes2D/filled_circle_2d.h"
|
||||
#include "../3d_rendering/raytracing/shapes2D/round_segment_2d.h"
|
||||
#include "../3d_rendering/raytracing/shapes2D/triangle_2d.h"
|
||||
#include "fp_textbox.h"
|
||||
#include <board_adapter.h>
|
||||
#include <footprint.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <fp_shape.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <pcb_painter.h> // for PCB_RENDER_SETTINGS
|
||||
#include <zone.h>
|
||||
#include <fp_text.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <trigo.h>
|
||||
#include <geometry/shape_segment.h>
|
||||
@@ -60,39 +63,8 @@
|
||||
#define TO_SFVEC2F( vec ) SFVEC2F( TO_3DU( vec.x ), TO_3DU( -vec.y ) )
|
||||
|
||||
|
||||
void addFILLED_CIRCLE_2D( CONTAINER_2D_BASE* aContainer, const SFVEC2F& aCenter, float aRadius,
|
||||
const BOARD_ITEM& aBoardItem )
|
||||
{
|
||||
if( aRadius > 0.0f )
|
||||
aContainer->Add( new FILLED_CIRCLE_2D( aCenter, aRadius, aBoardItem ) );
|
||||
}
|
||||
|
||||
|
||||
void addRING_2D( CONTAINER_2D_BASE* aContainer, const SFVEC2F& aCenter, float aInnerRadius,
|
||||
float aOuterRadius, const BOARD_ITEM& aBoardItem )
|
||||
{
|
||||
if( aOuterRadius > aInnerRadius && aInnerRadius > 0.0f )
|
||||
aContainer->Add( new RING_2D( aCenter, aInnerRadius, aOuterRadius, aBoardItem ) );
|
||||
}
|
||||
|
||||
|
||||
void addROUND_SEGMENT_2D( CONTAINER_2D_BASE* aContainer, const SFVEC2F& aStart, const SFVEC2F& aEnd,
|
||||
float aWidth, const BOARD_ITEM& aBoardItem )
|
||||
{
|
||||
if( Is_segment_a_circle( aStart, aEnd ) )
|
||||
{
|
||||
// Cannot add segments that have the same start and end point
|
||||
addFILLED_CIRCLE_2D( aContainer, aStart, aWidth / 2, aBoardItem );
|
||||
return;
|
||||
}
|
||||
|
||||
if( aWidth > 0.0f )
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( aStart, aEnd, aWidth, aBoardItem ) );
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM* aOwner )
|
||||
const BOARD_ITEM* aItem )
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
|
||||
@@ -102,17 +74,25 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( wxEmptyString, aText->IsBold(), aText->IsItalic() );
|
||||
|
||||
if( aOwner && aOwner->IsKnockout() )
|
||||
if( aItem && aItem->IsKnockout() )
|
||||
{
|
||||
SHAPE_POLY_SET finalPoly;
|
||||
const PCB_TEXT* pcbText = static_cast<const PCB_TEXT*>( aOwner );
|
||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
SHAPE_POLY_SET finalPoly;
|
||||
|
||||
pcbText->TransformTextToPolySet( finalPoly, 0, m_board->GetDesignSettings().m_MaxError,
|
||||
ERROR_INSIDE );
|
||||
if( aItem->Type() == PCB_FP_TEXT_T )
|
||||
{
|
||||
static_cast<const FP_TEXT*>( aItem )->TransformTextToPolySet( finalPoly, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
else if( aItem->Type() == PCB_TEXT_T )
|
||||
{
|
||||
static_cast<const PCB_TEXT*>( aItem )->TransformTextToPolySet( finalPoly, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
|
||||
// Do not call finalPoly.Fracture() here: ConvertPolygonToTriangles() call it
|
||||
// if needed, and Fracture() called twice can create bad results and is useless
|
||||
ConvertPolygonToTriangles( finalPoly, *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
ConvertPolygonToTriangles( finalPoly, *aContainer, m_biuTo3Dunits, *aItem );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -120,20 +100,35 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
|
||||
// Stroke callback
|
||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
||||
{
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( aPt1 ), TO_SFVEC2F( aPt2 ),
|
||||
penWidth_3DU, *aOwner );
|
||||
const SFVEC2F pt1_3DU = TO_SFVEC2F( aPt1 );
|
||||
const SFVEC2F pt2_3DU = TO_SFVEC2F( aPt2 );
|
||||
|
||||
if( penWidth_3DU == 0.0 )
|
||||
{
|
||||
// Don't attempt to render degenerate shapes
|
||||
}
|
||||
else if( Is_segment_a_circle( pt1_3DU, pt2_3DU ) )
|
||||
{
|
||||
// Cannot add segments that have the same start and end point
|
||||
aContainer->Add( new FILLED_CIRCLE_2D( pt1_3DU, penWidth_3DU / 2,
|
||||
*aItem ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( pt1_3DU, pt2_3DU, penWidth_3DU,
|
||||
*aItem ) );
|
||||
}
|
||||
},
|
||||
// Triangulation callback
|
||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
|
||||
{
|
||||
aContainer->Add( new TRIANGLE_2D( TO_SFVEC2F( aPt1 ), TO_SFVEC2F( aPt2 ),
|
||||
TO_SFVEC2F( aPt3 ), *aOwner ) );
|
||||
TO_SFVEC2F( aPt3 ), *aItem ) );
|
||||
} );
|
||||
|
||||
attrs.m_Angle = aText->GetDrawRotation();
|
||||
|
||||
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs,
|
||||
aOwner->GetFontMetrics() );
|
||||
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,19 +148,18 @@ void BOARD_ADAPTER::addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D
|
||||
{
|
||||
const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
|
||||
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( seg.A ), TO_SFVEC2F( seg.B ),
|
||||
TO_3DU( linewidth ), *aOwner );
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( TO_SFVEC2F( seg.A ), TO_SFVEC2F( seg.B ),
|
||||
TO_3DU( linewidth ), *aOwner ) );
|
||||
break;
|
||||
}
|
||||
|
||||
case SH_CIRCLE:
|
||||
{
|
||||
int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
|
||||
float innerR3DU = TO_3DU( radius ) - TO_3DU( aDimension->GetLineThickness() ) / 2.0f;
|
||||
float outerR3DU = TO_3DU( radius ) + TO_3DU( aDimension->GetLineThickness() ) / 2.0f;
|
||||
|
||||
addRING_2D( aContainer, TO_SFVEC2F( shape->Centre() ), innerR3DU, outerR3DU, *aOwner );
|
||||
int delta = aDimension->GetLineThickness() / 2;
|
||||
|
||||
aContainer->Add( new RING_2D( TO_SFVEC2F( shape->Centre() ), TO_3DU( radius - delta ),
|
||||
TO_3DU( radius + delta ), *aOwner ) );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -177,69 +171,49 @@ void BOARD_ADAPTER::addShape( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D
|
||||
|
||||
|
||||
void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aContainer,
|
||||
PCB_LAYER_ID aLayerId,
|
||||
const std::bitset<LAYER_3D_END>& aVisibilityFlags )
|
||||
PCB_LAYER_ID aLayerId )
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
|
||||
for( PCB_FIELD* field : aFootprint->GetFields() )
|
||||
{
|
||||
if( field->GetLayer() == aLayerId && field->IsVisible() )
|
||||
{
|
||||
if( !aVisibilityFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
else if( field->IsReference() && !aVisibilityFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
else if( field->IsValue() && !aVisibilityFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
if( aFootprint->Reference().GetLayer() == aLayerId && aFootprint->Reference().IsVisible() )
|
||||
addText( &aFootprint->Reference(), aContainer, &aFootprint->Reference() );
|
||||
|
||||
addText( field, aContainer, field );
|
||||
}
|
||||
}
|
||||
if( aFootprint->Value().GetLayer() == aLayerId && aFootprint->Value().IsVisible() )
|
||||
addText( &aFootprint->Value(), aContainer, &aFootprint->Value() );
|
||||
|
||||
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_TEXT_T:
|
||||
case PCB_FP_TEXT_T:
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
FP_TEXT* text = static_cast<FP_TEXT*>( item );
|
||||
|
||||
if( text->GetLayer() == aLayerId && text->IsVisible() )
|
||||
{
|
||||
if( !aVisibilityFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
else if( text->GetText() == wxT( "${REFERENCE}" ) && !aVisibilityFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
else if( text->GetText() == wxT( "${VALUE}" ) && !aVisibilityFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
|
||||
addText( text, aContainer, text );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TEXTBOX_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
{
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
FP_TEXTBOX* textbox = static_cast<FP_TEXTBOX*>( item );
|
||||
|
||||
if( textbox->GetLayer() == aLayerId )
|
||||
{
|
||||
if( textbox->IsBorderEnabled() )
|
||||
addShape( textbox, aContainer, aFootprint );
|
||||
|
||||
addText( textbox, aContainer, aFootprint );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
{
|
||||
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
|
||||
|
||||
@@ -249,9 +223,9 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_SHAPE_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
{
|
||||
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
|
||||
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
|
||||
|
||||
if( shape->GetLayer() == aLayerId )
|
||||
addShape( shape, aContainer, aFootprint );
|
||||
@@ -266,17 +240,6 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::createViaWithMargin( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer,
|
||||
int aMargin )
|
||||
{
|
||||
SFVEC2F start3DU = TO_SFVEC2F( aTrack->GetStart() );
|
||||
SFVEC2F end3DU = TO_SFVEC2F( aTrack->GetEnd() );
|
||||
const float radius3DU = TO_3DU( ( aTrack->GetWidth() / 2.0 ) + aMargin );
|
||||
|
||||
addFILLED_CIRCLE_2D( aDstContainer, start3DU, radius3DU, *aTrack );
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer )
|
||||
{
|
||||
SFVEC2F start3DU = TO_SFVEC2F( aTrack->GetStart() );
|
||||
@@ -285,8 +248,14 @@ void BOARD_ADAPTER::createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDs
|
||||
switch( aTrack->Type() )
|
||||
{
|
||||
case PCB_VIA_T:
|
||||
addFILLED_CIRCLE_2D( aDstContainer, start3DU, TO_3DU( aTrack->GetWidth() / 2.0 ), *aTrack );
|
||||
{
|
||||
const float radius3DU = TO_3DU( aTrack->GetWidth() / 2 );
|
||||
|
||||
if( radius3DU > 0.0 )
|
||||
aDstContainer->Add( new FILLED_CIRCLE_2D( start3DU, radius3DU, *aTrack ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_ARC_T:
|
||||
{
|
||||
@@ -305,10 +274,10 @@ void BOARD_ADAPTER::createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDs
|
||||
return;
|
||||
}
|
||||
|
||||
VECTOR2I center( arc->GetCenter() );
|
||||
VECTOR2D center( arc->GetCenter() );
|
||||
EDA_ANGLE arc_angle = arc->GetAngle();
|
||||
double radius = arc->GetRadius();
|
||||
int arcsegcount = GetArcToSegmentCount( KiROUND( radius ), ARC_HIGH_DEF, arc_angle );
|
||||
int arcsegcount = GetArcToSegmentCount( radius, ARC_HIGH_DEF, arc_angle );
|
||||
int circlesegcount;
|
||||
|
||||
// Avoid arcs that cannot be drawn
|
||||
@@ -324,17 +293,32 @@ void BOARD_ADAPTER::createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDs
|
||||
else
|
||||
{
|
||||
circlesegcount = KiROUND( arcsegcount * 360.0 / std::abs( arc_angle.AsDegrees() ) );
|
||||
circlesegcount = alg::clamp( 1, circlesegcount, 128 );
|
||||
circlesegcount = std::max( 1, std::min( circlesegcount, 128 ) );
|
||||
}
|
||||
|
||||
createArcSegments( center, arc->GetStart(), arc_angle, circlesegcount, arc->GetWidth(),
|
||||
aDstContainer, *arc );
|
||||
transformArcToSegments( VECTOR2I( center.x, center.y ), arc->GetStart(), arc_angle,
|
||||
circlesegcount, arc->GetWidth(), aDstContainer, *arc );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TRACE_T: // Track is a usual straight segment
|
||||
{
|
||||
addROUND_SEGMENT_2D( aDstContainer, start3DU, end3DU, TO_3DU( aTrack->GetWidth() ), *aTrack );
|
||||
if( aTrack->GetWidth() == 0 )
|
||||
{
|
||||
// Don't attempt to render degenerate shapes
|
||||
}
|
||||
else if( Is_segment_a_circle( start3DU, end3DU ) )
|
||||
{
|
||||
// Cannot add segments that have the same start and end point
|
||||
aDstContainer->Add( new FILLED_CIRCLE_2D( start3DU, TO_3DU( aTrack->GetWidth() / 2 ),
|
||||
*aTrack ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aDstContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, TO_3DU( aTrack->GetWidth() ),
|
||||
*aTrack ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -367,12 +351,9 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
return;
|
||||
|
||||
PAD dummy( *aPad );
|
||||
dummy.SetSize( VECTOR2I( dummySize.x, dummySize.y ) );
|
||||
dummy.SetSize( wxSize( dummySize.x, dummySize.y ) );
|
||||
dummy.TransformShapeToPolygon( poly, aLayer, 0, maxError, ERROR_INSIDE );
|
||||
clearance = { 0, 0 };
|
||||
|
||||
// Remove group membership from dummy item before deleting
|
||||
dummy.SetParentGroup( nullptr );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -386,11 +367,24 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
{
|
||||
const SHAPE_SEGMENT* seg = static_cast<const SHAPE_SEGMENT*>( shape );
|
||||
|
||||
addROUND_SEGMENT_2D( aContainer,
|
||||
TO_SFVEC2F( seg->GetSeg().A ),
|
||||
TO_SFVEC2F( seg->GetSeg().B ),
|
||||
TO_3DU( seg->GetWidth() + clearance.x * 2 ),
|
||||
*aPad );
|
||||
const SFVEC2F a3DU = TO_SFVEC2F( seg->GetSeg().A );
|
||||
const SFVEC2F b3DU = TO_SFVEC2F( seg->GetSeg().B );
|
||||
const double width3DU = TO_3DU( seg->GetWidth() + clearance.x * 2 );
|
||||
|
||||
if( width3DU == 0.0 )
|
||||
{
|
||||
// Don't attempt to render degenerate shapes
|
||||
}
|
||||
else if( Is_segment_a_circle( a3DU, b3DU ) )
|
||||
{
|
||||
// Cannot add segments that have the same start and end point
|
||||
aContainer->Add( new FILLED_CIRCLE_2D( a3DU, width3DU / 2, *aPad ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( a3DU, b3DU, width3DU, *aPad ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -398,10 +392,13 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
{
|
||||
const SHAPE_CIRCLE* circle = static_cast<const SHAPE_CIRCLE*>( shape );
|
||||
|
||||
addFILLED_CIRCLE_2D( aContainer,
|
||||
TO_SFVEC2F( circle->GetCenter() ),
|
||||
TO_3DU( circle->GetRadius() + clearance.x ),
|
||||
*aPad );
|
||||
const double radius3DU = TO_3DU( circle->GetRadius() + clearance.x );
|
||||
const SFVEC2F center3DU = TO_SFVEC2F( circle->GetCenter() );
|
||||
|
||||
// Don't render zero radius circles
|
||||
if( radius3DU > 0.0 )
|
||||
aContainer->Add( new FILLED_CIRCLE_2D( center3DU, radius3DU, *aPad ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -433,12 +430,23 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
for( int i = 0; i < l.SegmentCount(); i++ )
|
||||
{
|
||||
SHAPE_SEGMENT seg( l.Segment( i ).A, l.Segment( i ).B, arc->GetWidth() );
|
||||
const SFVEC2F a3DU = TO_SFVEC2F( seg.GetSeg().A );
|
||||
const SFVEC2F b3DU = TO_SFVEC2F( seg.GetSeg().B );
|
||||
const double width3DU = TO_3DU( arc->GetWidth() + clearance.x * 2 );
|
||||
|
||||
addROUND_SEGMENT_2D( aContainer,
|
||||
TO_SFVEC2F( seg.GetSeg().A ),
|
||||
TO_SFVEC2F( seg.GetSeg().B ),
|
||||
TO_3DU( arc->GetWidth() + clearance.x * 2 ),
|
||||
*aPad );
|
||||
if( width3DU == 0.0 )
|
||||
{
|
||||
// Don't attempt to render degenerate shapes
|
||||
}
|
||||
else if( Is_segment_a_circle( a3DU, b3DU ) )
|
||||
{
|
||||
// Cannot add segments that have the same start and end point
|
||||
aContainer->Add( new FILLED_CIRCLE_2D( a3DU, width3DU / 2, *aPad ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( a3DU, b3DU, width3DU, *aPad ) );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -454,7 +462,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
if( !poly.IsEmpty() )
|
||||
{
|
||||
if( clearance.x )
|
||||
poly.Inflate( clearance.x, CORNER_STRATEGY::ROUND_ALL_CORNERS, maxError );
|
||||
poly.Inflate( clearance.x, 32 );
|
||||
|
||||
// Add the PAD polygon
|
||||
ConvertPolygonToTriangles( poly, *aContainer, m_biuTo3Dunits, *aPad );
|
||||
@@ -462,22 +470,29 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::createPadWithHole( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer,
|
||||
int aInflateValue )
|
||||
OBJECT_2D* BOARD_ADAPTER::createPadWithDrill( const PAD* aPad, int aInflateValue )
|
||||
{
|
||||
if( !aPad->HasHole() )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "BOARD_ADAPTER::createPadWithHole - found an invalid pad" ) );
|
||||
return;
|
||||
wxLogTrace( m_logTrace, wxT( "BOARD_ADAPTER::createPadWithDrill - found an invalid pad" ) );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<SHAPE_SEGMENT> slot = aPad->GetEffectiveHoleShape();
|
||||
|
||||
addROUND_SEGMENT_2D( aDstContainer,
|
||||
TO_SFVEC2F( slot->GetSeg().A ),
|
||||
TO_SFVEC2F( slot->GetSeg().B ),
|
||||
TO_3DU( slot->GetWidth() + aInflateValue * 2 ),
|
||||
*aPad );
|
||||
if( slot->GetSeg().A == slot->GetSeg().B )
|
||||
{
|
||||
return new FILLED_CIRCLE_2D( TO_SFVEC2F( slot->GetSeg().A ),
|
||||
TO_3DU( slot->GetWidth() / 2 + aInflateValue ),
|
||||
*aPad );
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ROUND_SEGMENT_2D( TO_SFVEC2F( slot->GetSeg().A ),
|
||||
TO_SFVEC2F( slot->GetSeg().B ),
|
||||
TO_3DU( slot->GetWidth() + aInflateValue * 2 ),
|
||||
*aPad );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -546,10 +561,10 @@ void BOARD_ADAPTER::addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aCo
|
||||
|
||||
// based on TransformArcToPolygon function from
|
||||
// common/convert_basic_shapes_to_polygon.cpp
|
||||
void BOARD_ADAPTER::createArcSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
|
||||
const EDA_ANGLE& aArcAngle, int aCircleToSegmentsCount,
|
||||
int aWidth, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM& aOwner )
|
||||
void BOARD_ADAPTER::transformArcToSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart,
|
||||
const EDA_ANGLE& aArcAngle, int aCircleToSegmentsCount,
|
||||
int aWidth, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM& aOwner )
|
||||
{
|
||||
// Don't attempt to render degenerate shapes
|
||||
if( aWidth == 0 )
|
||||
@@ -579,16 +594,26 @@ void BOARD_ADAPTER::createArcSegments( const VECTOR2I& aCentre, const VECTOR2I&
|
||||
curr_end = arc_start;
|
||||
RotatePoint( curr_end, aCentre, -ii );
|
||||
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( curr_start ), TO_SFVEC2F( curr_end ),
|
||||
TO_3DU( aWidth ), aOwner );
|
||||
const SFVEC2F start3DU = TO_SFVEC2F( curr_start );
|
||||
const SFVEC2F end3DU = TO_SFVEC2F( curr_end );
|
||||
|
||||
if( Is_segment_a_circle( start3DU, end3DU ) )
|
||||
aContainer->Add( new FILLED_CIRCLE_2D( start3DU, TO_3DU( aWidth / 2 ), aOwner ) );
|
||||
else
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, TO_3DU( aWidth ), aOwner ) );
|
||||
|
||||
curr_start = curr_end;
|
||||
}
|
||||
|
||||
if( curr_end != arc_end )
|
||||
{
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( curr_end ), TO_SFVEC2F( arc_end ),
|
||||
TO_3DU( aWidth ), aOwner );
|
||||
const SFVEC2F start3DU = TO_SFVEC2F( curr_end );
|
||||
const SFVEC2F end3DU = TO_SFVEC2F( arc_end );
|
||||
|
||||
if( Is_segment_a_circle( start3DU, end3DU ) )
|
||||
aContainer->Add( new FILLED_CIRCLE_2D( start3DU, TO_3DU( aWidth / 2 ), aOwner ) );
|
||||
else
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, TO_3DU( aWidth ), aOwner ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,28 +622,38 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
const BOARD_ITEM* aOwner )
|
||||
{
|
||||
// The full width of the lines to create
|
||||
const float linewidth3DU = TO_3DU( aShape->GetWidth() );
|
||||
LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle();
|
||||
// The extra 1 protects the inner/outer radius values from degeneracy
|
||||
const int linewidth = aShape->GetWidth() + 1;
|
||||
PLOT_DASH_TYPE lineStyle = aShape->GetStroke().GetPlotStyle();
|
||||
|
||||
if( lineStyle <= LINE_STYLE::FIRST_TYPE )
|
||||
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
|
||||
{
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
SFVEC2F center3DU = TO_SFVEC2F( aShape->GetCenter() );
|
||||
float innerR3DU = TO_3DU( aShape->GetRadius() ) - linewidth3DU / 2.0;
|
||||
float outerR3DU = TO_3DU( aShape->GetRadius() ) + linewidth3DU / 2.0;
|
||||
const SFVEC2F center3DU = TO_SFVEC2F( aShape->GetCenter() );
|
||||
float inner_radius3DU = TO_3DU( aShape->GetRadius() - linewidth / 2 );
|
||||
float outer_radius3DU = TO_3DU( aShape->GetRadius() + linewidth / 2 );
|
||||
|
||||
if( aShape->IsFilled() || innerR3DU <= 0.0 )
|
||||
addFILLED_CIRCLE_2D( aContainer, center3DU, outerR3DU, *aOwner );
|
||||
else
|
||||
addRING_2D( aContainer, center3DU, innerR3DU, outerR3DU, *aOwner );
|
||||
if( inner_radius3DU < 0 )
|
||||
inner_radius3DU = 0.0;
|
||||
|
||||
if( aShape->IsFilled() )
|
||||
{
|
||||
aContainer->Add( new FILLED_CIRCLE_2D( center3DU, outer_radius3DU,
|
||||
*aOwner ) );
|
||||
}
|
||||
else if( outer_radius3DU > inner_radius3DU )
|
||||
{
|
||||
aContainer->Add( new RING_2D( center3DU, inner_radius3DU, outer_radius3DU,
|
||||
*aOwner ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::RECTANGLE:
|
||||
case SHAPE_T::RECT:
|
||||
if( aShape->IsFilled() )
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
@@ -634,14 +669,14 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
{
|
||||
std::vector<VECTOR2I> pts = aShape->GetRectCorners();
|
||||
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[0] ), TO_SFVEC2F( pts[1] ),
|
||||
linewidth3DU, *aOwner );
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[1] ), TO_SFVEC2F( pts[2] ),
|
||||
linewidth3DU, *aOwner );
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[2] ), TO_SFVEC2F( pts[3] ),
|
||||
linewidth3DU, *aOwner );
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[3] ), TO_SFVEC2F( pts[0] ),
|
||||
linewidth3DU, *aOwner );
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( TO_SFVEC2F( pts[0] ), TO_SFVEC2F( pts[1] ),
|
||||
TO_3DU( linewidth ), *aOwner ) );
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( TO_SFVEC2F( pts[1] ), TO_SFVEC2F( pts[2] ),
|
||||
TO_3DU( linewidth ), *aOwner ) );
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( TO_SFVEC2F( pts[2] ), TO_SFVEC2F( pts[3] ),
|
||||
TO_3DU( linewidth ), *aOwner ) );
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( TO_SFVEC2F( pts[3] ), TO_SFVEC2F( pts[0] ),
|
||||
TO_3DU( linewidth ), *aOwner ) );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -649,15 +684,33 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
{
|
||||
unsigned int segCount = GetCircleSegmentCount( aShape->GetBoundingBox().GetSizeMax() );
|
||||
|
||||
createArcSegments( aShape->GetCenter(), aShape->GetStart(), aShape->GetArcAngle(),
|
||||
segCount, aShape->GetWidth(), aContainer, *aOwner );
|
||||
transformArcToSegments( aShape->GetCenter(), aShape->GetStart(), aShape->GetArcAngle(),
|
||||
segCount, linewidth, aContainer, *aOwner );
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::SEGMENT:
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( aShape->GetStart() ),
|
||||
TO_SFVEC2F( aShape->GetEnd() ), linewidth3DU, *aOwner );
|
||||
{
|
||||
const SFVEC2F start3DU = TO_SFVEC2F( aShape->GetStart() );
|
||||
const SFVEC2F end3DU = TO_SFVEC2F( aShape->GetEnd() );
|
||||
const double linewidth3DU = TO_3DU( linewidth );
|
||||
|
||||
if( linewidth3DU == 0.0 )
|
||||
{
|
||||
// Don't attempt to render degenerate shapes
|
||||
}
|
||||
else if( Is_segment_a_circle( start3DU, end3DU ) )
|
||||
{
|
||||
// Cannot add segments that have the same start and end point
|
||||
aContainer->Add( new FILLED_CIRCLE_2D( start3DU, linewidth3DU / 2, *aOwner ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, linewidth3DU, *aOwner ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
case SHAPE_T::POLY:
|
||||
@@ -667,11 +720,6 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF,
|
||||
ERROR_INSIDE );
|
||||
|
||||
// Some polygons can be a bit complex (especially when coming from a
|
||||
// picture ot a text converted to a polygon
|
||||
// So call Simplify before calling ConvertPolygonToTriangles, just in case.
|
||||
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
if( polyList.IsEmpty() ) // Just for caution
|
||||
break;
|
||||
|
||||
@@ -685,11 +733,12 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if( linewidth > 0 )
|
||||
{
|
||||
std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
|
||||
SFVEC2F a3DU;
|
||||
SFVEC2F b3DU;
|
||||
double width3DU = TO_3DU( linewidth );
|
||||
|
||||
const PCB_PLOT_PARAMS& plotParams = aShape->GetBoard()->GetPlotOptions();
|
||||
KIGFX::PCB_RENDER_SETTINGS renderSettings;
|
||||
@@ -699,11 +748,16 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
{
|
||||
STROKE_PARAMS::Stroke( shape, lineStyle, aShape->GetWidth(), &renderSettings,
|
||||
STROKE_PARAMS::Stroke( shape, lineStyle, linewidth, &renderSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( a ), TO_SFVEC2F( b ),
|
||||
linewidth3DU, *aOwner );
|
||||
a3DU = TO_SFVEC2F( a );
|
||||
b3DU = TO_SFVEC2F( b );
|
||||
|
||||
if( Is_segment_a_circle( a3DU, b3DU ) )
|
||||
aContainer->Add( new FILLED_CIRCLE_2D( a3DU, width3DU / 2, *aOwner ) );
|
||||
else
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( a3DU, b3DU, width3DU, *aOwner ) );
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -713,38 +767,12 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM* aOwner )
|
||||
{
|
||||
addText( aTextBox, aContainer, aOwner );
|
||||
|
||||
if( !aTextBox->IsBorderEnabled() )
|
||||
return;
|
||||
|
||||
// We cannot use PCB_TEXTBOX::TransformShapeToPolygon because it convert the textbox
|
||||
// as filled polygon even if there's no background colour.
|
||||
// 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;
|
||||
|
||||
aTextBox->PCB_SHAPE::TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0,
|
||||
ARC_HIGH_DEF, ERROR_INSIDE );
|
||||
|
||||
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* aContainer,
|
||||
PCB_LAYER_ID aLayerId )
|
||||
{
|
||||
// This convert the poly in outline and holes
|
||||
ConvertPolygonToTriangles( *aZone->GetFilledPolysList( aLayerId ), *aContainer, m_biuTo3Dunits,
|
||||
*aZone );
|
||||
ConvertPolygonToTriangles( *aZone->GetFilledPolysList( aLayerId ), *aContainer,
|
||||
m_biuTo3Dunits, *aZone );
|
||||
}
|
||||
|
||||
|
||||
@@ -755,23 +783,35 @@ void BOARD_ADAPTER::buildPadOutlineAsSegments( const PAD* aPad, CONTAINER_2D_BAS
|
||||
{
|
||||
const SFVEC2F center3DU = TO_SFVEC2F( aPad->ShapePos() );
|
||||
const int radius = aPad->GetSize().x / 2;
|
||||
const float inner_radius3DU = TO_3DU( radius - aWidth / 2.0 );
|
||||
const float outer_radius3DU = TO_3DU( radius + aWidth / 2.0 );
|
||||
const float inner_radius3DU = TO_3DU( radius - aWidth / 2 );
|
||||
const float outer_radius3DU = TO_3DU( radius + aWidth / 2 );
|
||||
|
||||
addRING_2D( aContainer, center3DU, inner_radius3DU, outer_radius3DU, *aPad );
|
||||
aContainer->Add( new RING_2D( center3DU, inner_radius3DU, outer_radius3DU, *aPad ) );
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
// For other shapes, add outlines as thick segments in polygon buffer
|
||||
const std::shared_ptr<SHAPE_POLY_SET>& corners = aPad->GetEffectivePolygon( ERROR_INSIDE );
|
||||
const SHAPE_LINE_CHAIN& path = corners->COutline( 0 );
|
||||
|
||||
for( int j = 0; j < path.PointCount(); j++ )
|
||||
{
|
||||
// For other shapes, add outlines as thick segments in polygon buffer
|
||||
const std::shared_ptr<SHAPE_POLY_SET>& corners = aPad->GetEffectivePolygon( ERROR_INSIDE );
|
||||
const SHAPE_LINE_CHAIN& path = corners->COutline( 0 );
|
||||
SFVEC2F start3DU = TO_SFVEC2F( path.CPoint( j ) );
|
||||
SFVEC2F end3DU = TO_SFVEC2F( path.CPoint( j + 1 ) );
|
||||
|
||||
for( int j = 0; j < path.PointCount(); j++ )
|
||||
if( aWidth == 0 )
|
||||
{
|
||||
SFVEC2F start3DU = TO_SFVEC2F( path.CPoint( j ) );
|
||||
SFVEC2F end3DU = TO_SFVEC2F( path.CPoint( j + 1 ) );
|
||||
|
||||
addROUND_SEGMENT_2D( aContainer, start3DU, end3DU, TO_3DU( aWidth ), *aPad );
|
||||
// Don't attempt to render degenerate shapes
|
||||
}
|
||||
else if( Is_segment_a_circle( start3DU, end3DU ) )
|
||||
{
|
||||
// Cannot add segments that have the same start and end point
|
||||
aContainer->Add( new FILLED_CIRCLE_2D( start3DU, TO_3DU( aWidth / 2 ), *aPad ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aContainer->Add( new ROUND_SEGMENT_2D( start3DU, end3DU, TO_3DU( aWidth ), *aPad ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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-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 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file create_layer_poly.cpp
|
||||
* @brief This file implements the creation of the pcb board items in the poly
|
||||
* contours format.
|
||||
*/
|
||||
|
||||
#include "board_adapter.h"
|
||||
#include <board_design_settings.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <fp_shape.h>
|
||||
#include <footprint.h>
|
||||
|
||||
|
||||
/*
|
||||
* This is used to draw pad outlines on silk layers.
|
||||
*/
|
||||
void BOARD_ADAPTER::buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aBuffer,
|
||||
int aWidth ) const
|
||||
{
|
||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
|
||||
if( aPad->GetShape() == PAD_SHAPE::CIRCLE ) // Draw a ring
|
||||
{
|
||||
TransformRingToPolygon( aBuffer, aPad->ShapePos(), aPad->GetSize().x / 2, aWidth, maxError,
|
||||
ERROR_INSIDE );
|
||||
return;
|
||||
}
|
||||
|
||||
// For other shapes, add outlines as thick segments in polygon buffer
|
||||
const std::shared_ptr<SHAPE_POLY_SET>& corners = aPad->GetEffectivePolygon( ERROR_INSIDE );
|
||||
const SHAPE_LINE_CHAIN& path = corners->COutline( 0 );
|
||||
|
||||
for( int ii = 0; ii < path.PointCount(); ++ii )
|
||||
{
|
||||
const VECTOR2I& a = path.CPoint( ii );
|
||||
const VECTOR2I& b = path.CPoint( ii + 1 );
|
||||
|
||||
TransformOvalToPolygon( aBuffer, a, b, aWidth, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
|
||||
SHAPE_POLY_SET& aBuffer ) const
|
||||
{
|
||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
|
||||
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||
{
|
||||
if( item->Type() == PCB_FP_SHAPE_T )
|
||||
{
|
||||
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
|
||||
|
||||
if( shape->GetLayer() == aLayer )
|
||||
shape->TransformShapeToPolygon( aBuffer, aLayer, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
else if( BaseType( item->Type() ) == PCB_DIMENSION_T )
|
||||
{
|
||||
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
|
||||
|
||||
if( dimension->GetLayer() == aLayer )
|
||||
dimension->TransformShapeToPolygon( aBuffer, aLayer, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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-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 @@
|
||||
*/
|
||||
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/gl_utils.h>
|
||||
#include <gl_utils.h>
|
||||
#include <wx/tokenzr.h>
|
||||
|
||||
#include "../common_ogl/ogl_utils.h"
|
||||
@@ -35,10 +35,11 @@
|
||||
#include <advanced_config.h>
|
||||
#include <board.h>
|
||||
#include <reporter.h>
|
||||
#include <gal/opengl/gl_context_mgr.h>
|
||||
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
|
||||
#include <gl_context_mgr.h>
|
||||
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
|
||||
#include <bitmaps.h>
|
||||
#include <macros.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
@@ -70,7 +71,10 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, HIDPI_GL_3D_CANVAS )
|
||||
EVT_MIDDLE_DOWN( EDA_3D_CANVAS::OnMiddleDown)
|
||||
EVT_MOUSEWHEEL( EDA_3D_CANVAS::OnMouseWheel )
|
||||
EVT_MOTION( EDA_3D_CANVAS::OnMouseMove )
|
||||
|
||||
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
|
||||
EVT_MAGNIFY( EDA_3D_CANVAS::OnMagnify )
|
||||
#endif
|
||||
|
||||
// other events
|
||||
EVT_ERASE_BACKGROUND( EDA_3D_CANVAS::OnEraseBackground )
|
||||
@@ -84,8 +88,7 @@ END_EVENT_TABLE()
|
||||
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, wxID_ANY,
|
||||
aAttribList, wxDefaultPosition,
|
||||
HIDPI_GL_3D_CANVAS( aCamera, aParent, wxID_ANY, aAttribList, wxDefaultPosition,
|
||||
wxDefaultSize, wxFULL_REPAINT_ON_RESIZE ),
|
||||
m_eventDispatcher( nullptr ),
|
||||
m_parentStatusBar( nullptr ),
|
||||
@@ -153,7 +156,9 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
|
||||
wxEVT_RIGHT_UP, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_DCLICK,
|
||||
wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_DCLICK,
|
||||
wxEVT_MOTION, wxEVT_MOUSEWHEEL, wxEVT_CHAR, wxEVT_CHAR_HOOK,
|
||||
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
|
||||
wxEVT_MAGNIFY,
|
||||
#endif
|
||||
wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT
|
||||
};
|
||||
|
||||
@@ -226,10 +231,10 @@ bool EDA_3D_CANVAS::initializeOpenGL()
|
||||
else
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::initializeOpenGL Using GLEW version %s" ),
|
||||
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
|
||||
FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
|
||||
}
|
||||
|
||||
wxString version = From_UTF8( (char *) glGetString( GL_VERSION ) );
|
||||
wxString version = FROM_UTF8( (char *) glGetString( GL_VERSION ) );
|
||||
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::%s OpenGL version string %s." ),
|
||||
__WXFUNCTION__, version );
|
||||
@@ -330,9 +335,6 @@ void EDA_3D_CANVAS::DisplayStatus()
|
||||
|
||||
msg.Printf( wxT( "dy %3.2f" ), m_camera.GetCameraPos().y );
|
||||
m_parentStatusBar->SetStatusText( msg, static_cast<int>( EDA_3D_VIEWER_STATUSBAR::Y_POS ) );
|
||||
|
||||
msg.Printf( wxT( "zoom %3.2f" ), 1 / m_camera.GetZoom() );
|
||||
m_parentStatusBar->SetStatusText( msg, static_cast<int>( EDA_3D_VIEWER_STATUSBAR::ZOOM_LEVEL ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,13 +365,16 @@ void EDA_3D_CANVAS::DoRePaint()
|
||||
// therefore with invalid board.
|
||||
// This is dependent of the platform.
|
||||
// Especially on OSX, but also on Windows, it frequently happens
|
||||
if( !GetParent()->GetParent()->IsShownOnScreen() )
|
||||
if( !GetParent()->GetParent()->IsShown() )
|
||||
return; // The parent board editor frame is no more alive
|
||||
|
||||
wxString err_messages;
|
||||
wxString err_messages;
|
||||
|
||||
// !TODO: implement error reporter
|
||||
INFOBAR_REPORTER warningReporter( m_parentInfoBar );
|
||||
STATUSBAR_REPORTER activityReporter( m_parentStatusBar, EDA_3D_VIEWER_STATUSBAR::ACTIVITY );
|
||||
int64_t start_time = GetRunningMicroSecs();
|
||||
|
||||
unsigned strtime = GetRunningMicroSecs();
|
||||
|
||||
// "Makes the OpenGL state that is represented by the OpenGL rendering
|
||||
// context context current, i.e. it will be used by all subsequent OpenGL calls.
|
||||
@@ -461,7 +466,7 @@ void EDA_3D_CANVAS::DoRePaint()
|
||||
|
||||
if( m_camera_is_moving )
|
||||
{
|
||||
const int64_t curtime_delta = GetRunningMicroSecs() - m_strtime_camera_movement;
|
||||
const unsigned curtime_delta = GetRunningMicroSecs() - m_strtime_camera_movement;
|
||||
curtime_delta_s = (curtime_delta / 1e6) * m_camera_moving_speed;
|
||||
m_camera.Interpolate( curtime_delta_s );
|
||||
|
||||
@@ -527,9 +532,7 @@ void EDA_3D_CANVAS::DoRePaint()
|
||||
render_pivot( curtime_delta_s, scale );
|
||||
}
|
||||
|
||||
// This will only be enabled by the 3d mouse plugin, so we can leave
|
||||
// it as a simple if statement
|
||||
if( m_render3dmousePivot )
|
||||
if( m_render3dmousePivot && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
|
||||
{
|
||||
const float scale = glm::min( m_camera.GetZoom(), 1.0f );
|
||||
render3dmousePivot( scale );
|
||||
@@ -542,13 +545,16 @@ void EDA_3D_CANVAS::DoRePaint()
|
||||
|
||||
GL_CONTEXT_MANAGER::Get().UnlockCtx( m_glRC );
|
||||
|
||||
if( m_mouse_was_moved || m_camera_is_moving )
|
||||
if( !activityReporter.HasMessage() )
|
||||
{
|
||||
// Calculation time in milliseconds
|
||||
const double calculation_time = (double)( GetRunningMicroSecs() - start_time ) / 1e3;
|
||||
if( m_mouse_was_moved || m_camera_is_moving )
|
||||
{
|
||||
// Calculation time in milliseconds
|
||||
const double calculation_time = (double)( GetRunningMicroSecs() - strtime) / 1e3;
|
||||
|
||||
activityReporter.Report( wxString::Format( _( "Last render time %.0f ms" ),
|
||||
calculation_time ) );
|
||||
activityReporter.Report( wxString::Format( _( "Last render time %.0f ms" ),
|
||||
calculation_time ) );
|
||||
}
|
||||
}
|
||||
|
||||
// This will reset the flag of camera parameters changed
|
||||
@@ -608,6 +614,7 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
|
||||
}
|
||||
|
||||
|
||||
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
|
||||
void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event )
|
||||
{
|
||||
SetFocus();
|
||||
@@ -625,13 +632,11 @@ void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event )
|
||||
DisplayStatus();
|
||||
Request_refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
|
||||
{
|
||||
if( m_3d_render && m_3d_render->IsReloadRequestPending() )
|
||||
return; // Prevents using invalid m_3d_render_raytracing data
|
||||
|
||||
if( m_camera_is_moving )
|
||||
return;
|
||||
|
||||
@@ -838,7 +843,7 @@ void EDA_3D_CANVAS::OnTimerTimeout_Redraw( wxTimerEvent& aEvent )
|
||||
|
||||
void EDA_3D_CANVAS::OnRefreshRequest( wxEvent& aEvent )
|
||||
{
|
||||
Refresh();
|
||||
DoRePaint();
|
||||
}
|
||||
|
||||
|
||||
@@ -911,56 +916,68 @@ void EDA_3D_CANVAS::move_pivot_based_on_cur_mouse_position()
|
||||
}
|
||||
|
||||
|
||||
bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
|
||||
bool EDA_3D_CANVAS::SetView3D( int aKeycode )
|
||||
{
|
||||
if( m_camera_is_moving )
|
||||
return false;
|
||||
|
||||
const float delta_move = m_delta_move_step_factor * m_camera.GetZoom();
|
||||
const float arrow_moving_time_speed = 8.0f;
|
||||
bool handled = false;
|
||||
|
||||
switch( aRequestedView )
|
||||
switch( aKeycode )
|
||||
{
|
||||
case VIEW3D_TYPE::VIEW3D_PIVOT_CENTER:
|
||||
case WXK_SPACE:
|
||||
move_pivot_based_on_cur_mouse_position();
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_PAN_LEFT:
|
||||
case WXK_LEFT:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::LINEAR );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Pan_T1( SFVEC3F( -delta_move, 0.0f, 0.0f ) );
|
||||
request_start_moving_camera( arrow_moving_time_speed, false );
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_PAN_RIGHT:
|
||||
case WXK_RIGHT:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::LINEAR );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Pan_T1( SFVEC3F( +delta_move, 0.0f, 0.0f ) );
|
||||
request_start_moving_camera( arrow_moving_time_speed, false );
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_PAN_UP:
|
||||
case WXK_UP:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::LINEAR );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Pan_T1( SFVEC3F( 0.0f, +delta_move, 0.0f ) );
|
||||
request_start_moving_camera( arrow_moving_time_speed, false );
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_PAN_DOWN:
|
||||
case WXK_DOWN:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::LINEAR );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Pan_T1( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
|
||||
request_start_moving_camera( arrow_moving_time_speed, false );
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_FIT_SCREEN:
|
||||
case WXK_HOME:
|
||||
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(), 1 / 1.26f ), 1.26f ) );
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_ZOOM_IN:
|
||||
case WXK_END:
|
||||
break;
|
||||
|
||||
case WXK_TAB:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::EASING_IN_OUT );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.RotateZ_T1( glm::radians( 45.0f ) );
|
||||
request_start_moving_camera();
|
||||
handled = true;
|
||||
break;
|
||||
|
||||
case WXK_F1:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
|
||||
@@ -969,7 +986,7 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
|
||||
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_ZOOM_OUT:
|
||||
case WXK_F2:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
|
||||
@@ -978,7 +995,14 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
|
||||
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_RIGHT:
|
||||
case ID_VIEW3D_RESET:
|
||||
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 ID_VIEW3D_RIGHT:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Reset_T1();
|
||||
@@ -987,7 +1011,7 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
|
||||
request_start_moving_camera();
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_LEFT:
|
||||
case ID_VIEW3D_LEFT:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Reset_T1();
|
||||
@@ -996,7 +1020,7 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
|
||||
request_start_moving_camera();
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_FRONT:
|
||||
case ID_VIEW3D_FRONT:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Reset_T1();
|
||||
@@ -1004,7 +1028,7 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
|
||||
request_start_moving_camera();
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_BACK:
|
||||
case ID_VIEW3D_BACK:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Reset_T1();
|
||||
@@ -1017,14 +1041,14 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
|
||||
request_start_moving_camera();
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_TOP:
|
||||
case ID_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:
|
||||
case ID_VIEW3D_BOTTOM:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.Reset_T1();
|
||||
@@ -1032,7 +1056,7 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
|
||||
request_start_moving_camera( glm::min( glm::max( m_camera.GetZoom(), 0.5f ), 1.125f ) );
|
||||
return true;
|
||||
|
||||
case VIEW3D_TYPE::VIEW3D_FLIP:
|
||||
case ID_VIEW3D_FLIP:
|
||||
m_camera.SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
|
||||
m_camera.SetT0_and_T1_current_T();
|
||||
m_camera.RotateY_T1( glm::radians( 179.999f ) );
|
||||
@@ -1042,6 +1066,15 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
m_mouse_was_moved = true;
|
||||
|
||||
restart_editingTimeOut_Timer();
|
||||
|
||||
DisplayStatus();
|
||||
Request_refresh();
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -114,12 +114,12 @@ public:
|
||||
void GetScreenshot( wxImage& aDstImage );
|
||||
|
||||
/**
|
||||
* Select a specific 3D view or operation
|
||||
* Helper function to call view commands.
|
||||
*
|
||||
* @param aRequestedView the view to move to
|
||||
* @return true if the view request was handled, false if no command found for this view.
|
||||
* @param aKeycode ascii key commands.
|
||||
* @return true if the key code was handled, false if no command found for this code.
|
||||
*/
|
||||
bool SetView3D( VIEW3D_TYPE aRequestedView );
|
||||
bool SetView3D( int aKeycode );
|
||||
|
||||
/**
|
||||
* Enable or disable camera animation when switching to a pre-defined view.
|
||||
@@ -208,6 +208,12 @@ public:
|
||||
m_3dmousePivotPos = aPos;
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Called by a wxPaintEvent event
|
||||
*/
|
||||
void OnPaint( wxPaintEvent& aEvent );
|
||||
|
||||
/**
|
||||
* The actual function to repaint the canvas.
|
||||
*
|
||||
@@ -216,17 +222,16 @@ public:
|
||||
*/
|
||||
void DoRePaint();
|
||||
|
||||
private:
|
||||
// The wxPaintEvent event. mainly calls DoRePaint()
|
||||
void OnPaint( wxPaintEvent& aEvent );
|
||||
|
||||
void OnEraseBackground( wxEraseEvent& event );
|
||||
|
||||
void OnRefreshRequest( wxEvent& aEvent );
|
||||
|
||||
void OnMouseWheel( wxMouseEvent& event );
|
||||
|
||||
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
|
||||
void OnMagnify( wxMouseEvent& event );
|
||||
#endif
|
||||
|
||||
void OnMouseMove( wxMouseEvent& event );
|
||||
void OnLeftDown( wxMouseEvent& event );
|
||||
void OnLeftUp( wxMouseEvent& event );
|
||||
@@ -305,7 +310,7 @@ private:
|
||||
|
||||
bool m_render_pivot; // Render the pivot while camera moving
|
||||
float m_camera_moving_speed; // 1.0f will be 1:1
|
||||
int64_t m_strtime_camera_movement; // Ticktime of camera movement start
|
||||
unsigned m_strtime_camera_movement; // Ticktime of camera movement start
|
||||
bool m_animation_enabled; // Camera animation enabled
|
||||
int m_moving_speed_multiplier; // Camera animation speed multiplier option
|
||||
|
||||
|
||||
@@ -74,28 +74,4 @@ enum class MATERIAL_MODE
|
||||
CAD_MODE = 2 ///< Use a gray shading based on diffuse material
|
||||
};
|
||||
|
||||
enum class VIEW3D_TYPE
|
||||
{
|
||||
// Specific directions
|
||||
VIEW3D_TOP,
|
||||
VIEW3D_BOTTOM,
|
||||
VIEW3D_LEFT,
|
||||
VIEW3D_RIGHT,
|
||||
VIEW3D_FRONT,
|
||||
VIEW3D_BACK,
|
||||
VIEW3D_FLIP,
|
||||
|
||||
// Movement commands
|
||||
VIEW3D_PAN_UP,
|
||||
VIEW3D_PAN_DOWN,
|
||||
VIEW3D_PAN_LEFT,
|
||||
VIEW3D_PAN_RIGHT,
|
||||
VIEW3D_ZOOM_IN,
|
||||
VIEW3D_ZOOM_OUT,
|
||||
VIEW3D_PIVOT_CENTER,
|
||||
|
||||
// Specific levels
|
||||
VIEW3D_FIT_SCREEN
|
||||
};
|
||||
|
||||
#endif // _3D_ENUMS_H_
|
||||
|
||||
@@ -35,11 +35,10 @@
|
||||
#include "../3d_cache/3d_cache.h"
|
||||
#include <wx/dcclient.h>
|
||||
#include <base_units.h>
|
||||
#include <gal/opengl/gl_context_mgr.h>
|
||||
#include <gl_context_mgr.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <pgm_base.h>
|
||||
#include <dpi_scaling_common.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <gal/dpi_scaling.h>
|
||||
#include <macros.h>
|
||||
|
||||
/**
|
||||
@@ -87,8 +86,7 @@ END_EVENT_TABLE()
|
||||
|
||||
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, wxID_ANY, aAttribList,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
HIDPI_GL_CANVAS( aParent, wxID_ANY, aAttribList, wxDefaultPosition, wxDefaultSize,
|
||||
wxFULL_REPAINT_ON_RESIZE ),
|
||||
m_trackBallCamera( RANGE_SCALE_3D * 4.0f ),
|
||||
m_cacheManager( aCacheManager )
|
||||
@@ -105,7 +103,7 @@ EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER( wxWindow* aParent, const int* aAttribL
|
||||
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
||||
const DPI_SCALING dpi{ settings, this };
|
||||
SetScaleFactor( dpi.GetScaleFactor() );
|
||||
}
|
||||
|
||||
@@ -197,7 +195,7 @@ void EDA_3D_MODEL_VIEWER::ogl_initialize()
|
||||
else
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_MODEL_VIEWER::ogl_initialize Using GLEW version %s" ),
|
||||
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
|
||||
FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
|
||||
}
|
||||
|
||||
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
|
||||
@@ -402,16 +400,16 @@ void EDA_3D_MODEL_VIEWER::OnMouseWheel( wxMouseEvent& event )
|
||||
if( event.ShiftDown() )
|
||||
{
|
||||
//if( event.GetWheelRotation() < 0 )
|
||||
//SetView3D( VIEW_3D_TYPE::VIEW3D_PAN_UP ); // move up
|
||||
//SetView3D( WXK_UP ); // move up
|
||||
//else
|
||||
//SetView3D( VIEW_3D_TYPE::VIEW3D_PAN_DOWN ); // move down
|
||||
//SetView3D( WXK_DOWN ); // move down
|
||||
}
|
||||
else if( event.ControlDown() )
|
||||
{
|
||||
//if( event.GetWheelRotation() > 0 )
|
||||
//SetView3D( VIEW_3D_TYPE::VIEW3D_PAN_RIGHT ); // move right
|
||||
//SetView3D( WXK_RIGHT ); // move right
|
||||
//else
|
||||
//SetView3D( VIEW_3D_TYPE::VIEW3D_PAN_LEFT ); // move left
|
||||
//SetView3D( WXK_LEFT ); // move left
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file eda_3d_model_viewer.h
|
||||
* @file c3d_model_viewer.h
|
||||
* @brief Implements a model viewer canvas.
|
||||
*
|
||||
* The purpose of model viewer is to render 3d models that come in the original data from
|
||||
|
||||
@@ -21,17 +21,12 @@
|
||||
#include "nl_3d_viewer_plugin.h"
|
||||
#include "nl_3d_viewer_plugin_impl.h"
|
||||
#include <advanced_config.h>
|
||||
#include <kiplatform/drivers.h>
|
||||
|
||||
|
||||
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport )
|
||||
: m_impl( nullptr )
|
||||
{
|
||||
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver
|
||||
&& KIPLATFORM::DRIVERS::Valid3DConnexionDriverVersion() )
|
||||
{
|
||||
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
|
||||
m_impl = new NL_3D_VIEWER_PLUGIN_IMPL( aViewport );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +38,6 @@ NL_3D_VIEWER_PLUGIN::~NL_3D_VIEWER_PLUGIN()
|
||||
|
||||
void NL_3D_VIEWER_PLUGIN::SetFocus( bool focus )
|
||||
{
|
||||
if( m_impl )
|
||||
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
|
||||
m_impl->SetFocus( focus );
|
||||
}
|
||||
|
||||
@@ -73,10 +73,7 @@ bool equals( glm::mat<L, C, T, Q> const& aFirst, glm::mat<L, C, T, Q> const& aSe
|
||||
|
||||
|
||||
NL_3D_VIEWER_PLUGIN_IMPL::NL_3D_VIEWER_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas ) :
|
||||
NAV_3D( false, false ),
|
||||
m_canvas( aCanvas ),
|
||||
m_capIsMoving( false ),
|
||||
m_newWidth( 0.0 )
|
||||
NAV_3D( false, false ), m_canvas( aCanvas ), m_capIsMoving( false )
|
||||
{
|
||||
m_camera = dynamic_cast<TRACK_BALL*>( m_canvas->GetCamera() );
|
||||
|
||||
@@ -176,7 +173,7 @@ void NL_3D_VIEWER_PLUGIN_IMPL::exportCommandsAndImages()
|
||||
for( it = actions.begin(); it != actions.end(); ++it )
|
||||
{
|
||||
const TOOL_ACTION* action = *it;
|
||||
std::string label = action->GetMenuLabel().ToStdString();
|
||||
std::string label = action->GetLabel().ToStdString();
|
||||
|
||||
if( label.empty() )
|
||||
{
|
||||
@@ -591,7 +588,7 @@ long NL_3D_VIEWER_PLUGIN_IMPL::SetActiveCommand( std::string commandId )
|
||||
|
||||
if( runAction )
|
||||
{
|
||||
tool_manager->RunAction( *context );
|
||||
tool_manager->RunAction( *context, true );
|
||||
m_canvas->Request_refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* @file camera.cpp
|
||||
*/
|
||||
|
||||
#include <gal/3d/camera.h>
|
||||
#include "camera.h"
|
||||
#include <wx/log.h>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -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-2023 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,8 +30,7 @@
|
||||
#ifndef CAMERA_H
|
||||
#define CAMERA_H
|
||||
|
||||
#include <gal/gal.h>
|
||||
#include <plugins/3dapi/xv3d_types.h>
|
||||
#include "../3d_rendering/raytracing/ray.h"
|
||||
#include <wx/gdicmn.h> // for wxSize
|
||||
#include <vector>
|
||||
|
||||
@@ -59,29 +58,6 @@ struct CAMERA_FRUSTUM
|
||||
SFVEC3F fbr; ///< Far Bottom Right
|
||||
float nearD, farD, ratio, angle, tang;
|
||||
float nw, nh, fw, fh;
|
||||
|
||||
CAMERA_FRUSTUM() :
|
||||
nc( { 0.0, 0.0, 0.0 } ),
|
||||
fc( { 0.0, 0.0, 0.0 } ),
|
||||
ntl( { 0.0, 0.0, 0.0 } ),
|
||||
ntr( { 0.0, 0.0, 0.0 } ),
|
||||
nbl( { 0.0, 0.0, 0.0 } ),
|
||||
nbr( { 0.0, 0.0, 0.0 } ),
|
||||
ftl( { 0.0, 0.0, 0.0 } ),
|
||||
ftr( { 0.0, 0.0, 0.0 } ),
|
||||
fbl( { 0.0, 0.0, 0.0 } ),
|
||||
fbr( { 0.0, 0.0, 0.0 } ),
|
||||
nearD( 0.0 ),
|
||||
farD( 0.0 ),
|
||||
ratio( 1.0 ),
|
||||
angle( 0.0 ),
|
||||
tang( 0.0 ),
|
||||
nw( 0.0 ),
|
||||
nh( 0.0 ),
|
||||
fw( 0.0 ),
|
||||
fh( 0.0 )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -98,7 +74,7 @@ enum class CAMERA_INTERPOLATION
|
||||
*
|
||||
* It must be derived by other classes to implement a real camera object.
|
||||
*/
|
||||
class GAL_API CAMERA
|
||||
class CAMERA
|
||||
{
|
||||
public:
|
||||
static const float DEFAULT_MIN_ZOOM;
|
||||
@@ -24,7 +24,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file 3d_model.cpp
|
||||
* @file c_ogl_3dmodel.cpp
|
||||
* @brief
|
||||
*/
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
@@ -447,7 +448,7 @@ void MODEL_3D::Draw( bool aTransparent, float aOpacity, bool aUseSelectedMateria
|
||||
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, (const float*)¶m.x );
|
||||
|
||||
std::vector<const MODEL_3D::MATERIAL *> materialsToRender;
|
||||
|
||||
|
||||
materialsToRender.reserve( m_materials.size() );
|
||||
|
||||
if( aModelWorldMatrix && aCameraWorldPos )
|
||||
@@ -521,10 +522,10 @@ void MODEL_3D::Draw( bool aTransparent, float aOpacity, bool aUseSelectedMateria
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
materialsToRender.push_back( &mat );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( const MODEL_3D::MATERIAL* mat : materialsToRender )
|
||||
{
|
||||
@@ -603,7 +604,7 @@ void MODEL_3D::DrawBboxes() const
|
||||
: sizeof( GLuint );
|
||||
|
||||
glDrawElements( GL_LINES, bbox_idx_count * m_meshes_bbox.size(), m_bbox_index_buffer_type,
|
||||
reinterpret_cast<const void*>(
|
||||
reinterpret_cast<const void*>(
|
||||
static_cast<uintptr_t>( bbox_idx_count * idx_size ) ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +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) 2023 CERN
|
||||
* Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-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
|
||||
@@ -24,24 +23,25 @@
|
||||
*/
|
||||
|
||||
#include "render_3d_opengl.h"
|
||||
#include "opengl_utils.h"
|
||||
#include <board.h>
|
||||
#include <footprint.h>
|
||||
#include "../../3d_math.h"
|
||||
#include "convert_basic_shapes_to_polygon.h"
|
||||
#include <trigo.h>
|
||||
#include <project.h>
|
||||
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
|
||||
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
|
||||
#include <fp_lib_table.h>
|
||||
#include <eda_3d_canvas.h>
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <project_pcb.h>
|
||||
|
||||
|
||||
void RENDER_3D_OPENGL::addObjectTriangles( const FILLED_CIRCLE_2D* aCircle,
|
||||
void RENDER_3D_OPENGL::addObjectTriangles( const FILLED_CIRCLE_2D* aFilledCircle,
|
||||
TRIANGLE_DISPLAY_LIST* aDstLayer, float aZtop,
|
||||
float aZbot )
|
||||
{
|
||||
const SFVEC2F& center = aCircle->GetCenter();
|
||||
const float radius = aCircle->GetRadius() * 2.0f; // Double because the render triangle
|
||||
const SFVEC2F& center = aFilledCircle->GetCenter();
|
||||
const float radius = aFilledCircle->GetRadius() * 2.0f; // Double because the render triangle
|
||||
|
||||
// This is a small adjustment to the circle texture
|
||||
const float texture_factor = ( 8.0f / (float) SIZE_OF_CIRCLE_TEXTURE ) + 1.0f;
|
||||
@@ -303,7 +303,7 @@ OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateHoles( const LIST_OBJECT2D& aListH
|
||||
|
||||
OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateLayerList( const BVH_CONTAINER_2D* aContainer,
|
||||
const SHAPE_POLY_SET* aPolyList,
|
||||
PCB_LAYER_ID aLayer,
|
||||
PCB_LAYER_ID aLayerId,
|
||||
const BVH_CONTAINER_2D* aThroughHoles )
|
||||
{
|
||||
if( aContainer == nullptr )
|
||||
@@ -317,7 +317,7 @@ OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateLayerList( const BVH_CONTAINER_2D*
|
||||
float layer_z_bot = 0.0f;
|
||||
float layer_z_top = 0.0f;
|
||||
|
||||
getLayerZPos( aLayer, layer_z_top, layer_z_bot );
|
||||
getLayerZPos( aLayerId, layer_z_top, layer_z_bot );
|
||||
|
||||
// Calculate an estimation for the nr of triangles based on the nr of objects
|
||||
unsigned int nrTrianglesEstimation = listObject2d.size() * 8;
|
||||
@@ -376,12 +376,12 @@ OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateLayerList( const BVH_CONTAINER_2D*
|
||||
}
|
||||
|
||||
|
||||
OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateEmptyLayerList( PCB_LAYER_ID aLayer )
|
||||
OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateEmptyLayerList( PCB_LAYER_ID aLayerId )
|
||||
{
|
||||
float layer_z_bot = 0.0f;
|
||||
float layer_z_top = 0.0f;
|
||||
|
||||
getLayerZPos( aLayer, layer_z_top, layer_z_bot );
|
||||
getLayerZPos( aLayerId, layer_z_top, layer_z_bot );
|
||||
|
||||
TRIANGLE_DISPLAY_LIST* layerTriangles = new TRIANGLE_DISPLAY_LIST( 1 );
|
||||
|
||||
@@ -454,7 +454,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
OBJECT_2D_STATS::Instance().ResetStats();
|
||||
|
||||
int64_t stats_startReloadTime = GetRunningMicroSecs();
|
||||
unsigned stats_startReloadTime = GetRunningMicroSecs();
|
||||
|
||||
m_boardAdapter.InitSettings( aStatusReporter, aWarningReporter );
|
||||
|
||||
@@ -465,23 +465,28 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
aStatusReporter->Report( _( "Load OpenGL: board" ) );
|
||||
|
||||
// Create Board
|
||||
m_board = createBoard( m_boardAdapter.GetBoardPoly(), &m_boardAdapter.GetTH_IDs() );
|
||||
m_board = createBoard( m_boardAdapter.GetBoardPoly(), &m_boardAdapter.GetThroughHoleIds() );
|
||||
|
||||
m_antiBoardPolys.RemoveAllContours();
|
||||
m_antiBoardPolys.NewOutline();
|
||||
m_antiBoardPolys.Append( VECTOR2I( -INT_MAX/2, -INT_MAX/2 ) );
|
||||
m_antiBoardPolys.Append( VECTOR2I( INT_MAX/2, -INT_MAX/2 ) );
|
||||
m_antiBoardPolys.Append( VECTOR2I( INT_MAX/2, INT_MAX/2 ) );
|
||||
m_antiBoardPolys.Append( VECTOR2I( -INT_MAX/2, INT_MAX/2 ) );
|
||||
m_antiBoardPolys.Outline( 0 ).SetClosed( true );
|
||||
if( m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
{
|
||||
m_antiBoardPolys.RemoveAllContours();
|
||||
m_antiBoardPolys.NewOutline();
|
||||
m_antiBoardPolys.Append( VECTOR2I( -INT_MAX/2, -INT_MAX/2 ) );
|
||||
m_antiBoardPolys.Append( VECTOR2I( INT_MAX/2, -INT_MAX/2 ) );
|
||||
m_antiBoardPolys.Append( VECTOR2I( INT_MAX/2, INT_MAX/2 ) );
|
||||
m_antiBoardPolys.Append( VECTOR2I( -INT_MAX/2, INT_MAX/2 ) );
|
||||
m_antiBoardPolys.Outline( 0 ).SetClosed( true );
|
||||
|
||||
m_antiBoardPolys.BooleanSubtract( m_boardAdapter.GetBoardPoly(),
|
||||
SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
m_antiBoard = createBoard( m_antiBoardPolys );
|
||||
m_antiBoardPolys.BooleanSubtract( m_boardAdapter.GetBoardPoly(),
|
||||
SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
m_antiBoard = createBoard( m_antiBoardPolys );
|
||||
}
|
||||
|
||||
SHAPE_POLY_SET board_poly_with_holes = m_boardAdapter.GetBoardPoly().CloneDropTriangulation();
|
||||
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
|
||||
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
|
||||
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
m_boardWithHoles = createBoard( board_poly_with_holes );
|
||||
|
||||
@@ -492,22 +497,28 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
if( aStatusReporter )
|
||||
aStatusReporter->Report( _( "Load OpenGL: holes and vias" ) );
|
||||
|
||||
SHAPE_POLY_SET outerPolyTHT = m_boardAdapter.GetTH_ODPolys().CloneDropTriangulation();
|
||||
SHAPE_POLY_SET outerPolyTHT = m_boardAdapter.GetThroughHoleOdPolys().CloneDropTriangulation();
|
||||
|
||||
outerPolyTHT.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
|
||||
SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
|
||||
m_outerThroughHoles = generateHoles( m_boardAdapter.GetTH_ODs().GetList(), outerPolyTHT,
|
||||
1.0f, 0.0f, false, &m_boardAdapter.GetTH_IDs() );
|
||||
|
||||
m_outerViaThroughHoles = generateHoles( m_boardAdapter.GetViaTH_ODs().GetList(),
|
||||
m_boardAdapter.GetViaTH_ODPolys(), 1.0f, 0.0f, false );
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annuli )
|
||||
if( m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
{
|
||||
m_outerThroughHoleRings = generateHoles( m_boardAdapter.GetViaAnnuli().GetList(),
|
||||
m_boardAdapter.GetViaAnnuliPolys(),
|
||||
1.0f, 0.0f, false );
|
||||
outerPolyTHT.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
|
||||
SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||
}
|
||||
|
||||
m_outerThroughHoles = generateHoles( m_boardAdapter.GetThroughHoleOds().GetList(),
|
||||
outerPolyTHT, 1.0f, 0.0f, false,
|
||||
&m_boardAdapter.GetThroughHoleIds() );
|
||||
|
||||
m_outerViaThroughHoles = generateHoles(
|
||||
m_boardAdapter.GetThroughHoleViaOds().GetList(),
|
||||
m_boardAdapter.GetThroughHoleViaOdPolys(), 1.0f, 0.0f, false );
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus &&
|
||||
m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
{
|
||||
m_outerThroughHoleRings = generateHoles(
|
||||
m_boardAdapter.GetThroughHoleAnnularRings().GetList(),
|
||||
m_boardAdapter.GetThroughHoleAnnularRingPolys(), 1.0f, 0.0f, false );
|
||||
}
|
||||
|
||||
const MAP_POLY& innerMapHoles = m_boardAdapter.GetHoleIdPolysMap();
|
||||
@@ -522,20 +533,28 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
float layer_z_bot = 0.0f;
|
||||
float layer_z_top = 0.0f;
|
||||
|
||||
for( const auto& [ layer, poly ] : outerMapHoles )
|
||||
for( const std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET*>& ii : outerMapHoles )
|
||||
{
|
||||
getLayerZPos( layer, layer_z_top, layer_z_bot );
|
||||
const PCB_LAYER_ID layer_id = ii.first;
|
||||
const SHAPE_POLY_SET* poly = ii.second;
|
||||
const BVH_CONTAINER_2D* container = map_holes.at( layer_id );
|
||||
|
||||
m_outerLayerHoles[layer] = generateHoles( map_holes.at( layer )->GetList(), *poly,
|
||||
layer_z_top, layer_z_bot, false );
|
||||
getLayerZPos( layer_id, layer_z_top, layer_z_bot );
|
||||
|
||||
m_outerLayerHoles[layer_id] = generateHoles( container->GetList(), *poly,
|
||||
layer_z_top, layer_z_bot, false );
|
||||
}
|
||||
|
||||
for( const auto& [ layer, poly ] : innerMapHoles )
|
||||
for( const std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET*>& ii : innerMapHoles )
|
||||
{
|
||||
getLayerZPos( layer, layer_z_top, layer_z_bot );
|
||||
const PCB_LAYER_ID layer_id = ii.first;
|
||||
const SHAPE_POLY_SET* poly = ii.second;
|
||||
const BVH_CONTAINER_2D* container = map_holes.at( layer_id );
|
||||
|
||||
m_innerLayerHoles[layer] = generateHoles( map_holes.at( layer )->GetList(), *poly,
|
||||
layer_z_top, layer_z_bot, false );
|
||||
getLayerZPos( layer_id, layer_z_top, layer_z_bot );
|
||||
|
||||
m_innerLayerHoles[layer_id] = generateHoles( container->GetList(), *poly,
|
||||
layer_z_top, layer_z_bot, false );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,98 +565,107 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
if( aStatusReporter )
|
||||
aStatusReporter->Report( _( "Load OpenGL: layers" ) );
|
||||
|
||||
std::bitset<LAYER_3D_END> visibilityFlags = m_boardAdapter.GetVisibleLayers();
|
||||
const MAP_POLY& map_poly = m_boardAdapter.GetPolyMap();
|
||||
wxString msg;
|
||||
const MAP_POLY& map_poly = m_boardAdapter.GetPolyMap();
|
||||
|
||||
for( const auto& [ layer, container2d ] : m_boardAdapter.GetLayerMap() )
|
||||
for( const std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& ii : m_boardAdapter.GetLayerMap() )
|
||||
{
|
||||
if( !m_boardAdapter.Is3dLayerEnabled( layer, visibilityFlags ) )
|
||||
const PCB_LAYER_ID layer_id = ii.first;
|
||||
|
||||
if( !m_boardAdapter.Is3dLayerEnabled( layer_id ) )
|
||||
continue;
|
||||
|
||||
if( aStatusReporter )
|
||||
{
|
||||
msg = m_boardAdapter.GetBoard()->GetLayerName( layer );
|
||||
aStatusReporter->Report( wxString::Format( _( "Load OpenGL layer %s" ), msg ) );
|
||||
aStatusReporter->Report( wxString::Format( _( "Load OpenGL layer %d" ),
|
||||
(int) layer_id ) );
|
||||
}
|
||||
|
||||
const BVH_CONTAINER_2D* container2d = ii.second;
|
||||
|
||||
SHAPE_POLY_SET polyListSubtracted;
|
||||
SHAPE_POLY_SET* polyList = nullptr;
|
||||
|
||||
// Load the vertical (Z axis) component of shapes
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.opengl_copper_thickness )
|
||||
if( map_poly.find( layer_id ) != map_poly.end() )
|
||||
{
|
||||
if( map_poly.find( layer ) != map_poly.end() )
|
||||
polyListSubtracted = *map_poly.at( layer_id );;
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
{
|
||||
polyListSubtracted = *map_poly.at( layer );
|
||||
|
||||
if( LSET::PhysicalLayersMask().test( layer ) )
|
||||
{
|
||||
polyListSubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
|
||||
if( layer != B_Mask && layer != F_Mask )
|
||||
{
|
||||
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(),
|
||||
polyListSubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(),
|
||||
|
||||
if( layer_id != B_Mask && layer_id != F_Mask )
|
||||
{
|
||||
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
polyListSubtracted.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk )
|
||||
{
|
||||
if( layer == B_SilkS && map_poly.find( B_Mask ) != map_poly.end() )
|
||||
if( layer_id == B_SilkS && map_poly.find( B_Mask ) != map_poly.end() )
|
||||
{
|
||||
polyListSubtracted.BooleanSubtract( *map_poly.at( B_Mask ),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
else if( layer == F_SilkS && map_poly.find( F_Mask ) != map_poly.end() )
|
||||
else if( layer_id == F_SilkS && map_poly.find( F_Mask ) != map_poly.end() )
|
||||
{
|
||||
polyListSubtracted.BooleanSubtract( *map_poly.at( F_Mask ),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
}
|
||||
|
||||
polyList = &polyListSubtracted;
|
||||
}
|
||||
|
||||
polyList = &polyListSubtracted;
|
||||
}
|
||||
|
||||
OPENGL_RENDER_LIST* oglList = generateLayerList( container2d, polyList, layer,
|
||||
&m_boardAdapter.GetTH_IDs() );
|
||||
OPENGL_RENDER_LIST* oglList = generateLayerList( container2d, polyList, layer_id,
|
||||
&m_boardAdapter.GetThroughHoleIds() );
|
||||
|
||||
if( oglList != nullptr )
|
||||
m_layers[layer] = oglList;
|
||||
m_layers[layer_id] = oglList;
|
||||
|
||||
}
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.differentiate_plated_copper )
|
||||
if( m_boardAdapter.m_Cfg->m_Render.renderPlatedPadsAsPlated
|
||||
&& m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
{
|
||||
const SHAPE_POLY_SET* frontPlatedPadAndGraphicPolys = m_boardAdapter.GetFrontPlatedPadAndGraphicPolys();
|
||||
const SHAPE_POLY_SET* backPlatedPadAndGraphicPolys = m_boardAdapter.GetBackPlatedPadAndGraphicPolys();
|
||||
const SHAPE_POLY_SET* frontPlatedPadPolys = m_boardAdapter.GetFrontPlatedPadPolys();
|
||||
const SHAPE_POLY_SET* backPlatedPadPolys = m_boardAdapter.GetBackPlatedPadPolys();
|
||||
|
||||
if( frontPlatedPadAndGraphicPolys )
|
||||
if( frontPlatedPadPolys )
|
||||
{
|
||||
SHAPE_POLY_SET poly = frontPlatedPadAndGraphicPolys->CloneDropTriangulation();
|
||||
poly.BooleanIntersection( m_boardAdapter.GetBoardPoly(), SHAPE_POLY_SET::PM_FAST );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
|
||||
SHAPE_POLY_SET polySubtracted = frontPlatedPadPolys->CloneDropTriangulation();
|
||||
polySubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
polySubtracted.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
polySubtracted.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
m_platedPadsFront = generateLayerList( m_boardAdapter.GetPlatedPadsFront(), &poly, F_Cu );
|
||||
m_platedPadsFront = generateLayerList( m_boardAdapter.GetPlatedPadsFront(),
|
||||
&polySubtracted, F_Cu );
|
||||
|
||||
// An entry for F_Cu must exist in m_layers or we'll never look at m_platedPadsFront
|
||||
if( m_layers.count( F_Cu ) == 0 )
|
||||
m_layers[F_Cu] = generateEmptyLayerList( F_Cu );
|
||||
}
|
||||
|
||||
if( backPlatedPadAndGraphicPolys )
|
||||
if( backPlatedPadPolys )
|
||||
{
|
||||
SHAPE_POLY_SET poly = backPlatedPadAndGraphicPolys->CloneDropTriangulation();
|
||||
poly.BooleanIntersection( m_boardAdapter.GetBoardPoly(), SHAPE_POLY_SET::PM_FAST );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
|
||||
SHAPE_POLY_SET polySubtracted = backPlatedPadPolys->CloneDropTriangulation();
|
||||
polySubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
polySubtracted.BooleanSubtract( m_boardAdapter.GetThroughHoleOdPolys(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
polySubtracted.BooleanSubtract( m_boardAdapter.GetOuterNonPlatedThroughHolePoly(),
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
m_platedPadsBack = generateLayerList( m_boardAdapter.GetPlatedPadsBack(), &poly, B_Cu );
|
||||
m_platedPadsBack = generateLayerList( m_boardAdapter.GetPlatedPadsBack(),
|
||||
&polySubtracted, B_Cu );
|
||||
|
||||
// An entry for B_Cu must exist in m_layers or we'll never look at m_platedPadsBack
|
||||
if( m_layers.count( B_Cu ) == 0 )
|
||||
@@ -645,15 +673,6 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
}
|
||||
}
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.show_off_board_silk )
|
||||
{
|
||||
if( const BVH_CONTAINER_2D* padsFront = m_boardAdapter.GetOffboardPadsFront() )
|
||||
m_offboardPadsFront = generateLayerList( padsFront, nullptr, F_Cu );
|
||||
|
||||
if( const BVH_CONTAINER_2D* padsBack = m_boardAdapter.GetOffboardPadsBack() )
|
||||
m_offboardPadsBack = generateLayerList( padsBack, nullptr, B_Cu );
|
||||
}
|
||||
|
||||
// Load 3D models
|
||||
if( aStatusReporter )
|
||||
aStatusReporter->Report( _( "Loading 3D models..." ) );
|
||||
@@ -840,7 +859,8 @@ void RENDER_3D_OPENGL::generateViasAndPads()
|
||||
// Subtract the holes
|
||||
tht_outer_holes_poly.BooleanSubtract( tht_inner_holes_poly, SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
tht_outer_holes_poly.BooleanSubtract( m_antiBoardPolys, SHAPE_POLY_SET::PM_FAST );
|
||||
if( m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
tht_outer_holes_poly.BooleanSubtract( m_antiBoardPolys, SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
CONTAINER_2D holesContainer;
|
||||
|
||||
@@ -917,10 +937,6 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
|
||||
if( !m_boardAdapter.GetBoard() )
|
||||
return;
|
||||
|
||||
// Building the 3D models late crashes on recent versions of macOS
|
||||
// Unclear the exact mechanism, but as a workaround, just build them
|
||||
// all the time. See https://gitlab.com/kicad/code/kicad/-/issues/17198
|
||||
#ifndef __WXMAC__
|
||||
if( !m_boardAdapter.m_IsPreviewer
|
||||
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_normal
|
||||
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_insert
|
||||
@@ -928,7 +944,6 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Go for all footprints
|
||||
for( const FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
|
||||
@@ -942,8 +957,8 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
|
||||
{
|
||||
// FindRow() can throw an exception
|
||||
const FP_LIB_TABLE_ROW* fpRow =
|
||||
PROJECT_PCB::PcbFootprintLibs( m_boardAdapter.GetBoard()->GetProject() )
|
||||
->FindRow( libraryName, false );
|
||||
m_boardAdapter.GetBoard()->GetProject()->PcbFootprintLibs()->FindRow(
|
||||
libraryName, false );
|
||||
|
||||
if( fpRow )
|
||||
footprintBasePath = fpRow->GetFullURI( true );
|
||||
|
||||
@@ -471,11 +471,38 @@ void OPENGL_RENDER_LIST::DrawAll( bool aDrawMiddle ) const
|
||||
}
|
||||
|
||||
|
||||
void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle,
|
||||
const OPENGL_RENDER_LIST* aSubtractList,
|
||||
const OPENGL_RENDER_LIST* bSubtractList,
|
||||
const OPENGL_RENDER_LIST* cSubtractList,
|
||||
const OPENGL_RENDER_LIST* dSubtractList ) const
|
||||
void OPENGL_RENDER_LIST::DrawAllCameraCulled( float zCameraPos, bool aDrawMiddle ) const
|
||||
{
|
||||
zCameraPos = m_haveTransformation
|
||||
? ( ( zCameraPos - m_zPositionTransformation ) / m_zScaleTransformation )
|
||||
: zCameraPos;
|
||||
|
||||
if( aDrawMiddle )
|
||||
DrawMiddle();
|
||||
|
||||
if( zCameraPos > m_zTop )
|
||||
{
|
||||
DrawTop();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( zCameraPos < m_zBot )
|
||||
{
|
||||
DrawBot();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If camera is in the middle dont draw it.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OPENGL_RENDER_LIST::DrawAllCameraCulledSubtractLayer( bool aDrawMiddle,
|
||||
const OPENGL_RENDER_LIST* aLayerToSubtractA,
|
||||
const OPENGL_RENDER_LIST* aLayerToSubtractB,
|
||||
const OPENGL_RENDER_LIST* aLayerToSubtractC,
|
||||
const OPENGL_RENDER_LIST* aLayerToSubtractD ) const
|
||||
{
|
||||
glClearStencil( 0x00 );
|
||||
glClear( GL_STENCIL_BUFFER_BIT );
|
||||
@@ -490,17 +517,17 @@ void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle,
|
||||
glStencilFunc( GL_ALWAYS, 1, 0 );
|
||||
glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
|
||||
|
||||
if( aSubtractList )
|
||||
aSubtractList->DrawBot();
|
||||
if( aLayerToSubtractA )
|
||||
aLayerToSubtractA->DrawBot();
|
||||
|
||||
if( bSubtractList )
|
||||
bSubtractList->DrawBot();
|
||||
if( aLayerToSubtractB )
|
||||
aLayerToSubtractB->DrawBot();
|
||||
|
||||
if( cSubtractList )
|
||||
cSubtractList->DrawBot();
|
||||
if( aLayerToSubtractC )
|
||||
aLayerToSubtractC->DrawBot();
|
||||
|
||||
if( dSubtractList )
|
||||
dSubtractList->DrawBot();
|
||||
if( aLayerToSubtractD )
|
||||
aLayerToSubtractD->DrawBot();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_TRUE);
|
||||
@@ -517,17 +544,17 @@ void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle,
|
||||
glStencilFunc( GL_ALWAYS, 2, 0 );
|
||||
glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
|
||||
|
||||
if( aSubtractList )
|
||||
aSubtractList->DrawTop();
|
||||
if( aLayerToSubtractA )
|
||||
aLayerToSubtractA->DrawTop();
|
||||
|
||||
if( bSubtractList )
|
||||
bSubtractList->DrawTop();
|
||||
if( aLayerToSubtractB )
|
||||
aLayerToSubtractB->DrawTop();
|
||||
|
||||
if( cSubtractList )
|
||||
cSubtractList->DrawTop();
|
||||
if( aLayerToSubtractC )
|
||||
aLayerToSubtractC->DrawTop();
|
||||
|
||||
if( dSubtractList )
|
||||
dSubtractList->DrawTop();
|
||||
if( aLayerToSubtractD )
|
||||
aLayerToSubtractD->DrawTop();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_TRUE);
|
||||
@@ -548,8 +575,8 @@ void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle,
|
||||
|
||||
if( aDrawMiddle )
|
||||
{
|
||||
if( aSubtractList )
|
||||
aSubtractList->DrawMiddle();
|
||||
if( aLayerToSubtractA )
|
||||
aLayerToSubtractA->DrawMiddle();
|
||||
}
|
||||
|
||||
glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
|
||||
@@ -561,7 +588,7 @@ void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle,
|
||||
|
||||
void OPENGL_RENDER_LIST::ApplyScalePosition( float aZposition, float aZscale )
|
||||
{
|
||||
wxCHECK2( aZscale > FLT_EPSILON, aZscale = FLT_EPSILON + 1 );
|
||||
wxASSERT( aZscale > FLT_EPSILON );
|
||||
|
||||
m_zPositionTransformation = aZposition;
|
||||
m_zScaleTransformation = aZscale;
|
||||
@@ -569,12 +596,6 @@ void OPENGL_RENDER_LIST::ApplyScalePosition( float aZposition, float aZscale )
|
||||
}
|
||||
|
||||
|
||||
void OPENGL_RENDER_LIST::ApplyScalePosition( OPENGL_RENDER_LIST* aOtherList )
|
||||
{
|
||||
ApplyScalePosition( aOtherList->GetZBot(), aOtherList->GetZTop() - aOtherList->GetZBot() );
|
||||
}
|
||||
|
||||
|
||||
void OPENGL_RENDER_LIST::SetItIsTransparent( bool aSetTransparent )
|
||||
{
|
||||
m_draw_it_transparent = aSetTransparent;
|
||||
|
||||
@@ -194,14 +194,15 @@ public:
|
||||
*
|
||||
* @param zCameraPos is the camera z axis position.
|
||||
*/
|
||||
void DrawCulled( bool aDrawMiddle,
|
||||
const OPENGL_RENDER_LIST* aSubtractList = nullptr,
|
||||
const OPENGL_RENDER_LIST* bSubtractList = nullptr,
|
||||
const OPENGL_RENDER_LIST* cSubtractList = nullptr,
|
||||
const OPENGL_RENDER_LIST* dSubtractList = nullptr ) const;
|
||||
void DrawAllCameraCulled( float zCameraPos, bool aDrawMiddle = true ) const;
|
||||
|
||||
void DrawAllCameraCulledSubtractLayer( bool aDrawMiddle,
|
||||
const OPENGL_RENDER_LIST* aLayerToSubtractA = nullptr,
|
||||
const OPENGL_RENDER_LIST* aLayerToSubtractB = nullptr,
|
||||
const OPENGL_RENDER_LIST* aLayerToSubtractC = nullptr,
|
||||
const OPENGL_RENDER_LIST* aLayerToSubtractD = nullptr ) const;
|
||||
|
||||
void ApplyScalePosition( float aZposition, float aZscale );
|
||||
void ApplyScalePosition( OPENGL_RENDER_LIST* aOtherList );
|
||||
|
||||
void ClearScalePosition() { m_haveTransformation = false; }
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <trigo.h>
|
||||
#include <wx/debug.h> // For the wxASSERT
|
||||
|
||||
#define RADPERDEG 0.0174533f
|
||||
#define RADPERDEG 0.0174533
|
||||
|
||||
void DrawRoundArrow( SFVEC3F aPosition, SFVEC3F aTargetPos, float aSize )
|
||||
{
|
||||
@@ -155,7 +155,7 @@ void DrawHalfOpenCylinder( unsigned int aNrSidesPerCircle )
|
||||
{
|
||||
SFVEC2D corner = SFVEC2D( 0.0, radius );
|
||||
RotatePoint( &corner.x, &corner.y, ii );
|
||||
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 0.0 );
|
||||
glVertex3f( corner.x, corner.y, 0.0 );
|
||||
}
|
||||
|
||||
glVertex3d( 0.0, -radius, 0.0 );
|
||||
@@ -171,7 +171,7 @@ void DrawHalfOpenCylinder( unsigned int aNrSidesPerCircle )
|
||||
SFVEC2D corner = SFVEC2D( 0.0, radius );
|
||||
|
||||
RotatePoint( &corner.x, &corner.y, ii );
|
||||
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 1.0 );
|
||||
glVertex3f( corner.x, corner.y, 1.0 );
|
||||
}
|
||||
|
||||
glVertex3f( 0.0, radius, 1.0 );
|
||||
@@ -185,10 +185,9 @@ void DrawHalfOpenCylinder( unsigned int aNrSidesPerCircle )
|
||||
SFVEC2D corner = SFVEC2D( 0.0, radius );
|
||||
|
||||
RotatePoint( &corner.x, &corner.y, ii );
|
||||
glNormal3f( static_cast<GLfloat>( corner.x * 2.0f ),
|
||||
static_cast<GLfloat>( corner.y * 2.0f ), 0.0f );
|
||||
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 1.0f );
|
||||
glVertex3f( static_cast<GLfloat>( corner.x ), static_cast<GLfloat>( corner.y ), 0.0f );
|
||||
glNormal3f( corner.x * 2.0f, corner.y * 2.0f, 0.0f );
|
||||
glVertex3f( corner.x, corner.y, 1.0 );
|
||||
glVertex3f( corner.x, corner.y, 0.0 );
|
||||
}
|
||||
|
||||
glNormal3f( 0.0, 1.0f, 0.0f );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -73,15 +73,16 @@ public:
|
||||
|
||||
private:
|
||||
OPENGL_RENDER_LIST* generateHoles( const LIST_OBJECT2D& aListHolesObject2d,
|
||||
const SHAPE_POLY_SET& aPoly, float aZtop, float aZbot,
|
||||
bool aInvertFaces,
|
||||
const SHAPE_POLY_SET& aPoly, float aZtop,
|
||||
float aZbot, bool aInvertFaces,
|
||||
const BVH_CONTAINER_2D* aThroughHoles = nullptr );
|
||||
|
||||
OPENGL_RENDER_LIST* generateLayerList( const BVH_CONTAINER_2D* aContainer,
|
||||
const SHAPE_POLY_SET* aPolyList, PCB_LAYER_ID aLayer,
|
||||
const SHAPE_POLY_SET* aPolyList,
|
||||
PCB_LAYER_ID aLayerId,
|
||||
const BVH_CONTAINER_2D* aThroughHoles = nullptr );
|
||||
|
||||
OPENGL_RENDER_LIST* generateEmptyLayerList( PCB_LAYER_ID aLayer );
|
||||
OPENGL_RENDER_LIST* generateEmptyLayerList( PCB_LAYER_ID aLayerId );
|
||||
|
||||
void addTopAndBottomTriangles( TRIANGLE_DISPLAY_LIST* aDst, const SFVEC2F& v0,
|
||||
const SFVEC2F& v1, const SFVEC2F& v2, float top, float bot );
|
||||
@@ -92,17 +93,17 @@ private:
|
||||
void addObjectTriangles( const POLYGON_4PT_2D* aPoly, TRIANGLE_DISPLAY_LIST* aDstLayer,
|
||||
float aZtop, float aZbot );
|
||||
|
||||
void addObjectTriangles( const FILLED_CIRCLE_2D* aCircle, TRIANGLE_DISPLAY_LIST* aDstLayer,
|
||||
float aZtop, float aZbot );
|
||||
void addObjectTriangles( const FILLED_CIRCLE_2D* aFilledCircle,
|
||||
TRIANGLE_DISPLAY_LIST* aDstLayer, float aZtop, float aZbot );
|
||||
|
||||
void addObjectTriangles( const TRIANGLE_2D* aTri, TRIANGLE_DISPLAY_LIST* aDstLayer,
|
||||
float aZtop, float aZbot );
|
||||
|
||||
void addObjectTriangles( const ROUND_SEGMENT_2D* aSeg, TRIANGLE_DISPLAY_LIST* aDstLayer,
|
||||
float aZtop, float aZbot );
|
||||
void addObjectTriangles( const ROUND_SEGMENT_2D* aSeg,
|
||||
TRIANGLE_DISPLAY_LIST* aDstLayer, float aZtop, float aZbot );
|
||||
|
||||
void renderSolderMaskLayer( PCB_LAYER_ID aLayerID, float aZPos, bool aShowThickness,
|
||||
bool aSkipRenderHoles );
|
||||
void renderSolderMaskLayer( PCB_LAYER_ID aLayerID, float aZPosition,
|
||||
bool aDrawMiddleSegments, bool aSkipRenderHoles );
|
||||
|
||||
void renderBoardBody( bool aSkipRenderHoles );
|
||||
|
||||
@@ -153,12 +154,15 @@ private:
|
||||
void renderOpaqueModels( const glm::mat4 &aCameraViewMatrix );
|
||||
void renderTransparentModels( const glm::mat4 &aCameraViewMatrix );
|
||||
|
||||
void renderModel( const glm::mat4 &aCameraViewMatrix, const MODELTORENDER &aModelToRender,
|
||||
const SFVEC3F &aSelColor, const SFVEC3F *aCameraWorldPos );
|
||||
void renderModel( const glm::mat4 &aCameraViewMatrix,
|
||||
const MODELTORENDER &aModelToRender,
|
||||
const SFVEC3F &aSelColor,
|
||||
const SFVEC3F *aCameraWorldPos );
|
||||
|
||||
|
||||
void get3dModelsSelected( std::list<MODELTORENDER> &aDstRenderList, bool aGetTop, bool aGetBot,
|
||||
bool aRenderTransparentOnly, bool aRenderSelectedOnly );
|
||||
void get3dModelsSelected( std::list<MODELTORENDER> &aDstRenderList,
|
||||
bool aGetTop, bool aGetBot, bool aRenderTransparentOnly,
|
||||
bool aRenderSelectedOnly );
|
||||
|
||||
void get3dModelsFromFootprint( std::list<MODELTORENDER> &aDstRenderList,
|
||||
const FOOTPRINT* aFootprint, bool aRenderTransparentOnly,
|
||||
@@ -185,6 +189,7 @@ private:
|
||||
void unsetDepthOffset();
|
||||
|
||||
void setLayerMaterial( PCB_LAYER_ID aLayerID );
|
||||
SFVEC4F getLayerColor( PCB_LAYER_ID aLayerID );
|
||||
|
||||
bool initializeOpenGL();
|
||||
OPENGL_RENDER_LIST* createBoard( const SHAPE_POLY_SET& aBoardPoly,
|
||||
@@ -211,8 +216,6 @@ private:
|
||||
MAP_OGL_DISP_LISTS m_layers;
|
||||
OPENGL_RENDER_LIST* m_platedPadsFront;
|
||||
OPENGL_RENDER_LIST* m_platedPadsBack;
|
||||
OPENGL_RENDER_LIST* m_offboardPadsFront;
|
||||
OPENGL_RENDER_LIST* m_offboardPadsBack;
|
||||
MAP_OGL_DISP_LISTS m_outerLayerHoles;
|
||||
MAP_OGL_DISP_LISTS m_innerLayerHoles;
|
||||
OPENGL_RENDER_LIST* m_board;
|
||||
@@ -232,8 +235,8 @@ private:
|
||||
OPENGL_RENDER_LIST* m_padHoles;
|
||||
|
||||
// Caches
|
||||
std::map<wxString, MODEL_3D*> m_3dModelMap;
|
||||
std::map<std::vector<float>, glm::mat4> m_3dModelMatrixMap;
|
||||
std::map< wxString, MODEL_3D* > m_3dModelMap;
|
||||
std::map< std::vector<float>, glm::mat4 > m_3dModelMatrixMap;
|
||||
|
||||
BOARD_ITEM* m_currentRollOverItem;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef POST_SHADER_H
|
||||
#define POST_SHADER_H
|
||||
|
||||
#include <gal/3d/camera.h>
|
||||
#include "camera.h"
|
||||
|
||||
class POST_SHADER
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bvh_pbrt.cpp
|
||||
* @file cbvh_pbrt.cpp
|
||||
* @brief This BVH implementation is based on the source code implementation
|
||||
* from the book "Physically Based Rendering" (v2 and v3)
|
||||
*
|
||||
@@ -437,7 +437,7 @@ BVHBuildNode *BVH_PBRT::recursiveBuild ( std::vector<BVHPrimitiveInfo>& primitiv
|
||||
|
||||
(*totalNodes)++;
|
||||
|
||||
// !TODO: implement a memory arena
|
||||
// !TODO: implement an memory Arena
|
||||
BVHBuildNode *node = static_cast<BVHBuildNode *>( malloc( sizeof( BVHBuildNode ) ) );
|
||||
m_nodesToFree.push_back( node );
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2022 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-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
|
||||
@@ -42,10 +41,9 @@
|
||||
#include <footprint.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <project_pcb.h>
|
||||
|
||||
#include <base_units.h>
|
||||
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
|
||||
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
|
||||
|
||||
/**
|
||||
* Perform an interpolation step to easy control the transparency based on the
|
||||
@@ -236,9 +234,7 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
|
||||
if( aContainer2d == nullptr )
|
||||
return;
|
||||
|
||||
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
|
||||
bool isSilk = aLayer_id == B_SilkS || aLayer_id == F_SilkS;
|
||||
const LIST_OBJECT2D& listObject2d = aContainer2d->GetList();
|
||||
const LIST_OBJECT2D& listObject2d = aContainer2d->GetList();
|
||||
|
||||
if( listObject2d.size() == 0 )
|
||||
return;
|
||||
@@ -277,8 +273,11 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
|
||||
// layer and the flag is set, then clip the silk at the outer edge of the annular ring,
|
||||
// rather than the at the outer edge of the copper plating.
|
||||
const BVH_CONTAINER_2D& throughHoleOuter =
|
||||
cfg.clip_silk_on_via_annuli && isSilk ? m_boardAdapter.GetViaAnnuli()
|
||||
: m_boardAdapter.GetTH_ODs();
|
||||
m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus
|
||||
&& m_boardAdapter.m_Cfg->m_Render.realistic
|
||||
&& ( aLayer_id == B_SilkS || aLayer_id == F_SilkS ) ?
|
||||
m_boardAdapter.GetThroughHoleAnnularRings() :
|
||||
m_boardAdapter.GetThroughHoleOds();
|
||||
|
||||
if( !throughHoleOuter.GetList().empty() )
|
||||
{
|
||||
@@ -304,13 +303,14 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
|
||||
|
||||
const MAP_CONTAINER_2D_BASE& mapLayers = m_boardAdapter.GetLayerMap();
|
||||
|
||||
if( cfg.subtract_mask_from_silk
|
||||
if( m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk
|
||||
&& m_boardAdapter.m_Cfg->m_Render.realistic
|
||||
&& ( ( aLayer_id == B_SilkS && mapLayers.find( B_Mask ) != mapLayers.end() )
|
||||
|| ( aLayer_id == F_SilkS && mapLayers.find( F_Mask ) != mapLayers.end() ) ) )
|
||||
{
|
||||
const PCB_LAYER_ID maskLayer = ( aLayer_id == B_SilkS ) ? B_Mask : F_Mask;
|
||||
const PCB_LAYER_ID layerMask_id = ( aLayer_id == B_SilkS ) ? B_Mask : F_Mask;
|
||||
|
||||
const BVH_CONTAINER_2D* containerMaskLayer2d = mapLayers.at( maskLayer );
|
||||
const BVH_CONTAINER_2D* containerMaskLayer2d = mapLayers.at( layerMask_id );
|
||||
|
||||
CONST_LIST_OBJECT2D intersecting;
|
||||
|
||||
@@ -330,8 +330,8 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
|
||||
if( ( object2d_B == CSGITEM_EMPTY ) && ( object2d_C == CSGITEM_FULL ) )
|
||||
{
|
||||
LAYER_ITEM* objPtr = new LAYER_ITEM( object2d_A,
|
||||
m_boardAdapter.GetLayerBottomZPos( aLayer_id ) - aLayerZOffset,
|
||||
m_boardAdapter.GetLayerTopZPos( aLayer_id ) + aLayerZOffset );
|
||||
m_boardAdapter.GetLayerBottomZPos( aLayer_id ) - aLayerZOffset,
|
||||
m_boardAdapter.GetLayerTopZPos( aLayer_id ) + aLayerZOffset );
|
||||
objPtr->SetMaterial( aMaterialLayer );
|
||||
objPtr->SetColor( ConvertSRGBToLinear( aLayerColor ) );
|
||||
m_objectContainer.Add( objPtr );
|
||||
@@ -343,8 +343,8 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
|
||||
m_containerWithObjectsToDelete.Add( itemCSG2d );
|
||||
|
||||
LAYER_ITEM* objPtr = new LAYER_ITEM( itemCSG2d,
|
||||
m_boardAdapter.GetLayerBottomZPos( aLayer_id ) - aLayerZOffset,
|
||||
m_boardAdapter.GetLayerTopZPos( aLayer_id ) + aLayerZOffset );
|
||||
m_boardAdapter.GetLayerBottomZPos( aLayer_id ) - aLayerZOffset,
|
||||
m_boardAdapter.GetLayerTopZPos( aLayer_id ) + aLayerZOffset );
|
||||
|
||||
objPtr->SetMaterial( aMaterialLayer );
|
||||
objPtr->SetColor( ConvertSRGBToLinear( aLayerColor ) );
|
||||
@@ -368,7 +368,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
OBJECT_2D_STATS::Instance().ResetStats();
|
||||
OBJECT_3D_STATS::Instance().ResetStats();
|
||||
|
||||
int64_t stats_startReloadTime = GetRunningMicroSecs();
|
||||
unsigned stats_startReloadTime = GetRunningMicroSecs();
|
||||
|
||||
if( !aOnlyLoadCopperAndShapes )
|
||||
{
|
||||
@@ -393,8 +393,6 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
m_outlineBoard2dObjects = new CONTAINER_2D;
|
||||
m_antioutlineBoard2dObjects = new BVH_CONTAINER_2D;
|
||||
|
||||
std::bitset<LAYER_3D_END> layerFlags = m_boardAdapter.GetVisibleLayers();
|
||||
|
||||
if( !aOnlyLoadCopperAndShapes )
|
||||
{
|
||||
const int outlineCount = m_boardAdapter.GetBoardPoly().OutlineCount();
|
||||
@@ -436,7 +434,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
*m_boardAdapter.GetBoard(), ii );
|
||||
}
|
||||
|
||||
if( layerFlags.test( LAYER_3D_BOARD ) )
|
||||
if( m_boardAdapter.m_Cfg->m_Render.show_board_body )
|
||||
{
|
||||
const LIST_OBJECT2D& listObjects = m_outlineBoard2dObjects->GetList();
|
||||
|
||||
@@ -445,9 +443,9 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
std::vector<const OBJECT_2D*>* object2d_B = new std::vector<const OBJECT_2D*>();
|
||||
|
||||
// Check if there are any THT that intersects this outline object part
|
||||
if( !m_boardAdapter.GetTH_ODs().GetList().empty() )
|
||||
if( !m_boardAdapter.GetThroughHoleOds().GetList().empty() )
|
||||
{
|
||||
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetTH_ODs();
|
||||
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetThroughHoleOds();
|
||||
CONST_LIST_OBJECT2D intersecting;
|
||||
|
||||
throughHoles.GetIntersectingObjects( object2d_A->GetBBox(), intersecting );
|
||||
@@ -511,9 +509,9 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
// a polygon or dummy block) it will cut also the render of the hole.
|
||||
// So this will add a full hole.
|
||||
// In fact, that is not need if the hole have copper.
|
||||
if( !m_boardAdapter.GetTH_ODs().GetList().empty() )
|
||||
if( !m_boardAdapter.GetThroughHoleOds().GetList().empty() )
|
||||
{
|
||||
const LIST_OBJECT2D& holeList = m_boardAdapter.GetTH_ODs().GetList();
|
||||
const LIST_OBJECT2D& holeList = m_boardAdapter.GetThroughHoleOds().GetList();
|
||||
|
||||
for( const OBJECT_2D* hole2d : holeList )
|
||||
{
|
||||
@@ -588,33 +586,40 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
case B_Paste:
|
||||
case F_Paste:
|
||||
materialLayer = &m_materials.m_Paste;
|
||||
layerColor = m_boardAdapter.m_SolderPasteColor;
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
layerColor = m_boardAdapter.m_SolderPasteColor;
|
||||
else
|
||||
layerColor = m_boardAdapter.GetLayerColor( layer_id );
|
||||
|
||||
break;
|
||||
|
||||
case B_SilkS:
|
||||
materialLayer = &m_materials.m_SilkS;
|
||||
layerColor = m_boardAdapter.m_SilkScreenColorBot;
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
layerColor = m_boardAdapter.m_SilkScreenColorBot;
|
||||
else
|
||||
layerColor = m_boardAdapter.GetLayerColor( layer_id );
|
||||
|
||||
break;
|
||||
|
||||
case F_SilkS:
|
||||
materialLayer = &m_materials.m_SilkS;
|
||||
layerColor = m_boardAdapter.m_SilkScreenColorTop;
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
layerColor = m_boardAdapter.m_SilkScreenColorTop;
|
||||
else
|
||||
layerColor = m_boardAdapter.GetLayerColor( layer_id );
|
||||
|
||||
break;
|
||||
|
||||
case Dwgs_User:
|
||||
layerColor = m_boardAdapter.m_UserDrawingsColor;
|
||||
break;
|
||||
|
||||
case Cmts_User:
|
||||
layerColor = m_boardAdapter.m_UserCommentsColor;
|
||||
break;
|
||||
|
||||
case Eco1_User:
|
||||
layerColor = m_boardAdapter.m_ECO1Color;
|
||||
break;
|
||||
|
||||
case Eco2_User:
|
||||
layerColor = m_boardAdapter.m_ECO2Color;
|
||||
case Edge_Cuts:
|
||||
case Margin:
|
||||
break;
|
||||
|
||||
case B_CrtYd:
|
||||
@@ -626,15 +631,22 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
break;
|
||||
|
||||
default:
|
||||
if( m_boardAdapter.m_Cfg->m_Render.differentiate_plated_copper )
|
||||
if( m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
{
|
||||
layerColor = SFVEC3F( 184.0f / 255.0f, 115.0f / 255.0f, 50.0f / 255.0f );
|
||||
materialLayer = &m_materials.m_NonPlatedCopper;
|
||||
if( m_boardAdapter.m_Cfg->m_Render.renderPlatedPadsAsPlated )
|
||||
{
|
||||
layerColor = SFVEC3F( 184.0f / 255.0f, 115.0f / 255.0f, 50.0f / 255.0f );
|
||||
materialLayer = &m_materials.m_NonPlatedCopper;
|
||||
}
|
||||
else
|
||||
{
|
||||
layerColor = m_boardAdapter.m_CopperColor;
|
||||
materialLayer = &m_materials.m_Copper;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
layerColor = m_boardAdapter.m_CopperColor;
|
||||
materialLayer = &m_materials.m_Copper;
|
||||
layerColor = m_boardAdapter.GetLayerColor( layer_id );
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -644,7 +656,8 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
} // for each layer on map
|
||||
|
||||
// Create plated copper
|
||||
if( m_boardAdapter.m_Cfg->m_Render.differentiate_plated_copper )
|
||||
if( m_boardAdapter.m_Cfg->m_Render.renderPlatedPadsAsPlated
|
||||
&& m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
{
|
||||
createItemsFromContainer( m_boardAdapter.GetPlatedPadsFront(), F_Cu, &m_materials.m_Copper,
|
||||
m_boardAdapter.m_CopperColor,
|
||||
@@ -661,9 +674,8 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
// Solder mask layers are "negative" layers so the elements that we have in the container
|
||||
// should remove the board outline. We will check for all objects in the outline if it
|
||||
// intersects any object in the layer container and also any hole.
|
||||
if( ( layerFlags.test( LAYER_3D_SOLDERMASK_TOP )
|
||||
|| layerFlags.test( LAYER_3D_SOLDERMASK_BOTTOM ) )
|
||||
&& !m_outlineBoard2dObjects->GetList().empty() )
|
||||
if( m_boardAdapter.m_Cfg->m_Render.show_soldermask
|
||||
&& !m_outlineBoard2dObjects->GetList().empty() )
|
||||
{
|
||||
const MATERIAL* materialLayer = &m_materials.m_SolderMask;
|
||||
|
||||
@@ -677,22 +689,22 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
continue;
|
||||
|
||||
// Only get the Solder mask layers (and only if the board has them)
|
||||
if( layer_id == F_Mask && !layerFlags.test( LAYER_3D_SOLDERMASK_TOP ) )
|
||||
continue;
|
||||
|
||||
if( layer_id == B_Mask && !layerFlags.test( LAYER_3D_SOLDERMASK_BOTTOM ) )
|
||||
continue;
|
||||
|
||||
// Only Mask layers are processed here because they are negative layers
|
||||
if( layer_id != F_Mask && layer_id != B_Mask )
|
||||
if( !( layer_id == B_Mask || layer_id == F_Mask ) )
|
||||
continue;
|
||||
|
||||
SFVEC3F layerColor;
|
||||
|
||||
if( layer_id == B_Mask )
|
||||
layerColor = m_boardAdapter.m_SolderMaskColorBot;
|
||||
if( m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
{
|
||||
if( layer_id == B_Mask )
|
||||
layerColor = m_boardAdapter.m_SolderMaskColorBot;
|
||||
else
|
||||
layerColor = m_boardAdapter.m_SolderMaskColorTop;
|
||||
}
|
||||
else
|
||||
layerColor = m_boardAdapter.m_SolderMaskColorTop;
|
||||
{
|
||||
layerColor = m_boardAdapter.GetLayerColor( layer_id );
|
||||
}
|
||||
|
||||
const float zLayerMin = m_boardAdapter.GetLayerBottomZPos( layer_id );
|
||||
const float zLayerMax = m_boardAdapter.GetLayerTopZPos( layer_id );
|
||||
@@ -703,9 +715,9 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
std::vector<const OBJECT_2D*>* object2d_B = new std::vector<const OBJECT_2D*>();
|
||||
|
||||
// Check if there are any THT that intersects this outline object part
|
||||
if( !m_boardAdapter.GetTH_ODs().GetList().empty() )
|
||||
if( !m_boardAdapter.GetThroughHoleOds().GetList().empty() )
|
||||
{
|
||||
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetTH_ODs();
|
||||
const BVH_CONTAINER_2D& throughHoles = m_boardAdapter.GetThroughHoleOds();
|
||||
CONST_LIST_OBJECT2D intersecting;
|
||||
|
||||
throughHoles.GetIntersectingObjects( object2d_A->GetBBox(), intersecting );
|
||||
@@ -771,8 +783,8 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
}
|
||||
|
||||
#ifdef PRINT_STATISTICS_3D_VIEWER
|
||||
int64_t stats_endConvertTime = GetRunningMicroSecs();
|
||||
int64_t stats_startLoad3DmodelsTime = stats_endConvertTime;
|
||||
unsigned stats_endConvertTime = GetRunningMicroSecs();
|
||||
unsigned stats_startLoad3DmodelsTime = stats_endConvertTime;
|
||||
#endif
|
||||
|
||||
if( aStatusReporter )
|
||||
@@ -781,7 +793,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
load3DModels( m_objectContainer, aOnlyLoadCopperAndShapes );
|
||||
|
||||
#ifdef PRINT_STATISTICS_3D_VIEWER
|
||||
int64_t stats_endLoad3DmodelsTime = GetRunningMicroSecs();
|
||||
unsigned stats_endLoad3DmodelsTime = GetRunningMicroSecs();
|
||||
#endif
|
||||
|
||||
if( !aOnlyLoadCopperAndShapes )
|
||||
@@ -955,7 +967,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
if( aStatusReporter )
|
||||
{
|
||||
// Calculation time in seconds
|
||||
double calculation_time = (double) ( GetRunningMicroSecs() - stats_startReloadTime ) / 1e6;
|
||||
double calculation_time = (double) GetRunningMicroSecs() - stats_startReloadTime / 1e6;
|
||||
|
||||
aStatusReporter->Report( wxString::Format( _( "Reload time %.3f s" ), calculation_time ) );
|
||||
}
|
||||
@@ -987,7 +999,15 @@ void RENDER_3D_RAYTRACE::insertHole( const PCB_VIA* aVia )
|
||||
LAYER_ITEM* objPtr = new LAYER_ITEM( ring, topZ, botZ );
|
||||
|
||||
objPtr->SetMaterial( &m_materials.m_Copper );
|
||||
objPtr->SetColor( ConvertSRGBToLinear( m_boardAdapter.m_CopperColor ) );
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
objPtr->SetColor( ConvertSRGBToLinear( m_boardAdapter.m_CopperColor ) );
|
||||
else if( aVia->GetViaType() == VIATYPE::MICROVIA )
|
||||
objPtr->SetColor( ConvertSRGBToLinear( m_boardAdapter.GetItemColor( LAYER_VIA_MICROVIA ) ) );
|
||||
else if( aVia->GetViaType() == VIATYPE::BLIND_BURIED )
|
||||
objPtr->SetColor( ConvertSRGBToLinear( m_boardAdapter.GetItemColor( LAYER_VIA_BBLIND ) ) );
|
||||
else
|
||||
objPtr->SetColor( ConvertSRGBToLinear( m_boardAdapter.GetItemColor( LAYER_VIAS ) ) );
|
||||
|
||||
m_objectContainer.Add( objPtr );
|
||||
}
|
||||
@@ -997,7 +1017,13 @@ void RENDER_3D_RAYTRACE::insertHole( const PAD* aPad )
|
||||
{
|
||||
const OBJECT_2D* object2d_A = nullptr;
|
||||
|
||||
SFVEC3F objColor = m_boardAdapter.m_CopperColor;
|
||||
SFVEC3F objColor;
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.realistic )
|
||||
objColor = m_boardAdapter.m_CopperColor;
|
||||
else
|
||||
objColor = m_boardAdapter.GetItemColor( LAYER_PADS_TH );
|
||||
|
||||
const VECTOR2I drillsize = aPad->GetDrillSize();
|
||||
const bool hasHole = drillsize.x && drillsize.y;
|
||||
|
||||
@@ -1116,11 +1142,12 @@ void RENDER_3D_RAYTRACE::insertHole( const PAD* aPad )
|
||||
|
||||
// Check if there are any other THT that intersects this hole
|
||||
// It will use the non inflated holes
|
||||
if( !m_boardAdapter.GetTH_IDs().GetList().empty() )
|
||||
if( !m_boardAdapter.GetThroughHoleIds().GetList().empty() )
|
||||
{
|
||||
CONST_LIST_OBJECT2D intersecting;
|
||||
|
||||
m_boardAdapter.GetTH_IDs().GetIntersectingObjects( object2d_A->GetBBox(), intersecting );
|
||||
m_boardAdapter.GetThroughHoleIds().GetIntersectingObjects( object2d_A->GetBBox(),
|
||||
intersecting );
|
||||
|
||||
for( const OBJECT_2D* hole2d : intersecting )
|
||||
{
|
||||
@@ -1259,8 +1286,8 @@ void RENDER_3D_RAYTRACE::load3DModels( CONTAINER_3D& aDstContainer, bool aSkipMa
|
||||
{
|
||||
// FindRow() can throw an exception
|
||||
const FP_LIB_TABLE_ROW* fpRow =
|
||||
PROJECT_PCB::PcbFootprintLibs( m_boardAdapter.GetBoard()->GetProject() )
|
||||
->FindRow( libraryName, false );
|
||||
m_boardAdapter.GetBoard()->GetProject()->PcbFootprintLibs()->FindRow(
|
||||
libraryName, false );
|
||||
|
||||
if( fpRow )
|
||||
footprintBasePath = fpRow->GetFullURI( true );
|
||||
|
||||
@@ -141,8 +141,8 @@ struct RAYSEG2D
|
||||
bool IntersectSegment( const SFVEC2F &aStartA, const SFVEC2F &aEnd_minus_startA,
|
||||
const SFVEC2F &aStartB, const SFVEC2F &aEnd_minus_startB );
|
||||
|
||||
/*
|
||||
#if(GLM_ARCH != GLM_ARCH_PURE)
|
||||
/*
|
||||
struct RAY4
|
||||
{
|
||||
glm::simdVec4 m_orgX; ///< x coordinate of ray origin
|
||||
@@ -155,10 +155,9 @@ struct RAY4
|
||||
|
||||
glm::simdVec4 m_tnear; ///< Start of ray segment
|
||||
glm::simdVec4 m_tfar; ///< End of ray segment
|
||||
};
|
||||
};*/
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
#endif // RAY_H
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "ray.h"
|
||||
#include "frustum.h"
|
||||
#include <gal/3d/camera.h>
|
||||
#include "../camera.h"
|
||||
|
||||
#define RAYPACKET_DIM (1 << 3)
|
||||
#define RAYPACKET_MASK (unsigned int) ( ( RAYPACKET_DIM - 1 ) )
|
||||
|
||||
@@ -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-2023 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
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <climits>
|
||||
#include <thread>
|
||||
|
||||
#include "render_3d_raytrace.h"
|
||||
@@ -35,7 +36,7 @@
|
||||
#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 <profile.h> // To use GetRunningMicroSecs or another profiling utility
|
||||
#include <wx/log.h>
|
||||
|
||||
|
||||
@@ -91,7 +92,7 @@ RENDER_3D_RAYTRACE::~RENDER_3D_RAYTRACE()
|
||||
|
||||
int RENDER_3D_RAYTRACE::GetWaitForEditingTimeOut()
|
||||
{
|
||||
return 200; // ms
|
||||
return 1000; // ms
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ private:
|
||||
RT_RENDER_STATE m_renderState;
|
||||
|
||||
/// Time that the render starts
|
||||
int64_t m_renderStartTime;
|
||||
unsigned long int m_renderStartTime;
|
||||
|
||||
/// Save the number of blocks progress of the render
|
||||
size_t m_blockRenderProgressCount;
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
#include "object_2d.h"
|
||||
#include "../ray.h"
|
||||
#include "filled_circle_2d.h"
|
||||
#include <plugins/3dapi/xv3d_types.h> // SFVEC2F
|
||||
|
||||
class BOARD_ITEM;
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file cylinder_3d.cpp
|
||||
* @file ccylinder.cpp
|
||||
* @brief
|
||||
*/
|
||||
|
||||
#include "3d_fastmath.h"
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file object_3d.cpp
|
||||
* @file cobject.cpp
|
||||
* @brief
|
||||
*/
|
||||
|
||||
#include "object_3d.h"
|
||||
|
||||
@@ -52,7 +52,7 @@ class OBJECT_3D
|
||||
public:
|
||||
explicit OBJECT_3D( OBJECT_3D_TYPE aObjType );
|
||||
|
||||
void SetBoardItem( BOARD_ITEM* aBoardItem ) { m_boardItem = aBoardItem; }
|
||||
const void SetBoardItem( BOARD_ITEM* aBoardItem ) { m_boardItem = aBoardItem; }
|
||||
BOARD_ITEM* GetBoardItem() const { return m_boardItem; }
|
||||
|
||||
void SetMaterial( const MATERIAL* aMaterial )
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file track_ball.cpp
|
||||
* @file ctrack_ball.cpp
|
||||
* @brief Implementation of a track ball camera. A track ball is placed in the
|
||||
* center of the screen and rotates the camera.
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef TRACK_BALL_H
|
||||
#define TRACK_BALL_H
|
||||
|
||||
#include <gal/3d/camera.h>
|
||||
#include "camera.h"
|
||||
|
||||
|
||||
class TRACK_BALL : public CAMERA
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 1992-2023 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
|
||||
@@ -28,6 +27,7 @@
|
||||
#include <bitmaps.h>
|
||||
#include <tool/conditional_menu.h>
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <3d_viewer_id.h>
|
||||
#include <3d_viewer/tools/eda_3d_actions.h>
|
||||
#include <tool/tool_manager.h>
|
||||
@@ -35,12 +35,11 @@
|
||||
#include <widgets/wx_menubar.h>
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
|
||||
void EDA_3D_VIEWER_FRAME::CreateMenuBar()
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::CreateMenuBar" ) );
|
||||
|
||||
COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
|
||||
@@ -82,20 +81,6 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
|
||||
viewMenu->Add( ACTIONS::zoomFitScreen );
|
||||
viewMenu->Add( ACTIONS::zoomRedraw );
|
||||
|
||||
// Grid submenu
|
||||
ACTION_MENU* gridSubmenu = new ACTION_MENU( false, tool );
|
||||
gridSubmenu->SetTitle( _( "3D Grid" ) );
|
||||
gridSubmenu->SetIcon( BITMAPS::grid );
|
||||
|
||||
gridSubmenu->Add( EDA_3D_ACTIONS::noGrid, ACTION_MENU::CHECK);
|
||||
gridSubmenu->Add( EDA_3D_ACTIONS::show10mmGrid, ACTION_MENU::CHECK);
|
||||
gridSubmenu->Add( EDA_3D_ACTIONS::show5mmGrid, ACTION_MENU::CHECK);
|
||||
gridSubmenu->Add( EDA_3D_ACTIONS::show2_5mmGrid, ACTION_MENU::CHECK);
|
||||
gridSubmenu->Add( EDA_3D_ACTIONS::show1mmGrid, ACTION_MENU::CHECK);
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
viewMenu->Add( gridSubmenu );
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
viewMenu->Add( EDA_3D_ACTIONS::rotateXCW );
|
||||
viewMenu->Add( EDA_3D_ACTIONS::rotateXCCW );
|
||||
@@ -114,9 +99,6 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
|
||||
viewMenu->Add( EDA_3D_ACTIONS::moveUp );
|
||||
viewMenu->Add( EDA_3D_ACTIONS::moveDown );
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
viewMenu->Add( EDA_3D_ACTIONS::showLayersManager, ACTION_MENU::CHECK );
|
||||
|
||||
|
||||
//-- Preferences menu -----------------------------------------------
|
||||
//
|
||||
@@ -127,12 +109,37 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
|
||||
BITMAPS::tools,
|
||||
ACTION_MENU::CHECK );
|
||||
|
||||
prefsMenu->Add( ACTIONS::openPreferences );
|
||||
prefsMenu->Add( _( "Preferences..." ) + wxT( "\tCtrl+," ),
|
||||
_( "Show preferences for all open tools" ),
|
||||
wxID_PREFERENCES,
|
||||
BITMAPS::preference );
|
||||
|
||||
prefsMenu->Add( _( "Reset to Default Settings" ), ID_MENU3D_RESET_DEFAULTS, BITMAPS::tools );
|
||||
|
||||
prefsMenu->AppendSeparator();
|
||||
AddMenuLanguageList( prefsMenu, tool );
|
||||
|
||||
prefsMenu->Add( EDA_3D_ACTIONS::showTHT, ACTION_MENU::CHECK );
|
||||
prefsMenu->Add( EDA_3D_ACTIONS::showSMD, ACTION_MENU::CHECK );
|
||||
prefsMenu->Add( EDA_3D_ACTIONS::showVirtual, ACTION_MENU::CHECK );
|
||||
prefsMenu->Add( EDA_3D_ACTIONS::showNotInPosFile, ACTION_MENU::CHECK );
|
||||
|
||||
prefsMenu->AppendSeparator();
|
||||
|
||||
prefsMenu->Add( EDA_3D_ACTIONS::showAxis, ACTION_MENU::CHECK );
|
||||
prefsMenu->Add( EDA_3D_ACTIONS::showBBoxes, ACTION_MENU::CHECK );
|
||||
|
||||
// Grid submenu
|
||||
ACTION_MENU* gridSubmenu = new ACTION_MENU( false, tool );
|
||||
gridSubmenu->SetTitle( _( "3D Grid" ) );
|
||||
gridSubmenu->SetIcon( BITMAPS::grid );
|
||||
|
||||
gridSubmenu->Add( EDA_3D_ACTIONS::noGrid, ACTION_MENU::CHECK);
|
||||
gridSubmenu->Add( EDA_3D_ACTIONS::show10mmGrid, ACTION_MENU::CHECK);
|
||||
gridSubmenu->Add( EDA_3D_ACTIONS::show5mmGrid, ACTION_MENU::CHECK);
|
||||
gridSubmenu->Add( EDA_3D_ACTIONS::show2_5mmGrid, ACTION_MENU::CHECK);
|
||||
gridSubmenu->Add( EDA_3D_ACTIONS::show1mmGrid, ACTION_MENU::CHECK);
|
||||
|
||||
prefsMenu->Add( gridSubmenu );
|
||||
|
||||
//-- Menubar -------------------------------------------------------------
|
||||
//
|
||||
@@ -143,5 +150,4 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
|
||||
AddStandardHelpMenu( menuBar );
|
||||
|
||||
SetMenuBar( menuBar );
|
||||
delete oldMenuBar;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-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
|
||||
@@ -31,6 +30,7 @@
|
||||
#include <bitmaps.h>
|
||||
#include <dialogs/eda_view_switcher.h>
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <tool/action_toolbar.h>
|
||||
#include <tools/eda_3d_actions.h>
|
||||
#include <3d_viewer_id.h>
|
||||
@@ -52,6 +52,32 @@ void EDA_3D_VIEWER_FRAME::ReCreateMainToolbar()
|
||||
m_mainToolBar->SetAuiManager( &m_auimgr );
|
||||
}
|
||||
|
||||
// Show the hotkey to open the windows list selector:
|
||||
wxString keyName = KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY );
|
||||
|
||||
m_viewportsLabel = new wxStaticText( m_mainToolBar, wxID_ANY,
|
||||
wxString::Format( _( "Viewports (%s+Tab):" ), keyName ) );
|
||||
m_viewportsLabel->Wrap( -1 );
|
||||
|
||||
m_cbViewports = new wxChoice( m_mainToolBar, wxID_ANY );
|
||||
|
||||
for( std::pair<const wxString, VIEWPORT3D>& pair : m_viewports )
|
||||
m_cbViewports->Append( pair.first, static_cast<void*>( &pair.second ) );
|
||||
|
||||
m_cbViewports->Append( wxT( "---" ) );
|
||||
m_cbViewports->Append( _( "Save viewport..." ) );
|
||||
m_cbViewports->Append( _( "Delete viewport..." ) );
|
||||
|
||||
m_cbViewports->SetToolTip( wxString::Format( _( "Save and restore view orientation and zoom.\n"
|
||||
"Use %s+Tab to activate selector.\n"
|
||||
"Successive Tabs while holding %s down will "
|
||||
"cycle through viewports in the popup." ),
|
||||
keyName, keyName ) );
|
||||
|
||||
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
|
||||
|
||||
m_lastSelectedViewport = nullptr;
|
||||
|
||||
// Set up toolbar
|
||||
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
||||
KiScaledBitmap( BITMAPS::import3d, this ), _( "Reload board" ) );
|
||||
@@ -97,7 +123,14 @@ void EDA_3D_VIEWER_FRAME::ReCreateMainToolbar()
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::toggleOrtho, ACTION_TOOLBAR::TOGGLE );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::showTHT, ACTION_TOOLBAR::TOGGLE );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::showSMD, ACTION_TOOLBAR::TOGGLE );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::showVirtual, ACTION_TOOLBAR::TOGGLE );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::showNotInPosFile, ACTION_TOOLBAR::TOGGLE );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->AddControl( m_viewportsLabel );
|
||||
m_mainToolBar->AddControl( m_cbViewports );
|
||||
|
||||
m_mainToolBar->KiRealize();
|
||||
}
|
||||
|
||||
@@ -2,8 +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) 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
|
||||
@@ -29,9 +28,11 @@
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/dialog.h>
|
||||
#include "eda_3d_viewer_frame.h"
|
||||
#include "dialogs/appearance_controls_3D.h"
|
||||
#include "eda_list_dialog.h"
|
||||
#include "wx/generic/textdlgg.h"
|
||||
#include <dialogs/eda_view_switcher.h>
|
||||
#include <eda_3d_viewer_settings.h>
|
||||
#include <3d_viewer_id.h>
|
||||
@@ -42,7 +43,7 @@
|
||||
#include <bitmaps.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <dpi_scaling_common.h>
|
||||
#include <gal/dpi_scaling.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project.h>
|
||||
#include <project/project_file.h>
|
||||
@@ -54,9 +55,7 @@
|
||||
#include <tool/tool_dispatcher.h>
|
||||
#include <tool/action_toolbar.h>
|
||||
#include <widgets/wx_infobar.h>
|
||||
#include <widgets/wx_aui_utils.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <project_pcb.h>
|
||||
|
||||
#include <3d_navlib/nl_3d_viewer_plugin.h>
|
||||
|
||||
@@ -90,11 +89,10 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
const wxString& aTitle, long style ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle, wxDefaultPosition,
|
||||
wxDefaultSize, style, QUALIFIED_VIEWER3D_FRAMENAME( aParent ), unityScale ),
|
||||
m_mainToolBar( nullptr ),
|
||||
m_canvas( nullptr ),
|
||||
m_currentCamera( m_trackBallCamera ),
|
||||
m_trackBallCamera( 2 * RANGE_SCALE_3D ),
|
||||
m_spaceMouse( nullptr )
|
||||
m_mainToolBar( nullptr ), m_canvas( nullptr ), m_currentCamera( m_trackBallCamera ),
|
||||
m_viewportsLabel( nullptr ),
|
||||
m_cbViewports( nullptr ),
|
||||
m_trackBallCamera( 2 * RANGE_SCALE_3D ), m_spaceMouse( nullptr )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME %s" ), aTitle );
|
||||
|
||||
@@ -107,7 +105,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
SetIcon( icon );
|
||||
|
||||
// Create the status line
|
||||
static const int status_dims[5] = { -1, 170, 130, 130, 130 };
|
||||
static const int status_dims[4] = { -1, 170, 130, 130 };
|
||||
|
||||
wxStatusBar *status_bar = CreateStatusBar( arrayDim( status_dims ) );
|
||||
SetStatusWidths( arrayDim( status_dims ), status_dims );
|
||||
@@ -116,16 +114,13 @@ 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 ), m_boardAdapter,
|
||||
m_currentCamera,
|
||||
PROJECT_PCB::Get3DCacheManager( &Prj() ) );
|
||||
|
||||
m_appearancePanel = new APPEARANCE_CONTROLS_3D( this, GetCanvas() );
|
||||
m_canvas = new EDA_3D_CANVAS( this, OGL_ATT_LIST::GetAttributesList( aaMode ),
|
||||
m_boardAdapter, m_currentCamera, Prj().Get3DCacheManager() );
|
||||
|
||||
LoadSettings( cfg );
|
||||
loadCommonSettings();
|
||||
|
||||
m_appearancePanel->SetUserViewports( Prj().GetProjectFile().m_Viewports3D );
|
||||
SetUserViewports( Prj().GetProjectFile().m_Viewports3D );
|
||||
|
||||
// Create the manager
|
||||
m_toolManager = new TOOL_MANAGER;
|
||||
@@ -148,30 +143,16 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
// Run the viewer control tool, it is supposed to be always active
|
||||
m_toolManager->InvokeTool( "3DViewer.Control" );
|
||||
|
||||
ReCreateMenuBar();
|
||||
CreateMenuBar();
|
||||
ReCreateMainToolbar();
|
||||
|
||||
m_infoBar = new WX_INFOBAR( this, &m_auimgr );
|
||||
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
|
||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxS( "MainToolbar" ) )
|
||||
.Top().Layer( 6 ) );
|
||||
m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( wxS( "InfoBar" ) )
|
||||
.Top().Layer( 1 ) );
|
||||
m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" )
|
||||
.Right().Layer( 3 )
|
||||
.Caption( _( "Appearance" ) ).PaneBorder( false )
|
||||
.MinSize( 180, -1 ).BestSize( 190, -1 ) );
|
||||
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
|
||||
.Center() );
|
||||
|
||||
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
|
||||
|
||||
if( cfg->m_AuiPanels.right_panel_width > 0 )
|
||||
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
|
||||
|
||||
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
|
||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxS( "MainToolbar" ) ).Top().Layer( 6 ) );
|
||||
m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( wxS( "InfoBar" ) ).Top().Layer( 1 ) );
|
||||
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) ).Center() );
|
||||
|
||||
// Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
|
||||
// hiding it.
|
||||
@@ -184,19 +165,30 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
m_canvas->SetInfoBar( m_infoBar );
|
||||
m_canvas->SetStatusBar( status_bar );
|
||||
|
||||
try
|
||||
|
||||
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
|
||||
{
|
||||
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
|
||||
}
|
||||
catch( const std::system_error& e )
|
||||
{
|
||||
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
|
||||
try
|
||||
{
|
||||
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
|
||||
}
|
||||
catch( const std::system_error& e )
|
||||
{
|
||||
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
|
||||
}
|
||||
}
|
||||
|
||||
// Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
|
||||
// in order to receive mouse events. Otherwise, the user has to click somewhere on
|
||||
// the canvas before it will respond to mouse wheel events.
|
||||
m_canvas->SetFocus();
|
||||
|
||||
m_cbViewports->Connect( wxEVT_COMMAND_CHOICE_SELECTED,
|
||||
wxCommandEventHandler( EDA_3D_VIEWER_FRAME::onViewportChanged ),
|
||||
nullptr, this );
|
||||
m_cbViewports->Connect( wxEVT_UPDATE_UI,
|
||||
wxUpdateUIEventHandler( EDA_3D_VIEWER_FRAME::onUpdateViewportsCb ),
|
||||
nullptr, this );
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +196,14 @@ EDA_3D_VIEWER_FRAME::~EDA_3D_VIEWER_FRAME()
|
||||
{
|
||||
delete m_spaceMouse;
|
||||
|
||||
Prj().GetProjectFile().m_Viewports3D = m_appearancePanel->GetUserViewports();
|
||||
Prj().GetProjectFile().m_Viewports3D = GetUserViewports();
|
||||
|
||||
m_cbViewports->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED,
|
||||
wxCommandEventHandler( EDA_3D_VIEWER_FRAME::onViewportChanged ),
|
||||
nullptr, this );
|
||||
m_cbViewports->Disconnect( wxEVT_UPDATE_UI,
|
||||
wxUpdateUIEventHandler( EDA_3D_VIEWER_FRAME::onUpdateViewportsCb ),
|
||||
nullptr, this );
|
||||
|
||||
m_canvas->SetEventDispatcher( nullptr );
|
||||
|
||||
@@ -247,15 +246,10 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
|
||||
{
|
||||
return m_boardAdapter.m_Cfg->m_Render.show_footprints_not_in_posfile;
|
||||
};
|
||||
auto show_DNP =
|
||||
[this]( const SELECTION& aSel )
|
||||
{
|
||||
return m_boardAdapter.m_Cfg->m_Render.show_footprints_dnp;
|
||||
};
|
||||
auto showBBoxes =
|
||||
[this]( const SELECTION& aSel )
|
||||
{
|
||||
return m_boardAdapter.m_Cfg->m_Render.show_model_bbox;
|
||||
return m_boardAdapter.m_Cfg->m_Render.opengl_show_model_bbox;
|
||||
};
|
||||
auto showAxes =
|
||||
[this]( const SELECTION& aSel )
|
||||
@@ -268,31 +262,23 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
|
||||
return m_currentCamera.GetProjection() == PROJECTION_TYPE::ORTHO;
|
||||
};
|
||||
|
||||
auto appearances =
|
||||
[this]( const SELECTION& aSel )
|
||||
{
|
||||
return m_boardAdapter.m_Cfg->m_AuiPanels.show_layer_manager;
|
||||
};
|
||||
RegisterUIUpdateHandler( ID_RENDER_CURRENT_VIEW, ACTION_CONDITIONS().Check( raytracing ) );
|
||||
|
||||
RegisterUIUpdateHandler( ID_RENDER_CURRENT_VIEW, ACTION_CONDITIONS().Check( raytracing ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showTHT, ACTION_CONDITIONS().Check( showTH ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showSMD, ACTION_CONDITIONS().Check( showSMD ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showVirtual, ACTION_CONDITIONS().Check( showVirtual ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showNotInPosFile, ACTION_CONDITIONS().Check( show_NotInPosfile ) );
|
||||
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showTHT, ACTION_CONDITIONS().Check( showTH ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showSMD, ACTION_CONDITIONS().Check( showSMD ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showVirtual, ACTION_CONDITIONS().Check( showVirtual ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showNotInPosFile, ACTION_CONDITIONS().Check( show_NotInPosfile ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showDNP, ACTION_CONDITIONS().Check( show_DNP ) );
|
||||
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showBBoxes, ACTION_CONDITIONS().Check( showBBoxes ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showAxis, ACTION_CONDITIONS().Check( showAxes ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showBBoxes, ACTION_CONDITIONS().Check( showBBoxes ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showAxis, ACTION_CONDITIONS().Check( showAxes ) );
|
||||
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::noGrid, GridSizeCheck( GRID3D_TYPE::NONE ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::show10mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_10MM ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::show5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_5MM ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::show2_5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_2P5MM ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::show1mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_1MM ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::toggleOrtho, ACTION_CONDITIONS().Check( ortho ) );
|
||||
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showLayersManager, ACTION_CONDITIONS().Check( appearances ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::noGrid, GridSizeCheck( GRID3D_TYPE::NONE ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::show10mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_10MM ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::show5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_5MM ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::show2_5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_2P5MM ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::show1mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_1MM ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::toggleOrtho, ACTION_CONDITIONS().Check( ortho ) );
|
||||
|
||||
#undef GridSizeCheck
|
||||
}
|
||||
@@ -300,7 +286,6 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
|
||||
|
||||
bool EDA_3D_VIEWER_FRAME::TryBefore( wxEvent& aEvent )
|
||||
{
|
||||
static bool s_presetSwitcherShown = false;
|
||||
static bool s_viewportSwitcherShown = false;
|
||||
|
||||
// wxWidgets generates no key events for the tab key when the ctrl key is held down. One
|
||||
@@ -314,49 +299,13 @@ bool EDA_3D_VIEWER_FRAME::TryBefore( wxEvent& aEvent )
|
||||
&& static_cast<wxKeyEvent&>( aEvent ).GetKeyCode() == WXK_TAB )
|
||||
#endif
|
||||
{
|
||||
if( !s_presetSwitcherShown && wxGetKeyState( PRESET_SWITCH_KEY ) )
|
||||
{
|
||||
if( m_appearancePanel && this->IsActive() )
|
||||
{
|
||||
wxArrayString mru = m_appearancePanel->GetLayerPresetsMRU();
|
||||
|
||||
if( mru.size() > 0 )
|
||||
{
|
||||
for( wxString& str : mru )
|
||||
{
|
||||
if( str == FOLLOW_PCB )
|
||||
str = _( "Follow PCB Editor" );
|
||||
else if( str == FOLLOW_PLOT_SETTINGS )
|
||||
str = _( "Follow PCB Plot Settings" );
|
||||
}
|
||||
|
||||
EDA_VIEW_SWITCHER switcher( this, mru, PRESET_SWITCH_KEY );
|
||||
|
||||
s_presetSwitcherShown = true;
|
||||
switcher.ShowModal();
|
||||
s_presetSwitcherShown = false;
|
||||
|
||||
int idx = switcher.GetSelection();
|
||||
|
||||
if( idx >= 0 && idx < (int) mru.size() )
|
||||
{
|
||||
wxString internalName = m_appearancePanel->GetLayerPresetsMRU()[idx];
|
||||
m_appearancePanel->ApplyLayerPreset( internalName );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( !s_viewportSwitcherShown && wxGetKeyState( VIEWPORT_SWITCH_KEY ) )
|
||||
if( !s_viewportSwitcherShown && wxGetKeyState( VIEWPORT_SWITCH_KEY ) )
|
||||
{
|
||||
if( this->IsActive() )
|
||||
{
|
||||
const wxArrayString& viewportMRU = m_appearancePanel->GetViewportsMRU();
|
||||
|
||||
if( viewportMRU.size() > 0 )
|
||||
if( m_viewportMRU.size() > 0 )
|
||||
{
|
||||
EDA_VIEW_SWITCHER switcher( this, viewportMRU, VIEWPORT_SWITCH_KEY );
|
||||
EDA_VIEW_SWITCHER switcher( this, m_viewportMRU, VIEWPORT_SWITCH_KEY );
|
||||
|
||||
s_viewportSwitcherShown = true;
|
||||
switcher.ShowModal();
|
||||
@@ -364,8 +313,8 @@ bool EDA_3D_VIEWER_FRAME::TryBefore( wxEvent& aEvent )
|
||||
|
||||
int idx = switcher.GetSelection();
|
||||
|
||||
if( idx >= 0 && idx < (int) viewportMRU.size() )
|
||||
m_appearancePanel->ApplyViewport( viewportMRU[idx] );
|
||||
if( idx >= 0 && idx < (int) m_viewportMRU.size() )
|
||||
applyViewport( m_viewportMRU[idx] );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -381,31 +330,29 @@ void EDA_3D_VIEWER_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
|
||||
{
|
||||
KIWAY_PLAYER::handleIconizeEvent( aEvent );
|
||||
|
||||
if( m_spaceMouse && aEvent.IsIconized() )
|
||||
if( m_spaceMouse != nullptr && aEvent.IsIconized()
|
||||
&& ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
|
||||
{
|
||||
m_spaceMouse->SetFocus( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::ReloadRequest()
|
||||
{
|
||||
// This will schedule a request to load later
|
||||
// ReloadRequest also updates the board pointer so always call it first
|
||||
if( m_canvas )
|
||||
m_canvas->ReloadRequest( GetBoard(), PROJECT_PCB::Get3DCacheManager( &Prj() ) );
|
||||
|
||||
if( m_appearancePanel )
|
||||
m_appearancePanel->UpdateLayerCtls();
|
||||
m_canvas->ReloadRequest( GetBoard(), Prj().Get3DCacheManager() );
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::NewDisplay( bool aForceImmediateRedraw )
|
||||
{
|
||||
if( m_canvas )
|
||||
m_canvas->ReloadRequest( GetBoard(), PROJECT_PCB::Get3DCacheManager( &Prj() ) );
|
||||
ReloadRequest();
|
||||
|
||||
// After the ReloadRequest call, the refresh often takes a bit of time,
|
||||
// and it is made here only on request.
|
||||
if( m_canvas && aForceImmediateRedraw )
|
||||
if( aForceImmediateRedraw )
|
||||
m_canvas->Refresh();
|
||||
}
|
||||
|
||||
@@ -439,11 +386,6 @@ void EDA_3D_VIEWER_FRAME::OnCloseWindow( wxCloseEvent &event )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::OnCloseWindow" ) );
|
||||
|
||||
// Do not show the layer manager during closing to avoid flicker on some platforms (Windows)
|
||||
// that generate useless redraw of items in the Layer Manager
|
||||
if( m_auimgr.GetPane( wxS( "LayersManager" ) ).IsShown() )
|
||||
m_auimgr.GetPane( wxS( "LayersManager" ) ).Show( false );
|
||||
|
||||
if( m_canvas )
|
||||
m_canvas->Close();
|
||||
|
||||
@@ -497,6 +439,174 @@ void EDA_3D_VIEWER_FRAME::Process_Special_Functions( wxCommandEvent &event )
|
||||
}
|
||||
|
||||
|
||||
std::vector<VIEWPORT3D> EDA_3D_VIEWER_FRAME::GetUserViewports() const
|
||||
{
|
||||
std::vector<VIEWPORT3D> ret;
|
||||
|
||||
for( const std::pair<const wxString, VIEWPORT3D>& pair : m_viewports )
|
||||
ret.emplace_back( pair.second );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::SetUserViewports( std::vector<VIEWPORT3D>& aViewportList )
|
||||
{
|
||||
m_viewports.clear();
|
||||
|
||||
for( const VIEWPORT3D& viewport : aViewportList )
|
||||
{
|
||||
if( m_viewports.count( viewport.name ) )
|
||||
continue;
|
||||
|
||||
m_viewports[viewport.name] = viewport;
|
||||
|
||||
m_viewportMRU.Add( viewport.name );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::applyViewport( const wxString& aViewportName )
|
||||
{
|
||||
int idx = m_cbViewports->FindString( aViewportName );
|
||||
|
||||
if( idx >= 0 && idx < m_cbViewports->GetCount() - 3 /* separator */ )
|
||||
{
|
||||
m_cbViewports->SetSelection( idx );
|
||||
m_lastSelectedViewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( idx ) );
|
||||
|
||||
m_currentCamera.SetViewMatrix( m_lastSelectedViewport->matrix );
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||
m_canvas->Request_refresh();
|
||||
else
|
||||
m_canvas->RenderRaytracingRequest();
|
||||
|
||||
if( !m_lastSelectedViewport->name.IsEmpty() )
|
||||
{
|
||||
m_viewportMRU.Remove( m_lastSelectedViewport->name );
|
||||
m_viewportMRU.Insert( m_lastSelectedViewport->name, 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cbViewports->SetSelection( -1 ); // separator
|
||||
m_lastSelectedViewport = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::onViewportChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
int count = m_cbViewports->GetCount();
|
||||
int index = m_cbViewports->GetSelection();
|
||||
|
||||
if( index >= 0 && index < count - 3 /* separator */ )
|
||||
{
|
||||
VIEWPORT3D* viewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( index ) );
|
||||
|
||||
wxCHECK( viewport, /* void */ );
|
||||
|
||||
applyViewport( viewport->name );
|
||||
}
|
||||
else if( index == count - 2 )
|
||||
{
|
||||
// Save current state to new preset
|
||||
wxString name;
|
||||
|
||||
wxTextEntryDialog dlg( this, _( "Viewport name:" ), _( "Save Viewport" ), name );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
{
|
||||
if( m_lastSelectedViewport )
|
||||
m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
|
||||
else
|
||||
m_cbViewports->SetSelection( -1 );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
name = dlg.GetValue();
|
||||
bool exists = m_viewports.count( name );
|
||||
|
||||
if( !exists )
|
||||
{
|
||||
m_viewports[name] = VIEWPORT3D( name, m_currentCamera.GetViewMatrix() );
|
||||
|
||||
index = m_cbViewports->Insert( name, index-1, static_cast<void*>( &m_viewports[name] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
index = m_cbViewports->FindString( name );
|
||||
m_viewports[name].matrix = m_currentCamera.GetViewMatrix();
|
||||
m_viewportMRU.Remove( name );
|
||||
}
|
||||
|
||||
m_cbViewports->SetSelection( index );
|
||||
m_viewportMRU.Insert( name, 0 );
|
||||
|
||||
return;
|
||||
}
|
||||
else if( index == count - 1 )
|
||||
{
|
||||
// Delete an existing viewport
|
||||
wxArrayString headers;
|
||||
std::vector<wxArrayString> items;
|
||||
|
||||
headers.Add( _( "Viewports" ) );
|
||||
|
||||
for( std::pair<const wxString, VIEWPORT3D>& pair : m_viewports )
|
||||
{
|
||||
wxArrayString item;
|
||||
item.Add( pair.first );
|
||||
items.emplace_back( item );
|
||||
}
|
||||
|
||||
EDA_LIST_DIALOG dlg( this, _( "Delete Viewport" ), headers, items );
|
||||
dlg.SetListLabel( _( "Select viewport:" ) );
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
{
|
||||
wxString viewportName = dlg.GetTextSelection();
|
||||
int idx = m_cbViewports->FindString( viewportName );
|
||||
|
||||
if( idx != wxNOT_FOUND )
|
||||
{
|
||||
m_viewports.erase( viewportName );
|
||||
m_cbViewports->Delete( idx );
|
||||
m_viewportMRU.Remove( viewportName );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_lastSelectedViewport )
|
||||
m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
|
||||
else
|
||||
m_cbViewports->SetSelection( -1 );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
passOnFocus();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::onUpdateViewportsCb( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
int count = m_cbViewports->GetCount();
|
||||
int index = m_cbViewports->GetSelection();
|
||||
|
||||
if( index >= 0 && index < count - 3 )
|
||||
{
|
||||
VIEWPORT3D* viewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( index ) );
|
||||
|
||||
wxCHECK( viewport, /* void */ );
|
||||
|
||||
if( m_currentCamera.GetViewMatrix() != viewport->matrix )
|
||||
m_cbViewports->SetSelection( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::onRenderEngineSelection( wxCommandEvent &event )
|
||||
{
|
||||
RENDER_ENGINE& engine = m_boardAdapter.m_Cfg->m_Render.engine;
|
||||
@@ -540,7 +650,7 @@ void EDA_3D_VIEWER_FRAME::OnActivate( wxActivateEvent &aEvent )
|
||||
m_canvas->SetFocus();
|
||||
}
|
||||
|
||||
if( m_spaceMouse )
|
||||
if( m_spaceMouse != nullptr && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
|
||||
m_spaceMouse->SetFocus( aEvent.GetActive() );
|
||||
|
||||
aEvent.Skip(); // required under wxMAC
|
||||
@@ -557,6 +667,13 @@ void EDA_3D_VIEWER_FRAME::OnSetFocus( wxFocusEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::passOnFocus()
|
||||
{
|
||||
if( m_canvas )
|
||||
m_canvas->SetFocus();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
@@ -568,35 +685,16 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
applySettings( cfg );
|
||||
|
||||
m_boardAdapter.SetBoard( GetBoard() );
|
||||
m_boardAdapter.m_Cfg = cfg;
|
||||
|
||||
// When opening the 3D viewer, we use the OpenGL mode, never the ray tracing engine
|
||||
// because the ray tracing is very time consuming, and can be seen as not working
|
||||
// (freeze window) with large boards.
|
||||
m_boardAdapter.m_Cfg->m_Render.engine = RENDER_ENGINE::OPENGL;
|
||||
|
||||
if( cfg->m_CurrentPreset == LEGACY_PRESET_FLAG )
|
||||
{
|
||||
wxString legacyColorsPresetName = _( "legacy colors" );
|
||||
|
||||
cfg->m_UseStackupColors = false;
|
||||
|
||||
if( !cfg->FindPreset( legacyColorsPresetName ) )
|
||||
{
|
||||
cfg->m_LayerPresets.emplace_back( legacyColorsPresetName,
|
||||
GetAdapter().GetDefaultVisibleLayers(),
|
||||
GetAdapter().GetDefaultColors() );
|
||||
}
|
||||
|
||||
cfg->m_CurrentPreset = wxEmptyString;
|
||||
}
|
||||
|
||||
m_boardAdapter.InitSettings( nullptr, nullptr );
|
||||
|
||||
if( m_appearancePanel )
|
||||
m_appearancePanel->CommonSettingsChanged();
|
||||
m_canvas->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
|
||||
m_canvas->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
|
||||
m_canvas->SetProjectionMode( cfg->m_Camera.projection_mode );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,8 +714,6 @@ void EDA_3D_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE *aCfg )
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
|
||||
|
||||
cfg->m_Camera.animation_enabled = m_canvas->GetAnimationEnabled();
|
||||
cfg->m_Camera.moving_speed_multiplier = m_canvas->GetMovingSpeedMultiplier();
|
||||
cfg->m_Camera.projection_mode = m_canvas->GetProjectionMode();
|
||||
@@ -639,64 +735,12 @@ void EDA_3D_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTex
|
||||
ReCreateMainToolbar();
|
||||
|
||||
loadCommonSettings();
|
||||
applySettings( Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>() );
|
||||
|
||||
m_appearancePanel->CommonSettingsChanged();
|
||||
LoadSettings( Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>() );
|
||||
|
||||
NewDisplay( true );
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::ShowChangedLanguage()
|
||||
{
|
||||
EDA_BASE_FRAME::ShowChangedLanguage();
|
||||
|
||||
SetTitle( _( "3D Viewer" ) );
|
||||
ReCreateMainToolbar();
|
||||
|
||||
if( m_appearancePanel )
|
||||
{
|
||||
wxAuiPaneInfo& lm_pane_info = m_auimgr.GetPane( m_appearancePanel );
|
||||
lm_pane_info.Caption( _( "Appearance" ) );
|
||||
|
||||
m_appearancePanel->OnLanguageChanged();
|
||||
}
|
||||
|
||||
SetStatusText( wxEmptyString, ACTIVITY );
|
||||
SetStatusText( wxEmptyString, HOVERED_ITEM );
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::ToggleAppearanceManager()
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
|
||||
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
|
||||
|
||||
// show auxiliary Vertical layers and visibility manager toolbar
|
||||
cfg->m_AuiPanels.show_layer_manager = !cfg->m_AuiPanels.show_layer_manager;
|
||||
|
||||
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
|
||||
|
||||
if( cfg->m_AuiPanels.show_layer_manager )
|
||||
{
|
||||
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
|
||||
m_auimgr.Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::OnDarkModeToggle()
|
||||
{
|
||||
if( m_appearancePanel )
|
||||
m_appearancePanel->OnDarkModeToggle();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
|
||||
{
|
||||
wxString fullFileName;
|
||||
@@ -708,8 +752,8 @@ void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
|
||||
if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
||||
{
|
||||
// Remember path between saves during this session only.
|
||||
const wxString wildcard = fmt_is_jpeg ? FILEEXT::JpegFileWildcard() : FILEEXT::PngFileWildcard();
|
||||
const wxString ext = fmt_is_jpeg ? FILEEXT::JpegFileExtension : FILEEXT::PngFileExtension;
|
||||
const wxString wildcard = fmt_is_jpeg ? JpegFileWildcard() : PngFileWildcard();
|
||||
const wxString ext = fmt_is_jpeg ? JpegFileExtension : PngFileExtension;
|
||||
|
||||
// First time path is set to the project path.
|
||||
if( !m_defaultSaveScreenshotFileName.IsOk() )
|
||||
@@ -750,13 +794,8 @@ void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
// Be sure we have the latest 3D view (remember 3D view is buffered)
|
||||
// Also ensure any highlighted item is not highlighted when creating screen shot
|
||||
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
|
||||
bool allow_highlight = cfg.highlight_on_rollover;
|
||||
cfg.highlight_on_rollover = false;
|
||||
|
||||
m_canvas->DoRePaint(); // init first buffer
|
||||
m_canvas->DoRePaint(); // init second buffer
|
||||
m_canvas->Request_refresh( true );
|
||||
wxYield();
|
||||
|
||||
// Build image from the 3D buffer
|
||||
wxWindowUpdateLocker noUpdates( this );
|
||||
@@ -766,8 +805,6 @@ void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
|
||||
if( m_canvas )
|
||||
m_canvas->GetScreenshot( screenshotImage );
|
||||
|
||||
cfg.highlight_on_rollover = allow_highlight;
|
||||
|
||||
if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
||||
{
|
||||
wxBitmap bitmap( screenshotImage );
|
||||
@@ -812,21 +849,9 @@ void EDA_3D_VIEWER_FRAME::loadCommonSettings()
|
||||
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
||||
const DPI_SCALING 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;
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::applySettings( EDA_3D_VIEWER_SETTINGS* cfg )
|
||||
{
|
||||
m_boardAdapter.m_Cfg = cfg;
|
||||
|
||||
m_canvas->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
|
||||
m_canvas->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
|
||||
m_canvas->SetProjectionMode( cfg->m_Camera.projection_mode );
|
||||
|
||||
m_canvas->SetVcSettings( EDA_DRAW_PANEL_GAL::GetVcSettings() );
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-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
|
||||
@@ -26,7 +25,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file eda_3d_viewer_frame.h
|
||||
* @file eda_3d_viewer.h
|
||||
* @brief Declaration of the eda_3d_viewer class
|
||||
*/
|
||||
|
||||
@@ -41,12 +40,15 @@
|
||||
#include <dialogs/dialog_color_picker.h> // for CUSTOM_COLORS_LIST definition
|
||||
|
||||
|
||||
/// A variable name whose value holds the path of 3D shape files.
|
||||
/// Currently an environment variable, eventually a project variable.
|
||||
#define KICAD7_3DMODEL_DIR wxT( "KICAD7_3DMODEL_DIR" )
|
||||
|
||||
|
||||
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE (wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS)
|
||||
|
||||
// Forward declarations
|
||||
class NL_3D_VIEWER_PLUGIN;
|
||||
class APPEARANCE_CONTROLS_3D;
|
||||
|
||||
|
||||
enum EDA_3D_VIEWER_STATUSBAR
|
||||
{
|
||||
@@ -54,7 +56,6 @@ enum EDA_3D_VIEWER_STATUSBAR
|
||||
HOVERED_ITEM,
|
||||
X_POS,
|
||||
Y_POS,
|
||||
ZOOM_LEVEL,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -105,6 +106,9 @@ public:
|
||||
|
||||
EDA_3D_CANVAS* GetCanvas() { return m_canvas; }
|
||||
|
||||
std::vector<VIEWPORT3D> GetUserViewports() const;
|
||||
void SetUserViewports( std::vector<VIEWPORT3D>& aViewportList );
|
||||
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
@@ -115,19 +119,18 @@ public:
|
||||
* from the PCB frame because the 3D viewer isn't updated via the #KIWAY.
|
||||
*/
|
||||
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
|
||||
void ShowChangedLanguage() override;
|
||||
|
||||
APPEARANCE_CONTROLS_3D* GetAppearanceManager() { return m_appearancePanel; }
|
||||
|
||||
void ToggleAppearanceManager();
|
||||
|
||||
void OnDarkModeToggle();
|
||||
|
||||
protected:
|
||||
void setupUIConditions() override;
|
||||
|
||||
void handleIconizeEvent( wxIconizeEvent& aEvent ) override;
|
||||
|
||||
/**
|
||||
* switch to a given predefined 3D viewport
|
||||
* @param aViewportName is the name of the viewport to switch on
|
||||
*/
|
||||
void applyViewport( const wxString& aViewportName );
|
||||
|
||||
private:
|
||||
/// Called when user press the File->Exit
|
||||
void Exit3DFrame( wxCommandEvent& event );
|
||||
@@ -140,11 +143,14 @@ private:
|
||||
|
||||
void onRenderEngineSelection( wxCommandEvent& event );
|
||||
void onDisableRayTracing( wxCommandEvent& aEvent );
|
||||
void onViewportChanged( wxCommandEvent& aEvent );
|
||||
void onUpdateViewportsCb( wxUpdateUIEvent& aEvent );
|
||||
|
||||
void OnActivate( wxActivateEvent& event );
|
||||
void OnSetFocus( wxFocusEvent& event );
|
||||
void passOnFocus();
|
||||
|
||||
void doReCreateMenuBar() override;
|
||||
void CreateMenuBar();
|
||||
void ReCreateMainToolbar();
|
||||
|
||||
/**
|
||||
@@ -167,12 +173,12 @@ private:
|
||||
*/
|
||||
void loadCommonSettings();
|
||||
|
||||
void applySettings( EDA_3D_VIEWER_SETTINGS* aSettings );
|
||||
|
||||
private:
|
||||
wxFileName m_defaultSaveScreenshotFileName;
|
||||
|
||||
ACTION_TOOLBAR* m_mainToolBar;
|
||||
wxStaticText* m_viewportsLabel;
|
||||
wxChoice* m_cbViewports;
|
||||
EDA_3D_CANVAS* m_canvas;
|
||||
BOARD_ADAPTER m_boardAdapter;
|
||||
CAMERA& m_currentCamera;
|
||||
@@ -182,6 +188,10 @@ private:
|
||||
|
||||
NL_3D_VIEWER_PLUGIN* m_spaceMouse;
|
||||
|
||||
std::map<wxString, VIEWPORT3D> m_viewports;
|
||||
VIEWPORT3D* m_lastSelectedViewport;
|
||||
wxArrayString m_viewportMRU;
|
||||
|
||||
/**
|
||||
* 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,8 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-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
|
||||
@@ -23,172 +22,21 @@
|
||||
#include <common_ogl/ogl_attr_list.h>
|
||||
#include <settings/parameters.h>
|
||||
#include <settings/json_settings_internals.h>
|
||||
#include <3d_canvas/board_adapter.h>
|
||||
#include <wx/config.h>
|
||||
|
||||
#include "eda_3d_viewer_settings.h"
|
||||
|
||||
using KIGFX::COLOR4D;
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
|
||||
LAYER_PRESET_3D::LAYER_PRESET_3D( const wxString& aName ) :
|
||||
name( aName )
|
||||
{
|
||||
layers.set( LAYER_3D_BOARD );
|
||||
layers.set( LAYER_3D_COPPER_TOP );
|
||||
layers.set( LAYER_3D_COPPER_BOTTOM );
|
||||
layers.set( LAYER_3D_SILKSCREEN_TOP );
|
||||
layers.set( LAYER_3D_SILKSCREEN_BOTTOM );
|
||||
layers.set( LAYER_3D_SOLDERMASK_TOP );
|
||||
layers.set( LAYER_3D_SOLDERMASK_BOTTOM );
|
||||
layers.set( LAYER_3D_SOLDERPASTE );
|
||||
layers.set( LAYER_3D_ADHESIVE );
|
||||
|
||||
layers.set( LAYER_3D_TH_MODELS );
|
||||
layers.set( LAYER_3D_SMD_MODELS );
|
||||
|
||||
layers.set( LAYER_FP_REFERENCES );
|
||||
layers.set( LAYER_FP_TEXT );
|
||||
|
||||
layers.set( LAYER_GRID_AXES );
|
||||
|
||||
// Preload colors vector so we don't have to worry about exceptions using colors.at()
|
||||
colors[ LAYER_3D_BACKGROUND_TOP ] = BOARD_ADAPTER::g_DefaultBackgroundTop;
|
||||
colors[ LAYER_3D_BACKGROUND_BOTTOM ] = BOARD_ADAPTER::g_DefaultBackgroundBot;
|
||||
colors[ LAYER_3D_BOARD ] = BOARD_ADAPTER::g_DefaultBoardBody;
|
||||
colors[ LAYER_3D_COPPER_TOP ] = BOARD_ADAPTER::g_DefaultSurfaceFinish;
|
||||
colors[ LAYER_3D_COPPER_BOTTOM ] = BOARD_ADAPTER::g_DefaultSurfaceFinish;
|
||||
colors[ LAYER_3D_SILKSCREEN_TOP ] = BOARD_ADAPTER::g_DefaultSilkscreen;
|
||||
colors[ LAYER_3D_SILKSCREEN_BOTTOM ] = BOARD_ADAPTER::g_DefaultSilkscreen;
|
||||
colors[ LAYER_3D_SOLDERMASK_TOP ] = BOARD_ADAPTER::g_DefaultSolderMask;
|
||||
colors[ LAYER_3D_SOLDERMASK_BOTTOM ] = BOARD_ADAPTER::g_DefaultSolderMask;
|
||||
colors[ LAYER_3D_SOLDERPASTE ] = BOARD_ADAPTER::g_DefaultSolderPaste;
|
||||
colors[ LAYER_3D_USER_DRAWINGS ] = BOARD_ADAPTER::g_DefaultComments;
|
||||
colors[ LAYER_3D_USER_COMMENTS ] = BOARD_ADAPTER::g_DefaultComments;
|
||||
colors[ LAYER_3D_USER_ECO1 ] = BOARD_ADAPTER::g_DefaultECOs;
|
||||
colors[ LAYER_3D_USER_ECO2 ] = BOARD_ADAPTER::g_DefaultECOs;
|
||||
}
|
||||
|
||||
|
||||
PARAM_LAYER_PRESET_3D::PARAM_LAYER_PRESET_3D( const std::string& aPath,
|
||||
std::vector<LAYER_PRESET_3D>* aPresetList ) :
|
||||
PARAM_LAMBDA<nlohmann::json>( aPath,
|
||||
std::bind( &PARAM_LAYER_PRESET_3D::presetsToJson, this ),
|
||||
std::bind( &PARAM_LAYER_PRESET_3D::jsonToPresets, this, _1 ),
|
||||
{} ),
|
||||
m_presets( aPresetList )
|
||||
{
|
||||
wxASSERT( aPresetList );
|
||||
}
|
||||
|
||||
|
||||
nlohmann::json PARAM_LAYER_PRESET_3D::presetsToJson()
|
||||
{
|
||||
nlohmann::json ret = nlohmann::json::array();
|
||||
|
||||
for( const LAYER_PRESET_3D& preset : *m_presets )
|
||||
{
|
||||
nlohmann::json js = {
|
||||
{ "name", preset.name }
|
||||
};
|
||||
|
||||
nlohmann::json layers = nlohmann::json::array();
|
||||
|
||||
for( int layer = 0; layer < LAYER_3D_END; ++layer )
|
||||
{
|
||||
if( preset.layers.test( layer ) )
|
||||
layers.push_back( layer );
|
||||
}
|
||||
|
||||
js["layers"] = layers;
|
||||
|
||||
nlohmann::json colors = nlohmann::json::array();
|
||||
|
||||
for( const auto& [ layer, color ] : preset.colors )
|
||||
{
|
||||
nlohmann::json layerColor = {
|
||||
{ "layer", layer },
|
||||
{ "color", color.ToCSSString() }
|
||||
};
|
||||
|
||||
colors.push_back( layerColor );
|
||||
}
|
||||
|
||||
js["colors"] = colors;
|
||||
|
||||
ret.push_back( js );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void PARAM_LAYER_PRESET_3D::jsonToPresets( const nlohmann::json& aJson )
|
||||
{
|
||||
if( aJson.empty() || !aJson.is_array() )
|
||||
return;
|
||||
|
||||
m_presets->clear();
|
||||
|
||||
for( const nlohmann::json& preset : aJson )
|
||||
{
|
||||
if( preset.contains( "name" ) )
|
||||
{
|
||||
LAYER_PRESET_3D p( preset.at( "name" ).get<wxString>() );
|
||||
|
||||
if( preset.contains( "layers" ) && preset.at( "layers" ).is_array() )
|
||||
{
|
||||
p.layers.reset();
|
||||
|
||||
for( const nlohmann::json& layer : preset.at( "layers" ) )
|
||||
{
|
||||
if( layer.is_number_integer() )
|
||||
{
|
||||
int layerNum = layer.get<int>();
|
||||
|
||||
if( layerNum >= 0 && layerNum < LAYER_3D_END )
|
||||
p.layers.set( layerNum );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( preset.contains( "colors" ) && preset.at( "colors" ).is_array() )
|
||||
{
|
||||
for( const nlohmann::json& layerColor : preset.at( "colors" ) )
|
||||
{
|
||||
if( layerColor.contains( "layer" ) && layerColor.contains( "color" )
|
||||
&& layerColor.at( "layer" ).is_number_integer() )
|
||||
{
|
||||
int layerNum = layerColor.at( "layer" ).get<int>();
|
||||
COLOR4D color = layerColor.at( "color" ).get<COLOR4D>();
|
||||
p.colors[ layerNum ] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_presets->emplace_back( p );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///! Update the schema version whenever a migration is required
|
||||
const int viewer3dSchemaVersion = 3;
|
||||
const int viewer3dSchemaVersion = 2;
|
||||
|
||||
|
||||
EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
APP_SETTINGS_BASE( "3d_viewer", viewer3dSchemaVersion ),
|
||||
m_Render(),
|
||||
m_Camera()
|
||||
EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS()
|
||||
: APP_SETTINGS_BASE( "3d_viewer", viewer3dSchemaVersion ),
|
||||
m_Render(),
|
||||
m_Camera()
|
||||
{
|
||||
m_params.emplace_back( new PARAM<bool>( "aui.show_layer_manager",
|
||||
&m_AuiPanels.show_layer_manager, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "aui.right_panel_width",
|
||||
&m_AuiPanels.right_panel_width, -1 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_ENUM<RENDER_ENGINE>( "render.engine", &m_Render.engine,
|
||||
RENDER_ENGINE::OPENGL,
|
||||
RENDER_ENGINE::OPENGL,
|
||||
@@ -219,11 +67,9 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
m_params.emplace_back( new PARAM<bool>( "render.opengl_copper_thickness",
|
||||
&m_Render.opengl_copper_thickness, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.opengl_show_model_bbox",
|
||||
&m_Render.show_model_bbox, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.opengl_show_off_board_silk",
|
||||
&m_Render.show_off_board_silk, false ) );
|
||||
&m_Render.opengl_show_model_bbox, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.opengl_highlight_on_rollover",
|
||||
&m_Render.highlight_on_rollover, true ) );
|
||||
&m_Render.opengl_highlight_on_rollover, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.opengl_AA_disableOnMove",
|
||||
&m_Render.opengl_AA_disableOnMove, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.opengl_thickness_disableOnMove",
|
||||
@@ -316,6 +162,8 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
&m_Render.raytrace_lightAzimuth,
|
||||
default_azimuth ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "render.realistic",
|
||||
&m_Render.realistic, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_adhesive",
|
||||
&m_Render.show_adhesive, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_axis",
|
||||
@@ -324,12 +172,8 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
&m_Render.show_board_body, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_comments",
|
||||
&m_Render.show_comments, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_drawings",
|
||||
&m_Render.show_drawings, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_eco1",
|
||||
&m_Render.show_eco1, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_eco2",
|
||||
&m_Render.show_eco2, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_eco",
|
||||
&m_Render.show_eco, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_insert",
|
||||
&m_Render.show_footprints_insert, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_normal",
|
||||
@@ -338,36 +182,20 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
&m_Render.show_footprints_virtual, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_not_in_posfile",
|
||||
&m_Render.show_footprints_not_in_posfile, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_dnp",
|
||||
&m_Render.show_footprints_dnp, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_silkscreen_top",
|
||||
&m_Render.show_silkscreen_top, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_silkscreen_bottom",
|
||||
&m_Render.show_silkscreen_bottom, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_soldermask_top",
|
||||
&m_Render.show_soldermask_top, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_soldermask_bottom",
|
||||
&m_Render.show_soldermask_bottom, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_silkscreen",
|
||||
&m_Render.show_silkscreen, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_soldermask",
|
||||
&m_Render.show_soldermask, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_solderpaste",
|
||||
&m_Render.show_solderpaste, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_copper_top",
|
||||
&m_Render.show_copper_bottom, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_copper_bottom",
|
||||
&m_Render.show_copper_top, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_zones",
|
||||
&m_Render.show_zones, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_fp_references",
|
||||
&m_Render.show_fp_references, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_fp_values",
|
||||
&m_Render.show_fp_values, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_fp_text",
|
||||
&m_Render.show_fp_text, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.subtract_mask_from_silk",
|
||||
&m_Render.subtract_mask_from_silk, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.clip_silk_on_via_annulus",
|
||||
&m_Render.clip_silk_on_via_annuli, false ) );
|
||||
&m_Render.clip_silk_on_via_annulus, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.plated_and_bare_copper",
|
||||
&m_Render.differentiate_plated_copper, false ) );
|
||||
&m_Render.renderPlatedPadsAsPlated, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "camera.animation_enabled",
|
||||
&m_Camera.animation_enabled, true ) );
|
||||
m_params.emplace_back( new PARAM<int>( "camera.moving_speed_multiplier",
|
||||
@@ -377,13 +205,6 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
m_params.emplace_back( new PARAM<int>( "camera.projection_mode",
|
||||
&m_Camera.projection_mode, 1 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "use_stackup_colors",
|
||||
&m_UseStackupColors, true ) );
|
||||
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, LEGACY_PRESET_FLAG ) );
|
||||
|
||||
registerMigration( 0, 1, std::bind( &EDA_3D_VIEWER_SETTINGS::migrateSchema0to1, this ) );
|
||||
|
||||
registerMigration( 1, 2,
|
||||
@@ -392,51 +213,6 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
Set( "render.opengl_copper_thickness", false );
|
||||
return true;
|
||||
} );
|
||||
|
||||
registerMigration( 2, 3,
|
||||
[&]() -> bool
|
||||
{
|
||||
if( std::optional<bool> optval = Get<bool>( "render.show_copper" ) )
|
||||
{
|
||||
Set( "render.show_copper_top", *optval );
|
||||
Set( "render.show_copper_bottom", *optval );
|
||||
}
|
||||
|
||||
if( std::optional<bool> optval = Get<bool>( "render.show_silkscreen" ) )
|
||||
{
|
||||
Set( "render.show_silkscreen_top", *optval );
|
||||
Set( "render.show_silkscreen_bottom", *optval );
|
||||
}
|
||||
|
||||
if( std::optional<bool> optval = Get<bool>( "render.show_soldermask" ) )
|
||||
{
|
||||
Set( "render.show_soldermask_top", *optval );
|
||||
Set( "render.show_soldermask_bottom", *optval );
|
||||
}
|
||||
|
||||
if( std::optional<bool> optval = Get<bool>( "render.show_comments" ) )
|
||||
Set( "render.show_drawings", *optval );
|
||||
|
||||
if( std::optional<bool> optval = Get<bool>( "render.show_eco" ) )
|
||||
{
|
||||
Set( "render.show_eco1", *optval );
|
||||
Set( "render.show_eco2", *optval );
|
||||
}
|
||||
|
||||
return true;
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
LAYER_PRESET_3D* EDA_3D_VIEWER_SETTINGS::FindPreset( const wxString& aName )
|
||||
{
|
||||
for( LAYER_PRESET_3D& preset : m_LayerPresets )
|
||||
{
|
||||
if( preset.name == aName )
|
||||
return &preset;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-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
|
||||
@@ -27,55 +26,11 @@
|
||||
#include <plugins/3dapi/xv3d_types.h>
|
||||
#include <settings/app_settings.h>
|
||||
#include <settings/parameters.h>
|
||||
#include <project/board_project_settings.h>
|
||||
#include "render_settings.h"
|
||||
|
||||
#define FOLLOW_PCB wxT( "follow_pcb_editor" )
|
||||
#define FOLLOW_PLOT_SETTINGS wxT( "follow_plot_settings" )
|
||||
#define LEGACY_PRESET_FLAG wxT( "legacy_preset_flag" )
|
||||
|
||||
|
||||
struct LAYER_PRESET_3D
|
||||
{
|
||||
LAYER_PRESET_3D( const wxString& aName = wxEmptyString );
|
||||
|
||||
LAYER_PRESET_3D( const wxString& aName, const std::bitset<LAYER_3D_END>& aLayers,
|
||||
const std::map<int, KIGFX::COLOR4D>& aColors ) :
|
||||
name( aName ),
|
||||
layers( aLayers ),
|
||||
colors( aColors )
|
||||
{
|
||||
}
|
||||
|
||||
wxString name; ///< A name for this layer set
|
||||
std::bitset<LAYER_3D_END> layers;
|
||||
std::map<int, KIGFX::COLOR4D> colors;
|
||||
};
|
||||
|
||||
|
||||
class PARAM_LAYER_PRESET_3D : public PARAM_LAMBDA<nlohmann::json>
|
||||
{
|
||||
public:
|
||||
PARAM_LAYER_PRESET_3D( const std::string& aPath, std::vector<LAYER_PRESET_3D>* aPresetList );
|
||||
|
||||
private:
|
||||
nlohmann::json presetsToJson();
|
||||
|
||||
void jsonToPresets( const nlohmann::json& aJson );
|
||||
|
||||
std::vector<LAYER_PRESET_3D>* m_presets;
|
||||
};
|
||||
|
||||
|
||||
class EDA_3D_VIEWER_SETTINGS : public APP_SETTINGS_BASE
|
||||
{
|
||||
public:
|
||||
struct AUI_PANELS
|
||||
{
|
||||
int right_panel_width;
|
||||
bool show_layer_manager;
|
||||
};
|
||||
|
||||
struct RENDER_SETTINGS
|
||||
{
|
||||
RENDER_ENGINE engine;
|
||||
@@ -89,9 +44,8 @@ public:
|
||||
bool opengl_holes_disableOnMove;
|
||||
bool opengl_render_bbox_only_OnMove;
|
||||
bool opengl_copper_thickness;
|
||||
bool show_model_bbox;
|
||||
bool show_off_board_silk;
|
||||
bool highlight_on_rollover;
|
||||
bool opengl_show_model_bbox;
|
||||
bool opengl_highlight_on_rollover;
|
||||
KIGFX::COLOR4D opengl_selection_color;
|
||||
|
||||
bool raytrace_anti_aliasing;
|
||||
@@ -120,32 +74,23 @@ public:
|
||||
std::vector<int> raytrace_lightElevation; // -90 .. 90
|
||||
std::vector<int> raytrace_lightAzimuth; // 0 .. 359
|
||||
|
||||
bool realistic;
|
||||
bool show_adhesive;
|
||||
bool show_axis;
|
||||
bool show_board_body;
|
||||
bool show_comments;
|
||||
bool show_drawings;
|
||||
bool show_eco1;
|
||||
bool show_eco2;
|
||||
bool show_eco;
|
||||
bool show_footprints_insert;
|
||||
bool show_footprints_normal;
|
||||
bool show_footprints_virtual;
|
||||
bool show_footprints_not_in_posfile;
|
||||
bool show_footprints_dnp;
|
||||
bool show_silkscreen_top;
|
||||
bool show_silkscreen_bottom;
|
||||
bool show_soldermask_top;
|
||||
bool show_soldermask_bottom;
|
||||
bool show_silkscreen;
|
||||
bool show_soldermask;
|
||||
bool show_solderpaste;
|
||||
bool show_copper_top;
|
||||
bool show_copper_bottom;
|
||||
bool show_zones;
|
||||
bool show_fp_references;
|
||||
bool show_fp_values;
|
||||
bool show_fp_text;
|
||||
bool subtract_mask_from_silk;
|
||||
bool clip_silk_on_via_annuli;
|
||||
bool differentiate_plated_copper;
|
||||
bool clip_silk_on_via_annulus;
|
||||
bool renderPlatedPadsAsPlated;
|
||||
};
|
||||
|
||||
struct CAMERA_SETTINGS
|
||||
@@ -160,19 +105,11 @@ public:
|
||||
|
||||
virtual ~EDA_3D_VIEWER_SETTINGS() {}
|
||||
|
||||
LAYER_PRESET_3D* FindPreset( const wxString& aName );
|
||||
|
||||
virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
|
||||
|
||||
public:
|
||||
AUI_PANELS m_AuiPanels;
|
||||
RENDER_SETTINGS m_Render;
|
||||
CAMERA_SETTINGS m_Camera;
|
||||
|
||||
bool m_UseStackupColors;
|
||||
std::vector<LAYER_PRESET_3D> m_LayerPresets;
|
||||
wxString m_CurrentPreset;
|
||||
|
||||
protected:
|
||||
virtual std::string getLegacyFrameName() const override { return "Viewer3DFrameName"; }
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 2017-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-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 as published by the
|
||||
@@ -24,7 +23,6 @@
|
||||
#include <3d_viewer_id.h>
|
||||
#include <3d_enums.h>
|
||||
#include "eda_3d_actions.h"
|
||||
#include "tool/tool_action.h"
|
||||
|
||||
|
||||
// Actions, being statically-defined, require specialized I18N handling. We continue to
|
||||
@@ -34,308 +32,245 @@
|
||||
#undef _
|
||||
#define _(s) s
|
||||
|
||||
// No description, it is not supposed to be shown anywhere
|
||||
TOOL_ACTION EDA_3D_ACTIONS::controlActivate( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.Flags( AF_ACTIVATE ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::pivotCenter( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.pivotCenter" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( ' ' )
|
||||
.FriendlyName( _( "Set Pivot" ) )
|
||||
.Tooltip( _( "Place point around which the board will be rotated (middle mouse click)" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_PIVOT_CENTER ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::controlActivate( "3DViewer.Control", AS_GLOBAL,
|
||||
0, "", "", "",
|
||||
BITMAPS::INVALID_BITMAP, AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateXCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateXclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate X Clockwise" ) )
|
||||
.Icon( BITMAPS::rotate_cw_x )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::X_CW ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::pivotCenter( "3DViewer.Control.pivotCenter",
|
||||
AS_ACTIVE,
|
||||
' ', "",
|
||||
_( "Center pivot rotation" ), _( "Center pivot rotation (middle mouse click)" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) WXK_SPACE );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateXCCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateXcounterclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate X Counterclockwise" ) )
|
||||
.Icon( BITMAPS::rotate_ccw_x )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::X_CCW ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateXCW( "3DViewer.Control.rotateXclockwise",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Rotate X Clockwise" ), _( "Rotate X Clockwise" ),
|
||||
BITMAPS::rotate_cw_x, AF_NONE, (void*) ROTATION_DIR::X_CW );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateYCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateYclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate Y Clockwise" ) )
|
||||
.Icon( BITMAPS::rotate_cw_y )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::Y_CW ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateXCCW( "3DViewer.Control.rotateXcounterclockwise",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Rotate X Counterclockwise" ), _( "Rotate X Counterclockwise" ),
|
||||
BITMAPS::rotate_ccw_x, AF_NONE, (void*) ROTATION_DIR::X_CCW );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateYCCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateYcounterclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate Y Counterclockwise" ) )
|
||||
.Icon( BITMAPS::rotate_ccw_y )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::Y_CCW ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateYCW( "3DViewer.Control.rotateYclockwise",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Rotate Y Clockwise" ), _( "Rotate Y Clockwise" ),
|
||||
BITMAPS::rotate_cw_y, AF_NONE, (void*) ROTATION_DIR::Y_CW );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateZclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate Z Clockwise" ) )
|
||||
.Icon( BITMAPS::rotate_cw_z )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::Z_CW ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateYCCW( "3DViewer.Control.rotateYcounterclockwise",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Rotate Y Counterclockwise" ), _( "Rotate Y Counterclockwise" ),
|
||||
BITMAPS::rotate_ccw_y, AF_NONE, (void*) ROTATION_DIR::Y_CCW );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateZCCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateZcounterclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate Z Counterclockwise" ) )
|
||||
.Icon( BITMAPS::rotate_ccw_z )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::Z_CCW ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( "3DViewer.Control.rotateZclockwise",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Rotate Z Clockwise" ), _( "Rotate Z Clockwise" ),
|
||||
BITMAPS::rotate_cw_z, AF_NONE, (void*) ROTATION_DIR::Z_CW );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveLeft( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.moveLeft" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( WXK_LEFT )
|
||||
.FriendlyName( _( "Move Board Left" ) )
|
||||
.Icon( BITMAPS::left )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( CURSOR_LEFT ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateZCCW( "3DViewer.Control.rotateZcounterclockwise",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Rotate Z Counterclockwise" ), _( "Rotate Z Counterclockwise" ),
|
||||
BITMAPS::rotate_ccw_z, AF_NONE, (void*) ROTATION_DIR::Z_CCW );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveRight( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.moveRight" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( WXK_RIGHT )
|
||||
.FriendlyName( _( "Move Board Right" ) )
|
||||
.Icon( BITMAPS::right )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( CURSOR_RIGHT ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveLeft( "3DViewer.Control.moveLeft",
|
||||
AS_ACTIVE,
|
||||
WXK_LEFT, "",
|
||||
_( "Move board Left" ), _( "Move board Left" ),
|
||||
BITMAPS::left, AF_NONE, (void*) CURSOR_LEFT );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveUp( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.moveUp" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( WXK_UP )
|
||||
.FriendlyName( _( "Move Board Up" ) )
|
||||
.Icon( BITMAPS::up )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( CURSOR_UP ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveRight( "3DViewer.Control.moveRight",
|
||||
AS_ACTIVE,
|
||||
WXK_RIGHT, "",
|
||||
_( "Move board Right" ), _( "Move board Right" ),
|
||||
BITMAPS::right, AF_NONE, (void*) CURSOR_RIGHT );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveDown( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.moveDown" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( WXK_DOWN )
|
||||
.FriendlyName( _( "Move Board Down" ) )
|
||||
.Icon( BITMAPS::down )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( CURSOR_DOWN ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveUp( "3DViewer.Control.moveUp",
|
||||
AS_ACTIVE,
|
||||
WXK_UP, "",
|
||||
_( "Move board Up" ), _( "Move board Up" ),
|
||||
BITMAPS::up, AF_NONE, (void*) CURSOR_UP );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::homeView( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.homeView" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( WXK_HOME )
|
||||
.FriendlyName ( _( "Home View" ) )
|
||||
.Tooltip( _( "Redraw at the home position and zoom" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_FIT_SCREEN ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveDown( "3DViewer.Control.moveDown",
|
||||
AS_ACTIVE,
|
||||
WXK_DOWN, "",
|
||||
_( "Move board Down" ), _( "Move board Down" ),
|
||||
BITMAPS::down, AF_NONE, (void*) CURSOR_DOWN );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::flipView( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.flipView" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'F' )
|
||||
.FriendlyName( _( "Flip Board" ) )
|
||||
.Tooltip( _( "Flip the board view" ) )
|
||||
.Icon( BITMAPS::flip_board )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_FLIP ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::homeView( "3DViewer.Control.homeView",
|
||||
AS_ACTIVE,
|
||||
WXK_HOME, "",
|
||||
_( "Home view" ), _( "Home view" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) WXK_HOME );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleOrtho( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.toggleOrtho" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Toggle Orthographic Projection" ) )
|
||||
.Tooltip( _( "Enable/disable orthographic projection" ) )
|
||||
.Icon( BITMAPS::ortho ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::resetView( "3DViewer.Control.resetView",
|
||||
AS_ACTIVE,
|
||||
'R', "",
|
||||
_( "Reset view" ), _( "Reset view" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) ID_VIEW3D_RESET );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewFront( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.viewFront" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'Y' )
|
||||
.FriendlyName( _( "View Front" ) )
|
||||
.Icon( BITMAPS::axis3d_front )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_FRONT ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::flipView( "3DViewer.Control.flipView",
|
||||
AS_ACTIVE,
|
||||
'F', "",
|
||||
_( "Flip Board" ), _( "Flip the board view" ),
|
||||
BITMAPS::flip_board, AF_NONE, (void*) ID_VIEW3D_FLIP );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewBack( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.viewBack" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( MD_SHIFT + 'Y' )
|
||||
.FriendlyName( _( "View Back" ) )
|
||||
.Icon( BITMAPS::axis3d_back )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_BACK ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleOrtho( "3DViewer.Control.toggleOrtho",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Toggle orthographic projection" ), _( "Enable/disable orthographic projection" ),
|
||||
BITMAPS::ortho );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewLeft( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.viewLeft" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( MD_SHIFT + 'X' )
|
||||
.FriendlyName( _( "View Left" ) )
|
||||
.Icon( BITMAPS::axis3d_left )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_LEFT ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewFront( "3DViewer.Control.viewFront",
|
||||
AS_ACTIVE,
|
||||
'Y', "",
|
||||
_( "View Front" ), _( "View Front" ),
|
||||
BITMAPS::axis3d_front, AF_NONE, (void*) ID_VIEW3D_FRONT );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewRight( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.viewRight" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'X' )
|
||||
.FriendlyName( _( "View Right" ) )
|
||||
.Icon( BITMAPS::axis3d_right )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_RIGHT ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewBack( "3DViewer.Control.viewBack",
|
||||
AS_ACTIVE,
|
||||
MD_SHIFT + 'Y', "",
|
||||
_( "View Back" ), _( "View Back" ),
|
||||
BITMAPS::axis3d_back, AF_NONE, (void*) ID_VIEW3D_BACK );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewTop( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.viewTop" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'Z' )
|
||||
.FriendlyName( _( "View Top" ) )
|
||||
.Icon( BITMAPS::axis3d_top )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_TOP ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewLeft( "3DViewer.Control.viewLeft",
|
||||
AS_ACTIVE,
|
||||
MD_SHIFT + 'X', "",
|
||||
_( "View Left" ), _( "View Left" ),
|
||||
BITMAPS::axis3d_left, AF_NONE, (void*) ID_VIEW3D_LEFT );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewBottom( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.viewBottom" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( MD_SHIFT + 'Z' )
|
||||
.FriendlyName( _( "View Bottom" ) )
|
||||
.Icon( BITMAPS::axis3d_bottom )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_BOTTOM ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewRight( "3DViewer.Control.viewRight",
|
||||
AS_ACTIVE,
|
||||
'X', "",
|
||||
_( "View Right" ), _( "View Right" ),
|
||||
BITMAPS::axis3d_right, AF_NONE, (void*) ID_VIEW3D_RIGHT );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::noGrid( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.noGrid" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "No 3D Grid" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( GRID3D_TYPE::NONE ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewTop( "3DViewer.Control.viewTop",
|
||||
AS_ACTIVE,
|
||||
'Z', "",
|
||||
_( "View Top" ), _( "View Top" ),
|
||||
BITMAPS::axis3d_top, AF_NONE, (void*) ID_VIEW3D_TOP );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::show10mmGrid( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.show10mmGrid" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "3D Grid 10mm" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( GRID3D_TYPE::GRID_10MM ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewBottom( "3DViewer.Control.viewBottom",
|
||||
AS_ACTIVE,
|
||||
MD_SHIFT + 'Z', "",
|
||||
_( "View Bottom" ), _( "View Bottom" ),
|
||||
BITMAPS::axis3d_bottom, AF_NONE, (void*) ID_VIEW3D_BOTTOM );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::show5mmGrid( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.show5mmGrid" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "3D Grid 5mm" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( GRID3D_TYPE::GRID_5MM ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::noGrid( "3DViewer.Control.noGrid",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "No 3D Grid" ), _( "No 3D Grid" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) GRID3D_TYPE::NONE );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::show2_5mmGrid( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.show2_5mmGrid" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "3D Grid 2.5mm" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( GRID3D_TYPE::GRID_2P5MM ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::show10mmGrid( "3DViewer.Control.show10mmGrid",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "3D Grid 10mm" ), _( "3D Grid 10mm" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) GRID3D_TYPE::GRID_10MM );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::show1mmGrid( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.show1mmGrid" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "3D Grid 1mm" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( GRID3D_TYPE::GRID_1MM ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::show5mmGrid( "3DViewer.Control.show5mmGrid",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "3D Grid 5mm" ), _( "3D Grid 5mm" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) GRID3D_TYPE::GRID_5MM );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::materialNormal( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.materialNormal" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.FriendlyName( _( "Render Realistic Materials" ) )
|
||||
.Tooltip( _( "Use all material properties from each 3D model file" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( MATERIAL_MODE::NORMAL ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::show2_5mmGrid( "3DViewer.Control.show2_5mmGrid",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "3D Grid 2.5mm" ), _( "3D Grid 2.5mm" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) GRID3D_TYPE::GRID_2P5MM );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::materialDiffuse( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.materialDiffuse" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.FriendlyName( _( "Render Solid Colors" ) )
|
||||
.Tooltip( _( "Use only the diffuse color property from 3D model file" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( MATERIAL_MODE::DIFFUSE_ONLY ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::show1mmGrid( "3DViewer.Control.show1mmGrid",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "3D Grid 1mm" ), _( "3D Grid 1mm" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) GRID3D_TYPE::GRID_1MM );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::materialCAD( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.materialCAD" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.FriendlyName( _( "Render CAD Colors" ) )
|
||||
.Tooltip( _( "Use a CAD color style based on the diffuse color of the material" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( MATERIAL_MODE::CAD_MODE ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::materialNormal( "3DViewer.Control.materialNormal",
|
||||
AS_ACTIVE,
|
||||
0, "",
|
||||
_( "Render Realistic Materials" ),
|
||||
_( "Use all material properties from each 3D model file" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) MATERIAL_MODE::NORMAL );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showTHT( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.attributesTHT" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'T' )
|
||||
.FriendlyName( _( "Show Through Hole 3D Models" ) )
|
||||
.Tooltip( _( "Show 3D models for 'Through hole' type footprints" ) )
|
||||
.Icon( BITMAPS::show_tht )
|
||||
.Flags( AF_NONE ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::materialDiffuse( "3DViewer.Control.materialDiffuse",
|
||||
AS_ACTIVE,
|
||||
0, "",
|
||||
_( "Render Solid Colors" ),
|
||||
_( "Use only the diffuse color property from model 3D model file" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) MATERIAL_MODE::DIFFUSE_ONLY );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showSMD( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.attributesSMD" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'S' )
|
||||
.FriendlyName( _( "Show SMD 3D Models" ) )
|
||||
.Tooltip( _( "Show 3D models for 'Surface mount' type footprints" ) )
|
||||
.Icon( BITMAPS::show_smt )
|
||||
.Flags( AF_NONE ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::materialCAD( "3DViewer.Control.materialCAD",
|
||||
AS_ACTIVE,
|
||||
0, "",
|
||||
_( "Render CAD Colors" ),
|
||||
_( "Use a CAD color style based on the diffuse color of the material" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) MATERIAL_MODE::CAD_MODE );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showVirtual( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.attributesOther" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'V' )
|
||||
.FriendlyName( _( "Show Unspecified 3D Models" ) )
|
||||
.Tooltip( _( "Show 3D models for 'unspecified' type footprints" ) )
|
||||
.Icon( BITMAPS::show_other )
|
||||
.Flags( AF_NONE ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showTHT( "3DViewer.Control.attributesTHT",
|
||||
AS_ACTIVE,
|
||||
'T', "",
|
||||
_( "Toggle Through Hole 3D models" ),
|
||||
_( "Toggle 3D models for 'Through hole' type components" ),
|
||||
BITMAPS::show_tht, AF_NONE );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showNotInPosFile( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.attribute_not_in_posfile" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'P' )
|
||||
.FriendlyName( _( "Show 3D Models not in POS File" ) )
|
||||
.Tooltip( _( "Show 3D models even if not found in .pos file" ) )
|
||||
.Icon( BITMAPS::show_not_in_posfile )
|
||||
.Flags( AF_NONE ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showSMD( "3DViewer.Control.attributesSMD",
|
||||
AS_ACTIVE,
|
||||
'S', "",
|
||||
_( "Toggle SMD 3D models" ),
|
||||
_( "Toggle 3D models for 'Surface mount' type components" ),
|
||||
BITMAPS::show_smt, AF_NONE );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showDNP( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.attribute_dnp" )
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'D' )
|
||||
.FriendlyName( _( "Show 3D Models marked DNP" ) )
|
||||
.Tooltip( _( "Show 3D models even if marked 'Do Not Place'" ) )
|
||||
.Icon( BITMAPS::show_dnp )
|
||||
.Flags( AF_NONE ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showVirtual( "3DViewer.Control.attributesOther",
|
||||
AS_ACTIVE,
|
||||
'V', "",
|
||||
_( "Toggle unspecified 3D models" ), _( "Toggle 3D models for 'unspecified' type components" ),
|
||||
BITMAPS::show_other, AF_NONE );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showBBoxes( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.showBoundingBoxes" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Show Model Bounding Boxes" ) )
|
||||
.Tooltip( _( "Show 3D model bounding boxes in realtime renderer" ) )
|
||||
.Icon( BITMAPS::ortho )
|
||||
.Flags( AF_NONE ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showNotInPosFile( "3DViewer.Control.attribute_not_in_posfile",
|
||||
AS_ACTIVE,
|
||||
'P', "",
|
||||
_( "Toggle 3D models not in pos file" ), _( "Toggle 3D models not in pos file" ),
|
||||
BITMAPS::show_not_in_posfile, AF_NONE );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showAxis( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.showAxis" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Show 3D Axis" ) )
|
||||
.Icon( BITMAPS::axis3d_front )
|
||||
.Flags( AF_NONE ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showBBoxes( "3DViewer.Control.showBoundingBoxes",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Show Model Bounding Boxes" ), _( "Show Model Bounding Boxes" ),
|
||||
BITMAPS::ortho, AF_NONE );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showLayersManager( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.showLayersManager" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Show Appearance Manager" ) )
|
||||
.Tooltip( _( "Show/hide the appearance manager" ) )
|
||||
.Icon( BITMAPS::layers_manager ) );
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleRealisticMode( "3DViewer.Control.toggleRealisticMode",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Toggle realistic mode" ), _( "Toggle realistic mode" ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleBoardBody( "3DViewer.Control.toggleBoardBody",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Toggle board body display" ), _( "Toggle board body display" ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::showAxis( "3DViewer.Control.showAxis",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Show 3D Axis" ), _( "Show 3D Axis" ),
|
||||
BITMAPS::axis3d_front, AF_NONE );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleZones( "3DViewer.Control.toggleZones",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Toggle zone display" ), _( "Toggle zone display" ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleAdhesive( "3DViewer.Control.toggleAdhesive",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Toggle adhesive display" ), _( "Toggle display of adhesive layers" ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleSilk( "3DViewer.Control.toggleSilk",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Toggle silkscreen display" ), _( "Toggle display of silkscreen layers" ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleSolderMask( "3DViewer.Control.toggleSolderMask",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Toggle solder mask display" ), _( "Toggle display of solder mask layers" ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleSolderPaste( "3DViewer.Control.toggleSolderPaste",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Toggle solder paste display" ), _( "Toggle display of solder paste layers" ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleComments( "3DViewer.Control.toggleComments",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Toggle comments display" ), _( "Toggle display of comments and drawings layers" ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleECO( "3DViewer.Control.toggleECO",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Toggle ECO display" ), _( "Toggle display of ECO layers" ) );
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013-2023 CERN
|
||||
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2013-2016 CERN
|
||||
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
static TOOL_ACTION moveUp;
|
||||
static TOOL_ACTION moveDown;
|
||||
static TOOL_ACTION homeView;
|
||||
static TOOL_ACTION resetView;
|
||||
static TOOL_ACTION flipView;
|
||||
static TOOL_ACTION toggleOrtho;
|
||||
|
||||
@@ -78,10 +79,17 @@ public:
|
||||
static TOOL_ACTION showSMD;
|
||||
static TOOL_ACTION showVirtual;
|
||||
static TOOL_ACTION showNotInPosFile;
|
||||
static TOOL_ACTION showDNP;
|
||||
static TOOL_ACTION showBBoxes;
|
||||
static TOOL_ACTION toggleRealisticMode;
|
||||
static TOOL_ACTION toggleBoardBody;
|
||||
static TOOL_ACTION showAxis;
|
||||
static TOOL_ACTION showLayersManager;
|
||||
static TOOL_ACTION toggleZones;
|
||||
static TOOL_ACTION toggleAdhesive;
|
||||
static TOOL_ACTION toggleSilk;
|
||||
static TOOL_ACTION toggleSolderMask;
|
||||
static TOOL_ACTION toggleSolderPaste;
|
||||
static TOOL_ACTION toggleComments;
|
||||
static TOOL_ACTION toggleECO;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-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
|
||||
@@ -29,9 +28,8 @@
|
||||
#include <id.h>
|
||||
#include <kiface_base.h>
|
||||
#include <tools/eda_3d_controller.h>
|
||||
#include <tools/eda_3d_actions.h>
|
||||
#include <dialogs/panel_preview_3d_model.h>
|
||||
#include <dialogs/appearance_controls_3D.h>
|
||||
#include "eda_3d_actions.h"
|
||||
#include "dialogs/panel_preview_3d_model.h"
|
||||
#include <3d_rendering/opengl/render_3d_opengl.h>
|
||||
|
||||
|
||||
@@ -81,7 +79,8 @@ void EDA_3D_CONTROLLER::Reset( RESET_REASON aReason )
|
||||
{
|
||||
m_canvas = dynamic_cast<EDA_3D_CANVAS*>( holder->GetToolCanvas() );
|
||||
|
||||
EDA_3D_BOARD_HOLDER* holder3d = dynamic_cast<EDA_3D_BOARD_HOLDER*>( holder );
|
||||
EDA_3D_BOARD_HOLDER* holder3d =
|
||||
dynamic_cast<EDA_3D_BOARD_HOLDER*>( holder );
|
||||
|
||||
wxASSERT( holder3d );
|
||||
|
||||
@@ -118,7 +117,10 @@ int EDA_3D_CONTROLLER::Main( const TOOL_EVENT& aEvent )
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
wxWindow* canvas = m_toolMgr->GetToolHolder()->GetToolCanvas();
|
||||
wxWindow* topLevelParent = wxGetTopLevelParent( canvas->GetParent() );
|
||||
wxWindow* topLevelParent = canvas->GetParent();
|
||||
|
||||
while( topLevelParent && !topLevelParent->IsTopLevel() )
|
||||
topLevelParent = topLevelParent->GetParent();
|
||||
|
||||
if( topLevelParent && dynamic_cast<DIALOG_SHIM*>( topLevelParent ) )
|
||||
{
|
||||
@@ -150,7 +152,7 @@ int EDA_3D_CONTROLLER::Main( const TOOL_EVENT& aEvent )
|
||||
|
||||
int EDA_3D_CONTROLLER::ViewControl( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_canvas->SetView3D( aEvent.Parameter<VIEW3D_TYPE>() );
|
||||
m_canvas->SetView3D( aEvent.Parameter<intptr_t>() );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -158,13 +160,13 @@ int EDA_3D_CONTROLLER::ViewControl( const TOOL_EVENT& aEvent )
|
||||
|
||||
int EDA_3D_CONTROLLER::PanControl( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
switch( aEvent.Parameter<ACTIONS::CURSOR_EVENT_TYPE>() )
|
||||
switch( aEvent.Parameter<intptr_t>() )
|
||||
{
|
||||
case ACTIONS::CURSOR_UP: m_canvas->SetView3D( VIEW3D_TYPE::VIEW3D_PAN_UP ); break;
|
||||
case ACTIONS::CURSOR_DOWN: m_canvas->SetView3D( VIEW3D_TYPE::VIEW3D_PAN_DOWN ); break;
|
||||
case ACTIONS::CURSOR_LEFT: m_canvas->SetView3D( VIEW3D_TYPE::VIEW3D_PAN_LEFT ); break;
|
||||
case ACTIONS::CURSOR_RIGHT: m_canvas->SetView3D( VIEW3D_TYPE::VIEW3D_PAN_RIGHT ); break;
|
||||
default: wxFAIL; break;
|
||||
case ACTIONS::CURSOR_UP: m_canvas->SetView3D( WXK_UP ); break;
|
||||
case ACTIONS::CURSOR_DOWN: m_canvas->SetView3D( WXK_DOWN ); break;
|
||||
case ACTIONS::CURSOR_LEFT: m_canvas->SetView3D( WXK_LEFT ); break;
|
||||
case ACTIONS::CURSOR_RIGHT: m_canvas->SetView3D( WXK_RIGHT ); break;
|
||||
default: wxFAIL; break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -184,7 +186,7 @@ int EDA_3D_CONTROLLER::RotateView( const TOOL_EVENT& aEvent )
|
||||
case ROTATION_DIR::Y_CCW: m_camera->RotateY( -rotIncrement ); break;
|
||||
case ROTATION_DIR::Z_CW: m_camera->RotateZ( -rotIncrement ); break;
|
||||
case ROTATION_DIR::Z_CCW: m_camera->RotateZ( rotIncrement ); break;
|
||||
default: wxFAIL; break;
|
||||
default: wxFAIL; break;
|
||||
}
|
||||
|
||||
if( m_boardAdapter->m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||
@@ -223,44 +225,95 @@ int EDA_3D_CONTROLLER::ToggleOrtho( const TOOL_EVENT& aEvent )
|
||||
|
||||
int EDA_3D_CONTROLLER::ToggleVisibility( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::bitset<LAYER_3D_END> visibilityFlags = m_boardAdapter->GetVisibleLayers();
|
||||
APPEARANCE_CONTROLS_3D* appearanceManager = nullptr;
|
||||
bool reload = false;
|
||||
|
||||
auto flipLayer =
|
||||
[&]( int layer )
|
||||
{
|
||||
appearanceManager->OnLayerVisibilityChanged( layer, !visibilityFlags.test( layer ) );
|
||||
};
|
||||
#define FLIP( x ) x = !x
|
||||
|
||||
if( auto viewer = dynamic_cast<EDA_3D_VIEWER_FRAME*>( m_toolMgr->GetToolHolder() ) )
|
||||
appearanceManager = viewer->GetAppearanceManager();
|
||||
|
||||
if( appearanceManager )
|
||||
if( aEvent.IsAction( &EDA_3D_ACTIONS::showTHT ) )
|
||||
{
|
||||
if( aEvent.IsAction( &EDA_3D_ACTIONS::showTHT ) )
|
||||
flipLayer( LAYER_3D_TH_MODELS );
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showSMD ) )
|
||||
flipLayer( LAYER_3D_SMD_MODELS );
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showVirtual ) )
|
||||
flipLayer( LAYER_3D_VIRTUAL_MODELS );
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showNotInPosFile ) )
|
||||
flipLayer( LAYER_3D_MODELS_NOT_IN_POS );
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showDNP ) )
|
||||
flipLayer( LAYER_3D_MODELS_MARKED_DNP );
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showAxis ) )
|
||||
flipLayer( LAYER_3D_AXES );
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showBBoxes ) )
|
||||
flipLayer( LAYER_3D_BOUNDING_BOXES );
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_footprints_normal );
|
||||
reload = true;
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showSMD ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_footprints_insert );
|
||||
reload = true;
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showVirtual ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_footprints_virtual );
|
||||
reload = true;
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showNotInPosFile ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_footprints_not_in_posfile );
|
||||
reload = true;
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showBBoxes ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.opengl_show_model_bbox );
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleRealisticMode ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.realistic );
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleBoardBody ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_board_body );
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::showAxis ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_axis );
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleZones ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_zones );
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleAdhesive ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_adhesive );
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleSilk ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_silkscreen );
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleSolderMask ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_soldermask );
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleSolderPaste ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_solderpaste );
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleComments ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_comments );
|
||||
}
|
||||
else if( aEvent.IsAction( &EDA_3D_ACTIONS::toggleECO ) )
|
||||
{
|
||||
FLIP( m_boardAdapter->m_Cfg->m_Render.show_eco );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int EDA_3D_CONTROLLER::ToggleLayersManager( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( auto* viewer = dynamic_cast<EDA_3D_VIEWER_FRAME*>( m_toolMgr->GetToolHolder() ) )
|
||||
viewer->ToggleAppearanceManager();
|
||||
if( reload )
|
||||
{
|
||||
if( m_boardAdapter->m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||
{
|
||||
auto* renderer = static_cast<RENDER_3D_OPENGL*>( m_canvas->GetCurrentRender() );
|
||||
renderer->Load3dModelsIfNeeded();
|
||||
m_canvas->Request_refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_canvas->RenderRaytracingRequest();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( auto viewer = dynamic_cast<EDA_3D_VIEWER_FRAME*>( m_toolMgr->GetToolHolder() ) )
|
||||
viewer->NewDisplay( true );
|
||||
else
|
||||
m_canvas->Request_refresh();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -302,7 +355,7 @@ int EDA_3D_CONTROLLER::doZoomInOut( bool aDirection, bool aCenterOnCursor )
|
||||
{
|
||||
if( m_canvas )
|
||||
{
|
||||
m_canvas->SetView3D( aDirection ? VIEW3D_TYPE::VIEW3D_ZOOM_IN : VIEW3D_TYPE::VIEW3D_ZOOM_OUT );
|
||||
m_canvas->SetView3D( aDirection ? WXK_F1 : WXK_F2 );
|
||||
m_canvas->DisplayStatus();
|
||||
}
|
||||
|
||||
@@ -314,7 +367,7 @@ int EDA_3D_CONTROLLER::ZoomFitScreen( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( m_canvas )
|
||||
{
|
||||
m_canvas->SetView3D( VIEW3D_TYPE::VIEW3D_FIT_SCREEN );
|
||||
m_canvas->SetView3D( WXK_HOME );
|
||||
m_canvas->DisplayStatus();
|
||||
}
|
||||
|
||||
@@ -346,6 +399,7 @@ void EDA_3D_CONTROLLER::setTransitions()
|
||||
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::viewBack.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::pivotCenter.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::homeView.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::resetView.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ViewControl, EDA_3D_ACTIONS::flipView.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::RotateView, EDA_3D_ACTIONS::rotateXCW.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::RotateView, EDA_3D_ACTIONS::rotateXCCW.MakeEvent() );
|
||||
@@ -383,8 +437,18 @@ void EDA_3D_CONTROLLER::setTransitions()
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showSMD.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showVirtual.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showNotInPosFile.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showDNP.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleLayersManager,EDA_3D_ACTIONS::showLayersManager.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showVirtual.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showBBoxes.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleRealisticMode.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleBoardBody.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::showAxis.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleZones.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleAdhesive.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleSilk.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleSolderMask.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleSolderPaste.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleComments.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleVisibility, EDA_3D_ACTIONS::toggleECO.MakeEvent() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-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
|
||||
@@ -96,7 +95,6 @@ public:
|
||||
|
||||
int ToggleOrtho( const TOOL_EVENT& aEvent );
|
||||
int ToggleVisibility( const TOOL_EVENT& aEvent );
|
||||
int ToggleLayersManager( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
///< Sets up handlers for various events.
|
||||
|
||||
+10
-19
@@ -1,21 +1,5 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 <author>
|
||||
* 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/>.
|
||||
/**
|
||||
* @file 3d_viewer_id.h
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -27,7 +11,6 @@
|
||||
* However the number of IDs should be < ROOM_FOR_3D_VIEWER, defined in id.h
|
||||
* Please change the value of ROOM_FOR_3D_VIEWER if too small.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <id.h> // Generic Id.
|
||||
|
||||
@@ -35,6 +18,14 @@ enum id_3dview_frm
|
||||
{
|
||||
ID_START_COMMAND_3D = ID_KICAD_3D_VIEWER_START,
|
||||
ID_RELOAD3D_BOARD,
|
||||
ID_VIEW3D_TOP,
|
||||
ID_VIEW3D_BOTTOM,
|
||||
ID_VIEW3D_LEFT,
|
||||
ID_VIEW3D_RIGHT,
|
||||
ID_VIEW3D_FRONT,
|
||||
ID_VIEW3D_BACK,
|
||||
ID_VIEW3D_RESET,
|
||||
ID_VIEW3D_FLIP,
|
||||
ID_TOOL_SCREENCOPY_TOCLIBBOARD,
|
||||
|
||||
ID_MENU_SCREENCOPY_PNG,
|
||||
|
||||
+18
-17
@@ -1,5 +1,5 @@
|
||||
#add_definitions(-DPRINT_STATISTICS_3D_VIEWER)
|
||||
add_compile_definitions( PCBNEW )
|
||||
add_definitions(-DPCBNEW)
|
||||
|
||||
include_directories(BEFORE ${INC_BEFORE})
|
||||
include_directories(
|
||||
@@ -16,6 +16,7 @@ include_directories(
|
||||
)
|
||||
|
||||
# directories
|
||||
set( DIR_DLG dialogs )
|
||||
set( DIR_RAY 3d_rendering/raytracing )
|
||||
set( DIR_RAY_ACC ${DIR_RAY}/accelerators )
|
||||
set( DIR_RAY_2D ${DIR_RAY}/shapes2D )
|
||||
@@ -27,9 +28,15 @@ set(3D-VIEWER_SRCS
|
||||
${DIR_3D_PLUGINS}/3d/pluginldr3D.cpp
|
||||
3d_cache/3d_cache.cpp
|
||||
3d_cache/3d_plugin_manager.cpp
|
||||
${DIR_DLG}/3d_cache_dialogs.cpp
|
||||
${DIR_DLG}/dialog_select_3d_model_base.cpp
|
||||
${DIR_DLG}/dialog_select_3d_model.cpp
|
||||
${DIR_DLG}/panel_preview_3d_model_base.cpp
|
||||
${DIR_DLG}/panel_preview_3d_model.cpp
|
||||
3d_canvas/board_adapter.cpp
|
||||
3d_canvas/create_layer_items.cpp
|
||||
3d_canvas/create_3Dgraphic_brd_items.cpp
|
||||
3d_canvas/create_layer_poly.cpp
|
||||
3d_canvas/eda_3d_canvas.cpp
|
||||
3d_canvas/eda_3d_canvas_pivot.cpp
|
||||
3d_model_viewer/eda_3d_model_viewer.cpp
|
||||
@@ -71,6 +78,7 @@ set(3D-VIEWER_SRCS
|
||||
${DIR_RAY_3D}/triangle_3d.cpp
|
||||
3d_rendering/buffers_debug.cpp
|
||||
3d_rendering/render_3d_base.cpp
|
||||
3d_rendering/camera.cpp
|
||||
3d_rendering/color_rgb.cpp
|
||||
3d_rendering/image.cpp
|
||||
3d_rendering/post_shader.cpp
|
||||
@@ -80,6 +88,14 @@ set(3D-VIEWER_SRCS
|
||||
3d_rendering/trackball.cpp
|
||||
3d_viewer/3d_menubar.cpp
|
||||
3d_viewer/3d_toolbar.cpp
|
||||
dialogs/panel_3D_colors.cpp
|
||||
dialogs/panel_3D_colors_base.cpp
|
||||
dialogs/panel_3D_display_options.cpp
|
||||
dialogs/panel_3D_display_options_base.cpp
|
||||
dialogs/panel_3D_opengl_options.cpp
|
||||
dialogs/panel_3D_opengl_options_base.cpp
|
||||
dialogs/panel_3D_raytracing_options.cpp
|
||||
dialogs/panel_3D_raytracing_options_base.cpp
|
||||
3d_viewer/tools/eda_3d_actions.cpp
|
||||
3d_viewer/tools/eda_3d_conditions.cpp
|
||||
3d_viewer/tools/eda_3d_controller.cpp
|
||||
@@ -89,19 +105,6 @@ set(3D-VIEWER_SRCS
|
||||
common_ogl/ogl_utils.cpp
|
||||
3d_fastmath.cpp
|
||||
3d_math.cpp
|
||||
dialogs/3d_cache_dialogs.cpp
|
||||
dialogs/appearance_controls_3D.cpp
|
||||
dialogs/appearance_controls_3D_base.cpp
|
||||
dialogs/dialog_select_3d_model_base.cpp
|
||||
dialogs/dialog_select_3d_model.cpp
|
||||
dialogs/panel_preview_3d_model_base.cpp
|
||||
dialogs/panel_preview_3d_model.cpp
|
||||
dialogs/panel_3D_display_options.cpp
|
||||
dialogs/panel_3D_display_options_base.cpp
|
||||
dialogs/panel_3D_opengl_options.cpp
|
||||
dialogs/panel_3D_opengl_options_base.cpp
|
||||
dialogs/panel_3D_raytracing_options.cpp
|
||||
dialogs/panel_3D_raytracing_options_base.cpp
|
||||
)
|
||||
|
||||
add_library(3d-viewer STATIC ${3D-VIEWER_SRCS})
|
||||
@@ -111,10 +114,8 @@ target_link_libraries( 3d-viewer
|
||||
PRIVATE
|
||||
gal
|
||||
kimath
|
||||
core
|
||||
common
|
||||
nlohmann_json
|
||||
Boost::headers
|
||||
${Boost_LIBRARIES}
|
||||
${wxWidgets_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
kicad_3dsg )
|
||||
|
||||
@@ -31,11 +31,9 @@
|
||||
#define OPENGL_INCLUDES_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifndef GL_SILENCE_DEPRECATION
|
||||
// Apple, in their infinite wisdom, has decided to mark OpenGL as deprecated.
|
||||
// Luckily we can silence warnings about its deprecation.
|
||||
#define GL_SILENCE_DEPRECATION 1
|
||||
#endif
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
|
||||
@@ -1,978 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 2023-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 <dialogs/appearance_controls_3D.h>
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <confirm.h>
|
||||
#include <pgm_base.h>
|
||||
#include <dpi_scaling_common.h>
|
||||
#include <eda_list_dialog.h>
|
||||
#include <pcb_display_options.h>
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <project.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/eda_3d_actions.h>
|
||||
#include <widgets/bitmap_toggle.h>
|
||||
#include <widgets/color_swatch.h>
|
||||
#include <widgets/grid_bitmap_toggle.h>
|
||||
#include <dialogs/eda_view_switcher.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/textdlg.h>
|
||||
#include <wx/checkbox.h>
|
||||
|
||||
#include <../3d_rendering/opengl/render_3d_opengl.h>
|
||||
|
||||
|
||||
#define RR APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D // Render Row abbreviation to reduce source width
|
||||
|
||||
/// Template for object appearance settings
|
||||
const APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D APPEARANCE_CONTROLS_3D::s_layerSettings[] = {
|
||||
|
||||
// text id tooltip
|
||||
RR( _HKI( "Board Body" ), LAYER_3D_BOARD, _HKI( "Show board body" ) ),
|
||||
RR( _HKI( "F.Cu" ), LAYER_3D_COPPER_TOP, _HKI( "Show front copper / surface finish color" ) ),
|
||||
RR( _HKI( "B.Cu" ), LAYER_3D_COPPER_BOTTOM, _HKI( "Show back copper / surface finish color" ) ),
|
||||
RR( _HKI( "Adhesive" ), LAYER_3D_ADHESIVE, _HKI( "Show adhesive" ) ),
|
||||
RR( _HKI( "Solder Paste" ), LAYER_3D_SOLDERPASTE, _HKI( "Show solder paste" ) ),
|
||||
RR( _HKI( "F.Silkscreen" ), LAYER_3D_SILKSCREEN_TOP, _HKI( "Show front silkscreen" ) ),
|
||||
RR( _HKI( "B.Silkscreen" ), LAYER_3D_SILKSCREEN_BOTTOM, _HKI( "Show back silkscreen" ) ),
|
||||
RR( _HKI( "F.Mask" ), LAYER_3D_SOLDERMASK_TOP, _HKI( "Show front solder mask" ) ),
|
||||
RR( _HKI( "B.Mask" ), LAYER_3D_SOLDERMASK_BOTTOM, _HKI( "Show back solder mask" ) ),
|
||||
RR( _HKI( "User.Drawings" ), LAYER_3D_USER_DRAWINGS, _HKI( "Show user drawings layer" ) ),
|
||||
RR( _HKI( "User.Comments" ), LAYER_3D_USER_COMMENTS, _HKI( "Show user comments layer" ) ),
|
||||
RR( _HKI( "User.Eco1" ), LAYER_3D_USER_ECO1, _HKI( "Show user ECO1 layer" ) ),
|
||||
RR( _HKI( "User.Eco2" ), LAYER_3D_USER_ECO2, _HKI( "Show user ECO2 layer" ) ),
|
||||
RR(),
|
||||
RR( _HKI( "Through-hole Models" ), LAYER_3D_TH_MODELS, EDA_3D_ACTIONS::showTHT ),
|
||||
RR( _HKI( "SMD Models" ), LAYER_3D_SMD_MODELS, EDA_3D_ACTIONS::showSMD ),
|
||||
RR( _HKI( "Virtual Models" ), LAYER_3D_VIRTUAL_MODELS, EDA_3D_ACTIONS::showVirtual ),
|
||||
RR( _HKI( "Models not in POS File" ), LAYER_3D_MODELS_NOT_IN_POS, EDA_3D_ACTIONS::showNotInPosFile ),
|
||||
RR( _HKI( "Models marked DNP" ), LAYER_3D_MODELS_MARKED_DNP, EDA_3D_ACTIONS::showDNP ),
|
||||
RR( _HKI( "Model Bounding Boxes" ), LAYER_3D_BOUNDING_BOXES, EDA_3D_ACTIONS::showBBoxes ),
|
||||
RR(),
|
||||
RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ),
|
||||
RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ),
|
||||
RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ),
|
||||
RR( _HKI( "Off-board Silkscreen" ), LAYER_3D_OFF_BOARD_SILK, _HKI( "Do not clip silk layers to board outline" ) ),
|
||||
RR(),
|
||||
RR( _HKI( "3D Axis" ), LAYER_3D_AXES, EDA_3D_ACTIONS::showAxis ),
|
||||
RR( _HKI( "Background Start" ), LAYER_3D_BACKGROUND_TOP, _HKI( "Background gradient start color" ) ),
|
||||
RR( _HKI( "Background End" ), LAYER_3D_BACKGROUND_BOTTOM, _HKI( "Background gradient end color" ) ),
|
||||
};
|
||||
|
||||
// The list of IDs that can have colors coming from the board stackup, and cannot be
|
||||
// modified if use colors from stackup is activated
|
||||
static std::vector<int> inStackupColors{ LAYER_3D_BOARD, LAYER_3D_COPPER_TOP,
|
||||
LAYER_3D_COPPER_BOTTOM, LAYER_3D_SOLDERPASTE,
|
||||
LAYER_3D_SILKSCREEN_TOP, LAYER_3D_SILKSCREEN_BOTTOM,
|
||||
LAYER_3D_SOLDERMASK_TOP, LAYER_3D_SOLDERMASK_BOTTOM
|
||||
};
|
||||
|
||||
APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
|
||||
wxWindow* aFocusOwner ) :
|
||||
APPEARANCE_CONTROLS_3D_BASE( aParent ),
|
||||
m_frame( aParent ),
|
||||
m_focusOwner( aFocusOwner ),
|
||||
m_lastSelectedViewport( nullptr )
|
||||
{
|
||||
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();
|
||||
|
||||
m_layerPanelColour = m_panelLayers->GetBackgroundColour().ChangeLightness( 110 );
|
||||
SetBorders( true, false, false, false );
|
||||
|
||||
m_layersOuterSizer = new wxBoxSizer( wxVERTICAL );
|
||||
m_windowLayers->SetSizer( m_layersOuterSizer );
|
||||
m_windowLayers->SetScrollRate( 0, 5 );
|
||||
m_windowLayers->Bind( wxEVT_SET_FOCUS, &APPEARANCE_CONTROLS_3D::OnSetFocus, this );
|
||||
|
||||
m_envOuterSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxFont infoFont = KIUI::GetInfoFont( this );
|
||||
m_panelLayers->SetFont( infoFont );
|
||||
m_windowLayers->SetFont( infoFont );
|
||||
m_presetsLabel->SetFont( infoFont );
|
||||
m_viewportsLabel->SetFont( infoFont );
|
||||
|
||||
// Create display options
|
||||
m_cbUseBoardStackupColors = new wxCheckBox( m_panelLayers, wxID_ANY,
|
||||
_( "Use board stackup colors" ) );
|
||||
m_cbUseBoardStackupColors->SetFont( infoFont );
|
||||
|
||||
m_cbUseBoardStackupColors->Bind( wxEVT_CHECKBOX,
|
||||
[this]( wxCommandEvent& aEvent )
|
||||
{
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = m_frame->GetAdapter().m_Cfg;
|
||||
cfg->m_UseStackupColors = aEvent.IsChecked();
|
||||
|
||||
UpdateLayerCtls();
|
||||
syncLayerPresetSelection();
|
||||
m_frame->NewDisplay( true );
|
||||
} );
|
||||
|
||||
m_panelLayersSizer->Add( m_cbUseBoardStackupColors, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 7 );
|
||||
|
||||
m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore color and visibility "
|
||||
"combinations.\n"
|
||||
"Use %s+Tab to activate selector.\n"
|
||||
"Successive Tabs while holding %s down will "
|
||||
"cycle through presets in the popup." ),
|
||||
KeyNameFromKeyCode( PRESET_SWITCH_KEY ),
|
||||
KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) );
|
||||
|
||||
m_cbViewports->SetToolTip( wxString::Format( _( "Save and restore camera position and zoom.\n"
|
||||
"Use %s+Tab to activate selector.\n"
|
||||
"Successive Tabs while holding %s down will "
|
||||
"cycle through viewports in the popup." ),
|
||||
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ),
|
||||
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) );
|
||||
|
||||
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( KiBitmap( BITMAPS::visibility ),
|
||||
KiBitmap( BITMAPS::visibility_off ) );
|
||||
}
|
||||
|
||||
|
||||
APPEARANCE_CONTROLS_3D::~APPEARANCE_CONTROLS_3D()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxSize APPEARANCE_CONTROLS_3D::GetBestSize() const
|
||||
{
|
||||
DPI_SCALING_COMMON dpi( nullptr, m_frame );
|
||||
wxSize size( 220 * dpi.GetScaleFactor(), 480 * dpi.GetScaleFactor() );
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::OnSetFocus( wxFocusEvent& aEvent )
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
// In wxMSW, buttons won't process events unless they have focus, so we'll let it take the
|
||||
// focus and give it back to the parent in the button event handler.
|
||||
if( wxBitmapButton* btn = dynamic_cast<wxBitmapButton*>( aEvent.GetEventObject() ) )
|
||||
{
|
||||
wxCommandEvent evt( wxEVT_BUTTON );
|
||||
wxPostEvent( btn, evt );
|
||||
}
|
||||
#endif
|
||||
|
||||
passOnFocus();
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::OnSize( wxSizeEvent& aEvent )
|
||||
{
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::OnLanguageChanged()
|
||||
{
|
||||
Freeze();
|
||||
|
||||
rebuildLayers();
|
||||
m_cbUseBoardStackupColors->SetLabel( _( "Use board stackup colors" ) );
|
||||
rebuildLayerPresetsWidget();
|
||||
rebuildViewportsWidget();
|
||||
|
||||
Thaw();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::OnDarkModeToggle()
|
||||
{
|
||||
// This is essentially a list of hacks because DarkMode isn't yet implemented inside
|
||||
// wxWidgets.
|
||||
//
|
||||
// The individual wxPanels, COLOR_SWATCHes and GRID_CELL_COLOR_RENDERERs should really be
|
||||
// overriding some virtual method or responding to some wxWidgets event so that the parent
|
||||
// doesn't have to know what it contains. But, that's not where we are, so... :shrug:
|
||||
|
||||
m_layerPanelColour = m_panelLayers->GetBackgroundColour().ChangeLightness( 110 );
|
||||
|
||||
m_windowLayers->SetBackgroundColour( m_layerPanelColour );
|
||||
|
||||
for( wxSizerItem* child : m_layersOuterSizer->GetChildren() )
|
||||
{
|
||||
if( child && child->GetWindow() )
|
||||
child->GetWindow()->SetBackgroundColour( m_layerPanelColour );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::CommonSettingsChanged()
|
||||
{
|
||||
OnLanguageChanged();
|
||||
|
||||
UpdateLayerCtls();
|
||||
syncLayerPresetSelection();
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::ApplyLayerPreset( const wxString& aPresetName )
|
||||
{
|
||||
if( aPresetName == FOLLOW_PCB || aPresetName == FOLLOW_PLOT_SETTINGS )
|
||||
{
|
||||
m_frame->GetAdapter().m_Cfg->m_CurrentPreset = aPresetName;
|
||||
UpdateLayerCtls();
|
||||
m_frame->NewDisplay( true );
|
||||
}
|
||||
else if( LAYER_PRESET_3D* preset = m_frame->GetAdapter().m_Cfg->FindPreset( aPresetName ) )
|
||||
{
|
||||
doApplyLayerPreset( *preset );
|
||||
}
|
||||
|
||||
// Move to front of MRU list
|
||||
if( m_presetMRU.Index( aPresetName ) != wxNOT_FOUND )
|
||||
m_presetMRU.Remove( aPresetName );
|
||||
|
||||
m_presetMRU.Insert( aPresetName, 0 );
|
||||
|
||||
updateLayerPresetWidget( aPresetName );
|
||||
}
|
||||
|
||||
|
||||
std::vector<VIEWPORT3D> APPEARANCE_CONTROLS_3D::GetUserViewports() const
|
||||
{
|
||||
std::vector<VIEWPORT3D> ret;
|
||||
|
||||
for( const auto& [name, viewport] : m_viewports )
|
||||
ret.emplace_back( viewport );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::SetUserViewports( std::vector<VIEWPORT3D>& aViewportList )
|
||||
{
|
||||
m_viewports.clear();
|
||||
|
||||
for( const VIEWPORT3D& viewport : aViewportList )
|
||||
{
|
||||
if( m_viewports.count( viewport.name ) )
|
||||
continue;
|
||||
|
||||
m_viewports[viewport.name] = viewport;
|
||||
|
||||
m_viewportMRU.Add( viewport.name );
|
||||
}
|
||||
|
||||
rebuildViewportsWidget();
|
||||
|
||||
// Now is as good a time as any to initialize the layer presets as well.
|
||||
rebuildLayerPresetsWidget();
|
||||
|
||||
m_presetMRU.Add( FOLLOW_PCB );
|
||||
m_presetMRU.Add( FOLLOW_PLOT_SETTINGS );
|
||||
|
||||
for( const LAYER_PRESET_3D& preset : m_frame->GetAdapter().m_Cfg->m_LayerPresets )
|
||||
m_presetMRU.Add( preset.name );
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::ApplyViewport( const wxString& aViewportName )
|
||||
{
|
||||
int idx = m_cbViewports->FindString( aViewportName );
|
||||
|
||||
if( idx >= 0 && idx < (int)m_cbViewports->GetCount() - 3 /* separator */ )
|
||||
{
|
||||
m_cbViewports->SetSelection( idx );
|
||||
m_lastSelectedViewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( idx ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 ); // separator
|
||||
m_lastSelectedViewport = nullptr;
|
||||
}
|
||||
|
||||
if( m_lastSelectedViewport )
|
||||
doApplyViewport( *m_lastSelectedViewport );
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::OnLayerVisibilityChanged( int aLayer, bool isVisible )
|
||||
{
|
||||
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
|
||||
const std::map<int, COLOR4D>& colors = m_frame->GetAdapter().GetLayerColors();
|
||||
bool killFollow = false;
|
||||
bool doFastRefresh = false; // true to just refresh the display
|
||||
|
||||
// Special-case controls
|
||||
switch( aLayer )
|
||||
{
|
||||
case LAYER_FP_TEXT:
|
||||
// Because Footprint Text is a meta-control that also can disable values/references,
|
||||
// drag them along here so that the user is less likely to be confused.
|
||||
if( !isVisible )
|
||||
{
|
||||
visibleLayers.set( LAYER_FP_REFERENCES, false );
|
||||
visibleLayers.set( LAYER_FP_VALUES, false );
|
||||
}
|
||||
|
||||
visibleLayers.set( LAYER_FP_TEXT, isVisible );
|
||||
killFollow = true;
|
||||
break;
|
||||
|
||||
case LAYER_FP_REFERENCES:
|
||||
case LAYER_FP_VALUES:
|
||||
// In case that user changes Footprint Value/References when the Footprint Text
|
||||
// meta-control is disabled, we should put it back on.
|
||||
if( isVisible )
|
||||
visibleLayers.set( LAYER_FP_TEXT, true );
|
||||
|
||||
visibleLayers.set( aLayer, isVisible );
|
||||
killFollow = true;
|
||||
break;
|
||||
|
||||
case LAYER_3D_BOARD:
|
||||
case LAYER_3D_COPPER_TOP:
|
||||
case LAYER_3D_COPPER_BOTTOM:
|
||||
case LAYER_3D_SILKSCREEN_BOTTOM:
|
||||
case LAYER_3D_SILKSCREEN_TOP:
|
||||
case LAYER_3D_SOLDERMASK_BOTTOM:
|
||||
case LAYER_3D_SOLDERMASK_TOP:
|
||||
case LAYER_3D_SOLDERPASTE:
|
||||
case LAYER_3D_ADHESIVE:
|
||||
case LAYER_3D_USER_COMMENTS:
|
||||
case LAYER_3D_USER_DRAWINGS:
|
||||
case LAYER_3D_USER_ECO1:
|
||||
case LAYER_3D_USER_ECO2:
|
||||
visibleLayers.set( aLayer, isVisible );
|
||||
killFollow = true;
|
||||
break;
|
||||
|
||||
case LAYER_3D_TH_MODELS:
|
||||
case LAYER_3D_SMD_MODELS:
|
||||
case LAYER_3D_VIRTUAL_MODELS:
|
||||
case LAYER_3D_MODELS_NOT_IN_POS:
|
||||
case LAYER_3D_MODELS_MARKED_DNP:
|
||||
doFastRefresh = true;
|
||||
visibleLayers.set( aLayer, isVisible );
|
||||
break;
|
||||
|
||||
default:
|
||||
visibleLayers.set( aLayer, isVisible );
|
||||
break;
|
||||
}
|
||||
|
||||
m_frame->GetAdapter().SetVisibleLayers( visibleLayers );
|
||||
m_frame->GetAdapter().SetLayerColors( colors );
|
||||
|
||||
const wxString& currentPreset = m_frame->GetAdapter().m_Cfg->m_CurrentPreset;
|
||||
|
||||
if( ( currentPreset != FOLLOW_PCB && currentPreset != FOLLOW_PLOT_SETTINGS ) || killFollow )
|
||||
syncLayerPresetSelection();
|
||||
|
||||
UpdateLayerCtls();
|
||||
|
||||
if( doFastRefresh && m_frame->GetAdapter().m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||
{
|
||||
RENDER_3D_OPENGL* renderer =
|
||||
static_cast<RENDER_3D_OPENGL*>( m_frame->GetCanvas()->GetCurrentRender() );
|
||||
renderer->Load3dModelsIfNeeded();
|
||||
m_frame->GetCanvas()->Request_refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->NewDisplay( true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::onColorSwatchChanged( COLOR_SWATCH* aSwatch )
|
||||
{
|
||||
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
|
||||
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
|
||||
|
||||
m_frame->GetAdapter().SetVisibleLayers( visibleLayers );
|
||||
m_frame->GetAdapter().SetLayerColors( colors );
|
||||
|
||||
int layer = aSwatch->GetId();
|
||||
COLOR4D newColor = aSwatch->GetSwatchColor();
|
||||
|
||||
colors[ layer ] = newColor;
|
||||
|
||||
if( layer == LAYER_3D_COPPER_TOP )
|
||||
colors[ LAYER_3D_COPPER_BOTTOM ] = newColor;
|
||||
else if( layer == LAYER_3D_COPPER_BOTTOM )
|
||||
colors[ LAYER_3D_COPPER_TOP ] = newColor;
|
||||
|
||||
m_frame->GetAdapter().SetLayerColors( colors );
|
||||
|
||||
syncLayerPresetSelection();
|
||||
|
||||
m_frame->NewDisplay( true );
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::rebuildLayers()
|
||||
{
|
||||
int swatchWidth = m_windowLayers->ConvertDialogToPixels( wxSize( 8, 0 ) ).x;
|
||||
|
||||
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
|
||||
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
|
||||
std::map<int, COLOR4D> defaultColors = m_frame->GetAdapter().GetDefaultColors();
|
||||
|
||||
m_layerSettings.clear();
|
||||
m_layersOuterSizer->Clear( true );
|
||||
m_layersOuterSizer->AddSpacer( 5 );
|
||||
|
||||
m_envOuterSizer->Clear( true );
|
||||
|
||||
auto appendLayer =
|
||||
[&]( const std::unique_ptr<APPEARANCE_SETTING_3D>& aSetting )
|
||||
{
|
||||
wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
int layer = aSetting->m_Id;
|
||||
|
||||
aSetting->m_Visible = visibleLayers.test( layer );
|
||||
|
||||
if( colors.count( layer ) )
|
||||
{
|
||||
COLOR_SWATCH* swatch = new COLOR_SWATCH( m_windowLayers, colors[ layer ], layer,
|
||||
COLOR4D::WHITE, defaultColors[ layer ],
|
||||
SWATCH_SMALL );
|
||||
swatch->SetToolTip( _( "Left double click or middle click to change color" ) );
|
||||
|
||||
swatch->SetReadOnlyCallback(
|
||||
[this]()
|
||||
{
|
||||
WX_INFOBAR* infobar = m_frame->GetInfoBar();
|
||||
|
||||
infobar->RemoveAllButtons();
|
||||
infobar->AddCloseButton();
|
||||
|
||||
infobar->ShowMessageFor( _( "Uncheck 'Use board stackup colors' to "
|
||||
"allow color editing." ),
|
||||
10000, wxICON_INFORMATION );
|
||||
} );
|
||||
|
||||
sizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL, 0 );
|
||||
aSetting->m_Ctl_color = swatch;
|
||||
|
||||
swatch->Bind( COLOR_SWATCH_CHANGED,
|
||||
[this]( wxCommandEvent& event )
|
||||
{
|
||||
auto swatch = static_cast<COLOR_SWATCH*>( event.GetEventObject() );
|
||||
onColorSwatchChanged( swatch );
|
||||
|
||||
passOnFocus();
|
||||
} );
|
||||
}
|
||||
else
|
||||
{
|
||||
sizer->AddSpacer( swatchWidth );
|
||||
}
|
||||
|
||||
sizer->AddSpacer( 5 );
|
||||
|
||||
wxStaticText* label = new wxStaticText( m_windowLayers, layer, aSetting->GetLabel() );
|
||||
label->Wrap( -1 );
|
||||
label->SetToolTip( aSetting->GetTooltip() );
|
||||
|
||||
if( layer == LAYER_3D_BACKGROUND_TOP || layer == LAYER_3D_BACKGROUND_BOTTOM )
|
||||
{
|
||||
sizer->AddSpacer( swatchWidth );
|
||||
}
|
||||
else
|
||||
{
|
||||
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 )
|
||||
{
|
||||
int id = static_cast<wxWindow*>( aEvent.GetEventObject() )->GetId();
|
||||
bool isVisible = aEvent.GetInt();
|
||||
OnLayerVisibilityChanged( id, isVisible );
|
||||
|
||||
passOnFocus();
|
||||
} );
|
||||
|
||||
wxString tip;
|
||||
tip.Printf( _( "Show or hide %s" ), aSetting->GetLabel().Lower() );
|
||||
btn_visible->SetToolTip( tip );
|
||||
|
||||
aSetting->m_Ctl_visibility = btn_visible;
|
||||
sizer->Add( btn_visible, 0, wxALIGN_CENTER_VERTICAL, 0 );
|
||||
}
|
||||
|
||||
sizer->AddSpacer( 5 );
|
||||
sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL, 0 );
|
||||
|
||||
m_layersOuterSizer->Add( sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, 5 );
|
||||
m_layersOuterSizer->AddSpacer( 2 );
|
||||
};
|
||||
|
||||
for( const APPEARANCE_SETTING_3D& s_setting : s_layerSettings )
|
||||
{
|
||||
m_layerSettings.emplace_back( std::make_unique<APPEARANCE_SETTING_3D>( s_setting ) );
|
||||
std::unique_ptr<APPEARANCE_SETTING_3D>& setting = m_layerSettings.back();
|
||||
|
||||
if( setting->m_Spacer )
|
||||
m_layersOuterSizer->AddSpacer( m_pointSize );
|
||||
else
|
||||
appendLayer( setting );
|
||||
|
||||
m_layerSettingsMap[setting->m_Id] = setting.get();
|
||||
}
|
||||
|
||||
m_sizerOuter->Layout();
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::UpdateLayerCtls()
|
||||
{
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = m_frame->GetAdapter().m_Cfg;
|
||||
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
|
||||
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
|
||||
|
||||
for( std::unique_ptr<APPEARANCE_SETTING_3D>& setting : m_layerSettings )
|
||||
{
|
||||
if( setting->m_Spacer )
|
||||
continue;
|
||||
|
||||
if( setting->m_Ctl_visibility )
|
||||
setting->m_Ctl_visibility->SetValue( visibleLayers.test( setting->m_Id ) );
|
||||
|
||||
if( setting->m_Ctl_color )
|
||||
{
|
||||
setting->m_Ctl_color->SetSwatchColor( colors[ setting->m_Id ], false );
|
||||
|
||||
// if cfg->m_UseStackupColors is set, board colors cannot be modified locally, but
|
||||
// other colors can be
|
||||
if( std::find( inStackupColors.begin(), inStackupColors.end(), setting->m_Id )
|
||||
!= inStackupColors.end() )
|
||||
{
|
||||
if( cfg )
|
||||
setting->m_Ctl_color->SetReadOnly( cfg->m_UseStackupColors );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
m_cbUseBoardStackupColors->SetValue( cfg->m_UseStackupColors );
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::rebuildLayerPresetsWidget()
|
||||
{
|
||||
m_presetsLabel->SetLabel( wxString::Format( _( "Presets (%s+Tab):" ),
|
||||
KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) );
|
||||
|
||||
m_cbLayerPresets->Clear();
|
||||
|
||||
// Build the layers preset list.
|
||||
|
||||
m_cbLayerPresets->Append( _( "Follow PCB Editor" ) );
|
||||
m_cbLayerPresets->Append( _( "Follow PCB Plot Settings" ) );
|
||||
|
||||
for( const LAYER_PRESET_3D& preset : m_frame->GetAdapter().m_Cfg->m_LayerPresets )
|
||||
m_cbLayerPresets->Append( preset.name );
|
||||
|
||||
m_cbLayerPresets->Append( wxT( "---" ) );
|
||||
m_cbLayerPresets->Append( _( "Save preset..." ) );
|
||||
m_cbLayerPresets->Append( _( "Delete preset..." ) );
|
||||
|
||||
updateLayerPresetWidget( m_frame->GetAdapter().m_Cfg->m_CurrentPreset );
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::syncLayerPresetSelection()
|
||||
{
|
||||
m_frame->GetAdapter().m_Cfg->m_CurrentPreset = wxEmptyString;
|
||||
|
||||
std::vector<LAYER_PRESET_3D>& presets = m_frame->GetAdapter().m_Cfg->m_LayerPresets;
|
||||
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
|
||||
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
|
||||
|
||||
auto it = std::find_if(
|
||||
presets.begin(), presets.end(),
|
||||
[&]( const LAYER_PRESET_3D& aPreset )
|
||||
{
|
||||
if( aPreset.name.Lower() == _( "legacy colors" )
|
||||
&& m_cbUseBoardStackupColors->GetValue() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for( int layer = LAYER_3D_BOARD; layer < LAYER_3D_END; ++layer )
|
||||
{
|
||||
if( aPreset.layers.test( layer ) != visibleLayers.test( layer ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
for( int layer : { LAYER_FP_REFERENCES, LAYER_FP_VALUES, LAYER_FP_TEXT } )
|
||||
{
|
||||
if( aPreset.layers.test( layer ) != visibleLayers.test( layer ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
for( int layer = LAYER_3D_START + 1; layer < LAYER_3D_END; ++layer )
|
||||
{
|
||||
auto it1 = aPreset.colors.find( layer );
|
||||
auto it2 = colors.find( layer );
|
||||
|
||||
if( it1 != aPreset.colors.end() && it2 != colors.end() && *it1 != *it2 )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} );
|
||||
|
||||
if( it != presets.end() )
|
||||
{
|
||||
m_frame->GetAdapter().m_Cfg->m_CurrentPreset = it->name;
|
||||
m_cbLayerPresets->SetStringSelection( it->name );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 3 ); // separator
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::updateLayerPresetWidget( const wxString& aName )
|
||||
{
|
||||
if( aName == FOLLOW_PCB )
|
||||
m_cbLayerPresets->SetSelection( 0 );
|
||||
else if( aName == FOLLOW_PLOT_SETTINGS )
|
||||
m_cbLayerPresets->SetSelection( 1 );
|
||||
else if( !m_cbLayerPresets->SetStringSelection( aName ) )
|
||||
m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 3 ); // separator
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::onLayerPresetChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = m_frame->GetAdapter().m_Cfg;
|
||||
int count = m_cbLayerPresets->GetCount();
|
||||
int index = m_cbLayerPresets->GetSelection();
|
||||
wxString name;
|
||||
|
||||
auto resetSelection =
|
||||
[&]()
|
||||
{
|
||||
updateLayerPresetWidget( cfg->m_CurrentPreset );
|
||||
};
|
||||
|
||||
if( index == 0 )
|
||||
{
|
||||
name = FOLLOW_PCB;
|
||||
cfg->m_CurrentPreset = name;
|
||||
UpdateLayerCtls();
|
||||
m_frame->NewDisplay( true );
|
||||
}
|
||||
else if( index == 1 )
|
||||
{
|
||||
name = FOLLOW_PLOT_SETTINGS;
|
||||
cfg->m_CurrentPreset = name;
|
||||
UpdateLayerCtls();
|
||||
m_frame->NewDisplay( true );
|
||||
}
|
||||
else if( index == count - 3 )
|
||||
{
|
||||
// Separator: reject the selection
|
||||
resetSelection();
|
||||
return;
|
||||
}
|
||||
else if( index == count - 2 )
|
||||
{
|
||||
wxTextEntryDialog dlg( wxGetTopLevelParent( this ), _( "Layer preset name:" ),
|
||||
_( "Save Layer Preset" ) );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
{
|
||||
resetSelection();
|
||||
return;
|
||||
}
|
||||
|
||||
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
|
||||
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
|
||||
|
||||
name = dlg.GetValue();
|
||||
|
||||
if( LAYER_PRESET_3D* preset = cfg->FindPreset( name ) )
|
||||
{
|
||||
if( !IsOK( wxGetTopLevelParent( this ), _( "Overwrite existing preset?" ) ) )
|
||||
{
|
||||
resetSelection();
|
||||
return;
|
||||
}
|
||||
|
||||
preset->layers = visibleLayers;
|
||||
preset->colors = colors;
|
||||
m_cbLayerPresets->SetSelection( m_cbLayerPresets->FindString( name ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
cfg->m_LayerPresets.emplace_back( name, visibleLayers, colors );
|
||||
m_cbLayerPresets->SetSelection( m_cbLayerPresets->Insert( name, index - 1 ) );
|
||||
}
|
||||
|
||||
cfg->m_CurrentPreset = name;
|
||||
m_presetMRU.Insert( name, 0 );
|
||||
|
||||
return;
|
||||
}
|
||||
else if( index == count - 1 )
|
||||
{
|
||||
wxArrayString headers;
|
||||
std::vector<wxArrayString> items;
|
||||
|
||||
headers.Add( _( "Presets" ) );
|
||||
|
||||
for( LAYER_PRESET_3D& preset : cfg->m_LayerPresets )
|
||||
{
|
||||
wxArrayString item;
|
||||
item.Add( preset.name );
|
||||
items.emplace_back( item );
|
||||
}
|
||||
|
||||
EDA_LIST_DIALOG dlg( m_frame, _( "Delete Preset" ), headers, items );
|
||||
dlg.SetListLabel( _( "Select preset:" ) );
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
{
|
||||
name = dlg.GetTextSelection();
|
||||
|
||||
if( m_cbLayerPresets->FindString( name ) != wxNOT_FOUND )
|
||||
m_cbLayerPresets->Delete( m_cbLayerPresets->FindString( name ) );
|
||||
|
||||
alg::delete_if( cfg->m_LayerPresets,
|
||||
[name]( const LAYER_PRESET_3D& preset )
|
||||
{
|
||||
return preset.name == name;
|
||||
} );
|
||||
|
||||
if( cfg->m_CurrentPreset == name )
|
||||
cfg->m_CurrentPreset = wxEmptyString;
|
||||
|
||||
m_presetMRU.Remove( name );
|
||||
}
|
||||
|
||||
resetSelection();
|
||||
return;
|
||||
}
|
||||
else if( LAYER_PRESET_3D* preset = cfg->FindPreset( m_cbLayerPresets->GetStringSelection() ) )
|
||||
{
|
||||
name = preset->name;
|
||||
doApplyLayerPreset( *preset );
|
||||
}
|
||||
|
||||
// Move to front of MRU list
|
||||
if( m_presetMRU.Index( name ) != wxNOT_FOUND )
|
||||
m_presetMRU.Remove( name );
|
||||
|
||||
m_presetMRU.Insert( name, 0 );
|
||||
|
||||
passOnFocus();
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::doApplyLayerPreset( const LAYER_PRESET_3D& aPreset )
|
||||
{
|
||||
BOARD_ADAPTER& adapter = m_frame->GetAdapter();
|
||||
|
||||
adapter.m_Cfg->m_CurrentPreset = aPreset.name;
|
||||
adapter.SetVisibleLayers( aPreset.layers );
|
||||
adapter.SetLayerColors( aPreset.colors );
|
||||
|
||||
if( aPreset.name.Lower() == _( "legacy colors" ) )
|
||||
adapter.m_Cfg->m_UseStackupColors = false;
|
||||
|
||||
UpdateLayerCtls();
|
||||
m_frame->NewDisplay( true );
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::rebuildViewportsWidget()
|
||||
{
|
||||
m_viewportsLabel->SetLabel( wxString::Format( _( "Viewports (%s+Tab):" ),
|
||||
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) );
|
||||
|
||||
m_cbViewports->Clear();
|
||||
|
||||
for( std::pair<const wxString, VIEWPORT3D>& pair : m_viewports )
|
||||
m_cbViewports->Append( pair.first, static_cast<void*>( &pair.second ) );
|
||||
|
||||
m_cbViewports->Append( wxT( "---" ) );
|
||||
m_cbViewports->Append( _( "Save viewport..." ) );
|
||||
m_cbViewports->Append( _( "Delete viewport..." ) );
|
||||
|
||||
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
|
||||
m_lastSelectedViewport = nullptr;
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::onViewportChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
int count = m_cbViewports->GetCount();
|
||||
int index = m_cbViewports->GetSelection();
|
||||
|
||||
if( index >= 0 && index < count - 3 )
|
||||
{
|
||||
VIEWPORT3D* viewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( index ) );
|
||||
|
||||
wxCHECK( viewport, /* void */ );
|
||||
|
||||
doApplyViewport( *viewport );
|
||||
|
||||
if( !viewport->name.IsEmpty() )
|
||||
{
|
||||
m_viewportMRU.Remove( viewport->name );
|
||||
m_viewportMRU.Insert( viewport->name, 0 );
|
||||
}
|
||||
}
|
||||
else if( index == count - 2 )
|
||||
{
|
||||
// Save current state to new preset
|
||||
wxString name;
|
||||
|
||||
wxTextEntryDialog dlg( wxGetTopLevelParent( this ), _( "Viewport name:" ),
|
||||
_( "Save Viewport" ), name );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
{
|
||||
if( m_lastSelectedViewport )
|
||||
m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
|
||||
else
|
||||
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
name = dlg.GetValue();
|
||||
bool exists = m_viewports.count( name );
|
||||
|
||||
if( !exists )
|
||||
{
|
||||
m_viewports[name] = VIEWPORT3D( name, m_frame->GetCurrentCamera().GetViewMatrix() );
|
||||
|
||||
index = m_cbViewports->Insert( name, index-1, static_cast<void*>( &m_viewports[name] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_viewports[name].matrix = m_frame->GetCurrentCamera().GetViewMatrix();
|
||||
index = m_cbViewports->FindString( name );
|
||||
m_viewportMRU.Remove( name );
|
||||
}
|
||||
|
||||
m_cbViewports->SetSelection( index );
|
||||
m_viewportMRU.Insert( name, 0 );
|
||||
|
||||
return;
|
||||
}
|
||||
else if( index == count - 1 )
|
||||
{
|
||||
// Delete an existing viewport
|
||||
wxArrayString headers;
|
||||
std::vector<wxArrayString> items;
|
||||
|
||||
headers.Add( _( "Viewports" ) );
|
||||
|
||||
for( std::pair<const wxString, VIEWPORT3D>& pair : m_viewports )
|
||||
{
|
||||
wxArrayString item;
|
||||
item.Add( pair.first );
|
||||
items.emplace_back( item );
|
||||
}
|
||||
|
||||
EDA_LIST_DIALOG dlg( m_frame, _( "Delete Viewport" ), headers, items );
|
||||
dlg.SetListLabel( _( "Select viewport:" ) );
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
{
|
||||
wxString viewportName = dlg.GetTextSelection();
|
||||
int idx = m_cbViewports->FindString( viewportName );
|
||||
|
||||
if( idx != wxNOT_FOUND )
|
||||
{
|
||||
m_viewports.erase( viewportName );
|
||||
m_cbViewports->Delete( idx );
|
||||
m_viewportMRU.Remove( viewportName );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_lastSelectedViewport )
|
||||
m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
|
||||
else
|
||||
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
passOnFocus();
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::onUpdateViewportsCb( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
int count = m_cbViewports->GetCount();
|
||||
int index = m_cbViewports->GetSelection();
|
||||
|
||||
if( index >= 0 && index < count - 3 )
|
||||
{
|
||||
VIEWPORT3D* viewport = static_cast<VIEWPORT3D*>( m_cbViewports->GetClientData( index ) );
|
||||
|
||||
wxCHECK( viewport, /* void */ );
|
||||
|
||||
if( m_frame->GetCurrentCamera().GetViewMatrix() != viewport->matrix )
|
||||
m_cbViewports->SetSelection( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::doApplyViewport( const VIEWPORT3D& aViewport )
|
||||
{
|
||||
m_frame->GetCurrentCamera().SetViewMatrix( aViewport.matrix );
|
||||
|
||||
if( m_frame->GetAdapter().m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||
m_frame->GetCanvas()->Request_refresh();
|
||||
else
|
||||
m_frame->GetCanvas()->RenderRaytracingRequest();
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::passOnFocus()
|
||||
{
|
||||
m_focusOwner->SetFocus();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 CERN
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef APPEARANCE_CONTROLS_3D_H
|
||||
#define APPEARANCE_CONTROLS_3D_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <gal/color4d.h>
|
||||
#include <layer_ids.h>
|
||||
#include <3d_canvas/board_adapter.h>
|
||||
#include <dialogs/appearance_controls_3D_base.h>
|
||||
#include <tool/tool_action.h>
|
||||
#include <wx/intl.h>
|
||||
|
||||
|
||||
class BITMAP_TOGGLE;
|
||||
class COLOR_SWATCH;
|
||||
class EDA_3D_VIEWER_FRAME;
|
||||
class ROW_ICON_PROVIDER;
|
||||
class GRID_BITMAP_TOGGLE_RENDERER;
|
||||
|
||||
using KIGFX::COLOR4D;
|
||||
|
||||
|
||||
class APPEARANCE_CONTROLS_3D : public APPEARANCE_CONTROLS_3D_BASE
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Container for an appearance setting (can control a layer class, object type, etc.)
|
||||
*/
|
||||
class APPEARANCE_SETTING_3D
|
||||
{
|
||||
public:
|
||||
int m_Id;
|
||||
bool m_Visible;
|
||||
bool m_Spacer;
|
||||
|
||||
BITMAP_TOGGLE* m_Ctl_visibility;
|
||||
COLOR_SWATCH* m_Ctl_color;
|
||||
|
||||
APPEARANCE_SETTING_3D( const wxString& aLabel, int aId, const wxString& aTooltip ) :
|
||||
m_Id( aId ),
|
||||
m_Visible( true ),
|
||||
m_Spacer( false ),
|
||||
m_Ctl_visibility( nullptr ),
|
||||
m_Ctl_color( nullptr ),
|
||||
m_tooltip( aTooltip ),
|
||||
m_label( aLabel )
|
||||
{
|
||||
}
|
||||
|
||||
APPEARANCE_SETTING_3D( const wxString& aLabel, int aId, const TOOL_ACTION& aAction ) :
|
||||
m_Id( aId ),
|
||||
m_Visible( true ),
|
||||
m_Spacer( false ),
|
||||
m_Ctl_visibility( nullptr ),
|
||||
m_Ctl_color( nullptr ),
|
||||
m_label( aLabel ),
|
||||
m_action( &aAction )
|
||||
{
|
||||
}
|
||||
|
||||
APPEARANCE_SETTING_3D() :
|
||||
m_Id( -1 ),
|
||||
m_Visible( false ),
|
||||
m_Spacer( true ),
|
||||
m_Ctl_visibility( nullptr ),
|
||||
m_Ctl_color( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
wxString GetTooltip() const
|
||||
{
|
||||
if( m_tooltip.has_value() )
|
||||
return wxGetTranslation( m_tooltip.value() );
|
||||
else if( m_action.has_value() )
|
||||
return m_action.value()->GetTooltip( true );
|
||||
else
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
wxString GetLabel() const
|
||||
{
|
||||
return wxGetTranslation( m_label );
|
||||
}
|
||||
|
||||
private:
|
||||
wxString m_label;
|
||||
|
||||
std::optional<wxString> m_tooltip;
|
||||
std::optional<const TOOL_ACTION*> m_action;
|
||||
};
|
||||
|
||||
APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, wxWindow* aFocusOwner );
|
||||
~APPEARANCE_CONTROLS_3D();
|
||||
|
||||
wxSize GetBestSize() const;
|
||||
|
||||
void OnLanguageChanged();
|
||||
void OnDarkModeToggle();
|
||||
void OnLayerVisibilityChanged( int aLayer, bool isVisible );
|
||||
|
||||
void CommonSettingsChanged();
|
||||
|
||||
void UpdateLayerCtls();
|
||||
|
||||
void ApplyLayerPreset( const wxString& aPresetName );
|
||||
|
||||
const wxArrayString& GetLayerPresetsMRU() { return m_presetMRU; }
|
||||
|
||||
///< Return a list of viewports created by the user.
|
||||
std::vector<VIEWPORT3D> GetUserViewports() const;
|
||||
|
||||
///< Update the current viewports from those saved in the project file.
|
||||
void SetUserViewports( std::vector<VIEWPORT3D>& aPresetList );
|
||||
|
||||
void ApplyViewport( const wxString& aPresetName );
|
||||
|
||||
const wxArrayString& GetViewportsMRU() { return m_viewportMRU; }
|
||||
|
||||
protected:
|
||||
void OnSetFocus( wxFocusEvent& aEvent ) override;
|
||||
void OnSize( wxSizeEvent& aEvent ) override;
|
||||
|
||||
private:
|
||||
void rebuildLayers();
|
||||
|
||||
void rebuildLayerPresetsWidget();
|
||||
|
||||
void syncLayerPresetSelection();
|
||||
|
||||
void rebuildViewportsWidget();
|
||||
|
||||
void onColorSwatchChanged( COLOR_SWATCH* aSwatch );
|
||||
|
||||
void updateLayerPresetWidget( const wxString& aName );
|
||||
|
||||
void onLayerPresetChanged( wxCommandEvent& aEvent ) override;
|
||||
|
||||
void doApplyLayerPreset( const LAYER_PRESET_3D& aPreset );
|
||||
|
||||
void onViewportChanged( wxCommandEvent& aEvent ) override;
|
||||
void onUpdateViewportsCb( wxUpdateUIEvent& aEvent ) override;
|
||||
|
||||
void doApplyViewport( const VIEWPORT3D& aViewport );
|
||||
|
||||
void passOnFocus();
|
||||
|
||||
private:
|
||||
static const APPEARANCE_SETTING_3D s_layerSettings[];
|
||||
|
||||
EDA_3D_VIEWER_FRAME* m_frame;
|
||||
wxWindow* m_focusOwner;
|
||||
|
||||
std::vector<std::unique_ptr<APPEARANCE_SETTING_3D>> m_layerSettings;
|
||||
std::map<int, APPEARANCE_SETTING_3D*> m_layerSettingsMap;
|
||||
|
||||
wxArrayString m_presetMRU;
|
||||
|
||||
std::map<wxString, VIEWPORT3D> m_viewports;
|
||||
VIEWPORT3D* m_lastSelectedViewport;
|
||||
wxArrayString m_viewportMRU;
|
||||
|
||||
wxBoxSizer* m_layersOuterSizer;
|
||||
wxBoxSizer* m_envOuterSizer;
|
||||
int m_pointSize;
|
||||
wxColour m_layerPanelColour;
|
||||
GRID_BITMAP_TOGGLE_RENDERER* m_toggleGridRenderer;
|
||||
wxCheckBox* m_cbUseBoardStackupColors;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,98 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "appearance_controls_3D_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
APPEARANCE_CONTROLS_3D_BASE::APPEARANCE_CONTROLS_3D_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WX_PANEL( parent, id, pos, size, style, name )
|
||||
{
|
||||
this->SetMinSize( wxSize( 200,360 ) );
|
||||
|
||||
m_sizerOuter = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_panelLayers = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_panelLayersSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_windowLayers = new wxScrolledCanvas( m_panelLayers, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
|
||||
m_panelLayersSizer->Add( m_windowLayers, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelLayers->SetSizer( m_panelLayersSizer );
|
||||
m_panelLayers->Layout();
|
||||
m_panelLayersSizer->Fit( m_panelLayers );
|
||||
m_sizerOuter->Add( m_panelLayers, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bBottomMargin;
|
||||
bBottomMargin = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bBottomMargin->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM, 3 );
|
||||
|
||||
wxBoxSizer* bPresets;
|
||||
bPresets = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_presetsLabel = new wxStaticText( this, wxID_ANY, _("Presets (Ctrl+Tab):"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_presetsLabel->Wrap( -1 );
|
||||
bPresets->Add( m_presetsLabel, 1, wxRIGHT|wxLEFT, 2 );
|
||||
|
||||
wxString m_cbLayerPresetsChoices[] = { _("Follow PCB Editor"), _("Follow PCB Plot Settings") };
|
||||
int m_cbLayerPresetsNChoices = sizeof( m_cbLayerPresetsChoices ) / sizeof( wxString );
|
||||
m_cbLayerPresets = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbLayerPresetsNChoices, m_cbLayerPresetsChoices, 0 );
|
||||
m_cbLayerPresets->SetSelection( 1 );
|
||||
bPresets->Add( m_cbLayerPresets, 0, wxALL|wxEXPAND, 2 );
|
||||
|
||||
|
||||
bBottomMargin->Add( bPresets, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bBottomMargin->Add( 0, 2, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bViewports;
|
||||
bViewports = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_viewportsLabel = new wxStaticText( this, wxID_ANY, _("Viewports (Alt+Tab):"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_viewportsLabel->Wrap( -1 );
|
||||
bViewports->Add( m_viewportsLabel, 1, wxRIGHT|wxLEFT, 2 );
|
||||
|
||||
wxString m_cbViewportsChoices[] = { _("(unsaved)") };
|
||||
int m_cbViewportsNChoices = sizeof( m_cbViewportsChoices ) / sizeof( wxString );
|
||||
m_cbViewports = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbViewportsNChoices, m_cbViewportsChoices, 0 );
|
||||
m_cbViewports->SetSelection( 1 );
|
||||
bViewports->Add( m_cbViewports, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 2 );
|
||||
|
||||
|
||||
bBottomMargin->Add( bViewports, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
m_sizerOuter->Add( bBottomMargin, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 );
|
||||
|
||||
|
||||
this->SetSizer( m_sizerOuter );
|
||||
this->Layout();
|
||||
m_sizerOuter->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSetFocus ) );
|
||||
this->Connect( wxEVT_SIZE, wxSizeEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSize ) );
|
||||
m_panelLayers->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSetFocus ), NULL, this );
|
||||
m_cbLayerPresets->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_3D_BASE::onLayerPresetChanged ), NULL, this );
|
||||
m_cbViewports->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_3D_BASE::onViewportChanged ), NULL, this );
|
||||
m_cbViewports->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( APPEARANCE_CONTROLS_3D_BASE::onUpdateViewportsCb ), NULL, this );
|
||||
}
|
||||
|
||||
APPEARANCE_CONTROLS_3D_BASE::~APPEARANCE_CONTROLS_3D_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSetFocus ) );
|
||||
this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSize ) );
|
||||
m_panelLayers->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_3D_BASE::OnSetFocus ), NULL, this );
|
||||
m_cbLayerPresets->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_3D_BASE::onLayerPresetChanged ), NULL, this );
|
||||
m_cbViewports->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_3D_BASE::onViewportChanged ), NULL, this );
|
||||
m_cbViewports->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( APPEARANCE_CONTROLS_3D_BASE::onUpdateViewportsCb ), NULL, this );
|
||||
|
||||
}
|
||||
@@ -1,553 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="17"/>
|
||||
<object class="Project" expanded="true">
|
||||
<property name="class_decoration">; </property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">appearance_controls_3D_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">Appearance Panel 3D</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Panel" expanded="true">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size">200,360</property>
|
||||
<property name="name">APPEARANCE_CONTROLS_3D_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="subclass">WX_PANEL; widgets/wx_panel.h; forward_declare</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="two_step_creation">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnSetFocus">OnSetFocus</event>
|
||||
<event name="OnSize">OnSize</event>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_sizerOuter</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">protected</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxPanel" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_panelLayers</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnSetFocus">OnSetFocus</event>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_panelLayersSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">protected</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="CustomControl" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="class">wxScrolledCanvas</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration"></property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="include">#include <wx/scrolwin.h>
#include <wx/grid.h> // needed for MSVC to see wxScrolledCanvas indirectly exported</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_windowLayers</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxVSCROLL</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">2</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bBottomMargin</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">3</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticLine" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticline1</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxLI_HORIZONTAL</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bPresets</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">2</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticText" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Presets (Ctrl+Tab):</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_presetsLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">2</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxChoice" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Follow PCB Editor" "Follow PCB Plot Settings"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_cbLayerPresets</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">1</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChoice">onLayerPresetChanged</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="false">
|
||||
<property name="height">2</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bViewports</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">2</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticText" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Viewports (Alt+Tab):</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_viewportsLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="false">
|
||||
<property name="border">2</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxChoice" expanded="false">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"(unsaved)"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_cbViewports</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">1</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChoice">onViewportChanged</event>
|
||||
<event name="OnUpdateUI">onUpdateViewportsCb</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
||||
@@ -1,63 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "widgets/wx_panel.h"
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/grid.h> // needed for MSVC to see wxScrolledCanvas indirectly exported
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/choice.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class APPEARANCE_CONTROLS_3D_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class APPEARANCE_CONTROLS_3D_BASE : public WX_PANEL
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxBoxSizer* m_sizerOuter;
|
||||
wxPanel* m_panelLayers;
|
||||
wxBoxSizer* m_panelLayersSizer;
|
||||
wxScrolledCanvas* m_windowLayers;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxStaticText* m_presetsLabel;
|
||||
wxChoice* m_cbLayerPresets;
|
||||
wxStaticText* m_viewportsLabel;
|
||||
wxChoice* m_cbViewports;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnSetFocus( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void OnSize( wxSizeEvent& event ) { event.Skip(); }
|
||||
virtual void onLayerPresetChanged( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onViewportChanged( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onUpdateViewportsCb( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
APPEARANCE_CONTROLS_3D_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
|
||||
~APPEARANCE_CONTROLS_3D_BASE();
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* 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 "panel_3D_colors.h"
|
||||
#include <widgets/color_swatch.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <pgm_base.h>
|
||||
|
||||
|
||||
PANEL_3D_COLORS::PANEL_3D_COLORS( wxWindow* aParent ) :
|
||||
PANEL_3D_COLORS_BASE( aParent )
|
||||
{
|
||||
m_backgroundTop->SetDefaultColor( BOARD_ADAPTER::g_DefaultBackgroundTop );
|
||||
m_backgroundBottom->SetDefaultColor( BOARD_ADAPTER::g_DefaultBackgroundBot );
|
||||
|
||||
m_silkscreenTop->SetUserColors( &BOARD_ADAPTER::g_SilkscreenColors );
|
||||
m_silkscreenTop->SetDefaultColor( BOARD_ADAPTER::g_DefaultSilkscreen );
|
||||
m_silkscreenBottom->SetUserColors( &BOARD_ADAPTER::g_SilkscreenColors );
|
||||
m_silkscreenBottom->SetDefaultColor( BOARD_ADAPTER::g_DefaultSilkscreen );
|
||||
|
||||
m_solderMaskTop->SetUserColors( &BOARD_ADAPTER::g_MaskColors );
|
||||
m_solderMaskTop->SetDefaultColor( BOARD_ADAPTER::g_DefaultSolderMask );
|
||||
m_solderMaskBottom->SetUserColors( &BOARD_ADAPTER::g_MaskColors );
|
||||
m_solderMaskBottom->SetDefaultColor( BOARD_ADAPTER::g_DefaultSolderMask );
|
||||
|
||||
m_solderPaste->SetUserColors( &BOARD_ADAPTER::g_PasteColors );
|
||||
m_solderPaste->SetDefaultColor( BOARD_ADAPTER::g_DefaultSolderPaste );
|
||||
|
||||
m_surfaceFinish->SetUserColors( &BOARD_ADAPTER::g_FinishColors );
|
||||
m_surfaceFinish->SetDefaultColor( BOARD_ADAPTER::g_DefaultSurfaceFinish );
|
||||
|
||||
m_boardBody->SetUserColors( &BOARD_ADAPTER::g_BoardColors );
|
||||
m_boardBody->SetDefaultColor( BOARD_ADAPTER::g_DefaultBoardBody );
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_3D_COLORS::TransferDataToWindow()
|
||||
{
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
m_backgroundTop->SetSupportsOpacity( false );
|
||||
m_backgroundBottom->SetSupportsOpacity( false );
|
||||
m_silkscreenTop->SetSupportsOpacity( false );
|
||||
m_silkscreenBottom->SetSupportsOpacity( false );
|
||||
m_solderMaskTop->SetBackgroundColour( *wxWHITE );
|
||||
m_solderMaskBottom->SetBackgroundColour( *wxWHITE );
|
||||
m_solderPaste->SetSupportsOpacity( false );
|
||||
m_surfaceFinish->SetSupportsOpacity( false );
|
||||
m_boardBody->SetBackgroundColour( *wxWHITE );
|
||||
|
||||
m_backgroundTop->SetSwatchColor( colors->GetColor( LAYER_3D_BACKGROUND_TOP ), false );
|
||||
m_backgroundBottom->SetSwatchColor( colors->GetColor( LAYER_3D_BACKGROUND_BOTTOM ), false );
|
||||
m_silkscreenTop->SetSwatchColor( colors->GetColor( LAYER_3D_SILKSCREEN_TOP ), false );
|
||||
m_silkscreenBottom->SetSwatchColor( colors->GetColor( LAYER_3D_SILKSCREEN_BOTTOM ), false );
|
||||
m_solderMaskTop->SetSwatchColor( colors->GetColor( LAYER_3D_SOLDERMASK_TOP ), false );
|
||||
m_solderMaskBottom->SetSwatchColor( colors->GetColor( LAYER_3D_SOLDERMASK_BOTTOM ), false );
|
||||
m_solderPaste->SetSwatchColor( colors->GetColor( LAYER_3D_SOLDERPASTE ), false );
|
||||
m_surfaceFinish->SetSwatchColor( colors->GetColor( LAYER_3D_COPPER ), false );
|
||||
m_boardBody->SetSwatchColor( colors->GetColor( LAYER_3D_BOARD ), false );
|
||||
|
||||
if( colors->GetUseBoardStackupColors() )
|
||||
m_boardStackupRB->SetValue( true );
|
||||
else
|
||||
m_specificColorsRB->SetValue( true );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_3D_COLORS::TransferDataFromWindow()
|
||||
{
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
colors->SetColor( LAYER_3D_BACKGROUND_TOP, m_backgroundTop->GetSwatchColor() );
|
||||
colors->SetColor( LAYER_3D_BACKGROUND_BOTTOM, m_backgroundBottom->GetSwatchColor() );
|
||||
colors->SetColor( LAYER_3D_SILKSCREEN_TOP, m_silkscreenTop->GetSwatchColor() );
|
||||
colors->SetColor( LAYER_3D_SILKSCREEN_BOTTOM, m_silkscreenBottom->GetSwatchColor() );
|
||||
colors->SetColor( LAYER_3D_SOLDERMASK_TOP, m_solderMaskTop->GetSwatchColor() );
|
||||
colors->SetColor( LAYER_3D_SOLDERMASK_BOTTOM, m_solderMaskBottom->GetSwatchColor() );
|
||||
colors->SetColor( LAYER_3D_SOLDERPASTE, m_solderPaste->GetSwatchColor() );
|
||||
colors->SetColor( LAYER_3D_COPPER, m_surfaceFinish->GetSwatchColor() );
|
||||
colors->SetColor( LAYER_3D_BOARD, m_boardBody->GetSwatchColor() );
|
||||
|
||||
colors->SetUseBoardStackupColors( m_boardStackupRB->GetValue() );
|
||||
|
||||
Pgm().GetSettingsManager().SaveColorSettings( colors, "3d_viewer" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PANEL_3D_COLORS::ResetPanel()
|
||||
{
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
m_backgroundTop->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_BACKGROUND_TOP ), false );
|
||||
m_backgroundBottom->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_BACKGROUND_BOTTOM ), false );
|
||||
m_silkscreenTop->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_SILKSCREEN_TOP ), false );
|
||||
m_silkscreenBottom->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_SILKSCREEN_BOTTOM ), false );
|
||||
m_solderMaskTop->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_SOLDERMASK_TOP ), false );
|
||||
m_solderMaskBottom->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_SOLDERMASK_BOTTOM ), false );
|
||||
m_solderPaste->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_SOLDERPASTE ), false );
|
||||
m_surfaceFinish->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_COPPER ), false );
|
||||
m_boardBody->SetSwatchColor( colors->GetDefaultColor( LAYER_3D_BOARD ), false );
|
||||
|
||||
m_boardStackupRB->SetValue( true );
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* 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 PANEL_3D_COLORS_H
|
||||
#define PANEL_3D_COLORS_H
|
||||
|
||||
#include "panel_3D_colors_base.h"
|
||||
#include <3d_viewer/eda_3d_viewer_frame.h>
|
||||
|
||||
class PANEL_3D_COLORS : public PANEL_3D_COLORS_BASE
|
||||
{
|
||||
public:
|
||||
explicit PANEL_3D_COLORS( wxWindow* aParent );
|
||||
|
||||
bool TransferDataFromWindow() override;
|
||||
bool TransferDataToWindow() override;
|
||||
|
||||
void ResetPanel() override;
|
||||
};
|
||||
|
||||
|
||||
#endif // PANEL_3D_COLORS_H
|
||||
@@ -0,0 +1,153 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/color_swatch.h"
|
||||
|
||||
#include "panel_3D_colors_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PANEL_3D_COLORS_BASE::PANEL_3D_COLORS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name )
|
||||
{
|
||||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_environmentLable = new wxStaticText( this, wxID_ANY, _("Environment Colors"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_environmentLable->Wrap( -1 );
|
||||
bSizerMain->Add( m_environmentLable, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizer1;
|
||||
fgSizer1 = new wxFlexGridSizer( 0, 2, 5, 0 );
|
||||
fgSizer1->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
backgroundTopLabel = new wxStaticText( this, wxID_ANY, _("Background gradient start:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
backgroundTopLabel->Wrap( -1 );
|
||||
fgSizer1->Add( backgroundTopLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_backgroundTop = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer1->Add( m_backgroundTop, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
backgroundBotLabel = new wxStaticText( this, wxID_ANY, _("Background gradient end:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
backgroundBotLabel->Wrap( -1 );
|
||||
fgSizer1->Add( backgroundBotLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_backgroundBottom = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer1->Add( m_backgroundBottom, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 6, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
solderPasteLabel = new wxStaticText( this, wxID_ANY, _("Solder paste:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
solderPasteLabel->Wrap( -1 );
|
||||
fgSizer1->Add( solderPasteLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_solderPaste = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer1->Add( m_solderPaste, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( fgSizer1, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( 0, 15, 0, wxEXPAND, 5 );
|
||||
|
||||
m_boardColorsLabel = new wxStaticText( this, wxID_ANY, _("Board Colors"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_boardColorsLabel->Wrap( -1 );
|
||||
bSizerMain->Add( m_boardColorsLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerMain->Add( m_staticline2, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
m_boardStackupRB = new wxRadioButton( this, wxID_ANY, _("Use board stackup colors"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerMain->Add( m_boardStackupRB, 0, wxTOP|wxBOTTOM|wxLEFT, 8 );
|
||||
|
||||
m_specificColorsRB = new wxRadioButton( this, wxID_ANY, _("Use colors:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerMain->Add( m_specificColorsRB, 0, wxTOP|wxBOTTOM|wxLEFT, 8 );
|
||||
|
||||
wxFlexGridSizer* fgSizer2;
|
||||
fgSizer2 = new wxFlexGridSizer( 0, 2, 5, 0 );
|
||||
fgSizer2->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
silkscreenTopLabel = new wxStaticText( this, wxID_ANY, _("Silkscreen top:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
silkscreenTopLabel->Wrap( -1 );
|
||||
fgSizer2->Add( silkscreenTopLabel, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 20 );
|
||||
|
||||
m_silkscreenTop = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_silkscreenTop, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
silkscreenBottomLabel = new wxStaticText( this, wxID_ANY, _("Silkscreen bottom:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
silkscreenBottomLabel->Wrap( -1 );
|
||||
fgSizer2->Add( silkscreenBottomLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 20 );
|
||||
|
||||
m_silkscreenBottom = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_silkscreenBottom, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
fgSizer2->Add( 0, 6, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
solderMaskTopLabel = new wxStaticText( this, wxID_ANY, _("Solder mask top:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
solderMaskTopLabel->Wrap( -1 );
|
||||
fgSizer2->Add( solderMaskTopLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 20 );
|
||||
|
||||
m_solderMaskTop = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_solderMaskTop, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
solderMaskBottomLabel = new wxStaticText( this, wxID_ANY, _("Solder mask bottom:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
solderMaskBottomLabel->Wrap( -1 );
|
||||
fgSizer2->Add( solderMaskBottomLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 20 );
|
||||
|
||||
m_solderMaskBottom = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_solderMaskBottom, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
fgSizer2->Add( 0, 6, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
surfaceFinishLabel = new wxStaticText( this, wxID_ANY, _("Copper/surface finish:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
surfaceFinishLabel->Wrap( -1 );
|
||||
fgSizer2->Add( surfaceFinishLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 20 );
|
||||
|
||||
m_surfaceFinish = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_surfaceFinish, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
fgSizer2->Add( 0, 6, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
boardBodyLabel = new wxStaticText( this, wxID_ANY, _("Board body:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
boardBodyLabel->Wrap( -1 );
|
||||
fgSizer2->Add( boardBodyLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 20 );
|
||||
|
||||
m_boardBody = new COLOR_SWATCH( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_boardBody, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( fgSizer2, 1, wxEXPAND|wxLEFT, 8 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
bSizerMain->Fit( this );
|
||||
}
|
||||
|
||||
PANEL_3D_COLORS_BASE::~PANEL_3D_COLORS_BASE()
|
||||
{
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,70 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class COLOR_SWATCH;
|
||||
|
||||
#include "widgets/resettable_panel.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_3D_COLORS_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class PANEL_3D_COLORS_BASE : public RESETTABLE_PANEL
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_environmentLable;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxStaticText* backgroundTopLabel;
|
||||
COLOR_SWATCH* m_backgroundTop;
|
||||
wxStaticText* backgroundBotLabel;
|
||||
COLOR_SWATCH* m_backgroundBottom;
|
||||
wxStaticText* solderPasteLabel;
|
||||
COLOR_SWATCH* m_solderPaste;
|
||||
wxStaticText* m_boardColorsLabel;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxRadioButton* m_boardStackupRB;
|
||||
wxRadioButton* m_specificColorsRB;
|
||||
wxStaticText* silkscreenTopLabel;
|
||||
COLOR_SWATCH* m_silkscreenTop;
|
||||
wxStaticText* silkscreenBottomLabel;
|
||||
COLOR_SWATCH* m_silkscreenBottom;
|
||||
wxStaticText* solderMaskTopLabel;
|
||||
COLOR_SWATCH* m_solderMaskTop;
|
||||
wxStaticText* solderMaskBottomLabel;
|
||||
COLOR_SWATCH* m_solderMaskBottom;
|
||||
wxStaticText* surfaceFinishLabel;
|
||||
COLOR_SWATCH* m_surfaceFinish;
|
||||
wxStaticText* boardBodyLabel;
|
||||
COLOR_SWATCH* m_boardBody;
|
||||
|
||||
public:
|
||||
|
||||
PANEL_3D_COLORS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
|
||||
~PANEL_3D_COLORS_BASE();
|
||||
|
||||
};
|
||||
|
||||
@@ -45,11 +45,18 @@ void PANEL_3D_DISPLAY_OPTIONS::OnCheckEnableAnimation( wxCommandEvent& event )
|
||||
void PANEL_3D_DISPLAY_OPTIONS::loadViewSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
|
||||
{
|
||||
// Check/uncheck checkboxes
|
||||
m_checkBoxRealisticMode->SetValue( aCfg->m_Render.realistic );
|
||||
m_checkBoxBoardBody->SetValue( aCfg->m_Render.show_board_body );
|
||||
m_checkBoxAreas->SetValue( aCfg->m_Render.show_zones );
|
||||
|
||||
m_checkBoxSilkscreen->SetValue( aCfg->m_Render.show_silkscreen );
|
||||
m_checkBoxSolderMask->SetValue( aCfg->m_Render.show_soldermask );
|
||||
m_checkBoxSolderpaste->SetValue( aCfg->m_Render.show_solderpaste );
|
||||
m_checkBoxAdhesive->SetValue( aCfg->m_Render.show_adhesive );
|
||||
m_checkBoxComments->SetValue( aCfg->m_Render.show_comments );
|
||||
m_checkBoxECO->SetValue( aCfg->m_Render.show_eco );
|
||||
m_checkBoxSubtractMaskFromSilk->SetValue( aCfg->m_Render.subtract_mask_from_silk );
|
||||
m_checkBoxClipSilkOnViaAnnulus->SetValue( aCfg->m_Render.clip_silk_on_via_annuli );
|
||||
m_checkBoxRenderPlatedPadsAsPlated->SetValue( aCfg->m_Render.differentiate_plated_copper );
|
||||
m_checkBoxClipSilkOnViaAnnulus->SetValue( aCfg->m_Render.clip_silk_on_via_annulus );
|
||||
m_checkBoxRenderPlatedPadsAsPlated->SetValue( aCfg->m_Render.renderPlatedPadsAsPlated );
|
||||
|
||||
m_materialProperties->SetSelection( static_cast<int>( aCfg->m_Render.material_mode ) );
|
||||
|
||||
@@ -76,14 +83,26 @@ bool PANEL_3D_DISPLAY_OPTIONS::TransferDataFromWindow()
|
||||
{
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
|
||||
|
||||
// Set render mode
|
||||
cfg->m_Render.realistic = m_checkBoxRealisticMode->GetValue();
|
||||
|
||||
// Set visibility of items
|
||||
cfg->m_Render.show_board_body = m_checkBoxBoardBody->GetValue();
|
||||
cfg->m_Render.show_zones = m_checkBoxAreas->GetValue();
|
||||
cfg->m_Render.subtract_mask_from_silk = m_checkBoxSubtractMaskFromSilk->GetValue();
|
||||
cfg->m_Render.clip_silk_on_via_annuli = m_checkBoxClipSilkOnViaAnnulus->GetValue();
|
||||
cfg->m_Render.differentiate_plated_copper = m_checkBoxRenderPlatedPadsAsPlated->GetValue();
|
||||
cfg->m_Render.clip_silk_on_via_annulus = m_checkBoxClipSilkOnViaAnnulus->GetValue();
|
||||
cfg->m_Render.renderPlatedPadsAsPlated = m_checkBoxRenderPlatedPadsAsPlated->GetValue();
|
||||
|
||||
cfg->m_Render.material_mode = static_cast<MATERIAL_MODE>( m_materialProperties->GetSelection() );
|
||||
|
||||
// Set Layer visibility
|
||||
cfg->m_Render.show_silkscreen = m_checkBoxSilkscreen->GetValue();
|
||||
cfg->m_Render.show_soldermask = m_checkBoxSolderMask->GetValue();
|
||||
cfg->m_Render.show_solderpaste = m_checkBoxSolderpaste->GetValue();
|
||||
cfg->m_Render.show_adhesive = m_checkBoxAdhesive->GetValue();
|
||||
cfg->m_Render.show_comments = m_checkBoxComments->GetValue();
|
||||
cfg->m_Render.show_eco = m_checkBoxECO->GetValue( );
|
||||
|
||||
// Camera Options
|
||||
cfg->m_Camera.animation_enabled = m_checkBoxEnableAnimation->GetValue();
|
||||
cfg->m_Camera.moving_speed_multiplier = m_sliderAnimationSpeed->GetValue();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -15,11 +15,69 @@ PANEL_3D_DISPLAY_OPTIONS_BASE::PANEL_3D_DISPLAY_OPTIONS_BASE( wxWindow* parent,
|
||||
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizer7;
|
||||
bSizer7 = new wxBoxSizer( wxVERTICAL );
|
||||
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizeLeft;
|
||||
bSizeLeft = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_boardLayersLabel = new wxStaticText( this, wxID_ANY, _("Board Layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_boardLayersLabel->Wrap( -1 );
|
||||
bSizeLeft->Add( m_boardLayersLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizeLeft->Add( m_staticline2, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizer1;
|
||||
fgSizer1 = new wxFlexGridSizer( 0, 1, 4, 0 );
|
||||
fgSizer1->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_checkBoxSilkscreen = new wxCheckBox( this, wxID_ANY, _("Show silkscreen layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer1->Add( m_checkBoxSilkscreen, 0, wxLEFT, 5 );
|
||||
|
||||
m_checkBoxSubtractMaskFromSilk = new wxCheckBox( this, wxID_ANY, _("Clip silkscreen at solder mask edges"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer1->Add( m_checkBoxSubtractMaskFromSilk, 0, wxLEFT, 25 );
|
||||
|
||||
m_checkBoxClipSilkOnViaAnnulus = new wxCheckBox( this, wxID_ANY, _("Clip silkscreen at via annuli"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer1->Add( m_checkBoxClipSilkOnViaAnnulus, 0, wxLEFT, 25 );
|
||||
|
||||
m_checkBoxSolderMask = new wxCheckBox( this, wxID_ANY, _("Show solder mask layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer1->Add( m_checkBoxSolderMask, 0, wxTOP|wxLEFT, 5 );
|
||||
|
||||
m_checkBoxSolderpaste = new wxCheckBox( this, wxID_ANY, _("Show solder paste layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer1->Add( m_checkBoxSolderpaste, 0, wxLEFT, 5 );
|
||||
|
||||
m_checkBoxAdhesive = new wxCheckBox( this, wxID_ANY, _("Show adhesive layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer1->Add( m_checkBoxAdhesive, 0, wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizeLeft->Add( fgSizer1, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
bSizeLeft->Add( 0, 15, 0, wxEXPAND, 5 );
|
||||
|
||||
m_userLayersLabel = new wxStaticText( this, wxID_ANY, _("User Layers (not shown in realistic mode)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_userLayersLabel->Wrap( -1 );
|
||||
bSizeLeft->Add( m_userLayersLabel, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 13 );
|
||||
|
||||
m_staticline31 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizeLeft->Add( m_staticline31, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bSizeLeft->Add( 0, 5, 0, wxEXPAND, 5 );
|
||||
|
||||
m_checkBoxComments = new wxCheckBox( this, wxID_ANY, _("Show comment and drawing layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizeLeft->Add( m_checkBoxComments, 0, wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
bSizeLeft->Add( 0, 4, 0, wxEXPAND, 5 );
|
||||
|
||||
m_checkBoxECO = new wxCheckBox( this, wxID_ANY, _("Show ECO layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizeLeft->Add( m_checkBoxECO, 0, wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
bSizeLeft->Add( 0, 15, 0, wxEXPAND, 5 );
|
||||
|
||||
m_renderOptionsLabel = new wxStaticText( this, wxID_ANY, _("Render Options"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_renderOptionsLabel->Wrap( -1 );
|
||||
bSizeLeft->Add( m_renderOptionsLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
|
||||
@@ -28,20 +86,20 @@ PANEL_3D_DISPLAY_OPTIONS_BASE::PANEL_3D_DISPLAY_OPTIONS_BASE( wxWindow* parent,
|
||||
bSizeLeft->Add( m_staticline4, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizer2;
|
||||
fgSizer2 = new wxFlexGridSizer( 0, 1, 5, 0 );
|
||||
fgSizer2 = new wxFlexGridSizer( 0, 1, 4, 0 );
|
||||
fgSizer2->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_checkBoxClipSilkOnViaAnnulus = new wxCheckBox( this, wxID_ANY, _("Clip silkscreen at via annuli"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_checkBoxClipSilkOnViaAnnulus, 0, wxLEFT, 5 );
|
||||
m_checkBoxBoardBody = new wxCheckBox( this, wxID_ANY, _("Show board body"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_checkBoxBoardBody, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkBoxSubtractMaskFromSilk = new wxCheckBox( this, wxID_ANY, _("Clip silkscreen at solder mask edges"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_checkBoxSubtractMaskFromSilk, 0, wxLEFT, 5 );
|
||||
m_checkBoxRealisticMode = new wxCheckBox( this, wxID_ANY, _("Realistic mode"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_checkBoxRealisticMode, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkBoxAreas = new wxCheckBox( this, wxID_ANY, _("Show filled areas in zones"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_checkBoxAreas, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkBoxRenderPlatedPadsAsPlated = new wxCheckBox( this, wxID_ANY, _("Use bare copper color for unplated copper (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkBoxRenderPlatedPadsAsPlated = new wxCheckBox( this, wxID_ANY, _("Use bare copper color for unplated copper"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkBoxRenderPlatedPadsAsPlated->SetToolTip( _("Use different colors for plated and unplated copper. (Slow)") );
|
||||
|
||||
fgSizer2->Add( m_checkBoxRenderPlatedPadsAsPlated, 0, wxRIGHT|wxLEFT, 5 );
|
||||
@@ -94,27 +152,35 @@ PANEL_3D_DISPLAY_OPTIONS_BASE::PANEL_3D_DISPLAY_OPTIONS_BASE( wxWindow* parent,
|
||||
bSizerRotAngle->Add( m_staticTextRotAngleUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizerRight->Add( bSizerRotAngle, 0, wxTOP|wxLEFT, 5 );
|
||||
bSizerRight->Add( bSizerRotAngle, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bSizer9;
|
||||
bSizer9 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_checkBoxEnableAnimation = new wxCheckBox( this, wxID_ANY, _("Enable animation"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkBoxEnableAnimation->SetValue(true);
|
||||
bSizer9->Add( m_checkBoxEnableAnimation, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizerRight->Add( bSizer9, 0, wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerSlider;
|
||||
bSizerSlider = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_checkBoxEnableAnimation = new wxCheckBox( this, wxID_ANY, _("Redraw while moving"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkBoxEnableAnimation->SetValue(true);
|
||||
bSizerSlider->Add( m_checkBoxEnableAnimation, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticAnimationSpeed = new wxStaticText( this, wxID_ANY, _("Redraw speed:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticAnimationSpeed = new wxStaticText( this, wxID_ANY, _("Animation speed:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticAnimationSpeed->Wrap( -1 );
|
||||
bSizerSlider->Add( m_staticAnimationSpeed, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
|
||||
bSizerSlider->Add( m_staticAnimationSpeed, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_sliderAnimationSpeed = new wxSlider( this, wxID_ANY, 3, 1, 5, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS );
|
||||
bSizerSlider->Add( m_sliderAnimationSpeed, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
m_sliderAnimationSpeed->SetMinSize( wxSize( 100,-1 ) );
|
||||
|
||||
bSizerSlider->Add( m_sliderAnimationSpeed, 1, wxEXPAND|wxLEFT|wxRIGHT, 15 );
|
||||
|
||||
|
||||
bSizerRight->Add( bSizerSlider, 0, wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizer7->Add( bSizerRight, 0, wxEXPAND|wxTOP, 15 );
|
||||
bSizer7->Add( bSizerRight, 0, wxEXPAND, 15 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizer7, 1, 0, 5 );
|
||||
@@ -125,12 +191,14 @@ PANEL_3D_DISPLAY_OPTIONS_BASE::PANEL_3D_DISPLAY_OPTIONS_BASE( wxWindow* parent,
|
||||
bSizerMain->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
m_checkBoxRealisticMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_3D_DISPLAY_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
|
||||
m_checkBoxEnableAnimation->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_3D_DISPLAY_OPTIONS_BASE::OnCheckEnableAnimation ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_3D_DISPLAY_OPTIONS_BASE::~PANEL_3D_DISPLAY_OPTIONS_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_checkBoxRealisticMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_3D_DISPLAY_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
|
||||
m_checkBoxEnableAnimation->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_3D_DISPLAY_OPTIONS_BASE::OnCheckEnableAnimation ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer7</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">20</property>
|
||||
@@ -75,6 +75,814 @@
|
||||
<property name="name">bSizeLeft</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">13</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Board Layers</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_boardLayersLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticLine" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticline2</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxLI_HORIZONTAL</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<property name="cols">1</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols"></property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">fgSizer1</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">4</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show silkscreen layers</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_checkBoxSilkscreen</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">25</property>
|
||||
<property name="flag">wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Clip silkscreen at solder mask edges</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_checkBoxSubtractMaskFromSilk</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">25</property>
|
||||
<property name="flag">wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Clip silkscreen at via annuli</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_checkBoxClipSilkOnViaAnnulus</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show solder mask layers</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_checkBoxSolderMask</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show solder paste layers</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_checkBoxSolderpaste</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show adhesive layers</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_checkBoxAdhesive</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">15</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">13</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">User Layers (not shown in realistic mode)</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_userLayersLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticLine" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticline31</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxLI_HORIZONTAL</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">5</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show comment and drawing layers</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_checkBoxComments</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">4</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show ECO layers</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_checkBoxECO</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">15</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">13</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
@@ -209,10 +1017,10 @@
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">5</property>
|
||||
<property name="vgap">4</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxLEFT</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -243,7 +1051,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Clip silkscreen at via annuli</property>
|
||||
<property name="label">Show board body</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -251,7 +1059,7 @@
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_checkBoxClipSilkOnViaAnnulus</property>
|
||||
<property name="name">m_checkBoxBoardBody</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
@@ -276,7 +1084,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxLEFT</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -307,7 +1115,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Clip silkscreen at solder mask edges</property>
|
||||
<property name="label">Realistic mode</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -315,7 +1123,7 @@
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_checkBoxSubtractMaskFromSilk</property>
|
||||
<property name="name">m_checkBoxRealisticMode</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
@@ -336,6 +1144,7 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnCheckRealisticMode</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
@@ -435,7 +1244,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Use bare copper color for unplated copper (slow)</property>
|
||||
<property name="label">Use bare copper color for unplated copper</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -608,7 +1417,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">15</property>
|
||||
<property name="flag">wxEXPAND|wxTOP</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
@@ -734,11 +1543,11 @@
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxLEFT</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerRotAngle</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
@@ -937,12 +1746,12 @@
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerSlider</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="name">bSizer9</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -973,7 +1782,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Redraw while moving</property>
|
||||
<property name="label">Enable animation</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -1005,8 +1814,19 @@
|
||||
<event name="OnCheckBox">OnCheckEnableAnimation</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerSlider</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">15</property>
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="0">
|
||||
@@ -1037,7 +1857,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Redraw speed:</property>
|
||||
<property name="label">Animation speed:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
@@ -1067,9 +1887,9 @@
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<property name="border">15</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxSlider" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
@@ -1105,7 +1925,7 @@
|
||||
<property name="minValue">1</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="minimum_size">100,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_sliderAnimationSpeed</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -19,8 +19,8 @@
|
||||
#include <wx/settings.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/panel.h>
|
||||
@@ -36,10 +36,22 @@ class PANEL_3D_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_boardLayersLabel;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxCheckBox* m_checkBoxSilkscreen;
|
||||
wxCheckBox* m_checkBoxSubtractMaskFromSilk;
|
||||
wxCheckBox* m_checkBoxClipSilkOnViaAnnulus;
|
||||
wxCheckBox* m_checkBoxSolderMask;
|
||||
wxCheckBox* m_checkBoxSolderpaste;
|
||||
wxCheckBox* m_checkBoxAdhesive;
|
||||
wxStaticText* m_userLayersLabel;
|
||||
wxStaticLine* m_staticline31;
|
||||
wxCheckBox* m_checkBoxComments;
|
||||
wxCheckBox* m_checkBoxECO;
|
||||
wxStaticText* m_renderOptionsLabel;
|
||||
wxStaticLine* m_staticline4;
|
||||
wxCheckBox* m_checkBoxClipSilkOnViaAnnulus;
|
||||
wxCheckBox* m_checkBoxSubtractMaskFromSilk;
|
||||
wxCheckBox* m_checkBoxBoardBody;
|
||||
wxCheckBox* m_checkBoxRealisticMode;
|
||||
wxCheckBox* m_checkBoxAreas;
|
||||
wxCheckBox* m_checkBoxRenderPlatedPadsAsPlated;
|
||||
wxStaticText* m_materialPropertiesLabel;
|
||||
@@ -54,6 +66,7 @@ class PANEL_3D_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL
|
||||
wxSlider* m_sliderAnimationSpeed;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnCheckRealisticMode( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCheckEnableAnimation( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ PANEL_3D_OPENGL_OPTIONS::PANEL_3D_OPENGL_OPTIONS( wxWindow* aParent ) :
|
||||
void PANEL_3D_OPENGL_OPTIONS::loadSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
|
||||
{
|
||||
m_checkBoxCuThickness->SetValue( aCfg->m_Render.opengl_copper_thickness );
|
||||
m_checkBoxBoundingBoxes->SetValue( aCfg->m_Render.show_model_bbox );
|
||||
m_checkBoxHighlightOnRollOver->SetValue( aCfg->m_Render.highlight_on_rollover );
|
||||
m_checkBoxBoundingBoxes->SetValue( aCfg->m_Render.opengl_show_model_bbox );
|
||||
m_checkBoxHighlightOnRollOver->SetValue( aCfg->m_Render.opengl_highlight_on_rollover );
|
||||
|
||||
m_choiceAntiAliasing->SetSelection( static_cast<int>( aCfg->m_Render.opengl_AA_mode ) );
|
||||
m_selectionColorSwatch->SetSwatchColor( aCfg->m_Render.opengl_selection_color, false );
|
||||
@@ -69,8 +69,8 @@ bool PANEL_3D_OPENGL_OPTIONS::TransferDataFromWindow()
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
|
||||
|
||||
cfg->m_Render.opengl_copper_thickness = m_checkBoxCuThickness->GetValue();
|
||||
cfg->m_Render.show_model_bbox = m_checkBoxBoundingBoxes->GetValue();
|
||||
cfg->m_Render.highlight_on_rollover = m_checkBoxHighlightOnRollOver->GetValue();
|
||||
cfg->m_Render.opengl_show_model_bbox = m_checkBoxBoundingBoxes->GetValue();
|
||||
cfg->m_Render.opengl_highlight_on_rollover = m_checkBoxHighlightOnRollOver->GetValue();
|
||||
|
||||
cfg->m_Render.opengl_AA_mode = static_cast<ANTIALIASING_MODE>( m_choiceAntiAliasing->GetSelection() );
|
||||
cfg->m_Render.opengl_selection_color = m_selectionColorSwatch->GetSwatchColor();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-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
|
||||
@@ -35,9 +35,8 @@
|
||||
#include <bitmaps.h>
|
||||
#include <board.h>
|
||||
#include <common_ogl/ogl_attr_list.h>
|
||||
#include <dpi_scaling_common.h>
|
||||
#include <gal/dpi_scaling.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project_pcb.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <widgets/wx_infobar.h>
|
||||
@@ -64,8 +63,6 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
// This board will only be used to hold a footprint for viewing
|
||||
m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
|
||||
|
||||
m_bodyStyleShowAll = true;
|
||||
|
||||
BOARD_DESIGN_SETTINGS parent_bds = aFrame->GetDesignSettings();
|
||||
BOARD_DESIGN_SETTINGS& dummy_bds = m_dummyBoard->GetDesignSettings();
|
||||
dummy_bds.SetBoardThickness( parent_bds.GetBoardThickness() );
|
||||
@@ -79,16 +76,15 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
m_previewLabel->SetFont( KIUI::GetStatusFont( this ) );
|
||||
|
||||
// Set the bitmap of 3D view buttons:
|
||||
m_bpvTop->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_top ) );
|
||||
m_bpvFront->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_front ) );
|
||||
m_bpvBack->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_back ) );
|
||||
m_bpvLeft->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_left ) );
|
||||
m_bpvRight->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_right ) );
|
||||
m_bpvBottom->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_bottom ) );
|
||||
m_bpvISO->SetBitmap( KiBitmapBundle( BITMAPS::ortho ) );
|
||||
m_bpvBodyStyle->SetBitmap( KiBitmapBundle( BITMAPS::axis3d ) );
|
||||
m_bpUpdate->SetBitmap( KiBitmapBundle( BITMAPS::reload ) );
|
||||
m_bpSettings->SetBitmap( KiBitmapBundle( BITMAPS::options_3drender ) );
|
||||
m_bpvTop->SetBitmap( KiBitmap( BITMAPS::axis3d_top ) );
|
||||
m_bpvFront->SetBitmap( KiBitmap( BITMAPS::axis3d_front ) );
|
||||
m_bpvBack->SetBitmap( KiBitmap( BITMAPS::axis3d_back ) );
|
||||
m_bpvLeft->SetBitmap( KiBitmap( BITMAPS::axis3d_left ) );
|
||||
m_bpvRight->SetBitmap( KiBitmap( BITMAPS::axis3d_right ) );
|
||||
m_bpvBottom->SetBitmap( KiBitmap( BITMAPS::axis3d_bottom ) );
|
||||
m_bpvISO->SetBitmap( KiBitmap( BITMAPS::ortho ) );
|
||||
m_bpUpdate->SetBitmap( KiBitmap( BITMAPS::reload ) );
|
||||
m_bpSettings->SetBitmap( KiBitmap( BITMAPS::options_3drender ) );
|
||||
|
||||
// Set the min and max values of spin buttons (mandatory on Linux)
|
||||
// They are not used, so they are set to min and max 32 bits int values
|
||||
@@ -123,7 +119,8 @@ 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,
|
||||
aFrame->Prj().Get3DCacheManager() );
|
||||
|
||||
m_boardAdapter.SetBoard( m_dummyBoard );
|
||||
m_boardAdapter.m_IsBoardView = false;
|
||||
@@ -158,8 +155,7 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
this );
|
||||
}
|
||||
|
||||
aFrame->Connect( EDA_EVT_UNITS_CHANGED,
|
||||
wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
|
||||
aFrame->Connect( UNITS_CHANGED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
|
||||
nullptr, this );
|
||||
|
||||
#ifdef __WXOSX__
|
||||
@@ -186,10 +182,6 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
|
||||
PANEL_PREVIEW_3D_MODEL::~PANEL_PREVIEW_3D_MODEL()
|
||||
{
|
||||
// Restore the 3D viewer Render settings, that can be modified by the panel tools
|
||||
if( m_boardAdapter.m_Cfg )
|
||||
m_boardAdapter.m_Cfg->m_Render = m_initialRender;
|
||||
|
||||
delete m_dummyBoard;
|
||||
delete m_previewPane;
|
||||
}
|
||||
@@ -210,33 +202,45 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
|
||||
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
||||
const DPI_SCALING 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;
|
||||
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
if( colors )
|
||||
{
|
||||
auto set =
|
||||
[] ( const COLOR4D& aColor, SFVEC4F& aTarget )
|
||||
{
|
||||
aTarget.r = aColor.r;
|
||||
aTarget.g = aColor.g;
|
||||
aTarget.b = aColor.b;
|
||||
aTarget.a = aColor.a;
|
||||
};
|
||||
|
||||
set( colors->GetColor( LAYER_3D_BACKGROUND_BOTTOM ), m_boardAdapter.m_BgColorBot );
|
||||
set( colors->GetColor( LAYER_3D_BACKGROUND_TOP ), m_boardAdapter.m_BgColorTop );
|
||||
set( colors->GetColor( LAYER_3D_BOARD ), m_boardAdapter.m_BoardBodyColor );
|
||||
set( colors->GetColor( LAYER_3D_COPPER ), m_boardAdapter.m_CopperColor );
|
||||
set( colors->GetColor( LAYER_3D_SILKSCREEN_BOTTOM ), m_boardAdapter.m_SilkScreenColorBot );
|
||||
set( colors->GetColor( LAYER_3D_SILKSCREEN_TOP ), m_boardAdapter.m_SilkScreenColorTop );
|
||||
set( colors->GetColor( LAYER_3D_SOLDERMASK_BOTTOM ), m_boardAdapter.m_SolderMaskColorBot );
|
||||
set( colors->GetColor( LAYER_3D_SOLDERMASK_TOP ), m_boardAdapter.m_SolderMaskColorTop );
|
||||
set( colors->GetColor( LAYER_3D_SOLDERPASTE ), m_boardAdapter.m_SolderPasteColor );
|
||||
}
|
||||
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
// Save the 3D viewer render settings, to restore it after closing the preview
|
||||
m_initialRender = cfg->m_Render;
|
||||
|
||||
m_boardAdapter.m_Cfg = cfg;
|
||||
|
||||
m_previewPane->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
|
||||
m_previewPane->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
|
||||
m_previewPane->SetProjectionMode( cfg->m_Camera.projection_mode );
|
||||
|
||||
// Ensure the board body is always shown, and do not use the settings of the 3D viewer
|
||||
cfg->m_Render.show_copper_top = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_copper_bottom = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_soldermask_top = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_soldermask_bottom = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_solderpaste = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_zones = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_board_body = m_bodyStyleShowAll;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,40 +391,18 @@ void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::setBodyStyleView( wxCommandEvent& event )
|
||||
{
|
||||
// turn ON or OFF options to show the board body if OFF, soder paste, soldermask
|
||||
// and board body are hidden, to allows a good view of the 3D model and its pads.
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = m_boardAdapter.m_Cfg;
|
||||
|
||||
if( !cfg )
|
||||
return;
|
||||
|
||||
m_bodyStyleShowAll = !m_bodyStyleShowAll;
|
||||
|
||||
cfg->m_Render.show_soldermask_top = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_soldermask_bottom = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_solderpaste = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_zones = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_board_body = m_bodyStyleShowAll;
|
||||
|
||||
m_previewPane->ReloadRequest();
|
||||
m_previewPane->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::View3DSettings( wxCommandEvent& event )
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS bds = m_dummyBoard->GetDesignSettings();
|
||||
int thickness = bds.GetBoardThickness();
|
||||
|
||||
WX_UNIT_ENTRY_DIALOG dlg( m_parentFrame, _( "3D Preview Options" ), _( "Board thickness:" ),
|
||||
thickness );
|
||||
WX_UNIT_ENTRY_DIALOG dlg( m_parentFrame, _( "Board Thickness: " ),
|
||||
_( "Preview Settings" ), thickness );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
bds.SetBoardThickness( dlg.GetValue() );
|
||||
bds.SetBoardThickness( (int) dlg.GetValue() );
|
||||
|
||||
BOARD_STACKUP& boardStackup = m_dummyBoard->GetDesignSettings().GetStackupDescriptor();
|
||||
boardStackup.RemoveAll();
|
||||
@@ -489,8 +471,7 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign
|
||||
|
||||
double step_mm = OFFSET_INCREMENT_MM;
|
||||
double curr_value_mm =
|
||||
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
||||
textCtrl->GetValue() )
|
||||
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 )
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
* Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-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
|
||||
@@ -151,24 +151,19 @@ private:
|
||||
m_previewPane->Refresh();
|
||||
}
|
||||
|
||||
// turn ON or OFF options to show the board body. If OFF, solder paste, soldermask
|
||||
// and board body are hidden, to allows a good view of the 3D model and its pads.
|
||||
// Useful for 3D model placement
|
||||
void setBodyStyleView( wxCommandEvent& event ) override;
|
||||
|
||||
void View3DLeft( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_LEFT );
|
||||
m_previewPane->SetView3D( ID_VIEW3D_LEFT );
|
||||
}
|
||||
|
||||
void View3DFront( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_FRONT );
|
||||
m_previewPane->SetView3D( ID_VIEW3D_FRONT );
|
||||
}
|
||||
|
||||
void View3DTop( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_TOP );
|
||||
m_previewPane->SetView3D( ID_VIEW3D_TOP );
|
||||
}
|
||||
|
||||
void View3DUpdate( wxCommandEvent& event ) override
|
||||
@@ -181,17 +176,17 @@ private:
|
||||
|
||||
void View3DRight( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_RIGHT );
|
||||
m_previewPane->SetView3D( ID_VIEW3D_RIGHT );
|
||||
}
|
||||
|
||||
void View3DBack( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_BACK );
|
||||
m_previewPane->SetView3D( ID_VIEW3D_BACK );
|
||||
}
|
||||
|
||||
void View3DBottom( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( VIEW3D_TYPE::VIEW3D_BOTTOM );
|
||||
m_previewPane->SetView3D( ID_VIEW3D_BOTTOM );
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -206,12 +201,9 @@ private:
|
||||
FOOTPRINT* m_dummyFootprint;
|
||||
|
||||
std::vector<FP_3DMODEL>* m_parentModelList;
|
||||
int m_selected; /// Index into m_parentInfoList
|
||||
int m_selected; /// Index into m_parentInfoList
|
||||
|
||||
EDA_UNITS m_userUnits;
|
||||
bool m_bodyStyleShowAll; /// true if the board body is show
|
||||
/// The 3d viewer Render initial settings (must be saved and restored)
|
||||
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender;
|
||||
};
|
||||
|
||||
#endif // PANEL_PREVIEW_3D_MODEL_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -190,18 +190,10 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
wxBoxSizer* bSizer3DButtons;
|
||||
bSizer3DButtons = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( 0, 10, 0, 0, 5 );
|
||||
|
||||
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 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|wxBOTTOM, 5 );
|
||||
bSizer3DButtons->Add( m_bpvISO, 0, wxTOP, 14 );
|
||||
|
||||
|
||||
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
@@ -233,10 +225,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
bSizer3DButtons->Add( m_bpUpdate, 0, wxBOTTOM, 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 );
|
||||
bSizer3DButtons->Add( m_bpSettings, 0, 0, 5 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizer3DButtons, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 );
|
||||
@@ -285,7 +274,6 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
m_spinZoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onIncrementOffset ), NULL, this );
|
||||
m_opacity->Connect( wxEVT_SLIDER, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onOpacitySlider ), NULL, this );
|
||||
m_bpvISO->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DISO ), NULL, this );
|
||||
m_bpvBodyStyle->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::setBodyStyleView ), NULL, this );
|
||||
m_bpvLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DLeft ), NULL, this );
|
||||
m_bpvRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DRight ), NULL, this );
|
||||
m_bpvFront->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DFront ), NULL, this );
|
||||
@@ -337,7 +325,6 @@ PANEL_PREVIEW_3D_MODEL_BASE::~PANEL_PREVIEW_3D_MODEL_BASE()
|
||||
m_spinZoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onIncrementOffset ), NULL, this );
|
||||
m_opacity->Disconnect( wxEVT_SLIDER, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onOpacitySlider ), NULL, this );
|
||||
m_bpvISO->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DISO ), NULL, this );
|
||||
m_bpvBodyStyle->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::setBodyStyleView ), NULL, this );
|
||||
m_bpvLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DLeft ), NULL, this );
|
||||
m_bpvRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DRight ), NULL, this );
|
||||
m_bpvFront->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DFront ), NULL, this );
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="fg"></property>
|
||||
@@ -120,7 +119,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -182,7 +180,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -249,7 +246,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -310,7 +306,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -372,7 +367,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -439,7 +433,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -500,7 +493,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -562,7 +554,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -629,7 +620,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -722,7 +712,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -784,7 +773,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -851,7 +839,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -912,7 +899,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -974,7 +960,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1041,7 +1026,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1102,7 +1086,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1164,7 +1147,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1231,7 +1213,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1324,7 +1305,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1386,7 +1366,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1453,7 +1432,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1514,7 +1492,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1576,7 +1553,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1643,7 +1619,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1704,7 +1679,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1766,7 +1740,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1833,7 +1806,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1910,7 +1882,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -1999,7 +1970,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -2061,17 +2031,7 @@
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag"></property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">10</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="border">14</property>
|
||||
<property name="flag">wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
@@ -2100,7 +2060,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -2145,81 +2104,6 @@
|
||||
<event name="OnButtonClick">View3DISO</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">MyButton</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bpvBodyStyle</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Show or hide the board body
If hidden, show only copper and silkscreen layers.</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">setBodyStyleView</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
@@ -2260,7 +2144,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -2335,7 +2218,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -2410,7 +2292,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -2485,7 +2366,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -2560,7 +2440,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -2635,7 +2514,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -2720,7 +2598,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -2767,7 +2644,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM</property>
|
||||
<property name="flag"></property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -2795,7 +2672,6 @@
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
@@ -2840,16 +2716,6 @@
|
||||
<event name="OnButtonClick">View3DSettings</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag"></property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">10</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -69,7 +69,6 @@ class PANEL_PREVIEW_3D_MODEL_BASE : public wxPanel
|
||||
wxStaticText* m_previewLabel;
|
||||
wxBoxSizer* m_SizerPanelView;
|
||||
wxBitmapButton* m_bpvISO;
|
||||
wxBitmapButton* m_bpvBodyStyle;
|
||||
wxBitmapButton* m_bpvLeft;
|
||||
wxBitmapButton* m_bpvRight;
|
||||
wxBitmapButton* m_bpvFront;
|
||||
@@ -92,7 +91,6 @@ class PANEL_PREVIEW_3D_MODEL_BASE : public wxPanel
|
||||
virtual void onIncrementOffset( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onOpacitySlider( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DISO( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void setBodyStyleView( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DLeft( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DRight( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DFront( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
@@ -50,7 +50,6 @@ Ian McInerney <ian.s.mcinerney[at]ieee-dot-org>
|
||||
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>
|
||||
|
||||
See git repo on GitLab for contributors at
|
||||
https://gitlab.com/kicad/code/kicad/-/graphs/master
|
||||
|
||||
+248
-289
@@ -15,7 +15,6 @@
|
||||
#
|
||||
# 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.,
|
||||
@@ -46,7 +45,6 @@ set(CMAKE_CXX_FLAGS_QABUILD "-Os -g1 -ggdb1")
|
||||
|
||||
include( GNUInstallDirs )
|
||||
include( CMakeDependentOption )
|
||||
include( CheckCXXCompilerFlag )
|
||||
|
||||
# Output compile_commands.json for various LSP and other users
|
||||
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
|
||||
@@ -55,8 +53,6 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
|
||||
set( KICAD_CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" )
|
||||
set( CMAKE_MODULE_PATH "${KICAD_CMAKE_MODULE_PATH}" )
|
||||
|
||||
include( ConfigurePlatform )
|
||||
|
||||
# Create a flag to identify the non-Apple unix systems
|
||||
if( UNIX AND NOT APPLE )
|
||||
set( UNIX_NOT_APPLE ON )
|
||||
@@ -64,11 +60,12 @@ else()
|
||||
set( UNIX_NOT_APPLE OFF )
|
||||
endif()
|
||||
|
||||
if( APPLE OR WIN32 )
|
||||
set( APPLE_OR_WIN32 ON )
|
||||
else()
|
||||
set( APPLE_OR_WIN32 OFF )
|
||||
endif()
|
||||
# On Windows, binaries created by link option -g3 are very large (more than 1Gb for pcbnew,
|
||||
# and more than 3Gb for the full kicad suite)
|
||||
# This option create binaries using link option -g1 that create much smaller files, but
|
||||
# there are less info in debug (but the file names and line numbers are available)
|
||||
cmake_dependent_option( BUILD_SMALL_DEBUG_FILES "In debug build: create smaller binaries." OFF "NOT MSVC" OFF )
|
||||
|
||||
|
||||
#
|
||||
# KiCad build options should be added below.
|
||||
@@ -78,52 +75,29 @@ endif()
|
||||
# so that build option settings can be included in bug reports.
|
||||
#
|
||||
|
||||
####################################
|
||||
# Feature flags
|
||||
####################################
|
||||
option( KICAD_SPICE_QA
|
||||
"Build software Quality assurance unit tests for spice (default ON)"
|
||||
option( KICAD_SCRIPTING_WXPYTHON
|
||||
"Build wxPython implementation for wx interface building in Python and py.shell (default ON)."
|
||||
ON )
|
||||
mark_as_advanced( KICAD_SCRIPTING_WXPYTHON )
|
||||
|
||||
option( KICAD_INSTALL_DEMOS
|
||||
"Install KiCad demos and examples (default ON)"
|
||||
ON )
|
||||
|
||||
option( KICAD_USE_SENTRY
|
||||
"Build KiCad with support for sentry app metrics"
|
||||
OFF )
|
||||
option( KICAD_BUILD_QA_TESTS
|
||||
"Build software Quality assurance unit tests (default ON)"
|
||||
ON )
|
||||
|
||||
option( KICAD_SIGNAL_INTEGRITY
|
||||
"Build tools for signal integrity analysis ( default ON )"
|
||||
option( KICAD_SPICE
|
||||
"Build KiCad with internal Spice simulator."
|
||||
ON )
|
||||
|
||||
option( KICAD_BUILD_I18N
|
||||
"Build the translation libraries."
|
||||
OFF )
|
||||
|
||||
option( KICAD_BUILD_QA_TESTS
|
||||
"Build software Quality assurance unit tests (default ON)"
|
||||
ON )
|
||||
|
||||
option( KICAD_SCRIPTING_WXPYTHON
|
||||
"Build wxPython implementation for wx interface building in Python and py.shell (default ON)."
|
||||
ON )
|
||||
mark_as_advanced( KICAD_SCRIPTING_WXPYTHON )
|
||||
|
||||
option( KICAD_UPDATE_CHECK
|
||||
"Build in update check"
|
||||
ON )
|
||||
|
||||
# EGL is only needed on Linux with Wayland
|
||||
cmake_dependent_option( KICAD_USE_EGL
|
||||
"Build KiCad with EGL backend support for Wayland."
|
||||
OFF "UNIX_NOT_APPLE"
|
||||
OFF)
|
||||
|
||||
cmake_dependent_option( KICAD_USE_BUNDLED_GLEW
|
||||
"Use the bundled version of GLEW - only available when KICAD_USE_EGL is set"
|
||||
ON "KICAD_USE_EGL"
|
||||
OFF )
|
||||
|
||||
cmake_dependent_option( KICAD_WAYLAND
|
||||
"Support Wayland features"
|
||||
ON "KICAD_USE_EGL"
|
||||
option( KICAD_I18N_UNIX_STRICT_PATH
|
||||
"Use standard Unix locale lookup path (default OFF)."
|
||||
OFF )
|
||||
|
||||
# Options to build with flatpak platform defaults (only on Linux)
|
||||
@@ -137,64 +111,19 @@ cmake_dependent_option( KICAD_BUILD_NIGHTLY_FLATPAK
|
||||
OFF "UNIX_NOT_APPLE"
|
||||
OFF )
|
||||
|
||||
cmake_dependent_option( KICAD_WIN32_DPI_AWARE
|
||||
"Turn on DPI awareness for Windows builds only"
|
||||
OFF "WIN32"
|
||||
OFF )
|
||||
|
||||
cmake_dependent_option( KICAD_WIN32_VERIFY_CODESIGN
|
||||
"When enabled, verifies the code signing signature of certain DLLs loaded during runtime."
|
||||
OFF "WIN32"
|
||||
OFF )
|
||||
|
||||
# On Windows, binaries created by link option -g3 are very large (more than 1Gb for pcbnew,
|
||||
# and more than 3Gb for the full kicad suite)
|
||||
# This option create binaries using link option -g1 that create much smaller files, but
|
||||
# there are less info in debug (but the file names and line numbers are available)
|
||||
cmake_dependent_option( KICAD_BUILD_SMALL_DEBUG_FILES
|
||||
"Create smaller binaries in debug builds."
|
||||
OFF "NOT MSVC"
|
||||
OFF )
|
||||
|
||||
cmake_dependent_option( KICAD_APPLE_MAKE_RELOCATEABLE_BUNDLE
|
||||
"On macOS, post-process the build to make it relocateable (default ON)"
|
||||
ON "APPLE" OFF )
|
||||
|
||||
####################################
|
||||
# Installation options
|
||||
####################################
|
||||
option( KICAD_INSTALL_DEMOS
|
||||
"Install KiCad demos and examples (default ON)"
|
||||
ON )
|
||||
|
||||
option( KICAD_I18N_UNIX_STRICT_PATH
|
||||
"Use standard Unix locale lookup path (default OFF)."
|
||||
OFF )
|
||||
|
||||
cmake_dependent_option( KICAD_WIN32_INSTALL_PDBS
|
||||
"Installs debug pdb to the bin folder, DO NOT USE (NOR REQUIRED) FOR DEBUGGING THE SOURCE ON MSVC. This is purely for release building.
|
||||
MSVC can find the PDBs without this."
|
||||
OFF "WIN32"
|
||||
OFF )
|
||||
|
||||
####################################
|
||||
# Compiler options/tools
|
||||
####################################
|
||||
|
||||
# Not supported by all platforms (for instance mingw)
|
||||
option( KICAD_SANITIZE_ADDRESS
|
||||
"Build KiCad with address sanitizer options. WARNING: Not compatible with gold linker"
|
||||
"Build KiCad with sanitizer options. WARNING: Not compatible with gold linker"
|
||||
OFF )
|
||||
|
||||
# Not supported by all platforms (for instance mingw)
|
||||
option( KICAD_SANITIZE_THREADS
|
||||
"Build KiCad with thread sanitizer options. WARNING: Not compatible with gold linker"
|
||||
"Build KiCad with sanitizer options. WARNING: Not compatible with gold linker"
|
||||
OFF )
|
||||
|
||||
# Enable additional valgrind instrumentation for stack tracking in libcontext
|
||||
option( KICAD_USE_VALGRIND
|
||||
"Build KiCad with valgrind stack tracking enabled."
|
||||
OFF )
|
||||
option( KICAD_SIGNAL_INTEGRITY
|
||||
"Build tools for signal integrity analysis ( default ON )"
|
||||
ON )
|
||||
|
||||
option( KICAD_STDLIB_DEBUG
|
||||
"Build KiCad with libstdc++ debug flags enabled."
|
||||
@@ -206,31 +135,33 @@ option( KICAD_STDLIB_LIGHT_DEBUG
|
||||
|
||||
cmake_dependent_option( KICAD_WIN32_BUILD_PARALLEL_CL_MP
|
||||
"Build in parallel using the /MP compiler option (default OFF for safety reasons)"
|
||||
OFF "WIN32"
|
||||
OFF "WIN32" OFF )
|
||||
|
||||
option( KICAD_USE_VALGRIND
|
||||
"Build KiCad with valgrind stack tracking enabled."
|
||||
OFF )
|
||||
|
||||
cmake_dependent_option( KICAD_WIN32_LTCG
|
||||
"Enable Whole Program Optimization"
|
||||
OFF "WIN32"
|
||||
option( KICAD_NETLIST_QA
|
||||
"Run eeschema netlist QA tests (requires Python 3)"
|
||||
OFF )
|
||||
|
||||
# Advanced option to make link maps (only available on linux)
|
||||
cmake_dependent_option( KICAD_MAKE_LINK_MAPS
|
||||
"Create link maps for artifacts"
|
||||
OFF "UNIX_NOT_APPLE"
|
||||
cmake_dependent_option( KICAD_WIN32_DPI_AWARE
|
||||
"Turn on DPI awareness for Windows builds only"
|
||||
OFF "WIN32" OFF )
|
||||
|
||||
cmake_dependent_option( KICAD_WIN32_CONTEXT_WINFIBER
|
||||
"Use win32 fibers for libcontext"
|
||||
OFF "WIN32" OFF )
|
||||
|
||||
option( KICAD_USE_EGL
|
||||
"Build KiCad with EGL backend support for Wayland."
|
||||
OFF )
|
||||
mark_as_advanced( KICAD_MAKE_LINK_MAPS )
|
||||
|
||||
set( KICAD_INIT_VARIABLES "Default" CACHE STRING "Specify how compiler should initialize variables" )
|
||||
set_property( CACHE KICAD_INIT_VARIABLES PROPERTY STRINGS
|
||||
"Default" # Equivalent to pattern in debug mode (but not when Valgrind is used), zero in release mode
|
||||
"Off" # Don't initialize anything
|
||||
"Zero" # Initialize trivial variables to 0
|
||||
"Pattern" ) # Initialize trivial variables to a non-zero pattern to flag them (usually 0xAA...)
|
||||
cmake_dependent_option( KICAD_USE_BUNDLED_GLEW
|
||||
"Use the bundled version of GLEW - only available when KICAD_USE_EGL is set"
|
||||
ON "KICAD_USE_EGL"
|
||||
OFF )
|
||||
|
||||
####################################
|
||||
# Debugging/profiling
|
||||
####################################
|
||||
option( KICAD_DRC_PROTO
|
||||
"Build the DRC prototype QA tool"
|
||||
OFF )
|
||||
@@ -247,6 +178,35 @@ option( KICAD_GAL_PROFILE
|
||||
"Enable profiling info for GAL"
|
||||
OFF )
|
||||
|
||||
cmake_dependent_option( KICAD_WIN32_INSTALL_PDBS
|
||||
"Installs debug pdb to the bin folder, DO NOT USE (NOR REQUIRED) FOR DEBUGGING THE SOURCE ON MSVC. This is purely for release building.
|
||||
MSVC can find the PDBs without this."
|
||||
OFF "WIN32"
|
||||
OFF )
|
||||
|
||||
option( KICAD_USE_3DCONNEXION
|
||||
"Build KiCad with support for 3Dconnexion devices (Currently only for Mac/MSW)"
|
||||
OFF )
|
||||
|
||||
cmake_dependent_option( KICAD_WIN32_VERIFY_CODESIGN
|
||||
"When enabled, verifies the code signing signature of certain DLLs loaded during runtime."
|
||||
OFF "WIN32"
|
||||
OFF )
|
||||
|
||||
option( KICAD_USE_SENTRY
|
||||
"Build KiCad with support for sentry app metrics"
|
||||
OFF )
|
||||
|
||||
if( KICAD_USE_3DCONNEXION )
|
||||
if( WIN32 )
|
||||
add_definitions( -DKICAD_USE_3DCONNEXION )
|
||||
elseif( APPLE )
|
||||
add_definitions( -DKICAD_USE_3DCONNEXION )
|
||||
else()
|
||||
remove_definitions( -DKICAD_USE_3DCONNEXION )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Global setting: exports are explicit
|
||||
set( CMAKE_CXX_VISIBILITY_PRESET "hidden" )
|
||||
set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )
|
||||
@@ -259,34 +219,30 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Pass defines into KiCad code based on the build options set
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_SCRIPTING_WXPYTHON}>:KICAD_SCRIPTING_WXPYTHON> )
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_SIGNAL_INTEGRITY}>:KICAD_SIGNAL_INTEGRITY> )
|
||||
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_USE_VALGRIND}>:KICAD_USE_VALGRIND> )
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_GAL_PROFILE}>:KICAD_GAL_PROFILE> )
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_WIN32_VERIFY_CODESIGN}>:KICAD_WIN32_VERIFY_CODESIGN> )
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_UPDATE_CHECK}>:KICAD_UPDATE_CHECK> )
|
||||
|
||||
if( KICAD_USE_EGL )
|
||||
message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" )
|
||||
add_compile_definitions( KICAD_USE_EGL )
|
||||
# Enable additional valgrind instrumentation for stack tracking in libcontext
|
||||
if( KICAD_USE_VALGRIND )
|
||||
add_definitions( -DKICAD_USE_VALGRIND )
|
||||
endif()
|
||||
|
||||
if( KICAD_WAYLAND )
|
||||
message( STATUS "Configuring KiCad to support Wayland features" )
|
||||
add_compile_definitions( KICAD_WAYLAND )
|
||||
if( KICAD_GAL_PROFILE )
|
||||
add_definitions( -DKICAD_GAL_PROFILE )
|
||||
endif()
|
||||
|
||||
if( KICAD_WIN32_VERIFY_CODESIGN )
|
||||
add_definitions( -DKICAD_WIN32_VERIFY_CODESIGN )
|
||||
endif()
|
||||
|
||||
# Ensure DEBUG is defined for all platforms in Debug builds
|
||||
add_compile_definitions( $<$<CONFIG:Debug>:DEBUG> )
|
||||
# change to add_compile_definitions() after minimum required CMake version is 3.12
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DEBUG> )
|
||||
|
||||
|
||||
# Add option to add user directories for linker, if any
|
||||
link_directories( ${LINK_DIRECTORIES_PATH} )
|
||||
LINK_DIRECTORIES( ${LINK_DIRECTORIES_PATH} )
|
||||
|
||||
set( KICAD_CONFIG_DIR "kicad" CACHE STRING "Location of user specific KiCad config files" )
|
||||
mark_as_advanced( KICAD_CONFIG_DIR )
|
||||
add_compile_definitions( KICAD_CONFIG_DIR=${KICAD_CONFIG_DIR} )
|
||||
add_definitions( -DKICAD_CONFIG_DIR=${KICAD_CONFIG_DIR} )
|
||||
|
||||
# Set default data file path to CMAKE_INSTALL_PREFIX if it wasn't specified during the
|
||||
# CMake configuration. The value of DEFAULT_INSTALL_PATH is expanded in config.h and
|
||||
@@ -305,25 +261,71 @@ message( STATUS "KiCad install dir: <${DEFAULT_INSTALL_PATH}>" )
|
||||
include( PerformFeatureChecks )
|
||||
perform_feature_checks()
|
||||
|
||||
|
||||
# Setup the compiler warnings
|
||||
include( ${KICAD_CMAKE_MODULE_PATH}/Warnings.cmake )
|
||||
|
||||
if( KICAD_WIN32_CONTEXT_WINFIBER )
|
||||
set(LIBCONTEXT_USE_WINFIBER true)
|
||||
add_compile_definitions(LIBCONTEXT_USE_WINFIBER)
|
||||
else()
|
||||
set(LIBCONTEXT_USE_WINFIBER false)
|
||||
endif()
|
||||
|
||||
if( WIN32 )
|
||||
# define UNICODE and_UNICODE definition on Windows. KiCad uses unicode.
|
||||
# Both definitions are required
|
||||
add_compile_definitions( UNICODE _UNICODE)
|
||||
add_definitions(-DUNICODE -D_UNICODE)
|
||||
|
||||
# In fully standards-compliant mode, M_PI et al. are defined only if
|
||||
# _USE_MATH_DEFINES is set.
|
||||
add_compile_definitions( _USE_MATH_DEFINES )
|
||||
add_definitions( -D_USE_MATH_DEFINES )
|
||||
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_WIN32_DPI_AWARE}>:KICAD_WIN32_DPI_AWARE=1> )
|
||||
# Used for the resource compiler and other arch dependent steps
|
||||
if( MSVC )
|
||||
# CMake does not set CMAKE_SYSTEM_PROCESSOR correctly for MSVC
|
||||
# and it will always return the host instead of the target arch
|
||||
if("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM64")
|
||||
set( KICAD_BUILD_ARCH "arm64" )
|
||||
set( KICAD_BUILD_ARCH_ARM64 1 )
|
||||
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM")
|
||||
set( KICAD_BUILD_ARCH "arm" )
|
||||
set( KICAD_BUILD_ARCH_ARM 1 )
|
||||
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "X86")
|
||||
set( KICAD_BUILD_ARCH "x86" )
|
||||
set( KICAD_BUILD_ARCH_X86 1 )
|
||||
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "x64")
|
||||
set( KICAD_BUILD_ARCH "x64" )
|
||||
set( KICAD_BUILD_ARCH_X64 1 )
|
||||
else()
|
||||
message(FATAL_ERROR "Failed to determine the MSVC target architecture: ${MSVC_C_ARCHITECTURE_ID}")
|
||||
endif()
|
||||
else()
|
||||
if ( NOT CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
set( KICAD_BUILD_ARCH "x86" )
|
||||
set( KICAD_BUILD_ARCH_X86 1 )
|
||||
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
set( KICAD_BUILD_ARCH "x64" )
|
||||
set( KICAD_BUILD_ARCH_X64 1 )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_definitions( -DKICAD_BUILD_ARCH=${KICAD_BUILD_ARCH} )
|
||||
|
||||
if( KICAD_WIN32_DPI_AWARE )
|
||||
add_definitions( -DKICAD_WIN32_DPI_AWARE=1 )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_BUILD_ARCH_X86}>:KICAD_BUILD_ARCH_X86> )
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_BUILD_ARCH_X64}>:KICAD_BUILD_ARCH_X64> )
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_BUILD_ARCH_ARM}>:KICAD_BUILD_ARCH_ARM> )
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_BUILD_ARCH_ARM64}>:KICAD_BUILD_ARCH_ARM64> )
|
||||
if(KICAD_BUILD_ARCH_X64)
|
||||
add_definitions( -DKICAD_BUILD_ARCH_X64 )
|
||||
elseif(KICAD_BUILD_ARCH_X86)
|
||||
add_definitions( -DKICAD_BUILD_ARCH_X86 )
|
||||
elseif(KICAD_BUILD_ARCH_ARM64)
|
||||
add_definitions( -DKICAD_BUILD_ARCH_ARM64 )
|
||||
elseif(KICAD_BUILD_ARCH_ARM)
|
||||
add_definitions( -DKICAD_BUILD_ARCH_ARM )
|
||||
endif()
|
||||
|
||||
#================================================
|
||||
# Provide access to CCACHE
|
||||
@@ -363,28 +365,26 @@ endif(USE_DISTCC)
|
||||
|
||||
|
||||
#================================================
|
||||
# Setup compiler-specific flags
|
||||
# Set flags for GCC, or treat llvm as GCC
|
||||
#================================================
|
||||
|
||||
if( CMAKE_COMPILER_IS_GNUCXX )
|
||||
# Set 32-bit flag for GCC to prevent excess precision (not needed for Clang)
|
||||
# Set 32-bit flag for GCC to prevent excess precision
|
||||
# clang des not know this flag, so keep this separate
|
||||
if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
|
||||
set( CMAKE_CXX_FLAGS "-ffloat-store ${CMAKE_CXX_FLAGS}" )
|
||||
endif()
|
||||
endif( CMAKE_COMPILER_IS_GNUCXX )
|
||||
|
||||
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
# Clang needs this flag or wxStrings, etc. won't be viewable in the debugger
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstandalone-debug" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstandalone-debug" )
|
||||
endif()
|
||||
|
||||
if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
|
||||
# Link flags in Debug: -g1 and -ggdb1 or -g1 and -ggdb3 can be used.
|
||||
# Level 1 produces minimal information, enough for making basic backtraces.
|
||||
# This includes descriptions of functions and external variables, and line number tables,
|
||||
# but no information about local variables.
|
||||
# Level 3 includes full information, but binaries are much larger.
|
||||
if( KICAD_BUILD_SMALL_DEBUG_FILES )
|
||||
if( BUILD_SMALL_DEBUG_FILES )
|
||||
set( CMAKE_C_FLAGS_DEBUG "-g1 -ggdb1" )
|
||||
set( CMAKE_CXX_FLAGS_DEBUG "-g1 -ggdb1" )
|
||||
else()
|
||||
@@ -392,48 +392,14 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3" )
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag( "-ftrivial-auto-var-init=pattern" COMPILER_SUPPORTS_TRIVIAL_PATTERN_INIT )
|
||||
if( COMPILER_SUPPORTS_TRIVIAL_PATTERN_INIT )
|
||||
set( VAR_PATTERN_INIT_FLAGS -ftrivial-auto-var-init=pattern )
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag( "-ftrivial-auto-var-init=zero" COMPILER_SUPPORTS_TRIVIAL_ZERO_INIT )
|
||||
if( COMPILER_SUPPORTS_TRIVIAL_ZERO_INIT )
|
||||
set( VAR_ZERO_INIT_FLAGS -ftrivial-auto-var-init=zero )
|
||||
else()
|
||||
# Clang 15 and below required a special flag to enable the zero-init flag, so try that
|
||||
check_cxx_compiler_flag( "-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang"
|
||||
COMPILER_REQUIRES_ENABLE_TRIVIAL_ZERO_INIT )
|
||||
if( COMPILER_REQUIRES_ENABLE_TRIVIAL_ZERO_INIT )
|
||||
set( VAR_ZERO_INIT_FLAGS -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( NOT KICAD_INIT_VARIABLES STREQUAL "Off" )
|
||||
if( KICAD_INIT_VARIABLES STREQUAL "Default" )
|
||||
# Disable when using valgrind to preserve reporting of uninitialized variables
|
||||
if( NOT KICAD_USE_VALGRIND )
|
||||
# Use pattern init in debug mode only, use zero init every other time
|
||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
|
||||
set( VAR_INIT_FLAGS ${VAR_PATTERN_INIT_FLAGS} )
|
||||
else()
|
||||
set( VAR_INIT_FLAGS ${VAR_ZERO_INIT_FLAGS} )
|
||||
endif()
|
||||
endif()
|
||||
elseif( KICAD_INIT_VARIABLES STREQUAL "Zero" )
|
||||
set( VAR_INIT_FLAGS ${VAR_ZERO_INIT_FLAGS} )
|
||||
elseif( KICAD_INIT_VARIABLES STREQUAL "Pattern" )
|
||||
set( VAR_INIT_FLAGS ${VAR_PATTERN_INIT_FLAGS} )
|
||||
endif()
|
||||
|
||||
if( VAR_INIT_FLAGS )
|
||||
add_compile_options( ${VAR_INIT_FLAGS} )
|
||||
message( STATUS "Initializing trivial variables (${VAR_INIT_FLAGS})" )
|
||||
endif()
|
||||
# Clang needs this flag or wxStrings, etc. won't be viewable in the debugger
|
||||
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstandalone-debug" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstandalone-debug" )
|
||||
endif()
|
||||
|
||||
if( KICAD_SANITIZE_ADDRESS )
|
||||
add_compile_definitions( KICAD_SANITIZE_ADDRESS )
|
||||
add_definitions( -DKICAD_SANITIZE_ADDRESS )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_SANITIZE_VECTOR -fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer" )
|
||||
|
||||
# ASAN shouldn't be used with these options (https://github.com/google/sanitizers/wiki/AddressSanitizer#faq)
|
||||
@@ -441,7 +407,7 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
endif()
|
||||
|
||||
if( KICAD_SANITIZE_THREADS )
|
||||
add_compile_definitions( KICAD_SANITIZE_THREADS )
|
||||
add_definitions( -DKICAD_SANITIZE_THREADS )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_SANITIZE_VECTOR -fsanitize=thread -fno-optimize-sibling-calls -fno-omit-frame-pointer" )
|
||||
|
||||
# Based on this warning https://github.com/JuliaLang/julia/blob/29d5158d27ddc3983ae2e373c4cd05569b9ead6c/src/julia.h#L77
|
||||
@@ -455,12 +421,12 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
endif()
|
||||
|
||||
if( KICAD_STDLIB_DEBUG )
|
||||
add_compile_definitions( KICAD_STDLIB_DEBUG )
|
||||
add_definitions( -DKICAD_STDLIB_DEBUG )
|
||||
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG" )
|
||||
elseif( KICAD_STDLIB_LIGHT_DEBUG )
|
||||
# useless if KICAD_STDLIB_DEBUG is ON.
|
||||
# this option makes some controls to trap out of bound memory access.
|
||||
add_compile_definitions( KICAD_STDLIB_LIGHT_DEBUG )
|
||||
add_definitions( -DKICAD_STDLIB_LIGHT_DEBUG )
|
||||
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wp,-D_GLIBCXX_ASSERTIONS" )
|
||||
endif()
|
||||
|
||||
@@ -478,12 +444,12 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
# for some reasons, cmake does do use always a response file to send the list of objects
|
||||
# to the archiver, and because this list can be very long, and can create issue
|
||||
# when it is used in a command line, force use of a response file to store it
|
||||
set( CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
|
||||
SET( CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
|
||||
|
||||
# The MinGW compiler can use the microsoft system snprintf as standard and it has a broken
|
||||
# API with respect to the C99 standard, so make sure we force it to use its own compliant
|
||||
# snprintf
|
||||
add_compile_definitions( __USE_MINGW_ANSI_STDIO=1 )
|
||||
add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
|
||||
|
||||
# Allow linking for Boost for the UUID against bcrypt
|
||||
set( EXTRA_LIBS "bcrypt" )
|
||||
@@ -499,13 +465,13 @@ if( MSVC )
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/resources/msw/ )
|
||||
|
||||
# Disallow implicit linking for Boost
|
||||
add_compile_definitions( BOOST_ALL_NO_LIB )
|
||||
add_definitions( -DBOOST_ALL_NO_LIB )
|
||||
# But allow it for the UUID so that it will link against bcrypt
|
||||
add_compile_definitions( BOOST_UUID_FORCE_AUTO_LINK )
|
||||
add_definitions( -DBOOST_UUID_FORCE_AUTO_LINK )
|
||||
# Disable MSVC's deprecation warnings
|
||||
add_compile_definitions( _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE _SCL_SECURE_NO_WARNINGS )
|
||||
add_definitions( -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS )
|
||||
# Hide Windows's min() and max() macros
|
||||
add_compile_definitions( NOMINMAX )
|
||||
add_definitions( -DNOMINMAX )
|
||||
# source and execution charset are UTF-8
|
||||
string( APPEND CMAKE_CXX_FLAGS " /utf-8" )
|
||||
# C4290: throw() is interpreted as declspec(nothrow)
|
||||
@@ -514,8 +480,6 @@ if( MSVC )
|
||||
string( APPEND CMAKE_CXX_FLAGS " /wd4800" )
|
||||
# /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
|
||||
string( APPEND CMAKE_CXX_FLAGS_RELEASE " /GF" )
|
||||
string( APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /GF" )
|
||||
@@ -524,20 +488,17 @@ if( MSVC )
|
||||
string( APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /Gy" )
|
||||
# Avoid fatal error because /GF + swig wrapper exceed standard obj file limits
|
||||
string( APPEND CMAKE_CXX_FLAGS " /bigobj" )
|
||||
# /permissive-: This puts MSVC into compliance mode, this flag is default on with C++20
|
||||
# but we want to turn it on to enable debug performance improvements available under C++17 in MSVC 17.5+
|
||||
string( APPEND CMAKE_CXX_FLAGS " /permissive-" )
|
||||
|
||||
# Exception handling
|
||||
# Remove the potential default EHsc option cmake doesn't allow us to remove easily
|
||||
string( REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
|
||||
if( KICAD_WIN32_CONTEXT_WINFIBER )
|
||||
# /EHsc: ensure standard exception C++ unwinding is enabled, "extern C" can never throw exceptions
|
||||
string( APPEND CMAKE_CXX_FLAGS " /EHsc" )
|
||||
# /EHsc: ensure standard exception C++ unwinding is enabled, "extern C" can never throw exceptions
|
||||
string( APPEND CMAKE_CXX_FLAGS " /EHsc" )
|
||||
else()
|
||||
# the asm libcontext implementation a slight change of rules
|
||||
# /EHs: ensure standard exception C++ unwinding is enabled, "extern C" MAY throw exceptions
|
||||
string( APPEND CMAKE_CXX_FLAGS " /EHs" )
|
||||
# the asm libcontext implementation a slight change of rules
|
||||
# /EHs: ensure standard exception C++ unwinding is enabled, "extern C" MAY throw exceptions
|
||||
string( APPEND CMAKE_CXX_FLAGS " /EHs" )
|
||||
endif()
|
||||
|
||||
if( KICAD_SANITIZE_ADDRESS )
|
||||
@@ -546,12 +507,6 @@ if( MSVC )
|
||||
string( APPEND CMAKE_CXX_FLAGS " /fsanitize=address" )
|
||||
endif()
|
||||
|
||||
if( KICAD_WIN32_LTCG )
|
||||
# we are implementing this manually because CMake's LTCG option is incomplete
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/20484
|
||||
string( APPEND CMAKE_CXX_FLAGS_RELEASE " /GL" )
|
||||
endif()
|
||||
|
||||
foreach( type EXE SHARED MODULE)
|
||||
# /DEBUG: create PDB
|
||||
string( APPEND CMAKE_${type}_LINKER_FLAGS " /DEBUG /MANIFEST:NO" )
|
||||
@@ -561,12 +516,6 @@ if( MSVC )
|
||||
# /OPT:ICF: fold common data
|
||||
string( APPEND CMAKE_${type}_LINKER_FLAGS_RELEASE " /OPT:ICF /MANIFEST:NO" )
|
||||
string( APPEND CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO " /OPT:ICF /MANIFEST:NO" )
|
||||
|
||||
if( KICAD_WIN32_LTCG )
|
||||
# we are implementing this manually because CMake's LTCG option is incomplete
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/20484
|
||||
string( APPEND CMAKE_${type}_LINKER_FLAGS_RELEASE " /LTCG" )
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Let cl.exe parallelize builds
|
||||
@@ -575,6 +524,26 @@ if( MSVC )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( KICAD_SCRIPTING_WXPYTHON )
|
||||
add_definitions( -DKICAD_SCRIPTING_WXPYTHON )
|
||||
endif()
|
||||
|
||||
if( KICAD_SPICE )
|
||||
add_definitions( -DKICAD_SPICE )
|
||||
endif()
|
||||
|
||||
if( KICAD_SIGNAL_INTEGRITY )
|
||||
add_definitions( -DKICAD_SIGNAL_INTEGRITY )
|
||||
endif()
|
||||
|
||||
|
||||
if( KICAD_USE_EGL AND UNIX AND NOT APPLE )
|
||||
message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" )
|
||||
add_definitions( -DKICAD_USE_EGL )
|
||||
elseif( KICAD_USE_EGL )
|
||||
message( STATUS "Ignoring KICAD_USE_EGL since not on Linux" )
|
||||
endif()
|
||||
|
||||
# KIFACE_SUFFIX is the file extension used for top level program modules which
|
||||
# implement the KIFACE interface. A valid suffix starts with a period '.'.
|
||||
|
||||
@@ -693,13 +662,31 @@ else()
|
||||
set( KICAD_DEMOS demos
|
||||
CACHE PATH "Location of KiCad demo files." FORCE )
|
||||
|
||||
# Required to run from build folder
|
||||
if( PYTHON_FRAMEWORK )
|
||||
list(APPEND CMAKE_BUILD_RPATH ${PYTHON_FRAMEWORK} )
|
||||
endif()
|
||||
|
||||
# RPATH settings for building shared libraries
|
||||
set( CMAKE_MACOSX_RPATH FALSE )
|
||||
|
||||
# Override default paths for fixup_bundle
|
||||
set( OSX_BUNDLE_OVERRIDE_PATHS "
|
||||
function( gp_item_default_embedded_path_override item default_embedded_path_var )
|
||||
# by default, embed things right next to the main bundle executable:
|
||||
set( path \"@executable_path/../../Contents/MacOS\" )
|
||||
set( overridden 0 )
|
||||
|
||||
# embed .dylibs right next to the main bundle executable:
|
||||
if( item MATCHES \"\\\\.dylib$\" )
|
||||
set( path \"@executable_path/../Frameworks\" )
|
||||
set( overridden 1 )
|
||||
endif()
|
||||
|
||||
set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE )
|
||||
endfunction(gp_item_default_embedded_path_override)
|
||||
|
||||
# If `BU_CHMOD_BUNDLE_ITEMS` is not set, `install_name_tool` will fail to re-write some
|
||||
# loader paths due to lack of writable permissions if the build dependencies were installed
|
||||
# by brew (or didn't have writable permissions)
|
||||
set ( BU_CHMOD_BUNDLE_ITEMS ON )
|
||||
"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced( KICAD_BIN
|
||||
@@ -729,12 +716,8 @@ endif()
|
||||
#
|
||||
# Find OpenGL library, required
|
||||
#
|
||||
if( KICAD_USE_EGL )
|
||||
find_package( OpenGL REQUIRED COMPONENTS OpenGL EGL )
|
||||
else()
|
||||
set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
|
||||
find_package( OpenGL REQUIRED )
|
||||
endif()
|
||||
set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
|
||||
find_package( OpenGL REQUIRED )
|
||||
|
||||
#
|
||||
# Find GLEW library, required
|
||||
@@ -767,18 +750,21 @@ endif()
|
||||
# Find GLM library, required
|
||||
#
|
||||
find_package( GLM 0.9.8 REQUIRED )
|
||||
add_compile_definitions( GLM_FORCE_CTOR_INIT )
|
||||
add_definitions( -DGLM_FORCE_CTOR_INIT )
|
||||
include_directories( SYSTEM ${GLM_INCLUDE_DIR} )
|
||||
|
||||
#
|
||||
# Find zlib library, required
|
||||
#
|
||||
find_package(ZLIB REQUIRED)
|
||||
check_find_package_result( ZLIB_FOUND "ZLIB" )
|
||||
include_directories( SYSTEM ${ZLIB_INCLUDE_DIRS} )
|
||||
|
||||
#
|
||||
# Find libcurl, required
|
||||
# Find CURL library, required
|
||||
#
|
||||
find_package( CURL REQUIRED )
|
||||
include_directories( SYSTEM ${CURL_INCLUDE_DIRS} )
|
||||
|
||||
#
|
||||
# Find Cairo library, required
|
||||
@@ -789,22 +775,10 @@ include_directories( SYSTEM ${CAIRO_INCLUDE_DIR} )
|
||||
find_package( Pixman 0.30 REQUIRED )
|
||||
include_directories( SYSTEM ${PIXMAN_INCLUDE_DIR} )
|
||||
|
||||
# Find libgit2, required
|
||||
find_package( libgit2 REQUIRED )
|
||||
|
||||
# Set include directories for libgit
|
||||
include_directories(${LIBGIT2_INCLUDE_DIRS})
|
||||
|
||||
#
|
||||
# Find Boost headers and libraries, required.
|
||||
set( BOOST_REQUESTED_COMPONENTS locale ) # locale is required by nanoodbc/database libraries
|
||||
|
||||
if( KICAD_BUILD_QA_TESTS )
|
||||
# required by the unit test framework
|
||||
list( APPEND BOOST_REQUESTED_COMPONENTS unit_test_framework )
|
||||
endif()
|
||||
|
||||
find_package( Boost 1.71.0 REQUIRED COMPONENTS ${BOOST_REQUESTED_COMPONENTS} )
|
||||
# Find Boost headers, required.
|
||||
find_package( Boost 1.71.0 REQUIRED )
|
||||
include_directories( SYSTEM ${Boost_INCLUDE_DIR} )
|
||||
|
||||
#
|
||||
# Libraries required for outline font support.
|
||||
@@ -825,7 +799,9 @@ find_package( Fontconfig REQUIRED )
|
||||
include( MinGWResourceCompiler )
|
||||
|
||||
# Find ngspice library, required for integrated circuit simulator
|
||||
find_package( ngspice REQUIRED )
|
||||
if( KICAD_SPICE )
|
||||
find_package( ngspice REQUIRED )
|
||||
endif()
|
||||
|
||||
# Find OpenCascade, required for STEP plugin and tools
|
||||
find_package(OCC)
|
||||
@@ -834,10 +810,10 @@ if( NOT OCC_FOUND )
|
||||
" OpenCASCADE was not found!\n"
|
||||
"================================================================\n")
|
||||
endif()
|
||||
if( OCC_VERSION_STRING VERSION_LESS 7.5.0 )
|
||||
if( OCC_VERSION_STRING VERSION_LESS 7.3.0 )
|
||||
MESSAGE( FATAL_ERROR "================================================================\n"
|
||||
"OpenCASCADE version ${OCC_VERSION_STRING} was found.\n"
|
||||
" KiCad requires a minimum version of 7.5.0\n"
|
||||
" KiCad requires a minimum version of 7.3.0\n"
|
||||
"================================================================\n")
|
||||
endif()
|
||||
include_directories( SYSTEM ${OCC_INCLUDE_DIR} )
|
||||
@@ -878,14 +854,7 @@ check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
|
||||
# Get the correct Python site package install path from the Python interpreter found by
|
||||
# FindPythonInterp unless the user specifically defined a custom path.
|
||||
if( NOT PYTHON_SITE_PACKAGE_PATH )
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import sys, sysconfig
|
||||
if 'deb_system' in sysconfig.get_scheme_names():
|
||||
scheme = 'deb_system'
|
||||
elif sys.version_info > (3, 10):
|
||||
scheme = sysconfig.get_default_scheme()
|
||||
else:
|
||||
scheme = sysconfig._get_default_scheme()
|
||||
print(\"%s\"%sysconfig.get_path('platlib', vars={'platbase': '.'}, scheme=scheme))"
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print(\"%s\"%distutils.sysconfig.get_python_lib(plat_specific=0, standard_lib=0, prefix=''))"
|
||||
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
@@ -901,8 +870,8 @@ if( APPLE )
|
||||
set( PYTHON_DEST "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR}"
|
||||
CACHE PATH "Python module install path."
|
||||
)
|
||||
|
||||
add_compile_definitions( OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR="${OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR}" )
|
||||
# change to add_compile_definitions() after minimum required CMake version is 3.12
|
||||
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR="${OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR}")
|
||||
elseif( VCPKG_TOOLCHAIN )
|
||||
set( PYTHON_DEST "${CMAKE_INSTALL_PREFIX}/bin/Lib/site-packages"
|
||||
CACHE PATH "Python module install path."
|
||||
@@ -940,18 +909,11 @@ set( INC_AFTER ${INC_AFTER} ${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/s
|
||||
|
||||
if( KICAD_SCRIPTING_WXPYTHON )
|
||||
# Find the wxPython installation
|
||||
if( NOT VCPKG_TOOLCHAIN AND NOT KICAD_BUILD_ARCH_ARM64 )
|
||||
find_package( wxPython REQUIRED )
|
||||
find_package( wxPython REQUIRED )
|
||||
|
||||
if( WXPYTHON_VERSION VERSION_LESS 4.0.0 )
|
||||
message( FATAL_ERROR "wxPython Phoenix is required" )
|
||||
endif()
|
||||
|
||||
if( WXPYTHON_WXVERSION VERSION_LESS 3.2.0 )
|
||||
message( FATAL_ERROR "wxWidgets 3.2.0 or greater is required" )
|
||||
endif()
|
||||
if( WXPYTHON_VERSION VERSION_LESS 4.0.0 )
|
||||
message( FATAL_ERROR "wxPython Phoenix is required" )
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# GTK3 is required on Linux
|
||||
@@ -971,6 +933,10 @@ endif()
|
||||
# Find wxWidgets library, required
|
||||
#
|
||||
|
||||
# Turn on wxWidgets compatibility mode for some classes
|
||||
add_definitions( -DWX_COMPATIBILITY )
|
||||
|
||||
|
||||
# Check if '--toolkit=xxx' option has been passed
|
||||
string( REGEX MATCH "--toolkit=([a-zA-Z0-9]+)"
|
||||
WXWIDGETS_REQUESTED_TOOLKIT "${wxWidgets_CONFIG_OPTIONS}" )
|
||||
@@ -989,11 +955,7 @@ else()
|
||||
endif()
|
||||
|
||||
# Require the same wxWidgets version as is used by wxPython
|
||||
if( KICAD_SCRIPTING_WXPYTHON )
|
||||
set( wxWidgets_REQ_VERSION ${WXPYTHON_WXVERSION} )
|
||||
else()
|
||||
set( wxWidgets_REQ_VERSION 3.2.0 )
|
||||
endif()
|
||||
set( wxWidgets_REQ_VERSION ${WXPYTHON_WXVERSION} )
|
||||
|
||||
# See line 49 of cmake/FindwxWidgets.cmake
|
||||
set( wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --static=no )
|
||||
@@ -1003,12 +965,6 @@ find_package( wxWidgets ${wxWidgets_REQ_VERSION} COMPONENTS gl aui adv html core
|
||||
# Include wxWidgets macros.
|
||||
include( ${wxWidgets_USE_FILE} )
|
||||
|
||||
if( NOT MSVC )
|
||||
if( ${wxWidgets_VERSION_STRING} VERSION_LESS 3.2 )
|
||||
message( FATAL_ERROR "wxWidgets 3.2.0 or greater is required" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( MINGW )
|
||||
# This needs to be on a separate line to protect against a broken FindWxWidgets.cmake in vcpkg
|
||||
if( ${wxWidgets_VERSION_STRING} VERSION_LESS 3.1 )
|
||||
@@ -1039,16 +995,9 @@ endif()
|
||||
|
||||
|
||||
if( KICAD_USE_SENTRY )
|
||||
set( KICAD_SENTRY_DSN "" CACHE STRING "The sentry DSN used with sentry integration" )
|
||||
if ( KICAD_SENTRY_DSN STREQUAL "")
|
||||
message( FATAL_ERROR "Sentry DSN must be configured with KICAD_USE_SENTRY" )
|
||||
endif()
|
||||
|
||||
if( WIN32 )
|
||||
set( CRASHPAD_WER_ENABLED ON )
|
||||
endif()
|
||||
set( CRASHPAD_WER_ENABLED ON )
|
||||
add_subdirectory( thirdparty/sentry-native )
|
||||
add_compile_definitions( KICAD_USE_SENTRY )
|
||||
add_definitions( -DKICAD_USE_SENTRY )
|
||||
endif()
|
||||
|
||||
#================================================
|
||||
@@ -1062,6 +1011,17 @@ add_subdirectory( doxygen )
|
||||
configure_file( ${PROJECT_SOURCE_DIR}/cmake/config.h.cmake
|
||||
${CMAKE_BINARY_DIR}/config.h )
|
||||
|
||||
###
|
||||
# Generate Map file
|
||||
###
|
||||
if( KICAD_MAKE_LINK_MAPS )
|
||||
# Currently only works on linux/gcc
|
||||
if( UNIX AND NOT APPLE )
|
||||
set( MAKE_LINK_MAPS true )
|
||||
else()
|
||||
set( MAKE_LINK_MAPS false )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#================================================
|
||||
# "make uninstall" rules
|
||||
@@ -1081,7 +1041,6 @@ add_custom_target( uninstall
|
||||
|
||||
include( CTest )
|
||||
enable_testing()
|
||||
list( APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure" )
|
||||
|
||||
#================================================
|
||||
# Let CMake look in these directories for nested
|
||||
|
||||
+117
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
{
|
||||
"environments": [
|
||||
{
|
||||
"BuildDir": "${workspaceRoot}\\build",
|
||||
@@ -7,9 +7,77 @@
|
||||
{
|
||||
"environment": "vcpkg",
|
||||
"VcPkgDir": "D:/vcpkg/"
|
||||
},
|
||||
{
|
||||
"environment": "mingw_64",
|
||||
"MINGW64_ROOT": "D:/msys64/mingw64",
|
||||
"BIN_ROOT": "${env.MINGW64_ROOT}/bin",
|
||||
"FLAVOR": "x86_64-w64-mingw32",
|
||||
"TOOLSET_VERSION": "10.2.0",
|
||||
"PATH": "${env.MINGW64_ROOT}/bin;${env.MINGW64_ROOT}/../usr/local/bin;${env.MINGW64_ROOT}/../usr/bin;${env.MINGW64_ROOT}/../bin;${env.PATH}",
|
||||
"INCLUDE": "${env.INCLUDE};${env.MINGW64_ROOT}/include/c++/${env.TOOLSET_VERSION};${env.MINGW64_ROOT}/include/c++/${env.TOOLSET_VERSION}/tr1;${env.MINGW64_ROOT}/include/c++/${env.TOOLSET_VERSION}/${env.FLAVOR}"
|
||||
}
|
||||
],
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x86-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x86", "vcpkg" ],
|
||||
"buildRoot": "${env.BuildDir}\\${name}",
|
||||
"installRoot": "${env.InstallDir}\\${name}",
|
||||
"addressSanitizerEnabled": false,
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"variables": [
|
||||
{
|
||||
"name": "KICAD_SPICE",
|
||||
"value": "ON",
|
||||
"type": "STRING"
|
||||
},
|
||||
{
|
||||
"name": "KICAD_BUILD_QA_TESTS",
|
||||
"value": "False",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "KICAD_WIN32_DPI_AWARE",
|
||||
"value": "ON",
|
||||
"type": "BOOL"
|
||||
}
|
||||
],
|
||||
"cmakeToolchain": "${env.VcPkgDir}/scripts/buildsystems/vcpkg.cmake"
|
||||
},
|
||||
{
|
||||
"name": "x86-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"inheritEnvironments": [ "msvc_x86", "vcpkg" ],
|
||||
"buildRoot": "${env.BuildDir}\\${name}",
|
||||
"installRoot": "${env.InstallDir}\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"variables": [
|
||||
{
|
||||
"name": "KICAD_SPICE",
|
||||
"value": "ON",
|
||||
"type": "STRING"
|
||||
},
|
||||
{
|
||||
"name": "KICAD_BUILD_QA_TESTS",
|
||||
"value": "False",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "KICAD_WIN32_DPI_AWARE",
|
||||
"value": "ON",
|
||||
"type": "BOOL"
|
||||
}
|
||||
],
|
||||
"cmakeToolchain": "${env.VcPkgDir}/scripts/buildsystems/vcpkg.cmake"
|
||||
},
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
@@ -21,6 +89,11 @@
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"variables": [
|
||||
{
|
||||
"name": "KICAD_SPICE",
|
||||
"value": "ON",
|
||||
"type": "STRING"
|
||||
},
|
||||
{
|
||||
"name": "KICAD_BUILD_QA_TESTS",
|
||||
"value": "False",
|
||||
@@ -45,6 +118,11 @@
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"variables": [
|
||||
{
|
||||
"name": "KICAD_SPICE",
|
||||
"value": "ON",
|
||||
"type": "STRING"
|
||||
},
|
||||
{
|
||||
"name": "KICAD_BUILD_QA_TESTS",
|
||||
"value": "False",
|
||||
@@ -57,6 +135,44 @@
|
||||
}
|
||||
],
|
||||
"cmakeToolchain": "${env.VcPkgDir}/scripts/buildsystems/vcpkg.cmake"
|
||||
},
|
||||
{
|
||||
"name": "MSYS2-x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "mingw_64" ],
|
||||
"buildRoot": "${env.BuildDir}\\${name}",
|
||||
"installRoot": "${env.InstallDir}\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"intelliSenseMode": "linux-gcc-x64",
|
||||
"cmakeToolchain": "",
|
||||
"variables": [
|
||||
{
|
||||
"name": "CMAKE_C_COMPILER",
|
||||
"value": "${env.BIN_ROOT}/gcc.exe"
|
||||
},
|
||||
{
|
||||
"name": "CMAKE_CXX_COMPILER",
|
||||
"value": "${env.BIN_ROOT}/g++.exe"
|
||||
},
|
||||
{
|
||||
"name": "KICAD_SPICE",
|
||||
"value": "ON",
|
||||
"type": "STRING"
|
||||
},
|
||||
{
|
||||
"name": "KICAD_BUILD_QA_TESTS",
|
||||
"value": "False",
|
||||
"type": "BOOL"
|
||||
},
|
||||
{
|
||||
"name": "KICAD_WIN32_DPI_AWARE",
|
||||
"value": "ON",
|
||||
"type": "BOOL"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+99
-3
@@ -17,12 +17,28 @@ The parts of KiCad
|
||||
Installation from binary packages
|
||||
---------------------------------
|
||||
|
||||
Check the KiCad website for packages and installation instructions for
|
||||
all supported platforms: https://kicad.org/download/
|
||||
Compiled KiCad binaries exist for Windows (8.1, 10), macOS (10.14+), and several
|
||||
Linux distributions (Fedora, Debian, Ubuntu, Arch). These are available from the
|
||||
main KiCad website: https://kicad.org/download/
|
||||
|
||||
Data files (schematics, boards, libraries) are compatible with all platforms.
|
||||
|
||||
|
||||
Installation from binary packages for Windows
|
||||
---------------------------------------------
|
||||
|
||||
KiCad can be installed anywhere on the system as long as the user has write privileges.
|
||||
Pre-made installers are available on the KiCad website: https://kicad.org/download/windows/
|
||||
|
||||
|
||||
Installation from binary packages for Linux
|
||||
-------------------------------------------
|
||||
|
||||
KiCad comes packaged on many Linux platforms including Debian, Fedora, Ubuntu and Arch,
|
||||
and is available in their respective package repositories. More information can be found on
|
||||
the platform's page at https://kicad.org/download/
|
||||
|
||||
|
||||
Linux install tree
|
||||
-------------------------------------
|
||||
|
||||
@@ -43,10 +59,74 @@ Linux install tree
|
||||
Do not change the KiCad tree, or the location of binary files. Otherwise
|
||||
KiCad may not be able to find some or all of its required files.
|
||||
|
||||
|
||||
macOS KiCad tree
|
||||
----------------
|
||||
|
||||
System wide files
|
||||
|
||||
/Library/Application Support/kicad/help
|
||||
/Library/Application Support/kicad/template
|
||||
/Library/Application Support/kicad/library
|
||||
/Library/Application Support/kicad/modules
|
||||
/Library/Application Support/kicad/3dmodels
|
||||
|
||||
User files can be the same as the system wide files but only inside the user's home directory.
|
||||
|
||||
$HOME/Library/Application Support/kicad
|
||||
|
||||
Warning:
|
||||
These paths are hardcoded into KiCad, if you put them somewhere else KiCad will not find
|
||||
them when a new project is created.
|
||||
|
||||
|
||||
Installation from source code
|
||||
-----------------------------
|
||||
|
||||
Current documentation for building from source can be found at: https://dev-docs.kicad.org/
|
||||
Currently the only supported compilers are GCC on Linux and Windows and Clang on macOS.
|
||||
|
||||
Some dependencies must be satisfied for the correct installation of KiCad:
|
||||
|
||||
wxWidgets >= 3.0.0 http://www.wxwidgets.org/
|
||||
|
||||
CMake >= 3.10.0 https://www.cmake.org/
|
||||
|
||||
Boost C++ Libraries >= 1.59 https://www.boost.org/
|
||||
|
||||
OpenGL >= 2.1
|
||||
Linux: Mesa 3D Graphics Library http://www.mesa3d.org/
|
||||
Windows: built-in
|
||||
|
||||
Zlib Compression Library http://www.zlib.net/
|
||||
|
||||
cairo >= 1.12 http://cairographics.org/
|
||||
|
||||
GLEW http://glew.sourceforge.net/
|
||||
|
||||
libcurl http://curl.haxx.se/
|
||||
|
||||
OpenMP (optional) http://openmp.org/
|
||||
|
||||
GLM >= 9.5.4 http://glm.g-truc.net/
|
||||
|
||||
pkg-config http://pkgconfig.freedesktop.org/
|
||||
|
||||
Doxygen (optional) http://www.doxygen.nl
|
||||
|
||||
Python >= 2.6 (optional) https://python.org/
|
||||
|
||||
wxPython (optional) http://www.wxpython.org/
|
||||
|
||||
SWIG >= 3.0 (optional) http://swig.org/
|
||||
|
||||
libngspice (optional) http://ngspice.sourceforge.net/
|
||||
|
||||
One of:
|
||||
OCE >= 0.18 (optional) https://github.com/tpaviot/oce
|
||||
|
||||
OCC >= 6.9.0 (optiona) https://www.opencascade.com/content/latest-release
|
||||
|
||||
Complete documentation for building from source can be found at: https://dev-docs.kicad.org/
|
||||
|
||||
|
||||
Important parameters to CMake
|
||||
@@ -60,8 +140,24 @@ Important parameters to CMake
|
||||
-DCMAKE_INSTALL_PREFIX=<prefix>
|
||||
Default to "/usr/local".
|
||||
|
||||
-DwxWidgets_ROOT_DIR=<wxInstallDir>
|
||||
Required for Windows platform.
|
||||
|
||||
-DwxWidgets_USE_DEBUG=ON
|
||||
Can be used only with -DCMAKE_BUILD_TYPE=Debug
|
||||
|
||||
-DCMAKE_CXX_FLAGS=<some extra flags>
|
||||
Extra flags for the C++ compiler required for your system.
|
||||
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON
|
||||
When more output is wanted use this cmake parameter or call "make VERBOSE=1".
|
||||
|
||||
|
||||
Extra CFLAGS and linker flags
|
||||
-----------------------------
|
||||
|
||||
If you require extra flags for compiler and linker you may give them via
|
||||
environment variables
|
||||
"CXXFLAGS" (c++ compiler)
|
||||
"LDFLAGS" (for linker)
|
||||
"CFLAGS" (for c-compiler, not needed in kdesvn build)
|
||||
|
||||
+3
-21
@@ -11,40 +11,22 @@ You are free to use the *sources* under the terms of their respective licenses.
|
||||
Licensed under Apache License, Version 2.0
|
||||
- portions of code in libs/kimath/include/math/util.h
|
||||
Licensed under BOOSTv1:
|
||||
- clipper in thirdparty/clipper
|
||||
- clipper2 in thirdparty/clipper2
|
||||
- libcontext [https://github.com/boostorg/context] in thirdparty/libcontext
|
||||
- pegtl in thirdparty/pegtl
|
||||
- picosha2 in thirdparty/picosha2
|
||||
- turtle in thirdparty/turtle
|
||||
- clipper in thirdparty/clipper
|
||||
Licensed under ISC:
|
||||
- portions of code in include/geometry/polygon_triangulation.h
|
||||
Licensed under MIT:
|
||||
- argparse in thirdparty/argparse
|
||||
- compoundfilereader in thirdparty/compoundfilereader
|
||||
- delaunator in thirdparty/delaunator
|
||||
- fmt in thirdparty/fmt
|
||||
- json_schema_validator in thirdparty/json_schema_validator
|
||||
- magic_enum in thirdparty/magic_enum
|
||||
- nanodbc in thirdparty/nanodbc
|
||||
- tinyspline_lib in thirdparty/tinyspline_lib
|
||||
- nlohmann/json in thirdparty/nlohmann_json
|
||||
- nlohmann/fifo_map in thirdparty/nlohmann_json
|
||||
- pboettch/json-schema-validator in thirdparty/json_schema_validator
|
||||
- picoSHA2 in thirdparty/picosha2
|
||||
- rectpack2d in thirdparty/rectpack2d
|
||||
- sentry-native in thirdparty/sentry-native
|
||||
- thread-pool in thirdparty/thread-pool
|
||||
- tinyspline_lib in thirdparty/tinyspline_lib
|
||||
Licensed under MIT and BSD:
|
||||
- glew in thirdparty/glew
|
||||
Licensed under BSD:
|
||||
- pybind11 in thirdparty/pybind11
|
||||
Licensed under BSD2:
|
||||
- gzip-hpp in thirdparty/gzip-hpp
|
||||
Licensed under GPLv2 (or later):
|
||||
- dxflib in thirdparty/dxflib_qcad
|
||||
- math_for_graphics in thirdparty/other_math
|
||||
- potrace in thirdparty/potrace
|
||||
- math_for_graphics in thirdparty/other_math
|
||||
- SutherlandHodgmanClipPoly in thirdparty/other_math
|
||||
Licensed under ZLib:
|
||||
- nanosvg in thirdparty/nanosvg
|
||||
|
||||
@@ -49,8 +49,8 @@ GitLab CI pipeline status can be viewed for Linux and Windows builds of the late
|
||||
* [plugins](plugins) - Sourcecode for the 3D viewer plugins
|
||||
* [qa](qa) - Unit testing framework for KiCad
|
||||
* [resources](resources) - Packaging resources such as bitmaps and operating system specific files
|
||||
- [bitmaps_png](resources/bitmaps_png) - Menu and program icons
|
||||
- [project_template](resources/project_template) - Project template
|
||||
- [bitmaps_png](bitmaps_png) - Menu and program icons
|
||||
- [project_template](project_template) - Project template
|
||||
* [scripting](scripting) - Python integration for KiCad
|
||||
* [thirdparty](thirdparty) - Sourcecode of external libraries used in KiCad but not written by the KiCad team
|
||||
* [tools](tools) - Helpers for developing, testing and building
|
||||
|
||||
@@ -4,26 +4,27 @@ if( COMPILER_SUPPORTS_WARNINGS )
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARN_FLAGS_C}")
|
||||
endif()
|
||||
|
||||
add_compile_definitions( BITMAP_2_CMP )
|
||||
add_definitions( -DBITMAP_2_CMP )
|
||||
|
||||
include_directories( BEFORE ${INC_BEFORE} )
|
||||
include_directories( ${INC_AFTER} )
|
||||
|
||||
set( BITMAP2COMPONENT_SRCS
|
||||
${CMAKE_SOURCE_DIR}/common/single_top.cpp
|
||||
bitmap2cmp_control.cpp
|
||||
bitmap2cmp_main.cpp
|
||||
bitmap2cmp_settings.cpp
|
||||
bitmap2component.cpp
|
||||
bitmap2cmp_panel_base.cpp
|
||||
bitmap2cmp_frame.cpp
|
||||
bitmap2cmp_panel.cpp
|
||||
bitmap2cmp_panel_base.cpp
|
||||
bitmap2cmp_gui_base.cpp
|
||||
bitmap2cmp_gui.cpp
|
||||
../common/env_vars.cpp # needed on MSW to avoid a link issue (a symbol not found)
|
||||
)
|
||||
|
||||
set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_BM2CMP"
|
||||
)
|
||||
set_source_files_properties( bitmap2cmp_gui.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "COMPILING_DLL"
|
||||
)
|
||||
|
||||
if( WIN32 )
|
||||
if( MINGW )
|
||||
@@ -61,32 +62,24 @@ if( APPLE )
|
||||
MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/bitmap2component/Info.plist
|
||||
)
|
||||
|
||||
set_target_properties( bitmap2component PROPERTIES INSTALL_RPATH
|
||||
"@executable_path/../Frameworks;@executable_path/../Frameworks/Python.framework" )
|
||||
|
||||
# put individual bundle outside of main bundle as a first step
|
||||
# will be pulled into the main bundle when creating main bundle
|
||||
install( TARGETS bitmap2component
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT binary
|
||||
)
|
||||
|
||||
install( CODE "
|
||||
set( KICAD_CMAKE_MODULE_PATH \"${KICAD_CMAKE_MODULE_PATH}\" )
|
||||
set( KICAD_BIN \"${KICAD_BIN}\" )
|
||||
set( OSX_BUNDLE_INSTALL_BIN_DIR \"${OSX_BUNDLE_INSTALL_BIN_DIR}\" )
|
||||
set( OSX_BUNDLE_INSTALL_LIB_DIR \"${OSX_BUNDLE_INSTALL_LIB_DIR}\" )
|
||||
" )
|
||||
# override default embedded path settings
|
||||
${OSX_BUNDLE_OVERRIDE_PATHS}
|
||||
|
||||
install( CODE [[
|
||||
include( ${KICAD_CMAKE_MODULE_PATH}/InstallSteps/InstallMacOS.cmake )
|
||||
|
||||
# Install any dependencies (this will generally duplicate kicad.app but we can't be sure)
|
||||
install_runtime_deps( "${KICAD_BIN}/bitmap2component.app/Contents/MacOS/bitmap2component"
|
||||
""
|
||||
""
|
||||
# do all the work
|
||||
include( BundleUtilities )
|
||||
fixup_bundle( ${KICAD_BIN}/bitmap2component.app/Contents/MacOS/bitmap2component
|
||||
\"\"
|
||||
\"${PYTHON_FRAMEWORK}\"
|
||||
)
|
||||
]] )
|
||||
" COMPONENT Runtime
|
||||
)
|
||||
else()
|
||||
install( TARGETS bitmap2component
|
||||
DESTINATION ${KICAD_BIN}
|
||||
@@ -101,6 +94,6 @@ endif()
|
||||
|
||||
if( false ) # linker map with cross reference
|
||||
set_target_properties( bitmap2component PROPERTIES
|
||||
LINK_FLAGS "-Wl,--cref,-Map=bitmap2component.map"
|
||||
LINK_FLAGS "-Wl,-cref,-Map=bitmap2component.map"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -1,62 +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 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 <kiway.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/actions.h>
|
||||
#include <bitmap2cmp_frame.h>
|
||||
#include <bitmap2cmp_control.h>
|
||||
|
||||
|
||||
bool BITMAP2CMP_CONTROL::Init()
|
||||
{
|
||||
Reset( MODEL_RELOAD );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_CONTROL::Reset( RESET_REASON aReason )
|
||||
{
|
||||
m_frame = getEditFrame<BITMAP2CMP_FRAME>();
|
||||
}
|
||||
|
||||
|
||||
int BITMAP2CMP_CONTROL::Open( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->OnLoadFile();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int BITMAP2CMP_CONTROL::Close( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->Close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_CONTROL::setTransitions()
|
||||
{
|
||||
Go( &BITMAP2CMP_CONTROL::Open, ACTIONS::open.MakeEvent() );
|
||||
Go( &BITMAP2CMP_CONTROL::Close, ACTIONS::quit.MakeEvent() );
|
||||
}
|
||||
@@ -1,64 +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 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 BITMAP2CMP_CONTROL_H
|
||||
#define BITMAP2CMP_CONTROL_H
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
|
||||
class BITMAP2CMP_FRAME;
|
||||
|
||||
|
||||
/**
|
||||
* Handle actions for the various symbol editor and viewers.
|
||||
*/
|
||||
class BITMAP2CMP_CONTROL : public wxEvtHandler, public TOOL_INTERACTIVE
|
||||
{
|
||||
public:
|
||||
BITMAP2CMP_CONTROL() :
|
||||
TOOL_INTERACTIVE( "bitmap2cmp.Control" ),
|
||||
m_frame( nullptr )
|
||||
{ }
|
||||
|
||||
virtual ~BITMAP2CMP_CONTROL() { }
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override;
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
int Open( const TOOL_EVENT& aEvent );
|
||||
int Close( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
///< Set up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
BITMAP2CMP_FRAME* m_frame;
|
||||
};
|
||||
|
||||
|
||||
#endif // BITMAP2CMP_CONTROL_H
|
||||
@@ -1,579 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2010 jean-pierre.charras
|
||||
* 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
|
||||
* 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 <bitmap2component.h>
|
||||
#include <bitmap2cmp_frame.h>
|
||||
#include <bitmap2cmp_panel.h>
|
||||
#include <bitmap2cmp_settings.h>
|
||||
#include <bitmap_io.h>
|
||||
#include <bitmaps.h>
|
||||
#include <common.h>
|
||||
#include <id.h>
|
||||
#include <kiface_base.h>
|
||||
#include <pgm_base.h>
|
||||
#include <widgets/wx_menubar.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <file_history.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
#include <tool/common_control.h>
|
||||
#include <bitmap2cmp_control.h>
|
||||
#include <tool/actions.h>
|
||||
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
|
||||
#define DEFAULT_DPI 300 // the image DPI used in formats that do not define a DPI
|
||||
|
||||
IMAGE_SIZE::IMAGE_SIZE()
|
||||
{
|
||||
m_outputSize = 0.0;
|
||||
m_originalDPI = DEFAULT_DPI;
|
||||
m_originalSizePixels = 0;
|
||||
m_unit = EDA_UNITS::MILLIMETRES;
|
||||
}
|
||||
|
||||
|
||||
void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
|
||||
{
|
||||
// Safety-check to guarantee no divide-by-zero
|
||||
m_originalDPI = std::max( 1, m_originalDPI );
|
||||
|
||||
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
|
||||
else
|
||||
m_outputSize = m_originalDPI;
|
||||
}
|
||||
|
||||
|
||||
int IMAGE_SIZE::GetOutputDPI()
|
||||
{
|
||||
int outputDPI;
|
||||
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
outputDPI = GetOriginalSizePixels() / m_outputSize;
|
||||
else
|
||||
outputDPI = KiROUND( m_outputSize );
|
||||
|
||||
// Zero is not a DPI, and may cause divide-by-zero errors...
|
||||
outputDPI = std::max( 1, outputDPI );
|
||||
|
||||
return outputDPI;
|
||||
}
|
||||
|
||||
|
||||
void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
|
||||
{
|
||||
// Set the unit used for m_outputSize, and convert the old m_outputSize value
|
||||
// to the value in new unit
|
||||
if( aUnit == m_unit )
|
||||
return;
|
||||
|
||||
// Convert m_outputSize to mm:
|
||||
double size_mm;
|
||||
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
size_mm = m_outputSize;
|
||||
}
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
{
|
||||
size_mm = m_outputSize * 25.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_outputSize is the DPI, not an image size
|
||||
// the image size is m_originalSizePixels / m_outputSize (in inches)
|
||||
if( m_outputSize )
|
||||
size_mm = m_originalSizePixels / m_outputSize * 25.4;
|
||||
else
|
||||
size_mm = 0;
|
||||
}
|
||||
|
||||
// Convert m_outputSize to new value:
|
||||
if( aUnit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
m_outputSize = size_mm;
|
||||
}
|
||||
else if( aUnit == EDA_UNITS::INCHES )
|
||||
{
|
||||
m_outputSize = size_mm / 25.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( size_mm )
|
||||
m_outputSize = m_originalSizePixels / size_mm * 25.4;
|
||||
else
|
||||
m_outputSize = 0;
|
||||
}
|
||||
|
||||
m_unit = aUnit;
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( BITMAP2CMP_FRAME, EDA_BASE_FRAME )
|
||||
EVT_MENU( wxID_CLOSE, BITMAP2CMP_FRAME::OnExit )
|
||||
EVT_MENU( wxID_EXIT, BITMAP2CMP_FRAME::OnExit )
|
||||
|
||||
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, BITMAP2CMP_FRAME::OnFileHistory )
|
||||
EVT_MENU( ID_FILE_LIST_CLEAR, BITMAP2CMP_FRAME::OnClearFileHistory )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
BITMAP2CMP_FRAME::BITMAP2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_BM2CMP, _( "Image Converter" ), wxDefaultPosition,
|
||||
wxDefaultSize, wxDEFAULT_FRAME_STYLE, wxT( "bitmap2cmp" ), unityScale ),
|
||||
m_panel( nullptr ),
|
||||
m_statusBar( nullptr )
|
||||
{
|
||||
m_aboutTitle = _HKI( "KiCad Image Converter" );
|
||||
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
wxIconBundle icon_bundle;
|
||||
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component, 48 ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component, 128 ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component, 256 ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_32 ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_16 ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
|
||||
SetIcons( icon_bundle );
|
||||
|
||||
wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
SetSizer( mainSizer );
|
||||
|
||||
m_panel = new BITMAP2CMP_PANEL( this );
|
||||
mainSizer->Add( m_panel, 1, wxEXPAND, 5 );
|
||||
|
||||
m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
|
||||
|
||||
LoadSettings( config() );
|
||||
|
||||
m_toolManager = new TOOL_MANAGER;
|
||||
m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
|
||||
|
||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
|
||||
|
||||
// Register tools
|
||||
m_toolManager->RegisterTool( new COMMON_CONTROL );
|
||||
m_toolManager->RegisterTool( new BITMAP2CMP_CONTROL );
|
||||
m_toolManager->InitTools();
|
||||
|
||||
ReCreateMenuBar();
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
|
||||
|
||||
if ( m_framePos == wxDefaultPosition )
|
||||
Centre();
|
||||
}
|
||||
|
||||
|
||||
BITMAP2CMP_FRAME::~BITMAP2CMP_FRAME()
|
||||
{
|
||||
SaveSettings( config() );
|
||||
/*
|
||||
* This needed for OSX: avoids further OnDraw processing after this
|
||||
* destructor and before the native window is destroyed
|
||||
*/
|
||||
Freeze();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::OnExit( wxCommandEvent& aEvent )
|
||||
{
|
||||
// Just generate a wxCloseEvent
|
||||
Close( false );
|
||||
}
|
||||
|
||||
|
||||
wxWindow* BITMAP2CMP_FRAME::GetToolCanvas() const
|
||||
{
|
||||
return m_panel->GetCurrentPage();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::OnFileHistory( wxCommandEvent& event )
|
||||
{
|
||||
wxString fn = GetFileFromHistory( event.GetId(), _( "Image files" ) );
|
||||
|
||||
if( !fn.IsEmpty() )
|
||||
{
|
||||
OpenProjectFiles( std::vector<wxString>( 1, fn ) );
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::OnClearFileHistory( wxCommandEvent& aEvent )
|
||||
{
|
||||
ClearFileHistory();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::doReCreateMenuBar()
|
||||
{
|
||||
COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
|
||||
EDA_BASE_FRAME* base_frame = dynamic_cast<EDA_BASE_FRAME*>( this );
|
||||
|
||||
// base_frame == nullptr should not happen, but it makes Coverity happy
|
||||
wxCHECK( base_frame, /* void */ );
|
||||
|
||||
// wxWidgets handles the OSX Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = base_frame->GetMenuBar();
|
||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||
|
||||
//-- File menu -----------------------------------------------------------
|
||||
//
|
||||
ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
|
||||
|
||||
fileMenu->Add( ACTIONS::open );
|
||||
|
||||
static ACTION_MENU* openRecentMenu;
|
||||
FILE_HISTORY& fileHistory = GetFileHistory();
|
||||
|
||||
// Create the menu if it does not exist. Adding a file to/from the history
|
||||
// will automatically refresh the menu.
|
||||
if( !openRecentMenu )
|
||||
{
|
||||
openRecentMenu = new ACTION_MENU( false, tool );
|
||||
openRecentMenu->SetIcon( BITMAPS::recent );
|
||||
|
||||
fileHistory.UseMenu( openRecentMenu );
|
||||
fileHistory.AddFilesToMenu();
|
||||
}
|
||||
|
||||
// Ensure the title is up to date after changing language
|
||||
openRecentMenu->SetTitle( _( "Open Recent" ) );
|
||||
fileHistory.UpdateClearText( openRecentMenu, _( "Clear Recent Files" ) );
|
||||
|
||||
wxMenuItem* item = fileMenu->Add( openRecentMenu->Clone() );
|
||||
|
||||
// Add the file menu condition here since it needs the item ID for the submenu
|
||||
ACTION_CONDITIONS cond;
|
||||
cond.Enable( FILE_HISTORY::FileHistoryNotEmpty( fileHistory ) );
|
||||
RegisterUIUpdateHandler( item->GetId(), cond );
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->AddQuit( _( "Image Converter" ) );
|
||||
|
||||
//-- Preferences menu -----------------------------------------------
|
||||
//
|
||||
ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
|
||||
|
||||
prefsMenu->Add( ACTIONS::openPreferences );
|
||||
|
||||
prefsMenu->AppendSeparator();
|
||||
AddMenuLanguageList( prefsMenu, tool );
|
||||
|
||||
|
||||
//-- Menubar -------------------------------------------------------------
|
||||
//
|
||||
menuBar->Append( fileMenu, _( "&File" ) );
|
||||
menuBar->Append( prefsMenu, _( "&Preferences" ) );
|
||||
base_frame->AddStandardHelpMenu( menuBar );
|
||||
|
||||
base_frame->SetMenuBar( menuBar );
|
||||
delete oldMenuBar;
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::ShowChangedLanguage()
|
||||
{
|
||||
EDA_BASE_FRAME::ShowChangedLanguage();
|
||||
|
||||
UpdateTitle();
|
||||
|
||||
SaveSettings( config() );
|
||||
IMAGE_SIZE imageSizeX = m_panel->GetOutputSizeX();
|
||||
IMAGE_SIZE imageSizeY = m_panel->GetOutputSizeY();
|
||||
Freeze();
|
||||
|
||||
wxSizer* mainSizer = m_panel->GetContainingSizer();
|
||||
mainSizer->Detach( m_panel );
|
||||
m_panel->Destroy();
|
||||
|
||||
m_panel = new BITMAP2CMP_PANEL( this );
|
||||
mainSizer->Add( m_panel, 1, wxEXPAND, 5 );
|
||||
Layout();
|
||||
|
||||
if( !m_bitmapFileName.IsEmpty() )
|
||||
OpenProjectFiles( std::vector<wxString>( 1, m_bitmapFileName ) );
|
||||
|
||||
LoadSettings( config() );
|
||||
m_panel->SetOutputSize( imageSizeX, imageSizeY );
|
||||
|
||||
Thaw();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::UpdateTitle()
|
||||
{
|
||||
wxString title;
|
||||
|
||||
if( !m_bitmapFileName.IsEmpty() )
|
||||
{
|
||||
wxFileName filename( m_bitmapFileName );
|
||||
title = filename.GetFullName() + wxT( " \u2014 " );
|
||||
}
|
||||
|
||||
title += _( "Image Converter" );
|
||||
|
||||
SetTitle( title );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
|
||||
BITMAP2CMP_SETTINGS* cfg = dynamic_cast<BITMAP2CMP_SETTINGS*>( aCfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
m_bitmapFileName = cfg->m_BitmapFileName;
|
||||
m_convertedFileName = cfg->m_ConvertedFileName;
|
||||
m_panel->LoadSettings( cfg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||
|
||||
BITMAP2CMP_SETTINGS* cfg = dynamic_cast<BITMAP2CMP_SETTINGS*>( aCfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_BitmapFileName = m_bitmapFileName;
|
||||
cfg->m_ConvertedFileName = m_convertedFileName;
|
||||
m_panel->SaveSettings( cfg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::OnLoadFile()
|
||||
{
|
||||
wxFileName fn( m_bitmapFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = m_mruPath;
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
||||
_( "Image Files" ) + wxS( " " )+ wxImage::GetImageExtWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
wxString fullFilename = fileDlg.GetPath();
|
||||
|
||||
if( !OpenProjectFiles( std::vector<wxString>( 1, fullFilename ) ) )
|
||||
return;
|
||||
|
||||
fn = fullFilename;
|
||||
m_mruPath = fn.GetPath();
|
||||
SetStatusText( fullFilename );
|
||||
UpdateTitle();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
bool BITMAP2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||
{
|
||||
m_bitmapFileName = aFileSet[0];
|
||||
|
||||
if( m_panel->OpenProjectFiles( aFileSet, aCtl ) )
|
||||
{
|
||||
UpdateFileHistory( m_bitmapFileName );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::ExportDrawingSheetFormat()
|
||||
{
|
||||
wxFileName fn( m_convertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Drawing Sheet File" ), path, wxEmptyString,
|
||||
FILEEXT::DrawingSheetFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( FILEEXT::DrawingSheetFileExtension );
|
||||
m_convertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
m_panel->ExportToBuffer( buffer, KICAD_WKS_LOGO );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::ExportPostScriptFormat()
|
||||
{
|
||||
wxFileName fn( m_convertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create PostScript File" ), path, wxEmptyString,
|
||||
FILEEXT::PSFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( wxT( "ps" ) );
|
||||
m_convertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
m_panel->ExportToBuffer( buffer, POSTSCRIPT_FMT );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::ExportEeschemaFormat()
|
||||
{
|
||||
wxFileName fn( m_convertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Symbol Library" ), path, wxEmptyString,
|
||||
FILEEXT::KiCadSymbolLibFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = EnsureFileExtension( fileDlg.GetPath(), FILEEXT::KiCadSymbolLibFileExtension );
|
||||
m_convertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
m_panel->ExportToBuffer( buffer, EESCHEMA_FMT );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::ExportPcbnewFormat()
|
||||
{
|
||||
wxFileName fn( m_convertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = m_mruPath;
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Footprint Library" ), path, wxEmptyString,
|
||||
FILEEXT::KiCadFootprintLibFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = EnsureFileExtension( fileDlg.GetPath(), FILEEXT::KiCadFootprintFileExtension );
|
||||
m_convertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
m_panel->ExportToBuffer( buffer, PCBNEW_KICAD_MOD );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
m_mruPath = fn.GetPath();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-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 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 BITMOP2CMP_GUI_H_
|
||||
#define BITMOP2CMP_GUI_H_
|
||||
|
||||
#include <kiway_player.h>
|
||||
#include <bitmap2cmp_frame.h>
|
||||
|
||||
#include <eda_units.h>
|
||||
#include <potracelib.h>
|
||||
|
||||
class BITMAP2CMP_PANEL;
|
||||
|
||||
class BITMAP2CMP_FRAME : public KIWAY_PLAYER
|
||||
{
|
||||
public:
|
||||
BITMAP2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
~BITMAP2CMP_FRAME();
|
||||
|
||||
// overload KIWAY_PLAYER virtual
|
||||
bool OpenProjectFiles( const std::vector<wxString>& aFilenames, int aCtl = 0 ) override;
|
||||
|
||||
void OnLoadFile();
|
||||
|
||||
void OnFileHistory( wxCommandEvent& event );
|
||||
void OnClearFileHistory( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Generate a schematic library which contains one component:
|
||||
* the logo
|
||||
*/
|
||||
void ExportEeschemaFormat();
|
||||
|
||||
/**
|
||||
* Generate a footprint in S expr format
|
||||
*/
|
||||
void ExportPcbnewFormat();
|
||||
|
||||
/**
|
||||
* Generate a postscript file
|
||||
*/
|
||||
void ExportPostScriptFormat();
|
||||
|
||||
/**
|
||||
* Generate a file suitable to be copied into a drawing sheet (.kicad_wks) file
|
||||
*/
|
||||
void ExportDrawingSheetFormat();
|
||||
|
||||
void UpdateTitle();
|
||||
void ShowChangedLanguage() override;
|
||||
|
||||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
wxWindow* GetToolCanvas() const override;
|
||||
|
||||
/**
|
||||
* Event handler for the wxID_EXIT and wxID_CLOSE events.
|
||||
*/
|
||||
void OnExit( wxCommandEvent& aEvent );
|
||||
|
||||
protected:
|
||||
void doReCreateMenuBar() override;
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
private:
|
||||
BITMAP2CMP_PANEL* m_panel;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
wxString m_bitmapFileName;
|
||||
wxString m_convertedFileName;
|
||||
};
|
||||
|
||||
#endif// BITMOP2CMP_GUI_H_
|
||||
@@ -0,0 +1,922 @@
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2010 jean-pierre.charras
|
||||
* Copyright (C) 1992-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 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 "bitmap2cmp_gui.h"
|
||||
#include "bitmap2component.h"
|
||||
#include <bitmap2cmp_settings.h>
|
||||
#include <bitmap_io.h>
|
||||
#include <bitmaps.h>
|
||||
#include <kiface_base.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <kiway.h>
|
||||
#include <potracelib.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/common_control.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/rawbmp.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
|
||||
#include "bitmap2cmp_gui_base.h"
|
||||
#include "pgm_base.h"
|
||||
|
||||
#define DEFAULT_DPI 300 // the image DPI used in formats that do not define a DPI
|
||||
|
||||
IMAGE_SIZE::IMAGE_SIZE()
|
||||
{
|
||||
m_outputSize = 0.0;
|
||||
m_originalDPI = DEFAULT_DPI;
|
||||
m_originalSizePixels = 0;
|
||||
m_unit = EDA_UNITS::MILLIMETRES;
|
||||
}
|
||||
|
||||
|
||||
void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
|
||||
{
|
||||
// Safety-check to guarantee no divide-by-zero
|
||||
m_originalDPI = std::max( 1, m_originalDPI );
|
||||
|
||||
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
|
||||
else
|
||||
m_outputSize = m_originalDPI;
|
||||
}
|
||||
|
||||
|
||||
int IMAGE_SIZE::GetOutputDPI()
|
||||
{
|
||||
int outputDPI;
|
||||
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
outputDPI = GetOriginalSizePixels() / m_outputSize;
|
||||
else
|
||||
outputDPI = KiROUND( m_outputSize );
|
||||
|
||||
// Zero is not a DPI, and may cause divide-by-zero errors...
|
||||
outputDPI = std::max( 1, outputDPI );
|
||||
|
||||
return outputDPI;
|
||||
}
|
||||
|
||||
|
||||
void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
|
||||
{
|
||||
// Set the unit used for m_outputSize, and convert the old m_outputSize value
|
||||
// to the value in new unit
|
||||
if( aUnit == m_unit )
|
||||
return;
|
||||
|
||||
// Convert m_outputSize to mm:
|
||||
double size_mm;
|
||||
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
size_mm = m_outputSize;
|
||||
}
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
{
|
||||
size_mm = m_outputSize * 25.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_outputSize is the DPI, not an image size
|
||||
// the image size is m_originalSizePixels / m_outputSize (in inches)
|
||||
if( m_outputSize )
|
||||
size_mm = m_originalSizePixels / m_outputSize * 25.4;
|
||||
else
|
||||
size_mm = 0;
|
||||
}
|
||||
|
||||
// Convert m_outputSize to new value:
|
||||
if( aUnit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
m_outputSize = size_mm;
|
||||
}
|
||||
else if( aUnit == EDA_UNITS::INCHES )
|
||||
{
|
||||
m_outputSize = size_mm / 25.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( size_mm )
|
||||
m_outputSize = m_originalSizePixels / size_mm * 25.4;
|
||||
else
|
||||
m_outputSize = 0;
|
||||
}
|
||||
|
||||
m_unit = aUnit;
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( BM2CMP_FRAME, BM2CMP_FRAME_BASE )
|
||||
EVT_MENU( wxID_EXIT, BM2CMP_FRAME::OnExit )
|
||||
EVT_MENU( wxID_OPEN, BM2CMP_FRAME::OnLoadFile )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
BM2CMP_FRAME_BASE( aParent )
|
||||
{
|
||||
m_ident = FRAME_BM2CMP; // Initialized to wxID_ANY by wxFormBuilder
|
||||
SetKiway( this, aKiway );
|
||||
|
||||
for( wxString unit : { _( "mm" ), _( "Inch" ), _( "DPI" ) } )
|
||||
m_PixelUnit->Append( unit );
|
||||
|
||||
LoadSettings( config() );
|
||||
|
||||
m_outputSizeX.SetUnit( getUnitFromSelection() );
|
||||
m_outputSizeY.SetUnit( getUnitFromSelection() );
|
||||
m_outputSizeX.SetOutputSize( 0, getUnitFromSelection() );
|
||||
m_outputSizeY.SetOutputSize( 0, getUnitFromSelection() );
|
||||
|
||||
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
|
||||
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
|
||||
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
wxIconBundle icon_bundle;
|
||||
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_32 ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_16 ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
|
||||
SetIcons( icon_bundle );
|
||||
|
||||
ReCreateMenuBar();
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
m_buttonExportFile->Enable( false );
|
||||
m_buttonExportClipboard->Enable( false );
|
||||
|
||||
SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
|
||||
|
||||
if ( m_framePos == wxDefaultPosition )
|
||||
Centre();
|
||||
}
|
||||
|
||||
|
||||
BM2CMP_FRAME::~BM2CMP_FRAME()
|
||||
{
|
||||
SaveSettings( config() );
|
||||
/*
|
||||
* This needed for OSX: avoids further OnDraw processing after this
|
||||
* destructor and before the native window is destroyed
|
||||
*/
|
||||
Freeze();
|
||||
}
|
||||
|
||||
|
||||
wxWindow* BM2CMP_FRAME::GetToolCanvas() const
|
||||
{
|
||||
return m_Notebook->GetCurrentPage();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::doReCreateMenuBar()
|
||||
{
|
||||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
|
||||
wxMenu* fileMenu = new wxMenu;
|
||||
|
||||
wxMenuItem* item = new wxMenuItem( fileMenu, wxID_OPEN, _( "Open..." ) + wxT( "\tCtrl+O" ),
|
||||
_( "Load source image" ) );
|
||||
|
||||
fileMenu->Append( item );
|
||||
|
||||
#ifndef __WXMAC__
|
||||
// Mac moves Quit to the App menu so we don't need a separator on Mac
|
||||
fileMenu->AppendSeparator();
|
||||
#endif
|
||||
|
||||
item = new wxMenuItem( fileMenu, wxID_EXIT, _( "Quit" ) + wxT( "\tCtrl+Q" ),
|
||||
_( "Quit Image Converter" ) );
|
||||
|
||||
if( Pgm().GetCommonSettings()->m_Appearance.use_icons_in_menus )
|
||||
item->SetBitmap( KiBitmap( BITMAPS::exit ) );
|
||||
|
||||
fileMenu->Append( item );
|
||||
|
||||
menuBar->Append( fileMenu, _( "&File" ) );
|
||||
|
||||
SetMenuBar( menuBar );
|
||||
delete oldMenuBar;
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExit( wxCommandEvent& event )
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
|
||||
BITMAP2CMP_SETTINGS* cfg = static_cast<BITMAP2CMP_SETTINGS*>( aCfg );
|
||||
|
||||
m_BitmapFileName = cfg->m_BitmapFileName;
|
||||
m_ConvertedFileName = cfg->m_ConvertedFileName;
|
||||
|
||||
int u_select = cfg->m_Units;
|
||||
|
||||
if( u_select < 0 || u_select > 2 ) // Validity control
|
||||
u_select = 0;
|
||||
|
||||
m_PixelUnit->SetSelection( u_select );
|
||||
|
||||
m_sliderThreshold->SetValue( cfg->m_Threshold );
|
||||
|
||||
m_Negative = cfg->m_Negative;
|
||||
m_checkNegative->SetValue( cfg->m_Negative );
|
||||
|
||||
m_AspectRatio = 1.0;
|
||||
m_aspectRatioCheckbox->SetValue( true );
|
||||
|
||||
int format = cfg->m_LastFormat;
|
||||
|
||||
if( format < 0 || format > FINAL_FMT )
|
||||
format = PCBNEW_KICAD_MOD;
|
||||
|
||||
m_rbOutputFormat->SetSelection( format );
|
||||
|
||||
if( format == PCBNEW_KICAD_MOD )
|
||||
m_rbPCBLayer->Enable( true );
|
||||
else
|
||||
m_rbPCBLayer->Enable( false );
|
||||
|
||||
int last_layer = cfg->m_LastModLayer;
|
||||
|
||||
if( last_layer > static_cast<int>( MOD_LYR_FINAL ) ) // Out of range
|
||||
m_rbPCBLayer->SetSelection( MOD_LYR_FSILKS );
|
||||
else
|
||||
m_rbPCBLayer->SetSelection( last_layer );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||
|
||||
BITMAP2CMP_SETTINGS* cfg = static_cast<BITMAP2CMP_SETTINGS*>( aCfg );
|
||||
|
||||
cfg->m_BitmapFileName = m_BitmapFileName;
|
||||
cfg->m_ConvertedFileName = m_ConvertedFileName;
|
||||
cfg->m_Threshold = m_sliderThreshold->GetValue();
|
||||
cfg->m_Negative = m_checkNegative->IsChecked();
|
||||
cfg->m_LastFormat = m_rbOutputFormat->GetSelection();
|
||||
cfg->m_LastModLayer = m_rbPCBLayer->GetSelection();
|
||||
cfg->m_Units = m_PixelUnit->GetSelection();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnPaintInit( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
wxClientDC pict_dc( m_InitialPicturePanel );
|
||||
#else
|
||||
wxPaintDC pict_dc( m_InitialPicturePanel );
|
||||
#endif
|
||||
|
||||
m_InitialPicturePanel->PrepareDC( pict_dc );
|
||||
|
||||
// OSX crashes with empty bitmaps (on initial refreshes)
|
||||
if( m_Pict_Bitmap.IsOk() )
|
||||
pict_dc.DrawBitmap( m_Pict_Bitmap, 0, 0, !!m_Pict_Bitmap.GetMask() );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnPaintGreyscale( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
wxClientDC greyscale_dc( m_GreyscalePicturePanel );
|
||||
#else
|
||||
wxPaintDC greyscale_dc( m_GreyscalePicturePanel );
|
||||
#endif
|
||||
|
||||
m_GreyscalePicturePanel->PrepareDC( greyscale_dc );
|
||||
|
||||
// OSX crashes with empty bitmaps (on initial refreshes)
|
||||
if( m_Greyscale_Bitmap.IsOk() )
|
||||
greyscale_dc.DrawBitmap( m_Greyscale_Bitmap, 0, 0, !!m_Greyscale_Bitmap.GetMask() );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnPaintBW( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
wxClientDC nb_dc( m_BNPicturePanel );
|
||||
#else
|
||||
wxPaintDC nb_dc( m_BNPicturePanel );
|
||||
#endif
|
||||
|
||||
m_BNPicturePanel->PrepareDC( nb_dc );
|
||||
|
||||
if( m_BN_Bitmap.IsOk() )
|
||||
nb_dc.DrawBitmap( m_BN_Bitmap, 0, 0, !!m_BN_Bitmap.GetMask() );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn( m_BitmapFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = m_mruPath;
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
||||
_( "Image Files" ) + wxS( " " )+ wxImage::GetImageExtWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
wxString fullFilename = fileDlg.GetPath();
|
||||
|
||||
if( !OpenProjectFiles( std::vector<wxString>( 1, fullFilename ) ) )
|
||||
return;
|
||||
|
||||
fn = fullFilename;
|
||||
m_mruPath = fn.GetPath();
|
||||
SetStatusText( fullFilename );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||
{
|
||||
m_Pict_Image.Destroy();
|
||||
m_BitmapFileName = aFileSet[0];
|
||||
|
||||
if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
|
||||
{
|
||||
// LoadFile has its own UI, no need for further failure notification here
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Pict_Bitmap = wxBitmap( m_Pict_Image );
|
||||
|
||||
// Determine image resolution in DPI (does not existing in all formats).
|
||||
// the resolution can be given in bit per inches or bit per cm in file
|
||||
|
||||
int imageDPIx = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
|
||||
int imageDPIy = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
|
||||
|
||||
if( imageDPIx > 1 && imageDPIy > 1 )
|
||||
{
|
||||
if( m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM )
|
||||
{
|
||||
imageDPIx = KiROUND( imageDPIx * 2.54 );
|
||||
imageDPIy = KiROUND( imageDPIy * 2.54 );
|
||||
}
|
||||
}
|
||||
else // fallback to a default value (DEFAULT_DPI)
|
||||
{
|
||||
imageDPIx = imageDPIy = DEFAULT_DPI;
|
||||
}
|
||||
|
||||
m_InputXValueDPI->SetLabel( wxString::Format( wxT( "%d" ), imageDPIx ) );
|
||||
m_InputYValueDPI->SetLabel( wxString::Format( wxT( "%d" ), imageDPIy ) );
|
||||
|
||||
int h = m_Pict_Bitmap.GetHeight();
|
||||
int w = m_Pict_Bitmap.GetWidth();
|
||||
m_AspectRatio = (double) w / h;
|
||||
|
||||
m_outputSizeX.SetOriginalDPI( imageDPIx );
|
||||
m_outputSizeX.SetOriginalSizePixels( w );
|
||||
m_outputSizeY.SetOriginalDPI( imageDPIy );
|
||||
m_outputSizeY.SetOriginalSizePixels( h );
|
||||
|
||||
// Update display to keep aspect ratio
|
||||
wxCommandEvent dummy;
|
||||
OnSizeChangeX( dummy );
|
||||
|
||||
updateImageInfo();
|
||||
|
||||
m_InitialPicturePanel->SetVirtualSize( w, h );
|
||||
m_GreyscalePicturePanel->SetVirtualSize( w, h );
|
||||
m_BNPicturePanel->SetVirtualSize( w, h );
|
||||
|
||||
m_Greyscale_Image.Destroy();
|
||||
m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( );
|
||||
|
||||
if( m_Pict_Bitmap.GetMask() )
|
||||
{
|
||||
for( int x = 0; x < m_Pict_Bitmap.GetWidth(); x++ )
|
||||
{
|
||||
for( int y = 0; y < m_Pict_Bitmap.GetHeight(); y++ )
|
||||
{
|
||||
if( m_Pict_Image.GetRed( x, y ) == m_Pict_Image.GetMaskRed() &&
|
||||
m_Pict_Image.GetGreen( x, y ) == m_Pict_Image.GetMaskGreen() &&
|
||||
m_Pict_Image.GetBlue( x, y ) == m_Pict_Image.GetMaskBlue() )
|
||||
{
|
||||
m_Greyscale_Image.SetRGB( x, y, 255, 255, 255 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_Negative )
|
||||
NegateGreyscaleImage( );
|
||||
|
||||
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
||||
m_NB_Image = m_Greyscale_Image;
|
||||
Binarize( (double) m_sliderThreshold->GetValue() / m_sliderThreshold->GetMax() );
|
||||
|
||||
m_buttonExportFile->Enable( true );
|
||||
m_buttonExportClipboard->Enable( true );
|
||||
|
||||
m_outputSizeX.SetOutputSizeFromInitialImageSize();
|
||||
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
|
||||
m_outputSizeY.SetOutputSizeFromInitialImageSize();
|
||||
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// return a string giving the output size, according to the selected unit
|
||||
wxString BM2CMP_FRAME::FormatOutputSize( double aSize )
|
||||
{
|
||||
wxString text;
|
||||
|
||||
if( getUnitFromSelection() == EDA_UNITS::MILLIMETRES )
|
||||
text.Printf( wxS( "%.1f" ), aSize );
|
||||
else if( getUnitFromSelection() == EDA_UNITS::INCHES )
|
||||
text.Printf( wxS( "%.2f" ), aSize );
|
||||
else
|
||||
text.Printf( wxT( "%d" ), KiROUND( aSize ) );
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
void BM2CMP_FRAME::updateImageInfo()
|
||||
{
|
||||
// Note: the image resolution text controls are not modified here, to avoid a race between
|
||||
// text change when entered by user and a text change if it is modified here.
|
||||
|
||||
if( m_Pict_Bitmap.IsOk() )
|
||||
{
|
||||
int h = m_Pict_Bitmap.GetHeight();
|
||||
int w = m_Pict_Bitmap.GetWidth();
|
||||
int nb = m_Pict_Bitmap.GetDepth();
|
||||
|
||||
m_SizeXValue->SetLabel( wxString::Format( wxT( "%d" ), w ) );
|
||||
m_SizeYValue->SetLabel( wxString::Format( wxT( "%d" ), h ) );
|
||||
m_BPPValue->SetLabel( wxString::Format( wxT( "%d" ), nb ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EDA_UNITS BM2CMP_FRAME::getUnitFromSelection()
|
||||
{
|
||||
// return the EDA_UNITS from the m_PixelUnit choice
|
||||
switch( m_PixelUnit->GetSelection() )
|
||||
{
|
||||
case 1: return EDA_UNITS::INCHES;
|
||||
case 2: return EDA_UNITS::UNSCALED;
|
||||
case 0:
|
||||
default: return EDA_UNITS::MILLIMETRES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnSizeChangeX( wxCommandEvent& event )
|
||||
{
|
||||
double new_size;
|
||||
|
||||
if( m_UnitSizeX->GetValue().ToDouble( &new_size ) )
|
||||
{
|
||||
if( m_aspectRatioCheckbox->GetValue() )
|
||||
{
|
||||
double calculatedY = new_size / m_AspectRatio;
|
||||
|
||||
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
|
||||
{
|
||||
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
|
||||
// just re-scale the other dpi
|
||||
double ratio = new_size / m_outputSizeX.GetOutputSize();
|
||||
calculatedY = m_outputSizeY.GetOutputSize() * ratio;
|
||||
}
|
||||
|
||||
m_outputSizeY.SetOutputSize( calculatedY, getUnitFromSelection() );
|
||||
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
|
||||
}
|
||||
|
||||
m_outputSizeX.SetOutputSize( new_size, getUnitFromSelection() );
|
||||
}
|
||||
|
||||
updateImageInfo();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnSizeChangeY( wxCommandEvent& event )
|
||||
{
|
||||
double new_size;
|
||||
|
||||
if( m_UnitSizeY->GetValue().ToDouble( &new_size ) )
|
||||
{
|
||||
if( m_aspectRatioCheckbox->GetValue() )
|
||||
{
|
||||
double calculatedX = new_size * m_AspectRatio;
|
||||
|
||||
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
|
||||
{
|
||||
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
|
||||
// just re-scale the other dpi
|
||||
double ratio = new_size / m_outputSizeX.GetOutputSize();
|
||||
calculatedX = m_outputSizeX.GetOutputSize() * ratio;
|
||||
}
|
||||
|
||||
m_outputSizeX.SetOutputSize( calculatedX, getUnitFromSelection() );
|
||||
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
|
||||
}
|
||||
|
||||
m_outputSizeY.SetOutputSize( new_size, getUnitFromSelection() );
|
||||
}
|
||||
|
||||
updateImageInfo();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnSizeUnitChange( wxCommandEvent& event )
|
||||
{
|
||||
m_outputSizeX.SetUnit( getUnitFromSelection() );
|
||||
m_outputSizeY.SetUnit( getUnitFromSelection() );
|
||||
updateImageInfo();
|
||||
|
||||
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
|
||||
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::ToggleAspectRatioLock( wxCommandEvent& event )
|
||||
{
|
||||
if( m_aspectRatioCheckbox->GetValue() )
|
||||
{
|
||||
// Force display update when aspect ratio is locked
|
||||
wxCommandEvent dummy;
|
||||
OnSizeChangeX( dummy );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::Binarize( double aThreshold )
|
||||
{
|
||||
int h = m_Greyscale_Image.GetHeight();
|
||||
int w = m_Greyscale_Image.GetWidth();
|
||||
unsigned char threshold = aThreshold * 255;
|
||||
unsigned char alpha_thresh = 0.7 * threshold;
|
||||
|
||||
for( int y = 0; y < h; y++ )
|
||||
{
|
||||
for( int x = 0; x < w; x++ )
|
||||
{
|
||||
unsigned char pixout;
|
||||
unsigned char pixin = m_Greyscale_Image.GetGreen( x, y );
|
||||
unsigned char alpha = m_Greyscale_Image.HasAlpha() ? m_Greyscale_Image.GetAlpha( x, y )
|
||||
: wxALPHA_OPAQUE;
|
||||
|
||||
if( pixin < threshold && alpha > alpha_thresh )
|
||||
pixout = 0;
|
||||
else
|
||||
pixout = 255;
|
||||
|
||||
m_NB_Image.SetRGB( x, y, pixout, pixout, pixout );
|
||||
}
|
||||
}
|
||||
|
||||
m_BN_Bitmap = wxBitmap( m_NB_Image );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::NegateGreyscaleImage( )
|
||||
{
|
||||
unsigned char pix;
|
||||
int h = m_Greyscale_Image.GetHeight();
|
||||
int w = m_Greyscale_Image.GetWidth();
|
||||
|
||||
for( int y = 0; y < h; y++ )
|
||||
{
|
||||
for( int x = 0; x < w; x++ )
|
||||
{
|
||||
pix = m_Greyscale_Image.GetGreen( x, y );
|
||||
pix = ~pix;
|
||||
m_Greyscale_Image.SetRGB( x, y, pix, pix, pix );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnNegativeClicked( wxCommandEvent& )
|
||||
{
|
||||
if( m_checkNegative->GetValue() != m_Negative )
|
||||
{
|
||||
NegateGreyscaleImage();
|
||||
|
||||
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
m_Negative = m_checkNegative->GetValue();
|
||||
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
|
||||
{
|
||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event )
|
||||
{
|
||||
// choices of m_rbOutputFormat are expected to be in same order as
|
||||
// OUTPUT_FMT_ID. See bitmap2component.h
|
||||
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
|
||||
exportBitmap( format );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
|
||||
{
|
||||
// choices of m_rbOutputFormat are expected to be in same order as
|
||||
// OUTPUT_FMT_ID. See bitmap2component.h
|
||||
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
|
||||
|
||||
std::string buffer;
|
||||
ExportToBuffer( buffer, format );
|
||||
|
||||
wxLogNull doNotLog; // disable logging of failed clipboard actions
|
||||
|
||||
// Write buffer to the clipboard
|
||||
if( wxTheClipboard->Open() )
|
||||
{
|
||||
// This data objects are held by the clipboard,
|
||||
// so do not delete them in the app.
|
||||
wxTheClipboard->SetData( new wxTextDataObject( buffer.c_str() ) );
|
||||
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox( _( "Unable to export to the Clipboard") );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::exportBitmap( OUTPUT_FMT_ID aFormat )
|
||||
{
|
||||
switch( aFormat )
|
||||
{
|
||||
case EESCHEMA_FMT: exportEeschemaFormat(); break;
|
||||
case PCBNEW_KICAD_MOD: exportPcbnewFormat(); break;
|
||||
case POSTSCRIPT_FMT: exportPostScriptFormat(); break;
|
||||
case KICAD_WKS_LOGO: exportLogo(); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::exportLogo()
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Logo File" ), path, wxEmptyString,
|
||||
DrawingSheetFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( DrawingSheetFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
ExportToBuffer( buffer, KICAD_WKS_LOGO );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::exportPostScriptFormat()
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create PostScript File" ), path, wxEmptyString,
|
||||
PSFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( wxT( "ps" ) );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
ExportToBuffer( buffer, POSTSCRIPT_FMT );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::exportEeschemaFormat()
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Symbol Library" ), path, wxEmptyString,
|
||||
KiCadSymbolLibFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( KiCadSymbolLibFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
ExportToBuffer( buffer, EESCHEMA_FMT );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::exportPcbnewFormat()
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = m_mruPath;
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Footprint Library" ), path, wxEmptyString,
|
||||
KiCadFootprintLibFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( KiCadFootprintFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
ExportToBuffer( buffer, PCBNEW_KICAD_MOD );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
m_mruPath = fn.GetPath();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat )
|
||||
{
|
||||
// Create a potrace bitmap
|
||||
int h = m_NB_Image.GetHeight();
|
||||
int w = m_NB_Image.GetWidth();
|
||||
potrace_bitmap_t* potrace_bitmap = bm_new( w, h );
|
||||
|
||||
if( !potrace_bitmap )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error allocating memory for potrace bitmap" ) );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
/* fill the bitmap with data */
|
||||
for( int y = 0; y < h; y++ )
|
||||
{
|
||||
for( int x = 0; x < w; x++ )
|
||||
{
|
||||
unsigned char pix = m_NB_Image.GetGreen( x, y );
|
||||
BM_PUT( potrace_bitmap, x, y, pix ? 0 : 1 );
|
||||
}
|
||||
}
|
||||
|
||||
// choices of m_rbPCBLayer are expected to be in same order as
|
||||
// BMP2CMP_MOD_LAYER. See bitmap2component.h
|
||||
BMP2CMP_MOD_LAYER modLayer = MOD_LYR_FSILKS;
|
||||
|
||||
if( aFormat == PCBNEW_KICAD_MOD )
|
||||
modLayer = (BMP2CMP_MOD_LAYER) m_rbPCBLayer->GetSelection();
|
||||
|
||||
BITMAPCONV_INFO converter( aOutput );
|
||||
converter.ConvertBitmap( potrace_bitmap, aFormat, m_outputSizeX.GetOutputDPI(),
|
||||
m_outputSizeY.GetOutputDPI(), modLayer );
|
||||
|
||||
if( !converter.GetErrorMessages().empty() )
|
||||
wxMessageBox( converter.GetErrorMessages().c_str(), _( "Errors" ) );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnFormatChange( wxCommandEvent& event )
|
||||
{
|
||||
if( m_rbOutputFormat->GetSelection() == PCBNEW_KICAD_MOD )
|
||||
m_rbPCBLayer->Enable( true );
|
||||
else
|
||||
m_rbPCBLayer->Enable( false );
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-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 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 BITMOP2CMP_GUI_H_
|
||||
#define BITMOP2CMP_GUI_H_
|
||||
|
||||
#include "bitmap2component.h"
|
||||
|
||||
#include "bitmap2cmp_gui_base.h"
|
||||
#include <eda_units.h>
|
||||
#include <potracelib.h>
|
||||
|
||||
|
||||
class IMAGE_SIZE
|
||||
{
|
||||
public:
|
||||
IMAGE_SIZE();
|
||||
|
||||
// Set the unit used for m_outputSize, and convert the old m_outputSize value
|
||||
// to the value in new unit
|
||||
void SetUnit( EDA_UNITS aUnit );
|
||||
|
||||
// Accessors:
|
||||
void SetOriginalDPI( int aDPI )
|
||||
{
|
||||
m_originalDPI = aDPI;
|
||||
}
|
||||
|
||||
void SetOriginalSizePixels( int aPixels )
|
||||
{
|
||||
m_originalSizePixels = aPixels;
|
||||
}
|
||||
|
||||
double GetOutputSize()
|
||||
{
|
||||
return m_outputSize;
|
||||
}
|
||||
|
||||
void SetOutputSize( double aSize, EDA_UNITS aUnit )
|
||||
{
|
||||
m_unit = aUnit;
|
||||
m_outputSize = aSize;
|
||||
}
|
||||
|
||||
int GetOriginalSizePixels()
|
||||
{
|
||||
return m_originalSizePixels;
|
||||
}
|
||||
|
||||
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
|
||||
void SetOutputSizeFromInitialImageSize();
|
||||
|
||||
/** @return the pixels per inch value to build the output image.
|
||||
* It is used by potrace to build the polygonal image
|
||||
*/
|
||||
int GetOutputDPI();
|
||||
|
||||
private:
|
||||
EDA_UNITS m_unit; // The units for m_outputSize (mm, inch, dpi)
|
||||
double m_outputSize; // The size in m_unit of the output image, depending on
|
||||
// the user settings. Set to the initial image size
|
||||
int m_originalDPI; // The image DPI if specified in file, or 0 if unknown
|
||||
int m_originalSizePixels; // The original image size read from file, in pixels
|
||||
};
|
||||
|
||||
class BM2CMP_FRAME : public BM2CMP_FRAME_BASE
|
||||
{
|
||||
public:
|
||||
BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
~BM2CMP_FRAME();
|
||||
|
||||
// overload KIWAY_PLAYER virtual
|
||||
bool OpenProjectFiles( const std::vector<wxString>& aFilenames, int aCtl = 0 ) override;
|
||||
|
||||
void OnExit( wxCommandEvent& event );
|
||||
void OnLoadFile( wxCommandEvent& event ) override;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
// Event handlers
|
||||
void OnPaintInit( wxPaintEvent& event ) override;
|
||||
void OnPaintGreyscale( wxPaintEvent& event ) override;
|
||||
void OnPaintBW( wxPaintEvent& event ) override;
|
||||
void OnExportToFile( wxCommandEvent& event ) override;
|
||||
void OnExportToClipboard( wxCommandEvent& event ) override;
|
||||
|
||||
///< @return the EDA_UNITS from the m_PixelUnit choice
|
||||
EDA_UNITS getUnitFromSelection();
|
||||
|
||||
// return a string giving the output size, according to the selected unit
|
||||
wxString FormatOutputSize( double aSize );
|
||||
|
||||
/**
|
||||
* Generate a schematic library which contains one component:
|
||||
* the logo
|
||||
*/
|
||||
void exportEeschemaFormat();
|
||||
|
||||
/**
|
||||
* Generate a footprint in S expr format
|
||||
*/
|
||||
void exportPcbnewFormat();
|
||||
|
||||
/**
|
||||
* Generate a postscript file
|
||||
*/
|
||||
void exportPostScriptFormat();
|
||||
|
||||
/**
|
||||
* Generate a file suitable to be copied into a drawing sheet (.kicad_wks) file
|
||||
*/
|
||||
void exportLogo();
|
||||
|
||||
void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level)
|
||||
void OnNegativeClicked( wxCommandEvent& event ) override;
|
||||
void OnThresholdChange( wxScrollEvent& event ) override;
|
||||
|
||||
void OnSizeChangeX( wxCommandEvent& event ) override;
|
||||
void OnSizeChangeY( wxCommandEvent& event ) override;
|
||||
void OnSizeUnitChange( wxCommandEvent& event ) override;
|
||||
|
||||
void ToggleAspectRatioLock( wxCommandEvent& event ) override;
|
||||
|
||||
void NegateGreyscaleImage();
|
||||
/**
|
||||
* generate a export data of the current bitmap.
|
||||
* @param aOutput is a string buffer to fill with data
|
||||
* @param aFormat is the format to generate
|
||||
*/
|
||||
void ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat );
|
||||
|
||||
void updateImageInfo();
|
||||
void OnFormatChange( wxCommandEvent& event ) override;
|
||||
void exportBitmap( OUTPUT_FMT_ID aFormat );
|
||||
|
||||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
wxWindow* GetToolCanvas() const override;
|
||||
|
||||
protected:
|
||||
void doReCreateMenuBar() override;
|
||||
|
||||
private:
|
||||
wxImage m_Pict_Image;
|
||||
wxBitmap m_Pict_Bitmap;
|
||||
wxImage m_Greyscale_Image;
|
||||
wxBitmap m_Greyscale_Bitmap;
|
||||
wxImage m_NB_Image;
|
||||
wxBitmap m_BN_Bitmap;
|
||||
IMAGE_SIZE m_outputSizeX;
|
||||
IMAGE_SIZE m_outputSizeY;
|
||||
bool m_Negative;
|
||||
wxString m_BitmapFileName;
|
||||
wxString m_ConvertedFileName;
|
||||
double m_AspectRatio;
|
||||
};
|
||||
#endif// BITMOP2CMP_GUI_H_
|
||||
@@ -0,0 +1,224 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "bitmap2cmp_gui_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : KIWAY_PLAYER( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Notebook->SetMinSize( wxSize( 500,-1 ) );
|
||||
|
||||
m_InitialPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_InitialPicturePanel->SetScrollRate( 5, 5 );
|
||||
m_Notebook->AddPage( m_InitialPicturePanel, _("Original Picture"), false );
|
||||
m_GreyscalePicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_GreyscalePicturePanel->SetScrollRate( 5, 5 );
|
||||
m_Notebook->AddPage( m_GreyscalePicturePanel, _("Greyscale Picture"), false );
|
||||
m_BNPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_BNPicturePanel->SetScrollRate( 5, 5 );
|
||||
m_Notebook->AddPage( m_BNPicturePanel, _("Black && White Picture"), true );
|
||||
|
||||
bMainSizer->Add( m_Notebook, 1, wxEXPAND|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* brightSizer;
|
||||
brightSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* sbSizerInfo;
|
||||
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Image Information") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerInfo;
|
||||
fgSizerInfo = new wxFlexGridSizer( 0, 4, 0, 0 );
|
||||
fgSizerInfo->AddGrowableCol( 1 );
|
||||
fgSizerInfo->AddGrowableCol( 2 );
|
||||
fgSizerInfo->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticTextISize = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Image size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextISize->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextISize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_SizeXValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizeXValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeXValue, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_SizeYValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizeYValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeYValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_SizePixUnits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizePixUnits->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizePixUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_staticTextDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Image PPI:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextDPI->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextDPI, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_InputXValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InputXValueDPI->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_InputXValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_InputYValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InputYValueDPI->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_InputYValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_DPIUnit = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("PPI"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DPIUnit->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_DPIUnit, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_staticTextBPP = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextBPP->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextBPP, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_BPPValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_BPPValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_BPPValue, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_BPPunits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_BPPunits->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_BPPunits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
fgSizerInfo->Add( 0, 0, 0, 0, 5 );
|
||||
|
||||
|
||||
sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_buttonLoad = new wxButton( this, wxID_ANY, _("Load Source Image"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
brightSizer->Add( 0, 10, 1, wxEXPAND, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerImgPrms;
|
||||
sbSizerImgPrms = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Output Size") ), wxVERTICAL );
|
||||
|
||||
m_aspectRatioCheckbox = new wxCheckBox( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("Lock height / width ratio"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizerImgPrms->Add( m_aspectRatioCheckbox, 0, wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* bSizerRes;
|
||||
bSizerRes = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticTextOSize = new wxStaticText( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextOSize->Wrap( -1 );
|
||||
bSizerRes->Add( m_staticTextOSize, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_UnitSizeX = new wxTextCtrl( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_UnitSizeX->SetMinSize( wxSize( 60,-1 ) );
|
||||
|
||||
bSizerRes->Add( m_UnitSizeX, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_UnitSizeY = new wxTextCtrl( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_UnitSizeY->SetMinSize( wxSize( 60,-1 ) );
|
||||
|
||||
bSizerRes->Add( m_UnitSizeY, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
wxArrayString m_PixelUnitChoices;
|
||||
m_PixelUnit = new wxChoice( sbSizerImgPrms->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_PixelUnitChoices, 0 );
|
||||
m_PixelUnit->SetSelection( 0 );
|
||||
m_PixelUnit->SetMinSize( wxSize( 80,-1 ) );
|
||||
|
||||
bSizerRes->Add( m_PixelUnit, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
|
||||
sbSizerImgPrms->Add( bSizerRes, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
brightSizer->Add( sbSizerImgPrms, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizer2;
|
||||
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
|
||||
|
||||
m_ThresholdText = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Black / white threshold:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ThresholdText->Wrap( -1 );
|
||||
sbSizer2->Add( m_ThresholdText, 0, wxLEFT, 5 );
|
||||
|
||||
m_sliderThreshold = new wxSlider( sbSizer2->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
|
||||
m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") );
|
||||
|
||||
sbSizer2->Add( m_sliderThreshold, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_checkNegative = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Negative"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizer2->Add( m_checkNegative, 0, wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
brightSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxString m_rbPCBLayerChoices[] = { _("Front silk screen"), _("Front solder mask"), _("User layer Eco1"), _("User layer Eco2") };
|
||||
int m_rbPCBLayerNChoices = sizeof( m_rbPCBLayerChoices ) / sizeof( wxString );
|
||||
m_rbPCBLayer = new wxRadioBox( this, wxID_ANY, _("Board Layer for Outline"), wxDefaultPosition, wxDefaultSize, m_rbPCBLayerNChoices, m_rbPCBLayerChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_rbPCBLayer->SetSelection( 1 );
|
||||
m_rbPCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe reference designator and value are always placed on the silk screen layer (but will be marked invisible).") );
|
||||
|
||||
brightSizer->Add( m_rbPCBLayer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxString m_rbOutputFormatChoices[] = { _("Symbol (.kicad_sym file)"), _("Footprint (.kicad_mod file)"), _("Postscript (.ps file)"), _("Drawing Sheet (.kicad_wks file)") };
|
||||
int m_rbOutputFormatNChoices = sizeof( m_rbOutputFormatChoices ) / sizeof( wxString );
|
||||
m_rbOutputFormat = new wxRadioBox( this, wxID_ANY, _("Output Format"), wxDefaultPosition, wxDefaultSize, m_rbOutputFormatNChoices, m_rbOutputFormatChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_rbOutputFormat->SetSelection( 0 );
|
||||
brightSizer->Add( m_rbOutputFormat, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_buttonExportFile = new wxButton( this, wxID_ANY, _("Export to File"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
brightSizer->Add( m_buttonExportFile, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_buttonExportClipboard = new wxButton( this, wxID_ANY, _("Export to Clipboard"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
brightSizer->Add( m_buttonExportClipboard, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( brightSizer, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
|
||||
|
||||
// Connect Events
|
||||
m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
|
||||
m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
|
||||
m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
|
||||
m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
||||
m_aspectRatioCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this );
|
||||
m_UnitSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this );
|
||||
m_UnitSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this );
|
||||
m_PixelUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this );
|
||||
m_sliderThreshold->Connect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
|
||||
m_sliderThreshold->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
|
||||
m_checkNegative->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this );
|
||||
m_rbOutputFormat->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this );
|
||||
m_buttonExportFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this );
|
||||
m_buttonExportClipboard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this );
|
||||
}
|
||||
|
||||
BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
|
||||
m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
|
||||
m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
|
||||
m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
||||
m_aspectRatioCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this );
|
||||
m_UnitSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this );
|
||||
m_UnitSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this );
|
||||
m_PixelUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this );
|
||||
m_sliderThreshold->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
|
||||
m_sliderThreshold->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
|
||||
m_checkNegative->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this );
|
||||
m_rbOutputFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this );
|
||||
m_buttonExportFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this );
|
||||
m_buttonExportClipboard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this );
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,101 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "kiway_player.h"
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/valtext.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/statusbr.h>
|
||||
#include <wx/frame.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class BM2CMP_FRAME_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class BM2CMP_FRAME_BASE : public KIWAY_PLAYER
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxNotebook* m_Notebook;
|
||||
wxScrolledWindow* m_InitialPicturePanel;
|
||||
wxScrolledWindow* m_GreyscalePicturePanel;
|
||||
wxScrolledWindow* m_BNPicturePanel;
|
||||
wxStaticText* m_staticTextISize;
|
||||
wxStaticText* m_SizeXValue;
|
||||
wxStaticText* m_SizeYValue;
|
||||
wxStaticText* m_SizePixUnits;
|
||||
wxStaticText* m_staticTextDPI;
|
||||
wxStaticText* m_InputXValueDPI;
|
||||
wxStaticText* m_InputYValueDPI;
|
||||
wxStaticText* m_DPIUnit;
|
||||
wxStaticText* m_staticTextBPP;
|
||||
wxStaticText* m_BPPValue;
|
||||
wxStaticText* m_BPPunits;
|
||||
wxButton* m_buttonLoad;
|
||||
wxCheckBox* m_aspectRatioCheckbox;
|
||||
wxStaticText* m_staticTextOSize;
|
||||
wxTextCtrl* m_UnitSizeX;
|
||||
wxTextCtrl* m_UnitSizeY;
|
||||
wxChoice* m_PixelUnit;
|
||||
wxStaticText* m_ThresholdText;
|
||||
wxSlider* m_sliderThreshold;
|
||||
wxCheckBox* m_checkNegative;
|
||||
wxRadioBox* m_rbPCBLayer;
|
||||
wxRadioBox* m_rbOutputFormat;
|
||||
wxButton* m_buttonExportFile;
|
||||
wxButton* m_buttonExportClipboard;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnPaintInit( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaintGreyscale( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaintBW( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnLoadFile( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void ToggleAspectRatioLock( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeChangeX( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeChangeY( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeUnitChange( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnThresholdChange( wxScrollEvent& event ) { event.Skip(); }
|
||||
virtual void OnNegativeClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnFormatChange( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnExportToFile( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnExportToClipboard( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Image Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCLOSE_BOX|wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
|
||||
|
||||
~BM2CMP_FRAME_BASE();
|
||||
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <bitmap2cmp_frame.h>
|
||||
#include <bitmap2cmp_gui.h>
|
||||
#include <bitmap2cmp_settings.h>
|
||||
#include <kiface_base.h>
|
||||
#include <kiway.h>
|
||||
@@ -34,14 +34,14 @@ namespace BMP2CMP {
|
||||
|
||||
static struct IFACE : public KIFACE_BASE
|
||||
{
|
||||
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway ) override;
|
||||
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override;
|
||||
|
||||
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
|
||||
int aCtlBits = 0 ) override
|
||||
{
|
||||
InitSettings( new BITMAP2CMP_SETTINGS );
|
||||
Pgm().GetSettingsManager().RegisterSettings( KifaceSettings() );
|
||||
return new BITMAP2CMP_FRAME( aKiway, aParent );
|
||||
return new BM2CMP_FRAME( aKiway, aParent );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ PGM_BASE* PgmOrNull()
|
||||
#endif
|
||||
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway )
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
{
|
||||
return start_common( aCtlBits );
|
||||
}
|
||||
|
||||
@@ -1,575 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2010 jean-pierre.charras
|
||||
* 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
|
||||
* 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 <bitmap2cmp_frame.h>
|
||||
#include <bitmap2component.h>
|
||||
#include <bitmap2cmp_panel.h>
|
||||
#include <bitmap2cmp_settings.h>
|
||||
#include <bitmap_io.h>
|
||||
#include <bitmaps.h>
|
||||
#include <common.h>
|
||||
#include <kiface_base.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <pgm_base.h>
|
||||
#include <potracelib.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/rawbmp.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
#define DEFAULT_DPI 300 // the image DPI used in formats that do not define a DPI
|
||||
|
||||
|
||||
BITMAP2CMP_PANEL::BITMAP2CMP_PANEL( BITMAP2CMP_FRAME* aParent ) :
|
||||
BITMAP2CMP_PANEL_BASE( aParent ),
|
||||
m_parentFrame( aParent ), m_negative( false ),
|
||||
m_aspectRatio( 1.0 )
|
||||
{
|
||||
for( wxString unit : { _( "mm" ), _( "Inch" ), _( "DPI" ) } )
|
||||
m_PixelUnit->Append( unit );
|
||||
|
||||
m_outputSizeX.SetUnit( getUnitFromSelection() );
|
||||
m_outputSizeY.SetUnit( getUnitFromSelection() );
|
||||
m_outputSizeX.SetOutputSize( 0, getUnitFromSelection() );
|
||||
m_outputSizeY.SetOutputSize( 0, getUnitFromSelection() );
|
||||
|
||||
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
|
||||
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
|
||||
|
||||
m_buttonExportFile->Enable( false );
|
||||
m_buttonExportClipboard->Enable( false );
|
||||
}
|
||||
|
||||
|
||||
BITMAP2CMP_PANEL::~BITMAP2CMP_PANEL()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxWindow* BITMAP2CMP_PANEL::GetCurrentPage()
|
||||
{
|
||||
return m_Notebook->GetCurrentPage();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::LoadSettings( BITMAP2CMP_SETTINGS* cfg )
|
||||
{
|
||||
int u_select = cfg->m_Units;
|
||||
|
||||
if( u_select < 0 || u_select > 2 ) // Validity control
|
||||
u_select = 0;
|
||||
|
||||
m_PixelUnit->SetSelection( u_select );
|
||||
|
||||
m_sliderThreshold->SetValue( cfg->m_Threshold );
|
||||
|
||||
m_negative = cfg->m_Negative;
|
||||
m_checkNegative->SetValue( cfg->m_Negative );
|
||||
|
||||
m_aspectRatio = 1.0;
|
||||
m_aspectRatioCheckbox->SetValue( true );
|
||||
|
||||
int format = cfg->m_LastFormat;
|
||||
|
||||
if( format < 0 || format > FINAL_FMT )
|
||||
format = PCBNEW_KICAD_MOD;
|
||||
|
||||
m_rbOutputFormat->SetSelection( format );
|
||||
|
||||
bool enable = format == PCBNEW_KICAD_MOD;
|
||||
m_chPCBLayer->Enable( enable );
|
||||
|
||||
int last_layer = cfg->m_LastModLayer;
|
||||
|
||||
if( last_layer < 0 || last_layer > static_cast<int>( MOD_LYR_FINAL ) ) // Out of range
|
||||
last_layer = MOD_LYR_FSILKS;
|
||||
|
||||
m_chPCBLayer->SetSelection( last_layer );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::SaveSettings( BITMAP2CMP_SETTINGS* cfg )
|
||||
{
|
||||
cfg->m_Threshold = m_sliderThreshold->GetValue();
|
||||
cfg->m_Negative = m_checkNegative->IsChecked();
|
||||
cfg->m_LastFormat = m_rbOutputFormat->GetSelection();
|
||||
cfg->m_LastModLayer = m_chPCBLayer->GetSelection();
|
||||
cfg->m_Units = m_PixelUnit->GetSelection();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnPaintInit( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
wxClientDC pict_dc( m_InitialPicturePanel );
|
||||
#else
|
||||
wxPaintDC pict_dc( m_InitialPicturePanel );
|
||||
#endif
|
||||
|
||||
m_InitialPicturePanel->PrepareDC( pict_dc );
|
||||
|
||||
// OSX crashes with empty bitmaps (on initial refreshes)
|
||||
if( m_Pict_Bitmap.IsOk() )
|
||||
pict_dc.DrawBitmap( m_Pict_Bitmap, 0, 0, !!m_Pict_Bitmap.GetMask() );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnPaintGreyscale( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
wxClientDC greyscale_dc( m_GreyscalePicturePanel );
|
||||
#else
|
||||
wxPaintDC greyscale_dc( m_GreyscalePicturePanel );
|
||||
#endif
|
||||
|
||||
m_GreyscalePicturePanel->PrepareDC( greyscale_dc );
|
||||
|
||||
// OSX crashes with empty bitmaps (on initial refreshes)
|
||||
if( m_Greyscale_Bitmap.IsOk() )
|
||||
greyscale_dc.DrawBitmap( m_Greyscale_Bitmap, 0, 0, !!m_Greyscale_Bitmap.GetMask() );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnPaintBW( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
wxClientDC nb_dc( m_BNPicturePanel );
|
||||
#else
|
||||
wxPaintDC nb_dc( m_BNPicturePanel );
|
||||
#endif
|
||||
|
||||
m_BNPicturePanel->PrepareDC( nb_dc );
|
||||
|
||||
if( m_BN_Bitmap.IsOk() )
|
||||
nb_dc.DrawBitmap( m_BN_Bitmap, 0, 0, !!m_BN_Bitmap.GetMask() );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnLoadFile( wxCommandEvent& event )
|
||||
{
|
||||
m_parentFrame->OnLoadFile();
|
||||
}
|
||||
|
||||
|
||||
bool BITMAP2CMP_PANEL::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||
{
|
||||
m_Pict_Image.Destroy();
|
||||
|
||||
if( !m_Pict_Image.LoadFile( aFileSet[0] ) )
|
||||
{
|
||||
// LoadFile has its own UI, no need for further failure notification here
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Pict_Bitmap = wxBitmap( m_Pict_Image );
|
||||
|
||||
// Determine image resolution in DPI (does not existing in all formats).
|
||||
// the resolution can be given in bit per inches or bit per cm in file
|
||||
|
||||
int imageDPIx = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
|
||||
int imageDPIy = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
|
||||
|
||||
if( imageDPIx > 1 && imageDPIy > 1 )
|
||||
{
|
||||
if( m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM )
|
||||
{
|
||||
imageDPIx = KiROUND( imageDPIx * 2.54 );
|
||||
imageDPIy = KiROUND( imageDPIy * 2.54 );
|
||||
}
|
||||
}
|
||||
else // fallback to a default value (DEFAULT_DPI)
|
||||
{
|
||||
imageDPIx = imageDPIy = DEFAULT_DPI;
|
||||
}
|
||||
|
||||
m_InputXValueDPI->SetLabel( wxString::Format( wxT( "%d" ), imageDPIx ) );
|
||||
m_InputYValueDPI->SetLabel( wxString::Format( wxT( "%d" ), imageDPIy ) );
|
||||
|
||||
int h = m_Pict_Bitmap.GetHeight();
|
||||
int w = m_Pict_Bitmap.GetWidth();
|
||||
m_aspectRatio = (double) w / h;
|
||||
|
||||
m_outputSizeX.SetOriginalDPI( imageDPIx );
|
||||
m_outputSizeX.SetOriginalSizePixels( w );
|
||||
m_outputSizeY.SetOriginalDPI( imageDPIy );
|
||||
m_outputSizeY.SetOriginalSizePixels( h );
|
||||
|
||||
// Update display to keep aspect ratio
|
||||
wxCommandEvent dummy;
|
||||
OnSizeChangeX( dummy );
|
||||
|
||||
updateImageInfo();
|
||||
|
||||
m_InitialPicturePanel->SetVirtualSize( w, h );
|
||||
m_GreyscalePicturePanel->SetVirtualSize( w, h );
|
||||
m_BNPicturePanel->SetVirtualSize( w, h );
|
||||
|
||||
m_Greyscale_Image.Destroy();
|
||||
m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( );
|
||||
|
||||
if( m_Pict_Bitmap.GetMask() )
|
||||
{
|
||||
for( int x = 0; x < m_Pict_Bitmap.GetWidth(); x++ )
|
||||
{
|
||||
for( int y = 0; y < m_Pict_Bitmap.GetHeight(); y++ )
|
||||
{
|
||||
if( m_Pict_Image.GetRed( x, y ) == m_Pict_Image.GetMaskRed() &&
|
||||
m_Pict_Image.GetGreen( x, y ) == m_Pict_Image.GetMaskGreen() &&
|
||||
m_Pict_Image.GetBlue( x, y ) == m_Pict_Image.GetMaskBlue() )
|
||||
{
|
||||
m_Greyscale_Image.SetRGB( x, y, 255, 255, 255 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_negative )
|
||||
NegateGreyscaleImage( );
|
||||
|
||||
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
||||
m_NB_Image = m_Greyscale_Image;
|
||||
Binarize( (double) m_sliderThreshold->GetValue() / m_sliderThreshold->GetMax() );
|
||||
|
||||
m_buttonExportFile->Enable( true );
|
||||
m_buttonExportClipboard->Enable( true );
|
||||
|
||||
m_outputSizeX.SetOutputSizeFromInitialImageSize();
|
||||
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
|
||||
m_outputSizeY.SetOutputSizeFromInitialImageSize();
|
||||
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// return a string giving the output size, according to the selected unit
|
||||
wxString BITMAP2CMP_PANEL::FormatOutputSize( double aSize )
|
||||
{
|
||||
wxString text;
|
||||
|
||||
if( getUnitFromSelection() == EDA_UNITS::MILLIMETRES )
|
||||
text.Printf( wxS( "%.1f" ), aSize );
|
||||
else if( getUnitFromSelection() == EDA_UNITS::INCHES )
|
||||
text.Printf( wxS( "%.2f" ), aSize );
|
||||
else
|
||||
text.Printf( wxT( "%d" ), KiROUND( aSize ) );
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
void BITMAP2CMP_PANEL::updateImageInfo()
|
||||
{
|
||||
// Note: the image resolution text controls are not modified here, to avoid a race between
|
||||
// text change when entered by user and a text change if it is modified here.
|
||||
|
||||
if( m_Pict_Bitmap.IsOk() )
|
||||
{
|
||||
int h = m_Pict_Bitmap.GetHeight();
|
||||
int w = m_Pict_Bitmap.GetWidth();
|
||||
int nb = m_Pict_Bitmap.GetDepth();
|
||||
|
||||
m_SizeXValue->SetLabel( wxString::Format( wxT( "%d" ), w ) );
|
||||
m_SizeYValue->SetLabel( wxString::Format( wxT( "%d" ), h ) );
|
||||
m_BPPValue->SetLabel( wxString::Format( wxT( "%d" ), nb ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EDA_UNITS BITMAP2CMP_PANEL::getUnitFromSelection()
|
||||
{
|
||||
// return the EDA_UNITS from the m_PixelUnit choice
|
||||
switch( m_PixelUnit->GetSelection() )
|
||||
{
|
||||
case 1: return EDA_UNITS::INCHES;
|
||||
case 2: return EDA_UNITS::UNSCALED;
|
||||
case 0:
|
||||
default: return EDA_UNITS::MILLIMETRES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnSizeChangeX( wxCommandEvent& event )
|
||||
{
|
||||
double new_size;
|
||||
|
||||
if( m_UnitSizeX->GetValue().ToDouble( &new_size ) )
|
||||
{
|
||||
if( m_aspectRatioCheckbox->GetValue() )
|
||||
{
|
||||
double calculatedY = new_size / m_aspectRatio;
|
||||
|
||||
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
|
||||
{
|
||||
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
|
||||
// just re-scale the other dpi
|
||||
double ratio = new_size / m_outputSizeX.GetOutputSize();
|
||||
calculatedY = m_outputSizeY.GetOutputSize() * ratio;
|
||||
}
|
||||
|
||||
m_outputSizeY.SetOutputSize( calculatedY, getUnitFromSelection() );
|
||||
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
|
||||
}
|
||||
|
||||
m_outputSizeX.SetOutputSize( new_size, getUnitFromSelection() );
|
||||
}
|
||||
|
||||
updateImageInfo();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnSizeChangeY( wxCommandEvent& event )
|
||||
{
|
||||
double new_size;
|
||||
|
||||
if( m_UnitSizeY->GetValue().ToDouble( &new_size ) )
|
||||
{
|
||||
if( m_aspectRatioCheckbox->GetValue() )
|
||||
{
|
||||
double calculatedX = new_size * m_aspectRatio;
|
||||
|
||||
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
|
||||
{
|
||||
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
|
||||
// just re-scale the other dpi
|
||||
double ratio = new_size / m_outputSizeX.GetOutputSize();
|
||||
calculatedX = m_outputSizeX.GetOutputSize() * ratio;
|
||||
}
|
||||
|
||||
m_outputSizeX.SetOutputSize( calculatedX, getUnitFromSelection() );
|
||||
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
|
||||
}
|
||||
|
||||
m_outputSizeY.SetOutputSize( new_size, getUnitFromSelection() );
|
||||
}
|
||||
|
||||
updateImageInfo();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnSizeUnitChange( wxCommandEvent& event )
|
||||
{
|
||||
m_outputSizeX.SetUnit( getUnitFromSelection() );
|
||||
m_outputSizeY.SetUnit( getUnitFromSelection() );
|
||||
updateImageInfo();
|
||||
|
||||
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
|
||||
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::SetOutputSize( const IMAGE_SIZE& aSizeX, const IMAGE_SIZE& aSizeY )
|
||||
{
|
||||
m_outputSizeX = aSizeX;
|
||||
m_outputSizeY = aSizeY;
|
||||
updateImageInfo();
|
||||
|
||||
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
|
||||
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::ToggleAspectRatioLock( wxCommandEvent& event )
|
||||
{
|
||||
if( m_aspectRatioCheckbox->GetValue() )
|
||||
{
|
||||
// Force display update when aspect ratio is locked
|
||||
wxCommandEvent dummy;
|
||||
OnSizeChangeX( dummy );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::Binarize( double aThreshold )
|
||||
{
|
||||
int h = m_Greyscale_Image.GetHeight();
|
||||
int w = m_Greyscale_Image.GetWidth();
|
||||
unsigned char threshold = aThreshold * 255;
|
||||
unsigned char alpha_thresh = 0.7 * threshold;
|
||||
|
||||
for( int y = 0; y < h; y++ )
|
||||
{
|
||||
for( int x = 0; x < w; x++ )
|
||||
{
|
||||
unsigned char pixout;
|
||||
unsigned char pixin = m_Greyscale_Image.GetGreen( x, y );
|
||||
unsigned char alpha = m_Greyscale_Image.HasAlpha() ? m_Greyscale_Image.GetAlpha( x, y )
|
||||
: wxALPHA_OPAQUE;
|
||||
|
||||
if( pixin < threshold && alpha > alpha_thresh )
|
||||
pixout = 0;
|
||||
else
|
||||
pixout = 255;
|
||||
|
||||
m_NB_Image.SetRGB( x, y, pixout, pixout, pixout );
|
||||
}
|
||||
}
|
||||
|
||||
m_BN_Bitmap = wxBitmap( m_NB_Image );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::NegateGreyscaleImage( )
|
||||
{
|
||||
unsigned char pix;
|
||||
int h = m_Greyscale_Image.GetHeight();
|
||||
int w = m_Greyscale_Image.GetWidth();
|
||||
|
||||
for( int y = 0; y < h; y++ )
|
||||
{
|
||||
for( int x = 0; x < w; x++ )
|
||||
{
|
||||
pix = m_Greyscale_Image.GetGreen( x, y );
|
||||
pix = ~pix;
|
||||
m_Greyscale_Image.SetRGB( x, y, pix, pix, pix );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnNegativeClicked( wxCommandEvent& )
|
||||
{
|
||||
if( m_checkNegative->GetValue() != m_negative )
|
||||
{
|
||||
NegateGreyscaleImage();
|
||||
|
||||
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
m_negative = m_checkNegative->GetValue();
|
||||
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnThresholdChange( wxScrollEvent& event )
|
||||
{
|
||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnExportToFile( wxCommandEvent& event )
|
||||
{
|
||||
// choices of m_rbOutputFormat are expected to be in same order as
|
||||
// OUTPUT_FMT_ID. See bitmap2component.h
|
||||
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
|
||||
exportBitmap( format );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnExportToClipboard( wxCommandEvent& event )
|
||||
{
|
||||
// choices of m_rbOutputFormat are expected to be in same order as
|
||||
// OUTPUT_FMT_ID. See bitmap2component.h
|
||||
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
|
||||
|
||||
std::string buffer;
|
||||
ExportToBuffer( buffer, format );
|
||||
|
||||
wxLogNull doNotLog; // disable logging of failed clipboard actions
|
||||
|
||||
// Write buffer to the clipboard
|
||||
if( wxTheClipboard->Open() )
|
||||
{
|
||||
// This data objects are held by the clipboard,
|
||||
// so do not delete them in the app.
|
||||
wxTheClipboard->SetData( new wxTextDataObject( buffer.c_str() ) );
|
||||
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox( _( "Unable to export to the Clipboard") );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::exportBitmap( OUTPUT_FMT_ID aFormat )
|
||||
{
|
||||
switch( aFormat )
|
||||
{
|
||||
case EESCHEMA_FMT: m_parentFrame->ExportEeschemaFormat(); break;
|
||||
case PCBNEW_KICAD_MOD: m_parentFrame->ExportPcbnewFormat(); break;
|
||||
case POSTSCRIPT_FMT: m_parentFrame->ExportPostScriptFormat(); break;
|
||||
case KICAD_WKS_LOGO: m_parentFrame->ExportDrawingSheetFormat(); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat )
|
||||
{
|
||||
// Create a potrace bitmap
|
||||
int h = m_NB_Image.GetHeight();
|
||||
int w = m_NB_Image.GetWidth();
|
||||
potrace_bitmap_t* potrace_bitmap = bm_new( w, h );
|
||||
|
||||
if( !potrace_bitmap )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error allocating memory for potrace bitmap" ) );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
/* fill the bitmap with data */
|
||||
for( int y = 0; y < h; y++ )
|
||||
{
|
||||
for( int x = 0; x < w; x++ )
|
||||
{
|
||||
unsigned char pix = m_NB_Image.GetGreen( x, y );
|
||||
BM_PUT( potrace_bitmap, x, y, pix ? 0 : 1 );
|
||||
}
|
||||
}
|
||||
|
||||
// choices of m_rbPCBLayer are expected to be in same order as
|
||||
// BMP2CMP_MOD_LAYER. See bitmap2component.h
|
||||
BMP2CMP_MOD_LAYER modLayer = MOD_LYR_FSILKS;
|
||||
|
||||
if( aFormat == PCBNEW_KICAD_MOD )
|
||||
modLayer = (BMP2CMP_MOD_LAYER) m_chPCBLayer->GetSelection();
|
||||
|
||||
BITMAPCONV_INFO converter( aOutput );
|
||||
converter.ConvertBitmap( potrace_bitmap, aFormat, m_outputSizeX.GetOutputDPI(),
|
||||
m_outputSizeY.GetOutputDPI(), modLayer );
|
||||
|
||||
if( !converter.GetErrorMessages().empty() )
|
||||
wxMessageBox( converter.GetErrorMessages().c_str(), _( "Errors" ) );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_PANEL::OnFormatChange( wxCommandEvent& event )
|
||||
{
|
||||
bool enable = m_rbOutputFormat->GetSelection() == PCBNEW_KICAD_MOD;
|
||||
m_chPCBLayer->Enable( enable );
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user