Compare commits
1014 Commits
9.0
...
revert-0c36e162
| Author | SHA1 | Date | |
|---|---|---|---|
| e808544c20 | |||
| 0c36e16292 | |||
| d2307fdcaa | |||
| 1b1623885c | |||
| 874fad4846 | |||
| a53a639523 | |||
| 5573dce448 | |||
| 57102b87ce | |||
| 8ef54c3651 | |||
| bd1f6e505c | |||
| f51c5c396f | |||
| 9cb0d100e5 | |||
| 9d1142839a | |||
| 199a7a34ea | |||
| c1b1c689ad | |||
| 519b29472f | |||
| 207199fd80 | |||
| 7c56b04436 | |||
| 5a3b2cc8fd | |||
| 072932df80 | |||
| af11746cc4 | |||
| 54681278c5 | |||
| 82043e374a | |||
| 6a24c5c5a4 | |||
| f72d5c43f3 | |||
| 81e2e4e8d2 | |||
| e6c8618386 | |||
| f3392b5c99 | |||
| 7a38e3bf1e | |||
| 254ba394f1 | |||
| 396b7b0054 | |||
| ef594d7bb2 | |||
| a43956a87b | |||
| cfd5846f4e | |||
| 6d22d32f46 | |||
| 64d2fef703 | |||
| 95b8e1241f | |||
| 8051904211 | |||
| 4239e706ea | |||
| c737bd392e | |||
| 496fc3b6bf | |||
| 5371312c6f | |||
| b23bd0ed92 | |||
| 2483ab4d7a | |||
| 1af76a9bef | |||
| 86b17f46de | |||
| 6afedab205 | |||
| 97be2d1ce0 | |||
| 80373e90eb | |||
| ad12fbd2f9 | |||
| 16b4ee92bb | |||
| f0f6b5a09b | |||
| f102298eeb | |||
| b5a913e582 | |||
| fd2822fb15 | |||
| a90e83a699 | |||
| 49e04d3327 | |||
| 61986ab7c8 | |||
| 8229d2e915 | |||
| f1344e921a | |||
| 80a25764eb | |||
| 0331ecb173 | |||
| 846ffa5659 | |||
| ec6af4a5b4 | |||
| 920173a197 | |||
| 53e509326c | |||
| 24cef6d165 | |||
| f9011e9e35 | |||
| 046f1c916b | |||
| 8113824f7c | |||
| c2df0951f9 | |||
| 8814d452fe | |||
| 30912470cd | |||
| 15d88aed92 | |||
| 27910d0228 | |||
| 00d756ea66 | |||
| a088ddd693 | |||
| fc8e41a0de | |||
| 3724789249 | |||
| fc158d5d4b | |||
| 109c15d22f | |||
| b12a4b2650 | |||
| ccdb4e7f18 | |||
| 8f2707c663 | |||
| 661437ba5b | |||
| c0e31e278f | |||
| c20165b13f | |||
| e873b85cd2 | |||
| f96372f100 | |||
| 7fe235cd27 | |||
| 24f5e1c53a | |||
| 7158a9a693 | |||
| 6f7c98d7d9 | |||
| 2d644aedbe | |||
| 04feb955ef | |||
| be167c021b | |||
| 1f1e98a7cf | |||
| 75f369ece9 | |||
| d60a0cc27c | |||
| 1df9195de5 | |||
| 6b59655102 | |||
| a4ff701e7a | |||
| 2ee6c6b133 | |||
| eb17ebee4e | |||
| 0820e90c73 | |||
| c5093a5df0 | |||
| 70cbdbff89 | |||
| df8250fd70 | |||
| e6240f9fbf | |||
| 194ee9ef25 | |||
| 6bc9653029 | |||
| 1c8e20b61f | |||
| f66f2e522f | |||
| 5279cc8767 | |||
| 69bf9894e9 | |||
| 0a8d5ea78b | |||
| 6befe4badf | |||
| 70af60c930 | |||
| a5be581b1b | |||
| 2ee66ccfac | |||
| 9364bcdc9e | |||
| 6d2b728fb1 | |||
| a3fae053c4 | |||
| 4bc099429c | |||
| e64eeb0161 | |||
| a57cd8a207 | |||
| b9013b87d0 | |||
| fd4b18140f | |||
| 6ebadf9fbe | |||
| cdac27b2bc | |||
| 82ec293907 | |||
| 5eee8f1c5f | |||
| 0ba6882c47 | |||
| 5db091fc79 | |||
| 718bf40807 | |||
| 027b01750c | |||
| 05f3c47b4f | |||
| 8c9f4e7832 | |||
| d6e7970738 | |||
| f483fcd2d9 | |||
| fa02c70604 | |||
| 0c0dbc6271 | |||
| fa517a0429 | |||
| c4ff42cb54 | |||
| d421af6e4d | |||
| adc5523f43 | |||
| 10af2f04d3 | |||
| ac265926b1 | |||
| 2d2f443aa4 | |||
| f4107fa4d6 | |||
| 38c822db9c | |||
| 8827323361 | |||
| 2a2a73a1e9 | |||
| e6c76c6e21 | |||
| 352e0035cf | |||
| 8b19777d5d | |||
| 4faa00e262 | |||
| 6cb690fe6b | |||
| 2d69b6e8ba | |||
| eece18f4a8 | |||
| 57d0fa6f2d | |||
| 66a7abca09 | |||
| ecb5c5e0d4 | |||
| f1718370c4 | |||
| e90a3112f8 | |||
| 191327f7e8 | |||
| 9111a65302 | |||
| 0890d3f1cb | |||
| 6f54b11431 | |||
| 069954fa31 | |||
| 159302063a | |||
| aa1dbcba34 | |||
| 7d195b73b2 | |||
| 9228369617 | |||
| a24f7121d8 | |||
| 598d446a38 | |||
| a661deb0ad | |||
| c810ef716d | |||
| 45abc90885 | |||
| 66fad52331 | |||
| 4ae07d1122 | |||
| ea4b2b73bb | |||
| 65a49cc3ba | |||
| e57bc3304f | |||
| 7232a98b65 | |||
| 065e9dbf46 | |||
| f29c19ef02 | |||
| 945c990a53 | |||
| 7ce2b2b85f | |||
| 1d45de0d1d | |||
| 98ec2d7ba2 | |||
| ec6bc85a29 | |||
| 702d802b22 | |||
| f381c6e846 | |||
| 60364a9062 | |||
| ee68280b27 | |||
| cb1e6b62e9 | |||
| 1176ff4a15 | |||
| 3d29fae7a9 | |||
| 82003c8660 | |||
| c5b132dd27 | |||
| f4695081c1 | |||
| 5d70b07c99 | |||
| 43aa63c1ec | |||
| 845cdb1b25 | |||
| bccf365380 | |||
| f0ebf0a7cc | |||
| 3def4afaec | |||
| 0659290417 | |||
| c5ff61ba9c | |||
| 848a6b6930 | |||
| ac616b8c19 | |||
| 7a9db0f8c1 | |||
| 2745945894 | |||
| 860f52800e | |||
| 96491132ce | |||
| 598850b1f0 | |||
| 12c82149bf | |||
| 91d9863cc3 | |||
| d4cc91f17a | |||
| 8b33b25e83 | |||
| 2c9c607b95 | |||
| 82f94e9185 | |||
| 7a04389ac2 | |||
| 11edaa6e4a | |||
| 642e4d37bc | |||
| 91dda80530 | |||
| 200c4a9eae | |||
| 7151d21f0b | |||
| 9eea670617 | |||
| cf3dae0bb9 | |||
| 380b5160d6 | |||
| cf96295fa1 | |||
| 185491f2b8 | |||
| 661d002234 | |||
| 2e556d0abc | |||
| f8ec23db00 | |||
| 40058ebe80 | |||
| 8ff0aafbb8 | |||
| a0ec7f59c4 | |||
| 901ad3064d | |||
| db911c0d91 | |||
| 967bf1d0a1 | |||
| 05e9772d54 | |||
| 8b69ec4761 | |||
| 5fd294cad2 | |||
| f40b24d04a | |||
| 43e432f9ad | |||
| 76929808d3 | |||
| 7f9a277594 | |||
| 0573a32f36 | |||
| a1fe0f7faf | |||
| 6f6ef8e626 | |||
| 5e0beb97ee | |||
| 7b76aa4992 | |||
| 2ce7535318 | |||
| 22769b9159 | |||
| 9920751eb7 | |||
| 1202838135 | |||
| 6e566b2819 | |||
| 688448f9ab | |||
| ef5cd6bb28 | |||
| c8b57c50dc | |||
| 822e188d55 | |||
| d52d0d0aad | |||
| 9b71102dd8 | |||
| 14ca6e7b08 | |||
| 4ae4f9ea87 | |||
| 141097549c | |||
| 582aef0220 | |||
| 2b0d082df5 | |||
| d729b34986 | |||
| 9066ad3620 | |||
| 33ee9e99fe | |||
| 79fbae00ce | |||
| 97e1c107c9 | |||
| 906c24bc6d | |||
| 12861345d3 | |||
| 7a4325e610 | |||
| 60a26308ae | |||
| 4f115b12a4 | |||
| b62f00912e | |||
| 408d3a0170 | |||
| baaf341d0d | |||
| 4783bc4cfd | |||
| 31f3c44520 | |||
| 313cc15fd3 | |||
| dc9fa2e2ac | |||
| 3bac9344d2 | |||
| 6d0e0312b2 | |||
| 175a326307 | |||
| a4ad5dc773 | |||
| 1437e66741 | |||
| 7f32b2452d | |||
| 1bed76bed8 | |||
| 3990c61ea8 | |||
| 11ba582d87 | |||
| e6f4b02e9c | |||
| 560e91880e | |||
| c187c098ae | |||
| be4b25026d | |||
| 286518e926 | |||
| 49b145a6a0 | |||
| 8f9a6fde98 | |||
| 5107bd43e7 | |||
| 01936b1683 | |||
| 5d49f4a3e9 | |||
| 7c5ce03a93 | |||
| deb14110aa | |||
| 629a12ab2e | |||
| d59f624001 | |||
| fd94488289 | |||
| 151cb01795 | |||
| 659c783e5e | |||
| 7ba07a3bb0 | |||
| c67924ccac | |||
| a90b8ec57a | |||
| 7cf699bc9d | |||
| 79924b5dfd | |||
| 78b6ca8256 | |||
| 8076bfa3c7 | |||
| 96835cbfcf | |||
| 07eda5d57e | |||
| d16a5bf87d | |||
| 937f225df0 | |||
| 22e1f70a7e | |||
| 88267c4a47 | |||
| 99e65afa1f | |||
| 01c1ff47ad | |||
| 2ca09457b0 | |||
| 3dfd164e2b | |||
| 3e51b2c647 | |||
| 7bd4fa3fa6 | |||
| 34f12dc4be | |||
| 5f620f0fa1 | |||
| 2dfe4d4716 | |||
| cdbf71a562 | |||
| da05ad93ac | |||
| 3380afd9fd | |||
| 1b40ddaba5 | |||
| 1638322649 | |||
| 69f758dbcd | |||
| 7bc1404956 | |||
| b5cd5d2e27 | |||
| 6181fa5a91 | |||
| 4cd007cb6d | |||
| 6e2914b990 | |||
| ab43c3c6b5 | |||
| e48ad06cab | |||
| 9a7b82a8c0 | |||
| 1c83f0a70b | |||
| 805ca0c791 | |||
| cf93cdf13f | |||
| 074b511fab | |||
| d2b3f8ba28 | |||
| 9113651076 | |||
| 5422cff30b | |||
| 2fb0fd8de1 | |||
| d8f37ff86a | |||
| b57d1f9ab5 | |||
| 09e34d2b58 | |||
| 65e1e12eaf | |||
| 51ddfa359f | |||
| 6f0350c761 | |||
| 7562f6a804 | |||
| 3eef769de5 | |||
| ea62ece5a4 | |||
| e167bd8782 | |||
| fccddf8330 | |||
| 63d5b2bea9 | |||
| ef76fbbd94 | |||
| 4ab1964a1c | |||
| 84d6ee94c7 | |||
| 95f99c2731 | |||
| 60f331862a | |||
| 67b8226960 | |||
| b678e73e71 | |||
| 750956da7b | |||
| 30fc350550 | |||
| 0ee47a3492 | |||
| b618cd353b | |||
| cfc3364b58 | |||
| 66f670ca18 | |||
| ab27d41dfe | |||
| 8dc2733a33 | |||
| 76eee9be4a | |||
| ba782e5bed | |||
| c5804bebde | |||
| f83e607e6e | |||
| 6d0a8cd346 | |||
| 9c375581ff | |||
| 0a4533703c | |||
| d205a136a9 | |||
| 8921824128 | |||
| 52514e1bfe | |||
| 36366e254d | |||
| ea36110980 | |||
| b65ceb60b2 | |||
| faf6243d1a | |||
| b8225ba2d6 | |||
| 0d6838b803 | |||
| 5e61a5193f | |||
| e6843cde64 | |||
| e11cf94a3e | |||
| e64239969a | |||
| 9a1e42f228 | |||
| f5cae044d0 | |||
| b567532af7 | |||
| 59e77e977e | |||
| 1b7f92f4c5 | |||
| b366204824 | |||
| 33a8cd942f | |||
| 86e1d4c684 | |||
| 5ec526fe4f | |||
| d3f57fac5a | |||
| 0aa4f11970 | |||
| 21725eeef3 | |||
| a648fccbb3 | |||
| 19d1b6ec52 | |||
| eb4a52f372 | |||
| f0c81e972f | |||
| 7e046e6c8b | |||
| bc4a40de76 | |||
| 4cb234862c | |||
| 18010b1104 | |||
| 7578439b0c | |||
| b7fd26e026 | |||
| 8994f6abd7 | |||
| 3328dc48be | |||
| b4640cdc55 | |||
| 0a3ddd33ee | |||
| 824c7ecfa7 | |||
| 983d14d371 | |||
| 0f1f6b23a8 | |||
| 24a8c2a684 | |||
| 4ef0d3554e | |||
| 2ef123d9e1 | |||
| 7645f05962 | |||
| 6307f0aee8 | |||
| 142f8265c5 | |||
| 683444733a | |||
| cf4369a2ef | |||
| 19b0ac6ec4 | |||
| 31d3c17d99 | |||
| 8fa48c7be2 | |||
| 62cb67d854 | |||
| 5094f750df | |||
| dd806aa902 | |||
| 5783623c50 | |||
| 858f6b0fc2 | |||
| f53d1a5356 | |||
| 47984b6793 | |||
| 4131089260 | |||
| b364f5dbde | |||
| 4a99a3060d | |||
| d0518c96b2 | |||
| 32e3570758 | |||
| 1dfc09a39d | |||
| 2230fd2518 | |||
| 3e838bce5b | |||
| b6b5c4be54 | |||
| 6fdad6c799 | |||
| a06fd8a97e | |||
| 5a732b7b9f | |||
| 2ac2bffa9e | |||
| df02aec8a5 | |||
| 627d9e5e50 | |||
| 36255b90e4 | |||
| 25f883cf63 | |||
| 403c9055ed | |||
| 17712ba321 | |||
| 6c97a40b8c | |||
| 60f65e68c1 | |||
| 1848401d5b | |||
| dd921354fc | |||
| 413d6747c5 | |||
| 1333c4c305 | |||
| 77747aa41e | |||
| fe22166d9f | |||
| 6708f7b10c | |||
| 533551f014 | |||
| 676dd4ceec | |||
| f4a5404e0a | |||
| f9b19bbb5b | |||
| f33f10bb38 | |||
| 29c0c35f5f | |||
| 13c295e141 | |||
| d9a0c001b2 | |||
| e526c5b988 | |||
| 6df678a227 | |||
| e5a275038d | |||
| e6200bb5eb | |||
| c7bfe02382 | |||
| 6ddd5ae050 | |||
| da267aed7e | |||
| dfd81c7521 | |||
| ede5faee72 | |||
| bb62444fe9 | |||
| de09403b10 | |||
| 2c52f98da4 | |||
| 26c331a837 | |||
| 078a01976f | |||
| 10237c4270 | |||
| 1ee3131e4a | |||
| be183c94c0 | |||
| 8894c470ef | |||
| 7f1b412203 | |||
| 2210fc3518 | |||
| d3c05c7ccd | |||
| 521b411090 | |||
| 3c32f4d31d | |||
| 313232c9f3 | |||
| 54be62b8fa | |||
| 2304d10879 | |||
| e48a2b5ee4 | |||
| 18b5046fae | |||
| f3f9730f2c | |||
| 93ea523eec | |||
| 5996cffabc | |||
| d5f02ba7bc | |||
| 61a89f1c83 | |||
| f8a1de4945 | |||
| 7167faaab6 | |||
| 1ac75d2c04 | |||
| df1c7802d7 | |||
| 7c8187cb56 | |||
| 37dca5b2e6 | |||
| 423ea8deae | |||
| dc8ad32e92 | |||
| 02c9336de1 | |||
| 6fdd2cc119 | |||
| fd4871409b | |||
| 37249d0fd1 | |||
| 087cd06deb | |||
| d6cfd3e41c | |||
| 48fc765a38 | |||
| 8c700eac1b | |||
| 62fc117473 | |||
| 039b03cd7a | |||
| 487afaad96 | |||
| 442fa8f511 | |||
| f6d4815c8a | |||
| 3a087b5baf | |||
| ed29c73763 | |||
| 9cdaa7848a | |||
| fc264aaa60 | |||
| 9a04c1ce37 | |||
| ea0a26b8a8 | |||
| 76243ef2c9 | |||
| 99adcbb1ed | |||
| d5ad5f7c81 | |||
| ddd27f2869 | |||
| de4d7882e6 | |||
| d31eeb5c1b | |||
| 7d8b385a72 | |||
| 1c245ad01e | |||
| 96794e94e3 | |||
| dd604361d3 | |||
| 6df9c90440 | |||
| e5bedd937c | |||
| 63435df77d | |||
| ccc396a6c2 | |||
| 95e6ca44c6 | |||
| 5774338af2 | |||
| b7ef57a97d | |||
| 459cf030b8 | |||
| a6fbf4bbdb | |||
| 31b788c04f | |||
| 4a64aa9816 | |||
| d527ce92ca | |||
| 7401b57fcb | |||
| b11b1a6f72 | |||
| b569d919ea | |||
| 9ac851b314 | |||
| 567da3de91 | |||
| 6ac64d290b | |||
| c4655da4e6 | |||
| 3ddaa24775 | |||
| c05cc345f3 | |||
| b1bf5127fa | |||
| 8192ba73d9 | |||
| 91ee987cfe | |||
| a468c486eb | |||
| 4b38932129 | |||
| b13318b854 | |||
| e72c5e9e82 | |||
| f5629f04e3 | |||
| 8caa051e8b | |||
| cd0cbb5acb | |||
| e674827255 | |||
| c6fee328e2 | |||
| 569d38c39e | |||
| b47b04b795 | |||
| 2335fa7708 | |||
| 97753e8208 | |||
| 456e2e18b4 | |||
| 2d81ba665a | |||
| a7b9d1cabe | |||
| 35eaef151c | |||
| 6de078ffad | |||
| 17eb1f0558 | |||
| 7e7b78707d | |||
| 2ed2d733c3 | |||
| dc961d37ad | |||
| b91e005277 | |||
| a82916f4db | |||
| 18d836ef8b | |||
| 0a3f14c855 | |||
| 1f620e9cca | |||
| e163c40e54 | |||
| 85e6978aa2 | |||
| 50174ec528 | |||
| ab6ee168cf | |||
| 241962a84d | |||
| 6729e313a5 | |||
| 4ef627edb9 | |||
| 2cdc1ed88e | |||
| 9a1cf81ca6 | |||
| 9d1b320896 | |||
| 641e06e67c | |||
| 4ef81ee3ea | |||
| 4f6a73d83c | |||
| 3f17aabcd0 | |||
| bded181ad0 | |||
| 95d8634401 | |||
| eedd811c0a | |||
| 880442e8ed | |||
| b532a849b8 | |||
| b401505259 | |||
| 1157b5b0b3 | |||
| 2b557c5497 | |||
| 0fae6a0db0 | |||
| 727fc9bd06 | |||
| dd4c9af265 | |||
| 877c6bce89 | |||
| ce5469b95e | |||
| a1e897c245 | |||
| 7558b49afd | |||
| ca51b0f37d | |||
| 81fcc16cc9 | |||
| 54540f9e82 | |||
| c24832f72b | |||
| 57952a7a86 | |||
| 8e048d0c42 | |||
| a1b78d170d | |||
| 413468cd04 | |||
| 8ee263b341 | |||
| 4b07565d35 | |||
| 68b6c2d1da | |||
| 52648497b2 | |||
| 5c91a7fa3a | |||
| 124eccb710 | |||
| 671d84562b | |||
| 3d41eca856 | |||
| c92014f759 | |||
| c6ccb195a1 | |||
| f104ded1d5 | |||
| c738bc9f37 | |||
| 95dd38c3e8 | |||
| 985a62aad2 | |||
| f6aa8a0e3d | |||
| 02b603af50 | |||
| 72a832175e | |||
| 378e1765a0 | |||
| 8907937e94 | |||
| de49ba63c1 | |||
| fdfc28c034 | |||
| 80753f2f6e | |||
| 727bae947a | |||
| cff5888751 | |||
| 22f4b6bad5 | |||
| c22ed9aa39 | |||
| f80c52f0af | |||
| ee4a6127c6 | |||
| 38cf86cb09 | |||
| e54c73b516 | |||
| af3aba3c46 | |||
| 086b9907c2 | |||
| 237953fd55 | |||
| ff6eb9c091 | |||
| 984041f57e | |||
| 4a3b33df4e | |||
| f0e287a87b | |||
| c108b20616 | |||
| a091b6c1c9 | |||
| c7cec5f21a | |||
| 8e10c539f5 | |||
| 9856cb2210 | |||
| 305bb6302b | |||
| 3051a40376 | |||
| b0c42362b6 | |||
| 50507212fd | |||
| 4f4ece61bb | |||
| fdcfa8f354 | |||
| a6ef2d97fb | |||
| 259e249aed | |||
| 32b5cf6221 | |||
| d0b22d21bb | |||
| 49a4699d5a | |||
| 699fd2b3ac | |||
| 9be7464681 | |||
| 4248fba976 | |||
| 9eb2b13833 | |||
| 7a7dfdc043 | |||
| 6a0efe6883 | |||
| 251a6ea8cb | |||
| d9c952d90c | |||
| b0e2e9e35e | |||
| ea9cece5fe | |||
| 001d3dfd88 | |||
| b419058df3 | |||
| c61b6b8bdd | |||
| f00947266f | |||
| b6743653f3 | |||
| 28ce3c2e7d | |||
| 56997e75e9 | |||
| 8e5d2e18e7 | |||
| 0f92164f29 | |||
| 48e5de1a50 | |||
| 9f4b242713 | |||
| 16b8649969 | |||
| 60889bebd4 | |||
| 51ee5c97ff | |||
| aff0ad971f | |||
| 1e9cf4e3d7 | |||
| 7cfa826c9a | |||
| 3960480819 | |||
| 92b4b7187e | |||
| 1808fcec78 | |||
| d9ab3a6228 | |||
| 2afa67f946 | |||
| a32c0a8687 | |||
| d8cdb69831 | |||
| 6f6ca2a35f | |||
| afa4ebcc84 | |||
| 6b146874c1 | |||
| 1c48e97cd7 | |||
| d0e86cad7c | |||
| 46378dc760 | |||
| bb074f73aa | |||
| c2685ef76f | |||
| 27edf0b949 | |||
| b0eef3ee28 | |||
| 3fc87a841d | |||
| 559a966ef7 | |||
| 164eff1a3b | |||
| 7d9dd50b08 | |||
| dc12fdfc33 | |||
| f5d2b40c9e | |||
| 163a26111a | |||
| b1a4b77291 | |||
| 833bcba06c | |||
| 925f2f9bc1 | |||
| b0fe4df3c5 | |||
| 2890500f4c | |||
| 0acdabd1eb | |||
| 1a10b5fb64 | |||
| 8d096590dc | |||
| 5694c90ae9 | |||
| eaa1e6d594 | |||
| 307798ac92 | |||
| f951497a4f | |||
| 481e467968 | |||
| ef75f63f10 | |||
| 547a063981 | |||
| 8b541f03e9 | |||
| b21814b973 | |||
| 93549a649b | |||
| 3768221d9c | |||
| 5bdeb40d66 | |||
| 10cb0592ee | |||
| 00dca4edb3 | |||
| 49a5b44220 | |||
| e44eed6e6b | |||
| 51f56ab31c | |||
| 8762f7e5e6 | |||
| c5c368af6c | |||
| a3b5c209d8 | |||
| e8aad579ec | |||
| 72a2ae5fa1 | |||
| 2f7a4518b6 | |||
| 6d7f958026 | |||
| 344d501d82 | |||
| 8050cb614d | |||
| 3d43e026af | |||
| 92eb945a46 | |||
| 99cdb6238c | |||
| 47b955b187 | |||
| 81428e14a6 | |||
| c0e4c6a865 | |||
| 6e66b22a13 | |||
| 7f935e290a | |||
| 2aa0c15b41 | |||
| 26871b56f0 | |||
| 18ac99d838 | |||
| 75bed91789 | |||
| e202b00a74 | |||
| 18e5a16040 | |||
| 85810510f4 | |||
| ab114c4159 | |||
| e53c155b8c | |||
| 548334b4e2 | |||
| caa03ab59e | |||
| 7e2a81da15 | |||
| 29c62e9d9a | |||
| ea2f8a63c1 | |||
| 784246575b | |||
| 04ab369a49 | |||
| 9e9db8bd4d | |||
| c18bc2472b | |||
| 384ca6bf98 | |||
| fc6f3f2332 | |||
| f0a76f62b6 | |||
| 7ad1103f55 | |||
| df15db3236 | |||
| c24dbc17bf | |||
| 7eb07c00a2 | |||
| 268094320b | |||
| 1205464472 | |||
| 46db959074 | |||
| b4d29a98f9 | |||
| 007db5f957 | |||
| e80780d3ad | |||
| 5e467a969d | |||
| e81956f292 | |||
| 320a298394 | |||
| a414cb0a17 | |||
| 230a976742 | |||
| 144e660684 | |||
| 8e461941c0 | |||
| a9cea9fbb7 | |||
| ba85c54f81 | |||
| 9211136953 | |||
| 5027a562e4 | |||
| 52e86303c0 | |||
| 20c72504c3 | |||
| 797de67c6c | |||
| f510cce2da | |||
| 53e784caef | |||
| 500962b3a4 | |||
| 23528425ef | |||
| f538908f62 | |||
| 7c067e25d9 | |||
| 7faee6acc2 | |||
| ef9fc7841a | |||
| 50d976be35 | |||
| f13f8f788f | |||
| caf99cc3b4 | |||
| c2bcb36369 | |||
| f2205e0c83 | |||
| 638d6bbf2a | |||
| 0ae37c0f60 | |||
| b7401a5087 | |||
| e029537739 | |||
| b85c5eb8cc | |||
| fde4aac075 | |||
| 956875e2f4 | |||
| 6ccacd232e | |||
| 20f40c1030 | |||
| 888cbf8e7a | |||
| 931b1b0231 | |||
| 92cdca69b3 | |||
| de160e4af6 | |||
| 9d5e143d08 | |||
| aa1baec062 | |||
| b6aac9369e | |||
| 41f5750be7 | |||
| 5cec2fac9d | |||
| 72411af9de | |||
| 0877467384 | |||
| 59b297dcdc | |||
| 2c54ab277b | |||
| 42e448dbf6 | |||
| 71fdc9b199 | |||
| d2edf6796c | |||
| 62b208e0a5 | |||
| b6a0a7cd14 | |||
| bc5fca1daa | |||
| dbab601c0a | |||
| c4c1842bc4 | |||
| f928b6b7e0 | |||
| 8f40feedbb | |||
| 141d50f0c1 | |||
| 7db3ccd98a | |||
| 78fc95fd6d | |||
| 9e4947ed36 | |||
| 29a4ec0fde | |||
| bfbdfcf872 | |||
| 6be2468e05 | |||
| 3b24b5b74b | |||
| ea520da1c8 | |||
| 907f21e739 | |||
| 0de8d75dec | |||
| f5cee2ee0a | |||
| 86e9f47875 | |||
| ddcf3f9855 | |||
| 8fd175dd22 | |||
| 29b8066473 | |||
| 562ff37314 | |||
| 1691d8d2b2 | |||
| 3f15b0d75b | |||
| 59d6152cf0 | |||
| 34db9ed245 | |||
| 01a19bf3d0 | |||
| 7b80e93a4b | |||
| 675624b926 | |||
| 7583c0e69d | |||
| c5bb59468d | |||
| 9d901188cb | |||
| f2da0c791f | |||
| f9c41d70d1 | |||
| e7652685f0 | |||
| 79eeb1492c | |||
| 3a4aec7267 | |||
| 28684cfeba | |||
| 7eb75720b5 | |||
| aaca66351e | |||
| 85c4319185 | |||
| b74c2791f4 | |||
| 9d051d096e | |||
| 97a0ec504b | |||
| 3b3fd95430 | |||
| 0c9f08742c | |||
| e483c48fe6 | |||
| 76a3d1c845 | |||
| 5771467ca3 | |||
| 4123f75d5a | |||
| 03af293683 | |||
| 3525731a4e | |||
| 58d2b34304 | |||
| 9c6ebb44b6 | |||
| bacb6bf40f | |||
| 0e8934f887 | |||
| 89a5fadcdc | |||
| 157c7422b0 | |||
| b02a449be8 | |||
| c57088a60c | |||
| 812a3ff83e | |||
| 2e7db39751 | |||
| d29025ef78 | |||
| 5a5759c41a | |||
| 4e4ebe536e | |||
| 5abfdac639 | |||
| 8082d6ffa9 | |||
| 78d117bf3b | |||
| 8d7d769bb6 | |||
| cc1f513a6e | |||
| fc9795e95d | |||
| e972fb42ee | |||
| c7aaf8b6e1 | |||
| ca21a35bfc | |||
| 1e84d1e496 | |||
| ee614161d7 | |||
| 0c2a5b72ec | |||
| 255f4aee76 | |||
| 878cf768d6 | |||
| 2e93fb7a24 | |||
| ac9f41baaa | |||
| aafe6157e2 | |||
| 22a2cca312 | |||
| 68869f6439 | |||
| 0885d48d6b | |||
| a9fb475cf2 | |||
| b932487f2e | |||
| a8a1b08013 | |||
| 9ca9d7120a | |||
| 1748c3c893 | |||
| 8a5b71a01b | |||
| 0201e7286c | |||
| f24c8d7410 | |||
| 3d15317282 | |||
| 0954f8ff76 | |||
| 6b3d01ead9 | |||
| a00aeb7876 | |||
| e018a33628 | |||
| 61efe5be18 | |||
| bf34fe625c | |||
| fea659a002 | |||
| 426ac96bb7 | |||
| be58dddcab | |||
| 6a3f52dbaf | |||
| 3c71e7ab09 | |||
| c136df247f | |||
| 006d8b290a | |||
| 072d8d55fe | |||
| c8f56f24a8 | |||
| 4e08afd517 | |||
| 1ff0dfb052 | |||
| c28039556d | |||
| 42acb62f6e | |||
| f65d260961 | |||
| d921a4e916 | |||
| 56b8fec74b | |||
| 1c848bb9fb | |||
| 80e7698131 | |||
| 4fa02690f8 | |||
| b44261c2bd | |||
| 4959b480c3 | |||
| 9c0214afc0 | |||
| 281aa74f30 | |||
| 5edae8250d | |||
| 40daacbeeb | |||
| 3fff89820d | |||
| cedb97c4c3 | |||
| 759bfbca99 | |||
| 2a1b93a254 | |||
| 4a35468301 | |||
| 5e64f56d54 | |||
| 2559ac50a3 | |||
| 663f00da25 | |||
| cf2827c6ec | |||
| 9781da51e1 | |||
| d2f780dfb4 | |||
| ef49d83bc1 |
+1
-1
@@ -25,7 +25,7 @@ BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 100
|
||||
ColumnLimit: 120
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
|
||||
@@ -24,6 +24,7 @@ common/template_fieldnames_lexer.h
|
||||
eeschema/schematic_keywords.*
|
||||
pcbnew/pcb_plot_params_keywords.cpp
|
||||
pcbnew/pcb_plot_params_lexer.h
|
||||
pcbnew/dialogs/panel_setup_rules_help_*.h
|
||||
Makefile
|
||||
CMakeUserPresets.json
|
||||
CMakeCache.txt
|
||||
@@ -51,6 +52,7 @@ common/pcb_keywords.cpp
|
||||
include/pcb_lexer.h
|
||||
fp-info-cache
|
||||
qa/tests/output/**
|
||||
qa/tests/cli/output/**
|
||||
|
||||
# demo project auxiliary files
|
||||
demos/**/*-bak
|
||||
@@ -125,9 +127,11 @@ i18n_status.csv
|
||||
# Project local settings files and backups (in demos and qa tests)
|
||||
*.kicad_prl
|
||||
*-backups
|
||||
~*.lck
|
||||
|
||||
# QA dataoutput
|
||||
qa/data/**/*.csv
|
||||
qa/data/**/*.spice
|
||||
|
||||
# Don't actually ignore any of these files, since we need them in the tree
|
||||
!resources/linux/icons/hicolor/**/**/*
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
# Despite the unfortunate naming convention of this file, KiCad does not have code "owners".
|
||||
# All parts of KiCad are worked on by all developers, and we do not require explicit approval
|
||||
# from any particular person in order to accept contributions or fixes to sections of KiCad.
|
||||
|
||||
# This file is used to generate suggested reviewers for pull requests that touch certain parts
|
||||
# of the KiCad codebase based on the development history of those parts. Most of KiCad does not
|
||||
# have a particular set of reviewers defined in this file, and in general, it is a good thing if
|
||||
# entries can be removed from this file over time, because it indicates that expertise about
|
||||
# parts of the codebase that once were only familiar to one or two developers is now shared among
|
||||
# a wider set of the core development team.
|
||||
|
||||
# Contributors: despite this file, the KiCad team still primarily matches up new merge requests
|
||||
# with reviewers based on developer availability. If a change you propose touches files that
|
||||
# are covered by entries in this file, the relevant developer(s) may or may not be the final
|
||||
# reviewer(s) for your merge request.
|
||||
|
||||
# Core team developers: consider adding yourself to places where you are commonly asked for
|
||||
# review feedback by the rest of the team. Consider removing yourself if you are stepping back
|
||||
# from participating in KiCad code review, or if you notice that an area you were previously
|
||||
# listed as a reviewer because not many others were familiar with it is now familiar with the
|
||||
# larger team.
|
||||
|
||||
^[Suggested Reviewers]
|
||||
|
||||
/vcpkg*.json @mroszko
|
||||
|
||||
/api/ @craftyjon
|
||||
|
||||
/cmake/InstallSteps/*MacOS.cmake @craftyjon
|
||||
|
||||
/common/api/ @craftyjon
|
||||
/common/git/ @sethhillbrand
|
||||
/common/database/ @craftyjon
|
||||
/common/io/eagle/ @stambaughw
|
||||
/common/jobs/ @mroszko
|
||||
|
||||
/cmake/KiCadVersion.cmake @stambaughw
|
||||
|
||||
/eeschema/api/ @craftyjon
|
||||
/eeschema/erc/ @jeffyoung
|
||||
/eeschema/connection_graph.* @craftyjon @sethhillbrand
|
||||
/eeschema/sch_io/database/ @craftyjon
|
||||
/eeschema/sch_io/kicad_sexpr/ @stambaughw
|
||||
/eeschema/sch_io/eagle/ @stambaughw
|
||||
|
||||
/libs/kinng/ @craftyjon
|
||||
|
||||
/pcbnew/api/ @craftyjon
|
||||
/pcbnew/drc/ @jeffyoung
|
||||
/pcbnew/pcb_io/easyeda* @dsa-t
|
||||
/pcbnew/pcb_io/ipc2581/ @sethhillbrand
|
||||
/pcbnew/pcb_io/odbpp/ @SYSUeric66 @sethhillbrand @craftyjon
|
||||
/pcbnew/router/ @twlostow @craftyjon @sethhillbrand
|
||||
/pcbnew/zone_filler* @jeffyoung
|
||||
|
||||
/scripting/ @craftyjon @sethhillbrand
|
||||
|
||||
/thirdparty/nanodbc/ @craftyjon
|
||||
@@ -91,7 +91,6 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
||||
m_IsPreviewer( false ),
|
||||
m_board( nullptr ),
|
||||
m_3dModelManager( nullptr ),
|
||||
m_colors( nullptr ),
|
||||
m_layerZcoordTop(),
|
||||
m_layerZcoordBottom()
|
||||
{
|
||||
@@ -114,6 +113,8 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
||||
m_frontCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
|
||||
m_backCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
|
||||
m_nonCopperLayerThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_frontMaskThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_backMaskThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_solderPasteLayerThickness3DU = SOLDERPASTE_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
|
||||
m_trackCount = 0;
|
||||
@@ -137,13 +138,14 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
||||
m_ECO1Color = SFVEC4F( 0.70, 0.10, 0.10, 1.0 );
|
||||
m_ECO2Color = SFVEC4F( 0.70, 0.10, 0.10, 1.0 );
|
||||
|
||||
for( int ii = 0; ii < 45; ++ii )
|
||||
m_UserDefinedLayerColor[ii] = SFVEC4F( 0.70, 0.10, 0.10, 1.0 );
|
||||
|
||||
m_platedPadsFront = nullptr;
|
||||
m_platedPadsBack = nullptr;
|
||||
m_offboardPadsFront = nullptr;
|
||||
m_offboardPadsBack = nullptr;
|
||||
|
||||
m_frontPlatedPadAndGraphicPolys = nullptr;
|
||||
m_backPlatedPadAndGraphicPolys = nullptr;
|
||||
m_frontPlatedCopperPolys = nullptr;
|
||||
m_backPlatedCopperPolys = nullptr;
|
||||
|
||||
@@ -229,11 +231,12 @@ void BOARD_ADAPTER::ReloadColorSettings() noexcept
|
||||
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
|
||||
COLOR_SETTINGS* colors = mgr.GetColorSettings( cfg ? cfg->m_ColorTheme : wxString( "" ) );
|
||||
|
||||
if( cfg )
|
||||
if( colors )
|
||||
{
|
||||
m_colors = Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
|
||||
GetBoardEditorCopperLayerColors( cfg );
|
||||
for( int layer = F_Cu; layer < PCB_LAYER_ID_COUNT; ++layer )
|
||||
m_BoardEditorColors[ layer ] = colors->GetColor( layer );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +265,15 @@ bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer,
|
||||
case Cmts_User: return aVisibilityFlags.test( LAYER_3D_USER_COMMENTS );
|
||||
case Eco1_User: return aVisibilityFlags.test( LAYER_3D_USER_ECO1 );
|
||||
case Eco2_User: return aVisibilityFlags.test( LAYER_3D_USER_ECO2 );
|
||||
default: return m_board && m_board->IsLayerVisible( aLayer );
|
||||
default:
|
||||
{
|
||||
int layer3D = MapPCBLayerTo3DLayer( aLayer );
|
||||
|
||||
if( layer3D != UNDEFINED_LAYER )
|
||||
return aVisibilityFlags.test( layer3D );
|
||||
|
||||
return m_board && m_board->IsLayerVisible( aLayer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,6 +383,8 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
m_frontCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
|
||||
m_backCopperThickness3DU = DEFAULT_COPPER_THICKNESS * m_biuTo3Dunits;
|
||||
m_nonCopperLayerThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_frontMaskThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_backMaskThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
m_solderPasteLayerThickness3DU = SOLDERPASTE_LAYER_THICKNESS * m_biuTo3Dunits;
|
||||
|
||||
g_BevelThickness3DU = pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_3DRT_BevelHeight_um / 1000.0 )
|
||||
@@ -383,7 +396,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
|
||||
if( bds.GetStackupDescriptor().GetCount() )
|
||||
{
|
||||
int thickness = 0;
|
||||
int body_thickness = 0;
|
||||
|
||||
for( BOARD_STACKUP_ITEM* item : bds.GetStackupDescriptor().GetList() )
|
||||
{
|
||||
@@ -391,31 +404,44 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
{
|
||||
case BS_ITEM_TYPE_DIELECTRIC:
|
||||
for( int sublayer = 0; sublayer < item->GetSublayersCount(); sublayer++ )
|
||||
thickness += item->GetThickness( sublayer );
|
||||
body_thickness += item->GetThickness( sublayer );
|
||||
|
||||
break;
|
||||
|
||||
case BS_ITEM_TYPE_COPPER:
|
||||
{
|
||||
// The copper thickness must be > 0 to avoid draw issues (divide by 0 for
|
||||
// instance). We use a minimal arbitrary value = 1 micrometer here:
|
||||
int copper_thickness = std::max( item->GetThickness(),
|
||||
pcbIUScale.mmToIU( 0.001 ) );
|
||||
int copper_thickness = std::max( item->GetThickness(), pcbIUScale.mmToIU( 0.001 ) );
|
||||
|
||||
if( item->GetBrdLayerId() == F_Cu )
|
||||
m_frontCopperThickness3DU = copper_thickness * m_biuTo3Dunits;
|
||||
else if( item->GetBrdLayerId() == B_Cu )
|
||||
m_backCopperThickness3DU = copper_thickness * m_biuTo3Dunits;
|
||||
else if( item->IsEnabled() )
|
||||
thickness += copper_thickness;
|
||||
}
|
||||
body_thickness += copper_thickness;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case BS_ITEM_TYPE_SOLDERMASK:
|
||||
{
|
||||
// The mask thickness must be > 0 to avoid draw issues (divide by 0 for
|
||||
// instance). We use a minimal arbitrary value = 1 micrometer here:
|
||||
int mask_thickness = std::max( item->GetThickness(), pcbIUScale.mmToIU( 0.001 ) );
|
||||
|
||||
if( item->GetBrdLayerId() == F_Mask )
|
||||
m_frontMaskThickness3DU = mask_thickness * m_biuTo3Dunits;
|
||||
else if( item->GetBrdLayerId() == B_Mask )
|
||||
m_backMaskThickness3DU = mask_thickness * m_biuTo3Dunits;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_boardBodyThickness3DU = thickness * m_biuTo3Dunits;
|
||||
m_boardBodyThickness3DU = body_thickness * m_biuTo3Dunits;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,8 +475,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
};
|
||||
|
||||
m_layerZcoordBottom[layer_id] = m_boardBodyThickness3DU / 2.0
|
||||
- ( m_boardBodyThickness3DU * layer_pos
|
||||
/ ( m_copperLayersCount - 1 ) );
|
||||
- ( m_boardBodyThickness3DU * layer_pos / ( m_copperLayersCount - 1 ) );
|
||||
|
||||
if( layer_pos < (m_copperLayersCount / 2) )
|
||||
m_layerZcoordTop[layer_id] = m_layerZcoordBottom[layer_id] + m_frontCopperThickness3DU;
|
||||
@@ -465,26 +490,14 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
const float zpos_copperTop_back = m_layerZcoordTop[B_Cu];
|
||||
const float zpos_copperTop_front = m_layerZcoordTop[F_Cu];
|
||||
|
||||
// Fill not copper layers zpos with a dummy position
|
||||
// (m_layerZcoordTop[B_Cu]with a small margin)
|
||||
// Some important layer position will be set later
|
||||
// Fill not copper layers zpos
|
||||
for( int layer_id = 0; layer_id < PCB_LAYER_ID_COUNT; layer_id++ )
|
||||
{
|
||||
if( IsCopperLayer( (PCB_LAYER_ID)layer_id ) )
|
||||
continue;
|
||||
|
||||
m_layerZcoordBottom[(PCB_LAYER_ID)layer_id] = zpos_copperTop_back - 2.0f * zpos_offset;
|
||||
m_layerZcoordTop[(PCB_LAYER_ID) layer_id] =
|
||||
m_layerZcoordBottom[(PCB_LAYER_ID) layer_id] - m_backCopperThickness3DU;
|
||||
}
|
||||
|
||||
// calculate z position for each technical layer
|
||||
// Solder mask and Solder paste have the same Z position
|
||||
for( PCB_LAYER_ID layer_id :
|
||||
{ B_Adhes, B_Mask, B_Paste, F_Adhes, F_Mask, F_Paste, B_SilkS, F_SilkS } )
|
||||
{
|
||||
float zposTop = 0.0;
|
||||
float zposBottom = 0.0;
|
||||
float zposBottom = zpos_copperTop_front + 2.0f * zpos_offset;
|
||||
float zposTop = zposBottom + m_frontCopperThickness3DU;
|
||||
|
||||
switch( layer_id )
|
||||
{
|
||||
@@ -500,7 +513,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
|
||||
case B_Mask:
|
||||
zposBottom = zpos_copperTop_back;
|
||||
zposTop = zpos_copperTop_back - m_nonCopperLayerThickness3DU;
|
||||
zposTop = zpos_copperTop_back - m_backMaskThickness3DU;
|
||||
break;
|
||||
|
||||
case B_Paste:
|
||||
@@ -510,7 +523,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
|
||||
case F_Mask:
|
||||
zposBottom = zpos_copperTop_front;
|
||||
zposTop = zpos_copperTop_front + m_nonCopperLayerThickness3DU;
|
||||
zposTop = zpos_copperTop_front + m_frontMaskThickness3DU;
|
||||
break;
|
||||
|
||||
case F_Paste:
|
||||
@@ -532,14 +545,13 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
break;
|
||||
}
|
||||
|
||||
m_layerZcoordTop[layer_id] = zposTop;
|
||||
m_layerZcoordBottom[layer_id] = zposBottom;
|
||||
m_layerZcoordTop[(PCB_LAYER_ID)layer_id] = zposTop;
|
||||
m_layerZcoordBottom[(PCB_LAYER_ID)layer_id] = zposBottom;
|
||||
}
|
||||
|
||||
m_boardCenter = SFVEC3F( m_boardPos.x * m_biuTo3Dunits, m_boardPos.y * m_biuTo3Dunits, 0.0f );
|
||||
|
||||
SFVEC3F boardSize = SFVEC3F( m_boardSize.x * m_biuTo3Dunits, m_boardSize.y * m_biuTo3Dunits,
|
||||
0.0f );
|
||||
SFVEC3F boardSize = SFVEC3F( m_boardSize.x * m_biuTo3Dunits, m_boardSize.y * m_biuTo3Dunits, 0.0f );
|
||||
boardSize /= 2.0f;
|
||||
|
||||
SFVEC3F boardMin = ( m_boardCenter - boardSize );
|
||||
@@ -580,6 +592,9 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
m_UserCommentsColor = to_SFVEC4F( colors[ LAYER_3D_USER_COMMENTS ] );
|
||||
m_ECO1Color = to_SFVEC4F( colors[ LAYER_3D_USER_ECO1 ] );
|
||||
m_ECO2Color = to_SFVEC4F( colors[ LAYER_3D_USER_ECO2 ] );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
m_UserDefinedLayerColor[ layer - LAYER_3D_USER_1 ] = to_SFVEC4F( colors[ layer ] );
|
||||
}
|
||||
|
||||
|
||||
@@ -602,28 +617,15 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetDefaultColors() const
|
||||
colors[ LAYER_3D_USER_ECO1 ] = BOARD_ADAPTER::g_DefaultECOs;
|
||||
colors[ LAYER_3D_USER_ECO2 ] = BOARD_ADAPTER::g_DefaultECOs;
|
||||
|
||||
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings( wxEmptyString );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
colors[ layer ] = settings->GetColor( layer );
|
||||
|
||||
return colors;
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::GetBoardEditorCopperLayerColors( PCBNEW_SETTINGS* aCfg )
|
||||
{
|
||||
m_BoardEditorColors.clear();
|
||||
|
||||
if( m_copperLayersCount <= 0 )
|
||||
return;
|
||||
|
||||
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings( aCfg->m_ColorTheme );
|
||||
|
||||
LSET copperLayers = LSET::AllCuMask();
|
||||
|
||||
for( auto layer : LAYER_RANGE( F_Cu, B_Cu, m_copperLayersCount ) )
|
||||
{
|
||||
m_BoardEditorColors[ layer ] = settings->GetColor( layer );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
{
|
||||
std::map<int, COLOR4D> colors;
|
||||
@@ -747,8 +749,13 @@ 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 );
|
||||
|
||||
if( layer >= LAYER_3D_USER_1 && layer <= LAYER_3D_USER_45 )
|
||||
m_UserDefinedLayerColor[ layer - LAYER_3D_USER_1 ] = GetColor( color );
|
||||
}
|
||||
|
||||
Pgm().GetSettingsManager().SaveColorSettings( settings, "3d_viewer" );
|
||||
}
|
||||
|
||||
@@ -769,6 +776,9 @@ void BOARD_ADAPTER::SetVisibleLayers( const std::bitset<LAYER_3D_END>& aLayers )
|
||||
m_Cfg->m_Render.show_eco1 = aLayers.test( LAYER_3D_USER_ECO1 );
|
||||
m_Cfg->m_Render.show_eco2 = aLayers.test( LAYER_3D_USER_ECO2 );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
m_Cfg->m_Render.show_user[ layer - LAYER_3D_USER_1 ] = aLayers.test( layer );
|
||||
|
||||
m_Cfg->m_Render.show_footprints_normal = aLayers.test( LAYER_3D_TH_MODELS );
|
||||
m_Cfg->m_Render.show_footprints_insert = aLayers.test( LAYER_3D_SMD_MODELS );
|
||||
m_Cfg->m_Render.show_footprints_virtual = aLayers.test( LAYER_3D_VIRTUAL_MODELS );
|
||||
@@ -789,6 +799,46 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
|
||||
{
|
||||
std::bitset<LAYER_3D_END> ret;
|
||||
|
||||
if( m_board && m_board->IsFootprintHolder() )
|
||||
{
|
||||
if( m_Cfg->m_Render.preview_show_board_body )
|
||||
{
|
||||
ret.set( LAYER_3D_BOARD, m_Cfg->m_Render.show_board_body );
|
||||
ret.set( LAYER_3D_SOLDERMASK_TOP, m_Cfg->m_Render.show_soldermask_top );
|
||||
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, m_Cfg->m_Render.show_soldermask_bottom );
|
||||
ret.set( LAYER_3D_SOLDERPASTE, m_Cfg->m_Render.show_solderpaste );
|
||||
ret.set( LAYER_3D_ADHESIVE, m_Cfg->m_Render.show_adhesive );
|
||||
}
|
||||
|
||||
ret.set( LAYER_3D_COPPER_TOP, true );
|
||||
ret.set( LAYER_3D_COPPER_BOTTOM, true );
|
||||
ret.set( LAYER_3D_SILKSCREEN_TOP, true );
|
||||
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, true );
|
||||
ret.set( LAYER_3D_USER_COMMENTS, true );
|
||||
ret.set( LAYER_3D_USER_DRAWINGS, true );
|
||||
ret.set( LAYER_3D_USER_ECO1, true );
|
||||
ret.set( LAYER_3D_USER_ECO2, true );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
ret.set( layer, true );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, true );
|
||||
ret.set( LAYER_FP_VALUES, true );
|
||||
ret.set( LAYER_FP_TEXT, true );
|
||||
|
||||
ret.set( LAYER_3D_TH_MODELS, true );
|
||||
ret.set( LAYER_3D_SMD_MODELS, true );
|
||||
ret.set( LAYER_3D_VIRTUAL_MODELS, true );
|
||||
ret.set( LAYER_3D_MODELS_NOT_IN_POS, true );
|
||||
ret.set( LAYER_3D_MODELS_MARKED_DNP, true );
|
||||
|
||||
ret.set( LAYER_3D_BOUNDING_BOXES, m_Cfg->m_Render.show_model_bbox );
|
||||
ret.set( LAYER_3D_OFF_BOARD_SILK, m_Cfg->m_Render.show_off_board_silk );
|
||||
ret.set( LAYER_3D_AXES, m_Cfg->m_Render.show_axis );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret.set( LAYER_3D_BOARD, m_Cfg->m_Render.show_board_body );
|
||||
ret.set( LAYER_3D_COPPER_TOP, m_Cfg->m_Render.show_copper_top );
|
||||
ret.set( LAYER_3D_COPPER_BOTTOM, m_Cfg->m_Render.show_copper_bottom );
|
||||
@@ -803,6 +853,9 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
|
||||
ret.set( LAYER_3D_USER_ECO1, m_Cfg->m_Render.show_eco1 );
|
||||
ret.set( LAYER_3D_USER_ECO2, m_Cfg->m_Render.show_eco2 );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
ret.set( layer, m_Cfg->m_Render.show_user[ layer - LAYER_3D_USER_1 ] );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, m_Cfg->m_Render.show_fp_references );
|
||||
ret.set( LAYER_FP_VALUES, m_Cfg->m_Render.show_fp_values );
|
||||
ret.set( LAYER_FP_TEXT, m_Cfg->m_Render.show_fp_text );
|
||||
@@ -845,7 +898,10 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
|
||||
return ret;
|
||||
|
||||
const PCB_PLOT_PARAMS& plotParams = m_board->GetPlotOptions();
|
||||
LSET layers = plotParams.GetLayerSelection() | plotParams.GetPlotOnAllLayersSelection();
|
||||
LSET layers = plotParams.GetLayerSelection();
|
||||
|
||||
for( PCB_LAYER_ID commonLayer : plotParams.GetPlotOnAllLayersSequence() )
|
||||
layers.set( commonLayer );
|
||||
|
||||
ret.set( LAYER_3D_BOARD, true );
|
||||
ret.set( LAYER_3D_COPPER_TOP, layers.test( F_Cu ) );
|
||||
@@ -861,34 +917,17 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
|
||||
ret.set( LAYER_3D_USER_ECO1, layers.test( Eco1_User ) );
|
||||
ret.set( LAYER_3D_USER_ECO2, layers.test( Eco2_User ) );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, plotParams.GetPlotReference() );
|
||||
ret.set( LAYER_FP_VALUES, plotParams.GetPlotValue() );
|
||||
ret.set( LAYER_FP_TEXT, plotParams.GetPlotFPText() );
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
ret.set( layer, layers.test( Map3DLayerToPCBLayer( layer ) ) );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, plotParams.GetPlotReference() );
|
||||
ret.set( LAYER_FP_VALUES, plotParams.GetPlotValue() );
|
||||
ret.set( LAYER_FP_TEXT, plotParams.GetPlotFPText() );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -912,6 +951,9 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetDefaultVisibleLayers() const
|
||||
ret.set( LAYER_3D_USER_ECO1, false );
|
||||
ret.set( LAYER_3D_USER_ECO2, false );
|
||||
|
||||
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
|
||||
ret.set( layer, false );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, true );
|
||||
ret.set( LAYER_FP_VALUES, true );
|
||||
ret.set( LAYER_FP_TEXT, true );
|
||||
@@ -930,6 +972,12 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetDefaultVisibleLayers() const
|
||||
}
|
||||
|
||||
|
||||
bool BOARD_ADAPTER::GetUseBoardEditorCopperLayerColors() const
|
||||
{
|
||||
return m_Cfg->m_Render.use_board_editor_copper_colors && !m_board->IsFootprintHolder();
|
||||
}
|
||||
|
||||
|
||||
bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
|
||||
{
|
||||
m_board_poly.RemoveAllContours();
|
||||
@@ -992,19 +1040,14 @@ float BOARD_ADAPTER::GetFootprintZPos( bool aIsFlipped ) const
|
||||
}
|
||||
|
||||
|
||||
SFVEC4F BOARD_ADAPTER::GetLayerColor( PCB_LAYER_ID aLayerId ) const
|
||||
SFVEC4F BOARD_ADAPTER::GetLayerColor( int aLayerId ) const
|
||||
{
|
||||
if( aLayerId >= LAYER_3D_USER_1 && aLayerId <= LAYER_3D_USER_45 )
|
||||
aLayerId = Map3DLayerToPCBLayer( aLayerId );
|
||||
|
||||
wxASSERT( aLayerId < PCB_LAYER_ID_COUNT );
|
||||
|
||||
const COLOR4D color = m_colors->GetColor( aLayerId );
|
||||
|
||||
return SFVEC4F( color.r, color.g, color.b, color.a );
|
||||
}
|
||||
|
||||
|
||||
SFVEC4F BOARD_ADAPTER::GetItemColor( int aItemId ) const
|
||||
{
|
||||
return GetColor( m_colors->GetColor( aItemId ) );
|
||||
return GetColor( m_BoardEditorColors.at( aLayerId ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -1016,9 +1059,8 @@ SFVEC4F BOARD_ADAPTER::GetColor( const COLOR4D& aColor ) const
|
||||
|
||||
SFVEC2F BOARD_ADAPTER::GetSphericalCoord( int i ) const
|
||||
{
|
||||
SFVEC2F sphericalCoord =
|
||||
SFVEC2F( ( m_Cfg->m_Render.raytrace_lightElevation[i] + 90.0f ) / 180.0f,
|
||||
m_Cfg->m_Render.raytrace_lightAzimuth[i] / 180.0f );
|
||||
SFVEC2F sphericalCoord = SFVEC2F( ( m_Cfg->m_Render.raytrace_lightElevation[i] + 90.0f ) / 180.0f,
|
||||
m_Cfg->m_Render.raytrace_lightAzimuth[i] / 180.0f );
|
||||
|
||||
sphericalCoord.x = glm::clamp( sphericalCoord.x, 0.0f, 1.0f );
|
||||
sphericalCoord.y = glm::clamp( sphericalCoord.y, 0.0f, 2.0f );
|
||||
|
||||
@@ -112,11 +112,6 @@ public:
|
||||
*/
|
||||
std::map<int, COLOR4D> GetLayerColors() const;
|
||||
|
||||
/**
|
||||
* Build the copper color list used by the board editor, and store it in m_BoardEditorColors
|
||||
*/
|
||||
void GetBoardEditorCopperLayerColors( PCBNEW_SETTINGS* aCfg );
|
||||
|
||||
std::map<int, COLOR4D> GetDefaultColors() const;
|
||||
void SetLayerColors( const std::map<int, COLOR4D>& aColors );
|
||||
|
||||
@@ -124,6 +119,8 @@ public:
|
||||
std::bitset<LAYER_3D_END> GetDefaultVisibleLayers() const;
|
||||
void SetVisibleLayers( const std::bitset<LAYER_3D_END>& aLayers );
|
||||
|
||||
bool GetUseBoardEditorCopperLayerColors() const;
|
||||
|
||||
/**
|
||||
* Function to be called by the render when it need to reload the settings for the board.
|
||||
*
|
||||
@@ -210,15 +207,7 @@ public:
|
||||
* @param aLayerId the layer to get the color information.
|
||||
* @return the color in SFVEC3F format.
|
||||
*/
|
||||
SFVEC4F GetLayerColor( PCB_LAYER_ID aLayerId ) const;
|
||||
|
||||
/**
|
||||
* Get the technical color of a layer.
|
||||
*
|
||||
* @param aItemId the item id to get the color information.
|
||||
* @return the color in SFVEC3F format.
|
||||
*/
|
||||
SFVEC4F GetItemColor( int aItemId ) const;
|
||||
SFVEC4F GetLayerColor( int aLayerId ) const;
|
||||
|
||||
/**
|
||||
* @param[in] aColor is the color mapped.
|
||||
@@ -352,14 +341,14 @@ public:
|
||||
*/
|
||||
const MAP_POLY& GetPolyMap() const noexcept { return m_layers_poly; }
|
||||
|
||||
const SHAPE_POLY_SET* GetFrontPlatedPadAndGraphicPolys()
|
||||
const SHAPE_POLY_SET* GetFrontPlatedCopperPolys()
|
||||
{
|
||||
return m_frontPlatedPadAndGraphicPolys;
|
||||
return m_frontPlatedCopperPolys;
|
||||
}
|
||||
|
||||
const SHAPE_POLY_SET* GetBackPlatedPadAndGraphicPolys()
|
||||
const SHAPE_POLY_SET* GetBackPlatedCopperPolys()
|
||||
{
|
||||
return m_backPlatedPadAndGraphicPolys;
|
||||
return m_backPlatedCopperPolys;
|
||||
}
|
||||
|
||||
const MAP_POLY& GetHoleIdPolysMap() const noexcept { return m_layerHoleIdPolys; }
|
||||
@@ -386,7 +375,7 @@ private:
|
||||
int aInflateValue );
|
||||
|
||||
void addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayerId, bool aSkipPlatedPads, bool aSkipNonPlatedPads );
|
||||
PCB_LAYER_ID aLayerId );
|
||||
|
||||
void addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayerId,
|
||||
@@ -455,6 +444,7 @@ public:
|
||||
SFVEC4F m_UserCommentsColor;
|
||||
SFVEC4F m_ECO1Color;
|
||||
SFVEC4F m_ECO2Color;
|
||||
SFVEC4F m_UserDefinedLayerColor[45];
|
||||
|
||||
std::map<int, COLOR4D> m_ColorOverrides; ///< allows to override color scheme colors
|
||||
std::map<int, COLOR4D> m_BoardEditorColors; ///< list of colors used by the board editor
|
||||
@@ -462,7 +452,6 @@ public:
|
||||
private:
|
||||
BOARD* m_board;
|
||||
S3D_CACHE* m_3dModelManager;
|
||||
COLOR_SETTINGS* m_colors;
|
||||
|
||||
VECTOR2I m_boardPos; ///< Board center position in board internal units.
|
||||
VECTOR2I m_boardSize; ///< Board size in board internal units.
|
||||
@@ -472,8 +461,6 @@ private:
|
||||
MAP_POLY m_layers_poly; ///< Amalgamated polygon contours for various types
|
||||
///< of items
|
||||
|
||||
SHAPE_POLY_SET* m_frontPlatedPadAndGraphicPolys;
|
||||
SHAPE_POLY_SET* m_backPlatedPadAndGraphicPolys;
|
||||
SHAPE_POLY_SET* m_frontPlatedCopperPolys;
|
||||
SHAPE_POLY_SET* m_backPlatedCopperPolys;
|
||||
|
||||
@@ -505,16 +492,15 @@ private:
|
||||
double m_biuTo3Dunits; ///< Scale factor to convert board internal units
|
||||
///< to 3D units normalized between -1.0 and 1.0.
|
||||
|
||||
std::map<PCB_LAYER_ID, float> m_layerZcoordTop; ///< Top (End) Z position of each
|
||||
///< layer in 3D units.
|
||||
|
||||
std::map<PCB_LAYER_ID, float> m_layerZcoordBottom; ///< Bottom (Start) Z position of
|
||||
///< each layer in 3D units.
|
||||
std::map<PCB_LAYER_ID, float> m_layerZcoordTop; ///< Top (End) Z pos of each layer in 3D units.
|
||||
std::map<PCB_LAYER_ID, float> m_layerZcoordBottom; ///< Bottom (Start) Z pos of each layer.
|
||||
|
||||
float m_frontCopperThickness3DU;
|
||||
float m_backCopperThickness3DU;
|
||||
float m_boardBodyThickness3DU;
|
||||
float m_nonCopperLayerThickness3DU;
|
||||
float m_frontMaskThickness3DU;
|
||||
float m_backMaskThickness3DU;
|
||||
float m_solderPasteLayerThickness3DU;
|
||||
|
||||
unsigned int m_trackCount;
|
||||
|
||||
@@ -96,6 +96,7 @@ void addROUND_SEGMENT_2D( CONTAINER_2D_BASE* aContainer, const SFVEC2F& aStart,
|
||||
void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM* aOwner )
|
||||
{
|
||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
|
||||
float penWidth_3DU = TO_3DU( aText->GetEffectiveTextPenWidth() );
|
||||
@@ -110,8 +111,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
|
||||
SHAPE_POLY_SET finalPoly;
|
||||
const PCB_TEXT* pcbText = static_cast<const PCB_TEXT*>( aOwner );
|
||||
|
||||
pcbText->TransformTextToPolySet( finalPoly, 0, m_board->GetDesignSettings().m_MaxError,
|
||||
ERROR_INSIDE );
|
||||
pcbText->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
|
||||
@@ -188,23 +188,23 @@ 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 )
|
||||
const std::bitset<LAYER_3D_END>& aFlags )
|
||||
{
|
||||
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( !aFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
|
||||
if( field->IsReference() && !aFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
|
||||
if( field->IsValue() && !aFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
|
||||
if( field->GetLayer() == aLayerId && field->IsVisible() )
|
||||
addText( field, aContainer, field );
|
||||
}
|
||||
}
|
||||
|
||||
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||
@@ -215,19 +215,17 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_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;
|
||||
if( !aFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
|
||||
if( text->GetText() == wxT( "${REFERENCE}" ) && !aFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
|
||||
if( text->GetText() == wxT( "${VALUE}" ) && !aFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
|
||||
if( text->GetLayer() == aLayerId )
|
||||
addText( text, aContainer, text );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -283,9 +281,8 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack,
|
||||
CONTAINER_2D_BASE* aDstContainer, PCB_LAYER_ID aLayer,
|
||||
int aMargin )
|
||||
void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer,
|
||||
PCB_LAYER_ID aLayer, int aMargin )
|
||||
{
|
||||
SFVEC2F start3DU = TO_SFVEC2F( aTrack->GetStart() );
|
||||
SFVEC2F end3DU = TO_SFVEC2F( aTrack->GetEnd() );
|
||||
@@ -341,8 +338,7 @@ void BOARD_ADAPTER::createTrackWithMargin( const PCB_TRACK* aTrack,
|
||||
}
|
||||
|
||||
createArcSegments( center, arc->GetStart(), arc_angle, circlesegcount,
|
||||
arc->GetWidth() + aMargin * 2,
|
||||
aDstContainer, *arc );
|
||||
arc->GetWidth() + aMargin * 2, aDstContainer, *arc );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -373,8 +369,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
// Of course being a hack it falls down when dealing with custom shape pads (where the size
|
||||
// is only the size of the anchor), so for those we punt and just use aMargin.x.
|
||||
|
||||
if( ( clearance.x < 0 || clearance.x != clearance.y )
|
||||
&& aPad->GetShape( aLayer ) != PAD_SHAPE::CUSTOM )
|
||||
if( ( clearance.x < 0 || clearance.x != clearance.y ) && aPad->GetShape( aLayer ) != PAD_SHAPE::CUSTOM )
|
||||
{
|
||||
VECTOR2I dummySize = VECTOR2I( aPad->GetSize( aLayer ) ) + clearance + clearance;
|
||||
|
||||
@@ -398,8 +393,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo
|
||||
}
|
||||
else
|
||||
{
|
||||
auto padShapes =
|
||||
std::static_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape( aLayer ) );
|
||||
auto padShapes = std::static_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape( aLayer ) );
|
||||
|
||||
for( const SHAPE* shape : padShapes->Shapes() )
|
||||
{
|
||||
@@ -505,7 +499,7 @@ void BOARD_ADAPTER::createPadWithHole( const PAD* aPad, CONTAINER_2D_BASE* aDstC
|
||||
|
||||
|
||||
void BOARD_ADAPTER::addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aContainer,
|
||||
PCB_LAYER_ID aLayerId, bool aSkipPlatedPads, bool aSkipNonPlatedPads )
|
||||
PCB_LAYER_ID aLayerId )
|
||||
{
|
||||
for( PAD* pad : aFootprint->Pads() )
|
||||
{
|
||||
@@ -529,24 +523,6 @@ void BOARD_ADAPTER::addPads( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aCo
|
||||
|
||||
switch( aLayerId )
|
||||
{
|
||||
case F_Cu:
|
||||
if( aSkipPlatedPads && pad->FlashLayer( F_Mask ) )
|
||||
continue;
|
||||
|
||||
if( aSkipNonPlatedPads && !pad->FlashLayer( F_Mask ) )
|
||||
continue;
|
||||
|
||||
break;
|
||||
|
||||
case B_Cu:
|
||||
if( aSkipPlatedPads && pad->FlashLayer( B_Mask ) )
|
||||
continue;
|
||||
|
||||
if( aSkipNonPlatedPads && !pad->FlashLayer( B_Mask ) )
|
||||
continue;
|
||||
|
||||
break;
|
||||
|
||||
case F_Mask:
|
||||
case B_Mask:
|
||||
margin.x += pad->GetSolderMaskExpansion( aLayerId );
|
||||
@@ -624,16 +600,15 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
int margin = 0;
|
||||
|
||||
if( IsSolderMaskLayer( aLayer )
|
||||
&& aShape->HasSolderMask()
|
||||
&& IsExternalCopperLayer( aShape->GetLayer() ) )
|
||||
&& aShape->HasSolderMask()
|
||||
&& IsExternalCopperLayer( aShape->GetLayer() ) )
|
||||
{
|
||||
margin = aShape->GetSolderMaskExpansion();
|
||||
linewidth += margin * 2;
|
||||
}
|
||||
|
||||
float linewidth3DU = TO_3DU( linewidth );
|
||||
|
||||
LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle();
|
||||
float linewidth3DU = TO_3DU( linewidth );
|
||||
LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle();
|
||||
|
||||
if( lineStyle <= LINE_STYLE::FIRST_TYPE )
|
||||
{
|
||||
@@ -645,7 +620,7 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
float innerR3DU = TO_3DU( aShape->GetRadius() ) - linewidth3DU / 2.0;
|
||||
float outerR3DU = TO_3DU( aShape->GetRadius() ) + linewidth3DU / 2.0;
|
||||
|
||||
if( aShape->IsFilled() || innerR3DU <= 0.0 )
|
||||
if( aShape->IsSolidFill() || innerR3DU <= 0.0 )
|
||||
addFILLED_CIRCLE_2D( aContainer, center3DU, outerR3DU, *aOwner );
|
||||
else
|
||||
addRING_2D( aContainer, center3DU, innerR3DU, outerR3DU, *aOwner );
|
||||
@@ -654,12 +629,11 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
}
|
||||
|
||||
case SHAPE_T::RECTANGLE:
|
||||
if( aShape->IsFilled() )
|
||||
if( aShape->IsSolidFill() )
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF,
|
||||
ERROR_INSIDE );
|
||||
aShape->TransformShapeToPolySet( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF, ERROR_INSIDE );
|
||||
|
||||
polyList.Simplify();
|
||||
|
||||
@@ -705,8 +679,7 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
{
|
||||
SHAPE_POLY_SET polyList;
|
||||
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF,
|
||||
ERROR_INSIDE );
|
||||
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF, ERROR_INSIDE );
|
||||
|
||||
// Some polygons can be a bit complex (especially when coming from a
|
||||
// picture of a text converted to a polygon
|
||||
@@ -759,6 +732,9 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
|
||||
for( SHAPE* shape : shapes )
|
||||
delete shape;
|
||||
}
|
||||
|
||||
if( aShape->IsHatchedFill() )
|
||||
ConvertPolygonToTriangles( aShape->GetHatching(), *aContainer, m_biuTo3Dunits, *aOwner );
|
||||
}
|
||||
|
||||
|
||||
@@ -793,11 +769,18 @@ void BOARD_ADAPTER::addShape( const PCB_TEXTBOX* aTextBox, CONTAINER_2D_BASE* aC
|
||||
void BOARD_ADAPTER::addTable( const PCB_TABLE* aTable, CONTAINER_2D_BASE* aContainer,
|
||||
const BOARD_ITEM* aOwner )
|
||||
{
|
||||
// JEY TODO: tables
|
||||
// add borders
|
||||
aTable->DrawBorders(
|
||||
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB, const STROKE_PARAMS& stroke )
|
||||
{
|
||||
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( ptA ), TO_SFVEC2F( ptB ),
|
||||
TO_3DU( stroke.GetWidth() ), *aOwner );
|
||||
} );
|
||||
|
||||
for( PCB_TABLECELL* cell : aTable->GetCells() )
|
||||
addText( cell, aContainer, aOwner );
|
||||
{
|
||||
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
|
||||
addText( cell, aContainer, aOwner );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -805,8 +788,7 @@ void BOARD_ADAPTER::addSolidAreasShapes( const ZONE* aZone, CONTAINER_2D_BASE* a
|
||||
PCB_LAYER_ID aLayerId )
|
||||
{
|
||||
// This convert the poly in outline and holes
|
||||
ConvertPolygonToTriangles( *aZone->GetFilledPolysList( aLayerId ), *aContainer, m_biuTo3Dunits,
|
||||
*aZone );
|
||||
ConvertPolygonToTriangles( *aZone->GetFilledPolysList( aLayerId ), *aContainer, m_biuTo3Dunits, *aZone );
|
||||
}
|
||||
|
||||
|
||||
@@ -825,8 +807,7 @@ void BOARD_ADAPTER::buildPadOutlineAsSegments( const PAD* aPad, PCB_LAYER_ID aLa
|
||||
else
|
||||
{
|
||||
// For other shapes, add outlines as thick segments in polygon buffer
|
||||
const std::shared_ptr<SHAPE_POLY_SET>& corners = aPad->GetEffectivePolygon( aLayer,
|
||||
ERROR_INSIDE );
|
||||
const std::shared_ptr<SHAPE_POLY_SET>& corners = aPad->GetEffectivePolygon( aLayer, ERROR_INSIDE );
|
||||
const SHAPE_LINE_CHAIN& path = corners->COutline( 0 );
|
||||
|
||||
for( int j = 0; j < path.PointCount(); j++ )
|
||||
|
||||
@@ -23,34 +23,17 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file create_layer_items.cpp
|
||||
* @brief This file implements the creation of the pcb board.
|
||||
*
|
||||
* It is based on the function found in the files:
|
||||
* board_items_to_polygon_shape_transform.cpp
|
||||
* board_items_to_polygon_shape_transform.cpp
|
||||
*/
|
||||
|
||||
#include "board_adapter.h"
|
||||
#include "../3d_rendering/raytracing/shapes2D/filled_circle_2d.h"
|
||||
#include "raytracing/shapes2D/triangle_2d.h"
|
||||
#include <board_design_settings.h>
|
||||
#include <board.h>
|
||||
#include <footprint.h>
|
||||
#include <layer_range.h>
|
||||
#include <lset.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <pcb_table.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <zone.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <trigo.h>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include <core/arraydim.h>
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <wx/log.h>
|
||||
@@ -59,9 +42,6 @@
|
||||
#include <core/profile.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is used to draw pad outlines on silk layers.
|
||||
*/
|
||||
@@ -97,12 +77,71 @@ void transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLaye
|
||||
if( item->Type() == PCB_SHAPE_T || BaseType( item->Type() ) == PCB_DIMENSION_T )
|
||||
{
|
||||
if( item->GetLayer() == aLayer )
|
||||
item->TransformShapeToPolygon( aBuffer, aLayer, 0, aMaxError, aErrorLoc );
|
||||
item->TransformShapeToPolySet( aBuffer, aLayer, 0, aMaxError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void transformFPTextToPolySet( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
|
||||
const std::bitset<LAYER_3D_END>& aFlags, SHAPE_POLY_SET& aBuffer,
|
||||
int aMaxError, ERROR_LOC aErrorLoc )
|
||||
{
|
||||
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||
{
|
||||
if( item->GetLayer() != aLayer )
|
||||
continue;
|
||||
|
||||
if( item->Type() == PCB_TEXT_T )
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( !aFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
|
||||
if( text->GetText() == wxT( "${REFERENCE}" ) && !aFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
|
||||
if( text->GetText() == wxT( "${VALUE}" ) && !aFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
|
||||
if( aLayer != UNDEFINED_LAYER && text->GetLayer() == aLayer )
|
||||
text->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc );
|
||||
}
|
||||
|
||||
if( item->Type() == PCB_TEXTBOX_T )
|
||||
{
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
|
||||
if( aLayer != UNDEFINED_LAYER && textbox->GetLayer() == aLayer )
|
||||
{
|
||||
// border
|
||||
if( textbox->IsBorderEnabled() )
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( aBuffer, aLayer, 0, aMaxError, aErrorLoc );
|
||||
|
||||
// text
|
||||
textbox->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( const PCB_FIELD* field : aFootprint->GetFields() )
|
||||
{
|
||||
if( !aFlags.test( LAYER_FP_TEXT ) )
|
||||
continue;
|
||||
|
||||
if( field->IsReference() && !aFlags.test( LAYER_FP_REFERENCES ) )
|
||||
continue;
|
||||
|
||||
if( field->IsValue() && !aFlags.test( LAYER_FP_VALUES ) )
|
||||
continue;
|
||||
|
||||
if( field->GetLayer() == aLayer && field->IsVisible() )
|
||||
field->TransformTextToPolySet( aBuffer, 0, aMaxError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ADAPTER::destroyLayers()
|
||||
{
|
||||
#define DELETE_AND_FREE( ptr ) \
|
||||
@@ -121,8 +160,6 @@ void BOARD_ADAPTER::destroyLayers()
|
||||
|
||||
DELETE_AND_FREE_MAP( m_layers_poly );
|
||||
|
||||
DELETE_AND_FREE( m_frontPlatedPadAndGraphicPolys )
|
||||
DELETE_AND_FREE( m_backPlatedPadAndGraphicPolys )
|
||||
DELETE_AND_FREE( m_frontPlatedCopperPolys )
|
||||
DELETE_AND_FREE( m_backPlatedCopperPolys )
|
||||
|
||||
@@ -240,8 +277,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
if( cfg.DifferentiatePlatedCopper() )
|
||||
{
|
||||
m_frontPlatedPadAndGraphicPolys = new SHAPE_POLY_SET;
|
||||
m_backPlatedPadAndGraphicPolys = new SHAPE_POLY_SET;
|
||||
m_frontPlatedCopperPolys = new SHAPE_POLY_SET;
|
||||
m_backPlatedCopperPolys = new SHAPE_POLY_SET;
|
||||
|
||||
@@ -261,7 +296,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
// Create tracks as objects and add it to container
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() );
|
||||
wxASSERT( m_layerMap.contains( layer ) );
|
||||
|
||||
BVH_CONTAINER_2D *layerContainer = m_layerMap[layer];
|
||||
|
||||
@@ -319,7 +354,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
BVH_CONTAINER_2D *layerHoleContainer = nullptr;
|
||||
|
||||
// Check if the layer is already created
|
||||
if( m_layerHoleMap.find( layer ) == m_layerHoleMap.end() )
|
||||
if( !m_layerHoleMap.contains( layer ) )
|
||||
{
|
||||
// not found, create a new container
|
||||
layerHoleContainer = new BVH_CONTAINER_2D;
|
||||
@@ -339,10 +374,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
else if( layer == layer_ids[0] ) // it only adds once the THT holes
|
||||
{
|
||||
// Add through hole object
|
||||
m_TH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness,
|
||||
*track ) );
|
||||
m_viaTH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness,
|
||||
*track ) );
|
||||
m_TH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness, *track ) );
|
||||
m_viaTH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness, *track ) );
|
||||
|
||||
if( cfg.clip_silk_on_via_annuli && ring_radius > 0.0 )
|
||||
m_viaAnnuli.Add( new FILLED_CIRCLE_2D( via_center, ring_radius, *track ) );
|
||||
@@ -353,15 +386,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
}
|
||||
|
||||
if( cfg.DifferentiatePlatedCopper() && layer == F_Cu )
|
||||
{
|
||||
track->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
track->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, maxError, ERROR_INSIDE );
|
||||
else if( cfg.DifferentiatePlatedCopper() && layer == B_Cu )
|
||||
{
|
||||
track->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
track->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,13 +420,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
SHAPE_POLY_SET *layerInnerHolesPoly = nullptr;
|
||||
|
||||
// Check if the layer is already created
|
||||
if( m_layerHoleOdPolys.find( layer ) == m_layerHoleOdPolys.end() )
|
||||
if( !m_layerHoleOdPolys.contains( layer ) )
|
||||
{
|
||||
// not found, create a new container
|
||||
layerOuterHolesPoly = new SHAPE_POLY_SET;
|
||||
m_layerHoleOdPolys[layer] = layerOuterHolesPoly;
|
||||
|
||||
wxASSERT( m_layerHoleIdPolys.find( layer ) == m_layerHoleIdPolys.end() );
|
||||
wxASSERT( !m_layerHoleIdPolys.contains( layer ) );
|
||||
|
||||
layerInnerHolesPoly = new SHAPE_POLY_SET;
|
||||
m_layerHoleIdPolys[layer] = layerInnerHolesPoly;
|
||||
@@ -409,7 +436,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
// found
|
||||
layerOuterHolesPoly = m_layerHoleOdPolys[layer];
|
||||
|
||||
wxASSERT( m_layerHoleIdPolys.find( layer ) != m_layerHoleIdPolys.end() );
|
||||
wxASSERT( m_layerHoleIdPolys.contains( layer ) );
|
||||
|
||||
layerInnerHolesPoly = m_layerHoleIdPolys[layer];
|
||||
}
|
||||
@@ -417,11 +444,11 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
const int holediameter = via->GetDrillValue();
|
||||
const int hole_outer_radius = (holediameter / 2) + GetHolePlatingThickness();
|
||||
|
||||
TransformCircleToPolygon( *layerOuterHolesPoly, via->GetStart(),
|
||||
hole_outer_radius, maxError, ERROR_INSIDE );
|
||||
TransformCircleToPolygon( *layerOuterHolesPoly, via->GetStart(), hole_outer_radius,
|
||||
maxError, ERROR_INSIDE );
|
||||
|
||||
TransformCircleToPolygon( *layerInnerHolesPoly, via->GetStart(),
|
||||
holediameter / 2, maxError, ERROR_INSIDE );
|
||||
TransformCircleToPolygon( *layerInnerHolesPoly, via->GetStart(), holediameter / 2,
|
||||
maxError, ERROR_INSIDE );
|
||||
}
|
||||
else if( layer == layer_ids[0] ) // it only adds once the THT holes
|
||||
{
|
||||
@@ -439,8 +466,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
if( cfg.clip_silk_on_via_annuli )
|
||||
{
|
||||
TransformCircleToPolygon( m_viaAnnuliPolys, via->GetStart(),
|
||||
hole_outer_ring_radius, maxError, ERROR_INSIDE );
|
||||
TransformCircleToPolygon( m_viaAnnuliPolys, via->GetStart(), hole_outer_ring_radius,
|
||||
maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -452,7 +479,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() );
|
||||
wxASSERT( m_layers_poly.contains( layer ) );
|
||||
|
||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[layer];
|
||||
|
||||
@@ -545,17 +572,20 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
// Add footprints PADs objects to containers
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() );
|
||||
wxASSERT( m_layerMap.contains( layer ) );
|
||||
|
||||
BVH_CONTAINER_2D *layerContainer = m_layerMap[layer];
|
||||
|
||||
// ADD PADS
|
||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||
{
|
||||
addPads( footprint, layerContainer, layer, cfg.DifferentiatePlatedCopper(), false );
|
||||
|
||||
// Micro-wave footprints may have items on copper layers
|
||||
addPads( footprint, layerContainer, layer );
|
||||
addFootprintShapes( footprint, layerContainer, layer, visibilityFlags );
|
||||
|
||||
if( cfg.DifferentiatePlatedCopper() && layer == F_Cu )
|
||||
footprint->TransformPadsToPolySet( *m_frontPlatedCopperPolys, F_Cu, 0, maxError, ERROR_INSIDE );
|
||||
else if( cfg.DifferentiatePlatedCopper() && layer == B_Cu )
|
||||
footprint->TransformPadsToPolySet( *m_backPlatedCopperPolys, B_Cu, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,40 +594,23 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() );
|
||||
wxASSERT( m_layers_poly.contains( layer ) );
|
||||
|
||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[layer];
|
||||
|
||||
// Add pads to polygon list
|
||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||
{
|
||||
// Note: NPTH pads are not drawn on copper layers when the pad has same shape as
|
||||
// its hole
|
||||
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE,
|
||||
true, cfg.DifferentiatePlatedCopper(), false );
|
||||
|
||||
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
|
||||
if( cfg.DifferentiatePlatedCopper() )
|
||||
{
|
||||
// ADD PLATED PADS contours
|
||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||
{
|
||||
footprint->TransformPadsToPolySet( *m_frontPlatedPadAndGraphicPolys, F_Cu, 0, maxError,
|
||||
ERROR_INSIDE, true, false, true );
|
||||
|
||||
footprint->TransformPadsToPolySet( *m_backPlatedPadAndGraphicPolys, B_Cu, 0, maxError,
|
||||
ERROR_INSIDE, true, false, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add graphic item on copper layers to object containers
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layerMap.find( layer ) != m_layerMap.end() );
|
||||
wxASSERT( m_layerMap.contains( layer ) );
|
||||
|
||||
BVH_CONTAINER_2D *layerContainer = m_layerMap[layer];
|
||||
|
||||
@@ -640,34 +653,28 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
}
|
||||
|
||||
// add also this shape to the plated copper polygon list if required
|
||||
if( cfg.DifferentiatePlatedCopper() )
|
||||
if( cfg.DifferentiatePlatedCopper() && ( layer == F_Cu || layer == B_Cu ) )
|
||||
{
|
||||
// Note: for TEXT and TEXTBOX, TransformShapeToPolygon returns the bounding
|
||||
// box shape, not the exact text shape. So it is not used for these items
|
||||
if( layer == F_Cu || layer == B_Cu )
|
||||
{
|
||||
SHAPE_POLY_SET* platedCopperPolys = layer == F_Cu
|
||||
? m_frontPlatedCopperPolys
|
||||
SHAPE_POLY_SET* copperPolys = layer == F_Cu ? m_frontPlatedCopperPolys
|
||||
: m_backPlatedCopperPolys;
|
||||
|
||||
if( item->Type() == PCB_TEXTBOX_T )
|
||||
{
|
||||
PCB_TEXTBOX* text_box = static_cast<PCB_TEXTBOX*>( item );
|
||||
text_box->TransformTextToPolySet( *platedCopperPolys,
|
||||
0, maxError, ERROR_INSIDE );
|
||||
// Add box outlines
|
||||
text_box->PCB_SHAPE::TransformShapeToPolygon( *platedCopperPolys, layer,
|
||||
0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
else if( item->Type() == PCB_TEXT_T )
|
||||
{
|
||||
static_cast<PCB_TEXT*>( item )->TransformTextToPolySet(
|
||||
*platedCopperPolys,
|
||||
0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
else
|
||||
item->TransformShapeToPolygon( *platedCopperPolys, layer,
|
||||
0, maxError, ERROR_INSIDE );
|
||||
// Note: for TEXT and TEXTBOX, TransformShapeToPolygon returns the bounding
|
||||
// box shape, not the exact text shape. So it is not used for these items
|
||||
if( item->Type() == PCB_TEXTBOX_T )
|
||||
{
|
||||
PCB_TEXTBOX* text_box = static_cast<PCB_TEXTBOX*>( item );
|
||||
text_box->TransformTextToPolySet( *copperPolys, 0, maxError, ERROR_INSIDE );
|
||||
// Add box outlines
|
||||
text_box->PCB_SHAPE::TransformShapeToPolygon( *copperPolys, layer, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
else if( item->Type() == PCB_TEXT_T )
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
text->TransformTextToPolySet( *copperPolys, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
else
|
||||
{
|
||||
item->TransformShapeToPolySet( *copperPolys, layer, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -678,7 +685,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
wxASSERT( m_layers_poly.find( layer ) != m_layers_poly.end() );
|
||||
wxASSERT( m_layers_poly.contains( layer ) );
|
||||
|
||||
SHAPE_POLY_SET *layerPoly = m_layers_poly[layer];
|
||||
|
||||
@@ -691,7 +698,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_SHAPE_T:
|
||||
item->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
item->TransformShapeToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
@@ -706,13 +713,29 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
|
||||
if( textbox->IsBorderEnabled() )
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
|
||||
textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TABLE_T:
|
||||
// JEY TODO: tables
|
||||
{
|
||||
PCB_TABLE* table = static_cast<PCB_TABLE*>( item );
|
||||
|
||||
for( PCB_TABLECELL* cell : table->GetCells() )
|
||||
cell->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
|
||||
table->DrawBorders(
|
||||
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB,
|
||||
const STROKE_PARAMS& stroke )
|
||||
{
|
||||
SHAPE_SEGMENT seg( ptA, ptB, stroke.GetWidth() );
|
||||
seg.TransformToPolygon( *layerPoly, maxError, ERROR_INSIDE );
|
||||
} );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
wxLogTrace( m_logTrace, wxT( "createLayers: item type: %d not implemented" ),
|
||||
@@ -739,15 +762,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
layer_lock.emplace( layer, std::make_unique<std::mutex>() );
|
||||
|
||||
if( cfg.DifferentiatePlatedCopper() && layer == F_Cu )
|
||||
{
|
||||
zone->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
zone->TransformShapeToPolygon( *m_frontPlatedCopperPolys, F_Cu, 0, maxError, ERROR_INSIDE );
|
||||
else if( cfg.DifferentiatePlatedCopper() && layer == B_Cu )
|
||||
{
|
||||
zone->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
zone->TransformShapeToPolygon( *m_backPlatedCopperPolys, B_Cu, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,19 +790,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
PCB_LAYER_ID layer = zones[areaId].second;
|
||||
|
||||
auto layerContainer = m_layerMap.find( layer );
|
||||
auto layerPolyContainer = m_layers_poly.find( layer );
|
||||
|
||||
if( layerContainer != m_layerMap.end() )
|
||||
addSolidAreasShapes( zone, layerContainer->second, layer );
|
||||
if( m_layerMap.contains( layer ) )
|
||||
addSolidAreasShapes( zone, m_layerMap[layer], layer );
|
||||
|
||||
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL
|
||||
&& layerPolyContainer != m_layers_poly.end() )
|
||||
&& m_layers_poly.contains( layer ) )
|
||||
{
|
||||
auto mut_it = layer_lock.find( layer );
|
||||
|
||||
std::lock_guard< std::mutex > lock( *( mut_it->second ) );
|
||||
zone->TransformSolidAreasShapesToPolygon( layer, *layerPolyContainer->second );
|
||||
zone->TransformSolidAreasShapesToPolygon( layer, *m_layers_poly[layer] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -828,7 +842,52 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
Dwgs_User,
|
||||
Cmts_User,
|
||||
Eco1_User,
|
||||
Eco2_User
|
||||
Eco2_User,
|
||||
User_1,
|
||||
User_2,
|
||||
User_3,
|
||||
User_4,
|
||||
User_5,
|
||||
User_6,
|
||||
User_7,
|
||||
User_8,
|
||||
User_9,
|
||||
User_10,
|
||||
User_11,
|
||||
User_12,
|
||||
User_13,
|
||||
User_14,
|
||||
User_15,
|
||||
User_16,
|
||||
User_17,
|
||||
User_18,
|
||||
User_19,
|
||||
User_20,
|
||||
User_21,
|
||||
User_22,
|
||||
User_23,
|
||||
User_24,
|
||||
User_25,
|
||||
User_26,
|
||||
User_27,
|
||||
User_28,
|
||||
User_29,
|
||||
User_30,
|
||||
User_31,
|
||||
User_32,
|
||||
User_33,
|
||||
User_34,
|
||||
User_35,
|
||||
User_36,
|
||||
User_37,
|
||||
User_38,
|
||||
User_39,
|
||||
User_40,
|
||||
User_41,
|
||||
User_42,
|
||||
User_43,
|
||||
User_44,
|
||||
User_45,
|
||||
} );
|
||||
|
||||
std::bitset<LAYER_3D_END> enabledFlags = visibilityFlags;
|
||||
@@ -876,7 +935,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
break;
|
||||
|
||||
case PCB_TABLE_T:
|
||||
// JEY TODO: tables
|
||||
addTable( static_cast<PCB_TABLE*>( item ), layerContainer, item );
|
||||
break;
|
||||
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
@@ -903,9 +962,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
// Only vias on a external copper layer can have a solder mask
|
||||
PCB_LAYER_ID copper_layer = layer == F_Mask ? F_Cu : B_Cu;
|
||||
|
||||
if( track->Type() == PCB_VIA_T
|
||||
&& !static_cast<const PCB_VIA*>( track )->FlashLayer( copper_layer ) )
|
||||
continue;
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
{
|
||||
const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
|
||||
|
||||
if( !via->FlashLayer( copper_layer ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
int maskExpansion = track->GetSolderMaskExpansion();
|
||||
createTrackWithMargin( track, layerContainer, layer, maskExpansion );
|
||||
@@ -929,7 +992,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
}
|
||||
else
|
||||
{
|
||||
addPads( footprint, layerContainer, layer, false, false );
|
||||
addPads( footprint, layerContainer, layer );
|
||||
}
|
||||
|
||||
addFootprintShapes( footprint, layerContainer, layer, visibilityFlags );
|
||||
@@ -960,7 +1023,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_SHAPE_T:
|
||||
item->TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
item->TransformShapeToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
@@ -975,13 +1038,30 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
{
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
|
||||
if( textbox->IsBorderEnabled() )
|
||||
textbox->PCB_SHAPE::TransformShapeToPolygon( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
|
||||
textbox->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TABLE_T:
|
||||
// JEY TODO: tables
|
||||
{
|
||||
PCB_TABLE* table = static_cast<PCB_TABLE*>( item );
|
||||
|
||||
for( PCB_TABLECELL* cell : table->GetCells() )
|
||||
cell->TransformTextToPolySet( *layerPoly, 0, maxError, ERROR_INSIDE );
|
||||
|
||||
table->DrawBorders(
|
||||
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB,
|
||||
const STROKE_PARAMS& stroke )
|
||||
{
|
||||
SHAPE_SEGMENT seg( ptA, ptB, stroke.GetWidth() );
|
||||
seg.TransformToPolygon( *layerPoly, maxError, ERROR_INSIDE );
|
||||
} );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -999,8 +1079,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
&& static_cast<const PCB_VIA*>( track )->FlashLayer( layer )
|
||||
&& !static_cast<const PCB_VIA*>( track )->IsTented( layer ) )
|
||||
{
|
||||
track->TransformShapeToPolygon( *layerPoly, layer, maskExpansion, maxError,
|
||||
ERROR_INSIDE );
|
||||
track->TransformShapeToPolygon( *layerPoly, layer, maskExpansion, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1015,10 +1094,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
for( PAD* pad : footprint->Pads() )
|
||||
{
|
||||
if( pad->IsOnLayer( layer ) )
|
||||
{
|
||||
buildPadOutlineAsPolygon( pad, layer, *layerPoly, linewidth, maxError,
|
||||
ERROR_INSIDE );
|
||||
}
|
||||
buildPadOutlineAsPolygon( pad, layer, *layerPoly, linewidth, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1026,10 +1102,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
|
||||
// On tech layers, use a poor circle approximation, only for texts (stroke font)
|
||||
footprint->TransformFPTextToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE );
|
||||
|
||||
// Add the remaining things with dynamic seg count for circles
|
||||
transformFPTextToPolySet( footprint, layer, visibilityFlags, *layerPoly, maxError, ERROR_INSIDE );
|
||||
transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError, ERROR_INSIDE );
|
||||
}
|
||||
|
||||
@@ -1059,9 +1132,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
if( !footprint->GetBoundingBox().Intersects( boardBBox ) )
|
||||
{
|
||||
if( footprint->IsFlipped() )
|
||||
addPads( footprint, m_offboardPadsBack, B_Cu, false, false );
|
||||
addPads( footprint, m_offboardPadsBack, B_Cu );
|
||||
else
|
||||
addPads( footprint, m_offboardPadsFront, F_Cu, false, false );
|
||||
addPads( footprint, m_offboardPadsFront, F_Cu );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1080,52 +1153,18 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
aStatusReporter->Report( _( "Calculating plated copper" ) );
|
||||
|
||||
// TRIM PLATED COPPER TO SOLDERMASK
|
||||
if( m_layers_poly.find( F_Mask ) != m_layers_poly.end() )
|
||||
{
|
||||
if( m_layers_poly.contains( F_Mask ) )
|
||||
m_frontPlatedCopperPolys->BooleanIntersection( *m_layers_poly.at( F_Mask ) );
|
||||
}
|
||||
|
||||
if( m_layers_poly.find( B_Mask ) != m_layers_poly.end() )
|
||||
{
|
||||
if( m_layers_poly.contains( B_Mask ))
|
||||
m_backPlatedCopperPolys->BooleanIntersection( *m_layers_poly.at( B_Mask ) );
|
||||
}
|
||||
|
||||
// Subtract plated copper from unplated copper
|
||||
bool hasF_Cu = false;
|
||||
bool hasB_Cu = false;
|
||||
|
||||
if( m_layers_poly.find( F_Cu ) != m_layers_poly.end() )
|
||||
{
|
||||
m_layers_poly[F_Cu]->BooleanSubtract( *m_frontPlatedPadAndGraphicPolys );
|
||||
if( m_layers_poly.contains( F_Cu ) )
|
||||
m_layers_poly[F_Cu]->BooleanSubtract( *m_frontPlatedCopperPolys );
|
||||
hasF_Cu = true;
|
||||
}
|
||||
|
||||
if( m_layers_poly.find( B_Cu ) != m_layers_poly.end() )
|
||||
{
|
||||
m_layers_poly[B_Cu]->BooleanSubtract( *m_backPlatedPadAndGraphicPolys );
|
||||
if( m_layers_poly.contains( B_Cu ) )
|
||||
m_layers_poly[B_Cu]->BooleanSubtract( *m_backPlatedCopperPolys );
|
||||
hasB_Cu = true;
|
||||
}
|
||||
|
||||
// Add plated graphic items to build vertical walls
|
||||
if( hasF_Cu && m_frontPlatedCopperPolys->OutlineCount() )
|
||||
m_frontPlatedPadAndGraphicPolys->Append( *m_frontPlatedCopperPolys );
|
||||
|
||||
if( hasB_Cu && m_backPlatedCopperPolys->OutlineCount() )
|
||||
m_backPlatedPadAndGraphicPolys->Append( *m_backPlatedCopperPolys );
|
||||
|
||||
m_frontPlatedPadAndGraphicPolys->Simplify();
|
||||
m_backPlatedPadAndGraphicPolys->Simplify();
|
||||
m_frontPlatedCopperPolys->Simplify();
|
||||
m_backPlatedCopperPolys->Simplify();
|
||||
|
||||
// ADD PLATED PADS
|
||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||
{
|
||||
addPads( footprint, m_platedPadsFront, F_Cu, false, true );
|
||||
addPads( footprint, m_platedPadsBack, B_Cu, false, true );
|
||||
}
|
||||
|
||||
// ADD PLATED COPPER
|
||||
ConvertPolygonToTriangles( *m_frontPlatedCopperPolys, *m_platedPadsFront, m_biuTo3Dunits,
|
||||
@@ -1181,13 +1220,11 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
i < selected_layer_id.size();
|
||||
i = nextItem.fetch_add( 1 ) )
|
||||
{
|
||||
auto layerPoly = m_layers_poly.find( selected_layer_id[i] );
|
||||
|
||||
if( layerPoly != m_layers_poly.end() )
|
||||
if( m_layers_poly.contains( selected_layer_id[i] ) )
|
||||
{
|
||||
// This will make a union of all added contours
|
||||
layerPoly->second->ClearArcs();
|
||||
layerPoly->second->Simplify();
|
||||
m_layers_poly[ selected_layer_id[i] ]->ClearArcs();
|
||||
m_layers_poly[ selected_layer_id[i] ]->Simplify();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1208,13 +1245,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
for( PCB_LAYER_ID layer : layer_ids )
|
||||
{
|
||||
if( m_layerHoleOdPolys.find( layer ) != m_layerHoleOdPolys.end() )
|
||||
if( m_layerHoleOdPolys.contains( layer ) )
|
||||
{
|
||||
// found
|
||||
SHAPE_POLY_SET *polyLayer = m_layerHoleOdPolys[layer];
|
||||
polyLayer->Simplify();
|
||||
|
||||
wxASSERT( m_layerHoleIdPolys.find( layer ) != m_layerHoleIdPolys.end() );
|
||||
wxASSERT( m_layerHoleIdPolys.contains( layer ) );
|
||||
|
||||
polyLayer = m_layerHoleIdPolys[layer];
|
||||
polyLayer->Simplify();
|
||||
|
||||
@@ -567,7 +567,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.opengl_copper_thickness )
|
||||
{
|
||||
if( map_poly.find( layer ) != map_poly.end() )
|
||||
if( map_poly.contains( layer ) )
|
||||
{
|
||||
polyListSubtracted = *map_poly.at( layer );
|
||||
|
||||
@@ -584,11 +584,11 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk )
|
||||
{
|
||||
if( layer == B_SilkS && map_poly.find( B_Mask ) != map_poly.end() )
|
||||
if( layer == B_SilkS && map_poly.contains( B_Mask ) )
|
||||
{
|
||||
polyListSubtracted.BooleanSubtract( *map_poly.at( B_Mask ) );
|
||||
}
|
||||
else if( layer == F_SilkS && map_poly.find( F_Mask ) != map_poly.end() )
|
||||
else if( layer == F_SilkS && map_poly.contains( F_Mask ) )
|
||||
{
|
||||
polyListSubtracted.BooleanSubtract( *map_poly.at( F_Mask ) );
|
||||
}
|
||||
@@ -607,14 +607,12 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.DifferentiatePlatedCopper() )
|
||||
{
|
||||
const SHAPE_POLY_SET* frontPlatedPadAndGraphicPolys =
|
||||
m_boardAdapter.GetFrontPlatedPadAndGraphicPolys();
|
||||
const SHAPE_POLY_SET* backPlatedPadAndGraphicPolys =
|
||||
m_boardAdapter.GetBackPlatedPadAndGraphicPolys();
|
||||
const SHAPE_POLY_SET* frontPlatedCopperPolys = m_boardAdapter.GetFrontPlatedCopperPolys();
|
||||
const SHAPE_POLY_SET* backPlatedCopperPolys = m_boardAdapter.GetBackPlatedCopperPolys();
|
||||
|
||||
if( frontPlatedPadAndGraphicPolys )
|
||||
if( frontPlatedCopperPolys )
|
||||
{
|
||||
SHAPE_POLY_SET poly = frontPlatedPadAndGraphicPolys->CloneDropTriangulation();
|
||||
SHAPE_POLY_SET poly = frontPlatedCopperPolys->CloneDropTriangulation();
|
||||
poly.BooleanIntersection( m_boardAdapter.GetBoardPoly() );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetTH_ODPolys() );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys() );
|
||||
@@ -627,9 +625,9 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
m_layers[F_Cu] = generateEmptyLayerList( F_Cu );
|
||||
}
|
||||
|
||||
if( backPlatedPadAndGraphicPolys )
|
||||
if( backPlatedCopperPolys )
|
||||
{
|
||||
SHAPE_POLY_SET poly = backPlatedPadAndGraphicPolys->CloneDropTriangulation();
|
||||
SHAPE_POLY_SET poly = backPlatedCopperPolys->CloneDropTriangulation();
|
||||
poly.BooleanIntersection( m_boardAdapter.GetBoardPoly() );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetTH_ODPolys() );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys() );
|
||||
@@ -964,7 +962,7 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
|
||||
|
||||
// Check if the fp_model is not present in our cache map
|
||||
// (Not already loaded in memory)
|
||||
if( m_3dModelMap.find( fp_model.m_Filename ) == m_3dModelMap.end() )
|
||||
if( !m_3dModelMap.contains( fp_model.m_Filename ) )
|
||||
{
|
||||
// It is not present, try get it from cache
|
||||
const S3DMODEL* modelPtr =
|
||||
|
||||
@@ -271,9 +271,7 @@ void RENDER_3D_OPENGL::setupMaterials()
|
||||
|
||||
void RENDER_3D_OPENGL::setLayerMaterial( PCB_LAYER_ID aLayerID )
|
||||
{
|
||||
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
|
||||
|
||||
if( cfg.use_board_editor_copper_colors && IsCopperLayer( aLayerID ) )
|
||||
if( m_boardAdapter.GetUseBoardEditorCopperLayerColors() && IsCopperLayer( aLayerID ) )
|
||||
{
|
||||
COLOR4D copper_color = m_boardAdapter.m_BoardEditorColors[aLayerID];
|
||||
m_materials.m_Copper.m_Diffuse = SFVEC3F( copper_color.r, copper_color.g,
|
||||
@@ -362,10 +360,34 @@ void RENDER_3D_OPENGL::setLayerMaterial( PCB_LAYER_ID aLayerID )
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
int layer3D = MapPCBLayerTo3DLayer( aLayerID );
|
||||
|
||||
// Note: MUST do this in LAYER_3D space; User_1..User_45 are NOT contiguous
|
||||
if( layer3D >= LAYER_3D_USER_1 && layer3D <= LAYER_3D_USER_45 )
|
||||
{
|
||||
int user_idx = layer3D - LAYER_3D_USER_1;
|
||||
|
||||
m_materials.m_Plastic.m_Diffuse = m_boardAdapter.m_UserDefinedLayerColor[ user_idx ];
|
||||
m_materials.m_Plastic.m_Ambient = SFVEC3F( m_materials.m_Plastic.m_Diffuse.r * 0.05f,
|
||||
m_materials.m_Plastic.m_Diffuse.g * 0.05f,
|
||||
m_materials.m_Plastic.m_Diffuse.b * 0.05f );
|
||||
|
||||
m_materials.m_Plastic.m_Specular = SFVEC3F( m_materials.m_Plastic.m_Diffuse.r * 0.7f,
|
||||
m_materials.m_Plastic.m_Diffuse.g * 0.7f,
|
||||
m_materials.m_Plastic.m_Diffuse.b * 0.7f );
|
||||
|
||||
m_materials.m_Plastic.m_Shininess = 0.078125f * 128.0f;
|
||||
m_materials.m_Plastic.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
|
||||
OglSetMaterial( m_materials.m_Plastic, 1.0f );
|
||||
break;
|
||||
}
|
||||
|
||||
m_materials.m_Copper.m_Diffuse = m_boardAdapter.m_CopperColor;
|
||||
OglSetMaterial( m_materials.m_Copper, 1.0f );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -632,7 +632,15 @@ void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarn
|
||||
break;
|
||||
|
||||
default:
|
||||
if( m_boardAdapter.m_Cfg->m_Render.differentiate_plated_copper )
|
||||
{
|
||||
int layer3D = MapPCBLayerTo3DLayer( layer_id );
|
||||
|
||||
// Note: MUST do this in LAYER_3D space; User_1..User_45 are NOT contiguous
|
||||
if( layer3D >= LAYER_3D_USER_1 && layer3D <= LAYER_3D_USER_45 )
|
||||
{
|
||||
layerColor = m_boardAdapter.m_UserDefinedLayerColor[ layer3D - LAYER_3D_USER_1 ];
|
||||
}
|
||||
else if( m_boardAdapter.m_Cfg->m_Render.differentiate_plated_copper )
|
||||
{
|
||||
layerColor = SFVEC3F( 184.0f / 255.0f, 115.0f / 255.0f, 50.0f / 255.0f );
|
||||
materialLayer = &m_materials.m_NonPlatedCopper;
|
||||
@@ -645,6 +653,7 @@ void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarn
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
createItemsFromContainer( container2d, layer_id, materialLayer, layerColor, 0.0f );
|
||||
} // for each layer on map
|
||||
|
||||
@@ -274,10 +274,12 @@ void RENDER_3D_RAYTRACE_BASE::renderTracing( uint8_t* ptrPBO, REPORTER* aStatusR
|
||||
}
|
||||
};
|
||||
|
||||
for( size_t i = 0; i < tp.get_thread_count() + 1; ++i )
|
||||
tp.push_task( processBlocks );
|
||||
BS::multi_future<void> futures;
|
||||
|
||||
tp.wait_for_tasks();
|
||||
for( size_t i = 0; i < tp.get_thread_count(); ++i )
|
||||
futures.push_back( tp.submit( processBlocks ) );
|
||||
|
||||
futures.wait();
|
||||
|
||||
m_blockRenderProgressCount += numBlocksRendered;
|
||||
|
||||
|
||||
@@ -48,15 +48,8 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
|
||||
//
|
||||
ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
|
||||
|
||||
fileMenu->Add( _( "Export Current View as PNG..." ),
|
||||
wxEmptyString,
|
||||
ID_MENU_SCREENCOPY_PNG,
|
||||
BITMAPS::export_png );
|
||||
|
||||
fileMenu->Add( _( "Export Current View as JPEG..." ),
|
||||
wxEmptyString,
|
||||
ID_MENU_SCREENCOPY_JPEG,
|
||||
BITMAPS::export_file );
|
||||
fileMenu->Add( EDA_3D_ACTIONS::exportAsPNG );
|
||||
fileMenu->Add( EDA_3D_ACTIONS::exportAsJPEG );
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->AddClose( _( "3D Viewer" ) );
|
||||
@@ -67,10 +60,7 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
|
||||
// The translated modifiers do not always work
|
||||
ACTION_MENU* editMenu = new ACTION_MENU( false, tool );
|
||||
|
||||
editMenu->Add( _( "Copy 3D Image" ),
|
||||
wxEmptyString,
|
||||
ID_TOOL_SCREENCOPY_TOCLIBBOARD,
|
||||
BITMAPS::copy );
|
||||
editMenu->Add( EDA_3D_ACTIONS::copyToClipboard );
|
||||
|
||||
|
||||
//-- View menu -------------------------------------------------------
|
||||
@@ -122,10 +112,7 @@ void EDA_3D_VIEWER_FRAME::doReCreateMenuBar()
|
||||
//
|
||||
ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
|
||||
|
||||
prefsMenu->Add( _( "Raytracing" ), "",
|
||||
ID_RENDER_CURRENT_VIEW,
|
||||
BITMAPS::tools,
|
||||
ACTION_MENU::CHECK );
|
||||
prefsMenu->Add( EDA_3D_ACTIONS::toggleRaytacing, ACTION_MENU::CHECK );
|
||||
|
||||
prefsMenu->Add( ACTIONS::openPreferences );
|
||||
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/choice.h>
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <dialogs/eda_view_switcher.h>
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <tool/action_toolbar.h>
|
||||
#include <tools/eda_3d_actions.h>
|
||||
#include <3d_viewer_id.h>
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::ReCreateMainToolbar()
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::ReCreateMainToolbar" ) );
|
||||
|
||||
wxWindowUpdateLocker dummy( this );
|
||||
|
||||
if( m_mainToolBar )
|
||||
{
|
||||
m_mainToolBar->ClearToolbar();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT |
|
||||
wxAUI_TB_HORIZONTAL );
|
||||
m_mainToolBar->SetAuiManager( &m_auimgr );
|
||||
}
|
||||
|
||||
// Set up toolbar
|
||||
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
||||
KiBitmapBundle( BITMAPS::import3d ),
|
||||
_( "Reload board" ) );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
||||
KiBitmapBundle( BITMAPS::copy ),
|
||||
_( "Copy 3D image to clipboard" ) );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString,
|
||||
KiBitmapBundle( BITMAPS::ray_tracing ),
|
||||
_( "Render current view using Raytracing" ), wxITEM_CHECK );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( ACTIONS::zoomRedraw );
|
||||
m_mainToolBar->Add( ACTIONS::zoomInCenter );
|
||||
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
|
||||
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCW );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCCW );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCW );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCCW );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCW );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCCW );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::flipView );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::moveLeft );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::moveRight );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::moveUp );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::moveDown );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::toggleOrtho, ACTION_TOOLBAR::TOGGLE );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( EDA_3D_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE );
|
||||
|
||||
m_mainToolBar->KiRealize();
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include <widgets/wx_aui_utils.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <project_pcb.h>
|
||||
#include <toolbars_3d.h>
|
||||
|
||||
#include <3d_navlib/nl_3d_viewer_plugin.h>
|
||||
|
||||
@@ -80,7 +81,6 @@ BEGIN_EVENT_TABLE( EDA_3D_VIEWER_FRAME, KIWAY_PLAYER )
|
||||
EDA_3D_VIEWER_FRAME::Process_Special_Functions )
|
||||
|
||||
EVT_MENU( wxID_CLOSE, EDA_3D_VIEWER_FRAME::Exit3DFrame )
|
||||
EVT_MENU( ID_RENDER_CURRENT_VIEW, EDA_3D_VIEWER_FRAME::onRenderEngineSelection )
|
||||
EVT_MENU( ID_DISABLE_RAY_TRACING, EDA_3D_VIEWER_FRAME::onDisableRayTracing )
|
||||
|
||||
EVT_CLOSE( EDA_3D_VIEWER_FRAME::OnCloseWindow )
|
||||
@@ -91,7 +91,6 @@ 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 )
|
||||
@@ -149,13 +148,16 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
m_toolManager->InvokeTool( "3DViewer.Control" );
|
||||
|
||||
ReCreateMenuBar();
|
||||
ReCreateMainToolbar();
|
||||
|
||||
m_toolbarSettings = Pgm().GetSettingsManager().GetToolbarSettings<EDA_3D_VIEWER_TOOLBAR_SETTINGS>( "3d_viewer-toolbars" );
|
||||
configureToolbars();
|
||||
RecreateToolbars();
|
||||
|
||||
m_infoBar = new WX_INFOBAR( this, &m_auimgr );
|
||||
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
|
||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxS( "MainToolbar" ) )
|
||||
m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
|
||||
.Top().Layer( 6 ) );
|
||||
m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( wxS( "InfoBar" ) )
|
||||
.Top().Layer( 1 ) );
|
||||
@@ -272,7 +274,7 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
|
||||
return m_boardAdapter.m_Cfg->m_AuiPanels.show_layer_manager;
|
||||
};
|
||||
|
||||
RegisterUIUpdateHandler( ID_RENDER_CURRENT_VIEW, ACTION_CONDITIONS().Check( raytracing ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::toggleRaytacing, ACTION_CONDITIONS().Check( raytracing ) );
|
||||
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showTHT, ACTION_CONDITIONS().Check( showTH ) );
|
||||
mgr->SetConditions( EDA_3D_ACTIONS::showSMD, ACTION_CONDITIONS().Check( showSMD ) );
|
||||
@@ -467,21 +469,13 @@ void EDA_3D_VIEWER_FRAME::Process_Special_Functions( wxCommandEvent &event )
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_RELOAD3D_BOARD:
|
||||
NewDisplay( true );
|
||||
break;
|
||||
|
||||
case ID_TOOL_SCREENCOPY_TOCLIBBOARD:
|
||||
case ID_MENU_SCREENCOPY_PNG:
|
||||
case ID_MENU_SCREENCOPY_JPEG:
|
||||
takeScreenshot( event );
|
||||
return;
|
||||
|
||||
case ID_MENU3D_RESET_DEFAULTS:
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
|
||||
|
||||
m_boardAdapter.SetLayerColors( m_boardAdapter.GetDefaultColors() );
|
||||
|
||||
cfg->ResetToDefaults();
|
||||
LoadSettings( cfg );
|
||||
|
||||
@@ -499,24 +493,6 @@ void EDA_3D_VIEWER_FRAME::Process_Special_Functions( wxCommandEvent &event )
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::onRenderEngineSelection( wxCommandEvent &event )
|
||||
{
|
||||
RENDER_ENGINE& engine = m_boardAdapter.m_Cfg->m_Render.engine;
|
||||
RENDER_ENGINE old_engine = engine;
|
||||
|
||||
if( old_engine == RENDER_ENGINE::OPENGL )
|
||||
engine = RENDER_ENGINE::RAYTRACING;
|
||||
else
|
||||
engine = RENDER_ENGINE::OPENGL;
|
||||
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::OnRenderEngineSelection type %s " ),
|
||||
engine == RENDER_ENGINE::RAYTRACING ? wxT( "raytracing" ) : wxT( "realtime" ) );
|
||||
|
||||
if( old_engine != engine )
|
||||
RenderEngineChanged();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::onDisableRayTracing( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::%s disabling ray tracing." ),
|
||||
@@ -641,9 +617,6 @@ void EDA_3D_VIEWER_FRAME::CommonSettingsChanged( int aFlags )
|
||||
// Regen menu bars, etc
|
||||
EDA_BASE_FRAME::CommonSettingsChanged( aFlags );
|
||||
|
||||
// There is no base class that handles toolbars for this frame
|
||||
ReCreateMainToolbar();
|
||||
|
||||
loadCommonSettings();
|
||||
applySettings(
|
||||
Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
|
||||
@@ -659,7 +632,7 @@ void EDA_3D_VIEWER_FRAME::ShowChangedLanguage()
|
||||
EDA_BASE_FRAME::ShowChangedLanguage();
|
||||
|
||||
SetTitle( _( "3D Viewer" ) );
|
||||
ReCreateMainToolbar();
|
||||
RecreateToolbars();
|
||||
|
||||
if( m_appearancePanel )
|
||||
{
|
||||
@@ -702,15 +675,15 @@ void EDA_3D_VIEWER_FRAME::OnDarkModeToggle()
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
|
||||
void EDA_3D_VIEWER_FRAME::TakeScreenshot( EDA_3D_VIEWER_EXPORT_FORMAT aFormat )
|
||||
{
|
||||
wxString fullFileName;
|
||||
bool fmt_is_jpeg = false;
|
||||
|
||||
if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
|
||||
if( aFormat == EDA_3D_VIEWER_EXPORT_FORMAT::JPEG )
|
||||
fmt_is_jpeg = true;
|
||||
|
||||
if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
||||
if( aFormat != EDA_3D_VIEWER_EXPORT_FORMAT::CLIPBOARD )
|
||||
{
|
||||
// Remember path between saves during this session only.
|
||||
const wxString wildcard =
|
||||
@@ -774,7 +747,7 @@ void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
|
||||
|
||||
cfg.highlight_on_rollover = allow_highlight;
|
||||
|
||||
if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
||||
if( aFormat == EDA_3D_VIEWER_EXPORT_FORMAT::CLIPBOARD )
|
||||
{
|
||||
wxBitmap bitmap( screenshotImage );
|
||||
|
||||
|
||||
@@ -57,6 +57,13 @@ enum EDA_3D_VIEWER_STATUSBAR
|
||||
ZOOM_LEVEL,
|
||||
};
|
||||
|
||||
enum class EDA_3D_VIEWER_EXPORT_FORMAT
|
||||
{
|
||||
CLIPBOARD,
|
||||
PNG,
|
||||
JPEG
|
||||
};
|
||||
|
||||
/**
|
||||
* Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard
|
||||
*/
|
||||
@@ -123,6 +130,12 @@ public:
|
||||
|
||||
void OnDarkModeToggle();
|
||||
|
||||
/**
|
||||
* Create a Screenshot of the current 3D view.
|
||||
* Output file format is png or jpeg, or image is copied to the clipboard
|
||||
*/
|
||||
void TakeScreenshot( EDA_3D_VIEWER_EXPORT_FORMAT aFormat );
|
||||
|
||||
protected:
|
||||
void setupUIConditions() override;
|
||||
|
||||
@@ -138,20 +151,12 @@ private:
|
||||
|
||||
void Process_Special_Functions( wxCommandEvent& event );
|
||||
|
||||
void onRenderEngineSelection( wxCommandEvent& event );
|
||||
void onDisableRayTracing( wxCommandEvent& aEvent );
|
||||
|
||||
void OnActivate( wxActivateEvent& event );
|
||||
void OnSetFocus( wxFocusEvent& event );
|
||||
|
||||
void doReCreateMenuBar() override;
|
||||
void ReCreateMainToolbar();
|
||||
|
||||
/**
|
||||
* Create a Screenshot of the current 3D view.
|
||||
* Output file format is png or jpeg, or image is copied to the clipboard
|
||||
*/
|
||||
void takeScreenshot( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* @brief RenderEngineChanged - Update toolbar icon and call canvas RenderEngineChanged
|
||||
@@ -172,7 +177,6 @@ private:
|
||||
private:
|
||||
wxFileName m_defaultSaveScreenshotFileName;
|
||||
|
||||
ACTION_TOOLBAR* m_mainToolBar;
|
||||
EDA_3D_CANVAS* m_canvas;
|
||||
BOARD_ADAPTER m_boardAdapter;
|
||||
CAMERA& m_currentCamera;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <3d_enums.h>
|
||||
#include <common_ogl/ogl_attr_list.h>
|
||||
#include <settings/parameters.h>
|
||||
@@ -81,6 +82,35 @@ PARAM_LAYER_PRESET_3D::PARAM_LAYER_PRESET_3D( const std::string& aPath,
|
||||
m_presets( aPresetList )
|
||||
{
|
||||
wxASSERT( aPresetList );
|
||||
|
||||
#define LAYER( n, l ) m_layerToLayerNameMap[l] = n; m_layerNameToLayerMap[n] = l;
|
||||
|
||||
LAYER( "fp_values", LAYER_FP_VALUES );
|
||||
LAYER( "fp_references", LAYER_FP_REFERENCES );
|
||||
LAYER( "fp_text", LAYER_FP_TEXT );
|
||||
LAYER( "background_bottom", LAYER_3D_BACKGROUND_BOTTOM );
|
||||
LAYER( "background_top", LAYER_3D_BACKGROUND_TOP );
|
||||
LAYER( "board", LAYER_3D_BOARD );
|
||||
LAYER( "copper", LAYER_3D_COPPER_TOP );
|
||||
LAYER( "copper_bottom", LAYER_3D_COPPER_BOTTOM );
|
||||
LAYER( "silkscreen_bottom", LAYER_3D_SILKSCREEN_BOTTOM );
|
||||
LAYER( "silkscreen_top", LAYER_3D_SILKSCREEN_TOP );
|
||||
LAYER( "soldermask_bottom", LAYER_3D_SOLDERMASK_BOTTOM );
|
||||
LAYER( "soldermask_top", LAYER_3D_SOLDERMASK_TOP );
|
||||
LAYER( "solderpaste", LAYER_3D_SOLDERPASTE );
|
||||
LAYER( "adhesive", LAYER_3D_ADHESIVE );
|
||||
LAYER( "user_comments", LAYER_3D_USER_COMMENTS );
|
||||
LAYER( "user_drawings", LAYER_3D_USER_DRAWINGS );
|
||||
LAYER( "user_eco1", LAYER_3D_USER_ECO1 );
|
||||
LAYER( "user_eco2", LAYER_3D_USER_ECO2 );
|
||||
LAYER( "3d_axes", LAYER_3D_AXES );
|
||||
LAYER( "th_models", LAYER_3D_TH_MODELS );
|
||||
LAYER( "smd_models", LAYER_3D_SMD_MODELS );
|
||||
LAYER( "virtual_models", LAYER_3D_VIRTUAL_MODELS );
|
||||
LAYER( "non_pos_file_models", LAYER_3D_MODELS_NOT_IN_POS );
|
||||
LAYER( "dnp_models", LAYER_3D_MODELS_MARKED_DNP );
|
||||
LAYER( "bounding_boxes", LAYER_3D_BOUNDING_BOXES );
|
||||
LAYER( "off_board_silk", LAYER_3D_OFF_BOARD_SILK );
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +129,7 @@ nlohmann::json PARAM_LAYER_PRESET_3D::presetsToJson()
|
||||
for( int layer = 0; layer < LAYER_3D_END; ++layer )
|
||||
{
|
||||
if( preset.layers.test( layer ) )
|
||||
layers.push_back( layer );
|
||||
layers.push_back( m_layerToLayerNameMap[layer] );
|
||||
}
|
||||
|
||||
js["layers"] = layers;
|
||||
@@ -109,7 +139,7 @@ nlohmann::json PARAM_LAYER_PRESET_3D::presetsToJson()
|
||||
for( const auto& [ layer, color ] : preset.colors )
|
||||
{
|
||||
nlohmann::json layerColor = {
|
||||
{ "layer", layer },
|
||||
{ "layer", m_layerToLayerNameMap[layer] },
|
||||
{ "color", color.ToCSSString() }
|
||||
};
|
||||
|
||||
@@ -144,26 +174,20 @@ void PARAM_LAYER_PRESET_3D::jsonToPresets( const nlohmann::json& aJson )
|
||||
|
||||
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( layer.is_string() )
|
||||
p.layers.set( m_layerNameToLayerMap[layer.get<wxString>()] );
|
||||
}
|
||||
}
|
||||
|
||||
if( preset.contains( "colors" ) && preset.at( "colors" ).is_array() )
|
||||
{
|
||||
for( const nlohmann::json& layerColor : preset.at( "colors" ) )
|
||||
for( const nlohmann::json& entry : preset.at( "colors" ) )
|
||||
{
|
||||
if( layerColor.contains( "layer" ) && layerColor.contains( "color" )
|
||||
&& layerColor.at( "layer" ).is_number_integer() )
|
||||
if( entry.contains( "layer" ) && entry.contains( "color" )
|
||||
&& entry.at( "layer" ).is_string() )
|
||||
{
|
||||
int layerNum = layerColor.at( "layer" ).get<int>();
|
||||
COLOR4D color = layerColor.at( "color" ).get<COLOR4D>();
|
||||
p.colors[ layerNum ] = color;
|
||||
int layerNum = m_layerNameToLayerMap[entry.at( "layer" ).get<wxString>()];
|
||||
p.colors[ layerNum ] = entry.at( "color" ).get<COLOR4D>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,7 +199,7 @@ void PARAM_LAYER_PRESET_3D::jsonToPresets( const nlohmann::json& aJson )
|
||||
|
||||
|
||||
///! Update the schema version whenever a migration is required
|
||||
const int viewer3dSchemaVersion = 3;
|
||||
const int viewer3dSchemaVersion = 4;
|
||||
|
||||
|
||||
EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
@@ -330,6 +354,13 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
&m_Render.show_eco1, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_eco2",
|
||||
&m_Render.show_eco2, true ) );
|
||||
|
||||
for( int layer = 0; layer < 45; ++layer )
|
||||
{
|
||||
m_params.emplace_back( new PARAM<bool>( fmt::format( "render.show_user{}", layer + 1 ),
|
||||
&m_Render.show_user[layer], false ) );
|
||||
}
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_insert",
|
||||
&m_Render.show_footprints_insert, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.show_footprints_normal",
|
||||
@@ -370,6 +401,8 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
&m_Render.differentiate_plated_copper, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.use_board_editor_copper_colors",
|
||||
&m_Render.use_board_editor_copper_colors, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "render.preview_show_board_body",
|
||||
&m_Render.preview_show_board_body, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "camera.animation_enabled",
|
||||
&m_Camera.animation_enabled, true ) );
|
||||
m_params.emplace_back( new PARAM<int>( "camera.moving_speed_multiplier",
|
||||
@@ -425,6 +458,69 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
Set( "render.show_eco2", *optval );
|
||||
}
|
||||
|
||||
return true;
|
||||
} );
|
||||
|
||||
registerMigration( 3, 4,
|
||||
[&]() -> bool
|
||||
{
|
||||
std::map<int, wxString> legacyColorMap;
|
||||
|
||||
legacyColorMap[142] = "fp_values";
|
||||
legacyColorMap[143] = "fp_references";
|
||||
legacyColorMap[130] = "fp_text";
|
||||
legacyColorMap[466] = "background_bottom";
|
||||
legacyColorMap[467] = "background_top";
|
||||
legacyColorMap[468] = "board";
|
||||
legacyColorMap[469] = "copper";
|
||||
legacyColorMap[470] = "copper_bottom";
|
||||
legacyColorMap[471] = "silkscreen_bottom";
|
||||
legacyColorMap[472] = "silkscreen_top";
|
||||
legacyColorMap[473] = "soldermask_bottom";
|
||||
legacyColorMap[474] = "soldermask_top";
|
||||
legacyColorMap[475] = "solderpaste";
|
||||
legacyColorMap[476] = "adhesive";
|
||||
legacyColorMap[477] = "user_comments";
|
||||
legacyColorMap[478] = "user_drawings";
|
||||
legacyColorMap[479] = "user_eco1";
|
||||
legacyColorMap[480] = "user_eco2";
|
||||
legacyColorMap[481] = "th_models";
|
||||
legacyColorMap[482] = "smd_models";
|
||||
legacyColorMap[483] = "virtual_models";
|
||||
legacyColorMap[484] = "non_pos_file_models";
|
||||
legacyColorMap[485] = "dnp_models";
|
||||
legacyColorMap[486] = "3d_axes";
|
||||
legacyColorMap[487] = "bounding_boxes";
|
||||
legacyColorMap[488] = "off_board_silk";
|
||||
|
||||
if( !Contains( "layer_presets" ) || !At( "layer_presets" ).is_array() )
|
||||
return true;
|
||||
|
||||
for( nlohmann::json& preset : At( "layer_presets" ) )
|
||||
{
|
||||
if( preset.contains( "colors" ) && preset.at( "colors" ).is_array() )
|
||||
{
|
||||
for( nlohmann::json& color : preset.at( "colors" ) )
|
||||
{
|
||||
if( color.contains( "layer" ) && color.at( "layer" ).is_number_integer() )
|
||||
color["layer"] = legacyColorMap[color["layer"].get<int>()];
|
||||
}
|
||||
}
|
||||
|
||||
if( preset.contains( "layers" ) && preset.at( "layers" ).is_array() )
|
||||
{
|
||||
nlohmann::json mappedLayers = nlohmann::json::array();
|
||||
|
||||
for( const nlohmann::json& layer : preset.at( "layers" ) )
|
||||
{
|
||||
if( layer.is_number_integer() )
|
||||
mappedLayers.push_back( legacyColorMap[layer.get<int>()] );
|
||||
}
|
||||
|
||||
preset["layers"] = mappedLayers;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -64,7 +64,11 @@ private:
|
||||
|
||||
void jsonToPresets( const nlohmann::json& aJson );
|
||||
|
||||
private:
|
||||
std::vector<LAYER_PRESET_3D>* m_presets;
|
||||
|
||||
std::map<int, wxString> m_layerToLayerNameMap;
|
||||
std::map<wxString, int> m_layerNameToLayerMap;
|
||||
};
|
||||
|
||||
|
||||
@@ -128,6 +132,7 @@ public:
|
||||
bool show_drawings;
|
||||
bool show_eco1;
|
||||
bool show_eco2;
|
||||
bool show_user[45];
|
||||
bool show_footprints_insert;
|
||||
bool show_footprints_normal;
|
||||
bool show_footprints_virtual;
|
||||
@@ -147,21 +152,19 @@ public:
|
||||
bool subtract_mask_from_silk;
|
||||
bool clip_silk_on_via_annuli;
|
||||
bool differentiate_plated_copper;
|
||||
// Board editor copper colors are used only in OpenGL mode if
|
||||
// use_board_editor_copper_colors is true
|
||||
bool use_board_editor_copper_colors;
|
||||
bool use_board_editor_copper_colors; // OpenGL only
|
||||
bool preview_show_board_body;
|
||||
|
||||
/**
|
||||
* return true if platted copper aeras and non platted copper areas must be drawn
|
||||
* using a different color
|
||||
* in OPENGL mode, if use_board_editor_copper_colors, always false
|
||||
* in RAYTRACING mode, use_board_editor_copper_colors is ignored (board editor copper
|
||||
* colors are ignored)
|
||||
*/
|
||||
bool DifferentiatePlatedCopper()
|
||||
{
|
||||
return engine == RENDER_ENGINE::RAYTRACING ? differentiate_plated_copper
|
||||
: differentiate_plated_copper && !use_board_editor_copper_colors;
|
||||
if( engine == RENDER_ENGINE::OPENGL && use_board_editor_copper_colors )
|
||||
return false;
|
||||
|
||||
return differentiate_plated_copper;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/choice.h>
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <dialogs/eda_view_switcher.h>
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <tool/action_toolbar.h>
|
||||
#include <tools/eda_3d_actions.h>
|
||||
#include <3d_viewer_id.h>
|
||||
|
||||
#include <toolbars_3d.h>
|
||||
|
||||
|
||||
std::optional<TOOLBAR_CONFIGURATION> EDA_3D_VIEWER_TOOLBAR_SETTINGS::DefaultToolbarConfig( TOOLBAR_LOC aToolbar )
|
||||
{
|
||||
TOOLBAR_CONFIGURATION config;
|
||||
|
||||
// clang-format off
|
||||
switch( aToolbar )
|
||||
{
|
||||
case TOOLBAR_LOC::LEFT:
|
||||
case TOOLBAR_LOC::RIGHT:
|
||||
case TOOLBAR_LOC::TOP_AUX:
|
||||
return std::nullopt;
|
||||
case TOOLBAR_LOC::TOP_MAIN:
|
||||
config.AppendAction( EDA_3D_ACTIONS::reloadBoard );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::copyToClipboard );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::toggleRaytacing );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( ACTIONS::zoomRedraw )
|
||||
.AppendAction( ACTIONS::zoomInCenter )
|
||||
.AppendAction( ACTIONS::zoomOutCenter )
|
||||
.AppendAction( ACTIONS::zoomFitScreen );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateXCW )
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateXCCW );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateYCW )
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateYCCW );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateZCW )
|
||||
.AppendAction( EDA_3D_ACTIONS::rotateZCCW );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::flipView );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::moveLeft )
|
||||
.AppendAction( EDA_3D_ACTIONS::moveRight )
|
||||
.AppendAction( EDA_3D_ACTIONS::moveUp )
|
||||
.AppendAction( EDA_3D_ACTIONS::moveDown );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::toggleOrtho );
|
||||
|
||||
config.AppendSeparator()
|
||||
.AppendAction( EDA_3D_ACTIONS::showLayersManager );
|
||||
break;
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
return config;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TOOLBARS_3D_H_
|
||||
#define TOOLBARS_3D_H_
|
||||
|
||||
#include <tool/ui/toolbar_configuration.h>
|
||||
|
||||
/**
|
||||
* Toolbar configuration for the 3D viewer.
|
||||
*/
|
||||
class EDA_3D_VIEWER_TOOLBAR_SETTINGS : public TOOLBAR_SETTINGS
|
||||
{
|
||||
public:
|
||||
EDA_3D_VIEWER_TOOLBAR_SETTINGS() :
|
||||
TOOLBAR_SETTINGS( "3d_viewer-toolbars" )
|
||||
{}
|
||||
|
||||
~EDA_3D_VIEWER_TOOLBAR_SETTINGS() {}
|
||||
|
||||
std::optional<TOOLBAR_CONFIGURATION> DefaultToolbarConfig( TOOLBAR_LOC aToolbar ) override;
|
||||
};
|
||||
|
||||
#endif /* TOOLBARS_3D_H_ */
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <bitmaps.h>
|
||||
#include <3d_viewer_id.h>
|
||||
#include <3d_enums.h>
|
||||
#include <3d-viewer/3d_viewer/eda_3d_viewer_frame.h>
|
||||
#include "eda_3d_actions.h"
|
||||
#include "tool/tool_action.h"
|
||||
|
||||
@@ -38,7 +39,47 @@
|
||||
TOOL_ACTION EDA_3D_ACTIONS::controlActivate( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.Flags( AF_ACTIVATE ) );
|
||||
.Flags( AF_ACTIVATE )
|
||||
.ToolbarState( TOOLBAR_STATE::HIDDEN) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS:: reloadBoard( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.reloadBoard" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Reload board" ) )
|
||||
.Tooltip( _( "Reload board and refresh 3D view" ) )
|
||||
.Icon( BITMAPS::import3d ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::toggleRaytacing( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.toggleRaytacing" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Use raytracing" ) )
|
||||
.Tooltip( _( "Render current view using Raytracing" ) )
|
||||
.Icon( BITMAPS::ray_tracing )
|
||||
.ToolbarState( TOOLBAR_STATE::TOGGLE) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::copyToClipboard( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.copyToClipboard" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Copy 3D image to clipboard" ) )
|
||||
.Tooltip( _( "Copy the current 3D image to the clipboard" ) )
|
||||
.Icon( BITMAPS::copy )
|
||||
.Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>( EDA_3D_VIEWER_EXPORT_FORMAT::CLIPBOARD ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::exportAsPNG( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.exportAsPNG" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Export Current View as PNG..." ) )
|
||||
.Tooltip( _( "Export the Current View as a PNG image" ) )
|
||||
.Icon( BITMAPS::export_png )
|
||||
.Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>( EDA_3D_VIEWER_EXPORT_FORMAT::PNG ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::exportAsJPEG( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.exportAsJPEG" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Export Current View as JPEG..." ) )
|
||||
.Tooltip( _( "Export the Current View as a JPEG image" ) )
|
||||
.Icon( BITMAPS::export_file )
|
||||
.Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>( EDA_3D_VIEWER_EXPORT_FORMAT::JPEG ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::pivotCenter( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.pivotCenter" )
|
||||
@@ -84,6 +125,7 @@ TOOL_ACTION EDA_3D_ACTIONS::rotateYCCW( TOOL_ACTION_ARGS()
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateZclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.DefaultHotkey( MD_SHIFT + 'R' )
|
||||
.FriendlyName( _( "Rotate Z Clockwise" ) )
|
||||
.Icon( BITMAPS::rotate_cw_z )
|
||||
.Flags( AF_NONE )
|
||||
@@ -92,6 +134,7 @@ TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( TOOL_ACTION_ARGS()
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotateZCCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateZcounterclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.DefaultHotkey( 'R' )
|
||||
.FriendlyName( _( "Rotate Z Counterclockwise" ) )
|
||||
.Icon( BITMAPS::rotate_ccw_z )
|
||||
.Flags( AF_NONE )
|
||||
@@ -157,7 +200,8 @@ TOOL_ACTION EDA_3D_ACTIONS::toggleOrtho( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Toggle Orthographic Projection" ) )
|
||||
.Tooltip( _( "Enable/disable orthographic projection" ) )
|
||||
.Icon( BITMAPS::ortho ) );
|
||||
.Icon( BITMAPS::ortho )
|
||||
.ToolbarState( TOOLBAR_STATE::TOGGLE ) );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewFront( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.viewFront" )
|
||||
@@ -337,5 +381,6 @@ TOOL_ACTION EDA_3D_ACTIONS::showLayersManager( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Show Appearance Manager" ) )
|
||||
.Tooltip( _( "Show/hide the appearance manager" ) )
|
||||
.Icon( BITMAPS::layers_manager ) );
|
||||
.Icon( BITMAPS::layers_manager )
|
||||
.ToolbarState( TOOLBAR_STATE::TOGGLE ) );
|
||||
|
||||
|
||||
@@ -42,6 +42,13 @@ class EDA_3D_ACTIONS : public ACTIONS
|
||||
public:
|
||||
static TOOL_ACTION controlActivate;
|
||||
|
||||
static TOOL_ACTION reloadBoard;
|
||||
static TOOL_ACTION toggleRaytacing;
|
||||
|
||||
static TOOL_ACTION copyToClipboard;
|
||||
static TOOL_ACTION exportAsPNG;
|
||||
static TOOL_ACTION exportAsJPEG;
|
||||
|
||||
static TOOL_ACTION pivotCenter;
|
||||
static TOOL_ACTION rotateXCW;
|
||||
static TOOL_ACTION rotateXCCW;
|
||||
|
||||
@@ -334,11 +334,65 @@ int EDA_3D_CONTROLLER::ZoomFitScreen( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
|
||||
|
||||
int EDA_3D_CONTROLLER::ReloadBoard( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EDA_BASE_FRAME* frame = dynamic_cast<EDA_BASE_FRAME*>( m_toolMgr->GetToolHolder() );
|
||||
|
||||
if( frame && frame->GetFrameType() == FRAME_PCB_DISPLAY3D )
|
||||
static_cast<EDA_3D_VIEWER_FRAME*>( frame )->NewDisplay( true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int EDA_3D_CONTROLLER::ToggleRaytracing( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EDA_BASE_FRAME* frame = dynamic_cast<EDA_BASE_FRAME*>( m_toolMgr->GetToolHolder() );
|
||||
|
||||
if( frame && frame->GetFrameType() == FRAME_PCB_DISPLAY3D )
|
||||
{
|
||||
EDA_3D_VIEWER_FRAME* frame3d = static_cast<EDA_3D_VIEWER_FRAME*>( frame );
|
||||
|
||||
RENDER_ENGINE& engine = frame3d->GetAdapter().m_Cfg->m_Render.engine;
|
||||
RENDER_ENGINE old_engine = engine;
|
||||
|
||||
if( old_engine == RENDER_ENGINE::OPENGL )
|
||||
engine = RENDER_ENGINE::RAYTRACING;
|
||||
else
|
||||
engine = RENDER_ENGINE::OPENGL;
|
||||
|
||||
// Directly tell the canvas the rendering engine changed
|
||||
if( old_engine != engine )
|
||||
frame3d->GetCanvas()->RenderEngineChanged();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int EDA_3D_CONTROLLER::ExportImage( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EDA_BASE_FRAME* frame = dynamic_cast<EDA_BASE_FRAME*>( m_toolMgr->GetToolHolder() );
|
||||
|
||||
if( frame && frame->GetFrameType() == FRAME_PCB_DISPLAY3D )
|
||||
static_cast<EDA_3D_VIEWER_FRAME*>( frame )->TakeScreenshot( aEvent.Parameter<EDA_3D_VIEWER_EXPORT_FORMAT>() );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CONTROLLER::setTransitions()
|
||||
{
|
||||
Go( &EDA_3D_CONTROLLER::Main, EDA_3D_ACTIONS::controlActivate.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
|
||||
|
||||
// Miscellaneous control
|
||||
Go( &EDA_3D_CONTROLLER::ReloadBoard, EDA_3D_ACTIONS::reloadBoard.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ToggleRaytracing, EDA_3D_ACTIONS::toggleRaytacing.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ExportImage, EDA_3D_ACTIONS::copyToClipboard.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ExportImage, EDA_3D_ACTIONS::exportAsPNG.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::ExportImage, EDA_3D_ACTIONS::exportAsJPEG.MakeEvent() );
|
||||
|
||||
// Pan control
|
||||
Go( &EDA_3D_CONTROLLER::PanControl, ACTIONS::panUp.MakeEvent() );
|
||||
Go( &EDA_3D_CONTROLLER::PanControl, ACTIONS::panDown.MakeEvent() );
|
||||
|
||||
@@ -96,6 +96,10 @@ public:
|
||||
int ToggleVisibility( const TOOL_EVENT& aEvent );
|
||||
int ToggleLayersManager( const TOOL_EVENT& aEvent );
|
||||
|
||||
int ReloadBoard( const TOOL_EVENT& aEvent );
|
||||
int ToggleRaytracing( const TOOL_EVENT& aEvent );
|
||||
int ExportImage( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
/// Set up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
@@ -34,20 +34,12 @@
|
||||
enum id_3dview_frm
|
||||
{
|
||||
ID_START_COMMAND_3D = ID_KICAD_3D_VIEWER_START,
|
||||
ID_RELOAD3D_BOARD,
|
||||
ID_TOOL_SCREENCOPY_TOCLIBBOARD,
|
||||
|
||||
ID_MENU_SCREENCOPY_PNG,
|
||||
ID_MENU_SCREENCOPY_JPEG,
|
||||
ID_MENU_SCREENCOPY_TOCLIBBOARD,
|
||||
|
||||
ID_MENU3D_RESET_DEFAULTS,
|
||||
|
||||
// Help
|
||||
ID_MENU_COMMAND_END,
|
||||
|
||||
ID_RENDER_CURRENT_VIEW,
|
||||
|
||||
ID_DISABLE_RAY_TRACING,
|
||||
|
||||
ID_CUSTOM_EVENT_1, // A id for a custom event (canvas refresh request)
|
||||
|
||||
@@ -81,7 +81,7 @@ set(3D-VIEWER_SRCS
|
||||
3d_rendering/test_cases.cpp
|
||||
3d_rendering/trackball.cpp
|
||||
3d_viewer/3d_menubar.cpp
|
||||
3d_viewer/3d_toolbar.cpp
|
||||
3d_viewer/toolbars_3d.cpp
|
||||
3d_viewer/tools/eda_3d_actions.cpp
|
||||
3d_viewer/tools/eda_3d_conditions.cpp
|
||||
3d_viewer/tools/eda_3d_controller.cpp
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
#include <eda_3d_viewer_frame.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <project.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <board.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/eda_3d_actions.h>
|
||||
@@ -51,52 +50,93 @@
|
||||
/// 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" ) ),
|
||||
// text id tooltip
|
||||
RR( _HKI( "Board Body" ), LAYER_3D_BOARD, _HKI( "Show board body" ) ),
|
||||
RR( wxS( "F.Cu" ), LAYER_3D_COPPER_TOP, _HKI( "Show front copper / surface finish color" ) ),
|
||||
RR( wxS( "B.Cu" ), LAYER_3D_COPPER_BOTTOM, _HKI( "Show back copper / surface finish color" ) ),
|
||||
RR( _HKI( "Adhesive" ), LAYER_3D_ADHESIVE, _HKI( "Show adhesive" ) ),
|
||||
RR( _HKI( "Solder Paste" ), LAYER_3D_SOLDERPASTE, _HKI( "Show solder paste" ) ),
|
||||
RR( wxS( "F.Silkscreen" ), LAYER_3D_SILKSCREEN_TOP, _HKI( "Show front silkscreen" ) ),
|
||||
RR( wxS( "B.Silkscreen" ), LAYER_3D_SILKSCREEN_BOTTOM, _HKI( "Show back silkscreen" ) ),
|
||||
RR( wxS( "F.Mask" ), LAYER_3D_SOLDERMASK_TOP, _HKI( "Show front solder mask" ) ),
|
||||
RR( wxS( "B.Mask" ), LAYER_3D_SOLDERMASK_BOTTOM, _HKI( "Show back solder mask" ) ),
|
||||
RR( wxS( "User.Drawings" ), LAYER_3D_USER_DRAWINGS, _HKI( "Show user drawings layer" ) ),
|
||||
RR( wxS( "User.Comments" ), LAYER_3D_USER_COMMENTS, _HKI( "Show user comments layer" ) ),
|
||||
RR( wxS( "User.Eco1" ), LAYER_3D_USER_ECO1, _HKI( "Show user ECO1 layer" ) ),
|
||||
RR( wxS( "User.Eco2" ), LAYER_3D_USER_ECO2, _HKI( "Show user ECO2 layer" ) ),
|
||||
RR( wxS( "User.1" ), LAYER_3D_USER_1, _HKI( "Show user defined layer 1" ) ),
|
||||
RR( wxS( "User.2" ), LAYER_3D_USER_2, _HKI( "Show user defined layer 2" ) ),
|
||||
RR( wxS( "User.3" ), LAYER_3D_USER_3, _HKI( "Show user defined layer 3" ) ),
|
||||
RR( wxS( "User.4" ), LAYER_3D_USER_4, _HKI( "Show user defined layer 4" ) ),
|
||||
RR( wxS( "User.5" ), LAYER_3D_USER_5, _HKI( "Show user defined layer 5" ) ),
|
||||
RR( wxS( "User.6" ), LAYER_3D_USER_6, _HKI( "Show user defined layer 6" ) ),
|
||||
RR( wxS( "User.7" ), LAYER_3D_USER_7, _HKI( "Show user defined layer 7" ) ),
|
||||
RR( wxS( "User.8" ), LAYER_3D_USER_8, _HKI( "Show user defined layer 8" ) ),
|
||||
RR( wxS( "User.9" ), LAYER_3D_USER_9, _HKI( "Show user defined layer 9" ) ),
|
||||
RR( wxS( "User.10" ), LAYER_3D_USER_10, _HKI( "Show user defined layer 10" ) ),
|
||||
RR( wxS( "User.11" ), LAYER_3D_USER_11, _HKI( "Show user defined layer 11" ) ),
|
||||
RR( wxS( "User.12" ), LAYER_3D_USER_12, _HKI( "Show user defined layer 12" ) ),
|
||||
RR( wxS( "User.13" ), LAYER_3D_USER_13, _HKI( "Show user defined layer 13" ) ),
|
||||
RR( wxS( "User.14" ), LAYER_3D_USER_14, _HKI( "Show user defined layer 14" ) ),
|
||||
RR( wxS( "User.15" ), LAYER_3D_USER_15, _HKI( "Show user defined layer 15" ) ),
|
||||
RR( wxS( "User.16" ), LAYER_3D_USER_16, _HKI( "Show user defined layer 16" ) ),
|
||||
RR( wxS( "User.17" ), LAYER_3D_USER_17, _HKI( "Show user defined layer 17" ) ),
|
||||
RR( wxS( "User.18" ), LAYER_3D_USER_18, _HKI( "Show user defined layer 18" ) ),
|
||||
RR( wxS( "User.19" ), LAYER_3D_USER_19, _HKI( "Show user defined layer 19" ) ),
|
||||
RR( wxS( "User.20" ), LAYER_3D_USER_20, _HKI( "Show user defined layer 20" ) ),
|
||||
RR( wxS( "User.21" ), LAYER_3D_USER_21, _HKI( "Show user defined layer 21" ) ),
|
||||
RR( wxS( "User.22" ), LAYER_3D_USER_22, _HKI( "Show user defined layer 22" ) ),
|
||||
RR( wxS( "User.23" ), LAYER_3D_USER_23, _HKI( "Show user defined layer 23" ) ),
|
||||
RR( wxS( "User.24" ), LAYER_3D_USER_24, _HKI( "Show user defined layer 24" ) ),
|
||||
RR( wxS( "User.25" ), LAYER_3D_USER_25, _HKI( "Show user defined layer 25" ) ),
|
||||
RR( wxS( "User.26" ), LAYER_3D_USER_26, _HKI( "Show user defined layer 26" ) ),
|
||||
RR( wxS( "User.27" ), LAYER_3D_USER_27, _HKI( "Show user defined layer 27" ) ),
|
||||
RR( wxS( "User.28" ), LAYER_3D_USER_28, _HKI( "Show user defined layer 28" ) ),
|
||||
RR( wxS( "User.29" ), LAYER_3D_USER_29, _HKI( "Show user defined layer 29" ) ),
|
||||
RR( wxS( "User.30" ), LAYER_3D_USER_30, _HKI( "Show user defined layer 30" ) ),
|
||||
RR( wxS( "User.31" ), LAYER_3D_USER_31, _HKI( "Show user defined layer 31" ) ),
|
||||
RR( wxS( "User.32" ), LAYER_3D_USER_32, _HKI( "Show user defined layer 32" ) ),
|
||||
RR( wxS( "User.33" ), LAYER_3D_USER_33, _HKI( "Show user defined layer 33" ) ),
|
||||
RR( wxS( "User.34" ), LAYER_3D_USER_34, _HKI( "Show user defined layer 34" ) ),
|
||||
RR( wxS( "User.35" ), LAYER_3D_USER_35, _HKI( "Show user defined layer 35" ) ),
|
||||
RR( wxS( "User.36" ), LAYER_3D_USER_36, _HKI( "Show user defined layer 36" ) ),
|
||||
RR( wxS( "User.37" ), LAYER_3D_USER_37, _HKI( "Show user defined layer 37" ) ),
|
||||
RR( wxS( "User.38" ), LAYER_3D_USER_38, _HKI( "Show user defined layer 38" ) ),
|
||||
RR( wxS( "User.39" ), LAYER_3D_USER_39, _HKI( "Show user defined layer 39" ) ),
|
||||
RR( wxS( "User.40" ), LAYER_3D_USER_40, _HKI( "Show user defined layer 40" ) ),
|
||||
RR( wxS( "User.41" ), LAYER_3D_USER_41, _HKI( "Show user defined layer 41" ) ),
|
||||
RR( wxS( "User.42" ), LAYER_3D_USER_42, _HKI( "Show user defined layer 42" ) ),
|
||||
RR( wxS( "User.43" ), LAYER_3D_USER_43, _HKI( "Show user defined layer 43" ) ),
|
||||
RR( wxS( "User.44" ), LAYER_3D_USER_44, _HKI( "Show user defined layer 44" ) ),
|
||||
RR( wxS( "User.45" ), LAYER_3D_USER_45, _HKI( "Show user defined layer 45" ) ),
|
||||
RR(),
|
||||
RR( _HKI( "Through-hole Models" ), LAYER_3D_TH_MODELS, EDA_3D_ACTIONS::showTHT ),
|
||||
RR( _HKI( "SMD Models" ), LAYER_3D_SMD_MODELS, EDA_3D_ACTIONS::showSMD ),
|
||||
RR( _HKI( "Virtual Models" ), LAYER_3D_VIRTUAL_MODELS, EDA_3D_ACTIONS::showVirtual ),
|
||||
RR( _HKI( "Models not in POS File" ), LAYER_3D_MODELS_NOT_IN_POS,
|
||||
EDA_3D_ACTIONS::showNotInPosFile ),
|
||||
RR( _HKI( "Models marked DNP" ), LAYER_3D_MODELS_MARKED_DNP, EDA_3D_ACTIONS::showDNP ),
|
||||
RR( _HKI( "Model Bounding Boxes" ), LAYER_3D_BOUNDING_BOXES, EDA_3D_ACTIONS::showBBoxes ),
|
||||
RR( _HKI( "Through-hole Models" ), LAYER_3D_TH_MODELS, EDA_3D_ACTIONS::showTHT ),
|
||||
RR( _HKI( "SMD Models" ), LAYER_3D_SMD_MODELS, EDA_3D_ACTIONS::showSMD ),
|
||||
RR( _HKI( "Virtual Models" ), LAYER_3D_VIRTUAL_MODELS, EDA_3D_ACTIONS::showVirtual ),
|
||||
RR( _HKI( "Models not in POS File" ), LAYER_3D_MODELS_NOT_IN_POS, EDA_3D_ACTIONS::showNotInPosFile ),
|
||||
RR( _HKI( "Models marked DNP" ), LAYER_3D_MODELS_MARKED_DNP, EDA_3D_ACTIONS::showDNP ),
|
||||
RR( _HKI( "Model Bounding Boxes" ), LAYER_3D_BOUNDING_BOXES, EDA_3D_ACTIONS::showBBoxes ),
|
||||
RR(),
|
||||
RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ),
|
||||
RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ),
|
||||
RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ),
|
||||
RR( _HKI( "Off-board Silkscreen" ), LAYER_3D_OFF_BOARD_SILK,
|
||||
_HKI( "Do not clip silk layers to board outline" ) ),
|
||||
RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ),
|
||||
RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ),
|
||||
RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ),
|
||||
RR( _HKI( "Off-board Silkscreen" ), LAYER_3D_OFF_BOARD_SILK, _HKI( "Do not clip silk layers to board outline" ) ),
|
||||
RR(),
|
||||
RR( _HKI( "3D 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" ) ),
|
||||
RR( _HKI( "3D Axis" ), LAYER_3D_AXES, EDA_3D_ACTIONS::showAxis ),
|
||||
RR( _HKI( "Background Start" ), LAYER_3D_BACKGROUND_TOP, _HKI( "Background gradient start color" ) ),
|
||||
RR( _HKI( "Background End" ), LAYER_3D_BACKGROUND_BOTTOM, _HKI( "Background gradient end color" ) ),
|
||||
};
|
||||
|
||||
// The list of IDs that can have colors coming from the board stackup, and cannot be
|
||||
// modified if use colors from stackup is activated
|
||||
static std::vector<int> inStackupColors{ LAYER_3D_BOARD, LAYER_3D_COPPER_TOP,
|
||||
LAYER_3D_COPPER_BOTTOM, LAYER_3D_SOLDERPASTE,
|
||||
static std::vector<int> inStackupColors{ LAYER_3D_BOARD,
|
||||
LAYER_3D_COPPER_TOP, LAYER_3D_COPPER_BOTTOM,
|
||||
LAYER_3D_SOLDERPASTE,
|
||||
LAYER_3D_SILKSCREEN_TOP, LAYER_3D_SILKSCREEN_BOTTOM,
|
||||
LAYER_3D_SOLDERMASK_TOP, LAYER_3D_SOLDERMASK_BOTTOM
|
||||
};
|
||||
|
||||
APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
|
||||
wxWindow* aFocusOwner ) :
|
||||
APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, wxWindow* aFocusOwner ) :
|
||||
APPEARANCE_CONTROLS_3D_BASE( aParent ),
|
||||
m_frame( aParent ),
|
||||
m_focusOwner( aFocusOwner ),
|
||||
@@ -135,15 +175,14 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
|
||||
cfg->m_UseStackupColors = aEvent.IsChecked();
|
||||
|
||||
UpdateLayerCtls();
|
||||
syncLayerPresetSelection();
|
||||
m_frame->NewDisplay( true );
|
||||
} );
|
||||
|
||||
m_cbUseBoardEditorCopperColors = new wxCheckBox( m_panelLayers, wxID_ANY,
|
||||
_( "Use board editor copper colors" ) );
|
||||
_( "Use PCB editor copper colors" ) );
|
||||
m_cbUseBoardEditorCopperColors->SetFont( infoFont );
|
||||
m_cbUseBoardEditorCopperColors->SetToolTip(
|
||||
_( "Use the board editor copper colors (openGL only)" ) );
|
||||
m_cbUseBoardEditorCopperColors->SetToolTip( _( "Use the board editor layer colors for copper "
|
||||
"layers (realtime renderer only)" ) );
|
||||
|
||||
m_cbUseBoardEditorCopperColors->Bind( wxEVT_CHECKBOX,
|
||||
[this]( wxCommandEvent& aEvent )
|
||||
@@ -152,27 +191,24 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
|
||||
cfg->m_Render.use_board_editor_copper_colors = aEvent.IsChecked();
|
||||
|
||||
UpdateLayerCtls();
|
||||
syncLayerPresetSelection();
|
||||
m_frame->NewDisplay( true );
|
||||
} );
|
||||
|
||||
|
||||
m_panelLayersSizer->Add( m_cbUseBoardStackupColors, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 7 );
|
||||
m_panelLayersSizer->Add( m_cbUseBoardStackupColors, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5 );
|
||||
m_panelLayersSizer->Add( m_cbUseBoardEditorCopperColors, 0,
|
||||
wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 7 );
|
||||
wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore color and visibility "
|
||||
"combinations.\n"
|
||||
m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore color and visibility combinations.\n"
|
||||
"Use %s+Tab to activate selector.\n"
|
||||
"Successive Tabs while holding %s down will "
|
||||
"cycle through presets in the popup." ),
|
||||
"Successive Tabs while holding %s down will cycle through "
|
||||
"presets in the popup." ),
|
||||
KeyNameFromKeyCode( PRESET_SWITCH_KEY ),
|
||||
KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) );
|
||||
|
||||
m_cbViewports->SetToolTip( wxString::Format( _( "Save and restore camera position and zoom.\n"
|
||||
"Use %s+Tab to activate selector.\n"
|
||||
"Successive Tabs while holding %s down will "
|
||||
"cycle through viewports in the popup." ),
|
||||
"Successive Tabs while holding %s down will cycle through "
|
||||
"viewports in the popup." ),
|
||||
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ),
|
||||
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) );
|
||||
|
||||
@@ -273,22 +309,19 @@ void APPEARANCE_CONTROLS_3D::CommonSettingsChanged()
|
||||
rebuildControls();
|
||||
|
||||
UpdateLayerCtls();
|
||||
syncLayerPresetSelection();
|
||||
|
||||
const wxString& currentPreset = m_frame->GetAdapter().m_Cfg->m_CurrentPreset;
|
||||
|
||||
if( currentPreset == FOLLOW_PCB || currentPreset == FOLLOW_PLOT_SETTINGS )
|
||||
updateLayerPresetWidget( currentPreset );
|
||||
else
|
||||
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 );
|
||||
}
|
||||
doApplyLayerPreset( aPresetName );
|
||||
|
||||
// Move to front of MRU list
|
||||
if( m_presetMRU.Index( aPresetName ) != wxNOT_FOUND )
|
||||
@@ -420,6 +453,10 @@ void APPEARANCE_CONTROLS_3D::OnLayerVisibilityChanged( int aLayer, bool isVisibl
|
||||
|
||||
default:
|
||||
visibleLayers.set( aLayer, isVisible );
|
||||
|
||||
if( aLayer >= LAYER_3D_USER_1 && aLayer <= LAYER_3D_USER_45 )
|
||||
killFollow = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -435,8 +472,7 @@ void APPEARANCE_CONTROLS_3D::OnLayerVisibilityChanged( int aLayer, bool isVisibl
|
||||
|
||||
if( doFastRefresh && m_frame->GetAdapter().m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
|
||||
{
|
||||
RENDER_3D_OPENGL* renderer =
|
||||
static_cast<RENDER_3D_OPENGL*>( m_frame->GetCanvas()->GetCurrentRender() );
|
||||
RENDER_3D_OPENGL* renderer = static_cast<RENDER_3D_OPENGL*>( m_frame->GetCanvas()->GetCurrentRender() );
|
||||
renderer->Load3dModelsIfNeeded();
|
||||
m_frame->GetCanvas()->Request_refresh();
|
||||
}
|
||||
@@ -453,7 +489,6 @@ void APPEARANCE_CONTROLS_3D::onColorSwatchChanged( COLOR_SWATCH* aSwatch )
|
||||
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
|
||||
|
||||
m_frame->GetAdapter().SetVisibleLayers( visibleLayers );
|
||||
m_frame->GetAdapter().SetLayerColors( colors );
|
||||
|
||||
int layer = aSwatch->GetId();
|
||||
COLOR4D newColor = aSwatch->GetSwatchColor();
|
||||
@@ -467,7 +502,12 @@ void APPEARANCE_CONTROLS_3D::onColorSwatchChanged( COLOR_SWATCH* aSwatch )
|
||||
|
||||
m_frame->GetAdapter().SetLayerColors( colors );
|
||||
|
||||
syncLayerPresetSelection();
|
||||
const wxString& currentPreset = m_frame->GetAdapter().m_Cfg->m_CurrentPreset;
|
||||
|
||||
if( currentPreset == FOLLOW_PCB || currentPreset == FOLLOW_PLOT_SETTINGS )
|
||||
updateLayerPresetWidget( currentPreset );
|
||||
else
|
||||
syncLayerPresetSelection();
|
||||
|
||||
m_frame->NewDisplay( true );
|
||||
}
|
||||
@@ -480,6 +520,7 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers()
|
||||
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
|
||||
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
|
||||
std::map<int, COLOR4D> defaultColors = m_frame->GetAdapter().GetDefaultColors();
|
||||
LSET enabled = m_frame->GetBoard()->GetEnabledLayers();
|
||||
|
||||
m_layerSettings.clear();
|
||||
m_layersOuterSizer->Clear( true );
|
||||
@@ -534,8 +575,13 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers()
|
||||
|
||||
sizer->AddSpacer( 5 );
|
||||
|
||||
wxStaticText* label = new wxStaticText( m_windowLayers, layer,
|
||||
aSetting->GetLabel() );
|
||||
wxString layerName = aSetting->GetLabel();
|
||||
PCB_LAYER_ID boardLayer = Map3DLayerToPCBLayer( layer );
|
||||
|
||||
if( boardLayer != UNDEFINED_LAYER )
|
||||
layerName = m_frame->GetBoard()->GetLayerName( boardLayer );
|
||||
|
||||
wxStaticText* label = new wxStaticText( m_windowLayers, layer, layerName );
|
||||
label->Wrap( -1 );
|
||||
label->SetToolTip( aSetting->GetTooltip() );
|
||||
|
||||
@@ -545,9 +591,10 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers()
|
||||
}
|
||||
else
|
||||
{
|
||||
BITMAP_TOGGLE* btn_visible = new BITMAP_TOGGLE(
|
||||
m_windowLayers, layer, KiBitmapBundle( BITMAPS::visibility ),
|
||||
KiBitmapBundle( BITMAPS::visibility_off ), aSetting->m_Visible );
|
||||
BITMAP_TOGGLE* btn_visible = new BITMAP_TOGGLE( m_windowLayers, layer,
|
||||
KiBitmapBundle( BITMAPS::visibility ),
|
||||
KiBitmapBundle( BITMAPS::visibility_off ),
|
||||
aSetting->m_Visible );
|
||||
|
||||
btn_visible->Bind( TOGGLE_CHANGED,
|
||||
[this]( wxCommandEvent& aEvent )
|
||||
@@ -580,9 +627,18 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers()
|
||||
std::unique_ptr<APPEARANCE_SETTING_3D>& setting = m_layerSettings.back();
|
||||
|
||||
if( setting->m_Spacer )
|
||||
{
|
||||
m_layersOuterSizer->AddSpacer( m_pointSize );
|
||||
}
|
||||
else if( setting->m_Id >= LAYER_3D_USER_1 && setting->m_Id <= LAYER_3D_USER_45 )
|
||||
{
|
||||
if( enabled.test( Map3DLayerToPCBLayer( setting->m_Id ) ) )
|
||||
appendLayer( setting );
|
||||
}
|
||||
else
|
||||
{
|
||||
appendLayer( setting );
|
||||
}
|
||||
|
||||
m_layerSettingsMap[setting->m_Id] = setting.get();
|
||||
}
|
||||
@@ -611,12 +667,8 @@ void APPEARANCE_CONTROLS_3D::UpdateLayerCtls()
|
||||
|
||||
// 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( alg::contains( inStackupColors, setting->m_Id ) && cfg )
|
||||
setting->m_Ctl_color->SetReadOnly( cfg->m_UseStackupColors );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -663,11 +715,8 @@ void APPEARANCE_CONTROLS_3D::syncLayerPresetSelection()
|
||||
presets.begin(), presets.end(),
|
||||
[&]( const LAYER_PRESET_3D& aPreset )
|
||||
{
|
||||
if( aPreset.name.Lower() == _( "legacy colors" )
|
||||
&& m_cbUseBoardStackupColors->GetValue() )
|
||||
{
|
||||
if( aPreset.name.Lower() == _( "legacy colors" ) && m_cbUseBoardStackupColors->GetValue() )
|
||||
return false;
|
||||
}
|
||||
|
||||
for( int layer = LAYER_3D_BOARD; layer < LAYER_3D_END; ++layer )
|
||||
{
|
||||
@@ -731,17 +780,11 @@ void APPEARANCE_CONTROLS_3D::onLayerPresetChanged( wxCommandEvent& aEvent )
|
||||
|
||||
if( index == 0 )
|
||||
{
|
||||
name = FOLLOW_PCB;
|
||||
cfg->m_CurrentPreset = name;
|
||||
UpdateLayerCtls();
|
||||
m_frame->NewDisplay( true );
|
||||
doApplyLayerPreset( FOLLOW_PCB );
|
||||
}
|
||||
else if( index == 1 )
|
||||
{
|
||||
name = FOLLOW_PLOT_SETTINGS;
|
||||
cfg->m_CurrentPreset = name;
|
||||
UpdateLayerCtls();
|
||||
m_frame->NewDisplay( true );
|
||||
doApplyLayerPreset( FOLLOW_PLOT_SETTINGS );
|
||||
}
|
||||
else if( index == count - 3 )
|
||||
{
|
||||
@@ -827,10 +870,9 @@ void APPEARANCE_CONTROLS_3D::onLayerPresetChanged( wxCommandEvent& aEvent )
|
||||
resetSelection();
|
||||
return;
|
||||
}
|
||||
else if( LAYER_PRESET_3D* preset = cfg->FindPreset( m_cbLayerPresets->GetStringSelection() ) )
|
||||
else
|
||||
{
|
||||
name = preset->name;
|
||||
doApplyLayerPreset( *preset );
|
||||
doApplyLayerPreset( m_cbLayerPresets->GetStringSelection() );
|
||||
}
|
||||
|
||||
// Move to front of MRU list
|
||||
@@ -843,16 +885,28 @@ void APPEARANCE_CONTROLS_3D::onLayerPresetChanged( wxCommandEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::doApplyLayerPreset( const LAYER_PRESET_3D& aPreset )
|
||||
void APPEARANCE_CONTROLS_3D::doApplyLayerPreset( const wxString& aPresetName )
|
||||
{
|
||||
BOARD_ADAPTER& adapter = m_frame->GetAdapter();
|
||||
|
||||
adapter.m_Cfg->m_CurrentPreset = aPreset.name;
|
||||
adapter.SetVisibleLayers( aPreset.layers );
|
||||
adapter.SetLayerColors( aPreset.colors );
|
||||
if( aPresetName == FOLLOW_PCB || aPresetName == FOLLOW_PLOT_SETTINGS )
|
||||
{
|
||||
adapter.m_Cfg->m_CurrentPreset = aPresetName;
|
||||
adapter.SetVisibleLayers( adapter.GetVisibleLayers() );
|
||||
}
|
||||
else if( LAYER_PRESET_3D* preset = adapter.m_Cfg->FindPreset( aPresetName ) )
|
||||
{
|
||||
adapter.m_Cfg->m_CurrentPreset = aPresetName;
|
||||
adapter.SetVisibleLayers( preset->layers );
|
||||
adapter.SetLayerColors( preset->colors );
|
||||
|
||||
if( aPreset.name.Lower() == _( "legacy colors" ) )
|
||||
adapter.m_Cfg->m_UseStackupColors = false;
|
||||
if( preset->name.Lower() == _( "legacy colors" ) )
|
||||
adapter.m_Cfg->m_UseStackupColors = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateLayerCtls();
|
||||
m_frame->NewDisplay( true );
|
||||
@@ -922,8 +976,7 @@ void APPEARANCE_CONTROLS_3D::onViewportChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_viewports[name] = VIEWPORT3D( name, m_frame->GetCurrentCamera().GetViewMatrix() );
|
||||
|
||||
index = m_cbViewports->Insert( name, index-1,
|
||||
static_cast<void*>( &m_viewports[name] ) );
|
||||
index = m_cbViewports->Insert( name, index-1, static_cast<void*>( &m_viewports[name] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -157,7 +157,7 @@ private:
|
||||
|
||||
void onLayerPresetChanged( wxCommandEvent& aEvent ) override;
|
||||
|
||||
void doApplyLayerPreset( const LAYER_PRESET_3D& aPreset );
|
||||
void doApplyLayerPreset( const wxString& aPresetName );
|
||||
|
||||
void onViewportChanged( wxCommandEvent& aEvent ) override;
|
||||
void onUpdateViewportsCb( wxUpdateUIEvent& aEvent ) override;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
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 ) );
|
||||
this->SetMinSize( wxSize( 210,360 ) );
|
||||
|
||||
m_sizerOuter = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<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="minimum_size">210,360</property>
|
||||
<property name="name">APPEARANCE_CONTROLS_3D_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
|
||||
@@ -32,7 +32,7 @@ PANEL_3D_OPENGL_OPTIONS_BASE::PANEL_3D_OPENGL_OPTIONS_BASE( wxWindow* parent, wx
|
||||
m_checkBoxBoundingBoxes = new wxCheckBox( this, wxID_ANY, _("Show model bounding boxes"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerMargins->Add( m_checkBoxBoundingBoxes, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkBoxCuThickness = new wxCheckBox( this, wxID_ANY, _("Show copper and tech layers thickness (very slow)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkBoxCuThickness = new wxCheckBox( this, wxID_ANY, _("Show copper and tech layers thickness (slow)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerMargins->Add( m_checkBoxCuThickness, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkBoxHighlightOnRollOver = new wxCheckBox( this, wxID_ANY, _("Highlight items on rollover"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show copper and tech layers thickness (very slow)</property>
|
||||
<property name="label">Show copper and tech layers thickness (slow)</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
||||
@@ -68,8 +68,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() );
|
||||
@@ -225,16 +223,6 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
|
||||
m_previewPane->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
|
||||
m_previewPane->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
|
||||
m_previewPane->SetProjectionMode( cfg->m_Camera.projection_mode );
|
||||
|
||||
// Ensure the board body is always shown, and do not use the settings of the 3D viewer
|
||||
cfg->m_Render.show_copper_top = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_copper_bottom = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_soldermask_top = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_soldermask_bottom = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_solderpaste = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_zones = m_bodyStyleShowAll;
|
||||
cfg->m_Render.show_board_body = m_bodyStyleShowAll;
|
||||
cfg->m_Render.use_board_editor_copper_colors = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +274,7 @@ wxString PANEL_PREVIEW_3D_MODEL::formatRotationValue( double aValue )
|
||||
wxString PANEL_PREVIEW_3D_MODEL::formatOffsetValue( double aValue )
|
||||
{
|
||||
// Convert from internal units (mm) to user units
|
||||
if( m_userUnits == EDA_UNITS::INCHES )
|
||||
if( m_userUnits == EDA_UNITS::INCH )
|
||||
aValue /= 25.4;
|
||||
else if( m_userUnits == EDA_UNITS::MILS )
|
||||
aValue /= 25.4 / 1e3;
|
||||
@@ -405,13 +393,7 @@ void PANEL_PREVIEW_3D_MODEL::setBodyStyleView( wxCommandEvent& event )
|
||||
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;
|
||||
cfg->m_Render.preview_show_board_body = !cfg->m_Render.preview_show_board_body;
|
||||
|
||||
m_previewPane->ReloadRequest();
|
||||
m_previewPane->Refresh();
|
||||
@@ -444,7 +426,9 @@ void PANEL_PREVIEW_3D_MODEL::View3DSettings( wxCommandEvent& event )
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign )
|
||||
{
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
|
||||
wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( event.GetEventObject() );
|
||||
|
||||
wxCHECK( spinCtrl, /* void */ );
|
||||
|
||||
wxTextCtrl * textCtrl = xscale;
|
||||
|
||||
@@ -471,7 +455,10 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
|
||||
{
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
|
||||
wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( aEvent.GetEventObject() );
|
||||
|
||||
wxCHECK( spinCtrl, /* void */ );
|
||||
|
||||
wxTextCtrl* textCtrl = xrot;
|
||||
|
||||
if( spinCtrl == m_spinYrot )
|
||||
@@ -497,7 +484,9 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aS
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign )
|
||||
{
|
||||
wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
|
||||
wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( event.GetEventObject() );
|
||||
|
||||
wxCHECK( spinCtrl, /* void */ );
|
||||
|
||||
wxTextCtrl * textCtrl = xoff;
|
||||
|
||||
@@ -511,7 +500,7 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign
|
||||
if( wxGetMouseState().ShiftDown( ) )
|
||||
step_mm = OFFSET_INCREMENT_MM_FINE;
|
||||
|
||||
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
|
||||
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCH )
|
||||
{
|
||||
step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
|
||||
|
||||
@@ -533,7 +522,9 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::onMouseWheelScale( wxMouseEvent& event )
|
||||
{
|
||||
wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
|
||||
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
|
||||
|
||||
wxCHECK( textCtrl, /* void */ );
|
||||
|
||||
double step = SCALE_INCREMENT;
|
||||
|
||||
@@ -556,7 +547,9 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelScale( wxMouseEvent& event )
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::onMouseWheelRot( wxMouseEvent& event )
|
||||
{
|
||||
wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
|
||||
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
|
||||
|
||||
wxCHECK( textCtrl, /* void */ );
|
||||
|
||||
double step = ROTATION_INCREMENT;
|
||||
|
||||
@@ -579,14 +572,16 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelRot( wxMouseEvent& event )
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::onMouseWheelOffset( wxMouseEvent& event )
|
||||
{
|
||||
wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
|
||||
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
|
||||
|
||||
wxCHECK( textCtrl, /* void */ );
|
||||
|
||||
double step_mm = OFFSET_INCREMENT_MM;
|
||||
|
||||
if( event.ShiftDown( ) )
|
||||
step_mm = OFFSET_INCREMENT_MM_FINE;
|
||||
|
||||
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
|
||||
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCH )
|
||||
{
|
||||
step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;
|
||||
|
||||
|
||||
@@ -222,11 +222,11 @@ private:
|
||||
int m_selected; /// Index into m_parentInfoList
|
||||
|
||||
EDA_UNITS m_userUnits;
|
||||
bool m_bodyStyleShowAll; /// true if the board body is show
|
||||
/// The 3d viewer Render initial settings (must be saved and restored)
|
||||
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender;
|
||||
|
||||
std::unique_ptr<NL_FOOTPRINT_PROPERTIES_PLUGIN> m_spaceMouse;
|
||||
/// The 3d viewer Render initial settings (must be saved and restored)
|
||||
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender;
|
||||
|
||||
std::unique_ptr<NL_FOOTPRINT_PROPERTIES_PLUGIN> m_spaceMouse;
|
||||
};
|
||||
|
||||
#endif // PANEL_PREVIEW_3D_MODEL_H
|
||||
|
||||
@@ -158,7 +158,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Opacity") ), wxVERTICAL );
|
||||
|
||||
m_opacity = new wxSlider( sbSizer4->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
|
||||
sbSizer4->Add( m_opacity, 0, wxRIGHT|wxLEFT, 2 );
|
||||
sbSizer4->Add( m_opacity, 0, wxRIGHT|wxLEFT|wxEXPAND, 2 );
|
||||
|
||||
|
||||
bSizerLeft->Add( sbSizer4, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
@@ -1889,7 +1889,7 @@
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">2</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxSlider" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
||||
+2
-1
@@ -168,9 +168,9 @@
|
||||
Thomas Gambier
|
||||
Ashutosh Gangwar
|
||||
Alessandro Gatti
|
||||
Zenn Geeraerts
|
||||
Alex Gellen
|
||||
Robert Antoni Buj Gelonch
|
||||
Robert Antoni Buj Genlonch
|
||||
Hal Gentz
|
||||
Lucas Gerads
|
||||
Davide Gerhard
|
||||
@@ -228,6 +228,7 @@
|
||||
Mario Hros
|
||||
Hubert Hu
|
||||
Josue Huaroto
|
||||
Eli Hughes
|
||||
Huibean
|
||||
Matt Huszagh
|
||||
José Ignacio
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#
|
||||
|
||||
cmake_minimum_required( VERSION 3.21 FATAL_ERROR )
|
||||
cmake_minimum_required( VERSION 3.22 FATAL_ERROR )
|
||||
|
||||
# Generate DEPFILES without transforming relative paths
|
||||
cmake_policy( SET CMP0116 OLD )
|
||||
@@ -824,7 +824,7 @@ find_package( Pixman 0.30 REQUIRED )
|
||||
include_directories( SYSTEM ${PIXMAN_INCLUDE_DIR} )
|
||||
|
||||
# Find libgit2, required
|
||||
find_package( libgit2 REQUIRED )
|
||||
find_package( libgit2 1.5 REQUIRED )
|
||||
|
||||
# Set include directories for libgit
|
||||
include_directories(${LIBGIT2_INCLUDE_DIRS})
|
||||
|
||||
+74
-47
@@ -1,56 +1,83 @@
|
||||
{
|
||||
"version": 3,
|
||||
"version": 9,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
{
|
||||
"name": "base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"KICAD_BUILD_QA_TESTS": "OFF",
|
||||
"KICAD_BUILD_I18N": "ON",
|
||||
"KICAD_SCRIPTING_WXPYTHON": "ON"
|
||||
}
|
||||
},
|
||||
"cacheVariables": {
|
||||
"KICAD_BUILD_QA_TESTS": "OFF",
|
||||
"KICAD_BUILD_I18N": "ON",
|
||||
"KICAD_SCRIPTING_WXPYTHON": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "win64",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"KICAD_WIN32_DPI_AWARE": "ON",
|
||||
"CMAKE_INSTALL_PREFIX": "out",
|
||||
"CMAKE_PDB_OUTPUT_DIRECTORY": "out/pdb"
|
||||
{
|
||||
"name": "win64",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"KICAD_WIN32_DPI_AWARE": "ON",
|
||||
"CMAKE_INSTALL_PREFIX": "out",
|
||||
"CMAKE_PDB_OUTPUT_DIRECTORY": "out/pdb"
|
||||
},
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"inherits": [
|
||||
"base"
|
||||
]
|
||||
},
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
{
|
||||
"name": "x64-debug",
|
||||
"displayName": "x64 Debug",
|
||||
"description": "Sets debug build type and x64 arch",
|
||||
"inherits": "win64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
"inherits": [
|
||||
"base"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-debug",
|
||||
"displayName": "x64 Debug",
|
||||
"description": "Sets debug build type and x64 arch",
|
||||
"inherits": "win64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
{
|
||||
"name": "x64-release",
|
||||
"displayName": "x64 Release",
|
||||
"description": "Sets release build type",
|
||||
"inherits": "win64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64-release",
|
||||
"displayName": "x64 Release",
|
||||
"description": "Sets release build type",
|
||||
"inherits": "win64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "kicad",
|
||||
"configurePreset": "x64-debug",
|
||||
"configuration": "Debug",
|
||||
"targets": [
|
||||
"install"
|
||||
]
|
||||
}
|
||||
],
|
||||
"workflowPresets": [
|
||||
{
|
||||
"name": "kicad",
|
||||
"description": "kicad",
|
||||
"displayName": "kicad",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "x64-debug"
|
||||
},
|
||||
{
|
||||
"type": "build",
|
||||
"name": "kicad"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+1
-1
@@ -24,7 +24,7 @@ BreakBeforeBraces: Allman
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 100
|
||||
ColumnLimit: 120
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
|
||||
@@ -58,6 +58,30 @@ message GraphicsDefaultsResponse
|
||||
kiapi.board.GraphicsDefaults defaults = 1;
|
||||
}
|
||||
|
||||
enum BoardOriginType
|
||||
{
|
||||
BOT_UNKNOWN = 0;
|
||||
BOT_GRID = 1;
|
||||
BOT_DRILL = 2;
|
||||
}
|
||||
|
||||
// Returns a Vector2 with the specified origin point
|
||||
message GetBoardOrigin
|
||||
{
|
||||
kiapi.common.types.DocumentSpecifier board = 1;
|
||||
|
||||
BoardOriginType type = 2;
|
||||
}
|
||||
|
||||
message SetBoardOrigin
|
||||
{
|
||||
kiapi.common.types.DocumentSpecifier board = 1;
|
||||
|
||||
BoardOriginType type = 2;
|
||||
|
||||
kiapi.common.types.Vector2 origin = 3;
|
||||
}
|
||||
|
||||
/*
|
||||
* Net management
|
||||
*/
|
||||
|
||||
@@ -89,6 +89,42 @@ enum BoardLayer
|
||||
BL_User_8 = 60;
|
||||
BL_User_9 = 61;
|
||||
BL_Rescue = 62;
|
||||
BL_User_10 = 63;
|
||||
BL_User_11 = 64;
|
||||
BL_User_12 = 65;
|
||||
BL_User_13 = 66;
|
||||
BL_User_14 = 67;
|
||||
BL_User_15 = 68;
|
||||
BL_User_16 = 69;
|
||||
BL_User_17 = 70;
|
||||
BL_User_18 = 71;
|
||||
BL_User_19 = 72;
|
||||
BL_User_20 = 73;
|
||||
BL_User_21 = 74;
|
||||
BL_User_22 = 75;
|
||||
BL_User_23 = 76;
|
||||
BL_User_24 = 77;
|
||||
BL_User_25 = 78;
|
||||
BL_User_26 = 79;
|
||||
BL_User_27 = 80;
|
||||
BL_User_28 = 81;
|
||||
BL_User_29 = 82;
|
||||
BL_User_30 = 83;
|
||||
BL_User_31 = 84;
|
||||
BL_User_32 = 85;
|
||||
BL_User_33 = 86;
|
||||
BL_User_34 = 87;
|
||||
BL_User_35 = 88;
|
||||
BL_User_36 = 89;
|
||||
BL_User_37 = 90;
|
||||
BL_User_38 = 91;
|
||||
BL_User_39 = 92;
|
||||
BL_User_40 = 93;
|
||||
BL_User_41 = 94;
|
||||
BL_User_42 = 95;
|
||||
BL_User_43 = 96;
|
||||
BL_User_44 = 97;
|
||||
BL_User_45 = 98;
|
||||
}
|
||||
|
||||
message NetCode
|
||||
@@ -258,15 +294,31 @@ message PadStackLayer
|
||||
|
||||
enum SolderMaskMode
|
||||
{
|
||||
SMM_UNKOWN = 0;
|
||||
SMM_UNKNOWN = 0;
|
||||
SMM_MASKED = 1;
|
||||
SMM_UNMASKED = 2;
|
||||
SMM_FROM_DESIGN_RULES = 3;
|
||||
}
|
||||
|
||||
enum ViaCoveringMode
|
||||
{
|
||||
VCM_UNKNOWN = 0;
|
||||
VCM_COVERED = 1;
|
||||
VCM_UNCOVERED = 2;
|
||||
VCM_FROM_DESIGN_RULES = 3;
|
||||
}
|
||||
|
||||
enum ViaPluggingMode
|
||||
{
|
||||
VPM_UNKNOWN = 0;
|
||||
VPM_PLUGGED = 1;
|
||||
VPM_UNPLUGGED = 2;
|
||||
VPM_FROM_DESIGN_RULES = 3;
|
||||
}
|
||||
|
||||
enum SolderPasteMode
|
||||
{
|
||||
SPM_UNKOWN = 0;
|
||||
SPM_UNKNOWN = 0;
|
||||
SPM_PASTE = 1;
|
||||
SPM_NO_PASTE = 2;
|
||||
SPM_FROM_DESIGN_RULES = 3;
|
||||
@@ -283,6 +335,9 @@ message PadStackOuterLayer
|
||||
|
||||
// NOTE: At present, KiCad does not support different solder paste expansion settings for the top and bottom layers
|
||||
SolderPasteOverrides solder_paste_settings = 4;
|
||||
|
||||
ViaPluggingMode plugging_mode = 5;
|
||||
ViaCoveringMode covering_mode = 6;
|
||||
}
|
||||
|
||||
enum DrillShape
|
||||
@@ -293,6 +348,22 @@ enum DrillShape
|
||||
DS_UNDEFINED = 3;
|
||||
}
|
||||
|
||||
enum ViaDrillCappingMode
|
||||
{
|
||||
VDCM_UNKNOWN = 0;
|
||||
VDCM_CAPPED = 1;
|
||||
VDCM_UNCAPPED = 2;
|
||||
VDCM_FROM_DESIGN_RULES = 3;
|
||||
}
|
||||
|
||||
enum ViaDrillFillingMode
|
||||
{
|
||||
VDFM_UNKNOWN = 0;
|
||||
VDFM_FILLED = 1;
|
||||
VDFM_UNFILLED = 2;
|
||||
VDFM_FROM_DESIGN_RULES = 3;
|
||||
}
|
||||
|
||||
message DrillProperties
|
||||
{
|
||||
// Lowest (closest to F_Cu) layer this drill exists on.
|
||||
@@ -306,6 +377,10 @@ message DrillProperties
|
||||
kiapi.common.types.Vector2 diameter = 3;
|
||||
|
||||
DrillShape shape = 4;
|
||||
|
||||
ViaDrillCappingMode capped = 5;
|
||||
|
||||
ViaDrillFillingMode filled = 6;
|
||||
}
|
||||
|
||||
// A pad stack definition for a multilayer pad or via.
|
||||
@@ -572,6 +647,14 @@ message ZoneFilledPolygons
|
||||
kiapi.common.types.PolySet shapes = 2;
|
||||
}
|
||||
|
||||
message ZoneLayerProperties
|
||||
{
|
||||
BoardLayer layer = 1;
|
||||
|
||||
kiapi.common.types.Vector2 hatching_offset = 2;
|
||||
}
|
||||
|
||||
|
||||
message Zone
|
||||
{
|
||||
kiapi.common.types.KIID id = 1;
|
||||
@@ -598,6 +681,8 @@ message Zone
|
||||
ZoneBorderSettings border = 11;
|
||||
|
||||
kiapi.common.types.LockedState locked = 12;
|
||||
|
||||
repeated ZoneLayerProperties layer_properties = 13;
|
||||
}
|
||||
|
||||
// An aligned dimension is drawn parallel to the line segment between the start and end points
|
||||
@@ -768,6 +853,9 @@ message Field
|
||||
FieldId id = 1;
|
||||
string name = 2;
|
||||
BoardText text = 3;
|
||||
|
||||
// Since 9.0.1
|
||||
bool visible = 4;
|
||||
}
|
||||
|
||||
enum FootprintMountingStyle
|
||||
@@ -821,6 +909,19 @@ message Footprint3DModel
|
||||
double opacity = 6;
|
||||
}
|
||||
|
||||
message JumperGroup
|
||||
{
|
||||
repeated string pad_names = 1;
|
||||
}
|
||||
|
||||
message JumperSettings
|
||||
{
|
||||
/// If true, duplicate pad names in this footprint are jumpered together
|
||||
bool duplicate_names_are_jumpered = 1;
|
||||
|
||||
repeated JumperGroup groups = 2;
|
||||
}
|
||||
|
||||
// A footprint definition (i.e. what would be in a library)
|
||||
message Footprint
|
||||
{
|
||||
@@ -838,6 +939,8 @@ message Footprint
|
||||
|
||||
// All footprint items except for mandatory fields
|
||||
repeated google.protobuf.Any items = 11;
|
||||
|
||||
JumperSettings jumpers = 12;
|
||||
}
|
||||
|
||||
// An instance of a footprint on a board
|
||||
|
||||
@@ -291,7 +291,10 @@ message TextAttributes
|
||||
bool italic = 7;
|
||||
bool bold = 8;
|
||||
bool underlined = 9;
|
||||
|
||||
// Deprecated since 9.0.1 (text items are now always visible, only Fields can be hidden)
|
||||
bool visible = 10;
|
||||
|
||||
bool mirrored = 11;
|
||||
bool multiline = 12;
|
||||
bool keep_upright = 13;
|
||||
@@ -305,7 +308,7 @@ message Text
|
||||
kiapi.common.types.Vector2 position = 2;
|
||||
kiapi.common.types.TextAttributes attributes = 3;
|
||||
|
||||
// Reserved for future use; base objects don't support locking right nos
|
||||
// Reserved for future use; base objects don't support locking right now
|
||||
//kiapi.common.types.LockedState locked = 4;
|
||||
|
||||
string text = 5;
|
||||
@@ -318,7 +321,7 @@ message TextBox
|
||||
kiapi.common.types.Vector2 bottom_right = 3;
|
||||
kiapi.common.types.TextAttributes attributes = 4;
|
||||
|
||||
// Reserved for future use; base objects don't support locking right nos
|
||||
// Reserved for future use; base objects don't support locking right now
|
||||
//kiapi.common.types.LockedState locked = 5;
|
||||
|
||||
string text = 6;
|
||||
|
||||
@@ -84,6 +84,8 @@ enum KiCadObjectType
|
||||
KOT_WSG_TEXT = 48;
|
||||
KOT_WSG_BITMAP = 49;
|
||||
KOT_WSG_PAGE = 50;
|
||||
|
||||
KOT_SCH_GROUP = 51;
|
||||
}
|
||||
|
||||
// Mapped to GR_TEXT_H_ALIGN_T
|
||||
|
||||
@@ -51,7 +51,7 @@ IMAGE_SIZE::IMAGE_SIZE()
|
||||
m_outputSize = 0.0;
|
||||
m_originalDPI = DEFAULT_DPI;
|
||||
m_originalSizePixels = 0;
|
||||
m_unit = EDA_UNITS::MILLIMETRES;
|
||||
m_unit = EDA_UNITS::MM;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
|
||||
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 )
|
||||
if( m_unit == EDA_UNITS::MM )
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
else if( m_unit == EDA_UNITS::INCH )
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
|
||||
else
|
||||
m_outputSize = m_originalDPI;
|
||||
@@ -74,9 +74,9 @@ int IMAGE_SIZE::GetOutputDPI()
|
||||
{
|
||||
int outputDPI;
|
||||
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
if( m_unit == EDA_UNITS::MM )
|
||||
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
else if( m_unit == EDA_UNITS::INCH )
|
||||
outputDPI = GetOriginalSizePixels() / m_outputSize;
|
||||
else
|
||||
outputDPI = KiROUND( m_outputSize );
|
||||
@@ -98,11 +98,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
|
||||
// Convert m_outputSize to mm:
|
||||
double size_mm;
|
||||
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
if( m_unit == EDA_UNITS::MM )
|
||||
{
|
||||
size_mm = m_outputSize;
|
||||
}
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
else if( m_unit == EDA_UNITS::INCH )
|
||||
{
|
||||
size_mm = m_outputSize * 25.4;
|
||||
}
|
||||
@@ -117,11 +117,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
|
||||
}
|
||||
|
||||
// Convert m_outputSize to new value:
|
||||
if( aUnit == EDA_UNITS::MILLIMETRES )
|
||||
if( aUnit == EDA_UNITS::MM )
|
||||
{
|
||||
m_outputSize = size_mm;
|
||||
}
|
||||
else if( aUnit == EDA_UNITS::INCHES )
|
||||
else if( aUnit == EDA_UNITS::INCH )
|
||||
{
|
||||
m_outputSize = size_mm / 25.4;
|
||||
}
|
||||
|
||||
@@ -266,9 +266,9 @@ wxString BITMAP2CMP_PANEL::formatOutputSize( double aSize )
|
||||
{
|
||||
wxString text;
|
||||
|
||||
if( getUnitFromSelection() == EDA_UNITS::MILLIMETRES )
|
||||
if( getUnitFromSelection() == EDA_UNITS::MM )
|
||||
text.Printf( wxS( "%.1f" ), aSize );
|
||||
else if( getUnitFromSelection() == EDA_UNITS::INCHES )
|
||||
else if( getUnitFromSelection() == EDA_UNITS::INCH )
|
||||
text.Printf( wxS( "%.2f" ), aSize );
|
||||
else
|
||||
text.Printf( wxT( "%d" ), KiROUND( aSize ) );
|
||||
@@ -295,10 +295,10 @@ 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 1: return EDA_UNITS::INCH;
|
||||
case 2: return EDA_UNITS::UNSCALED;
|
||||
case 0:
|
||||
default: return EDA_UNITS::MILLIMETRES;
|
||||
default: return EDA_UNITS::MM;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -48,9 +48,7 @@ set( OCC_LIBS_COMMON
|
||||
TKLCAF
|
||||
TKMath
|
||||
TKMesh
|
||||
TKMeshVS
|
||||
TKOffset
|
||||
TKOpenGl
|
||||
TKPrim
|
||||
TKRWMesh
|
||||
TKService
|
||||
@@ -138,6 +136,7 @@ else(WIN32)
|
||||
HINTS
|
||||
${OCC_LIBRARY_DIR}
|
||||
/usr
|
||||
/usr/opencascade
|
||||
/usr/local
|
||||
/usr/local/opencascade
|
||||
/opt/opencascade
|
||||
|
||||
@@ -37,7 +37,7 @@ unset(_Python_NAMES)
|
||||
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
set(_PYTHON3_VERSIONS 3.14 3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
|
||||
# Disabling the "search every possible place" code for now
|
||||
# see https://gitlab.com/kicad/code/kicad/-/issues/8553
|
||||
|
||||
@@ -44,7 +44,7 @@ cmake_find_frameworks(Python)
|
||||
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
set(_PYTHON3_VERSIONS 3.14 3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
|
||||
if(PythonLibs_FIND_VERSION)
|
||||
if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
# KiCad.
|
||||
#
|
||||
# Note: This version string should follow the semantic versioning system
|
||||
set( KICAD_SEMANTIC_VERSION "9.0.0-unknown" )
|
||||
set( KICAD_SEMANTIC_VERSION "9.99.0-unknown" )
|
||||
|
||||
# Default the version to the semantic version.
|
||||
# This is overridden by the git repository tag though (if using git)
|
||||
|
||||
+30
-2
@@ -72,6 +72,7 @@ set( KICOMMON_SRCS
|
||||
jobs/job_export_pcb_gerber.cpp
|
||||
jobs/job_export_pcb_gerbers.cpp
|
||||
jobs/job_export_pcb_ipc2581.cpp
|
||||
jobs/job_export_pcb_ipcd356.cpp
|
||||
jobs/job_export_pcb_odb.cpp
|
||||
jobs/job_export_pcb_pdf.cpp
|
||||
jobs/job_export_pcb_plot.cpp
|
||||
@@ -112,10 +113,15 @@ set( KICOMMON_SRCS
|
||||
settings/settings_manager.cpp
|
||||
|
||||
project/board_project_settings.cpp
|
||||
project/component_class_settings.cpp
|
||||
project/net_settings.cpp
|
||||
project/project_archiver.cpp
|
||||
project/project_file.cpp
|
||||
project/project_local_settings.cpp
|
||||
project/time_domain_parameters.cpp
|
||||
|
||||
# This is basically a settings object, but for the toolbar
|
||||
tool/ui/toolbar_configuration.cpp
|
||||
|
||||
dialogs/dialog_migrate_settings.cpp
|
||||
dialogs/dialog_migrate_settings_base.cpp
|
||||
@@ -348,6 +354,8 @@ set( COMMON_DLG_SRCS
|
||||
dialogs/dialog_color_picker_base.cpp
|
||||
dialogs/dialog_configure_paths.cpp
|
||||
dialogs/dialog_configure_paths_base.cpp
|
||||
dialogs/dialog_design_block_properties.cpp
|
||||
dialogs/dialog_design_block_properties_base.cpp
|
||||
dialogs/dialog_display_html_text_base.cpp
|
||||
dialogs/dialog_edit_library_tables.cpp
|
||||
dialogs/dialog_embed_files.cpp
|
||||
@@ -356,6 +364,8 @@ set( COMMON_DLG_SRCS
|
||||
dialogs/dialog_global_design_block_lib_table_config.cpp
|
||||
dialogs/dialog_grid_settings.cpp
|
||||
dialogs/dialog_grid_settings_base.cpp
|
||||
dialogs/dialog_group_properties.cpp
|
||||
dialogs/dialog_group_properties_base.cpp
|
||||
dialogs/dialog_hotkey_list.cpp
|
||||
dialogs/dialog_HTML_reporter_base.cpp
|
||||
dialogs/dialog_import_choose_project.cpp
|
||||
@@ -404,10 +414,15 @@ set( COMMON_DLG_SRCS
|
||||
dialogs/panel_plugin_settings.cpp
|
||||
dialogs/panel_plugin_settings_base.cpp
|
||||
dialogs/panel_setup_netclasses.cpp
|
||||
dialogs/panel_printer_list.cpp
|
||||
dialogs/panel_printer_list_base.cpp
|
||||
|
||||
dialogs/panel_setup_netclasses_base.cpp
|
||||
dialogs/panel_setup_severities.cpp
|
||||
dialogs/panel_text_variables.cpp
|
||||
dialogs/panel_text_variables_base.cpp
|
||||
dialogs/panel_toolbar_customization.cpp
|
||||
dialogs/panel_toolbar_customization_base.cpp
|
||||
)
|
||||
|
||||
if( KICAD_USE_SENTRY )
|
||||
@@ -421,6 +436,7 @@ set( COMMON_WIDGET_SRCS
|
||||
widgets/bitmap_toggle.cpp
|
||||
widgets/button_row_panel.cpp
|
||||
widgets/color_swatch.cpp
|
||||
widgets/design_block_pane.cpp
|
||||
widgets/filter_combobox.cpp
|
||||
widgets/font_choice.cpp
|
||||
widgets/footprint_choice.cpp
|
||||
@@ -431,6 +447,7 @@ set( COMMON_WIDGET_SRCS
|
||||
widgets/gal_options_panel_base.cpp
|
||||
widgets/grid_bitmap_toggle.cpp
|
||||
widgets/grid_button.cpp
|
||||
widgets/grid_checkbox.cpp
|
||||
widgets/grid_color_swatch_helpers.cpp
|
||||
widgets/grid_combobox.cpp
|
||||
widgets/grid_icon_text_helpers.cpp
|
||||
@@ -445,6 +462,7 @@ set( COMMON_WIDGET_SRCS
|
||||
widgets/mathplot.cpp
|
||||
widgets/msgpanel.cpp
|
||||
widgets/paged_dialog.cpp
|
||||
widgets/panel_design_block_chooser.cpp
|
||||
widgets/properties_panel.cpp
|
||||
widgets/search_pane.cpp
|
||||
widgets/search_pane_base.cpp
|
||||
@@ -585,6 +603,7 @@ set( COMMON_SRCS
|
||||
eda_dde.cpp
|
||||
eda_doc.cpp
|
||||
eda_draw_frame.cpp
|
||||
eda_group.cpp
|
||||
eda_item.cpp
|
||||
eda_shape.cpp
|
||||
eda_text.cpp
|
||||
@@ -606,6 +625,7 @@ set( COMMON_SRCS
|
||||
lib_table_grid_tricks.cpp
|
||||
lib_tree_model.cpp
|
||||
lib_tree_model_adapter.cpp
|
||||
design_block_tree_model_adapter.cpp
|
||||
marker_base.cpp
|
||||
origin_transforms.cpp
|
||||
printout.cpp
|
||||
@@ -639,12 +659,14 @@ set( COMMON_SRCS
|
||||
tool/construction_manager.cpp
|
||||
tool/common_tools.cpp
|
||||
tool/conditional_menu.cpp
|
||||
tool/design_block_control.cpp
|
||||
tool/edit_constraints.cpp
|
||||
tool/edit_points.cpp
|
||||
tool/editor_conditions.cpp
|
||||
tool/embed_tool.cpp
|
||||
tool/grid_helper.cpp
|
||||
tool/grid_menu.cpp
|
||||
tool/group_tool.cpp
|
||||
tool/library_editor_control.cpp
|
||||
tool/picker_tool.cpp
|
||||
tool/point_editor_behavior.cpp
|
||||
@@ -766,7 +788,10 @@ set( PCB_COMMON_SRCS
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/teardrop/teardrop_parameters.cpp #needed by board_design_settings.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/router/pns_meander.cpp #needed by board_design_settings.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/board.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/component_class_manager.cpp #needed by board.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/component_classes/component_class.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/component_classes/component_class_assignment_rule.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/component_classes/component_class_cache_proxy.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/component_classes/component_class_manager.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/board_item.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_dimension.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_shape.cpp
|
||||
@@ -810,7 +835,6 @@ set( PCB_COMMON_SRCS
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/kicad_netlist_reader.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/legacy_netlist_reader.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/netlist_reader.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pad_custom_shape_functions.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_draw_panel_gal.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/pcb_netlist.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_origin_transforms.cpp
|
||||
@@ -841,6 +865,10 @@ set( PCB_COMMON_SRCS
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_editor_conditions.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/tools/pcb_viewer_tools.cpp
|
||||
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/length_delay_calculation/length_delay_calculation.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/length_delay_calculation/length_delay_calculation_item.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/length_delay_calculation/time_domain_parameters_user_defined.cpp
|
||||
|
||||
widgets/net_selector.cpp
|
||||
)
|
||||
|
||||
|
||||
+26
-23
@@ -98,13 +98,10 @@ static const wxChar AllowManualCanvasScale[] = wxT( "AllowManualCanvasScale" );
|
||||
static const wxChar UpdateUIEventInterval[] = wxT( "UpdateUIEventInterval" );
|
||||
static const wxChar V3DRT_BevelHeight_um[] = wxT( "V3DRT_BevelHeight_um" );
|
||||
static const wxChar V3DRT_BevelExtentFactor[] = wxT( "V3DRT_BevelExtentFactor" );
|
||||
static const wxChar EnableDesignBlocks[] = wxT( "EnableDesignBlocks" );
|
||||
static const wxChar EnablePcbDesignBlocks[] = wxT( "EnablePcbDesignBlocks" );
|
||||
static const wxChar EnableGenerators[] = wxT( "EnableGenerators" );
|
||||
static const wxChar EnableGit[] = wxT( "EnableGit" );
|
||||
static const wxChar EnableLibWithText[] = wxT( "EnableLibWithText" );
|
||||
static const wxChar EnableLibDir[] = wxT( "EnableLibDir" );
|
||||
static const wxChar EnableEeschemaPrintCairo[] = wxT( "EnableEeschemaPrintCairo" );
|
||||
static const wxChar EnableEeschemaExportClipboardCairo[] = wxT( "EnableEeschemaExportClipboardCairo" );
|
||||
static const wxChar DisambiguationTime[] = wxT( "DisambiguationTime" );
|
||||
static const wxChar PcbSelectionVisibilityRatio[] = wxT( "PcbSelectionVisibilityRatio" );
|
||||
static const wxChar FontErrorSize[] = wxT( "FontErrorSize" );
|
||||
@@ -127,6 +124,9 @@ static const wxChar MsgPanelShowUuids[] = wxT( "MsgPanelShowUuids" );
|
||||
static const wxChar MaximumThreads[] = wxT( "MaximumThreads" );
|
||||
static const wxChar NetInspectorBulkUpdateOptimisationThreshold[] =
|
||||
wxT( "NetInspectorBulkUpdateOptimisationThreshold" );
|
||||
static const wxChar ExcludeFromSimulationLineWidth[] = wxT( "ExcludeFromSimulationLineWidth" );
|
||||
static const wxChar GitIconRefreshInterval[] = wxT( "GitIconRefreshInterval" );
|
||||
static const wxChar ConfigurableToolbars[] = wxT( "ConfigurableToolbars" );
|
||||
|
||||
} // namespace KEYS
|
||||
|
||||
@@ -255,15 +255,11 @@ ADVANCED_CFG::ADVANCED_CFG()
|
||||
m_CompactSave = false;
|
||||
m_UpdateUIEventInterval = 0;
|
||||
m_ShowRepairSchematic = false;
|
||||
m_EnableDesignBlocks = true;
|
||||
m_EnablePcbDesignBlocks = false;
|
||||
m_EnableGenerators = false;
|
||||
m_EnableGit = true;
|
||||
m_EnableLibWithText = false;
|
||||
m_EnableLibDir = false;
|
||||
|
||||
m_EnableEeschemaPrintCairo = true;
|
||||
m_EnableEeschemaExportClipboardCairo = true;
|
||||
|
||||
m_3DRT_BevelHeight_um = 30;
|
||||
m_3DRT_BevelExtentFactor = 1.0 / 16.0;
|
||||
|
||||
@@ -305,7 +301,13 @@ ADVANCED_CFG::ADVANCED_CFG()
|
||||
|
||||
m_MinimumMarkerSeparationDistance = 0.15;
|
||||
|
||||
m_NetInspectorBulkUpdateOptimisationThreshold = 25;
|
||||
m_NetInspectorBulkUpdateOptimisationThreshold = 100;
|
||||
|
||||
m_ExcludeFromSimulationLineWidth = 25;
|
||||
|
||||
m_GitIconRefreshInterval = 10000;
|
||||
|
||||
m_ConfigurableToolbars = false;
|
||||
|
||||
loadFromConfigFile();
|
||||
}
|
||||
@@ -487,8 +489,8 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
m_DisambiguationMenuDelay,
|
||||
50, 10000 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableDesignBlocks,
|
||||
&m_EnableDesignBlocks, m_EnableDesignBlocks ) );
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnablePcbDesignBlocks, &m_EnablePcbDesignBlocks,
|
||||
m_EnablePcbDesignBlocks ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableGenerators,
|
||||
&m_EnableGenerators, m_EnableGenerators ) );
|
||||
@@ -496,23 +498,12 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableAPILogging,
|
||||
&m_EnableAPILogging, m_EnableAPILogging ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableGit,
|
||||
&m_EnableGit, m_EnableGit ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableLibWithText,
|
||||
&m_EnableLibWithText, m_EnableLibWithText ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableLibDir,
|
||||
&m_EnableLibDir, m_EnableLibDir ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableEeschemaPrintCairo,
|
||||
&m_EnableEeschemaPrintCairo,
|
||||
m_EnableEeschemaPrintCairo ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableEeschemaExportClipboardCairo,
|
||||
&m_EnableEeschemaExportClipboardCairo,
|
||||
m_EnableEeschemaExportClipboardCairo ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::PcbSelectionVisibilityRatio,
|
||||
&m_PcbSelectionVisibilityRatio,
|
||||
m_PcbSelectionVisibilityRatio, 0.0, 1.0 ) );
|
||||
@@ -592,6 +583,18 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
&m_NetInspectorBulkUpdateOptimisationThreshold,
|
||||
m_NetInspectorBulkUpdateOptimisationThreshold, 0, 1000 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::ExcludeFromSimulationLineWidth,
|
||||
&m_ExcludeFromSimulationLineWidth,
|
||||
m_ExcludeFromSimulationLineWidth, 1, 100 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::GitIconRefreshInterval,
|
||||
&m_GitIconRefreshInterval,
|
||||
m_GitIconRefreshInterval, 0, 100000 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ConfigurableToolbars,
|
||||
&m_ConfigurableToolbars,
|
||||
m_ConfigurableToolbars ) );
|
||||
|
||||
// Special case for trace mask setting...we just grab them and set them immediately
|
||||
// Because we even use wxLogTrace inside of advanced config
|
||||
wxString traceMasks;
|
||||
|
||||
@@ -53,6 +53,7 @@ KICAD_T FromProtoEnum( types::KiCadObjectType aValue )
|
||||
case types::KiCadObjectType::KOT_PCB_DIMENSION: return PCB_DIMENSION_T;
|
||||
case types::KiCadObjectType::KOT_PCB_ZONE: return PCB_ZONE_T;
|
||||
case types::KiCadObjectType::KOT_PCB_GROUP: return PCB_GROUP_T;
|
||||
case types::KiCadObjectType::KOT_SCH_GROUP: return SCH_GROUP_T;
|
||||
case types::KiCadObjectType::KOT_SCH_MARKER: return SCH_MARKER_T;
|
||||
case types::KiCadObjectType::KOT_SCH_JUNCTION: return SCH_JUNCTION_T;
|
||||
case types::KiCadObjectType::KOT_SCH_NO_CONNECT: return SCH_NO_CONNECT_T;
|
||||
@@ -126,6 +127,7 @@ types::KiCadObjectType ToProtoEnum( KICAD_T aValue )
|
||||
case SCH_TABLECELL_T: return types::KiCadObjectType::KOT_SCH_TABLECELL;
|
||||
case SCH_LABEL_T: return types::KiCadObjectType::KOT_SCH_LABEL;
|
||||
case SCH_GLOBAL_LABEL_T: return types::KiCadObjectType::KOT_SCH_GLOBAL_LABEL;
|
||||
case SCH_GROUP_T: return types::KiCadObjectType::KOT_SCH_GROUP;
|
||||
case SCH_HIER_LABEL_T: return types::KiCadObjectType::KOT_SCH_HIER_LABEL;
|
||||
case SCH_DIRECTIVE_LABEL_T: return types::KiCadObjectType::KOT_SCH_DIRECTIVE_LABEL;
|
||||
case SCH_FIELD_T: return types::KiCadObjectType::KOT_SCH_FIELD;
|
||||
@@ -214,6 +216,42 @@ PCB_LAYER_ID FromProtoEnum( board::types::BoardLayer aValue )
|
||||
case board::types::BoardLayer::BL_User_8: return User_8;
|
||||
case board::types::BoardLayer::BL_User_9: return User_9;
|
||||
case board::types::BoardLayer::BL_Rescue: return Rescue;
|
||||
case board::types::BoardLayer::BL_User_10: return User_10;
|
||||
case board::types::BoardLayer::BL_User_11: return User_11;
|
||||
case board::types::BoardLayer::BL_User_12: return User_12;
|
||||
case board::types::BoardLayer::BL_User_13: return User_13;
|
||||
case board::types::BoardLayer::BL_User_14: return User_14;
|
||||
case board::types::BoardLayer::BL_User_15: return User_15;
|
||||
case board::types::BoardLayer::BL_User_16: return User_16;
|
||||
case board::types::BoardLayer::BL_User_17: return User_17;
|
||||
case board::types::BoardLayer::BL_User_18: return User_18;
|
||||
case board::types::BoardLayer::BL_User_19: return User_19;
|
||||
case board::types::BoardLayer::BL_User_20: return User_20;
|
||||
case board::types::BoardLayer::BL_User_21: return User_21;
|
||||
case board::types::BoardLayer::BL_User_22: return User_22;
|
||||
case board::types::BoardLayer::BL_User_23: return User_23;
|
||||
case board::types::BoardLayer::BL_User_24: return User_24;
|
||||
case board::types::BoardLayer::BL_User_25: return User_25;
|
||||
case board::types::BoardLayer::BL_User_26: return User_26;
|
||||
case board::types::BoardLayer::BL_User_27: return User_27;
|
||||
case board::types::BoardLayer::BL_User_28: return User_28;
|
||||
case board::types::BoardLayer::BL_User_29: return User_29;
|
||||
case board::types::BoardLayer::BL_User_30: return User_30;
|
||||
case board::types::BoardLayer::BL_User_31: return User_31;
|
||||
case board::types::BoardLayer::BL_User_32: return User_32;
|
||||
case board::types::BoardLayer::BL_User_33: return User_33;
|
||||
case board::types::BoardLayer::BL_User_34: return User_34;
|
||||
case board::types::BoardLayer::BL_User_35: return User_35;
|
||||
case board::types::BoardLayer::BL_User_36: return User_36;
|
||||
case board::types::BoardLayer::BL_User_37: return User_37;
|
||||
case board::types::BoardLayer::BL_User_38: return User_38;
|
||||
case board::types::BoardLayer::BL_User_39: return User_39;
|
||||
case board::types::BoardLayer::BL_User_40: return User_40;
|
||||
case board::types::BoardLayer::BL_User_41: return User_41;
|
||||
case board::types::BoardLayer::BL_User_42: return User_42;
|
||||
case board::types::BoardLayer::BL_User_43: return User_43;
|
||||
case board::types::BoardLayer::BL_User_44: return User_44;
|
||||
case board::types::BoardLayer::BL_User_45: return User_45;
|
||||
|
||||
case board::types::BoardLayer::BL_UNKNOWN: return UNDEFINED_LAYER;
|
||||
default:
|
||||
@@ -290,6 +328,42 @@ board::types::BoardLayer ToProtoEnum( PCB_LAYER_ID aValue )
|
||||
case User_8: return board::types::BoardLayer::BL_User_8;
|
||||
case User_9: return board::types::BoardLayer::BL_User_9;
|
||||
case Rescue: return board::types::BoardLayer::BL_Rescue;
|
||||
case User_10: return board::types::BoardLayer::BL_User_10;
|
||||
case User_11: return board::types::BoardLayer::BL_User_11;
|
||||
case User_12: return board::types::BoardLayer::BL_User_12;
|
||||
case User_13: return board::types::BoardLayer::BL_User_13;
|
||||
case User_14: return board::types::BoardLayer::BL_User_14;
|
||||
case User_15: return board::types::BoardLayer::BL_User_15;
|
||||
case User_16: return board::types::BoardLayer::BL_User_16;
|
||||
case User_17: return board::types::BoardLayer::BL_User_17;
|
||||
case User_18: return board::types::BoardLayer::BL_User_18;
|
||||
case User_19: return board::types::BoardLayer::BL_User_19;
|
||||
case User_20: return board::types::BoardLayer::BL_User_20;
|
||||
case User_21: return board::types::BoardLayer::BL_User_21;
|
||||
case User_22: return board::types::BoardLayer::BL_User_22;
|
||||
case User_23: return board::types::BoardLayer::BL_User_23;
|
||||
case User_24: return board::types::BoardLayer::BL_User_24;
|
||||
case User_25: return board::types::BoardLayer::BL_User_25;
|
||||
case User_26: return board::types::BoardLayer::BL_User_26;
|
||||
case User_27: return board::types::BoardLayer::BL_User_27;
|
||||
case User_28: return board::types::BoardLayer::BL_User_28;
|
||||
case User_29: return board::types::BoardLayer::BL_User_29;
|
||||
case User_30: return board::types::BoardLayer::BL_User_30;
|
||||
case User_31: return board::types::BoardLayer::BL_User_31;
|
||||
case User_32: return board::types::BoardLayer::BL_User_32;
|
||||
case User_33: return board::types::BoardLayer::BL_User_33;
|
||||
case User_34: return board::types::BoardLayer::BL_User_34;
|
||||
case User_35: return board::types::BoardLayer::BL_User_35;
|
||||
case User_36: return board::types::BoardLayer::BL_User_36;
|
||||
case User_37: return board::types::BoardLayer::BL_User_37;
|
||||
case User_38: return board::types::BoardLayer::BL_User_38;
|
||||
case User_39: return board::types::BoardLayer::BL_User_39;
|
||||
case User_40: return board::types::BoardLayer::BL_User_40;
|
||||
case User_41: return board::types::BoardLayer::BL_User_41;
|
||||
case User_42: return board::types::BoardLayer::BL_User_42;
|
||||
case User_43: return board::types::BoardLayer::BL_User_43;
|
||||
case User_44: return board::types::BoardLayer::BL_User_44;
|
||||
case User_45: return board::types::BoardLayer::BL_User_45;
|
||||
default:
|
||||
wxCHECK_MSG( false, board::types::BoardLayer::BL_UNKNOWN,
|
||||
"Unhandled case in ToProtoEnum<PCB_LAYER_ID>");
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <json_common.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/regex.h>
|
||||
#include <wx/stdstream.h>
|
||||
|
||||
@@ -142,6 +142,7 @@ COMMIT& COMMIT::createModified( EDA_ITEM* aItem, EDA_ITEM* aCopy, int aExtraFlag
|
||||
|
||||
if( m_changedItems.find( parent ) != m_changedItems.end() )
|
||||
{
|
||||
aCopy->SetParentGroup( nullptr );
|
||||
delete aCopy;
|
||||
return *this; // item has been already modified once
|
||||
}
|
||||
|
||||
+5
-3
@@ -118,11 +118,12 @@ wxString ExpandTextVars( const wxString& aSource,
|
||||
}
|
||||
|
||||
|
||||
wxString GetTextVars( const wxString& aSource )
|
||||
wxString GetGeneratedFieldDisplayName( const wxString& aSource )
|
||||
{
|
||||
std::function<bool( wxString* )> tokenExtractor =
|
||||
[&]( wxString* token ) -> bool
|
||||
{
|
||||
*token = *token; // token value is the token name
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -130,9 +131,10 @@ wxString GetTextVars( const wxString& aSource )
|
||||
}
|
||||
|
||||
|
||||
bool IsTextVar( const wxString& aSource )
|
||||
bool IsGeneratedField( const wxString& aSource )
|
||||
{
|
||||
return aSource.StartsWith( wxS( "${" ) );
|
||||
static wxRegEx expr( wxS( "^\\$\\{\\w*\\}$" ) );
|
||||
return expr.Matches( aSource );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-4
@@ -167,7 +167,7 @@ int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxStrin
|
||||
|
||||
|
||||
// DisplayError should be deprecated, use DisplayErrorMessage instead
|
||||
void DisplayError( wxWindow* aParent, const wxString& aText, int aDisplayTime )
|
||||
void DisplayError( wxWindow* aParent, const wxString& aText )
|
||||
{
|
||||
if( !wxTheApp || !wxTheApp->IsMainLoopRunning() )
|
||||
{
|
||||
@@ -182,10 +182,9 @@ void DisplayError( wxWindow* aParent, const wxString& aText, int aDisplayTime )
|
||||
}
|
||||
|
||||
wxMessageDialog* dlg;
|
||||
int icon = aDisplayTime > 0 ? wxICON_INFORMATION : wxICON_ERROR;
|
||||
|
||||
dlg = new wxMessageDialog( aParent, aText, _( "Warning" ),
|
||||
wxOK | wxCENTRE | wxRESIZE_BORDER | icon | wxSTAY_ON_TOP );
|
||||
dlg = new wxMessageDialog( aParent, aText, _( "Error" ),
|
||||
wxOK | wxCENTRE | wxRESIZE_BORDER | wxICON_ERROR | wxSTAY_ON_TOP );
|
||||
|
||||
dlg->ShowModal();
|
||||
dlg->Destroy();
|
||||
|
||||
+13
-3
@@ -21,9 +21,13 @@
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef DESIGN_BLOCK_H
|
||||
#define DESIGN_BLOCK_H
|
||||
|
||||
#include <kicommon.h>
|
||||
#include <lib_id.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <json_common.h>
|
||||
|
||||
|
||||
class KICOMMON_API DESIGN_BLOCK
|
||||
@@ -41,6 +45,9 @@ public:
|
||||
const wxString& GetSchematicFile() const { return m_schematicFile; }
|
||||
void SetSchematicFile( const wxString& aFile ) { m_schematicFile = aFile; }
|
||||
|
||||
const wxString& GetBoardFile() const { return m_boardFile; }
|
||||
void SetBoardFile( const wxString& aFile ) { m_boardFile = aFile; }
|
||||
|
||||
void SetFields( nlohmann::ordered_map<wxString, wxString>& aFields )
|
||||
{
|
||||
m_fields = std::move( aFields );
|
||||
@@ -55,9 +62,12 @@ public:
|
||||
|
||||
private:
|
||||
LIB_ID m_lib_id;
|
||||
wxString m_schematicFile; ///< File name and path for schematic symbol.
|
||||
wxString m_schematicFile; ///< File name and path for schematic file.
|
||||
wxString m_boardFile; ///< File name and path for board file
|
||||
wxString m_libDescription; ///< File name and path for documentation file.
|
||||
wxString m_keywords; ///< Search keywords to find footprint in library.
|
||||
wxString m_keywords; ///< Search keywords to find design block in library.
|
||||
|
||||
nlohmann::ordered_map<wxString, wxString> m_fields;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -72,7 +72,9 @@ std::vector<SEARCH_TERM> DESIGN_BLOCK_INFO::GetSearchTerms()
|
||||
{
|
||||
std::vector<SEARCH_TERM> terms;
|
||||
|
||||
terms.emplace_back( SEARCH_TERM( GetLibNickname(), 4 ) );
|
||||
terms.emplace_back( SEARCH_TERM( GetName(), 8 ) );
|
||||
terms.emplace_back( SEARCH_TERM( GetLIB_ID().Format(), 16 ) );
|
||||
|
||||
wxStringTokenizer keywordTokenizer( GetKeywords(), wxS( " " ), wxTOKEN_STRTOK );
|
||||
|
||||
|
||||
+76
-23
@@ -74,8 +74,10 @@ DESIGN_BLOCK_IO_MGR::DESIGN_BLOCK_FILE_T
|
||||
DESIGN_BLOCK_IO_MGR::GuessPluginTypeFromLibPath( const wxString& aLibPath, int aCtl )
|
||||
{
|
||||
if( IO_RELEASER<DESIGN_BLOCK_IO>( FindPlugin( KICAD_SEXP ) )->CanReadLibrary( aLibPath )
|
||||
&& aCtl != KICTL_NONKICAD_ONLY )
|
||||
&& aCtl != KICTL_NONKICAD_ONLY )
|
||||
{
|
||||
return KICAD_SEXP;
|
||||
}
|
||||
|
||||
return DESIGN_BLOCK_IO_MGR::FILE_TYPE_NONE;
|
||||
}
|
||||
@@ -265,7 +267,9 @@ void DESIGN_BLOCK_IO::DesignBlockEnumerate( wxArrayString& aDesignBlockNames,
|
||||
wxDir dir( aLibraryPath );
|
||||
|
||||
if( !dir.IsOpened() )
|
||||
return;
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "Design block '%s' does not exist." ), aLibraryPath ) );
|
||||
}
|
||||
|
||||
wxString dirname;
|
||||
wxString fileSpec = wxT( "*." ) + wxString( FILEEXT::KiCadDesignBlockPathExtension );
|
||||
@@ -287,17 +291,23 @@ DESIGN_BLOCK* DESIGN_BLOCK_IO::DesignBlockLoad( const wxString& aLibraryPath,
|
||||
+ FILEEXT::KiCadDesignBlockPathExtension + wxFileName::GetPathSeparator();
|
||||
wxString dbSchPath = dbPath + aDesignBlockName + wxT( "." )
|
||||
+ FILEEXT::KiCadSchematicFileExtension;
|
||||
wxString dbPcbPath = dbPath + aDesignBlockName + wxT( "." ) + FILEEXT::KiCadPcbFileExtension;
|
||||
wxString dbMetadataPath = dbPath + aDesignBlockName + wxT( "." ) + FILEEXT::JsonFileExtension;
|
||||
|
||||
if( !wxFileExists( dbSchPath ) )
|
||||
return nullptr;
|
||||
if( !wxDir::Exists( dbPath ) )
|
||||
THROW_IO_ERROR( wxString::Format( _( "Design block '%s' does not exist." ), dbPath ) );
|
||||
|
||||
DESIGN_BLOCK* newDB = new DESIGN_BLOCK();
|
||||
|
||||
// Library name needs to be empty for when we fill it in with the correct library nickname
|
||||
// one layer above
|
||||
newDB->SetLibId( LIB_ID( wxEmptyString, aDesignBlockName ) );
|
||||
newDB->SetSchematicFile( dbSchPath );
|
||||
|
||||
if( wxFileExists( dbSchPath ) )
|
||||
newDB->SetSchematicFile( dbSchPath );
|
||||
|
||||
if( wxFileExists( dbPcbPath ) )
|
||||
newDB->SetBoardFile( dbPcbPath );
|
||||
|
||||
// Parse the JSON file if it exists
|
||||
if( wxFileExists( dbMetadataPath ) )
|
||||
@@ -333,16 +343,27 @@ DESIGN_BLOCK* DESIGN_BLOCK_IO::DesignBlockLoad( const wxString& aLibraryPath,
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
delete newDB;
|
||||
THROW_IO_ERROR( wxString::Format(
|
||||
_( "Design block metadata file '%s' could not be read." ), dbMetadataPath ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return newDB;
|
||||
}
|
||||
|
||||
|
||||
bool DESIGN_BLOCK_IO::DesignBlockExists( const wxString& aLibraryPath,
|
||||
const wxString& aDesignBlockName,
|
||||
const std::map<std::string, UTF8>* aProperties )
|
||||
{
|
||||
wxString dbPath = aLibraryPath + wxFileName::GetPathSeparator() + aDesignBlockName + wxT( "." )
|
||||
+ FILEEXT::KiCadDesignBlockPathExtension + wxFileName::GetPathSeparator();
|
||||
|
||||
return wxDir::Exists( dbPath );
|
||||
}
|
||||
|
||||
|
||||
void DESIGN_BLOCK_IO::DesignBlockSave( const wxString& aLibraryPath,
|
||||
const DESIGN_BLOCK* aDesignBlock,
|
||||
const std::map<std::string, UTF8>* aProperties )
|
||||
@@ -353,12 +374,23 @@ void DESIGN_BLOCK_IO::DesignBlockSave( const wxString& aLibra
|
||||
THROW_IO_ERROR( _( "Design block does not have a valid library ID." ) );
|
||||
}
|
||||
|
||||
wxFileName schematicFile( aDesignBlock->GetSchematicFile() );
|
||||
|
||||
if( !schematicFile.FileExists() )
|
||||
if( aDesignBlock->GetSchematicFile().IsEmpty() && aDesignBlock->GetBoardFile().IsEmpty() )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "Schematic source file '%s' does not exist." ),
|
||||
schematicFile.GetFullPath() ) );
|
||||
THROW_IO_ERROR( _( "Design block does not have a schematic or board file." ) );
|
||||
}
|
||||
|
||||
wxFileName schematicFile( aDesignBlock->GetSchematicFile() );
|
||||
wxFileName boardFile( aDesignBlock->GetBoardFile() );
|
||||
|
||||
if( !aDesignBlock->GetSchematicFile().IsEmpty() && !schematicFile.FileExists() )
|
||||
{
|
||||
THROW_IO_ERROR(
|
||||
wxString::Format( _( "Schematic source file '%s' does not exist." ), schematicFile.GetFullPath() ) );
|
||||
}
|
||||
|
||||
if( !aDesignBlock->GetBoardFile().IsEmpty() && !boardFile.FileExists() )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "Board source file '%s' does not exist." ), boardFile.GetFullPath() ) );
|
||||
}
|
||||
|
||||
// Create the design block folder
|
||||
@@ -376,23 +408,44 @@ void DESIGN_BLOCK_IO::DesignBlockSave( const wxString& aLibra
|
||||
}
|
||||
}
|
||||
|
||||
// The new schematic file name is based on the design block name, not the source sheet name
|
||||
wxString dbSchematicFile = dbFolder.GetFullPath() + aDesignBlock->GetLibId().GetLibItemName()
|
||||
+ wxT( "." ) + FILEEXT::KiCadSchematicFileExtension;
|
||||
|
||||
// If the source and destination files are the same, then we don't need to copy the file
|
||||
// as we are just updating the metadata
|
||||
if( schematicFile.GetFullPath() != dbSchematicFile )
|
||||
if( !aDesignBlock->GetSchematicFile().IsEmpty() )
|
||||
{
|
||||
// Copy the source sheet file to the design block folder, under the design block name
|
||||
if( !wxCopyFile( schematicFile.GetFullPath(), dbSchematicFile ) )
|
||||
// The new schematic file name is based on the design block name, not the source sheet name
|
||||
wxString dbSchematicFile = dbFolder.GetFullPath() + aDesignBlock->GetLibId().GetLibItemName() + wxT( "." )
|
||||
+ FILEEXT::KiCadSchematicFileExtension;
|
||||
|
||||
// If the source and destination files are the same, then we don't need to copy the file
|
||||
// as we are just updating the metadata
|
||||
if( schematicFile.GetFullPath() != dbSchematicFile )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format(
|
||||
_( "Schematic file '%s' could not be saved as design block at '%s'." ),
|
||||
schematicFile.GetFullPath(), dbSchematicFile ) );
|
||||
// Copy the source sheet file to the design block folder, under the design block name
|
||||
if( !wxCopyFile( schematicFile.GetFullPath(), dbSchematicFile ) )
|
||||
{
|
||||
THROW_IO_ERROR(
|
||||
wxString::Format( _( "Schematic file '%s' could not be saved as design block at '%s'." ),
|
||||
schematicFile.GetFullPath(), dbSchematicFile ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !aDesignBlock->GetBoardFile().IsEmpty() )
|
||||
{
|
||||
// The new Board file name is based on the design block name, not the source sheet name
|
||||
wxString dbBoardFile = dbFolder.GetFullPath() + aDesignBlock->GetLibId().GetLibItemName() + wxT( "." )
|
||||
+ FILEEXT::KiCadPcbFileExtension;
|
||||
|
||||
// If the source and destination files are the same, then we don't need to copy the file
|
||||
// as we are just updating the metadata
|
||||
if( boardFile.GetFullPath() != dbBoardFile )
|
||||
{
|
||||
// Copy the source sheet file to the design block folder, under the design block name
|
||||
if( !wxCopyFile( boardFile.GetFullPath(), dbBoardFile ) )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "Board file '%s' could not be saved as design block at '%s'." ),
|
||||
boardFile.GetFullPath(), dbBoardFile ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxString dbMetadataFile = dbFolder.GetFullPath() + aDesignBlock->GetLibId().GetLibItemName()
|
||||
+ wxT( "." ) + FILEEXT::JsonFileExtension;
|
||||
|
||||
@@ -76,10 +76,7 @@ public:
|
||||
}
|
||||
|
||||
bool DesignBlockExists( const wxString& aLibraryPath, const wxString& aDesignBlockName,
|
||||
const std::map<std::string, UTF8>* aProperties = nullptr )
|
||||
{
|
||||
return DesignBlockLoad( aLibraryPath, aDesignBlockName, true, aProperties ) != nullptr;
|
||||
}
|
||||
const std::map<std::string, UTF8>* aProperties = nullptr );
|
||||
|
||||
DESIGN_BLOCK* ImportDesignBlock( const wxString& aDesignBlockPath,
|
||||
wxString& aDesignBlockNameOut,
|
||||
|
||||
@@ -73,6 +73,23 @@ void DESIGN_BLOCK_LIB_TABLE_ROW::SetType( const wxString& aType )
|
||||
}
|
||||
|
||||
|
||||
bool DESIGN_BLOCK_LIB_TABLE_ROW::Refresh()
|
||||
{
|
||||
if( !plugin )
|
||||
{
|
||||
wxArrayString dummyList;
|
||||
|
||||
plugin.reset( DESIGN_BLOCK_IO_MGR::FindPlugin( type ) );
|
||||
SetLoaded( false );
|
||||
plugin->DesignBlockEnumerate( dummyList, GetFullURI( true ), true, GetProperties() );
|
||||
SetLoaded( true );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
DESIGN_BLOCK_LIB_TABLE::DESIGN_BLOCK_LIB_TABLE( DESIGN_BLOCK_LIB_TABLE* aFallBackTable ) :
|
||||
LIB_TABLE( aFallBackTable )
|
||||
{
|
||||
@@ -205,7 +222,8 @@ void DESIGN_BLOCK_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
||||
row->SetVisible();
|
||||
break;
|
||||
|
||||
default: in->Unexpected( tok );
|
||||
default:
|
||||
in->Unexpected( tok );
|
||||
}
|
||||
|
||||
in->NeedRIGHT();
|
||||
@@ -253,7 +271,9 @@ bool DESIGN_BLOCK_LIB_TABLE::operator==( const DESIGN_BLOCK_LIB_TABLE& aDesignBl
|
||||
{
|
||||
if( (DESIGN_BLOCK_LIB_TABLE_ROW&) m_rows[i]
|
||||
!= (DESIGN_BLOCK_LIB_TABLE_ROW&) aDesignBlockTable.m_rows[i] )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -268,8 +288,8 @@ void DESIGN_BLOCK_LIB_TABLE::Format( OUTPUTFORMATTER* aOutput, int aIndentLevel
|
||||
aOutput->Print( aIndentLevel, "(design_block_lib_table\n" );
|
||||
aOutput->Print( aIndentLevel + 1, "(version %d)\n", m_version );
|
||||
|
||||
for( LIB_TABLE_ROWS_CITER it = m_rows.begin(); it != m_rows.end(); ++it )
|
||||
it->Format( aOutput, aIndentLevel + 1 );
|
||||
for( const LIB_TABLE_ROW& row : m_rows)
|
||||
row.Format( aOutput, aIndentLevel + 1 );
|
||||
|
||||
aOutput->Print( aIndentLevel, ")\n" );
|
||||
}
|
||||
@@ -330,9 +350,9 @@ const DESIGN_BLOCK_LIB_TABLE_ROW* DESIGN_BLOCK_LIB_TABLE::FindRow( const wxStrin
|
||||
|
||||
if( !row )
|
||||
{
|
||||
wxString msg = wxString::Format(
|
||||
_( "design-block-lib-table files contain no library named '%s'." ), aNickname );
|
||||
THROW_IO_ERROR( msg );
|
||||
THROW_IO_ERROR( wxString::Format( _( "design-block-lib-table files contain no library "
|
||||
"named '%s'." ),
|
||||
aNickname ) );
|
||||
}
|
||||
|
||||
if( !row->plugin )
|
||||
@@ -490,14 +510,12 @@ DESIGN_BLOCK_LIB_TABLE::DesignBlockLoadWithOptionalNickname( const LIB_ID& aDesi
|
||||
// nickname is empty, sequentially search (alphabetically) all libs/nicks for first match:
|
||||
else
|
||||
{
|
||||
std::vector<wxString> nicks = GetLogicalLibs();
|
||||
|
||||
// Search each library going through libraries alphabetically.
|
||||
for( unsigned i = 0; i < nicks.size(); ++i )
|
||||
for( const wxString& library : GetLogicalLibs() )
|
||||
{
|
||||
// DesignBlockLoad() returns NULL on not found, does not throw exception
|
||||
// unless there's an IO_ERROR.
|
||||
DESIGN_BLOCK* ret = DesignBlockLoad( nicks[i], DesignBlockname, aKeepUUID );
|
||||
DESIGN_BLOCK* ret = DesignBlockLoad( library, DesignBlockname, aKeepUUID );
|
||||
|
||||
if( ret )
|
||||
return ret;
|
||||
@@ -520,7 +538,8 @@ public:
|
||||
explicit PCM_DESIGN_BLOCK_LIB_TRAVERSER( const wxString& aPath, DESIGN_BLOCK_LIB_TABLE& aTable,
|
||||
const wxString& aPrefix ) :
|
||||
m_lib_table( aTable ),
|
||||
m_path_prefix( aPath ), m_lib_prefix( aPrefix )
|
||||
m_path_prefix( aPath ),
|
||||
m_lib_prefix( aPrefix )
|
||||
{
|
||||
wxFileName f( aPath, wxS( "" ) );
|
||||
m_prefix_dir_count = f.GetDirCount();
|
||||
@@ -539,8 +558,9 @@ public:
|
||||
FILEEXT::KiCadDesignBlockLibPathExtension ) )
|
||||
&& dir.GetDirCount() >= m_prefix_dir_count + 3 )
|
||||
{
|
||||
wxString versionedPath = wxString::Format(
|
||||
wxS( "${%s}" ), ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ) );
|
||||
wxString versionedPath;
|
||||
versionedPath.Printf( wxS( "${%s}" ),
|
||||
ENV_VAR::GetVersionedEnvVarName( wxS( "3RD_PARTY" ) ) );
|
||||
|
||||
wxArrayString parts = dir.GetDirs();
|
||||
parts.RemoveAt( 0, m_prefix_dir_count );
|
||||
@@ -551,16 +571,21 @@ public:
|
||||
if( !m_lib_table.HasLibraryWithPath( libPath ) )
|
||||
{
|
||||
wxString name = parts.Last().substr( 0, parts.Last().length() - 7 );
|
||||
wxString nickname = wxString::Format( wxS( "%s%s" ), m_lib_prefix, name );
|
||||
wxString nickname;
|
||||
nickname.Printf( wxS( "%s%s" ),
|
||||
m_lib_prefix,
|
||||
name );
|
||||
|
||||
if( m_lib_table.HasLibrary( nickname ) )
|
||||
{
|
||||
int increment = 1;
|
||||
|
||||
do
|
||||
{
|
||||
nickname =
|
||||
wxString::Format( wxS( "%s%s_%d" ), m_lib_prefix, name, increment );
|
||||
increment++;
|
||||
nickname.Printf( wxS( "%s%s_%d" ),
|
||||
m_lib_prefix,
|
||||
name,
|
||||
increment++ );
|
||||
} while( m_lib_table.HasLibrary( nickname ) );
|
||||
}
|
||||
|
||||
@@ -603,8 +628,8 @@ bool DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable( DESIGN_BLOCK_LIB_TABLE& aTable )
|
||||
SystemDirsAppend( &ss );
|
||||
|
||||
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
|
||||
std::optional<wxString> v =
|
||||
ENV_VAR::GetVersionedEnvVarValue( envVars, wxT( "TEMPLATE_DIR" ) );
|
||||
std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( envVars,
|
||||
wxT( "TEMPLATE_DIR" ) );
|
||||
|
||||
if( v && !v->IsEmpty() )
|
||||
ss.AddPaths( *v, 0 );
|
||||
|
||||
+18
-21
@@ -25,30 +25,32 @@
|
||||
#include <project/project_file.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <settings/app_settings.h>
|
||||
#include <string_utils.h>
|
||||
#include <eda_pattern_match.h>
|
||||
#include <design_block.h>
|
||||
#include <design_block_lib_table.h>
|
||||
#include <design_block_info.h>
|
||||
#include <design_block_tree_model_adapter.h>
|
||||
#include <tools/sch_design_block_control.h>
|
||||
|
||||
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>
|
||||
DESIGN_BLOCK_TREE_MODEL_ADAPTER::Create( EDA_BASE_FRAME* aParent, LIB_TABLE* aLibs,
|
||||
APP_SETTINGS_BASE::LIB_TREE& aSettings )
|
||||
APP_SETTINGS_BASE::LIB_TREE& aSettings,
|
||||
TOOL_INTERACTIVE* aContextMenuTool )
|
||||
{
|
||||
auto* adapter = new DESIGN_BLOCK_TREE_MODEL_ADAPTER( aParent, aLibs, aSettings );
|
||||
adapter->m_frame = aParent;
|
||||
auto* adapter = new DESIGN_BLOCK_TREE_MODEL_ADAPTER( aParent, aLibs, aSettings, aContextMenuTool );
|
||||
return wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>( adapter );
|
||||
}
|
||||
|
||||
|
||||
DESIGN_BLOCK_TREE_MODEL_ADAPTER::DESIGN_BLOCK_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent,
|
||||
LIB_TABLE* aLibs,
|
||||
APP_SETTINGS_BASE::LIB_TREE& aSettings ) :
|
||||
LIB_TREE_MODEL_ADAPTER( aParent, wxT( "pinned_design_block_libs" ), aSettings ),
|
||||
DESIGN_BLOCK_TREE_MODEL_ADAPTER::DESIGN_BLOCK_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, LIB_TABLE* aLibs,
|
||||
APP_SETTINGS_BASE::LIB_TREE& aSettings,
|
||||
TOOL_INTERACTIVE* aContextMenuTool ) :
|
||||
LIB_TREE_MODEL_ADAPTER( aParent, wxT( "pinned_design_block_libs" ),
|
||||
Kiface().KifaceSettings()->m_DesignBlockChooserPanel.tree ),
|
||||
m_libs( (DESIGN_BLOCK_LIB_TABLE*) aLibs ),
|
||||
m_frame( aParent )
|
||||
m_frame( aParent ),
|
||||
m_contextMenuTool( aContextMenuTool )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -74,8 +76,7 @@ void DESIGN_BLOCK_TREE_MODEL_ADAPTER::AddLibraries( EDA_BASE_FRAME* aParent )
|
||||
bool pinned = alg::contains( cfg->m_Session.pinned_design_block_libs, libName )
|
||||
|| alg::contains( project.m_PinnedDesignBlockLibs, libName );
|
||||
|
||||
DoAddLibrary( libName, library->GetDescr(), getDesignBlocks( aParent, libName ), pinned,
|
||||
true );
|
||||
DoAddLibrary( libName, library->GetDescr(), getDesignBlocks( aParent, libName ), pinned, true );
|
||||
}
|
||||
|
||||
m_tree.AssignIntrinsicRanks();
|
||||
@@ -88,23 +89,20 @@ void DESIGN_BLOCK_TREE_MODEL_ADAPTER::ClearLibraries()
|
||||
}
|
||||
|
||||
|
||||
std::vector<LIB_TREE_ITEM*>
|
||||
DESIGN_BLOCK_TREE_MODEL_ADAPTER::getDesignBlocks( EDA_BASE_FRAME* aParent,
|
||||
const wxString& aLibName )
|
||||
std::vector<LIB_TREE_ITEM*> DESIGN_BLOCK_TREE_MODEL_ADAPTER::getDesignBlocks( EDA_BASE_FRAME* aParent,
|
||||
const wxString& aLibName )
|
||||
{
|
||||
std::vector<LIB_TREE_ITEM*> libList;
|
||||
|
||||
auto fullListStart = DESIGN_BLOCK_LIB_TABLE::GetGlobalList().GetList().begin();
|
||||
auto fullListEnd = DESIGN_BLOCK_LIB_TABLE::GetGlobalList().GetList().end();
|
||||
|
||||
std::unique_ptr<DESIGN_BLOCK_INFO> dummy =
|
||||
std::make_unique<DESIGN_BLOCK_INFO_IMPL>( aLibName, wxEmptyString );
|
||||
std::unique_ptr<DESIGN_BLOCK_INFO> dummy = std::make_unique<DESIGN_BLOCK_INFO_IMPL>( aLibName, wxEmptyString );
|
||||
|
||||
// List is sorted, so use a binary search to find the range of footnotes for our library
|
||||
auto libBounds = std::equal_range(
|
||||
fullListStart, fullListEnd, dummy,
|
||||
[]( const std::unique_ptr<DESIGN_BLOCK_INFO>& a,
|
||||
const std::unique_ptr<DESIGN_BLOCK_INFO>& b )
|
||||
[]( const std::unique_ptr<DESIGN_BLOCK_INFO>& a, const std::unique_ptr<DESIGN_BLOCK_INFO>& b )
|
||||
{
|
||||
return StrNumCmp( a->GetLibNickname(), b->GetLibNickname(), false ) < 0;
|
||||
} );
|
||||
@@ -148,8 +146,7 @@ wxString DESIGN_BLOCK_TREE_MODEL_ADAPTER::GenerateInfo( LIB_ID const& aLibId, in
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxLogError( _( "Error loading design block %s from library '%s'." ) + wxS( "\n%s" ),
|
||||
aLibId.GetLibItemName().wx_str(), aLibId.GetLibNickname().wx_str(),
|
||||
ioe.What() );
|
||||
aLibId.GetLibItemName().wx_str(), aLibId.GetLibNickname().wx_str(), ioe.What() );
|
||||
|
||||
return wxEmptyString;
|
||||
}
|
||||
@@ -206,5 +203,5 @@ wxString DESIGN_BLOCK_TREE_MODEL_ADAPTER::GenerateInfo( LIB_ID const& aLibId, in
|
||||
|
||||
TOOL_INTERACTIVE* DESIGN_BLOCK_TREE_MODEL_ADAPTER::GetContextMenuTool()
|
||||
{
|
||||
return m_frame->GetToolManager()->GetTool<SCH_DESIGN_BLOCK_CONTROL>();
|
||||
return m_contextMenuTool;
|
||||
}
|
||||
+7
-6
@@ -33,9 +33,9 @@ public:
|
||||
*
|
||||
* @param aLibs library set from which parts will be loaded
|
||||
*/
|
||||
static wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> Create( EDA_BASE_FRAME* aParent,
|
||||
LIB_TABLE* aLibs,
|
||||
APP_SETTINGS_BASE::LIB_TREE& aSettings );
|
||||
static wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> Create( EDA_BASE_FRAME* aParent, LIB_TABLE* aLibs,
|
||||
APP_SETTINGS_BASE::LIB_TREE& aSettings,
|
||||
TOOL_INTERACTIVE* aContextMenuTool );
|
||||
|
||||
void AddLibraries( EDA_BASE_FRAME* aParent );
|
||||
void ClearLibraries();
|
||||
@@ -51,16 +51,17 @@ protected:
|
||||
* Constructor; takes a set of libraries to be included in the search.
|
||||
*/
|
||||
DESIGN_BLOCK_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, LIB_TABLE* aLibs,
|
||||
APP_SETTINGS_BASE::LIB_TREE& aSettings );
|
||||
APP_SETTINGS_BASE::LIB_TREE& aSettings,
|
||||
TOOL_INTERACTIVE* aContextMenuTool );
|
||||
|
||||
std::vector<LIB_TREE_ITEM*> getDesignBlocks( EDA_BASE_FRAME* aParent,
|
||||
const wxString& aLibName );
|
||||
std::vector<LIB_TREE_ITEM*> getDesignBlocks( EDA_BASE_FRAME* aParent, const wxString& aLibName );
|
||||
|
||||
PROJECT::LIB_TYPE_T getLibType() override { return PROJECT::LIB_TYPE_T::DESIGN_BLOCK_LIB; }
|
||||
|
||||
protected:
|
||||
DESIGN_BLOCK_LIB_TABLE* m_libs;
|
||||
EDA_BASE_FRAME* m_frame;
|
||||
TOOL_INTERACTIVE* m_contextMenuTool;
|
||||
};
|
||||
|
||||
#endif // DESIGN_BLOCK_TREE_MODEL_ADAPTER_H
|
||||
@@ -622,6 +622,7 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
|
||||
ADD_DEV( wxT( "Nick Østergaard" ), CONTRIB_DEV );
|
||||
ADD_DEV( wxT( "木 王" ), CONTRIB_DEV );
|
||||
ADD_DEV( wxT( "wh201906" ), CONTRIB_DEV );
|
||||
|
||||
// The document writers
|
||||
#define DOC_TEAM _( "Documentation Team" )
|
||||
|
||||
+50
-61
@@ -42,43 +42,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
/// Toggle a window's "enable" status to disabled, then enabled on destruction.
|
||||
class WDO_ENABLE_DISABLE
|
||||
{
|
||||
wxWindow* m_win;
|
||||
|
||||
public:
|
||||
|
||||
WDO_ENABLE_DISABLE( wxWindow* aWindow ) :
|
||||
m_win( aWindow )
|
||||
{
|
||||
if( m_win )
|
||||
m_win->Disable();
|
||||
}
|
||||
|
||||
~WDO_ENABLE_DISABLE()
|
||||
{
|
||||
if( m_win )
|
||||
{
|
||||
m_win->Enable();
|
||||
m_win->Raise(); // let's focus back on the parent window
|
||||
}
|
||||
}
|
||||
|
||||
void SuspendForTrueModal()
|
||||
{
|
||||
if( m_win )
|
||||
m_win->Enable();
|
||||
}
|
||||
|
||||
void ResumeAfterTrueModal()
|
||||
{
|
||||
if( m_win )
|
||||
m_win->Disable();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( DIALOG_SHIM, wxDialog )
|
||||
EVT_CHAR_HOOK( DIALOG_SHIM::OnCharHook )
|
||||
END_EVENT_TABLE()
|
||||
@@ -87,17 +50,17 @@ END_EVENT_TABLE()
|
||||
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, long style,
|
||||
const wxString& name ) :
|
||||
wxDialog( aParent, id, title, pos, size, style, name ),
|
||||
KIWAY_HOLDER( nullptr, KIWAY_HOLDER::DIALOG ),
|
||||
m_units( EDA_UNITS::MILLIMETRES ),
|
||||
m_useCalculatedSize( false ),
|
||||
m_firstPaintEvent( true ),
|
||||
m_initialFocusTarget( nullptr ),
|
||||
m_isClosing( false ),
|
||||
m_qmodal_loop( nullptr ),
|
||||
m_qmodal_showing( false ),
|
||||
m_qmodal_parent_disabler( nullptr ),
|
||||
m_parentFrame( nullptr )
|
||||
wxDialog( aParent, id, title, pos, size, style, name ),
|
||||
KIWAY_HOLDER( nullptr, KIWAY_HOLDER::DIALOG ),
|
||||
m_units( EDA_UNITS::MM ),
|
||||
m_useCalculatedSize( false ),
|
||||
m_firstPaintEvent( true ),
|
||||
m_initialFocusTarget( nullptr ),
|
||||
m_isClosing( false ),
|
||||
m_qmodal_loop( nullptr ),
|
||||
m_qmodal_showing( false ),
|
||||
m_qmodal_parent_disabler( nullptr ),
|
||||
m_parentFrame( nullptr )
|
||||
{
|
||||
KIWAY_HOLDER* kiwayHolder = nullptr;
|
||||
m_initialSize = size;
|
||||
@@ -521,15 +484,7 @@ int DIALOG_SHIM::ShowModal()
|
||||
|
||||
int DIALOG_SHIM::ShowQuasiModal()
|
||||
{
|
||||
// This is an exception safe way to zero a pointer before returning.
|
||||
// Yes, even though DismissModal() clears this first normally, this is
|
||||
// here in case there's an exception before the dialog is dismissed.
|
||||
struct NULLER
|
||||
{
|
||||
void*& m_what;
|
||||
NULLER( void*& aPtr ) : m_what( aPtr ) {}
|
||||
~NULLER() { m_what = nullptr; } // indeed, set it to NULL on destruction
|
||||
} clear_this( (void*&) m_qmodal_loop );
|
||||
NULLER raii_nuller( (void*&) m_qmodal_loop );
|
||||
|
||||
// release the mouse if it's currently captured as the window having it
|
||||
// will be disabled when this dialog is shown -- but will still keep the
|
||||
@@ -545,7 +500,7 @@ int DIALOG_SHIM::ShowQuasiModal()
|
||||
"window?" ) );
|
||||
|
||||
// quasi-modal: disable only my "optimal" parent
|
||||
m_qmodal_parent_disabler = new WDO_ENABLE_DISABLE( parent );
|
||||
m_qmodal_parent_disabler = new WINDOW_DISABLER( parent );
|
||||
|
||||
// Apple in its infinite wisdom will raise a disabled window before even passing
|
||||
// us the event, so we have no way to stop it. Instead, we must set an order on
|
||||
@@ -698,9 +653,43 @@ void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
|
||||
return;
|
||||
}
|
||||
}
|
||||
// shift-return (Mac default) or Ctrl-Return (GTK) for OK
|
||||
else if( ( aEvt.GetKeyCode() == WXK_RETURN || aEvt.GetKeyCode() == WXK_NUMPAD_ENTER )
|
||||
&& ( aEvt.ShiftDown() || aEvt.ControlDown() ) )
|
||||
// shift-return (Mac default) or Ctrl-Return (GTK) for new line input
|
||||
else if( ( aEvt.GetKeyCode() == WXK_RETURN || aEvt.GetKeyCode() == WXK_NUMPAD_ENTER ) && aEvt.ShiftDown() )
|
||||
{
|
||||
wxObject* eventSource = aEvt.GetEventObject();
|
||||
|
||||
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( eventSource ) )
|
||||
{
|
||||
#if defined( __WXMAC__ ) || defined( __WXMSW__ )
|
||||
wxString eol = "\r\n";
|
||||
#else
|
||||
wxString eol = "\n";
|
||||
#endif
|
||||
|
||||
long pos = textCtrl->GetInsertionPoint();
|
||||
textCtrl->WriteText( eol );
|
||||
textCtrl->SetInsertionPoint( pos + eol.length() );
|
||||
return;
|
||||
}
|
||||
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( eventSource ) )
|
||||
{
|
||||
wxString eol = "\n";
|
||||
switch( scintilla->GetEOLMode() )
|
||||
{
|
||||
case wxSTC_EOL_CRLF: eol = "\r\n"; break;
|
||||
case wxSTC_EOL_CR: eol = "\r"; break;
|
||||
case wxSTC_EOL_LF: eol = "\n"; break;
|
||||
}
|
||||
|
||||
long pos = scintilla->GetCurrentPos();
|
||||
scintilla->InsertText( pos, eol );
|
||||
scintilla->GotoPos( pos + eol.length() );
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
// command-return (Mac default) or Ctrl-Return (GTK) for OK
|
||||
else if( ( aEvt.GetKeyCode() == WXK_RETURN || aEvt.GetKeyCode() == WXK_NUMPAD_ENTER ) && aEvt.ControlDown() )
|
||||
{
|
||||
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
|
||||
return;
|
||||
|
||||
+29
-11
@@ -24,20 +24,20 @@
|
||||
|
||||
|
||||
#include <dialogs/dialog_design_block_properties.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/tooltip.h>
|
||||
#include <grid_tricks.h>
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
#include <bitmaps.h>
|
||||
|
||||
#include <design_block.h>
|
||||
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES::DIALOG_DESIGN_BLOCK_PROPERTIES( SCH_EDIT_FRAME* aParent,
|
||||
DESIGN_BLOCK* aDesignBlock ) :
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES::DIALOG_DESIGN_BLOCK_PROPERTIES( wxWindow* aParent,
|
||||
DESIGN_BLOCK* aDesignBlock,
|
||||
bool aDisableName ) :
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES_BASE( aParent ), m_designBlock( aDesignBlock )
|
||||
{
|
||||
if( !m_textName->IsEmpty() )
|
||||
m_textName->SetEditable( false );
|
||||
m_textName->SetEditable( !aDisableName );
|
||||
|
||||
wxToolTip::Enable( true );
|
||||
SetupStandardButtons();
|
||||
@@ -50,10 +50,11 @@ DIALOG_DESIGN_BLOCK_PROPERTIES::DIALOG_DESIGN_BLOCK_PROPERTIES( SCH_EDIT_FRAME*
|
||||
|
||||
m_fieldsGrid->SetUseNativeColLabels();
|
||||
|
||||
m_fieldsGrid->PushEventHandler( new GRID_TRICKS( m_fieldsGrid, [this]( wxCommandEvent& aEvent )
|
||||
{
|
||||
OnAddField( aEvent );
|
||||
} ) );
|
||||
m_fieldsGrid->PushEventHandler( new GRID_TRICKS( m_fieldsGrid,
|
||||
[this]( wxCommandEvent& aEvent )
|
||||
{
|
||||
OnAddField( aEvent );
|
||||
} ) );
|
||||
m_fieldsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
|
||||
}
|
||||
|
||||
@@ -86,8 +87,25 @@ bool DIALOG_DESIGN_BLOCK_PROPERTIES::TransferDataToWindow()
|
||||
|
||||
bool DIALOG_DESIGN_BLOCK_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
m_designBlock->SetLibId(
|
||||
LIB_ID( m_designBlock->GetLibId().GetLibNickname(), m_textName->GetValue() ) );
|
||||
unsigned int illegalCh = LIB_ID::FindIllegalLibraryNameChar( m_textName->GetValue() );
|
||||
|
||||
// Also check for / in the name, since this is a path character which is illegal for
|
||||
// design blocks and footprints but not symbols
|
||||
if( illegalCh == 0 && m_textName->GetValue().Find( '/' ) != wxNOT_FOUND )
|
||||
illegalCh = '/';
|
||||
|
||||
if( illegalCh )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Illegal character '%c' in name '%s'." ),
|
||||
illegalCh,
|
||||
m_textName->GetValue() );
|
||||
|
||||
wxMessageDialog errdlg( this, msg, _( "Error" ) );
|
||||
errdlg.ShowModal();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_designBlock->SetLibId( LIB_ID( m_designBlock->GetLibId().GetLibNickname(), m_textName->GetValue() ) );
|
||||
m_designBlock->SetLibDescription( m_textDescription->GetValue() );
|
||||
m_designBlock->SetKeywords( m_textKeywords->GetValue() );
|
||||
|
||||
+8
-3
@@ -22,8 +22,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_DESIGN_BLOCK_PROPERTIES_H
|
||||
#define DIALOG_DESIGN_BLOCK_PROPERTIES_H
|
||||
|
||||
#include <dialogs/dialog_design_block_properties_base.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <json_common.h>
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class DESIGN_BLOCK;
|
||||
@@ -31,7 +34,7 @@ class DESIGN_BLOCK;
|
||||
class DIALOG_DESIGN_BLOCK_PROPERTIES : public DIALOG_DESIGN_BLOCK_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES( SCH_EDIT_FRAME* aParent, DESIGN_BLOCK* aDesignBlock );
|
||||
DIALOG_DESIGN_BLOCK_PROPERTIES( wxWindow* aParent, DESIGN_BLOCK* aDesignBlock, bool aDisableName = false );
|
||||
~DIALOG_DESIGN_BLOCK_PROPERTIES() override;
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
@@ -50,6 +53,8 @@ public:
|
||||
private:
|
||||
void AdjustGridColumns( int aWidth );
|
||||
|
||||
DESIGN_BLOCK* m_designBlock;
|
||||
DESIGN_BLOCK* m_designBlock;
|
||||
nlohmann::ordered_map<wxString, wxString> m_fields;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -77,14 +77,14 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
|
||||
{
|
||||
double gridX = m_gridSizeX.GetDoubleValue();
|
||||
|
||||
if( !m_gridSizeX.Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) )
|
||||
if( !m_gridSizeX.Validate( 0.001, 1000.0, EDA_UNITS::MM ) )
|
||||
{
|
||||
wxMessageBox( _( "Grid size X out of range." ), _( "Error" ), wxOK | wxICON_ERROR );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !m_checkLinked->IsChecked()
|
||||
&& !m_gridSizeY.Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) )
|
||||
&& !m_gridSizeY.Validate( 0.001, 1000.0, EDA_UNITS::MM ) )
|
||||
{
|
||||
wxMessageBox( _( "Grid size Y out of range." ), _( "Error" ), wxOK | wxICON_ERROR );
|
||||
return false;
|
||||
@@ -94,10 +94,10 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
|
||||
|
||||
m_grid.name = m_textName->GetValue();
|
||||
// Grid X/Y are always stored in millimeters so we can compare them easily
|
||||
m_grid.x = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(),
|
||||
EDA_UNITS::MILLIMETRES, gridX );
|
||||
m_grid.y = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(),
|
||||
EDA_UNITS::MILLIMETRES, gridY );
|
||||
m_grid.x = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(), EDA_UNITS::MM,
|
||||
gridX );
|
||||
m_grid.y = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(), EDA_UNITS::MM,
|
||||
gridY );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+38
-37
@@ -22,34 +22,36 @@
|
||||
*/
|
||||
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/pcb_picker_tool.h>
|
||||
#include <pcb_base_edit_frame.h>
|
||||
#include <pcb_group.h>
|
||||
#include <tool/actions.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <eda_group.h>
|
||||
#include <status_popup.h>
|
||||
#include <board_commit.h>
|
||||
#include <commit.h>
|
||||
#include <bitmaps.h>
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
#include <dialogs/dialog_group_properties.h>
|
||||
|
||||
|
||||
DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent,
|
||||
PCB_GROUP* aGroup ) :
|
||||
DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES( EDA_DRAW_FRAME* aParent,
|
||||
EDA_GROUP* aGroup,
|
||||
COMMIT& aCommit ) :
|
||||
DIALOG_GROUP_PROPERTIES_BASE( aParent ),
|
||||
m_brdEditor( aParent ),
|
||||
m_frame( aParent ),
|
||||
m_toolMgr( aParent->GetToolManager() ),
|
||||
m_group( aGroup )
|
||||
m_group( aGroup ),
|
||||
m_commit( aCommit )
|
||||
{
|
||||
m_bpAddMember->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
|
||||
m_bpRemoveMember->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
|
||||
|
||||
m_nameCtrl->SetValue( m_group->GetName() );
|
||||
m_locked->SetValue( aGroup->AsEdaItem()->IsLocked() );
|
||||
|
||||
m_locked->SetValue( m_group->IsLocked() );
|
||||
m_locked->Show( dynamic_cast<PCB_EDIT_FRAME*>( aParent ) != nullptr );
|
||||
if( aGroup->AsEdaItem()->Type() != PCB_GROUP_T )
|
||||
m_locked->Hide();
|
||||
|
||||
for( BOARD_ITEM* item : m_group->GetItems() )
|
||||
m_membersList->Append( item->GetItemDescription( m_brdEditor, true ), item );
|
||||
for( EDA_ITEM* item : m_group->GetItems() )
|
||||
m_membersList->Append( item->GetItemDescription( m_frame, true ), item );
|
||||
|
||||
SetupStandardButtons();
|
||||
|
||||
@@ -62,11 +64,11 @@ DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent,
|
||||
|
||||
DIALOG_GROUP_PROPERTIES::~DIALOG_GROUP_PROPERTIES()
|
||||
{
|
||||
if( m_brdEditor->IsBeingDeleted() )
|
||||
if( m_frame->IsBeingDeleted() )
|
||||
return;
|
||||
|
||||
m_brdEditor->FocusOnItem( nullptr );
|
||||
m_brdEditor->GetCanvas()->Refresh();
|
||||
m_frame->ClearFocus();
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,38 +82,37 @@ bool DIALOG_GROUP_PROPERTIES::TransferDataToWindow()
|
||||
|
||||
bool DIALOG_GROUP_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
BOARD_COMMIT commit( m_brdEditor );
|
||||
commit.Modify( m_group );
|
||||
m_commit.Modify( m_group->AsEdaItem(), m_frame->GetScreen() );
|
||||
|
||||
for( size_t ii = 0; ii < m_membersList->GetCount(); ++ii )
|
||||
{
|
||||
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( m_membersList->GetClientData( ii ) );
|
||||
PCB_GROUP* existingGroup = item->GetParentGroup();
|
||||
EDA_ITEM* item = static_cast<EDA_ITEM*>( m_membersList->GetClientData( ii ) );
|
||||
EDA_GROUP* existingGroup = item->GetParentGroup();
|
||||
|
||||
if( existingGroup != m_group )
|
||||
{
|
||||
commit.Modify( item );
|
||||
m_commit.Modify( item, m_frame->GetScreen() );
|
||||
|
||||
if( existingGroup )
|
||||
commit.Modify( existingGroup );
|
||||
m_commit.Modify( existingGroup->AsEdaItem(), m_frame->GetScreen() );
|
||||
}
|
||||
}
|
||||
|
||||
m_group->SetName( m_nameCtrl->GetValue() );
|
||||
m_group->SetLocked( m_locked->GetValue() );
|
||||
m_group->AsEdaItem()->SetLocked( m_locked->GetValue() );
|
||||
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
|
||||
m_toolMgr->RunAction( ACTIONS::selectionClear );
|
||||
m_group->RemoveAll();
|
||||
|
||||
for( size_t ii = 0; ii < m_membersList->GetCount(); ++ii )
|
||||
{
|
||||
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( m_membersList->GetClientData( ii ) );
|
||||
EDA_ITEM* item = static_cast<EDA_ITEM*>( m_membersList->GetClientData( ii ) );
|
||||
m_group->AddItem( item );
|
||||
}
|
||||
|
||||
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, m_group );
|
||||
m_toolMgr->RunAction<EDA_ITEM*>( ACTIONS::selectItem, m_group->AsEdaItem() );
|
||||
|
||||
commit.Push( _( "Edit Group Properties" ) );
|
||||
m_commit.Push( _( "Edit Group Properties" ) );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -122,11 +123,11 @@ void DIALOG_GROUP_PROPERTIES::OnMemberSelected( wxCommandEvent& aEvent )
|
||||
|
||||
if( selected >= 0 )
|
||||
{
|
||||
WINDOW_THAWER thawer( m_brdEditor );
|
||||
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( m_membersList->GetClientData( selected ) );
|
||||
WINDOW_THAWER thawer( m_frame );
|
||||
EDA_ITEM* item = static_cast<EDA_ITEM*>( m_membersList->GetClientData( selected ) );
|
||||
|
||||
m_brdEditor->FocusOnItem( item );
|
||||
m_brdEditor->GetCanvas()->Refresh();
|
||||
m_frame->FocusOnItem( item );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
aEvent.Skip();
|
||||
@@ -135,7 +136,7 @@ void DIALOG_GROUP_PROPERTIES::OnMemberSelected( wxCommandEvent& aEvent )
|
||||
|
||||
void DIALOG_GROUP_PROPERTIES::OnAddMember( wxCommandEvent& event )
|
||||
{
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::pickNewGroupMember );
|
||||
m_toolMgr->RunAction( ACTIONS::pickNewGroupMember );
|
||||
}
|
||||
|
||||
|
||||
@@ -144,14 +145,14 @@ void DIALOG_GROUP_PROPERTIES::DoAddMember( EDA_ITEM* aItem )
|
||||
|
||||
for( size_t ii = 0; ii < m_membersList->GetCount(); ++ii )
|
||||
{
|
||||
if( aItem == static_cast<BOARD_ITEM*>( m_membersList->GetClientData( ii ) ) )
|
||||
if( aItem == static_cast<EDA_ITEM*>( m_membersList->GetClientData( ii ) ) )
|
||||
return;
|
||||
}
|
||||
|
||||
if( aItem == m_group )
|
||||
if( aItem == m_group->AsEdaItem() )
|
||||
return;
|
||||
|
||||
m_membersList->Append( aItem->GetItemDescription( m_brdEditor, true ), aItem );
|
||||
m_membersList->Append( aItem->GetItemDescription( m_frame, true ), aItem );
|
||||
}
|
||||
|
||||
|
||||
@@ -162,8 +163,8 @@ void DIALOG_GROUP_PROPERTIES::OnRemoveMember( wxCommandEvent& event )
|
||||
if( selected >= 0 )
|
||||
m_membersList->Delete( selected );
|
||||
|
||||
m_brdEditor->FocusOnItem( nullptr );
|
||||
m_brdEditor->GetCanvas()->Refresh();
|
||||
m_frame->ClearFocus();
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
+11
-7
@@ -26,16 +26,19 @@
|
||||
|
||||
#include <dialogs/dialog_group_properties_base.h>
|
||||
|
||||
class PCB_BASE_EDIT_FRAME;
|
||||
class EDA_DRAW_FRAME;
|
||||
class TOOL_MANAGER;
|
||||
class PCB_GROUP;
|
||||
class EDA_GROUP;
|
||||
class EDA_ITEM;
|
||||
class COMMIT;
|
||||
class BASE_SCREEN;
|
||||
|
||||
|
||||
class DIALOG_GROUP_PROPERTIES : public DIALOG_GROUP_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_GROUP_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, PCB_GROUP* aTarget );
|
||||
~DIALOG_GROUP_PROPERTIES();
|
||||
DIALOG_GROUP_PROPERTIES( EDA_DRAW_FRAME* aParent, EDA_GROUP* aTarget, COMMIT& aCommit );
|
||||
~DIALOG_GROUP_PROPERTIES() override;
|
||||
|
||||
void OnMemberSelected( wxCommandEvent& event ) override;
|
||||
void OnAddMember( wxCommandEvent& event ) override;
|
||||
@@ -47,9 +50,10 @@ private:
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
PCB_BASE_EDIT_FRAME* m_brdEditor;
|
||||
TOOL_MANAGER* m_toolMgr;
|
||||
PCB_GROUP* m_group;
|
||||
EDA_DRAW_FRAME* m_frame;
|
||||
TOOL_MANAGER* m_toolMgr;
|
||||
EDA_GROUP* m_group;
|
||||
COMMIT& m_commit;
|
||||
};
|
||||
|
||||
#endif // DIALOG_GROUP_PROPERTIES_H
|
||||
@@ -21,11 +21,13 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "kicad_manager_frame.h"
|
||||
#include <dialogs/dialog_hotkey_list.h>
|
||||
#include <kiface_base.h>
|
||||
#include <eda_base_frame.h>
|
||||
#include <panel_hotkeys_editor.h>
|
||||
#include <widgets/ui_common.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
@@ -39,7 +41,15 @@ DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent ):
|
||||
|
||||
m_hk_list = new PANEL_HOTKEYS_EDITOR( aParent, this, true );
|
||||
|
||||
Kiway().GetActions( m_hk_list->ActionsList() );
|
||||
wxWindow* kicadMgr_window = wxWindow::FindWindowByName( KICAD_MANAGER_FRAME_NAME );
|
||||
|
||||
if( KICAD_MANAGER_FRAME* kicadMgr = static_cast<KICAD_MANAGER_FRAME*>( kicadMgr_window ) )
|
||||
{
|
||||
ACTION_MANAGER* actionMgr = kicadMgr->GetToolManager()->GetActionManager();
|
||||
|
||||
for( const auto& [name, action] : actionMgr->GetActions() )
|
||||
m_hk_list->ActionsList().push_back( action );
|
||||
}
|
||||
|
||||
kiface = Kiway().KiFACE( KIWAY::FACE_SCH );
|
||||
kiface->GetActions( m_hk_list->ActionsList() );
|
||||
|
||||
@@ -27,7 +27,7 @@ DIALOG_LOCKED_ITEMS_QUERY_BASE::DIALOG_LOCKED_ITEMS_QUERY_BASE( wxWindow* parent
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_messageLine1 = new wxStaticText( this, wxID_ANY, _("The selection contains %lu locked items."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_messageLine1 = new wxStaticText( this, wxID_ANY, _("The selection contains %zu locked items."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_messageLine1->Wrap( -1 );
|
||||
bSizer4->Add( m_messageLine1, 0, wxALL, 5 );
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">The selection contains %lu locked items.</property>
|
||||
<property name="label">The selection contains %zu locked items.</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <wx/print.h>
|
||||
#include <wx/printdlg.h>
|
||||
|
||||
#include <dialogs/panel_printer_list.h>
|
||||
|
||||
// Define min and max reasonable values for print scale
|
||||
static constexpr double MIN_SCALE = 0.01;
|
||||
static constexpr double MAX_SCALE = 100.0;
|
||||
@@ -93,6 +95,9 @@ DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC( EDA_DRAW_FRAME* aParent, PRINTOUT_SE
|
||||
m_scaleValidator.SetRange( 0.0, MAX_SCALE );
|
||||
m_scaleCustomText->SetValidator( m_scaleValidator );
|
||||
|
||||
// Show m_panelPrinters only if there are printers to list:
|
||||
m_panelPrinters->Show( m_panelPrinters->AsPrintersAvailable() );
|
||||
|
||||
SetupStandardButtons( { { wxID_OK, _( "Print" ) },
|
||||
{ wxID_APPLY, _( "Print Preview" ) },
|
||||
{ wxID_CANCEL, _( "Close" ) } } );
|
||||
@@ -245,6 +250,13 @@ void DIALOG_PRINT_GENERIC::onPrintPreview( wxCommandEvent& event )
|
||||
return;
|
||||
}
|
||||
|
||||
wxString selectedPrinterName;
|
||||
|
||||
if( m_panelPrinters )
|
||||
selectedPrinterName = m_panelPrinters->GetSelectedPrinterName();
|
||||
|
||||
s_PrintData->SetPrinterName( selectedPrinterName );
|
||||
|
||||
// Pass two printout objects: for preview, and possible printing.
|
||||
wxString title = _( "Print Preview" );
|
||||
wxPrintPreview* preview =
|
||||
@@ -296,6 +308,13 @@ void DIALOG_PRINT_GENERIC::onPrintButtonClick( wxCommandEvent& event )
|
||||
return;
|
||||
}
|
||||
|
||||
wxString selectedPrinterName;
|
||||
|
||||
if( m_panelPrinters )
|
||||
selectedPrinterName = m_panelPrinters->GetSelectedPrinterName();
|
||||
|
||||
s_PrintData->SetPrinterName( selectedPrinterName );
|
||||
|
||||
wxPrintDialogData printDialogData( *s_PrintData );
|
||||
printDialogData.SetMaxPage( m_settings->m_pageCount );
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialogs/panel_printer_list.h"
|
||||
|
||||
#include "dialog_print_generic_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -16,6 +18,15 @@ DIALOG_PRINT_GENERIC_BASE::DIALOG_PRINT_GENERIC_BASE( wxWindow* parent, wxWindow
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizerPanelPrinters;
|
||||
bSizerPanelPrinters = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_panelPrinters = new PANEL_PRINTER_LIST( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
bSizerPanelPrinters->Add( m_panelPrinters, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bSizerPanelPrinters, 0, wxEXPAND, 5 );
|
||||
|
||||
m_bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bRightCol;
|
||||
|
||||
@@ -65,6 +65,75 @@
|
||||
<property name="name">bMainSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerPanelPrinters</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</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">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_panelPrinters</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">PANEL_PRINTER_LIST; dialogs/panel_printer_list.h; 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>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
|
||||
@@ -10,17 +10,20 @@
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class PANEL_PRINTER_LIST;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/panel.h>
|
||||
#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/stattext.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/textctrl.h>
|
||||
@@ -46,6 +49,7 @@ class DIALOG_PRINT_GENERIC_BASE : public DIALOG_SHIM
|
||||
wxID_PRINT_OPTIONS,
|
||||
};
|
||||
|
||||
PANEL_PRINTER_LIST* m_panelPrinters;
|
||||
wxBoxSizer* m_bUpperSizer;
|
||||
wxStaticBoxSizer* m_sbOptionsSizer;
|
||||
wxGridBagSizer* m_gbOptionsSizer;
|
||||
|
||||
@@ -50,11 +50,13 @@ int WX_UNIT_ENTRY_DIALOG::GetValue()
|
||||
|
||||
WX_PT_ENTRY_DIALOG::WX_PT_ENTRY_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aCaption,
|
||||
const wxString& aLabelX, const wxString& aLabelY,
|
||||
const VECTOR2I& aDefaultValue ) :
|
||||
const VECTOR2I& aDefaultValue, bool aShowResetButt ) :
|
||||
WX_PT_ENTRY_DIALOG_BASE( ( wxWindow* ) aParent, wxID_ANY, aCaption ),
|
||||
m_unit_binder_x( aParent, m_labelX, m_textCtrlX, m_unitsX, true ),
|
||||
m_unit_binder_y( aParent, m_labelY, m_textCtrlY, m_unitsY, true )
|
||||
{
|
||||
m_ButtonReset->Show( aShowResetButt );
|
||||
|
||||
m_labelX->SetLabel( aLabelX );
|
||||
m_labelY->SetLabel( aLabelY );
|
||||
|
||||
@@ -67,8 +69,7 @@ WX_PT_ENTRY_DIALOG::WX_PT_ENTRY_DIALOG( EDA_DRAW_FRAME* aParent, const wxString&
|
||||
SetInitialFocus( m_textCtrlX );
|
||||
SetupStandardButtons();
|
||||
|
||||
Layout();
|
||||
bSizerMain->Fit( this );
|
||||
finishDialogSettings();
|
||||
}
|
||||
|
||||
|
||||
@@ -76,3 +77,9 @@ VECTOR2I WX_PT_ENTRY_DIALOG::GetValue()
|
||||
{
|
||||
return VECTOR2I( m_unit_binder_x.GetIntValue(), m_unit_binder_y.GetIntValue() );
|
||||
}
|
||||
|
||||
void WX_PT_ENTRY_DIALOG::ResetValues( wxCommandEvent& event )
|
||||
{
|
||||
m_unit_binder_x.SetValue( 0 );
|
||||
m_unit_binder_y.SetValue( 0 );
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -102,8 +102,11 @@ WX_PT_ENTRY_DIALOG_BASE::WX_PT_ENTRY_DIALOG_BASE( wxWindow* parent, wxWindowID i
|
||||
wxBoxSizer* bSizerButtons;
|
||||
bSizerButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_ButtonReset = new wxButton( this, wxID_ANY, _("Reset"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerButtons->Add( m_ButtonReset, 0, wxALL|wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5 );
|
||||
|
||||
bSizerButtons->Add( 100, 0, 1, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
bSizerButtons->Add( 30, 0, 1, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_sdbSizer1 = new wxStdDialogButtonSizer();
|
||||
m_sdbSizer1OK = new wxButton( this, wxID_OK );
|
||||
@@ -123,8 +126,14 @@ WX_PT_ENTRY_DIALOG_BASE::WX_PT_ENTRY_DIALOG_BASE( wxWindow* parent, wxWindowID i
|
||||
bSizerMain->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
m_ButtonReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WX_PT_ENTRY_DIALOG_BASE::ResetValues ), NULL, this );
|
||||
}
|
||||
|
||||
WX_PT_ENTRY_DIALOG_BASE::~WX_PT_ENTRY_DIALOG_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_ButtonReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WX_PT_ENTRY_DIALOG_BASE::ResetValues ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -21,10 +21,12 @@
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class WX_UNIT_ENTRY_DIALOG_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -64,10 +66,15 @@ class WX_PT_ENTRY_DIALOG_BASE : public DIALOG_SHIM
|
||||
wxStaticText* m_labelY;
|
||||
wxTextCtrl* m_textCtrlY;
|
||||
wxStaticText* m_unitsY;
|
||||
wxButton* m_ButtonReset;
|
||||
wxStdDialogButtonSizer* m_sdbSizer1;
|
||||
wxButton* m_sdbSizer1OK;
|
||||
wxButton* m_sdbSizer1Cancel;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void ResetValues( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
WX_PT_ENTRY_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Move Point to Location"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#include <confirm.h>
|
||||
|
||||
#include <git2.h>
|
||||
#include <git/kicad_git_memory.h>
|
||||
#include <git/kicad_git_common.h>
|
||||
#include <git/git_repo_mixin.h>
|
||||
#include <gestfich.h>
|
||||
|
||||
#include <cerrno>
|
||||
@@ -42,9 +45,6 @@ DIALOG_GIT_REPOSITORY::DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository*
|
||||
DIALOG_GIT_REPOSITORY_BASE( aParent ),
|
||||
m_repository( aRepository ),
|
||||
m_prevFile( wxEmptyString ),
|
||||
m_tested( 0 ),
|
||||
m_failedTest( false ),
|
||||
m_testError( wxEmptyString ),
|
||||
m_tempRepo( false )
|
||||
{
|
||||
m_txtURL->SetFocus();
|
||||
@@ -68,13 +68,18 @@ DIALOG_GIT_REPOSITORY::DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository*
|
||||
|
||||
if( !m_txtURL->GetValue().IsEmpty() )
|
||||
updateURLData();
|
||||
else
|
||||
m_ConnType->SetSelection( static_cast<int>( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL ) );
|
||||
|
||||
SetupStandardButtons();
|
||||
updateAuthControls();
|
||||
|
||||
SetupStandardButtons( { { wxID_HELP, _( "Test Connection" ) } } );
|
||||
Layout();
|
||||
finishDialogSettings();
|
||||
|
||||
updateAuthControls();
|
||||
}
|
||||
|
||||
|
||||
DIALOG_GIT_REPOSITORY::~DIALOG_GIT_REPOSITORY()
|
||||
{
|
||||
if( m_tempRepo )
|
||||
@@ -140,6 +145,13 @@ void DIALOG_GIT_REPOSITORY::setDefaultSSHKey()
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_GIT_REPOSITORY::onCbCustom( wxCommandEvent& event )
|
||||
{
|
||||
updateAuthControls();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_GIT_REPOSITORY::OnUpdateUI( wxUpdateUIEvent& event )
|
||||
{
|
||||
// event.Enable( !m_txtName->GetValue().IsEmpty() && !m_txtURL->GetValue().IsEmpty() );
|
||||
@@ -161,6 +173,7 @@ void DIALOG_GIT_REPOSITORY::SetEncrypted( bool aEncrypted )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::tuple<bool,wxString,wxString,wxString> DIALOG_GIT_REPOSITORY::isValidHTTPS( const wxString& url )
|
||||
{
|
||||
wxRegEx regex( R"((https?:\/\/)(([^:]+)(:([^@]+))?@)?([^\/]+\/[^\s]+))" );
|
||||
@@ -228,6 +241,7 @@ void DIALOG_GIT_REPOSITORY::updateURLData()
|
||||
|
||||
if( valid )
|
||||
{
|
||||
m_fullURL = url;
|
||||
m_ConnType->SetSelection( static_cast<int>( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_HTTPS ) );
|
||||
SetUsername( username );
|
||||
SetPassword( password );
|
||||
@@ -235,7 +249,6 @@ void DIALOG_GIT_REPOSITORY::updateURLData()
|
||||
|
||||
if( m_txtName->GetValue().IsEmpty() )
|
||||
m_txtName->SetValue( get_repo_name( repoAddress ) );
|
||||
|
||||
}
|
||||
}
|
||||
else if( url.Contains( "ssh://" ) || url.Contains( "git@" ) )
|
||||
@@ -244,6 +257,7 @@ void DIALOG_GIT_REPOSITORY::updateURLData()
|
||||
|
||||
if( valid )
|
||||
{
|
||||
m_fullURL = url;
|
||||
m_ConnType->SetSelection( static_cast<int>( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_SSH ) );
|
||||
m_txtUsername->SetValue( username );
|
||||
m_txtURL->SetValue( repoAddress );
|
||||
@@ -259,6 +273,11 @@ void DIALOG_GIT_REPOSITORY::updateURLData()
|
||||
|
||||
void DIALOG_GIT_REPOSITORY::OnTestClick( wxCommandEvent& event )
|
||||
{
|
||||
if( m_txtURL->GetValue().Trim().Trim( false ).IsEmpty() )
|
||||
return;
|
||||
|
||||
wxString error;
|
||||
bool success = false;
|
||||
git_remote* remote = nullptr;
|
||||
git_remote_callbacks callbacks;
|
||||
git_remote_init_callbacks( &callbacks, GIT_REMOTE_CALLBACKS_VERSION );
|
||||
@@ -266,81 +285,40 @@ void DIALOG_GIT_REPOSITORY::OnTestClick( wxCommandEvent& event )
|
||||
// We track if we have already tried to connect.
|
||||
// If we have, the server may come back to offer another connection
|
||||
// type, so we need to keep track of how many times we have tried.
|
||||
m_tested = 0;
|
||||
|
||||
callbacks.credentials = []( git_cred** aOut, const char* aUrl, const char* aUsername,
|
||||
unsigned int aAllowedTypes, void* aPayload ) -> int
|
||||
{
|
||||
DIALOG_GIT_REPOSITORY* dialog = static_cast<DIALOG_GIT_REPOSITORY*>( aPayload );
|
||||
|
||||
if( dialog->GetRepoType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL )
|
||||
return GIT_PASSTHROUGH;
|
||||
|
||||
if( aAllowedTypes & GIT_CREDTYPE_USERNAME
|
||||
&& !( dialog->GetTested() & GIT_CREDTYPE_USERNAME ) )
|
||||
{
|
||||
wxString username = dialog->GetUsername().Trim().Trim( false );
|
||||
git_cred_username_new( aOut, username.ToStdString().c_str() );
|
||||
dialog->GetTested() |= GIT_CREDTYPE_USERNAME;
|
||||
}
|
||||
else if( dialog->GetRepoType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_HTTPS
|
||||
&& ( aAllowedTypes & GIT_CREDTYPE_USERPASS_PLAINTEXT )
|
||||
&& !( dialog->GetTested() & GIT_CREDTYPE_USERPASS_PLAINTEXT ) )
|
||||
{
|
||||
wxString username = dialog->GetUsername().Trim().Trim( false );
|
||||
wxString password = dialog->GetPassword().Trim().Trim( false );
|
||||
|
||||
git_cred_userpass_plaintext_new( aOut, username.ToStdString().c_str(),
|
||||
password.ToStdString().c_str() );
|
||||
dialog->GetTested() |= GIT_CREDTYPE_USERPASS_PLAINTEXT;
|
||||
}
|
||||
else if( dialog->GetRepoType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_SSH
|
||||
&& ( aAllowedTypes & GIT_CREDTYPE_SSH_KEY )
|
||||
&& !( dialog->GetTested() & GIT_CREDTYPE_SSH_KEY ) )
|
||||
{
|
||||
// SSH key authentication
|
||||
wxString sshKey = dialog->GetRepoSSHPath();
|
||||
wxString sshPubKey = sshKey + ".pub";
|
||||
wxString username = dialog->GetUsername().Trim().Trim( false );
|
||||
wxString password = dialog->GetPassword().Trim().Trim( false );
|
||||
|
||||
git_cred_ssh_key_new( aOut, username.ToStdString().c_str(),
|
||||
sshPubKey.ToStdString().c_str(), sshKey.ToStdString().c_str(),
|
||||
password.ToStdString().c_str() );
|
||||
dialog->GetTested() |= GIT_CREDTYPE_SSH_KEY;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GIT_PASSTHROUGH;
|
||||
}
|
||||
|
||||
return GIT_OK;
|
||||
};
|
||||
|
||||
callbacks.payload = this;
|
||||
KIGIT_COMMON common( m_repository );
|
||||
common.SetRemote( m_txtURL->GetValue() );
|
||||
callbacks.credentials = credentials_cb;
|
||||
common.SetPassword( m_txtPassword->GetValue() );
|
||||
common.SetUsername( m_txtUsername->GetValue() );
|
||||
common.SetSSHKey( m_fpSSHKey->GetFileName().GetFullPath() );
|
||||
KIGIT_REPO_MIXIN repoMixin( &common );
|
||||
callbacks.payload = &repoMixin;
|
||||
|
||||
wxString txtURL = m_txtURL->GetValue();
|
||||
git_remote_create_with_fetchspec( &remote, m_repository, "origin", txtURL.ToStdString().c_str(),
|
||||
git_remote_create_with_fetchspec( &remote, m_repository, "origin", txtURL.mbc_str(),
|
||||
"+refs/heads/*:refs/remotes/origin/*" );
|
||||
KIGIT::GitRemotePtr remotePtr( remote );
|
||||
|
||||
if( git_remote_connect( remote, GIT_DIRECTION_FETCH, &callbacks, nullptr, nullptr ) != GIT_OK )
|
||||
SetTestResult( true, git_error_last()->message );
|
||||
if( git_remote_connect( remote, GIT_DIRECTION_FETCH, &callbacks, nullptr, nullptr ) == GIT_OK )
|
||||
success = true;
|
||||
else
|
||||
SetTestResult( false, wxEmptyString );
|
||||
error = KIGIT_COMMON::GetLastGitError();
|
||||
|
||||
git_remote_disconnect( remote );
|
||||
git_remote_free( remote );
|
||||
|
||||
auto dlg = wxMessageDialog( this, wxEmptyString, _( "Test connection" ), wxOK | wxICON_INFORMATION );
|
||||
auto dlg = wxMessageDialog( this, wxEmptyString, _( "Test Connection" ),
|
||||
wxOK | wxICON_INFORMATION );
|
||||
|
||||
if( !m_failedTest )
|
||||
if( success )
|
||||
{
|
||||
dlg.SetMessage( _( "Connection successful" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
dlg.SetMessage( wxString::Format( _( "Could not connect to '%s' " ), m_txtURL->GetValue() ) );
|
||||
dlg.SetExtendedMessage( m_testError );
|
||||
dlg.SetMessage( wxString::Format( _( "Could not connect to '%s' " ),
|
||||
m_txtURL->GetValue() ) );
|
||||
dlg.SetExtendedMessage( error );
|
||||
}
|
||||
|
||||
dlg.ShowModal();
|
||||
@@ -413,13 +391,6 @@ void DIALOG_GIT_REPOSITORY::OnOKClick( wxCommandEvent& event )
|
||||
{
|
||||
// Save the repository details
|
||||
|
||||
if( m_txtName->GetValue().IsEmpty() )
|
||||
{
|
||||
DisplayErrorMessage( this, _( "Missing information" ),
|
||||
_( "Please enter a name for the repository" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_txtURL->GetValue().IsEmpty() )
|
||||
{
|
||||
DisplayErrorMessage( this, _( "Missing information" ),
|
||||
@@ -435,28 +406,29 @@ void DIALOG_GIT_REPOSITORY::updateAuthControls()
|
||||
{
|
||||
if( m_ConnType->GetSelection() == static_cast<int>( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL ) )
|
||||
{
|
||||
m_panelAuth->Show( false );
|
||||
m_panelAuth->Enable( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_panelAuth->Show( true );
|
||||
m_panelAuth->Enable( true );
|
||||
|
||||
if( m_ConnType->GetSelection() == static_cast<int>( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_SSH ) )
|
||||
{
|
||||
m_fpSSHKey->Show( true );
|
||||
m_labelSSH->Show( true );
|
||||
m_labelPass1->SetLabel( _( "SSH Key Password" ) );
|
||||
m_cbCustom->Enable( true );
|
||||
m_fpSSHKey->Enable( m_cbCustom->IsChecked() );
|
||||
m_txtUsername->Enable( m_cbCustom->IsChecked() );
|
||||
m_txtPassword->Enable( m_cbCustom->IsChecked() );
|
||||
m_labelPass1->SetLabel( _( "SSH key password:" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fpSSHKey->Show( false );
|
||||
m_labelSSH->Show( false );
|
||||
m_labelPass1->SetLabel( _( "Password" ) );
|
||||
setDefaultSSHKey();
|
||||
m_cbCustom->Enable( false );
|
||||
m_fpSSHKey->Enable( false );
|
||||
m_txtUsername->Enable( true );
|
||||
m_txtPassword->Enable( true );
|
||||
m_labelPass1->SetLabel( _( "Password:" ) );
|
||||
}
|
||||
}
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,12 +36,6 @@ public:
|
||||
wxString aURL = wxEmptyString );
|
||||
~DIALOG_GIT_REPOSITORY() override;
|
||||
|
||||
void SetTestResult( bool aFailed, const wxString& aError )
|
||||
{
|
||||
m_failedTest = aFailed;
|
||||
m_testError = aError;
|
||||
}
|
||||
|
||||
void SetRepoType( KIGIT_COMMON::GIT_CONN_TYPE aType )
|
||||
{
|
||||
m_ConnType->SetSelection( static_cast<int>( aType ) );
|
||||
@@ -78,6 +72,8 @@ public:
|
||||
return url;
|
||||
}
|
||||
|
||||
const wxString& GetFullURL() const { return m_fullURL; }
|
||||
|
||||
void SetUsername( const wxString& aUsername ) { m_txtUsername->SetValue( aUsername ); }
|
||||
wxString GetUsername() const { return m_txtUsername->GetValue(); }
|
||||
|
||||
@@ -87,8 +83,6 @@ public:
|
||||
void SetRepoSSHPath( const wxString& aPath ) { m_fpSSHKey->SetFileName( aPath ); m_prevFile = aPath; }
|
||||
wxString GetRepoSSHPath() const { return m_fpSSHKey->GetFileName().GetFullPath(); }
|
||||
|
||||
unsigned& GetTested() { return m_tested; }
|
||||
|
||||
void SetEncrypted( bool aEncrypted = true );
|
||||
|
||||
private:
|
||||
@@ -100,6 +94,7 @@ private:
|
||||
void OnTestClick( wxCommandEvent& event ) override;
|
||||
|
||||
void OnFileUpdated( wxFileDirPickerEvent& event ) override;
|
||||
void onCbCustom( wxCommandEvent& event ) override;
|
||||
|
||||
void setDefaultSSHKey();
|
||||
|
||||
@@ -112,13 +107,10 @@ private:
|
||||
|
||||
private:
|
||||
git_repository* m_repository;
|
||||
wxString m_fullURL;
|
||||
|
||||
wxString m_prevFile;
|
||||
|
||||
unsigned m_tested;
|
||||
bool m_failedTest;
|
||||
wxString m_testError;
|
||||
|
||||
bool m_tempRepo;
|
||||
wxString m_tempPath;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-254-gc2ef7767)
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -13,7 +13,6 @@ DIALOG_GIT_REPOSITORY_BASE::DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWind
|
||||
{
|
||||
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Connection"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
@@ -21,31 +20,37 @@ DIALOG_GIT_REPOSITORY_BASE::DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWind
|
||||
bSizerMain->Add( m_staticText1, 0, wxLEFT|wxTOP, 10 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxTOP, 5 );
|
||||
bSizerMain->Add( m_staticline1, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizer2;
|
||||
fgSizer2 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizer2 = new wxFlexGridSizer( 0, 2, 5, 0 );
|
||||
fgSizer2->AddGrowableCol( 1 );
|
||||
fgSizer2->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Name"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText3->Wrap( -1 );
|
||||
fgSizer2->Add( m_staticText3, 0, wxALL, 5 );
|
||||
m_staticText3->Hide();
|
||||
|
||||
fgSizer2->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_txtName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_txtName, 0, wxALL|wxEXPAND, 5 );
|
||||
m_txtName->Hide();
|
||||
|
||||
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Location"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_txtName, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Location:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText4->Wrap( -1 );
|
||||
fgSizer2->Add( m_staticText4, 0, wxALL, 5 );
|
||||
fgSizer2->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_txtURL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_txtURL, 0, wxALL|wxEXPAND, 5 );
|
||||
fgSizer2->Add( m_txtURL, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
m_staticText9 = new wxStaticText( this, wxID_ANY, _("Connection Type"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText9 = new wxStaticText( this, wxID_ANY, _("Connection type:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText9->Wrap( -1 );
|
||||
fgSizer2->Add( m_staticText9, 0, wxALL, 5 );
|
||||
m_staticText9->Hide();
|
||||
|
||||
fgSizer2->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizer3;
|
||||
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
|
||||
@@ -54,97 +59,84 @@ DIALOG_GIT_REPOSITORY_BASE::DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWind
|
||||
int m_ConnTypeNChoices = sizeof( m_ConnTypeChoices ) / sizeof( wxString );
|
||||
m_ConnType = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ConnTypeNChoices, m_ConnTypeChoices, 0 );
|
||||
m_ConnType->SetSelection( 0 );
|
||||
bSizer3->Add( m_ConnType, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
m_ConnType->Hide();
|
||||
|
||||
bSizer3->Add( m_ConnType, 0, wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
bSizer3->Add( 0, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer2->Add( bSizer3, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( fgSizer2, 1, wxEXPAND, 5 );
|
||||
bSizerMain->Add( fgSizer2, 0, wxEXPAND, 5 );
|
||||
|
||||
m_panelAuth = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* m_szAuth;
|
||||
m_szAuth = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
m_szAuth->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer11;
|
||||
bSizer11 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticText2 = new wxStaticText( m_panelAuth, wxID_ANY, _("Authentication"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText2->Wrap( -1 );
|
||||
bSizer11->Add( m_staticText2, 0, wxLEFT|wxTOP, 10 );
|
||||
|
||||
|
||||
bSizer11->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_szAuth->Add( bSizer11, 0, wxEXPAND, 5 );
|
||||
m_szAuth->Add( m_staticText2, 0, wxLEFT|wxTOP, 10 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( m_panelAuth, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
m_szAuth->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSshSizer;
|
||||
fgSshSizer = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSshSizer->AddGrowableCol( 1 );
|
||||
fgSshSizer->SetFlexibleDirection( wxBOTH );
|
||||
fgSshSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
wxFlexGridSizer* fgSizer21;
|
||||
fgSizer21 = new wxFlexGridSizer( 0, 2, 5, 0 );
|
||||
fgSizer21->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer21->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_labelSSH = new wxStaticText( m_panelAuth, wxID_ANY, _("SSH Private Key"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_labelSSH->Wrap( -1 );
|
||||
fgSshSizer->Add( m_labelSSH, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5 );
|
||||
|
||||
wxBoxSizer* bSizer41;
|
||||
bSizer41 = new wxBoxSizer( wxHORIZONTAL );
|
||||
m_cbCustom = new wxCheckBox( m_panelAuth, wxID_ANY, _("SSH private key: "), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer21->Add( m_cbCustom, 0, wxALL, 5 );
|
||||
|
||||
m_fpSSHKey = new wxFilePickerCtrl( m_panelAuth, wxID_ANY, wxEmptyString, _("Select SSH private key file"), _("*"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE|wxFLP_FILE_MUST_EXIST|wxFLP_OPEN );
|
||||
bSizer41->Add( m_fpSSHKey, 1, wxEXPAND|wxLEFT|wxRESERVE_SPACE_EVEN_IF_HIDDEN|wxRIGHT, 5 );
|
||||
m_fpSSHKey->SetMinSize( wxSize( 250,-1 ) );
|
||||
|
||||
m_btnTest = new wxButton( m_panelAuth, wxID_ANY, _("Test"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer41->Add( m_btnTest, 0, wxLEFT|wxRIGHT, 5 );
|
||||
fgSizer21->Add( m_fpSSHKey, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
|
||||
fgSshSizer->Add( bSizer41, 1, wxEXPAND, 5 );
|
||||
|
||||
m_staticText11 = new wxStaticText( m_panelAuth, wxID_ANY, _("Username"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText11 = new wxStaticText( m_panelAuth, wxID_ANY, _("User name:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText11->Wrap( -1 );
|
||||
fgSshSizer->Add( m_staticText11, 0, wxALL, 5 );
|
||||
fgSizer21->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_txtUsername = new wxTextCtrl( m_panelAuth, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSshSizer->Add( m_txtUsername, 0, wxALL|wxEXPAND, 5 );
|
||||
fgSizer21->Add( m_txtUsername, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
m_labelPass1 = new wxStaticText( m_panelAuth, wxID_ANY, _("SSH Key Password"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_labelPass1 = new wxStaticText( m_panelAuth, wxID_ANY, _("SSH key password:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_labelPass1->Wrap( -1 );
|
||||
fgSshSizer->Add( m_labelPass1, 0, wxALL, 5 );
|
||||
fgSizer21->Add( m_labelPass1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_txtPassword = new wxTextCtrl( m_panelAuth, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSshSizer->Add( m_txtPassword, 0, wxALL|wxEXPAND, 5 );
|
||||
fgSizer21->Add( m_txtPassword, 0, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
|
||||
m_szAuth->Add( fgSshSizer, 1, wxEXPAND, 5 );
|
||||
m_szAuth->Add( fgSizer21, 1, wxBOTTOM|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelAuth->SetSizer( m_szAuth );
|
||||
m_panelAuth->Layout();
|
||||
m_szAuth->Fit( m_panelAuth );
|
||||
bSizerMain->Add( m_panelAuth, 1, wxALL|wxEXPAND|wxRESERVE_SPACE_EVEN_IF_HIDDEN, 0 );
|
||||
bSizerMain->Add( m_panelAuth, 0, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer->AddButton( m_sdbSizerOK );
|
||||
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizer->AddButton( m_sdbSizerCancel );
|
||||
m_sdbSizerHelp = new wxButton( this, wxID_HELP );
|
||||
m_sdbSizer->AddButton( m_sdbSizerHelp );
|
||||
m_sdbSizer->Realize();
|
||||
|
||||
bSizerMain->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
bSizerMain->Add( m_sdbSizer, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
bSizerMain->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
@@ -153,8 +145,9 @@ DIALOG_GIT_REPOSITORY_BASE::DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWind
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnUpdateUI ) );
|
||||
m_txtURL->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnLocationExit ), NULL, this );
|
||||
m_ConnType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnSelectConnType ), NULL, this );
|
||||
m_cbCustom->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::onCbCustom ), NULL, this );
|
||||
m_fpSSHKey->Connect( wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnFileUpdated ), NULL, this );
|
||||
m_btnTest->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnTestClick ), NULL, this );
|
||||
m_sdbSizerHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnTestClick ), NULL, this );
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnOKClick ), NULL, this );
|
||||
}
|
||||
|
||||
@@ -165,8 +158,9 @@ DIALOG_GIT_REPOSITORY_BASE::~DIALOG_GIT_REPOSITORY_BASE()
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnUpdateUI ) );
|
||||
m_txtURL->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnLocationExit ), NULL, this );
|
||||
m_ConnType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnSelectConnType ), NULL, this );
|
||||
m_cbCustom->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::onCbCustom ), NULL, this );
|
||||
m_fpSSHKey->Disconnect( wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnFileUpdated ), NULL, this );
|
||||
m_btnTest->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnTestClick ), NULL, this );
|
||||
m_sdbSizerHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnTestClick ), NULL, this );
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GIT_REPOSITORY_BASE::OnOKClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-254-gc2ef7767)
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -21,17 +21,14 @@
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/filepicker.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_GIT_REPOSITORY_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -40,6 +37,7 @@ class DIALOG_GIT_REPOSITORY_BASE : public DIALOG_SHIM
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxBoxSizer* bSizerMain;
|
||||
wxStaticText* m_staticText1;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxStaticText* m_staticText3;
|
||||
@@ -51,9 +49,8 @@ class DIALOG_GIT_REPOSITORY_BASE : public DIALOG_SHIM
|
||||
wxPanel* m_panelAuth;
|
||||
wxStaticText* m_staticText2;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxStaticText* m_labelSSH;
|
||||
wxCheckBox* m_cbCustom;
|
||||
wxFilePickerCtrl* m_fpSSHKey;
|
||||
wxButton* m_btnTest;
|
||||
wxStaticText* m_staticText11;
|
||||
wxTextCtrl* m_txtUsername;
|
||||
wxStaticText* m_labelPass1;
|
||||
@@ -61,12 +58,14 @@ class DIALOG_GIT_REPOSITORY_BASE : public DIALOG_SHIM
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
wxButton* m_sdbSizerHelp;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnLocationExit( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void OnSelectConnType( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onCbCustom( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnFileUpdated( wxFileDirPickerEvent& event ) { event.Skip(); }
|
||||
virtual void OnTestClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
@@ -74,7 +73,7 @@ class DIALOG_GIT_REPOSITORY_BASE : public DIALOG_SHIM
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Git Repository"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 682,598 ), long style = wxCAPTION|wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Git Repository"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
|
||||
~DIALOG_GIT_REPOSITORY_BASE();
|
||||
|
||||
|
||||
@@ -24,9 +24,13 @@
|
||||
|
||||
#include "dialog_git_switch.h"
|
||||
|
||||
#include <git/kicad_git_memory.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/timer.h>
|
||||
@@ -240,39 +244,42 @@ void DIALOG_GIT_SWITCH::GetBranches()
|
||||
git_reference* currentBranchReference = nullptr;
|
||||
git_repository_head( ¤tBranchReference, m_repository );
|
||||
|
||||
// Get the current branch name
|
||||
if( currentBranchReference )
|
||||
if( !currentBranchReference )
|
||||
{
|
||||
m_currentBranch = git_reference_shorthand( currentBranchReference );
|
||||
git_reference_free( currentBranchReference );
|
||||
wxLogTrace( traceGit, "Failed to get current branch" );
|
||||
return;
|
||||
}
|
||||
|
||||
KIGIT::GitReferencePtr currentBranch( currentBranchReference );
|
||||
m_currentBranch = git_reference_shorthand( currentBranchReference );
|
||||
|
||||
// Initialize branch iterator
|
||||
git_branch_iterator_new( &branchIterator, m_repository, GIT_BRANCH_ALL );
|
||||
KIGIT::GitBranchIteratorPtr branchIteratorPtr( branchIterator );
|
||||
|
||||
// Iterate over local branches
|
||||
git_reference* branchReference = nullptr;
|
||||
while( git_branch_next( &branchReference, &branchType, branchIterator ) == 0 )
|
||||
{
|
||||
KIGIT::GitReferencePtr branchReferencePtr( branchReference );
|
||||
|
||||
// Get the branch OID
|
||||
const git_oid* branchOid = git_reference_target( branchReference );
|
||||
|
||||
// Skip this branch if it doesn't have an OID
|
||||
if( !branchOid )
|
||||
{
|
||||
git_reference_free( branchReference );
|
||||
continue;
|
||||
}
|
||||
|
||||
git_commit* commit = nullptr;
|
||||
|
||||
if( git_commit_lookup( &commit, m_repository, branchOid ) )
|
||||
{
|
||||
// Skip this branch if it doesn't have a commit
|
||||
git_reference_free( branchReference );
|
||||
continue;
|
||||
}
|
||||
|
||||
KIGIT::GitCommitPtr commitPtr( commit );
|
||||
|
||||
// Retrieve commit details
|
||||
BranchData branchData;
|
||||
branchData.commitString = git_commit_message( commit );
|
||||
@@ -280,10 +287,5 @@ void DIALOG_GIT_SWITCH::GetBranches()
|
||||
branchData.isRemote = branchType == GIT_BRANCH_REMOTE;
|
||||
|
||||
m_branches[git_reference_shorthand( branchReference )] = branchData;
|
||||
|
||||
git_commit_free( commit );
|
||||
git_reference_free( branchReference );
|
||||
}
|
||||
|
||||
git_branch_iterator_free( branchIterator );
|
||||
}
|
||||
@@ -24,10 +24,12 @@
|
||||
#include <kiplatform/secrets.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <trace_helpers.h>
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
#include <widgets/wx_grid.h>
|
||||
|
||||
#include <git2.h>
|
||||
#include <git/kicad_git_memory.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/checkbox.h>
|
||||
@@ -36,11 +38,6 @@
|
||||
|
||||
PANEL_GIT_REPOS::PANEL_GIT_REPOS( wxWindow* aParent ) : PANEL_GIT_REPOS_BASE( aParent)
|
||||
{
|
||||
|
||||
m_btnAddRepo->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
|
||||
m_btnEditRepo->SetBitmap( KiBitmapBundle( BITMAPS::small_edit ) );
|
||||
m_btnDelete->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
|
||||
|
||||
}
|
||||
|
||||
PANEL_GIT_REPOS::~PANEL_GIT_REPOS()
|
||||
@@ -50,7 +47,6 @@ PANEL_GIT_REPOS::~PANEL_GIT_REPOS()
|
||||
|
||||
void PANEL_GIT_REPOS::ResetPanel()
|
||||
{
|
||||
m_grid->ClearGrid();
|
||||
m_cbDefault->SetValue( true );
|
||||
m_author->SetValue( wxEmptyString );
|
||||
m_authorEmail->SetValue( wxEmptyString );
|
||||
@@ -67,56 +63,44 @@ static std::pair<wxString, wxString> getDefaultAuthorAndEmail()
|
||||
|
||||
if( git_config_open_default( &config ) != 0 )
|
||||
{
|
||||
printf( "Failed to open default Git config: %s\n", giterr_last()->message );
|
||||
wxLogTrace( traceGit, "Failed to open default Git config: %s", KIGIT_COMMON::GetLastGitError() );
|
||||
return std::make_pair( name, email );
|
||||
}
|
||||
|
||||
KIGIT::GitConfigPtr configPtr( config );
|
||||
|
||||
if( git_config_get_entry( &name_c, config, "user.name" ) != 0 )
|
||||
{
|
||||
printf( "Failed to get user.name from Git config: %s\n", giterr_last()->message );
|
||||
wxLogTrace( traceGit, "Failed to get user.name from Git config: %s", KIGIT_COMMON::GetLastGitError() );
|
||||
return std::make_pair( name, email );
|
||||
}
|
||||
|
||||
KIGIT::GitConfigEntryPtr namePtr( name_c );
|
||||
|
||||
if( git_config_get_entry( &email_c, config, "user.email" ) != 0 )
|
||||
{
|
||||
printf( "Failed to get user.email from Git config: %s\n", giterr_last()->message );
|
||||
wxLogTrace( traceGit, "Failed to get user.email from Git config: %s", KIGIT_COMMON::GetLastGitError() );
|
||||
return std::make_pair( name, email );
|
||||
}
|
||||
|
||||
KIGIT::GitConfigEntryPtr emailPtr( email_c );
|
||||
|
||||
if( name_c )
|
||||
name = name_c->value;
|
||||
|
||||
if( email_c )
|
||||
email = email_c->value;
|
||||
|
||||
git_config_entry_free( name_c );
|
||||
git_config_entry_free( email_c );
|
||||
git_config_free( config );
|
||||
|
||||
return std::make_pair( name, email );
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_GIT_REPOS::TransferDataFromWindow()
|
||||
{
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
std::vector<COMMON_SETTINGS::GIT_REPOSITORY>& repos = settings->m_Git.repositories;
|
||||
|
||||
repos.clear();
|
||||
|
||||
for( int row = 0; row < m_grid->GetNumberRows(); row++ )
|
||||
{
|
||||
COMMON_SETTINGS::GIT_REPOSITORY repo;
|
||||
|
||||
repo.active = m_grid->GetCellValue( row, COL_ACTIVE ) == "1";
|
||||
repo.name = m_grid->GetCellValue( row, COL_NAME );
|
||||
repo.path = m_grid->GetCellValue( row, COL_PATH );
|
||||
repo.authType = m_grid->GetCellValue( row, COL_AUTH_TYPE );
|
||||
repo.username = m_grid->GetCellValue( row, COL_USERNAME );
|
||||
|
||||
KIPLATFORM::SECRETS::StoreSecret( repo.path, repo.username,
|
||||
m_grid->GetCellValue( row, COL_PASSWORD ) );
|
||||
repo.ssh_path = m_grid->GetCellValue( row, COL_SSH_PATH );
|
||||
repo.checkValid = m_grid->GetCellValue( row, COL_STATUS ) == "1";
|
||||
repos.push_back( repo );
|
||||
}
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
settings->m_Git.enableGit = m_enableGit->GetValue();
|
||||
settings->m_Git.updatInterval = m_updateInterval->GetValue();
|
||||
settings->m_Git.useDefaultAuthor = m_cbDefault->GetValue();
|
||||
settings->m_Git.authorName = m_author->GetValue();
|
||||
settings->m_Git.authorEmail = m_authorEmail->GetValue();
|
||||
@@ -124,153 +108,38 @@ bool PANEL_GIT_REPOS::TransferDataFromWindow()
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool testRepositoryConnection( COMMON_SETTINGS::GIT_REPOSITORY& repository)
|
||||
{
|
||||
git_libgit2_init();
|
||||
|
||||
git_remote_callbacks callbacks;
|
||||
callbacks.version = GIT_REMOTE_CALLBACKS_VERSION;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
COMMON_SETTINGS::GIT_REPOSITORY* repo;
|
||||
bool success;
|
||||
} callbacksPayload;
|
||||
|
||||
callbacksPayload cb_data( { &repository, true } ); // If we don't need authentication, then,
|
||||
// we are successful
|
||||
callbacks.payload = &cb_data;
|
||||
callbacks.credentials =
|
||||
[](git_cred** out, const char* url, const char* username, unsigned int allowed_types,
|
||||
void* payload) -> int
|
||||
{
|
||||
|
||||
// If we are asking for credentials, then, we need authentication
|
||||
|
||||
callbacksPayload* data = static_cast<callbacksPayload*>(payload);
|
||||
|
||||
data->success = false;
|
||||
|
||||
if( allowed_types & GIT_CREDTYPE_USERNAME )
|
||||
{
|
||||
data->success = true;
|
||||
}
|
||||
else if( data->repo->authType == "ssh" && ( allowed_types & GIT_CREDTYPE_SSH_KEY ) )
|
||||
{
|
||||
wxString sshKeyPath = data->repo->ssh_path;
|
||||
|
||||
// Check if the SSH key exists and is readable
|
||||
if( wxFileExists( sshKeyPath ) && wxFile::Access( sshKeyPath, wxFile::read ) )
|
||||
data->success = true;
|
||||
}
|
||||
else if( data->repo->authType == "password" )
|
||||
{
|
||||
data->success = ( allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT );
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
// Create a temporary directory to initialize the Git repository
|
||||
wxString tempDirPath = wxFileName::CreateTempFileName(wxT("kigit_temp"));
|
||||
|
||||
if( !wxFileName::Mkdir( tempDirPath, wxS_DIR_DEFAULT ) )
|
||||
{
|
||||
git_libgit2_shutdown();
|
||||
wxLogError( "Failed to create temporary directory for Git repository (%s): %s", tempDirPath,
|
||||
wxSysErrorMsg() );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize the Git repository
|
||||
git_repository* repo = nullptr;
|
||||
int result = git_repository_init( &repo, tempDirPath.mb_str( wxConvUTF8 ), 0 );
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
git_repository_free(repo);
|
||||
git_libgit2_shutdown();
|
||||
wxRmdir(tempDirPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
git_remote* remote = nullptr;
|
||||
result = git_remote_create_anonymous( &remote, repo, tempDirPath.mb_str( wxConvUTF8 ) );
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
git_remote_free(remote);
|
||||
git_repository_free(repo);
|
||||
git_libgit2_shutdown();
|
||||
wxRmdir(tempDirPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// We don't really care about the result of this call, the authentication callback
|
||||
// will set the return values we need
|
||||
git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks, nullptr, nullptr);
|
||||
|
||||
git_remote_disconnect(remote);
|
||||
git_remote_free(remote);
|
||||
git_repository_free(repo);
|
||||
|
||||
git_libgit2_shutdown();
|
||||
|
||||
// Clean up the temporary directory
|
||||
wxRmdir(tempDirPath);
|
||||
|
||||
return cb_data.success;
|
||||
}
|
||||
|
||||
bool PANEL_GIT_REPOS::TransferDataToWindow()
|
||||
{
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
std::pair<wxString, wxString> defaultAuthor = getDefaultAuthorAndEmail();
|
||||
|
||||
m_grid->ClearGrid();
|
||||
|
||||
for( COMMON_SETTINGS::GIT_REPOSITORY& repo : settings->m_Git.repositories )
|
||||
{
|
||||
if( repo.name.IsEmpty() || repo.path.IsEmpty() )
|
||||
continue;
|
||||
|
||||
int row = m_grid->GetNumberRows();
|
||||
m_grid->AppendRows( 1 );
|
||||
|
||||
m_grid->SetCellRenderer( row, COL_ACTIVE, new wxGridCellBoolRenderer() );
|
||||
m_grid->SetCellEditor( row, COL_ACTIVE, new wxGridCellBoolEditor() );
|
||||
m_grid->SetCellValue( row, COL_ACTIVE, repo.active ? "1" : "0" );
|
||||
|
||||
m_grid->SetCellValue( row, COL_NAME, repo.name );
|
||||
m_grid->SetCellValue( row, COL_PATH, repo.path );
|
||||
m_grid->SetCellValue( row, COL_AUTH_TYPE, repo.authType );
|
||||
m_grid->SetCellValue( row, COL_USERNAME, repo.username );
|
||||
|
||||
wxString password;
|
||||
KIPLATFORM::SECRETS::GetSecret( repo.path, repo.username, password );
|
||||
m_grid->SetCellValue( row, COL_PASSWORD, password );
|
||||
m_grid->SetCellValue( row, COL_SSH_PATH, repo.ssh_path );
|
||||
|
||||
if( repo.active )
|
||||
m_grid->SetCellValue( row, 3, testRepositoryConnection( repo ) ? "C" : "NC" );
|
||||
|
||||
}
|
||||
m_enableGit->SetValue( settings->m_Git.enableGit );
|
||||
m_updateInterval->SetValue( settings->m_Git.updatInterval );
|
||||
|
||||
m_cbDefault->SetValue( settings->m_Git.useDefaultAuthor );
|
||||
|
||||
if( settings->m_Git.useDefaultAuthor )
|
||||
{
|
||||
std::pair<wxString, wxString> defaultAuthor = getDefaultAuthorAndEmail();
|
||||
m_author->SetValue( defaultAuthor.first );
|
||||
m_authorEmail->SetValue( defaultAuthor.second );
|
||||
m_author->Disable();
|
||||
m_authorEmail->Disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_author->SetValue( settings->m_Git.authorName );
|
||||
m_authorEmail->SetValue( settings->m_Git.authorEmail );
|
||||
if( settings->m_Git.authorName.IsEmpty() )
|
||||
m_author->SetValue( defaultAuthor.first );
|
||||
else
|
||||
m_author->SetValue( settings->m_Git.authorName );
|
||||
|
||||
if( settings->m_Git.authorEmail.IsEmpty() )
|
||||
m_authorEmail->SetValue( defaultAuthor.second );
|
||||
else
|
||||
m_authorEmail->SetValue( settings->m_Git.authorEmail );
|
||||
}
|
||||
|
||||
wxCommandEvent event;
|
||||
onDefaultClick( event );
|
||||
onEnableGitClick( event );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -282,115 +151,13 @@ void PANEL_GIT_REPOS::onDefaultClick( wxCommandEvent& event )
|
||||
m_authorEmailLabel->Enable( !m_cbDefault->GetValue() );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_GIT_REPOS::onGridDClick( wxGridEvent& event )
|
||||
void PANEL_GIT_REPOS::onEnableGitClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( m_grid->GetNumberRows() <= 0 )
|
||||
{
|
||||
wxCommandEvent evt;
|
||||
onAddClick( evt );
|
||||
return;
|
||||
}
|
||||
|
||||
int row = event.GetRow();
|
||||
|
||||
if( row < 0 || row >= m_grid->GetNumberRows() )
|
||||
return;
|
||||
|
||||
DIALOG_GIT_REPOSITORY dialog( this, nullptr );
|
||||
|
||||
dialog.SetRepoName( m_grid->GetCellValue( row, COL_NAME ) );
|
||||
dialog.SetRepoURL( m_grid->GetCellValue( row, COL_PATH ) );
|
||||
dialog.SetUsername( m_grid->GetCellValue( row, COL_USERNAME ) );
|
||||
dialog.SetRepoSSHPath( m_grid->GetCellValue( row, COL_SSH_PATH ) );
|
||||
dialog.SetPassword( m_grid->GetCellValue( row, COL_PASSWORD ) );
|
||||
|
||||
wxString type = m_grid->GetCellValue( row, COL_AUTH_TYPE );
|
||||
|
||||
if( type == "password" )
|
||||
dialog.SetRepoType( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_HTTPS );
|
||||
else if( type == "ssh" )
|
||||
dialog.SetRepoType( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_SSH );
|
||||
else
|
||||
dialog.SetRepoType( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL);
|
||||
|
||||
if( dialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
m_grid->SetCellValue( row, COL_NAME, dialog.GetRepoName() );
|
||||
m_grid->SetCellValue( row, COL_PATH, dialog.GetRepoURL() );
|
||||
m_grid->SetCellValue( row, COL_USERNAME, dialog.GetUsername() );
|
||||
m_grid->SetCellValue( row, COL_SSH_PATH, dialog.GetRepoSSHPath() );
|
||||
m_grid->SetCellValue( row, COL_PASSWORD, dialog.GetPassword() );
|
||||
|
||||
if( dialog.GetRepoType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_HTTPS )
|
||||
{
|
||||
m_grid->SetCellValue( row, COL_AUTH_TYPE, "password" );
|
||||
}
|
||||
else if( dialog.GetRepoType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_SSH )
|
||||
{
|
||||
m_grid->SetCellValue( row, COL_AUTH_TYPE, "ssh" );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_grid->SetCellValue( row, COL_AUTH_TYPE, "none" );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PANEL_GIT_REPOS::onAddClick( wxCommandEvent& event )
|
||||
{
|
||||
|
||||
DIALOG_GIT_REPOSITORY dialog( m_parent, nullptr );
|
||||
|
||||
if( dialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
int row = m_grid->GetNumberRows();
|
||||
m_grid->AppendRows( 1 );
|
||||
|
||||
m_grid->SetCellValue( row, COL_NAME, dialog.GetRepoName() );
|
||||
m_grid->SetCellValue( row, COL_PATH, dialog.GetRepoURL() );
|
||||
m_grid->SetCellValue( row, COL_USERNAME, dialog.GetUsername() );
|
||||
m_grid->SetCellValue( row, COL_SSH_PATH, dialog.GetRepoSSHPath() );
|
||||
m_grid->SetCellValue( row, COL_PASSWORD, dialog.GetPassword() );
|
||||
|
||||
if( dialog.GetRepoType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_HTTPS )
|
||||
{
|
||||
m_grid->SetCellValue( row, COL_AUTH_TYPE, "password" );
|
||||
}
|
||||
else if( dialog.GetRepoType() == KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_SSH )
|
||||
{
|
||||
m_grid->SetCellValue( row, COL_AUTH_TYPE, "ssh" );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_grid->SetCellValue( row, COL_AUTH_TYPE, "none" );
|
||||
}
|
||||
|
||||
m_grid->MakeCellVisible( row, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_GIT_REPOS::onEditClick( wxCommandEvent& event )
|
||||
{
|
||||
wxGridEvent evt( m_grid->GetId(), wxEVT_GRID_CELL_LEFT_DCLICK, m_grid,
|
||||
m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() );
|
||||
onGridDClick( evt );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_GIT_REPOS::onDeleteClick( wxCommandEvent& event )
|
||||
{
|
||||
if( !m_grid->CommitPendingChanges() || m_grid->GetNumberRows() <= 0 )
|
||||
return;
|
||||
|
||||
int curRow = m_grid->GetGridCursorRow();
|
||||
|
||||
m_grid->DeleteRows( curRow );
|
||||
|
||||
curRow = std::max( 0, curRow - 1 );
|
||||
m_grid->MakeCellVisible( curRow, m_grid->GetGridCursorCol() );
|
||||
m_grid->SetGridCursor( curRow, m_grid->GetGridCursorCol() );
|
||||
bool enable = m_enableGit->GetValue();
|
||||
m_updateInterval->Enable( enable );
|
||||
m_cbDefault->Enable( enable );
|
||||
m_author->Enable( enable && !m_cbDefault->GetValue() );
|
||||
m_authorEmail->Enable( enable && !m_cbDefault->GetValue() );
|
||||
m_authorLabel->Enable( enable && !m_cbDefault->GetValue() );
|
||||
m_authorEmailLabel->Enable( enable && !m_cbDefault->GetValue() );
|
||||
}
|
||||
|
||||
@@ -49,10 +49,7 @@ public:
|
||||
|
||||
private:
|
||||
void onDefaultClick( wxCommandEvent& event ) override;
|
||||
void onGridDClick( wxGridEvent& event ) override;
|
||||
void onAddClick( wxCommandEvent& event ) override;
|
||||
void onEditClick( wxCommandEvent& event ) override;
|
||||
void onDeleteClick( wxCommandEvent& event ) override;
|
||||
void onEnableGitClick( wxCommandEvent& event ) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-254-gc2ef7767)
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/std_bitmap_button.h"
|
||||
#include "widgets/wx_grid.h"
|
||||
|
||||
#include "panel_git_repos_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -20,9 +17,57 @@ PANEL_GIT_REPOS_BASE::PANEL_GIT_REPOS_BASE( wxWindow* parent, wxWindowID id, con
|
||||
wxBoxSizer* bLeftSizer;
|
||||
bLeftSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_enableGit = new wxCheckBox( this, wxID_ANY, _("Enable Git Tracking"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bLeftSizer->Add( m_enableGit, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 13 );
|
||||
|
||||
m_gitSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizerUpdate;
|
||||
bSizerUpdate = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText6 = new wxStaticText( this, wxID_ANY, _("Remote Tracking"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText6->Wrap( -1 );
|
||||
bSizerUpdate->Add( m_staticText6, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 13 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerUpdate->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxGridBagSizer* gbUpdate;
|
||||
gbUpdate = new wxGridBagSizer( 4, 5 );
|
||||
gbUpdate->SetFlexibleDirection( wxBOTH );
|
||||
gbUpdate->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
gbUpdate->SetEmptyCellSize( wxSize( -1,2 ) );
|
||||
|
||||
m_updateLabel = new wxStaticText( this, wxID_ANY, _("Update interval:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_updateLabel->Wrap( -1 );
|
||||
gbUpdate->Add( m_updateLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_updateInterval = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 60, 5 );
|
||||
m_updateInterval->SetToolTip( _("Number of minutes between remote update checks. Zero disables automatic checks.") );
|
||||
|
||||
gbUpdate->Add( m_updateInterval, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText7 = new wxStaticText( this, wxID_ANY, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText7->Wrap( -1 );
|
||||
gbUpdate->Add( m_staticText7, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
gbUpdate->AddGrowableCol( 2 );
|
||||
|
||||
bSizerUpdate->Add( gbUpdate, 0, wxEXPAND|wxLEFT, 13 );
|
||||
|
||||
|
||||
m_gitSizer->Add( bSizerUpdate, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerCommitData;
|
||||
bSizerCommitData = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText12 = new wxStaticText( this, wxID_ANY, _("Git Commit Data"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText12->Wrap( -1 );
|
||||
bLeftSizer->Add( m_staticText12, 0, wxEXPAND|wxLEFT|wxTOP, 10 );
|
||||
bSizerCommitData->Add( m_staticText12, 0, wxEXPAND|wxLEFT|wxTOP, 13 );
|
||||
|
||||
m_staticline31 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerCommitData->Add( m_staticline31, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizer1;
|
||||
fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
@@ -60,84 +105,13 @@ PANEL_GIT_REPOS_BASE::PANEL_GIT_REPOS_BASE( wxWindow* parent, wxWindowID id, con
|
||||
fgSizer1->Add( m_authorEmail, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bLeftSizer->Add( fgSizer1, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 13 );
|
||||
|
||||
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bLeftSizer->Add( m_staticline3, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
m_staticText20 = new wxStaticText( this, wxID_ANY, _("Git Repositories"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText20->Wrap( -1 );
|
||||
bLeftSizer->Add( m_staticText20, 0, wxEXPAND|wxLEFT|wxRIGHT, 13 );
|
||||
|
||||
wxBoxSizer* bAntialiasingSizer;
|
||||
bAntialiasingSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxSize( 820,200 ), 0 );
|
||||
|
||||
// Grid
|
||||
m_grid->CreateGrid( 0, 10 );
|
||||
m_grid->EnableEditing( false );
|
||||
m_grid->EnableGridLines( true );
|
||||
m_grid->EnableDragGridSize( false );
|
||||
m_grid->SetMargins( 0, 0 );
|
||||
|
||||
// Columns
|
||||
m_grid->SetColSize( 0, 60 );
|
||||
m_grid->SetColSize( 1, 200 );
|
||||
m_grid->SetColSize( 2, 500 );
|
||||
m_grid->SetColSize( 3, 60 );
|
||||
m_grid->SetColSize( 4, 0 );
|
||||
m_grid->SetColSize( 5, 0 );
|
||||
m_grid->SetColSize( 6, 0 );
|
||||
m_grid->SetColSize( 7, 0 );
|
||||
m_grid->SetColSize( 8, 0 );
|
||||
m_grid->SetColSize( 9, 0 );
|
||||
m_grid->EnableDragColMove( false );
|
||||
m_grid->EnableDragColSize( true );
|
||||
m_grid->SetColLabelValue( 0, _("Active") );
|
||||
m_grid->SetColLabelValue( 1, _("Name") );
|
||||
m_grid->SetColLabelValue( 2, _("Path") );
|
||||
m_grid->SetColLabelValue( 3, _("Status") );
|
||||
m_grid->SetColLabelSize( 22 );
|
||||
m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
// Rows
|
||||
m_grid->EnableDragRowSize( true );
|
||||
m_grid->SetRowLabelSize( 0 );
|
||||
m_grid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
// Label Appearance
|
||||
|
||||
// Cell Defaults
|
||||
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||
bAntialiasingSizer->Add( m_grid, 5, wxALL|wxEXPAND, 5 );
|
||||
bSizerCommitData->Add( fgSizer1, 0, wxBOTTOM|wxEXPAND|wxLEFT, 8 );
|
||||
|
||||
|
||||
bLeftSizer->Add( bAntialiasingSizer, 0, wxEXPAND|wxLEFT|wxTOP, 5 );
|
||||
|
||||
wxBoxSizer* bButtonsSizer;
|
||||
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_btnAddRepo = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
m_btnAddRepo->SetToolTip( _("Add new repository") );
|
||||
|
||||
bButtonsSizer->Add( m_btnAddRepo, 0, wxALL, 5 );
|
||||
|
||||
m_btnEditRepo = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
m_btnEditRepo->SetToolTip( _("Edit repository properties") );
|
||||
|
||||
bButtonsSizer->Add( m_btnEditRepo, 0, wxALL, 5 );
|
||||
m_gitSizer->Add( bSizerCommitData, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bButtonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_btnDelete = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
m_btnDelete->SetToolTip( _("Remove Git Repository") );
|
||||
|
||||
bButtonsSizer->Add( m_btnDelete, 0, wxBOTTOM|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
|
||||
bLeftSizer->Add( bButtonsSizer, 1, wxALL|wxEXPAND, 5 );
|
||||
bLeftSizer->Add( m_gitSizer, 0, wxEXPAND, 0 );
|
||||
|
||||
|
||||
bPanelSizer->Add( bLeftSizer, 0, wxRIGHT, 20 );
|
||||
@@ -148,20 +122,14 @@ PANEL_GIT_REPOS_BASE::PANEL_GIT_REPOS_BASE( wxWindow* parent, wxWindowID id, con
|
||||
bPanelSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
m_enableGit->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_GIT_REPOS_BASE::onEnableGitClick ), NULL, this );
|
||||
m_cbDefault->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_GIT_REPOS_BASE::onDefaultClick ), NULL, this );
|
||||
m_grid->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( PANEL_GIT_REPOS_BASE::onGridDClick ), NULL, this );
|
||||
m_btnAddRepo->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GIT_REPOS_BASE::onAddClick ), NULL, this );
|
||||
m_btnEditRepo->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GIT_REPOS_BASE::onEditClick ), NULL, this );
|
||||
m_btnDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GIT_REPOS_BASE::onDeleteClick ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_GIT_REPOS_BASE::~PANEL_GIT_REPOS_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_enableGit->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_GIT_REPOS_BASE::onEnableGitClick ), NULL, this );
|
||||
m_cbDefault->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_GIT_REPOS_BASE::onDefaultClick ), NULL, this );
|
||||
m_grid->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( PANEL_GIT_REPOS_BASE::onGridDClick ), NULL, this );
|
||||
m_btnAddRepo->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GIT_REPOS_BASE::onAddClick ), NULL, this );
|
||||
m_btnEditRepo->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GIT_REPOS_BASE::onEditClick ), NULL, this );
|
||||
m_btnDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GIT_REPOS_BASE::onDeleteClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-254-gc2ef7767)
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -10,26 +10,19 @@
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class STD_BITMAP_BUTTON;
|
||||
class WX_GRID;
|
||||
|
||||
#include "widgets/resettable_panel.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -42,25 +35,24 @@ class PANEL_GIT_REPOS_BASE : public RESETTABLE_PANEL
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxCheckBox* m_enableGit;
|
||||
wxBoxSizer* m_gitSizer;
|
||||
wxStaticText* m_staticText6;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxStaticText* m_updateLabel;
|
||||
wxSpinCtrl* m_updateInterval;
|
||||
wxStaticText* m_staticText7;
|
||||
wxStaticText* m_staticText12;
|
||||
wxStaticLine* m_staticline31;
|
||||
wxCheckBox* m_cbDefault;
|
||||
wxStaticText* m_authorLabel;
|
||||
wxTextCtrl* m_author;
|
||||
wxStaticText* m_authorEmailLabel;
|
||||
wxTextCtrl* m_authorEmail;
|
||||
wxStaticLine* m_staticline3;
|
||||
wxStaticText* m_staticText20;
|
||||
WX_GRID* m_grid;
|
||||
STD_BITMAP_BUTTON* m_btnAddRepo;
|
||||
STD_BITMAP_BUTTON* m_btnEditRepo;
|
||||
STD_BITMAP_BUTTON* m_btnDelete;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void onEnableGitClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onDefaultClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onGridDClick( wxGridEvent& event ) { event.Skip(); }
|
||||
virtual void onAddClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onEditClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onDeleteClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -633,6 +633,44 @@ bool PANEL_DESIGN_BLOCK_LIB_TABLE::verifyTables()
|
||||
}
|
||||
}
|
||||
|
||||
for( DESIGN_BLOCK_LIB_TABLE* table : { global_model(), project_model() } )
|
||||
{
|
||||
if( !table )
|
||||
continue;
|
||||
|
||||
for( unsigned int r = 0; r < table->GetCount(); ++r )
|
||||
{
|
||||
DESIGN_BLOCK_LIB_TABLE_ROW& row = dynamic_cast<DESIGN_BLOCK_LIB_TABLE_ROW&>( table->At( r ) );
|
||||
|
||||
// Newly-added rows won't have set this yet
|
||||
row.SetParent( table );
|
||||
|
||||
if( !row.GetIsEnabled() )
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
if( row.Refresh() )
|
||||
{
|
||||
if( table == global_model() )
|
||||
m_parent->m_GlobalTableChanged = true;
|
||||
else
|
||||
m_parent->m_ProjectTableChanged = true;
|
||||
}
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
msg.Printf( _( "Design block library '%s' failed to load." ), row.GetNickName() );
|
||||
|
||||
wxWindow* topLevelParent = wxGetTopLevelParent( this );
|
||||
wxMessageDialog errdlg( topLevelParent, msg + wxS( "\n" ) + ioe.What(), _( "Error Loading Library" ) );
|
||||
errdlg.ShowModal();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1214,7 +1252,7 @@ void InvokeEditDesignBlockLibTable( KIWAY* aKiway, wxWindow *aParent )
|
||||
|
||||
std::string payload = "";
|
||||
aKiway->ExpressMail( FRAME_SCH, MAIL_RELOAD_LIB, payload );
|
||||
aKiway->ExpressMail( FRAME_SCH_VIEWER, MAIL_RELOAD_LIB, payload );
|
||||
aKiway->ExpressMail( FRAME_PCB_EDITOR, MAIL_RELOAD_LIB, payload );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <wx/filename.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/wfstream.h>
|
||||
|
||||
/* ---------- GRID_TRICKS for embedded files grid ---------- */
|
||||
|
||||
@@ -317,7 +318,7 @@ void PANEL_EMBEDDED_FILES::onAddEmbeddedFiles( wxCommandEvent& event )
|
||||
{
|
||||
// TODO: Update strings to reflect that multiple files can be selected.
|
||||
wxFileDialog fileDialog( this, _( "Select a file to embed" ), wxEmptyString, wxEmptyString,
|
||||
_( "All files|*.*" ),
|
||||
_( "All Files" ) + wxT( " (*.*)|*.*" ),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE );
|
||||
|
||||
if( fileDialog.ShowModal() == wxID_OK )
|
||||
@@ -445,9 +446,10 @@ void PANEL_EMBEDDED_FILES::onExportFiles( wxCommandEvent& event )
|
||||
if( skip_file )
|
||||
continue;
|
||||
|
||||
wxFFile ffile( fileName.GetFullPath(), wxT( "w" ) );
|
||||
|
||||
if( !ffile.IsOpened() )
|
||||
wxFFileOutputStream out( fileName.GetFullPath() );
|
||||
|
||||
if( !out.IsOk() )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Failed to open file '%s'." ),
|
||||
fileName.GetFullName() );
|
||||
@@ -457,12 +459,15 @@ void PANEL_EMBEDDED_FILES::onExportFiles( wxCommandEvent& event )
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !ffile.Write( file->decompressedData.data(), file->decompressedData.size() ) )
|
||||
out.Write( file->decompressedData.data(), file->decompressedData.size() );
|
||||
|
||||
if( !out.IsOk() || ( out.LastWrite() != file->decompressedData.size() ) )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Failed to write file '%s'." ),
|
||||
fileName.GetFullName() );
|
||||
|
||||
KIDIALOG errorDlg( m_parent, msg, _( "Error" ), wxOK | wxICON_ERROR );
|
||||
|
||||
errorDlg.ShowModal();
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user