Compare commits
2249 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a0f1c4126 | |||
| a792a0e7ea | |||
| cad85c8a7a | |||
| c40d25df29 | |||
| 5d4eab87f8 | |||
| d3ee4b1eda | |||
| b331a3b3fd | |||
| 0ec0b63ad2 | |||
| 659c2184b3 | |||
| 6bbd4defaf | |||
| ea4867d5b1 | |||
| 8d14b4798e | |||
| 1283747b59 | |||
| a2df815ba6 | |||
| cd7d6d470b | |||
| e8ef3c14d4 | |||
| 3a8ca47fce | |||
| 176607db25 | |||
| c389c2f6e4 | |||
| 144de5dd78 | |||
| 139ca8f6ef | |||
| 741602c9cc | |||
| 825561d6f4 | |||
| d932043905 | |||
| 68d613ef0d | |||
| 6ffcddcb87 | |||
| e9ece451af | |||
| 5d8db7fa96 | |||
| 608de9970b | |||
| 97de56756f | |||
| 854f882090 | |||
| 1119c1e68f | |||
| c5bc58ee46 | |||
| 0cd99fc3b3 | |||
| dadec3bd25 | |||
| 6ac1bae539 | |||
| 068076a2c2 | |||
| 51fe856360 | |||
| c719b4f3c3 | |||
| f7f45dc4c8 | |||
| dfbafdc3fb | |||
| 2d62eab4b4 | |||
| 4478c09544 | |||
| 438cdafd60 | |||
| 53b6c1f39a | |||
| 0c540ebea6 | |||
| 269e88b18d | |||
| 9a86def109 | |||
| faa6582adc | |||
| 77bba5e9f9 | |||
| bbfd2fb66c | |||
| ec37f295c7 | |||
| af44f2c720 | |||
| 913a9dcdc3 | |||
| 62b264f770 | |||
| edc2938fb8 | |||
| 2498414e91 | |||
| 3c5929258b | |||
| 810a01b779 | |||
| ad2957d534 | |||
| 6742f54243 | |||
| 5437f43790 | |||
| fc14556d43 | |||
| 4bd4c43d1a | |||
| f27e85eeb0 | |||
| 16a70dd267 | |||
| a53caab12b | |||
| 2cead53fc9 | |||
| 77defa69c6 | |||
| 8c540c8b83 | |||
| 0a415fad36 | |||
| 95bb3d6bb1 | |||
| 3142172cff | |||
| 074a265166 | |||
| ce3943446c | |||
| 6c0c2b4365 | |||
| 2fc8a05aec | |||
| 3eab6c5af2 | |||
| d1bd519e7c | |||
| 0b62184c51 | |||
| 7ae4bc208a | |||
| c28fbe566d | |||
| 5ae8d9b220 | |||
| 4d3ac11467 | |||
| 5777523b35 | |||
| e0eb666f6c | |||
| 19ebe3feb8 | |||
| b9e9480e5c | |||
| 70b7131ae7 | |||
| 7ec2c004a2 | |||
| 7e884e1eb1 | |||
| 7689d48632 | |||
| 514c6c11ae | |||
| e18828bed7 | |||
| 0d52d9aa52 | |||
| bf9db2148c | |||
| 768f7c0e45 | |||
| d160459f4a | |||
| 69b16484ec | |||
| 5f023e1e25 | |||
| b7996a4ad4 | |||
| 447bb98480 | |||
| 68d43a49df | |||
| 3353297858 | |||
| f56e4fe1a4 | |||
| 5a6e6b2733 | |||
| 58b96efe06 | |||
| 0328cfe83e | |||
| 4270fece64 | |||
| 9cba0c0b02 | |||
| 64201d49f0 | |||
| c801fcd835 | |||
| aac9946aef | |||
| ebdddf0bc0 | |||
| a8ac725564 | |||
| 342684587a | |||
| 9a532f2cda | |||
| 909b7fb425 | |||
| 0913c5e167 | |||
| 9abad0063e | |||
| 4b851f9b98 | |||
| a8339496e5 | |||
| 9a183196a2 | |||
| 5a12aa9e1b | |||
| 5c0d62ac2e | |||
| 3d511efbb9 | |||
| 05a159d648 | |||
| 5a9aa812e2 | |||
| 35a9deb301 | |||
| c0ed445918 | |||
| f954ace66b | |||
| 6776f8a79f | |||
| ba345cb823 | |||
| 39abd88a54 | |||
| ecccdf0279 | |||
| 095e4a8799 | |||
| a66ae2f51b | |||
| 781c6449d3 | |||
| eca952b8c5 | |||
| 13d4ee03b3 | |||
| 22f9af6bf3 | |||
| d01c071d25 | |||
| 3f4bf9062c | |||
| 92e0d7bab2 | |||
| d9174a110b | |||
| f9c92b7c78 | |||
| bb87cd5fba | |||
| 5d21c2d300 | |||
| da08a4129e | |||
| bff99dcf73 | |||
| 1d7538a557 | |||
| e483be7726 | |||
| 3b8a34bf25 | |||
| 0f6dfb782e | |||
| c8aada9941 | |||
| 3d4fa72b51 | |||
| 936ffcaabc | |||
| 84721d045e | |||
| 0443c73aab | |||
| 5778d74fbb | |||
| b67faf780e | |||
| 3afbd8f2e1 | |||
| fb771bf797 | |||
| 46f42ba9c8 | |||
| bee41d9491 | |||
| f37fb67e5a | |||
| 940fc985e7 | |||
| 384abca49e | |||
| c04eb822b7 | |||
| 0a51662c0b | |||
| 84af2eb8e1 | |||
| f3ef0fcf57 | |||
| 59f450bcfd | |||
| 53db1d2c9b | |||
| 8cc9b69017 | |||
| 12098fe113 | |||
| 53053d0693 | |||
| 829629d05f | |||
| 49233429e4 | |||
| 47b6dd34af | |||
| 4bd71d676f | |||
| 9a860c355a | |||
| c42a473521 | |||
| 43eb124964 | |||
| 86a8bbee9a | |||
| 4897ea8c35 | |||
| fa2edf8547 | |||
| dcefaf675c | |||
| 82b2558d96 | |||
| 466ecca932 | |||
| 96adde2d52 | |||
| b2a71b505b | |||
| ecafc030ef | |||
| 6007dca4d1 | |||
| 08ecc5005f | |||
| 7b70f2835c | |||
| d8b046a361 | |||
| 9ee683e971 | |||
| 0b01c898f0 | |||
| 08e6ef95ab | |||
| dd89260db3 | |||
| 534a04206b | |||
| 25eaf50586 | |||
| e259a150fb | |||
| 6bc8d6a231 | |||
| 8122846078 | |||
| 8fbdc6a50d | |||
| 2be3ebd401 | |||
| f114bed0d2 | |||
| 31deb4d25d | |||
| 413b776194 | |||
| af18baba7b | |||
| 527695bf53 | |||
| bcd3470b20 | |||
| fd86b347e6 | |||
| 801d72c55a | |||
| 6ea28cb69d | |||
| 19196bede7 | |||
| eed87fc699 | |||
| 6c1a67684e | |||
| e5b6055e7d | |||
| 3ea78d07b1 | |||
| c8c06ff230 | |||
| bbc596ad6c | |||
| 0930828a81 | |||
| 8c71406615 | |||
| 1b01dba827 | |||
| 4aa52ddd60 | |||
| b80de21136 | |||
| ca927e4227 | |||
| f2c17a64fb | |||
| c793624195 | |||
| 42d54163c5 | |||
| 5f2f80f480 | |||
| 88be1fee15 | |||
| 0a6a44522a | |||
| 0ba54b4b7c | |||
| 56b35ef6fb | |||
| 03855be6f9 | |||
| 39b55e20c0 | |||
| 24ab8e0b52 | |||
| a961938716 | |||
| 5c2b9d6011 | |||
| 66def25eab | |||
| 16b7338a59 | |||
| 5b89f42738 | |||
| 882a0bcb7d | |||
| 629d397508 | |||
| 346384f8fc | |||
| fe4af49759 | |||
| 5370236743 | |||
| ee289e4a30 | |||
| 83ccbc7add | |||
| aa633bf2c7 | |||
| 621b92cd5e | |||
| 0d549ae203 | |||
| d944e67a69 | |||
| e2b13be7a0 | |||
| 8750485c6d | |||
| 1f9c1e6627 | |||
| 050e782df5 | |||
| 732f4856c6 | |||
| 27863c0bc9 | |||
| f0215a7009 | |||
| 3a06962045 | |||
| 6fffba5bb2 | |||
| 2ace8e0a5e | |||
| 99e99e5b60 | |||
| fc19e7dfdb | |||
| 2398fa4044 | |||
| aedfb6e6fa | |||
| c760a1c545 | |||
| bcb30ce933 | |||
| a4c3485440 | |||
| e8e223630a | |||
| 7b68bdce5f | |||
| 8884e47051 | |||
| 7c352e2038 | |||
| 2b20d3ef64 | |||
| 0d5a7f3224 | |||
| 4bc0cdd8b3 | |||
| 3511c95836 | |||
| 5456ada1bd | |||
| 1fa3ef37c3 | |||
| a5d8c49d75 | |||
| 0e69125217 | |||
| 046ecb794d | |||
| d61ebcf446 | |||
| cfb3c942d7 | |||
| e49a3275e2 | |||
| 30964aec70 | |||
| 4e39d09d1d | |||
| 162b70ce5d | |||
| 4b49d5d355 | |||
| 3e18a46758 | |||
| d6edc898c5 | |||
| 1dcaf135e5 | |||
| 25919e8393 | |||
| 1080a4e6f9 | |||
| b97769bf5c | |||
| d17c1c57be | |||
| fd1fc0f1d1 | |||
| eeddfcbec2 | |||
| fe2b9bd444 | |||
| 5ebb4b54d9 | |||
| cdd2967087 | |||
| e61505149a | |||
| 8dbe249bf9 | |||
| 38a0857a69 | |||
| 2b1b586251 | |||
| f36cdde500 | |||
| 6de1bfb64c | |||
| a5e82117cb | |||
| 2b7d04368a | |||
| a9dbdbc822 | |||
| 6528829796 | |||
| 3ad682a898 | |||
| 7aca2ee5be | |||
| 1c99f118ff | |||
| b49be74501 | |||
| 55f69da613 | |||
| ae7966a20c | |||
| 2e92fdf272 | |||
| cf9a3cdc38 | |||
| 70951375c9 | |||
| 6329a0070d | |||
| 29fae88610 | |||
| ee0c0fa6ba | |||
| 33822213e6 | |||
| cb05bedf08 | |||
| 4cf328c50b | |||
| f44eb0f8ba | |||
| 76c9029ec3 | |||
| 68e3516075 | |||
| 19ff8e95e5 | |||
| 4bf49bf6a6 | |||
| 0e377e43cc | |||
| f9f23806ed | |||
| 3569e16519 | |||
| 2a40ddd5f9 | |||
| efcd8987d9 | |||
| e66a4ce337 | |||
| 6d19d7c257 | |||
| 988aee863c | |||
| 8253899a70 | |||
| 4edca43531 | |||
| a876fc788d | |||
| cc79e5ca83 | |||
| 8aeb204c8a | |||
| db73939504 | |||
| de90187eb0 | |||
| 8aa809d2bc | |||
| 9e28d91879 | |||
| 2e89516b6e | |||
| f690b8e505 | |||
| 5964e4c332 | |||
| 6033b200e6 | |||
| 0ee33d34f2 | |||
| 44cb99f663 | |||
| 99170bc25b | |||
| 07640b1961 | |||
| e5cb41601e | |||
| f9d8e64a31 | |||
| 7bfdb82225 | |||
| 04aefeae55 | |||
| d6cad30c9f | |||
| 28358306e1 | |||
| 5539a982b5 | |||
| ed22433178 | |||
| 127876bd1b | |||
| c5cae05683 | |||
| 2f3cbdd7c5 | |||
| 9c682e2cc0 | |||
| f31dfd49d9 | |||
| 731b356c95 | |||
| 6d48a01801 | |||
| 3ec06fa3cc | |||
| 5a1d4ad491 | |||
| 581d67177d | |||
| ac6347fece | |||
| ebb42aa419 | |||
| 8223f9742e | |||
| dfdacba649 | |||
| eeeffd1ad1 | |||
| 93fc797b2e | |||
| 094d6de8e0 | |||
| 3d9fc4c40f | |||
| 3cdc207b50 | |||
| 5acd895e0d | |||
| 3715af2172 | |||
| be4d7a6249 | |||
| 04db1ff7cb | |||
| 5f1a04cfa0 | |||
| 4783e22fdc | |||
| db4903cdc4 | |||
| 248e37c292 | |||
| 8a8ba43bde | |||
| 5c0bc4913e | |||
| ca84ed7e63 | |||
| a64fb40d7e | |||
| d11102c643 | |||
| 745b5328eb | |||
| 5fefc74da4 | |||
| a3a73426bf | |||
| 276d867ab2 | |||
| 49b6a1725f | |||
| 4c67f4cc26 | |||
| b369cc4afc | |||
| 52a7f3e2dc | |||
| 85d1048762 | |||
| 8b80c79feb | |||
| 9bef4cb797 | |||
| 39edd3bdcd | |||
| b4585ce13a | |||
| e47790c3f8 | |||
| 5098088237 | |||
| b1c0d614a3 | |||
| 66c9d29539 | |||
| 655c8e609d | |||
| 948a0713d5 | |||
| b43d883db6 | |||
| 73367a10ea | |||
| b9eba042c0 | |||
| 17a33166a4 | |||
| ffbaf87dc9 | |||
| 8ea74c38c3 | |||
| 5789f20794 | |||
| 133e60410c | |||
| 57a8622e9a | |||
| 634039d81a | |||
| b9c9990bdb | |||
| 1e31e737f5 | |||
| 5e3f579431 | |||
| e9e4df8d01 | |||
| a3cdc4fb83 | |||
| c034e5922f | |||
| 3d8d726a52 | |||
| 1b09ac4757 | |||
| f7012d8275 | |||
| e61950267b | |||
| 4c9ff08f4f | |||
| 8668488a20 | |||
| 31f8dc5cbf | |||
| a477129bc1 | |||
| c46b8aecbc | |||
| a010b6177c | |||
| d38b7012e9 | |||
| 6a6152eb0a | |||
| 15121e6d4e | |||
| a8e44d0093 | |||
| fd8f74cf43 | |||
| 472e4da100 | |||
| 607fe8ed4b | |||
| a0a479eb53 | |||
| 04cdb15ceb | |||
| 180e0a3645 | |||
| c931800642 | |||
| e839d1a129 | |||
| 1efec52b33 | |||
| 3799481c35 | |||
| c1025612d1 | |||
| e07a8fbe31 | |||
| 2d52cb1d55 | |||
| a1cdbe5762 | |||
| 2f3bbf1f59 | |||
| 7ceb13d041 | |||
| d04d93eb9b | |||
| f6a3bc9168 | |||
| dca79490da | |||
| abf37168de | |||
| 67fadf0c94 | |||
| 1b29805fc9 | |||
| fcd3bbecdf | |||
| 3d767ffcc7 | |||
| f88711ebf9 | |||
| 17cd564ba6 | |||
| 8bb3bba7e8 | |||
| 5d3dda7a9d | |||
| 5761c182ee | |||
| 0e23e23a7c | |||
| e2736f4db1 | |||
| 1ea78293d0 | |||
| df0a195f38 | |||
| b00d23c46c | |||
| ed4966a3ff | |||
| b03359a3db | |||
| d4e07e981a | |||
| 2d097d0fd7 | |||
| 278b4547f4 | |||
| ee84127892 | |||
| 3724c40afd | |||
| eaada4cf1f | |||
| 033b25de32 | |||
| 32a12d1d6f | |||
| fe27b0e2ba | |||
| 66fcd4c5a2 | |||
| ccdeb6dc0a | |||
| b579262869 | |||
| 11f1dd1623 | |||
| 6a9a25fc54 | |||
| ef47f6cfd2 | |||
| cecd75063e | |||
| 6dad482efa | |||
| 4aae4489b9 | |||
| 1b00dede02 | |||
| 5700075b7a | |||
| 5a461f5bb3 | |||
| a6cbdccadc | |||
| b662a577ea | |||
| 128b1a423f | |||
| 5e41599d13 | |||
| 2cab94f56c | |||
| eedd673d4c | |||
| 25ffde5a42 | |||
| a06134cd6c | |||
| fa57fee9bb | |||
| 404bfdcf30 | |||
| 87d81a6d92 | |||
| 7d41dc1616 | |||
| c1e1502d35 | |||
| 73949712f6 | |||
| 61778974a4 | |||
| c817deb652 | |||
| 802a0117a7 | |||
| 9b2a450133 | |||
| fcfbe920d5 | |||
| b57331f450 | |||
| 944a61100b | |||
| f8ae1a9997 | |||
| 8ea015aaab | |||
| e38019d74e | |||
| 7da892b49a | |||
| 60c84abfe4 | |||
| efa1ac3807 | |||
| f6b7ab7994 | |||
| c0b6d159fc | |||
| fa85685baa | |||
| d1883bdd9d | |||
| b4ff4df808 | |||
| 3254bfa619 | |||
| bf26cf175f | |||
| 2c287965fc | |||
| 4551ded37e | |||
| b4d05af28f | |||
| eac742e3db | |||
| 57a1201b11 | |||
| 85a8a71fc5 | |||
| bd6bb510f8 | |||
| 0cf8221e62 | |||
| 36d4e8fa62 | |||
| a384290356 | |||
| 8b9226d820 | |||
| 35e639c599 | |||
| 3a7f5fcf03 | |||
| 881cbd6d2f | |||
| b319b710df | |||
| dd1ad34cea | |||
| 9406893722 | |||
| cea4d89697 | |||
| 7bbd31fa2a | |||
| c6d9a04dba | |||
| 77fc1aecb2 | |||
| 24da541747 | |||
| 02f7e9c800 | |||
| cbbc2f42e8 | |||
| 7e73dad7b0 | |||
| bc67fc338e | |||
| 6054e7be0a | |||
| a7f31c59a8 | |||
| 345e97f296 | |||
| 7716d4592d | |||
| 7e4eba9eed | |||
| a1089c9dd6 | |||
| 9a032e7422 | |||
| 55dddb69f7 | |||
| 580d42a63e | |||
| 1a1416aaa4 | |||
| 1d74450216 | |||
| 446a0a174e | |||
| 6405273059 | |||
| bbd0a41191 | |||
| 7bc9003fb8 | |||
| 7c745cd9c6 | |||
| 202f7f9107 | |||
| 1e1fbb4ccf | |||
| 0b17e5d288 | |||
| 3b046c409b | |||
| 9eeb56fe3e | |||
| 3124f8133a | |||
| f99ca77461 | |||
| 0bc1c08d4f | |||
| 3fcf44ae32 | |||
| 4d1dc14b45 | |||
| e4710f54f8 | |||
| ce983ec34a | |||
| bf9b535f66 | |||
| a2f0110f3d | |||
| 367924e669 | |||
| 9c6998c6bc | |||
| 1bf848e418 | |||
| d62e474850 | |||
| 7546333fbc | |||
| 405bb0ad90 | |||
| b7e9f8ce1e | |||
| 00a2da7d18 | |||
| 86c29e23df | |||
| 8765d96c4b | |||
| ee6233b893 | |||
| cebdb43234 | |||
| f65da3d98f | |||
| e6e13b2609 | |||
| 96774bb98c | |||
| 681301ab9b | |||
| 0d68dfcbc1 | |||
| 0a17e9a236 | |||
| 8597d2c681 | |||
| eca53baf6f | |||
| b7bc4ea43e | |||
| 6ab2f35f74 | |||
| c015153e21 | |||
| 7a74418c39 | |||
| 6033b3599e | |||
| 37d98063f0 | |||
| 7fe85b44f9 | |||
| 68125a7f50 | |||
| 166879a1c8 | |||
| b518569674 | |||
| 6a25e05e3c | |||
| 179862b10a | |||
| 339cf51c0c | |||
| c8d06997f5 | |||
| 57979f3c9b | |||
| e70a0e4e0e | |||
| 6268fe957a | |||
| 49ce5eecdf | |||
| 4e1da2b6d0 | |||
| 3f7d24bccf | |||
| de0c051e51 | |||
| 1ef99e657f | |||
| 7cbe1c0a44 | |||
| 8c45f18409 | |||
| ae3c02abae | |||
| 543d4af682 | |||
| 19c49fa82b | |||
| a723b8de7a | |||
| 21c3926714 | |||
| 3d79bf82f4 | |||
| 6338f88db1 | |||
| fdfe60dd09 | |||
| cdff2d0d41 | |||
| eb290bf362 | |||
| 18618deea3 | |||
| 67b64f5ec6 | |||
| f394f2c57f | |||
| 46670c7eeb | |||
| eefc79b5b2 | |||
| 744dd4893d | |||
| 7eed86de38 | |||
| 1c04f5a03c | |||
| 9d9d74faad | |||
| c2342776e1 | |||
| 09aa89f3f9 | |||
| a8430e09f5 | |||
| 768b039cde | |||
| 3f1b9a6b4a | |||
| 638e29b5d6 | |||
| 5abc48269b | |||
| c81b17c1cb | |||
| c928bc8ce3 | |||
| f33a4975ef | |||
| 5920137968 | |||
| f636e1d45f | |||
| 7e6a243df9 | |||
| ad7ba8f029 | |||
| 3096a26b59 | |||
| ff2a719bf7 | |||
| b6c4aaac8e | |||
| f7ad4ca025 | |||
| 4666b7fb69 | |||
| 125ce48525 | |||
| 114d12b060 | |||
| bf1566884c | |||
| fa7b6a8cec | |||
| 9855104120 | |||
| 36f7125513 | |||
| 6ebd5ddc53 | |||
| 2bc4103ea9 | |||
| 01eab7dccb | |||
| a95dee3d09 | |||
| 891c85a2c1 | |||
| 386f9b2074 | |||
| 325d5a6bcd | |||
| f05d7f4176 | |||
| a8ea2e05a4 | |||
| 8bcb88d6fd | |||
| f9bd431d56 | |||
| 0c6e180937 | |||
| 2c5fcd7d2c | |||
| 1a19c761ae | |||
| 71b8823625 | |||
| 24cab0eabd | |||
| 3e5c236942 | |||
| a3f74b2f68 | |||
| 2d09237bd7 | |||
| d26b94db61 | |||
| 017c41bc5f | |||
| d7857dd026 | |||
| 7ac5a172fa | |||
| f44a64a705 | |||
| 490b630e2d | |||
| 1265dc6334 | |||
| 69f994e1b2 | |||
| 0f841f194f | |||
| db6aecda47 | |||
| 83ca78a5fb | |||
| 2f0ae47c8e | |||
| 11a2d81738 | |||
| bb4ea2db67 | |||
| 70a2321cc1 | |||
| 2331742384 | |||
| d41ea73765 | |||
| 5a5616f258 | |||
| bd3108a40c | |||
| 8c9a12e3a1 | |||
| fe45fa81fc | |||
| 3e30600f70 | |||
| 5c05ec5b98 | |||
| 7024117709 | |||
| fd38b708fb | |||
| 153020283c | |||
| b41d1e0eaf | |||
| fcbfd00b98 | |||
| 51edb08796 | |||
| bb087fdc45 | |||
| a4a2196cc2 | |||
| 8ab96afd5b | |||
| f5b230a2ef | |||
| 076defb0a5 | |||
| 76660ff15b | |||
| 60471ecc1e | |||
| 9e68ba1ea3 | |||
| 414dddbf59 | |||
| a0c61484d2 | |||
| 7f6787c8b8 | |||
| 8c74dcde28 | |||
| 27332a8a17 | |||
| 8733da346b | |||
| e644f5be05 | |||
| 7007601655 | |||
| b1fc1cd11e | |||
| 919edcf1e1 | |||
| d99260c614 | |||
| cf9d1ba541 | |||
| d6628419c9 | |||
| 75eb5491d5 | |||
| c32d8f38ed | |||
| 9f22c35519 | |||
| f775500932 | |||
| fdbdb76c39 | |||
| af26e17fa7 | |||
| 769bf51359 | |||
| c81c316a46 | |||
| e5192ceddd | |||
| 89ddf97fa0 | |||
| 79b2eb0ff7 | |||
| 0ab0c7b8ed | |||
| 1d582a515c | |||
| a4a6064316 | |||
| 910d95a7b6 | |||
| 3cedadd738 | |||
| 3ba2d4428b | |||
| 7a545df299 | |||
| 2b3d6075e2 | |||
| 1073a524b9 | |||
| 6dd9cb6fb8 | |||
| 6789755b06 | |||
| e7dae3a9c1 | |||
| 1f78a15db2 | |||
| 79a4f42ef9 | |||
| 8fdf3799a2 | |||
| 4b095ab61f | |||
| 757d617ef3 | |||
| 17923c0d9e | |||
| c9f9db9069 | |||
| 90d03c784c | |||
| ea436444f2 | |||
| 209bb4290f | |||
| 7d9d2e508d | |||
| 5bd8e7d4e8 | |||
| 30f19be555 | |||
| 3e140ddcfe | |||
| 81143324a5 | |||
| fabb646a0b | |||
| 85131e359e | |||
| 5a0f8019c7 | |||
| f067dc8b32 | |||
| 14110cdea8 | |||
| f885296fb2 | |||
| a6c5f46f2d | |||
| 145ea35ac3 | |||
| 1399ed198c | |||
| c2fb99ce49 | |||
| 53542a9d37 | |||
| e77690c268 | |||
| d8e45ef866 | |||
| ffc24ad518 | |||
| b79c17b43c | |||
| be415dab1d | |||
| d0278dad15 | |||
| 927ff2bca7 | |||
| fc7b9029c9 | |||
| 187b529dbb | |||
| 2061947138 | |||
| 04c24cb686 | |||
| f38935459b | |||
| a6ce907a4f | |||
| f1dbfffd82 | |||
| a46d344db2 | |||
| 5476a03799 | |||
| d4569d66ac | |||
| c4ce6d9ab1 | |||
| fa083142a7 | |||
| 8aa8451434 | |||
| a1f81bbe97 | |||
| e9669c6594 | |||
| 690e7144c1 | |||
| a53b3d496c | |||
| be7f436951 | |||
| 7708753ed3 | |||
| 95d5ab706a | |||
| 7afb4e68f1 | |||
| 4caad33c9a | |||
| 1ece12b907 | |||
| 88c2f8504e | |||
| 9137a9ec80 | |||
| fad35e7e00 | |||
| 009925724e | |||
| 8504f30594 | |||
| 96116659be | |||
| 1e7df3606a | |||
| 603029b106 | |||
| 4ca54b2f1d | |||
| 555e24dc59 | |||
| a651aaea00 | |||
| 258b804941 | |||
| dbb4e67737 | |||
| ec1a5d1318 | |||
| cdab6cfdbe | |||
| 33b3d5edfb | |||
| e1aa6f7e84 | |||
| bfc1665d87 | |||
| 9e937f8113 | |||
| d114d9e386 | |||
| 4e8d1366b6 | |||
| 8afb0255f0 | |||
| dac6c662c5 | |||
| 577229bb6e | |||
| b5fdf4f1da | |||
| bf7d383066 | |||
| 6e977b668c | |||
| fdc52d933a | |||
| 316f7309a1 | |||
| ff75a28080 | |||
| e7b5e816d0 | |||
| db41bc2870 | |||
| 585aeb7f91 | |||
| 1b644a164e | |||
| c4e42f46a9 | |||
| bff4d1239c | |||
| 8a89e160ed | |||
| 198052358e | |||
| 6730b7d656 | |||
| f917efd430 | |||
| 7d51fc7dfb | |||
| b192495bbc | |||
| 34a697fc37 | |||
| 2dda514cb0 | |||
| 82d667e30c | |||
| 29b0b9cfcd | |||
| ed7f92ebc7 | |||
| 93ae8f4066 | |||
| 6b030ac9be | |||
| 8470c44bb0 | |||
| 4c75540ca2 | |||
| 70f43b0003 | |||
| 91452f3b58 | |||
| daeb396fd8 | |||
| ad649d9670 | |||
| 0038722d0f | |||
| 6a00664b2a | |||
| 2956543d27 | |||
| 0fcf722af4 | |||
| ceebdbfdd3 | |||
| 1b05af7f8e | |||
| 123b7b5537 | |||
| 5fa1257e2c | |||
| 5c405a6f40 | |||
| 03b5d6125b | |||
| 2376811df8 | |||
| c48997608d | |||
| 8a5285db41 | |||
| c4d6fc943a | |||
| 3655df08ea | |||
| 7858e6aa7c | |||
| c909988aa5 | |||
| 5deaba9669 | |||
| f162b6662b | |||
| 2d5f342ee8 | |||
| 85a2aee79c | |||
| a4cc671c22 | |||
| 2912138ef2 | |||
| cdae489afa | |||
| 51ad0c18ff | |||
| 998255fb1b | |||
| edfb5811cf | |||
| c733b32672 | |||
| 38862c1a09 | |||
| 03161c81df | |||
| 264c73747a | |||
| 5e53e410ce | |||
| b42ec57f6f | |||
| 4d0f664f50 | |||
| 2ea3b8b068 | |||
| 0810492a2c | |||
| c5178979ce | |||
| 08bdaf07be | |||
| 832764aa3a | |||
| 43c87d0cb6 | |||
| 6a6b944c00 | |||
| 90eb83dcb2 | |||
| 31b722f9d3 | |||
| e3351a9686 | |||
| 19dea9095e | |||
| 3b023da602 | |||
| 33d0a72fce | |||
| 5136fc535f | |||
| 16a21ade8f | |||
| ec2b2dc291 | |||
| 2703a5aebd | |||
| 4bdd21b281 | |||
| 499d41206e | |||
| ece008e790 | |||
| d1cfa88bc0 | |||
| 0e28b55184 | |||
| afccbbe04d | |||
| a4cec09781 | |||
| 54d70ec738 | |||
| 39c3a38e2d | |||
| 699897ddf8 | |||
| 00d3af4816 | |||
| ceadbbcdc1 | |||
| e703b53b3a | |||
| f037cc3c74 | |||
| 7dec942ef7 | |||
| 1d0ca22572 | |||
| a6decc3cc7 | |||
| b58cc107e6 | |||
| a593306a06 | |||
| 0177590699 | |||
| 787fe28fd0 | |||
| 541568e09f | |||
| 5dd7ef6895 | |||
| 153df79699 | |||
| 4ad9af71f5 | |||
| d76671a601 | |||
| ea094a4fbc | |||
| cb11dad4de | |||
| 817cf192c8 | |||
| aec00ab96f | |||
| 48b288cdc2 | |||
| 66d257f620 | |||
| dd14218c34 | |||
| 918231795b | |||
| 9f71172437 | |||
| 69e3b23960 | |||
| 7b426e8103 | |||
| 27e1043fc4 | |||
| 76518712c4 | |||
| 64843d6b0a | |||
| 87fa661591 | |||
| 2ec6d22131 | |||
| f6ac92dc39 | |||
| be69f7ad20 | |||
| 9a7cc494f7 | |||
| 8c3d4d4eda | |||
| 636ca7a74b | |||
| c57c1e94d1 | |||
| 1e1c2cbb7d | |||
| 5399b6f438 | |||
| 41b6c8434a | |||
| 3031b9e6a5 | |||
| 0d5331df59 | |||
| bca75d4930 | |||
| a70965eb6d | |||
| ad21bfda4d | |||
| fef46ffacf | |||
| f803745fc6 | |||
| c36ab1c6ed | |||
| 28f9d7f28f | |||
| 5b225186c4 | |||
| 09bb2a6054 | |||
| e1ea1237b7 | |||
| fb65f5d1ae | |||
| ff439ecd7f | |||
| 4cc4df87ff | |||
| 56aabe20bc | |||
| 4b624381e0 | |||
| c5508f34b3 | |||
| 3c667d7652 | |||
| 4664427784 | |||
| c747ffef95 | |||
| b5b1777304 | |||
| 228004b472 | |||
| a1f91c08ad | |||
| 96dc27d9e6 | |||
| 11f9f15199 | |||
| 991a92429e | |||
| 4f17dc0716 | |||
| 37c7fa9fb4 | |||
| fd2f700390 | |||
| 97255b2b7f | |||
| 8d32141b8f | |||
| 7700779e2c | |||
| 1cc9d2ce5a | |||
| b9980df1b7 | |||
| af8b256a00 | |||
| 324c39931c | |||
| 113325673f | |||
| 857b02706e | |||
| 1e0f1b39b0 | |||
| 6a429facb6 | |||
| 8663a6c7a0 | |||
| b6ec124ceb | |||
| 85a3b72c71 | |||
| d9b489d471 | |||
| 3289c6c305 | |||
| ec83adde3f | |||
| 206c8e1189 | |||
| 07545ba49c | |||
| 8312497d6c | |||
| eed2bed0bd | |||
| 49045cf08c | |||
| 55f7a99d1b | |||
| 98addf78b4 | |||
| 4b42ec3218 | |||
| e469d9d1f9 | |||
| d53d9d88fb | |||
| ed484deec6 | |||
| df9502dd06 | |||
| 6001254160 | |||
| 2b0c4ba215 | |||
| 1e9088f7d2 | |||
| ec9e283d34 | |||
| 20e7d431a6 | |||
| 6c745e6e9b | |||
| d1635e17f6 | |||
| f9e5881b45 | |||
| 869505a659 | |||
| 895d265603 | |||
| e5e60c6bed | |||
| 568e6c8093 | |||
| cf01f1a264 | |||
| be7de02a1d | |||
| b8d88f0dc5 | |||
| 698bc0cdac | |||
| 48a7a863ae | |||
| f2c4fa2b46 | |||
| f996d6cc7a | |||
| 0dbf3ef30a | |||
| 76b558c831 | |||
| c10bb66b12 | |||
| 89a391d001 | |||
| 0fef63956f | |||
| 63c2af4fa4 | |||
| 3ff7ddbea7 | |||
| 21733e7bda | |||
| 3fa60aaed8 | |||
| 9422e37c45 | |||
| c074c8c9d4 | |||
| 27c4956046 | |||
| ebbd7c48d3 | |||
| 079edee146 | |||
| 87f9452bbe | |||
| 9c0c64e87b | |||
| 3b65c120e8 | |||
| 3289835b53 | |||
| 7745d37d6c | |||
| 37e440b093 | |||
| 7792364e8c | |||
| 3a4ad03492 | |||
| cac7dbc607 | |||
| 7326c9cb73 | |||
| beb8e76bb4 | |||
| 43e37caf46 | |||
| a985798a86 | |||
| d09cca948f | |||
| 3f52031b86 | |||
| 7448116f37 | |||
| 4e0d54fe21 | |||
| 10d8275962 | |||
| 157cbc2f68 | |||
| 7d64d2e92a | |||
| f86261c812 | |||
| e1eb33a320 | |||
| cadcc20ea6 | |||
| 56ad7642c9 | |||
| d1695d3408 | |||
| b51fbe5c50 | |||
| 04c0ba65d2 | |||
| c2f5e7d88c | |||
| f456a92f08 | |||
| 48419d8fd9 | |||
| 0ef5dbac4a | |||
| 8014e0d993 | |||
| 739238659e | |||
| 6de593c771 | |||
| 4e9fd3ee9d | |||
| 900056be44 | |||
| 221cb6d5b2 | |||
| 83e693c78a | |||
| 8db5848e91 | |||
| 27807f02c5 | |||
| 30e31ff164 | |||
| ee0fe85cd0 | |||
| b2270b2f4f | |||
| 141252b73f | |||
| 7c4ac2e3a4 | |||
| 46b731b2d3 | |||
| bd76e47976 | |||
| bd2c878b35 | |||
| 84ee9591d1 | |||
| 15b27fa35f | |||
| e41536484b | |||
| d3004fc833 | |||
| 395c5fc922 | |||
| c20de314cc | |||
| 4881e6477f | |||
| 93609837dd | |||
| a8b3c20e66 | |||
| db2fba1faa | |||
| bf9cbb4491 | |||
| 18f32cfbd6 | |||
| a5a3ef17b8 | |||
| 326b827cc6 | |||
| 961efac8e2 | |||
| 418d26d250 | |||
| 07fb2a3e93 | |||
| 5006cca67b | |||
| 735e3b71d6 | |||
| d9da8228d4 | |||
| b5a7e66134 | |||
| 00bc96a2b7 | |||
| 5dd66771fb | |||
| 6f19a7deac | |||
| 811585b00f | |||
| f610377363 | |||
| 8c549a28df | |||
| cab22ffeac | |||
| 60c9f576f6 | |||
| b619c2069f | |||
| 3efdcb95cd | |||
| 4b11862ecc | |||
| c5e9b187ae | |||
| 04fc574229 | |||
| f6b6665fed | |||
| 0da9086397 | |||
| c5852c1237 | |||
| 5bbd7cb013 | |||
| a3b4a09fd2 | |||
| bf783c42bd | |||
| 57e832dc65 | |||
| ab2d301968 | |||
| f1f961a43e | |||
| 8e345bd09c | |||
| 0996c307ac | |||
| fb8e505590 | |||
| ec2804a78a | |||
| 29d2ee3273 | |||
| 6e3e6a1944 | |||
| 1005fd2872 | |||
| ab666cc267 | |||
| e79df21353 | |||
| ff0ddbcac0 | |||
| d1604137cc | |||
| 969efff611 | |||
| 293f7cca28 | |||
| 45a48cfcb2 | |||
| 822cc6a781 | |||
| 658f02a6b9 | |||
| 8d675d9bc0 | |||
| fdf135d877 | |||
| a2bb144556 | |||
| c867ed9de4 | |||
| 39ef596bdc | |||
| a9bcaa1493 | |||
| f05163fbeb | |||
| 7ad3e0c544 | |||
| 24882a9324 | |||
| 9bb6ead2b1 | |||
| d6bcbc5cdf | |||
| dc4b261c68 | |||
| 9262f13eef | |||
| 82998d0cc0 | |||
| 8949cfe584 | |||
| c10d1fe279 | |||
| 9ed5ee8310 | |||
| 7b266ef475 | |||
| 09f1a4fbb8 | |||
| c7f55381a5 | |||
| 81f35ffe73 | |||
| 597b362603 | |||
| 0163e4b4e4 | |||
| 98a77ee649 | |||
| c9edd2c8de | |||
| 379ad3a8e7 | |||
| aca64b5dda | |||
| d34639b79b | |||
| 0d4b157207 | |||
| 58160d9624 | |||
| 57e34dfb3c | |||
| 67ab19289d | |||
| 7718bf6858 | |||
| ee467d0203 | |||
| 9b7265810b | |||
| 24dc1092b1 | |||
| ab953f1381 | |||
| 83174e996e | |||
| 38069048fd | |||
| 9fda651595 | |||
| cb13ae57bc | |||
| 6a45d30715 | |||
| a43f24617d | |||
| f11a148d2d | |||
| 73cf4c0e49 | |||
| 8ea3cd1cb5 | |||
| 62979ae06d | |||
| 5e998288d6 | |||
| e01b851e1c | |||
| 2e6a40be96 | |||
| 02c1ec5efc | |||
| 78a6ba31d8 | |||
| 1ae23df0ba | |||
| 36ba9a7309 | |||
| 7ee129b21a | |||
| b3d4123007 | |||
| 5bfd330692 | |||
| 49125d1a7d | |||
| 6050ef41a9 | |||
| 0d809688ee | |||
| da20e80de6 | |||
| 1f46bf2e28 | |||
| f345dbe7e4 | |||
| 490c8d856e | |||
| 897a5b8de6 | |||
| 155cb4f158 | |||
| 445cf5860a | |||
| 6cb1bae032 | |||
| c0c9d667cd | |||
| b946032f56 | |||
| df8826240f | |||
| 5dda4f95a6 | |||
| f3822e6ffa | |||
| 084ad26b73 | |||
| fafecb491e | |||
| 0e6a590305 | |||
| 0e8c9fda5e | |||
| d2ac283570 | |||
| 69bdc16751 | |||
| b8325a38a1 | |||
| 403a1a7e1f | |||
| cf481d2fc4 | |||
| c3e3fc4dba | |||
| 254ad1b26b | |||
| 2c642afd04 | |||
| e43fab7c01 | |||
| 55f2914163 | |||
| 96d7ac7c6a | |||
| c9be096e88 | |||
| e18b8642c4 | |||
| dad83c9004 | |||
| f0a86c360c | |||
| c6444b7d05 | |||
| 6b81b6931f | |||
| b391fb3faf | |||
| 2649c38bf7 | |||
| 81266f2f71 | |||
| 05189f9ff5 | |||
| a3f8783dca | |||
| c20d23a552 | |||
| d2ed926077 | |||
| c0b3ad8253 | |||
| 30495f780a | |||
| a2114c44ad | |||
| 0f06a927ff | |||
| c5c41b8ab5 | |||
| 1f4ca54938 | |||
| 720e3e9272 | |||
| a42400272d | |||
| 19558b48c1 | |||
| 744d875838 | |||
| 59d2523c49 | |||
| 13fdde5e5d | |||
| 86e73c1bae | |||
| 6cd558fd5c | |||
| 8f45c7d27e | |||
| 3518b18351 | |||
| 6dea106650 | |||
| 123a29d126 | |||
| 9a8383de24 | |||
| 2453201d7b | |||
| 14deef3adf | |||
| 8c191e5ba8 | |||
| 20fc4a2efe | |||
| 49a577dd59 | |||
| 8b8f5d45c9 | |||
| cec687bad2 | |||
| 9891e2d986 | |||
| 24b23e2383 | |||
| 413aa106a2 | |||
| 097dcd724f | |||
| 1454880fb7 | |||
| c6a712dec3 | |||
| 2c888b86f5 | |||
| 7481dcf520 | |||
| 435a34cd60 | |||
| 23ffcf8f89 | |||
| 89d6a09401 | |||
| b8fce6a8e1 | |||
| 523e7eb397 | |||
| 30a3668779 | |||
| d95ea479c4 | |||
| baf18a6379 | |||
| 92831ee7d4 | |||
| de823996b5 | |||
| 936974f12c | |||
| 0c88507dcf | |||
| 9184095b34 | |||
| f1eea58b6b | |||
| 49f2206ef0 | |||
| 8f94a14063 | |||
| 9843e0c436 | |||
| e3149cd2b0 | |||
| 7c5d2ab029 | |||
| 6422be116b | |||
| 50eef193ff | |||
| 8092d98ea3 | |||
| ed42891509 | |||
| 6124226428 | |||
| 6c22590d4a | |||
| 950d9ae23a | |||
| a12ff75fee | |||
| 681413bb97 | |||
| 1ebe2c8728 | |||
| 41dd21ac7b | |||
| 6b6d9706bd | |||
| 1b57a79636 | |||
| a1f3b7d53f | |||
| 1118ef8f19 | |||
| 4b9526adb1 | |||
| ef3f42dfab | |||
| 6f018668c2 | |||
| f20d6e8d05 | |||
| 0574bf8aba | |||
| 7ea9f8ddcc | |||
| e4d9cb77fc | |||
| 7eee33a6a0 | |||
| 3bbafe14f5 | |||
| 1dc048662b | |||
| 7546651a30 | |||
| 6d16131b03 | |||
| 7eb196b4d1 | |||
| 1e8f7f7ba8 | |||
| eefbd1610e | |||
| 0f8af51da6 | |||
| c14dad91b2 | |||
| 2538262531 | |||
| 453a135a3e | |||
| 0cfa6d8097 | |||
| 7e77f3b902 | |||
| 71d2467963 | |||
| a6140c799d | |||
| bd7217b090 | |||
| cc45f4f212 | |||
| d95710f8e0 | |||
| b3703f1f91 | |||
| 104d63fd7c | |||
| df994764a5 | |||
| 764ef2dcc9 | |||
| 1dddc22a9b | |||
| ebac5c4a70 | |||
| 59a3715e40 | |||
| 86bb2f325e | |||
| eb370afe4a | |||
| fc06b1762f | |||
| a1fed86b28 | |||
| a96a265a7b | |||
| a2d65bb523 | |||
| 7c966fa775 | |||
| 8042d6f892 | |||
| d4c8c0bb52 | |||
| 148d567aa4 | |||
| 85e96c92ed | |||
| b25e440ba9 | |||
| c4d874cdb1 | |||
| 4e96cc4bbb | |||
| 78f928544f | |||
| 0edbe77903 | |||
| ccf8c3bd83 | |||
| f8020f4728 | |||
| 23bded5697 | |||
| 9df7292af6 | |||
| bcb05fbc14 | |||
| 7adc495692 | |||
| 69f8ee8ee2 | |||
| 4acb97e02e | |||
| 7cd840bf83 | |||
| 9577736788 | |||
| f7ec499ee9 | |||
| a64e1b3397 | |||
| abeba63ed5 | |||
| 0dd05887d2 | |||
| f8b3873b83 | |||
| 63362c97f5 | |||
| b07b214293 | |||
| e368ae3230 | |||
| 9cf627a656 | |||
| 5d383f1885 | |||
| f9b7ede7ff | |||
| a2a44bb7ef | |||
| 1f37ca437b | |||
| ac77e047f4 | |||
| 02a6baad8a | |||
| 799ef3bc0d | |||
| b337dccd0c | |||
| 8867bf262b | |||
| 0543670734 | |||
| 9c66afb6fe | |||
| 0dc8241605 | |||
| 7ca5c4099e | |||
| e40c8fa164 | |||
| df88d0cbea | |||
| f73e785662 | |||
| 1bb685cc57 | |||
| 5d4da5ede9 | |||
| fe295788e7 | |||
| f8b3eaedb5 | |||
| e5e83eba05 | |||
| 28a35c9883 | |||
| d8a6c7c1bf | |||
| c8f6806287 | |||
| 8bf57814a4 | |||
| c2d4338024 | |||
| 6410862b15 | |||
| 4845668a4a | |||
| 146adbf831 | |||
| d1f291acb8 | |||
| 4b7c3010e0 | |||
| 4039f66530 | |||
| 4ce6362f4c | |||
| 5765ebef08 | |||
| a3eb501225 | |||
| 82706bf152 | |||
| 5e852ba1fd | |||
| d49cdb2ded | |||
| a8ad1f8097 | |||
| 2ea3c4acac | |||
| d1e3bad24f | |||
| 06f46e4b14 | |||
| 54714fd989 | |||
| 912d308b9d | |||
| 0b71e4a98a | |||
| 900bef9ccf | |||
| 7106d1e605 | |||
| 6840ec0d09 | |||
| 0e8e811b14 | |||
| 3dc986bbf6 | |||
| 34813dc07c | |||
| f79d75076c | |||
| 57b5ce84a5 | |||
| 395338f46a | |||
| c33cd27626 | |||
| 2ca4512443 | |||
| 76b4dc7346 | |||
| 53609d2ecd | |||
| d24054ac00 | |||
| 2c0619f69d | |||
| f039aeb4c8 | |||
| ab0e47d402 | |||
| 03128b7530 | |||
| ed3e79325f | |||
| c4c715fcd0 | |||
| 86b83ddbc9 | |||
| 62c43eaf53 | |||
| 33cf2243a8 | |||
| 02a1c2f096 | |||
| b841150c23 | |||
| 3db19ba2eb | |||
| 22d1f50455 | |||
| baee140518 | |||
| deaa4529ae | |||
| bed29749f2 | |||
| e57cbd3348 | |||
| 2f788445a9 | |||
| d4e55c69c1 | |||
| d07351c8ba | |||
| 2412caf494 | |||
| 9b6f75afd3 | |||
| a4b2a6537c | |||
| cfaa7d9e54 | |||
| 0ca3012c67 | |||
| 42ebece808 | |||
| 0d7510c129 | |||
| ebe697f62a | |||
| 29240fd14b | |||
| 97f4d18a13 | |||
| 8ef0dd69da | |||
| 30d41b33d1 | |||
| 2ce06cfe08 | |||
| 3b1a1125d2 | |||
| 93cdfb566b | |||
| b61ac2069d | |||
| 6e8a71ec34 | |||
| 3b3fc0151e | |||
| f5643f2332 | |||
| 38e5d961f6 | |||
| 5be15bed82 | |||
| deb6aa8cc5 | |||
| 3b3e19ee8a | |||
| a713e47713 | |||
| abbc83bd51 | |||
| 7d4aaa8cdb | |||
| 06b3172333 | |||
| 2062cf8fe4 | |||
| 3e15da5bcc | |||
| 520eace689 | |||
| 9ed3c5dc46 | |||
| 7db3834f0b | |||
| 5979b1a1b6 | |||
| d283a8c878 | |||
| 3f2a258930 | |||
| 550d36dc33 | |||
| 46b9d9e359 | |||
| 3e084a3b0e | |||
| 391a663360 | |||
| 068ae2f344 | |||
| 64dfea78b8 | |||
| 3bbcd30396 | |||
| 09bfd3311c | |||
| fdd0e02c35 | |||
| 10b5322b87 | |||
| f01feef636 | |||
| 1aed2b3114 | |||
| adc9b70d72 | |||
| 5f86a70891 | |||
| ea9a84b748 | |||
| c73ca9a6da | |||
| e467e58857 | |||
| bb73777a4a | |||
| a63a62f827 | |||
| 1c6574e69d | |||
| 313785b421 | |||
| b6261f3d80 | |||
| 3dc4de85b5 | |||
| bb0711eb3f | |||
| 0cb647ee1e | |||
| 5a0c37e2b9 | |||
| 4a3ddd5b2c | |||
| e6095e6fd8 | |||
| 33d1d0f8e4 | |||
| d02025b0ed | |||
| 28af99d95d | |||
| 619c8e689a | |||
| c03355d67f | |||
| 417572f3c5 | |||
| c5ed76f104 | |||
| 5721a279c8 | |||
| 0cf8553b2e | |||
| 6d5b865741 | |||
| 7b08e81991 | |||
| 6d4e0ff665 | |||
| bd6ea96ed6 | |||
| 9feccc625b | |||
| 65949662f6 | |||
| 22defb9ad4 | |||
| 37cb4d00df | |||
| a48c0ece4b | |||
| b8c77dc417 | |||
| ed42ae5a79 | |||
| 20f83297ce | |||
| 896dc0fcf6 | |||
| f8a238e670 | |||
| 3b8f2a551b | |||
| 2263633df8 | |||
| 59b7a8ff8f | |||
| 9e6b63e3da | |||
| 5eb63c42f1 | |||
| 1bba1c5ee0 | |||
| f7047d3cfa | |||
| cb16951519 | |||
| 14dc5709ee | |||
| 7d03b0af33 | |||
| 33f7d83c71 | |||
| e469a6b3d8 | |||
| 2971ea6564 | |||
| 02ced9a339 | |||
| 1960a8768e | |||
| f4c8abb1b4 | |||
| ab9630b825 | |||
| e79d6ae971 | |||
| 0348e13258 | |||
| 40c7c7dae8 | |||
| 396695c866 | |||
| a07ae76bcc | |||
| 0221700226 | |||
| d8f3424554 | |||
| 623234c7c2 | |||
| 49aff4eba3 | |||
| 9281d15c70 | |||
| e482826ac3 | |||
| 49e2e292dd | |||
| d721f176f8 | |||
| 58532cd8c5 | |||
| 37fe3ca01a | |||
| 1a01535313 | |||
| 2ba0f5d807 | |||
| 48fa8fd20b | |||
| eeb179fc9a | |||
| 76d1abb9ca | |||
| 68d2aed8af | |||
| dfdecb7e0b | |||
| 2b54414e60 | |||
| 2f03f95e9d | |||
| a828d714c6 | |||
| e36a3dd460 | |||
| b60fda3fec | |||
| 590b237338 | |||
| 237592fbda | |||
| 9a6a301c4f | |||
| 064c057200 | |||
| d1077e6171 | |||
| b90e483117 | |||
| ad25f4c43a | |||
| de22ae4a99 | |||
| d166463bca | |||
| ef326260c2 | |||
| a969e87f13 | |||
| 532fb73c43 | |||
| 0c79aa30ab | |||
| cd68572df5 | |||
| a37cc75bd7 | |||
| 3b8118ac0b | |||
| bdf725f86b | |||
| c8866b7d4c | |||
| 552b211124 | |||
| 680fe999b2 | |||
| 1e380374eb | |||
| 25705ad61b | |||
| 6351d5a283 | |||
| 1666e12db2 | |||
| 728cbcdff4 | |||
| bd047624e5 | |||
| 0e8f5b8147 | |||
| 45d4353cf4 | |||
| c7455ca776 | |||
| 5def0c2eea | |||
| 9e4090f601 | |||
| d1a8ecca70 | |||
| 69415616f8 | |||
| 7eec35e4ea | |||
| f76bf37229 | |||
| 5c335f3acc | |||
| 98f91f8b0a | |||
| 93e568b254 | |||
| e86579b576 | |||
| 672ffefb5f | |||
| c500a6704e | |||
| 3e0c355d7b | |||
| 87da1b2d0c | |||
| 0d45084914 | |||
| 9097433898 | |||
| 0b704e356f | |||
| d847d5b942 | |||
| 694c900cd4 | |||
| 9204086f41 | |||
| d8395dfeb6 | |||
| 39f84d7fe4 | |||
| bbc8c1121f | |||
| 383ffdfe0a | |||
| 8c89c1daf5 | |||
| 706337b8ea | |||
| 9f67477858 | |||
| b703d81561 | |||
| 9e8be6cd28 | |||
| 250960f771 | |||
| bbfb0d669c | |||
| ad14802227 | |||
| d5b1087fb8 | |||
| 150b7cd4e2 | |||
| 20fc8ee3cc | |||
| 47877ec70c | |||
| 91e8aca0a9 | |||
| f809cc2db7 | |||
| b07caa93c9 | |||
| a65c42b7d8 | |||
| 583006b599 | |||
| 29b5837a91 | |||
| 26eadad611 | |||
| 0aafa5a591 | |||
| 0a42863bd1 | |||
| a1f23f3a4c | |||
| badef10f41 | |||
| f1284bd73c | |||
| d2926d2edf | |||
| da45f02f6a | |||
| 67a3a7521f | |||
| 699f87c617 | |||
| a568ed2bd8 | |||
| 6b4366a0a4 | |||
| 5aa957bcff | |||
| f22b5abfac | |||
| 8811f5053d | |||
| b16571bb86 | |||
| d12cf29322 | |||
| 7c8c7984a1 | |||
| a35ddcd0e1 | |||
| ddc95bc7f7 | |||
| ce99a71a52 | |||
| 9882eef93a | |||
| 140667308d | |||
| f50859fd09 | |||
| 86267bd8d6 | |||
| e5f6738280 | |||
| d6acc8debe | |||
| 84c562de1c | |||
| ddd6bb632a | |||
| 85b69b8689 | |||
| b2837d38b8 | |||
| 06582b4cf9 | |||
| f5d0863b2e | |||
| f05c0cd6ce | |||
| 223642904f | |||
| 8317e918d9 | |||
| d497b62fb3 | |||
| 014ba087a8 | |||
| dfa1f480b5 | |||
| 9ce8fcd268 | |||
| 6bd07d3d63 | |||
| 125d820dac | |||
| f77f7e645b | |||
| 82bee848a1 | |||
| 41aa30c93f | |||
| 594c4102f6 | |||
| cf1ae599f1 | |||
| 9fbc499361 | |||
| 3d747571d6 | |||
| 036e02e052 | |||
| d03a9188ae | |||
| a07e6e4013 | |||
| ea0562c124 | |||
| 215b6cc634 | |||
| f7460dfa9c | |||
| 92a285378a | |||
| d033f2235f | |||
| 29016a1fe4 | |||
| d75596c9b8 | |||
| 8ef3f8ade3 | |||
| cdce807375 | |||
| 4c9cf84dff | |||
| f878e38d12 | |||
| 24c572b806 | |||
| abb05eae40 | |||
| 934271b272 | |||
| a3366e6c95 | |||
| 8971bf7546 | |||
| 3a673cc06e | |||
| 8bf09f65cf | |||
| b7f5699b3e | |||
| 7d01550649 | |||
| 05aedc7c57 | |||
| 9af5367aee | |||
| 3c1015942d | |||
| 98329144a0 | |||
| dc990a5309 | |||
| c28dc2bb13 | |||
| c3fa406d60 | |||
| 3c84312ac5 | |||
| a88656ea5a | |||
| 86ad0d2c62 | |||
| 5512567d74 | |||
| d14d7f67b3 | |||
| f6b8a150bb | |||
| ba8ab188d8 | |||
| b188f76b65 | |||
| 48a745e934 | |||
| e1c9cbedd7 | |||
| c53c5b47ea | |||
| 487ac04a1b | |||
| c98771f683 | |||
| 9f990349ff | |||
| 3aed6de76e | |||
| 1be7a45f18 | |||
| 531228f3c0 | |||
| 15a53269d2 | |||
| 7187639286 | |||
| fd72c74184 | |||
| 9912fce370 | |||
| 063850bc20 | |||
| fb8c1ad75b | |||
| 805c6b9711 | |||
| e3fbd46a79 | |||
| 9fc9ca3265 | |||
| 40aee428b5 | |||
| b7fe42a545 | |||
| 5cbd311e80 | |||
| 4f74bf88f1 | |||
| 4df999cbe2 | |||
| 039fe4bddf | |||
| 833bbc5b88 | |||
| c0dfc5bb89 | |||
| b1866205ed | |||
| 50067840c7 | |||
| aa6c9e7f21 | |||
| cf4991979d | |||
| 09cfdfd756 | |||
| 72970d8c7d | |||
| c3d320aa8c | |||
| 3fcbc847a9 | |||
| 151fc3065b | |||
| 7eeb8a2c0c | |||
| 93437e3539 | |||
| ae81396710 | |||
| 7a61b1f4b9 | |||
| 6fd2e6ced0 | |||
| f3ddaf5dce | |||
| 961b408f10 | |||
| 18c5a9aef4 | |||
| 880844d178 | |||
| f55cf6f90d | |||
| ea90b73781 | |||
| e81576b74e | |||
| 4de3380ca5 | |||
| 7f2ecfe721 | |||
| 62c00ba871 | |||
| d55c34f662 | |||
| 76821902c8 | |||
| 504fd3e282 | |||
| 86da74e0bc | |||
| 484bbcbfba | |||
| 500e3b9d85 | |||
| b299c85f98 | |||
| 6a39f5bd1c | |||
| 2cecd66a50 | |||
| ca15df807c | |||
| ce4d8d902d | |||
| 0f83413a8f | |||
| 12a5a2da41 | |||
| 15f53f6d97 | |||
| 40d78f97e6 | |||
| cbe9446e50 | |||
| 890e7beb26 | |||
| 72926fd4ee | |||
| 0d62f4706a | |||
| da20193852 | |||
| cdc07b5d4e | |||
| df0d018b40 | |||
| d02e5ecdc5 | |||
| 7ee96336d7 | |||
| 89ce14bfee | |||
| b5b6e9997d | |||
| 9ea12cf091 | |||
| 5d6ca51ea8 | |||
| 2d0a80bcbb | |||
| a2eea79ea8 | |||
| fe52062f04 | |||
| 6c4f5c78d0 | |||
| d7a65ae09f | |||
| e97a630235 | |||
| f66f15ce90 | |||
| 7b6b9a6e22 | |||
| 4d471306f4 | |||
| e3dbc609d1 | |||
| 67bb18921b | |||
| 83c75f9291 | |||
| fce606ed94 | |||
| 24a9663db4 | |||
| b7dba5f72b | |||
| 60d245e968 | |||
| 689324ad24 | |||
| 5a2d655c4a | |||
| a6b258c953 | |||
| 765df72a6e | |||
| 2b5b1b2a40 | |||
| 55b3776f42 | |||
| f36217fb92 | |||
| 6881dae3bc | |||
| 02c7630bbb | |||
| d80207d69e | |||
| 09a999c8a1 | |||
| e3dd66ddb4 | |||
| f36ffece70 | |||
| d6d74ef77f | |||
| 279c944628 | |||
| ff624c35e3 | |||
| a6deca4da8 | |||
| 14d5685528 | |||
| cb13201fd5 | |||
| e56b50474a | |||
| 83b94092b6 | |||
| fe8318d336 | |||
| 898c009f50 | |||
| b8bdc638bf | |||
| 3537b47ba8 | |||
| 9bde5a6482 | |||
| f8b7583de5 | |||
| d484fbd93c | |||
| 214e5cc6e3 | |||
| a6c123d4e4 | |||
| 363a438fc6 | |||
| 2c4975c5b5 | |||
| f8d96846d5 | |||
| a57fd395fe | |||
| 9feea24516 | |||
| 41f2b5ec8d | |||
| a8e9046c6c | |||
| 67b1db7123 | |||
| 2a59f5ce00 | |||
| 14cf2d9532 | |||
| c10d526385 | |||
| 32efce9f86 | |||
| 533d885923 | |||
| 9903dd5ad9 | |||
| ad5a85ed51 | |||
| f25e5a1012 | |||
| acb7148ac4 | |||
| 585c87a8c6 | |||
| 9d651f85f1 | |||
| ddef0a729d | |||
| 7a0b449ac3 | |||
| f8bcc9966d | |||
| f300ddcada | |||
| c28013930e | |||
| 45b820abe2 | |||
| 034177f0c0 | |||
| 5edbac54d3 | |||
| 09bf5ca5a0 | |||
| 814f9ebc5b | |||
| 6680975105 | |||
| dfdbcd8325 | |||
| 2820371a00 | |||
| 5f1d1869e3 | |||
| a60a4405c8 | |||
| 24d596ee53 | |||
| 0c37fcebe8 | |||
| 1ca7408701 | |||
| eceaf3bfb4 | |||
| 68f8d44e0d | |||
| ab5f27c5af | |||
| f7d074d64c | |||
| 6ad9366be0 | |||
| 32cea2e656 | |||
| 17cf16dd19 | |||
| f533541b67 | |||
| f4ccffc754 | |||
| 6a51e74319 | |||
| eb99d460a3 | |||
| 25a92406ce | |||
| e2f76ff8e3 | |||
| a7cfb276a6 | |||
| a26ea8134c | |||
| 892cf8be29 | |||
| 4880bc49e1 | |||
| 068eb252c5 | |||
| e784171e11 | |||
| 98db29d939 | |||
| 6fddeb89bc | |||
| e51810cb65 | |||
| 27ae0785c1 | |||
| 1dabea71da | |||
| e6fe79daca | |||
| dd54429ff6 | |||
| 47c9866131 | |||
| c39e8b142e | |||
| 1b54306b2f | |||
| 1a193d24ef | |||
| d27bdd02ef | |||
| 9474623ff0 | |||
| caf2439116 | |||
| 4ad507b4e9 | |||
| 9e61e71cb1 | |||
| 1176351701 | |||
| ed835a4973 | |||
| 641c7a6d57 | |||
| 8bfbdc8cf5 | |||
| eae27b0baa | |||
| 6281f981fa | |||
| ee08bfb6aa | |||
| 6a07109e10 | |||
| 28d18a4f70 | |||
| 14e81fca0e | |||
| 6d0cb74b64 | |||
| 29b40bc75f | |||
| d78bf5a93c | |||
| f37b21bf6c | |||
| 7309784487 | |||
| 55426fb047 | |||
| a1172b6211 | |||
| 271a865d01 | |||
| 5050dd13f4 | |||
| 5ce81bf386 | |||
| 40fd3e9ae2 | |||
| d8bffe12d7 | |||
| 7566aa2824 | |||
| c97ede5c34 | |||
| a2416f0b3f | |||
| 89eefbdc6a | |||
| 44f64a852b | |||
| 11ecb09eab | |||
| e6f686533f | |||
| c8dd7d95de | |||
| 81a7af5704 | |||
| e0dd754995 | |||
| 178e024721 | |||
| 99877adb39 | |||
| 5d8779fac2 | |||
| 34e07ef245 | |||
| c2f006f37a | |||
| f19506c3ce | |||
| 313a40875a | |||
| c49acaddf4 | |||
| e2487270e5 | |||
| 2a29b56b12 | |||
| 746c533c3c | |||
| 3ddd2445e5 | |||
| a682132503 | |||
| 00bee0fa54 | |||
| 4d25d2ffcc | |||
| 1db4a96c2c | |||
| 8fef15cd56 | |||
| 64396d15c8 | |||
| 5d209f798a | |||
| 811006ed8f | |||
| 555e9ed5fe | |||
| 49eb11e135 | |||
| a40cc0d9fc | |||
| 23078fe9c4 | |||
| 254c6dc993 | |||
| 66d0b809da | |||
| d0223dc1a0 | |||
| 876b58cebc | |||
| a21c2b4144 | |||
| b38bde7e12 | |||
| 5cce143273 | |||
| 75b97c9e0d | |||
| 91d3e9d924 | |||
| b6819aa8dd | |||
| 60cb12c062 | |||
| 8ea57a4b36 | |||
| dd96425a72 | |||
| 1bdcac1aac | |||
| 70443d06a2 | |||
| e23512d815 | |||
| 8db20a6589 | |||
| e7787b18d3 | |||
| 7f7bbbcfb4 | |||
| 6a966bdb61 | |||
| 702ac16d12 | |||
| 8c9150c223 | |||
| af4e13e528 | |||
| 8951032d07 | |||
| a5a64daf75 | |||
| b3e7510d31 | |||
| 4bc6b69a96 | |||
| 00b0d03dee | |||
| 1c24f3b14a | |||
| 65383f28a2 | |||
| ef1c63169e | |||
| 7cf1f011ef | |||
| 4aeeaed4c7 | |||
| ebe2f2b950 | |||
| 9998946886 | |||
| 0b16a37675 | |||
| f860b5a058 | |||
| 4f982ee3d1 | |||
| 5f4acdee0e | |||
| e640cc187b | |||
| d52fa9bcfc | |||
| 3029f0dd16 | |||
| 9f69d80b12 | |||
| 573e154c18 | |||
| ad49eea20d | |||
| 1dfb8ee3ce | |||
| bca57a4330 | |||
| ea483333f4 | |||
| 9f2d83c148 | |||
| 4a59e203cb | |||
| 697137585e | |||
| 8031ec9d89 | |||
| 54310ba2bc | |||
| 60a894bded | |||
| f40cbb06d6 | |||
| 01576229fe | |||
| 6ad505b6e4 | |||
| 9c79b55078 | |||
| aac231c39a | |||
| 6b577e1516 | |||
| 79b4503d01 | |||
| 1673a59a65 | |||
| ae395070d9 | |||
| eced38791a | |||
| 7d3c3cc1e3 | |||
| a26fdf3b54 | |||
| b162585beb | |||
| 77fb880f2d | |||
| 46222d488e | |||
| c0abe47d87 | |||
| d6321ab2a1 | |||
| ca1cc1c76e | |||
| 92593c3ea9 | |||
| 4b2a89683a | |||
| a830db6d86 | |||
| 7fb62aedc7 | |||
| c7fa954449 | |||
| a002e04838 | |||
| fe38bab63e | |||
| 86e0c29c25 | |||
| e554792ea5 | |||
| a82f60e302 | |||
| 072a7ac84a | |||
| 8dcfd7be61 | |||
| a401afe52e | |||
| f2ccc83a29 | |||
| b0ccf97226 | |||
| 77cccbc405 | |||
| 6370db0587 | |||
| b5c71915c7 | |||
| c96777369d | |||
| 9d663c5819 | |||
| 218eaf92ec | |||
| bbc31e07e9 | |||
| db889737be | |||
| d16ddf42cb | |||
| fa0f0bfad9 | |||
| 23e28fdd93 | |||
| cb62a3b039 | |||
| 0cb15dba0a | |||
| 48112f1a50 | |||
| b99290a060 | |||
| ce013119b9 | |||
| 851643110f | |||
| 45d9f292f9 | |||
| b3723ae020 | |||
| 498bb81c0a | |||
| cfbc1d6b70 | |||
| 7355272818 | |||
| 3c49b63a6b | |||
| db7b0a2272 | |||
| 42e99ac2eb | |||
| 6f86b4ec95 | |||
| 574b492479 | |||
| c9cf188e08 | |||
| b459a204a4 | |||
| a8ca4dbc3a | |||
| 21c4e4940b | |||
| ee6e44669f | |||
| b84cab3fc0 | |||
| a9edcb5f10 | |||
| ee207e2249 | |||
| 28f06953fc | |||
| 90e3024517 | |||
| 6222a3a8f7 | |||
| 14482a174b | |||
| a2395a0417 | |||
| fb2fc2f43f | |||
| dccd6a0499 | |||
| 01ffe94974 | |||
| 67f51b6e69 | |||
| 105eec0693 | |||
| ea4dd30143 | |||
| abfa841a98 | |||
| 1003c372bf | |||
| ff99823130 | |||
| fe431f1e8e | |||
| 2ee49802a9 | |||
| 2ab46f7fa3 | |||
| 77e721f7ce | |||
| d4d1491a81 | |||
| b2b86d2e04 | |||
| 3f3e7fd9f5 | |||
| deec9e9ac8 | |||
| 5634eaaf7a | |||
| 05f8a7bfb7 | |||
| c1aa4fc1d0 | |||
| 51570c73e1 | |||
| 6afafe1114 | |||
| c431a1e701 | |||
| 177103021e | |||
| 5dd4e8ff47 | |||
| 8b36b16b03 | |||
| b04ea483a8 | |||
| 55bb147862 | |||
| f2ba32a950 | |||
| 35c893e84f | |||
| cca9777064 | |||
| 2f386b6be2 | |||
| 6d19312f51 | |||
| a16b8a5474 | |||
| 27b72c4c89 | |||
| dbdce87679 | |||
| 2fd37df46a | |||
| 32a55c5c6e | |||
| 481a3f1ba1 | |||
| 74f6c56d27 | |||
| bcaf8c7e70 | |||
| d1f4eecc3a | |||
| 7f5fef431a | |||
| f6a0f2743e | |||
| 9b49ee6208 | |||
| 198e472ba3 | |||
| 4226ac02dc | |||
| 4606630f5a | |||
| 5d8d561565 | |||
| 6a6ac8b47b | |||
| 6417d7f882 | |||
| 93ee368556 | |||
| d89171768b | |||
| b73037a282 | |||
| 1888ac386f | |||
| 535958a274 | |||
| 35e1f2abed | |||
| 6e5cfde4b1 | |||
| 52828730cb | |||
| e3eae253df | |||
| 104123aa88 | |||
| 71224984bb | |||
| 181f4ab54c | |||
| 5d1f303a16 | |||
| 6a48348831 | |||
| 33be36f175 | |||
| 1a63b68990 | |||
| 1e3963b75d | |||
| ca290eeb97 | |||
| dbe7934931 | |||
| ca12278e90 | |||
| db0e93fa8e | |||
| c8a041fbeb | |||
| 273d14d8a0 | |||
| 024592281f | |||
| 5dbcca1543 | |||
| b57b079c9b |
@@ -1,7 +1,5 @@
|
||||
boost_root
|
||||
.downloads-by-cmake
|
||||
Build
|
||||
build
|
||||
common/netlist_keywords.*
|
||||
common/netlist_lexer.h
|
||||
common/pcb_plot_params_lexer.h
|
||||
@@ -29,10 +27,7 @@ version.h
|
||||
config.h
|
||||
install_manifest.txt
|
||||
Documentation/doxygen
|
||||
Documentation/development/doxygen
|
||||
*.bak
|
||||
.*.swp
|
||||
*.~*
|
||||
common/pcb_plot_params_keywords.cpp
|
||||
include/pcb_plot_params_lexer.h
|
||||
pcbnew/specctra_keywords.cpp
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[core]
|
||||
excludesfile .bzrignore
|
||||
+63
-38
@@ -45,11 +45,16 @@
|
||||
#include <info3d_visu.h>
|
||||
#include <trackball.h>
|
||||
|
||||
// Exported function:
|
||||
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
|
||||
|
||||
void S3D_MASTER::ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices )
|
||||
|
||||
void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices )
|
||||
{
|
||||
unsigned ii;
|
||||
|
||||
/* adjust object scale, rotation and offset position */
|
||||
for( unsigned ii = 0; ii < aVertices.size(); ii++ )
|
||||
for( ii = 0; ii < aVertices.size(); ii++ )
|
||||
{
|
||||
aVertices[ii].x *= m_MatScale.x;
|
||||
aVertices[ii].y *= m_MatScale.y;
|
||||
@@ -57,33 +62,16 @@ void S3D_MASTER::ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices )
|
||||
|
||||
// adjust rotation
|
||||
if( m_MatRotation.x )
|
||||
{
|
||||
double a = aVertices[ii].y;
|
||||
double b = aVertices[ii].z;
|
||||
RotatePoint( &a, &b, m_MatRotation.x * 10 );
|
||||
aVertices[ii].y = (float)a;
|
||||
aVertices[ii].z = (float)b;
|
||||
}
|
||||
RotatePoint( &aVertices[ii].y, &aVertices[ii].z, m_MatRotation.x * 10 );
|
||||
|
||||
if( m_MatRotation.y )
|
||||
{
|
||||
double a = aVertices[ii].z;
|
||||
double b = aVertices[ii].x;
|
||||
RotatePoint( &a, &b, m_MatRotation.x * 10 );
|
||||
aVertices[ii].z = (float)a;
|
||||
aVertices[ii].x = (float)b;
|
||||
}
|
||||
RotatePoint( &aVertices[ii].z, &aVertices[ii].x, m_MatRotation.y * 10 );
|
||||
|
||||
if( m_MatRotation.z )
|
||||
{
|
||||
double a = aVertices[ii].x;
|
||||
double b = aVertices[ii].y;
|
||||
RotatePoint( &a, &b, m_MatRotation.x * 10 );
|
||||
aVertices[ii].x = (float)a;
|
||||
aVertices[ii].y = (float)b;
|
||||
}
|
||||
RotatePoint( &aVertices[ii].x, &aVertices[ii].y, m_MatRotation.z * 10 );
|
||||
|
||||
/* adjust offset position (offset is given in UNIT 3D (0.1 inch) */
|
||||
#define SCALE_3D_CONV ((IU_PER_MILS * 1000) / UNITS3D_TO_UNITSPCB)
|
||||
aVertices[ii].x += m_MatPosition.x * SCALE_3D_CONV;
|
||||
aVertices[ii].y += m_MatPosition.y * SCALE_3D_CONV;
|
||||
aVertices[ii].z += m_MatPosition.z * SCALE_3D_CONV;
|
||||
@@ -91,7 +79,7 @@ void S3D_MASTER::ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices )
|
||||
}
|
||||
|
||||
|
||||
void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits )
|
||||
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits )
|
||||
{
|
||||
unsigned ii;
|
||||
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
|
||||
@@ -105,9 +93,9 @@ void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUni
|
||||
ay = aVertices[1].y - aVertices[0].y;
|
||||
az = aVertices[1].z - aVertices[0].z;
|
||||
|
||||
bx = aVertices[2].x - aVertices[0].x;
|
||||
by = aVertices[2].y - aVertices[0].y;
|
||||
bz = aVertices[2].z - aVertices[0].z;
|
||||
bx = aVertices[aVertices.size() - 1].x - aVertices[0].x;
|
||||
by = aVertices[aVertices.size() - 1].y - aVertices[0].y;
|
||||
bz = aVertices[aVertices.size() - 1].z - aVertices[0].z;
|
||||
|
||||
nx = ay * bz - az * by;
|
||||
ny = az * bx - ax * bz;
|
||||
@@ -150,14 +138,52 @@ void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUni
|
||||
glEnd();
|
||||
}
|
||||
|
||||
S3DPOINT_VALUE_CTRL::S3DPOINT_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer )
|
||||
|
||||
GLuint EDA_3D_CANVAS::DisplayCubeforTest()
|
||||
{
|
||||
GLuint gllist = glGenLists( 1 );
|
||||
|
||||
glNewList( gllist, GL_COMPILE_AND_EXECUTE );
|
||||
/* draw six faces of a cube */
|
||||
glBegin( GL_QUADS );
|
||||
glNormal3f( 0.0F, 0.0F, 1.0F );
|
||||
glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F );
|
||||
glVertex3f( -0.5F, -0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F );
|
||||
|
||||
glNormal3f( 0.0F, 0.0F, -1.0F );
|
||||
glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F );
|
||||
glVertex3f( 0.5F, 0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F );
|
||||
|
||||
glNormal3f( 0.0F, 1.0F, 0.0F );
|
||||
glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F );
|
||||
glVertex3f( -0.5F, 0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F );
|
||||
|
||||
glNormal3f( 0.0F, -1.0F, 0.0F );
|
||||
glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F );
|
||||
glVertex3f( 0.5F, -0.5F, 0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F );
|
||||
|
||||
glNormal3f( 1.0F, 0.0F, 0.0F );
|
||||
glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F );
|
||||
glVertex3f( 0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F );
|
||||
|
||||
glNormal3f( -1.0F, 0.0F, 0.0F );
|
||||
glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F );
|
||||
glVertex3f( -0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F );
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
|
||||
return gllist;
|
||||
}
|
||||
|
||||
VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer )
|
||||
{
|
||||
wxString text;
|
||||
|
||||
wxFlexGridSizer* gridSizer = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
gridSizer->AddGrowableCol( 1 );
|
||||
gridSizer->SetFlexibleDirection( wxHORIZONTAL );
|
||||
gridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
gridSizer->AddGrowableCol( 1 );
|
||||
gridSizer->SetFlexibleDirection( wxHORIZONTAL );
|
||||
gridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
aBoxSizer->Add( gridSizer, 0, wxEXPAND, 5 );
|
||||
|
||||
@@ -186,16 +212,15 @@ S3DPOINT_VALUE_CTRL::S3DPOINT_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSiz
|
||||
}
|
||||
|
||||
|
||||
S3DPOINT_VALUE_CTRL::~S3DPOINT_VALUE_CTRL()
|
||||
VERTEX_VALUE_CTRL::~VERTEX_VALUE_CTRL()
|
||||
{
|
||||
// Nothing to delete: all items are managed by the parent window.
|
||||
}
|
||||
|
||||
|
||||
S3DPOINT S3DPOINT_VALUE_CTRL::GetValue()
|
||||
S3D_VERTEX VERTEX_VALUE_CTRL::GetValue()
|
||||
{
|
||||
S3DPOINT value;
|
||||
double dtmp;
|
||||
S3D_VERTEX value;
|
||||
double dtmp;
|
||||
|
||||
m_XValueCtrl->GetValue().ToDouble( &dtmp );
|
||||
value.x = dtmp;
|
||||
@@ -207,7 +232,7 @@ S3DPOINT S3DPOINT_VALUE_CTRL::GetValue()
|
||||
}
|
||||
|
||||
|
||||
void S3DPOINT_VALUE_CTRL::SetValue( S3DPOINT vertex )
|
||||
void VERTEX_VALUE_CTRL::SetValue( S3D_VERTEX vertex )
|
||||
{
|
||||
wxString text;
|
||||
|
||||
@@ -225,7 +250,7 @@ void S3DPOINT_VALUE_CTRL::SetValue( S3DPOINT vertex )
|
||||
}
|
||||
|
||||
|
||||
void S3DPOINT_VALUE_CTRL::Enable( bool onoff )
|
||||
void VERTEX_VALUE_CTRL::Enable( bool onoff )
|
||||
{
|
||||
m_XValueCtrl->Enable( onoff );
|
||||
m_YValueCtrl->Enable( onoff );
|
||||
|
||||
+179
-233
@@ -1,33 +1,8 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file 3d_canvas.cpp
|
||||
*/
|
||||
#include <fctsys.h>
|
||||
#include <trigo.h>
|
||||
#include <project.h>
|
||||
#include <gestfich.h>
|
||||
|
||||
#include <wx/image.h>
|
||||
|
||||
@@ -39,9 +14,7 @@
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/wupdlock.h>
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <GL/glew.h> // must be included before gl.h
|
||||
#endif
|
||||
#include <gestfich.h>
|
||||
|
||||
#include <3d_viewer.h>
|
||||
#include <3d_canvas.h>
|
||||
@@ -49,8 +22,34 @@
|
||||
#include <trackball.h>
|
||||
#include <3d_viewer_id.h>
|
||||
|
||||
#include <textures/text_silk.h>
|
||||
#include <textures/text_pcb.h>
|
||||
|
||||
// -----------------
|
||||
// helper function (from wxWidgets, opengl/cube.cpp sample
|
||||
// -----------------
|
||||
void CheckGLError()
|
||||
{
|
||||
GLenum errLast = GL_NO_ERROR;
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
GLenum err = glGetError();
|
||||
if ( err == GL_NO_ERROR )
|
||||
return;
|
||||
|
||||
// normally the error is reset by the call to glGetError() but if
|
||||
// glGetError() itself returns an error, we risk looping forever here
|
||||
// so check that we get a different error than the last time
|
||||
if ( err == errLast )
|
||||
{
|
||||
wxLogError(wxT("OpenGL error state couldn't be reset."));
|
||||
return;
|
||||
}
|
||||
|
||||
errLast = err;
|
||||
|
||||
wxLogError(wxT("OpenGL error %d"), err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -66,9 +65,6 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, wxGLCanvas )
|
||||
// mouse events
|
||||
EVT_RIGHT_DOWN( EDA_3D_CANVAS::OnRightClick )
|
||||
EVT_MOUSEWHEEL( EDA_3D_CANVAS::OnMouseWheel )
|
||||
#ifdef USE_OSX_MAGNIFY_EVENT
|
||||
EVT_MAGNIFY( EDA_3D_CANVAS::OnMagnify )
|
||||
#endif
|
||||
EVT_MOTION( EDA_3D_CANVAS::OnMouseMove )
|
||||
|
||||
// other events
|
||||
@@ -76,34 +72,13 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, wxGLCanvas )
|
||||
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END, EDA_3D_CANVAS::OnPopUpMenu )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Define an invalid value for some unsigned int indexes
|
||||
#define INVALID_INDEX GL_INVALID_VALUE
|
||||
|
||||
EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
|
||||
wxGLCanvas( parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize,
|
||||
wxFULL_REPAINT_ON_RESIZE )
|
||||
{
|
||||
m_init = false;
|
||||
m_reportWarnings = true;
|
||||
m_shadow_init = false;
|
||||
// set an invalide value to not yet initialized indexes managing
|
||||
// textures created to enhance 3D rendering
|
||||
m_text_pcb = m_text_silk = INVALID_INDEX;
|
||||
m_text_fake_shadow_front = INVALID_INDEX;
|
||||
m_text_fake_shadow_back = INVALID_INDEX;
|
||||
m_text_fake_shadow_board = INVALID_INDEX;
|
||||
|
||||
// position of the front and back layers
|
||||
// (will be initialized to a better value later)
|
||||
m_ZBottom = 0.0;
|
||||
m_ZTop = 0.0;
|
||||
|
||||
m_lightPos = S3D_VERTEX(0.0f, 0.0f, 30.0f);
|
||||
|
||||
// Clear all gl list identifiers:
|
||||
for( int ii = GL_ID_BEGIN; ii < GL_ID_END; ii++ )
|
||||
m_glLists[ii] = 0;
|
||||
|
||||
m_gllist = 0;
|
||||
// Explicitly create a new rendering context instance for this canvas.
|
||||
m_glRC = new wxGLContext( this );
|
||||
|
||||
@@ -116,46 +91,15 @@ EDA_3D_CANVAS::~EDA_3D_CANVAS()
|
||||
ClearLists();
|
||||
m_init = false;
|
||||
delete m_glRC;
|
||||
|
||||
// Free the list of parsers list
|
||||
for( unsigned int i = 0; i < m_model_parsers_list.size(); i++ )
|
||||
delete m_model_parsers_list[i];
|
||||
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::ClearLists( int aGlList )
|
||||
void EDA_3D_CANVAS::ClearLists()
|
||||
{
|
||||
if( aGlList )
|
||||
{
|
||||
if( m_glLists[aGlList] > 0 )
|
||||
glDeleteLists( m_glLists[aGlList], 1 );
|
||||
if( m_gllist > 0 )
|
||||
glDeleteLists( m_gllist, 1 );
|
||||
|
||||
m_glLists[aGlList] = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for( int ii = GL_ID_BEGIN; ii < GL_ID_END; ii++ )
|
||||
{
|
||||
if( m_glLists[ii] > 0 )
|
||||
glDeleteLists( m_glLists[ii], 1 );
|
||||
|
||||
m_glLists[ii] = 0;
|
||||
}
|
||||
|
||||
// When m_text_fake_shadow_??? is set to INVALID_INDEX, textures are no yet
|
||||
// created.
|
||||
if( m_text_fake_shadow_front != INVALID_INDEX )
|
||||
glDeleteTextures( 1, &m_text_fake_shadow_front );
|
||||
|
||||
if( m_text_fake_shadow_back != INVALID_INDEX )
|
||||
glDeleteTextures( 1, &m_text_fake_shadow_back );
|
||||
|
||||
if( m_text_fake_shadow_board != INVALID_INDEX )
|
||||
glDeleteTextures( 1, &m_text_fake_shadow_board );
|
||||
|
||||
m_shadow_init = false;
|
||||
m_gllist = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +113,7 @@ void EDA_3D_CANVAS::OnChar( wxKeyEvent& event )
|
||||
void EDA_3D_CANVAS::SetView3D( int keycode )
|
||||
{
|
||||
int ii;
|
||||
double delta_move = 0.7 * GetPrm3DVisu().m_Zoom;
|
||||
double delta_move = 0.7 * g_Parm_3D_Visu.m_Zoom;
|
||||
|
||||
switch( keycode )
|
||||
{
|
||||
@@ -190,22 +134,22 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
|
||||
break;
|
||||
|
||||
case WXK_HOME:
|
||||
GetPrm3DVisu().m_Zoom = 1.0;
|
||||
g_Parm_3D_Visu.m_Zoom = 1.0;
|
||||
m_draw3dOffset.x = m_draw3dOffset.y = 0;
|
||||
trackball( GetPrm3DVisu().m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
break;
|
||||
|
||||
case WXK_END:
|
||||
break;
|
||||
|
||||
case WXK_F1:
|
||||
GetPrm3DVisu().m_Zoom /= 1.4;
|
||||
if( GetPrm3DVisu().m_Zoom <= 0.01 )
|
||||
GetPrm3DVisu().m_Zoom = 0.01;
|
||||
g_Parm_3D_Visu.m_Zoom /= 1.4;
|
||||
if( g_Parm_3D_Visu.m_Zoom <= 0.01 )
|
||||
g_Parm_3D_Visu.m_Zoom = 0.01;
|
||||
break;
|
||||
|
||||
case WXK_F2:
|
||||
GetPrm3DVisu().m_Zoom *= 1.4;
|
||||
g_Parm_3D_Visu.m_Zoom *= 1.4;
|
||||
break;
|
||||
|
||||
case '+':
|
||||
@@ -218,59 +162,59 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
|
||||
case 'R':
|
||||
m_draw3dOffset.x = m_draw3dOffset.y = 0;
|
||||
for( ii = 0; ii < 4; ii++ )
|
||||
GetPrm3DVisu().m_Rot[ii] = 0.0;
|
||||
g_Parm_3D_Visu.m_Rot[ii] = 0.0;
|
||||
|
||||
trackball( GetPrm3DVisu().m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
for( ii = 0; ii < 4; ii++ )
|
||||
GetPrm3DVisu().m_Rot[ii] = 0.0;
|
||||
g_Parm_3D_Visu.m_Rot[ii] = 0.0;
|
||||
|
||||
trackball( GetPrm3DVisu().m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
GetPrm3DVisu().m_ROTZ = -90;
|
||||
GetPrm3DVisu().m_ROTX = -90;
|
||||
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
g_Parm_3D_Visu.m_ROTZ = -90;
|
||||
g_Parm_3D_Visu.m_ROTX = -90;
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
for( ii = 0; ii < 4; ii++ )
|
||||
GetPrm3DVisu().m_Rot[ii] = 0.0;
|
||||
g_Parm_3D_Visu.m_Rot[ii] = 0.0;
|
||||
|
||||
trackball( GetPrm3DVisu().m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
GetPrm3DVisu().m_ROTZ = 90;
|
||||
GetPrm3DVisu().m_ROTX = -90;
|
||||
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
g_Parm_3D_Visu.m_ROTZ = 90;
|
||||
g_Parm_3D_Visu.m_ROTX = -90;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
for( ii = 0; ii < 4; ii++ )
|
||||
GetPrm3DVisu().m_Rot[ii] = 0.0;
|
||||
g_Parm_3D_Visu.m_Rot[ii] = 0.0;
|
||||
|
||||
trackball( GetPrm3DVisu().m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
GetPrm3DVisu().m_ROTX = -90;
|
||||
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
g_Parm_3D_Visu.m_ROTX = -90;
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
for( ii = 0; ii < 4; ii++ )
|
||||
GetPrm3DVisu().m_Rot[ii] = 0.0;
|
||||
g_Parm_3D_Visu.m_Rot[ii] = 0.0;
|
||||
|
||||
trackball( GetPrm3DVisu().m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
GetPrm3DVisu().m_ROTX = -90;
|
||||
GetPrm3DVisu().m_ROTZ = -180;
|
||||
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
g_Parm_3D_Visu.m_ROTX = -90;
|
||||
g_Parm_3D_Visu.m_ROTZ = -180;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
for( ii = 0; ii < 4; ii++ )
|
||||
GetPrm3DVisu().m_Rot[ii] = 0.0;
|
||||
g_Parm_3D_Visu.m_Rot[ii] = 0.0;
|
||||
|
||||
trackball( GetPrm3DVisu().m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
for( ii = 0; ii < 4; ii++ )
|
||||
GetPrm3DVisu().m_Rot[ii] = 0.0;
|
||||
g_Parm_3D_Visu.m_Rot[ii] = 0.0;
|
||||
|
||||
trackball( GetPrm3DVisu().m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
GetPrm3DVisu().m_ROTX = -180;
|
||||
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
g_Parm_3D_Visu.m_ROTX = -180;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -287,54 +231,50 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
|
||||
if( event.ShiftDown() )
|
||||
{
|
||||
if( event.GetWheelRotation() < 0 )
|
||||
SetView3D( WXK_UP ); // move up
|
||||
{
|
||||
/* up */
|
||||
SetView3D( WXK_UP );
|
||||
}
|
||||
else
|
||||
SetView3D( WXK_DOWN ); // move down
|
||||
{
|
||||
/* down */
|
||||
SetView3D( WXK_DOWN );
|
||||
}
|
||||
}
|
||||
else if( event.ControlDown() )
|
||||
{
|
||||
if( event.GetWheelRotation() > 0 )
|
||||
SetView3D( WXK_RIGHT ); // move right
|
||||
{
|
||||
/* right */
|
||||
SetView3D( WXK_RIGHT );
|
||||
}
|
||||
else
|
||||
SetView3D( WXK_LEFT ); // move left
|
||||
{
|
||||
/* left */
|
||||
SetView3D( WXK_LEFT );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( event.GetWheelRotation() > 0 )
|
||||
{
|
||||
GetPrm3DVisu().m_Zoom /= 1.4;
|
||||
g_Parm_3D_Visu.m_Zoom /= 1.4;
|
||||
|
||||
if( GetPrm3DVisu().m_Zoom <= 0.01 )
|
||||
GetPrm3DVisu().m_Zoom = 0.01;
|
||||
if( g_Parm_3D_Visu.m_Zoom <= 0.01 )
|
||||
g_Parm_3D_Visu.m_Zoom = 0.01;
|
||||
}
|
||||
else
|
||||
GetPrm3DVisu().m_Zoom *= 1.4;
|
||||
g_Parm_3D_Visu.m_Zoom *= 1.4;
|
||||
|
||||
DisplayStatus();
|
||||
Refresh( false );
|
||||
}
|
||||
|
||||
GetPrm3DVisu().m_Beginx = event.GetX();
|
||||
GetPrm3DVisu().m_Beginy = event.GetY();
|
||||
g_Parm_3D_Visu.m_Beginx = event.GetX();
|
||||
g_Parm_3D_Visu.m_Beginy = event.GetY();
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_OSX_MAGNIFY_EVENT
|
||||
void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event )
|
||||
{
|
||||
double magnification = ( event.GetMagnification() + 1.0f );
|
||||
|
||||
GetPrm3DVisu().m_Zoom /= magnification;
|
||||
|
||||
if( GetPrm3DVisu().m_Zoom <= 0.01 )
|
||||
GetPrm3DVisu().m_Zoom = 0.01;
|
||||
|
||||
DisplayStatus();
|
||||
Refresh( false );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
|
||||
{
|
||||
wxSize size( GetClientSize() );
|
||||
@@ -346,12 +286,12 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
|
||||
{
|
||||
/* drag in progress, simulate trackball */
|
||||
trackball( spin_quat,
|
||||
(2.0 * GetPrm3DVisu().m_Beginx - size.x) / size.x,
|
||||
(size.y - 2.0 * GetPrm3DVisu().m_Beginy) / size.y,
|
||||
(2.0 * g_Parm_3D_Visu.m_Beginx - size.x) / size.x,
|
||||
(size.y - 2.0 * g_Parm_3D_Visu.m_Beginy) / size.y,
|
||||
( 2.0 * event.GetX() - size.x) / size.x,
|
||||
( size.y - 2.0 * event.GetY() ) / size.y );
|
||||
|
||||
add_quats( spin_quat, GetPrm3DVisu().m_Quat, GetPrm3DVisu().m_Quat );
|
||||
add_quats( spin_quat, g_Parm_3D_Visu.m_Quat, g_Parm_3D_Visu.m_Quat );
|
||||
}
|
||||
else if( event.MiddleIsDown() )
|
||||
{
|
||||
@@ -359,11 +299,11 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
|
||||
|
||||
/* Current zoom and an additional factor are taken into account
|
||||
* for the amount of panning. */
|
||||
const double PAN_FACTOR = 8.0 * GetPrm3DVisu().m_Zoom;
|
||||
const double PAN_FACTOR = 8.0 * g_Parm_3D_Visu.m_Zoom;
|
||||
m_draw3dOffset.x -= PAN_FACTOR *
|
||||
( GetPrm3DVisu().m_Beginx - event.GetX() ) / size.x;
|
||||
( g_Parm_3D_Visu.m_Beginx - event.GetX() ) / size.x;
|
||||
m_draw3dOffset.y -= PAN_FACTOR *
|
||||
(event.GetY() - GetPrm3DVisu().m_Beginy) / size.y;
|
||||
(event.GetY() - g_Parm_3D_Visu.m_Beginy) / size.y;
|
||||
}
|
||||
|
||||
/* orientation has changed, redraw mesh */
|
||||
@@ -371,8 +311,8 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
|
||||
Refresh( false );
|
||||
}
|
||||
|
||||
GetPrm3DVisu().m_Beginx = event.GetX();
|
||||
GetPrm3DVisu().m_Beginy = event.GetY();
|
||||
g_Parm_3D_Visu.m_Beginx = event.GetX();
|
||||
g_Parm_3D_Visu.m_Beginy = event.GetY();
|
||||
}
|
||||
|
||||
|
||||
@@ -514,7 +454,7 @@ void EDA_3D_CANVAS::DisplayStatus()
|
||||
msg.Printf( wxT( "dy %3.2f" ), m_draw3dOffset.y );
|
||||
Parent()->SetStatusText( msg, 2 );
|
||||
|
||||
msg.Printf( _( "Zoom: %3.1f" ), 45 * GetPrm3DVisu().m_Zoom );
|
||||
msg.Printf( wxT( "View: %3.1f" ), 45 * g_Parm_3D_Visu.m_Zoom );
|
||||
Parent()->SetStatusText( msg, 3 );
|
||||
}
|
||||
|
||||
@@ -533,48 +473,16 @@ void EDA_3D_CANVAS::OnEraseBackground( wxEraseEvent& event )
|
||||
// Do nothing, to avoid flashing.
|
||||
}
|
||||
|
||||
typedef struct s_sImage
|
||||
{
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */
|
||||
unsigned char pixel_data[64 * 64 * 4 + 1];
|
||||
}tsImage;
|
||||
|
||||
|
||||
GLuint load_and_generate_texture( tsImage *image )
|
||||
{
|
||||
|
||||
GLuint texture;
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 1);
|
||||
|
||||
glGenTextures( 1, &texture );
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, image->width, image->height,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, image->pixel_data );
|
||||
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
|
||||
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
return texture;
|
||||
}
|
||||
|
||||
/* Initialize broad parameters for OpenGL */
|
||||
void EDA_3D_CANVAS::InitGL()
|
||||
{
|
||||
wxSize size = GetClientSize();
|
||||
|
||||
if( !m_init )
|
||||
{
|
||||
m_init = true;
|
||||
|
||||
|
||||
m_text_pcb = load_and_generate_texture( (tsImage *)&text_pcb );
|
||||
m_text_silk = load_and_generate_texture( (tsImage *)&text_silk );
|
||||
|
||||
GetPrm3DVisu().m_Zoom = 1.0;
|
||||
g_Parm_3D_Visu.m_Zoom = 1.0;
|
||||
m_ZBottom = 1.0;
|
||||
m_ZTop = 10.0;
|
||||
|
||||
@@ -583,12 +491,12 @@ void EDA_3D_CANVAS::InitGL()
|
||||
glEnable( GL_ALPHA_TEST );
|
||||
glEnable( GL_LINE_SMOOTH );
|
||||
// glEnable(GL_POLYGON_SMOOTH); // creates issues with some graphic cards
|
||||
glEnable( GL_NORMALIZE );
|
||||
glShadeModel( GL_SMOOTH );
|
||||
glEnable( GL_COLOR_MATERIAL );
|
||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||
|
||||
// speedups
|
||||
//glEnable( GL_DITHER );
|
||||
glEnable( GL_DITHER );
|
||||
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE );
|
||||
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
|
||||
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
|
||||
@@ -596,50 +504,90 @@ void EDA_3D_CANVAS::InitGL()
|
||||
// Initialize alpha blending function.
|
||||
glEnable( GL_BLEND );
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
}
|
||||
}
|
||||
|
||||
// set viewing projection
|
||||
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
|
||||
#define MAX_VIEW_ANGLE 160.0 / 45.0
|
||||
if( g_Parm_3D_Visu.m_Zoom > MAX_VIEW_ANGLE )
|
||||
g_Parm_3D_Visu.m_Zoom = MAX_VIEW_ANGLE;
|
||||
|
||||
if( Parent()->ModeIsOrtho() )
|
||||
{
|
||||
// OrthoReductionFactor is chosen so as to provide roughly the same size as
|
||||
// Perspective View
|
||||
const double orthoReductionFactor = 400 / g_Parm_3D_Visu.m_Zoom;
|
||||
|
||||
// Initialize Projection Matrix for Ortographic View
|
||||
glOrtho( -size.x / orthoReductionFactor, size.x / orthoReductionFactor,
|
||||
-size.y / orthoReductionFactor, size.y / orthoReductionFactor, 1, 10 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ratio width / height of the window display
|
||||
double ratio_HV = (double) size.x / size.y;
|
||||
|
||||
// Initialize Projection Matrix for Perspective View
|
||||
gluPerspective( 45.0 * g_Parm_3D_Visu.m_Zoom, ratio_HV, 1, 10 );
|
||||
}
|
||||
|
||||
|
||||
// position viewer
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0F, 0.0F, -( m_ZBottom + m_ZTop) / 2 );
|
||||
|
||||
// clear color and depth buffers
|
||||
glClearColor( g_Parm_3D_Visu.m_BgColor.m_Red,
|
||||
g_Parm_3D_Visu.m_BgColor.m_Green,
|
||||
g_Parm_3D_Visu.m_BgColor.m_Blue, 1 );
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
|
||||
// Setup light sources:
|
||||
SetLights();
|
||||
|
||||
CheckGLError();
|
||||
}
|
||||
|
||||
|
||||
/* Initialize OpenGL light sources. */
|
||||
void EDA_3D_CANVAS::SetLights()
|
||||
{
|
||||
// activate light. the source is above the xy plane, at source_pos
|
||||
GLfloat source_pos[4] = { m_lightPos.x, m_lightPos.y, m_lightPos.z, 0.0f };
|
||||
GLfloat light_color[4]; // color of lights (RGBA values)
|
||||
double light;
|
||||
GLfloat light_color[4];
|
||||
|
||||
/* set viewing projection */
|
||||
light_color[3] = 1.0;
|
||||
GLfloat Z_axis_pos[4] = { 0.0, 0.0, 3.0, 0.0 };
|
||||
GLfloat lowZ_axis_pos[4] = { 0.0, 0.0, -3.0, 0.5 };
|
||||
|
||||
// Light above the xy plane
|
||||
light_color[0] = light_color[1] = light_color[2] = 0.0;
|
||||
glLightfv( GL_LIGHT0, GL_AMBIENT, light_color );
|
||||
|
||||
light_color[0] = light_color[1] = light_color[2] = 1.0;
|
||||
/* activate light */
|
||||
light = 1.0;
|
||||
light_color[0] = light_color[1] = light_color[2] = light;
|
||||
glLightfv( GL_LIGHT0, GL_POSITION, Z_axis_pos );
|
||||
glLightfv( GL_LIGHT0, GL_DIFFUSE, light_color );
|
||||
|
||||
light_color[0] = light_color[1] = light_color[2] = 1.0;
|
||||
glLightfv( GL_LIGHT0, GL_SPECULAR, light_color );
|
||||
|
||||
glLightfv( GL_LIGHT0, GL_POSITION, source_pos );
|
||||
|
||||
light_color[0] = light_color[1] = light_color[2] = 0.2;
|
||||
glLightModelfv( GL_LIGHT_MODEL_AMBIENT, light_color );
|
||||
|
||||
glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
|
||||
|
||||
glEnable( GL_LIGHT0 ); // White spot on Z axis ( top )
|
||||
light = 0.3;
|
||||
light_color[0] = light_color[1] = light_color[2] = light;
|
||||
glLightfv( GL_LIGHT1, GL_POSITION, lowZ_axis_pos );
|
||||
glLightfv( GL_LIGHT1, GL_DIFFUSE, light_color );
|
||||
glEnable( GL_LIGHT0 ); // White spot on Z axis
|
||||
glEnable( GL_LIGHT1 ); // White spot on Z axis ( bottom)
|
||||
glEnable( GL_LIGHTING );
|
||||
}
|
||||
|
||||
|
||||
/* Create a Screenshot of the current 3D view.
|
||||
* Output file format is png or jpeg, or image is copied to the clipboard
|
||||
*/
|
||||
void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
|
||||
{
|
||||
static wxFileName fn; // Remember path between saves during this session only.
|
||||
wxString FullFileName;
|
||||
wxString file_ext, mask;
|
||||
bool fmt_is_jpeg = false;
|
||||
|
||||
// First time path is set to the project path.
|
||||
if( !fn.IsOk() )
|
||||
fn = Parent()->Prj().GetProjectFullName();
|
||||
wxFileName fn( Parent()->GetDefaultFileName() );
|
||||
wxString FullFileName;
|
||||
wxString file_ext, mask;
|
||||
bool fmt_is_jpeg = false;
|
||||
|
||||
if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
|
||||
fmt_is_jpeg = true;
|
||||
@@ -648,24 +596,23 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
|
||||
{
|
||||
file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
|
||||
mask = wxT( "*." ) + file_ext;
|
||||
FullFileName = Parent()->GetDefaultFileName();
|
||||
fn.SetExt( file_ext );
|
||||
|
||||
FullFileName = EDA_FILE_SELECTOR( _( "3D Image File Name:" ), fn.GetPath(),
|
||||
fn.GetFullName(), file_ext, mask, this,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT, true );
|
||||
FullFileName = EDA_FileSelector( _( "3D Image filename:" ), wxEmptyString,
|
||||
fn.GetFullName(), file_ext, mask, this,
|
||||
wxFD_SAVE, true );
|
||||
|
||||
if( FullFileName.IsEmpty() )
|
||||
return;
|
||||
|
||||
fn = FullFileName;
|
||||
|
||||
// Be sure the screen area destroyed by the file dialog is redrawn before making
|
||||
// a screen copy.
|
||||
// Without this call, under Linux the screen refresh is made to late.
|
||||
wxYield();
|
||||
}
|
||||
|
||||
struct viewport_params
|
||||
struct vieport_params
|
||||
{
|
||||
GLint originx;
|
||||
GLint originy;
|
||||
@@ -673,10 +620,6 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
|
||||
GLint y;
|
||||
} viewport;
|
||||
|
||||
// Be sure we have the latest 3D view (remember 3D view is buffered)
|
||||
Refresh();
|
||||
wxYield();
|
||||
|
||||
// Build image from the 3D buffer
|
||||
wxWindowUpdateLocker noUpdates( this );
|
||||
glGetIntegerv( GL_VIEWPORT, (GLint*) &viewport );
|
||||
@@ -694,6 +637,7 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
|
||||
viewport.x, viewport.y,
|
||||
GL_ALPHA, GL_UNSIGNED_BYTE, alphabuffer );
|
||||
|
||||
|
||||
image.SetData( pixelbuffer );
|
||||
image.SetAlpha( alphabuffer );
|
||||
image = image.Mirror( false );
|
||||
@@ -701,15 +645,17 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
|
||||
|
||||
if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
||||
{
|
||||
wxBitmapDataObject* dobjBmp = new wxBitmapDataObject;
|
||||
dobjBmp->SetBitmap( bitmap );
|
||||
|
||||
if( wxTheClipboard->Open() )
|
||||
{
|
||||
wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap );
|
||||
|
||||
if( !wxTheClipboard->SetData( dobjBmp ) )
|
||||
wxMessageBox( _( "Failed to copy image to clipboard" ) );
|
||||
|
||||
wxTheClipboard->Flush(); /* the data in clipboard will stay
|
||||
* available after the application exits */
|
||||
* available after the
|
||||
* application exits */
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
}
|
||||
|
||||
+20
-277
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2012 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
|
||||
@@ -43,333 +43,76 @@
|
||||
#endif
|
||||
|
||||
#include <3d_struct.h>
|
||||
#include <modelparsers.h>
|
||||
#include <class_module.h>
|
||||
#include <CBBox.h>
|
||||
|
||||
class BOARD_DESIGN_SETTINGS;
|
||||
class EDA_3D_FRAME;
|
||||
class SHAPE_POLY_SET;
|
||||
class REPORTER;
|
||||
|
||||
class VIA;
|
||||
class S3D_VERTEX;
|
||||
class SEGVIA;
|
||||
class D_PAD;
|
||||
|
||||
// We are using GL lists to store layers and other items
|
||||
// to draw or not
|
||||
// GL_LIST_ID are the GL lists indexes in m_glLists
|
||||
enum GL_LIST_ID
|
||||
{
|
||||
GL_ID_BEGIN = 0,
|
||||
GL_ID_AXIS = GL_ID_BEGIN, // list id for 3D axis
|
||||
GL_ID_GRID, // list id for 3D grid
|
||||
GL_ID_BOARD, // List id for copper layers
|
||||
GL_ID_TECH_LAYERS, // List id for non copper layers (masks...)
|
||||
GL_ID_AUX_LAYERS, // List id for user layers (draw, eco, comment)
|
||||
GL_ID_3DSHAPES_SOLID_FRONT, // List id for 3D shapes, non transparent entities
|
||||
GL_ID_3DSHAPES_TRANSP_FRONT,// List id for 3D shapes, transparent entities
|
||||
GL_ID_3DSHAPES_SOLID_BACK, // List id for 3D shapes, non transparent entities
|
||||
GL_ID_3DSHAPES_TRANSP_BACK, // List id for 3D shapes, transparent entities
|
||||
GL_ID_SHADOW_FRONT,
|
||||
GL_ID_SHADOW_BACK,
|
||||
GL_ID_SHADOW_BOARD,
|
||||
GL_ID_BODY, // Body only list
|
||||
GL_ID_END
|
||||
};
|
||||
|
||||
class EDA_3D_CANVAS : public wxGLCanvas
|
||||
{
|
||||
private:
|
||||
bool m_init;
|
||||
bool m_reportWarnings; ///< true to report all warnings when building the 3D scene
|
||||
///< false to report errors only
|
||||
GLuint m_glLists[GL_ID_END]; ///< GL lists
|
||||
GLuint m_gllist;
|
||||
wxGLContext* m_glRC;
|
||||
wxRealPoint m_draw3dOffset; ///< offset to draw the 3D mesh.
|
||||
double m_ZBottom; ///< position of the back layer
|
||||
double m_ZTop; ///< position of the front layer
|
||||
|
||||
GLuint m_text_pcb; ///< an index to the texture generated for pcb texts
|
||||
GLuint m_text_silk; ///< an index to the texture generated for silk layers
|
||||
|
||||
// Index to the textures generated for shadows
|
||||
bool m_shadow_init;
|
||||
GLuint m_text_fake_shadow_front;
|
||||
GLuint m_text_fake_shadow_back;
|
||||
GLuint m_text_fake_shadow_board;
|
||||
|
||||
CBBOX m_boardAABBox; ///< Axis Align Bounding Box of the board
|
||||
CBBOX m_fastAABBox; ///< Axis Align Bounding Box that contain the other bounding boxes
|
||||
CBBOX m_fastAABBox_Shadow; ///< A bit scalled version of the m_fastAABBox
|
||||
|
||||
S3D_VERTEX m_lightPos;
|
||||
|
||||
/// Stores the list of parsers for each new file name (dont repeat files already loaded)
|
||||
std::vector<S3D_MODEL_PARSER *> m_model_parsers_list;
|
||||
std::vector<wxString> m_model_filename_list;
|
||||
|
||||
void create_and_render_shadow_buffer( GLuint *aDst_gl_texture,
|
||||
GLuint aTexture_size, bool aDraw_body, int aBlurPasses );
|
||||
|
||||
void calcBBox();
|
||||
wxRealPoint m_draw3dOffset; // offset to draw the 3 mesh.
|
||||
double m_ZBottom; // position of the back layer
|
||||
double m_ZTop; // position of the front layer
|
||||
|
||||
public:
|
||||
EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList = 0 );
|
||||
~EDA_3D_CANVAS();
|
||||
|
||||
EDA_3D_FRAME* Parent() const { return static_cast<EDA_3D_FRAME*>( GetParent() ); }
|
||||
EDA_3D_FRAME* Parent() { return (EDA_3D_FRAME*)GetParent(); }
|
||||
|
||||
BOARD* GetBoard() { return Parent()->GetBoard(); }
|
||||
|
||||
/**
|
||||
* Function ClearLists
|
||||
* Clear the display list.
|
||||
* @param aGlList = the list to clear.
|
||||
* if 0 (default) all lists are cleared
|
||||
*/
|
||||
void ClearLists( int aGlList = 0 );
|
||||
void ClearLists();
|
||||
|
||||
// Event functions:
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void OnEraseBackground( wxEraseEvent& event );
|
||||
void OnChar( wxKeyEvent& event );
|
||||
void OnMouseWheel( wxMouseEvent& event );
|
||||
#ifdef USE_OSX_MAGNIFY_EVENT
|
||||
void OnMagnify( wxMouseEvent& event );
|
||||
#endif
|
||||
void OnMouseMove( wxMouseEvent& event );
|
||||
void OnRightClick( wxMouseEvent& event );
|
||||
void OnPopUpMenu( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function TakeScreenshot
|
||||
*
|
||||
* creates a screenshot of the current 3D view and save to file as png or jpeg or image
|
||||
* is copied to the clipboard
|
||||
*/
|
||||
void TakeScreenshot( wxCommandEvent& event );
|
||||
void OnEnterWindow( wxMouseEvent& event );
|
||||
|
||||
// Display functions
|
||||
GLuint DisplayCubeforTest(); // Just a test function
|
||||
void SetView3D( int keycode );
|
||||
void DisplayStatus();
|
||||
void Redraw();
|
||||
void Redraw( bool finish = false );
|
||||
void Render();
|
||||
|
||||
/**
|
||||
* Function CreateDrawGL_List
|
||||
* Prepares the parameters of the OpenGL draw list
|
||||
* creates the OpenGL draw list items (board, grid ...)
|
||||
* @param aErrorMessages = a REPORTER which will filled with error messages,
|
||||
* if any
|
||||
* @param aActivity = a REPORTER to display activity state
|
||||
* creates the OpenGL draw list items (board, grid ...
|
||||
*/
|
||||
void CreateDrawGL_List( REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||
GLuint CreateDrawGL_List();
|
||||
void InitGL();
|
||||
|
||||
void ReportWarnings( bool aReport ) { m_reportWarnings = aReport; }
|
||||
|
||||
void SetLights();
|
||||
|
||||
void SetOffset(double aPosX, double aPosY)
|
||||
{
|
||||
m_draw3dOffset.x = aPosX;
|
||||
m_draw3dOffset.y = aPosY;
|
||||
}
|
||||
|
||||
/** @return the INFO3D_VISU which contains the current parameters
|
||||
* to draw the 3D view og the board
|
||||
*/
|
||||
INFO3D_VISU& GetPrm3DVisu() const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* return true if we are in realistic mode render
|
||||
*/
|
||||
bool isRealisticMode() const;
|
||||
|
||||
/**
|
||||
* @return true if aItem should be displayed
|
||||
* @param aItem = an item of DISPLAY3D_FLG enum
|
||||
*/
|
||||
bool isEnabled( DISPLAY3D_FLG aItem ) const;
|
||||
|
||||
/** Helper function
|
||||
* @return true if aLayer should be displayed, false otherwise
|
||||
*/
|
||||
bool is3DLayerEnabled( LAYER_ID aLayer ) const;
|
||||
|
||||
/**
|
||||
* @return the size of the board in pcb units
|
||||
*/
|
||||
wxSize getBoardSize() const;
|
||||
|
||||
/**
|
||||
* @return the position of the board center in pcb units
|
||||
*/
|
||||
wxPoint getBoardCenter() const;
|
||||
|
||||
/**
|
||||
* Helper function setGLTechLayersColor
|
||||
* Initialize the color to draw the non copper layers
|
||||
* in realistic mode and normal mode.
|
||||
*/
|
||||
void setGLTechLayersColor( LAYER_NUM aLayer );
|
||||
|
||||
/**
|
||||
* Helper function setGLCopperColor
|
||||
* Initialize the copper color to draw the board
|
||||
* in realistic mode (a golden yellow color )
|
||||
*/
|
||||
void setGLCopperColor();
|
||||
|
||||
/**
|
||||
* Helper function setGLEpoxyColor
|
||||
* Initialize the color to draw the epoxy body board in realistic mode.
|
||||
*/
|
||||
void setGLEpoxyColor( float aTransparency = 1.0 );
|
||||
|
||||
/**
|
||||
* Helper function setGLSolderMaskColor
|
||||
* Initialize the color to draw the solder mask layers in realistic mode.
|
||||
*/
|
||||
void setGLSolderMaskColor( float aTransparency = 1.0 );
|
||||
|
||||
/**
|
||||
* Function buildBoard3DView
|
||||
* Function BuildBoard3DView
|
||||
* Called by CreateDrawGL_List()
|
||||
* Populates the OpenGL GL_ID_BOARD draw list with board items only on copper layers.
|
||||
* 3D footprint shapes, tech layers and aux layers are not on this list
|
||||
* Fills aErrorMessages with error messages created by some calculation function
|
||||
* display activity state
|
||||
* @param aBoardList =
|
||||
* @param aBodyOnlyList =
|
||||
* @param aErrorMessages = a REPORTER to add error and warning messages
|
||||
* created by the build process (can be NULL)
|
||||
* @param aActivity = a REPORTER to display activity state
|
||||
* Fills the OpenGL draw list with board items draw list.
|
||||
*/
|
||||
void buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||
REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||
void BuildBoard3DView();
|
||||
|
||||
/**
|
||||
* Function buildTechLayers3DView
|
||||
* Called by CreateDrawGL_List()
|
||||
* Populates the OpenGL GL_ID_TECH_LAYERS draw list with items on tech layers
|
||||
* @param aErrorMessages = a REPORTER to add error and warning messages
|
||||
* created by the build process (can be NULL)
|
||||
* @param aActivity = a REPORTER to display activity state
|
||||
*/
|
||||
void buildTechLayers3DView( REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||
|
||||
/**
|
||||
* Function buildBoardThroughHolesPolygonList
|
||||
* Helper funtion to build the list of the board through holes polygons
|
||||
* @param allBoardHoles = the SHAPE_POLY_SET to populate
|
||||
* @param aSegCountPerCircle = the number of segments to approximate a circle
|
||||
* @param aOptimizeLargeCircles = true to use more than aSegCountPerCircle
|
||||
* for large circles (a large circle dimatere is > 1mm )
|
||||
*/
|
||||
void buildBoardThroughHolesPolygonList( SHAPE_POLY_SET& allBoardHoles,
|
||||
int aSegCountPerCircle, bool aOptimizeLargeCircles );
|
||||
|
||||
/**
|
||||
* Function buildShadowList
|
||||
* Called by CreateDrawGL_List()
|
||||
*/
|
||||
void buildShadowList( GLuint aFrontList, GLuint aBacklist, GLuint aBoardList );
|
||||
|
||||
/**
|
||||
* Function buildFootprintShape3DList
|
||||
* Called by CreateDrawGL_List()
|
||||
* Fills the OpenGL GL_ID_3DSHAPES_SOLID and GL_ID_3DSHAPES_TRANSP
|
||||
* draw lists with 3D footprint shapes
|
||||
* @param aOpaqueList is the gl list for non transparent items
|
||||
* @param aTransparentList is the gl list for non transparent items,
|
||||
* @param aErrorMessages = a REPORTER to add error and warning messages
|
||||
* created by the build process (can be NULL)
|
||||
* @param aActivity = a REPORTER to display activity state
|
||||
* which need to be drawn after all other items
|
||||
*/
|
||||
void buildFootprintShape3DList( GLuint aOpaqueList,
|
||||
GLuint aTransparentList,
|
||||
REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||
/**
|
||||
* Function buildBoard3DAuxLayers
|
||||
* Called by CreateDrawGL_List()
|
||||
* Fills the OpenGL GL_ID_AUX_LAYERS draw list
|
||||
* with items on aux layers only
|
||||
* @param aErrorMessages = a REPORTER to add error and warning messages
|
||||
* created by the build process (can be NULL)
|
||||
* @param aActivity = a REPORTER to display activity state
|
||||
* which need to be drawn after all other items
|
||||
*/
|
||||
void buildBoard3DAuxLayers( REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||
|
||||
void draw3DGrid( double aGriSizeMM );
|
||||
void draw3DAxis();
|
||||
|
||||
/**
|
||||
* Helper function BuildPadShapeThickOutlineAsPolygon:
|
||||
* Build a pad outline as non filled polygon, to draw pads on silkscreen layer
|
||||
* with a line thickness = aWidth
|
||||
* Used only to draw pads outlines on silkscreen layers.
|
||||
*/
|
||||
void buildPadShapeThickOutlineAsPolygon( const D_PAD* aPad,
|
||||
SHAPE_POLY_SET& aCornerBuffer,
|
||||
int aWidth,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor );
|
||||
|
||||
|
||||
/**
|
||||
* Helper function draw3DViaHole:
|
||||
* Draw the via hole:
|
||||
* Build a vertical hole (a cylinder) between the first and the last via layers
|
||||
*/
|
||||
void draw3DViaHole( const VIA * aVia );
|
||||
|
||||
/**
|
||||
* Helper function draw3DPadHole:
|
||||
* Draw the pad hole:
|
||||
* Build a vertical hole (round or oblong) between the front and back layers
|
||||
*/
|
||||
void draw3DPadHole( const D_PAD * aPad );
|
||||
|
||||
/**
|
||||
* function render3DComponentShape
|
||||
* insert mesh in gl list
|
||||
* @param module
|
||||
* @param aIsRenderingJustNonTransparentObjects = true to load non transparent objects
|
||||
* @param aIsRenderingJustTransparentObjects = true to load non transparent objects
|
||||
* in openGL, transparent objects should be drawn *after* non transparent objects
|
||||
*/
|
||||
void render3DComponentShape( MODULE* module,
|
||||
bool aIsRenderingJustNonTransparentObjects,
|
||||
bool aIsRenderingJustTransparentObjects );
|
||||
|
||||
/**
|
||||
* function read3DComponentShape
|
||||
* read the 3D component shape(s) of the footprint (physical shape).
|
||||
* @param module
|
||||
* @return true if load was succeeded, false otherwise
|
||||
*/
|
||||
bool read3DComponentShape( MODULE* module );
|
||||
|
||||
/**
|
||||
* function generateFakeShadowsTextures
|
||||
* creates shadows of the board an footprints
|
||||
* for aesthetical purpose
|
||||
* @param aErrorMessages = a REPORTER to add error and warning messages
|
||||
* created by the build process (can be NULL)
|
||||
* @param aActivity = a REPORTER to display activity state
|
||||
*/
|
||||
void generateFakeShadowsTextures( REPORTER* aErrorMessages, REPORTER* aActivity );
|
||||
void DrawGrid( double aGriSizeMM );
|
||||
void Draw3DViaHole( SEGVIA * aVia );
|
||||
void Draw3DPadHole( D_PAD * aPad );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
void CheckGLError(const char *aFileName, int aLineNumber);
|
||||
|
||||
#endif /* _3D_CANVAS_H_ */
|
||||
|
||||
+32
-65
@@ -1,7 +1,11 @@
|
||||
/**
|
||||
* @file 3d_class.cpp
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2012 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
|
||||
@@ -21,21 +25,35 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file 3d_class.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
|
||||
#include "3d_viewer.h"
|
||||
#include "3d_struct.h"
|
||||
#include "modelparsers.h"
|
||||
#include <3d_viewer.h>
|
||||
|
||||
|
||||
void S3D_MASTER::Insert( S3D_MATERIAL* aMaterial )
|
||||
S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
|
||||
EDA_ITEM( father, NOT_USED )
|
||||
{
|
||||
aMaterial->SetNext( m_Materials );
|
||||
m_Materials = aMaterial;
|
||||
m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0;
|
||||
m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0;
|
||||
m_AmbientIntensity = 1.0;
|
||||
m_Transparency = 0.0;
|
||||
m_Shininess = 1.0;
|
||||
m_Name = name;
|
||||
}
|
||||
|
||||
|
||||
void S3D_MATERIAL::SetMaterial()
|
||||
{
|
||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||
glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
|
||||
m_DiffuseColor.y * m_AmbientIntensity,
|
||||
m_DiffuseColor.z * m_AmbientIntensity,
|
||||
1.0 - m_Transparency );
|
||||
#if 0
|
||||
glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR );
|
||||
glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z );
|
||||
#endif
|
||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||
}
|
||||
|
||||
|
||||
@@ -54,18 +72,9 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) :
|
||||
EDA_ITEM( aParent, NOT_USED )
|
||||
{
|
||||
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
|
||||
|
||||
m_3D_Drawings = NULL;
|
||||
m_Materials = NULL;
|
||||
m_parser = NULL;
|
||||
m_ShapeType = FILE3D_NONE;
|
||||
|
||||
m_use_modelfile_diffuseColor = true;
|
||||
m_use_modelfile_emissiveColor = true;
|
||||
m_use_modelfile_specularColor = true;
|
||||
m_use_modelfile_ambientIntensity = true;
|
||||
m_use_modelfile_transparency = true;
|
||||
m_use_modelfile_shininess = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,14 +87,12 @@ S3D_MASTER:: ~S3D_MASTER()
|
||||
{
|
||||
next = m_3D_Drawings->Next();
|
||||
delete m_3D_Drawings;
|
||||
m_3D_Drawings = 0;
|
||||
}
|
||||
|
||||
for( ; m_Materials != NULL; m_Materials = nextmat )
|
||||
{
|
||||
nextmat = m_Materials->Next();
|
||||
delete m_Materials;
|
||||
m_Materials = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,59 +123,19 @@ void S3D_MASTER::SetShape3DName( const wxString& aShapeName )
|
||||
return;
|
||||
|
||||
wxFileName fn = m_Shape3DName;
|
||||
m_Shape3DNameExtension = fn.GetExt();
|
||||
wxString ext = fn.GetExt();
|
||||
|
||||
if( m_Shape3DNameExtension == wxT( "wrl" ) ||
|
||||
m_Shape3DNameExtension == wxT( "x3d" ) )
|
||||
if( ext == wxT( "wrl" ) || ext == wxT( "x3d" ) )
|
||||
m_ShapeType = FILE3D_VRML;
|
||||
else if( m_Shape3DNameExtension == wxT( "idf" ) )
|
||||
else if( ext == wxT( "idf" ) )
|
||||
m_ShapeType = FILE3D_IDF;
|
||||
else
|
||||
m_ShapeType = FILE3D_UNKNOWN;
|
||||
|
||||
// Expand any environment variables embedded in footprint's m_Shape3DName field.
|
||||
// To ensure compatibility with most of footprint's m_Shape3DName field,
|
||||
// if the m_Shape3DName is not an absolute path the default path
|
||||
// given by the environment variable KISYS3DMOD will be used
|
||||
|
||||
if( m_Shape3DName.StartsWith( wxT("${") ) )
|
||||
m_Shape3DFullFilename = wxExpandEnvVars( m_Shape3DName );
|
||||
else
|
||||
m_Shape3DFullFilename = m_Shape3DName;
|
||||
|
||||
wxFileName fnFull( m_Shape3DFullFilename );
|
||||
|
||||
if( !( fnFull.IsAbsolute() || m_Shape3DFullFilename.StartsWith( wxT(".") ) ) )
|
||||
{
|
||||
wxString default_path;
|
||||
wxGetEnv( KISYS3DMOD, &default_path );
|
||||
|
||||
if( !( default_path.IsEmpty() ) )
|
||||
{
|
||||
|
||||
if( !default_path.EndsWith( wxT("/") ) && !default_path.EndsWith( wxT("\\") ) )
|
||||
default_path += wxT("/");
|
||||
|
||||
m_Shape3DFullFilename = default_path + m_Shape3DFullFilename;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const wxString S3D_MASTER::GetShape3DFullFilename()
|
||||
{
|
||||
return m_Shape3DFullFilename;
|
||||
}
|
||||
|
||||
|
||||
const wxString S3D_MASTER::GetShape3DExtension()
|
||||
{
|
||||
return m_Shape3DNameExtension;
|
||||
}
|
||||
|
||||
|
||||
STRUCT_3D_SHAPE::STRUCT_3D_SHAPE( EDA_ITEM* aParent ) :
|
||||
EDA_ITEM( aParent, NOT_USED )
|
||||
{
|
||||
|
||||
+758
-966
File diff suppressed because it is too large
Load Diff
@@ -33,28 +33,35 @@
|
||||
#include <3d_viewer.h>
|
||||
#include <info3d_visu.h>
|
||||
#include <3d_draw_basic_functions.h>
|
||||
#include <modelparsers.h>
|
||||
|
||||
// Imported function:
|
||||
extern void Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits );
|
||||
extern void CheckGLError();
|
||||
|
||||
// Number of segments to approximate a circle by segments
|
||||
#define SEGM_PER_CIRCLE 24
|
||||
#define SEGM_PER_CIRCLE 16
|
||||
|
||||
#ifndef CALLBACK
|
||||
#define CALLBACK
|
||||
#endif
|
||||
|
||||
// Variables used to pass a value to call back openGL functions
|
||||
static float s_textureScale;
|
||||
static double s_currentZpos;
|
||||
static double s_biuTo3Dunits;
|
||||
bool s_useTextures;
|
||||
|
||||
// CALLBACK functions for GLU_TESS
|
||||
static void CALLBACK tessBeginCB( GLenum which );
|
||||
static void CALLBACK tessEndCB();
|
||||
static void CALLBACK tessErrorCB( GLenum errorCode );
|
||||
static void CALLBACK tessCPolyPt2Vertex( const GLvoid* data );
|
||||
|
||||
void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
|
||||
// 2 helper functions to set the current normal vector for gle items
|
||||
static inline void SetNormalZpos()
|
||||
{
|
||||
glNormal3f( 0.0, 0.0, 1.0 );
|
||||
}
|
||||
|
||||
static inline void SetNormalZneg()
|
||||
{
|
||||
glNormal3f( 0.0, 0.0, -1.0 );
|
||||
}
|
||||
|
||||
|
||||
/* Draw3D_VerticalPolygonalCylinder is a helper function.
|
||||
*
|
||||
@@ -62,7 +69,7 @@ void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUni
|
||||
* from Z position = aZpos to aZpos + aHeight
|
||||
* Used to create the vertical sides of 3D horizontal shapes with thickness.
|
||||
*/
|
||||
static void Draw3D_VerticalPolygonalCylinder( const SHAPE_POLY_SET& aPolysList,
|
||||
static void Draw3D_VerticalPolygonalCylinder( const CPOLYGONS_LIST& aPolysList,
|
||||
int aHeight, int aZpos,
|
||||
bool aInside, double aBiuTo3DUnits )
|
||||
{
|
||||
@@ -87,61 +94,42 @@ static void Draw3D_VerticalPolygonalCylinder( const SHAPE_POLY_SET& aPolysList,
|
||||
coords[3].z = coords[0].z;
|
||||
|
||||
// Draw the vertical polygonal side
|
||||
for( int idx = 0; idx < aPolysList.OutlineCount(); idx++ )
|
||||
int startContour = 0;
|
||||
for( unsigned ii = 0; ii < aPolysList.GetCornersCount(); ii++ )
|
||||
{
|
||||
// Each polygon in aPolysList is a polygon with holes
|
||||
const SHAPE_POLY_SET::POLYGON& curr_polywithholes = aPolysList.CPolygon( idx );
|
||||
unsigned jj = ii + 1;
|
||||
|
||||
// Draw the outline of each simple polygon inside the polygon with holes:
|
||||
for( unsigned ipoly = 0; ipoly < curr_polywithholes.size(); ipoly++ )
|
||||
if( aPolysList.IsEndContour( ii ) || jj >= aPolysList.GetCornersCount() )
|
||||
{
|
||||
const SHAPE_LINE_CHAIN& path = curr_polywithholes[ipoly]; // a simple polygon
|
||||
|
||||
for( int jj = 0; jj < path.PointCount(); jj++ )
|
||||
{
|
||||
const VECTOR2I& a = path.CPoint( jj );
|
||||
const VECTOR2I& b = path.CPoint( jj + 1 );
|
||||
|
||||
// Build the 4 vertices of each GL_QUAD
|
||||
coords[0].x = a.x;
|
||||
coords[0].y = -a.y;
|
||||
coords[1].x = coords[0].x;
|
||||
coords[1].y = coords[0].y; // only z change
|
||||
coords[2].x = b.x;
|
||||
coords[2].y = -b.y;
|
||||
coords[3].x = coords[2].x;
|
||||
coords[3].y = coords[2].y; // only z change
|
||||
|
||||
// Creates the GL_QUAD
|
||||
TransfertToGLlist( coords, aBiuTo3DUnits );
|
||||
}
|
||||
jj = startContour;
|
||||
startContour = ii + 1;
|
||||
}
|
||||
|
||||
// Build the 4 vertices of each GL_QUAD
|
||||
coords[0].x = aPolysList.GetX( ii );
|
||||
coords[0].y = -aPolysList.GetY( ii );
|
||||
coords[1].x = coords[0].x;
|
||||
coords[1].y = coords[0].y; // only z change
|
||||
coords[2].x = aPolysList.GetX( jj );
|
||||
coords[2].y = -aPolysList.GetY( jj );
|
||||
coords[3].x = coords[2].x;
|
||||
coords[3].y = coords[2].y; // only z change
|
||||
|
||||
// Creates the GL_QUAD
|
||||
Set_Object_Data( coords, aBiuTo3DUnits );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SetGLColor( EDA_COLOR_T color, double alpha )
|
||||
{
|
||||
double red, green, blue;
|
||||
const StructColors &colordata = g_ColorRefs[ColorGetBase( color )];
|
||||
|
||||
float red = colordata.m_Red / 255.0;
|
||||
float blue = colordata.m_Blue / 255.0;
|
||||
float green = colordata.m_Green / 255.0;
|
||||
glColor4f( red, green, blue, (float)alpha );
|
||||
}
|
||||
|
||||
|
||||
void SetGLColor( S3D_COLOR& aColor, float aTransparency )
|
||||
{
|
||||
glColor4f( aColor.m_Red, aColor.m_Green, aColor.m_Blue, aTransparency );
|
||||
}
|
||||
|
||||
|
||||
void SetGLTexture( GLuint text_id, float scale )
|
||||
{
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glBindTexture( GL_TEXTURE_2D, text_id );
|
||||
s_textureScale = scale; // for Tess callback functions
|
||||
red = colordata.m_Red / 255.0;
|
||||
blue = colordata.m_Blue / 255.0;
|
||||
green = colordata.m_Green / 255.0;
|
||||
glColor4f( red, green, blue, alpha );
|
||||
}
|
||||
|
||||
|
||||
@@ -153,15 +141,9 @@ void SetGLTexture( GLuint text_id, float scale )
|
||||
* The top side is located at aZpos + aThickness / 2
|
||||
* The bottom side is located at aZpos - aThickness / 2
|
||||
*/
|
||||
void Draw3D_SolidHorizontalPolyPolygons( const SHAPE_POLY_SET& aPolysList,
|
||||
int aZpos, int aThickness, double aBiuTo3DUnits,
|
||||
bool aUseTextures,
|
||||
float aNormal_Z_Orientation )
|
||||
void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
|
||||
int aZpos, int aThickness, double aBiuTo3DUnits )
|
||||
{
|
||||
// for Tess callback functions:
|
||||
s_biuTo3Dunits = aBiuTo3DUnits;
|
||||
s_useTextures = aUseTextures;
|
||||
|
||||
GLUtesselator* tess = gluNewTess();
|
||||
|
||||
gluTessCallback( tess, GLU_TESS_BEGIN, ( void (CALLBACK*) () )tessBeginCB );
|
||||
@@ -169,63 +151,58 @@ void Draw3D_SolidHorizontalPolyPolygons( const SHAPE_POLY_SET& aPolysList,
|
||||
gluTessCallback( tess, GLU_TESS_ERROR, ( void (CALLBACK*) () )tessErrorCB );
|
||||
gluTessCallback( tess, GLU_TESS_VERTEX, ( void (CALLBACK*) () )tessCPolyPt2Vertex );
|
||||
|
||||
GLdouble v_data[3];
|
||||
double zpos = ( aZpos + (aThickness / 2.0) ) * aBiuTo3DUnits;
|
||||
s_currentZpos = zpos; // for Tess callback functions
|
||||
v_data[2] = zpos;
|
||||
GLdouble v_data[3];
|
||||
double zpos = ( aZpos + (aThickness / 2) ) * aBiuTo3DUnits;
|
||||
g_Parm_3D_Visu.m_CurrentZpos = zpos;
|
||||
v_data[2] = aZpos + (aThickness / 2);
|
||||
|
||||
// Set normal toward positive Z axis, for a solid object on the top side
|
||||
// Set normal to toward positive Z axis, for a solid object only (to draw the top side)
|
||||
if( aThickness )
|
||||
SetNormalZpos();
|
||||
|
||||
//gluTessProperty( tess, GLU_TESS_BOUNDARY_ONLY, GL_FALSE );
|
||||
gluTessProperty( tess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD );
|
||||
|
||||
glNormal3f( 0.0, 0.0, aNormal_Z_Orientation );
|
||||
// gluTessProperty(tess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD);
|
||||
|
||||
// Draw solid areas contained in this list
|
||||
SHAPE_POLY_SET polylist = aPolysList; // temporary copy for gluTessVertex
|
||||
CPOLYGONS_LIST polylist = aPolysList; // temporary copy for gluTessVertex
|
||||
|
||||
for( int side = 0; side < 2; side++ )
|
||||
{
|
||||
int startContour = 1;
|
||||
|
||||
for ( int idx = 0; idx < polylist.OutlineCount(); ++idx )
|
||||
for( unsigned ii = 0; ii < polylist.GetCornersCount(); ii++ )
|
||||
{
|
||||
gluTessBeginPolygon( tess, NULL );
|
||||
|
||||
SHAPE_POLY_SET::POLYGON& curr_polywithholes = polylist.Polygon( idx ); // a polygon with holes
|
||||
|
||||
for( unsigned ipoly = 0; ipoly < curr_polywithholes.size(); ipoly++ )
|
||||
if( startContour == 1 )
|
||||
{
|
||||
SHAPE_LINE_CHAIN& curr_poly = curr_polywithholes[ipoly]; // a simple polygon
|
||||
|
||||
gluTessBeginPolygon( tess, NULL );
|
||||
gluTessBeginContour( tess );
|
||||
|
||||
for( int ipt = 0; ipt < curr_poly.PointCount(); ipt++ )
|
||||
{
|
||||
v_data[0] = curr_poly.Point( ipt ).x * aBiuTo3DUnits;
|
||||
v_data[1] = -curr_poly.Point( ipt ).y * aBiuTo3DUnits;
|
||||
// gluTessVertex store pointers on data, not data, so do not store
|
||||
// different corners values in a temporary variable
|
||||
// but send pointer on each CPolyPt value in polylist
|
||||
// before calling gluDeleteTess
|
||||
gluTessVertex( tess, v_data, &curr_poly.Point( ipt ) );
|
||||
}
|
||||
|
||||
gluTessEndContour( tess );
|
||||
startContour = 0;
|
||||
}
|
||||
|
||||
gluTessEndPolygon( tess );
|
||||
}
|
||||
v_data[0] = polylist.GetX( ii ) * aBiuTo3DUnits;
|
||||
v_data[1] = -polylist.GetY( ii ) * aBiuTo3DUnits;
|
||||
// gluTessVertex store pointers on data, not data, so do not store
|
||||
// different corners values in a temporary variable
|
||||
// but send pointer on each CPolyPt value in polylist
|
||||
// before calling gluDeleteTess
|
||||
gluTessVertex( tess, v_data, &polylist[ii] );
|
||||
|
||||
if( polylist.IsEndContour( ii ) )
|
||||
{
|
||||
gluTessEndContour( tess );
|
||||
gluTessEndPolygon( tess );
|
||||
startContour = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if( aThickness == 0 )
|
||||
break;
|
||||
|
||||
// Prepare the bottom side of solid areas
|
||||
zpos = ( aZpos - (aThickness / 2.0) ) * aBiuTo3DUnits;
|
||||
s_currentZpos = zpos; // for Tess callback functions
|
||||
zpos = ( aZpos - (aThickness / 2) ) * aBiuTo3DUnits;
|
||||
g_Parm_3D_Visu.m_CurrentZpos = zpos;
|
||||
v_data[2] = zpos;
|
||||
|
||||
glNormal3f( 0.0, 0.0, -aNormal_Z_Orientation );
|
||||
// Now;, set normal to toward negative Z axis, for the solid object bottom side
|
||||
SetNormalZneg();
|
||||
}
|
||||
|
||||
gluDeleteTess( tess );
|
||||
@@ -234,8 +211,22 @@ void Draw3D_SolidHorizontalPolyPolygons( const SHAPE_POLY_SET& aPolysList,
|
||||
return;
|
||||
|
||||
// Build the 3D data : vertical side
|
||||
Draw3D_VerticalPolygonalCylinder( polylist, aThickness, aZpos - (aThickness / 2.0),
|
||||
true, aBiuTo3DUnits );
|
||||
Draw3D_VerticalPolygonalCylinder( polylist, aThickness, aZpos - (aThickness / 2), false, aBiuTo3DUnits );
|
||||
}
|
||||
|
||||
|
||||
/* draw the solid polygon found in aPolysList
|
||||
* The first polygon is the main polygon, others are holes
|
||||
* See Draw3D_SolidHorizontalPolyPolygons for more info
|
||||
*/
|
||||
void Draw3D_SolidHorizontalPolygonWithHoles( const CPOLYGONS_LIST& aPolysList,
|
||||
int aZpos, int aThickness,
|
||||
double aBiuTo3DUnits )
|
||||
{
|
||||
CPOLYGONS_LIST polygon;
|
||||
|
||||
ConvertPolysListWithHolesToOnePolygon( aPolysList, polygon );
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos, aThickness, aBiuTo3DUnits );
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +240,7 @@ void Draw3D_ZaxisCylinder( wxPoint aCenterPos, int aRadius,
|
||||
int aZpos, double aBiuTo3DUnits )
|
||||
{
|
||||
const int slice = SEGM_PER_CIRCLE;
|
||||
SHAPE_POLY_SET outer_cornerBuffer;
|
||||
CPOLYGONS_LIST outer_cornerBuffer;
|
||||
|
||||
TransformCircleToPolygon( outer_cornerBuffer, aCenterPos,
|
||||
aRadius + (aThickness / 2), slice );
|
||||
@@ -257,41 +248,42 @@ void Draw3D_ZaxisCylinder( wxPoint aCenterPos, int aRadius,
|
||||
std::vector<S3D_VERTEX> coords;
|
||||
coords.resize( 4 );
|
||||
|
||||
SHAPE_POLY_SET inner_cornerBuffer;
|
||||
|
||||
CPOLYGONS_LIST inner_cornerBuffer;
|
||||
if( aThickness ) // build the the vertical inner polygon (hole)
|
||||
TransformCircleToPolygon( inner_cornerBuffer, aCenterPos,
|
||||
aRadius - (aThickness / 2), slice );
|
||||
|
||||
if( aHeight )
|
||||
{
|
||||
|
||||
// Draw the vertical outer side
|
||||
Draw3D_VerticalPolygonalCylinder( outer_cornerBuffer,
|
||||
aHeight, aZpos, false, aBiuTo3DUnits );
|
||||
|
||||
aHeight, aZpos, false, aBiuTo3DUnits );
|
||||
if( aThickness )
|
||||
// Draws the vertical inner side (hole)
|
||||
Draw3D_VerticalPolygonalCylinder( inner_cornerBuffer,
|
||||
aHeight, aZpos, true, aBiuTo3DUnits );
|
||||
aHeight, aZpos, true, aBiuTo3DUnits );
|
||||
}
|
||||
|
||||
if( aThickness )
|
||||
{
|
||||
// draw top (front) and bottom (back) horizontal sides (rings)
|
||||
outer_cornerBuffer.AddHole( inner_cornerBuffer.COutline( 0 ) );
|
||||
SetNormalZpos();
|
||||
outer_cornerBuffer.Append( inner_cornerBuffer );
|
||||
CPOLYGONS_LIST polygon;
|
||||
|
||||
ConvertPolysListWithHolesToOnePolygon( outer_cornerBuffer, polygon );
|
||||
// draw top (front) horizontal ring
|
||||
Draw3D_SolidHorizontalPolyPolygons( outer_cornerBuffer, aZpos + aHeight,
|
||||
0, aBiuTo3DUnits, false, 1.0f );
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos + aHeight, 0, aBiuTo3DUnits );
|
||||
|
||||
if( aHeight )
|
||||
{
|
||||
// draw bottom (back) horizontal ring
|
||||
Draw3D_SolidHorizontalPolyPolygons( outer_cornerBuffer, aZpos,
|
||||
0, aBiuTo3DUnits, false, -1.0f );
|
||||
SetNormalZneg();
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos, 0, aBiuTo3DUnits );
|
||||
}
|
||||
}
|
||||
|
||||
SetNormalZpos();
|
||||
}
|
||||
|
||||
|
||||
@@ -309,20 +301,20 @@ void Draw3D_ZaxisOblongCylinder( wxPoint aAxis1Pos, wxPoint aAxis2Pos,
|
||||
const int slice = SEGM_PER_CIRCLE;
|
||||
|
||||
// Build the points to approximate oblong cylinder by segments
|
||||
SHAPE_POLY_SET cornerBuffer;
|
||||
CPOLYGONS_LIST outer_cornerBuffer;
|
||||
|
||||
int segm_width = (aRadius * 2) + aThickness;
|
||||
TransformRoundedEndsSegmentToPolygon( cornerBuffer, aAxis1Pos,
|
||||
TransformRoundedEndsSegmentToPolygon( outer_cornerBuffer, aAxis1Pos,
|
||||
aAxis2Pos, slice, segm_width );
|
||||
|
||||
// Draw the oblong outer cylinder
|
||||
if( aHeight )
|
||||
Draw3D_VerticalPolygonalCylinder( cornerBuffer, aHeight, aZpos,
|
||||
Draw3D_VerticalPolygonalCylinder( outer_cornerBuffer, aHeight, aZpos,
|
||||
false, aBiuTo3DUnits );
|
||||
|
||||
if( aThickness )
|
||||
{
|
||||
SHAPE_POLY_SET inner_cornerBuffer;
|
||||
CPOLYGONS_LIST inner_cornerBuffer;
|
||||
segm_width = aRadius * 2;
|
||||
TransformRoundedEndsSegmentToPolygon( inner_cornerBuffer, aAxis1Pos,
|
||||
aAxis2Pos, slice, segm_width );
|
||||
@@ -334,19 +326,24 @@ void Draw3D_ZaxisOblongCylinder( wxPoint aAxis1Pos, wxPoint aAxis2Pos,
|
||||
|
||||
// Build the horizontal full polygon shape
|
||||
// (outer polygon shape - inner polygon shape)
|
||||
cornerBuffer.AddHole( inner_cornerBuffer.COutline( 0 ) );
|
||||
outer_cornerBuffer.Append( inner_cornerBuffer );
|
||||
|
||||
CPOLYGONS_LIST polygon;
|
||||
ConvertPolysListWithHolesToOnePolygon( outer_cornerBuffer, polygon );
|
||||
|
||||
// draw top (front) horizontal side (ring)
|
||||
Draw3D_SolidHorizontalPolyPolygons( cornerBuffer, aZpos + aHeight, 0, aBiuTo3DUnits, false,
|
||||
1.0f );
|
||||
SetNormalZpos();
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos + aHeight, 0, aBiuTo3DUnits );
|
||||
|
||||
if( aHeight )
|
||||
{
|
||||
// draw bottom (back) horizontal side (ring)
|
||||
Draw3D_SolidHorizontalPolyPolygons( cornerBuffer, aZpos, 0, aBiuTo3DUnits, false,
|
||||
-1.0f );
|
||||
SetNormalZneg();
|
||||
Draw3D_SolidHorizontalPolyPolygons( polygon, aZpos, 0, aBiuTo3DUnits );
|
||||
}
|
||||
}
|
||||
|
||||
SetNormalZpos();
|
||||
}
|
||||
|
||||
|
||||
@@ -359,12 +356,12 @@ void Draw3D_ZaxisOblongCylinder( wxPoint aAxis1Pos, wxPoint aAxis2Pos,
|
||||
void Draw3D_SolidSegment( const wxPoint& aStart, const wxPoint& aEnd,
|
||||
int aWidth, int aThickness, int aZpos, double aBiuTo3DUnits )
|
||||
{
|
||||
SHAPE_POLY_SET cornerBuffer;
|
||||
const int slice = SEGM_PER_CIRCLE;
|
||||
CPOLYGONS_LIST cornerBuffer;
|
||||
const int slice = SEGM_PER_CIRCLE;
|
||||
|
||||
TransformRoundedEndsSegmentToPolygon( cornerBuffer, aStart, aEnd, slice, aWidth );
|
||||
|
||||
Draw3D_SolidHorizontalPolyPolygons( cornerBuffer, aZpos, aThickness, aBiuTo3DUnits, false, 1.0f );
|
||||
Draw3D_SolidHorizontalPolyPolygons( cornerBuffer, aZpos, aThickness, aBiuTo3DUnits );
|
||||
}
|
||||
|
||||
|
||||
@@ -374,11 +371,11 @@ void Draw3D_ArcSegment( const wxPoint& aCenterPos, const wxPoint& aStartPoint,
|
||||
{
|
||||
const int slice = SEGM_PER_CIRCLE;
|
||||
|
||||
SHAPE_POLY_SET cornerBuffer;
|
||||
CPOLYGONS_LIST cornerBuffer;
|
||||
TransformArcToPolygon( cornerBuffer, aCenterPos, aStartPoint, aArcAngle,
|
||||
slice, aWidth );
|
||||
|
||||
Draw3D_SolidHorizontalPolyPolygons( cornerBuffer, aZpos, aThickness, aBiuTo3DUnits, false, 1.0f );
|
||||
Draw3D_SolidHorizontalPolyPolygons( cornerBuffer, aZpos, aThickness, aBiuTo3DUnits );
|
||||
}
|
||||
|
||||
|
||||
@@ -401,15 +398,11 @@ void CALLBACK tessEndCB()
|
||||
void CALLBACK tessCPolyPt2Vertex( const GLvoid* data )
|
||||
{
|
||||
// cast back to double type
|
||||
const VECTOR2I* ptr = (const VECTOR2I*) data;
|
||||
const CPolyPt* ptr = (const CPolyPt*) data;
|
||||
|
||||
if( s_useTextures )
|
||||
{
|
||||
glTexCoord2f( ptr->x * s_biuTo3Dunits * s_textureScale,
|
||||
-ptr->y * s_biuTo3Dunits * s_textureScale);
|
||||
}
|
||||
|
||||
glVertex3d( ptr->x * s_biuTo3Dunits, -ptr->y * s_biuTo3Dunits, s_currentZpos );
|
||||
glVertex3d( ptr->x * g_Parm_3D_Visu.m_BiuTo3Dunits,
|
||||
-ptr->y * g_Parm_3D_Visu.m_BiuTo3Dunits,
|
||||
g_Parm_3D_Visu.m_CurrentZpos );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,17 +36,27 @@
|
||||
* @param aZpos = z position in board internal units
|
||||
* @param aThickness = thickness in board internal units
|
||||
* @param aBiuTo3DUnits = board internal units to 3D units scaling value
|
||||
* @param aUseTextures = true to use textxures for the polygons
|
||||
* @param aNormal_Z_Orientation = the normal Z orientation to apply
|
||||
* If aThickness = 0, a polygon area is drawn in a XY plane at Z position = aZpos.
|
||||
* If aThickness > 0, a solid object is drawn.
|
||||
* The top side is located at aZpos + aThickness / 2
|
||||
* The bottom side is located at aZpos - aThickness / 2
|
||||
*/
|
||||
void Draw3D_SolidHorizontalPolyPolygons( const SHAPE_POLY_SET& aPolysList,
|
||||
int aZpos, int aThickness, double aBiuTo3DUnits,
|
||||
bool aUseTextures,
|
||||
float aNormal_Z_Orientation );
|
||||
void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
|
||||
int aZpos, int aThickness, double aBiuTo3DUnits );
|
||||
|
||||
/** draw the solid polygon found in aPolysList
|
||||
* The first polygonj is the main polygon, others are holes
|
||||
* @param aPolysList = the polygon with holes to draw
|
||||
* @param aZpos = z position in board internal units
|
||||
* @param aThickness = thickness in board internal units
|
||||
* @param aBiuTo3DUnits = board internal units to 3D units scaling value
|
||||
* If aThickness = 0, a polygon area is drawn in a XY plane at Z position = aZpos.
|
||||
* If aThickness > 0, a solid object is drawn.
|
||||
* The top side is located at aZpos + aThickness / 2
|
||||
* The bottom side is located at aZpos - aThickness / 2
|
||||
*/
|
||||
void Draw3D_SolidHorizontalPolygonWithHoles( const CPOLYGONS_LIST& aPolysList,
|
||||
int aZpos, int aThickness, double aBiuTo3DUnits );
|
||||
|
||||
/** draw a thick segment using 3D primitives, in a XY plane
|
||||
* @param aStart = YX position of start point in board units
|
||||
@@ -115,20 +125,5 @@ void Draw3D_ZaxisOblongCylinder( wxPoint aAxis1Pos, wxPoint aAxis2Pos,
|
||||
*/
|
||||
void SetGLColor( EDA_COLOR_T aColor, double aTransparency = 1.0 );
|
||||
|
||||
/**
|
||||
* Set the current 3D color from a S3D_COLOR color, with optional transparency
|
||||
* @param aColor = a S3D_COLOR RGB color index
|
||||
* @param aTransparency = the color transparency (default = 1.0 = no transparency)
|
||||
*/
|
||||
void SetGLColor( S3D_COLOR& aColor, float aTransparency );
|
||||
|
||||
|
||||
/**
|
||||
* Set a texture id and a scale to apply when rendering the polygons
|
||||
* @param text_id = texture ID created by glGenTextures
|
||||
* @param scale = scale to apply to texture coords
|
||||
*/
|
||||
void SetGLTexture( GLuint text_id, float scale );
|
||||
|
||||
|
||||
#endif // _3D_DRAW_BASIC_FUNCTIONS_H_
|
||||
|
||||
@@ -1,640 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014-2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file 3d_draw_board_body.cpp
|
||||
*
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <trigo.h>
|
||||
#include <pcbstruct.h>
|
||||
#include <drawtxt.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
|
||||
#include <wxBasePcbFrame.h>
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_track.h>
|
||||
#include <class_edge_mod.h>
|
||||
#include <class_zone.h>
|
||||
#include <class_drawsegment.h>
|
||||
#include <class_pcb_text.h>
|
||||
#include <colors_selection.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <gal/opengl/glm/gtc/matrix_transform.hpp>
|
||||
#include <gal/opengl/opengl_compositor.h>
|
||||
#ifdef __WINDOWS__
|
||||
#include <GL/glew.h> // must be included before gl.h
|
||||
#endif
|
||||
|
||||
#include <3d_viewer.h>
|
||||
#include <3d_canvas.h>
|
||||
#include <info3d_visu.h>
|
||||
#include <trackball.h>
|
||||
#include <3d_draw_basic_functions.h>
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <geometry/shape_file_io.h>
|
||||
|
||||
|
||||
#include <CImage.h>
|
||||
#include <reporter.h>
|
||||
|
||||
// An option for all operations on polygons:
|
||||
// when useFastModeForPolygons = true, calculations can be *a lot* faster.
|
||||
// but created polygons can be not stricty simple (can share edges)
|
||||
// Although stricty simple are better for glu tesselation functions, I do not see
|
||||
// any issue when allowing not stricty simple polygons.
|
||||
// But I see *very* long calculations when setting useFastMode to false.
|
||||
// So, be careful if changing thie option
|
||||
bool useFastModeForPolygons = true;
|
||||
|
||||
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
|
||||
* Z orientation is 1.0 for all layers but "back" layers:
|
||||
* B_Cu , B_Adhes, B_Paste ), B_SilkS
|
||||
* used to calculate the Z orientation parameter for glNormal3f
|
||||
*/
|
||||
GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer );
|
||||
|
||||
void EDA_3D_CANVAS::buildBoardThroughHolesPolygonList( SHAPE_POLY_SET& allBoardHoles,
|
||||
int aSegCountPerCircle, bool aOptimizeLargeCircles )
|
||||
{
|
||||
// hole diameter value to change seg count by circle:
|
||||
int small_hole_limit = Millimeter2iu( 1.0 );
|
||||
int copper_thickness = GetPrm3DVisu().GetCopperThicknessBIU();
|
||||
|
||||
BOARD* pcb = GetBoard();
|
||||
|
||||
// Build holes of through vias:
|
||||
for( TRACK* track = pcb->m_Track; track; track = track->Next() )
|
||||
{
|
||||
if( track->Type() != PCB_VIA_T )
|
||||
continue;
|
||||
|
||||
VIA *via = static_cast<VIA*>( track );
|
||||
|
||||
if( via->GetViaType() != VIA_THROUGH )
|
||||
continue;
|
||||
|
||||
int holediameter = via->GetDrillValue();
|
||||
int hole_outer_radius = (holediameter + copper_thickness) / 2;
|
||||
|
||||
TransformCircleToPolygon( allBoardHoles,
|
||||
via->GetStart(), hole_outer_radius,
|
||||
aSegCountPerCircle );
|
||||
}
|
||||
|
||||
// Build holes of through pads:
|
||||
for( MODULE* footprint = pcb->m_Modules; footprint; footprint = footprint->Next() )
|
||||
{
|
||||
for( D_PAD* pad = footprint->Pads(); pad; pad = pad->Next() )
|
||||
{
|
||||
// Calculate a factor to apply to segcount for large holes ( > 1 mm)
|
||||
// (bigger pad drill size -> more segments) because holes in pads can have
|
||||
// very different sizes and optimizing this segcount gives a better look
|
||||
// Mainly mounting holes have a size bigger than small_hole_limit
|
||||
wxSize padHole = pad->GetDrillSize();
|
||||
|
||||
if( ! padHole.x ) // Not drilled pad like SMD pad
|
||||
continue;
|
||||
|
||||
// we use the hole diameter to calculate the seg count.
|
||||
// for round holes, padHole.x == padHole.y
|
||||
// for oblong holes, the diameter is the smaller of (padHole.x, padHole.y)
|
||||
int diam = std::min( padHole.x, padHole.y );
|
||||
int segcount = aSegCountPerCircle;
|
||||
|
||||
if( diam > small_hole_limit )
|
||||
{
|
||||
double segFactor = (double)diam / small_hole_limit;
|
||||
segcount = (int)(aSegCountPerCircle * segFactor);
|
||||
|
||||
// limit segcount to 48. For a circle this is a very good approx.
|
||||
if( segcount > 48 )
|
||||
segcount = 48;
|
||||
}
|
||||
|
||||
// The hole in the body is inflated by copper thickness.
|
||||
int inflate = copper_thickness;
|
||||
|
||||
// If not plated, no copper.
|
||||
if( pad->GetAttribute () == PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||
inflate = 0;
|
||||
|
||||
pad->BuildPadDrillShapePolygon( allBoardHoles, inflate, segcount );
|
||||
}
|
||||
}
|
||||
|
||||
allBoardHoles.Simplify( useFastModeForPolygons );
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::buildBoard3DView( GLuint aBoardList, GLuint aBodyOnlyList,
|
||||
REPORTER* aErrorMessages, REPORTER* aActivity )
|
||||
{
|
||||
BOARD* pcb = GetBoard();
|
||||
|
||||
// If FL_RENDER_SHOW_HOLES_IN_ZONES is true, holes are correctly removed from copper zones areas.
|
||||
// If FL_RENDER_SHOW_HOLES_IN_ZONES is false, holes are not removed from copper zones areas,
|
||||
// but the calculation time is twice shorter.
|
||||
bool remove_Holes = isEnabled( FL_RENDER_SHOW_HOLES_IN_ZONES );
|
||||
|
||||
bool realistic_mode = isRealisticMode();
|
||||
bool useTextures = isRealisticMode() && isEnabled( FL_RENDER_TEXTURES );
|
||||
|
||||
// Number of segments to convert a circle to polygon
|
||||
// We use 2 values: the first gives a good shape (for instanes rond pads)
|
||||
// the second is used to speed up calculations, when a poor approximation is acceptable (holes)
|
||||
const int segcountforcircle = 18;
|
||||
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2.0) );
|
||||
const int segcountLowQuality = 12; // segments to draw a circle with low quality
|
||||
// to reduce time calculations
|
||||
// for holes and items which do not need
|
||||
// a fine representation
|
||||
double correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2.0) );
|
||||
|
||||
SHAPE_POLY_SET bufferPolys; // copper areas: tracks, pads and filled zones areas
|
||||
// when holes are removed from zones
|
||||
SHAPE_POLY_SET bufferPcbOutlines; // stores the board main outlines
|
||||
SHAPE_POLY_SET bufferZonesPolys; // copper filled zones areas
|
||||
// when holes are not removed from zones
|
||||
SHAPE_POLY_SET currLayerHoles; // Contains holes for the current layer
|
||||
SHAPE_POLY_SET allLayerHoles; // Contains holes for all layers
|
||||
|
||||
// Build a polygon from edge cut items
|
||||
wxString msg;
|
||||
|
||||
if( !pcb->GetBoardPolygonOutlines( bufferPcbOutlines, allLayerHoles, &msg ) )
|
||||
{
|
||||
if( aErrorMessages )
|
||||
{
|
||||
msg << wxT("\n") << _("Unable to calculate the board outlines.\n"
|
||||
"Therefore use the board boundary box.") << wxT("\n\n");
|
||||
|
||||
aErrorMessages->Report( msg, REPORTER::RPT_WARNING );
|
||||
}
|
||||
}
|
||||
|
||||
// Build board holes, with optimization of large holes shape.
|
||||
buildBoardThroughHolesPolygonList( allLayerHoles, segcountLowQuality, true );
|
||||
|
||||
LSET cu_set = LSET::AllCuMask( GetPrm3DVisu().m_CopperLayersCount );
|
||||
|
||||
glNewList( aBoardList, GL_COMPILE );
|
||||
|
||||
for( LSEQ cu = cu_set.CuStack(); cu; ++cu )
|
||||
{
|
||||
LAYER_ID layer = *cu;
|
||||
|
||||
// Skip non enabled layers in normal mode,
|
||||
// and internal layers in realistic mode
|
||||
if( !is3DLayerEnabled( layer ) )
|
||||
continue;
|
||||
|
||||
if( aActivity )
|
||||
aActivity->Report( wxString::Format( _( "Build layer %s" ), LSET::Name( layer ) ) );
|
||||
|
||||
bufferPolys.RemoveAllContours();
|
||||
bufferZonesPolys.RemoveAllContours();
|
||||
currLayerHoles.RemoveAllContours();
|
||||
|
||||
// Draw track shapes:
|
||||
for( TRACK* track = pcb->m_Track; track; track = track->Next() )
|
||||
{
|
||||
if( !track->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
track->TransformShapeWithClearanceToPolygon( bufferPolys,
|
||||
0, segcountforcircle,
|
||||
correctionFactor );
|
||||
|
||||
// Add blind/buried via holes
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
{
|
||||
VIA *via = static_cast<VIA*>( track );
|
||||
|
||||
if( via->GetViaType() == VIA_THROUGH )
|
||||
continue; // already done
|
||||
|
||||
int holediameter = via->GetDrillValue();
|
||||
int thickness = GetPrm3DVisu().GetCopperThicknessBIU();
|
||||
int hole_outer_radius = (holediameter + thickness) / 2;
|
||||
|
||||
TransformCircleToPolygon( currLayerHoles,
|
||||
via->GetStart(), hole_outer_radius,
|
||||
segcountLowQuality );
|
||||
}
|
||||
}
|
||||
|
||||
// draw pad shapes
|
||||
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
// Note: NPTH pads are not drawn on copper layers when the pad
|
||||
// has same shape as its hole
|
||||
module->TransformPadsShapesWithClearanceToPolygon( layer,
|
||||
bufferPolys,
|
||||
0,
|
||||
segcountforcircle,
|
||||
correctionFactor, true );
|
||||
|
||||
// Micro-wave modules may have items on copper layers
|
||||
module->TransformGraphicShapesWithClearanceToPolygonSet( layer,
|
||||
bufferPolys,
|
||||
0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
|
||||
// pad holes are already in list.
|
||||
}
|
||||
|
||||
// Draw copper zones. Note:
|
||||
// * if the holes are removed from copper zones
|
||||
// the polygons are stored in bufferPolys (which contains all other polygons)
|
||||
// * if the holes are NOT removed from copper zones
|
||||
// the polygons are stored in bufferZonesPolys
|
||||
if( isEnabled( FL_ZONE ) )
|
||||
{
|
||||
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
ZONE_CONTAINER* zone = pcb->GetArea( ii );
|
||||
LAYER_NUM zonelayer = zone->GetLayer();
|
||||
|
||||
if( zonelayer == layer )
|
||||
{
|
||||
zone->TransformSolidAreasShapesToPolygonSet(
|
||||
remove_Holes ? bufferPolys : bufferZonesPolys,
|
||||
segcountLowQuality, correctionFactorLQ );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// draw graphic items on copper layers (texts)
|
||||
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
if( !item->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_LINE_T: // should not exist on copper layers
|
||||
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet(
|
||||
bufferPolys, 0, segcountLowQuality, correctionFactor );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// bufferPolys contains polygons to merge. Many overlaps .
|
||||
// Calculate merged polygons
|
||||
if( bufferPolys.IsEmpty() )
|
||||
continue;
|
||||
|
||||
// Use Clipper lib to subtract holes to copper areas
|
||||
if( currLayerHoles.OutlineCount() )
|
||||
{
|
||||
currLayerHoles.Append(allLayerHoles);
|
||||
currLayerHoles.Simplify( useFastModeForPolygons );
|
||||
bufferPolys.BooleanSubtract( currLayerHoles, useFastModeForPolygons );
|
||||
}
|
||||
else
|
||||
bufferPolys.BooleanSubtract( allLayerHoles, useFastModeForPolygons );
|
||||
|
||||
int thickness = GetPrm3DVisu().GetLayerObjectThicknessBIU( layer );
|
||||
int zpos = GetPrm3DVisu().GetLayerZcoordBIU( layer );
|
||||
|
||||
float zNormal = 1.0f; // When using thickness it will draw first the top and then botton (with z inverted)
|
||||
|
||||
// If we are not using thickness, then the z-normal has to match the layer direction
|
||||
// because just one plane will be drawn
|
||||
if( !thickness )
|
||||
zNormal = Get3DLayer_Z_Orientation( layer );
|
||||
|
||||
if( realistic_mode )
|
||||
{
|
||||
setGLCopperColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer );
|
||||
SetGLColor( color );
|
||||
}
|
||||
|
||||
// If holes are removed from copper zones, bufferPolys contains all polygons
|
||||
// to draw (tracks+zones+texts).
|
||||
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos, thickness,
|
||||
GetPrm3DVisu().m_BiuTo3Dunits, useTextures,
|
||||
zNormal );
|
||||
|
||||
// If holes are not removed from copper zones (for calculation time reasons,
|
||||
// the zone polygons are stored in bufferZonesPolys and have to be drawn now:
|
||||
if( !bufferZonesPolys.IsEmpty() )
|
||||
{
|
||||
Draw3D_SolidHorizontalPolyPolygons( bufferZonesPolys, zpos, thickness,
|
||||
GetPrm3DVisu().m_BiuTo3Dunits, useTextures,
|
||||
zNormal );
|
||||
}
|
||||
}
|
||||
|
||||
if( aActivity )
|
||||
aActivity->Report( _( "Build board body" ) );
|
||||
|
||||
// Draw plated vertical holes inside the board, but not always. They are drawn:
|
||||
// - if the board body is not shown, to show the holes.
|
||||
// - or if the copper thickness is shown
|
||||
if( !isEnabled( FL_SHOW_BOARD_BODY ) || isEnabled( FL_USE_COPPER_THICKNESS ) )
|
||||
{
|
||||
// Draw vias holes (vertical cylinders)
|
||||
for( const TRACK* track = pcb->m_Track; track; track = track->Next() )
|
||||
{
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
{
|
||||
const VIA *via = static_cast<const VIA*>(track);
|
||||
draw3DViaHole( via );
|
||||
}
|
||||
}
|
||||
|
||||
// Draw pads holes (vertical cylinders)
|
||||
for( const MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
|
||||
if( pad->GetAttribute () != PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||
draw3DPadHole( pad );
|
||||
}
|
||||
}
|
||||
|
||||
glEndList();
|
||||
|
||||
// Build the body board:
|
||||
glNewList( aBodyOnlyList, GL_COMPILE );
|
||||
|
||||
if( isRealisticMode() )
|
||||
{
|
||||
setGLEpoxyColor( 1.00 );
|
||||
}
|
||||
else
|
||||
{
|
||||
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( Edge_Cuts );
|
||||
SetGLColor( color, 0.7 );
|
||||
}
|
||||
|
||||
float copper_thickness = GetPrm3DVisu().GetCopperThicknessBIU();
|
||||
|
||||
// a small offset between substrate and external copper layer to avoid artifacts
|
||||
// when drawing copper items on board
|
||||
float epsilon = Millimeter2iu( 0.01 );
|
||||
float zpos = GetPrm3DVisu().GetLayerZcoordBIU( B_Cu );
|
||||
float board_thickness = GetPrm3DVisu().GetLayerZcoordBIU( F_Cu )
|
||||
- GetPrm3DVisu().GetLayerZcoordBIU( B_Cu );
|
||||
|
||||
// items on copper layers and having a thickness = copper_thickness
|
||||
// are drawn from zpos - copper_thickness/2 to zpos + copper_thickness
|
||||
// therefore substrate position is copper_thickness/2 to
|
||||
// substrate_height - copper_thickness/2
|
||||
zpos += (copper_thickness + epsilon) / 2.0f;
|
||||
board_thickness -= copper_thickness + epsilon;
|
||||
|
||||
bufferPcbOutlines.BooleanSubtract( allLayerHoles, useFastModeForPolygons );
|
||||
|
||||
if( !bufferPcbOutlines.IsEmpty() )
|
||||
{
|
||||
Draw3D_SolidHorizontalPolyPolygons( bufferPcbOutlines, zpos + board_thickness / 2.0,
|
||||
board_thickness, GetPrm3DVisu().m_BiuTo3Dunits, useTextures,
|
||||
1.0f );
|
||||
}
|
||||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::buildTechLayers3DView( REPORTER* aErrorMessages, REPORTER* aActivity )
|
||||
{
|
||||
BOARD* pcb = GetBoard();
|
||||
bool useTextures = isRealisticMode() && isEnabled( FL_RENDER_TEXTURES );
|
||||
|
||||
// Number of segments to draw a circle using segments
|
||||
const int segcountforcircle = 18;
|
||||
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
|
||||
const int segcountLowQuality = 12; // segments to draw a circle with low quality
|
||||
// to reduce time calculations
|
||||
// for holes and items which do not need
|
||||
// a fine representation
|
||||
|
||||
double correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2) );
|
||||
|
||||
// segments to draw a circle to build texts. Is is used only to build
|
||||
// the shape of each segment of the stroke font, therefore no need to have
|
||||
// many segments per circle.
|
||||
const int segcountInStrokeFont = 8;
|
||||
|
||||
SHAPE_POLY_SET bufferPolys;
|
||||
SHAPE_POLY_SET allLayerHoles; // Contains through holes, calculated only once
|
||||
SHAPE_POLY_SET bufferPcbOutlines; // stores the board main outlines
|
||||
|
||||
// Build a polygon from edge cut items
|
||||
wxString msg;
|
||||
|
||||
if( !pcb->GetBoardPolygonOutlines( bufferPcbOutlines, allLayerHoles, &msg ) )
|
||||
{
|
||||
if( aErrorMessages )
|
||||
{
|
||||
msg << wxT("\n") <<
|
||||
_("Unable to calculate the board outlines.\n"
|
||||
"Therefore use the board boundary box.") << wxT("\n\n");
|
||||
aErrorMessages->Report( msg, REPORTER::RPT_WARNING );
|
||||
}
|
||||
}
|
||||
|
||||
// Build board holes, with no optimization of large holes shape.
|
||||
buildBoardThroughHolesPolygonList( allLayerHoles, segcountLowQuality, false );
|
||||
|
||||
// draw graphic items, on technical layers
|
||||
|
||||
static const LAYER_ID teckLayerList[] = {
|
||||
B_Adhes,
|
||||
F_Adhes,
|
||||
B_Paste,
|
||||
F_Paste,
|
||||
B_SilkS,
|
||||
F_SilkS,
|
||||
B_Mask,
|
||||
F_Mask,
|
||||
};
|
||||
|
||||
// User layers are not drawn here, only technical layers
|
||||
for( LSEQ seq = LSET::AllTechMask().Seq( teckLayerList, DIM( teckLayerList ) ); seq; ++seq )
|
||||
{
|
||||
LAYER_ID layer = *seq;
|
||||
|
||||
if( !is3DLayerEnabled( layer ) )
|
||||
continue;
|
||||
|
||||
if( layer == Edge_Cuts && isEnabled( FL_SHOW_BOARD_BODY ) )
|
||||
continue;
|
||||
|
||||
if( aActivity )
|
||||
aActivity->Report( wxString::Format( _( "Build layer %s" ), LSET::Name( layer ) ) );
|
||||
|
||||
bufferPolys.RemoveAllContours();
|
||||
|
||||
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
if( !item->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_LINE_T:
|
||||
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet(
|
||||
bufferPolys, 0, segcountLowQuality, 1.0 );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
if( layer == F_SilkS || layer == B_SilkS )
|
||||
{
|
||||
// On silk screen layers, the pad shape is only the pad outline
|
||||
// never a filled shape
|
||||
D_PAD* pad = module->Pads();
|
||||
int linewidth = g_DrawDefaultLineThickness;
|
||||
|
||||
for( ; pad; pad = pad->Next() )
|
||||
{
|
||||
if( !pad->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
buildPadShapeThickOutlineAsPolygon( pad, bufferPolys,
|
||||
linewidth, segcountforcircle, correctionFactor );
|
||||
}
|
||||
}
|
||||
else
|
||||
module->TransformPadsShapesWithClearanceToPolygon( layer,
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
|
||||
// On tech layers, use a poor circle approximation, only for texts (stroke font)
|
||||
module->TransformGraphicShapesWithClearanceToPolygonSet( layer,
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor, segcountInStrokeFont );
|
||||
}
|
||||
|
||||
// Draw non copper zones
|
||||
if( isEnabled( FL_ZONE ) )
|
||||
{
|
||||
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
ZONE_CONTAINER* zone = pcb->GetArea( ii );
|
||||
|
||||
if( !zone->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
zone->TransformSolidAreasShapesToPolygonSet(
|
||||
bufferPolys, segcountLowQuality, correctionFactorLQ );
|
||||
}
|
||||
}
|
||||
|
||||
// bufferPolys contains polygons to merge. Many overlaps .
|
||||
// Calculate merged polygons and remove pads and vias holes
|
||||
if( layer != B_Mask && layer != F_Mask && bufferPolys.IsEmpty() )
|
||||
// if a layer has no iten to draw, skip it
|
||||
// However solder mask layers are negative layers, so no item
|
||||
// means only a full layer mask
|
||||
continue;
|
||||
|
||||
// Solder mask layers are "negative" layers.
|
||||
// Shapes should be removed from the full board area.
|
||||
if( layer == B_Mask || layer == F_Mask )
|
||||
{
|
||||
SHAPE_POLY_SET cuts = bufferPolys;
|
||||
bufferPolys = bufferPcbOutlines;
|
||||
|
||||
cuts.Append(allLayerHoles);
|
||||
cuts.Simplify( useFastModeForPolygons );
|
||||
|
||||
bufferPolys.BooleanSubtract( cuts, useFastModeForPolygons );
|
||||
}
|
||||
// Remove holes from Solder paste layers and silkscreen
|
||||
else if( layer == B_Paste || layer == F_Paste
|
||||
|| layer == B_SilkS || layer == F_SilkS )
|
||||
{
|
||||
bufferPolys.BooleanSubtract( allLayerHoles, useFastModeForPolygons );
|
||||
}
|
||||
|
||||
int thickness = 0;
|
||||
|
||||
if( layer != B_Mask && layer != F_Mask )
|
||||
thickness = GetPrm3DVisu().GetLayerObjectThicknessBIU( layer );
|
||||
|
||||
int zpos = GetPrm3DVisu().GetLayerZcoordBIU( layer );
|
||||
|
||||
if( layer == Edge_Cuts )
|
||||
{
|
||||
thickness = GetPrm3DVisu().GetLayerZcoordBIU( F_Cu )
|
||||
- GetPrm3DVisu().GetLayerZcoordBIU( B_Cu );
|
||||
zpos = GetPrm3DVisu().GetLayerZcoordBIU( B_Cu )
|
||||
+ (thickness / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// for Draw3D_SolidHorizontalPolyPolygons, zpos it the middle between bottom and top
|
||||
// sides.
|
||||
// However for top layers, zpos should be the bottom layer pos,
|
||||
// and for bottom layers, zpos should be the top layer pos.
|
||||
if( Get3DLayer_Z_Orientation( layer ) > 0 )
|
||||
zpos += thickness/2;
|
||||
else
|
||||
zpos -= thickness/2 ;
|
||||
}
|
||||
|
||||
|
||||
float zNormal = 1.0f; // When using thickness it will draw first the top and then botton (with z inverted)
|
||||
|
||||
// If we are not using thickness, then the znormal must face the layer direction
|
||||
// because it will draw just one plane
|
||||
if( !thickness )
|
||||
zNormal = Get3DLayer_Z_Orientation( layer );
|
||||
|
||||
|
||||
setGLTechLayersColor( layer );
|
||||
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
||||
thickness, GetPrm3DVisu().m_BiuTo3Dunits, useTextures,
|
||||
zNormal );
|
||||
}
|
||||
}
|
||||
@@ -1,493 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file 3d_draw_helper_functions.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
|
||||
#include <PolyLine.h>
|
||||
#include <colors.h>
|
||||
#include <colors_selection.h>
|
||||
#include <class_pad.h>
|
||||
#include <class_track.h>
|
||||
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
|
||||
#include <3d_viewer.h>
|
||||
#include <3d_canvas.h>
|
||||
#include <info3d_visu.h>
|
||||
#include <3d_draw_basic_functions.h>
|
||||
|
||||
#define TEXTURE_PCB_SCALE 5.0
|
||||
|
||||
// -----------------
|
||||
// helper function (from wxWidgets, opengl/cube.cpp sample
|
||||
// -----------------
|
||||
void CheckGLError(const char *aFileName, int aLineNumber)
|
||||
{
|
||||
GLenum errLast = GL_NO_ERROR;
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
GLenum err = glGetError();
|
||||
if ( err == GL_NO_ERROR )
|
||||
return;
|
||||
|
||||
// normally the error is reset by the call to glGetError() but if
|
||||
// glGetError() itself returns an error, we risk looping forever here
|
||||
// so check that we get a different error than the last time
|
||||
if ( err == errLast )
|
||||
{
|
||||
wxLogError(wxT("OpenGL error state couldn't be reset."));
|
||||
return;
|
||||
}
|
||||
|
||||
errLast = err;
|
||||
|
||||
wxLogError( wxT( "OpenGL error %d At: %s, line: %d" ), err,
|
||||
GetChars( FROM_UTF8( aFileName ) ), aLineNumber );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
INFO3D_VISU& EDA_3D_CANVAS::GetPrm3DVisu() const
|
||||
{
|
||||
return Parent()->GetPrm3DVisu();
|
||||
}
|
||||
|
||||
wxSize EDA_3D_CANVAS::getBoardSize() const
|
||||
{
|
||||
// return the size of the board in pcb units
|
||||
return GetPrm3DVisu().m_BoardSize;
|
||||
}
|
||||
|
||||
|
||||
wxPoint EDA_3D_CANVAS::getBoardCenter() const
|
||||
{
|
||||
// return the position of the board center in pcb units
|
||||
return GetPrm3DVisu().m_BoardPos;
|
||||
}
|
||||
|
||||
// return true if we are in realistic mode render
|
||||
bool EDA_3D_CANVAS::isRealisticMode() const
|
||||
{
|
||||
return GetPrm3DVisu().IsRealisticMode();
|
||||
}
|
||||
|
||||
// return true if aItem should be displayed
|
||||
bool EDA_3D_CANVAS::isEnabled( DISPLAY3D_FLG aItem ) const
|
||||
{
|
||||
return GetPrm3DVisu().GetFlag( aItem );
|
||||
}
|
||||
|
||||
|
||||
// Helper function: initialize the copper color to draw the board
|
||||
// in realistic mode.
|
||||
void EDA_3D_CANVAS::setGLCopperColor()
|
||||
{
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
SetGLColor( GetPrm3DVisu().m_CopperColor, 1.0 );
|
||||
}
|
||||
|
||||
// Helper function: initialize the color to draw the epoxy
|
||||
// body board in realistic mode.
|
||||
void EDA_3D_CANVAS::setGLEpoxyColor( float aTransparency )
|
||||
{
|
||||
// Generates an epoxy color, near board color
|
||||
SetGLColor( GetPrm3DVisu().m_BoardBodyColor, aTransparency );
|
||||
|
||||
if( isEnabled( FL_RENDER_TEXTURES ) )
|
||||
{
|
||||
SetGLTexture( m_text_pcb, TEXTURE_PCB_SCALE );
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function: initialize the color to draw the
|
||||
// solder mask layers in realistic mode.
|
||||
void EDA_3D_CANVAS::setGLSolderMaskColor( float aTransparency )
|
||||
{
|
||||
// Generates a solder mask color
|
||||
SetGLColor( GetPrm3DVisu().m_SolderMaskColor, aTransparency );
|
||||
|
||||
if( isEnabled( FL_RENDER_TEXTURES ) )
|
||||
{
|
||||
SetGLTexture( m_text_pcb, TEXTURE_PCB_SCALE );
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function: initialize the color to draw the non copper layers
|
||||
// in realistic mode and normal mode.
|
||||
void EDA_3D_CANVAS::setGLTechLayersColor( LAYER_NUM aLayer )
|
||||
{
|
||||
EDA_COLOR_T color;
|
||||
|
||||
if( isRealisticMode() )
|
||||
{
|
||||
switch( aLayer )
|
||||
{
|
||||
case B_Paste:
|
||||
case F_Paste:
|
||||
SetGLColor( GetPrm3DVisu().m_SolderPasteColor, 1 );
|
||||
break;
|
||||
|
||||
case B_SilkS:
|
||||
case F_SilkS:
|
||||
SetGLColor( GetPrm3DVisu().m_SilkScreenColor, 0.96 );
|
||||
|
||||
if( isEnabled( FL_RENDER_TEXTURES ) )
|
||||
{
|
||||
SetGLTexture( m_text_silk, 10.0f );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case B_Mask:
|
||||
case F_Mask:
|
||||
setGLSolderMaskColor( 0.90 );
|
||||
break;
|
||||
|
||||
default:
|
||||
color = g_ColorsSettings.GetLayerColor( aLayer );
|
||||
SetGLColor( color, 0.7 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
color = g_ColorsSettings.GetLayerColor( aLayer );
|
||||
SetGLColor( color, 0.7 );
|
||||
}
|
||||
}
|
||||
|
||||
void EDA_3D_CANVAS::draw3DAxis()
|
||||
{
|
||||
if( ! m_glLists[GL_ID_AXIS] )
|
||||
{
|
||||
m_glLists[GL_ID_AXIS] = glGenLists( 1 );
|
||||
glNewList( m_glLists[GL_ID_AXIS], GL_COMPILE );
|
||||
|
||||
glEnable( GL_COLOR_MATERIAL );
|
||||
glBegin( GL_LINES );
|
||||
SetGLColor( RED );
|
||||
glNormal3f( 0.0f, 0.0f, 1.0f ); // Normal is Z axis
|
||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||
glVertex3f( -10.0f, 0.0f, 0.0f );
|
||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||
glVertex3f( 10.0f, 0.0f, 0.0f ); // X axis
|
||||
SetGLColor( GREEN );
|
||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||
glVertex3f( 0.0f, -10.0f, 0.0f ); // Y axis
|
||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||
glVertex3f( 0.0f, 10.0f, 0.0f );
|
||||
SetGLColor( BLUE );
|
||||
glNormal3f( 1.0f, 0.0f, 0.0f ); // Normal is Y axis
|
||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||
glVertex3f( 0.0f, 0.0f, -10.0f );
|
||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||
glVertex3f( 0.0f, 0.0f, 10.0f ); // Z axis
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
}
|
||||
}
|
||||
|
||||
// draw a 3D grid: an horizontal grid (XY plane and Z = 0,
|
||||
// and a vertical grid (XZ plane and Y = 0)
|
||||
void EDA_3D_CANVAS::draw3DGrid( double aGriSizeMM )
|
||||
{
|
||||
double zpos = 0.0;
|
||||
EDA_COLOR_T gridcolor = DARKGRAY; // Color of grid lines
|
||||
EDA_COLOR_T gridcolor_marker = LIGHTGRAY; // Color of grid lines every 5 lines
|
||||
const double scale = GetPrm3DVisu().m_BiuTo3Dunits;
|
||||
const double transparency = 0.3;
|
||||
|
||||
glNormal3f( 0.0, 0.0, 1.0 );
|
||||
|
||||
wxSize brd_size = getBoardSize();
|
||||
wxPoint brd_center_pos = getBoardCenter();
|
||||
brd_center_pos.y = -brd_center_pos.y;
|
||||
|
||||
int xsize = std::max( brd_size.x, Millimeter2iu( 100 ) ) * 1.2;
|
||||
int ysize = std::max( brd_size.y, Millimeter2iu( 100 ) ) * 1.2;
|
||||
|
||||
// Grid limits, in 3D units
|
||||
double xmin = (brd_center_pos.x - xsize / 2) * scale;
|
||||
double xmax = (brd_center_pos.x + xsize / 2) * scale;
|
||||
double ymin = (brd_center_pos.y - ysize / 2) * scale;
|
||||
double ymax = (brd_center_pos.y + ysize / 2) * scale;
|
||||
double zmin = Millimeter2iu( -50 ) * scale;
|
||||
double zmax = Millimeter2iu( 100 ) * scale;
|
||||
|
||||
// Draw horizontal grid centered on 3D origin (center of the board)
|
||||
for( int ii = 0; ; ii++ )
|
||||
{
|
||||
if( (ii % 5) )
|
||||
SetGLColor( gridcolor, transparency );
|
||||
else
|
||||
SetGLColor( gridcolor_marker, transparency );
|
||||
|
||||
int delta = KiROUND( ii * aGriSizeMM * IU_PER_MM );
|
||||
|
||||
if( delta <= xsize / 2 ) // Draw grid lines parallel to X axis
|
||||
{
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( (brd_center_pos.x + delta) * scale, -ymin, zpos );
|
||||
glVertex3f( (brd_center_pos.x + delta) * scale, -ymax, zpos );
|
||||
glEnd();
|
||||
|
||||
if( ii != 0 )
|
||||
{
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( (brd_center_pos.x - delta) * scale, -ymin, zpos );
|
||||
glVertex3f( (brd_center_pos.x - delta) * scale, -ymax, zpos );
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
if( delta <= ysize / 2 ) // Draw grid lines parallel to Y axis
|
||||
{
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( xmin, -(brd_center_pos.y + delta) * scale, zpos );
|
||||
glVertex3f( xmax, -(brd_center_pos.y + delta) * scale, zpos );
|
||||
glEnd();
|
||||
|
||||
if( ii != 0 )
|
||||
{
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( xmin, -(brd_center_pos.y - delta) * scale, zpos );
|
||||
glVertex3f( xmax, -(brd_center_pos.y - delta) * scale, zpos );
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
if( ( delta > ysize / 2 ) && ( delta > xsize / 2 ) )
|
||||
break;
|
||||
}
|
||||
|
||||
// Draw vertical grid on Z axis
|
||||
glNormal3f( 0.0, -1.0, 0.0 );
|
||||
|
||||
// Draw vertical grid lines (parallel to Z axis)
|
||||
double posy = -brd_center_pos.y * scale;
|
||||
|
||||
for( int ii = 0; ; ii++ )
|
||||
{
|
||||
if( (ii % 5) )
|
||||
SetGLColor( gridcolor, transparency );
|
||||
else
|
||||
SetGLColor( gridcolor_marker, transparency );
|
||||
|
||||
double delta = ii * aGriSizeMM * IU_PER_MM;
|
||||
|
||||
glBegin( GL_LINES );
|
||||
xmax = (brd_center_pos.x + delta) * scale;
|
||||
|
||||
glVertex3f( xmax, posy, zmin );
|
||||
glVertex3f( xmax, posy, zmax );
|
||||
glEnd();
|
||||
|
||||
if( ii != 0 )
|
||||
{
|
||||
glBegin( GL_LINES );
|
||||
xmin = (brd_center_pos.x - delta) * scale;
|
||||
glVertex3f( xmin, posy, zmin );
|
||||
glVertex3f( xmin, posy, zmax );
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if( delta > xsize / 2.0f )
|
||||
break;
|
||||
}
|
||||
|
||||
// Draw horizontal grid lines on Z axis (parallel to X axis)
|
||||
for( int ii = 0; ; ii++ )
|
||||
{
|
||||
if( (ii % 5) )
|
||||
SetGLColor( gridcolor, transparency);
|
||||
else
|
||||
SetGLColor( gridcolor_marker, transparency );
|
||||
|
||||
double delta = ii * aGriSizeMM * IU_PER_MM * scale;
|
||||
|
||||
if( delta <= zmax )
|
||||
{
|
||||
// Draw grid lines on Z axis (positive Z axis coordinates)
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( xmin, posy, delta );
|
||||
glVertex3f( xmax, posy, delta );
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if( delta <= -zmin && ( ii != 0 ) )
|
||||
{
|
||||
// Draw grid lines on Z axis (negative Z axis coordinates)
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( xmin, posy, -delta );
|
||||
glVertex3f( xmax, posy, -delta );
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if( ( delta > zmax ) && ( delta > -zmin ) )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Draw 3D pads.
|
||||
void EDA_3D_CANVAS::draw3DPadHole( const D_PAD* aPad )
|
||||
{
|
||||
// Draw the pad hole
|
||||
wxSize drillsize = aPad->GetDrillSize();
|
||||
bool hasHole = drillsize.x && drillsize.y;
|
||||
|
||||
if( !hasHole )
|
||||
return;
|
||||
|
||||
// Store here the points to approximate hole by segments
|
||||
SHAPE_POLY_SET holecornersBuffer;
|
||||
int thickness = GetPrm3DVisu().GetCopperThicknessBIU();
|
||||
int height = GetPrm3DVisu().GetLayerZcoordBIU( F_Cu ) -
|
||||
GetPrm3DVisu().GetLayerZcoordBIU( B_Cu );
|
||||
|
||||
if( isRealisticMode() )
|
||||
setGLCopperColor();
|
||||
else
|
||||
SetGLColor( DARKGRAY );
|
||||
|
||||
int holeZpoz = GetPrm3DVisu().GetLayerZcoordBIU( B_Cu ) - thickness / 2;
|
||||
int holeHeight = height + thickness;
|
||||
|
||||
if( drillsize.x == drillsize.y ) // usual round hole
|
||||
{
|
||||
int hole_radius = ( drillsize.x + thickness ) / 2;
|
||||
Draw3D_ZaxisCylinder( aPad->GetPosition(),
|
||||
hole_radius, holeHeight,
|
||||
thickness, holeZpoz, GetPrm3DVisu().m_BiuTo3Dunits );
|
||||
}
|
||||
else // Oblong hole
|
||||
{
|
||||
wxPoint ends_offset;
|
||||
int width;
|
||||
|
||||
if( drillsize.x > drillsize.y ) // Horizontal oval
|
||||
{
|
||||
ends_offset.x = ( drillsize.x - drillsize.y ) / 2;
|
||||
width = drillsize.y;
|
||||
}
|
||||
else // Vertical oval
|
||||
{
|
||||
ends_offset.y = ( drillsize.y - drillsize.x ) / 2;
|
||||
width = drillsize.x;
|
||||
}
|
||||
|
||||
RotatePoint( &ends_offset, aPad->GetOrientation() );
|
||||
|
||||
wxPoint start = aPad->GetPosition() + ends_offset;
|
||||
wxPoint end = aPad->GetPosition() - ends_offset;
|
||||
int hole_radius = ( width + thickness ) / 2;
|
||||
|
||||
// Draw the hole
|
||||
Draw3D_ZaxisOblongCylinder( start, end, hole_radius, holeHeight,
|
||||
thickness, holeZpoz, GetPrm3DVisu().m_BiuTo3Dunits );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::draw3DViaHole( const VIA* aVia )
|
||||
{
|
||||
LAYER_ID top_layer, bottom_layer;
|
||||
int thickness = GetPrm3DVisu().GetCopperThicknessBIU();
|
||||
int inner_radius = (int)((float)aVia->GetDrillValue() * 1.01f) / 2.0f; // This add a bit more in order to correct a draw artifact while using tickness
|
||||
|
||||
aVia->LayerPair( &top_layer, &bottom_layer );
|
||||
|
||||
// Drawing via hole:
|
||||
if( isRealisticMode() )
|
||||
setGLCopperColor();
|
||||
else
|
||||
{
|
||||
EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + aVia->GetViaType() );
|
||||
SetGLColor( color );
|
||||
}
|
||||
|
||||
int height = GetPrm3DVisu().GetLayerZcoordBIU( top_layer ) -
|
||||
GetPrm3DVisu().GetLayerZcoordBIU( bottom_layer ) + thickness;
|
||||
int zpos = GetPrm3DVisu().GetLayerZcoordBIU( bottom_layer ) - thickness / 2;
|
||||
|
||||
Draw3D_ZaxisCylinder( aVia->GetStart(), inner_radius, height,
|
||||
thickness, zpos, GetPrm3DVisu().m_BiuTo3Dunits );
|
||||
}
|
||||
|
||||
/* Build a pad outline as non filled polygon, to draw pads on silkscreen layer
|
||||
* Used only to draw pads outlines on silkscreen layers.
|
||||
*/
|
||||
void EDA_3D_CANVAS::buildPadShapeThickOutlineAsPolygon( const D_PAD* aPad,
|
||||
SHAPE_POLY_SET& aCornerBuffer,
|
||||
int aWidth,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor )
|
||||
{
|
||||
if( aPad->GetShape() == PAD_SHAPE_CIRCLE ) // Draw a ring
|
||||
{
|
||||
TransformRingToPolygon( aCornerBuffer, aPad->ShapePos(),
|
||||
aPad->GetSize().x / 2, aCircleToSegmentsCount, aWidth );
|
||||
return;
|
||||
}
|
||||
|
||||
// For other shapes, draw polygon outlines
|
||||
SHAPE_POLY_SET corners;
|
||||
aPad->BuildPadShapePolygon( corners, wxSize( 0, 0 ),
|
||||
aCircleToSegmentsCount, aCorrectionFactor );
|
||||
|
||||
// Add outlines as thick segments in polygon buffer
|
||||
|
||||
const SHAPE_LINE_CHAIN& path = corners.COutline( 0 );
|
||||
|
||||
for( int ii = 0; ii < path.PointCount(); ii++ )
|
||||
{
|
||||
const VECTOR2I& a = path.CPoint( ii );
|
||||
const VECTOR2I& b = path.CPoint( ii + 1 );
|
||||
|
||||
TransformRoundedEndsSegmentToPolygon( aCornerBuffer,
|
||||
wxPoint( a.x, a.y ),
|
||||
wxPoint( b.x, b.y ),
|
||||
aCircleToSegmentsCount, aWidth );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer )
|
||||
{
|
||||
double nZ = 1.0;
|
||||
|
||||
if( ( aLayer == B_Cu )
|
||||
|| ( aLayer == B_Adhes )
|
||||
|| ( aLayer == B_Paste )
|
||||
|| ( aLayer == B_SilkS )
|
||||
|| ( aLayer == B_Mask ) )
|
||||
nZ = -1.0;
|
||||
|
||||
return nZ;
|
||||
}
|
||||
+152
-549
@@ -5,7 +5,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -26,9 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <kiface_i.h>
|
||||
#include <pgm_base.h>
|
||||
#include <macros.h>
|
||||
#include <appl_wxstruct.h>
|
||||
|
||||
#include <3d_viewer.h>
|
||||
#include <3d_canvas.h>
|
||||
@@ -42,57 +40,21 @@
|
||||
INFO3D_VISU g_Parm_3D_Visu;
|
||||
|
||||
// Key to store 3D Viewer config:
|
||||
static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
|
||||
static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
|
||||
static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
|
||||
|
||||
static const wxChar keyBgColor_Red_Top[] = wxT( "BgColor_Red_Top" );
|
||||
static const wxChar keyBgColor_Green_Top[] = wxT( "BgColor_Green_Top" );
|
||||
static const wxChar keyBgColor_Blue_Top[] = wxT( "BgColor_Blue_Top" );
|
||||
|
||||
static const wxChar keySMaskColor_Red[] = wxT( "SMaskColor_Red" );
|
||||
static const wxChar keySMaskColor_Green[] = wxT( "SMaskColor_Green" );
|
||||
static const wxChar keySMaskColor_Blue[] = wxT( "SMaskColor_Blue" );
|
||||
|
||||
static const wxChar keySPasteColor_Red[] = wxT( "SPasteColor_Red" );
|
||||
static const wxChar keySPasteColor_Green[] = wxT( "SPasteColor_Green" );
|
||||
static const wxChar keySPasteColor_Blue[] = wxT( "SPasteColor_Blue" );
|
||||
|
||||
static const wxChar keySilkColor_Red[] = wxT( "SilkColor_Red" );
|
||||
static const wxChar keySilkColor_Green[] = wxT( "SilkColor_Green" );
|
||||
static const wxChar keySilkColor_Blue[] = wxT( "SilkColor_Blue" );
|
||||
|
||||
static const wxChar keyCopperColor_Red[] = wxT( "CopperColor_Red" );
|
||||
static const wxChar keyCopperColor_Green[] = wxT( "CopperColor_Green" );
|
||||
static const wxChar keyCopperColor_Blue[] = wxT( "CopperColor_Blue" );
|
||||
|
||||
static const wxChar keyBoardBodyColor_Red[] = wxT( "BoardBodyColor_Red" );
|
||||
static const wxChar keyBoardBodyColor_Green[] = wxT( "BoardBodyColor_Green" );
|
||||
static const wxChar keyBoardBodyColor_Blue[]= wxT( "BoardBodyColor_Blue" );
|
||||
|
||||
static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
|
||||
static const wxChar keyRenderShadows[] = wxT( "Render_Shadows" );
|
||||
static const wxChar keyRenderRemoveHoles[] = wxT( "Render_RemoveHoles" );
|
||||
static const wxChar keyRenderTextures[] = wxT( "Render_Textures" );
|
||||
static const wxChar keyRenderSmoothNormals[] = wxT( "Render_Smooth_Normals" );
|
||||
static const wxChar keyRenderUseModelNormals[] =wxT( "Render_Use_Model_Normals" );
|
||||
static const wxChar keyRenderMaterial[] = wxT( "Render_Material" );
|
||||
static const wxChar keyRenderShowModelBBox[] = wxT( "Render_ShowModelBoudingBoxes" );
|
||||
|
||||
static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
|
||||
static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
|
||||
static const wxChar keyShowGridSize[] = wxT( "Grid3DSize" );
|
||||
static const wxChar keyShowZones[] = wxT( "ShowZones" );
|
||||
static const wxChar keyShowFootprints[] = wxT( "ShowFootprints" );
|
||||
static const wxChar keyShowCopperThickness[] = wxT( "ShowCopperThickness" );
|
||||
static const wxChar keyShowAdhesiveLayers[] = wxT( "ShowAdhesiveLayers" );
|
||||
static const wxChar keyShowSilkScreenLayers[] = wxT( "ShowSilkScreenLayers" );
|
||||
static const wxChar keyShowSolderMaskLayers[] = wxT( "ShowSolderMasLayers" );
|
||||
static const wxChar keyShowSolderPasteLayers[] =wxT( "ShowSolderPasteLayers" );
|
||||
static const wxChar keyShowCommentsLayer[] = wxT( "ShowCommentsLayers" );
|
||||
static const wxChar keyShowBoardBody[] = wxT( "ShowBoardBody" );
|
||||
static const wxChar keyShowEcoLayers[] = wxT( "ShowEcoLayers" );
|
||||
|
||||
static const wxString keyBgColor_Red( wxT( "BgColor_Red" ) );
|
||||
static const wxString keyBgColor_Green( wxT( "BgColor_Green" ) );
|
||||
static const wxString keyBgColor_Blue( wxT( "BgColor_Blue" ) );
|
||||
static const wxString keyShowRealisticMode( wxT( "ShowRealisticMode" ) );
|
||||
static const wxString keyShowAxis( wxT( "ShowAxis" ) );
|
||||
static const wxString keyShowZones( wxT( "ShowZones" ) );
|
||||
static const wxString keyShowFootprints( wxT( "ShowFootprints" ) );
|
||||
static const wxString keyShowCopperThickness( wxT( "ShowCopperThickness" ) );
|
||||
static const wxString keyShowAdhesiveLayers( wxT( "ShowAdhesiveLayers" ) );
|
||||
static const wxString keyShowSilkScreenLayers( wxT( "ShowSilkScreenLayers" ) );
|
||||
static const wxString keyShowSolderMaskLayers( wxT( "ShowSolderMasLayers" ) );
|
||||
static const wxString keyShowSolderPasteLayers( wxT( "ShowSolderPasteLayers" ) );
|
||||
static const wxString keyShowCommentsLayer( wxT( "ShowCommentsLayers" ) );
|
||||
static const wxString keyShowBoardBody( wxT( "ShowBoardBody" ) );
|
||||
static const wxString keyShowEcoLayers( wxT( "ShowEcoLayers" ) );
|
||||
|
||||
BEGIN_EVENT_TABLE( EDA_3D_FRAME, EDA_BASE_FRAME )
|
||||
EVT_ACTIVATE( EDA_3D_FRAME::OnActivate )
|
||||
@@ -110,13 +72,11 @@ EVT_MENU_RANGE( ID_MENU3D_GRID, ID_MENU3D_GRID_END,
|
||||
|
||||
EVT_CLOSE( EDA_3D_FRAME::OnCloseWindow )
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
|
||||
const wxString& aTitle, long style ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle,
|
||||
wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
|
||||
END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
|
||||
const wxString& title,
|
||||
long style ) :
|
||||
EDA_BASE_FRAME( parent, DISPLAY3D_FRAME_TYPE, title,
|
||||
wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
|
||||
{
|
||||
m_canvas = NULL;
|
||||
m_reloadRequest = false;
|
||||
@@ -127,78 +87,20 @@ EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
|
||||
icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
|
||||
SetIcon( icon );
|
||||
|
||||
LoadSettings( config() );
|
||||
GetSettings();
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
// Create the status line
|
||||
static const int status_dims[4] = { -1, 130, 130, 170 };
|
||||
static const int dims[5] = { -1, 100, 100, 100, 140 };
|
||||
|
||||
CreateStatusBar( DIM( status_dims ) );
|
||||
SetStatusWidths( DIM( status_dims ), status_dims );
|
||||
CreateStatusBar( 5 );
|
||||
SetStatusWidths( 5, dims );
|
||||
|
||||
CreateMenuBar();
|
||||
ReCreateMainToolbar();
|
||||
|
||||
// Make a EDA_3D_CANVAS
|
||||
// Note: We try to use anti aliasing if the graphic card allows that,
|
||||
// but only on wxWidgets >= 3.0.0 (this option does not exist on wxWidgets 2.8)
|
||||
int attrs[] = { // This array should be 2*n+1
|
||||
// Sadly wxwidgets / glx < 13 allowed
|
||||
// a thing named "boolean attributes" that don't take a value.
|
||||
// (See src/unix/glx11.cpp -> wxGLCanvasX11::ConvertWXAttrsToGL() ).
|
||||
// To avoid problems due to this, just specify those attributes twice.
|
||||
// Only WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_STEREO are such boolean
|
||||
// attributes.
|
||||
|
||||
// Boolean attributes (using itself at padding):
|
||||
WX_GL_RGBA, WX_GL_RGBA,
|
||||
WX_GL_DOUBLEBUFFER, WX_GL_DOUBLEBUFFER,
|
||||
|
||||
// Normal attributes with values:
|
||||
WX_GL_DEPTH_SIZE, 16,
|
||||
WX_GL_STENCIL_SIZE, 1,
|
||||
WX_GL_SAMPLE_BUFFERS, 1, // Enable multisampling support (antialiasing).
|
||||
WX_GL_SAMPLES, 0, // Disable AA for the start.
|
||||
0 }; // NULL termination
|
||||
|
||||
|
||||
// Check if the canvas supports multisampling.
|
||||
if( EDA_3D_CANVAS::IsDisplaySupported( attrs ) )
|
||||
{
|
||||
// Check for possible sample sizes, start form the top.
|
||||
int maxSamples = 8; // Any higher doesn't change anything.
|
||||
int samplesOffset = 0;
|
||||
|
||||
for( unsigned int ii = 0; ii < DIM( attrs ); ii += 2 )
|
||||
{
|
||||
if( attrs[ii] == WX_GL_SAMPLES )
|
||||
{
|
||||
samplesOffset = ii+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
attrs[samplesOffset] = maxSamples;
|
||||
|
||||
for( ; maxSamples > 0 && !EDA_3D_CANVAS::IsDisplaySupported( attrs );
|
||||
maxSamples = maxSamples>>1 )
|
||||
{
|
||||
attrs[samplesOffset] = maxSamples;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Disable multisampling
|
||||
for( unsigned int ii = 0; ii < DIM( attrs ); ii += 2 )
|
||||
{
|
||||
if( attrs[ii] == WX_GL_SAMPLE_BUFFERS )
|
||||
{
|
||||
attrs[ii+1] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int attrs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0 };
|
||||
m_canvas = new EDA_3D_CANVAS( this, attrs );
|
||||
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
@@ -222,11 +124,6 @@ EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
|
||||
}
|
||||
|
||||
|
||||
EDA_3D_FRAME::~EDA_3D_FRAME()
|
||||
{
|
||||
m_auimgr.UnInit();
|
||||
}
|
||||
|
||||
void EDA_3D_FRAME::Exit3DFrame( wxCommandEvent& event )
|
||||
{
|
||||
Close( true );
|
||||
@@ -242,167 +139,84 @@ void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||
void EDA_3D_FRAME::GetSettings()
|
||||
{
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
|
||||
class INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||
|
||||
INFO3D_VISU& prms = GetPrm3DVisu();
|
||||
if( config )
|
||||
{
|
||||
EDA_BASE_FRAME::LoadSettings();
|
||||
|
||||
aCfg->Read( keyBgColor_Red, &GetPrm3DVisu().m_BgColor.m_Red, 0.4 );
|
||||
aCfg->Read( keyBgColor_Green, &GetPrm3DVisu().m_BgColor.m_Green, 0.4 );
|
||||
aCfg->Read( keyBgColor_Blue, &GetPrm3DVisu().m_BgColor.m_Blue, 0.5 );
|
||||
config->Read( keyBgColor_Red, &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
|
||||
config->Read( keyBgColor_Green, &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
|
||||
config->Read( keyBgColor_Blue, &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
|
||||
|
||||
aCfg->Read( keyBgColor_Red_Top, &GetPrm3DVisu().m_BgColor_Top.m_Red, 0.8 );
|
||||
aCfg->Read( keyBgColor_Green_Top, &GetPrm3DVisu().m_BgColor_Top.m_Green, 0.8 );
|
||||
aCfg->Read( keyBgColor_Blue_Top, &GetPrm3DVisu().m_BgColor_Top.m_Blue, 0.9 );
|
||||
bool tmp;
|
||||
config->Read( keyShowRealisticMode, &tmp, false );
|
||||
prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
|
||||
|
||||
// m_SolderMaskColor default value = dark grey-green
|
||||
aCfg->Read( keySMaskColor_Red, &GetPrm3DVisu().m_SolderMaskColor.m_Red, 100.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Green, &GetPrm3DVisu().m_SolderMaskColor.m_Green, 255.0 * 0.2 / 255.0 );
|
||||
aCfg->Read( keySMaskColor_Blue, &GetPrm3DVisu().m_SolderMaskColor.m_Blue, 180.0 * 0.2 / 255.0 );
|
||||
config->Read( keyShowAxis, &tmp, true );
|
||||
prms.SetFlag( FL_AXIS, tmp );
|
||||
|
||||
// m_SolderPasteColor default value = light grey
|
||||
aCfg->Read( keySPasteColor_Red, &GetPrm3DVisu().m_SolderPasteColor.m_Red, 128.0 /255.0 );
|
||||
aCfg->Read( keySPasteColor_Green, &GetPrm3DVisu().m_SolderPasteColor.m_Green, 128.0 /255.0 );
|
||||
aCfg->Read( keySPasteColor_Blue, &GetPrm3DVisu().m_SolderPasteColor.m_Blue, 128.0 /255.0 );
|
||||
config->Read( keyShowFootprints, &tmp, true );
|
||||
prms.SetFlag( FL_MODULE, tmp );
|
||||
|
||||
// m_SilkScreenColor default value = white
|
||||
aCfg->Read( keySilkColor_Red, &GetPrm3DVisu().m_SilkScreenColor.m_Red, 0.9 );
|
||||
aCfg->Read( keySilkColor_Green, &GetPrm3DVisu().m_SilkScreenColor.m_Green, 0.9 );
|
||||
aCfg->Read( keySilkColor_Blue, &GetPrm3DVisu().m_SilkScreenColor.m_Blue, 0.9 );
|
||||
config->Read( keyShowCopperThickness, &tmp, false );
|
||||
prms.SetFlag( FL_USE_COPPER_THICKNESS, tmp );
|
||||
|
||||
// m_CopperColor default value = gold
|
||||
aCfg->Read( keyCopperColor_Red, &GetPrm3DVisu().m_CopperColor.m_Red, 255.0 * 0.7 / 255.0 );
|
||||
aCfg->Read( keyCopperColor_Green, &GetPrm3DVisu().m_CopperColor.m_Green, 223.0 * 0.7 / 255.0 );
|
||||
aCfg->Read( keyCopperColor_Blue, &GetPrm3DVisu().m_CopperColor.m_Blue, 0.0 /255.0 );
|
||||
config->Read( keyShowZones, &tmp, true );
|
||||
prms.SetFlag( FL_ZONE, tmp );
|
||||
|
||||
// m_BoardBodyColor default value = FR4, in realistic mode
|
||||
aCfg->Read( keyBoardBodyColor_Red, &GetPrm3DVisu().m_BoardBodyColor.m_Red, 51.0 / 255.0 );
|
||||
aCfg->Read( keyBoardBodyColor_Green, &GetPrm3DVisu().m_BoardBodyColor.m_Green, 43.0 / 255.0 );
|
||||
aCfg->Read( keyBoardBodyColor_Blue, &GetPrm3DVisu().m_BoardBodyColor.m_Blue, 22.0 /255.0 );
|
||||
config->Read( keyShowAdhesiveLayers, &tmp, true );
|
||||
prms.SetFlag( FL_ADHESIVE, tmp );
|
||||
|
||||
bool tmp;
|
||||
aCfg->Read( keyShowRealisticMode, &tmp, false );
|
||||
prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
|
||||
config->Read( keyShowSilkScreenLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SILKSCREEN, tmp );
|
||||
|
||||
aCfg->Read( keyRenderShadows, &tmp, false );
|
||||
prms.SetFlag( FL_RENDER_SHADOWS, tmp );
|
||||
config->Read( keyShowSolderMaskLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SOLDERMASK, tmp );
|
||||
|
||||
aCfg->Read( keyRenderRemoveHoles, &tmp, false );
|
||||
prms.SetFlag( FL_RENDER_SHOW_HOLES_IN_ZONES, tmp );
|
||||
config->Read( keyShowSolderPasteLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SOLDERPASTE, tmp );
|
||||
|
||||
aCfg->Read( keyRenderTextures, &tmp, false );
|
||||
prms.SetFlag( FL_RENDER_TEXTURES, tmp );
|
||||
config->Read( keyShowCommentsLayer, &tmp, true );
|
||||
prms.SetFlag( FL_COMMENTS, tmp );
|
||||
|
||||
aCfg->Read( keyRenderSmoothNormals, &tmp, false );
|
||||
prms.SetFlag( FL_RENDER_SMOOTH_NORMALS, tmp );
|
||||
config->Read( keyShowEcoLayers, &tmp, true );
|
||||
prms.SetFlag( FL_ECO, tmp );
|
||||
|
||||
aCfg->Read( keyRenderUseModelNormals, &tmp, false );
|
||||
prms.SetFlag( FL_RENDER_USE_MODEL_NORMALS, tmp );
|
||||
|
||||
aCfg->Read( keyRenderMaterial, &tmp, false );
|
||||
prms.SetFlag( FL_RENDER_MATERIAL, tmp );
|
||||
|
||||
aCfg->Read( keyRenderShowModelBBox, &tmp, false );
|
||||
prms.SetFlag( FL_RENDER_SHOW_MODEL_BBOX, tmp );
|
||||
|
||||
aCfg->Read( keyShowAxis, &tmp, true );
|
||||
prms.SetFlag( FL_AXIS, tmp );
|
||||
|
||||
aCfg->Read( keyShowGrid, &tmp, true );
|
||||
prms.SetFlag( FL_GRID, tmp );
|
||||
|
||||
aCfg->Read( keyShowGridSize, &prms.m_3D_Grid, 10.0 );
|
||||
|
||||
aCfg->Read( keyShowFootprints, &tmp, true );
|
||||
prms.SetFlag( FL_MODULE, tmp );
|
||||
|
||||
aCfg->Read( keyShowCopperThickness, &tmp, false );
|
||||
prms.SetFlag( FL_USE_COPPER_THICKNESS, tmp );
|
||||
|
||||
aCfg->Read( keyShowZones, &tmp, true );
|
||||
prms.SetFlag( FL_ZONE, tmp );
|
||||
|
||||
aCfg->Read( keyShowAdhesiveLayers, &tmp, true );
|
||||
prms.SetFlag( FL_ADHESIVE, tmp );
|
||||
|
||||
aCfg->Read( keyShowSilkScreenLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SILKSCREEN, tmp );
|
||||
|
||||
aCfg->Read( keyShowSolderMaskLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SOLDERMASK, tmp );
|
||||
|
||||
aCfg->Read( keyShowSolderPasteLayers, &tmp, true );
|
||||
prms.SetFlag( FL_SOLDERPASTE, tmp );
|
||||
|
||||
aCfg->Read( keyShowCommentsLayer, &tmp, true );
|
||||
prms.SetFlag( FL_COMMENTS, tmp );
|
||||
|
||||
aCfg->Read( keyShowEcoLayers, &tmp, true );
|
||||
prms.SetFlag( FL_ECO, tmp );
|
||||
|
||||
aCfg->Read( keyShowBoardBody, &tmp, true );
|
||||
prms.SetFlag( FL_SHOW_BOARD_BODY, tmp );
|
||||
config->Read( keyShowBoardBody, &tmp, true );
|
||||
prms.SetFlag( FL_SHOW_BOARD_BODY, tmp );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||
void EDA_3D_FRAME::SaveSettings()
|
||||
{
|
||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||
wxConfig* config = wxGetApp().GetSettings(); // Current config used by application
|
||||
|
||||
INFO3D_VISU& prms = GetPrm3DVisu();
|
||||
if( !config )
|
||||
return;
|
||||
|
||||
aCfg->Write( keyBgColor_Red, GetPrm3DVisu().m_BgColor.m_Red );
|
||||
aCfg->Write( keyBgColor_Green, GetPrm3DVisu().m_BgColor.m_Green );
|
||||
aCfg->Write( keyBgColor_Blue, GetPrm3DVisu().m_BgColor.m_Blue );
|
||||
EDA_BASE_FRAME::SaveSettings();
|
||||
|
||||
aCfg->Write( keyBgColor_Red_Top, GetPrm3DVisu().m_BgColor_Top.m_Red );
|
||||
aCfg->Write( keyBgColor_Green_Top, GetPrm3DVisu().m_BgColor_Top.m_Green );
|
||||
aCfg->Write( keyBgColor_Blue_Top, GetPrm3DVisu().m_BgColor_Top.m_Blue );
|
||||
|
||||
aCfg->Write( keySMaskColor_Red, GetPrm3DVisu().m_SolderMaskColor.m_Red );
|
||||
aCfg->Write( keySMaskColor_Green, GetPrm3DVisu().m_SolderMaskColor.m_Green );
|
||||
aCfg->Write( keySMaskColor_Blue, GetPrm3DVisu().m_SolderMaskColor.m_Blue );
|
||||
|
||||
aCfg->Write( keySPasteColor_Red, GetPrm3DVisu().m_SolderPasteColor.m_Red );
|
||||
aCfg->Write( keySPasteColor_Green, GetPrm3DVisu().m_SolderPasteColor.m_Green );
|
||||
aCfg->Write( keySPasteColor_Blue, GetPrm3DVisu().m_SolderPasteColor.m_Blue );
|
||||
|
||||
aCfg->Write( keySilkColor_Red, GetPrm3DVisu().m_SilkScreenColor.m_Red );
|
||||
aCfg->Write( keySilkColor_Green, GetPrm3DVisu().m_SilkScreenColor.m_Green );
|
||||
aCfg->Write( keySilkColor_Blue, GetPrm3DVisu().m_SilkScreenColor.m_Blue );
|
||||
|
||||
aCfg->Write( keyCopperColor_Red, GetPrm3DVisu().m_CopperColor.m_Red );
|
||||
aCfg->Write( keyCopperColor_Green, GetPrm3DVisu().m_CopperColor.m_Green );
|
||||
aCfg->Write( keyCopperColor_Blue, GetPrm3DVisu().m_CopperColor.m_Blue );
|
||||
|
||||
aCfg->Write( keyBoardBodyColor_Red, GetPrm3DVisu().m_BoardBodyColor.m_Red );
|
||||
aCfg->Write( keyBoardBodyColor_Green, GetPrm3DVisu().m_BoardBodyColor.m_Green );
|
||||
aCfg->Write( keyBoardBodyColor_Blue, GetPrm3DVisu().m_BoardBodyColor.m_Blue );
|
||||
|
||||
aCfg->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
|
||||
|
||||
aCfg->Write( keyRenderShadows, prms.GetFlag( FL_RENDER_SHADOWS ) );
|
||||
aCfg->Write( keyRenderRemoveHoles, prms.GetFlag( FL_RENDER_SHOW_HOLES_IN_ZONES ) );
|
||||
aCfg->Write( keyRenderTextures, prms.GetFlag( FL_RENDER_TEXTURES ) );
|
||||
aCfg->Write( keyRenderSmoothNormals, prms.GetFlag( FL_RENDER_SMOOTH_NORMALS ) );
|
||||
aCfg->Write( keyRenderUseModelNormals, prms.GetFlag( FL_RENDER_USE_MODEL_NORMALS ) );
|
||||
aCfg->Write( keyRenderMaterial, prms.GetFlag( FL_RENDER_MATERIAL ) );
|
||||
aCfg->Write( keyRenderShowModelBBox, prms.GetFlag( FL_RENDER_SHOW_MODEL_BBOX ) );
|
||||
|
||||
aCfg->Write( keyShowAxis, prms.GetFlag( FL_AXIS ) );
|
||||
aCfg->Write( keyShowGrid, prms.GetFlag( FL_GRID ) );
|
||||
aCfg->Write( keyShowGridSize, prms.m_3D_Grid );
|
||||
aCfg->Write( keyShowFootprints, prms.GetFlag( FL_MODULE ) );
|
||||
aCfg->Write( keyShowCopperThickness, prms.GetFlag( FL_USE_COPPER_THICKNESS ) );
|
||||
aCfg->Write( keyShowZones, prms.GetFlag( FL_ZONE ) );
|
||||
aCfg->Write( keyShowAdhesiveLayers, prms.GetFlag( FL_ADHESIVE ) );
|
||||
aCfg->Write( keyShowSilkScreenLayers, prms.GetFlag( FL_SILKSCREEN ) );
|
||||
aCfg->Write( keyShowSolderMaskLayers, prms.GetFlag( FL_SOLDERMASK ) );
|
||||
aCfg->Write( keyShowSolderPasteLayers, prms.GetFlag( FL_SOLDERPASTE ) );
|
||||
aCfg->Write( keyShowCommentsLayer, prms.GetFlag( FL_COMMENTS ) );
|
||||
aCfg->Write( keyShowEcoLayers, prms.GetFlag( FL_ECO ) );
|
||||
aCfg->Write( keyShowBoardBody, prms.GetFlag( FL_SHOW_BOARD_BODY ) );
|
||||
config->Write( keyBgColor_Red, g_Parm_3D_Visu.m_BgColor.m_Red );
|
||||
config->Write( keyBgColor_Green, g_Parm_3D_Visu.m_BgColor.m_Green );
|
||||
config->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
|
||||
class INFO3D_VISU& prms = g_Parm_3D_Visu;
|
||||
config->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
|
||||
config->Write( keyShowAxis, prms.GetFlag( FL_AXIS ) );
|
||||
config->Write( keyShowFootprints, prms.GetFlag( FL_MODULE ) );
|
||||
config->Write( keyShowCopperThickness, prms.GetFlag( FL_USE_COPPER_THICKNESS ) );
|
||||
config->Write( keyShowZones, prms.GetFlag( FL_ZONE ) );
|
||||
config->Write( keyShowAdhesiveLayers, prms.GetFlag( FL_ADHESIVE ) );
|
||||
config->Write( keyShowSilkScreenLayers, prms.GetFlag( FL_SILKSCREEN ) );
|
||||
config->Write( keyShowSolderMaskLayers, prms.GetFlag( FL_SOLDERMASK ) );
|
||||
config->Write( keyShowSolderPasteLayers, prms.GetFlag( FL_SOLDERPASTE ) );
|
||||
config->Write( keyShowCommentsLayer, prms.GetFlag( FL_COMMENTS ) );
|
||||
config->Write( keyShowEcoLayers, prms.GetFlag( FL_ECO ) );
|
||||
config->Write( keyShowBoardBody, prms.GetFlag( FL_SHOW_BOARD_BODY ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -415,23 +229,23 @@ void EDA_3D_FRAME::Process_Zoom( wxCommandEvent& event )
|
||||
case ID_ZOOM_PAGE:
|
||||
|
||||
for( ii = 0; ii < 4; ii++ )
|
||||
GetPrm3DVisu().m_Rot[ii] = 0.0;
|
||||
g_Parm_3D_Visu.m_Rot[ii] = 0.0;
|
||||
|
||||
GetPrm3DVisu().m_Zoom = 1.0;
|
||||
g_Parm_3D_Visu.m_Zoom = 1.0;
|
||||
m_canvas->SetOffset( 0.0, 0.0 );
|
||||
trackball( GetPrm3DVisu().m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
|
||||
break;
|
||||
|
||||
case ID_ZOOM_IN:
|
||||
GetPrm3DVisu().m_Zoom /= 1.2;
|
||||
g_Parm_3D_Visu.m_Zoom /= 1.2;
|
||||
|
||||
if( GetPrm3DVisu().m_Zoom <= 0.01 )
|
||||
GetPrm3DVisu().m_Zoom = 0.01;
|
||||
if( g_Parm_3D_Visu.m_Zoom <= 0.01 )
|
||||
g_Parm_3D_Visu.m_Zoom = 0.01;
|
||||
|
||||
break;
|
||||
|
||||
case ID_ZOOM_OUT:
|
||||
GetPrm3DVisu().m_Zoom *= 1.2;
|
||||
g_Parm_3D_Visu.m_Zoom *= 1.2;
|
||||
break;
|
||||
|
||||
case ID_ZOOM_REDRAW:
|
||||
@@ -480,33 +294,32 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||
break;
|
||||
|
||||
case ID_RELOAD3D_BOARD:
|
||||
m_reloadRequest = true;
|
||||
NewDisplay();
|
||||
return;
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_X_POS:
|
||||
GetPrm3DVisu().m_ROTX += ROT_ANGLE;
|
||||
g_Parm_3D_Visu.m_ROTX += ROT_ANGLE;
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_X_NEG:
|
||||
GetPrm3DVisu().m_ROTX -= ROT_ANGLE;
|
||||
g_Parm_3D_Visu.m_ROTX -= ROT_ANGLE;
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_Y_POS:
|
||||
GetPrm3DVisu().m_ROTY += ROT_ANGLE;
|
||||
g_Parm_3D_Visu.m_ROTY += ROT_ANGLE;
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_Y_NEG:
|
||||
GetPrm3DVisu().m_ROTY -= ROT_ANGLE;
|
||||
g_Parm_3D_Visu.m_ROTY -= ROT_ANGLE;
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_Z_POS:
|
||||
GetPrm3DVisu().m_ROTZ += ROT_ANGLE;
|
||||
g_Parm_3D_Visu.m_ROTZ += ROT_ANGLE;
|
||||
break;
|
||||
|
||||
case ID_ROTATE3D_Z_NEG:
|
||||
GetPrm3DVisu().m_ROTZ -= ROT_ANGLE;
|
||||
g_Parm_3D_Visu.m_ROTZ -= ROT_ANGLE;
|
||||
break;
|
||||
|
||||
case ID_MOVE3D_LEFT:
|
||||
@@ -535,133 +348,68 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||
m_canvas->TakeScreenshot( event );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_BGCOLOR_BOTTOM_SELECTION:
|
||||
if( Set3DColorFromUser( GetPrm3DVisu().m_BgColor, _( "Background Color, Bottom" ) ) )
|
||||
m_canvas->Refresh( true );
|
||||
case ID_MENU3D_BGCOLOR_SELECTION:
|
||||
Set3DBgColor();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_BGCOLOR_TOP_SELECTION:
|
||||
if( Set3DColorFromUser( GetPrm3DVisu().m_BgColor_Top, _( "Background Color, Top" ) ) )
|
||||
m_canvas->Refresh( true );
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SILKSCREEN_COLOR_SELECTION:
|
||||
Set3DSilkScreenColorFromUser();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SOLDERMASK_COLOR_SELECTION:
|
||||
Set3DSolderMaskColorFromUser();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SOLDERPASTE_COLOR_SELECTION:
|
||||
Set3DSolderPasteColorFromUser();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_COPPER_COLOR_SELECTION:
|
||||
Set3DCopperColorFromUser();
|
||||
break;
|
||||
|
||||
case ID_MENU3D_PCB_BODY_COLOR_SELECTION:
|
||||
Set3DBoardBodyColorFromUser();
|
||||
break;
|
||||
|
||||
case ID_MENU3D_REALISTIC_MODE:
|
||||
GetPrm3DVisu().SetFlag( FL_USE_REALISTIC_MODE, isChecked );
|
||||
GetMenuBar()->FindItem( ID_MENU3D_COMMENTS_ONOFF )->Enable( !isChecked );
|
||||
GetMenuBar()->FindItem( ID_MENU3D_ECO_ONOFF )->Enable( !isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_FL_RENDER_SHADOWS:
|
||||
GetPrm3DVisu().SetFlag( FL_RENDER_SHADOWS, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES:
|
||||
GetPrm3DVisu().SetFlag( FL_RENDER_SHOW_HOLES_IN_ZONES, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_FL_RENDER_TEXTURES:
|
||||
GetPrm3DVisu().SetFlag( FL_RENDER_TEXTURES, isChecked );
|
||||
NewDisplay(GL_ID_BOARD);
|
||||
NewDisplay(GL_ID_TECH_LAYERS);
|
||||
return;
|
||||
|
||||
case ID_MENU3D_FL_RENDER_SMOOTH_NORMALS:
|
||||
GetPrm3DVisu().SetFlag( FL_RENDER_SMOOTH_NORMALS, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_FL_RENDER_USE_MODEL_NORMALS:
|
||||
GetPrm3DVisu().SetFlag( FL_RENDER_USE_MODEL_NORMALS, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_FL_RENDER_MATERIAL:
|
||||
GetPrm3DVisu().SetFlag( FL_RENDER_MATERIAL, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_FL_RENDER_SHOW_MODEL_BBOX:
|
||||
GetPrm3DVisu().SetFlag( FL_RENDER_SHOW_MODEL_BBOX, isChecked );
|
||||
g_Parm_3D_Visu.SetFlag( FL_USE_REALISTIC_MODE, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SHOW_BOARD_BODY:
|
||||
GetPrm3DVisu().SetFlag( FL_SHOW_BOARD_BODY, isChecked );
|
||||
g_Parm_3D_Visu.SetFlag( FL_SHOW_BOARD_BODY, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_AXIS_ONOFF:
|
||||
GetPrm3DVisu().SetFlag( FL_AXIS, isChecked );
|
||||
m_canvas->Refresh();
|
||||
g_Parm_3D_Visu.SetFlag( FL_AXIS, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_MODULE_ONOFF:
|
||||
GetPrm3DVisu().SetFlag( FL_MODULE, isChecked );
|
||||
m_canvas->Refresh();
|
||||
g_Parm_3D_Visu.SetFlag( FL_MODULE, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_USE_COPPER_THICKNESS:
|
||||
GetPrm3DVisu().SetFlag( FL_USE_COPPER_THICKNESS, isChecked );
|
||||
NewDisplay( GL_ID_BOARD );
|
||||
NewDisplay( GL_ID_TECH_LAYERS );
|
||||
g_Parm_3D_Visu.SetFlag( FL_USE_COPPER_THICKNESS, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_ZONE_ONOFF:
|
||||
GetPrm3DVisu().SetFlag( FL_ZONE, isChecked );
|
||||
NewDisplay( GL_ID_BOARD );
|
||||
g_Parm_3D_Visu.SetFlag( FL_ZONE, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_ADHESIVE_ONOFF:
|
||||
GetPrm3DVisu().SetFlag( FL_ADHESIVE, isChecked );
|
||||
NewDisplay( GL_ID_TECH_LAYERS );
|
||||
g_Parm_3D_Visu.SetFlag( FL_ADHESIVE, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SILKSCREEN_ONOFF:
|
||||
GetPrm3DVisu().SetFlag( FL_SILKSCREEN, isChecked );
|
||||
NewDisplay( GL_ID_TECH_LAYERS );
|
||||
g_Parm_3D_Visu.SetFlag( FL_SILKSCREEN, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SOLDER_MASK_ONOFF:
|
||||
GetPrm3DVisu().SetFlag( FL_SOLDERMASK, isChecked );
|
||||
NewDisplay( GL_ID_TECH_LAYERS );
|
||||
g_Parm_3D_Visu.SetFlag( FL_SOLDERMASK, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SOLDER_PASTE_ONOFF:
|
||||
GetPrm3DVisu().SetFlag( FL_SOLDERPASTE, isChecked );
|
||||
NewDisplay( GL_ID_TECH_LAYERS );
|
||||
g_Parm_3D_Visu.SetFlag( FL_SOLDERPASTE, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_COMMENTS_ONOFF:
|
||||
GetPrm3DVisu().SetFlag( FL_COMMENTS, isChecked );
|
||||
NewDisplay( GL_ID_AUX_LAYERS );
|
||||
g_Parm_3D_Visu.SetFlag( FL_COMMENTS, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_ECO_ONOFF:
|
||||
GetPrm3DVisu().SetFlag( FL_ECO, isChecked );
|
||||
NewDisplay( GL_ID_AUX_LAYERS );
|
||||
g_Parm_3D_Visu.SetFlag( FL_ECO, isChecked );
|
||||
NewDisplay();
|
||||
return;
|
||||
|
||||
default:
|
||||
@@ -678,7 +426,7 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
|
||||
for( int ii = ID_MENU3D_GRID_NOGRID; ii < ID_MENU3D_GRID_END; ii++ )
|
||||
for( int ii = ID_MENU3D_GRID; ii < ID_MENU3D_GRID_END; ii++ )
|
||||
{
|
||||
if( event.GetId() == ii )
|
||||
continue;
|
||||
@@ -686,30 +434,31 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
|
||||
GetMenuBar()->Check( ii, false );
|
||||
}
|
||||
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_MENU3D_GRID_NOGRID:
|
||||
GetPrm3DVisu().SetFlag( FL_GRID, false );
|
||||
g_Parm_3D_Visu.SetFlag( FL_GRID, false );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_GRID_10_MM:
|
||||
GetPrm3DVisu().SetFlag( FL_GRID, true );
|
||||
GetPrm3DVisu().m_3D_Grid = 10.0;
|
||||
g_Parm_3D_Visu.SetFlag( FL_GRID, true );
|
||||
g_Parm_3D_Visu.m_3D_Grid = 10.0;
|
||||
break;
|
||||
|
||||
case ID_MENU3D_GRID_5_MM:
|
||||
GetPrm3DVisu().SetFlag( FL_GRID, true );
|
||||
GetPrm3DVisu().m_3D_Grid = 5.0;
|
||||
g_Parm_3D_Visu.SetFlag( FL_GRID, true );
|
||||
g_Parm_3D_Visu.m_3D_Grid = 5.0;
|
||||
break;
|
||||
|
||||
case ID_MENU3D_GRID_2P5_MM:
|
||||
GetPrm3DVisu().SetFlag( FL_GRID, true );
|
||||
GetPrm3DVisu().m_3D_Grid = 2.5;
|
||||
g_Parm_3D_Visu.SetFlag( FL_GRID, true );
|
||||
g_Parm_3D_Visu.m_3D_Grid = 2.5;
|
||||
break;
|
||||
|
||||
case ID_MENU3D_GRID_1_MM:
|
||||
GetPrm3DVisu().SetFlag( FL_GRID, true );
|
||||
GetPrm3DVisu().m_3D_Grid = 1.0;
|
||||
g_Parm_3D_Visu.SetFlag( FL_GRID, true );
|
||||
g_Parm_3D_Visu.m_3D_Grid = 1.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -717,28 +466,26 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
|
||||
return;
|
||||
}
|
||||
|
||||
NewDisplay( GL_ID_GRID );
|
||||
NewDisplay();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_FRAME::NewDisplay( int aGlList )
|
||||
void EDA_3D_FRAME::NewDisplay()
|
||||
{
|
||||
m_canvas->ClearLists( aGlList );
|
||||
|
||||
// Rebuild the 3D board and refresh the view on reload request:
|
||||
if( m_reloadRequest )
|
||||
m_canvas->ReportWarnings( true );
|
||||
|
||||
m_canvas->Refresh( true );
|
||||
|
||||
m_canvas->DisplayStatus();
|
||||
m_reloadRequest = false;
|
||||
|
||||
m_canvas->ClearLists();
|
||||
m_canvas->CreateDrawGL_List();
|
||||
|
||||
// m_canvas->InitGL();
|
||||
m_canvas->Refresh( true );
|
||||
m_canvas->DisplayStatus();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_FRAME::OnActivate( wxActivateEvent& event )
|
||||
{
|
||||
// Reload data if 3D frame shows a board,
|
||||
// Reload data if 3D frame shows a footprint,
|
||||
// because it can be changed since last frame activation
|
||||
if( m_reloadRequest )
|
||||
NewDisplay();
|
||||
@@ -749,166 +496,22 @@ void EDA_3D_FRAME::OnActivate( wxActivateEvent& event )
|
||||
|
||||
/* called to set the background color of the 3D scene
|
||||
*/
|
||||
bool EDA_3D_FRAME::Set3DColorFromUser( S3D_COLOR &aColor, const wxString& aTitle,
|
||||
wxColourData* aPredefinedColors )
|
||||
void EDA_3D_FRAME::Set3DBgColor()
|
||||
{
|
||||
wxColour newcolor, oldcolor;
|
||||
S3D_COLOR color;
|
||||
wxColour newcolor, oldcolor;
|
||||
|
||||
oldcolor.Set( KiROUND( aColor.m_Red * 255 ),
|
||||
KiROUND( aColor.m_Green * 255 ),
|
||||
KiROUND( aColor.m_Blue * 255 ) );
|
||||
oldcolor.Set( KiROUND( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),
|
||||
KiROUND( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ),
|
||||
KiROUND( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) );
|
||||
|
||||
wxColourData emptyColorSet; // Provides a empty predefined set of colors
|
||||
// if no color set available to avoid use of an
|
||||
// old color set
|
||||
|
||||
if( aPredefinedColors == NULL )
|
||||
aPredefinedColors = &emptyColorSet;
|
||||
|
||||
newcolor = wxGetColourFromUser( this, oldcolor, aTitle, aPredefinedColors );
|
||||
|
||||
if( !newcolor.IsOk() ) // Cancel command
|
||||
return false;
|
||||
newcolor = wxGetColourFromUser( this, oldcolor );
|
||||
|
||||
if( newcolor != oldcolor )
|
||||
{
|
||||
aColor.m_Red = (double) newcolor.Red() / 255.0;
|
||||
aColor.m_Green = (double) newcolor.Green() / 255.0;
|
||||
aColor.m_Blue = (double) newcolor.Blue() / 255.0;
|
||||
g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0;
|
||||
g_Parm_3D_Visu.m_BgColor.m_Green = (double) newcolor.Green() / 255.0;
|
||||
g_Parm_3D_Visu.m_BgColor.m_Blue = (double) newcolor.Blue() / 255.0;
|
||||
NewDisplay();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* called to set the silkscreen color. Sets up a number of default colors
|
||||
*/
|
||||
bool EDA_3D_FRAME::Set3DSilkScreenColorFromUser()
|
||||
{
|
||||
wxColourData definedColors;
|
||||
|
||||
definedColors.SetCustomColour(0, wxColour( 241, 241, 241 ) ); // White
|
||||
definedColors.SetCustomColour(1, wxColour( 180, 180, 180 ) ); // Gray
|
||||
|
||||
bool change = Set3DColorFromUser( GetPrm3DVisu().m_SilkScreenColor,
|
||||
_( "Silk Screen Color" ),
|
||||
&definedColors );
|
||||
|
||||
if( change )
|
||||
NewDisplay( GL_ID_TECH_LAYERS );
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
|
||||
/* called to set the soldermask color. Sets up a number of default colors
|
||||
*/
|
||||
bool EDA_3D_FRAME::Set3DSolderMaskColorFromUser()
|
||||
{
|
||||
wxColourData definedColors;
|
||||
|
||||
definedColors.SetCustomColour(0, wxColour( 20, 51, 36 ) ); // Green
|
||||
definedColors.SetCustomColour(1, wxColour( 43, 10, 65 ) ); // Purple
|
||||
definedColors.SetCustomColour(2, wxColour( 117, 19, 21 ) ); // Red
|
||||
definedColors.SetCustomColour(3, wxColour( 54, 79, 116) ); // Light blue
|
||||
definedColors.SetCustomColour(4, wxColour( 11, 11, 11 ) ); // Black
|
||||
definedColors.SetCustomColour(5, wxColour( 241, 241,241) ); // White
|
||||
|
||||
bool change = Set3DColorFromUser( GetPrm3DVisu().m_SolderMaskColor,
|
||||
_( "Solder Mask Color" ),
|
||||
&definedColors );
|
||||
|
||||
if( change )
|
||||
NewDisplay( GL_ID_TECH_LAYERS );
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
|
||||
/* called to set the copper surface color. Sets up a number of default colors
|
||||
*/
|
||||
bool EDA_3D_FRAME::Set3DCopperColorFromUser()
|
||||
{
|
||||
wxColourData definedColors;
|
||||
|
||||
definedColors.SetCustomColour( 0, wxColour( 184, 115, 50 ) ); // Copper
|
||||
definedColors.SetCustomColour( 1, wxColour( 233, 221, 82 ) ); // Gold
|
||||
definedColors.SetCustomColour( 2, wxColour( 213, 213, 213) ); // Silver
|
||||
definedColors.SetCustomColour( 3, wxColour( 160, 160, 160) ); // tin
|
||||
|
||||
|
||||
bool change = Set3DColorFromUser( GetPrm3DVisu().m_CopperColor,
|
||||
_( "Copper Color" ),
|
||||
&definedColors );
|
||||
|
||||
if( change )
|
||||
NewDisplay( GL_ID_BOARD );
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
|
||||
/* called to set the board body color. Sets up a number of default colors
|
||||
*/
|
||||
bool EDA_3D_FRAME::Set3DBoardBodyColorFromUser()
|
||||
{
|
||||
wxColourData definedColors;
|
||||
|
||||
definedColors.SetCustomColour( 0, wxColour( 51, 43, 22 ) ); // FR4 natural, dark
|
||||
definedColors.SetCustomColour( 1, wxColour( 109, 116, 75 ) ); // FR4 natural
|
||||
definedColors.SetCustomColour( 2, wxColour( 78, 14, 5 ) ); // brown/red
|
||||
definedColors.SetCustomColour( 3, wxColour( 146, 99, 47 ) ); // brown 1
|
||||
definedColors.SetCustomColour( 4, wxColour( 160, 123, 54 ) ); // brown 2
|
||||
definedColors.SetCustomColour( 5, wxColour( 146, 99, 47 ) ); // brown 3
|
||||
definedColors.SetCustomColour( 6, wxColour( 63, 126, 71 ) ); // green 1
|
||||
definedColors.SetCustomColour( 7, wxColour( 117, 122, 90 ) ); // green 2
|
||||
|
||||
bool change = Set3DColorFromUser( GetPrm3DVisu().m_BoardBodyColor,
|
||||
_( "Board Body Color" ),
|
||||
&definedColors );
|
||||
|
||||
if( change )
|
||||
NewDisplay( GL_ID_BOARD );
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
|
||||
/* called to set the solder paste layer color. Sets up a number of default colors
|
||||
*/
|
||||
bool EDA_3D_FRAME::Set3DSolderPasteColorFromUser()
|
||||
{
|
||||
wxColourData definedColors;
|
||||
|
||||
definedColors.SetCustomColour(0, wxColour( 128, 128, 128 ) ); // grey
|
||||
definedColors.SetCustomColour(1, wxColour( 213, 213, 213 ) ); // Silver
|
||||
definedColors.SetCustomColour(2, wxColour( 90, 90, 90 ) ); // grey 2
|
||||
|
||||
bool change = Set3DColorFromUser( GetPrm3DVisu().m_SolderPasteColor,
|
||||
_( "Solder Paste Color" ),
|
||||
&definedColors );
|
||||
|
||||
if( change )
|
||||
NewDisplay( GL_ID_TECH_LAYERS );
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
|
||||
BOARD* EDA_3D_FRAME::GetBoard()
|
||||
{
|
||||
return Parent()->GetBoard();
|
||||
}
|
||||
|
||||
|
||||
INFO3D_VISU& EDA_3D_FRAME::GetPrm3DVisu() const
|
||||
{
|
||||
// return the INFO3D_VISU which contains the current parameters
|
||||
// to draw the 3D view of the board
|
||||
return g_Parm_3D_Visu;
|
||||
}
|
||||
|
||||
bool EDA_3D_FRAME::IsEnabled( DISPLAY3D_FLG aItem ) const
|
||||
{
|
||||
// return true if aItem must be displayed
|
||||
return GetPrm3DVisu().GetFlag( aItem );
|
||||
}
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014-2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
/**
|
||||
* @file 3d_class.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <3d_struct.h>
|
||||
#include <3d_material.h>
|
||||
#include <info3d_visu.h>
|
||||
|
||||
#ifdef __WXMAC__
|
||||
# ifdef __DARWIN__
|
||||
# include <OpenGL/glu.h>
|
||||
# else
|
||||
# include <glu.h>
|
||||
# endif
|
||||
#else
|
||||
# include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
|
||||
EDA_ITEM( father, NOT_USED )
|
||||
{
|
||||
m_Name = name;
|
||||
m_AmbientColor.clear();
|
||||
m_DiffuseColor.clear();
|
||||
m_EmissiveColor.clear();
|
||||
m_SpecularColor.clear();
|
||||
m_Shininess.clear();
|
||||
m_Transparency.clear();
|
||||
m_ColorPerVertex = false;
|
||||
}
|
||||
|
||||
|
||||
void SetOpenGlDefaultMaterial()
|
||||
{
|
||||
glm::vec4 ambient( 0.2f, 0.2f, 0.2f, 1.0f );
|
||||
glm::vec4 specular( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
glm::vec4 emissive( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
glm::vec4 diffuse( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
GLint shininess_value = 0;
|
||||
|
||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||
glMateriali ( GL_FRONT_AND_BACK, GL_SHININESS, shininess_value );
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.x );
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.x );
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.x );
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.x );
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool S3D_MATERIAL::SetOpenGLMaterial( unsigned int aMaterialIndex, bool aUseMaterial )
|
||||
{
|
||||
if( aUseMaterial )
|
||||
{
|
||||
float transparency_value = 0.0f;
|
||||
|
||||
if( m_Transparency.size() > aMaterialIndex )
|
||||
{
|
||||
transparency_value = m_Transparency[aMaterialIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_Transparency.size() > 0 )
|
||||
transparency_value = m_Transparency[0];
|
||||
}
|
||||
|
||||
if( m_DiffuseColor.size() > aMaterialIndex )
|
||||
{
|
||||
glm::vec3 color = m_DiffuseColor[aMaterialIndex];
|
||||
|
||||
glColor4f( color.x, color.y, color.z, 1.0f - transparency_value );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_DiffuseColor.size() == 0 )
|
||||
{
|
||||
glColor4f( 0.8f, 0.8f, 0.8f, 1.0f );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_Shininess.size() > 0 )
|
||||
{
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, m_Shininess[0] );
|
||||
}
|
||||
|
||||
// emissive
|
||||
if( m_EmissiveColor.size() > aMaterialIndex )
|
||||
{
|
||||
glm::vec4 emissive;
|
||||
emissive[0] = m_EmissiveColor[aMaterialIndex].x;
|
||||
emissive[1] = m_EmissiveColor[aMaterialIndex].y;
|
||||
emissive[2] = m_EmissiveColor[aMaterialIndex].z;
|
||||
emissive[3] = 1.0f;
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.x );
|
||||
}
|
||||
|
||||
// specular
|
||||
if( m_SpecularColor.size() > aMaterialIndex )
|
||||
{
|
||||
glm::vec4 specular;
|
||||
specular[0] = m_SpecularColor[aMaterialIndex].x;
|
||||
specular[1] = m_SpecularColor[aMaterialIndex].y;
|
||||
specular[2] = m_SpecularColor[aMaterialIndex].z;
|
||||
specular[3] = 1.0f;
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.x );
|
||||
}
|
||||
|
||||
// ambient
|
||||
if( m_AmbientColor.size() > aMaterialIndex )
|
||||
{
|
||||
glm::vec4 ambient;
|
||||
ambient[0] = m_AmbientColor[aMaterialIndex].x;
|
||||
ambient[1] = m_AmbientColor[aMaterialIndex].y;
|
||||
ambient[2] = m_AmbientColor[aMaterialIndex].z;
|
||||
ambient[3] = 1.0f;
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.x );
|
||||
}
|
||||
|
||||
return (transparency_value != 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_DiffuseColor.size() > aMaterialIndex )
|
||||
{
|
||||
glm::vec3 color = m_DiffuseColor[aMaterialIndex];
|
||||
glColor4f( color.x, color.y, color.z, 1.0 );
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014-2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file 3d_material.h
|
||||
*/
|
||||
|
||||
#ifndef STRUCT_3D_MATERIAL_H
|
||||
#define STRUCT_3D_MATERIAL_H
|
||||
|
||||
#include <common.h>
|
||||
#include <base_struct.h>
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <gal/opengl/glm/glm.hpp>
|
||||
|
||||
class S3D_MASTER;
|
||||
|
||||
class S3D_MATERIAL : public EDA_ITEM // openGL "material" data
|
||||
{
|
||||
public:
|
||||
wxString m_Name;
|
||||
|
||||
// Material list
|
||||
std::vector< glm::vec3 > m_AmbientColor;
|
||||
std::vector< glm::vec3 > m_DiffuseColor;
|
||||
std::vector< glm::vec3 > m_EmissiveColor;
|
||||
std::vector< glm::vec3 > m_SpecularColor;
|
||||
std::vector< float > m_Shininess;
|
||||
std::vector< float > m_Transparency;
|
||||
bool m_ColorPerVertex;
|
||||
|
||||
public:
|
||||
S3D_MATERIAL( S3D_MASTER* father, const wxString& name );
|
||||
|
||||
S3D_MATERIAL* Next() const { return (S3D_MATERIAL*) Pnext; }
|
||||
S3D_MATERIAL* Back() const { return (S3D_MATERIAL*) Pback; }
|
||||
|
||||
/**
|
||||
* Initialize the material prms.
|
||||
* @param aMaterialIndex = the index in list of available materials
|
||||
* @param aUseMaterial = true to use the values found in the available material
|
||||
* = false to use only the color, and other prms are fixed
|
||||
* @return true if the material is transparency
|
||||
*/
|
||||
bool SetOpenGLMaterial(unsigned int aMaterialIndex, bool aUseMaterial);
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
||||
#endif
|
||||
|
||||
/** Get class name
|
||||
* @return string "S3D_MATERIAL"
|
||||
*/
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "S3D_MATERIAL" );
|
||||
}
|
||||
};
|
||||
|
||||
void SetOpenGlDefaultMaterial();
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014-2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file 3d_mesh_model.h
|
||||
* @brief
|
||||
*/
|
||||
|
||||
#ifndef __3D_MESH_MODEL_H__
|
||||
#define __3D_MESH_MODEL_H__
|
||||
|
||||
#include <memory>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <vector>
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <gal/opengl/glm/glm.hpp>
|
||||
#include "3d_struct.h"
|
||||
#include "3d_material.h"
|
||||
#include "CBBox.h"
|
||||
|
||||
class S3D_MESH;
|
||||
|
||||
/** A smart pointer to an S3D_MESH object */
|
||||
typedef boost::shared_ptr<S3D_MESH> S3D_MESH_PTR;
|
||||
|
||||
/** A container of smar S3D_MESH object pointers */
|
||||
typedef std::vector<S3D_MESH_PTR> S3D_MESH_PTRS;
|
||||
|
||||
class S3D_MESH
|
||||
{
|
||||
public:
|
||||
|
||||
S3D_MESH();
|
||||
~S3D_MESH();
|
||||
|
||||
void openGL_RenderAllChilds( bool aIsRenderingJustNonTransparentObjects,
|
||||
bool aIsRenderingJustTransparentObjects );
|
||||
|
||||
S3D_MATERIAL *m_Materials;
|
||||
|
||||
// Point and index list
|
||||
std::vector< S3D_VERTEX > m_Point;
|
||||
std::vector< std::vector<int> > m_CoordIndex;
|
||||
std::vector< std::vector<int> > m_NormalIndex;
|
||||
std::vector< S3D_VERTEX > m_PerFaceColor;
|
||||
std::vector< S3D_VERTEX > m_PerFaceNormalsNormalized;
|
||||
std::vector< S3D_VERTEX > m_PerVertexNormalsNormalized;
|
||||
std::vector< int > m_MaterialIndexPerFace;
|
||||
std::vector< std::vector<int> > m_MaterialIndexPerVertex;
|
||||
S3D_MESH_PTRS childs;
|
||||
|
||||
S3D_VERTEX m_translation;
|
||||
glm::vec4 m_rotation;
|
||||
S3D_VERTEX m_scale;
|
||||
|
||||
CBBOX &getBBox();
|
||||
|
||||
private:
|
||||
std::vector< S3D_VERTEX > m_PerFaceNormalsRaw_X_PerFaceSquaredArea;
|
||||
std::vector< std::vector< S3D_VERTEX > > m_PerFaceVertexNormals;
|
||||
std::vector< S3D_VERTEX > m_PointNormalized;
|
||||
|
||||
std::vector< std::vector<int> > m_InvalidCoordIndexes; //!TODO: check for invalid CoordIndex in file and remove the index and the same material index
|
||||
|
||||
bool isPerFaceNormalsComputed;
|
||||
void calcPerFaceNormals ();
|
||||
|
||||
bool isPointNormalizedComputed;
|
||||
void calcPointNormalized();
|
||||
|
||||
bool isPerPointNormalsComputed;
|
||||
void calcPerPointNormals();
|
||||
|
||||
bool isPerVertexNormalsVerified;
|
||||
void perVertexNormalsVerify_and_Repair();
|
||||
|
||||
void calcBBox();
|
||||
void calcBBoxAllChilds();
|
||||
|
||||
CBBOX m_BBox;
|
||||
|
||||
void openGL_Render( bool aIsRenderingJustNonTransparentObjects,
|
||||
bool aIsRenderingJustTransparentObjects );
|
||||
};
|
||||
|
||||
#endif
|
||||
+51
-113
@@ -1,10 +1,9 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -32,33 +31,44 @@
|
||||
#include <common.h>
|
||||
#include <macros.h>
|
||||
#include <kicad_string.h>
|
||||
#include <pgm_base.h>
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <gal/opengl/glm/gtc/matrix_transform.hpp>
|
||||
#include <appl_wxstruct.h>
|
||||
|
||||
#include <3d_viewer.h>
|
||||
#include <info3d_visu.h>
|
||||
#include "3d_struct.h"
|
||||
#include "modelparsers.h"
|
||||
|
||||
// Imported function:
|
||||
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
|
||||
|
||||
S3D_MODEL_PARSER *S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster,
|
||||
|
||||
S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster,
|
||||
const wxString aExtension )
|
||||
{
|
||||
if ( aExtension == wxT( "x3d" ) )
|
||||
{
|
||||
return new X3D_MODEL_PARSER( aMaster );
|
||||
}
|
||||
else if ( aExtension == wxT( "wrl" ) )
|
||||
{
|
||||
return new VRML_MODEL_PARSER( aMaster );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int S3D_MASTER::ReadData( S3D_MODEL_PARSER* aParser )
|
||||
int S3D_MASTER::ReadData()
|
||||
{
|
||||
if( m_Shape3DFullFilename.IsEmpty() || aParser == NULL )
|
||||
return -1;
|
||||
if( m_Shape3DName.IsEmpty() )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
wxString filename = m_Shape3DFullFilename;
|
||||
// Expand any environment variables embedded in footprint's m_Shape3DName field.
|
||||
wxString filename = wxExpandEnvVars( m_Shape3DName );
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
filename.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||
@@ -66,114 +76,42 @@ int S3D_MASTER::ReadData( S3D_MODEL_PARSER* aParser )
|
||||
filename.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
#endif
|
||||
|
||||
if( wxFileName::FileExists( filename ) )
|
||||
if( !wxFileName::FileExists( filename ) )
|
||||
{
|
||||
wxFileName fn( filename );
|
||||
|
||||
if( aParser->Load( filename ) )
|
||||
{
|
||||
// Invalidate bounding boxes
|
||||
m_fastAABBox.Reset();
|
||||
m_BBox.Reset();
|
||||
|
||||
m_parser = aParser;
|
||||
|
||||
return 0;
|
||||
}
|
||||
wxLogDebug( wxT( "3D shape '%s' not found, even tried '%s' after env var substitution." ),
|
||||
GetChars( m_Shape3DName ),
|
||||
GetChars( filename )
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
|
||||
wxLogDebug( wxT( "3D shape '%s' not found, even tried '%s' after env var substitution." ),
|
||||
GetChars( m_Shape3DName ),
|
||||
GetChars( filename ) );
|
||||
wxFileName fn( filename );
|
||||
|
||||
wxString extension = fn.GetExt();
|
||||
S3D_MODEL_PARSER* parser = S3D_MODEL_PARSER::Create( this, extension );
|
||||
|
||||
if( parser )
|
||||
{
|
||||
parser->Load( filename );
|
||||
delete parser;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogDebug( wxT( "Unknown file type '%s'" ), GetChars( extension ) );
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void S3D_MASTER::Render( bool aIsRenderingJustNonTransparentObjects,
|
||||
bool aIsRenderingJustTransparentObjects )
|
||||
int STRUCT_3D_SHAPE::ReadData( FILE* file, int* LineNum )
|
||||
{
|
||||
if( m_parser == NULL )
|
||||
return;
|
||||
char line[512];
|
||||
|
||||
double aVrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
|
||||
while( GetLine( file, line, LineNum, 512 ) )
|
||||
{
|
||||
}
|
||||
|
||||
glScalef( aVrmlunits_to_3Dunits, aVrmlunits_to_3Dunits, aVrmlunits_to_3Dunits );
|
||||
|
||||
glTranslatef( m_MatPosition.x * SCALE_3D_CONV,
|
||||
m_MatPosition.y * SCALE_3D_CONV,
|
||||
m_MatPosition.z * SCALE_3D_CONV );
|
||||
|
||||
glRotatef( -m_MatRotation.z, 0.0f, 0.0f, 1.0f );
|
||||
glRotatef( -m_MatRotation.y, 0.0f, 1.0f, 0.0f );
|
||||
glRotatef( -m_MatRotation.x, 1.0f, 0.0f, 0.0f );
|
||||
|
||||
glScalef( m_MatScale.x, m_MatScale.y, m_MatScale.z );
|
||||
|
||||
for( unsigned int idx = 0; idx < m_parser->childs.size(); idx++ )
|
||||
m_parser->childs[idx]->openGL_RenderAllChilds( aIsRenderingJustNonTransparentObjects,
|
||||
aIsRenderingJustTransparentObjects );
|
||||
}
|
||||
|
||||
|
||||
CBBOX &S3D_MASTER::getBBox( )
|
||||
{
|
||||
if( !m_BBox.IsInitialized() )
|
||||
calcBBox();
|
||||
|
||||
return m_BBox;
|
||||
}
|
||||
|
||||
|
||||
CBBOX &S3D_MASTER::getFastAABBox( )
|
||||
{
|
||||
if( !m_fastAABBox.IsInitialized() )
|
||||
calcBBox();
|
||||
|
||||
return m_fastAABBox;
|
||||
}
|
||||
|
||||
|
||||
void S3D_MASTER::calcBBox()
|
||||
{
|
||||
if( m_parser == NULL )
|
||||
return;
|
||||
|
||||
bool firstBBox = true;
|
||||
|
||||
for( unsigned int idx = 0; idx < m_parser->childs.size(); idx++ )
|
||||
if( firstBBox )
|
||||
{
|
||||
firstBBox = false;
|
||||
m_BBox = m_parser->childs[idx]->getBBox();
|
||||
}
|
||||
else
|
||||
m_BBox.Union( m_parser->childs[idx]->getBBox() );
|
||||
|
||||
// Calc transformation matrix to apply in AABBox
|
||||
|
||||
float aVrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
|
||||
|
||||
glm::mat4 fullTransformMatrix;
|
||||
|
||||
fullTransformMatrix = glm::scale( glm::mat4(), S3D_VERTEX( aVrmlunits_to_3Dunits,
|
||||
aVrmlunits_to_3Dunits,
|
||||
aVrmlunits_to_3Dunits ) );
|
||||
|
||||
fullTransformMatrix = glm::translate( fullTransformMatrix, S3D_VERTEX( m_MatPosition.x * SCALE_3D_CONV,
|
||||
m_MatPosition.y * SCALE_3D_CONV,
|
||||
m_MatPosition.z * SCALE_3D_CONV) );
|
||||
|
||||
if( m_MatRotation.z != 0.0 )
|
||||
fullTransformMatrix = glm::rotate( fullTransformMatrix, glm::radians(-(float)m_MatRotation.z), S3D_VERTEX( 0.0f, 0.0f, 1.0f ) );
|
||||
if( m_MatRotation.y != 0.0 )
|
||||
fullTransformMatrix = glm::rotate( fullTransformMatrix, glm::radians(-(float)m_MatRotation.y), S3D_VERTEX( 0.0f, 1.0f, 0.0f ) );
|
||||
if( m_MatRotation.x != 0.0 )
|
||||
fullTransformMatrix = glm::rotate( fullTransformMatrix, glm::radians(-(float)m_MatRotation.x), S3D_VERTEX( 1.0f, 0.0f, 0.0f ) );
|
||||
|
||||
fullTransformMatrix = glm::scale( fullTransformMatrix, S3D_VERTEX( m_MatScale.x, m_MatScale.y, m_MatScale.z ) );
|
||||
|
||||
// Apply transformation
|
||||
m_fastAABBox = m_BBox;
|
||||
m_fastAABBox.ApplyTransformationAA( fullTransformMatrix );
|
||||
return -1;
|
||||
}
|
||||
|
||||
+96
-92
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014-2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
@@ -33,25 +32,71 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <base_struct.h>
|
||||
#include <3d_material.h>
|
||||
#include <3d_types.h>
|
||||
#include <CBBox.h>
|
||||
|
||||
|
||||
/* 3D modeling units -> PCB units conversion scale:
|
||||
* 1 "3D model unit" wings3d = 1 unit = 2.54 mm = 0.1 inch = 100 mils
|
||||
*/
|
||||
#define UNITS3D_TO_UNITSPCB (IU_PER_MILS * 100)
|
||||
|
||||
|
||||
class S3D_MASTER;
|
||||
class STRUCT_3D_SHAPE;
|
||||
class S3D_MODEL_PARSER;
|
||||
|
||||
// Master structure for a 3D footprint shape description
|
||||
/* S3D_VERTEX manages a 3D coordinate (3 float numbers: x,y,z coordinates)*/
|
||||
class S3D_VERTEX
|
||||
{
|
||||
public:
|
||||
double x, y, z;
|
||||
|
||||
public:
|
||||
S3D_VERTEX()
|
||||
{
|
||||
x = y = z = 0.0;
|
||||
}
|
||||
|
||||
S3D_VERTEX( double px, double py, double pz)
|
||||
{
|
||||
x = px;
|
||||
y = py;
|
||||
z = pz;
|
||||
}
|
||||
};
|
||||
|
||||
class S3D_MATERIAL : public EDA_ITEM /* openGL "material" data*/
|
||||
{
|
||||
public:
|
||||
wxString m_Name;
|
||||
S3D_VERTEX m_DiffuseColor;
|
||||
S3D_VERTEX m_EmissiveColor;
|
||||
S3D_VERTEX m_SpecularColor;
|
||||
float m_AmbientIntensity;
|
||||
float m_Transparency;
|
||||
float m_Shininess;
|
||||
|
||||
public:
|
||||
S3D_MATERIAL( S3D_MASTER* father, const wxString& name );
|
||||
|
||||
S3D_MATERIAL* Next() const { return (S3D_MATERIAL*) Pnext; }
|
||||
S3D_MATERIAL* Back() const { return (S3D_MATERIAL*) Pback; }
|
||||
|
||||
void SetMaterial();
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/* Master structure for a 3D item description */
|
||||
class S3D_MASTER : public EDA_ITEM
|
||||
{
|
||||
public:
|
||||
S3DPOINT m_MatScale; ///< a scaling factor for the entire 3D footprint shape
|
||||
S3DPOINT m_MatRotation; ///< a grotation for the entire 3D footprint shape
|
||||
S3DPOINT m_MatPosition; ///< an offset for the entire 3D footprint shape
|
||||
STRUCT_3D_SHAPE* m_3D_Drawings; ///< the list of basic shapes
|
||||
S3D_MATERIAL* m_Materials; ///< the list of materiels used by the shapes
|
||||
S3D_MODEL_PARSER* m_parser; ///< it store the loaded file to be rendered later
|
||||
S3D_VERTEX m_MatScale;
|
||||
S3D_VERTEX m_MatRotation;
|
||||
S3D_VERTEX m_MatPosition;
|
||||
STRUCT_3D_SHAPE* m_3D_Drawings;
|
||||
S3D_MATERIAL* m_Materials;
|
||||
|
||||
enum FILE3D_TYPE
|
||||
{
|
||||
@@ -61,19 +106,9 @@ public:
|
||||
FILE3D_UNKNOWN
|
||||
};
|
||||
|
||||
// Check defaults in S3D_MASTER
|
||||
bool m_use_modelfile_diffuseColor;
|
||||
bool m_use_modelfile_emissiveColor;
|
||||
bool m_use_modelfile_specularColor;
|
||||
bool m_use_modelfile_ambientIntensity;
|
||||
bool m_use_modelfile_transparency;
|
||||
bool m_use_modelfile_shininess;
|
||||
|
||||
private:
|
||||
wxString m_Shape3DName; ///< The 3D shape filename in 3D library
|
||||
FILE3D_TYPE m_ShapeType; ///< Shape type based on filename extension
|
||||
wxString m_Shape3DFullFilename; ///< Full file path name
|
||||
wxString m_Shape3DNameExtension; ///< Extension of the shape file name
|
||||
wxString m_Shape3DName; /* 3D shape name in 3D library */
|
||||
FILE3D_TYPE m_ShapeType;
|
||||
|
||||
public:
|
||||
S3D_MASTER( EDA_ITEM* aParent );
|
||||
@@ -82,29 +117,16 @@ public:
|
||||
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
|
||||
S3D_MASTER* Back() const { return (S3D_MASTER*) Pback; }
|
||||
|
||||
// Accessors
|
||||
void Insert( S3D_MATERIAL* aMaterial );
|
||||
void Insert( S3D_MATERIAL* aMaterial )
|
||||
{
|
||||
aMaterial->SetNext( m_Materials );
|
||||
m_Materials = aMaterial;
|
||||
}
|
||||
|
||||
|
||||
void Copy( S3D_MASTER* pattern );
|
||||
|
||||
/**
|
||||
* Function ReadData
|
||||
* Select the parser to read the 3D data file (vrml, x3d ...)
|
||||
* and build the description objects list
|
||||
* @param aParser the parser that should be used to read model data and stored in
|
||||
*/
|
||||
int ReadData( S3D_MODEL_PARSER* aParser );
|
||||
|
||||
void Render( bool aIsRenderingJustNonTransparentObjects,
|
||||
bool aIsRenderingJustTransparentObjects );
|
||||
|
||||
/**
|
||||
* Function ObjectCoordsTo3DUnits
|
||||
* @param aVertices = a list of 3D coordinates in shape units
|
||||
* to convert to 3D canvas units, according to the
|
||||
* footprint 3Dshape rotation, offset and scale parameters
|
||||
*/
|
||||
void ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices );
|
||||
int ReadData();
|
||||
void Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
||||
@@ -122,53 +144,7 @@ public:
|
||||
return m_Shape3DName;
|
||||
}
|
||||
|
||||
/** Get class name
|
||||
* @return string "S3D_MASTER"
|
||||
*/
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "S3D_MASTER" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetShape3DFullFilename
|
||||
* @return the full filename of the 3D shape,
|
||||
* expanding environment variable (if any ) and/or adding default 3D path
|
||||
* given by environment variable KISYS3DMOD
|
||||
*/
|
||||
const wxString GetShape3DFullFilename();
|
||||
|
||||
/**
|
||||
* Function GetShape3DExtension
|
||||
* @return the extension of the filename of the 3D shape,
|
||||
*/
|
||||
const wxString GetShape3DExtension();
|
||||
|
||||
/**
|
||||
* Function SetShape3DName
|
||||
* @param aShapeName = file name of the data file relative to the 3D shape
|
||||
*
|
||||
* Set the filename of the 3D shape, and depending on the file extention
|
||||
* (vrl, x3d, idf ) the type of file.
|
||||
*/
|
||||
void SetShape3DName( const wxString& aShapeName );
|
||||
|
||||
/**
|
||||
* Function getBBox Model Space Bouding Box
|
||||
* @return return the model space bouding box
|
||||
*/
|
||||
CBBOX &getBBox();
|
||||
|
||||
/**
|
||||
* Function getFastAABBox
|
||||
* @return return the Axis Align Bounding Box of the other bouding boxes
|
||||
*/
|
||||
CBBOX &getFastAABBox();
|
||||
|
||||
private:
|
||||
void calcBBox();
|
||||
CBBOX m_BBox; ///< Model oriented Bouding Box
|
||||
CBBOX m_fastAABBox; ///< Axis Align Bounding Box that contain the other bounding boxes
|
||||
};
|
||||
|
||||
|
||||
@@ -187,9 +163,37 @@ public:
|
||||
STRUCT_3D_SHAPE* Next() const { return (STRUCT_3D_SHAPE*) Pnext; }
|
||||
STRUCT_3D_SHAPE* Back() const { return (STRUCT_3D_SHAPE*) Pback; }
|
||||
|
||||
int ReadData( FILE* file, int* LineNum );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class VERTEX_VALUE_CTRL
|
||||
* displays a vertex for editing. A vertex is a triplet of values
|
||||
* Values can be scale, rotation, offset...
|
||||
*/
|
||||
class VERTEX_VALUE_CTRL
|
||||
{
|
||||
private:
|
||||
wxTextCtrl* m_XValueCtrl, * m_YValueCtrl, * m_ZValueCtrl;
|
||||
|
||||
public:
|
||||
VERTEX_VALUE_CTRL( wxWindow* parent, wxBoxSizer* BoxSizer );
|
||||
|
||||
~VERTEX_VALUE_CTRL();
|
||||
|
||||
/**
|
||||
* Function GetValue
|
||||
* @return the vertex in internal units.
|
||||
*/
|
||||
S3D_VERTEX GetValue();
|
||||
void SetValue( S3D_VERTEX vertex );
|
||||
void Enable( bool enbl );
|
||||
void SetToolTip( const wxString& text );
|
||||
};
|
||||
|
||||
#endif // STRUCT_3D_H
|
||||
|
||||
+49
-157
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2013 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
|
||||
@@ -51,11 +51,15 @@ void EDA_3D_FRAME::ReCreateMainToolbar()
|
||||
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
||||
KiBitmap( import3d_xpm ), _( "Reload board" ) );
|
||||
|
||||
#if (defined(__WINDOWS__) || defined(__APPLE__ ) )
|
||||
|
||||
// Does not work properly under linux
|
||||
m_mainToolBar->AddSeparator();
|
||||
|
||||
m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
||||
KiBitmap( copy_button_xpm ),
|
||||
_( "Copy 3D image to clipboard" ) );
|
||||
_( "Copy 3D Image to Clipboard" ) );
|
||||
#endif
|
||||
|
||||
m_mainToolBar->AddSeparator();
|
||||
|
||||
@@ -134,158 +138,74 @@ void EDA_3D_FRAME::CreateMenuBar()
|
||||
|
||||
menuBar->Append( fileMenu, _( "&File" ) );
|
||||
|
||||
AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_PNG,
|
||||
_( "Create Image (png format)" ),
|
||||
KiBitmap( export_xpm ) );
|
||||
AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_JPEG,
|
||||
_( "Create Image (jpeg format)" ),
|
||||
KiBitmap( export_xpm ) );
|
||||
fileMenu->Append( ID_MENU_SCREENCOPY_PNG, _( "Create Image (png format)" ) );
|
||||
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG, _( "Create Image (jpeg format)" ) );
|
||||
|
||||
#if (defined(__WINDOWS__) || defined(__APPLE__ ) )
|
||||
// Does not work properly under linux
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Append( ID_TOOL_SCREENCOPY_TOCLIBBOARD, _( "Copy 3D Image to Clipboard" ) );
|
||||
#endif
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
AddMenuItem( fileMenu, ID_TOOL_SCREENCOPY_TOCLIBBOARD,
|
||||
_( "Copy 3D Image to Clipboard" ),
|
||||
KiBitmap( copy_button_xpm ) );
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
AddMenuItem( fileMenu, wxID_EXIT,
|
||||
_( "&Exit" ),
|
||||
KiBitmap( exit_xpm ) );
|
||||
fileMenu->Append( wxID_EXIT, _( "&Exit" ) );
|
||||
|
||||
menuBar->Append( prefsMenu, _( "&Preferences" ) );
|
||||
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_REALISTIC_MODE,
|
||||
_( "Realistic Mode" ),
|
||||
KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
|
||||
|
||||
wxMenu * renderOptionsMenu = new wxMenu;
|
||||
AddMenuItem( prefsMenu, renderOptionsMenu, ID_MENU3D_COLOR,
|
||||
_( "Render Options" ), KiBitmap( tools_xpm ) );
|
||||
|
||||
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_SHADOWS,
|
||||
_( "Render Shadows" ),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES,
|
||||
_( "Show Holes in Zones" ),
|
||||
_( "Holes inside a copper layer copper zones are shown, "
|
||||
"but the calculation time is longer" ),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_TEXTURES,
|
||||
_( "Render Textures" ),
|
||||
_( "Apply a grid/cloud textures to board, solder mask and silk screen" ),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_SMOOTH_NORMALS,
|
||||
_( "Render Smooth Normals" ),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_USE_MODEL_NORMALS,
|
||||
_( "Use Model Normals" ),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_MATERIAL,
|
||||
_( "Render Material Properties" ),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( renderOptionsMenu, ID_MENU3D_FL_RENDER_SHOW_MODEL_BBOX,
|
||||
_( "Show Model Bounding Boxes" ),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
|
||||
_( "Realistic Mode" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
|
||||
prefsMenu->AppendSeparator();
|
||||
|
||||
// Add submenu set Colors
|
||||
wxMenu * setColorMenu = new wxMenu;
|
||||
AddMenuItem( prefsMenu, setColorMenu, ID_MENU3D_COLOR,
|
||||
_( "Choose Colors" ), KiBitmap( palette_xpm ) );
|
||||
|
||||
wxMenu * setBgColorMenu = new wxMenu;
|
||||
AddMenuItem( setColorMenu, setBgColorMenu, ID_MENU3D_BGCOLOR,
|
||||
_( "Background Color" ), KiBitmap( palette_xpm ) );
|
||||
|
||||
AddMenuItem( setBgColorMenu, ID_MENU3D_BGCOLOR_TOP_SELECTION,
|
||||
_( "Background Top Color" ), KiBitmap( setcolor_3d_bg_xpm ) );
|
||||
|
||||
AddMenuItem( setBgColorMenu, ID_MENU3D_BGCOLOR_BOTTOM_SELECTION,
|
||||
_( "Background Bottom Color" ), KiBitmap( setcolor_3d_bg_xpm ) );
|
||||
|
||||
AddMenuItem( setColorMenu, ID_MENU3D_SILKSCREEN_COLOR_SELECTION,
|
||||
_( "Silkscreen Color" ), KiBitmap( setcolor_silkscreen_xpm ) );
|
||||
|
||||
AddMenuItem( setColorMenu, ID_MENU3D_SOLDERMASK_COLOR_SELECTION,
|
||||
_( "Solder Mask Color" ), KiBitmap( setcolor_soldermask_xpm ) );
|
||||
|
||||
AddMenuItem( setColorMenu, ID_MENU3D_SOLDERPASTE_COLOR_SELECTION,
|
||||
_( "Solder Paste Color" ), KiBitmap( setcolor_solderpaste_xpm ) );
|
||||
|
||||
AddMenuItem( setColorMenu, ID_MENU3D_COPPER_COLOR_SELECTION,
|
||||
_( "Copper/Surface Finish Color" ), KiBitmap( setcolor_copper_xpm ) );
|
||||
|
||||
AddMenuItem( setColorMenu, ID_MENU3D_PCB_BODY_COLOR_SELECTION,
|
||||
_( "Board Body Color" ), KiBitmap( setcolor_board_body_xpm ) );
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_BGCOLOR_SELECTION,
|
||||
_( "Choose background color" ), KiBitmap( palette_xpm ) );
|
||||
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_AXIS_ONOFF,
|
||||
_( "Show 3D &Axis" ), KiBitmap( axis3d_front_xpm ), wxITEM_CHECK );
|
||||
_( "Show 3D &Axis" ), KiBitmap( axis3d_front_xpm ), wxITEM_CHECK );
|
||||
|
||||
// Creates grid menu
|
||||
wxMenu * gridlistMenu = new wxMenu;
|
||||
AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID,
|
||||
_( "3D Grid" ), KiBitmap( grid_xpm ) );
|
||||
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString );
|
||||
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString );
|
||||
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString );
|
||||
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString );
|
||||
gridlistMenu->AppendCheckItem( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString );
|
||||
gridlistMenu->Append( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString, true );
|
||||
gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );
|
||||
|
||||
// If the grid is on, check the corresponding menuitem showing the grid size
|
||||
if( IsEnabled( FL_GRID ) )
|
||||
{
|
||||
gridlistMenu->Check( ID_MENU3D_GRID_10_MM, GetPrm3DVisu().m_3D_Grid == 10.0 );
|
||||
gridlistMenu->Check( ID_MENU3D_GRID_5_MM, GetPrm3DVisu().m_3D_Grid == 5.0 );
|
||||
gridlistMenu->Check( ID_MENU3D_GRID_2P5_MM, GetPrm3DVisu().m_3D_Grid == 2.5 );
|
||||
gridlistMenu->Check( ID_MENU3D_GRID_1_MM, GetPrm3DVisu().m_3D_Grid == 1.0 );
|
||||
}
|
||||
else
|
||||
gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );
|
||||
gridlistMenu->Append( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString, true );
|
||||
gridlistMenu->Append( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString, true );
|
||||
gridlistMenu->Append( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString, true );
|
||||
gridlistMenu->Append( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString, true );
|
||||
|
||||
prefsMenu->AppendSeparator();
|
||||
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_SHOW_BOARD_BODY,
|
||||
_( "Show Board Bod&y" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
|
||||
_( "Show Board Body" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_USE_COPPER_THICKNESS,
|
||||
_( "Show Copper &Thickness" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
|
||||
_( "Show Copper Thickness" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_MODULE_ONOFF,
|
||||
_( "Show 3D M&odels" ), KiBitmap( shape_3d_xpm ), wxITEM_CHECK );
|
||||
_( "Show 3D F&ootprints" ), KiBitmap( shape_3d_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_ZONE_ONOFF,
|
||||
_( "Show Zone &Filling" ), KiBitmap( add_zone_xpm ), wxITEM_CHECK );
|
||||
|
||||
prefsMenu->AppendSeparator();
|
||||
|
||||
wxMenu * layersMenu = new wxMenu;
|
||||
AddMenuItem( prefsMenu, layersMenu, ID_MENU3D_LAYERS,
|
||||
_( "Show &Layers" ), KiBitmap( tools_xpm ) );
|
||||
|
||||
AddMenuItem( layersMenu, ID_MENU3D_ADHESIVE_ONOFF,
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_ADHESIVE_ONOFF,
|
||||
_( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( layersMenu, ID_MENU3D_SILKSCREEN_ONOFF,
|
||||
_( "Show &Silkscreen Layers" ), KiBitmap( add_text_xpm ), wxITEM_CHECK );
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_SILKSCREEN_ONOFF,
|
||||
_( "Show &Silkscreen Layer" ), KiBitmap( add_text_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( layersMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
|
||||
_( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( layersMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
|
||||
_( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
|
||||
|
||||
// Other layers are not "board" layers, and are not shown in realistic mode
|
||||
// These menus will be disabled in in realistic mode
|
||||
AddMenuItem( layersMenu, ID_MENU3D_COMMENTS_ONOFF,
|
||||
_( "Show &Comments and Drawing Layers" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_COMMENTS_ONOFF,
|
||||
_( "Show &Comments and Drawings Layer" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
|
||||
|
||||
AddMenuItem( layersMenu, ID_MENU3D_ECO_ONOFF,
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_ECO_ONOFF,
|
||||
_( "Show &Eco Layers" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
|
||||
|
||||
SetMenuBar( menuBar );
|
||||
@@ -302,68 +222,40 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
|
||||
wxMenuItem* item;
|
||||
// Set the state of toggle menus according to the current display options
|
||||
item = menuBar->FindItem( ID_MENU3D_REALISTIC_MODE );
|
||||
item->Check( GetPrm3DVisu().IsRealisticMode() );
|
||||
item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF );
|
||||
item->Enable( !GetPrm3DVisu().IsRealisticMode() );
|
||||
item = menuBar->FindItem( ID_MENU3D_ECO_ONOFF );
|
||||
item->Enable( !GetPrm3DVisu().IsRealisticMode() );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_SHADOWS );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_RENDER_SHADOWS ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_SHADOWS );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_RENDER_SHADOWS ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_RENDER_SHOW_HOLES_IN_ZONES ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_TEXTURES );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_RENDER_TEXTURES ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_SMOOTH_NORMALS );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_RENDER_SMOOTH_NORMALS ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_USE_MODEL_NORMALS );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_RENDER_USE_MODEL_NORMALS ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_MATERIAL );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_RENDER_MATERIAL ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_SHOW_MODEL_BBOX );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_RENDER_SHOW_MODEL_BBOX ) );
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_USE_REALISTIC_MODE ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_SHOW_BOARD_BODY );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_SHOW_BOARD_BODY ) );
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_USE_COPPER_THICKNESS );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_USE_COPPER_THICKNESS ) );
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_USE_COPPER_THICKNESS ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_MODULE_ONOFF );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_MODULE ) );
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_MODULE ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_ZONE_ONOFF );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_ZONE ) );
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_ZONE ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_AXIS_ONOFF );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_AXIS ) );
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_AXIS ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_ADHESIVE_ONOFF );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_ADHESIVE ) );
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_ADHESIVE ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_SILKSCREEN_ONOFF );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_SILKSCREEN ) );
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_SILKSCREEN ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_SOLDER_MASK_ONOFF );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_SOLDERMASK ) );
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_SOLDERMASK ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_SOLDER_PASTE_ONOFF );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_SOLDERPASTE ) );
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_SOLDERPASTE ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_COMMENTS ) );
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_COMMENTS ) );
|
||||
|
||||
item = menuBar->FindItem( ID_MENU3D_ECO_ONOFF );
|
||||
item->Check( GetPrm3DVisu().GetFlag( FL_ECO ));
|
||||
item->Check(g_Parm_3D_Visu.GetFlag( FL_ECO ));
|
||||
}
|
||||
|
||||
void EDA_3D_FRAME::SetToolbars()
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file 3d_types.h
|
||||
*/
|
||||
|
||||
#ifndef _3D_TYPES_H_
|
||||
#define _3D_TYPES_H_
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <gal/opengl/glm/glm.hpp>
|
||||
#include <base_units.h> // for IU_PER_MILS
|
||||
|
||||
|
||||
/**
|
||||
* @note For historical reasons the 3D modeling unit is 0.1 inch
|
||||
* 1 3Dunit = 2.54 mm = 0.1 inch = 100 mils
|
||||
*/
|
||||
#define UNITS3D_TO_UNITSPCB (IU_PER_MILS * 100)
|
||||
|
||||
|
||||
/**
|
||||
* scaling factor for 3D shape offset ( S3D_MASTER::m_MatPosition member )
|
||||
* Was in inches in legacy version, and, due to a mistake, still in inches
|
||||
* in .kicad_pcb files (which are using mm)
|
||||
* so this scaling convert file units (inch) to 3D units (0.1 inch), only
|
||||
* for S3D_MASTER::m_MatPosition parameter
|
||||
*/
|
||||
#define SCALE_3D_CONV 10
|
||||
|
||||
|
||||
// S3D_VERTEX manages a opengl 3D coordinate (3 float numbers: x,y,z coordinates)
|
||||
// float are widely used in opengl functions.
|
||||
// they are used here in coordinates which are also used in opengl functions.
|
||||
#define S3D_VERTEX glm::vec3
|
||||
|
||||
|
||||
// S3DPOINT manages a set of 3 double values (x,y,z )
|
||||
// It is used for values which are not directly used in opengl functions.
|
||||
// It is used in dialogs, or when reading/writing files for instance
|
||||
class S3DPOINT
|
||||
{
|
||||
public:
|
||||
double x, y, z;
|
||||
|
||||
public:
|
||||
S3DPOINT()
|
||||
{
|
||||
x = y = z = 0.0;
|
||||
}
|
||||
|
||||
S3DPOINT( double px, double py, double pz)
|
||||
{
|
||||
x = px;
|
||||
y = py;
|
||||
z = pz;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class S3DPOINT_VALUE_CTRL
|
||||
* displays a S3DPOINT for editing (in dialogs). A S3DPOINT is a triplet of values
|
||||
* Values can be scale, rotation, offset...
|
||||
*/
|
||||
class S3DPOINT_VALUE_CTRL
|
||||
{
|
||||
private:
|
||||
wxTextCtrl* m_XValueCtrl, * m_YValueCtrl, * m_ZValueCtrl;
|
||||
|
||||
public:
|
||||
S3DPOINT_VALUE_CTRL( wxWindow* parent, wxBoxSizer* BoxSizer );
|
||||
|
||||
~S3DPOINT_VALUE_CTRL();
|
||||
|
||||
/**
|
||||
* Function GetValue
|
||||
* @return the 3D point in internal units.
|
||||
*/
|
||||
S3DPOINT GetValue();
|
||||
void SetValue( S3DPOINT a3Dpoint );
|
||||
void Enable( bool enbl );
|
||||
void SetToolTip( const wxString& text );
|
||||
};
|
||||
|
||||
#endif // 3D_TYPES_H
|
||||
+26
-93
@@ -30,50 +30,50 @@
|
||||
#ifndef __3D_VIEWER_H__
|
||||
#define __3D_VIEWER_H__
|
||||
|
||||
#include <draw_frame.h>
|
||||
#include <wxstruct.h> // for EDA_BASE_FRAME.
|
||||
|
||||
#if !wxUSE_GLCANVAS
|
||||
#error Please build wxWidgets with Opengl support (./configure --with-opengl)
|
||||
#endif
|
||||
|
||||
#include <wx/glcanvas.h>
|
||||
|
||||
#ifdef __WXMAC__
|
||||
# ifdef __DARWIN__
|
||||
# include <OpenGL/glu.h>
|
||||
# else
|
||||
# include <glu.h>
|
||||
# endif
|
||||
#else
|
||||
# include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
#include <3d_struct.h>
|
||||
#include <info3d_visu.h>
|
||||
|
||||
/// A variable name whose value holds the path of 3D shape files.
|
||||
/// Currently an environment variable, eventually a project variable.
|
||||
#define KISYS3DMOD wxT( "KISYS3DMOD" )
|
||||
|
||||
/// All 3D files are expected to be stored in LIB3D_FOLDER, or one of
|
||||
/// its subdirectory.
|
||||
#define LIB3D_FOLDER wxT( "packages3d" )
|
||||
|
||||
class EDA_3D_CANVAS;
|
||||
class PCB_BASE_FRAME;
|
||||
class wxColourData;
|
||||
|
||||
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE (wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS)
|
||||
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
|
||||
#define LIB3D_PATH wxT( "packages3d" )
|
||||
|
||||
|
||||
class EDA_3D_FRAME : public KIWAY_PLAYER
|
||||
class EDA_3D_FRAME : public EDA_BASE_FRAME
|
||||
{
|
||||
private:
|
||||
EDA_3D_CANVAS* m_canvas;
|
||||
bool m_reloadRequest;
|
||||
wxString m_defaultFileName; /// Filename to propose for screenshot
|
||||
|
||||
/// Tracks whether to use Orthographic or Perspective projection
|
||||
bool m_ortho;
|
||||
|
||||
public:
|
||||
EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent, const wxString& aTitle,
|
||||
EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title,
|
||||
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
|
||||
~EDA_3D_FRAME()
|
||||
{
|
||||
m_auimgr.UnInit();
|
||||
};
|
||||
|
||||
~EDA_3D_FRAME();
|
||||
|
||||
PCB_BASE_FRAME* Parent() const { return (PCB_BASE_FRAME*)GetParent(); }
|
||||
|
||||
BOARD* GetBoard();
|
||||
PCB_BASE_FRAME* Parent() { return (PCB_BASE_FRAME*)GetParent(); }
|
||||
|
||||
/**
|
||||
* Function ReloadRequest
|
||||
@@ -90,10 +90,8 @@ public:
|
||||
* Function NewDisplay
|
||||
* Rebuild the display list.
|
||||
* must be called when 3D opengl data is modified
|
||||
* @param aGlList = the list to rebuild.
|
||||
* if 0 (default) all lists are rebuilt
|
||||
*/
|
||||
void NewDisplay( int aGlList = 0 );
|
||||
void NewDisplay();
|
||||
|
||||
void SetDefaultFileName(const wxString &aFn) { m_defaultFileName = aFn; }
|
||||
const wxString &GetDefaultFileName() const { return m_defaultFileName; }
|
||||
@@ -101,21 +99,9 @@ public:
|
||||
/// Toggles orthographic projection on and off
|
||||
void ToggleOrtho(){ m_ortho = !m_ortho ; Refresh(true);};
|
||||
|
||||
/// @return the orthographic projection flag
|
||||
/// Returns the orthographic projection flag
|
||||
bool ModeIsOrtho() { return m_ortho ;};
|
||||
|
||||
/** @return the INFO3D_VISU which contains the current parameters
|
||||
* to draw the 3D view og the board
|
||||
*/
|
||||
INFO3D_VISU& GetPrm3DVisu() const;
|
||||
|
||||
/**
|
||||
* @return true if aItem must be displayed
|
||||
* @param aItem = an item of DISPLAY3D_FLG enum
|
||||
*/
|
||||
bool IsEnabled( DISPLAY3D_FLG aItem ) const;
|
||||
|
||||
|
||||
private:
|
||||
// Event handlers:
|
||||
void Exit3DFrame( wxCommandEvent& event );
|
||||
@@ -132,9 +118,8 @@ private:
|
||||
// to the current display options
|
||||
void ReCreateMainToolbar();
|
||||
void SetToolbars();
|
||||
|
||||
void LoadSettings( wxConfigBase* aCfg ); // overload virtual
|
||||
void SaveSettings( wxConfigBase* aCfg ); // overload virtual
|
||||
void GetSettings();
|
||||
void SaveSettings();
|
||||
|
||||
// Other functions
|
||||
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
||||
@@ -143,59 +128,7 @@ private:
|
||||
double BestZoom();
|
||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
||||
|
||||
/**
|
||||
* Function Set3DColorFromUser
|
||||
* Get a S3D_COLOR from a wx colour dialog
|
||||
* @param aColor is the S3D_COLOR to change
|
||||
* @param aTitle is the title displayed in the colordialog selector
|
||||
* @param aPredefinedColors is a reference to a wxColourData
|
||||
* which contains a few predefined colors
|
||||
* if it is NULL, no predefined colors are used
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
*/
|
||||
bool Set3DColorFromUser( S3D_COLOR &aColor, const wxString& aTitle,
|
||||
wxColourData* aPredefinedColors = NULL );
|
||||
|
||||
/**
|
||||
* Function Set3DSolderMaskColorFromUser
|
||||
* Set the solder mask color from a set of colors
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
*/
|
||||
bool Set3DSolderMaskColorFromUser();
|
||||
|
||||
/**
|
||||
* Function Set3DSolderPasteColorFromUser
|
||||
* Set the solder mask color from a set of colors
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
*/
|
||||
bool Set3DSolderPasteColorFromUser();
|
||||
|
||||
/**
|
||||
* Function Set3DCopperColorFromUser
|
||||
* Set the copper color from a set of colors
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
*/
|
||||
bool Set3DCopperColorFromUser();
|
||||
|
||||
/**
|
||||
* Function Set3DBoardBodyBodyColorFromUser
|
||||
* Set the copper color from a set of colors
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
*/
|
||||
bool Set3DBoardBodyColorFromUser();
|
||||
|
||||
/**
|
||||
* Function Set3DSilkScreenColorFromUser
|
||||
* Set the silkscreen color from a set of colors
|
||||
* @return true if a new color is chosen, false if
|
||||
* no change or aborted by user
|
||||
*/
|
||||
bool Set3DSilkScreenColorFromUser();
|
||||
void Set3DBgColor();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
@@ -8,15 +8,13 @@
|
||||
* Please add IDs that are unique to the 3D viewer here and not in the global
|
||||
* id.h file. This will prevent the entire project from being rebuilt when
|
||||
* adding new commands to the 3D viewer.
|
||||
* However the number of IDs should be < ROOM_FOR_3D_VIEWER, defined in id.h
|
||||
* Please change the value of ROOM_FOR_3D_VIEWER if too small.
|
||||
*/
|
||||
|
||||
#include <id.h> // Generic Id.
|
||||
#include <id.h> // Generic Id.
|
||||
|
||||
enum id_3dview_frm
|
||||
{
|
||||
ID_START_COMMAND_3D = ID_KICAD_3D_VIEWER_START,
|
||||
ID_START_COMMAND_3D = ID_END_LIST,
|
||||
ID_ROTATE3D_X_NEG,
|
||||
ID_ROTATE3D_X_POS,
|
||||
ID_ROTATE3D_Y_NEG,
|
||||
@@ -30,20 +28,11 @@ enum id_3dview_frm
|
||||
ID_MOVE3D_UP,
|
||||
ID_MOVE3D_DOWN,
|
||||
ID_ORTHO,
|
||||
ID_MENU3D_COLOR,
|
||||
ID_MENU3D_BGCOLOR,
|
||||
ID_MENU3D_BGCOLOR_BOTTOM_SELECTION,
|
||||
ID_MENU3D_BGCOLOR_TOP_SELECTION,
|
||||
ID_MENU3D_SILKSCREEN_COLOR_SELECTION,
|
||||
ID_MENU3D_SOLDERMASK_COLOR_SELECTION,
|
||||
ID_MENU3D_SOLDERPASTE_COLOR_SELECTION,
|
||||
ID_MENU3D_PCB_BODY_COLOR_SELECTION,
|
||||
ID_MENU3D_COPPER_COLOR_SELECTION,
|
||||
ID_MENU3D_BGCOLOR_SELECTION,
|
||||
ID_MENU3D_USE_COPPER_THICKNESS,
|
||||
ID_MENU3D_AXIS_ONOFF,
|
||||
ID_MENU3D_MODULE_ONOFF,
|
||||
ID_MENU3D_ZONE_ONOFF,
|
||||
ID_MENU3D_LAYERS,
|
||||
ID_MENU3D_ADHESIVE_ONOFF,
|
||||
ID_MENU3D_SILKSCREEN_ONOFF,
|
||||
ID_MENU3D_SOLDER_PASTE_ONOFF,
|
||||
@@ -52,13 +41,6 @@ enum id_3dview_frm
|
||||
ID_MENU3D_ECO_ONOFF,
|
||||
ID_MENU3D_SHOW_BOARD_BODY,
|
||||
ID_MENU3D_REALISTIC_MODE,
|
||||
ID_MENU3D_FL_RENDER_SHADOWS,
|
||||
ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES,
|
||||
ID_MENU3D_FL_RENDER_TEXTURES,
|
||||
ID_MENU3D_FL_RENDER_SMOOTH_NORMALS,
|
||||
ID_MENU3D_FL_RENDER_USE_MODEL_NORMALS,
|
||||
ID_MENU3D_FL_RENDER_MATERIAL,
|
||||
ID_MENU3D_FL_RENDER_SHOW_MODEL_BBOX,
|
||||
ID_END_COMMAND_3D,
|
||||
|
||||
ID_TOOL_SET_VISIBLE_ITEMS,
|
||||
|
||||
@@ -1,278 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file CBBox.cpp
|
||||
* @brief Bounding Box class implementation
|
||||
*/
|
||||
|
||||
#include "CBBox.h"
|
||||
|
||||
|
||||
// openGL includes used for debug the bounding box
|
||||
#ifdef __WXMAC__
|
||||
# ifdef __DARWIN__
|
||||
# include <OpenGL/glu.h>
|
||||
# else
|
||||
# include <glu.h>
|
||||
# endif
|
||||
#else
|
||||
# include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
CBBOX::CBBOX()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
CBBOX::CBBOX( const S3D_VERTEX &aPbInit )
|
||||
{
|
||||
m_min = aPbInit;
|
||||
m_max = aPbInit;
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
CBBOX::CBBOX( const S3D_VERTEX &aPbMin, const S3D_VERTEX &aPbMax )
|
||||
{
|
||||
Set( aPbMin, aPbMax );
|
||||
}
|
||||
|
||||
CBBOX::~CBBOX()
|
||||
{
|
||||
}
|
||||
|
||||
void CBBOX::Set( const S3D_VERTEX &aPbMin, const S3D_VERTEX &aPbMax )
|
||||
{
|
||||
m_min.x = glm::min( aPbMin.x, aPbMax.x );
|
||||
m_min.y = glm::min( aPbMin.y, aPbMax.y );
|
||||
m_min.z = glm::min( aPbMin.z, aPbMax.z );
|
||||
|
||||
m_max.x = glm::max( aPbMin.x, aPbMax.x );
|
||||
m_max.y = glm::max( aPbMin.y, aPbMax.y );
|
||||
m_max.z = glm::max( aPbMin.z, aPbMax.z );
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
bool CBBOX::IsInitialized() const
|
||||
{
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
void CBBOX::Reset()
|
||||
{
|
||||
m_min = S3D_VERTEX( 0.0f, 0.0f, 0.0f );
|
||||
m_max = S3D_VERTEX( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
void CBBOX::Union( const S3D_VERTEX &aPoint )
|
||||
{
|
||||
if( !m_initialized )
|
||||
{
|
||||
m_initialized = true;
|
||||
// Initialize the bounding box with the given point
|
||||
m_min = aPoint;
|
||||
m_max = aPoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
// get the minimun value between the added point and the existent bounding box
|
||||
m_min.x = glm::min( m_min.x, aPoint.x );
|
||||
m_min.y = glm::min( m_min.y, aPoint.y );
|
||||
m_min.z = glm::min( m_min.z, aPoint.z );
|
||||
|
||||
// get the maximun value between the added point and the existent bounding box
|
||||
m_max.x = glm::max( m_max.x, aPoint.x );
|
||||
m_max.y = glm::max( m_max.y, aPoint.y );
|
||||
m_max.z = glm::max( m_max.z, aPoint.z );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CBBOX::Union( const CBBOX &aBBox )
|
||||
{
|
||||
if( aBBox.m_initialized == false )
|
||||
return;
|
||||
|
||||
if( !m_initialized )
|
||||
{
|
||||
// Initialize the bounding box with the given bounding box
|
||||
m_initialized = true;
|
||||
m_min = aBBox.m_min;
|
||||
m_max = aBBox.m_max;
|
||||
}
|
||||
else
|
||||
{
|
||||
// get the minimun value between the added bounding box and the existent bounding box
|
||||
m_min.x = glm::min( m_min.x, aBBox.m_min.x );
|
||||
m_min.y = glm::min( m_min.y, aBBox.m_min.y );
|
||||
m_min.z = glm::min( m_min.z, aBBox.m_min.z );
|
||||
|
||||
// get the maximun value between the added bounding box and the existent bounding box
|
||||
m_max.x = glm::max( m_max.x, aBBox.m_max.x );
|
||||
m_max.y = glm::max( m_max.y, aBBox.m_max.y );
|
||||
m_max.z = glm::max( m_max.z, aBBox.m_max.z );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
S3D_VERTEX CBBOX::GetCenter() const
|
||||
{
|
||||
return (m_max + m_min) * 0.5f;
|
||||
}
|
||||
|
||||
S3D_VERTEX CBBOX::Min() const
|
||||
{
|
||||
return m_min;
|
||||
}
|
||||
|
||||
S3D_VERTEX CBBOX::Max() const
|
||||
{
|
||||
return m_max;
|
||||
}
|
||||
|
||||
void CBBOX::Scale( float aScale )
|
||||
{
|
||||
if( m_initialized == false )
|
||||
return;
|
||||
|
||||
S3D_VERTEX scaleV = S3D_VERTEX( aScale, aScale, aScale );
|
||||
S3D_VERTEX centerV = GetCenter();
|
||||
|
||||
m_min = (m_min - centerV) * scaleV + centerV;
|
||||
m_max = (m_max - centerV) * scaleV + centerV;
|
||||
}
|
||||
|
||||
|
||||
bool CBBOX::OverlapsBox( const CBBOX &aBBox ) const
|
||||
{
|
||||
if( aBBox.m_initialized == false )
|
||||
return false;
|
||||
|
||||
bool x = ( m_max.x >= aBBox.m_min.x ) && ( m_min.x <= aBBox.m_max.x );
|
||||
bool y = ( m_max.y >= aBBox.m_min.y ) && ( m_min.y <= aBBox.m_max.y );
|
||||
bool z = ( m_max.z >= aBBox.m_min.z ) && ( m_min.z <= aBBox.m_max.z );
|
||||
|
||||
return ( x && y && z );
|
||||
}
|
||||
|
||||
|
||||
bool CBBOX::Inside( const S3D_VERTEX &aPoint ) const
|
||||
{
|
||||
if( m_initialized == false )
|
||||
return false;
|
||||
|
||||
return (( aPoint.x >= m_min.x ) && ( aPoint.x <= m_max.x ) &&
|
||||
( aPoint.y >= m_min.y ) && ( aPoint.y <= m_max.y ) &&
|
||||
( aPoint.z >= m_min.z ) && ( aPoint.z <= m_max.z ));
|
||||
}
|
||||
|
||||
|
||||
float CBBOX::Volume() const
|
||||
{
|
||||
if( m_initialized == false )
|
||||
return 0.0f;
|
||||
|
||||
S3D_VERTEX d = m_max - m_min;
|
||||
return d.x * d.y * d.z;
|
||||
}
|
||||
|
||||
|
||||
void CBBOX::ApplyTransformation( glm::mat4 aTransformMatrix )
|
||||
{
|
||||
if( m_initialized == false )
|
||||
return;
|
||||
|
||||
S3D_VERTEX v1 = S3D_VERTEX( aTransformMatrix * glm::vec4( m_min.x, m_min.y, m_min.z, 1.0f ) );
|
||||
S3D_VERTEX v2 = S3D_VERTEX( aTransformMatrix * glm::vec4( m_max.x, m_max.y, m_max.z, 1.0f ) );
|
||||
|
||||
Reset();
|
||||
Union( v1 );
|
||||
Union( v2 );
|
||||
}
|
||||
|
||||
|
||||
void CBBOX::ApplyTransformationAA( glm::mat4 aTransformMatrix )
|
||||
{
|
||||
if( m_initialized == false )
|
||||
return;
|
||||
|
||||
// apply the transformation matrix for each of vertices of the bounding box
|
||||
// and make a union with all vertices
|
||||
CBBOX tmpBBox = CBBOX( S3D_VERTEX( aTransformMatrix * glm::vec4( m_min.x, m_min.y, m_min.z, 1.0f ) ) );
|
||||
tmpBBox.Union( S3D_VERTEX( aTransformMatrix * glm::vec4( m_max.x, m_min.y, m_min.z, 1.0f ) ) );
|
||||
tmpBBox.Union( S3D_VERTEX( aTransformMatrix * glm::vec4( m_min.x, m_max.y, m_min.z, 1.0f ) ) );
|
||||
tmpBBox.Union( S3D_VERTEX( aTransformMatrix * glm::vec4( m_min.x, m_min.y, m_max.z, 1.0f ) ) );
|
||||
tmpBBox.Union( S3D_VERTEX( aTransformMatrix * glm::vec4( m_min.x, m_max.y, m_max.z, 1.0f ) ) );
|
||||
tmpBBox.Union( S3D_VERTEX( aTransformMatrix * glm::vec4( m_max.x, m_max.y, m_min.z, 1.0f ) ) );
|
||||
tmpBBox.Union( S3D_VERTEX( aTransformMatrix * glm::vec4( m_max.x, m_min.y, m_max.z, 1.0f ) ) );
|
||||
tmpBBox.Union( S3D_VERTEX( aTransformMatrix * glm::vec4( m_max.x, m_max.y, m_max.z, 1.0f ) ) );
|
||||
|
||||
m_min = tmpBBox.m_min;
|
||||
m_max = tmpBBox.m_max;
|
||||
}
|
||||
|
||||
|
||||
void CBBOX::GLdebug() const
|
||||
{
|
||||
if( m_initialized == false )
|
||||
return;
|
||||
|
||||
glBegin( GL_LINE_LOOP );
|
||||
glVertex3f( m_min.x, m_min.y, m_min.z );
|
||||
glVertex3f( m_max.x, m_min.y, m_min.z );
|
||||
glVertex3f( m_max.x, m_max.y, m_min.z );
|
||||
glVertex3f( m_min.x, m_max.y, m_min.z );
|
||||
glEnd();
|
||||
|
||||
glBegin( GL_LINE_LOOP );
|
||||
glVertex3f( m_min.x, m_min.y, m_max.z );
|
||||
glVertex3f( m_max.x, m_min.y, m_max.z );
|
||||
glVertex3f( m_max.x, m_max.y, m_max.z );
|
||||
glVertex3f( m_min.x, m_max.y, m_max.z );
|
||||
glEnd();
|
||||
|
||||
glBegin( GL_LINE_STRIP );
|
||||
glVertex3f( m_min.x, m_min.y, m_min.z );
|
||||
glVertex3f( m_min.x, m_min.y, m_max.z );
|
||||
glEnd();
|
||||
|
||||
glBegin( GL_LINE_STRIP );
|
||||
glVertex3f( m_max.x, m_min.y, m_min.z );
|
||||
glVertex3f( m_max.x, m_min.y, m_max.z );
|
||||
glEnd();
|
||||
|
||||
glBegin( GL_LINE_STRIP );
|
||||
glVertex3f( m_max.x, m_max.y, m_min.z );
|
||||
glVertex3f( m_max.x, m_max.y, m_max.z );
|
||||
glEnd();
|
||||
|
||||
glBegin( GL_LINE_STRIP );
|
||||
glVertex3f( m_min.x, m_max.y, m_min.z );
|
||||
glVertex3f( m_min.x, m_max.y, m_max.z );
|
||||
glEnd();
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file CBBox.h
|
||||
* @brief Bounding Box class definition
|
||||
*/
|
||||
|
||||
#ifndef CBBox_h
|
||||
#define CBBox_h
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <gal/opengl/glm/glm.hpp>
|
||||
#include <3d_types.h>
|
||||
|
||||
|
||||
/**
|
||||
* Class CBBOX
|
||||
* manages a bounding box defined by two S3D_VERTEX points.
|
||||
*/
|
||||
class CBBOX
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor CBBOX
|
||||
* Create with default values a bounding box (not inizialized)
|
||||
*/
|
||||
CBBOX();
|
||||
|
||||
/**
|
||||
* Constructor CBBOX
|
||||
* Initialize a bounding box with a given point
|
||||
* @param aPbInit a point for the bounding box initialization
|
||||
*/
|
||||
CBBOX( const S3D_VERTEX &aPbInit );
|
||||
|
||||
/**
|
||||
* Constructor CBBOX
|
||||
* Initialize a bounding box with a minimon and a maximun point
|
||||
* @param aPbMin the minimun point to initialize the bounding box
|
||||
* @param aPbMax the maximun point to initialize the bounding box
|
||||
*/
|
||||
CBBOX( const S3D_VERTEX &aPbMin, const S3D_VERTEX &aPbMax );
|
||||
|
||||
~CBBOX();
|
||||
|
||||
|
||||
/**
|
||||
* Function Set
|
||||
* Set bounding box with new parameters
|
||||
* @param aPbMin the minimun point to initialize the bounding box
|
||||
* @param aPbMax the maximun point to initialize the bounding box
|
||||
*/
|
||||
void Set( const S3D_VERTEX &aPbMin, const S3D_VERTEX &aPbMax );
|
||||
|
||||
/**
|
||||
* Function Union
|
||||
* recalculate the bounding box adding a point
|
||||
* @param aPoint the point to be bounded
|
||||
*/
|
||||
void Union( const S3D_VERTEX &aPoint );
|
||||
|
||||
/**
|
||||
* Function Union
|
||||
* recalculate the bounding box adding other bounding box
|
||||
* @param aBBox the bounding box to be bounded
|
||||
*/
|
||||
void Union( const CBBOX &aBBox );
|
||||
|
||||
/**
|
||||
* Function Scale
|
||||
* scales a bounding box by its center
|
||||
* @param aScale scale factor to apply
|
||||
*/
|
||||
void Scale( float aScale );
|
||||
|
||||
/**
|
||||
* Function OverlapsBox
|
||||
* test if a bounding box overlaps this box
|
||||
* @param aBBox the bounding box to check if it overlaps
|
||||
*/
|
||||
bool OverlapsBox( const CBBOX &aBBox ) const;
|
||||
|
||||
/**
|
||||
* Function Inside
|
||||
* check is a point is inside this bounding box
|
||||
* @param aPoint point to test
|
||||
*/
|
||||
bool Inside( const S3D_VERTEX &aPoint ) const;
|
||||
|
||||
/**
|
||||
* Function ApplyTransformation
|
||||
* apply a transformation matrix to the box points
|
||||
* @param aTransformMatrix matrix to apply to the points of the bounding box
|
||||
*/
|
||||
void ApplyTransformation( glm::mat4 aTransformMatrix );
|
||||
|
||||
/**
|
||||
* Function ApplyTransformationAA
|
||||
* apply a transformation matrix to the box points and recalculate it
|
||||
* to fit an axis aligned bounding box
|
||||
* @param aTransformMatrix matrix to apply to the points of the bounding box
|
||||
*/
|
||||
void ApplyTransformationAA( glm::mat4 aTransformMatrix );
|
||||
|
||||
/**
|
||||
* Function Volume
|
||||
* calculate the volume of a bounding box
|
||||
* @return float - volume of this bounding box
|
||||
*/
|
||||
float Volume() const;
|
||||
|
||||
/**
|
||||
* Function GLdebug
|
||||
* render a wired bounding box using openGL
|
||||
*/
|
||||
void GLdebug() const;
|
||||
|
||||
/**
|
||||
* Function IsInitialized
|
||||
* check if this bounding box is already initialized
|
||||
* @return bool - return true if it was initialized, false if otherwise
|
||||
*/
|
||||
bool IsInitialized() const;
|
||||
|
||||
/**
|
||||
* Function Reset
|
||||
* reset the bounding box to zero and de-initialized it
|
||||
*/
|
||||
void Reset();
|
||||
|
||||
/**
|
||||
* Function GetCenter
|
||||
* return the center point of the bounding box
|
||||
* @return S3D_VERTEX - the position of the center of this bounding box
|
||||
*/
|
||||
S3D_VERTEX GetCenter() const;
|
||||
|
||||
/**
|
||||
* Function Min
|
||||
* return the minimun vertex pointer
|
||||
* @return S3D_VERTEX - the minimun vertice position
|
||||
*/
|
||||
S3D_VERTEX Min() const;
|
||||
|
||||
/**
|
||||
* Function Max
|
||||
* return the maximum vertex pointer
|
||||
* @return S3D_VERTEX - the maximun vertice position
|
||||
*/
|
||||
S3D_VERTEX Max() const;
|
||||
|
||||
private:
|
||||
S3D_VERTEX m_min; ///< point of the lower position of the bounding box
|
||||
S3D_VERTEX m_max; ///< point of the higher position of the bounding box
|
||||
bool m_initialized; ///< initialization status of the bounding box. true - if initialized, false otherwise
|
||||
};
|
||||
|
||||
#endif // CBBox_h
|
||||
@@ -1,440 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file CImage.cpp
|
||||
* @brief one 8bit-channel image implementation
|
||||
*/
|
||||
|
||||
#include "CImage.h"
|
||||
#include <wx/image.h> // Used for save an image to disk
|
||||
#include <string.h> // For memcpy
|
||||
|
||||
#ifndef CLAMP
|
||||
#define CLAMP(n, min, max) {if (n < min) n=min; else if (n > max) n = max;}
|
||||
#endif
|
||||
|
||||
|
||||
CIMAGE::CIMAGE( unsigned int aXsize, unsigned int aYsize )
|
||||
{
|
||||
m_wxh = aXsize * aYsize;
|
||||
m_pixels = (unsigned char*)malloc( m_wxh );
|
||||
m_width = aXsize;
|
||||
m_height = aYsize;
|
||||
m_wraping = (E_WRAP)WRAP_CLAMP;
|
||||
}
|
||||
|
||||
|
||||
CIMAGE::~CIMAGE()
|
||||
{
|
||||
free( m_pixels );
|
||||
}
|
||||
|
||||
|
||||
unsigned char* CIMAGE::GetBuffer() const
|
||||
{
|
||||
return m_pixels;
|
||||
}
|
||||
|
||||
|
||||
bool CIMAGE::wrapCoords( int *aXo, int *aYo ) const
|
||||
{
|
||||
int x = *aXo;
|
||||
int y = *aYo;
|
||||
|
||||
switch(m_wraping)
|
||||
{
|
||||
case WRAP_CLAMP:
|
||||
x = (x < 0 )?0:x;
|
||||
x = (x >= (int)(m_width - 1))?(m_width - 1):x;
|
||||
y = (y < 0)?0:y;
|
||||
y = (y >= (int)(m_height - 1))?(m_height - 1):y;
|
||||
break;
|
||||
case WRAP_WRAP:
|
||||
x = (x < 0)?((m_width - 1)+x):x;
|
||||
x = (x >= (int)(m_width - 1))?(x - m_width):x;
|
||||
y = (y < 0)?((m_height - 1)+y):y;
|
||||
y = (y >= (int)(m_height - 1))?(y - m_height):y;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if( (x < 0) || (x >= (int)m_width) ||
|
||||
(y < 0) || (y >= (int)m_height) )
|
||||
return false;
|
||||
|
||||
*aXo = x;
|
||||
*aYo = y;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CIMAGE::Setpixel( int aX, int aY, unsigned char aValue )
|
||||
{
|
||||
if( wrapCoords( &aX, &aY ) )
|
||||
m_pixels[aX + aY * m_width] = aValue;
|
||||
}
|
||||
|
||||
|
||||
unsigned char CIMAGE::Getpixel( int aX, int aY ) const
|
||||
{
|
||||
if( wrapCoords( &aX, &aY ) )
|
||||
return m_pixels[aX + aY * m_width];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CIMAGE::Invert()
|
||||
{
|
||||
for( unsigned int it = 0; it < m_wxh; it++ )
|
||||
m_pixels[it] = 255 - m_pixels[it];
|
||||
}
|
||||
|
||||
|
||||
void CIMAGE::CopyFull( const CIMAGE *aImgA, const CIMAGE *aImgB, E_IMAGE_OP aOperation )
|
||||
{
|
||||
int aV, bV;
|
||||
|
||||
if( aOperation == COPY_RAW )
|
||||
{
|
||||
if ( aImgA == NULL )
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (aImgA == NULL) || (aImgB == NULL) )
|
||||
return;
|
||||
}
|
||||
|
||||
switch(aOperation)
|
||||
{
|
||||
case COPY_RAW:
|
||||
memcpy( m_pixels, aImgA->m_pixels, m_wxh );
|
||||
break;
|
||||
|
||||
case COPY_ADD:
|
||||
for( unsigned int it = 0;it < m_wxh; it++ )
|
||||
{
|
||||
aV = aImgA->m_pixels[it];
|
||||
bV = aImgB->m_pixels[it];
|
||||
|
||||
aV = (aV + bV);
|
||||
aV = (aV > 255)?255:aV;
|
||||
|
||||
m_pixels[it] = aV;
|
||||
}
|
||||
break;
|
||||
|
||||
case COPY_SUB:
|
||||
for( unsigned int it = 0;it < m_wxh; it++ )
|
||||
{
|
||||
aV = aImgA->m_pixels[it];
|
||||
bV = aImgB->m_pixels[it];
|
||||
|
||||
aV = (aV - bV);
|
||||
aV = (aV < 0)?0:aV;
|
||||
|
||||
m_pixels[it] = aV;
|
||||
}
|
||||
break;
|
||||
|
||||
case COPY_DIF:
|
||||
for( unsigned int it = 0;it < m_wxh; it++ )
|
||||
{
|
||||
aV = aImgA->m_pixels[it];
|
||||
bV = aImgB->m_pixels[it];
|
||||
|
||||
m_pixels[it] = abs(aV - bV);
|
||||
}
|
||||
break;
|
||||
|
||||
case COPY_MUL:
|
||||
for( unsigned int it = 0;it < m_wxh; it++ )
|
||||
{
|
||||
aV = aImgA->m_pixels[it];
|
||||
bV = aImgB->m_pixels[it];
|
||||
|
||||
m_pixels[it] = (unsigned char)((((float)aV / 255.0f) * ((float)bV / 255.0f)) * 255);
|
||||
}
|
||||
break;
|
||||
|
||||
case COPY_AND:
|
||||
for( unsigned int it = 0;it < m_wxh; it++ )
|
||||
{
|
||||
m_pixels[it] = aImgA->m_pixels[it] & aImgB->m_pixels[it];
|
||||
}
|
||||
break;
|
||||
|
||||
case COPY_OR:
|
||||
for( unsigned int it = 0;it < m_wxh; it++ )
|
||||
{
|
||||
m_pixels[it] = aImgA->m_pixels[it] | aImgB->m_pixels[it];
|
||||
}
|
||||
break;
|
||||
|
||||
case COPY_XOR:
|
||||
for( unsigned int it = 0;it < m_wxh; it++ )
|
||||
{
|
||||
m_pixels[it] = aImgA->m_pixels[it] ^ aImgB->m_pixels[it];
|
||||
}
|
||||
break;
|
||||
|
||||
case COPY_BLEND50:
|
||||
for( unsigned int it = 0;it < m_wxh; it++ )
|
||||
{
|
||||
aV = aImgA->m_pixels[it];
|
||||
bV = aImgB->m_pixels[it];
|
||||
|
||||
m_pixels[it] = (aV + bV) / 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case COPY_MIN:
|
||||
for( unsigned int it = 0;it < m_wxh; it++ )
|
||||
{
|
||||
aV = aImgA->m_pixels[it];
|
||||
bV = aImgB->m_pixels[it];
|
||||
|
||||
m_pixels[it] = (aV < bV)?aV:bV;
|
||||
}
|
||||
break;
|
||||
|
||||
case COPY_MAX:
|
||||
for( unsigned int it = 0;it < m_wxh; it++ )
|
||||
{
|
||||
aV = aImgA->m_pixels[it];
|
||||
bV = aImgB->m_pixels[it];
|
||||
|
||||
m_pixels[it] = (aV > bV)?aV:bV;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TIP: If you want create or test filters you can use GIMP
|
||||
// with a generic convolution matrix and get the values from there.
|
||||
// http://docs.gimp.org/nl/plug-in-convmatrix.html
|
||||
static const S_FILTER FILTERS[] = {
|
||||
// Hi Pass
|
||||
{
|
||||
{ { 0, -1, -1, -1, 0},
|
||||
{-1, 2, -4, 2, -1},
|
||||
{-1, -4, 13, -4, -1},
|
||||
{-1, 2, -4, 2, -1},
|
||||
{ 0, -1, -1, -1, 0}
|
||||
},
|
||||
7,
|
||||
255
|
||||
},
|
||||
|
||||
// Blur
|
||||
{
|
||||
{ { 3, 5, 7, 5, 3},
|
||||
{ 5, 9, 12, 9, 5},
|
||||
{ 7, 12, 20, 12, 7},
|
||||
{ 5, 9, 12, 9, 5},
|
||||
{ 3, 5, 7, 5, 3}
|
||||
},
|
||||
182,
|
||||
0
|
||||
},
|
||||
|
||||
// Blur Invert
|
||||
{
|
||||
{ { 0, 0, 0, 0, 0},
|
||||
{ 0, 0, -1, 0, 0},
|
||||
{ 0, -1, 0, -1, 0},
|
||||
{ 0, 0, -1, 0, 0},
|
||||
{ 0, 0, 0, 0, 0}
|
||||
},
|
||||
4,
|
||||
255
|
||||
},
|
||||
|
||||
//
|
||||
{
|
||||
{ { 0, 2, 4, 2, 0},
|
||||
{ 2, -2, 1, -2, 2},
|
||||
{ 4, 1, -8, 1, 4},
|
||||
{ 2, -2, 1, -2, 2},
|
||||
{ 0, 2, 4, 2, 0}
|
||||
},
|
||||
20,
|
||||
0
|
||||
},
|
||||
|
||||
// Cartoon
|
||||
{
|
||||
{ {-1, -1, -1, -1, 0},
|
||||
{-1, 0, 0, 0, 0},
|
||||
{-1, 0, 4, 0, 0},
|
||||
{ 0, 0, 0, 1, 0},
|
||||
{ 0, 0, 0, 0, 4}
|
||||
},
|
||||
3,
|
||||
0
|
||||
},
|
||||
|
||||
// Emboss
|
||||
{
|
||||
{ {-1, -1, -1, -1, 0},
|
||||
{-1, -1, -1, 0, 1},
|
||||
{-1, -1, 0, 1, 1},
|
||||
{-1, 0, 1, 1, 1},
|
||||
{ 0, 1, 1, 1, 1}
|
||||
},
|
||||
1,
|
||||
128
|
||||
},
|
||||
|
||||
// Sharpen
|
||||
{
|
||||
{ {-1, -1, -1, -1, -1},
|
||||
{-1, 2, 2, 2, -1},
|
||||
{-1, 2, 8, 2, -1},
|
||||
{-1, 2, 2, 2, -1},
|
||||
{-1, -1, -1, -1, -1}
|
||||
},
|
||||
8,
|
||||
0
|
||||
},
|
||||
|
||||
// Melt
|
||||
{
|
||||
{ { 4, 2, 6, 8, 1},
|
||||
{ 1, 2, 5, 4, 2},
|
||||
{ 0, -1, 1, -1, 0},
|
||||
{ 0, 0, -2, 0, 0},
|
||||
{ 0, 0, 0, 0, 0}
|
||||
},
|
||||
32,
|
||||
0
|
||||
},
|
||||
|
||||
// Sobel Gx
|
||||
{
|
||||
{ { 0, 0, 0, 0, 0},
|
||||
{ 0, -1, 0, 1, 0},
|
||||
{ 0, -2, 0, 2, 0},
|
||||
{ 0, -1, 0, 1, 0},
|
||||
{ 0, 0, 0, 0, 0}
|
||||
},
|
||||
1,
|
||||
0
|
||||
},
|
||||
|
||||
// Sobel Gy
|
||||
{
|
||||
{ { 1, 2, 4, 2, 1},
|
||||
{-1, -1, 0, 1, 1},
|
||||
{-2, -2, 0, 2, 2},
|
||||
{-1, -1, 0, 1, 1},
|
||||
{-1, -2, -4, -2, -1},
|
||||
},
|
||||
1,
|
||||
0
|
||||
}
|
||||
};// Filters
|
||||
|
||||
|
||||
//!TODO: This functions can be optimized slipting it between the edges and
|
||||
// do it without use the getpixel function.
|
||||
// Optimization can be done to m_pixels[ix + iy * m_width]
|
||||
// but keep in mind the parallel process of the algorithm
|
||||
void CIMAGE::EfxFilter( CIMAGE *aInImg, E_FILTER aFilterType )
|
||||
{
|
||||
S_FILTER filter = FILTERS[aFilterType];
|
||||
|
||||
aInImg->m_wraping = WRAP_CLAMP;
|
||||
m_wraping = WRAP_CLAMP;
|
||||
|
||||
#ifdef USE_OPENMP
|
||||
#pragma omp parallel for
|
||||
#endif /* USE_OPENMP */
|
||||
|
||||
for( int iy = 0; iy < (int)m_height; iy++)
|
||||
{
|
||||
for( int ix = 0; ix < (int)m_width; ix++ )
|
||||
{
|
||||
int v = 0;
|
||||
|
||||
for( int sy = 0; sy < 5; sy++ )
|
||||
{
|
||||
for( int sx = 0; sx < 5; sx++ )
|
||||
{
|
||||
int factor = filter.kernel[sx][sy];
|
||||
unsigned char pixelv = aInImg->Getpixel( ix + sx - 2, iy + sy - 2 );
|
||||
v += pixelv * factor;
|
||||
}
|
||||
}
|
||||
|
||||
v /= filter.div;
|
||||
|
||||
v += filter.offset;
|
||||
|
||||
CLAMP(v, 0, 255);
|
||||
|
||||
m_pixels[ix + iy * m_width] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CIMAGE::SetPixelsFromNormalizedFloat( const float * aNormalizedFloatArray )
|
||||
{
|
||||
for( unsigned int i = 0; i < m_wxh; i++ )
|
||||
{
|
||||
int v = aNormalizedFloatArray[i] * 255;
|
||||
CLAMP(v, 0, 255);
|
||||
m_pixels[i] = v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CIMAGE::SaveAsPNG( wxString aFileName ) const
|
||||
{
|
||||
unsigned char* pixelbuffer = (unsigned char*) malloc( m_wxh * 3 );
|
||||
|
||||
wxImage image( m_width, m_height );
|
||||
|
||||
for( unsigned int i = 0; i < m_wxh; i++)
|
||||
{
|
||||
unsigned char v = m_pixels[i];
|
||||
// Set RGB value with all same values intensities
|
||||
pixelbuffer[i * 3 + 0] = v;
|
||||
pixelbuffer[i * 3 + 1] = v;
|
||||
pixelbuffer[i * 3 + 2] = v;
|
||||
}
|
||||
|
||||
image.SetData( pixelbuffer );
|
||||
image = image.Mirror( false );
|
||||
image.SaveFile( aFileName + ".png", wxBITMAP_TYPE_PNG );
|
||||
image.Destroy();
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file CImage.h
|
||||
* @brief one 8bit-channel image definition
|
||||
*/
|
||||
|
||||
#ifndef CImage_h
|
||||
#define CImage_h
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
/// Image operation type
|
||||
enum E_IMAGE_OP {
|
||||
COPY_RAW,
|
||||
COPY_ADD,
|
||||
COPY_SUB,
|
||||
COPY_DIF,
|
||||
COPY_MUL,
|
||||
COPY_AND,
|
||||
COPY_OR,
|
||||
COPY_XOR,
|
||||
COPY_BLEND50,
|
||||
COPY_MIN,
|
||||
COPY_MAX
|
||||
};
|
||||
|
||||
|
||||
/// Image wrap type enumeration
|
||||
enum E_WRAP {
|
||||
WRAP_ZERO, ///< Coords that wraps are not evaluated
|
||||
WRAP_CLAMP, ///< Coords are clamped to image size
|
||||
WRAP_WRAP ///< Coords are wrapped arround
|
||||
};
|
||||
|
||||
|
||||
/// Filter type enumeration
|
||||
enum E_FILTER {
|
||||
FILTER_HIPASS,
|
||||
FILTER_GAUSSIAN_BLUR,
|
||||
FILTER_INVERT_BLUR,
|
||||
};
|
||||
|
||||
/// 5x5 Filter struct parameters
|
||||
typedef struct {
|
||||
signed char kernel[5][5];
|
||||
unsigned char div;
|
||||
unsigned char offset;
|
||||
}S_FILTER;
|
||||
|
||||
|
||||
/**
|
||||
* Class CIMAGE
|
||||
* manages a 8-bit channel image
|
||||
*/
|
||||
class CIMAGE
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor CIMAGE
|
||||
* constructs a CIMAGE based on image size
|
||||
* @param aXsize x size
|
||||
* @param aYsize y size
|
||||
*/
|
||||
CIMAGE( unsigned int aXsize, unsigned int aYsize );
|
||||
|
||||
~CIMAGE();
|
||||
|
||||
/**
|
||||
* Function Setpixel
|
||||
* set a value in a pixel position, position is clamped in accord with the
|
||||
* current clamp settings
|
||||
* @param aX x position
|
||||
* @param aY y position
|
||||
* @param aValue value to set the pixel
|
||||
*/
|
||||
void Setpixel( int aX, int aY, unsigned char aValue );
|
||||
|
||||
/**
|
||||
* Function Getpixel
|
||||
* get the pixel value from pixel position, position is clamped in accord with the
|
||||
* current clamp settings
|
||||
* @param aX x position
|
||||
* @param aY y position
|
||||
* @return unsigned char - pixel value
|
||||
*/
|
||||
unsigned char Getpixel( int aX, int aY ) const;
|
||||
|
||||
/**
|
||||
* Function CopyFull
|
||||
* perform a copy operation, based on operation type. The result destination is the self image class
|
||||
* @param aImgA an image input
|
||||
* @param aImgB an image input
|
||||
* @param aOperation operation to perform
|
||||
* COPY_RAW this <- aImgA
|
||||
* COPY_ADD this <- CLAMP(aImgA + aImgB)
|
||||
* COPY_SUB this <- CLAMP(aImgA - aImgB)
|
||||
* COPY_DIF this <- abs(aImgA - aImgB)
|
||||
* COPY_MUL this <- aImgA * aImgB
|
||||
* COPY_AND this <- aImgA & aImgB
|
||||
* COPY_OR this <- aImgA | aImgB
|
||||
* COPY_XOR this <- aImgA ^ aImgB
|
||||
* COPY_BLEND50 this <- (aImgA + aImgB) / 2
|
||||
* COPY_MIN this <- (aImgA < aImgB)?aImgA:aImgB
|
||||
* COPY_MAX this <- (aImgA > aImgB)?aImgA:aImgB
|
||||
*/
|
||||
void CopyFull( const CIMAGE *aImgA, const CIMAGE *aImgB, E_IMAGE_OP aOperation );
|
||||
|
||||
/**
|
||||
* Function Invert
|
||||
* invert the values of image this <- (255 - this)
|
||||
*/
|
||||
void Invert();
|
||||
|
||||
/**
|
||||
* Function EfxFilter
|
||||
* apply a filter to the input image and stores it in the image class
|
||||
* this <- FilterType(aInImg)
|
||||
* @param aInImg input image
|
||||
* @param aFilterType filter type to apply
|
||||
*/
|
||||
void EfxFilter( CIMAGE *aInImg, E_FILTER aFilterType );
|
||||
|
||||
/**
|
||||
* Function SaveAsPNG
|
||||
* save image buffer to a PNG file into the working folder.
|
||||
* each of RGB channel will have the 8bit-channel from the image.
|
||||
* @param aFileName fime name (without extension)
|
||||
*/
|
||||
void SaveAsPNG( wxString aFileName ) const;
|
||||
|
||||
/**
|
||||
* Function SetPixelsFromNormalizedFloat
|
||||
* set the current channel from a float normalized (0.0 - 1.0) buffer
|
||||
* this <- CLAMP(NormalizedFloat * 255)
|
||||
* @param aNormalizedFloatArray a float array with the same size of the image
|
||||
*/
|
||||
void SetPixelsFromNormalizedFloat( const float * aNormalizedFloatArray );
|
||||
|
||||
/**
|
||||
* Function GetBuffer
|
||||
* get the image buffer pointer
|
||||
* @return unsigned char * - the pointer of the buffer 8bit channel
|
||||
*/
|
||||
unsigned char* GetBuffer() const;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Function wrapCoords
|
||||
* calculate the coordinates points in accord with the current clamping settings
|
||||
* @param aXo X coordinate to be converted (output)
|
||||
* @param aXo Y coordinate to be converted (output)
|
||||
* @return bool - true if the coordinates are inside the image, false otherwise
|
||||
*/
|
||||
bool wrapCoords( int *aXo, int *aYo ) const;
|
||||
|
||||
private:
|
||||
unsigned char* m_pixels; ///< buffer to store the image 8bit-channel
|
||||
unsigned int m_width; ///< width of the image
|
||||
unsigned int m_height; ///< height of the image
|
||||
unsigned int m_wxh; ///< width * height precalc value
|
||||
E_WRAP m_wraping; ///< current wrapping type
|
||||
};
|
||||
|
||||
#endif // CImage_h
|
||||
@@ -2,10 +2,8 @@ add_definitions(-DPCBNEW)
|
||||
|
||||
include_directories(BEFORE ${INC_BEFORE})
|
||||
include_directories(
|
||||
textures
|
||||
../pcbnew
|
||||
../polygon
|
||||
${GLEW_INCLUDE_DIR}
|
||||
${INC_AFTER}
|
||||
)
|
||||
|
||||
@@ -16,24 +14,14 @@ set(3D-VIEWER_SRCS
|
||||
3d_canvas.cpp
|
||||
3d_class.cpp
|
||||
3d_draw.cpp
|
||||
3d_draw_board_body.cpp
|
||||
3d_draw_basic_functions.cpp
|
||||
3d_draw_helper_functions.cpp
|
||||
3d_frame.cpp
|
||||
3d_material.cpp
|
||||
3d_mesh_model.cpp
|
||||
3d_read_mesh.cpp
|
||||
3d_toolbar.cpp
|
||||
info3d_visu.cpp
|
||||
trackball.cpp
|
||||
vrmlmodelparser.cpp
|
||||
vrml_aux.cpp
|
||||
vrml_v1_modelparser.cpp
|
||||
vrml_v2_modelparser.cpp
|
||||
x3dmodelparser.cpp
|
||||
CImage.cpp
|
||||
CBBox.cpp
|
||||
vrmlmodelparser.cpp
|
||||
)
|
||||
|
||||
add_library(3d-viewer STATIC ${3D-VIEWER_SRCS})
|
||||
add_dependencies( 3d-viewer pcbcommon )
|
||||
|
||||
@@ -1,26 +1,3 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.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 "dialog_3D_view_option_base.h"
|
||||
#include <3d_viewer.h>
|
||||
@@ -41,14 +18,11 @@ private:
|
||||
void OnShowAllClick( wxCommandEvent& event );
|
||||
void OnShowNoneClick( wxCommandEvent& event );
|
||||
void OnOKClick( wxCommandEvent& event );
|
||||
void OnCheckRealisticMode( wxCommandEvent& event );
|
||||
};
|
||||
|
||||
|
||||
void EDA_3D_FRAME::Install_3D_ViewOptionDialog( wxCommandEvent& event )
|
||||
{
|
||||
DIALOG_3D_VIEW_OPTIONS dlg( this );
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
{
|
||||
SetMenuBarOptionsState();
|
||||
@@ -64,16 +38,13 @@ DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent )
|
||||
|
||||
initDialog();
|
||||
|
||||
SetDefaultItem( (wxWindow*) m_sdbSizerOK );
|
||||
Layout();
|
||||
GetSizer()->SetSizeHints( this );
|
||||
GetSizer()->SetSizeHints(this);
|
||||
Centre();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_3D_VIEW_OPTIONS::initDialog()
|
||||
{
|
||||
m_bitmapRealisticMode->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
|
||||
m_bitmapCuThickness->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
|
||||
m_bitmap3Dshapes->SetBitmap( KiBitmap( shape_3d_xpm ) );
|
||||
m_bitmapAreas->SetBitmap( KiBitmap( add_zone_xpm ) );
|
||||
@@ -85,7 +56,6 @@ void DIALOG_3D_VIEW_OPTIONS::initDialog()
|
||||
m_bitmapECO->SetBitmap( KiBitmap( edit_sheet_xpm ) );
|
||||
|
||||
// Check/uncheck checkboxes
|
||||
m_checkBoxRealisticMode->SetValue( m_3Dprms.GetFlag( FL_USE_REALISTIC_MODE ) );
|
||||
m_checkBoxCuThickness->SetValue( m_3Dprms.GetFlag( FL_USE_COPPER_THICKNESS ) );
|
||||
m_checkBox3Dshapes->SetValue( m_3Dprms.GetFlag( FL_MODULE ) );
|
||||
m_checkBoxAreas->SetValue( m_3Dprms.GetFlag( FL_ZONE ) );
|
||||
@@ -93,19 +63,8 @@ void DIALOG_3D_VIEW_OPTIONS::initDialog()
|
||||
m_checkBoxSolderMask->SetValue( m_3Dprms.GetFlag( FL_SOLDERMASK ) );
|
||||
m_checkBoxSolderpaste->SetValue( m_3Dprms.GetFlag( FL_SOLDERPASTE ) );
|
||||
m_checkBoxAdhesive->SetValue( m_3Dprms.GetFlag( FL_ADHESIVE ) );
|
||||
|
||||
m_checkBoxComments->SetValue( m_3Dprms.GetFlag( FL_COMMENTS ) );
|
||||
m_checkBoxECO->SetValue( m_3Dprms.GetFlag( FL_ECO ) );
|
||||
bool enable = !m_3Dprms.GetFlag( FL_USE_REALISTIC_MODE );
|
||||
m_checkBoxComments->Enable( enable );
|
||||
m_checkBoxECO->Enable( enable );
|
||||
}
|
||||
|
||||
void DIALOG_3D_VIEW_OPTIONS::OnCheckRealisticMode( wxCommandEvent& event )
|
||||
{
|
||||
bool enable = !m_checkBoxRealisticMode->GetValue();
|
||||
m_checkBoxComments->Enable( enable );
|
||||
m_checkBoxECO->Enable( enable );
|
||||
}
|
||||
|
||||
void DIALOG_3D_VIEW_OPTIONS::OnShowAllClick( wxCommandEvent& event )
|
||||
@@ -122,7 +81,6 @@ void DIALOG_3D_VIEW_OPTIONS::OnShowAllClick( wxCommandEvent& event )
|
||||
m_checkBoxECO->SetValue( state );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_3D_VIEW_OPTIONS::OnShowNoneClick( wxCommandEvent& event )
|
||||
{
|
||||
bool state = false;
|
||||
@@ -137,11 +95,10 @@ void DIALOG_3D_VIEW_OPTIONS::OnShowNoneClick( wxCommandEvent& event )
|
||||
m_checkBoxECO->SetValue( state );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_3D_VIEW_OPTIONS::OnOKClick( wxCommandEvent& event )
|
||||
{
|
||||
m_3Dprms.SetFlag( FL_USE_REALISTIC_MODE, m_checkBoxRealisticMode->GetValue() );
|
||||
m_3Dprms.SetFlag( FL_USE_COPPER_THICKNESS, m_checkBoxCuThickness->GetValue() );
|
||||
m_3Dprms.SetFlag( FL_USE_COPPER_THICKNESS,
|
||||
m_checkBoxCuThickness->GetValue() );
|
||||
m_3Dprms.SetFlag( FL_MODULE, m_checkBox3Dshapes->GetValue() );
|
||||
m_3Dprms.SetFlag( FL_ZONE, m_checkBoxAreas->GetValue() );
|
||||
m_3Dprms.SetFlag( FL_SILKSCREEN, m_checkBoxSilkscreen->GetValue() );
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
@@ -20,69 +20,63 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
|
||||
bSizerLeft = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxFlexGridSizer* fgSizeShowOpts;
|
||||
fgSizeShowOpts = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizeShowOpts = new wxFlexGridSizer( 9, 2, 0, 0 );
|
||||
fgSizeShowOpts->SetFlexibleDirection( wxBOTH );
|
||||
fgSizeShowOpts->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_bitmapRealisticMode = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_bitmapRealisticMode, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_checkBoxRealisticMode = new wxCheckBox( this, wxID_ANY, _("Realistic mode"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBoxRealisticMode, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_bitmapCuThickness = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_bitmapCuThickness, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_bitmapCuThickness, 0, wxALL, 5 );
|
||||
|
||||
m_checkBoxCuThickness = new wxCheckBox( this, wxID_ANY, _("Show copper thickness"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBoxCuThickness, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_checkBoxCuThickness, 0, wxALL, 5 );
|
||||
|
||||
m_bitmap3Dshapes = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_bitmap3Dshapes, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_bitmap3Dshapes, 0, wxALL, 5 );
|
||||
|
||||
m_checkBox3Dshapes = new wxCheckBox( this, wxID_ANY, _("Show 3D Models"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBox3Dshapes, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
m_checkBox3Dshapes = new wxCheckBox( this, wxID_ANY, _("Show component 3D shapes"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBox3Dshapes, 0, wxALL, 5 );
|
||||
|
||||
m_bitmapAreas = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_bitmapAreas, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_bitmapAreas, 0, wxALL, 5 );
|
||||
|
||||
m_checkBoxAreas = new wxCheckBox( this, wxID_ANY, _("Show filled areas in zones"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBoxAreas, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_checkBoxAreas, 0, wxALL, 5 );
|
||||
|
||||
m_bitmapSilkscreen = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_bitmapSilkscreen, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_bitmapSilkscreen, 0, wxALL, 5 );
|
||||
|
||||
m_checkBoxSilkscreen = new wxCheckBox( this, wxID_ANY, _("Show silkscreen layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBoxSilkscreen, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_checkBoxSilkscreen, 0, wxALL, 5 );
|
||||
|
||||
m_bitmapSolderMask = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_bitmapSolderMask, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_bitmapSolderMask, 0, wxALL, 5 );
|
||||
|
||||
m_checkBoxSolderMask = new wxCheckBox( this, wxID_ANY, _("Show solder mask layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBoxSolderMask, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_checkBoxSolderMask, 0, wxALL, 5 );
|
||||
|
||||
m_bitmapSolderPaste = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_bitmapSolderPaste, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_bitmapSolderPaste, 0, wxALL, 5 );
|
||||
|
||||
m_checkBoxSolderpaste = new wxCheckBox( this, wxID_ANY, _("Show solder paste layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBoxSolderpaste, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_checkBoxSolderpaste, 0, wxALL, 5 );
|
||||
|
||||
m_bitmapAdhesive = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_bitmapAdhesive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_bitmapAdhesive, 0, wxALL, 5 );
|
||||
|
||||
m_checkBoxAdhesive = new wxCheckBox( this, wxID_ANY, _("Show adhesive layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBoxAdhesive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_checkBoxAdhesive, 0, wxALL, 5 );
|
||||
|
||||
m_bitmapComments = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_bitmapComments, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_bitmapComments, 0, wxALL, 5 );
|
||||
|
||||
m_checkBoxComments = new wxCheckBox( this, wxID_ANY, _("Show comments and drawings layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBoxComments, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
m_checkBoxComments = new wxCheckBox( this, wxID_ANY, _("Show comments and drawings Layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBoxComments, 0, wxALL, 5 );
|
||||
|
||||
m_bitmapECO = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_bitmapECO, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizeShowOpts->Add( m_bitmapECO, 0, wxALL, 5 );
|
||||
|
||||
m_checkBoxECO = new wxCheckBox( this, wxID_ANY, _("Show ECO layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBoxECO, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
m_checkBoxECO = new wxCheckBox( this, wxID_ANY, _("Show ECOs layers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizeShowOpts->Add( m_checkBoxECO, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizerLeft->Add( fgSizeShowOpts, 1, wxEXPAND, 5 );
|
||||
@@ -112,28 +106,27 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
|
||||
m_sdbSizer->AddButton( m_sdbSizerCancel );
|
||||
m_sdbSizer->Realize();
|
||||
|
||||
bSizerMain->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
bSizerMain->Add( m_sdbSizer, 0, wxALIGN_RIGHT, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
bSizerMain->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
m_checkBoxRealisticMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
|
||||
m_buttonShowAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnShowAllClick ), NULL, this );
|
||||
m_buttonShowNone->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnShowNoneClick ), NULL, this );
|
||||
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnOKClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_3D_VIEW_OPTIONS_BASE::~DIALOG_3D_VIEW_OPTIONS_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_checkBoxRealisticMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
|
||||
m_buttonShowAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnShowAllClick ), NULL, this );
|
||||
m_buttonShowNone->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnShowNoneClick ), NULL, this );
|
||||
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnOKClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="13" />
|
||||
<FileVersion major="1" minor="11" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
@@ -20,10 +20,8 @@
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
@@ -44,7 +42,7 @@
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_3D_VIEW_OPTIONS_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="size">340,344</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">3D Display Options</property>
|
||||
@@ -116,180 +114,11 @@
|
||||
<property name="name">fgSizeShowOpts</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="rows">9</property>
|
||||
<property name="vgap">0</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bitmapRealisticMode</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"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Realistic mode</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_checkBoxRealisticMode</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCheckBox">OnCheckRealisticMode</event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -370,7 +199,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -458,7 +287,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -539,7 +368,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -570,7 +399,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show 3D Models</property>
|
||||
<property name="label">Show component 3D shapes</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -627,7 +456,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -708,7 +537,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -796,7 +625,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -877,7 +706,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -965,7 +794,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -1046,7 +875,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -1134,7 +963,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -1215,7 +1044,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -1303,7 +1132,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -1384,7 +1213,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -1472,7 +1301,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -1553,7 +1382,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -1584,7 +1413,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show comments and drawings layers</property>
|
||||
<property name="label">Show comments and drawings Layers</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -1641,7 +1470,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBitmap" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -1722,7 +1551,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -1753,7 +1582,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show ECO layers</property>
|
||||
<property name="label">Show ECOs layers</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -2082,7 +1911,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="flag">wxALIGN_RIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||
<property name="Apply">0</property>
|
||||
@@ -2097,7 +1926,7 @@
|
||||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
<event name="OnApplyButtonClick"></event>
|
||||
<event name="OnCancelButtonClick"></event>
|
||||
<event name="OnCancelButtonClick">OnCancelClick</event>
|
||||
<event name="OnContextHelpButtonClick"></event>
|
||||
<event name="OnHelpButtonClick"></event>
|
||||
<event name="OnNoButtonClick"></event>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
@@ -40,8 +40,6 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticBitmap* m_bitmapRealisticMode;
|
||||
wxCheckBox* m_checkBoxRealisticMode;
|
||||
wxStaticBitmap* m_bitmapCuThickness;
|
||||
wxCheckBox* m_checkBoxCuThickness;
|
||||
wxStaticBitmap* m_bitmap3Dshapes;
|
||||
@@ -68,15 +66,15 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCheckRealisticMode( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnShowAllClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnShowNoneClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 340,344 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_3D_VIEW_OPTIONS_BASE();
|
||||
|
||||
};
|
||||
|
||||
+48
-68
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2011 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
|
||||
@@ -62,19 +62,16 @@ INFO3D_VISU::INFO3D_VISU()
|
||||
|
||||
m_CopperLayersCount = 2;
|
||||
m_BoardSettings = NULL;
|
||||
m_copperThickness = 0;
|
||||
m_epoxyThickness = 0;
|
||||
m_nonCopperLayerThickness = 0;
|
||||
m_BiuTo3Dunits = 1.0;
|
||||
zpos_offset = 0.0;
|
||||
m_CopperThickness = 0;
|
||||
m_EpoxyThickness = 0;
|
||||
m_NonCopperLayerThickness = 0;
|
||||
|
||||
// default all special item layers Visible
|
||||
m_drawFlags.set();
|
||||
for( ii = 0; ii < FL_LAST; ii++ )
|
||||
m_drawFlags[ii] = true;
|
||||
|
||||
SetFlag( FL_GRID, false );
|
||||
SetFlag( FL_USE_COPPER_THICKNESS, false );
|
||||
SetFlag( FL_RENDER_SHADOWS, false );
|
||||
SetFlag( FL_RENDER_SHOW_HOLES_IN_ZONES, false );
|
||||
}
|
||||
|
||||
|
||||
@@ -87,17 +84,13 @@ INFO3D_VISU::~INFO3D_VISU()
|
||||
*/
|
||||
void INFO3D_VISU::InitSettings( BOARD* aBoard )
|
||||
{
|
||||
// Calculates the board bounding box
|
||||
// First, use only the board outlines
|
||||
EDA_RECT bbbox = aBoard->ComputeBoundingBox( true );
|
||||
EDA_RECT bbbox = aBoard->ComputeBoundingBox( false );
|
||||
|
||||
// If no outlines, use the board with items
|
||||
if( bbbox.GetWidth() == 0 && bbbox.GetHeight() == 0 )
|
||||
bbbox = aBoard->ComputeBoundingBox( false );
|
||||
|
||||
// Gives a non null size to avoid issues in zoom / scale calculations
|
||||
if( bbbox.GetWidth() == 0 && bbbox.GetHeight() == 0 )
|
||||
bbbox.Inflate( Millimeter2iu( 10 ) );
|
||||
{
|
||||
bbbox.SetWidth( 100 * IU_PER_MM );
|
||||
bbbox.SetHeight( 100 * IU_PER_MM );
|
||||
}
|
||||
|
||||
m_BoardSettings = &aBoard->GetDesignSettings();
|
||||
|
||||
@@ -114,109 +107,96 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
|
||||
|
||||
m_BiuTo3Dunits = 2.0 / std::max( m_BoardSize.x, m_BoardSize.y );
|
||||
|
||||
m_epoxyThickness = aBoard->GetDesignSettings().GetBoardThickness() * m_BiuTo3Dunits;
|
||||
m_EpoxyThickness = aBoard->GetDesignSettings().GetBoardThickness() * m_BiuTo3Dunits;
|
||||
|
||||
// TODO use value defined by user (currently use default values by ctor
|
||||
m_copperThickness = COPPER_THICKNESS * m_BiuTo3Dunits;
|
||||
m_nonCopperLayerThickness = TECH_LAYER_THICKNESS * m_BiuTo3Dunits;
|
||||
m_CopperThickness = COPPER_THICKNESS * m_BiuTo3Dunits;
|
||||
m_NonCopperLayerThickness = TECH_LAYER_THICKNESS * m_BiuTo3Dunits;
|
||||
|
||||
// Init Z position of each layer
|
||||
// calculate z position for each copper layer
|
||||
// Z = 0 is the z position of the back (bottom) layer (layer id = 31)
|
||||
// Z = m_epoxyThickness is the z position of the front (top) layer (layer id = 0)
|
||||
// all unused copper layer z position are set to 0
|
||||
int layer;
|
||||
int copper_layers_cnt = m_CopperLayersCount;
|
||||
|
||||
for( layer = 0; layer < copper_layers_cnt; layer++ )
|
||||
{
|
||||
m_layerZcoord[layer] =
|
||||
m_epoxyThickness - (m_epoxyThickness * layer / (copper_layers_cnt - 1));
|
||||
m_LayerZcoord[layer] =
|
||||
m_EpoxyThickness * layer / (copper_layers_cnt - 1);
|
||||
}
|
||||
|
||||
#define layerThicknessMargin 1.1
|
||||
double zpos_offset = m_nonCopperLayerThickness * layerThicknessMargin;
|
||||
double zpos_copper_back = - layerThicknessMargin*m_copperThickness/2;
|
||||
double zpos_copper_front = m_epoxyThickness + layerThicknessMargin*m_copperThickness/2;
|
||||
double zpos_offset = m_NonCopperLayerThickness * layerThicknessMargin;
|
||||
double zpos_copper_back = m_LayerZcoord[0] - layerThicknessMargin*m_CopperThickness/2;
|
||||
double zpos_copper_front = m_EpoxyThickness + layerThicknessMargin*m_CopperThickness/2;
|
||||
|
||||
// Fill remaining unused copper layers and back layer zpos
|
||||
// with 0
|
||||
for( ; layer < MAX_CU_LAYERS; layer++ )
|
||||
// Fill remaining unused copper layers and front layer zpos
|
||||
// with m_EpoxyThickness
|
||||
for( ; layer <= LAST_COPPER_LAYER; layer++ )
|
||||
{
|
||||
m_layerZcoord[layer] = 0;
|
||||
m_LayerZcoord[layer] = m_EpoxyThickness;
|
||||
}
|
||||
|
||||
// calculate z position for each non copper layer
|
||||
// Solder mask and Solder paste have the same Z position
|
||||
for( int layer_id = MAX_CU_LAYERS; layer_id < LAYER_ID_COUNT; layer_id++ )
|
||||
for( int layer_id = FIRST_NON_COPPER_LAYER; layer_id < NB_PCB_LAYERS; layer_id++ )
|
||||
{
|
||||
double zpos;
|
||||
|
||||
switch( layer_id )
|
||||
{
|
||||
case B_Adhes:
|
||||
case ADHESIVE_N_BACK:
|
||||
zpos = zpos_copper_back - 4 * zpos_offset;
|
||||
break;
|
||||
|
||||
case ADHESIVE_N_FRONT:
|
||||
zpos = zpos_copper_front + 4 * zpos_offset;
|
||||
break;
|
||||
|
||||
case SOLDERPASTE_N_BACK:
|
||||
zpos = zpos_copper_back - 3 * zpos_offset;
|
||||
break;
|
||||
|
||||
case F_Adhes:
|
||||
case SOLDERPASTE_N_FRONT:
|
||||
zpos = zpos_copper_front + 3 * zpos_offset;
|
||||
break;
|
||||
|
||||
case B_Paste:
|
||||
case SOLDERMASK_N_BACK:
|
||||
zpos = zpos_copper_back - 1 * zpos_offset;
|
||||
break;
|
||||
|
||||
case F_Paste:
|
||||
case SOLDERMASK_N_FRONT:
|
||||
zpos = zpos_copper_front + 1 * zpos_offset;
|
||||
break;
|
||||
|
||||
case B_Mask:
|
||||
zpos = zpos_copper_back - 1 * zpos_offset;
|
||||
break;
|
||||
|
||||
case F_Mask:
|
||||
zpos = zpos_copper_front + 1 * zpos_offset;
|
||||
break;
|
||||
|
||||
case B_SilkS:
|
||||
case SILKSCREEN_N_BACK:
|
||||
zpos = zpos_copper_back - 2 * zpos_offset;
|
||||
break;
|
||||
|
||||
case F_SilkS:
|
||||
case SILKSCREEN_N_FRONT:
|
||||
zpos = zpos_copper_front + 2 * zpos_offset;
|
||||
break;
|
||||
|
||||
default:
|
||||
zpos = zpos_copper_front + (layer_id - MAX_CU_LAYERS + 4) * zpos_offset;
|
||||
zpos = zpos_copper_front +
|
||||
(layer_id - FIRST_NON_COPPER_LAYER + 5) * zpos_offset;
|
||||
break;
|
||||
}
|
||||
|
||||
m_layerZcoord[layer_id] = zpos;
|
||||
m_LayerZcoord[layer_id] = zpos;
|
||||
}
|
||||
}
|
||||
|
||||
/* return the Z position of 3D shapes, in 3D Units
|
||||
* aIsFlipped: true for modules on Front (top) layer, false
|
||||
* if on back (bottom) layer
|
||||
* Note: in draw functions, the copper has a thickness = m_copperThickness
|
||||
* Vias and tracks are draw with the top side position = m_copperThickness/2
|
||||
* and the bottom side position = -m_copperThickness/2 from the Z layer position
|
||||
* Note: in draw functions, the copper has a thickness = m_CopperThickness
|
||||
* Vias and tracks are draw with the top side position = m_CopperThickness/2
|
||||
* and the bottom side position = -m_CopperThickness/2 from the Z layer position
|
||||
*/
|
||||
double INFO3D_VISU::GetModulesZcoord3DIU( bool aIsFlipped )
|
||||
{
|
||||
if( aIsFlipped )
|
||||
{
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_SOLDERPASTE ) )
|
||||
return m_layerZcoord[B_SilkS] - ( m_copperThickness / 2.0 );
|
||||
else
|
||||
return m_layerZcoord[B_Paste] - ( m_copperThickness / 2.0 );
|
||||
}
|
||||
if( aIsFlipped )
|
||||
return m_LayerZcoord[LAYER_N_BACK] - ( m_CopperThickness / 2 );
|
||||
else
|
||||
{
|
||||
if( g_Parm_3D_Visu.GetFlag( FL_SOLDERPASTE ) )
|
||||
return m_layerZcoord[F_SilkS] + ( m_copperThickness / 2.0 );
|
||||
else
|
||||
return m_layerZcoord[F_Paste] + ( m_copperThickness / 2.0 );
|
||||
}
|
||||
return m_LayerZcoord[LAYER_N_FRONT] + ( m_CopperThickness / 2 );
|
||||
}
|
||||
|
||||
|
||||
+32
-43
@@ -52,9 +52,7 @@
|
||||
|
||||
class BOARD_DESIGN_SETTINGS;
|
||||
|
||||
/** Minor class to store a 3D color (R, G, B) 3 floats range 0 to 1.0
|
||||
*/
|
||||
class S3D_COLOR
|
||||
class S3D_COLOR /* 3D color (R, G, B) 3 floats range 0 to 1.0*/
|
||||
{
|
||||
public:
|
||||
double m_Red, m_Green, m_Blue;
|
||||
@@ -64,6 +62,7 @@ public: S3D_COLOR()
|
||||
}
|
||||
};
|
||||
|
||||
/* information needed to display 3D board */
|
||||
enum DISPLAY3D_FLG {
|
||||
FL_AXIS=0, FL_MODULE, FL_ZONE,
|
||||
FL_ADHESIVE, FL_SILKSCREEN, FL_SOLDERMASK, FL_SOLDERPASTE,
|
||||
@@ -72,18 +71,10 @@ enum DISPLAY3D_FLG {
|
||||
FL_USE_COPPER_THICKNESS,
|
||||
FL_SHOW_BOARD_BODY,
|
||||
FL_USE_REALISTIC_MODE,
|
||||
FL_RENDER_SHADOWS,
|
||||
FL_RENDER_SHOW_HOLES_IN_ZONES,
|
||||
FL_RENDER_TEXTURES,
|
||||
FL_RENDER_SMOOTH_NORMALS,
|
||||
FL_RENDER_USE_MODEL_NORMALS,
|
||||
FL_RENDER_MATERIAL,
|
||||
FL_RENDER_SHOW_MODEL_BBOX,
|
||||
FL_LAST
|
||||
};
|
||||
|
||||
/** Helper class to handle information needed to display 3D board
|
||||
*/
|
||||
|
||||
class INFO3D_VISU
|
||||
{
|
||||
public:
|
||||
@@ -93,12 +84,6 @@ public:
|
||||
double m_Zoom; // 3D zoom value
|
||||
double m_3D_Grid; // 3D grid value, in mm
|
||||
S3D_COLOR m_BgColor;
|
||||
S3D_COLOR m_BgColor_Top;
|
||||
S3D_COLOR m_BoardBodyColor; // in realistic mode: FR4 board color
|
||||
S3D_COLOR m_SolderMaskColor; // in realistic mode: solder mask color
|
||||
S3D_COLOR m_SolderPasteColor; // in realistic mode: solder paste color
|
||||
S3D_COLOR m_SilkScreenColor; // in realistic mode: SilkScreen color
|
||||
S3D_COLOR m_CopperColor; // in realistic mode: copper color
|
||||
wxPoint m_BoardPos; // center board actual position in board units
|
||||
wxSize m_BoardSize; // board actual size in board units
|
||||
int m_CopperLayersCount; // Number of copper layers actually used by the board
|
||||
@@ -107,34 +92,35 @@ public:
|
||||
|
||||
double m_BiuTo3Dunits; // Normalization scale to convert board
|
||||
// internal units to 3D units
|
||||
// to normalize 3D units between -1.0 and +1.0
|
||||
|
||||
double zpos_offset;
|
||||
|
||||
// to scale 3D units between -1.0 and +1.0
|
||||
double m_CurrentZpos; // temporary storage of current value of Z position,
|
||||
// used in some calculation
|
||||
private:
|
||||
double m_layerZcoord[LAYER_ID_COUNT]; // Z position of each layer (normalized)
|
||||
double m_copperThickness; // Copper thickness (normalized)
|
||||
double m_epoxyThickness; // Epoxy thickness (normalized)
|
||||
double m_nonCopperLayerThickness; // Non copper layers thickness
|
||||
std::bitset<FL_LAST> m_drawFlags; // Enable/disable flags (see DISPLAY3D_FLG list)
|
||||
double m_LayerZcoord[NB_LAYERS]; // Z position of each layer (normalized)
|
||||
double m_CopperThickness; // Copper thickness (normalized)
|
||||
double m_EpoxyThickness; // Epoxy thickness (normalized)
|
||||
double m_NonCopperLayerThickness; // Non copper layers thickness
|
||||
bool m_drawFlags[FL_LAST]; // Enable/disable flags (see DISPLAY3D_FLG list)
|
||||
|
||||
public: INFO3D_VISU();
|
||||
~INFO3D_VISU();
|
||||
|
||||
// Accessors
|
||||
bool GetFlag( DISPLAY3D_FLG aFlag ) const { return m_drawFlags[aFlag]; }
|
||||
void SetFlag( DISPLAY3D_FLG aFlag, bool aState )
|
||||
bool SetFlag( DISPLAY3D_FLG aFlag, bool aState )
|
||||
{
|
||||
m_drawFlags[aFlag] = aState;
|
||||
return m_drawFlags[aFlag] = aState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize 3D Parameters depending on aBoard
|
||||
* Function InitSettings
|
||||
* Initialize info 3D Parameters from aBoard
|
||||
* @param aBoard: the board to display
|
||||
*/
|
||||
void InitSettings( BOARD* aBoard );
|
||||
|
||||
/**
|
||||
* function GetModulesZcoord3DIU
|
||||
* @return the Z position of 3D shapes, in 3D Units
|
||||
* @param aIsFlipped: true for modules on Front (top) layer, false
|
||||
* if on back (bottom) layer
|
||||
@@ -142,15 +128,17 @@ public: INFO3D_VISU();
|
||||
double GetModulesZcoord3DIU( bool aIsFlipped );
|
||||
|
||||
/**
|
||||
* function GetLayerZcoordBIU
|
||||
* @return the Z coordinate of the layer aLayer, in Board Internal Units
|
||||
* @param aLayerId: the layer number
|
||||
*/
|
||||
int GetLayerZcoordBIU( int aLayerId )
|
||||
{
|
||||
return KiROUND( m_layerZcoord[aLayerId] / m_BiuTo3Dunits );
|
||||
return KiROUND( m_LayerZcoord[aLayerId] / m_BiuTo3Dunits );
|
||||
}
|
||||
|
||||
/**
|
||||
* function GetCopperThicknessBIU
|
||||
* @return the thickness (Z size) of the copper, in Board Internal Units
|
||||
* note: the thickness (Z size) of the copper is not the thickness
|
||||
* of the layer (the thickness of the layer is the epoxy thickness / layer count)
|
||||
@@ -160,10 +148,10 @@ public: INFO3D_VISU();
|
||||
*/
|
||||
int GetCopperThicknessBIU() const
|
||||
{
|
||||
bool use_thickness = GetFlag( FL_USE_COPPER_THICKNESS );
|
||||
|
||||
return use_thickness ?
|
||||
KiROUND( m_copperThickness / m_BiuTo3Dunits )
|
||||
bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
|
||||
GetFlag( FL_USE_REALISTIC_MODE );
|
||||
return use_copper_thickness ?
|
||||
KiROUND( m_CopperThickness / m_BiuTo3Dunits )
|
||||
: 0;
|
||||
}
|
||||
|
||||
@@ -173,7 +161,7 @@ public: INFO3D_VISU();
|
||||
*/
|
||||
int GetEpoxyThicknessBIU() const
|
||||
{
|
||||
return KiROUND( m_epoxyThickness / m_BiuTo3Dunits );
|
||||
return KiROUND( m_EpoxyThickness / m_BiuTo3Dunits );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,9 +173,10 @@ public: INFO3D_VISU();
|
||||
*/
|
||||
int GetNonCopperLayerThicknessBIU() const
|
||||
{
|
||||
bool use_thickness = GetFlag( FL_USE_COPPER_THICKNESS );
|
||||
return use_thickness ?
|
||||
KiROUND( m_nonCopperLayerThickness / m_BiuTo3Dunits )
|
||||
bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
|
||||
GetFlag( FL_USE_REALISTIC_MODE );
|
||||
return use_copper_thickness ?
|
||||
KiROUND( m_NonCopperLayerThickness / m_BiuTo3Dunits )
|
||||
: 0;
|
||||
}
|
||||
|
||||
@@ -198,11 +187,11 @@ public: INFO3D_VISU();
|
||||
*
|
||||
* Note: if m_drawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0
|
||||
*/
|
||||
int GetLayerObjectThicknessBIU( int aLayerId ) const
|
||||
int GetLayerObjectThicknessBIU( int aLayerId) const
|
||||
{
|
||||
return IsCopperLayer( aLayerId ) ?
|
||||
GetCopperThicknessBIU() :
|
||||
GetNonCopperLayerThicknessBIU();
|
||||
return aLayerId >= FIRST_NON_COPPER_LAYER ?
|
||||
GetNonCopperLayerThicknessBIU() :
|
||||
GetCopperThicknessBIU();
|
||||
}
|
||||
|
||||
bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); }
|
||||
|
||||
+62
-167
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -30,12 +30,16 @@
|
||||
#define MODELPARSERS_H
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <wx/string.h>
|
||||
#include <3d_mesh_model.h>
|
||||
|
||||
|
||||
class S3D_MASTER;
|
||||
class S3D_VERTEX;
|
||||
|
||||
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
|
||||
|
||||
class S3D_MODEL_PARSER;
|
||||
class X3D_MODEL_PARSER;
|
||||
|
||||
/**
|
||||
@@ -45,11 +49,12 @@ class X3D_MODEL_PARSER;
|
||||
class S3D_MODEL_PARSER
|
||||
{
|
||||
public:
|
||||
S3D_MODEL_PARSER( S3D_MASTER* aMaster ) :
|
||||
S3D_MODEL_PARSER(S3D_MASTER* aMaster) :
|
||||
master( aMaster )
|
||||
{}
|
||||
|
||||
virtual ~S3D_MODEL_PARSER(){}
|
||||
virtual ~S3D_MODEL_PARSER()
|
||||
{}
|
||||
|
||||
S3D_MASTER* GetMaster()
|
||||
{
|
||||
@@ -65,19 +70,12 @@ public:
|
||||
* @param aExtension is file extension of the file you are going to parse.
|
||||
*/
|
||||
static S3D_MODEL_PARSER* Create( S3D_MASTER* aMaster, const wxString aExtension );
|
||||
|
||||
/**
|
||||
* virtual Function
|
||||
* Function Load
|
||||
*
|
||||
* Concrete parsers should implement this function
|
||||
* @param aFilename = the full file name of the file to load
|
||||
* @return true if as succeeded
|
||||
*/
|
||||
virtual bool Load( const wxString& aFilename )
|
||||
{
|
||||
return false;
|
||||
};
|
||||
|
||||
S3D_MESH_PTRS childs;
|
||||
virtual void Load( const wxString aFilename ) = 0;
|
||||
|
||||
private:
|
||||
S3D_MASTER* master;
|
||||
@@ -95,11 +93,10 @@ class X3D_MODEL_PARSER: public S3D_MODEL_PARSER
|
||||
public:
|
||||
X3D_MODEL_PARSER( S3D_MASTER* aMaster );
|
||||
~X3D_MODEL_PARSER();
|
||||
|
||||
bool Load( const wxString& aFilename );
|
||||
void Load( const wxString aFilename );
|
||||
|
||||
typedef std::map< wxString, wxString > PROPERTY_MAP;
|
||||
typedef std::vector< wxXmlNode* > NODE_LIST;
|
||||
typedef std::vector< wxXmlNode* > NODE_LIST;
|
||||
|
||||
/**
|
||||
* Function GetChildsByName
|
||||
@@ -120,10 +117,14 @@ public:
|
||||
*/
|
||||
static void GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps );
|
||||
|
||||
private:
|
||||
wxString m_Filename;
|
||||
S3D_MESH_PTR m_model;
|
||||
/**
|
||||
* Return string representing x3d file in vrml format
|
||||
* Function Load must be called before this function, otherwise empty
|
||||
* data set is returned.
|
||||
*/
|
||||
wxString VRML_representation();
|
||||
|
||||
private:
|
||||
std::vector< wxString > vrml_materials;
|
||||
std::vector< wxString > vrml_points;
|
||||
std::vector< wxString > vrml_coord_indexes;
|
||||
@@ -136,163 +137,57 @@ private:
|
||||
void rotate( S3D_VERTEX& aCoordinate, S3D_VERTEX& aRotAxis, double angle );
|
||||
};
|
||||
|
||||
|
||||
typedef std::map< std::string, std::vector< glm::vec3 > > VRML2_COORDINATE_MAP;
|
||||
typedef std::map< std::string, S3D_MESH_PTR > VRML2_DEF_GROUP_MAP;
|
||||
|
||||
/**
|
||||
* class VRML2_MODEL_PARSER
|
||||
* Parses
|
||||
*/
|
||||
class VRML2_MODEL_PARSER
|
||||
{
|
||||
public:
|
||||
VRML2_MODEL_PARSER( S3D_MODEL_PARSER* aModelParser );
|
||||
~VRML2_MODEL_PARSER();
|
||||
|
||||
bool Load( const wxString& aFilename );
|
||||
|
||||
/**
|
||||
* Function Load
|
||||
* Load a VRML2 filename and apply a transformation to the root
|
||||
* @param aFilename file name with path
|
||||
* @param aTransformationModel a model with translation, rotation and scale to apply to default root
|
||||
* @return bool - true if finnished with success
|
||||
*/
|
||||
bool Load( const wxString& aFilename, S3D_MESH_PTR aTransformationModel );
|
||||
|
||||
/**
|
||||
* Return string representing VRML2 file in vrml2 format
|
||||
* Function Load must be called before this function, otherwise empty
|
||||
* data set is returned.
|
||||
*/
|
||||
wxString VRML2_representation();
|
||||
|
||||
private:
|
||||
int loadFileModel( S3D_MESH_PTR transformationModel );
|
||||
int read_Transform();
|
||||
int read_DEF();
|
||||
int read_DEF_Coordinate();
|
||||
int read_Shape();
|
||||
int read_appearance();
|
||||
int read_Appearance();
|
||||
int read_material();
|
||||
int read_Material();
|
||||
int read_IndexedFaceSet();
|
||||
int read_IndexedLineSet();
|
||||
int read_Coordinate();
|
||||
int read_CoordinateDef();
|
||||
int read_Normal();
|
||||
int read_NormalIndex();
|
||||
int read_Color();
|
||||
int read_coordIndex();
|
||||
int read_colorIndex();
|
||||
int read_geometry();
|
||||
int read_IndexedFaceSet_USE();
|
||||
int read_Transform_USE();
|
||||
int read_Inline();
|
||||
|
||||
/** Function debug_enter
|
||||
* Used in debug to increase a ' ' in the m_debugSpacer,
|
||||
* should be called after the first debug comment in a function
|
||||
*/
|
||||
void debug_enter();
|
||||
|
||||
/** Function debug_exit
|
||||
* Used in debug to decrease a ' ' in the m_debugSpacer,
|
||||
* should be called before the last debug comment in a funtion before exit
|
||||
*/
|
||||
void debug_exit();
|
||||
|
||||
bool m_normalPerVertex;
|
||||
bool colorPerVertex;
|
||||
S3D_MESH_PTR m_model; ///< It stores the current model that the parsing is adding data
|
||||
FILE* m_file;
|
||||
wxFileName m_Filename;
|
||||
VRML2_COORDINATE_MAP m_defCoordinateMap;
|
||||
VRML2_DEF_GROUP_MAP m_defGroupMap; ///< Stores a list of labels for groups and meshs that will be used later by the USE keyword
|
||||
S3D_MODEL_PARSER* m_ModelParser;
|
||||
S3D_MASTER* m_Master;
|
||||
wxString m_debugSpacer; ///< Used to give identation space
|
||||
|
||||
int m_counter_DEF_GROUP; ///< Counts the number of DEF * GROUPS used
|
||||
int m_counter_USE_GROUP; ///< Counts the number of USE * used, in the end, if m_counter_DEF_GROUP > 0 and m_counter_USE_GROUP == 0 then it will add the first group with childs
|
||||
|
||||
bool m_discardLastGeometry; ///< If true, it should not store the latest loaded geometry (used to discard IndexedLineSet, but load it)
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* class VRML1_MODEL_PARSER
|
||||
* Parses
|
||||
*/
|
||||
class VRML1_MODEL_PARSER
|
||||
{
|
||||
public:
|
||||
VRML1_MODEL_PARSER( S3D_MODEL_PARSER* aModelParser );
|
||||
~VRML1_MODEL_PARSER();
|
||||
|
||||
bool Load( const wxString& aFilename );
|
||||
|
||||
/**
|
||||
* Return string representing VRML2 file in vrml2 format
|
||||
* Function Load must be called before this function, otherwise empty
|
||||
* data set is returned.
|
||||
*/
|
||||
wxString VRML2_representation();
|
||||
|
||||
private:
|
||||
int read_separator();
|
||||
int readMaterial();
|
||||
int readCoordinate3();
|
||||
int readIndexedFaceSet();
|
||||
|
||||
int readMaterial_ambientColor();
|
||||
int readMaterial_diffuseColor();
|
||||
int readMaterial_emissiveColor();
|
||||
int readMaterial_specularColor();
|
||||
int readMaterial_shininess();
|
||||
int readMaterial_transparency();
|
||||
|
||||
int readCoordinate3_point();
|
||||
|
||||
int readIndexedFaceSet_coordIndex();
|
||||
int readIndexedFaceSet_materialIndex();
|
||||
|
||||
bool m_normalPerVertex;
|
||||
bool colorPerVertex;
|
||||
S3D_MESH_PTR m_model;
|
||||
FILE* m_file;
|
||||
wxString m_Filename;
|
||||
S3D_MODEL_PARSER* m_ModelParser;
|
||||
S3D_MASTER* m_Master;
|
||||
};
|
||||
|
||||
/**
|
||||
* class VRML_MODEL_PARSER
|
||||
* class WRL_MODEL_PARSER
|
||||
* Parses
|
||||
*/
|
||||
class VRML_MODEL_PARSER: public S3D_MODEL_PARSER
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* ctor: initialize a VRML file parser
|
||||
* @param aMaster = a ref to a 3D footprint shape description to fill
|
||||
* by the vrml file data
|
||||
*/
|
||||
VRML_MODEL_PARSER( S3D_MASTER* aMaster );
|
||||
~VRML_MODEL_PARSER();
|
||||
void Load( const wxString aFilename );
|
||||
|
||||
private:
|
||||
/**
|
||||
* Function ReadMaterial
|
||||
* read the description of a 3D material definition in the form:
|
||||
* DEF yellow material Material (
|
||||
* DiffuseColor 1.00000 1.00000 0.00000e 0
|
||||
* EmissiveColor 0.00000e 0 0.00000e 0 0.00000e 0
|
||||
* SpecularColor 1.00000 1.00000 1.00000
|
||||
* AmbientIntensity 1.00000
|
||||
* Transparency 0.00000e 0
|
||||
* Shininess 1.00000
|
||||
*)
|
||||
* Or type:
|
||||
* USE yellow material
|
||||
*/
|
||||
int readMaterial( FILE* file, int* LineNum );
|
||||
int readChildren( FILE* file, int* LineNum );
|
||||
int readShape( FILE* file, int* LineNum );
|
||||
int readAppearance( FILE* file, int* LineNum );
|
||||
int readGeometry( FILE* file, int* LineNum );
|
||||
|
||||
/**
|
||||
* Function load
|
||||
* Load a 3D file and build a S3D_MASTER shape.
|
||||
* file has .vrml ext and can be VRML 1 or VRML 2 format
|
||||
* @param aFilename = the full filename to read
|
||||
* @param aVrmlunits_to_3Dunits = the csaling factor to convert the 3D file unit
|
||||
* to our internal units.
|
||||
* Function ReadCoordList
|
||||
* reads 3D coordinate lists like:
|
||||
* coord Coordinate { point [
|
||||
* -5.24489 6.57640e-3 -9.42129e-2,
|
||||
* -5.11821 6.57421e-3 0.542654,
|
||||
* -3.45868 0.256565 1.32000 ] }
|
||||
* or:
|
||||
* normal Normal { vector [
|
||||
* 0.995171 -6.08102e-6 9.81541e-2,
|
||||
* 0.923880 -4.09802e-6 0.382683,
|
||||
* 0.707107 -9.38186e-7 0.707107]
|
||||
* }
|
||||
*
|
||||
* text_buffer contains the first line of this node :
|
||||
* "coord Coordinate { point ["
|
||||
*/
|
||||
bool Load( const wxString& aFilename );
|
||||
void readCoordsList( FILE* file, char* text_buffer, std::vector< double >& aList,
|
||||
int* LineNum );
|
||||
};
|
||||
|
||||
|
||||
#endif // MODELPARSERS_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@
|
||||
* LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
||||
* THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN PAD_CONNECTION WITH THE
|
||||
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* US Government Users Restricted Rights
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
||||
* THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN PAD_CONNECTION WITH THE
|
||||
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* US Government Users Restricted Rights
|
||||
|
||||
@@ -1,270 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014-2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file vrml_aux.cpp
|
||||
* @brief implements auxiliar functions to parse VRML files
|
||||
*/
|
||||
|
||||
#include "vrml_aux.h"
|
||||
|
||||
|
||||
bool GetString( FILE* File, char* aDstString, size_t maxDstLen )
|
||||
{
|
||||
|
||||
if( (!aDstString) || (maxDstLen == 0) )
|
||||
return false;
|
||||
|
||||
int c;
|
||||
|
||||
while( ( c = fgetc( File ) ) != EOF )
|
||||
{
|
||||
if( c == '\"' )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( c != '\"' )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
while( (( c = fgetc( File ) ) != EOF) && (maxDstLen > 0) )
|
||||
{
|
||||
if( c == '\"' )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
maxDstLen--;
|
||||
|
||||
*aDstString = c;
|
||||
aDstString++;
|
||||
|
||||
}
|
||||
|
||||
*aDstString = 0;
|
||||
|
||||
if( c == '\"' )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static int SkipGetChar ( FILE* File );
|
||||
|
||||
|
||||
static int SkipGetChar( FILE* File )
|
||||
{
|
||||
int c;
|
||||
bool re_parse;
|
||||
|
||||
if( ( c = fgetc( File ) ) == EOF )
|
||||
{
|
||||
// DBG( printf( "EOF\n" ) );
|
||||
return EOF;
|
||||
}
|
||||
|
||||
// DBG( printf( "c %c 0x%02X\n", c, c ) );
|
||||
|
||||
do
|
||||
{
|
||||
re_parse = false;
|
||||
|
||||
if( (c == ' ') || (c == '\t') || (c == '{') || (c == '[') )
|
||||
{
|
||||
// DBG( printf( "Skipping space \\t or { or [\n" ) );
|
||||
do
|
||||
{
|
||||
if( ( c = fgetc( File ) ) == EOF )
|
||||
{
|
||||
// DBG( printf( "EOF\n" ) );
|
||||
|
||||
return EOF;
|
||||
}
|
||||
} while( (c == ' ') || (c == '\t') || (c == '{') || (c == '[') );
|
||||
}
|
||||
|
||||
if( (c == '#') || (c == '\n') || (c == '\r') || (c == 0) || (c == ',') )
|
||||
{
|
||||
if( c == '#' )
|
||||
{
|
||||
// DBG( printf( "Skipping # \\n or \\r or 0, 0x%02X\n", c ) );
|
||||
do
|
||||
{
|
||||
if( ( c = fgetc( File ) ) == EOF )
|
||||
{
|
||||
// DBG( printf( "EOF\n" ) );
|
||||
return EOF;
|
||||
}
|
||||
} while( (c != '\n') && (c != '\r') && (c != 0) && (c != ',') );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ( c = fgetc( File ) ) == EOF )
|
||||
{
|
||||
// DBG( printf( "EOF\n" ) );
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
|
||||
re_parse = true;
|
||||
}
|
||||
} while( re_parse == true );
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
bool GetNextTag( FILE* File, char* tag, size_t len )
|
||||
{
|
||||
int c = SkipGetChar( File );
|
||||
|
||||
if( c == EOF )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
tag[0] = c;
|
||||
tag[1] = 0;
|
||||
|
||||
// DBG( printf( "tag[0] %c\n", tag[0] ) );
|
||||
if( (c != '}') && (c != ']') )
|
||||
{
|
||||
len--;
|
||||
char* dst = &tag[1];
|
||||
|
||||
while( fscanf( File, "%c", dst ) && len > 0 )
|
||||
{
|
||||
if( (*dst == ' ') || (*dst == '[') || (*dst == '{')
|
||||
|| (*dst == '\t') || (*dst == '\n')|| (*dst == '\r') )
|
||||
{
|
||||
*dst = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
dst++;
|
||||
len--;
|
||||
}
|
||||
|
||||
|
||||
// DBG( printf( "tag %s\n", tag ) );
|
||||
c = SkipGetChar( File );
|
||||
|
||||
if( c != EOF )
|
||||
{
|
||||
// Puts again the read char in the buffer
|
||||
ungetc( c, File );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int Read_NotImplemented( FILE* File, char closeChar )
|
||||
{
|
||||
int c;
|
||||
|
||||
// DBG( printf( "look for %c\n", closeChar) );
|
||||
while( ( c = fgetc( File ) ) != EOF )
|
||||
{
|
||||
if( c == '{' )
|
||||
{
|
||||
// DBG( printf( "{\n") );
|
||||
Read_NotImplemented( File, '}' );
|
||||
}
|
||||
else if( c == '[' )
|
||||
{
|
||||
// DBG( printf( "[\n") );
|
||||
Read_NotImplemented( File, ']' );
|
||||
}
|
||||
else if( c == closeChar )
|
||||
{
|
||||
// DBG( printf( "%c\n", closeChar) );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// DBG( printf( " NotImplemented failed\n" ) );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int ParseVertexList( FILE* File, std::vector<glm::vec3>& dst_vector )
|
||||
{
|
||||
// DBG( printf( " ParseVertexList\n" ) );
|
||||
|
||||
dst_vector.clear();
|
||||
|
||||
glm::vec3 vertex;
|
||||
|
||||
while( ParseVertex( File, vertex ) )
|
||||
{
|
||||
dst_vector.push_back( vertex );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool ParseVertex( FILE* File, glm::vec3& dst_vertex )
|
||||
{
|
||||
float a, b, c;
|
||||
int ret = fscanf( File, "%e %e %e", &a, &b, &c );
|
||||
|
||||
dst_vertex.x = a;
|
||||
dst_vertex.y = b;
|
||||
dst_vertex.z = c;
|
||||
|
||||
int s = SkipGetChar( File );
|
||||
|
||||
if( s != EOF )
|
||||
{
|
||||
// Puts again the read char in the buffer
|
||||
ungetc( s, File );
|
||||
}
|
||||
|
||||
// DBG( printf( "ret%d(%.9f,%.9f,%.9f)", ret, a,b,c) );
|
||||
|
||||
return ret == 3;
|
||||
}
|
||||
|
||||
|
||||
bool ParseFloat( FILE* aFile, float *aDstFloat, float aDefaultValue )
|
||||
{
|
||||
float value;
|
||||
int ret = fscanf( aFile, "%e", &value );
|
||||
|
||||
if( ret == 1 )
|
||||
*aDstFloat = value;
|
||||
else
|
||||
*aDstFloat = aDefaultValue;
|
||||
|
||||
return ret == 1;
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014-2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file vrml_aux.h
|
||||
* @brief auxiliar functions to parse VRML files
|
||||
*/
|
||||
|
||||
#ifndef _VRML_AUX_H
|
||||
#define _VRML_AUX_H
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <macros.h>
|
||||
#include <base_struct.h>
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <gal/opengl/glm/glm.hpp>
|
||||
#include <vector>
|
||||
#include <kicad_string.h>
|
||||
#include <info3d_visu.h>
|
||||
#ifdef __WXMAC__
|
||||
# ifdef __DARWIN__
|
||||
# include <OpenGL/glu.h>
|
||||
# else
|
||||
# include <glu.h>
|
||||
# endif
|
||||
#else
|
||||
# include <GL/glu.h>
|
||||
#endif
|
||||
#include <wx/glcanvas.h>
|
||||
|
||||
/**
|
||||
* Function GetEpoxyThicknessBIU
|
||||
* skip a VRML block and eventualy internal blocks until it find the close char
|
||||
* @param File file to read from
|
||||
* @param closeChar the expected close char of the block
|
||||
* @return int - -1 if failed, 0 if OK
|
||||
*/
|
||||
int Read_NotImplemented( FILE* File, char closeChar);
|
||||
|
||||
|
||||
/**
|
||||
* Function ParseVertexList
|
||||
* parse a vertex list
|
||||
* @param File file to read from
|
||||
* @param dst_vector destination vector list
|
||||
* @return int - -1 if failed, 0 if OK
|
||||
*/
|
||||
int ParseVertexList( FILE* File, std::vector< glm::vec3 > &dst_vector);
|
||||
|
||||
|
||||
/**
|
||||
* Function ParseVertex
|
||||
* parse a vertex
|
||||
* @param File file to read from
|
||||
* @param dst_vertex destination vector
|
||||
* @return bool - return true if the 3 elements are read
|
||||
*/
|
||||
bool ParseVertex( FILE* File, glm::vec3 &dst_vertex );
|
||||
|
||||
|
||||
/**
|
||||
* Function ParseFloat
|
||||
* parse a float value
|
||||
* @param aFile file to read from
|
||||
* @param aDstFloat destination float
|
||||
* @param aDefaultValue = the default value, when the actual value cannot be read
|
||||
* @return bool - Return true if the float was read without error
|
||||
*/
|
||||
bool ParseFloat( FILE* aFile, float *aDstFloat, float aDefaultValue );
|
||||
|
||||
/**
|
||||
* Function GetNextTag
|
||||
* parse the next tag
|
||||
* @param File file to read from
|
||||
* @param tag destination pointer
|
||||
* @param len max length of storage
|
||||
* @return bool - true if succeeded, false if EOF
|
||||
*/
|
||||
bool GetNextTag( FILE* File, char* tag, size_t len );
|
||||
|
||||
/**
|
||||
* Function GetString
|
||||
* parse a string, it expects starting by " and end with "
|
||||
* @param File file to read from
|
||||
* @param aDstString destination pointer
|
||||
* @param maxDstLen max length of storage
|
||||
* @return bool - true if successful read the string, false if failed to get a string
|
||||
*/
|
||||
bool GetString( FILE* File, char* aDstString, size_t maxDstLen );
|
||||
|
||||
#endif
|
||||
@@ -1,439 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 Mario Luzeiro <mrluzeiro@gmail.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file vrml_v1_modelparser.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <vector>
|
||||
#include <macros.h>
|
||||
#include <kicad_string.h>
|
||||
#include <info3d_visu.h>
|
||||
|
||||
#include "3d_struct.h"
|
||||
#include "modelparsers.h"
|
||||
#include "vrml_aux.h"
|
||||
|
||||
#define BUFLINE_SIZE 32
|
||||
|
||||
/**
|
||||
* Trace mask used to enable or disable the trace output of the VRML V1 parser code.
|
||||
* The debug output can be turned on by setting the WXTRACE environment variable to
|
||||
* "KI_TRACE_VRML_V1_PARSER". See the wxWidgets documentation on wxLogTrace for
|
||||
* more information.
|
||||
*/
|
||||
static const wxChar* traceVrmlV1Parser = wxT( "KI_TRACE_VRML_V1_PARSER" );
|
||||
|
||||
|
||||
VRML1_MODEL_PARSER::VRML1_MODEL_PARSER( S3D_MODEL_PARSER* aModelParser )
|
||||
{
|
||||
m_ModelParser = aModelParser;
|
||||
m_Master = m_ModelParser->GetMaster();
|
||||
m_model.reset();
|
||||
m_file = NULL;
|
||||
m_normalPerVertex = true;
|
||||
colorPerVertex = true;
|
||||
}
|
||||
|
||||
|
||||
VRML1_MODEL_PARSER::~VRML1_MODEL_PARSER()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool VRML1_MODEL_PARSER::Load( const wxString& aFilename )
|
||||
{
|
||||
char text[BUFLINE_SIZE];
|
||||
|
||||
wxLogTrace( traceVrmlV1Parser, wxT( "Loading: %s" ), GetChars( aFilename ) );
|
||||
|
||||
m_file = wxFopen( aFilename, wxT( "rt" ) );
|
||||
|
||||
if( m_file == NULL )
|
||||
return false;
|
||||
|
||||
// Switch the locale to standard C (needed to print floating point numbers)
|
||||
LOCALE_IO toggle;
|
||||
|
||||
m_ModelParser->childs.clear();
|
||||
|
||||
while( GetNextTag( m_file, text, sizeof(text) ) )
|
||||
{
|
||||
if( ( *text == '}' ) || ( *text == ']' ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strcmp( text, "Separator" ) == 0 )
|
||||
{
|
||||
m_model.reset( new S3D_MESH() );
|
||||
m_ModelParser->childs.push_back( m_model );
|
||||
read_separator();
|
||||
}
|
||||
}
|
||||
|
||||
fclose( m_file );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::read_separator()
|
||||
{
|
||||
char text[BUFLINE_SIZE];
|
||||
|
||||
// DBG( printf( "Separator\n" ) );
|
||||
|
||||
while( GetNextTag( m_file, text, sizeof(text) ) )
|
||||
{
|
||||
if( strcmp( text, "Material" ) == 0 )
|
||||
{
|
||||
readMaterial();
|
||||
}
|
||||
else if( strcmp( text, "Coordinate3" ) == 0 )
|
||||
{
|
||||
readCoordinate3();
|
||||
}
|
||||
else if( strcmp( text, "IndexedFaceSet" ) == 0 )
|
||||
{
|
||||
readIndexedFaceSet();
|
||||
}
|
||||
else if( strcmp( text, "Separator" ) == 0 )
|
||||
{
|
||||
S3D_MESH_PTR parent( m_model.get() );
|
||||
|
||||
S3D_MESH_PTR new_mesh_model( new S3D_MESH() );
|
||||
|
||||
m_model->childs.push_back( new_mesh_model );
|
||||
|
||||
m_model.reset( new_mesh_model.get() );
|
||||
|
||||
// recursive
|
||||
read_separator();
|
||||
|
||||
m_model.reset( parent.get() );
|
||||
}
|
||||
else if( ( *text != '}' ) )
|
||||
{
|
||||
// DBG( printf( "read_NotImplemented %s\n", text ) );
|
||||
Read_NotImplemented( m_file, '}' );
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readMaterial()
|
||||
{
|
||||
char text[BUFLINE_SIZE];
|
||||
S3D_MATERIAL* material = NULL;
|
||||
|
||||
// DBG( printf( " readMaterial\n" ) );
|
||||
|
||||
wxString mat_name;
|
||||
|
||||
material = new S3D_MATERIAL( m_Master, mat_name );
|
||||
|
||||
m_Master->Insert( material );
|
||||
|
||||
m_model->m_Materials = material;
|
||||
|
||||
while( GetNextTag( m_file, text, sizeof(text) ) )
|
||||
{
|
||||
if( *text == ']' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( *text == '}' )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( strcmp( text, "ambientColor" ) == 0 )
|
||||
{
|
||||
readMaterial_ambientColor();
|
||||
}
|
||||
else if( strcmp( text, "diffuseColor" ) == 0 )
|
||||
{
|
||||
readMaterial_diffuseColor();
|
||||
}
|
||||
else if( strcmp( text, "emissiveColor" ) == 0 )
|
||||
{
|
||||
readMaterial_emissiveColor();
|
||||
}
|
||||
else if( strcmp( text, "specularColor" ) == 0 )
|
||||
{
|
||||
readMaterial_specularColor();
|
||||
}
|
||||
else if( strcmp( text, "shininess" ) == 0 )
|
||||
{
|
||||
readMaterial_shininess();
|
||||
}
|
||||
else if( strcmp( text, "transparency" ) == 0 )
|
||||
{
|
||||
readMaterial_transparency();
|
||||
}
|
||||
}
|
||||
|
||||
wxLogTrace( traceVrmlV1Parser, wxT( " readMaterial failed" ) );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readCoordinate3()
|
||||
{
|
||||
char text[BUFLINE_SIZE];
|
||||
|
||||
// DBG( printf( " readCoordinate3\n" ) );
|
||||
|
||||
while( GetNextTag( m_file, text, sizeof( text ) ) )
|
||||
{
|
||||
if( *text == ']' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( *text == '}' )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( strcmp( text, "point" ) == 0 )
|
||||
{
|
||||
readCoordinate3_point();
|
||||
}
|
||||
}
|
||||
|
||||
wxLogTrace( traceVrmlV1Parser, wxT( " readCoordinate3 failed" ) );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readIndexedFaceSet()
|
||||
{
|
||||
char text[BUFLINE_SIZE];
|
||||
|
||||
// DBG( printf( " readIndexedFaceSet\n" ) );
|
||||
|
||||
while( GetNextTag( m_file, text, sizeof(text) ) )
|
||||
{
|
||||
if( *text == ']' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( *text == '}' )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( strcmp( text, "coordIndex" ) == 0 )
|
||||
{
|
||||
readIndexedFaceSet_coordIndex();
|
||||
}
|
||||
else if( strcmp( text, "materialIndex" ) == 0 )
|
||||
{
|
||||
readIndexedFaceSet_materialIndex();
|
||||
}
|
||||
}
|
||||
|
||||
wxLogTrace( traceVrmlV1Parser, wxT( " readIndexedFaceSet failed" ) );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readMaterial_ambientColor()
|
||||
{
|
||||
// DBG( printf( " readMaterial_ambientColor\n" ) );
|
||||
|
||||
return ParseVertexList( m_file, m_model->m_Materials->m_AmbientColor );
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readMaterial_diffuseColor()
|
||||
{
|
||||
// DBG( printf( " readMaterial_diffuseColor\n" ) );
|
||||
|
||||
return ParseVertexList( m_file, m_model->m_Materials->m_DiffuseColor );
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readMaterial_emissiveColor()
|
||||
{
|
||||
// DBG( printf( " readMaterial_emissiveColor\n" ) );
|
||||
|
||||
int ret = ParseVertexList( m_file, m_model->m_Materials->m_EmissiveColor );
|
||||
|
||||
if( m_Master->m_use_modelfile_emissiveColor == false )
|
||||
{
|
||||
m_model->m_Materials->m_EmissiveColor.clear();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readMaterial_specularColor()
|
||||
{
|
||||
// DBG( printf( " readMaterial_specularColor\n" ) );
|
||||
|
||||
int ret = ParseVertexList( m_file, m_model->m_Materials->m_SpecularColor );
|
||||
|
||||
if( m_Master->m_use_modelfile_specularColor == false )
|
||||
{
|
||||
m_model->m_Materials->m_SpecularColor.clear();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readMaterial_shininess()
|
||||
{
|
||||
// DBG( printf( " readMaterial_shininess\n" ) );
|
||||
|
||||
m_model->m_Materials->m_Shininess.clear();
|
||||
|
||||
float shininess_value;
|
||||
|
||||
while( fscanf( m_file, "%f,", &shininess_value ) )
|
||||
{
|
||||
// VRML value is normalized and openGL expects a value 0 - 128
|
||||
shininess_value = shininess_value * 128.0f;
|
||||
m_model->m_Materials->m_Shininess.push_back( shininess_value );
|
||||
}
|
||||
|
||||
if( m_Master->m_use_modelfile_shininess == false )
|
||||
{
|
||||
m_model->m_Materials->m_Shininess.clear();
|
||||
}
|
||||
|
||||
// DBG( printf( " m_Shininess.size: %ld\n", m_model->m_Materials->m_Shininess.size() ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readMaterial_transparency()
|
||||
{
|
||||
// DBG( printf( " readMaterial_transparency\n" ) );
|
||||
|
||||
m_model->m_Materials->m_Transparency.clear();
|
||||
|
||||
float tmp;
|
||||
|
||||
while( fscanf( m_file, "%f,", &tmp ) )
|
||||
{
|
||||
m_model->m_Materials->m_Transparency.push_back( tmp );
|
||||
}
|
||||
|
||||
if( m_Master->m_use_modelfile_transparency == false )
|
||||
{
|
||||
m_model->m_Materials->m_Transparency.clear();
|
||||
}
|
||||
|
||||
// DBG( printf( " m_Transparency.size: %ld\n", m_model->m_Materials->m_Transparency.size() ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readCoordinate3_point()
|
||||
{
|
||||
// DBG( printf( " readCoordinate3_point\n" ) );
|
||||
|
||||
if( ParseVertexList( m_file, m_model->m_Point ) == 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
wxLogTrace( traceVrmlV1Parser, wxT( " readCoordinate3_point failed" ) );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readIndexedFaceSet_coordIndex()
|
||||
{
|
||||
// DBG( printf( " readIndexedFaceSet_coordIndex\n" ) );
|
||||
|
||||
m_model->m_CoordIndex.clear();
|
||||
|
||||
glm::ivec3 coord;
|
||||
|
||||
int dummy; // should be -1
|
||||
|
||||
while( fscanf( m_file, "%d,%d,%d,%d,", &coord[0], &coord[1], &coord[2], &dummy ) )
|
||||
{
|
||||
std::vector<int> coord_list;
|
||||
|
||||
coord_list.resize( 3 );
|
||||
coord_list[0] = coord[0];
|
||||
coord_list[1] = coord[1];
|
||||
coord_list[2] = coord[2];
|
||||
|
||||
if( (coord[0] == coord[1])
|
||||
|| (coord[0] == coord[2])
|
||||
|| (coord[2] == coord[1]) )
|
||||
{
|
||||
wxLogTrace( traceVrmlV1Parser, wxT( " invalid coordIndex at index %zu (%d, %d, %d, %d)" ),
|
||||
m_model->m_CoordIndex.size() + 1, coord[0], coord[1], coord[2], dummy );
|
||||
}
|
||||
|
||||
if( dummy != -1 )
|
||||
{
|
||||
wxLogTrace( traceVrmlV1Parser, wxT( " Error at index %zu, -1 Expected, got %d" ),
|
||||
m_model->m_CoordIndex.size() + 1, dummy );
|
||||
}
|
||||
|
||||
m_model->m_CoordIndex.push_back( coord_list );
|
||||
}
|
||||
|
||||
// DBG( printf( " m_CoordIndex.size: %ld\n", m_model->m_CoordIndex.size() ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int VRML1_MODEL_PARSER::readIndexedFaceSet_materialIndex()
|
||||
{
|
||||
// DBG( printf( " readIndexedFaceSet_materialIndex\n" ) );
|
||||
|
||||
m_model->m_MaterialIndexPerFace.clear();
|
||||
|
||||
int index;
|
||||
|
||||
while( fscanf( m_file, "%d,", &index ) )
|
||||
{
|
||||
m_model->m_MaterialIndexPerFace.push_back( index );
|
||||
}
|
||||
|
||||
// DBG( printf( " m_MaterialIndexPerFace.size: %ld\n", m_model->m_MaterialIndexPerFace.size() ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+491
-34
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -37,53 +37,510 @@
|
||||
#include "3d_struct.h"
|
||||
#include "modelparsers.h"
|
||||
|
||||
// separator chars
|
||||
static const char* sep_chars = " \t\n\r";
|
||||
|
||||
VRML_MODEL_PARSER::VRML_MODEL_PARSER( S3D_MASTER* aMaster ) :
|
||||
S3D_MODEL_PARSER( aMaster )
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
VRML_MODEL_PARSER::~VRML_MODEL_PARSER()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool VRML_MODEL_PARSER::Load( const wxString& aFilename )
|
||||
|
||||
void VRML_MODEL_PARSER::Load( const wxString aFilename )
|
||||
{
|
||||
char line[11 + 1];
|
||||
char line[1024], * text;
|
||||
FILE* file;
|
||||
|
||||
//DBG( printf( "Load %s", GetChars( aFilename ) ) );
|
||||
int LineNum = 0;
|
||||
|
||||
file = wxFopen( aFilename, wxT( "rt" ) );
|
||||
|
||||
if( file == NULL )
|
||||
return false;
|
||||
|
||||
if( fgets( line, 11, file ) == NULL )
|
||||
{
|
||||
fclose( file );
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
|
||||
SetLocaleTo_C_standard();
|
||||
|
||||
while( GetLine( file, line, &LineNum, 512 ) )
|
||||
{
|
||||
text = strtok( line, sep_chars );
|
||||
|
||||
if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0 )
|
||||
{
|
||||
while( GetLine( file, line, &LineNum, 512 ) )
|
||||
{
|
||||
text = strtok( line, sep_chars );
|
||||
|
||||
if( text == NULL )
|
||||
continue;
|
||||
|
||||
if( *text == '}' )
|
||||
break;
|
||||
|
||||
if( stricmp( text, "children" ) == 0 )
|
||||
{
|
||||
readChildren( file, &LineNum );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose( file );
|
||||
|
||||
childs.clear();
|
||||
|
||||
if( stricmp( line, "#VRML V2.0" ) == 0 )
|
||||
{
|
||||
VRML2_MODEL_PARSER *vrml2_parser = new VRML2_MODEL_PARSER( this );
|
||||
vrml2_parser->Load( aFilename );
|
||||
delete vrml2_parser;
|
||||
return true;
|
||||
}
|
||||
else if( stricmp( line, "#VRML V1.0" ) == 0 )
|
||||
{
|
||||
VRML1_MODEL_PARSER *vrml1_parser = new VRML1_MODEL_PARSER( this );
|
||||
vrml1_parser->Load( aFilename );
|
||||
delete vrml1_parser;
|
||||
return true;
|
||||
}
|
||||
|
||||
DBG( printf( "Unknown internal VRML file format: %s\n", line ) );
|
||||
return false;
|
||||
SetLocaleTo_Default(); // revert to the current locale
|
||||
}
|
||||
|
||||
|
||||
int VRML_MODEL_PARSER::readMaterial( FILE* file, int* LineNum )
|
||||
{
|
||||
char line[512], * text, * command;
|
||||
wxString mat_name;
|
||||
S3D_MATERIAL* material = NULL;
|
||||
|
||||
command = strtok( NULL, sep_chars );
|
||||
text = strtok( NULL, sep_chars );
|
||||
mat_name = FROM_UTF8( text );
|
||||
|
||||
if( stricmp( command, "USE" ) == 0 )
|
||||
{
|
||||
for( material = GetMaster()->m_Materials; material; material = material->Next() )
|
||||
{
|
||||
if( material->m_Name == mat_name )
|
||||
{
|
||||
material->SetMaterial();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
DBG( printf( "ReadMaterial error: material not found\n" ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( stricmp( command, "DEF" ) == 0 || stricmp( command, "Material") == 0)
|
||||
{
|
||||
material = new S3D_MATERIAL( GetMaster(), mat_name );
|
||||
|
||||
GetMaster()->Insert( material );
|
||||
|
||||
while( GetLine( file, line, LineNum, 512 ) )
|
||||
{
|
||||
text = strtok( line, sep_chars );
|
||||
|
||||
if( text == NULL )
|
||||
continue;
|
||||
|
||||
if( text[0] == '}' )
|
||||
{
|
||||
material->SetMaterial();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( stricmp( text, "diffuseColor" ) == 0 )
|
||||
{
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_DiffuseColor.x = atof( text );
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_DiffuseColor.y = atof( text );
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_DiffuseColor.z = atof( text );
|
||||
}
|
||||
else if( stricmp( text, "emissiveColor" ) == 0 )
|
||||
{
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_EmissiveColor.x = atof( text );
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_EmissiveColor.y = atof( text );
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_EmissiveColor.z = atof( text );
|
||||
}
|
||||
else if( strnicmp( text, "specularColor", 13 ) == 0 )
|
||||
{
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_SpecularColor.x = atof( text );
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_SpecularColor.y = atof( text );
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_SpecularColor.z = atof( text );
|
||||
}
|
||||
else if( strnicmp( text, "ambientIntensity", 16 ) == 0 )
|
||||
{
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_AmbientIntensity = atof( text );
|
||||
}
|
||||
else if( strnicmp( text, "transparency", 12 ) == 0 )
|
||||
{
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_Transparency = atof( text );
|
||||
}
|
||||
else if( strnicmp( text, "shininess", 9 ) == 0 )
|
||||
{
|
||||
text = strtok( NULL, sep_chars );
|
||||
material->m_Shininess = atof( text );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int VRML_MODEL_PARSER::readChildren( FILE* file, int* LineNum )
|
||||
{
|
||||
char line[1024], * text;
|
||||
|
||||
while( GetLine( file, line, LineNum, 512 ) )
|
||||
{
|
||||
text = strtok( line, sep_chars );
|
||||
|
||||
if( *text == ']' )
|
||||
return 0;
|
||||
|
||||
if( *text == ',' )
|
||||
continue;
|
||||
|
||||
if( stricmp( text, "Shape" ) == 0 )
|
||||
{
|
||||
readShape( file, LineNum );
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG( printf( "ReadChildren error line %d <%s> \n", *LineNum, text ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int VRML_MODEL_PARSER::readShape( FILE* file, int* LineNum )
|
||||
{
|
||||
char line[1024], * text;
|
||||
int err = 1;
|
||||
|
||||
while( GetLine( file, line, LineNum, 512 ) )
|
||||
{
|
||||
text = strtok( line, sep_chars );
|
||||
|
||||
if( *text == '}' )
|
||||
{
|
||||
err = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if( stricmp( text, "appearance" ) == 0 )
|
||||
{
|
||||
readAppearance( file, LineNum );
|
||||
}
|
||||
else if( stricmp( text, "geometry" ) == 0 )
|
||||
{
|
||||
readGeometry( file, LineNum );
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG( printf( "ReadShape error line %d <%s> \n", *LineNum, text ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum )
|
||||
{
|
||||
char line[1024], * text;
|
||||
int err = 1;
|
||||
|
||||
while( GetLine( file, line, LineNum, 512 ) )
|
||||
{
|
||||
text = strtok( line, sep_chars );
|
||||
|
||||
if( *text == '}' )
|
||||
{
|
||||
err = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if( stricmp( text, "material" ) == 0 )
|
||||
{
|
||||
readMaterial( file, LineNum );
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG( printf( "ReadAppearance error line %d <%s> \n", *LineNum, text ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
#define BUFSIZE 2000
|
||||
|
||||
void VRML_MODEL_PARSER::readCoordsList( FILE* file, char* text_buffer,
|
||||
std::vector< double >& aList, int* LineNum )
|
||||
{
|
||||
unsigned int ii = 0, jj = 0;
|
||||
char* text;
|
||||
bool HasData = false;
|
||||
bool StartData = false;
|
||||
bool EndNode = false;
|
||||
char string_num[512];
|
||||
|
||||
text = text_buffer;
|
||||
|
||||
while( !EndNode )
|
||||
{
|
||||
if( *text == 0 ) // Needs data !
|
||||
{
|
||||
text = text_buffer;
|
||||
GetLine( file, text_buffer, LineNum, 512 );
|
||||
}
|
||||
|
||||
while( !EndNode && *text )
|
||||
{
|
||||
switch( *text )
|
||||
{
|
||||
case '[':
|
||||
StartData = true;
|
||||
jj = 0;
|
||||
string_num[jj] = 0;
|
||||
break;
|
||||
|
||||
case '}':
|
||||
EndNode = true;
|
||||
break;
|
||||
|
||||
case ']':
|
||||
case '\t':
|
||||
case ' ':
|
||||
case ',':
|
||||
jj = 0;
|
||||
|
||||
if( !StartData || !HasData )
|
||||
break;
|
||||
|
||||
aList.push_back( atof( string_num ) );
|
||||
string_num[jj] = 0;
|
||||
ii++;
|
||||
|
||||
HasData = false;
|
||||
|
||||
if( *text == ']' )
|
||||
{
|
||||
StartData = false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if( !StartData )
|
||||
break;
|
||||
|
||||
if( jj >= sizeof( string_num ) )
|
||||
break;
|
||||
|
||||
string_num[jj] = *text;
|
||||
jj++;
|
||||
string_num[jj] = 0;
|
||||
HasData = true;
|
||||
break;
|
||||
}
|
||||
|
||||
text++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
|
||||
{
|
||||
char line[1024], buffer[1024], * text;
|
||||
int err = 1;
|
||||
std::vector< double > points;
|
||||
std::vector< double > list;
|
||||
double vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
|
||||
|
||||
while( GetLine( file, line, LineNum, 512 ) )
|
||||
{
|
||||
strcpy( buffer, line );
|
||||
text = strtok( buffer, sep_chars );
|
||||
|
||||
if( *text == '}' )
|
||||
{
|
||||
err = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if( stricmp( text, "normalPerVertex" ) == 0 )
|
||||
{
|
||||
text = strtok( NULL, " ,\t\n\r" );
|
||||
|
||||
if( stricmp( text, "true" ) == 0 )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( text, "colorPerVertex" ) == 0 )
|
||||
{
|
||||
text = strtok( NULL, " ,\t\n\r" );
|
||||
|
||||
if( stricmp( text, "true" ) == 0 )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( text, "normal" ) == 0 )
|
||||
{
|
||||
readCoordsList( file, line, list, LineNum );
|
||||
list.clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( text, "normalIndex" ) == 0 )
|
||||
{
|
||||
while( GetLine( file, line, LineNum, 512 ) )
|
||||
{
|
||||
text = strtok( line, " ,\t\n\r" );
|
||||
|
||||
while( text )
|
||||
{
|
||||
if( *text == ']' )
|
||||
break;
|
||||
|
||||
text = strtok( NULL, " ,\t\n\r" );
|
||||
}
|
||||
|
||||
if( text && (*text == ']') )
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( text, "color" ) == 0 )
|
||||
{
|
||||
readCoordsList( file, line, list, LineNum );
|
||||
list.clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( text, "solid" ) == 0 )
|
||||
{
|
||||
// ignore solid
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( text, "colorIndex" ) == 0 )
|
||||
{
|
||||
while( GetLine( file, line, LineNum, 512 ) )
|
||||
{
|
||||
text = strtok( line, " ,\t\n\r" );
|
||||
|
||||
while( text )
|
||||
{
|
||||
if( *text == ']' )
|
||||
break;
|
||||
|
||||
text = strtok( NULL, " ,\t\n\r" );
|
||||
}
|
||||
|
||||
if( text && (*text == ']') )
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( text, "coord" ) == 0 )
|
||||
{
|
||||
readCoordsList( file, line, points, LineNum );
|
||||
}
|
||||
else if( stricmp( text, "coordIndex" ) == 0 )
|
||||
{
|
||||
if( points.size() < 3 || points.size() % 3 != 0 )
|
||||
{
|
||||
wxLogError( wxT( "3D geometry read error <%s> at line %d." ),
|
||||
GetChars( FROM_UTF8( text ) ), *LineNum );
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
std::vector< int > coordIndex;
|
||||
std::vector< S3D_VERTEX > vertices;
|
||||
|
||||
while( GetLine( file, line, LineNum, 512 ) )
|
||||
{
|
||||
int jj;
|
||||
text = strtok( line, " ,\t\n\r" );
|
||||
|
||||
while( text )
|
||||
{
|
||||
if( *text == ']' )
|
||||
break;
|
||||
|
||||
jj = atoi( text );
|
||||
|
||||
if( jj < 0 )
|
||||
{
|
||||
for( jj = 0; jj < (int) coordIndex.size(); jj++ )
|
||||
{
|
||||
int kk = coordIndex[jj] * 3;
|
||||
|
||||
if( (kk < 0) || ((kk + 3) > (int)points.size()) )
|
||||
{
|
||||
wxLogError( wxT( "3D geometry index read error <%s> at line %d." ),
|
||||
GetChars( FROM_UTF8( text ) ), *LineNum );
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
S3D_VERTEX vertex;
|
||||
vertex.x = points[kk];
|
||||
vertex.y = points[kk + 1];
|
||||
vertex.z = points[kk + 2];
|
||||
vertices.push_back( vertex );
|
||||
}
|
||||
|
||||
GetMaster()->Set_Object_Coords( vertices );
|
||||
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
|
||||
vertices.clear();
|
||||
coordIndex.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
coordIndex.push_back( jj );
|
||||
}
|
||||
|
||||
text = strtok( NULL, " ,\t\n\r" );
|
||||
}
|
||||
|
||||
if( text && (*text == ']') )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError( wxT( "3D geometry read error <%s> at line %d." ),
|
||||
GetChars( FROM_UTF8( text ) ), *LineNum );
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
+139
-223
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -40,50 +40,32 @@
|
||||
#include <modelparsers.h>
|
||||
#include <xnode.h>
|
||||
|
||||
/**
|
||||
* Trace mask used to enable or disable the trace output of the X3D parser code.
|
||||
* The debug output can be turned on by setting the WXTRACE environment variable to
|
||||
* "KI_TRACE_X3D_PARSER". See the wxWidgets documentation on wxLogTrace for
|
||||
* more information.
|
||||
*/
|
||||
static const wxChar* traceX3DParser = wxT( "KI_TRACE_X3D_PARSER" );
|
||||
|
||||
|
||||
X3D_MODEL_PARSER::X3D_MODEL_PARSER( S3D_MASTER* aMaster ) :
|
||||
S3D_MODEL_PARSER( aMaster )
|
||||
{
|
||||
m_model.reset();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
X3D_MODEL_PARSER::~X3D_MODEL_PARSER()
|
||||
{}
|
||||
|
||||
|
||||
void X3D_MODEL_PARSER::Load( const wxString aFilename )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool X3D_MODEL_PARSER::Load( const wxString& aFilename )
|
||||
{
|
||||
wxLogTrace( traceX3DParser, wxT( "Loading: %s" ), GetChars( aFilename ) );
|
||||
|
||||
wxXmlDocument doc;
|
||||
|
||||
if( !doc.Load( aFilename ) )
|
||||
{
|
||||
wxLogTrace( traceX3DParser, wxT( "Error while parsing file: %s" ), GetChars( aFilename ) );
|
||||
return false;
|
||||
wxLogError( wxT( "Error while parsing file '%s'" ), GetChars( aFilename ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( doc.GetRoot()->GetName() != wxT( "X3D" ) )
|
||||
{
|
||||
wxLogTrace( traceX3DParser, wxT( "Filetype is not X3D: %s" ), GetChars( aFilename ) );
|
||||
return false;
|
||||
wxLogError( wxT( "Filetype is not X3D '%s'" ), GetChars( aFilename ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// Switch the locale to standard C (needed to print floating point numbers)
|
||||
LOCALE_IO toggle;
|
||||
|
||||
childs.clear();
|
||||
|
||||
// Shapes are inside of Transform nodes
|
||||
// Transform node contains information about
|
||||
// transition, scale and rotation of the shape
|
||||
@@ -91,49 +73,68 @@ bool X3D_MODEL_PARSER::Load( const wxString& aFilename )
|
||||
GetChildsByName( doc.GetRoot(), wxT( "Transform" ), transforms );
|
||||
|
||||
for( NODE_LIST::iterator node_it = transforms.begin();
|
||||
node_it != transforms.end();
|
||||
node_it++ )
|
||||
node_it != transforms.end();
|
||||
node_it++ )
|
||||
{
|
||||
m_model.reset( new S3D_MESH() );
|
||||
childs.push_back( m_model );
|
||||
|
||||
wxXmlNode* node = *node_it;
|
||||
wxXmlAttribute* prop = node->GetAttributes();
|
||||
|
||||
wxLogTrace( traceX3DParser, wxT( "Transform: %s %s" ), prop->GetName(), prop->GetValue() );
|
||||
|
||||
readTransform( node );
|
||||
readTransform( *node_it );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxString X3D_MODEL_PARSER::VRML_representation()
|
||||
{
|
||||
wxString output;
|
||||
|
||||
for( unsigned i = 0; i < vrml_points.size(); i++ )
|
||||
{
|
||||
output +=
|
||||
wxT( "Shape {\n"
|
||||
" appearance Appearance {\n"
|
||||
" material Material {\n" ) +
|
||||
vrml_materials[i] +
|
||||
wxT( " }\n"
|
||||
" }\n"
|
||||
" geometry IndexedFaceSet {\n"
|
||||
" solid TRUE\n"
|
||||
" coord Coordinate {\n"
|
||||
" point [\n") +
|
||||
vrml_points[i] +
|
||||
wxT( " ]\n"
|
||||
" }\n"
|
||||
" coordIndex [\n" ) +
|
||||
vrml_coord_indexes[i] +
|
||||
wxT( " ]\n"
|
||||
" }\n"
|
||||
"},\n" );
|
||||
}
|
||||
|
||||
return true;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
void X3D_MODEL_PARSER::GetChildsByName( wxXmlNode* aParent,
|
||||
const wxString aName,
|
||||
std::vector<wxXmlNode*>& aResult )
|
||||
const wxString aName,
|
||||
std::vector< wxXmlNode* >& aResult )
|
||||
{
|
||||
// (-Breadth-first search (BFS)-)
|
||||
// **NOTE** This function was changed to get only the first depth of ocorrences
|
||||
// so it will be an workarround for the Bug #1443431
|
||||
std::queue<wxXmlNode*> found;
|
||||
// Breadth-first search (BFS)
|
||||
std::queue< wxXmlNode* > found;
|
||||
|
||||
found.push( aParent );
|
||||
|
||||
while( !found.empty() )
|
||||
{
|
||||
wxXmlNode* elem = found.front();
|
||||
wxXmlNode *elem = found.front();
|
||||
|
||||
for( wxXmlNode* child = elem->GetChildren();
|
||||
for( wxXmlNode *child = elem->GetChildren();
|
||||
child != NULL;
|
||||
child = child->GetNext() )
|
||||
{
|
||||
if( child->GetName() == aName )
|
||||
{
|
||||
aResult.push_back( child );
|
||||
else // **NOTE** This function was changed here to get only the first depth of ocorrences
|
||||
found.push( child );
|
||||
}
|
||||
|
||||
found.push( child );
|
||||
}
|
||||
|
||||
found.pop();
|
||||
@@ -153,13 +154,11 @@ void X3D_MODEL_PARSER::GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Private ----- */
|
||||
|
||||
void X3D_MODEL_PARSER::readTransform( wxXmlNode* aTransformNode )
|
||||
{
|
||||
NODE_LIST childnodes;
|
||||
|
||||
GetChildsByName( aTransformNode, wxT( "Material" ), childnodes );
|
||||
|
||||
for( NODE_LIST::iterator node = childnodes.begin();
|
||||
@@ -174,10 +173,7 @@ void X3D_MODEL_PARSER::readTransform( wxXmlNode* aTransformNode )
|
||||
PROPERTY_MAP properties;
|
||||
|
||||
GetNodeProperties( aTransformNode, properties );
|
||||
|
||||
|
||||
|
||||
GetChildsByName( aTransformNode, wxT( "IndexedFaceSet" ), childnodes );
|
||||
GetChildsByName( aTransformNode, wxT("IndexedFaceSet"), childnodes );
|
||||
|
||||
for( NODE_LIST::iterator node = childnodes.begin();
|
||||
node != childnodes.end();
|
||||
@@ -192,10 +188,7 @@ void X3D_MODEL_PARSER::readTransform( wxXmlNode* aTransformNode )
|
||||
|
||||
void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
|
||||
{
|
||||
glm::vec3 color;
|
||||
|
||||
PROPERTY_MAP properties;
|
||||
|
||||
GetNodeProperties( aMatNode, properties );
|
||||
|
||||
// DEFine new Material named as value of DEF
|
||||
@@ -206,33 +199,22 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
|
||||
S3D_MATERIAL* material = new S3D_MATERIAL( GetMaster(), properties[ wxT( "DEF" ) ] );
|
||||
GetMaster()->Insert( material );
|
||||
|
||||
m_model->m_Materials = material;
|
||||
|
||||
if( !parseDoubleTriplet( properties[ wxT( "diffuseColor" ) ], color ) )
|
||||
if( !parseDoubleTriplet( properties[ wxT( "diffuseColor" ) ],
|
||||
material->m_DiffuseColor ) )
|
||||
{
|
||||
// DBG( printf( "diffuseColor parsing error" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_model->m_Materials->m_DiffuseColor.push_back( color );
|
||||
DBG( printf("diffuseColor parsing error") );
|
||||
}
|
||||
|
||||
if( !parseDoubleTriplet( properties[ wxT( "specularColor" ) ], color ) )
|
||||
if( !parseDoubleTriplet( properties[ wxT( "specularColor" ) ],
|
||||
material->m_SpecularColor ) )
|
||||
{
|
||||
// DBG( printf( "specularColor parsing error" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_model->m_Materials->m_SpecularColor.push_back( color );
|
||||
DBG( printf("specularColor parsing error") );
|
||||
}
|
||||
|
||||
if( !parseDoubleTriplet( properties[ wxT( "emissiveColor" ) ], color ) )
|
||||
if( !parseDoubleTriplet( properties[ wxT( "emissiveColor" ) ],
|
||||
material->m_EmissiveColor ) )
|
||||
{
|
||||
// DBG( printf( "emissiveColor parsing error" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_model->m_Materials->m_EmissiveColor.push_back( color );
|
||||
DBG( printf("emissiveColor parsing error") );
|
||||
}
|
||||
|
||||
wxStringTokenizer values;
|
||||
@@ -240,47 +222,40 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
|
||||
|
||||
if( values.GetNextToken().ToDouble( &amb ) )
|
||||
{
|
||||
m_model->m_Materials->m_AmbientColor.push_back( glm::vec3( amb, amb, amb ) );
|
||||
material->m_AmbientIntensity = amb;
|
||||
}
|
||||
else
|
||||
{
|
||||
// DBG( printf( "ambienterror" ) );
|
||||
DBG( printf( "ambienterror" ) );
|
||||
}
|
||||
|
||||
values.SetString( properties[ wxT( "shininess" ) ] );
|
||||
|
||||
if( values.GetNextToken().ToDouble( &shine ) )
|
||||
{
|
||||
// VRML value is normalized and openGL expects a value 0 - 128
|
||||
if( shine > 1.0 )
|
||||
{
|
||||
shine = 1.0;
|
||||
} else if( shine < 0.0 )
|
||||
{
|
||||
shine = 0.0;
|
||||
}
|
||||
shine = shine * 128.0f;
|
||||
m_model->m_Materials->m_Shininess.push_back( shine );
|
||||
material->m_Shininess = shine;
|
||||
}
|
||||
else
|
||||
{
|
||||
// DBG( printf( "shininess error" ) );
|
||||
DBG( printf( "shininess error" ) );
|
||||
}
|
||||
|
||||
values.SetString( properties[ wxT( "transparency" ) ] );
|
||||
|
||||
if( values.GetNextToken().ToDouble( &transp ) )
|
||||
{
|
||||
m_model->m_Materials->m_Transparency.push_back( transp );
|
||||
material->m_Transparency = transp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// DBG( printf( "trans error" ) );
|
||||
DBG( printf( "trans error") );
|
||||
}
|
||||
|
||||
material->SetMaterial();
|
||||
|
||||
// VRML
|
||||
wxString vrml_material;
|
||||
PROPERTY_MAP::const_iterator p = ++properties.begin(); // skip DEF
|
||||
PROPERTY_MAP::const_iterator p = ++properties.begin(); // skip DEF
|
||||
|
||||
for( ; p != properties.end(); p++ )
|
||||
{
|
||||
@@ -289,6 +264,7 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
|
||||
|
||||
vrml_materials.push_back( vrml_material );
|
||||
}
|
||||
|
||||
// USE existing material named by value of USE
|
||||
else if( properties.find( wxT( "USE" ) ) != properties.end() )
|
||||
{
|
||||
@@ -302,71 +278,60 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
|
||||
wxString vrml_material;
|
||||
|
||||
vrml_material.Append( wxString::Format( wxT( "specularColor %f %f %f\n" ),
|
||||
material->m_SpecularColor[0].x,
|
||||
material->m_SpecularColor[0].y,
|
||||
material->m_SpecularColor[0].z ) );
|
||||
material->m_SpecularColor.x,
|
||||
material->m_SpecularColor.y,
|
||||
material->m_SpecularColor.z ) );
|
||||
|
||||
vrml_material.Append( wxString::Format( wxT( "diffuseColor %f %f %f\n" ),
|
||||
material->m_DiffuseColor[0].x,
|
||||
material->m_DiffuseColor[0].y,
|
||||
material->m_DiffuseColor[0].z ) );
|
||||
material->m_DiffuseColor.x,
|
||||
material->m_DiffuseColor.y,
|
||||
material->m_DiffuseColor.z ) );
|
||||
|
||||
vrml_material.Append( wxString::Format( wxT( "emissiveColor %f %f %f\n" ),
|
||||
material->m_EmissiveColor[0].x,
|
||||
material->m_EmissiveColor[0].y,
|
||||
material->m_EmissiveColor[0].z ) );
|
||||
material->m_EmissiveColor.x,
|
||||
material->m_EmissiveColor.y,
|
||||
material->m_EmissiveColor.z ) );
|
||||
|
||||
vrml_material.Append( wxString::Format( wxT( "ambientIntensity %f\n" ),
|
||||
material->m_AmbientColor[0].x ) );
|
||||
vrml_material.Append( wxString::Format( wxT( "ambientIntensity %f\n"),
|
||||
material->m_AmbientIntensity ) );
|
||||
|
||||
vrml_material.Append( wxString::Format( wxT( "shininess %f\n" ),
|
||||
material->m_Shininess[0] ) );
|
||||
vrml_material.Append( wxString::Format( wxT( "shininess %f\n"),
|
||||
material->m_Shininess ) );
|
||||
|
||||
vrml_material.Append( wxString::Format( wxT( "transparency %f\n" ),
|
||||
material->m_Transparency[0] ) );
|
||||
vrml_material.Append( wxString::Format( wxT( "transparency %f\n"),
|
||||
material->m_Transparency ) );
|
||||
|
||||
vrml_materials.push_back( vrml_material );
|
||||
|
||||
m_model->m_Materials = material;
|
||||
|
||||
material->SetMaterial();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// DBG( printf( "ReadMaterial error: material not found\n" ) );
|
||||
DBG( printf( "ReadMaterial error: material not found\n" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData,
|
||||
S3D_VERTEX& aResult )
|
||||
S3D_VERTEX& aResult )
|
||||
{
|
||||
wxStringTokenizer tokens( aData );
|
||||
wxStringTokenizer tokens(aData);
|
||||
|
||||
double x = 0;
|
||||
double y = 0;
|
||||
double z = 0;
|
||||
|
||||
bool ret = tokens.GetNextToken().ToDouble( &x )
|
||||
&& tokens.GetNextToken().ToDouble( &y )
|
||||
&& tokens.GetNextToken().ToDouble( &z );
|
||||
|
||||
aResult.x = x;
|
||||
aResult.y = y;
|
||||
aResult.z = z;
|
||||
|
||||
return ret;
|
||||
return tokens.GetNextToken().ToDouble( &aResult.x ) &&
|
||||
tokens.GetNextToken().ToDouble( &aResult.y ) &&
|
||||
tokens.GetNextToken().ToDouble( &aResult.z );
|
||||
}
|
||||
|
||||
|
||||
void X3D_MODEL_PARSER::rotate( S3D_VERTEX& aV,
|
||||
S3D_VERTEX& aU,
|
||||
double angle )
|
||||
S3D_VERTEX& aU,
|
||||
double angle )
|
||||
{
|
||||
S3D_VERTEX rotated;
|
||||
double C = cos( angle );
|
||||
double S = sin( angle );
|
||||
double t = 1.0 - C;
|
||||
double C = cos( angle );
|
||||
double S = sin( angle );
|
||||
double t = 1.0 - C;
|
||||
|
||||
rotated.x = ( t * aU.x * aU.x + C ) * aV.x +
|
||||
( t * aU.x * aU.y - S * aU.z ) * aV.y +
|
||||
@@ -380,9 +345,9 @@ void X3D_MODEL_PARSER::rotate( S3D_VERTEX& aV,
|
||||
( t * aU.y * aU.z + S * aU.x ) * aV.y +
|
||||
( t * aU.z * aU.z + C) * aV.z;
|
||||
|
||||
aV.x = rotated.x;
|
||||
aV.y = rotated.y;
|
||||
aV.z = rotated.z;
|
||||
aV.x = rotated.x;
|
||||
aV.y = rotated.y;
|
||||
aV.z = rotated.z;
|
||||
}
|
||||
|
||||
|
||||
@@ -393,13 +358,12 @@ void X3D_MODEL_PARSER::rotate( S3D_VERTEX& aV,
|
||||
* 4. Apply geometry to Master object
|
||||
*/
|
||||
void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
|
||||
PROPERTY_MAP& aTransformProps )
|
||||
PROPERTY_MAP& aTransformProps)
|
||||
{
|
||||
/* Step 1: Read transform data
|
||||
* --------------------------- */
|
||||
|
||||
S3D_VERTEX translation;
|
||||
|
||||
parseDoubleTriplet( aTransformProps[ wxT( "translation" ) ], translation );
|
||||
|
||||
S3D_VERTEX scale;
|
||||
@@ -407,36 +371,31 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
|
||||
|
||||
S3D_VERTEX rotation;
|
||||
double angle = 0.0;
|
||||
wxStringTokenizer tokens( aTransformProps[ wxT( "rotation" ) ] );
|
||||
wxStringTokenizer tokens(aTransformProps[ wxT( "rotation" ) ]);
|
||||
|
||||
double x = 0.0, y = 0.0, z = 0.0;
|
||||
if( !(tokens.GetNextToken().ToDouble( &rotation.x ) &&
|
||||
tokens.GetNextToken().ToDouble( &rotation.y ) &&
|
||||
tokens.GetNextToken().ToDouble( &rotation.z ) &&
|
||||
tokens.GetNextToken().ToDouble( &angle ) ) )
|
||||
{
|
||||
DBG( printf("rotation read error") );
|
||||
}
|
||||
|
||||
if( !( tokens.GetNextToken().ToDouble( &x )
|
||||
&& tokens.GetNextToken().ToDouble( &y )
|
||||
&& tokens.GetNextToken().ToDouble( &z )
|
||||
&& tokens.GetNextToken().ToDouble( &angle ) ) )
|
||||
{
|
||||
// DBG( printf( "rotation read error" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
rotation.x = x;
|
||||
rotation.y = y;
|
||||
rotation.z = z;
|
||||
}
|
||||
double vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits *
|
||||
UNITS3D_TO_UNITSPCB;
|
||||
|
||||
/* Step 2: Read all coordinate points
|
||||
* ---------------------------- */
|
||||
std::vector<double> points;
|
||||
std::vector< double > points;
|
||||
NODE_LIST coordinates;
|
||||
GetChildsByName( aFaceNode, wxT( "Coordinate" ), coordinates );
|
||||
GetChildsByName( aFaceNode, wxT( "Coordinate" ), coordinates);
|
||||
|
||||
PROPERTY_MAP coordinate_properties;
|
||||
// IndexedFaceSet has one Coordinate child node
|
||||
GetNodeProperties( coordinates[0], coordinate_properties );
|
||||
|
||||
// Save points to vector as doubles
|
||||
wxStringTokenizer point_tokens( coordinate_properties[ wxT( "point" ) ] );
|
||||
wxStringTokenizer point_tokens( coordinate_properties[ wxT("point") ] );
|
||||
double point = 0.0;
|
||||
|
||||
while( point_tokens.HasMoreTokens() )
|
||||
@@ -447,13 +406,13 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( traceX3DParser, wxT( "Error converting to double" ) );
|
||||
wxLogError( wxT( "Error converting to double" ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( points.size() % 3 != 0 )
|
||||
{
|
||||
// DBG( printf( "Number of points is incorrect" ) );
|
||||
DBG( printf( "Number of points is incorrect" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -461,14 +420,14 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
|
||||
* apply transforms in order of SCALE, ROTATION, TRANSLATION
|
||||
*/
|
||||
wxString vrml_pointlist;
|
||||
std::vector<S3D_VERTEX> triplets;
|
||||
std::vector< S3D_VERTEX > triplets;
|
||||
|
||||
for( unsigned id = 0; id < points.size() / 3; id++ )
|
||||
{
|
||||
int triplet_indx = id * 3;
|
||||
S3D_VERTEX point( points[ triplet_indx ],
|
||||
points[ triplet_indx + 1 ],
|
||||
points[ triplet_indx + 2 ] );
|
||||
points[ triplet_indx + 1 ],
|
||||
points[ triplet_indx + 2 ] );
|
||||
|
||||
point.x *= scale.x;
|
||||
point.y *= scale.y;
|
||||
@@ -480,7 +439,7 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
|
||||
point.y += translation.y;
|
||||
point.z += translation.z;
|
||||
|
||||
m_model->m_Point.push_back( point );
|
||||
triplets.push_back(point);
|
||||
|
||||
// VRML
|
||||
vrml_pointlist.Append( wxString::Format( wxT( "%f %f %f\n" ), point.x, point.y, point.z ) );
|
||||
@@ -488,72 +447,18 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
|
||||
|
||||
vrml_points.push_back( vrml_pointlist );
|
||||
|
||||
|
||||
/* Step 3: Read all color points
|
||||
* ---------------------------- */
|
||||
std::vector<double> color_points;
|
||||
NODE_LIST color;
|
||||
GetChildsByName( aFaceNode, wxT( "Color" ), color );
|
||||
|
||||
// Some models lack color information, need to handle this safely
|
||||
if( !color.empty() )
|
||||
{
|
||||
PROPERTY_MAP color_properties;
|
||||
// IndexedFaceSet has one Coordinate child node
|
||||
GetNodeProperties( color[0], color_properties );
|
||||
|
||||
// Save points to vector as doubles
|
||||
wxStringTokenizer colorpoint_tokens( color_properties[ wxT( "color" ) ] );
|
||||
double color_point = 0.0;
|
||||
|
||||
while( colorpoint_tokens.HasMoreTokens() )
|
||||
{
|
||||
if( colorpoint_tokens.GetNextToken().ToDouble( &color_point ) )
|
||||
{
|
||||
color_points.push_back( color_point );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( traceX3DParser, wxT( "Error converting to double" ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( color_points.size() % 3 != 0 )
|
||||
{
|
||||
// DBG( printf( "Number of points is incorrect" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Create 3D face color from 3 color points
|
||||
*/
|
||||
m_model->m_Materials->m_DiffuseColor.clear();
|
||||
|
||||
for( unsigned id = 0; id < color_points.size() / 3; id++ )
|
||||
{
|
||||
m_model->m_MaterialIndexPerFace.push_back( id );
|
||||
|
||||
int color_triplet_indx = id * 3;
|
||||
glm::vec3 colorface( color_points[ color_triplet_indx + 0 ],
|
||||
color_points[ color_triplet_indx + 1 ],
|
||||
color_points[ color_triplet_indx + 2 ] );
|
||||
|
||||
m_model->m_Materials->m_DiffuseColor.push_back( colorface );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -- Read coordinate indexes -- */
|
||||
PROPERTY_MAP faceset_properties;
|
||||
GetNodeProperties( aFaceNode, faceset_properties );
|
||||
|
||||
std::vector< S3D_VERTEX > vertices;
|
||||
std::vector< int > coordIndex;
|
||||
|
||||
wxString coordIndex_str = faceset_properties[ wxT( "coordIndex" ) ];
|
||||
wxStringTokenizer index_tokens( coordIndex_str );
|
||||
|
||||
wxString vrml_coord_indx_list;
|
||||
|
||||
std::vector<int> coord_list;
|
||||
coord_list.clear();
|
||||
|
||||
while( index_tokens.HasMoreTokens() )
|
||||
{
|
||||
long index = 0;
|
||||
@@ -565,15 +470,26 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
|
||||
{
|
||||
/* Step 4: Apply geometry to Master object
|
||||
* --------------------------------------- */
|
||||
m_model->m_CoordIndex.push_back( coord_list );
|
||||
std::vector<int>::const_iterator id;
|
||||
|
||||
coord_list.clear();
|
||||
for( id = coordIndex.begin();
|
||||
id != coordIndex.end();
|
||||
id++ )
|
||||
{
|
||||
vertices.push_back( triplets.at( *id ) );
|
||||
}
|
||||
|
||||
GetMaster()->Set_Object_Coords( vertices );
|
||||
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
|
||||
|
||||
vertices.clear();
|
||||
coordIndex.clear();
|
||||
vrml_coord_indx_list.Append( wxT( "-1\n" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
coord_list.push_back( index );
|
||||
vrml_coord_indx_list.Append( wxString::Format( wxT( "%ld " ), index ) );
|
||||
coordIndex.push_back( index );
|
||||
vrml_coord_indx_list.Append( wxString::Format( wxT( "%u " ), index ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-37
@@ -1,12 +1,11 @@
|
||||
* Copyright (C) 1992-2015 Jean-Pierre Charras
|
||||
* Copyright (C) 1992-2015 Kicad Developers Team
|
||||
* Copyright (C) 1992-2010 Jean-Pierre Charras
|
||||
* Copyright (C) 1992-2010 Kicad Developers Team
|
||||
* under GNU General Public License (see copyright.txt)
|
||||
|
||||
== Main Authors
|
||||
Jean-Pierre Charras <jean-pierre.charras[at]gipsa-lab-dot-inpg-dot-fr>
|
||||
Dick Hollenbeck <dick[at]softplc-dot-com>
|
||||
Wayne Stambaugh <stambaughw[at]gmail-dot-com>
|
||||
|
||||
Wayne Stambaugh <stambaughw[at]verizon-dot-net>
|
||||
|
||||
== Contributors
|
||||
Hauptmech <hauptmech[at]gmail-dot-com>
|
||||
@@ -17,37 +16,17 @@ Marco Serantoni <marco.serantoni[at]gmail-dot-com> (OSX maintener)
|
||||
Rok Markovic <rok[at]kanardia.eu>
|
||||
Tim Hanson <sideskate[at]gmail-dot-com>
|
||||
Vesa Solonen <vesa.solonen[at]hut-dot-fi>
|
||||
Alexander Zakamaldin <zaka62[at]mail-dot-ru>
|
||||
Miguel Angel Ajo Pelayo <miguelangel[at]nbee-dot-es> (Python Scripting)
|
||||
Alexander Lunev <al.lunev[at]yahoo-dot-com> (Pcad to Kicad converter)
|
||||
Jacobo Aragunde Perez <jaragunde[at]igalia-dot-com> for Igalia and the CERN
|
||||
Brian Sidebotham <brian.sidebotham[at]gmail-dot-com>
|
||||
Maciej Sumiński <maciej.suminski[at]cern-dot-ch>
|
||||
Tomasz Wlostowski <tomasz.wlostowski[at]cern-dot-ch>
|
||||
Henner Zeller <h.zeller[at]acm-dot-org>
|
||||
Mark Roszko <mark.roszko[at]gmail-dot-com>
|
||||
Daniel Majewski <lordblick[at]gmail-dot-com>
|
||||
Konstantin Baranovskiy <baranovskiykonstantin[at]gmail-dot-com>
|
||||
Torsten Hüter <torstenhtr[at]gmx-dot-de>
|
||||
Nick Østergaard <oe.nick[at]gmail-dot-com>
|
||||
Andrew Zonenberg <azonenberg[at]drawersteak-dot-com>
|
||||
Cirilo Bernardo <cirilo_bernardo[at]yahoo-dot-com>
|
||||
Adam Wolf <adamwolf[at]feelslikeburning-dot-com>
|
||||
Bernhard Stegmaier <stegmaier[at]sw-systems-dot-de>
|
||||
Chris Pavlina <pavlina.chris[at]gmail-dot-com>
|
||||
Simon Richter <Simon.Richter[at]hogyros-dot-de>
|
||||
Mario Luzeiro <mrluzeiro[at]ua-dot-pt>
|
||||
Mateusz Skowroński <skowri[at]gmail-dot-com>
|
||||
Alexander Zakamaldin <zaka62[at]mail.ru>
|
||||
Miguel Angel Ajo Pelayo <miguelangel@nbee.es> (Python Scripting)
|
||||
Alexander Lunev <al.lunev@yahoo.com> (Pcad to Kicad converter)
|
||||
Jacobo Aragunde Perez <jaragunde@igalia.com> for Igalia and the CERN
|
||||
|
||||
See also CHANGELOG.txt for contributors.
|
||||
|
||||
|
||||
== Document Writers
|
||||
Jean-Pierre Charras <jean-pierre.charras[at]gipsa-lab.inpg-dot-fr>
|
||||
Igor Plyatov <plyatov[at]gmail-dot-com>
|
||||
Jean-Pierre Charras <jean-pierre.charras[at]gipsa-lab.inpg.fr>
|
||||
Igor Plyatov <plyatov[at]gmail.com>
|
||||
Fabrizio Tappero <fabrizio-dot-tappero[at]gmail-dot-com>
|
||||
Marco Ciampa <ciampix[at]libero-dot-it>
|
||||
Wayne Stambaugh <stambaughw[at]gmail-dot-com
|
||||
|
||||
|
||||
== Translators
|
||||
Czech (CZ) Martin Kratoška <martin[at]ok1rr-dot-com>
|
||||
@@ -55,21 +34,20 @@ Dutch (NL) Jerry Jacobs <xor.gate.engineering[at]gmail-dot-com>
|
||||
Finnish (FI) Vesa Solonen <vesa.solonen[at]hut-dot-fi>
|
||||
French (FR) Jean-Pierre Charras <jean-pierre.charras[at]inpg-dot-fr>
|
||||
Polish (PL) Mateusz Skowro¿ski <skowri[at]gmail-dot-com>
|
||||
Polish (PL) Kerusey Karyu <keruseykaryu[at]o2.pl>
|
||||
Polish (PL) Kerusey Karyu <keruseykaryu@o2.pl>
|
||||
Portuguese (PT) Renie Marquet <reniemarquet[at]uol-dot-com-dot-br>"
|
||||
Russian (RU) Igor Plyatov <plyatov[at]gmail-dot-com>
|
||||
Russian (RU) Andrey Fedorushkov <andrf[at]mail-dot-ru>
|
||||
Russian (RU) Eldar Khayrullin <eldar.khayrullin[at]mail-dot-ru>
|
||||
Russian (RU) Andrey Fedorushkov <andrf@mail.ru>
|
||||
Spanish (ES) Pedro Martin del Valle <pkicad[at]yahoo-dot-es>
|
||||
Spanish (ES) Iñigo Zuluaga <inigo_zuluaga[at]yahoo-dot-es>
|
||||
German (DE) Rafael Sokolowski <Rafael.Sokolowski[at]web-dot-de
|
||||
Japanese (JA) Kenta Yonekura <yoneken[at]kicad-dot-jp>
|
||||
Japanese (JA) Kenta Yonekura <midpika@hotmail.com>
|
||||
Japanese (JA) yoneken <midpika@hotmail.com>
|
||||
|
||||
Remy Halvick, David Briscoe, Dominique Laigle, Paul Burke
|
||||
|
||||
|
||||
== Programm credits for icons and others
|
||||
Icons by Iñigo Zuluagaz <inigo_zuluaga[at]yahoo-dot-es>
|
||||
New Icons by Fabrizio Tappero <fabrizio-dot-tappero[at]gmail-dot-com>
|
||||
3D modules by Renie Marquet <reniemarquet[at]uol-dot-com-dot-br>
|
||||
3D modules by Renie Marquet <reniemarquet[at]uol.com-dot-br>
|
||||
3D modules by Christophe Boschat <nox454[at]hotmail-dot-fr>
|
||||
|
||||
+156
-370
@@ -23,6 +23,9 @@ set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
|
||||
# reports.
|
||||
#
|
||||
|
||||
option( USE_KIWAY_DLLS
|
||||
"Build the major modules as KIFACE DLLs or DSOs, will soon be the norm." OFF )
|
||||
|
||||
# The desire is to migrate designs *away from* case independence, and to create designs which use
|
||||
# literally (case specific) interpreted component names. But for backwards compatibility,
|
||||
# you may turn OFF this option if you really must. (Remember that with KiCad using text
|
||||
@@ -32,38 +35,30 @@ set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
|
||||
# have this option turned OFF, the xml export's referential integrity is broken
|
||||
# on library part name. Hence the default is ON now, as of 29-Jan-2014.
|
||||
option( KICAD_KEEPCASE
|
||||
"Use case sensitive string matching for component names (default ON)."
|
||||
"ON= case specific string matching on component names, OFF= match names as if they were spelt using uppercase."
|
||||
ON
|
||||
)
|
||||
|
||||
option( USE_WX_GRAPHICS_CONTEXT
|
||||
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental" )
|
||||
"Use wxGraphicsContext for rendering ( default OFF). Warning, this is experimental" )
|
||||
|
||||
option( USE_WX_OVERLAY
|
||||
"Use wxOverlay: Always ON for MAC (default OFF). Warning, this is experimental" )
|
||||
"Use wxOverlay: Always ON for MAC ( default OFF). Warning, this is experimental" )
|
||||
|
||||
option( KICAD_SCRIPTING
|
||||
"Build the Python scripting support inside KiCad binaries (default OFF)."
|
||||
"set this option ON to build the scripting support inside kicad binaries"
|
||||
)
|
||||
|
||||
option( KICAD_SCRIPTING_MODULES
|
||||
"Build KiCad Python modules that can be used from scripting languages (default OFF)."
|
||||
"set this option ON to build kicad modules that can be used from scripting languages"
|
||||
)
|
||||
|
||||
option( KICAD_SCRIPTING_WXPYTHON
|
||||
"Build wxPython implementation for wx interface building in Python and py.shell (default OFF)."
|
||||
"set this option ON to build wxpython implementation for wx interface building in python and py.shell"
|
||||
)
|
||||
|
||||
option( KICAD_BUILD_STATIC
|
||||
"Build dependencies as static libraries. OSX only. (default OFF)."
|
||||
)
|
||||
|
||||
option( KICAD_BUILD_DYNAMIC
|
||||
"Build dependencies as shared libraries. Required for wxPython support. OXS only. (default OFF)."
|
||||
)
|
||||
|
||||
option( USE_OSX_DEPS_BUILDER
|
||||
"Build dependencies from source instead of dependencies installed on system. OSX only. (default OFF)."
|
||||
"Builds Kicad and all libraries static (except wx-widgets)"
|
||||
)
|
||||
|
||||
# WARNING: KiCad developers strongly advise you to build Boost with supplied patches,
|
||||
@@ -74,14 +69,14 @@ option( KICAD_SKIP_BOOST
|
||||
)
|
||||
mark_as_advanced( KICAD_SKIP_BOOST ) # Normal builders should build Boost.
|
||||
|
||||
|
||||
# when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
|
||||
# PYTHON_EXECUTABLE can be defined when invoking cmake
|
||||
# ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
|
||||
# when not defined by user, the default is python.exe under Windows and python2 for others
|
||||
# python binary file should be is exec path.
|
||||
|
||||
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON )
|
||||
|
||||
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." OFF )
|
||||
|
||||
# This can be set to a custom name to brag about a particular branch in the "About" dialog:
|
||||
set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this build came." )
|
||||
@@ -94,33 +89,16 @@ set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this bu
|
||||
set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake
|
||||
CACHE PATH "Location of KiCad downloads, suggested is a dir common to all builds, i.e. global." )
|
||||
|
||||
# Add option to add user directories for linker, if any
|
||||
#Add option to add user directories for linker, if any
|
||||
LINK_DIRECTORIES( ${LINK_DIRECTORIES_PATH} )
|
||||
|
||||
if( UNIX )
|
||||
set( KICAD_USER_CONFIG_DIR $ENV{HOME} CACHE PATH "Location of user specific KiCad config files" )
|
||||
set( KICAD_USER_CONFIG_DIR $ENV{HOME} CACHE PATH "Location of user specifig KiCad config files" )
|
||||
elseif( MINGW )
|
||||
set( KICAD_USER_CONFIG_DIR $ENV{APPDATA} CACHE PATH "Location of user specific KiCad config files" )
|
||||
set( KICAD_USER_CONFIG_DIR $ENV{%APPDATA%} CACHE PATH "Location of user specifig KiCad config files" )
|
||||
endif()
|
||||
mark_as_advanced( KICAD_USER_CONFIG_DIR )
|
||||
|
||||
# Set default data file path to CMAKE_INSTALL_PREFIX if it wasn't specified during the
|
||||
# CMake configuration. The value of DEFAULT_INSTALL_PATH is expanded in config.h and
|
||||
# used in the source code to define the base path for kicad search paths and environment
|
||||
# variables.
|
||||
if( NOT DEFAULT_INSTALL_PATH )
|
||||
set( DEFAULT_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}"
|
||||
CACHE
|
||||
PATH
|
||||
"Location of KiCad data files." )
|
||||
endif()
|
||||
|
||||
message( STATUS "Kicad install dir: <${DEFAULT_INSTALL_PATH}>" )
|
||||
|
||||
# Generate build system specific header file.
|
||||
include( PerformFeatureChecks )
|
||||
perform_feature_checks()
|
||||
|
||||
|
||||
#================================================
|
||||
# Set flags for GCC, or treat llvm as GCC
|
||||
@@ -132,12 +110,6 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
OUTPUT_VARIABLE GCC_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
|
||||
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
set( TO_LINKER -XLinker )
|
||||
else()
|
||||
set( TO_LINKER -Wl )
|
||||
endif()
|
||||
|
||||
# Establish -Wall early, so specialized relaxations of this may come
|
||||
# subsequently on the command line, such as in pcbnew/github/CMakeLists.txt
|
||||
set( CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}" )
|
||||
@@ -172,20 +144,6 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden" )
|
||||
endif()
|
||||
|
||||
find_package( OpenMP QUIET )
|
||||
|
||||
if( OPENMP_FOUND )
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
||||
add_definitions( -DUSE_OPENMP )
|
||||
|
||||
# MinGW does not include the OpenMP link library and FindOpenMP.cmake does not
|
||||
# set it either. Not sure this is the most elegant solution but it works.
|
||||
if( MINGW )
|
||||
set( OPENMP_LIBRARIES gomp )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( MINGW )
|
||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
||||
|
||||
@@ -199,28 +157,16 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
# Since version 2.8.5, Cmake uses a response file (.rsp) to
|
||||
# pass the list of include paths to gcc
|
||||
# unfortunately, under mingw32+msys, at least with gcc 4.8 and previous,
|
||||
# this file is not always expanded and in this case include paths defined in this file
|
||||
# are not taken in account ( this is the case of wxWidgets includes )
|
||||
# If it is the case, disable this response file for includes ( See Windows-GNU.cmake module )
|
||||
if( false ) #set to true to disable the include response file
|
||||
if( WIN32 AND MSYS AND NOT CMAKE_CROSSCOMPILING )
|
||||
# fixme: it is needed only with MSYS+MINGW32? or always under MINGW
|
||||
if( ${CMAKE_SIZEOF_VOID_P} MATCHES 4 )
|
||||
set( CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 0 )
|
||||
endif()
|
||||
# this file is not expanded and include paths defined in this file are not taken in account
|
||||
# this is the case of wxWidgets includes
|
||||
# Disable this response file for includes ( See Windows-GNU.cmake module )
|
||||
if( WIN32 AND MSYS AND NOT CMAKE_CROSSCOMPILING )
|
||||
# fixme: it is needed only with MSYS+MINGW32? or always under MINGW
|
||||
if( ${CMAKE_SIZEOF_VOID_P} MATCHES 4 )
|
||||
set( CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 0 )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# for some reasons, cmake does do use always a response file to send the list of objects
|
||||
# to the archiver, and because this list can be very long, and can create issue
|
||||
# when it is used in a command line, force use of a response file to store it
|
||||
SET( CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
|
||||
|
||||
# The MinGW compiler can use the microsoft system snprintf as standard and it has a broken
|
||||
# API with respect to the C99 standard, so make sure we force it to use its own compliant
|
||||
# snprintf
|
||||
add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
|
||||
|
||||
else()
|
||||
# We build DLL/DSOs from static libraries, so create position independent
|
||||
# code for all cases, since we do not have DLL/DSO specific static
|
||||
@@ -231,20 +177,17 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIC_FLAG}" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIC_FLAG}" )
|
||||
|
||||
if( NOT APPLE )
|
||||
# Thou shalt not link vaporware and tell us it's a valid DSO (apple ld doesn't support it)
|
||||
set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
||||
|
||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
||||
|
||||
# Defeat ELF's ability to use the GOT to replace locally implemented functions
|
||||
# with ones from another module.
|
||||
# https://bugs.launchpad.net/kicad/+bug/1322354
|
||||
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TO_LINKER},-Bsymbolic" )
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${TO_LINKER},-Bsymbolic" )
|
||||
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
set( TO_LINKER -XLinker )
|
||||
else()
|
||||
set( TO_LINKER -Wl )
|
||||
endif()
|
||||
|
||||
# Thou shalt not link vaporware and tell us it's a valid DSO:
|
||||
set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
|
||||
|
||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
||||
endif()
|
||||
|
||||
# quiet GCC while in boost
|
||||
@@ -255,25 +198,19 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
|
||||
if( APPLE )
|
||||
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__ASSERTMACROS__" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__ASSERTMACROS__" )
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
|
||||
|
||||
# Allows .dylib relocation in the future - needed by fixbundle
|
||||
# Allows .dylib relocation in the future
|
||||
set( CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -headerpad_max_install_names")
|
||||
|
||||
if( NOT CMAKE_CXX_COMPILER )
|
||||
EXEC_PROGRAM( wx-config ARGS --cc OUTPUT_VARIABLE CMAKE_C_COMPILER )
|
||||
endif()
|
||||
endif( NOT CMAKE_CXX_COMPILER )
|
||||
|
||||
if( NOT CMAKE_CXX_COMPILER )
|
||||
EXEC_PROGRAM( wx-config ARGS --cxx OUTPUT_VARIABLE CMAKE_CXX_COMPILER )
|
||||
endif()
|
||||
|
||||
# There seems to be no consistent behavior when -mmacosx-min-version is
|
||||
# not specified, so force user to set minimum OSX version to build for
|
||||
if( NOT CMAKE_OSX_DEPLOYMENT_TARGET )
|
||||
message( FATAL_ERROR "Please specify target OS X version using -DCMAKE_OSX_DEPLOYMENT_TARGET=10.x" )
|
||||
endif()
|
||||
endif( NOT CMAKE_CXX_COMPILER )
|
||||
|
||||
endif()
|
||||
|
||||
@@ -304,13 +241,19 @@ if( USE_WX_GRAPHICS_CONTEXT )
|
||||
endif()
|
||||
|
||||
|
||||
# By default images in menu items are enabled on all platforms except OSX.
|
||||
if( NOT APPLE )
|
||||
set( USE_IMAGES_IN_MENUS ON CACHE BOOL "Enable images in menus" )
|
||||
else()
|
||||
set( USE_IMAGES_IN_MENUS OFF CACHE BOOL "Enable images in menus" )
|
||||
endif()
|
||||
|
||||
# Allow user to override the default settings for adding images to menu items. By default
|
||||
# images in menu items are enabled on all platforms except OSX. This can be over ridden by
|
||||
# defining -DUSE_IMAGES_IN_MENUS=ON/OFF to force the preferred behavior.
|
||||
if( NOT DEFINED USE_IMAGES_IN_MENUS )
|
||||
if( NOT APPLE )
|
||||
set( USE_IMAGES_IN_MENUS ON )
|
||||
endif()
|
||||
else()
|
||||
if( USE_IMAGES_IN_MENUS )
|
||||
set( USE_IMAGES_IN_MENUS ON )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# KIFACE_SUFFIX is the file extension used for top level program modules which
|
||||
@@ -333,83 +276,39 @@ set( KIFACE_PREFIX "_" )
|
||||
|
||||
#================================================
|
||||
# Locations for install targets.
|
||||
#================================================
|
||||
if( NOT APPLE )
|
||||
set( KICAD_BIN bin
|
||||
CACHE PATH "Location of KiCad binaries." )
|
||||
|
||||
set( KICAD_FP_LIB_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}"
|
||||
CACHE PATH "Default path where footprint libraries are installed." )
|
||||
|
||||
if( UNIX )
|
||||
# Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
|
||||
set( KICAD_BIN ${CMAKE_INSTALL_PREFIX}/bin
|
||||
CACHE PATH "Location of KiCad binaries." )
|
||||
|
||||
if( WIN32 )
|
||||
set( KICAD_PLUGINS ${KICAD_BIN}/scripting/plugins
|
||||
CACHE PATH "Location of KiCad plugins." )
|
||||
else()
|
||||
set( KICAD_PLUGINS lib/kicad/plugins
|
||||
CACHE PATH "Location of KiCad plugins." )
|
||||
endif()
|
||||
|
||||
set( KICAD_PLUGINS lib/kicad/plugins
|
||||
CACHE PATH "Location of KiCad plugins." )
|
||||
set( KICAD_DATA share/kicad
|
||||
CACHE PATH "Location of KiCad data files." )
|
||||
set( KICAD_DOCS share/doc/kicad
|
||||
CACHE PATH "Location of KiCad documentation files." )
|
||||
set( KICAD_DEMOS ${KICAD_DATA}/demos
|
||||
CACHE PATH "Location of KiCad demo files." )
|
||||
set( KICAD_TEMPLATE ${KICAD_DATA}/template
|
||||
CACHE PATH "Location of KiCad template files." )
|
||||
else()
|
||||
# everything without leading / is relative to CMAKE_INSTALL_PREFIX.
|
||||
# CMAKE_INSTALL_PREFIX is root of .dmg image
|
||||
set( KICAD_BIN ${CMAKE_INSTALL_PREFIX}
|
||||
CACHE PATH "Location of KiCad binaries." FORCE )
|
||||
|
||||
# some paths to single app bundle
|
||||
set( OSX_BUNDLE_MAIN "kicad.app" )
|
||||
set( OSX_BUNDLE_BIN_DIR "Contents/MacOS" )
|
||||
set( OSX_BUNDLE_LIB_DIR "Contents/Frameworks" )
|
||||
set( OSX_BUNDLE_KIFACE_DIR "Contents/PlugIns" )
|
||||
set( OSX_BUNDLE_SUP_DIR "Contents/SharedSupport" )
|
||||
set( OSX_BUNDLE_APP_DIR "Contents/Applications" )
|
||||
set( OSX_BUNDLE_BUILD_DIR "${CMAKE_BINARY_DIR}/kicad/${OSX_BUNDLE_MAIN}" )
|
||||
set( OSX_BUNDLE_BUILD_BIN_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_BIN_DIR}" )
|
||||
set( OSX_BUNDLE_BUILD_LIB_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_LIB_DIR}" )
|
||||
set( OSX_BUNDLE_BUILD_KIFACE_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_KIFACE_DIR}" )
|
||||
set( OSX_BUNDLE_INSTALL_DIR "${KICAD_BIN}/${OSX_BUNDLE_MAIN}" )
|
||||
set( OSX_BUNDLE_INSTALL_BIN_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_BIN_DIR}" )
|
||||
set( OSX_BUNDLE_INSTALL_LIB_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_LIB_DIR}" )
|
||||
set( OSX_BUNDLE_INSTALL_KIFACE_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_KIFACE_DIR}" )
|
||||
|
||||
# everything provided with the application bundle goes into
|
||||
# kicad.app/Contents/SharedSupport => accessible via GetDataDir()
|
||||
# everything else to the .dmg image
|
||||
set( KICAD_DATA ${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_SUP_DIR}
|
||||
CACHE PATH "Location of KiCad data files." FORCE )
|
||||
set( KICAD_TEMPLATE ${KICAD_DATA}/template
|
||||
CACHE PATH "Location of KiCad template files." FORCE )
|
||||
set( KICAD_PLUGINS ${KICAD_DATA}/plugins
|
||||
CACHE PATH "Location of KiCad plugins." FORCE )
|
||||
set( KICAD_DOCS doc
|
||||
CACHE PATH "Location of KiCad documentation files." FORCE )
|
||||
set( KICAD_DEMOS demos
|
||||
CACHE PATH "Location of KiCad demo files." FORCE )
|
||||
|
||||
# Override default paths for fixup_bundle
|
||||
set( OSX_BUNDLE_OVERRIDE_PATHS "
|
||||
function( gp_item_default_embedded_path_override item default_embedded_path_var )
|
||||
# by default, embed things right next to the main bundle executable:
|
||||
set( path \"@executable_path/../../Contents/MacOS\" )
|
||||
set( overridden 0 )
|
||||
|
||||
# embed .dylibs right next to the main bundle executable:
|
||||
if( item MATCHES \"\\\\.dylib$\" )
|
||||
set( path \"@executable_path/../Frameworks\" )
|
||||
set( overridden 1 )
|
||||
endif()
|
||||
|
||||
set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE )
|
||||
endfunction(gp_item_default_embedded_path_override)
|
||||
"
|
||||
)
|
||||
set( KICAD_FP_LIB_INSTALL_PATH "${KICAD_FP_LIB_INSTALL_PATH}/share/kicad/modules" )
|
||||
endif()
|
||||
|
||||
if( MINGW )
|
||||
# Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
|
||||
set( KICAD_PLUGINS ${KICAD_BIN}/plugins
|
||||
CACHE PATH "Location of KiCad plugins." )
|
||||
set( KICAD_DATA share
|
||||
CACHE PATH "Location of KiCad data files." )
|
||||
set( KICAD_DOCS doc
|
||||
CACHE PATH "Location of KiCad documentation files." )
|
||||
set( KICAD_FP_LIB_INSTALL_PATH "${KICAD_FP_LIB_INSTALL_PATH}/modules" )
|
||||
endif()
|
||||
|
||||
set( KICAD_DEMOS ${KICAD_DATA}/demos
|
||||
CACHE PATH "Location of KiCad demo files." )
|
||||
set( KICAD_TEMPLATE ${KICAD_DATA}/template
|
||||
CACHE PATH "Location of KiCad template files." )
|
||||
|
||||
mark_as_advanced( KICAD_BIN
|
||||
KICAD_PLUGINS
|
||||
KICAD_DATA
|
||||
@@ -426,23 +325,8 @@ include( ExternalProject )
|
||||
#================================================
|
||||
include( CheckFindPackageResult )
|
||||
|
||||
##########################
|
||||
# Find wxWidgets library #
|
||||
##########################
|
||||
# Here you can define what libraries of wxWidgets you need for your
|
||||
# application. You can figure out what libraries you need here;
|
||||
# http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html
|
||||
|
||||
# Turn on wxWidgets compatibility mode for some classes
|
||||
add_definitions( -DWX_COMPATIBILITY )
|
||||
|
||||
# See line 41 of CMakeModules/FindwxWidgets.cmake
|
||||
set( wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --static=no )
|
||||
|
||||
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml stc REQUIRED )
|
||||
|
||||
# Include wxWidgets macros.
|
||||
include( ${wxWidgets_USE_FILE} )
|
||||
add_definitions(-DWX_COMPATIBILITY)
|
||||
|
||||
#######################
|
||||
# Find OpenGL library #
|
||||
@@ -450,27 +334,7 @@ include( ${wxWidgets_USE_FILE} )
|
||||
find_package( OpenGL QUIET )
|
||||
check_find_package_result( OPENGL_FOUND "OpenGL" )
|
||||
|
||||
# Dick 5-Feb-2014:
|
||||
# Marco: We cannot use both ExternalProject_Add() add and find_package()
|
||||
# in the same CMake tree and have them both reference the same package:
|
||||
# http://stackoverflow.com/questions/6351609/cmake-linking-to-library-downloaded-from-externalproject-add
|
||||
# https://www.mail-archive.com/cmake@cmake.org/msg47501.html
|
||||
|
||||
# Handle target used to specify if a target needs wx-widgets or other libraries
|
||||
# Always defined, empty if no libraries are to be built
|
||||
add_custom_target( lib-dependencies )
|
||||
|
||||
# Only download and build all dependencies from source on OSX if the user specifically requests
|
||||
# it. Otherwise, respect the developers wishes to use the dependencies already installed on
|
||||
# their system
|
||||
if( APPLE AND USE_OSX_DEPS_BUILDER )
|
||||
|
||||
# This should be built in all cases, if swig exec is not available
|
||||
# will be impossible also enable SCRIPTING being for PCBNEW required immediately
|
||||
|
||||
include( download_pcre )
|
||||
include( download_swig )
|
||||
|
||||
if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
|
||||
|
||||
#set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so;.dylib;.dll")
|
||||
|
||||
@@ -480,83 +344,55 @@ if( APPLE AND USE_OSX_DEPS_BUILDER )
|
||||
|
||||
if( KICAD_BUILD_STATIC )
|
||||
message(STATUS "KICAD_BUILD_STATIC set")
|
||||
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_WXPYTHON OR KICAD_SCRIPTING_MODULES )
|
||||
message(FATAL_ERROR "KICAD_SCRIPTING* is not supported with KICAD_BUILD_STATIC, please select KICAD_BUILD_DYNAMIC" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( KICAD_BUILD_DYNAMIC )
|
||||
message(STATUS "KICAD_BUILD_DYNAMIC set")
|
||||
# TODO - Library packaging/relocation
|
||||
endif()
|
||||
|
||||
add_custom_target( lib-dependencies
|
||||
DEPENDS boost cairo glew libpng pixman pkgconfig
|
||||
)
|
||||
|
||||
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_WXPYTHON OR KICAD_SCRIPTING_MODULES )
|
||||
include( download_libpng )
|
||||
|
||||
message(STATUS "Scripting ENABLED")
|
||||
include( download_wxpython )
|
||||
|
||||
set( SWIG_EXECUTABLE ${SWIG_ROOT}/bin/swig )
|
||||
set( SWIG_INCLUDE ${SWIG_ROOT}/include )
|
||||
set( PYTHON_DEST ${LIBWXPYTHON_ROOT}/wxPython/lib/python2.6/site-packages )
|
||||
|
||||
if( NOT EXISTS ${SWIG_EXECUTABLE} )
|
||||
set(KICAD_SCRIPTING CACHE OFF FORCE "Disabling KICAD_SCRIPTING")
|
||||
message( STATUS "KICAD_SCRIPTING Enabled but SWIG not found, please disable and before reenabling execute: make swig")
|
||||
message( FATAL_ERROR "Missing SWIG!")
|
||||
endif()
|
||||
message(STATUS "SWIG_EXECUTABLE: ${SWIG_EXECUTABLE}")
|
||||
|
||||
set( PYTHON_DEST ${LIBWXPYTHON_ROOT}/wxPython/lib/python2.6/site-packages )
|
||||
|
||||
add_dependencies( lib-dependencies libwxpython )
|
||||
add_dependencies( lib-dependencies swig )
|
||||
if( KICAD_SCRIPTING_WXPYTHON )
|
||||
message( FATAL_ERROR "KICAD_BUILD_* and SCRIPTING Not Implemented Yet!" )
|
||||
else()
|
||||
include( download_wxwidgets )
|
||||
add_dependencies( lib-dependencies libwx )
|
||||
endif()
|
||||
|
||||
include( download_libpng )
|
||||
include( download_pkgconfig )
|
||||
set( PKG_CONFIG_EXECUTABLE "${PKGCONFIG_ROOT}/bin/pkg-config" )
|
||||
set( PKG_CONFIG_EXECUTABLE "${PKGCONFIG_ROOT}/bin/pkg-config" )
|
||||
include( download_glew )
|
||||
set( GLEW_GLEW_LIBRARY "${GLEW_ROOT}/lib/libGLEW.a" )
|
||||
set( GLEW_INCLUDE_DIR "${GLEW_ROOT}/include" )
|
||||
set( GLEW_GLEW_LIBRARY "${GLEW_ROOT}/lib/libGLEW.a" )
|
||||
set( GLEW_INCLUDE_DIR "${GLEW_ROOT}/include" )
|
||||
include( download_pixman )
|
||||
set( PIXMAN_LIBRARY "${PIXMAN_ROOT}/lib/libpixman-1.a" )
|
||||
set( PIXMAN_LIBRARY "${PIXMAN_ROOT}/lib/libpixman-1.a" )
|
||||
include( download_cairo )
|
||||
set( CAIRO_INCLUDE_DIR "${CAIRO_ROOT}/include/cairo" )
|
||||
set( CAIRO_LIBRARY "${CAIRO_ROOT}/lib/libcairo.a" )
|
||||
|
||||
add_dependencies( lib-dependencies boost )
|
||||
add_dependencies( lib-dependencies cairo )
|
||||
add_dependencies( lib-dependencies libpng )
|
||||
add_dependencies( lib-dependencies pixman )
|
||||
add_dependencies( lib-dependencies pkgconfig )
|
||||
set( CAIRO_INCLUDE_DIR "${CAIRO_ROOT}/include/cairo" )
|
||||
set( CAIRO_LIBRARY "${CAIRO_ROOT}/lib/libcairo.a" )
|
||||
|
||||
if( KICAD_BUILD_DYNAMIC AND APPLE )
|
||||
add_custom_target( osx_fix_bundles ALL DEPENDS
|
||||
eeschema gerbview kicad pcbnew bitmap2component pcb_calculator pl_editor)
|
||||
add_custom_command(TARGET osx_fix_bundles
|
||||
POST_BUILD COMMAND ${PROJECT_SOURCE_DIR}/scripts/osx_fixbundle.sh ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Migrating dylibs to bundles")
|
||||
add_custom_target( osx_fix_bundles ALL DEPENDS cvpcb eeschema gerbview kicad pcbnew bitmap2component pcb_calculator pl_editor)
|
||||
add_custom_command(TARGET osx_fix_bundles POST_BUILD COMMAND scripts/osx_fixbundle.sh COMMENT "Migrating dylibs to bundles")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC)
|
||||
|
||||
#####################
|
||||
# Find GLEW library #
|
||||
#####################
|
||||
if( NOT GLEW_FOUND )
|
||||
find_package( GLEW )
|
||||
check_find_package_result( GLEW_FOUND "GLEW" )
|
||||
endif()
|
||||
find_package(GLEW)
|
||||
check_find_package_result(GLEW_FOUND "GLEW")
|
||||
|
||||
######################
|
||||
# Find Cairo library #
|
||||
######################
|
||||
if( NOT CAIRO_FOUND )
|
||||
find_package( Cairo 1.8.1 QUIET )
|
||||
check_find_package_result( CAIRO_FOUND "Cairo" )
|
||||
endif()
|
||||
find_package(Cairo 1.8.1 QUIET)
|
||||
check_find_package_result(CAIRO_FOUND "Cairo")
|
||||
|
||||
# Download boost and possibly build parts of it
|
||||
#################################################
|
||||
@@ -568,22 +404,43 @@ if( KICAD_SKIP_BOOST )
|
||||
message( FATAL_ERROR "Boost 1.54+ libraries are required." )
|
||||
endif()
|
||||
|
||||
# Keeps CMake from complaining about undefined boost dependencies even though Boost was
|
||||
# found. Sigh!!!!!
|
||||
add_custom_target( boost )
|
||||
|
||||
message( WARNING "
|
||||
WARNING: You decided to skip building boost library.
|
||||
KiCad developers strongly advise you to build the bundled boost library, as it is known to work with KiCad.
|
||||
Other versions may contain bugs that may result in KiCad errors." )
|
||||
else()
|
||||
add_dependencies( lib-dependencies boost )
|
||||
include( download_boost )
|
||||
endif()
|
||||
|
||||
##########################
|
||||
# Find wxWidgets library #
|
||||
##########################
|
||||
# Here you can define what libraries of wxWidgets you need for your
|
||||
# application. You can figure out what libraries you need here;
|
||||
# http://www.wxwidgets.org/manuals/2.8/wx_librarieslist.html
|
||||
|
||||
# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
|
||||
# Seems no more needed on wx-3
|
||||
if( APPLE AND NOT (KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC) )
|
||||
find_package( wxWidgets COMPONENTS gl adv html core net base xml QUIET )
|
||||
else()
|
||||
find_package( wxWidgets COMPONENTS gl aui adv html core net base xml QUIET )
|
||||
endif()
|
||||
|
||||
if( NOT (KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC) )
|
||||
check_find_package_result( wxWidgets_FOUND "wxWidgets" )
|
||||
endif( NOT (KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC) )
|
||||
|
||||
# Include wxWidgets macros.
|
||||
include( ${wxWidgets_USE_FILE} )
|
||||
|
||||
# Include MinGW resource compiler.
|
||||
include( MinGWResourceCompiler )
|
||||
|
||||
# Generate build system specific header file.
|
||||
include( PerformFeatureChecks )
|
||||
perform_feature_checks()
|
||||
|
||||
# Find GDI+ on windows if wxGraphicsContext is available.
|
||||
if( MINGW AND USE_WX_GRAPHICS_CONTEXT )
|
||||
find_package( GdiPlus )
|
||||
@@ -613,82 +470,28 @@ set( INC_AFTER
|
||||
|
||||
# Find Python and other scripting resources
|
||||
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
||||
# force a python version < 3.0
|
||||
set( PythonInterp_FIND_VERSION 2.6 )
|
||||
set( PythonLibs_FIND_VERSION 2.6 )
|
||||
|
||||
set( PythonInterp_FIND_VERSION )
|
||||
find_package( PythonInterp )
|
||||
|
||||
check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
|
||||
|
||||
if( NOT PYTHON_VERSION_MAJOR EQUAL 2 )
|
||||
message( FATAL_ERROR "Python 2.x is required." )
|
||||
endif()
|
||||
|
||||
# Get the correct Python site package install path from the Python interpreter found by
|
||||
# FindPythonInterp unless the user specifically defined a custom path.
|
||||
if( NOT PYTHON_SITE_PACKAGE_PATH )
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib(plat_specific=0, standard_lib=0, prefix='')"
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()"
|
||||
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if( NOT PYTHON_SITE_PACKAGE_PATH )
|
||||
message( FATAL_ERROR "Error occurred while attempting to find the Python site library path." )
|
||||
message( FATAL_ERROR "Error occurred while attemping to find the Python site library path." )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( NOT APPLE )
|
||||
set( PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}"
|
||||
CACHE PATH "Python module install path."
|
||||
)
|
||||
else()
|
||||
# relative path for python in bundle
|
||||
set( PYTHON_LIB_DIR "python/site-packages" )
|
||||
# install into bundle Frameworks folder
|
||||
set( PYTHON_DEST "${OSX_BUNDLE_BUILD_LIB_DIR}/${PYTHON_LIB_DIR}"
|
||||
CACHE PATH "Python module install path."
|
||||
)
|
||||
endif()
|
||||
set( PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" CACHE PATH "Python module install path." )
|
||||
mark_as_advanced( PYTHON_DEST )
|
||||
message( STATUS "Python module install path: ${PYTHON_DEST}" )
|
||||
|
||||
find_package( PythonLibs 2.6 )
|
||||
|
||||
if( KICAD_SCRIPTING_WXPYTHON )
|
||||
# Check to see if the correct version of wxPython is installed based on the version of
|
||||
# wxWidgets found. At least the major an minor version should match.
|
||||
set( _wxpy_version "${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}" )
|
||||
set( _py_cmd "import wxversion;print wxversion.checkInstalled('${_wxpy_version}')" )
|
||||
|
||||
# Add user specified Python site package path.
|
||||
if( PYTHON_SITE_PACKAGE_PATH )
|
||||
set( _py_cmd
|
||||
"import sys;sys.path.insert(0, \"${PYTHON_SITE_PACKAGE_PATH}\");${_py_cmd}" )
|
||||
endif()
|
||||
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_cmd}"
|
||||
RESULT_VARIABLE WXPYTHON_VERSION_RESULT
|
||||
OUTPUT_VARIABLE WXPYTHON_VERSION_FOUND
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# message( STATUS "WXPYTHON_VERSION_FOUND: ${WXPYTHON_VERSION_FOUND}" )
|
||||
# message( STATUS "WXPYTHON_VERSION_RESULT: ${WXPYTHON_VERSION_RESULT}" )
|
||||
|
||||
# Check to see if any version of wxPython is installed on the system.
|
||||
if( WXPYTHON_VERSION_RESULT GREATER 0 )
|
||||
message( FATAL_ERROR "wxPython does not appear to be installed on the system." )
|
||||
endif()
|
||||
|
||||
if( NOT WXPYTHON_VERSION_FOUND STREQUAL "True" )
|
||||
message( FATAL_ERROR
|
||||
"wxPython version ${_wxpy_version} does not appear to be installed on the system." )
|
||||
endif()
|
||||
|
||||
set( WXPYTHON_VERSION ${_wxpy_version} CACHE STRING "wxPython version found." )
|
||||
message( STATUS "wxPython version ${_wxpy_version} found." )
|
||||
endif()
|
||||
find_package( PythonLibs )
|
||||
|
||||
#message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )
|
||||
|
||||
@@ -701,6 +504,11 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
# Automagically create version header file.
|
||||
include( CreateBzrVersionHeader )
|
||||
create_bzr_version_header()
|
||||
|
||||
if( EXISTS ${CMAKE_SOURCE_DIR}/include/config.h )
|
||||
# This file may exist ( created by an alternate process to the svn test above),
|
||||
# e.g. could be created by a checkout script that produces a source tar file.
|
||||
@@ -715,24 +523,6 @@ endif()
|
||||
# 'CMakeLists.txt' files to process
|
||||
#================================================
|
||||
|
||||
if( APPLE )
|
||||
# Remove app bundles in ${KICAD_BIN} before installing anything new.
|
||||
# Must be defined before all includes so that it is executed first.
|
||||
install( CODE "
|
||||
message( STATUS \"Removing existing application bundles...\" )
|
||||
# Remove links to standalone apps
|
||||
file( REMOVE ${KICAD_BIN}/bitmap2component.app )
|
||||
file( REMOVE ${KICAD_BIN}/eeschema.app )
|
||||
file( REMOVE ${KICAD_BIN}/gerbview.app )
|
||||
file( REMOVE ${KICAD_BIN}/pcb_calculator.app )
|
||||
file( REMOVE ${KICAD_BIN}/pcbnew.app )
|
||||
file( REMOVE ${KICAD_BIN}/pl_editor.app )
|
||||
# Remove main bundle
|
||||
file( REMOVE_RECURSE ${KICAD_BIN}/${OSX_BUNDLE_MAIN} )
|
||||
" COMPONENT Runtime
|
||||
)
|
||||
endif()
|
||||
|
||||
############################
|
||||
# Binaries ( CMake targets ) #
|
||||
############################
|
||||
@@ -743,6 +533,7 @@ add_subdirectory( 3d-viewer )
|
||||
add_subdirectory( cvpcb )
|
||||
add_subdirectory( eeschema )
|
||||
add_subdirectory( gerbview )
|
||||
add_subdirectory( kicad )
|
||||
add_subdirectory( lib_dxf )
|
||||
add_subdirectory( pcbnew )
|
||||
add_subdirectory( polygon )
|
||||
@@ -750,11 +541,8 @@ add_subdirectory( pagelayout_editor )
|
||||
add_subdirectory( potrace )
|
||||
add_subdirectory( bitmap2component )
|
||||
add_subdirectory( pcb_calculator )
|
||||
add_subdirectory( kicad ) # should follow pcbnew, eeschema
|
||||
add_subdirectory( tools )
|
||||
add_subdirectory( utils )
|
||||
add_subdirectory( qa )
|
||||
|
||||
#add_subdirectory( new )
|
||||
|
||||
|
||||
@@ -762,7 +550,7 @@ add_subdirectory( qa )
|
||||
# except perhaps bitmap lib. This allows a multi-threaded build to succeed.
|
||||
add_dependencies( pcbnew boost )
|
||||
add_dependencies( eeschema boost )
|
||||
add_dependencies( cvpcb_kiface boost )
|
||||
add_dependencies( cvpcb boost )
|
||||
add_dependencies( gal boost )
|
||||
add_dependencies( common boost )
|
||||
add_dependencies( pcbcommon boost )
|
||||
@@ -773,20 +561,24 @@ add_dependencies( pl_editor boost )
|
||||
add_dependencies( pnsrouter boost )
|
||||
|
||||
|
||||
if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
|
||||
add_dependencies( pcbnew lib-dependencies )
|
||||
add_dependencies( eeschema lib-dependencies )
|
||||
add_dependencies( cvpcb_kiface lib-dependencies )
|
||||
add_dependencies( common lib-dependencies )
|
||||
add_dependencies( gal lib-dependencies )
|
||||
add_dependencies( pcbcommon lib-dependencies )
|
||||
add_dependencies( 3d-viewer lib-dependencies )
|
||||
add_dependencies( pcad2kicadpcb lib-dependencies )
|
||||
add_dependencies( pl_editor lib-dependencies )
|
||||
add_dependencies( pnsrouter lib-dependencies )
|
||||
if ( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
|
||||
add_dependencies( pcbnew lib-dependencies )
|
||||
add_dependencies( eeschema lib-dependencies )
|
||||
add_dependencies( cvpcb lib-dependencies )
|
||||
add_dependencies( gal lib-dependencies )
|
||||
add_dependencies( common lib-dependencies )
|
||||
add_dependencies( pcbcommon lib-dependencies )
|
||||
add_dependencies( 3d-viewer lib-dependencies )
|
||||
add_dependencies( pcad2kicadpcb lib-dependencies )
|
||||
add_dependencies( polygon lib-dependencies )
|
||||
add_dependencies( pl_editor lib-dependencies )
|
||||
add_dependencies( pnsrouter lib-dependencies )
|
||||
if ( BUILD_GITHUB_PLUGIN )
|
||||
add_dependencies( github_plugin lib-dependencies )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( KICAD_BUILD_DYNAMIC )
|
||||
if ( KICAD_BUILD_DYNAMIC )
|
||||
endif()
|
||||
|
||||
#############
|
||||
@@ -807,20 +599,10 @@ if( DOXYGEN_FOUND )
|
||||
DEPENDS Doxyfile
|
||||
COMMENT "building doxygen docs into directory Documentation/doxygen/html"
|
||||
)
|
||||
add_custom_target( dev-docs
|
||||
${CMAKE_COMMAND} -E remove_directory Documentation/development/doxygen
|
||||
COMMAND ${DOXYGEN_EXECUTABLE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/development
|
||||
DEPENDS Doxyfile
|
||||
COMMENT "building developer's resource docs into directory Documentation/development/doxygen/html"
|
||||
)
|
||||
else()
|
||||
message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" )
|
||||
endif()
|
||||
|
||||
# Generate config.h.
|
||||
configure_file( ${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
|
||||
${CMAKE_BINARY_DIR}/config.h )
|
||||
|
||||
#================================================
|
||||
# "make uninstall" rules
|
||||
@@ -842,6 +624,10 @@ install( FILES INSTALL.txt
|
||||
DESTINATION ${KICAD_DOCS}
|
||||
COMPONENT resources )
|
||||
|
||||
install( FILES resources/freeroute.jnlp
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT resources )
|
||||
|
||||
###
|
||||
# Install scripts
|
||||
###
|
||||
@@ -855,7 +641,7 @@ endif()
|
||||
###
|
||||
# FreeDesktop .desktop and MIME resources
|
||||
###
|
||||
if( UNIX AND NOT APPLE )
|
||||
if( UNIX )
|
||||
|
||||
# Set paths
|
||||
set( UNIX_MIME_DIR resources/linux/mime )
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
# Copyright (C) 2010-2015 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
# Copyright (C) 2010 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,11 +22,7 @@
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#
|
||||
|
||||
macro( create_bzr_version_header _bzr_src_path )
|
||||
# If bzr is not found or an error occurs using the bzr commands to determine the repo
|
||||
# version, set the build version string to "no-bzr"
|
||||
set( KICAD_BUILD_VERSION "no-bzr" )
|
||||
|
||||
macro( create_bzr_version_header )
|
||||
# Include Bazaar support to automagically create version header file.
|
||||
find_package( Bazaar )
|
||||
|
||||
@@ -34,42 +30,53 @@ macro( create_bzr_version_header _bzr_src_path )
|
||||
set( _Bazaar_SAVED_LC_ALL "$ENV{LC_ALL}" )
|
||||
set( ENV{LC_ALL} C )
|
||||
|
||||
# Get the tree revision
|
||||
execute_process(
|
||||
COMMAND ${Bazaar_EXECUTABLE} revno --tree ${_bzr_src_path}
|
||||
OUTPUT_VARIABLE _bzr_TREE_DATE
|
||||
RESULT_VARIABLE _bzr_revno_result
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
# Get the tree revison
|
||||
execute_process( COMMAND
|
||||
${Bazaar_EXECUTABLE} revno --tree ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE _bazaar_TREE_DATE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if( ${_bzr_revno_result} EQUAL 0 )
|
||||
# Get more info about that revision
|
||||
execute_process(
|
||||
COMMAND ${Bazaar_EXECUTABLE} log -r${_bzr_TREE_DATE} ${_bzr_src_path}
|
||||
OUTPUT_VARIABLE _bzr_LAST_CHANGE_LOG
|
||||
ERROR_VARIABLE _bzr_log_error
|
||||
RESULT_VARIABLE _bzr_log_result
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
# Get more info about that revision
|
||||
execute_process( COMMAND
|
||||
${Bazaar_EXECUTABLE} log -r${_bazaar_TREE_DATE} ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE _bazaar_LAST_CHANGE_LOG
|
||||
ERROR_VARIABLE _bazaar_log_error
|
||||
RESULT_VARIABLE _bazaar_log_result
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
|
||||
if( ${_bzr_log_result} EQUAL 0 )
|
||||
string( REGEX REPLACE "^(.*\n)?revno: ([^ \n]+).*"
|
||||
"\\2" Kicad_REPO_REVISION "${_bzr_LAST_CHANGE_LOG}" )
|
||||
string( REGEX REPLACE "^(.*\n)?committer: ([^\n]+).*"
|
||||
"\\2" Kicad_REPO_LAST_CHANGED_AUTHOR "${_bzr_LAST_CHANGE_LOG}" )
|
||||
string( REGEX REPLACE "^(.*\n)?timestamp: [a-zA-Z]+ ([^ \n]+).*"
|
||||
"\\2" Kicad_REPO_LAST_CHANGED_DATE "${_bzr_LAST_CHANGE_LOG}" )
|
||||
endif()
|
||||
endif()
|
||||
if( NOT ${_bzr_log_result} EQUAL 0 )
|
||||
message(STATUS "Using <build_version.h> for version string.")
|
||||
else( NOT ${_bzr_log_result} EQUAL 0 )
|
||||
string( REGEX REPLACE "^(.*\n)?revno: ([^ \n]+).*"
|
||||
"\\2" Kicad_REPO_REVISION "${_bazaar_LAST_CHANGE_LOG}" )
|
||||
string( REGEX REPLACE "^(.*\n)?committer: ([^\n]+).*"
|
||||
"\\2" Kicad_REPO_LAST_CHANGED_AUTHOR "${_bazaar_LAST_CHANGE_LOG}" )
|
||||
string( REGEX REPLACE "^(.*\n)?timestamp: [a-zA-Z]+ ([^ \n]+).*"
|
||||
"\\2" Kicad_REPO_LAST_CHANGED_DATE "${_bazaar_LAST_CHANGE_LOG}" )
|
||||
endif( NOT ${_bzr_log_result} EQUAL 0 )
|
||||
|
||||
set( ENV{LC_ALL} ${_Bazaar_SAVED_LC_ALL} )
|
||||
endif()
|
||||
endif( Bazaar_FOUND )
|
||||
|
||||
# Check to make sure 'bzr log' command did not fail. Otherwise, default
|
||||
# to "no-bzr" as the revision.
|
||||
# Check to make sure 'bzr log' command did not fail. Otherwise fallback
|
||||
# to version strings defined in "<kicad-src-dir>/include/build_version.h".
|
||||
if( Kicad_REPO_LAST_CHANGED_DATE )
|
||||
string( REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+)" "\\1-\\2-\\3"
|
||||
_kicad_bzr_date ${Kicad_REPO_LAST_CHANGED_DATE} )
|
||||
_kicad_bzr_date ${Kicad_REPO_LAST_CHANGED_DATE} )
|
||||
set( KICAD_BUILD_VERSION "(${_kicad_bzr_date} BZR ${Kicad_REPO_REVISION})" )
|
||||
endif()
|
||||
|
||||
set( KICAD_BUILD_VERSION ${KICAD_BUILD_VERSION} )
|
||||
endmacro()
|
||||
# Definition to conditionally use date and revision returned from the
|
||||
# Bazaar log command instead of hand coded date and revision in
|
||||
# "include/build_version.h". If Bazaar is not found then the date
|
||||
# and version information must be manually edited.
|
||||
# Directive means bzr build, program version and build version will
|
||||
# reflect this.
|
||||
add_definitions( -DHAVE_SVN_VERSION )
|
||||
|
||||
# Generate version.h.
|
||||
configure_file( ${CMAKE_SOURCE_DIR}/CMakeModules/version.h.cmake
|
||||
${CMAKE_BINARY_DIR}/version.h)
|
||||
|
||||
message( STATUS "Kicad Bazaar build version: ${KICAD_BUILD_VERSION}")
|
||||
endif(Kicad_REPO_LAST_CHANGED_DATE)
|
||||
endmacro(create_bzr_version_header)
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
# Copyright (C) 2010-2015 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
|
||||
#
|
||||
|
||||
macro( create_git_version_header _git_src_path )
|
||||
# If bzr is not found or an error occurs using the git commands to determine the repo
|
||||
# version, set the build version string to "no-git"
|
||||
set( KICAD_BUILD_VERSION "no-git" )
|
||||
|
||||
# Include Git support to automagically create version header file.
|
||||
find_package( Git )
|
||||
|
||||
if( GIT_FOUND )
|
||||
set( _Git_SAVED_LC_ALL "$ENV{LC_ALL}" )
|
||||
set( ENV{LC_ALL} C )
|
||||
|
||||
# Get latest commit hash
|
||||
execute_process(
|
||||
COMMAND
|
||||
${GIT_EXECUTABLE} --no-pager log -1 HEAD
|
||||
--pretty=format:%H
|
||||
WORKING_DIRECTORY ${_git_src_path}
|
||||
OUTPUT_VARIABLE _git_LONG_HASH
|
||||
ERROR_VARIABLE _git_log_error
|
||||
RESULT_VARIABLE _git_log_result
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if( ${_git_log_result} EQUAL 0 )
|
||||
execute_process(
|
||||
COMMAND
|
||||
${GIT_EXECUTABLE} --no-pager log -1 HEAD
|
||||
--pretty=format:%h
|
||||
WORKING_DIRECTORY ${_git_src_path}
|
||||
OUTPUT_VARIABLE _git_SHORT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${GIT_EXECUTABLE} --no-pager log -1 HEAD
|
||||
--pretty=format:%cn
|
||||
WORKING_DIRECTORY ${_git_src_path}
|
||||
OUTPUT_VARIABLE _git_LAST_COMITTER
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${GIT_EXECUTABLE} --no-pager log -1 HEAD
|
||||
--pretty=format:%cd --date=short
|
||||
WORKING_DIRECTORY ${_git_src_path}
|
||||
OUTPUT_VARIABLE _git_LAST_CHANGE_LOG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${GIT_EXECUTABLE} rev-list HEAD --count
|
||||
--first-parent
|
||||
WORKING_DIRECTORY ${_git_src_path}
|
||||
OUTPUT_VARIABLE _git_SERIAL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
message(STATUS "Git hash: ${_git_LONG_HASH}")
|
||||
|
||||
if( ${_git_log_result} EQUAL 0 )
|
||||
string( REGEX REPLACE "^(.*\n)?revno: ([^ \n]+).*"
|
||||
"\\2" Kicad_REPO_REVISION "BZR ${_git_SERIAL}, Git ${_git_SHORT_HASH}" )
|
||||
string( REGEX REPLACE "^(.*\n)?committer: ([^\n]+).*"
|
||||
"\\2" Kicad_REPO_LAST_CHANGED_AUTHOR "${_git_LAST_COMITTER}")
|
||||
string( REGEX REPLACE "^(.*\n)?timestamp: [a-zA-Z]+ ([^ \n]+).*"
|
||||
"\\2" Kicad_REPO_LAST_CHANGED_DATE "${_git_LAST_CHANGE_LOG}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set( ENV{LC_ALL} ${_Git_SAVED_LC_ALL} )
|
||||
endif( GIT_FOUND )
|
||||
|
||||
# Check to make sure 'git' command did not fail. Otherwise fallback
|
||||
# to "no-git" as the revision.
|
||||
if( Kicad_REPO_LAST_CHANGED_DATE )
|
||||
string( REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+)" "\\1-\\2-\\3"
|
||||
_kicad_git_date ${Kicad_REPO_LAST_CHANGED_DATE} )
|
||||
set( KICAD_BUILD_VERSION "(${_kicad_git_date} ${Kicad_REPO_REVISION})" )
|
||||
endif()
|
||||
|
||||
set( KICAD_BUILD_VERSION ${KICAD_BUILD_VERSION} )
|
||||
endmacro()
|
||||
@@ -54,28 +54,28 @@ if( Bazaar_EXECUTABLE )
|
||||
|
||||
# Fetch the Bazaar executable version.
|
||||
execute_process( COMMAND ${Bazaar_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE _bzr_version_output
|
||||
OUTPUT_VARIABLE bzr_version_output
|
||||
ERROR_VARIABLE _bzr_version_error
|
||||
RESULT_VARIABLE _bzr_version_result
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
|
||||
if( ${_bzr_version_result} EQUAL 0 )
|
||||
set( Bazaar_FOUND TRUE )
|
||||
string( REGEX REPLACE "^[\n]*Bazaar \\(bzr\\) ([0-9.a-z]+).*"
|
||||
"\\1" Bazaar_VERSION "${_bzr_version_output}" )
|
||||
string( REGEX REPLACE "^(.*\n)? \(bzr\) ([^\n]+).*"
|
||||
"\\2" Bazaar_VERSION "${_bzr_version_output}" )
|
||||
message( STATUS "Bazaar version control system version ${Bazaar_VERSION} found." )
|
||||
endif()
|
||||
endif( ${_bzr_version_result} EQUAL 0 )
|
||||
|
||||
# restore the previous LC_ALL
|
||||
set( ENV{LC_ALL} ${_Bazaar_SAVED_LC_ALL} )
|
||||
endif()
|
||||
endif( Bazaar_EXECUTABLE )
|
||||
|
||||
if( NOT Bazaar_FOUND )
|
||||
if( NOT Bazaar_FIND_QUIETLY )
|
||||
message( STATUS "Bazaar version control command line client was not found." )
|
||||
else()
|
||||
else( NOT Bazaar_FIND_QUIETLY )
|
||||
if( Bazaar_FIND_REQUIRED )
|
||||
message( FATAL_ERROR "Bazaar version control command line client was not found." )
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif( Bazaar_FIND_REQUIRED )
|
||||
endif( NOT Bazaar_FIND_QUIETLY )
|
||||
endif( NOT Bazaar_FOUND )
|
||||
|
||||
@@ -33,7 +33,6 @@ IF (WIN32)
|
||||
NAMES glew glew32 glew32s
|
||||
PATHS
|
||||
$ENV{GLEW_ROOT_PATH}/lib
|
||||
$ENV{GLEW_ROOT_PATH}/lib/Release/Win32
|
||||
${OPENGL_LIBRARY_DIR}
|
||||
)
|
||||
|
||||
|
||||
@@ -1,342 +0,0 @@
|
||||
#.rst:
|
||||
# FindOpenSSL
|
||||
# -----------
|
||||
#
|
||||
# Try to find the OpenSSL encryption library
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL
|
||||
#
|
||||
#
|
||||
#
|
||||
# Read-Only variables:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# OPENSSL_FOUND - system has the OpenSSL library
|
||||
# OPENSSL_INCLUDE_DIR - the OpenSSL include directory
|
||||
# OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
|
||||
# OPENSSL_VERSION - This is set to $major.$minor.$revision$path (eg. 0.9.8s)
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2006-2009 Kitware, Inc.
|
||||
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
|
||||
# Copyright 2009-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
if (UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_OPENSSL QUIET openssl)
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
# http://www.slproweb.com/products/Win32OpenSSL.html
|
||||
set(_OPENSSL_ROOT_HINTS
|
||||
${OPENSSL_ROOT_DIR}
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
|
||||
ENV OPENSSL_ROOT_DIR
|
||||
)
|
||||
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
|
||||
set(_OPENSSL_ROOT_PATHS
|
||||
"${_programfiles}/OpenSSL"
|
||||
"${_programfiles}/OpenSSL-Win32"
|
||||
"${_programfiles}/OpenSSL-Win64"
|
||||
"C:/OpenSSL/"
|
||||
"C:/OpenSSL-Win32/"
|
||||
"C:/OpenSSL-Win64/"
|
||||
)
|
||||
unset(_programfiles)
|
||||
else ()
|
||||
set(_OPENSSL_ROOT_HINTS
|
||||
${OPENSSL_ROOT_DIR}
|
||||
ENV OPENSSL_ROOT_DIR
|
||||
)
|
||||
endif ()
|
||||
|
||||
set(_OPENSSL_ROOT_HINTS_AND_PATHS
|
||||
HINTS ${_OPENSSL_ROOT_HINTS}
|
||||
PATHS ${_OPENSSL_ROOT_PATHS}
|
||||
)
|
||||
|
||||
find_path(OPENSSL_INCLUDE_DIR
|
||||
NAMES
|
||||
openssl/ssl.h
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
HINTS
|
||||
${_OPENSSL_INCLUDEDIR}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
if(MSVC)
|
||||
# /MD and /MDd are the standard values - if someone wants to use
|
||||
# others, the libnames have to change here too
|
||||
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
|
||||
# TODO: handle /MT and static lib
|
||||
# In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
|
||||
# * MD for dynamic-release
|
||||
# * MDd for dynamic-debug
|
||||
# * MT for static-release
|
||||
# * MTd for static-debug
|
||||
|
||||
# Implementation details:
|
||||
# We are using the libraries located in the VC subdir instead of the parent directory eventhough :
|
||||
# libeay32MD.lib is identical to ../libeay32.lib, and
|
||||
# ssleay32MD.lib is identical to ../ssleay32.lib
|
||||
find_library(LIB_EAY_DEBUG
|
||||
NAMES
|
||||
libeay32MDd
|
||||
libeay32d
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
"lib"
|
||||
"VC"
|
||||
"lib/VC"
|
||||
)
|
||||
|
||||
find_library(LIB_EAY_RELEASE
|
||||
NAMES
|
||||
libeay32MD
|
||||
libeay32
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
"lib"
|
||||
"VC"
|
||||
"lib/VC"
|
||||
)
|
||||
|
||||
find_library(SSL_EAY_DEBUG
|
||||
NAMES
|
||||
ssleay32MDd
|
||||
ssleay32d
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
"lib"
|
||||
"VC"
|
||||
"lib/VC"
|
||||
)
|
||||
|
||||
find_library(SSL_EAY_RELEASE
|
||||
NAMES
|
||||
ssleay32MD
|
||||
ssleay32
|
||||
ssl
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
"lib"
|
||||
"VC"
|
||||
"lib/VC"
|
||||
)
|
||||
|
||||
set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}")
|
||||
set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}")
|
||||
set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}")
|
||||
set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
|
||||
select_library_configurations(LIB_EAY)
|
||||
select_library_configurations(SSL_EAY)
|
||||
|
||||
mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE
|
||||
SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE)
|
||||
set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} )
|
||||
elseif(MINGW)
|
||||
message( STATUS "Searching for OpenSSL in MinGW." )
|
||||
# same player, for MinGW
|
||||
set(LIB_EAY_NAMES libeay32)
|
||||
set(SSL_EAY_NAMES ssleay32)
|
||||
list(APPEND LIB_EAY_NAMES crypto)
|
||||
list(APPEND SSL_EAY_NAMES ssl)
|
||||
|
||||
find_library(LIB_EAY
|
||||
NAMES
|
||||
${LIB_EAY_NAMES}
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
"lib"
|
||||
"lib/MinGW"
|
||||
# Do not search system path. Otherwise the DLL will be found rather than the link library.
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
)
|
||||
|
||||
find_library(SSL_EAY
|
||||
NAMES
|
||||
${SSL_EAY_NAMES}
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
"lib"
|
||||
"lib/MinGW"
|
||||
# Do not search system path. Otherwise the DLL will be found rather than the link library.
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
)
|
||||
|
||||
mark_as_advanced(SSL_EAY LIB_EAY)
|
||||
set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
|
||||
unset(LIB_EAY_NAMES)
|
||||
unset(SSL_EAY_NAMES)
|
||||
else()
|
||||
# Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
|
||||
find_library(LIB_EAY
|
||||
NAMES
|
||||
libeay32
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
HINTS
|
||||
${_OPENSSL_LIBDIR}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
)
|
||||
|
||||
find_library(SSL_EAY
|
||||
NAMES
|
||||
ssleay32
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
HINTS
|
||||
${_OPENSSL_LIBDIR}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
)
|
||||
|
||||
mark_as_advanced(SSL_EAY LIB_EAY)
|
||||
set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
|
||||
endif()
|
||||
else()
|
||||
|
||||
find_library(OPENSSL_SSL_LIBRARY
|
||||
NAMES
|
||||
ssl
|
||||
ssleay32
|
||||
ssleay32MD
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
HINTS
|
||||
${_OPENSSL_LIBDIR}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
)
|
||||
|
||||
find_library(OPENSSL_CRYPTO_LIBRARY
|
||||
NAMES
|
||||
crypto
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
HINTS
|
||||
${_OPENSSL_LIBDIR}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
)
|
||||
|
||||
mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
|
||||
|
||||
# compat defines
|
||||
set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
|
||||
set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||
|
||||
set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
|
||||
|
||||
endif()
|
||||
|
||||
function(from_hex HEX DEC)
|
||||
string(TOUPPER "${HEX}" HEX)
|
||||
set(_res 0)
|
||||
string(LENGTH "${HEX}" _strlen)
|
||||
|
||||
while (_strlen GREATER 0)
|
||||
math(EXPR _res "${_res} * 16")
|
||||
string(SUBSTRING "${HEX}" 0 1 NIBBLE)
|
||||
string(SUBSTRING "${HEX}" 1 -1 HEX)
|
||||
if (NIBBLE STREQUAL "A")
|
||||
math(EXPR _res "${_res} + 10")
|
||||
elseif (NIBBLE STREQUAL "B")
|
||||
math(EXPR _res "${_res} + 11")
|
||||
elseif (NIBBLE STREQUAL "C")
|
||||
math(EXPR _res "${_res} + 12")
|
||||
elseif (NIBBLE STREQUAL "D")
|
||||
math(EXPR _res "${_res} + 13")
|
||||
elseif (NIBBLE STREQUAL "E")
|
||||
math(EXPR _res "${_res} + 14")
|
||||
elseif (NIBBLE STREQUAL "F")
|
||||
math(EXPR _res "${_res} + 15")
|
||||
else()
|
||||
math(EXPR _res "${_res} + ${NIBBLE}")
|
||||
endif()
|
||||
|
||||
string(LENGTH "${HEX}" _strlen)
|
||||
endwhile()
|
||||
|
||||
set(${DEC} ${_res} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if (OPENSSL_INCLUDE_DIR)
|
||||
if (_OPENSSL_VERSION)
|
||||
set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
|
||||
elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
|
||||
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
|
||||
REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
|
||||
|
||||
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
|
||||
# The status gives if this is a developer or prerelease and is ignored here.
|
||||
# Major, minor, and fix directly translate into the version numbers shown in
|
||||
# the string. The patch field translates to the single character suffix that
|
||||
# indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so
|
||||
# on.
|
||||
|
||||
message(STATUS "OPENSSL_VERSION_STR=${openssl_version_str}")
|
||||
|
||||
string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$"
|
||||
"\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}")
|
||||
list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR)
|
||||
list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR)
|
||||
from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR)
|
||||
list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX)
|
||||
from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX)
|
||||
list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
|
||||
|
||||
if (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
|
||||
from_hex("${OPENSSL_VERSION_PATCH}" _tmp)
|
||||
# 96 is the ASCII code of 'a' minus 1
|
||||
math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96")
|
||||
unset(_tmp)
|
||||
# Once anyone knows how OpenSSL would call the patch versions beyond 'z'
|
||||
# this should be updated to handle that, too. This has not happened yet
|
||||
# so it is simply ignored here for now.
|
||||
string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
|
||||
endif ()
|
||||
|
||||
set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if (OPENSSL_VERSION)
|
||||
find_package_handle_standard_args(OpenSSL
|
||||
REQUIRED_VARS
|
||||
OPENSSL_LIBRARIES
|
||||
OPENSSL_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
OPENSSL_VERSION
|
||||
FAIL_MESSAGE
|
||||
"Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
|
||||
)
|
||||
else ()
|
||||
find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
|
||||
OPENSSL_LIBRARIES
|
||||
OPENSSL_INCLUDE_DIR
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
|
||||
@@ -0,0 +1,260 @@
|
||||
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> ... )
|
||||
#
|
||||
# This function is intended to be used in FindXXX.cmake modules files.
|
||||
# It handles the REQUIRED, QUIET and version-related arguments to FIND_PACKAGE().
|
||||
# It also sets the <UPPERCASED_NAME>_FOUND variable.
|
||||
# The package is considered found if all variables <var1>... listed contain
|
||||
# valid results, e.g. valid filepaths.
|
||||
#
|
||||
# There are two modes of this function. The first argument in both modes is
|
||||
# the name of the Find-module where it is called (in original casing).
|
||||
#
|
||||
# The first simple mode looks like this:
|
||||
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> (DEFAULT_MSG|"Custom failure message") <var1>...<varN> )
|
||||
# If the variables <var1> to <varN> are all valid, then <UPPERCASED_NAME>_FOUND
|
||||
# will be set to TRUE.
|
||||
# If DEFAULT_MSG is given as second argument, then the function will generate
|
||||
# itself useful success and error messages. You can also supply a custom error message
|
||||
# for the failure case. This is not recommended.
|
||||
#
|
||||
# The second mode is more powerful and also supports version checking:
|
||||
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS <var1>...<varN>]
|
||||
# [VERSION_VAR <versionvar>
|
||||
# [CONFIG_MODE]
|
||||
# [FAIL_MESSAGE "Custom failure message"] )
|
||||
#
|
||||
# As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_FOUND
|
||||
# will be set to TRUE.
|
||||
# After REQUIRED_VARS the variables which are required for this package are listed.
|
||||
# Following VERSION_VAR the name of the variable can be specified which holds
|
||||
# the version of the package which has been found. If this is done, this version
|
||||
# will be checked against the (potentially) specified required version used
|
||||
# in the find_package() call. The EXACT keyword is also handled. The default
|
||||
# messages include information about the required version and the version
|
||||
# which has been actually found, both if the version is ok or not.
|
||||
# Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for
|
||||
# a find_package(... NO_MODULE) call, in this case all the information
|
||||
# provided by the config-mode of find_package() will be evaluated
|
||||
# automatically.
|
||||
# Via FAIL_MESSAGE a custom failure message can be specified, if this is not
|
||||
# used, the default message will be displayed.
|
||||
#
|
||||
# Example for mode 1:
|
||||
#
|
||||
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
|
||||
#
|
||||
# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and
|
||||
# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
|
||||
# If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
|
||||
# independent whether QUIET was used or not.
|
||||
# If it is found, success will be reported, including the content of <var1>.
|
||||
# On repeated Cmake runs, the same message won't be printed again.
|
||||
#
|
||||
# Example for mode 2:
|
||||
#
|
||||
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE
|
||||
# VERSION_VAR BISON_VERSION)
|
||||
# In this case, BISON is considered to be found if the variable(s) listed
|
||||
# after REQUIRED_VAR are all valid, i.e. BISON_EXECUTABLE in this case.
|
||||
# Also the version of BISON will be checked by using the version contained
|
||||
# in BISON_VERSION.
|
||||
# Since no FAIL_MESSAGE is given, the default messages will be printed.
|
||||
#
|
||||
# Another example for mode 2:
|
||||
#
|
||||
# FIND_PACKAGE(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
|
||||
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Automoc4 CONFIG_MODE)
|
||||
# In this case, FindAutmoc4.cmake wraps a call to FIND_PACKAGE(Automoc4 NO_MODULE)
|
||||
# and adds an additional search directory for automoc4.
|
||||
# The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper
|
||||
# success/error message.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
INCLUDE(FindPackageMessage)
|
||||
INCLUDE(CMakeParseArguments)
|
||||
|
||||
# internal helper macro
|
||||
MACRO(_FPHSA_FAILURE_MESSAGE _msg)
|
||||
IF (${_NAME}_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "${_msg}")
|
||||
ELSE (${_NAME}_FIND_REQUIRED)
|
||||
IF (NOT ${_NAME}_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "${_msg}")
|
||||
ENDIF (NOT ${_NAME}_FIND_QUIETLY)
|
||||
ENDIF (${_NAME}_FIND_REQUIRED)
|
||||
ENDMACRO(_FPHSA_FAILURE_MESSAGE _msg)
|
||||
|
||||
|
||||
# internal helper macro to generate the failure message when used in CONFIG_MODE:
|
||||
MACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
|
||||
# <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
|
||||
IF(${_NAME}_CONFIG)
|
||||
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
|
||||
ELSE(${_NAME}_CONFIG)
|
||||
# If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
|
||||
# List them all in the error message:
|
||||
IF(${_NAME}_CONSIDERED_CONFIGS)
|
||||
SET(configsText "")
|
||||
LIST(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
|
||||
MATH(EXPR configsCount "${configsCount} - 1")
|
||||
FOREACH(currentConfigIndex RANGE ${configsCount})
|
||||
LIST(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
|
||||
LIST(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
|
||||
SET(configsText "${configsText} ${filename} (version ${version})\n")
|
||||
ENDFOREACH(currentConfigIndex)
|
||||
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
|
||||
|
||||
ELSE(${_NAME}_CONSIDERED_CONFIGS)
|
||||
# Simple case: No Config-file was found at all:
|
||||
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
|
||||
ENDIF(${_NAME}_CONSIDERED_CONFIGS)
|
||||
ENDIF(${_NAME}_CONFIG)
|
||||
ENDMACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
|
||||
|
||||
|
||||
FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
|
||||
|
||||
# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in
|
||||
# new extended or in the "old" mode:
|
||||
SET(options CONFIG_MODE)
|
||||
SET(oneValueArgs FAIL_MESSAGE VERSION_VAR)
|
||||
SET(multiValueArgs REQUIRED_VARS)
|
||||
SET(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
|
||||
LIST(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
|
||||
|
||||
IF(${INDEX} EQUAL -1)
|
||||
SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
|
||||
SET(FPHSA_REQUIRED_VARS ${ARGN})
|
||||
SET(FPHSA_VERSION_VAR)
|
||||
ELSE(${INDEX} EQUAL -1)
|
||||
|
||||
CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
|
||||
|
||||
IF(FPHSA_UNPARSED_ARGUMENTS)
|
||||
MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
|
||||
ENDIF(FPHSA_UNPARSED_ARGUMENTS)
|
||||
|
||||
IF(NOT FPHSA_FAIL_MESSAGE)
|
||||
SET(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
|
||||
ENDIF(NOT FPHSA_FAIL_MESSAGE)
|
||||
ENDIF(${INDEX} EQUAL -1)
|
||||
|
||||
# now that we collected all arguments, process them
|
||||
|
||||
IF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
|
||||
SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
|
||||
ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
|
||||
|
||||
# In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package()
|
||||
# when it successfully found the config-file, including version checking:
|
||||
IF(FPHSA_CONFIG_MODE)
|
||||
LIST(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
|
||||
LIST(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
|
||||
SET(FPHSA_VERSION_VAR ${_NAME}_VERSION)
|
||||
ENDIF(FPHSA_CONFIG_MODE)
|
||||
|
||||
IF(NOT FPHSA_REQUIRED_VARS)
|
||||
MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
|
||||
ENDIF(NOT FPHSA_REQUIRED_VARS)
|
||||
|
||||
LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
|
||||
|
||||
STRING(TOUPPER ${_NAME} _NAME_UPPER)
|
||||
STRING(TOLOWER ${_NAME} _NAME_LOWER)
|
||||
|
||||
# collect all variables which were not found, so they can be printed, so the
|
||||
# user knows better what went wrong (#6375)
|
||||
SET(MISSING_VARS "")
|
||||
SET(DETAILS "")
|
||||
SET(${_NAME_UPPER}_FOUND TRUE)
|
||||
# check if all passed variables are valid
|
||||
FOREACH(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
|
||||
IF(NOT ${_CURRENT_VAR})
|
||||
SET(${_NAME_UPPER}_FOUND FALSE)
|
||||
SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
|
||||
ELSE(NOT ${_CURRENT_VAR})
|
||||
SET(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
|
||||
ENDIF(NOT ${_CURRENT_VAR})
|
||||
ENDFOREACH(_CURRENT_VAR)
|
||||
|
||||
|
||||
# version handling:
|
||||
SET(VERSION_MSG "")
|
||||
SET(VERSION_OK TRUE)
|
||||
SET(VERSION ${${FPHSA_VERSION_VAR}} )
|
||||
IF (${_NAME}_FIND_VERSION)
|
||||
|
||||
IF(VERSION)
|
||||
|
||||
IF(${_NAME}_FIND_VERSION_EXACT) # exact version required
|
||||
IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
|
||||
SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
|
||||
SET(VERSION_OK FALSE)
|
||||
ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
|
||||
SET(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
|
||||
ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
|
||||
|
||||
ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified:
|
||||
IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
|
||||
SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
|
||||
SET(VERSION_OK FALSE)
|
||||
ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
|
||||
SET(VERSION_MSG "(found suitable version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")")
|
||||
ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
|
||||
ENDIF(${_NAME}_FIND_VERSION_EXACT)
|
||||
|
||||
ELSE(VERSION)
|
||||
|
||||
# if the package was not found, but a version was given, add that to the output:
|
||||
IF(${_NAME}_FIND_VERSION_EXACT)
|
||||
SET(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
|
||||
ELSE(${_NAME}_FIND_VERSION_EXACT)
|
||||
SET(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
|
||||
ENDIF(${_NAME}_FIND_VERSION_EXACT)
|
||||
|
||||
ENDIF(VERSION)
|
||||
ELSE (${_NAME}_FIND_VERSION)
|
||||
IF(VERSION)
|
||||
SET(VERSION_MSG "(found version \"${VERSION}\")")
|
||||
ENDIF(VERSION)
|
||||
ENDIF (${_NAME}_FIND_VERSION)
|
||||
|
||||
IF(VERSION_OK)
|
||||
SET(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
|
||||
ELSE(VERSION_OK)
|
||||
SET(${_NAME_UPPER}_FOUND FALSE)
|
||||
ENDIF(VERSION_OK)
|
||||
|
||||
|
||||
# print the result:
|
||||
IF (${_NAME_UPPER}_FOUND)
|
||||
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG}" "${DETAILS}")
|
||||
ELSE (${_NAME_UPPER}_FOUND)
|
||||
|
||||
IF(FPHSA_CONFIG_MODE)
|
||||
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
|
||||
ELSE(FPHSA_CONFIG_MODE)
|
||||
IF(NOT VERSION_OK)
|
||||
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
|
||||
ELSE(NOT VERSION_OK)
|
||||
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
|
||||
ENDIF(NOT VERSION_OK)
|
||||
ENDIF(FPHSA_CONFIG_MODE)
|
||||
|
||||
ENDIF (${_NAME_UPPER}_FOUND)
|
||||
|
||||
SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
|
||||
|
||||
ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _FIRST_ARG)
|
||||
@@ -1,57 +0,0 @@
|
||||
#.rst:
|
||||
# FindPackageMessage
|
||||
# ------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
# FIND_PACKAGE_MESSAGE(<name> "message for user" "find result details")
|
||||
#
|
||||
# This macro is intended to be used in FindXXX.cmake modules files. It
|
||||
# will print a message once for each unique find result. This is useful
|
||||
# for telling the user where a package was found. The first argument
|
||||
# specifies the name (XXX) of the package. The second argument
|
||||
# specifies the message to display. The third argument lists details
|
||||
# about the find result so that if they change the message will be
|
||||
# displayed again. The macro also obeys the QUIET argument to the
|
||||
# find_package command.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# if(X11_FOUND)
|
||||
# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
|
||||
# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
|
||||
# else()
|
||||
# ...
|
||||
# endif()
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2008-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
function(FIND_PACKAGE_MESSAGE pkg msg details)
|
||||
# Avoid printing a message repeatedly for the same find result.
|
||||
if(NOT ${pkg}_FIND_QUIETLY)
|
||||
string(REGEX REPLACE "[\n]" "" details "${details}")
|
||||
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
|
||||
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
|
||||
# The message has not yet been printed.
|
||||
message(STATUS "${msg}")
|
||||
|
||||
# Save the find details in the cache to avoid printing the same
|
||||
# message again.
|
||||
set("${DETAILS_VAR}" "${details}"
|
||||
CACHE INTERNAL "Details about finding ${pkg}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -91,7 +91,7 @@ unset(_PYTHON3_VERSIONS)
|
||||
|
||||
# Search for newest python version if python executable isn't found
|
||||
if(NOT PYTHON_EXECUTABLE)
|
||||
|
||||
|
||||
# If using the MINGW compiler, we mustn't find the standard python
|
||||
# distribution because of multiple C-Runtime errors. We must instead
|
||||
# use the Python-a-mingw-us distribution
|
||||
@@ -110,7 +110,7 @@ if(NOT PYTHON_EXECUTABLE)
|
||||
else()
|
||||
list( APPEND _Python_PPATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath] )
|
||||
endif()
|
||||
|
||||
|
||||
foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||
set(_Python_NAMES python${_CURRENT_VERSION})
|
||||
if(WIN32)
|
||||
@@ -169,7 +169,7 @@ endif()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(PYTHON_EXECUTABLE)
|
||||
|
||||
@@ -37,10 +37,9 @@
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
include(CMakeFindFrameworks)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake)
|
||||
# Search for the python framework on Apple.
|
||||
cmake_find_frameworks(Python)
|
||||
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)
|
||||
@@ -87,25 +86,32 @@ unset(_PYTHON3_VERSIONS)
|
||||
|
||||
foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||
string(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION})
|
||||
|
||||
if(WIN32)
|
||||
if(MINGW)
|
||||
find_library(PYTHON_DEBUG_LIBRARY
|
||||
NAMES python{$_CURRENT_VERSION}_d
|
||||
PATHS
|
||||
"${PYTHON_ROOT_DIR}"
|
||||
"c:/python${_CURRENT_VERSION}"
|
||||
"c:/python${_CURRENT_VERSION_NO_DOTS}"
|
||||
"C:/python/${_CURRENT_VERSION}.9"
|
||||
"C:/python/${_CURRENT_VERSION}.8"
|
||||
"C:/python/${_CURRENT_VERSION}.7"
|
||||
"C:/python/${_CURRENT_VERSION}.6"
|
||||
"C:/python/${_CURRENT_VERSION}.5"
|
||||
"C:/python/${_CURRENT_VERSION}.4"
|
||||
"C:/python/${_CURRENT_VERSION}.3"
|
||||
"C:/python/${_CURRENT_VERSION}.2"
|
||||
"C:/python/${_CURRENT_VERSION}.1"
|
||||
"C:/python/${_CURRENT_VERSION}.0"
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
)
|
||||
else()
|
||||
find_library(PYTHON_DEBUG_LIBRARY
|
||||
NAMES python${_CURRENT_VERSION_NO_DOTS}_d python
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -115,20 +121,26 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||
NAMES python${_CURRENT_VERSION}
|
||||
PATHS
|
||||
"${PYTHON_ROOT_DIR}"
|
||||
"C:/python"
|
||||
PATH_SUFFIXES
|
||||
${_CURRENT_VERSION}
|
||||
${_CURRENT_VERSION_NO_DOTS}
|
||||
"C:/python/${_CURRENT_VERSION}.9"
|
||||
"C:/python/${_CURRENT_VERSION}.8"
|
||||
"C:/python/${_CURRENT_VERSION}.7"
|
||||
"C:/python/${_CURRENT_VERSION}.6"
|
||||
"C:/python/${_CURRENT_VERSION}.5"
|
||||
"C:/python/${_CURRENT_VERSION}.4"
|
||||
"C:/python/${_CURRENT_VERSION}.3"
|
||||
"C:/python/${_CURRENT_VERSION}.2"
|
||||
"C:/python/${_CURRENT_VERSION}.1"
|
||||
"C:/python/${_CURRENT_VERSION}.0"
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
else()
|
||||
find_library(PYTHON_LIBRARY
|
||||
NAMES
|
||||
python${_CURRENT_VERSION_NO_DOTS}
|
||||
python${_CURRENT_VERSION}mu
|
||||
python${_CURRENT_VERSION}m
|
||||
python${_CURRENT_VERSION}u
|
||||
python${_CURRENT_VERSION}
|
||||
python${_CURRENT_VERSION_NO_DOTS}
|
||||
python${_CURRENT_VERSION}mu
|
||||
python${_CURRENT_VERSION}m
|
||||
python${_CURRENT_VERSION}u
|
||||
python${_CURRENT_VERSION}
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||
@@ -146,6 +158,7 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||
PATH_SUFFIXES python${_CURRENT_VERSION}/config
|
||||
)
|
||||
|
||||
|
||||
# For backward compatibility, honour value of PYTHON_INCLUDE_PATH, if
|
||||
# PYTHON_INCLUDE_DIR is not set.
|
||||
if(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR)
|
||||
@@ -154,7 +167,6 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||
endif()
|
||||
|
||||
set(PYTHON_FRAMEWORK_INCLUDES)
|
||||
|
||||
if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR)
|
||||
foreach(dir ${Python_FRAMEWORKS})
|
||||
set(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES}
|
||||
@@ -166,13 +178,17 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||
find_path(PYTHON_INCLUDE_DIR
|
||||
NAMES Python.h
|
||||
PATHS
|
||||
"${PYTHON_ROOT_DIR}"
|
||||
"C:/python${_CURRENT_VERSION}"
|
||||
"C:/python${_CURRENT_VERSION_NOT_DOTS}"
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
python${_CURRENT_VERSION}
|
||||
python${_CURRENT_VERSION_NOT_DOTS}
|
||||
"${PYTHON_ROOT_DIR}/include"
|
||||
"C:/python/${_CURRENT_VERSION}.9/include"
|
||||
"C:/python/${_CURRENT_VERSION}.8/include"
|
||||
"C:/python/${_CURRENT_VERSION}.7/include"
|
||||
"C:/python/${_CURRENT_VERSION}.6/include"
|
||||
"C:/python/${_CURRENT_VERSION}.5/include"
|
||||
"C:/python/${_CURRENT_VERSION}.4/include"
|
||||
"C:/python/${_CURRENT_VERSION}.3/include"
|
||||
"C:/python/${_CURRENT_VERSION}.2/include"
|
||||
"C:/python/${_CURRENT_VERSION}.1/include"
|
||||
"C:/python/${_CURRENT_VERSION}.0/include"
|
||||
)
|
||||
else()
|
||||
find_path(PYTHON_INCLUDE_DIR
|
||||
@@ -223,14 +239,14 @@ set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
|
||||
set(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}")
|
||||
set(PYTHON_LIBRARY_RELEASE "${PYTHON_LIBRARY}")
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
|
||||
select_library_configurations(PYTHON)
|
||||
SELECT_LIBRARY_CONFIGURATIONS(PYTHON)
|
||||
# SELECT_LIBRARY_CONFIGURATIONS() sets ${PREFIX}_FOUND if it has a library.
|
||||
# Unset this, this prefix doesn't match the module prefix, they are different
|
||||
# for historical reasons.
|
||||
unset(PYTHON_FOUND)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PythonLibs
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs
|
||||
REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS
|
||||
VERSION_VAR PYTHONLIBS_VERSION_STRING)
|
||||
|
||||
|
||||
+434
-507
File diff suppressed because it is too large
Load Diff
@@ -83,9 +83,6 @@ macro( perform_feature_checks )
|
||||
check_symbol_exists( strncasecmp "strings.h" HAVE_STRNCASECMP )
|
||||
check_symbol_exists( strtok_r "string.h" HAVE_STRTOKR )
|
||||
|
||||
check_cxx_symbol_exists( strcasecmp "string.h" HAVE_STRCASECMP )
|
||||
check_cxx_symbol_exists( strncasecmp "string.h" HAVE_STRNCASECMP )
|
||||
|
||||
# Some platforms define malloc and free in malloc.h instead of stdlib.h.
|
||||
check_symbol_exists( malloc "stdlib.h" MALLOC_IN_STDLIB_H )
|
||||
|
||||
@@ -112,4 +109,9 @@ macro( perform_feature_checks )
|
||||
# getc() on platforms where getc_unlocked() doesn't exist.
|
||||
check_symbol_exists( getc_unlocked "stdio.h" HAVE_FGETC_NOLOCK )
|
||||
|
||||
# Generate config.h.
|
||||
configure_file( ${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
|
||||
${CMAKE_BINARY_DIR}/config.h
|
||||
)
|
||||
|
||||
endmacro( perform_feature_checks )
|
||||
|
||||
@@ -374,10 +374,14 @@ const char* ${LEXERCLASS}::TokenName( T aTok )
|
||||
{
|
||||
const char* ret;
|
||||
|
||||
if( aTok < 0 )
|
||||
ret = DSNLEXER::Syntax( aTok );
|
||||
else if( (unsigned) aTok < keyword_count )
|
||||
if( (unsigned) aTok < keyword_count )
|
||||
{
|
||||
ret = keywords[aTok].name;
|
||||
}
|
||||
else if( aTok < 0 )
|
||||
{
|
||||
ret = DSNLEXER::Syntax( aTok );
|
||||
}
|
||||
else
|
||||
ret = \"token too big\";
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
# Copyright (C) 2015 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
|
||||
#
|
||||
|
||||
# Automagically create version header file if the version string was not defined during
|
||||
# the build configuration. If CreateBzrVersionHeader or CreateGitVersionHeader cannot
|
||||
# determine the current repo version, a version.h file is still created with
|
||||
# KICAD_BUILD_VERSION set to "no-vcs-found".
|
||||
if( NOT KICAD_BUILD_VERSION )
|
||||
set( _wvh_version_str "no-vcs-found" )
|
||||
|
||||
# Detect the appropiate VCS and set the version string.
|
||||
if( EXISTS "${SRC_PATH}/.bzr" )
|
||||
message( STATUS "Using Bazaar to determine build version string." )
|
||||
include( ${CMAKE_MODULE_PATH}/CreateBzrVersionHeader.cmake )
|
||||
create_bzr_version_header( ${SRC_PATH} )
|
||||
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
|
||||
elseif( EXISTS "${SRC_PATH}/.git" )
|
||||
message( STATUS "Using Git to determine build version string." )
|
||||
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
||||
create_git_version_header( ${SRC_PATH} )
|
||||
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
|
||||
endif()
|
||||
else()
|
||||
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
|
||||
endif()
|
||||
|
||||
set( _wvh_write_version_file ON )
|
||||
|
||||
# Compare the version argument against the version in the existing header file for a mismatch.
|
||||
if( EXISTS ${OUTPUT_FILE} )
|
||||
file( STRINGS ${OUTPUT_FILE} _current_version_str
|
||||
REGEX "^#define[\t ]+KICAD_BUILD_VERSION[\t ]+.*" )
|
||||
string( REGEX REPLACE "^#define KICAD_BUILD_VERSION \"([()a-zA-Z0-9 -.]+)\".*"
|
||||
"\\1" _wvh_last_version "${_current_version_str}" )
|
||||
|
||||
# No change, do not write version.h
|
||||
if( _wvh_version_str STREQUAL _wvh_last_version )
|
||||
message( STATUS "Not updating ${OUTPUT_FILE}" )
|
||||
set( _wvh_write_version_file OFF )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( _wvh_write_version_file )
|
||||
message( STATUS "Writing ${OUTPUT_FILE} file with version: ${_wvh_version_str}" )
|
||||
|
||||
file( WRITE ${OUTPUT_FILE}
|
||||
"/* Do not modify this file, it was automatically generated by CMake. */
|
||||
|
||||
/*
|
||||
* Define the KiCad build version string.
|
||||
*/
|
||||
#ifndef __KICAD_VERSION_H__
|
||||
#define __KICAD_VERSION_H__
|
||||
|
||||
#define KICAD_BUILD_VERSION \"${_wvh_version_str}\"
|
||||
|
||||
#endif /* __KICAD_VERSION_H__ */
|
||||
"
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
# There should always be a valid version.h file. Otherwise, the build will fail.
|
||||
if( NOT EXISTS ${OUTPUT_FILE} )
|
||||
message( FATAL_ERROR "Configuration failed to write file ${OUTPUT_FILE}." )
|
||||
endif()
|
||||
@@ -58,13 +58,11 @@
|
||||
/// The legacy file format revision of the *.brd file created by this build
|
||||
#define LEGACY_BOARD_FILE_VERSION 2
|
||||
|
||||
/// The install prefix defined during CMake configuration or fall back to CMAKE_INSTALL_PREFIX.
|
||||
#define DEFAULT_INSTALL_PATH "@DEFAULT_INSTALL_PATH@"
|
||||
/// The install prefix defined in CMAKE_INSTALL_PREFIX.
|
||||
#define DEFAULT_INSTALL_PATH "@CMAKE_INSTALL_PREFIX@"
|
||||
|
||||
/// The wxPython version found during configuration.
|
||||
#if defined( KICAD_SCRIPTING_WXPYTHON )
|
||||
#define WXPYTHON_VERSION "@WXPYTHON_VERSION@"
|
||||
#endif
|
||||
/// Default footprint library install path when installed with `make install`.
|
||||
#define DEFAULT_FP_LIB_PATH "@KICAD_FP_LIB_INSTALL_PATH@"
|
||||
|
||||
/// When defined, build the GITHUB_PLUGIN for pcbnew.
|
||||
#cmakedefine BUILD_GITHUB_PLUGIN
|
||||
|
||||
@@ -38,12 +38,6 @@
|
||||
# Where the library is to be installed.
|
||||
set( PREFIX ${DOWNLOAD_DIR}/avhttp )
|
||||
|
||||
if( KICAD_SKIP_BOOST )
|
||||
set( AVHTTP_DEPEND "" )
|
||||
else()
|
||||
set( AVHTTP_DEPEND "boost" )
|
||||
endif()
|
||||
|
||||
|
||||
# Install the AVHTTP header only library ${PREFIX}
|
||||
ExternalProject_Add( avhttp
|
||||
@@ -52,7 +46,7 @@ ExternalProject_Add( avhttp
|
||||
|
||||
# grab it from a local zip file for now, cmake caller's source dir
|
||||
URL ${CMAKE_CURRENT_SOURCE_DIR}/avhttp-master.zip
|
||||
DEPENDS ${AVHTTP_DEPEND}
|
||||
DEPENDS boost
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
|
||||
|
||||
@@ -59,9 +59,7 @@ set( BOOST_LIBS_BUILT
|
||||
)
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
find_package( BZip2 REQUIRED )
|
||||
|
||||
string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" )
|
||||
set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )
|
||||
@@ -101,17 +99,7 @@ else()
|
||||
endif()
|
||||
|
||||
|
||||
find_program(patch_bin NAMES patch patch.exe)
|
||||
|
||||
if( "${patch_bin}" STREQUAL "patch_bin-NOTFOUND" )
|
||||
set( PATCH_STR_CMD ${PATCH_STR_CMD} )
|
||||
else()
|
||||
set( PATCH_STR_CMD ${patch_bin} -p0 -i )
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
if( MINGW AND NOT CMAKE_HOST_UNIX ) # building for MINGW on windows not UNIX
|
||||
if( MINGW )
|
||||
if( MSYS )
|
||||
# The Boost system does not build properly on MSYS using bootstrap.sh. Running
|
||||
# bootstrap.bat with cmd.exe does. It's ugly but it works. At least for Boost
|
||||
@@ -125,23 +113,24 @@ if( MINGW AND NOT CMAKE_HOST_UNIX ) # building for MINGW on windows not UNIX
|
||||
set( b2_libs ${b2_libs} --with-${lib} )
|
||||
endforeach()
|
||||
unset( BOOST_CFLAGS )
|
||||
|
||||
else()
|
||||
string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" )
|
||||
#message( STATUS "libs_csv:${libs_csv}" )
|
||||
|
||||
set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} )
|
||||
# pass to *both* C and C++ compilers
|
||||
set( BOOST_CFLAGS "cflags=${PIC_FLAG}" )
|
||||
set( BOOST_CXXFLAGS "cxxflags=${PIC_FLAG}" )
|
||||
set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
|
||||
set( BOOST_CFLAGS "cflags=${PIC_FLAG}" )
|
||||
set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
|
||||
unset( b2_libs )
|
||||
endif()
|
||||
|
||||
|
||||
if( APPLE )
|
||||
set( BOOST_CXXFLAGS "cxxflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -fno-common" )
|
||||
set( BOOST_LINKFLAGS "linkflags=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -fno-common" )
|
||||
# I set this to being compatible with wxWidgets
|
||||
# wxWidgets still using libstdc++ (gcc), meanwhile OSX
|
||||
# has switched to libc++ (llvm) by default
|
||||
set( BOOST_CXXFLAGS "cxxflags=-mmacosx-version-min=10.5 -fno-common" )
|
||||
set( BOOST_LINKFLAGS "linkflags=-mmacosx-version-min=10.5 -fno-common" )
|
||||
set( BOOST_TOOLSET "toolset=darwin" )
|
||||
|
||||
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
@@ -184,7 +173,7 @@ ExternalProject_Add( boost
|
||||
|
||||
URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2
|
||||
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
||||
TIMEOUT 1200 # 20 minutes
|
||||
TIMEOUT 600 # 10 minutes
|
||||
URL_MD5 ${BOOST_MD5}
|
||||
# If download fails, then enable "LOG_DOWNLOAD ON" and try again.
|
||||
# Upon a second failure with logging enabled, then look at these logs:
|
||||
@@ -204,27 +193,25 @@ ExternalProject_Add( boost
|
||||
# bzr revert is insufficient to remove "added" files:
|
||||
COMMAND bzr clean-tree -q --force
|
||||
|
||||
COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_minkowski.patch"
|
||||
COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_cstdint.patch"
|
||||
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_minkowski.patch"
|
||||
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_cstdint.patch"
|
||||
|
||||
COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86.patch" #https://svn.boost.org/trac/boost/ticket/8266
|
||||
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86.patch" #https://svn.boost.org/trac/boost/ticket/8266
|
||||
# tell bzr about "added" files by last patch:
|
||||
COMMAND bzr add libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S
|
||||
COMMAND bzr add libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S
|
||||
|
||||
COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86_build.patch" #https://svn.boost.org/trac/boost/ticket/8266
|
||||
COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_macosx_older_openssl.patch" #https://svn.boost.org/trac/boost/ticket/9273
|
||||
|
||||
COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_mingw.patch" #https://svn.boost.org/trac/boost/ticket/7262
|
||||
COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_mingw64_interlocked.patch"
|
||||
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86_build.patch" #https://svn.boost.org/trac/boost/ticket/8266
|
||||
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_macosx_older_openssl.patch" #https://svn.boost.org/trac/boost/ticket/9273
|
||||
|
||||
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_mingw.patch" #https://svn.boost.org/trac/boost/ticket/7262
|
||||
# tell bzr about "added" files by last patch:
|
||||
COMMAND bzr add libs/context/src/asm/make_i386_ms_pe_gas.S
|
||||
COMMAND bzr add libs/context/src/asm/jump_i386_ms_pe_gas.S
|
||||
COMMAND bzr add libs/context/src/asm/make_x86_64_ms_pe_gas.S
|
||||
COMMAND bzr add libs/context/src/asm/jump_x86_64_ms_pe_gas.S
|
||||
|
||||
COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/patch_macosx_context_ppc_v2.patch" #https://svn.boost.org/trac/boost/ticket/8266
|
||||
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/patch_macosx_context_ppc_v2.patch" #https://svn.boost.org/trac/boost/ticket/8266
|
||||
COMMAND bzr add libs/context/build/Jamfile.v2
|
||||
COMMAND bzr add libs/context/build/architecture.jam
|
||||
COMMAND bzr add libs/context/src/asm/jump_combined_sysv_macho_gas.S
|
||||
@@ -311,10 +298,6 @@ ExternalProject_Add_Step( boost bzr_add_boost
|
||||
|
||||
ExternalProject_Add_Step( boost bzr_init_boost
|
||||
COMMAND bzr init -q <SOURCE_DIR>
|
||||
#creates a .bzrignore file in boost root dir, to avoid copying useless files
|
||||
#moreover these files have a very very long name, and sometimes
|
||||
#have a too long full file name to be handled by DOS commands
|
||||
COMMAND echo "*.htm*" > ${PREFIX}/src/boost/.bzrignore
|
||||
COMMENT "creating 'boost scratch repo' specifically for boost to track boost patches"
|
||||
DEPENDERS bzr_add_boost
|
||||
DEPENDEES download
|
||||
|
||||
@@ -33,9 +33,7 @@ set( CAIRO_ROOT "${PROJECT_SOURCE_DIR}/cairo_root" )
|
||||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
find_package( BZip2 REQUIRED )
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/cairo )
|
||||
|
||||
@@ -44,7 +42,7 @@ if ( KICAD_BUILD_STATIC )
|
||||
endif( KICAD_BUILD_STATIC )
|
||||
|
||||
|
||||
if (APPLE)
|
||||
if (APPLE)
|
||||
|
||||
set( CAIRO_CFLAGS "CFLAGS=" )
|
||||
set( CAIRO_LDFLAGS "LDFLAGS=-framework CoreServices -framework Cocoa" )
|
||||
@@ -96,14 +94,8 @@ ExternalProject_Add( cairo
|
||||
|
||||
#BINARY_DIR "${PREFIX}"
|
||||
|
||||
BUILD_COMMAND $(MAKE)
|
||||
BUILD_COMMAND $(MAKE)
|
||||
|
||||
INSTALL_DIR "${CAIRO_ROOT}"
|
||||
INSTALL_COMMAND $(MAKE) install
|
||||
)
|
||||
|
||||
# match these with whatever FindCairo.cmake sets
|
||||
# Dick i'vent set it because /lib and /lib64 issue in non multiarch binaries OSs
|
||||
#set( CAIRO_FOUND true )
|
||||
set( CAIRO_INCLUDE_DIR ${CAIRO_ROOT}/include )
|
||||
set( CAIRO_LIBRARIES ${CAIRO_ROOT}/lib )
|
||||
|
||||
@@ -33,13 +33,11 @@ set( GLEW_ROOT "${PROJECT_SOURCE_DIR}/glew_root" )
|
||||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
find_package( BZip2 REQUIRED )
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/glew )
|
||||
|
||||
if (APPLE)
|
||||
if (APPLE)
|
||||
if( CMAKE_OSX_ARCHITECTURES )
|
||||
set( GLEW_CFLAGS "CFLAGS.EXTRA=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||
set( GLEW_LDFLAGS "LDFLAGS.EXTRA=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||
|
||||
@@ -42,14 +42,6 @@ if( CMAKE_TOOLCHAIN_FILE )
|
||||
set( TOOLCHAIN "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" )
|
||||
endif()
|
||||
|
||||
FIND_PROGRAM (patch_bin NAMES patch.exe patch)
|
||||
|
||||
if( "${patch_bin}" STREQUAL "patch_bin-NOTFOUND" )
|
||||
set( PATCH_STR_CMD bzr patch -p0 )
|
||||
else()
|
||||
set( PATCH_STR_CMD ${patch_bin} -p0 -i )
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(
|
||||
openssl
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
@@ -66,13 +58,13 @@ ExternalProject_Add(
|
||||
# PATCH_COMMAND patch -p0 < ${PROJECT_SOURCE_DIR}/patches/openssl-1.0.1e.patch
|
||||
|
||||
# This one requires the bzr commit below, since bzr patch only knows a working tree.
|
||||
|
||||
|
||||
# Revert the branch to pristine before applying patch sets as bzr patch
|
||||
# fails when applying a patch to the branch twice and doesn't have a switch
|
||||
# to ignore previously applied patches
|
||||
PATCH_COMMAND bzr revert
|
||||
# PATCH_COMMAND continuation (any *_COMMAND here can be continued with COMMAND):
|
||||
COMMAND ${PATCH_STR_CMD} ${PROJECT_SOURCE_DIR}/patches/openssl-1.0.1e.patch
|
||||
COMMAND bzr patch -p0 ${PROJECT_SOURCE_DIR}/patches/openssl-1.0.1e.patch
|
||||
|
||||
CONFIGURE_COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
# Copyright (C) 2013 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
|
||||
|
||||
# Downloads and builds PCRE
|
||||
|
||||
#-----<configure>----------------------------------------------------------------
|
||||
|
||||
set( PCRE_RELEASE 8.34 )
|
||||
set( PCRE_MD5 eb34b2c9c727fd64940d6fd9a00995eb ) # re-calc this on every RELEASE change
|
||||
|
||||
set( PCRE_ROOT "${PROJECT_SOURCE_DIR}/pcre_root" )
|
||||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
find_package( BZip2 REQUIRED )
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/pcre )
|
||||
|
||||
if (APPLE)
|
||||
if( CMAKE_OSX_ARCHITECTURES )
|
||||
set( PCRE_CFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||
set( PCRE_CXXFLAGS "CXXFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||
set( PCRE_LDFLAGS "LDFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||
endif( CMAKE_OSX_ARCHITECTURES )
|
||||
endif(APPLE)
|
||||
|
||||
ExternalProject_Add( pcre
|
||||
PREFIX "${PREFIX}"
|
||||
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
||||
URL http://sourceforge.net/projects/pcre/files/pcre/${PCRE_RELEASE}/pcre-${PCRE_RELEASE}.tar.gz
|
||||
URL_MD5 ${PCRE_MD5}
|
||||
STAMP_DIR "${PREFIX}"
|
||||
|
||||
#SOURCE_DIR "${PREFIX}"
|
||||
BUILD_IN_SOURCE 1
|
||||
|
||||
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${PCRE_ROOT}"
|
||||
|
||||
#PATCH_COMMAND "true"
|
||||
CONFIGURE_COMMAND ./configure --prefix=${PCRE_ROOT} ${PCRE_CFLAGS} ${PCRE_CXXFLAGS} ${PCRE_LDFLAGS} --disable-dependency-tracking
|
||||
|
||||
#BINARY_DIR "${PREFIX}"
|
||||
|
||||
BUILD_COMMAND $(MAKE)
|
||||
|
||||
INSTALL_DIR "${PCRE_ROOT}"
|
||||
INSTALL_COMMAND $(MAKE) install
|
||||
)
|
||||
@@ -33,15 +33,13 @@ set( PIXMAN_ROOT "${PROJECT_SOURCE_DIR}/pixman_root" )
|
||||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
find_package( BZip2 REQUIRED )
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/pixman )
|
||||
|
||||
set(PIXMAN_CPPFLAGS "CFLAGS=")
|
||||
|
||||
if (APPLE)
|
||||
if (APPLE)
|
||||
if( CMAKE_OSX_ARCHITECTURES )
|
||||
set(PIXMAN_CPPFLAGS "${PIXMAN_CPPFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES} -fno-common -mmacosx-version-min=10.5")
|
||||
else()
|
||||
|
||||
@@ -33,9 +33,7 @@ set( PKGCONFIG_ROOT "${PROJECT_SOURCE_DIR}/pkgconfig_root" )
|
||||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
find_package( BZip2 REQUIRED )
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/pkgconfig )
|
||||
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
# Copyright (C) 2013 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
|
||||
|
||||
# Downloads and builds SWIG
|
||||
|
||||
#-----<configure>----------------------------------------------------------------
|
||||
|
||||
set( SWIG_RELEASE 2.0.11 )
|
||||
set( SWIG_MD5 291ba57c0acd218da0b0916c280dcbae ) # re-calc this on every RELEASE change
|
||||
|
||||
# The boost headers [and static libs if built] go here, at the top of KiCad
|
||||
# source tree in boost_root.
|
||||
set( SWIG_ROOT "${PROJECT_SOURCE_DIR}/swig_root" )
|
||||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
find_package( BZip2 REQUIRED )
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/swig )
|
||||
|
||||
if (APPLE)
|
||||
if( CMAKE_OSX_ARCHITECTURES )
|
||||
set( SWIG_CFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||
set( SWIG_CXXFLAGS "CXXFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||
set( SWIG_LDFLAGS "LDFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||
endif( CMAKE_OSX_ARCHITECTURES )
|
||||
|
||||
set( SWIG_PYTHON "--with-python=/usr/bin/python2.6" )
|
||||
set( SWIG_OPTS --disable-dependency-tracking )
|
||||
endif(APPLE)
|
||||
|
||||
# <SOURCE_DIR> = ${PREFIX}/src/glew
|
||||
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
|
||||
# download, the patch is applied. This lets you regenerate a new patch at any time
|
||||
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
|
||||
|
||||
ExternalProject_Add( swig
|
||||
PREFIX "${PREFIX}"
|
||||
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
||||
URL http://sourceforge.net/projects/swig/files/swig/swig-${SWIG_RELEASE}/swig-${SWIG_RELEASE}.tar.gz
|
||||
URL_MD5 ${SWIG_MD5}
|
||||
STAMP_DIR "${PREFIX}"
|
||||
|
||||
DEPENDS pcre
|
||||
|
||||
#SOURCE_DIR "${PREFIX}"
|
||||
BUILD_IN_SOURCE 1
|
||||
|
||||
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${SWIG_ROOT}"
|
||||
|
||||
#PATCH_COMMAND "true"
|
||||
CONFIGURE_COMMAND ./configure --prefix=${SWIG_ROOT} --with-pcre-prefix=${PCRE_ROOT} ${SWIG_CFLAGS} ${SWIG_LDFLAGS} ${SWIG_CXXFLAGS} ${SWIG_PYTHON} ${SWIG_OPTS}
|
||||
|
||||
#BINARY_DIR "${PREFIX}"
|
||||
|
||||
BUILD_COMMAND $(MAKE)
|
||||
|
||||
INSTALL_DIR "${SWIG_ROOT}"
|
||||
INSTALL_COMMAND $(MAKE) install
|
||||
)
|
||||
@@ -1,121 +0,0 @@
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
# Copyright (C) 2013 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
|
||||
|
||||
# Downloads and builds LIBWXPYTHON
|
||||
|
||||
#-----<configure>----------------------------------------------------------------
|
||||
|
||||
set( LIBWXPYTHON_RELEASE 3.0.0.0 )
|
||||
set( LIBWXPYTHON_MD5 f5e32c7d85dc261ba777e113c3b7e365 ) # re-calc this on every RELEASE change
|
||||
|
||||
set( LIBWXPYTHON_ROOT "${PROJECT_SOURCE_DIR}/libwxpython_root" )
|
||||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
find_package( BZip2 REQUIRED )
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/libwxpython )
|
||||
set( LIBWXPYTHON_EXEC python )
|
||||
set( LIBWXPYTHON_OPTS --wxpy_installdir=${LIBWXPYTHON_ROOT}/wxPython )
|
||||
|
||||
if (APPLE)
|
||||
SET( LIBWXPYTHON_EXEC python2.6 )
|
||||
SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --osx_cocoa )
|
||||
#SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --mac_framework --mac_framework_prefix=${LIBWXPYTHON_ROOT}/wxPython )
|
||||
|
||||
if( CMAKE_OSX_ARCHITECTURES )
|
||||
STRING(REGEX REPLACE " -arch " "," LIBWXPYTHON_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
|
||||
SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --mac_arch=${LIBWXPYTHON_ARCHITECTURES})
|
||||
endif( CMAKE_OSX_ARCHITECTURES )
|
||||
|
||||
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
SET( LIBWXPYTHON_PRECMD export CFLAGS=-Qunused-arguments && )
|
||||
endif()
|
||||
endif(APPLE)
|
||||
|
||||
if ( KICAD_BUILD_STATIC )
|
||||
#message fail
|
||||
set( LIBWXPYTHON_BUILDTYPE "--disable-shared" )
|
||||
endif( KICAD_BUILD_STATIC )
|
||||
|
||||
# <SOURCE_DIR> = ${PREFIX}/src/libwx
|
||||
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
|
||||
# download, the patch is applied. This lets you regenerate a new patch at any time
|
||||
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
|
||||
|
||||
ExternalProject_Add( libwxpython
|
||||
PREFIX "${PREFIX}"
|
||||
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
||||
URL http://sourceforge.net/projects/wxpython/files/wxPython/${LIBWXPYTHON_RELEASE}/wxPython-src-${LIBWXPYTHON_RELEASE}.tar.bz2
|
||||
URL_MD5 ${LIBWXPYTHON_MD5}
|
||||
STAMP_DIR "${PREFIX}"
|
||||
|
||||
BUILD_IN_SOURCE 1
|
||||
|
||||
PATCH_COMMAND bzr revert
|
||||
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/wxpython-3.0.0_macosx.patch"
|
||||
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/wxpython-3.0.0_macosx_multiarch.patch" # http://trac.wxwidgets.org/ticket/15957
|
||||
|
||||
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${LIBWXPYTHON_ROOT}"
|
||||
COMMAND ${LIBWXPYTHON_EXEC} wxPython/build-wxpython.py --clean
|
||||
|
||||
CONFIGURE_COMMAND ${LIBWXPYTHON_PRECMD} ${LIBWXPYTHON_EXEC} wxPython/build-wxpython.py --prefix=${LIBWXPYTHON_ROOT} --unicode --install ${LIBWXPYTHON_OPTS}
|
||||
|
||||
#BINARY_DIR "${PREFIX}"
|
||||
|
||||
BUILD_COMMAND true
|
||||
|
||||
INSTALL_DIR "${LIBWXPYTHON_ROOT}"
|
||||
INSTALL_COMMAND true
|
||||
)
|
||||
|
||||
ExternalProject_Add_Step( libwxpython bzr_commit_libwxpython
|
||||
COMMAND bzr ci -q -m pristine <SOURCE_DIR>
|
||||
COMMENT "committing pristine libwxpython files to 'libwxpython scratch repo'"
|
||||
DEPENDERS patch
|
||||
)
|
||||
|
||||
|
||||
ExternalProject_Add_Step( libwxpython bzr_add_libwxpython
|
||||
COMMAND bzr add -q ${PREFIX}/src/libwxpython
|
||||
COMMENT "adding pristine libwxpython files to 'libwxpython scratch repo'"
|
||||
DEPENDERS bzr_commit_libwxpython
|
||||
)
|
||||
|
||||
|
||||
ExternalProject_Add_Step( libwxpython bzr_init_libwxpython
|
||||
COMMAND bzr init -q <SOURCE_DIR>
|
||||
COMMENT "creating 'libwxpython scratch repo' specifically for libwx to track libwx patches"
|
||||
DEPENDERS bzr_add_libwxpython
|
||||
DEPENDEES download
|
||||
)
|
||||
|
||||
######
|
||||
# Now is time to search what we have built
|
||||
######
|
||||
|
||||
ExternalProject_Add_Step( libwxpython libwxpython_recursive_message
|
||||
COMMAND cmake .
|
||||
COMMENT "*** RERUN CMAKE - wxWidgets built, now reissue a cmake to build Kicad"
|
||||
DEPENDEES install
|
||||
)
|
||||
|
||||
@@ -33,13 +33,11 @@ set( LIBWX_ROOT "${PROJECT_SOURCE_DIR}/libwx_root" )
|
||||
|
||||
#-----</configure>---------------------------------------------------------------
|
||||
|
||||
if( NOT BZIP2_FOUND )
|
||||
find_package( BZip2 REQUIRED )
|
||||
endif()
|
||||
find_package( BZip2 REQUIRED )
|
||||
|
||||
set( PREFIX ${DOWNLOAD_DIR}/libwx )
|
||||
|
||||
if (APPLE)
|
||||
if (APPLE)
|
||||
if( CMAKE_OSX_ARCHITECTURES )
|
||||
STRING(REGEX REPLACE " -arch " "," LIBWX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
|
||||
SET( LIBWX_ARCHITECTURES --enable-universal_binary=${LIBWX_ARCHITECTURES})
|
||||
@@ -82,7 +80,7 @@ ExternalProject_Add( libwx
|
||||
#SET directories
|
||||
set(wxWidgets_BIN_DIR ${LIBWX_ROOT}/bin)
|
||||
set(wxWidgets_CONFIG_EXECUTABLE ${LIBWX_ROOT}/bin/wx-config)
|
||||
set(wxWidgets_INCLUDE_DIRS ${LIBWX_ROOT}/include)
|
||||
set(wxWidgets_INCLUDE_DIRS ${LIBWX_ROOT}/include)
|
||||
set(wxWidgets_LIBRARY_DIRS ${LIBWX_ROOT}/lib)
|
||||
|
||||
|
||||
@@ -112,7 +110,7 @@ ExternalProject_Add_Step( libwx bzr_init_libwx
|
||||
######
|
||||
|
||||
ExternalProject_Add_Step( libwx libwx_recursive_message
|
||||
COMMAND cmake .
|
||||
COMMAND cmake .
|
||||
COMMENT "*** RERUN CMAKE - wxWidgets built, now reissue a cmake to build Kicad"
|
||||
DEPENDEES install
|
||||
)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/* Do not modify this file, it was automatically generated by CMake. */
|
||||
|
||||
/*
|
||||
* Define the current source code Subversion commit number. The version
|
||||
* string defined below does not update automatically when building the
|
||||
* source with make. Run make rebuild_cache to update version strings.
|
||||
*/
|
||||
#ifndef __KICAD_SVN_VERSION_H__
|
||||
#define __KICAD_SVN_VERSION_H__
|
||||
|
||||
#cmakedefine KICAD_BUILD_VERSION "@KICAD_BUILD_VERSION@"
|
||||
|
||||
#endif /* __KICAD_SVN_VERSION_H__ */
|
||||
+354
@@ -0,0 +1,354 @@
|
||||
Note that the GPL below is copyrighted by the Free Software
|
||||
Foundation, but the instance of code that it refers to (KiCad)
|
||||
is copyrighted by the KiCad developers, those who actually wrote it.
|
||||
The various CHANGELOG*.txt files and more importantly the Bazaar
|
||||
repository contain a record of who wrote what.
|
||||
|
||||
Also note that the only valid version of the GPL as far as KiCad
|
||||
is concerned is _this_ particular version of the license (ie v2, not
|
||||
v2.2 or v3.x or whatever), unless explicitly otherwise stated.
|
||||
|
||||
Dick Hollenbeck
|
||||
|
||||
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,29 +0,0 @@
|
||||
|
||||
KIWAY Build Symbols, Definitions and Intentions
|
||||
|
||||
|
||||
COMPILING_DLL:
|
||||
|
||||
This is a signal to import_export.h, and when present, toggles the
|
||||
interpretation of the #defines in that file. Its purpose should not be
|
||||
extended beyond this.
|
||||
|
||||
|
||||
USE_KIWAY_DLLS:
|
||||
|
||||
Comes from CMake as a user configuration variable, settable in the Cmake
|
||||
user interface. It decides if KiCad will be built with the *.kiface program
|
||||
modules.
|
||||
|
||||
|
||||
BUILD_KIWAY_DLL:
|
||||
|
||||
Comes from CMake, but at the 2nd tier, not the top tier. By 2nd tier,
|
||||
something like pcbnew/CMakeLists.txt, not /CMakeLists.txt is meant. It is
|
||||
not a user configuration variable. Instead, the 2nd tier CMakeLists.txt file
|
||||
looks at the top level USE_KIWAY_DLLS and decides how the object files under
|
||||
the 2nd tier's control will be built. If it decides it wants to march in
|
||||
lockstep with USE_KIWAY_DLLS, then this local CMakeLists.txt file may pass a
|
||||
defined BUILD_KIWAY_DLL (singular) on the compiler command line to the
|
||||
pertinent set of compilation steps under its control.
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
Compiling KiCad from Source
|
||||
===========================
|
||||
KiCad Documentation Team
|
||||
Last revised on 12-mars-2012 by jp Charras
|
||||
|
||||
Introduction
|
||||
------------
|
||||
This is a generic guide how to compile kicad from scratch. On windows and linux.
|
||||
If you need something more distribution specific or the experimental mac-osx port
|
||||
read the other documents in the Documentation/compiling folder.
|
||||
|
||||
Installation of Tools
|
||||
---------------------
|
||||
On windows:
|
||||
|
||||
Get msys and mingw here:
|
||||
http://mingw.org/
|
||||
msys sets up a development environment that allows the bash shell to run.
|
||||
mingw are a set of tools that run on windows or under msys. You will need
|
||||
at least the following mingw packages: make, gcc, g++, binutils, autoconf, and
|
||||
automake.
|
||||
|
||||
On linux:
|
||||
|
||||
Install "mesa". Use your package manager to install the
|
||||
development libaries.
|
||||
|
||||
After a fresh install you need the following packages to compile and run
|
||||
KiCad from source.
|
||||
|
||||
* bzr - Bazaar version control system
|
||||
* CMake - Cross-platform make
|
||||
* GLUT - The OpenGL Utility Library
|
||||
* wxGTK or wxWidgets - The wxWidgets GUI toolkit with GTK+ bindings
|
||||
|
||||
* Boost - Collection of portable C++ source libraries
|
||||
boost will be automagically downloaded and copied in kicad sources tree,
|
||||
the first time you compile kicad.
|
||||
|
||||
Useful, but not required:
|
||||
* Doxygen - Documentation system for several programming languages
|
||||
|
||||
KiCad uses the Bazaar version control system to track source code changes,
|
||||
and download the boost libraries needed by Kicad.
|
||||
Be sure you bzr install also includes bzrtools.
|
||||
boost libraries will be downloaded the first time you build Kicad.
|
||||
|
||||
Compiler and basic development tools
|
||||
-------------
|
||||
Make sure g++, make and other tools are in your path.
|
||||
If windows, then try running g++ and make from within your msys bash shell.
|
||||
|
||||
PLEASE NOTE: g++ 4.7.1 at least (possibly the 4.7.x series) is known to
|
||||
miscompile pcbnew (it get zones wrong) with -O2; using -O1 is a suitable
|
||||
workaround until they fix the compiler.
|
||||
|
||||
Install or Build wxWidgets
|
||||
--------------------------
|
||||
|
||||
WARNING:
|
||||
see wxWidgets_patch_notes.txt for patches and issues in wxWidgets.
|
||||
|
||||
If on Windows, download
|
||||
http://sourceforge.net/projects/wxwindows/files/wxAll/2.9.3/wxWidgets-2.9.3.zip/download
|
||||
or a newer version.
|
||||
Do NOT use previous versions which all have annoying issues for KiCad.
|
||||
Start msys so you have a bash shell.
|
||||
Note also since 2.9 versions no need to build a "debug" version of the wxWidgets library,
|
||||
the release abd the debug version are same.
|
||||
|
||||
Unzip the wxWidgets zip file into the build directory. Change directories into
|
||||
there, and then:
|
||||
|
||||
mkdir Release
|
||||
cd Release
|
||||
../configure --enable-unicode --enable-monolithic=no --disable-shared --with-opengl
|
||||
make
|
||||
|
||||
and under Linux, but not under Windows:
|
||||
sudo make install that install wxWidgets libs and headers in /usr/local/
|
||||
|
||||
|
||||
If on linux, you can use your package manager to install the
|
||||
development versions of the wxWidgets packages which include the C++ headers. An
|
||||
alternative is to build static libaries from source. Verify that wx-config is in
|
||||
your path by running it from a command prompt. Linux users then go to next step.
|
||||
|
||||
Install CMake
|
||||
-------------
|
||||
If windows, download the installation binary for windows from cmake.org.
|
||||
Install that and choose to add cmake to your path during installation. You
|
||||
will have to restart and command shells for the new path to take effect.
|
||||
Verify that cmake is in your path by trying to run it from a command prompt.
|
||||
|
||||
|
||||
If linux, use your package manager to install cmake. You should get cmake 2.6.4
|
||||
or later. If only an older one is available in your package repository, build
|
||||
cmake from source. Verify that cmake is in your path by trying to run it from a
|
||||
command prompt.
|
||||
|
||||
|
||||
Obtain Sources
|
||||
--------------
|
||||
You can use the Launchpad repository or a tar file for this. See the wiki.
|
||||
To download files from Launchpad repository, you should install bazaar (bzr) that is a
|
||||
version control system like subversion, mercurial, git...
|
||||
|
||||
Launchpad repository handle 2 branches for KiCda sources:
|
||||
- a testing branch (used by developers)
|
||||
- a stable branch (a copy of the testing branch, when this testing branch is near a stable state))
|
||||
|
||||
Testing branch:
|
||||
bzr branch lp:kicad kicad_testing
|
||||
|
||||
Stable branch:
|
||||
bzr branch lp:kicad/stable kicad_stable
|
||||
|
||||
Components and Footprints libraries
|
||||
bzr branch lp:~kicad-lib-committers/kicad/library kicad_libraries
|
||||
|
||||
Documentation and translations:
|
||||
bzr branch lp:~kicad-developers/kicad/doc kicad_doc
|
||||
|
||||
Create Makefiles with CMake
|
||||
---------------------------
|
||||
If windows, go into your msys shell. Linux and windows users both then make
|
||||
two "out of source" build directories:
|
||||
cd <kicadSource>
|
||||
mkdir -p build/release
|
||||
mkdir build/debug (if you want a debug version of KiCad)
|
||||
cd build/release
|
||||
|
||||
On either cmake command line shown below, you can optionally include
|
||||
-DCMAKE_INSTALL_PREFIX=<finallInstallDir>
|
||||
|
||||
If windows, run the following command:
|
||||
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
|
||||
|
||||
If linux, run instead the following command:
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ../../
|
||||
|
||||
Take a look at CMakeCache.txt, and in particular CMAKE_INSTALL_PREFIX, which
|
||||
gives the final install directory. If not what you want, edit it with a text
|
||||
editor and re-run the same cmake command again, but with no
|
||||
-DCMAKE_INSTALL_PREFIX given on the command line.
|
||||
|
||||
Compiling with Make
|
||||
------------------~
|
||||
You compile Kicad here. You will only need to do step 8) again when one of the
|
||||
CMakeLists.txt files change. If windows, you must be in your msys shell.
|
||||
On either platform then:
|
||||
|
||||
cd <kicadSource>/build/release
|
||||
make
|
||||
[sudo] make install
|
||||
|
||||
You are now done unless you want to make a Debug build.
|
||||
|
||||
|
||||
Compiling a Debug version
|
||||
-------------------------
|
||||
cd <kicadSource>/build/debug
|
||||
|
||||
On either cmake command line shown below, you can optionally include
|
||||
-DCMAKE_INSTALL_PREFIX=<finallInstallDir> before the final ../../ argument.
|
||||
Although normally you do not install the Debug binaries, you can debug them
|
||||
where they were built.
|
||||
|
||||
If windows, run the following command:
|
||||
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
|
||||
where <wxInstallDir> is <wxWidgets path>/Release
|
||||
|
||||
If linux, run instead the following command:
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_USE_DEBUG=ON ../../
|
||||
|
||||
Make the Debug binaries:
|
||||
make
|
||||
|
||||
Note: that it is easy to build only a specific binary such as pcbnew alone:
|
||||
make pcbnew
|
||||
|
||||
|
||||
See ./cmake_config.txt for customizing the KiCad build setting.
|
||||
@@ -0,0 +1,153 @@
|
||||
Bazaar
|
||||
------
|
||||
KiCad uses the Bazaar version control system to track source code changes,
|
||||
and download the boost libraries needed by Kicad.
|
||||
The easiest way to get a copy of the KiCad source is to use Bazaar.
|
||||
Bazaar can be download from http://wiki.bazaar.canonical.com.
|
||||
Your best bet is to use the stand alone version of Bazaar
|
||||
(which includes bzrtools, needed by Kicad) rather than one of
|
||||
the Python specific versions.
|
||||
Be sure bzrtools is also installed.
|
||||
boost libraries will be downloaded the first time you build Kicad.
|
||||
|
||||
CMake
|
||||
-----
|
||||
KiCad uses CMake to generate the build files specific for the target platform
|
||||
specified by the developer. This document attempts to define some of the more
|
||||
common CMake and KiCad build configuration settings. You can use CMake either
|
||||
by the command CMake on or the graphical version ccmake. This document only
|
||||
documents a very small subset of the total CMake documentation For all of the
|
||||
gory details, please see the complete CMake documentation at:
|
||||
|
||||
http://www.cmake.org/cmake/help/documentation.html.
|
||||
|
||||
|
||||
Useful CMake Build Settings.
|
||||
----------------------------
|
||||
This section defines some of the more common CMake build configuration setting
|
||||
used when configuring KiCad. These settings are valid for all projects that
|
||||
use CMake.
|
||||
|
||||
Changing the Build Generator.
|
||||
-----------------------------
|
||||
CMake attempts to create the project build system based on the platform. On
|
||||
Posix systems CMake will create Unix Makefiles to build KiCad. On Windows
|
||||
systems CMake will attempt to find the latest version of Visual C++ installed
|
||||
on the system and create the appropriate project files. This behavior can be
|
||||
changed by specifying the project generator using the -G "Project Generator"
|
||||
switch on the command line. Please note, only a small subset of these project
|
||||
generators are supported. If you want to use Eclipse on Linux to build KiCad,
|
||||
you may be in for a lot of work.
|
||||
|
||||
CMAKE_BUILD_TYPE (Release/Debug/RelWithDebInfo/MinSizeRel)
|
||||
----------------------------------------------------------
|
||||
When configuring the KiCad build for the command line you must specify build
|
||||
type. To create a debug build, set CMAKE_BUILD_TYPE to Debug. To create a
|
||||
release build, set CMAKE_BUILD_TYPE to Release. See the CMake documentation
|
||||
for other build types. For IDE project files, the build type can be selected
|
||||
by the IDE configuration manager.
|
||||
|
||||
CMAKE_INSTALL_PATH (InstallPath)
|
||||
--------------------------------
|
||||
By default CMake will select the correct install path for your platform. If
|
||||
you wish to install KiCad in a custom location, set CMAKE_INSTALL_PATH to the
|
||||
path where you want to install KiCad. Please note that the default install
|
||||
path that CMake chooses will likely overwrite the current version of KiCad
|
||||
installed on your system.
|
||||
|
||||
|
||||
wxWidgets Library Configuration.
|
||||
--------------------------------
|
||||
KiCad is built using the wxWidgets library. The following options allow you
|
||||
to specifically tailor the wxWidgets library configuration. For the complete
|
||||
list of wxWidgets setting see CMakeModules/FindwxWidgets.cmake in the KiCad
|
||||
source.
|
||||
|
||||
wxWidgets_ROOT_DIR (NonDefaultwxWidgetsPath)
|
||||
--------------------------------------------
|
||||
CMake looks in the standard platform locations to find the default version of
|
||||
the wxWidgets library. If you wish to use a custom built wxWidgets library,
|
||||
set wxWidgets_ROOT_DIR to the correct path.
|
||||
|
||||
wxWidgets_USE_DEBUG (ON/OFF)
|
||||
----------------------------
|
||||
When creating a debug build of KiCad, it is often useful to link against the
|
||||
debug build of the wxWidgets. To use the debug build of wxWidgets, set
|
||||
wxWidgets_USE_DEBUG to ON.
|
||||
|
||||
wxWidgets_USE_UNICODE (ON/OFF)
|
||||
------------------------------
|
||||
If your platform supports Unicode and you wish to build KiCad with Unicode
|
||||
support, set wxWidgets_USE_UNICODE to ON. Please note as of the 2.9 branch
|
||||
this option is not required.
|
||||
|
||||
|
||||
KiCad Specific Options
|
||||
----------------------
|
||||
All of the configuration settings below are specific to the KiCad project.
|
||||
If for any reason you add or remove a build option to the KiCad CMake files,
|
||||
please update the list below.
|
||||
|
||||
KICAD_SKIP_BOOST (ON/OFF)
|
||||
--------------------------
|
||||
Skips building the required boost library components.
|
||||
WARNING: KiCad developers strongly advise you to build the bundled boost library, as it is
|
||||
known to work with KiCad. Other versions may contain bugs that may result in KiCad errors.
|
||||
|
||||
USE_WX_GRAPHICS_CONTEXT (ON/OFF)
|
||||
--------------------------------
|
||||
This option is *Experimental* and used the advanced drawing library code
|
||||
using wxGraphicsContext and should only be used for testing purposes.
|
||||
Under Windows, a very recent version of mingw is needed. It also requires
|
||||
wxWidgets to be built with the --enable-graphics_ctx configuration switch.
|
||||
|
||||
USE_IMAGES_IN_MENUS (ON/OFF)
|
||||
----------------------------
|
||||
This option is used to enable or disable building KiCad with images in menu
|
||||
items. If this is not defined when CMake is used to create the build files,
|
||||
images will be included in menu items on all platforms except OSX.
|
||||
|
||||
KICAD_KEEPCASE (ON/OFF)
|
||||
-----------------------
|
||||
This option enables or disables turning off the automatic component name
|
||||
conversion to uppercase. The default is OFF which means component names will
|
||||
be converted to upper case.
|
||||
|
||||
USE_WX_OVERLAY (ON/OFF)
|
||||
-----------------------
|
||||
This option enables or disables wxOverlay for drawing operation on OSX. It is
|
||||
OFF by default on all platforms except OSX. Warning, this is experimental!
|
||||
|
||||
KICAD_SCRIPTING (ON/OFF)
|
||||
------------------------
|
||||
This option enables or disables building Python scripting support for KiCad.
|
||||
The default is OFF. Currently only Pcbnew is supported. This option requires
|
||||
that SWIG and Python are installed on the system.
|
||||
|
||||
KICAD_SCRIPTING_MODULES (ON/OFF)
|
||||
--------------------------------
|
||||
This option enables or disables building the KiCad modules that can be used
|
||||
from scripting languages. The default is OFF. Currently only Pcbnew is
|
||||
supported. This option requires that SWIG and Python are installed on the
|
||||
system.
|
||||
|
||||
KICAD_SCRIPTING_WXPYTHON (ON/OFF)
|
||||
---------------------------------
|
||||
This option enables or disables building wxPython support into KiCad for
|
||||
python and py.shell. The default is OFF. Currently only Pcbnew is
|
||||
supported. This option requires that SWIG, Python, and wxPython are
|
||||
installed on the system.
|
||||
|
||||
PYTHON_SITE_PACKAGE_PATH (PATH)
|
||||
-------------------------------
|
||||
When building KiCad with Python scripting enable, the Python site library path
|
||||
is used by default. If you want to install the KiCad Python extension in a
|
||||
different path, set this variable to the desired path.
|
||||
|
||||
|
||||
USE_FP_LIB_TABLE (ON/OFF)
|
||||
-------------------------
|
||||
This option enable or disables building KiCad with the new footprint library
|
||||
table support. The default setting (OFF) builds KiCad with the legacy library
|
||||
path support. This option is experimental until the library table support is
|
||||
ready for release.
|
||||
@@ -0,0 +1,226 @@
|
||||
Introduction
|
||||
------------
|
||||
|
||||
This document details how to build KiCad from source on Windows. The current
|
||||
supported method of building KiCad for Windows systems is to use the MinGW
|
||||
compiler, either from Windows or cross compiling from Linux. MSYS can be
|
||||
used on Windows to extend the range of subprojects that you can build, but
|
||||
is not needed to build KiCad itself.
|
||||
|
||||
Visual Studio is not supported, and don't ask about it, it is not supported
|
||||
and will not be, ever.
|
||||
|
||||
Install Build Tools
|
||||
-------------------
|
||||
This section describes the tools required to build KiCad from source and how
|
||||
to install them. Failure to install these tools properly will likely result
|
||||
in build errors.
|
||||
|
||||
MinGW/MSYS
|
||||
----------
|
||||
MinGW/MSYS provides the compiler tools and a partial Posix environment useful
|
||||
for building software. Download the MinGW installer from http://mingw.org.
|
||||
Run the installer and and verify MinGW and MSYS are checked. You will also
|
||||
need to expand the MinGW entry and select C++ from the list of supported
|
||||
languages. Only C is installed by default and C++ is required to build KiCad.
|
||||
|
||||
Bazaar
|
||||
------
|
||||
KiCad uses the Bazaar version control system to track source code changes,
|
||||
and download the boost libraries needed by Kicad.
|
||||
The easiest way to get a copy of the KiCad source is to use Bazaar. Bazaar
|
||||
can be download from http://wiki.bazaar.canonical.com/WindowsDownloads.
|
||||
Your best bet is to use the stand alone version of Bazaar
|
||||
(which includes bzrtools, needed Kicad) rather than one of
|
||||
the Python specific versions.
|
||||
|
||||
CMake
|
||||
-----
|
||||
The KiCad source uses CMake to make sure the system has the required software
|
||||
and libraries installed to properly compile the source. Download the latest
|
||||
CMake installer from http://cmake.org. Run the installer and make sure the
|
||||
add CMake to PATH variable check box is checked. If you fail to do this step,
|
||||
the CMake executable will not be found.
|
||||
|
||||
Doxygen (Optional)
|
||||
------------------
|
||||
Doxygen is used to generate HTML documentation of the KiCad source code. While
|
||||
it is not necessary to install Doxygen, it is a very good way to learn your way
|
||||
around the KiCad code base. It is highly recommended for new developers. The
|
||||
latest Doxygen installer can be downloaded from http://www.stack.nl/~dimitri/
|
||||
doxygen/
|
||||
|
||||
Python (Optional)
|
||||
-----------------
|
||||
KiCad supports the Python scripting language (currently only Pcbnew scripting
|
||||
exists). Currently the Python scripting support will only build against the
|
||||
version 2 branch of Python. The Python installer can be downloaded from http://
|
||||
www.python.org.
|
||||
|
||||
SWIG (Optional)
|
||||
---------------
|
||||
SWIG is used to generate the Python scripting code. It must be installed to
|
||||
build the Python scripting support. Unfortunately there in no installer for
|
||||
windows. You can download precompiled binaries from http://http://www.swig.
|
||||
org/download.html and install swig.exe. Make sure the folder you install the
|
||||
SWIG binary into is in the system PATH. Otherwise CMake will not be able to
|
||||
find it.
|
||||
|
||||
NullSoft Installer System (Optional)
|
||||
------------------------------------
|
||||
The NullSoft Installer System (NSIS) is used to create a Windows installer for
|
||||
end users from the binaries created from the KiCad source along with the
|
||||
library and documentation files. NSIS is typically only used be developers who
|
||||
create installers for end users and is not required if you install from source.
|
||||
NSIS can be downloaded from http://nsis.sourceforge.net/Download.
|
||||
|
||||
|
||||
Install and Build Libraries
|
||||
---------------------------
|
||||
This section documents installing and build all of the software libraries
|
||||
required to build KiCad. As of now, these libraries have to be built because
|
||||
MinGW builds of these libraries are not readily available Attempting to link
|
||||
programs built on MinGW with libraries from other compilers (namely Microsoft
|
||||
Visual C) is problematic. It can be done but it is not painless. As far as
|
||||
the author of this document knows, MinGW can only link to Visual Studio C
|
||||
libraries. The name mangling of Visual Studio C++ is not compatible with the
|
||||
MinGW linker.
|
||||
|
||||
Build and Install the wxWidgets Library
|
||||
---------------------------------------
|
||||
The wxWidgets library is the base that KiCad is built upon. Version 2.9.4
|
||||
or later of wxWidgets *should be* used on Windows. You may be able to build
|
||||
KiCad with older versions of wxWidgets but it is not recommended. wxWidgets
|
||||
can be downloaded from http://http://www.wxwidgets.org/downloads/
|
||||
|
||||
|
||||
Unzip the wxWidgets zip file into your preferred build directory. Avoid using
|
||||
spaces in the path names. Some MinGW tools do not play well with them. It is
|
||||
always best to error on the side of caution.
|
||||
|
||||
Open MinGW and change to the wxWidgets source directory. If you don't want to
|
||||
install the wxWidgets library into MinGW then enter the following commands:
|
||||
|
||||
#mkdir Release
|
||||
#cd Release
|
||||
#../configure --with-opengl
|
||||
#make
|
||||
|
||||
If you want to install wxWidgets in MinGW then enter the following commands:
|
||||
#mkdir Release
|
||||
#cd Release
|
||||
#../configure --prefix=/mingw --enable-monolithic=no --disable-shared --with-opengl
|
||||
#make && make install
|
||||
|
||||
wxWidgets will be statically linked to Kicad, which avoid issus with wxWidgets dlls
|
||||
|
||||
Download the KiCad Source Code
|
||||
------------------------------
|
||||
You can use the Launchpad repository or a tar file for this. See the wiki.
|
||||
To download files from Launchpad repository, you need to install the Bazaar
|
||||
(bzr) version control system.
|
||||
|
||||
Launchpad repository has two branches for KiCad sources:
|
||||
- a testing branch (used by developers)
|
||||
- a stable branch (a copy of the testing branch, when this testing branch is
|
||||
near a stable state)
|
||||
|
||||
To download the testing branch:
|
||||
#bzr branch lp:kicad kicad_testing
|
||||
|
||||
To download the stable branch:
|
||||
#bzr branch lp:kicad/stable kicad_stable
|
||||
|
||||
To download the component and footprint libraries
|
||||
#bzr branch lp:~kicad-lib-committers/kicad/library kicad_libraries
|
||||
|
||||
To download the documentation and translation files:
|
||||
#bzr branch lp:~kicad-developers/kicad/doc kicad_doc
|
||||
|
||||
Create Makefiles with CMake
|
||||
---------------------------
|
||||
Open your Msys shell. Create two "out of source" build directories at the
|
||||
command line enter the following commands:
|
||||
|
||||
#cd <kicadSource>
|
||||
#mkdir -p build/release # Build path can be anywhere you prefer.
|
||||
#mkdir build/debug # Only if you want a debug version of KiCad.
|
||||
|
||||
To create a release build of KiCad, run the following command:
|
||||
#cd build
|
||||
#cmake -G "MSYS Makefiles" \ # Back slashes are not required
|
||||
-DCMAKE_BUILD_TYPE=Release ../../ \ # and are for formatting only.
|
||||
|
||||
If the configuration fails, you have failed to install the required software
|
||||
on you system. The error message should give you a good indication of what is
|
||||
missing. You must resolve this before you can build KiCad.
|
||||
|
||||
Compiling the Code
|
||||
------------------
|
||||
To build KiCad, at the command line enter following comnands:
|
||||
|
||||
#cd <kicadSource>/build/release
|
||||
#make
|
||||
|
||||
Installing KiCad
|
||||
----------------
|
||||
To install Kicad, at the command line enter the following commands:
|
||||
|
||||
#cd <kicadSource>/build/release
|
||||
#make install
|
||||
|
||||
If you get any errors during the installation, you probably do not have the
|
||||
appropriate privileges to the install path. Take a look at CMakeCache.txt
|
||||
that was created when you ran CMake, and in particular look at the value of
|
||||
the CMAKE_INSTALL_PREFIX variable. This is where KiCad will be installed. If
|
||||
this not where you want KiCad installed, edit it with a text editor rerun the
|
||||
make install command. You do not have the appropriate privileges to install
|
||||
KiCad in the CMAKE_INSTALL_PATH, run the make install command as administrator.
|
||||
|
||||
You are now done unless you want to make a Debug build.
|
||||
|
||||
|
||||
Compiling a Debug version
|
||||
-------------------------
|
||||
To create a debug version of KiCad, enter the following commands:
|
||||
|
||||
#cd <kicadSource>/build/debug
|
||||
#cmake -G "MSYS Makefiles" \
|
||||
-DCMAKE_BUILD_TYPE=Debug ../../
|
||||
#make
|
||||
|
||||
Generally speaking you do not install debug binaries. They can be debugged in
|
||||
place. To monitor the debugging output, you can download the Windows debug
|
||||
viewer DbgView from http://technet.microsoft.com/en-us/sysinternals/
|
||||
bb896647.aspx
|
||||
|
||||
Compiling the Python Scripting Support.
|
||||
---------------------------------------
|
||||
|
||||
Before building KiCad Python scripting extension, you must create a MinGW
|
||||
compatible Python link library. The directions to do this can be found in
|
||||
the "How do I create Python extensions?" FAQ at http://www.mingw.org/wiki/FAQ.
|
||||
|
||||
To build KiCad with Python scripting support, run CMake as follows and then
|
||||
compile the source as described above.
|
||||
|
||||
#cmake -G "MSYS Makefiles" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DKICAD_PYTHON_SCRIPTING=ON \
|
||||
-DKICAD_PYTHON_MODULES=ON ../../
|
||||
|
||||
You only need to include the KICAD_PYTHON_MODULES option if you want to
|
||||
install the python modules that ship with KiCad. Also note that the wxPython
|
||||
support cannot be compiled on Windows at this time due to library conflicts
|
||||
between MinGW and Python. Work is currently underway by the KiCad developers
|
||||
to provide a MinGW build of Python which should resolve this issue.
|
||||
|
||||
Building the Developer Documentation
|
||||
------------------------------------
|
||||
To build the HTML developer documentation, run the following commands:
|
||||
|
||||
#cd <kicadSource>/build/debug
|
||||
#make doxygen-docs
|
||||
|
||||
The documentation will be created in the <kicadSouce>/Documentation/html
|
||||
directory.
|
||||
@@ -0,0 +1,168 @@
|
||||
Compiling KiCad on Apple Mac OS X
|
||||
=================================
|
||||
First written: 2010-01-31
|
||||
Last edited by: Jerry Jacobs <xor.gate.engineering[at]gmail[dot]com>
|
||||
|
||||
|
||||
Snow Leopard
|
||||
------------
|
||||
|
||||
Requirements
|
||||
* XCode Tools (http://developer.apple.com/tools/xcode)
|
||||
* bzr (bazaar)
|
||||
* CMake (http://www.cmake.org)
|
||||
* wxWidgets 2.9 (http://www.wxwidgets.org/downloads)
|
||||
* Doxygen (http://www.doxygen.nl)
|
||||
* ccache (http://www.macports.org)
|
||||
|
||||
|
||||
Building wxWidgets 2.9 Universal
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
To check if your tools and libraries are installed check with file for architectures.
|
||||
|
||||
user@macosx$ file /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib
|
||||
|
||||
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib: Mach-O universal binary with 4 architectures
|
||||
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture ppc7400): Mach-O dynamically linked shared library stub ppc
|
||||
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture ppc64)Mach-O 64-bit dynamically linked shared library stub ppc64
|
||||
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture i386):Mach-O dynamically linked shared library stub i386
|
||||
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library stub x86_64
|
||||
|
||||
You need the architectures what you are compiling for !
|
||||
|
||||
If you have problems that the 64bits library is not build you should add in
|
||||
the configure file:
|
||||
|
||||
At time of writing (2009-01-16) this is on line 18381
|
||||
changing this: OSX_UNIV_OPTS="-arch ppc -arch i386"
|
||||
into this: OSX_UNIV_OPTS="-arch ppc -arch i386 -arch x86_64"
|
||||
|
||||
Building a universal monolib wxWidgets 2.9 with the following parameters:
|
||||
./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-opengl --with-expat=builtin --enable-universal_binary --enable-aui --enable-debug --with-osx_cocoa --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk/ --prefix=/opt/wxwidgets/<rev>
|
||||
|
||||
<rev> Should be subsituded with the revision from SVN
|
||||
|
||||
Then you should a message like this:
|
||||
|
||||
Configured wxWidgets 2.9.2 for `i686-apple-darwin10.4.0'
|
||||
|
||||
Which GUI toolkit should wxWidgets use? osx_cocoa
|
||||
Should wxWidgets be compiled into single library? yes
|
||||
Should wxWidgets be linked as a shared library? no
|
||||
Should wxWidgets support Unicode? yes (using UTF-8)
|
||||
What level of wxWidgets compatibility should be enabled?
|
||||
wxWidgets 2.6 no
|
||||
wxWidgets 2.8 yes
|
||||
Which libraries should wxWidgets use?
|
||||
STL no
|
||||
jpeg builtin
|
||||
png builtin
|
||||
regex builtin
|
||||
tiff builtin
|
||||
zlib sys
|
||||
expat builtin
|
||||
libmspack no
|
||||
sdl no
|
||||
|
||||
|
||||
If you don't need the debugging symbols then you can remove the --enable-debug parameter.
|
||||
|
||||
Compiling and installing:
|
||||
make
|
||||
sudo make install
|
||||
|
||||
|
||||
Move the old Mac OS X wxconfig and symlink it to the new compiled 2.9
|
||||
|
||||
sudo mv /usr/bin/wx-config /usr/bin/wx-config.osx
|
||||
sudo ln -s /opt/wxwidgets-svn/bin/wx-config /usr
|
||||
|
||||
Building KiCad
|
||||
~~~~~~~~~~~~~~
|
||||
Extract the sources or get them from subversion.
|
||||
|
||||
user@mac-osx$ cmake .
|
||||
|
||||
Regarding Kicad the only things i've changed are the Variables
|
||||
in the generated CMakeCache.txt
|
||||
|
||||
It depends on which CMake version you use:
|
||||
|
||||
//Flags used by the compiler during all build types.
|
||||
//This fixes also BOOST macro errors
|
||||
CMAKE_CXX_FLAGS:STRING=-D__ASSERTMACROS__
|
||||
|
||||
//Build architectures for OSX
|
||||
CMAKE_OSX_ARCHITECTURES:STRING=x86_64 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -mmacosx-version-min=10.5
|
||||
|
||||
//The product will be built against the headers and libraries located
|
||||
// inside the indicated SDK.
|
||||
CMAKE_OSX_SYSROOT:PATH=/Developer/SDKs/MacOSX10.5.sdk
|
||||
|
||||
//Minimum OS X version to target for deployment (at runtime); newer
|
||||
// APIs weak linked. Set to empty string for default value.
|
||||
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5
|
||||
|
||||
Or:
|
||||
|
||||
CMAKE_OSX_ARCHITECTURE = x86_64 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -mmacosx-version-min=10.5
|
||||
CMAKE_OSX_SYSROOT = /Developer/SDKs/MacOSX10.5.sdk
|
||||
CMAKE_CXX_FLAGS = -D__ASSERTMACROS__
|
||||
|
||||
|
||||
Then we invoke make:
|
||||
user@mac-osx$ make
|
||||
|
||||
It is also possible to give all the options on the commandline and not to edit the CMakeCache.txt. This is a oneliner for Leopard and up:
|
||||
|
||||
cmake ~/Repositories/testing -DCMAKE_OSX_ARCHITECTURES="i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" -DCMAKE_CXX_FLAGS="-D__ASSERTMACROS__" -DCMAKE_OSX_SYSROOT="/Developer/SDKs/MacOSX10.6.sdk"
|
||||
|
||||
Optional compiler cache
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
If you (re)compile often, you would love to use cache. The best is to install it using macports and set the libexec symlink
|
||||
directory of ccache in your PATH variable.
|
||||
|
||||
Then start with a clean directory and invoke cmake, make sure that the C++ compiler points to /opt/local/libexec/ccache/g++
|
||||
|
||||
Further reading at http://trac.macports.org/wiki/howto/ccache
|
||||
|
||||
Known Problems
|
||||
~~~~~~~~~~~~~~
|
||||
In file included from
|
||||
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/detail/reversible_ptr_container.hpp:22In
|
||||
file included from
|
||||
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/detail/reversible_ptr_container.hpp:22,
|
||||
from
|
||||
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/ptr_sequence_adapter.hpp:20,
|
||||
from
|
||||
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/ptr_vector.hpp:20,
|
||||
from
|
||||
/temp/kicad-sources/kicad/include/board_item_struct.h:9,
|
||||
from /temp/kicad-sources/kicad/include/pcbstruct.h:10,
|
||||
from /temp/kicad-sources/kicad/3d-viewer/3d_viewer.h:29,
|
||||
from /temp/kicad-sources/kicad/3d-viewer/3d_aux.cpp:23:
|
||||
/temp/kicad-sources/boost_1_38_0/boost/ptr_container/detail/static_move_ptr.hpp:154:50:
|
||||
error: macro "check" passed 2 arguments, but takes just 1
|
||||
|
||||
CMAKE_CXX_FLAGS = -D__ASSERTMACROS__ fixes this :-)
|
||||
|
||||
|
||||
configure:18585: gcc -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -mmacosx-version-min=10.5 -o conftest -arch i386 -arch x86_64 -arch ppc -arch i386 -arch x86_64 -arch ppc conftest.c >&5
|
||||
ld: warning: in /Developer/SDKs/MacOSX10.5.sdk//usr/lib/libSystem.dylib, missing required architecture ppc in file
|
||||
|
||||
Installing rosetta and xcode with all architectures fixes this "problem"
|
||||
|
||||
|
||||
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks//QuickTime.framework/QuickTime, missing required architecture x86_64 in file
|
||||
|
||||
You get this error because the QuickTime 10.6 framework is not build with 64bit support. This not a real issue for KiCad because we don't use it anyway.
|
||||
|
||||
Undefined symbols:
|
||||
"TestForIntersectionOfStraightLineSegments(int, int, int, int, int, int, int, int, int*, int*, double*)", referenced from:
|
||||
clipLine(EDA_Rect*, int&, int&, int&, int&)in libcommon.a(gr_basic.cpp.o)
|
||||
|
||||
Make sure you marked the build type Release:
|
||||
|
||||
//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
|
||||
// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
|
||||
CMAKE_BUILD_TYPE:STRING=Release
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,800 +0,0 @@
|
||||
# KiCad C++ Source Code Style Guide #
|
||||
|
||||
Latest Publishing: February 2013
|
||||
|
||||
First Published: September 2010
|
||||
|
||||
written by
|
||||
|
||||
Wayne Stambaugh \<<stambaughw@verizon.net>\>
|
||||
and
|
||||
Dick Hollenbeck \<<dick@softplc.com>\>
|
||||
|
||||
[TOC]
|
||||
|
||||
# 1. Introduction # {#intro}
|
||||
The purpose of this document is to provide a reference guide for KiCad
|
||||
developers about how source code should be styled and formatted in
|
||||
KiCad. It is not a comprehensive programming guide because it does not
|
||||
discuss many things such as software engineering strategies, source
|
||||
directories, existing classes, or how to internationalize text. The goal
|
||||
is to make all of the KiCad source conform to this guide.
|
||||
|
||||
## 1.1 Why Coding Style Matters ## {#why}
|
||||
You may be thinking to yourself that using the style defined in this
|
||||
document will not make you a good programmer and you would be correct.
|
||||
Any given coding style is no substitute for experience. However, any
|
||||
experienced coder will tell that the only thing worse than looking at
|
||||
code that is not in your preferred coding style, is looking at twenty
|
||||
different coding styles that are not your preferred coding style.
|
||||
Consistency makes a) problems easier to spot, and b) looking at code for
|
||||
long periods of time more tolerable.
|
||||
|
||||
## 1.2 Enforcement ## {#enforcement}
|
||||
The KiCad coding police are not going to break down your door and beat
|
||||
you with your keyboard if you don't follow these guidelines (although
|
||||
there are those who would argue that they should). However, there are
|
||||
some very sound reasons why you should follow them. If you are
|
||||
contributing patches, you are much more likely to be taken seriously by
|
||||
the primary developers if your patches are formatted correctly. Busy
|
||||
developers don't have the time to go back and reformat your code. If you
|
||||
have a desire to become a regular KiCad developer with commit access to
|
||||
the development branch, you're not likely to get a glowing
|
||||
recommendation by the lead developers if you will not follow these
|
||||
guidelines. It is just good programming courtesy to follow this policy
|
||||
because it is respectful of the investment already made by the existing
|
||||
developers. The other KiCad developers will appreciate your effort.
|
||||
|
||||
**Warning**
|
||||
|
||||
**Do not modify this document without the consent of the project
|
||||
leader. All changes to this document require approval.**
|
||||
|
||||
|
||||
# 2. Naming Conventions # {#naming_conventions}
|
||||
Before delving into anything as esoteric as indentation and formatting,
|
||||
naming conventions need to be addressed. This section does not attempt
|
||||
to define what names you use for your code. Rather, it defines the style
|
||||
for naming. See the references section for links to some excellent
|
||||
coding references. When defining multiple word names use the following
|
||||
conventions for improved readability:
|
||||
|
||||
- Use underscores for all upper and all lower case variables to make
|
||||
multiple word names more readable.
|
||||
- Use camel case for mixed case variable names.
|
||||
|
||||
Avoid mixing camel case and underscores.
|
||||
|
||||
**Examples**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
CamelCaseName // if camelcase, then no underscores
|
||||
all_lower_case_name
|
||||
ALL_UPPER_CASE_NAME
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## 2.1 Class, Type Definitions, Name Space, and Macro Names ## {#definitions}
|
||||
Class, typedef, enum, name space, and macro names should be comprised of
|
||||
all capital letters.
|
||||
|
||||
**Examples**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
class SIMPLE
|
||||
#define LONG_MACRO_WITH_UNDERSCORES
|
||||
typedef boost::ptr_vector<PIN> PIN_LIST;
|
||||
enum KICAD_T {...};
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## 2.2 Local, Private and Automatic Variables ## {#local_variables}
|
||||
The first character of automatic, static local, and private variable
|
||||
names should be lower case. This indicates that the variable will not be
|
||||
“visible” outside of the function, file, or class where they are
|
||||
defined, respectively. The limited visibility is being acknowledged with
|
||||
the lowercase starting letter, where lowercase is considered to be less
|
||||
boisterous than uppercase.
|
||||
|
||||
**Examples**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
int i;
|
||||
double aPrivateVariable;
|
||||
static char* static_variable = NULL;
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## 2.3 Public and Global Variables ## {#global_variables}
|
||||
The first character of public and global variable names are to be
|
||||
uppercase. This indicates that the variable is visible outside the class
|
||||
or file in which it was defined. (An exception is the use of prefix `g_`
|
||||
which is also sometimes used to indicate a global variable.)
|
||||
|
||||
**Example**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
char* GlobalVariable;
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## 2.4 Local, Private and Static Functions ## {#functions}
|
||||
The first character of local, private, and static functions should be
|
||||
lower case. This indicates that the function is not visible outside the
|
||||
class or file where it is defined.
|
||||
|
||||
**Example**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
bool isModified();
|
||||
static int buildList( int* list );
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## 2.5 Function Arguments ## {#function_arguments}
|
||||
Function arguments are prefixed with an 'a' to indicate these are
|
||||
arguments to a function. The 'a' stands for “argument”, and it also
|
||||
enables clever and concise Doxygen comments.
|
||||
|
||||
**Example**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
/*/** */*
|
||||
* Function SetFoo
|
||||
* takes aFoo and copies it into this instance.
|
||||
*/
|
||||
void SetFoo( int aFoo );
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Notice how the reader can say “a Foo” to himself when reading this.
|
||||
|
||||
## 2.6 Pointers ## {#pointers}
|
||||
It is not desired to identify a pointer by building a 'p' into the
|
||||
variable name. The pointer aspect of the variable pertains to type, not
|
||||
purpose.
|
||||
|
||||
**Example**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
MODULE* module;
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
The purpose of the variable is that it represents a MODULE. Something
|
||||
like `p_module` would only make that harder to discern.
|
||||
|
||||
## 2.7 Accessing Member Variables and Member Functions ## {#accessing_members}
|
||||
We do not use “`this->`” to access either member variables or member
|
||||
functions from within the containing class. We let C++ perform this for
|
||||
us.
|
||||
|
||||
|
||||
# 3. Commenting # {#commenting}
|
||||
Comments in KiCad typically fall into two categories: in line code
|
||||
comments and Doxygen comments. In line comments have no set formatting
|
||||
rules other than they should have the same indent level as the code if
|
||||
they do not follow a statement. In line comments that follow statements
|
||||
should not exceed 99 columns unless absolutely necessary. The prevents
|
||||
word wrapping in an editor when the viewable columns is set to 100. In
|
||||
line comments can use either the C++ or the C commenting style, but C++
|
||||
comments are preferred for single line comments or comments consisting
|
||||
of only a few lines.
|
||||
|
||||
## 3.1 Blank Lines Above Comments ## {#blank_lines_above_comments}
|
||||
If a comment is the first thing on a line, then that comment should have
|
||||
one or more blank lines above them. One blank line is preferred.
|
||||
|
||||
## 3.2 Doxygen ## {#doxygen}
|
||||
Doxygen is a C++ source code documenting tool used by the project. Descriptive
|
||||
*.html files can be generated from the source code by installing Doxygen and
|
||||
building the target named **doxygen-docs**.
|
||||
|
||||
$ cd <kicad_build_base>
|
||||
$ make doxygen-docs
|
||||
|
||||
The \*.html files will be placed into
|
||||
\<kicad\_project\_base\>/Documentation/doxygen/html/
|
||||
|
||||
Doxygen comments are used to build developer documentation from the
|
||||
source code. They should normally be only placed in header files and not
|
||||
in \*.cpp files. This eliminates the obligation to keep two comments in
|
||||
agreement with each other. is if the class, function, or enum, etc. is
|
||||
only defined in a \*.cpp source file and not present in any header file,
|
||||
in which case the Doxygen comments should go into the \*.cpp source file.
|
||||
Again, avoid duplicating the Doxygen comments in both the header and
|
||||
\*.cpp source files.
|
||||
|
||||
KiCad uses the JAVADOC comment style defined in the [“Documenting the
|
||||
code”][doccode] section of the Doxygen [manual][manual]. Don't forget
|
||||
to use the special Doxygen tags: bug, todo, deprecated, etc., so other
|
||||
developers can quickly get useful information about your code. It is
|
||||
good practice to actually generate the Doxygen \*.html files by
|
||||
building target doxygen-docs, and then to review the quality of your
|
||||
Doxygen comments with a web browser before submitting a patch.
|
||||
|
||||
[doccode]: http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html
|
||||
[manual]: http://www.stack.nl/~dimitri/doxygen/manual.html
|
||||
|
||||
### 3.2.1 Function Comments ### {#function_comments}
|
||||
These go into a header file, unless the function is a private (i.e.
|
||||
static) function known only to a \*.cpp file. The format of a function
|
||||
comment is chosen to serve a dual purpose role: delineation of the
|
||||
function declaration within the source code and to create a consistent
|
||||
leading sentence in the doxygen html output. The chosen format is
|
||||
“Function \<name\>” as shown in the example below.
|
||||
|
||||
**Example**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
/*/** */*
|
||||
* Function Print
|
||||
* formats and writes text to the output stream.
|
||||
* @param nestLevel is the multiple of spaces to precede the output with.
|
||||
* @param fmt is a printf() style format string.
|
||||
* @param ... is a variable list of parameters that will get blended into
|
||||
* the output under control of the format string.
|
||||
* @return int - the number of characters output.
|
||||
* @throw IO_ERROR, if there is a problem outputting, such asisk.
|
||||
*/
|
||||
int PRINTF_FUNC Print( int nestLevel,
|
||||
const char* fmt, ... ) throw( IO_ERROR );
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
The “Function \<name\>” text goes on the 2nd line of the comment. The
|
||||
\@return keyword if present, should show the type of the return value
|
||||
followed by a hiphen. The \@param keyword names a function parameter
|
||||
and the text following should flow like a normal English sentence.
|
||||
|
||||
### 3.2.2 Class Comments ### {#class_comments}
|
||||
A class comment describes a class declaration by giving the purpose and
|
||||
use of the class. Its format is similar to a function comment. Doxygen
|
||||
can use the html \<p\> (paragraph designation) to begin a new paragraph
|
||||
in its output. So if the text of the comment is large, break it put into
|
||||
multiple paragraphs.
|
||||
|
||||
**Example**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
/*/** */*
|
||||
* Class OUTPUTFORMATTER
|
||||
* is an important interface (abstract) class used to output UTF8 text in
|
||||
* a convenient way. The primary interface is "printf() - like" but
|
||||
* with support for indentation control. The destination of the 8 bit
|
||||
* wide text is up to the implementer.
|
||||
* <p>
|
||||
* The implementer only has to implement the write() function, but can
|
||||
* also optionally re-implement GetQuoteChar().
|
||||
* <p>
|
||||
* If you want to output a wxString, then use CONV_TO_UTF8() on it
|
||||
* before passing it as an argument to Print().
|
||||
* <p>
|
||||
* Since this is an abstract interface, only classes derived from
|
||||
* this one may actually be used.
|
||||
*/
|
||||
class OUTPUTFORMATTER
|
||||
{
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
# 4. Formatting # {#formatting}
|
||||
This section defines the formatting style used in the KiCad source.
|
||||
|
||||
## 4.1 Indentation ## {#indentation}
|
||||
The indentation level for the KiCad source code is defined as four
|
||||
spaces. Please do not use tabs.
|
||||
|
||||
### 4.1.1 Defines ### {#defines}
|
||||
There should be only one space after a \#define statement.
|
||||
|
||||
### 4.1.2 Column Alignment ### {#column_alignment}
|
||||
Please try to align multiple consecutive similar lines into consistent
|
||||
columns when possible, such as \#define lines which can be thought of as
|
||||
containing 4 columns: \#define, symbol, value, and comment. Notice how
|
||||
all 4 columns are aligned in the example below.
|
||||
|
||||
**Example**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
#define LN_RED 12 // my favorite
|
||||
#define LN_GREEN 13 // eco friendly
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Another common case is the declaration of automatic variables. These are
|
||||
preferably shown in columns of type and variable name.
|
||||
|
||||
## 4.2 Blank Lines ## {#blank_lines}
|
||||
|
||||
### 4.2.1 Function Declarations ### {#function_declarations}
|
||||
There should be 1 blank line above a function declaration in a class
|
||||
file if that function declaration is presented with a Javadoc comment.
|
||||
This is consist with the statement above about blank lines above
|
||||
comments.
|
||||
|
||||
### 4.2.2 Function Definitions ### {#function_definitions}
|
||||
Function definitions in *.cpp files will not typically be accompanied by
|
||||
any comment, since those are normally only in the header file. It is
|
||||
desirable to set off the function definition within the *.cpp file by
|
||||
leaving two blank lines above the function definition.
|
||||
|
||||
### 4.2.3 If Statements ### {#if_statements}
|
||||
There should be one blank line above if statements.
|
||||
|
||||
## 4.3 Line Length ### {#line_length}
|
||||
The maximum line width is 99 columns. An exception to this is a long
|
||||
quoted string such as the internationalized text required to satisfy
|
||||
MSVC++, described below.
|
||||
|
||||
## 4.4 Strings ## {#strings}
|
||||
The KiCad project team no longer supports compiling with Microsoft
|
||||
Visual C++. When you need to break long strings into smaller substrings,
|
||||
please use the C99 compliant method for improved readability. Using
|
||||
any of previously accepted methods defined below for breaking
|
||||
long internationalized strings will no longer be accepted.
|
||||
|
||||
**Examples**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
// This works with C99 compliant compilers is the **only** accepted method:
|
||||
wxChar* foo = _( “this is a long string broken ”
|
||||
“into pieces for readability.” );
|
||||
|
||||
// This works with MSVC, breaks POEdit, and is **not** acceptable:
|
||||
wxChar* foo = _( “this is a long string broken ”
|
||||
L“into pieces for readability” );
|
||||
|
||||
// This works with MSVC, is ugly, and is **not** accepted:
|
||||
wxChar* foo = _( “this is a long string \
|
||||
broken into pieces for readability” );
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
A second acceptable solution is to simply put the text all on one
|
||||
line, even if it exceeds the 99 character line length limit. However,
|
||||
the preferred method is to break strings within the 99 character limit
|
||||
whenever possible to prevent wrapping.
|
||||
|
||||
## 4.5 Trailing Whitespace ## {#trailing_whitespace}
|
||||
Many programming editors conveniently indent your code for you. Some of
|
||||
them do it rather poorly and leave trailing whitespace. Thankfully, most
|
||||
editors come with a remove trailing whitespace macro or at least a
|
||||
setting to make trailing whitespace visible so you can see it and
|
||||
manually remove it. Trailing whitespace is known to break some text
|
||||
parsing tools. It also leads to unnecessary diffs in the version control
|
||||
system. Please remove trailing whitespace.
|
||||
|
||||
## 4.6 Multiple Statements per Line ## {#multiple_statements_per_line}
|
||||
It is generally preferred that each statement be placed on its own line.
|
||||
This is especially true for statements without keywords.
|
||||
|
||||
**Example**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
x=1; y=2; z=3; // Bad, should be on separate lines.
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## 4.7 Braces ## {#braces}
|
||||
Braces should be placed on the line proceeding the keyword and indented
|
||||
to the same level. It is not necessary to use braces if there is only a
|
||||
single line statement after the keyword. In the case of if..else
|
||||
if..else, indent all to the same level.
|
||||
|
||||
**Example**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
void function()
|
||||
{
|
||||
if( foo )
|
||||
{
|
||||
statement1;
|
||||
statement2;
|
||||
}
|
||||
else if( bar )
|
||||
{
|
||||
statement3;
|
||||
statement4;
|
||||
}
|
||||
else
|
||||
statement5;
|
||||
}
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## 4.8 Parenthesis ## {#parenthesis}
|
||||
Parenthesis should be placed immediately after function names and
|
||||
keywords. Spaces should be placed after the opening parenthesis, before
|
||||
the closing parenthesis, and between the comma and the next argument in
|
||||
functions. No space is needed if a function has no arguments.
|
||||
|
||||
**Example**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
void Function( int aArg1, int aArg2 )
|
||||
{
|
||||
while( busy )
|
||||
{
|
||||
if( a || b || c )
|
||||
doSomething();
|
||||
else
|
||||
doSomethingElse();
|
||||
}
|
||||
}
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
## 4.9 Switch Formatting ## {#switch}
|
||||
The case statement is to be indented to the same level as the switch.
|
||||
|
||||
**Example**
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
switch( foo )
|
||||
{
|
||||
case 1:
|
||||
doOne();
|
||||
break;
|
||||
case 2:
|
||||
doTwo();
|
||||
// Fall through.
|
||||
default:
|
||||
doDefault();
|
||||
}
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
# 5. License Statement # {#license_statement}
|
||||
There is a the file copyright.h which you can copy into the top of
|
||||
your new source files and edit the \<author\> field. KiCad depends on
|
||||
the copyright enforcement capabilities of copyright law, and this
|
||||
means that source files must be copyrighted and not be released into
|
||||
the public domain. Each source file has one or more owners.
|
||||
|
||||
|
||||
# 6. Header Files # {#header_files}
|
||||
Project \*.h source files should:
|
||||
|
||||
- contain a license statement
|
||||
- contain a nested include \#ifndef
|
||||
- be fully self standing and not depend on other headers that are not
|
||||
included within it.
|
||||
|
||||
The license statement was described above.
|
||||
|
||||
## 6.1 Nested Include #ifndef ## {#nested_include}
|
||||
Each header file should include an \#ifndef which is commonly used to
|
||||
prevent compiler errors in the case where the header file is seen
|
||||
multiple times in the code stream presented to the compiler. Just
|
||||
after the license statement, at the top of the file there should be
|
||||
lines similar to these (but with a filename specific token other than
|
||||
`RICHIO_H_`):
|
||||
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
#ifndef RICHIO_H_
|
||||
#define RICHIO_H_
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
And at the very bottom of the header file, use a line like this one:
|
||||
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
#endif // RICHIO_H_
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
The \#ifndef wrapper begins after the license statement, and ends at
|
||||
the very bottom of the file. It is important that it wrap any nested
|
||||
\#include statements, so that the compiler can skip them if the
|
||||
\#ifndef evaluates to false, which will reduce compilation time.
|
||||
|
||||
## 6.2 Headers Without Unsatisfied Dependencies ## {#header_depends}
|
||||
Any header file should include other headers that it depends on. (Note:
|
||||
KiCad is not at this point now, but this section is a goal of the
|
||||
project.)
|
||||
|
||||
It should be possible to run the compiler on any header file within the
|
||||
project, and with proper include paths being passed to the compiler, the
|
||||
header file should compile without error.
|
||||
|
||||
**Example**
|
||||
|
||||
$ cd /svn/kicad/testing.checkout/include
|
||||
$ g++ wx-config --cxxflags -I . xnode.h -o /tmp/junk
|
||||
|
||||
Such structuring of the header files removes the need within a client
|
||||
\*.cpp file to include some project header file before some other project
|
||||
header file. (A client \*.cpp file is one that intends to **use, not
|
||||
implement,** the public API exposed within the header file.)
|
||||
|
||||
Client code should not have to piece together things that a header file
|
||||
wishes to expose. The exposing header file should be viewed as a fully
|
||||
sufficient **ticket to use** the public API of that header file.
|
||||
|
||||
This is not saying anything about how much to expose, only that that
|
||||
which is exposed needs to be fully usable merely by including the header
|
||||
file that exposes it, with no additional includes.
|
||||
|
||||
For situations where there is a class header file and an
|
||||
implementation \*.cpp file, it is desirable to hide as much of the
|
||||
private implementation as is practical and any header file that is not
|
||||
needed as part of the public API can and should be included only in
|
||||
the implementation \*.cpp file. However, the number one concern of
|
||||
this section is that client (using) code can use the public API which
|
||||
is exposed in the header file, merely by including that one header
|
||||
file.
|
||||
|
||||
|
||||
# 7. I Wrote X Lines of Code Before I Read This Document # {#x_lines}
|
||||
It's OK. We all make mistakes. Fortunately, KiCad provides a
|
||||
configuration file for the code beautifier uncrustify. Uncrustify won't
|
||||
fix your naming problems but it does a pretty decent job of formatting
|
||||
your source code. There are a few places where uncrustify makes some
|
||||
less than ideal indentation choices. It struggles with the string
|
||||
declaration macros wxT(“”) and \_(“”) and functions used as arguments to
|
||||
other functions. After you uncrustify your source code, please review the
|
||||
indentation for any glaring errors and manually fix them. See the
|
||||
uncrustify [website][uncrustify] for more information.
|
||||
|
||||
[uncrustify]: http://uncrustify.sourceforge.net/
|
||||
|
||||
|
||||
# 8. Show Me an Example # {#show_me_an_example}
|
||||
Nothing drives the point home like an example. The source file richio.h
|
||||
below was taken directly from the KiCad source.
|
||||
|
||||
~~~~~~~~~~~~~{.cpp}
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007-2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef RICHIO_H_
|
||||
#define RICHIO_H_
|
||||
|
||||
|
||||
// This file defines 3 classes useful for working with DSN text files and is named
|
||||
// "richio" after its author, Richard Hollenbeck, aka Dick Hollenbeck.
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// I really did not want to be dependent on wxWidgets in richio
|
||||
// but the errorText needs to be wide char so wxString rules.
|
||||
#include <wx/wx.h>
|
||||
#include <cstdio> // FILE
|
||||
|
||||
|
||||
|
||||
/*/** */*
|
||||
* Struct IOError
|
||||
* is a class used to hold an error message and may be used to throw exceptions
|
||||
* containing meaningful error messages.
|
||||
*/
|
||||
struct IOError
|
||||
{
|
||||
wxString errorText;
|
||||
|
||||
IOError( const wxChar* aMsg ) :
|
||||
errorText( aMsg )
|
||||
{
|
||||
}
|
||||
|
||||
IOError( const wxString& aMsg ) :
|
||||
errorText( aMsg )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*/** */*
|
||||
* Class LINE_READER
|
||||
* reads single lines of text into its buffer and increments a line number counter.
|
||||
* It throws an exception if a line is too long.
|
||||
*/
|
||||
class LINE_READER
|
||||
{
|
||||
protected:
|
||||
|
||||
FILE* fp;
|
||||
int lineNum;
|
||||
unsigned maxLineLength;
|
||||
unsigned length;
|
||||
char* line;
|
||||
unsigned capacity;
|
||||
|
||||
public:
|
||||
|
||||
/*/** */*
|
||||
* Constructor LINE_READER
|
||||
* takes an open FILE and the size of the desired line buffer.
|
||||
* @param aFile An open file in "ascii" mode, not binary mode.
|
||||
* @param aMaxLineLength The number of bytes to use in the line buffer.
|
||||
*/
|
||||
LINE_READER( FILE* aFile, unsigned aMaxLineLength );
|
||||
|
||||
~LINE_READER()
|
||||
{
|
||||
delete[] line;
|
||||
}
|
||||
|
||||
/*
|
||||
int CharAt( int aNdx )
|
||||
{
|
||||
if( (unsigned) aNdx < capacity )
|
||||
return (char) (unsigned char) line[aNdx];
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
|
||||
/*/** */*
|
||||
* Function ReadLine
|
||||
* reads a line of text into the buffer and increments the line number
|
||||
* counter. If the line is larger than the buffer size, then an exception
|
||||
* is thrown.
|
||||
* @return int - The number of bytes read, 0 at end of file.
|
||||
* @throw IOError only when a line is too long.
|
||||
*/
|
||||
int ReadLine() throw (IOError);
|
||||
|
||||
operator char* ()
|
||||
{
|
||||
return line;
|
||||
}
|
||||
|
||||
int LineNumber()
|
||||
{
|
||||
return lineNum;
|
||||
}
|
||||
|
||||
unsigned Length()
|
||||
{
|
||||
return length;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*/** */*
|
||||
* Class OUTPUTFORMATTER
|
||||
* is an interface (abstract class) used to output ASCII text in a convenient
|
||||
* way. The primary interface is printf() like but with support for indentation
|
||||
* control. The destination of the 8 bit wide text is up to the implementer.
|
||||
* If you want to output a wxString, then use CONV_TO_UTF8() on it before passing
|
||||
* it as an argument to Print().
|
||||
* <p>
|
||||
* Since this is an abstract interface, only classes derived from this one
|
||||
* will be the implementations.
|
||||
*/
|
||||
class OUTPUTFORMATTER
|
||||
{
|
||||
|
||||
#if defined(__GNUG__) // The GNU C++ compiler defines this
|
||||
|
||||
// When used on a C++ function, we must account for the "this" pointer,
|
||||
// so increase the STRING-INDEX and FIRST-TO_CHECK by one.
|
||||
// See http://docs.freebsd.org/info/gcc/gcc.info.Function_Attributes.html
|
||||
// Then to get format checking during the compile, compile with -Wall or -Wformat
|
||||
#define PRINTF_FUNC __attribute__ ((format (printf, 3, 4)))
|
||||
|
||||
#else
|
||||
#define PRINTF_FUNC // nothing
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/*/** */*
|
||||
* Function Print
|
||||
* formats and writes text to the output stream.
|
||||
*
|
||||
* @param nestLevel The multiple of spaces to preceed the output with.
|
||||
* @param fmt A printf() style format string.
|
||||
* @param ... a variable list of parameters that will get blended into
|
||||
* the output under control of the format string.
|
||||
* @return int - the number of characters output.
|
||||
* @throw IOError, if there is a problem outputting, such as a full disk.
|
||||
*/
|
||||
virtual int PRINTF_FUNC Print( int nestLevel, const char* fmt, ... ) throw( IOError ) = 0;
|
||||
|
||||
/*/** */*
|
||||
* Function GetQuoteChar
|
||||
* performs quote character need determination.
|
||||
* It returns the quote character as a single character string for a given
|
||||
* input wrapee string. If the wrappee does not need to be quoted,
|
||||
* the return value is "" (the null string), such as when there are no
|
||||
* delimiters in the input wrapee string. If you want the quote_char
|
||||
* to be assuredly not "", then pass in "(" as the wrappee.
|
||||
* <p>
|
||||
* Implementations are free to override the default behavior, which is to
|
||||
* call the static function of the same name.
|
||||
|
||||
* @param wrapee A string that might need wrapping on each end.
|
||||
* @return const char* - the quote_char as a single character string, or ""
|
||||
* if the wrapee does not need to be wrapped.
|
||||
*/
|
||||
virtual const char* GetQuoteChar( const char* wrapee ) = 0;
|
||||
|
||||
virtual ~OUTPUTFORMATTER() {}
|
||||
|
||||
/*/** */*
|
||||
* Function GetQuoteChar
|
||||
* performs quote character need determination according to the Specctra DSN
|
||||
* specification.
|
||||
|
||||
* @param wrapee A string that might need wrapping on each end.
|
||||
* @param quote_char A single character C string which provides the current
|
||||
* quote character, should it be needed by the wrapee.
|
||||
*
|
||||
* @return const char* - the quote_char as a single character string, or ""
|
||||
* if the wrapee does not need to be wrapped.
|
||||
*/
|
||||
static const char* GetQuoteChar( const char* wrapee, const char* quote_char );
|
||||
};
|
||||
|
||||
|
||||
/*/** */*
|
||||
* Class STRINGFORMATTER
|
||||
* implements OUTPUTFORMATTER to a memory buffer. After Print()ing the
|
||||
* string is available through GetString()
|
||||
*/
|
||||
class STRINGFORMATTER : public OUTPUTFORMATTER
|
||||
{
|
||||
std::vector<char> buffer;
|
||||
std::string mystring;
|
||||
|
||||
int sprint( const char* fmt, ... );
|
||||
int vprint( const char* fmt, va_list ap );
|
||||
|
||||
public:
|
||||
|
||||
/*/** */*
|
||||
* Constructor STRINGFORMATTER
|
||||
* reserves space in the buffer
|
||||
*/
|
||||
STRINGFORMATTER( int aReserve = 300 ) :
|
||||
buffer( aReserve, '\0' )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*/** */*
|
||||
* Function Clear
|
||||
* clears the buffer and empties the internal string.
|
||||
*/
|
||||
void Clear()
|
||||
{
|
||||
mystring.clear();
|
||||
}
|
||||
|
||||
/*/** */*
|
||||
* Function StripUseless
|
||||
* removes whitespace, '(', and ')' from the mystring.
|
||||
*/
|
||||
void StripUseless();
|
||||
|
||||
|
||||
std::string GetString()
|
||||
{
|
||||
return mystring;
|
||||
}
|
||||
|
||||
|
||||
//-----<OUTPUTFORMATTER>------------------------------------------------
|
||||
int PRINTF_FUNC Print( int nestLevel, const char* fmt, ... ) throw( IOError );
|
||||
const char* GetQuoteChar( const char* wrapee );
|
||||
//-----</OUTPUTFORMATTER>-----------------------------------------------
|
||||
};
|
||||
|
||||
|
||||
#endif // RICHIO_H_
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
# 9. Resources # {#resources}
|
||||
There are plenty of excellent resources on the Internet on C++ coding
|
||||
styles and coding do's and don'ts. Here are a few useful ones. In most
|
||||
cases, the coding styles do not follow the KiCad coding style but there
|
||||
is plenty of other good information here. Besides, most of them have
|
||||
some great humor in them enjoyable to read. Who knows, you might even
|
||||
learn something new.
|
||||
|
||||
- [C++ Coding Standard][cppstandard]
|
||||
- [Linux Kernel Coding Style][kernel]
|
||||
- [C++ Operator Overloading Guidelines][overloading]
|
||||
- [Wikipedia's Programming Style Page][style]
|
||||
|
||||
[cppstandard]:http://www.possibility.com/Cpp/CppCodingStandard.html
|
||||
[kernel]:http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/CodingStyle
|
||||
[overloading]:http://www.cs.caltech.edu/courses/cs11/material/cpp/donnie/cpp-ops.html
|
||||
[style]:http://en.wikipedia.org/wiki/Programming_style
|
||||
@@ -1,398 +0,0 @@
|
||||
# Building KiCad from Source #
|
||||
If you are a user and not a developer, please consider using one of the prebuilt packages
|
||||
of KiCad which can be found at the [download][] page on the [KiCad website][]. Building KiCad
|
||||
from source is not for the faint of heart and is not recommended unless you have reasonable
|
||||
software development experience. This document contains the instructions on how to build KiCad
|
||||
from source on the supported platforms. It is not intended as a guide for installing or building
|
||||
[library dependencies](#library_dependencies). Please consult you platforms documentation for
|
||||
installing packages or the source code when building the library dependencies. Currently the
|
||||
supported platforms are Windows Versions 7-10, just about any version of Linux, and OSX
|
||||
10.7-10.10. You may be able to build KiCad on other platforms but it is not supported. On
|
||||
Windows and Linux the [GNU GCC][] is the only supported compiler and on OSX [Clang][] is the
|
||||
only supported compiler.
|
||||
|
||||
[TOC]
|
||||
|
||||
# Development Tools # {#development_tools}
|
||||
|
||||
Before you begin building KiCad, there are a few tools required in addition to your compiler.
|
||||
Some of these tools are required to build from source and some are optional.
|
||||
|
||||
## CMake Build Configuration Tool ## {#cmake}
|
||||
|
||||
[CMake][] is the build configuration and makefile generation tool used by KiCad. It is required.
|
||||
|
||||
|
||||
## Bazaar Version Control System ## {#bazaar}
|
||||
|
||||
The official source code repository is hosted on [Launchpad][] and requires the [Bazaar][] version
|
||||
control system in order to create a branch of the latest source. Bazaar is not required if you are
|
||||
going to build a stable version of KiCad from a source archive.
|
||||
|
||||
## GIT Version Control System ## {#git}
|
||||
|
||||
If you prefer to use [GIT][] for version control, there is a mirror of the official KiCad
|
||||
repository on [Github][]. GIT is not required if you are going to build a stable version of
|
||||
KiCad from a source archive. Please note that the Github mirror is read only. Do not submit
|
||||
pull requests to Github. Changes should be sent to the KiCad developer's [mailing list][] as
|
||||
an attached patch with [PATCH] at the beginning of the subject.
|
||||
|
||||
## Doxygen Code Documentation Generator ## {#doxygen_section}
|
||||
|
||||
The KiCad source code is documented using [Doxygen][] which parses the KiCad source code files
|
||||
and builds a dependency tree along with the source documentation into HTML. Doxygen is only
|
||||
required if you are going to build the KiCad documentation.
|
||||
|
||||
## SWIG Simplified Wrapper and Interface Generator ## {#swig}
|
||||
|
||||
[SWIG][] is used to generate the Python scripting language extensions for KiCad. SWIG is not
|
||||
required if you are not going to build the KiCad scripting extension.
|
||||
|
||||
|
||||
# Library Dependencies # {#library_dependencies}
|
||||
|
||||
This section includes a list of library dependencies required to build KiCad. It does not
|
||||
include any dependencies of the libraries. Please consult the library's documentation for any
|
||||
additional dependencies. Some of these libraries are optional depending on you build
|
||||
configuration. This is not a guide on how to install the library dependencies using you systems
|
||||
package management tools or how to build the library from source. Consult the appropriate
|
||||
documentation to perform these tasks.
|
||||
|
||||
## wxWidgets Cross Platform GUI Library## {#wxwidgets}
|
||||
|
||||
[wxWidgets][] is the graphical user interface (GUI) library used by KiCad. The current minimum
|
||||
version is 3.0.0. However, 3.0.2 should be used whenever possible as there are some known bugs
|
||||
in prior versions that can cause problems on some platforms. Please note that there are also
|
||||
some platform specific patches that must be applied before building wxWidgets from source. These
|
||||
patches can be found in the [patches folder][] in the KiCad source. These patches are named by
|
||||
the wxWidgets version and platform name they should be applied against. wxWidgets must be built
|
||||
with the --with-opengl option. If you installed the packaged version of wxWidgets on your system,
|
||||
verify that it was built with this option.
|
||||
|
||||
## Boost C++ Libraries ## {#boost}
|
||||
|
||||
The [Boost][] C++ library is required only if you intend to build KiCad with the system installed
|
||||
version of Boost instead of the default internally built version. If you use the system installed
|
||||
version of Boost, version 1.56 or greater is required. Please note there are some platform
|
||||
specific patches required to build a working Boost library. These patches can be found in the
|
||||
[patches folder][] in the KiCad source. These patches are named by the platform name they should
|
||||
be applied against.
|
||||
|
||||
## OpenSSL Secure Socket Layer Library ## {#openssl}
|
||||
|
||||
The [OpenSSL][] library is only required when the KiCad build is configured with the Github plugin
|
||||
enabled. See the [KiCad Build Configuration Options](#build_opts)` section for more information.
|
||||
Please note that KiCad will download and build version 1.0.1e of OpenSSL by default. You should
|
||||
probably use the version of OpenSSL installed on your system as it will most likely be more up to
|
||||
date and contain the latest security fixes.
|
||||
|
||||
## GLEW OpenGL Extension Wrangler Library ## {#glew}
|
||||
|
||||
The [OpenGL Extension Wrangler][GLEW] is an OpenGL helper library used by the KiCad graphics
|
||||
abstraction library [GAL] and is always required to build KiCad.
|
||||
|
||||
## GLUT OpenGL Utility Toolkit Library ## {#glut}
|
||||
|
||||
The [OpenGL Utility Toolkit][GLUT] is an OpenGL helper library used by the KiCad graphics
|
||||
abstraction library [GAL] and is always required to build KiCad.
|
||||
|
||||
## Cairo 2D Graphics Library ## {#cairo}
|
||||
|
||||
The [Cairo][] 2D graphics library is used as a fallback rendering canvas when OpenGL is no
|
||||
available and is always required to build KiCad.
|
||||
|
||||
## Python Programming Language ## {#python}
|
||||
|
||||
The [Python][] programming language is used to provide scripting support to KiCad. It only needs
|
||||
to be install if the [KiCad scripting](#kicad_scripting) build configuration option is enabled.
|
||||
|
||||
## wxPython Library ## {#wxpython}
|
||||
|
||||
The [wxPython][] library is used to provide a scripting console for Pcbnew. It only needs to be
|
||||
installed if the [wxPython scripting](#wxpython_scripting) build configuration option is enabled.
|
||||
When building KiCad with wxPython support, make sure the version of the wxWidgets library and
|
||||
the version of wxPython installed on your system are the same. Mismatched versions have been
|
||||
known to cause runtime issues.
|
||||
|
||||
# KiCad Build Configuration Options # {#build_opts}
|
||||
|
||||
KiCad has many build options that can be configured to build different options depending on
|
||||
the availability of support for each option on a given platform. This section documents
|
||||
these options and their default values.
|
||||
|
||||
## Case Sensitivity ## {#case_sensitive_opt}
|
||||
|
||||
The KICAD_KEEPCASE option allows you to build KiCad so that the string matching for component
|
||||
names is case sensitive of case insensitive. This option is enabled by default.
|
||||
|
||||
## Advanced Graphics Context ## {#graphics_context_opt}
|
||||
|
||||
The USE_WX_GRAPHICS_CONTEXT option replaces wxDC with wxGraphicsContext for graphics rendering.
|
||||
This option is disabled by default. Warning: the is experimental and has not been maintained
|
||||
so use at your own risk.
|
||||
|
||||
## Graphics Context Overlay ## {#overlay_opt}
|
||||
|
||||
The USE_WX_OVERLAY option is used to enable the optional wxOverlay class for graphics rendering
|
||||
on OSX. This is enabled on OSX by default and disabled on all other platforms.
|
||||
|
||||
## Scripting Support ## {#scripting_opt}
|
||||
|
||||
The KICAD_SCRIPTING option is used to enable building the Python scripting support into Pcbnew.
|
||||
This options is disabled by default.
|
||||
|
||||
## Scripting Module Support ## {#scripting_mod_opt}
|
||||
|
||||
The KICAD_SCRIPTING_MODULES option is used to enable building and installing the Python modules
|
||||
supplied by KiCad. This option is disabled by default.
|
||||
|
||||
## wxPython Scripting Support ## {#wxpython_opt}
|
||||
|
||||
The KICAD_SCRIPTING_WXPYTHON option is used to enable building the wxPython interface into
|
||||
Pcbnew including the wxPython console. This option is disabled by default.
|
||||
|
||||
## Build with Static Libraries ## {#static_lib_opt}
|
||||
|
||||
The KICAD_BUILD_STATIC option is used to build KiCad with static libraries. This option is
|
||||
used for OSX builds only and is disabled by default.
|
||||
|
||||
## Build with Dynamic Libraries ## {#dynamic_lib_opt}
|
||||
|
||||
The KICAD_BUILD_DYNAMIC option is used to build KiCad with dynamic libraries. This option is
|
||||
used for OSX only and is disabled by default.
|
||||
|
||||
## Build with System Boost ## {#boost_opt}
|
||||
|
||||
The KICAD_SKIP_BOOST option allow you to use the Boost libraries installed on your system to
|
||||
be used instead of downloading Boost 1.54 and building a custom version specifically for
|
||||
building KiCad. It is high recommended that you enable this option on Linux and use Boost
|
||||
version 1.56 or greater. On other platforms you mileage may vary. This option is disabled
|
||||
by default.
|
||||
|
||||
## OSX Dependency Builder ## {#osx_deps_opt}
|
||||
|
||||
The USE_OSX_DEPS_BUILDER option forces the build configuration to download and build the
|
||||
required dependencies to build KiCad on OSX. This option is not longer maintained and most
|
||||
likely is broken. Use it at your own peril.
|
||||
|
||||
## Github Plugin ## {#github_opt}
|
||||
|
||||
The BUILD_GITHUB_PLUGIN option is used to control if the Github plugin is built. This option is
|
||||
enabled by default.
|
||||
|
||||
# Getting the KiCad Source Code ## {#getting_src}
|
||||
|
||||
There are several ways to get the KiCad source. If you want to build the stable version you
|
||||
can down load the source archive from the [KiCad Launchpad][] developers page. Use tar or some
|
||||
other archive program to extract the source on your system. If you are using tar, use the
|
||||
following command:
|
||||
|
||||
tar -xzf kicad_src_archive.tar.gz
|
||||
|
||||
If you are contributing directly to the KiCad project on Launchpad, you can create a local
|
||||
branch on your machine by using the following command:
|
||||
|
||||
bzr branch lp:repo_to_branch
|
||||
|
||||
If you prefer to use [GIT][] as you version control system, you can clone the KiCad mirror on
|
||||
Github using the following command:
|
||||
|
||||
git clone https://github.com/KiCad/kicad-source-mirror
|
||||
|
||||
Here is a list of source links:
|
||||
|
||||
Stable release archive: https://launchpad.net/kicad/4.0/4.0.0-rc1/+download/kicad-4.0.0-rc1.tar.xz
|
||||
|
||||
Development branch: https://code.launchpad.net/~kicad-product-committers/kicad/product
|
||||
|
||||
Github mirror: https://github.com/KiCad/kicad-source-mirror
|
||||
|
||||
# Building KiCad on Linux # {#build_linux}
|
||||
|
||||
To perform a full build on Linux, run the following commands:
|
||||
|
||||
cd kicad_source_tree
|
||||
mkdir -p build/release
|
||||
mkdir build/debug # Optional for debug build.
|
||||
cd build/release
|
||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
||||
-DKICAD_SCRIPTING=ON \
|
||||
-DKICAD_SCRIPTING_MODULES=ON \
|
||||
-DKICAD_SCRIPTING_WXPYTHON=ON \
|
||||
../../
|
||||
make
|
||||
sudo make install
|
||||
|
||||
If the CMake configuration fails, determine the missing dependencies and install them on your
|
||||
system. By default, CMake sets the install path on Linux to /usr/local. Use the
|
||||
CMAKE_INSTALL_PREFIX option to specify a different install path.
|
||||
|
||||
# Building KiCad on Windows # {#build_windows}
|
||||
|
||||
The preferred Windows build environment is [MSYS2][]. The [MinGW][] build environment is still
|
||||
supported but it is not recommended because the developer is responsible for building *all* of
|
||||
the dependencies from source which is a huge and frustrating undertaking. The [MSYS2][] project
|
||||
provides packages for all of the require dependencies to build KiCad. To setup the [MSYS2][]
|
||||
build environment, depending on your system download and run either the [MSYS2 32-bit Installer][]
|
||||
or the [MSYS2 64-bit Installer][]. After the installer is finished, update to the latest
|
||||
package versions by running the `msys2_shell.bat` file located in the MSYS2 install path and
|
||||
running the command `pacman -Syu`. If the msys2-runtime package is updated, close the shell
|
||||
and run `msys2_shell.bat`.
|
||||
|
||||
## MSYS2 the Easy Way ## {#msys2_easy}
|
||||
|
||||
The easiest way to build KiCad using the [MSYS2][] build environment is to use the KiCad
|
||||
[PKGBUILD][] provided by the MSYS2 project to build package using the head of the KiCad
|
||||
development branch. To build the KiCad package, run the `msys2_shell.bat` file located in the
|
||||
MSYS2 install path and run the following commands:
|
||||
|
||||
pacman -S git
|
||||
mkdir src
|
||||
cd src
|
||||
git clone https://github.com/Alexpux/MINGW-packages
|
||||
cd MinGW-packages/mingw-w64-kicad-git
|
||||
makepkg-mingw -is
|
||||
|
||||
This will download and install all of the build dependencies, clone the KiCad source mirror
|
||||
from Github, create both 32-bit and 64-bit KiCad packages depending on your MSYS setup, and
|
||||
install the newly built KiCad packages. Please note that this build process takes a very
|
||||
long time to build even on a fast system.
|
||||
|
||||
## MSYS2 the Hard Way ## {#msys2_hard}
|
||||
|
||||
If you do not want to create KiCad packages and prefer the traditional `make && make install`
|
||||
method of building KiCad, your task is significantly more involved. For 64 bit builds run
|
||||
the `mingw64_shell.bat` file located in the MSYS2 install path. At the command prompt run the
|
||||
the following commands:
|
||||
|
||||
pacman -S mingw-w64-x86_64-cmake \
|
||||
mingw-w64-x86_64-doxygen \
|
||||
mingw-w64-x86_64-gcc \
|
||||
mingw-w64-x86_64-python2 \
|
||||
mingw-w64-x86_64-pkg-config \
|
||||
mingw-w64-x86_64-swig \
|
||||
mingw-w64-x86_64-boost \
|
||||
mingw-w64-x86_64-cairo \
|
||||
mingw-w64-x86_64-glew \
|
||||
mingw-w64-x86_64-openssl \
|
||||
mingw-w64-x86_64-wxPython \
|
||||
mingw-w64-x86_64-wxWidgets
|
||||
cd kicad-source
|
||||
mkdir -p build/release
|
||||
mkdir build/debug # Optional for debug build.
|
||||
cd build/release
|
||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
||||
-G "MSYS Makefiles" \
|
||||
-DCMAKE_PREFIX_PATH=/mingw64 \
|
||||
-DCMAKE_INSTALL_PREFIX=/mingw64 \
|
||||
-DDEFAULT_INSTALL_PATH=/mingw64 \
|
||||
-DOPENSSL_ROOT_DIR=/mingw64 \
|
||||
-DKICAD_SKIP_BOOST=ON \
|
||||
-DKICAD_SCRIPTING=ON \
|
||||
-DKICAD_SCRIPTING_MODULES=ON \
|
||||
-DKICAD_SCRIPTING_WXPYTHON=ON \
|
||||
../../
|
||||
make install
|
||||
|
||||
# Building KiCad on OSX # {#build_osx}
|
||||
|
||||
Building on OSX is challenging at best. It typically requires building dependency libraries
|
||||
that require patching in order to work correctly. For more information on the complexities of
|
||||
building KiCad on OSX, see the [OSX bundle build scripts][].
|
||||
|
||||
Download the wxPython source and build using the following commands:
|
||||
|
||||
cd path-to-wxwidgets-src
|
||||
patch -p0 < path-to-kicad-src/patches/wxwidgets-3.0.0_macosx.patch
|
||||
patch -p0 < path-to-kicad-src/wxwidgets-3.0.0_macosx_bug_15908.patch
|
||||
patch -p0 < path-to-kicad-src/patches/wxwidgets-3.0.0_macosx_soname.patch
|
||||
patch -p0 < path-to-kicad-src/patches/wxwidgets-3.0.2_macosx_yosemite.patch
|
||||
patch -p0 < path-to-kicad-src/patches/wxwidgets-3.0.0_macosx_scrolledwindow.patch
|
||||
mkdir build
|
||||
cd build
|
||||
export MAC_OS_X_VERSION_MIN_REQUIRED=10.7
|
||||
../configure \
|
||||
--prefix=`pwd`/../wx-bin \
|
||||
--with-opengl \
|
||||
--enable-aui \
|
||||
--enable-utf8 \
|
||||
--enable-html \
|
||||
--enable-stl \
|
||||
--with-libjpeg=builtin \
|
||||
--with-libpng=builtin \
|
||||
--with-regex=builtin \
|
||||
--with-libtiff=builtin \
|
||||
--with-zlib=builtin \
|
||||
--with-expat=builtin \
|
||||
--without-liblzma \
|
||||
--with-macosx-version-min=10.7 \
|
||||
--enable-universal-binary=i386,x86_64 \
|
||||
CC=clang \
|
||||
CXX=clang++
|
||||
|
||||
Build KiCad using the following commands:
|
||||
|
||||
cd kicad-source
|
||||
mkdir -p build/release
|
||||
mkdir build/debug # Optional for debug build.
|
||||
cd build/release
|
||||
cmake -DCMAKE_C_COMPILER=clang \
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 \
|
||||
-DwxWidgets_CONFIG_EXECUTABLE=path-to-wx-install/bin/wx-config \
|
||||
-DKICAD_SCRIPTING=ON \
|
||||
-DKICAD_SCRIPTING_MODULES=ON \
|
||||
-DKICAD_SCRIPTING_WXPYTHON=ON \
|
||||
-DPYTHON_EXECUTABLE=path-to-python-exe/python \
|
||||
-DPYTHON_SITE_PACKAGE_PATH=wx/wx-bin/lib/python2.7/site-packages \
|
||||
-DCMAKE_INSTALL_PREFIX=../bin \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
../../
|
||||
make
|
||||
make install
|
||||
|
||||
# Known Issues # {#known_issues}
|
||||
|
||||
There are some known issues that are platform and/or dependencie specific. This section provides
|
||||
a list of the currently known issues when building KiCad.
|
||||
|
||||
## Boost C++ Library Issues ## {#boost_issue}
|
||||
|
||||
As of version 5 of [GNU GCC][], using the default configuration of downloading, patching, and
|
||||
building of Boost 1.54 will cause the KiCad build to fail. Therefore a newer version of Boost
|
||||
must be used to build KiCad. If your system has Boost 1.56 or greater installed, you job is
|
||||
straight forward. Configure your KiCad build using `-DKICAD_SKIP_BOOST=ON`. If your system
|
||||
does not have Boost 1.56 or greater installed, you will have to download and [build Boost][]
|
||||
from source. If you are building Boost on windows using [MinGW][] you will have to apply the
|
||||
Boost patches in the KiCad source [patch folder][].
|
||||
|
||||
|
||||
[download]: http://kicad-pcb.org/download/
|
||||
[KiCad website]: http://kicad-pcb.org/
|
||||
[KiCad Launchpad]: https://launchpad.net/kicad
|
||||
[GNU GCC]: https://gcc.gnu.org/
|
||||
[Clang]: http://clang.llvm.org/
|
||||
[CMake]: https://cmake.org/
|
||||
[Launchpad]: https://code.launchpad.net/~kicad-product-committers/kicad/product
|
||||
[Bazaar]: http://bazaar.canonical.com/en/
|
||||
[GIT]: https://git-scm.com/
|
||||
[Github]: https://github.com/KiCad/kicad-source-mirror
|
||||
[Doxygen]: http://www.stack.nl/~dimitri/doxygen/
|
||||
[mailing list]: https://launchpad.net/~kicad-developers
|
||||
[SWIG]: http://www.swig.org/
|
||||
[wxWidgets]: http://wxwidgets.org/
|
||||
[patches folder]: http://bazaar.launchpad.net/~kicad-product-committers/kicad/product/files/head:/patches/
|
||||
[Boost]: http://www.boost.org/
|
||||
[OpenSSL]: https://www.openssl.org/
|
||||
[GLEW]: http://glew.sourceforge.net/
|
||||
[GLUT]: https://www.opengl.org/resources/libraries/glut/
|
||||
[Cairo]: http://cairographics.org/
|
||||
[Python]: https://www.python.org/
|
||||
[wxPython]: http://wxpython.org/
|
||||
[MSYS2]: http://msys2.github.io/
|
||||
[MSYS2 32-bit Installer]: http://repo.msys2.org/distrib/i686/msys2-i686-20150916.exe
|
||||
[MSYS2 64-bit Installer]: http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20150916.exe
|
||||
[PKGBUILD]: https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-kicad-git/PKGBUILD
|
||||
[OSX bundle build scripts]:http://bazaar.launchpad.net/~adamwolf/+junk/kicad-mac-packaging/files
|
||||
[MinGW]: http://mingw.org/
|
||||
[build Boost]: http://www.boost.org/doc/libs/1_59_0/more/getting_started/index.html
|
||||
@@ -1,834 +0,0 @@
|
||||
# Road Map #
|
||||
|
||||
This document is the KiCad Developer's road map document. It is a living
|
||||
document that should be maintained as the project progresses. The goal of
|
||||
this document is to provide an overview for developers of where the project
|
||||
is headed to prevent resource conflicts and endless rehashing of previously
|
||||
discussed topics. It is broken into sections for each major component of
|
||||
the KiCad source code and documentation. It defines tasks that developers
|
||||
an use to contribute to the project and provides updated status information.
|
||||
Tasks should define clear objective and avoid vague generalizations so that
|
||||
a new developer can complete the task. It is not a place for developers to
|
||||
add their own personal wish list It should only be updated with approval
|
||||
of the project manager after discussion with the lead developers.
|
||||
|
||||
Each entry in the road map is made up of four sections. The goal should
|
||||
be a brief description of the what the road map entry will accomplish. The
|
||||
task section should be a list of deliverable items that are specific enough
|
||||
hat they can be documented as completed. The dependencies sections is a list
|
||||
of requirements that must be completed before work can begin on any of the
|
||||
tasks. The status section should include a list of completed tasks or marked
|
||||
as complete as when the goal is met.
|
||||
|
||||
[TOC]
|
||||
|
||||
# Project # {#project}
|
||||
This section defines the tasks for the project related goals that are not
|
||||
related to coding or documentation. It is a catch all for issues such as
|
||||
developer and user relations, dissemination of information on websites,
|
||||
policies, etc.
|
||||
|
||||
## Stable Release ## {#stable_release}
|
||||
**Goal:**
|
||||
|
||||
Provide a lightweight stable release mechanism that is robust enough to meet
|
||||
the requirements of Linux packagers and corporate users but avoid the burden
|
||||
of back porting fixes to a maintenance branch to avoid the additional work for
|
||||
developers.
|
||||
|
||||
**Task:**
|
||||
- Devise a process to have some type of reasonably stable release protocol
|
||||
to provide "stable" releases for Linux distribution packagers and corporate
|
||||
users.
|
||||
- Document "stable" release procedure.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- Initial planning stages.
|
||||
|
||||
|
||||
## Website Improvements ## {#website_improvements}
|
||||
**Goal:**
|
||||
|
||||
Make the website at www.kicad-pcb.org as the definitive resource for both
|
||||
users and developers which will provide a single point of reference instead
|
||||
of the many separate websites currently in used.
|
||||
|
||||
**Task:**
|
||||
- Define the content and design of the website.
|
||||
- Implement the new design.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
|
||||
# General # {#general}
|
||||
This section defines the tasks that affect all or most of KiCad or do not
|
||||
fit under as specific part of the code such as the board editor or the
|
||||
schematic editor.
|
||||
|
||||
## Convert to a Single Process Application. ## {#kiway}
|
||||
**Goal:**
|
||||
|
||||
Merge common schematic and board code into to separate dynamic objects to allow
|
||||
Eeschema and Pcbnew to run under a single process.
|
||||
|
||||
**Task:**
|
||||
- Convert the majority core code in Eeschema and Pcbnew into dynamic libraries.
|
||||
- Provide a robust method for communicating between code running under a single
|
||||
process.
|
||||
- Revise the schematic editor and board editor main windows run under a single
|
||||
process instead of multiple stand alone applications.
|
||||
- Design a method for passing information between the dynamic libraries running
|
||||
under the same process.
|
||||
- Remove inter-process communications between Eeschema and Pcbnew.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- Stage 1 code released.
|
||||
- Stage 2 in process.
|
||||
|
||||
## User Interface Modernization ## {#wxaui}
|
||||
**Goal:**
|
||||
|
||||
Give KiCad a more modern user interface with dockable tool bars and windows.
|
||||
Create perspectives to allow users to arrange dockable windows as they prefer.
|
||||
|
||||
**Task:**
|
||||
- Take advantage of the advanced UI features in wxAui such as detaching and
|
||||
hiding.
|
||||
- Study ergonomics of various commercial/proprietary PCB applications (when
|
||||
in doubt about any particular UI solution, check how it has been done in a
|
||||
certain proprietary app that is very popular among OSHW folks and do exactly
|
||||
opposite).
|
||||
- Clean up menu structure. Menus must allow access to all features of the
|
||||
program in a clear and logical way. Currently some functions of Pcbnew are
|
||||
accessible only through tool bars
|
||||
- Redesign dialogs, make sure they are following same style rules.
|
||||
- Check quality of translations. Either fix or remove bad quality translations.
|
||||
- Develop a global shortcut manager that allows the user assign arbitrary
|
||||
shortcuts for any tool or action.
|
||||
|
||||
**Dependencies:**
|
||||
- [wxWidgets 3](#wxwidgets3)
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
|
||||
# Build Tools # {#build_tools}
|
||||
This section covers build tools for both the KiCad source as well as the
|
||||
custom dependency builds required to build KiCad.
|
||||
|
||||
## Create Separate Build Dependency Project ## {#depends_prj}
|
||||
**Goal:**
|
||||
|
||||
Move the library dependencies and their patches into a separate project to
|
||||
developers to build and install them as required instead of requiring them
|
||||
at build time. Give developers the flexibility to build and/or install
|
||||
library dependencies as they see fit. Remove them from the KiCad source code
|
||||
to reduce the build footprint.
|
||||
|
||||
**Task:**
|
||||
- Create a separate project to build all external dependency libraries that are
|
||||
currently build from source (Boost, OpenSSL, etc).
|
||||
- Use CMake to create a package configuration file for each library so the
|
||||
KiCad find package can pull in header paths, library dependencies, compile
|
||||
flags, and link flags to build KiCad.
|
||||
- Use CMake find package to pull external dependencies.
|
||||
- Remove all build from source dependencies for KiCad source code.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- Initial concept discussions.
|
||||
|
||||
## Platform Binary Installers ## {#installers}
|
||||
**Goal:**
|
||||
|
||||
Provide quality installers for all supported platforms.
|
||||
|
||||
**Task:**
|
||||
- Bring OSX installer up to the level of the Window's and Linux installers.
|
||||
- Possible use of CPack to build platform specific installers as long as they
|
||||
are of the same or better quality than the current independent installers.
|
||||
|
||||
**Dependencies**
|
||||
- None
|
||||
|
||||
**Status**
|
||||
- No progress
|
||||
|
||||
|
||||
# Common Library # {#common_lib}
|
||||
This section covers the source code shared between all of the KiCad
|
||||
applications
|
||||
|
||||
## Unified Rendering Framework ## {#unified_rendering}
|
||||
**Goal:**
|
||||
|
||||
Provide a single framework for developing new tools. Port existing tools
|
||||
to the new framework and remove the legacy framework tools.
|
||||
|
||||
**Task:**
|
||||
- Port wxDC to GAL or get Cairo rendering to nearly the performance of the
|
||||
current wxDC rendering so that we have a single framework to develop new
|
||||
tools and we can continue to support systems that don't have a complete
|
||||
OpenGL stack.
|
||||
|
||||
**Dependencies**
|
||||
- [Tool framework](http://www.ohwr.org/projects/cern-kicad/wiki/WorkPackages)
|
||||
|
||||
**Status**
|
||||
- No progress
|
||||
|
||||
## Unified Geometry Library ## {#geometry_lib}
|
||||
**Goal:**
|
||||
|
||||
Select a single geometry library so that all applications share a common
|
||||
base for 2D objects. Remove any redundant geometry libraries and code to
|
||||
clean up code base.
|
||||
|
||||
**Task:**
|
||||
- Select the best geometry library (Boost, etc.) for the task.
|
||||
- Port all legacy geometry code to the selected library.
|
||||
- Remove any unused geometry library code.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- In progress as part of push and shove router.
|
||||
|
||||
## Conversion to wxWidgets 3 ## {#wxwidgets3}
|
||||
**Goal:**
|
||||
|
||||
Stop supporting the version 2 branch of wxWidgets so that newer features
|
||||
provided by version 3 can be utilized.
|
||||
|
||||
**Task:**
|
||||
- Make wxWidgets 3 a build requirement.
|
||||
- Remove all wxWidgets 2 specific code.
|
||||
|
||||
**Dependencies:**
|
||||
- wxWidgets 3 is widely available on Linux distributions.
|
||||
|
||||
**Status:**
|
||||
- Build now requires 3.0.0 or greater.
|
||||
|
||||
## Linux Printing Improvements ## {#linux_print}
|
||||
**Goal:**
|
||||
|
||||
Bring printing on Linux up to par with printing on Windows.
|
||||
|
||||
**Task:**
|
||||
- Resolve Linux printing issues.
|
||||
|
||||
**Dependencies**
|
||||
- [wxWidgets 3](#wxwidgets3)
|
||||
|
||||
**Status**
|
||||
- No progress.
|
||||
|
||||
## Object Properties and Introspection ## {#object_props}
|
||||
**Goal:**
|
||||
|
||||
Provide an object introspection system using properties.
|
||||
|
||||
**Task:**
|
||||
- Select existing or develop property system.
|
||||
- Add definable properties to base objects.
|
||||
- Create introspection framework for manipulating object properties.
|
||||
- Serialization of properties to and from files and/or other I/O structures.
|
||||
- Create tool to edit property name/type/value table.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Dynamic Library Plugin ## {#plugin_base}
|
||||
**Goal:**
|
||||
|
||||
Create a base library plugin for handling external file I/O. This will allow
|
||||
plugins to be provided that are external to the project such as providing solid
|
||||
model file support (STEP, IGES, etc.) using OpenCascade without making it a
|
||||
project dependency.
|
||||
|
||||
**Task:**
|
||||
- Create a plugin to handle dynamically registered plugins for loading and
|
||||
saving file formats.
|
||||
- This object should be flexible enough to be extended for handling all file
|
||||
plugin types including schematic, board, footprint library, component
|
||||
library, etc.
|
||||
- See [blueprint](https://blueprints.launchpad.net/kicad/+spec/pluggable-file-io)
|
||||
on Launchpad for more information.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
|
||||
# KiCad: Application Launcher # {#kicad}
|
||||
This section applies to the source code for the KiCad application launcher.
|
||||
|
||||
|
||||
# Eeschema: Schematic Editor # {#eeschema}
|
||||
This section applies to the source code for the Eeschema schematic editor.
|
||||
|
||||
## Coherent SCHEMATIC Object ## {#sch_object}
|
||||
**Goal:**
|
||||
|
||||
Clean up the code related to the schematic object(s) into a coherent object for
|
||||
managing and manipulating the schematic.
|
||||
|
||||
**Task:**
|
||||
- Move most if not all of the code from SCH_SCREEN to the new SCHEMATIC object.
|
||||
- Add any missing functionality to the SCHEMATIC object.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Hierarchical Sheet Design ## {#hierarchy_fix}
|
||||
**Goal:**
|
||||
|
||||
Create a more robust sheet instance design rather than recreating them on the
|
||||
fly every time sheet information is required.
|
||||
|
||||
**Task:**
|
||||
- Choose a data structure to contain the sheet hierarchy.
|
||||
- Create helper class to manipulate the hierarchy data structure.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Schematic and Component Library Plugin ## {#sch_plugin}
|
||||
**Goal:**
|
||||
Create a plugin manager for loading and saving schematics and component
|
||||
libraries similar to the board plugin manager.
|
||||
|
||||
**Task:**
|
||||
- Design plugin manager for schematics and component libraries.
|
||||
- Port the current schematic and component library file formats to use the
|
||||
plugin.
|
||||
|
||||
**Dependencies:**
|
||||
- [Dynamic library plugin](#plugin_base)
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Graphics Abstraction Layer Conversion ## {#sch_gal}
|
||||
**Goal:**
|
||||
|
||||
Take advantage of advanced graphics rendering in Eeschema.
|
||||
|
||||
**Task:**
|
||||
- Port graphics rendering to GAL.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Port Editing Tools ## {#sch_tool_framework}
|
||||
**Goal:**
|
||||
|
||||
Use standard tool framework across all applications.
|
||||
|
||||
**Task:**
|
||||
- Rewrite editing tools using the new tool framework.
|
||||
|
||||
**Dependencies:**
|
||||
- [GAL port](#sch_gal).
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## S-Expression File Format ## {#sch_sexpr}
|
||||
**Goal:**
|
||||
|
||||
Make schematic file format more readable, add new features, and take advantage
|
||||
of the s-expression capability used in Pcbnew.
|
||||
|
||||
**Task:**
|
||||
- Finalize feature set and file format.
|
||||
- Discuss the possibility of dropping the unit-less proposal temporarily to get
|
||||
the s-expression file format and SWEET library format implemented without
|
||||
completely rewriting Eeschema.
|
||||
- Add new s-expression file format to plugin.
|
||||
|
||||
**Dependencies:**
|
||||
- [Dynamic library plugin](#plugin_base).
|
||||
|
||||
**Status:**
|
||||
- File format document nearly complete.
|
||||
|
||||
## Implement Sweet Component Libraries ## {#sch_sweet}
|
||||
**Goal:**
|
||||
|
||||
Make component library design more robust and feature rich. Use s-expressions
|
||||
to make component library files more readable.
|
||||
|
||||
**Task:**
|
||||
- Use sweet component file format for component libraries.
|
||||
|
||||
**Dependencies:**
|
||||
- [S-expression file format](#sch_sexpr).
|
||||
|
||||
**Status:**
|
||||
- Initial SWEET library written.
|
||||
|
||||
## Component Library Editor Improvements ## {#lib_editor_usability}
|
||||
**Goal:**
|
||||
|
||||
Make editing components with multiple units and/or alternate graphical
|
||||
representations easier.
|
||||
|
||||
**Task:**
|
||||
- Determine usability improvements in the library editor for components with
|
||||
multiple units and/or alternate graphical representations.
|
||||
- Implement said useability improvements.
|
||||
|
||||
**Dependencies:**
|
||||
- None.
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Component and Netlist Attributes ## {#netlist_attributes}
|
||||
**Goal:**
|
||||
Provide a method of passing information to other tools via the net list.
|
||||
|
||||
**Task:**
|
||||
- Add virtual components and attributes to netlist to define properties that
|
||||
can be used by other tools besides the board editor.
|
||||
|
||||
**Dependencies:**
|
||||
- [S-expression schematic file format](#sch_sexpr).
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Net Highlighting ## {#sch_net_highlight}
|
||||
**Goal:**
|
||||
Highlight wires, buses, and junctions when corresponding net in Pcbnew is selected.
|
||||
|
||||
**Task:**
|
||||
- Add communications link to handle net selection from Pcbnew.
|
||||
- Implement highlight algorithm for net objects.
|
||||
- Highlight objects connected to net selected in Pcbnew.
|
||||
|
||||
**Dependencies:**
|
||||
- [GAL port, maybe](#sch_gal).
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
# CvPcb: Footprint Association Tool # {#cvpcb}
|
||||
This section covers the source code of the footprint assignment tool CvPcb.
|
||||
|
||||
## Footprint Assignment Tool ##
|
||||
**Goal:**
|
||||
|
||||
Merge the footprint assignment functionality of CvPcb into Eeschema so
|
||||
footprints can be assigned inside the schematic editor eliminating the need
|
||||
to launch an separate program.
|
||||
|
||||
**Task:**
|
||||
- Merge footprint assignment capability into Pcbnew shared library.
|
||||
- Remove CvPcb as a stand alone tool.
|
||||
- Add functionality to both the schematic and board editors so users can assign
|
||||
footprints as they prefer.
|
||||
|
||||
**Dependencies:**
|
||||
- [Convert to a single process application](#kiway).
|
||||
|
||||
**Status:**
|
||||
- Initial library conversion committed to product branch.
|
||||
|
||||
|
||||
# Pcbnew: Circuit Board Editor # {#pcbnew}
|
||||
This section covers the source code of the board editing application Pcbnew.
|
||||
|
||||
## Tool Framework ## {#pcb_tool_framework}
|
||||
**Goal:**
|
||||
|
||||
Unify all board editing tools under a single framework.
|
||||
|
||||
**Task:**
|
||||
- Complete porting of all board editing tools to new tool framework so they
|
||||
are available in the OpenGL and Cairo canvases.
|
||||
- Remove all duplicate legacy editing tools.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- Initial porting work in progress.
|
||||
|
||||
## Linked Objects ## {#pcb_linked_objects}
|
||||
**Goal:**
|
||||
|
||||
Provide a way to allow external objects such as footprints to be externally
|
||||
linked in the board file so that changes in the footprint are automatically
|
||||
updated. This will all a one to many object relationship which can pave the
|
||||
way for real board modules.
|
||||
|
||||
**Task:**
|
||||
- Add externally and internally linked objects to the file format to allow for
|
||||
footprints and/or other board objects to be shared (one to many relationship)
|
||||
instead of only supporting embedded objects (one to one relationship) that
|
||||
can only be edited in place.
|
||||
|
||||
**Dependencies:**
|
||||
- None.
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Modeling ## {#modeling}
|
||||
**Goal:**
|
||||
|
||||
Provide improved solid modeling support for KiCad including the file formats
|
||||
available in OpenCascade.
|
||||
|
||||
**Task:**
|
||||
- Design plugin architecture to handle loading and saving 3D models.
|
||||
- Back port existing 3D formats (IDF and S3D) to plugin
|
||||
- Add STEP 3D modeling capability.
|
||||
- Add IGES 3D modeling capability.
|
||||
|
||||
**Dependencies:**
|
||||
- [Dynamic library plugin](#plugin_base).
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Push and Shove Router Improvements ## {#ps_router_improvements}
|
||||
**Goal:**
|
||||
Add features such as matched length and microwave tools to the P&S router.
|
||||
|
||||
**Task:**
|
||||
- Determine which features are feasible.
|
||||
- Look at the recently opened FreeRouter code at
|
||||
http://www.freerouting.net/fen/download/file.php?id=146 for inspiration.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- Match trace length work in progress.
|
||||
|
||||
## Layer Improvements ## {#pcb_layers}
|
||||
**Goal:**
|
||||
|
||||
Increase the number of usable technical and user defined layers in Pcbnew.
|
||||
|
||||
**Task:**
|
||||
- Extend the number of copper and mechanical layers.
|
||||
- Develop a type safe flag set template or adapt something already available.
|
||||
- Refactor Pcbnew code to use new flag and remove the 32 layer limitation.
|
||||
- Extend the board file format to handle the additional layers.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- Work complete on 32 copper and 32 technical layers is complete.
|
||||
|
||||
## Pin and Part Swapping ## {#pcb_drc}
|
||||
**Goal:**
|
||||
|
||||
Allow Pcbnew to perform pin and/or part swapping during layout so the user
|
||||
does not have to do it in Eeschema and re-import the net list.
|
||||
|
||||
**Task:**
|
||||
- Provide forward and back annotation between the schematic and board editors.
|
||||
- Define netlist file format changes required to handle pin/part swapping.
|
||||
- Update netlist file formatter and parser to handle file format changes.
|
||||
- Develop a netlist comparison engine that will produce a netlist diff that
|
||||
can be passed between the schematic and board editors.
|
||||
- Create pin/part swap dialog to manipulate swappable pins and parts.
|
||||
- Add support to handle net label back annotation changes.
|
||||
|
||||
**Dependencies:**
|
||||
- [S-expression schematic file format](#sch_sexpr).
|
||||
- [Convert to a single process application](#kiway).
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Intelligent Selection Tool ## {#pcb_selection_tool}
|
||||
**Goal:**
|
||||
|
||||
Make the selection tool easier for the user to determine which object(s) are
|
||||
being selected.
|
||||
|
||||
**Task:**
|
||||
- Determine and define the actual desired behavior.
|
||||
- Improve ambiguous selections when multiple items are under the cursor or in
|
||||
the selection bounding box.
|
||||
|
||||
**Dependencies:**
|
||||
- Tool framework.
|
||||
- Unified geometry library.
|
||||
|
||||
**Status:**
|
||||
- Initial design committed to product branch.
|
||||
|
||||
## Clipboard Support ## {#fp_edit_clipboard}
|
||||
**Goal:**
|
||||
|
||||
Provide clipboard cut and paste for footprints..
|
||||
|
||||
**Task:**
|
||||
- Clipboard cut and paste to and from clipboard of footprints in footprint
|
||||
editor.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Design Rule Check (DRC) Improvements. ## {#drc_improvements}
|
||||
**Goal:**
|
||||
|
||||
Create additional DRC tests for improved error checking.
|
||||
|
||||
**Task:**
|
||||
- Replace geometry code with [unified geometry library](#geometry_lib).
|
||||
- Remove floating point code from clearance calculations to prevent rounding
|
||||
errors.
|
||||
- Add checks for component, silk screen, and mask clearances.
|
||||
- Add checks for keep out zones.
|
||||
- Remove DRC related limitations such as no arc or text on copper layers.
|
||||
- Add option for saving and loading DRC options.
|
||||
|
||||
**Dependencies:**
|
||||
- [Unified geometry library.](#geometry_lib)
|
||||
|
||||
**Progress:**
|
||||
- Planning
|
||||
|
||||
## Segment End Point Snapping. ## {#segment_snapping}
|
||||
**Goal:**
|
||||
|
||||
It is not uncommon for board edge segment end points to inadvertently not
|
||||
be closed causing issues for the 3D viewer and exporting to different file
|
||||
formats due the board outline not being a fully enclosed polygon. This
|
||||
feature would add segment end snapping support to allow the board outline
|
||||
to be fully enclosed. This feature would only need to be supported by the
|
||||
GAL rendering.
|
||||
|
||||
**Tasks**
|
||||
- Mark board edge segment ends with a drag indicator to make it visible to the
|
||||
user that the segment end does not have an endpoint with any other board edge
|
||||
segment.
|
||||
- Allow the user to smap the unconnected segment end to the nearest segment end
|
||||
point.
|
||||
- Automatically connect unconnected segments with and additional segment when
|
||||
opening the 3D viewer or exporting the board to another format. Warn the
|
||||
user that an addition segment has be added and should be verified.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Progress:**
|
||||
- Initial discussion.
|
||||
|
||||
## Keepout Zones. ## {#keepout_zones}
|
||||
**Goal:**
|
||||
|
||||
Add support for keepout zones on boards and footprints.
|
||||
|
||||
**Task:**
|
||||
- Add keepout support to zone classes.
|
||||
- Add keepout zone support to board editor.
|
||||
- Add keepout zone support to library editor.
|
||||
|
||||
**Dependencies:**
|
||||
- [DRC Improvements.](#drc_improvements)
|
||||
|
||||
**Progress:**
|
||||
- Planning
|
||||
|
||||
|
||||
## Gerber File Attributes ## {#gerber_attributes}
|
||||
**Goal:**
|
||||
|
||||
Add file attributes to gerber files for defining layer stacks. See
|
||||
[this](http://www.ucamco.com/files/downloads/file/5/Extending_the_Gerber_Format_with_Attributes.pdf)
|
||||
document and [this](http://www.ucamco.com/files/downloads/file/22/Kick_Starting_a_Revolution_IPC-2581_Meets_Gerber.pdf)
|
||||
document for more information.
|
||||
|
||||
**Task:**
|
||||
- Implement gerber file attributes as an optional setting when plotting gerber
|
||||
files.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Progress:**
|
||||
- Done both in Pcbnew and Gerbview.
|
||||
|
||||
## Net Highlighting ## {#pcb_net_highlight}
|
||||
**Goal:**
|
||||
Highlight rats nest links and/or traces when corresponding net in Eeschema is selected.
|
||||
|
||||
**Task:**
|
||||
- Add communications link to handle net selection from Eeschema.
|
||||
- Implement highlight algorithm for objects connected to the selected net.
|
||||
- Highlight objects connected to net selected in Eeschema
|
||||
|
||||
**Dependencies:**
|
||||
- None.
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
|
||||
# GerbView: Gerber File Viewer # {#gerbview}
|
||||
|
||||
This section covers the source code for the GerbView gerber file viewer.
|
||||
|
||||
## Graphics Abstraction Layer ## {#gerbview_gal}
|
||||
**Goal:**
|
||||
|
||||
Graphics rendering unification.
|
||||
|
||||
**Task:**
|
||||
- Port graphics rendering layer to GAL.
|
||||
|
||||
**Dependencies:**
|
||||
- None.
|
||||
|
||||
**Status**
|
||||
- No progress.
|
||||
|
||||
# Documentation # {#documentation}
|
||||
This section defines the tasks for both the user and developer documentation.
|
||||
|
||||
## Conversion to Markup/down Format ## {#doc_format}
|
||||
**Goal:**
|
||||
|
||||
Make documentation more VCS friendly and separate document content and
|
||||
formatting for more uniform formatting across all user documentation.
|
||||
|
||||
**Task:**
|
||||
- Convert the documentation to a mark up/down language to reduce the VCS
|
||||
footprint, to be able to actually use the VCS to see what changed, and
|
||||
improve the formatting consistency.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- Started with this document.
|
||||
|
||||
## Grammar Check ## {#doc_grammar}
|
||||
**Goal:**
|
||||
|
||||
Improve user documentation readability and make life easier to for translators.
|
||||
|
||||
**Task:**
|
||||
- Review and revise all of the English documentation so that it is update with
|
||||
the current functionality of the code.
|
||||
- Translate the update documentation into other languages.
|
||||
|
||||
**Dependencies:**
|
||||
- None
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Maintenance ## {#doc_maintenance}
|
||||
**Task:**
|
||||
- Keep screen shots current with the source changes.
|
||||
|
||||
**Dependencies:**
|
||||
- None.
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
## Convert Developer Documentation to Markup/down Format ## {#dev_doc_format}
|
||||
**Goal:**
|
||||
|
||||
Improve developers documentation to make life easier for new developers to get
|
||||
involved with the project.
|
||||
|
||||
**Task:**
|
||||
- Convert platform build instructions from plain text to new format to be
|
||||
merged with the developer documentation.
|
||||
- Convert how to contribute to KiCad instructions from plain text to the new
|
||||
format to merged with the developer documentation.
|
||||
|
||||
**Dependencies:**
|
||||
- None.
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
|
||||
|
||||
# Unit Testing # {#unittest}
|
||||
**Goal:**
|
||||
|
||||
Improve the quality of KiCad and ensure changes do no break existing
|
||||
capabilities.
|
||||
|
||||
**Task:**
|
||||
- Explore the possibility of including a C++ unit test framework in addition
|
||||
to the existing Python framework.
|
||||
- Create robust enough test coverage to determine if code changes break any
|
||||
core functionality.
|
||||
|
||||
**Dependencies:**
|
||||
- Completion of the initial release of this document.
|
||||
|
||||
**Status:**
|
||||
- In progress.
|
||||
|
||||
|
||||
# Circuit Simulation # {#simulation}
|
||||
**Goal:**
|
||||
|
||||
Provide quality circuit simulation capabilities similar to commercial products.
|
||||
|
||||
**Task:**
|
||||
- Evaluate and select simulation library (spice, gnucap, qucs, etc).
|
||||
- Evaluate and select plotting library with wxWidgets support.
|
||||
- Confirm current spice netlist export is up to the task and add missing
|
||||
support for simulations.
|
||||
- Use plotting library to handle simulator output in a consistent manor similar
|
||||
to LTSpice.
|
||||
- Develop a tool that allows fine tuning of components on the fly.
|
||||
- Use plugin for the simulation code to allow support of different simulation
|
||||
libraries.
|
||||
- Create a library of simulation components such as voltage source, current
|
||||
source, current probe, etc.
|
||||
|
||||
**Dependencies:**
|
||||
- [Dynamic library plugin](#plugin_base).
|
||||
|
||||
**Status:**
|
||||
- No progress.
|
||||
@@ -1,80 +0,0 @@
|
||||
# Stable Release Policy #
|
||||
|
||||
This document defines the project requirements that must be satisfied in order to create a new
|
||||
stable release of the KiCad project. It is designed to be a reference for developers and user's
|
||||
so that both groups expectations are understood. This document is only to be modified by the
|
||||
project leader or at the request of the project leader. It should be noted that this policy is
|
||||
not cast in stone and at any time in the future, should the decision be made by the project at
|
||||
large that it can be revised to suit the ongoing needs of the project and it's users.
|
||||
|
||||
The current release policy is to support the concept of a lightweight stable release. The goal
|
||||
is to provide regular stable releases of KiCad without the burden of trying to provide long term
|
||||
support of a full stable release branch. Therefore, once a new release is created, the only
|
||||
patches that will be made to the stable release branch will be for bugs that cause KiCad to crash
|
||||
or possible corruption and/or loss of data. No other changes from the current development branch
|
||||
will be backported to the last stable release by the project.
|
||||
|
||||
[TOC]
|
||||
|
||||
# Stable Release Interval # {#stable_release_interval}
|
||||
|
||||
The criteria required for new stable releases is based on the developers decision that enough
|
||||
new features and/or improvements have been made to the current development branch to justify a
|
||||
new stable release. This decision is completely discretionary and can be proposed at any time
|
||||
by any developer on the KiCad developers mailing list. Once a request for a new stable release
|
||||
is made, a consensus must be reached by the primary developers to proceed with the release with
|
||||
the final decision and announcement being made by the project leader.
|
||||
|
||||
|
||||
# Feature Freeze # {#feature_freeze}
|
||||
|
||||
Once the announcement has been made that a new stable release is in effect, the current
|
||||
development branch is frozen. No new features or potentially disruptive core code changes can
|
||||
be committed with out approval of the primary developers and/or the project leader.
|
||||
|
||||
# Bug Fixing # {#bug_fixing}
|
||||
|
||||
After the development branch has been frozen, work will continue to fix bugs reported against
|
||||
the development branch. Bugs will be prioritized based on their severity. All bugs that cause
|
||||
KiCad to crash or cause loss and/or corruption of data must be fixed. All other bugs must be
|
||||
evaluated to see if they fit into the scope of the stable release. All bugs that fit into the
|
||||
scope of the stable release will be tagged and must be fixed. All other bugs will be tagged for
|
||||
the next stable release and fixed when it is convenient. Once the stable release is officially
|
||||
announced, the bugs tagged as "Fix Committed" that are relevant to the stable release will be
|
||||
changed to "Fix Released".
|
||||
|
||||
# User Documentation # {#user_docs}
|
||||
|
||||
The user documentation will be updated to reflect the current changes in the code. This includes
|
||||
all new features, any behavioral changes to existing features, and all screen shots as required.
|
||||
Completion of the English version of the user documentation is minimum that is required for
|
||||
release. Foreign language translations can be released at any time as the become available.
|
||||
|
||||
# Stable Release Series Branch # {#stable_branch}
|
||||
|
||||
Once the primary developers decide that the stable release criteria has been met, a new series
|
||||
branch will be created from the current product branch on Launchpad. At this time the freeze
|
||||
will be removed from the product branch and normal development can resume. The stable release
|
||||
version will be incremented from the previous stable release and tagged in the stable release
|
||||
branch build configuration.
|
||||
|
||||
# System Installers # {#system_installers}
|
||||
|
||||
To proved the best user experience for platforms that do not have package managers, full system
|
||||
installers will be provided. Currently this only pertains to Windows and OSX. The full system
|
||||
installers will include all KiCad binary files, all binary library dependencies, user
|
||||
documentation, component libraries, 3D model libraries, demo project files, and project template
|
||||
files. Optionally, the footprint libraries can be included for users who prefer not us use the
|
||||
GitHub plugin.
|
||||
|
||||
# Source Archives # {#source_archives}
|
||||
|
||||
To provide a convenient method for system packagers to build KiCad from known stable sources,
|
||||
source archives in the most common formats along with the resulting md5sum checksum will be
|
||||
added to either the KiCad developer's site on Launchpad or the main website at www.kicad-pcb.org.
|
||||
|
||||
# Stable Release Announcement # {#announcement}
|
||||
|
||||
Once all of the above tasks have been completed, the project leader will post an announcement on
|
||||
the developers mailing list and the Launchpad site. This announcement should include a list of
|
||||
new features and improvements made since the previous stable release.
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
pandoc -f markdown_mmd -t html interactive_router.mmd > interactive_router.html
|
||||
pandoc -f markdown_mmd -t latex interactive_router.mmd > tmp.tex
|
||||
pdflatex interactive_router.tex
|
||||
@@ -1,73 +0,0 @@
|
||||
# Interactive Router #
|
||||
|
||||
The Interactive Router lets you quickly and efficient route your PCBs by shoving off or walking around items on the PCB that collide with the trace you are currently drawing.
|
||||
|
||||
Following modes are supported:
|
||||
|
||||
- **Shove**, attempting to push and shove all items colliding with the currently routed track.
|
||||
- **Walk around**, trying to avoid obstacles by hugging/walking around them.
|
||||
- **Highlight collisions** which highlights all violating objects with a nice, shiny green color and shows violating clearance regions.
|
||||
|
||||
|
||||
## Setting up ##
|
||||
|
||||
Before using the Interactive Router, please set up these two things:
|
||||
- Clearance settings. To set the clearances, open the *Design Rules* dialog and make sure at least the default clearance
|
||||
value looks sensible.
|
||||
|
||||
- Enable OpenGL mode by selecting *View->Switch canvas to OpenGL* menu option or pressing **F11**.
|
||||
|
||||

|
||||
|
||||
## Laying out tracks ##
|
||||
|
||||
To activate the router tool press the *Interactive Router* button  or the **X** key.
|
||||
The cursor will turn into a cross and the tool name, will appear in the status bar.
|
||||
|
||||
To start a track, click on any item (a pad, track or a via) or press the **X** key again hovering the mouse over that item.
|
||||
The new track will use the net of the starting item. Clicking or pressing **X** on empty PCB space starts a track with no net assigned.
|
||||
|
||||
Move the mouse to define shape of the track. The router will try to follow mouse trail, hugging unmovable obstacles
|
||||
(such as pads) and shoving colliding traces/vias, depending on the mode. Retreating mouse cursor will cause the shoved items to spring back
|
||||
to their former locations.
|
||||
|
||||
Clicking on a pad/track/via in the same net finishes routing. Clicking in empty space fixes the segments routed so far and continues routing the trace.
|
||||
|
||||
In order to stop routing and undo all changes (shoved items, etc.), simply press **Esc**.
|
||||
|
||||
Pressing **V** or selecting *Place Through Via* from the context menu while routing a track attaches a via at the end of the trace being routed.
|
||||
Pressing **V** again disables via placement. Clicking in any spot establishes the via and continues routing.
|
||||
|
||||
Pressing **/** or selecting *Switch Track Posture* from the context menu toggles the direction of the initial track segment between straight or diagonal.
|
||||
|
||||
**Note**: By default, the router snaps to centers/axes of the items. Snapping can be disabled by holding **Shift** while routing or selecting items.
|
||||
|
||||
## Setting track widths and via sizes ##
|
||||
|
||||
There are several ways to pre-select a track width/via size or to change it during routing:
|
||||
- Use standard Kicad shortcuts.
|
||||
- Press **W** or select *Custom Track Width* from the context menu to type in a custom width/via size.
|
||||
- Pick a predefined width from the *Select Track Width* sub-menu of the context menu.
|
||||
- Select *Use the starting track width* in the *Select Track Width* menu to pick the width from the start item (or the traces already connected to it).
|
||||
|
||||
## Dragging ##
|
||||
|
||||
The router can drag track segments, corners and vias. To drag an item, click on it with **Ctrl** key pressed, hover the mouse and press **G** or select *Drag Track/Via* from the context menu.
|
||||
Finish dragging by clicking again or abort by pressing *Esc*.
|
||||
|
||||
## Options ##
|
||||
|
||||
The router behavior be configured by pressing *E* or selecting *Routing Options* from the context menu. It opens a window like the one below:
|
||||
|
||||

|
||||
|
||||
The options are:
|
||||
|
||||
- **Mode** - select how the router handles DRC violation (shoving, walking around, etc.)
|
||||
- **Shove vias** - when disabled, vias are treated as un-movable objects and hugged instead of shoved.
|
||||
- **Jump over obstacles** - when enabled, the router tries to move colliding traces behind solid obstacles (e.g. pads) instead of "reflecting" back the collision
|
||||
- **Remove redundant tracks** - removes loops while routing (e.g. if the new track ensures same connectivity as an already existing one, the old track is removed). Loop removal works locally (only between the start and end of the currently routed trace).
|
||||
- **Automatic neckdown** - when enabled, the router tries to break out pads/vias in a clean way, avoiding acute angles and jagged breakout traces.
|
||||
- **Smooth dragged segments** - when enabled, the router attempts to merge several jagged segments into a single straight one (dragging mode).
|
||||
- **Allow DRC violations** (*Highlight collisions* mode only) - allows to establish a track even if is violating the DRC rules.
|
||||
- **Optimizer effort** - defines how much time the router shall spend optimizing the routed/shoved traces. More effort means cleaner routing (but slower), less effort means faster routing but somewhat jagged traces.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 43 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 547 B |
Binary file not shown.
|
Before Width: | Height: | Size: 37 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 58 KiB |
@@ -0,0 +1,11 @@
|
||||
So, finally we've got an integrated interactive, push-and-sometimes-shove router, although with a very limited user interface:
|
||||
|
||||
- Edit->Interactive router launches the tool,
|
||||
- while routing: 'V' key places a via,
|
||||
- '+' and '-' keys cycle through available layers,
|
||||
- '/' key switches track posture.
|
||||
|
||||
Via/track dimensions are taken from the netclasses.
|
||||
There are no other options available for the time being - promise to add them soon :)
|
||||
|
||||
Tom
|
||||
@@ -1,20 +1,59 @@
|
||||
--== notes about wxWidgets problems ==--
|
||||
Last Revised: 02-jul-2015
|
||||
Last Revised: 28-Feb-2010
|
||||
|
||||
Kicad needs wxWidgets, the multi platform G.U.I toolkit.
|
||||
|
||||
use *only* wxWidgets
|
||||
>= 3.0.1 On Windows
|
||||
>= 3.0.2 on Linux (prevision versions have bugs which crash Kicad)
|
||||
>= 3.0.2 on OSX (which need patches: see patches/wxwidgets-3.0.0_macosx_xxx)
|
||||
Kicad needs wxWidgets, the multi platform G.U.I.
|
||||
Known problems:
|
||||
wxMSW:
|
||||
*DO NOT* use wxMSW.2.8.1
|
||||
in fact: use wxWidgets >= 2.9.3
|
||||
|
||||
Known bug on Windows:
|
||||
Postscript printers print tracks like thin line.
|
||||
It happens only for PS drivers, and PDF printer.
|
||||
Other drivers (PCL for instance) work fine,
|
||||
so it is unlikely a bug inside Kicad/wxWidgets
|
||||
wxGTK
|
||||
Use wxWidgets 2.8.10 or later
|
||||
|
||||
Linux and macOSX
|
||||
- Printing problems (all version).
|
||||
Note old versions of wxWidgets give *very ugly results*
|
||||
(poor printing resolution set to 72ppi)
|
||||
|
||||
So use a very recent version (>= 2.8.10 (that also solve other bugs)
|
||||
|
||||
wxWidgets patch:
|
||||
|
||||
|
||||
wxMSW, version 2.8.x
|
||||
Some zoom values smaller than 3 to 5 create artifacts on screen, mainly values < 1.
|
||||
(corresponding to draw scale factor > 1 )
|
||||
|
||||
See http://trac.wxwidgets.org/ticket/9554 (and 11669).
|
||||
|
||||
This is fixed in version 2.9.3
|
||||
|
||||
|
||||
wxWidgets 2.9.1 (all platforms)
|
||||
Has a problem when using the built in string to double conversion:
|
||||
In countries using a comm instead of a point as floating number separator
|
||||
after calling this conversion function, the comma is changed in point.
|
||||
(Happens after reading a parameter stored in a wxConfig structure, if this
|
||||
parameter is a double)
|
||||
Workaround:
|
||||
Use a version >= 2.9.3
|
||||
|
||||
|
||||
*************************************************************************************
|
||||
wxGTK version: All
|
||||
*************************************************************************************
|
||||
Patch for printing wide traces that were shown with missing rounded end caps.
|
||||
Without this patch, printing boards and schematics under Linux, and perhaps OSX
|
||||
gives ugly drawings.
|
||||
|
||||
wxGTK-2.8.11/src/generic/dcpsg.cpp
|
||||
search for:
|
||||
line 1636
|
||||
PsPrint( "%%EndProlog\n" );
|
||||
|
||||
Add after this line:
|
||||
PsPrint("%%BeginSetup\n");
|
||||
PsPrint( "1 setlinecap\n" );
|
||||
PsPrint("%%EndSetup\n");
|
||||
|
||||
On 3.0.2 Window version 64 bits:
|
||||
The mirror mode gives a blank sheet.
|
||||
This is a bug in wxWidgets 3.0.2
|
||||
wxWidgets 3.0.2 must be patched (see patches/wxWidgets-3.0.2-msw-dc-orientation-fix.patch) and rebuilt.
|
||||
|
||||
@@ -324,6 +324,22 @@ INLINE_SIMPLE_STRUCTS = NO
|
||||
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
|
||||
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
|
||||
# determine which symbols to keep in memory and which to flush to disk.
|
||||
# When the cache is full, less often used symbols will be written to disk.
|
||||
# For small to medium size projects (<1000 input files) the default value is
|
||||
# probably good enough. For larger projects a too small cache size can cause
|
||||
# doxygen to be busy swapping symbols to and from disk most of the time
|
||||
# causing a significant performance penalty.
|
||||
# If the system has enough physical memory increasing the cache will improve the
|
||||
# performance by keeping more symbols in memory. Note that the value works on
|
||||
# a logarithmic scale so increasing the size by one will roughly double the
|
||||
# memory usage. The cache size is given by this formula:
|
||||
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
|
||||
# corresponding to a cache size of 2^16 = 65536 symbols.
|
||||
|
||||
SYMBOL_CACHE_SIZE = 0
|
||||
|
||||
# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
|
||||
# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
|
||||
# their name and scope. Since this can be an expensive process and often the
|
||||
@@ -333,7 +349,7 @@ TYPEDEF_HIDES_STRUCT = NO
|
||||
# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
|
||||
# corresponding to a cache size of 2^16 = 65536 symbols.
|
||||
|
||||
LOOKUP_CACHE_SIZE = 6
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
@@ -645,11 +661,7 @@ WARN_LOGFILE =
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = Documentation/development/coding-style-policy.md \
|
||||
Documentation/development/stable-release-policy.md \
|
||||
Documentation/development/road-map.md \
|
||||
Documentation/development/compiling.md \
|
||||
kicad \
|
||||
INPUT = kicad \
|
||||
pcbnew \
|
||||
cvpcb \
|
||||
eeschema \
|
||||
@@ -692,7 +704,7 @@ RECURSIVE = YES
|
||||
# Note that relative paths are relative to the directory from which doxygen is
|
||||
# run.
|
||||
|
||||
EXCLUDE = polygon/clipper.cpp
|
||||
EXCLUDE = include/boost
|
||||
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||
@@ -1213,7 +1225,7 @@ MATHJAX_EXTENSIONS =
|
||||
# typically be disabled. For large projects the javascript based search engine
|
||||
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
|
||||
|
||||
SEARCHENGINE = YES
|
||||
SEARCHENGINE = NO
|
||||
|
||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||
# implemented using a PHP enabled web server instead of at the web client
|
||||
@@ -1410,6 +1422,18 @@ GENERATE_XML = NO
|
||||
|
||||
XML_OUTPUT = xml
|
||||
|
||||
# The XML_SCHEMA tag can be used to specify an XML schema,
|
||||
# which can be used by a validating XML parser to check the
|
||||
# syntax of the XML files.
|
||||
|
||||
XML_SCHEMA =
|
||||
|
||||
# The XML_DTD tag can be used to specify an XML DTD,
|
||||
# which can be used by a validating XML parser to check the
|
||||
# syntax of the XML files.
|
||||
|
||||
XML_DTD =
|
||||
|
||||
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
|
||||
# dump the program listings (including syntax highlighting
|
||||
# and cross-referencing information) to the XML output. Note that
|
||||
|
||||
@@ -11,40 +11,32 @@ Contribute to KiCad (under Linux)
|
||||
2) initialize Bazaar:
|
||||
bzr whoami "John Doe <john.doe@gmail.com>"
|
||||
|
||||
3) get latest KiCad source tree:
|
||||
3) get LATEST KiCad source tree and name it, for instance, "kicad_john":
|
||||
cd ~/
|
||||
bzr branch lp:kicad kicad.bzr
|
||||
bzr branch lp:kicad kicad_john
|
||||
|
||||
this should leave you with the folder kicad.bzr
|
||||
4) Read coding_style_policy.pdf, in <kicad_sources>/Documentation,
|
||||
and other docs.
|
||||
|
||||
4) Read coding_style_policy.pdf, in kicad.bzr/Documentation,
|
||||
and other docs.
|
||||
|
||||
5) create a local (branch) copy of the KiCad project
|
||||
bzr branch ./kicad.bzr ./kicad.my_contrib
|
||||
|
||||
6) Modify/add source code in
|
||||
cd kicad.my_contrib
|
||||
5) Modify/add source code.
|
||||
cd kicad_john
|
||||
gedit .......
|
||||
if you need to create and add the file foo.cpp do so and:
|
||||
bzr add foo.cpp
|
||||
if you need to delete files:
|
||||
bzr rm foo.cpp
|
||||
|
||||
7) Compile:
|
||||
cd kicad.my_contrib
|
||||
6) Compile:
|
||||
cd kicad_john
|
||||
mkdir build; cd build
|
||||
cmake ../ -DCMAKE_BUILD_TYPE=Debug
|
||||
to build a debug version
|
||||
or
|
||||
to build a debug version
|
||||
or
|
||||
cmake ../ -DCMAKE_BUILD_TYPE=Release
|
||||
to build a release version
|
||||
make -j8
|
||||
to build a release version
|
||||
make
|
||||
|
||||
8) Repeat step 6 and 7 until satisfied.
|
||||
7) Repeat step 5 and 6 until satisfied.
|
||||
|
||||
9) Create a patch file:
|
||||
cd kicad.my_contrib
|
||||
8) Create a patch:
|
||||
in kicad_john:
|
||||
if some files are added: bzr add [FILE...]
|
||||
bzr diff > my_changes.patch
|
||||
|
||||
9) Send the patch file "my_changes.patch" to the KiCad developers mailing list.
|
||||
+87
-38
@@ -24,43 +24,87 @@ Installation from binary packages
|
||||
Installation from binary packages for Windows
|
||||
---------------------------------------------
|
||||
|
||||
The KiCad binary archive can be installed anywhere on the system that as long as the user
|
||||
has write privileges.
|
||||
KiCad can be installed in 'C:\kicad', 'D:\kicad', 'C:\Program files\kicad',
|
||||
'D:\Program files\kicad'.
|
||||
|
||||
You can create a shortcut to '${prefix}\bin\kicad.exe' where ${prefix} is the install path.
|
||||
For example, for an installation in the folder 'C:\kicad', unzip KiCad
|
||||
packages:
|
||||
|
||||
kicad-{version}.zip
|
||||
kicad-doc-{version}.zip
|
||||
kicad-library-{version}.zip
|
||||
|
||||
to the folder 'C:\kicad'.
|
||||
|
||||
The main program is the project manager (kicad.exe) and from it you can run
|
||||
the other programs (schematic editor - eeschema, pcb editor - pcbnew,
|
||||
utilities: cvpcb and gerbview).
|
||||
|
||||
You can create a shortcut to 'C:\kicad\bin\kicad.exe'.
|
||||
|
||||
|
||||
Installation from binary packages for Linux
|
||||
-------------------------------------------
|
||||
|
||||
KiCad can be installed in '/usr' or '/usr/local'. You must have "root" access for installation.
|
||||
KiCad can be installed in '/usr' or '/usr/local'.
|
||||
|
||||
cd /
|
||||
tar -xjf kicad-{version}.tbz2
|
||||
tar -xjf kicad-doc-{version}.tbz2
|
||||
tar -xjf kicad-library-{version}.tbz2
|
||||
You must have "root" access for installation.
|
||||
|
||||
The main program is '/usr/bin/kicad'.
|
||||
cd /
|
||||
tar -xjf kicad-{version}.tbz2
|
||||
tar -xjf kicad-doc-{version}.tbz2
|
||||
tar -xjf kicad-library-{version}.tbz2
|
||||
|
||||
The main program is '/usr/bin/kicad'.
|
||||
|
||||
|
||||
Linux and Windows KiCad install tree
|
||||
-------------------------------------
|
||||
Windows KiCad tree
|
||||
------------------
|
||||
|
||||
${prefix}/bin - Binaries (executable files).
|
||||
${prefix}/share/doc/kicad/ - Various documentation.
|
||||
${prefix}/share/doc/kicad/help - Interactive help.
|
||||
${prefix}/share/kicad/demos - Sample schematics and printed boards.
|
||||
${prefix}/share/kicad/internat - Dictionaries for interface localization.
|
||||
${prefix}/share/kicad/library - Interface localization files.
|
||||
${prefix}/share/kicad/modules - Module libraries for printed boards.
|
||||
${prefix}/share/kicad/modules/packages3d - 3D component models (.wrl and .wings format).
|
||||
kicad/bin - Binaries (executable files).
|
||||
kicad/doc - Various documentation.
|
||||
kicad/doc/help - Interactive help.
|
||||
kicad/share/demos - Sample schematics and printed boards.
|
||||
kicad/share/internat - Interface localization files.
|
||||
kicad/share/library - Libraries for schematic.
|
||||
kicad/share/modules - Module libraries for printed boards.
|
||||
kicad/share/modules/packages3d - 3D component models (.wrl and .wings format).
|
||||
|
||||
KiCad searches for the libraries, templates, 3D models, etc. bin/../share.
|
||||
Files '*.mod' are libraries, and files '*.brd' are printed boards you can
|
||||
view with pcbnew.
|
||||
Files *.brd show the existing modules (and 3D shapes) in libraries.
|
||||
|
||||
|
||||
Linux KiCad tree
|
||||
----------------
|
||||
KiCad can use the Windows tree or the below tree.
|
||||
When Kicad is coming from Linux distribution, the tree is:
|
||||
|
||||
/usr/bin - Binaries (executable files).
|
||||
/usr/share/doc/kicad/ - Various documentation.
|
||||
/usr/share/doc/kicad/help - Interactive help.
|
||||
/usr/share/kicad/demos - Sample schematics and printed boards.
|
||||
/usr/share/kicad/internat - Dictionaries for interface localization.
|
||||
/usr/share/kicad/library - Interface localization files.
|
||||
/usr/share/kicad/modules - Module libraries for printed boards.
|
||||
/usr/share/kicad/modules/packages3d - 3D component models (.wrl and .wings format).
|
||||
|
||||
if KiCad does not found its files in usr/share, the search is made in
|
||||
/usr/local/kicad
|
||||
and kicad uses the same tree as the Windows KiCad tree above
|
||||
|
||||
*** When KiCad comes from .tgz archive from http://iut-tice.ujf-grenoble.fr/cao/,
|
||||
it must me installed in /usr/local and uses the Windows tree ***.
|
||||
|
||||
|
||||
Files '*.mod' are the libraries, and files '*.brd' are printed boards you can
|
||||
view with pcbnew.
|
||||
Files *.brd show the existing modules (and 3D shapes) in libraries.
|
||||
|
||||
Warning:
|
||||
Do not change the KiCad tree, or the location of binary files. Otherwise
|
||||
KiCad may not be able to find some or all of its required files.
|
||||
|
||||
Do not change the KiCad tree, or the location of binary files,
|
||||
else KiCad will not be able to find its required files (configuration,
|
||||
libraries, etc.).
|
||||
|
||||
Mac OS X KiCad tree
|
||||
-------------------
|
||||
@@ -78,35 +122,35 @@ User files can be the same as the system wide files but only inside the users ho
|
||||
$HOME/Library/Application Support/kicad
|
||||
|
||||
Warning:
|
||||
These paths are hardcoded into KiCad, if you put them somewhere else KiCad will not find
|
||||
them when a new project is created.
|
||||
These paths are hardcoded into KiCad, if you put them somewhere else KiCad will not find them when a new
|
||||
project is created.
|
||||
|
||||
Installation from source code
|
||||
-----------------------------
|
||||
|
||||
Some dependencies must be satisfied for the correct installation of KiCad:
|
||||
under Linux:
|
||||
wxWidgets >= 2.8.11 http://www.wxwidgets.org/
|
||||
(needs to be compiled with unicode support)
|
||||
under Windows:MacOSX
|
||||
wxWidgets >= 2.9.4 http://www.wxwidgets.org/
|
||||
|
||||
wxWidgets >= 3.0.0 http://www.wxwidgets.org/
|
||||
|
||||
CMake >= 2.8.4 http://www.cmake.org/
|
||||
|
||||
CMake >= 2.8.1 http://www.cmake.org/
|
||||
Boost C++ Libraries:
|
||||
files used by kicad are autmatically downloaded and patched if needed
|
||||
from boost site ( http://www.boost.org/ )
|
||||
|
||||
OpenGL
|
||||
Linux: Mesa 3D Graphics Library http://www.mesa3d.org/
|
||||
Windows: built-in
|
||||
|
||||
Zlib Compression Library http://www.zlib.net/
|
||||
|
||||
In source-tree-build are mostly unwanted, so make a subdir called "build" and
|
||||
In source-tree-build are mostly unwanted, so make a subdir called "build" and
|
||||
change to it.
|
||||
|
||||
Call cmake with the path to KiCad. E.g., when your build-folder is "build"
|
||||
Call cmake with the path to KiCad. E.g., when your build-folder is "build"
|
||||
within source-tree, type "cmake ../".
|
||||
|
||||
Now your system get checked if it is able compiling KiCad and cmake generates
|
||||
Now your system get checked if it is able compiling KiCad and cmake generates
|
||||
the Makefiles.
|
||||
|
||||
After calling cmake just type "make" and build begins.
|
||||
@@ -126,9 +170,6 @@ build directory.
|
||||
Important parameters to cmake
|
||||
-----------------------------
|
||||
|
||||
See Documentation/compiling/build-config.txt for a list of all CMake options
|
||||
available when compiling KiCad.
|
||||
|
||||
-DCMAKE_BUILD_TYPE=<buildtype>
|
||||
<buildtype> may current one of "Debug" and "Release".
|
||||
|
||||
@@ -141,6 +182,14 @@ Required for Windows platform.
|
||||
-DwxWidgets_USE_DEBUG=ON
|
||||
Can be used only with -DCMAKE_BUILD_TYPE=Debug
|
||||
|
||||
-DwxWidgets_USE_STATIC=ON
|
||||
For building statically linked executables. Can be used only if wxWidgets
|
||||
configured and builded with "--enable-monolithic --disable-shared" parameters.
|
||||
|
||||
-DwxWidgets_USE_STATIC=OFF
|
||||
For building dinamically linked executables. Can be used only if wxWidgets
|
||||
configured and builded with "--disable-monolithic --enable-shared" parameters.
|
||||
|
||||
-DKICAD_KEEPCASE=ON
|
||||
Build the KiCad with no component name conversion to uppercase (if you want your
|
||||
ADuC.../Si.../bq... components named as just so).
|
||||
@@ -155,7 +204,7 @@ When more output is wanted use this cmake parameter or call "make VERBOSE=1".
|
||||
Extra CFLAGS and linker flags
|
||||
-----------------------------
|
||||
|
||||
If you require extra flags for compiler and linker you may give them via
|
||||
If you require extra flags for compiler and linker you may give them via
|
||||
environment variables
|
||||
"CXXFLAGS" (c++ compiler)
|
||||
"LDFLAGS" (for linker)
|
||||
|
||||
@@ -60,17 +60,9 @@ PCBNew
|
||||
*) Paste (module ...) from clipboard into module editor.
|
||||
|
||||
|
||||
|
||||
|
||||
Dick's Final TODO List:
|
||||
======================
|
||||
*) Milestone B of Modular KiCad Blueprint:
|
||||
* Put SEARCH_STACK::LastVisitedPath() out of its misery.
|
||||
* Combine CVPCB into PCBNEW.
|
||||
|
||||
*) Milestone C of Modular KiCad Blueprint
|
||||
* SWIG class KIWAY, PROJECT, and KIWAY_MGR and fill out KIWAY_MGR as needed.
|
||||
* Implement PROJECT::Substitute().
|
||||
* Other stuff in blueprint milestone.
|
||||
|
||||
*) Get licensing cleaned up.
|
||||
*) Get licensing cleaned up.
|
||||
*) DLL-ization of pcbnew & eeschema
|
||||
http://www.eevblog.com/forum/open-source-kicad-geda/seriously-irritated-with-the-library-editor!/
|
||||
https://blueprints.launchpad.net/kicad/+spec/modular-kicad
|
||||
|
||||
@@ -1,90 +1,54 @@
|
||||
|
||||
include_directories( BEFORE ${INC_BEFORE} )
|
||||
include_directories(BEFORE ${INC_BEFORE})
|
||||
include_directories(
|
||||
../potrace
|
||||
../polygon/kbool/include
|
||||
../common
|
||||
../polygon
|
||||
${INC_AFTER}
|
||||
)
|
||||
|
||||
set( BITMAP2COMPONENT_SRCS
|
||||
../common/single_top.cpp
|
||||
set(BITMAP2COMPONENT_SRCS
|
||||
bitmap2component.cpp
|
||||
bitmap2cmp_gui_base
|
||||
bitmap2cmp_gui
|
||||
)
|
||||
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_BM2CMP"
|
||||
)
|
||||
set_source_files_properties( bitmap2cmp_gui.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "COMPILING_DLL"
|
||||
)
|
||||
if(WIN32)
|
||||
if(MINGW)
|
||||
# BITMAP2COMPONENT_RESOURCES variable is set by the macro.
|
||||
mingw_resource_compiler(bitmap2component)
|
||||
else(MINGW)
|
||||
set(BITMAP2COMPONENT_RESOURCES bitmap2component.rc)
|
||||
endif(MINGW)
|
||||
endif(WIN32)
|
||||
|
||||
if( MINGW )
|
||||
# BITMAP2COMPONENT_RESOURCES variable is set by the macro.
|
||||
mingw_resource_compiler( bitmap2component )
|
||||
else()
|
||||
set( BITMAP2COMPONENT_RESOURCES bitmap2component.rc )
|
||||
endif()
|
||||
|
||||
if( APPLE )
|
||||
# setup bundle
|
||||
set( BITMAP2COMPONENT_RESOURCES bitmap2component.icns )
|
||||
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/bitmap2component.icns" PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION Resources
|
||||
)
|
||||
set( MACOSX_BUNDLE_ICON_FILE bitmap2component.icns )
|
||||
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-pcb.kicad )
|
||||
set( MACOSX_BUNDLE_NAME bitmap2component )
|
||||
endif()
|
||||
if(APPLE)
|
||||
set(BITMAP2COMPONENT_RESOURCES bitmap2component.icns)
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/bitmap2component.icns"
|
||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
set(MACOSX_BUNDLE_ICON_FILE bitmap2component.icns)
|
||||
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.bitmap2component)
|
||||
endif(APPLE)
|
||||
|
||||
add_executable( bitmap2component WIN32 MACOSX_BUNDLE
|
||||
${BITMAP2COMPONENT_SRCS}
|
||||
${BITMAP2COMPONENT_RESOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries( bitmap2component
|
||||
common
|
||||
polygon
|
||||
bitmaps
|
||||
${wxWidgets_LIBRARIES}
|
||||
potrace
|
||||
)
|
||||
|
||||
if( APPLE )
|
||||
set_target_properties( bitmap2component PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
|
||||
)
|
||||
add_executable(bitmap2component WIN32 MACOSX_BUNDLE
|
||||
${BITMAP2COMPONENT_SRCS}
|
||||
${BITMAP2COMPONENT_RESOURCES})
|
||||
|
||||
# put individual bundle outside of main bundle as a first step
|
||||
# will be pulled into the main bundle when creating main bundle
|
||||
install( TARGETS bitmap2component
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(bitmap2component PROPERTIES MACOSX_BUNDLE_INFO_PLIST
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
||||
endif(APPLE)
|
||||
|
||||
target_link_libraries( bitmap2component common polygon bitmaps
|
||||
${wxWidgets_LIBRARIES}
|
||||
potrace
|
||||
)
|
||||
|
||||
install(TARGETS bitmap2component
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT binary
|
||||
)
|
||||
install( CODE "
|
||||
# override default embedded path settings
|
||||
${OSX_BUNDLE_OVERRIDE_PATHS}
|
||||
COMPONENT binary)
|
||||
|
||||
# do all the work
|
||||
include( BundleUtilities )
|
||||
fixup_bundle( ${KICAD_BIN}/bitmap2component.app/Contents/MacOS/bitmap2component
|
||||
\"\"
|
||||
\"\"
|
||||
)
|
||||
" COMPONENT Runtime
|
||||
)
|
||||
else()
|
||||
install( TARGETS bitmap2component
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT binary
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
if( false ) # linker map with cross reference
|
||||
set_target_properties( bitmap2component PROPERTIES
|
||||
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=bitmap2component.map"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>bitmap2component.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.kicad-pcb.bitmap2component</string>
|
||||
<string>org.kicad-eda.bitmap2component</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
|
||||
+174
-372
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2010 jean-pierre.charras
|
||||
* Copyright (C) 1992-2015 Kicad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 1992-2010 Kicad Developers, see change_log.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
|
||||
@@ -21,18 +21,17 @@
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <macros.h>
|
||||
|
||||
#include <pgm_base.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <wxstruct.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/config.h>
|
||||
#include <wx/filename.h>
|
||||
|
||||
#include <bitmap2cmp_gui_base.h>
|
||||
#include <bitmap2component.h>
|
||||
|
||||
#include <potracelib.h>
|
||||
#include <bitmap_io.h>
|
||||
@@ -40,72 +39,61 @@
|
||||
#include <colors_selection.h>
|
||||
#include <build_version.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <kiway.h>
|
||||
#include <kiface_i.h>
|
||||
|
||||
#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" )
|
||||
#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" )
|
||||
#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" )
|
||||
#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" )
|
||||
#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" )
|
||||
#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" )
|
||||
#define KEYWORD_LAST_FORMAT wxT( "Last_format" )
|
||||
#define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" )
|
||||
#define KEYWORD_BW_NEGATIVE wxT( "Negative_choice" )
|
||||
|
||||
#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" )
|
||||
#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" )
|
||||
#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" )
|
||||
#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" )
|
||||
#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" )
|
||||
#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" )
|
||||
#define KEYWORD_LAST_FORMAT wxT( "Last_format" )
|
||||
#define KEYWORD_LAST_MODLAYER wxT( "Last_modlayer" )
|
||||
#define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" )
|
||||
#define KEYWORD_BW_NEGATIVE wxT( "Negative_choice" )
|
||||
extern int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, int aFormat );
|
||||
|
||||
#define DEFAULT_DPI 300 // Default resolution in Bit per inches
|
||||
|
||||
extern int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile,
|
||||
OUTPUT_FMT_ID aFormat, int aDpi_X, int aDpi_Y,
|
||||
BMP2CMP_MOD_LAYER aModLayer );
|
||||
|
||||
/**
|
||||
* Class BM2CMP_FRAME_BASE
|
||||
* is the main frame for this application
|
||||
*/
|
||||
/* Class BM2CMP_FRAME_BASE
|
||||
This is the main frame for this application
|
||||
*/
|
||||
class BM2CMP_FRAME : public BM2CMP_FRAME_BASE
|
||||
{
|
||||
private:
|
||||
wxImage m_Pict_Image;
|
||||
wxBitmap m_Pict_Bitmap;
|
||||
wxImage m_Greyscale_Image;
|
||||
wxBitmap m_Greyscale_Bitmap;
|
||||
wxImage m_NB_Image;
|
||||
wxBitmap m_BN_Bitmap;
|
||||
wxSize m_imageDPI; // The initial image resolution. When unknown,
|
||||
// set to DEFAULT_DPI x DEFAULT_DPI per Inch
|
||||
wxString m_BitmapFileName;
|
||||
wxString m_ConvertedFileName;
|
||||
wxSize m_frameSize;
|
||||
wxPoint m_framePos;
|
||||
wxConfigBase* m_config;
|
||||
wxImage m_Pict_Image;
|
||||
wxBitmap m_Pict_Bitmap;
|
||||
wxImage m_Greyscale_Image;
|
||||
wxBitmap m_Greyscale_Bitmap;
|
||||
wxImage m_NB_Image;
|
||||
wxBitmap m_BN_Bitmap;
|
||||
wxString m_BitmapFileName;
|
||||
wxString m_ConvertedFileName;
|
||||
wxSize m_FrameSize;
|
||||
wxPoint m_FramePos;
|
||||
wxConfig * m_Config;
|
||||
|
||||
public:
|
||||
BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
BM2CMP_FRAME();
|
||||
~BM2CMP_FRAME();
|
||||
|
||||
// overload KIWAY_PLAYER virtual
|
||||
bool OpenProjectFiles( const std::vector<wxString>& aFilenames, int aCtl=0 );
|
||||
|
||||
private:
|
||||
|
||||
// Event handlers
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void OnLoadFile( wxCommandEvent& event );
|
||||
bool LoadFile( wxString& aFullFileName );
|
||||
void OnExport( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Generate a schematic library which contains one component:
|
||||
* Generate a schematic library which comtains one component:
|
||||
* the logo
|
||||
*/
|
||||
void OnExportEeschema();
|
||||
|
||||
/**
|
||||
* Generate a module in S expr format
|
||||
* Depending on the option:
|
||||
* Legacy format: generate a module library which comtains one component
|
||||
* New kicad_mod format: generate a module in S expr format
|
||||
*/
|
||||
void OnExportPcbnew();
|
||||
void OnExportPcbnew( bool aLegacyFormat );
|
||||
|
||||
/**
|
||||
* Generate a postscript file
|
||||
@@ -121,70 +109,29 @@ private:
|
||||
void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level)
|
||||
void OnOptionsSelection( wxCommandEvent& event );
|
||||
void OnThresholdChange( wxScrollEvent& event );
|
||||
void OnResolutionChange( wxCommandEvent& event );
|
||||
|
||||
// called when texts controls which handle the image resolution
|
||||
// lose the focus, to ensure the right values are displayed
|
||||
// because the m_imageDPI are clipped to acceptable values, and
|
||||
// the text displayed could be differ during text edition
|
||||
// We are using ChangeValue here to avoid generating a wxEVT_TEXT event.
|
||||
void UpdateDPITextValueX( wxMouseEvent& event )
|
||||
{
|
||||
m_DPIValueX->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.x ) );
|
||||
}
|
||||
|
||||
void UpdateDPITextValueY( wxMouseEvent& event )
|
||||
{
|
||||
m_DPIValueY->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.y ) );
|
||||
}
|
||||
|
||||
void NegateGreyscaleImage( );
|
||||
void ExportFile( FILE* aOutfile, OUTPUT_FMT_ID aFormat );
|
||||
void updateImageInfo();
|
||||
void OnFormatChange( wxCommandEvent& event );
|
||||
void ExportFile( FILE* aOutfile, int aFormat );
|
||||
};
|
||||
|
||||
|
||||
BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
BM2CMP_FRAME_BASE( aParent )
|
||||
BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL )
|
||||
{
|
||||
SetKiway( this, aKiway );
|
||||
|
||||
int tmp;
|
||||
m_config = GetNewConfig( Pgm().App().GetAppName() );
|
||||
m_config->Read( KEYWORD_FRAME_POSX, & m_framePos.x, -1 );
|
||||
m_config->Read( KEYWORD_FRAME_POSY, & m_framePos.y, -1 );
|
||||
m_config->Read( KEYWORD_FRAME_SIZEX, & m_frameSize.x, -1 );
|
||||
m_config->Read( KEYWORD_FRAME_SIZEY, & m_frameSize.y, -1 );
|
||||
m_config->Read( KEYWORD_LAST_INPUT_FILE, &m_BitmapFileName );
|
||||
m_config->Read( KEYWORD_LAST_OUTPUT_FILE, &m_ConvertedFileName );
|
||||
|
||||
if( m_config->Read( KEYWORD_BINARY_THRESHOLD, &tmp ) )
|
||||
m_Config = new wxConfig();
|
||||
m_Config->Read( KEYWORD_FRAME_POSX, & m_FramePos.x, -1 );
|
||||
m_Config->Read( KEYWORD_FRAME_POSY, & m_FramePos.y, -1 );
|
||||
m_Config->Read( KEYWORD_FRAME_SIZEX, & m_FrameSize.x, -1 );
|
||||
m_Config->Read( KEYWORD_FRAME_SIZEY, & m_FrameSize.y, -1 );
|
||||
m_Config->Read( KEYWORD_LAST_INPUT_FILE, &m_BitmapFileName );
|
||||
m_Config->Read( KEYWORD_LAST_OUTPUT_FILE, &m_ConvertedFileName );
|
||||
if( m_Config->Read( KEYWORD_BINARY_THRESHOLD, &tmp ) )
|
||||
m_sliderThreshold->SetValue( tmp );
|
||||
|
||||
if( m_config->Read( KEYWORD_BW_NEGATIVE, &tmp ) )
|
||||
if( m_Config->Read( KEYWORD_BW_NEGATIVE, &tmp ) )
|
||||
m_rbOptions->SetSelection( tmp ? 1 : 0 );
|
||||
|
||||
if( m_config->Read( KEYWORD_LAST_FORMAT, &tmp ) )
|
||||
{
|
||||
if( tmp < 0 || tmp > FINAL_FMT )
|
||||
tmp = PCBNEW_KICAD_MOD;
|
||||
m_Config->Read( KEYWORD_LAST_FORMAT, &tmp );
|
||||
m_radioBoxFormat->SetSelection( tmp );
|
||||
|
||||
m_radioBoxFormat->SetSelection( tmp );
|
||||
}
|
||||
|
||||
if( tmp == PCBNEW_KICAD_MOD )
|
||||
m_radio_PCBLayer->Enable( true );
|
||||
else
|
||||
m_radio_PCBLayer->Enable( false );
|
||||
|
||||
if( m_config->Read( KEYWORD_LAST_MODLAYER, &tmp ) )
|
||||
{
|
||||
if( (unsigned) tmp > MOD_LYR_FINAL ) // Out of range
|
||||
m_radio_PCBLayer->SetSelection( MOD_LYR_FSILKS );
|
||||
else
|
||||
m_radio_PCBLayer->SetSelection( tmp );
|
||||
}
|
||||
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
@@ -193,37 +140,34 @@ BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
m_buttonExport->Enable( false );
|
||||
|
||||
m_imageDPI.x = m_imageDPI.y = DEFAULT_DPI; // Default resolution in Bit per inches
|
||||
|
||||
if ( m_framePos == wxDefaultPosition )
|
||||
if ( m_FramePos == wxDefaultPosition )
|
||||
Centre();
|
||||
}
|
||||
|
||||
|
||||
BM2CMP_FRAME::~BM2CMP_FRAME()
|
||||
{
|
||||
if( !m_config || IsIconized() )
|
||||
if( ( m_Config == NULL ) || IsIconized() )
|
||||
return;
|
||||
|
||||
m_frameSize = GetSize();
|
||||
m_framePos = GetPosition();
|
||||
m_FrameSize = GetSize();
|
||||
m_FramePos = GetPosition();
|
||||
|
||||
m_config->Write( KEYWORD_FRAME_POSX, (long) m_framePos.x );
|
||||
m_config->Write( KEYWORD_FRAME_POSY, (long) m_framePos.y );
|
||||
m_config->Write( KEYWORD_FRAME_SIZEX, (long) m_frameSize.x );
|
||||
m_config->Write( KEYWORD_FRAME_SIZEY, (long) m_frameSize.y );
|
||||
m_config->Write( KEYWORD_LAST_INPUT_FILE, m_BitmapFileName );
|
||||
m_config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName );
|
||||
m_config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() );
|
||||
m_config->Write( KEYWORD_BW_NEGATIVE, m_rbOptions->GetSelection() );
|
||||
m_config->Write( KEYWORD_LAST_FORMAT, m_radioBoxFormat->GetSelection() );
|
||||
m_config->Write( KEYWORD_LAST_MODLAYER, m_radio_PCBLayer->GetSelection() );
|
||||
m_Config->Write( KEYWORD_FRAME_POSX, (long) m_FramePos.x );
|
||||
m_Config->Write( KEYWORD_FRAME_POSY, (long) m_FramePos.y );
|
||||
m_Config->Write( KEYWORD_FRAME_SIZEX, (long) m_FrameSize.x );
|
||||
m_Config->Write( KEYWORD_FRAME_SIZEY, (long) m_FrameSize.y );
|
||||
m_Config->Write( KEYWORD_LAST_INPUT_FILE, m_BitmapFileName );
|
||||
m_Config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName );
|
||||
m_Config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() );
|
||||
m_Config->Write( KEYWORD_BW_NEGATIVE, m_rbOptions->GetSelection() );
|
||||
m_Config->Write( KEYWORD_LAST_FORMAT, m_radioBoxFormat->GetSelection() );
|
||||
|
||||
delete m_config;
|
||||
delete m_Config;
|
||||
|
||||
/* This needed for OSX: avoids further OnDraw processing after this
|
||||
* destructor and before the native window is destroyed
|
||||
@@ -250,7 +194,7 @@ void BM2CMP_FRAME::OnPaint( wxPaintEvent& event )
|
||||
m_BNPicturePanel->PrepareDC( nb_dc );
|
||||
|
||||
// OSX crashes with empty bitmaps (on initial refreshes)
|
||||
if( m_Pict_Bitmap.IsOk() && m_Greyscale_Bitmap.IsOk() && m_BN_Bitmap.IsOk() )
|
||||
if(m_Pict_Bitmap.IsOk() && m_Greyscale_Bitmap.IsOk() && m_BN_Bitmap.IsOk())
|
||||
{
|
||||
pict_dc.DrawBitmap( m_Pict_Bitmap, 0, 0, false );
|
||||
greyscale_dc.DrawBitmap( m_Greyscale_Bitmap, 0, 0, false );
|
||||
@@ -259,45 +203,42 @@ void BM2CMP_FRAME::OnPaint( wxPaintEvent& event )
|
||||
}
|
||||
|
||||
|
||||
/* Called to load a bitmap file
|
||||
*/
|
||||
void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn( m_BitmapFileName );
|
||||
wxString path = fn.GetPath();
|
||||
wxFileName fn(m_BitmapFileName);
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = m_mruPath;
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
||||
wxFileDialog FileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
||||
_( "Image Files " ) + wxImage::GetImageExtWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
wxFD_OPEN );
|
||||
int diag = FileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
wxString fullFilename = fileDlg.GetPath();
|
||||
wxString fullFilename = FileDlg.GetPath();
|
||||
|
||||
if( !OpenProjectFiles( std::vector<wxString>( 1, fullFilename ) ) )
|
||||
if( ! LoadFile( fullFilename ) )
|
||||
return;
|
||||
|
||||
fn = fullFilename;
|
||||
m_mruPath = fn.GetPath();
|
||||
m_buttonExport->Enable( true );
|
||||
SetStatusText( fullFilename );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||
bool BM2CMP_FRAME::LoadFile( wxString& aFullFileName )
|
||||
{
|
||||
// Prj().MaybeLoadProjectSettings();
|
||||
|
||||
m_BitmapFileName = aFileSet[0];
|
||||
m_BitmapFileName = aFullFileName;
|
||||
|
||||
if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
|
||||
{
|
||||
// LoadFile has its own UI, no need for further failure notification here
|
||||
wxMessageBox( _( "Couldn't load image from <%s>" ), m_BitmapFileName.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -305,32 +246,15 @@ bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int
|
||||
|
||||
int h = m_Pict_Bitmap.GetHeight();
|
||||
int w = m_Pict_Bitmap.GetWidth();
|
||||
int nb = m_Pict_Bitmap.GetDepth();
|
||||
|
||||
// Determine image resolution in DPI (does not existing in all formats).
|
||||
// the resolution can be given in bit per inches or bit per cm in file
|
||||
m_imageDPI.x = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONX );
|
||||
m_imageDPI.y = m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONY );
|
||||
|
||||
if( m_imageDPI.x > 1 && m_imageDPI.y > 1 )
|
||||
{
|
||||
if( m_Pict_Image.GetOptionInt( wxIMAGE_OPTION_RESOLUTIONUNIT ) == wxIMAGE_RESOLUTION_CM )
|
||||
{
|
||||
// When the initial resolution is given in bits per cm,
|
||||
// experience shows adding 1.27 to the resolution converted in dpi
|
||||
// before convert to int value reduce the conversion error
|
||||
// but it is not perfect
|
||||
m_imageDPI.x = m_imageDPI.x * 2.54 + 1.27;
|
||||
m_imageDPI.y = m_imageDPI.y * 2.54 + 1.27;
|
||||
}
|
||||
}
|
||||
else // fallback to the default value
|
||||
m_imageDPI.x = m_imageDPI.y = DEFAULT_DPI;
|
||||
|
||||
// Display image info:
|
||||
// We are using ChangeValue here to avoid generating a wxEVT_TEXT event.
|
||||
m_DPIValueX->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.x ) );
|
||||
m_DPIValueY->ChangeValue( wxString::Format( wxT( "%d" ), m_imageDPI.y ) );
|
||||
updateImageInfo();
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "%d" ), w );
|
||||
m_SizeXValue->SetLabel(msg);
|
||||
msg.Printf( wxT( "%d" ), h );
|
||||
m_SizeYValue->SetLabel(msg);
|
||||
msg.Printf( wxT( "%d" ), nb );
|
||||
m_BPPValue->SetLabel(msg);
|
||||
|
||||
m_InitialPicturePanel->SetVirtualSize( w, h );
|
||||
m_GreyscalePicturePanel->SetVirtualSize( w, h );
|
||||
@@ -338,59 +262,17 @@ bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int
|
||||
|
||||
m_Greyscale_Image.Destroy();
|
||||
m_Greyscale_Image = m_Pict_Image.ConvertToGreyscale( );
|
||||
|
||||
if( m_rbOptions->GetSelection() > 0 )
|
||||
NegateGreyscaleImage( );
|
||||
|
||||
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
||||
|
||||
m_NB_Image = m_Greyscale_Image;
|
||||
Binarize( (double) m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::updateImageInfo()
|
||||
{
|
||||
// Note: the image resolution text controls are not modified
|
||||
// here, to avoid a race between text change when entered by user and
|
||||
// a text change if it is modified here.
|
||||
int h = m_Pict_Bitmap.GetHeight();
|
||||
int w = m_Pict_Bitmap.GetWidth();
|
||||
int nb = m_Pict_Bitmap.GetDepth();
|
||||
|
||||
m_SizeXValue->SetLabel( wxString::Format( wxT( "%d" ), w ) );
|
||||
m_SizeYValue->SetLabel( wxString::Format( wxT( "%d" ), h ) );
|
||||
m_BPPValue->SetLabel( wxString::Format( wxT( "%d" ), nb ) );
|
||||
|
||||
m_SizeXValue_mm->SetLabel( wxString::Format( wxT( "%.1f" ),
|
||||
(double) w / m_imageDPI.x * 25.4 ) );
|
||||
m_SizeYValue_mm->SetLabel( wxString::Format( wxT( "%.1f" ),
|
||||
(double) h / m_imageDPI.y * 25.4 ) );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnResolutionChange( wxCommandEvent& event )
|
||||
{
|
||||
long tmp;
|
||||
|
||||
if( m_DPIValueX->GetValue().ToLong( &tmp ) )
|
||||
m_imageDPI.x = tmp;
|
||||
|
||||
if( m_DPIValueY->GetValue().ToLong( &tmp ) )
|
||||
m_imageDPI.y = tmp;
|
||||
|
||||
if( m_imageDPI.x < 32 )
|
||||
m_imageDPI.x = 32;
|
||||
|
||||
if( m_imageDPI.y < 32 )
|
||||
m_imageDPI.y = 32;
|
||||
|
||||
updateImageInfo();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::Binarize( double aThreshold )
|
||||
{
|
||||
unsigned int pixin;
|
||||
@@ -415,12 +297,11 @@ void BM2CMP_FRAME::Binarize( double aThreshold )
|
||||
m_BN_Bitmap = wxBitmap( m_NB_Image );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::NegateGreyscaleImage( )
|
||||
{
|
||||
unsigned char pix;
|
||||
int h = m_Greyscale_Image.GetHeight();
|
||||
int w = m_Greyscale_Image.GetWidth();
|
||||
int h = m_Greyscale_Image.GetHeight();
|
||||
int w = m_Greyscale_Image.GetWidth();
|
||||
|
||||
for( int y = 0; y < h; y++ )
|
||||
for( int x = 0; x < w; x++ )
|
||||
@@ -431,70 +312,67 @@ void BM2CMP_FRAME::NegateGreyscaleImage( )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Called on Normal/Negative change option */
|
||||
void BM2CMP_FRAME::OnOptionsSelection( wxCommandEvent& event )
|
||||
{
|
||||
NegateGreyscaleImage();
|
||||
NegateGreyscaleImage( );
|
||||
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
|
||||
{
|
||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExport( wxCommandEvent& event )
|
||||
{
|
||||
// choices of m_radioBoxFormat are expected to be in same order as
|
||||
// OUTPUT_FMT_ID. See bitmap2component.h
|
||||
OUTPUT_FMT_ID sel = (OUTPUT_FMT_ID) m_radioBoxFormat->GetSelection();
|
||||
int sel = m_radioBoxFormat->GetSelection();
|
||||
|
||||
switch( sel )
|
||||
{
|
||||
case EESCHEMA_FMT:
|
||||
OnExportEeschema();
|
||||
break;
|
||||
case 0:
|
||||
OnExportEeschema();
|
||||
break;
|
||||
|
||||
case PCBNEW_KICAD_MOD:
|
||||
OnExportPcbnew();
|
||||
break;
|
||||
case 1:
|
||||
OnExportPcbnew( true );
|
||||
break;
|
||||
|
||||
case POSTSCRIPT_FMT:
|
||||
OnExportPostScript();
|
||||
break;
|
||||
case 2:
|
||||
OnExportPcbnew( false );
|
||||
break;
|
||||
|
||||
case KICAD_LOGO:
|
||||
OnExportLogo();
|
||||
break;
|
||||
case 3:
|
||||
OnExportPostScript();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
OnExportLogo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExportLogo()
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
wxFileName fn(m_ConvertedFileName);
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create a logo file" ),
|
||||
path, wxEmptyString,
|
||||
wxGetTranslation( PageLayoutDescrFileWildcard ),
|
||||
wxString msg = _( "Logo file (*.kicad_wks)|*.kicad_wks" );
|
||||
wxFileDialog FileDlg( this, _( "Create a logo file" ), path, wxEmptyString,
|
||||
msg,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = fileDlg.ShowModal();
|
||||
int diag = FileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( PageLayoutDescrFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
m_ConvertedFileName = FileDlg.GetPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
@@ -502,37 +380,33 @@ void BM2CMP_FRAME::OnExportLogo()
|
||||
if( outfile == NULL )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), GetChars( m_ConvertedFileName ) );
|
||||
msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
ExportFile( outfile, KICAD_LOGO );
|
||||
ExportFile( outfile, 4 );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExportPostScript()
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
wxFileName fn(m_ConvertedFileName);
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create a Postscript file" ),
|
||||
path, wxEmptyString,
|
||||
wxGetTranslation( PSFileWildcard ),
|
||||
wxString msg = _( "Postscript file (*.ps)|*.ps" );
|
||||
wxFileDialog FileDlg( this, _( "Create a Postscript file" ), path, wxEmptyString,
|
||||
msg,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
int diag = FileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( wxT( "ps" ) );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
m_ConvertedFileName = FileDlg.GetPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
@@ -540,92 +414,89 @@ void BM2CMP_FRAME::OnExportPostScript()
|
||||
if( outfile == NULL )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), GetChars( m_ConvertedFileName ) );
|
||||
msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
ExportFile( outfile, POSTSCRIPT_FMT );
|
||||
ExportFile( outfile, 3 );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExportEeschema()
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
wxFileName fn(m_ConvertedFileName);
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create a component library file for Eeschema" ),
|
||||
path, wxEmptyString,
|
||||
wxGetTranslation( SchematicLibraryFileWildcard ),
|
||||
wxString msg = _( "Schematic lib file (*.lib)|*.lib" );
|
||||
wxFileDialog FileDlg( this, _( "Create a lib file for Eeschema" ), path, wxEmptyString,
|
||||
msg,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
int diag = FileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( SchematicLibraryFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
m_ConvertedFileName = FileDlg.GetPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == NULL )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), GetChars( m_ConvertedFileName ) );
|
||||
msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
ExportFile( outfile, EESCHEMA_FMT );
|
||||
ExportFile( outfile, 2 );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExportPcbnew()
|
||||
void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
wxFileName fn(m_ConvertedFileName);
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = m_mruPath;
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create a footprint file for Pcbnew" ),
|
||||
wxString msg = aLegacyFormat ?
|
||||
_( "Footprint file (*.emp)|*.emp" ) :
|
||||
_( "Footprint file (*.kicad_mod)|*.kicad_mod" );
|
||||
wxFileDialog FileDlg( this, _( "Create a footprint file for PcbNew" ),
|
||||
path, wxEmptyString,
|
||||
wxGetTranslation( KiCadFootprintLibFileWildcard ),
|
||||
msg,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
int diag = FileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( KiCadFootprintFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
m_ConvertedFileName = FileDlg.GetPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == NULL )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), GetChars( m_ConvertedFileName ) );
|
||||
msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
ExportFile( outfile, PCBNEW_KICAD_MOD );
|
||||
ExportFile( outfile, aLegacyFormat ? 0 : 1 );
|
||||
fclose( outfile );
|
||||
m_mruPath = fn.GetPath();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::ExportFile( FILE* aOutfile, OUTPUT_FMT_ID aFormat )
|
||||
void BM2CMP_FRAME::ExportFile( FILE* aOutfile, int aFormat )
|
||||
{
|
||||
// Create a potrace bitmap
|
||||
int h = m_NB_Image.GetHeight();
|
||||
@@ -643,109 +514,40 @@ void BM2CMP_FRAME::ExportFile( FILE* aOutfile, OUTPUT_FMT_ID aFormat )
|
||||
/* fill the bitmap with data */
|
||||
for( int y = 0; y < h; y++ )
|
||||
{
|
||||
for( int x = 0; x < w; x++ )
|
||||
for( int x = 0; x<w; x++ )
|
||||
{
|
||||
unsigned char pix = m_NB_Image.GetGreen( x, y );
|
||||
BM_PUT( potrace_bitmap, x, y, pix ? 1 : 0 );
|
||||
}
|
||||
}
|
||||
|
||||
// choices of m_radio_PCBLayer are expected to be in same order as
|
||||
// BMP2CMP_MOD_LAYER. See bitmap2component.h
|
||||
BMP2CMP_MOD_LAYER modLayer = MOD_LYR_FSILKS;
|
||||
|
||||
if( aFormat == PCBNEW_KICAD_MOD )
|
||||
modLayer = (BMP2CMP_MOD_LAYER) m_radio_PCBLayer->GetSelection();
|
||||
|
||||
bitmap2component( potrace_bitmap, aOutfile, aFormat, m_imageDPI.x, m_imageDPI.y, modLayer );
|
||||
bitmap2component( potrace_bitmap, aOutfile, aFormat );
|
||||
}
|
||||
|
||||
|
||||
// EDA_APP
|
||||
|
||||
//-----<KIFACE>-----------------------------------------------------------------
|
||||
IMPLEMENT_APP( EDA_APP )
|
||||
|
||||
namespace BMP2CMP {
|
||||
///-----------------------------------------------------------------------------
|
||||
// EDA_APP
|
||||
// main program
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static struct IFACE : public KIFACE_I
|
||||
bool EDA_APP::OnInit()
|
||||
{
|
||||
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 )
|
||||
{
|
||||
switch( aClassId )
|
||||
{
|
||||
InitEDA_Appl( wxT( "BMP2CMP" ) );
|
||||
|
||||
default:
|
||||
{
|
||||
KIWAY_PLAYER* frame = new BM2CMP_FRAME( aKiway, aParent );
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
}
|
||||
wxFrame* frame = new BM2CMP_FRAME();
|
||||
SetTopWindow( frame );
|
||||
frame->Show( true );
|
||||
|
||||
/**
|
||||
* Function IfaceOrAddress
|
||||
* return a pointer to the requested object. The safest way to use this
|
||||
* is to retrieve a pointer to a static instance of an interface, similar to
|
||||
* how the KIFACE interface is exported. But if you know what you are doing
|
||||
* use it to retrieve anything you want.
|
||||
*
|
||||
* @param aDataId identifies which object you want the address of.
|
||||
*
|
||||
* @return void* - and must be cast into the know type.
|
||||
*/
|
||||
void* IfaceOrAddress( int aDataId )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IFACE( const char* aDSOname, KIWAY::FACE_T aType ) :
|
||||
KIFACE_I( aDSOname, aType )
|
||||
{}
|
||||
|
||||
} kiface( "BMP2CMP", KIWAY::FACE_BMP2CMP );
|
||||
|
||||
} // namespace BMP2CMP
|
||||
|
||||
using namespace BMP2CMP;
|
||||
|
||||
static PGM_BASE* process;
|
||||
|
||||
KIFACE_I& Kiface()
|
||||
{
|
||||
return kiface;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
|
||||
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
|
||||
MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
|
||||
void EDA_APP::MacOpenFile( const wxString& aFileName )
|
||||
{
|
||||
process = (PGM_BASE*) aProgram;
|
||||
return &kiface;
|
||||
}
|
||||
|
||||
|
||||
#if defined(BUILD_KIWAY_DLLS)
|
||||
PGM_BASE& Pgm()
|
||||
{
|
||||
wxASSERT( process ); // KIFACE_GETTER has already been called.
|
||||
return *process;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
{
|
||||
return start_common( aCtlBits );
|
||||
}
|
||||
|
||||
void BM2CMP_FRAME::OnFormatChange( wxCommandEvent& event )
|
||||
{
|
||||
if( m_radioBoxFormat->GetSelection() == PCBNEW_KICAD_MOD )
|
||||
m_radio_PCBLayer->Enable( true );
|
||||
else
|
||||
m_radio_PCBLayer->Enable( false );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user