Compare commits
959 Commits
xrced-0_1_
...
before_gtk
Author | SHA1 | Date | |
---|---|---|---|
|
3cbe6adda0 | ||
|
77df51f4fb | ||
|
547703373c | ||
|
0093c2fc5f | ||
|
136bafcd39 | ||
|
eca15c0d54 | ||
|
97c58531bf | ||
|
49732ef201 | ||
|
a068160f9f | ||
|
dee1a63ff5 | ||
|
92b0cd9eb0 | ||
|
96d8f9207f | ||
|
c358ea4147 | ||
|
2eef85139b | ||
|
d1dbe757c0 | ||
|
138861bcdd | ||
|
6e86d7842e | ||
|
179daed8f0 | ||
|
3f9ee1cd85 | ||
|
ad60f069f1 | ||
|
31df756d74 | ||
|
e933b5bc36 | ||
|
a7bdad336c | ||
|
541c319a2d | ||
|
68aef3dc22 | ||
|
741d91c5e4 | ||
|
f1f5039b45 | ||
|
a09f8377ec | ||
|
a1aa0349f8 | ||
|
d368dbeaef | ||
|
0fad0dfda8 | ||
|
346f42313b | ||
|
ed00b1195c | ||
|
76f13e9040 | ||
|
aab6965a93 | ||
|
4b2322641a | ||
|
f3f4302326 | ||
|
65baafba0e | ||
|
c25e6f326b | ||
|
df7e062c8c | ||
|
3006edc092 | ||
|
14cde5136d | ||
|
ae0fbceefa | ||
|
d66551669c | ||
|
9ead8387d0 | ||
|
e524af66ad | ||
|
4aa1c27094 | ||
|
888407a108 | ||
|
6b62c9ad44 | ||
|
88ef3a57a4 | ||
|
2c01d33555 | ||
|
355b4d3de5 | ||
|
7fc65a0384 | ||
|
10498b330d | ||
|
01cca03e20 | ||
|
ad4a6192d7 | ||
|
9b67181b39 | ||
|
edc536d358 | ||
|
6e21a3db8a | ||
|
c3b501e187 | ||
|
12af050427 | ||
|
1a1498c08b | ||
|
81a3763f80 | ||
|
587c26c5e3 | ||
|
46562151eb | ||
|
83dbeea988 | ||
|
18fa735d20 | ||
|
89d90d6d87 | ||
|
dd8df4fc9c | ||
|
0152ee89dd | ||
|
94cf5fc723 | ||
|
677856c9ef | ||
|
51e6392c54 | ||
|
a015d6943e | ||
|
4cbcfb73a0 | ||
|
6ce8b84846 | ||
|
5c173ba3f7 | ||
|
1c14217db4 | ||
|
14ba002a91 | ||
|
27a1fd5880 | ||
|
550343399a | ||
|
24d88d6d46 | ||
|
dc866dcabc | ||
|
6e644ef2d3 | ||
|
4db6714b16 | ||
|
17f504ec9d | ||
|
0ee4059da2 | ||
|
38c8fce8c4 | ||
|
51c9a5db64 | ||
|
eb9d223a9a | ||
|
712593b003 | ||
|
dab6fbae46 | ||
|
f1cf725509 | ||
|
84882850e5 | ||
|
c2b77b4301 | ||
|
82378a4f73 | ||
|
f94a81c084 | ||
|
c228fcb438 | ||
|
f15fa3a93f | ||
|
43dc5fb140 | ||
|
53a9325a43 | ||
|
312f1e6e37 | ||
|
a0fe0a18e5 | ||
|
c14e2e9c8d | ||
|
30e1369517 | ||
|
d8b6309bde | ||
|
bfe1edbddb | ||
|
11e62fe658 | ||
|
853dcc57c6 | ||
|
f7c40316d5 | ||
|
e9efd3f5bd | ||
|
a5f5f678f2 | ||
|
ae199d6e4d | ||
|
3ef092d63b | ||
|
cd5b511a70 | ||
|
c0f4a08e75 | ||
|
79b4079ff4 | ||
|
ef86428624 | ||
|
3b60ea2f22 | ||
|
acb96ac277 | ||
|
38d4b1e4bc | ||
|
812a5849e5 | ||
|
3452f00b56 | ||
|
94c09a19ec | ||
|
dfdc483a23 | ||
|
766a1d00c3 | ||
|
905a5e7f7c | ||
|
f36086d185 | ||
|
151815eb93 | ||
|
65e324b4b0 | ||
|
ff23892253 | ||
|
d1f024a8de | ||
|
c2b83fddb9 | ||
|
2fb18bf45b | ||
|
4e115ed2c7 | ||
|
8226a05440 | ||
|
67036b2497 | ||
|
ec52467188 | ||
|
2cfcf22d47 | ||
|
9f542367b7 | ||
|
3e8adad7d7 | ||
|
28c91b7deb | ||
|
c77a67962c | ||
|
f1afd2e066 | ||
|
b80388aab6 | ||
|
123dca7d25 | ||
|
fdda7199e8 | ||
|
7f47faf4f2 | ||
|
f536f00539 | ||
|
20ceebaa87 | ||
|
c88c6e94c0 | ||
|
9000cdfb2a | ||
|
4e47fd5a1b | ||
|
81f6ea4a29 | ||
|
53c5fb20ed | ||
|
02bcd285fa | ||
|
48f625bc2c | ||
|
84006e65e8 | ||
|
c6ece59558 | ||
|
17a1ebd101 | ||
|
bd090f77ee | ||
|
df6ddd9730 | ||
|
bc14c8b21f | ||
|
6cf2fb76fe | ||
|
7a7bd38a77 | ||
|
8a077f2872 | ||
|
ab0ad5f175 | ||
|
3b96fc2f1b | ||
|
f499ca450c | ||
|
33d094d13b | ||
|
588c80dea1 | ||
|
2e2a55b22e | ||
|
9864ef3b5c | ||
|
61a15bac86 | ||
|
259c43f679 | ||
|
c7fe80e285 | ||
|
f6551618d4 | ||
|
5001df0dd5 | ||
|
42d0df0030 | ||
|
7999124f55 | ||
|
d1e4a8182e | ||
|
976abb72fc | ||
|
fbfb8bcc3f | ||
|
68bc51a9ed | ||
|
e1cffcd6e3 | ||
|
a5924a7a35 | ||
|
af1f0a7631 | ||
|
4115960d4b | ||
|
254e8e2913 | ||
|
6459a506bb | ||
|
156162ece8 | ||
|
09f1d340c1 | ||
|
b323fb0b8f | ||
|
9de6df963d | ||
|
c05e07cb8c | ||
|
3d012d1bf1 | ||
|
8907154c1a | ||
|
919de94c4f | ||
|
2b5e2b5847 | ||
|
cae8f1bf03 | ||
|
422e411e95 | ||
|
74a7eb0bf6 | ||
|
37d0e9f603 | ||
|
de9a407728 | ||
|
d1fd98ccd8 | ||
|
421d214fa9 | ||
|
d48ba93329 | ||
|
ef1a9be407 | ||
|
fc87210f7d | ||
|
ae4e0c7a5c | ||
|
66c05fa96b | ||
|
ea4806251e | ||
|
57764418a4 | ||
|
7615dee740 | ||
|
9ffaedfcd0 | ||
|
9a7247f0e9 | ||
|
219ee9ba9d | ||
|
0c7ca81c4f | ||
|
cff83174db | ||
|
2ee70736f5 | ||
|
a0845d4583 | ||
|
43907f570d | ||
|
5863d5e6d0 | ||
|
84bdefa021 | ||
|
6334d81fe3 | ||
|
168e7d95ea | ||
|
34a35823ea | ||
|
fdd2ec3e96 | ||
|
10e0e1beb1 | ||
|
285ce5a341 | ||
|
4bbc4bded5 | ||
|
b7e22e3d27 | ||
|
e95b8d5a8c | ||
|
7682e22edb | ||
|
c25ac78a9f | ||
|
57d9fc8522 | ||
|
f58a6c817e | ||
|
608a34bf5b | ||
|
94dadb0a8e | ||
|
6f9cf1e6bd | ||
|
c5b6251927 | ||
|
0feb044436 | ||
|
c5044ee808 | ||
|
0aaa804e70 | ||
|
214774ceeb | ||
|
37f6a080f4 | ||
|
a36876368a | ||
|
0d34c30e55 | ||
|
783e0c6d48 | ||
|
f69e752c86 | ||
|
e6b915ed4f | ||
|
c687b303a5 | ||
|
7ea07c5342 | ||
|
7b94a67c64 | ||
|
f6b50c59ab | ||
|
4171f4c13d | ||
|
420de418ea | ||
|
c90c34007a | ||
|
fa4bc07cce | ||
|
6b91d11340 | ||
|
3f68727513 | ||
|
b3090d48b4 | ||
|
40711af81b | ||
|
09d2016d9d | ||
|
3f0785cd6b | ||
|
ca6a9a1486 | ||
|
761952d9cb | ||
|
b13095df45 | ||
|
363f7643a6 | ||
|
0944fceb98 | ||
|
35d10652f4 | ||
|
ce6f8d6fb3 | ||
|
7cb0687287 | ||
|
6ba5438dda | ||
|
0586024f65 | ||
|
3f97d339d6 | ||
|
8b3eb85d5e | ||
|
0ad5d837cb | ||
|
36afbc42f8 | ||
|
948b08e2ca | ||
|
12c6934146 | ||
|
02c3e53b45 | ||
|
19c46ab5f3 | ||
|
c74b77ed51 | ||
|
72e4e6a397 | ||
|
fa1346df91 | ||
|
e7272c0856 | ||
|
404914c6f6 | ||
|
15b17d22b0 | ||
|
a33c7e9933 | ||
|
a8793ff9ce | ||
|
2296fe5018 | ||
|
2831eb2dd5 | ||
|
a4588fd1df | ||
|
2263a14efc | ||
|
e6b2a3b383 | ||
|
c781c31638 | ||
|
17d8a88795 | ||
|
f64cd1e6b0 | ||
|
e1bce3caeb | ||
|
002ceb3840 | ||
|
9bb50fd0b0 | ||
|
0ea2339167 | ||
|
d6b30150b2 | ||
|
258e7b2562 | ||
|
1602d4d0fb | ||
|
fe404d1afc | ||
|
cec46079ae | ||
|
a749a99f08 | ||
|
1d20b7f2c6 | ||
|
e536d73ac4 | ||
|
c40691a064 | ||
|
a3fc2e6c94 | ||
|
9dbe002289 | ||
|
60e193718c | ||
|
ad0ac642d5 | ||
|
1d421f0c39 | ||
|
e716b9bee1 | ||
|
a141e01844 | ||
|
f1b747eb88 | ||
|
389076f148 | ||
|
b11729f149 | ||
|
9a1e758d89 | ||
|
d2797f557a | ||
|
bc2defe275 | ||
|
b7f64d345f | ||
|
f58585c091 | ||
|
ed05b5c6e1 | ||
|
a54930e05d | ||
|
da8cf7236e | ||
|
9122d155ab | ||
|
94500b3284 | ||
|
e828c96ac2 | ||
|
fea3713c03 | ||
|
ae3cd595dc | ||
|
5080e86f30 | ||
|
f1db433a3b | ||
|
3f62badb5f | ||
|
a13acfd803 | ||
|
fc9b078cc5 | ||
|
86ac4a2207 | ||
|
1229a1e7bf | ||
|
4a55909399 | ||
|
1d54b9d297 | ||
|
c493691d62 | ||
|
0d2c74c6ef | ||
|
defbeca1b8 | ||
|
c15b8bfd6f | ||
|
15dc68b6b8 | ||
|
8d79ccefda | ||
|
200a992309 | ||
|
d1f65ffa65 | ||
|
0331b385a8 | ||
|
451f6363c9 | ||
|
95e33ad869 | ||
|
9cb6c9a024 | ||
|
24490a1c72 | ||
|
9f0ff522c7 | ||
|
abc1acc90d | ||
|
95dc6a2b1d | ||
|
cff58b5299 | ||
|
f9daf953d6 | ||
|
f277ea12a6 | ||
|
2e11bb424c | ||
|
9d86099269 | ||
|
41884be320 | ||
|
95af070abd | ||
|
1c36a9d335 | ||
|
4f7ee81a08 | ||
|
731fa21e8c | ||
|
21ed3f204a | ||
|
cdf0ff0ff1 | ||
|
39a7f085a4 | ||
|
bf354396f6 | ||
|
86e778e267 | ||
|
6565d564cb | ||
|
41faf80727 | ||
|
9c00f5b593 | ||
|
8c80d38463 | ||
|
cff614f601 | ||
|
48beac4c55 | ||
|
bf8ca20d37 | ||
|
e78e858331 | ||
|
cc4f5ad809 | ||
|
c00266964a | ||
|
f50de1504e | ||
|
60b0bd1dd1 | ||
|
cde5a85767 | ||
|
625279a99f | ||
|
e7dfcb8ea4 | ||
|
34b29ae796 | ||
|
14653d3b83 | ||
|
96a9f4e8dd | ||
|
3f3a6949a6 | ||
|
62fa8b3a1d | ||
|
c4295812f4 | ||
|
3f39c25469 | ||
|
90f5e43731 | ||
|
cc48c73f3c | ||
|
a571cd8c60 | ||
|
ae6c8147aa | ||
|
d83c04e6a5 | ||
|
1afce1a8df | ||
|
6fbf4a60fe | ||
|
d334418da4 | ||
|
22e2e60cad | ||
|
8e2ff10c71 | ||
|
0fb7068d73 | ||
|
b636c599e7 | ||
|
89e94a4bff | ||
|
ff33410699 | ||
|
3dc786e02e | ||
|
6fbc7b5936 | ||
|
e08ed3082a | ||
|
0beb873533 | ||
|
d7e0024b09 | ||
|
de8a305a7f | ||
|
6758d3d3a3 | ||
|
05036fe062 | ||
|
2edd85f22b | ||
|
8b6b8e21a4 | ||
|
dec531b232 | ||
|
08f8037109 | ||
|
42c60e749f | ||
|
49c48f8190 | ||
|
3ee39f97af | ||
|
5887690b5e | ||
|
f730d32b0f | ||
|
5a23a495e4 | ||
|
e7cc2f6502 | ||
|
9f29226d68 | ||
|
8648883bfe | ||
|
d466385131 | ||
|
8138cfecaf | ||
|
04732a7f27 | ||
|
34a4e91286 | ||
|
a57ac1c418 | ||
|
d248a65cdd | ||
|
4a60e3f007 | ||
|
484bdc6a72 | ||
|
6774a5d355 | ||
|
d04a92f097 | ||
|
2bdd6b12dd | ||
|
e051b34ef2 | ||
|
d12aef517e | ||
|
9e03e02d0c | ||
|
47547fbe45 | ||
|
72ba915e7e | ||
|
a06e389f0a | ||
|
5d5c59e9c4 | ||
|
35d1986eb8 | ||
|
e426ff2972 | ||
|
8e432792b3 | ||
|
6ded0416df | ||
|
c9ee46c3a5 | ||
|
2971ea9d51 | ||
|
aca2d2de32 | ||
|
ae07248072 | ||
|
0ab82ca91e | ||
|
8a9a7f264c | ||
|
99f0cdf2e9 | ||
|
2cbdf975a9 | ||
|
42b1fb630d | ||
|
4ce18ecb66 | ||
|
f0794a4ccd | ||
|
3c542a4de0 | ||
|
18c9aebeca | ||
|
b624acad7e | ||
|
df7998fce5 | ||
|
bd118d35c6 | ||
|
fffdb4c9c7 | ||
|
2696b11cd5 | ||
|
4979a56c78 | ||
|
d2822091a7 | ||
|
c42f011ed6 | ||
|
631e67db81 | ||
|
84cefcb0eb | ||
|
5e99793eca | ||
|
08890e275c | ||
|
c07103f267 | ||
|
f7040b5fe6 | ||
|
4884b02b08 | ||
|
c15b71ae08 | ||
|
44bf7fe3d0 | ||
|
3e7cd2f52b | ||
|
f0e434d0f8 | ||
|
413e5c784d | ||
|
4f31d61012 | ||
|
b7ee3acf62 | ||
|
3b6c3fc8c5 | ||
|
f0cf38b706 | ||
|
ba76a609e4 | ||
|
030f50ef4a | ||
|
7c7f4cff9f | ||
|
774960ce3c | ||
|
d8ecf75446 | ||
|
d26adb9df7 | ||
|
5378558e5c | ||
|
17ec440be6 | ||
|
13abe5c0c8 | ||
|
a7f17c90e5 | ||
|
8b7b0d67b0 | ||
|
6bae67261c | ||
|
d30814cdf2 | ||
|
4e025aa206 | ||
|
3e81caa51b | ||
|
2bb7951e0c | ||
|
e7aaf2dedd | ||
|
0f71b9da7f | ||
|
2c1dbc95e1 | ||
|
0e71e8459f | ||
|
c725df80c5 | ||
|
53e2e87c9b | ||
|
58161defc3 | ||
|
966b84b914 | ||
|
3147bb585a | ||
|
8dbb7967d4 | ||
|
f8387e15ee | ||
|
d110378748 | ||
|
3b9b80c0e2 | ||
|
b20cb04588 | ||
|
a379a35f4b | ||
|
101b477808 | ||
|
07910a9a7e | ||
|
dbcf11198a | ||
|
5c66e5b2b2 | ||
|
71307412f5 | ||
|
5e23e2d59a | ||
|
4c620d1900 | ||
|
cfd1ac216d | ||
|
4f66d445e1 | ||
|
60e4975cb8 | ||
|
285ba64d0d | ||
|
8a43eaecc1 | ||
|
470731287a | ||
|
88d2e56706 | ||
|
d332c51456 | ||
|
0042166636 | ||
|
0683aca66e | ||
|
30962327c9 | ||
|
1e8774da27 | ||
|
5cb61fed97 | ||
|
84ae7ca4f6 | ||
|
c5035065a8 | ||
|
6ca1005bcb | ||
|
09f7f79f2d | ||
|
c54e5eb0f6 | ||
|
5f4d35b804 | ||
|
49fe461056 | ||
|
45aee08b3b | ||
|
7adabb9ae8 | ||
|
0b6db82f16 | ||
|
8a15e8ba7a | ||
|
7533ba252b | ||
|
04e525a00d | ||
|
2b36af83fd | ||
|
8c8c4b717a | ||
|
b67d14bee0 | ||
|
4a767dd5cd | ||
|
5844fc0775 | ||
|
38d446db26 | ||
|
b578601e3e | ||
|
dd6abbacb9 | ||
|
1bc4db11b1 | ||
|
7398fb8170 | ||
|
02d9204cad | ||
|
59afc60f15 | ||
|
229f627030 | ||
|
83498ef2b0 | ||
|
790fc140a9 | ||
|
525ae3fe38 | ||
|
6db6bfd1ce | ||
|
6ac23e25b8 | ||
|
671478ee46 | ||
|
0ccaeba319 | ||
|
d24a5079c5 | ||
|
7eb00c80b2 | ||
|
62603868bc | ||
|
aeb9a15618 | ||
|
9240613a8d | ||
|
20bfc1c29f | ||
|
5bd98e9354 | ||
|
47bd540624 | ||
|
efdf6afeb2 | ||
|
b5887a837d | ||
|
d66943923d | ||
|
be30c667ed | ||
|
472e73db81 | ||
|
14a3591de2 | ||
|
3c232ecbaf | ||
|
9eeab5fa9d | ||
|
6f2df739f4 | ||
|
69c54afe21 | ||
|
5e8c9935fd | ||
|
f2555abd7a | ||
|
938ad7687f | ||
|
eb76ad0b3b | ||
|
6ace5176f6 | ||
|
cb542c35fa | ||
|
92b6cd6289 | ||
|
a351409ef2 | ||
|
81e2cbc685 | ||
|
e822273ae0 | ||
|
f43dc7d3f8 | ||
|
c1ce4db1de | ||
|
a3c0d7684a | ||
|
f22d860b26 | ||
|
b0b2263b50 | ||
|
8c624a14ad | ||
|
ce52988a85 | ||
|
e38bddf552 | ||
|
f26623c817 | ||
|
befb44cf2e | ||
|
40eb3606eb | ||
|
bb8051f2fd | ||
|
6ba93d23bf | ||
|
d6bbc10c94 | ||
|
644e896d3f | ||
|
51c742ddf8 | ||
|
3e4ca115f5 | ||
|
cfda0ea87b | ||
|
dec48aa578 | ||
|
98fe5d46bd | ||
|
0db7dfb021 | ||
|
5d1b49193b | ||
|
0d29fecd2e | ||
|
ebeb1b6ad1 | ||
|
bd33d4acf6 | ||
|
e27d9a9106 | ||
|
89c9b933e3 | ||
|
f226be17ad | ||
|
a2ec9439a3 | ||
|
442a79c0b4 | ||
|
c73b4312f9 | ||
|
baba4aa5ec | ||
|
f02a4ffa5f | ||
|
6b93f25b0a | ||
|
905e339a93 | ||
|
1ff36a0a48 | ||
|
3b396a2629 | ||
|
217e77c3c0 | ||
|
ecc201480f | ||
|
8d5bdb7f2b | ||
|
f83b53a329 | ||
|
992b3f1da4 | ||
|
8804b53fb6 | ||
|
4d931bcca0 | ||
|
0725108f48 | ||
|
a6328131cd | ||
|
b23030d6fa | ||
|
c3b7706c4f | ||
|
6bbe97b71d | ||
|
952f2aaa86 | ||
|
749870835d | ||
|
8fb816ff93 | ||
|
1c2ed09a15 | ||
|
7147aa4780 | ||
|
31ad2c402c | ||
|
b8c8d204b7 | ||
|
a24d7726e6 | ||
|
83173c7a4d | ||
|
03319b655c | ||
|
6cb85701e2 | ||
|
97a798f7b2 | ||
|
af82bc101e | ||
|
8f1158912f | ||
|
394579cf6f | ||
|
d2a8de2f81 | ||
|
8b9e1f439b | ||
|
1fc0b5afe7 | ||
|
de1b0aeb6c | ||
|
2f31c6ec81 | ||
|
3c28b7cbc8 | ||
|
c7f476c90d | ||
|
2edad6fc48 | ||
|
460354e939 | ||
|
88d197753d | ||
|
86e69fa54a | ||
|
21d23b882f | ||
|
8ca58566a3 | ||
|
a8ee80604c | ||
|
8bc9a2f0b1 | ||
|
daef468900 | ||
|
f3a65c3e49 | ||
|
64f4562328 | ||
|
26dfc72818 | ||
|
592a746534 | ||
|
3a0827804b | ||
|
4a712ba3cf | ||
|
b1638abf1e | ||
|
a7c476dc94 | ||
|
b900c52285 | ||
|
abc3d84166 | ||
|
ada974cb26 | ||
|
5529f88ee3 | ||
|
97d16ceba0 | ||
|
4a3a0eada4 | ||
|
6afac89ea9 | ||
|
bc858dcfaa | ||
|
3877be2196 | ||
|
3dddebb1cd | ||
|
1cdab5d13a | ||
|
c6dcd973a5 | ||
|
d36d1be926 | ||
|
305561828c | ||
|
40d4efa81e | ||
|
0b62785c42 | ||
|
5bcb84f804 | ||
|
f10747d890 | ||
|
908f087155 | ||
|
7a64baad69 | ||
|
aa200e97df | ||
|
7e41b689a7 | ||
|
6ab9bf57a5 | ||
|
4e61bf2ca1 | ||
|
86e3091191 | ||
|
fa776a5809 | ||
|
4106cebb95 | ||
|
f3cb0d85b4 | ||
|
9aba21ea4b | ||
|
11850ff358 | ||
|
206391cbab | ||
|
fe19000379 | ||
|
33349a2073 | ||
|
687809e95b | ||
|
38b4a946f3 | ||
|
3df732cd47 | ||
|
85fa5d02d8 | ||
|
91ebae296d | ||
|
16f10340da | ||
|
50aee613a3 | ||
|
550f38d743 | ||
|
7cfd4b0c53 | ||
|
9475f9e7e1 | ||
|
e7c240da70 | ||
|
b7972e1fa8 | ||
|
6ebeb4c721 | ||
|
816a7358d3 | ||
|
9894cc01c9 | ||
|
52ca5b5941 | ||
|
82ff64fdb7 | ||
|
896e226aa2 | ||
|
2a5e6376f2 | ||
|
2ff3507939 | ||
|
187202106f | ||
|
25e6c06102 | ||
|
39de6d6ca1 | ||
|
fe856cc55b | ||
|
b3a6d2694c | ||
|
494c7caa78 | ||
|
498919ddcd | ||
|
376a8ce2d4 | ||
|
2e85922c96 | ||
|
2113bc7764 | ||
|
94709f1911 | ||
|
45a74fec3f | ||
|
f29a481a66 | ||
|
cdc0140021 | ||
|
9cf620e249 | ||
|
3a0ec6ebdb | ||
|
94c7b08817 | ||
|
20123d4958 | ||
|
172df1f035 | ||
|
5b12cceef8 | ||
|
968eb2ef39 | ||
|
d98c97a36a | ||
|
b5ab6d19d3 | ||
|
6807396fdf | ||
|
b3f4c57077 | ||
|
fee7a683ed | ||
|
a85245b1c2 | ||
|
8927d6d11c | ||
|
7a7d2a14fd | ||
|
a7e0e432a2 | ||
|
516d38cdfd | ||
|
5324268eab | ||
|
8fc754bf2b | ||
|
1a535eb9ee | ||
|
00a7bd8596 | ||
|
11840d1c73 | ||
|
2db1b1c0be | ||
|
996994c714 | ||
|
328f4fee60 | ||
|
b77a938972 | ||
|
bfb8eb7eae | ||
|
b468fab240 | ||
|
b5715bdd0b | ||
|
496959ebbd | ||
|
8da782ef64 | ||
|
d946915c20 | ||
|
9d02485ed9 | ||
|
b12401e0d5 | ||
|
6603071a99 | ||
|
9c8e9fb600 | ||
|
8d1bf3c7ff | ||
|
f920436385 | ||
|
c9429ecf52 | ||
|
b55c37167d | ||
|
7ecb668390 | ||
|
6926b9c403 | ||
|
7bccea09a7 | ||
|
e32dc37570 | ||
|
2bb0622079 | ||
|
d74358bc41 | ||
|
0818de2d5b | ||
|
a649ec0158 | ||
|
22df83431d | ||
|
11cfa8ef8d | ||
|
7d86a2d45c | ||
|
7a0e7e55d8 | ||
|
4fa8085100 | ||
|
f3d0213e5b | ||
|
93ed8ff770 | ||
|
b7146cbec5 | ||
|
3832f94664 | ||
|
f5de1a0530 | ||
|
fb5ab39697 | ||
|
3a44e4bec8 | ||
|
4a4aafb247 | ||
|
97ddaeee9e | ||
|
df71db0ede | ||
|
b4d06fb78d | ||
|
81f9c57504 | ||
|
b1e0f4ed69 | ||
|
0591bcfdfa | ||
|
cb51c9902f | ||
|
e3307dddec | ||
|
867f2ca48e | ||
|
ddc5c471d4 | ||
|
247ec3f4cc | ||
|
172f04f5bb | ||
|
941821d8ac | ||
|
2be57a5131 | ||
|
c9e4ece63a | ||
|
0645e2b90a | ||
|
0cc970b3db | ||
|
4a446b03dc | ||
|
32485259c1 | ||
|
c6732f7f2f | ||
|
56d74412d9 | ||
|
6925aa36f2 | ||
|
c5191fbd2b | ||
|
dca92ddfbf | ||
|
e9333003ea | ||
|
86110e1a19 | ||
|
73bb565476 | ||
|
978d3d3647 | ||
|
278d457684 | ||
|
25a116143a | ||
|
fb6efdf277 | ||
|
62f864c32c | ||
|
3b2931fbf5 | ||
|
97d8fe8791 | ||
|
6984e41478 | ||
|
93c96bab3d | ||
|
2b3c87952d | ||
|
e6d67b57dd | ||
|
b7d5066c30 | ||
|
fbd3c46d32 | ||
|
c5c4070f88 | ||
|
f60b1d829d | ||
|
083508af51 | ||
|
c946965956 | ||
|
810b94f0aa | ||
|
8e045ec6f5 | ||
|
da98e15760 | ||
|
3803c372a1 | ||
|
5d0bf05abe | ||
|
eb730a0ca9 | ||
|
0d90d6ea7a | ||
|
3285ee538b | ||
|
c962017556 | ||
|
db12374b74 | ||
|
e56d25204f | ||
|
77380b5cba | ||
|
a8f84bcded | ||
|
f5d7ba7593 | ||
|
8a46ca8568 | ||
|
5fb9aa5673 | ||
|
29c326b745 | ||
|
c40158e40b | ||
|
e4592d6028 | ||
|
90cf46d9cf | ||
|
14631f7fa5 | ||
|
f02fe2efc8 | ||
|
3c393c0a56 | ||
|
24eef5846c | ||
|
3ef9a46f7d | ||
|
03e4ffc38e | ||
|
9c43d88f6d | ||
|
fff52b1902 | ||
|
768c6e8be2 | ||
|
40ba2f3bcd | ||
|
37b2afb258 | ||
|
35c2acd4a8 | ||
|
6900d12d69 | ||
|
82c5bc84b8 | ||
|
3dee36ae33 | ||
|
0a164d4c4e | ||
|
bfd84575a2 | ||
|
92218ce600 | ||
|
7448de8d8d | ||
|
66e9a9f0ae | ||
|
0423ae974b | ||
|
b63269cabe | ||
|
38a4ddd52d | ||
|
77f4f0a700 | ||
|
8cc3b2e982 | ||
|
52abdc8300 | ||
|
7121be53c7 | ||
|
8ce8835c06 | ||
|
1dba7b4c69 | ||
|
7e1e696511 | ||
|
0872eaf957 | ||
|
6670f56440 | ||
|
7a893a3152 | ||
|
48962b9fdd | ||
|
4686e0f659 | ||
|
3c29734862 | ||
|
b0c4316ebd | ||
|
e1f2de5ab3 | ||
|
b903802e08 | ||
|
14ddc4d7eb | ||
|
2bb3c0c0dd | ||
|
3c58949394 | ||
|
94a5c401ac | ||
|
228146b082 | ||
|
056e68bb42 | ||
|
873aefb8b9 | ||
|
32c0c61cbd | ||
|
13aca5dd5d | ||
|
fde0548028 | ||
|
822fc19ef0 | ||
|
78a054f667 | ||
|
0a13502d18 | ||
|
b4626104e5 | ||
|
c447205527 | ||
|
0f8218d7ca | ||
|
121aea4614 | ||
|
8df1373abc | ||
|
45a9a13763 | ||
|
99b62b5ffc | ||
|
e0a3672027 | ||
|
28ea89b62b | ||
|
7ae74029b8 | ||
|
10b9be3230 | ||
|
99f0dc6887 | ||
|
62d5b1ceb7 | ||
|
36b6059076 | ||
|
e304942c65 | ||
|
c05cc2c727 | ||
|
c4e8770615 | ||
|
a3dc1da946 | ||
|
c707a0d410 | ||
|
a7b7500c4f | ||
|
a393585a1e | ||
|
874c5c9521 | ||
|
b3eb133b51 | ||
|
95e92d9049 |
90
include/wx/generic/scrolwin.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/scrolwin.h
|
||||
// Purpose: wxGenericScrolledWindow class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GENERIC_SCROLLWIN_H_
|
||||
#define _WX_GENERIC_SCROLLWIN_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers and constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
extern WXDLLEXPORT_DATA(const wxChar*) wxPanelNameStr;
|
||||
|
||||
// default scrolled window style
|
||||
#ifndef wxScrolledWindowStyle
|
||||
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGenericScrolledWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxGenericScrolledWindow : public wxPanel,
|
||||
public wxScrollHelper
|
||||
{
|
||||
public:
|
||||
wxGenericScrolledWindow() : wxScrollHelper(this) { }
|
||||
wxGenericScrolledWindow(wxWindow *parent,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
: wxScrollHelper(this)
|
||||
{
|
||||
Create(parent, winid, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxGenericScrolledWindow();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
|
||||
|
||||
// lay out the window and its children
|
||||
virtual bool Layout();
|
||||
|
||||
virtual void DoSetVirtualSize(int x, int y);
|
||||
|
||||
// wxWindow's GetBestVirtualSize returns the actual window size,
|
||||
// whereas we want to return the virtual size
|
||||
virtual wxSize GetBestVirtualSize() const;
|
||||
|
||||
// Return the size best suited for the current window
|
||||
// (this isn't a virtual size, this is a sensible size for the window)
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
protected:
|
||||
// this is needed for wxEVT_PAINT processing hack described in
|
||||
// wxScrollHelperEvtHandler::ProcessEvent()
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
// we need to return a special WM_GETDLGCODE value to process just the
|
||||
// arrows but let the other navigation characters through
|
||||
#ifdef __WXMSW__
|
||||
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
#endif // __WXMSW__
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericScrolledWindow)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // _WX_GENERIC_SCROLLWIN_H_
|
||||
|
193
include/wx/gtk/scrolwin.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/scrolwin.h
|
||||
// Purpose: wxScrolledWindow class
|
||||
// Author: Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_SCROLLWIN_H_
|
||||
#define _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers and constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||
|
||||
// default scrolled window style
|
||||
#ifndef wxScrolledWindowStyle
|
||||
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrolledWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxScrolledWindow : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxScrolledWindow()
|
||||
{ Init(); }
|
||||
|
||||
wxScrolledWindow(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{ Create(parent, id, pos, size, style, name); }
|
||||
|
||||
void Init();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
// Normally the wxScrolledWindow will scroll itself, but in
|
||||
// some rare occasions you might want it to scroll another
|
||||
// window (e.g. a child of it in order to scroll only a portion
|
||||
// the area between the scrollbars (spreadsheet: only cell area
|
||||
// will move).
|
||||
virtual void SetTargetWindow( wxWindow *target, bool pushEventHandler = FALSE );
|
||||
virtual wxWindow *GetTargetWindow() const;
|
||||
|
||||
// Set the scrolled area of the window.
|
||||
virtual void DoSetVirtualSize( int x, int y );
|
||||
|
||||
// wxWindow's GetBestVirtualSize returns the actual window size,
|
||||
// whereas we want to return the virtual size
|
||||
virtual wxSize GetBestVirtualSize() const;
|
||||
|
||||
// Return the size best suited for the current window
|
||||
// (this isn't a virtual size, this is a sensible size for the window)
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// Set the x, y scrolling increments.
|
||||
void SetScrollRate( int xstep, int ystep );
|
||||
|
||||
// Number of pixels per user unit (0 or -1 for no scrollbar)
|
||||
// Length of virtual canvas in user units
|
||||
// Length of page in user units
|
||||
// Default action is to set the virtual size and alter scrollbars
|
||||
// accordingly.
|
||||
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
||||
int noUnitsX, int noUnitsY,
|
||||
int xPos = 0, int yPos = 0,
|
||||
bool noRefresh = FALSE );
|
||||
|
||||
// Physically scroll the window
|
||||
virtual void Scroll(int x_pos, int y_pos);
|
||||
|
||||
int GetScrollPageSize(int orient) const;
|
||||
void SetScrollPageSize(int orient, int pageSize);
|
||||
|
||||
virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
|
||||
|
||||
// Enable/disable Windows scrolling in either direction.
|
||||
// If TRUE, wxWidgets scrolls the canvas and only a bit of
|
||||
// the canvas is invalidated; no Clear() is necessary.
|
||||
// If FALSE, the whole canvas is invalidated and a Clear() is
|
||||
// necessary. Disable for when the scroll increment is used
|
||||
// to actually scroll a non-constant distance
|
||||
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
|
||||
|
||||
// Get the view start
|
||||
virtual void GetViewStart(int *x, int *y) const;
|
||||
|
||||
// translate between scrolled and unscrolled coordinates
|
||||
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcScrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcScrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
|
||||
// Override this function to draw the graphic (or just process EVT_PAINT)
|
||||
virtual void OnDraw(wxDC& WXUNUSED(dc)) {}
|
||||
|
||||
// Override this function if you don't want to have wxScrolledWindow
|
||||
// automatically change the origin according to the scroll position.
|
||||
void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
|
||||
|
||||
// lay out the window and its children
|
||||
virtual bool Layout();
|
||||
|
||||
// Adjust the scrollbars
|
||||
virtual void AdjustScrollbars();
|
||||
|
||||
// Set the scale factor, used in PrepareDC
|
||||
void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
|
||||
double GetScaleX() const { return m_scaleX; }
|
||||
double GetScaleY() const { return m_scaleY; }
|
||||
|
||||
// implementation from now on
|
||||
void OnScroll(wxScrollWinEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
|
||||
void GtkVScroll( float value, unsigned int scroll_type );
|
||||
void GtkHScroll( float value, unsigned int scroll_type );
|
||||
void GtkVConnectEvent();
|
||||
void GtkHConnectEvent();
|
||||
void GtkVDisconnectEvent();
|
||||
void GtkHDisconnectEvent();
|
||||
|
||||
// Calculate scroll increment
|
||||
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
||||
|
||||
// Overridden from wxWidgets due callback being static
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
|
||||
virtual void DoPrepareDC(wxDC& dc);
|
||||
|
||||
protected:
|
||||
wxWindow *m_targetWindow;
|
||||
int m_xScrollPixelsPerLine;
|
||||
int m_yScrollPixelsPerLine;
|
||||
bool m_xScrollingEnabled;
|
||||
bool m_yScrollingEnabled;
|
||||
|
||||
// FIXME: these next four members are duplicated in the GtkAdjustment
|
||||
// members of wxWindow. Can they be safely removed from here?
|
||||
|
||||
int m_xScrollPosition;
|
||||
int m_yScrollPosition;
|
||||
int m_xScrollLinesPerPage;
|
||||
int m_yScrollLinesPerPage;
|
||||
|
||||
double m_scaleY,m_scaleX;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxScrolledWindow)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// vi:sts=4:sw=4:et
|
300
include/wx/gtk/window.h
Normal file
@@ -0,0 +1,300 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/window.h
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __GTKWINDOWH__
|
||||
#define __GTKWINDOWH__
|
||||
|
||||
// helper structure that holds class that holds GtkIMContext object and
|
||||
// some additional data needed for key events processing
|
||||
struct wxGtkIMData;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// callback definition for inserting a window (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK;
|
||||
typedef void (*wxInsertChildFunction)( wxWindowGTK*, wxWindowGTK* );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWindowGTK
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase
|
||||
{
|
||||
public:
|
||||
// creating the window
|
||||
// -------------------
|
||||
wxWindowGTK();
|
||||
wxWindowGTK(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxWindowGTK();
|
||||
|
||||
// implement base class (pure) virtual methods
|
||||
// -------------------------------------------
|
||||
|
||||
virtual bool Destroy();
|
||||
|
||||
virtual void Raise();
|
||||
virtual void Lower();
|
||||
|
||||
virtual bool Show( bool show = TRUE );
|
||||
virtual bool Enable( bool enable = TRUE );
|
||||
|
||||
virtual bool IsRetained() const;
|
||||
|
||||
virtual void SetFocus();
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
virtual bool Reparent( wxWindowBase *newParent );
|
||||
|
||||
virtual void WarpPointer(int x, int y);
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE,
|
||||
const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Update();
|
||||
virtual void ClearBackground();
|
||||
|
||||
virtual bool SetBackgroundColour( const wxColour &colour );
|
||||
virtual bool SetForegroundColour( const wxColour &colour );
|
||||
virtual bool SetCursor( const wxCursor &cursor );
|
||||
virtual bool SetFont( const wxFont &font );
|
||||
|
||||
virtual bool SetBackgroundStyle(wxBackgroundStyle style) ;
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = TRUE );
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
virtual int GetScrollPos( int orient ) const;
|
||||
virtual int GetScrollThumb( int orient ) const;
|
||||
virtual int GetScrollRange( int orient ) const;
|
||||
virtual void ScrollWindow( int dx, int dy,
|
||||
const wxRect* rect = (wxRect *) NULL );
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void AddChild( wxWindowBase *child );
|
||||
virtual void RemoveChild( wxWindowBase *child );
|
||||
#endif
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
virtual WXWidget GetHandle() const { return m_widget; }
|
||||
|
||||
// I don't want users to override what's done in idle so everything that
|
||||
// has to be done in idle time in order for wxGTK to work is done in
|
||||
// OnInternalIdle
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// Internal represention of Update()
|
||||
void GtkUpdate();
|
||||
|
||||
// For compatibility across platforms (not in event table)
|
||||
void OnIdle(wxIdleEvent& WXUNUSED(event)) {}
|
||||
|
||||
// wxGTK-specific: called recursively by Enable,
|
||||
// to give widgets an oppprtunity to correct their colours after they
|
||||
// have been changed by Enable
|
||||
virtual void OnParentEnable( bool WXUNUSED(enable) ) {}
|
||||
|
||||
// Used by all window classes in the widget creation process.
|
||||
bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size );
|
||||
void PostCreation();
|
||||
|
||||
// Internal addition of child windows. differs from class
|
||||
// to class not by using virtual functions but by using
|
||||
// the m_insertCallback.
|
||||
void DoAddChild(wxWindowGTK *child);
|
||||
|
||||
// This methods sends wxPaintEvents to the window. It reads the
|
||||
// update region, breaks it up into rects and sends an event
|
||||
// for each rect. It is also responsible for background erase
|
||||
// events and NC paint events. It is called from "draw" and
|
||||
// "expose" handlers as well as from ::Update()
|
||||
void GtkSendPaintEvents();
|
||||
|
||||
// The methods below are required because many native widgets
|
||||
// are composed of several subwidgets and setting a style for
|
||||
// the widget means setting it for all subwidgets as well.
|
||||
// also, it is nor clear, which native widget is the top
|
||||
// widget where (most of) the input goes. even tooltips have
|
||||
// to be applied to all subwidgets.
|
||||
virtual GtkWidget* GetConnectWidget();
|
||||
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ConnectWidget( GtkWidget *widget );
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
// Returns the default context which usually is anti-aliased
|
||||
PangoContext *GtkGetPangoDefaultContext();
|
||||
|
||||
// Returns the X11 context which renders on the X11 client
|
||||
// side (which can be remote) and which usually is not
|
||||
// anti-aliased and is thus faster
|
||||
// MR: Now returns the default pango_context for the widget as GtkGetPangoDefaultContext to
|
||||
// not depend on libpangox - which is completely deprecated.
|
||||
//BCI: Remove GtkGetPangoX11Context and m_x11Context completely when symbols may be removed
|
||||
PangoContext *GtkGetPangoX11Context();
|
||||
PangoContext *m_x11Context; // MR: Now unused
|
||||
#endif
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// Called from GTK signales handlers. it indicates that
|
||||
// the layouting functions have to be called later on
|
||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
||||
|
||||
// fix up the mouse event coords, used by wxListBox only so far
|
||||
virtual void FixUpMouseEvent(GtkWidget * WXUNUSED(widget),
|
||||
wxCoord& WXUNUSED(x),
|
||||
wxCoord& WXUNUSED(y)) { }
|
||||
|
||||
// is this window transparent for the mouse events (as wxStaticBox is)?
|
||||
virtual bool IsTransparentForMouse() const { return FALSE; }
|
||||
|
||||
// is this a radiobutton (used by radiobutton code itself only)?
|
||||
virtual bool IsRadioButton() const { return FALSE; }
|
||||
|
||||
// position and size of the window
|
||||
int m_x, m_y;
|
||||
int m_width, m_height;
|
||||
int m_oldClientWidth,m_oldClientHeight;
|
||||
|
||||
// see the docs in src/gtk/window.cpp
|
||||
GtkWidget *m_widget; // mostly the widget seen by the rest of GTK
|
||||
GtkWidget *m_wxwindow; // mostly the client area as per wxWidgets
|
||||
|
||||
// this widget will be queried for GTK's focus events
|
||||
GtkWidget *m_focusWidget;
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
wxGtkIMData *m_imData;
|
||||
#else // GTK 1
|
||||
#ifdef HAVE_XIM
|
||||
// XIM support for wxWidgets
|
||||
GdkIC *m_ic;
|
||||
GdkICAttr *m_icattr;
|
||||
#endif // HAVE_XIM
|
||||
#endif // GTK 2/1
|
||||
|
||||
#ifndef __WXGTK20__
|
||||
// The area to be cleared (and not just refreshed)
|
||||
// We cannot make this distinction under GTK 2.0.
|
||||
wxRegion m_clearRegion;
|
||||
#endif
|
||||
|
||||
// scrolling stuff
|
||||
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
||||
float m_oldHorizontalPos;
|
||||
float m_oldVerticalPos;
|
||||
|
||||
// extra (wxGTK-specific) flags
|
||||
bool m_needParent:1; // ! wxFrame, wxDialog, wxNotebookPage ?
|
||||
bool m_noExpose:1; // wxGLCanvas has its own redrawing
|
||||
bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size"
|
||||
bool m_hasScrolling:1;
|
||||
bool m_hasVMT:1;
|
||||
bool m_sizeSet:1;
|
||||
bool m_resizing:1;
|
||||
bool m_acceptsFocus:1; // true if not static
|
||||
bool m_hasFocus:1; // true if == FindFocus()
|
||||
bool m_isScrolling:1; // dragging scrollbar thumb?
|
||||
bool m_clipPaintRegion:1; // TRUE after ScrollWindow()
|
||||
#ifdef __WXGTK20__
|
||||
bool m_dirtyTabOrder:1; // tab order changed, GTK focus
|
||||
// chain needs update
|
||||
#endif
|
||||
bool m_needsStyleChange:1; // May not be able to change
|
||||
// background style until OnIdle
|
||||
|
||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||
// different methods of inserting a child window into a wxFrame,
|
||||
// wxMDIFrame, wxNotebook etc. this is the callback that will get used.
|
||||
wxInsertChildFunction m_insertCallback;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
virtual void DoGetSize( int *width, int *height ) const;
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
virtual void DoCaptureMouse();
|
||||
virtual void DoReleaseMouse();
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
protected:
|
||||
// common part of all ctors (not virtual because called from ctor)
|
||||
void Init();
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move);
|
||||
|
||||
// Copies m_children tab order to GTK focus chain:
|
||||
void RealizeTabOrder();
|
||||
#endif
|
||||
|
||||
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
||||
// SetXXXColour etc to apply style changed to native widgets) to create
|
||||
// modified GTK style with non-standard attributes. If forceStyle=true,
|
||||
// creates empty GtkRcStyle if there are no modifications, otherwise
|
||||
// returns NULL in such case.
|
||||
GtkRcStyle *CreateWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// Overridden in many GTK widgets who have to handle subwidgets
|
||||
virtual void ApplyWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// helper function to ease native widgets wrapping, called by
|
||||
// ApplyWidgetStyle -- override this, not ApplyWidgetStyle
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowGTK)
|
||||
DECLARE_NO_COPY_CLASS(wxWindowGTK)
|
||||
};
|
||||
|
||||
extern WXDLLIMPEXP_CORE wxWindow *wxFindFocusedChild(wxWindowGTK *win);
|
||||
|
||||
#endif // __GTKWINDOWH__
|
193
include/wx/gtk1/scrolwin.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/scrolwin.h
|
||||
// Purpose: wxScrolledWindow class
|
||||
// Author: Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_SCROLLWIN_H_
|
||||
#define _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers and constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||
|
||||
// default scrolled window style
|
||||
#ifndef wxScrolledWindowStyle
|
||||
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrolledWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxScrolledWindow : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxScrolledWindow()
|
||||
{ Init(); }
|
||||
|
||||
wxScrolledWindow(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{ Create(parent, id, pos, size, style, name); }
|
||||
|
||||
void Init();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
// Normally the wxScrolledWindow will scroll itself, but in
|
||||
// some rare occasions you might want it to scroll another
|
||||
// window (e.g. a child of it in order to scroll only a portion
|
||||
// the area between the scrollbars (spreadsheet: only cell area
|
||||
// will move).
|
||||
virtual void SetTargetWindow( wxWindow *target, bool pushEventHandler = FALSE );
|
||||
virtual wxWindow *GetTargetWindow() const;
|
||||
|
||||
// Set the scrolled area of the window.
|
||||
virtual void DoSetVirtualSize( int x, int y );
|
||||
|
||||
// wxWindow's GetBestVirtualSize returns the actual window size,
|
||||
// whereas we want to return the virtual size
|
||||
virtual wxSize GetBestVirtualSize() const;
|
||||
|
||||
// Return the size best suited for the current window
|
||||
// (this isn't a virtual size, this is a sensible size for the window)
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// Set the x, y scrolling increments.
|
||||
void SetScrollRate( int xstep, int ystep );
|
||||
|
||||
// Number of pixels per user unit (0 or -1 for no scrollbar)
|
||||
// Length of virtual canvas in user units
|
||||
// Length of page in user units
|
||||
// Default action is to set the virtual size and alter scrollbars
|
||||
// accordingly.
|
||||
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
||||
int noUnitsX, int noUnitsY,
|
||||
int xPos = 0, int yPos = 0,
|
||||
bool noRefresh = FALSE );
|
||||
|
||||
// Physically scroll the window
|
||||
virtual void Scroll(int x_pos, int y_pos);
|
||||
|
||||
int GetScrollPageSize(int orient) const;
|
||||
void SetScrollPageSize(int orient, int pageSize);
|
||||
|
||||
virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
|
||||
|
||||
// Enable/disable Windows scrolling in either direction.
|
||||
// If TRUE, wxWidgets scrolls the canvas and only a bit of
|
||||
// the canvas is invalidated; no Clear() is necessary.
|
||||
// If FALSE, the whole canvas is invalidated and a Clear() is
|
||||
// necessary. Disable for when the scroll increment is used
|
||||
// to actually scroll a non-constant distance
|
||||
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
|
||||
|
||||
// Get the view start
|
||||
virtual void GetViewStart(int *x, int *y) const;
|
||||
|
||||
// translate between scrolled and unscrolled coordinates
|
||||
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcScrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcScrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
|
||||
// Override this function to draw the graphic (or just process EVT_PAINT)
|
||||
virtual void OnDraw(wxDC& WXUNUSED(dc)) {}
|
||||
|
||||
// Override this function if you don't want to have wxScrolledWindow
|
||||
// automatically change the origin according to the scroll position.
|
||||
void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
|
||||
|
||||
// lay out the window and its children
|
||||
virtual bool Layout();
|
||||
|
||||
// Adjust the scrollbars
|
||||
virtual void AdjustScrollbars();
|
||||
|
||||
// Set the scale factor, used in PrepareDC
|
||||
void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
|
||||
double GetScaleX() const { return m_scaleX; }
|
||||
double GetScaleY() const { return m_scaleY; }
|
||||
|
||||
// implementation from now on
|
||||
void OnScroll(wxScrollWinEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
|
||||
void GtkVScroll( float value, unsigned int scroll_type );
|
||||
void GtkHScroll( float value, unsigned int scroll_type );
|
||||
void GtkVConnectEvent();
|
||||
void GtkHConnectEvent();
|
||||
void GtkVDisconnectEvent();
|
||||
void GtkHDisconnectEvent();
|
||||
|
||||
// Calculate scroll increment
|
||||
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
||||
|
||||
// Overridden from wxWidgets due callback being static
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
|
||||
virtual void DoPrepareDC(wxDC& dc);
|
||||
|
||||
protected:
|
||||
wxWindow *m_targetWindow;
|
||||
int m_xScrollPixelsPerLine;
|
||||
int m_yScrollPixelsPerLine;
|
||||
bool m_xScrollingEnabled;
|
||||
bool m_yScrollingEnabled;
|
||||
|
||||
// FIXME: these next four members are duplicated in the GtkAdjustment
|
||||
// members of wxWindow. Can they be safely removed from here?
|
||||
|
||||
int m_xScrollPosition;
|
||||
int m_yScrollPosition;
|
||||
int m_xScrollLinesPerPage;
|
||||
int m_yScrollLinesPerPage;
|
||||
|
||||
double m_scaleY,m_scaleX;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxScrolledWindow)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// vi:sts=4:sw=4:et
|
300
include/wx/gtk1/window.h
Normal file
@@ -0,0 +1,300 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/window.h
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __GTKWINDOWH__
|
||||
#define __GTKWINDOWH__
|
||||
|
||||
// helper structure that holds class that holds GtkIMContext object and
|
||||
// some additional data needed for key events processing
|
||||
struct wxGtkIMData;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// callback definition for inserting a window (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK;
|
||||
typedef void (*wxInsertChildFunction)( wxWindowGTK*, wxWindowGTK* );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWindowGTK
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase
|
||||
{
|
||||
public:
|
||||
// creating the window
|
||||
// -------------------
|
||||
wxWindowGTK();
|
||||
wxWindowGTK(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxWindowGTK();
|
||||
|
||||
// implement base class (pure) virtual methods
|
||||
// -------------------------------------------
|
||||
|
||||
virtual bool Destroy();
|
||||
|
||||
virtual void Raise();
|
||||
virtual void Lower();
|
||||
|
||||
virtual bool Show( bool show = TRUE );
|
||||
virtual bool Enable( bool enable = TRUE );
|
||||
|
||||
virtual bool IsRetained() const;
|
||||
|
||||
virtual void SetFocus();
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
virtual bool Reparent( wxWindowBase *newParent );
|
||||
|
||||
virtual void WarpPointer(int x, int y);
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE,
|
||||
const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Update();
|
||||
virtual void ClearBackground();
|
||||
|
||||
virtual bool SetBackgroundColour( const wxColour &colour );
|
||||
virtual bool SetForegroundColour( const wxColour &colour );
|
||||
virtual bool SetCursor( const wxCursor &cursor );
|
||||
virtual bool SetFont( const wxFont &font );
|
||||
|
||||
virtual bool SetBackgroundStyle(wxBackgroundStyle style) ;
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = TRUE );
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
virtual int GetScrollPos( int orient ) const;
|
||||
virtual int GetScrollThumb( int orient ) const;
|
||||
virtual int GetScrollRange( int orient ) const;
|
||||
virtual void ScrollWindow( int dx, int dy,
|
||||
const wxRect* rect = (wxRect *) NULL );
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void AddChild( wxWindowBase *child );
|
||||
virtual void RemoveChild( wxWindowBase *child );
|
||||
#endif
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
virtual WXWidget GetHandle() const { return m_widget; }
|
||||
|
||||
// I don't want users to override what's done in idle so everything that
|
||||
// has to be done in idle time in order for wxGTK to work is done in
|
||||
// OnInternalIdle
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// Internal represention of Update()
|
||||
void GtkUpdate();
|
||||
|
||||
// For compatibility across platforms (not in event table)
|
||||
void OnIdle(wxIdleEvent& WXUNUSED(event)) {}
|
||||
|
||||
// wxGTK-specific: called recursively by Enable,
|
||||
// to give widgets an oppprtunity to correct their colours after they
|
||||
// have been changed by Enable
|
||||
virtual void OnParentEnable( bool WXUNUSED(enable) ) {}
|
||||
|
||||
// Used by all window classes in the widget creation process.
|
||||
bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size );
|
||||
void PostCreation();
|
||||
|
||||
// Internal addition of child windows. differs from class
|
||||
// to class not by using virtual functions but by using
|
||||
// the m_insertCallback.
|
||||
void DoAddChild(wxWindowGTK *child);
|
||||
|
||||
// This methods sends wxPaintEvents to the window. It reads the
|
||||
// update region, breaks it up into rects and sends an event
|
||||
// for each rect. It is also responsible for background erase
|
||||
// events and NC paint events. It is called from "draw" and
|
||||
// "expose" handlers as well as from ::Update()
|
||||
void GtkSendPaintEvents();
|
||||
|
||||
// The methods below are required because many native widgets
|
||||
// are composed of several subwidgets and setting a style for
|
||||
// the widget means setting it for all subwidgets as well.
|
||||
// also, it is nor clear, which native widget is the top
|
||||
// widget where (most of) the input goes. even tooltips have
|
||||
// to be applied to all subwidgets.
|
||||
virtual GtkWidget* GetConnectWidget();
|
||||
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ConnectWidget( GtkWidget *widget );
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
// Returns the default context which usually is anti-aliased
|
||||
PangoContext *GtkGetPangoDefaultContext();
|
||||
|
||||
// Returns the X11 context which renders on the X11 client
|
||||
// side (which can be remote) and which usually is not
|
||||
// anti-aliased and is thus faster
|
||||
// MR: Now returns the default pango_context for the widget as GtkGetPangoDefaultContext to
|
||||
// not depend on libpangox - which is completely deprecated.
|
||||
//BCI: Remove GtkGetPangoX11Context and m_x11Context completely when symbols may be removed
|
||||
PangoContext *GtkGetPangoX11Context();
|
||||
PangoContext *m_x11Context; // MR: Now unused
|
||||
#endif
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// Called from GTK signales handlers. it indicates that
|
||||
// the layouting functions have to be called later on
|
||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
||||
|
||||
// fix up the mouse event coords, used by wxListBox only so far
|
||||
virtual void FixUpMouseEvent(GtkWidget * WXUNUSED(widget),
|
||||
wxCoord& WXUNUSED(x),
|
||||
wxCoord& WXUNUSED(y)) { }
|
||||
|
||||
// is this window transparent for the mouse events (as wxStaticBox is)?
|
||||
virtual bool IsTransparentForMouse() const { return FALSE; }
|
||||
|
||||
// is this a radiobutton (used by radiobutton code itself only)?
|
||||
virtual bool IsRadioButton() const { return FALSE; }
|
||||
|
||||
// position and size of the window
|
||||
int m_x, m_y;
|
||||
int m_width, m_height;
|
||||
int m_oldClientWidth,m_oldClientHeight;
|
||||
|
||||
// see the docs in src/gtk/window.cpp
|
||||
GtkWidget *m_widget; // mostly the widget seen by the rest of GTK
|
||||
GtkWidget *m_wxwindow; // mostly the client area as per wxWidgets
|
||||
|
||||
// this widget will be queried for GTK's focus events
|
||||
GtkWidget *m_focusWidget;
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
wxGtkIMData *m_imData;
|
||||
#else // GTK 1
|
||||
#ifdef HAVE_XIM
|
||||
// XIM support for wxWidgets
|
||||
GdkIC *m_ic;
|
||||
GdkICAttr *m_icattr;
|
||||
#endif // HAVE_XIM
|
||||
#endif // GTK 2/1
|
||||
|
||||
#ifndef __WXGTK20__
|
||||
// The area to be cleared (and not just refreshed)
|
||||
// We cannot make this distinction under GTK 2.0.
|
||||
wxRegion m_clearRegion;
|
||||
#endif
|
||||
|
||||
// scrolling stuff
|
||||
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
||||
float m_oldHorizontalPos;
|
||||
float m_oldVerticalPos;
|
||||
|
||||
// extra (wxGTK-specific) flags
|
||||
bool m_needParent:1; // ! wxFrame, wxDialog, wxNotebookPage ?
|
||||
bool m_noExpose:1; // wxGLCanvas has its own redrawing
|
||||
bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size"
|
||||
bool m_hasScrolling:1;
|
||||
bool m_hasVMT:1;
|
||||
bool m_sizeSet:1;
|
||||
bool m_resizing:1;
|
||||
bool m_acceptsFocus:1; // true if not static
|
||||
bool m_hasFocus:1; // true if == FindFocus()
|
||||
bool m_isScrolling:1; // dragging scrollbar thumb?
|
||||
bool m_clipPaintRegion:1; // TRUE after ScrollWindow()
|
||||
#ifdef __WXGTK20__
|
||||
bool m_dirtyTabOrder:1; // tab order changed, GTK focus
|
||||
// chain needs update
|
||||
#endif
|
||||
bool m_needsStyleChange:1; // May not be able to change
|
||||
// background style until OnIdle
|
||||
|
||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||
// different methods of inserting a child window into a wxFrame,
|
||||
// wxMDIFrame, wxNotebook etc. this is the callback that will get used.
|
||||
wxInsertChildFunction m_insertCallback;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
virtual void DoGetSize( int *width, int *height ) const;
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
virtual void DoCaptureMouse();
|
||||
virtual void DoReleaseMouse();
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
protected:
|
||||
// common part of all ctors (not virtual because called from ctor)
|
||||
void Init();
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move);
|
||||
|
||||
// Copies m_children tab order to GTK focus chain:
|
||||
void RealizeTabOrder();
|
||||
#endif
|
||||
|
||||
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
||||
// SetXXXColour etc to apply style changed to native widgets) to create
|
||||
// modified GTK style with non-standard attributes. If forceStyle=true,
|
||||
// creates empty GtkRcStyle if there are no modifications, otherwise
|
||||
// returns NULL in such case.
|
||||
GtkRcStyle *CreateWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// Overridden in many GTK widgets who have to handle subwidgets
|
||||
virtual void ApplyWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// helper function to ease native widgets wrapping, called by
|
||||
// ApplyWidgetStyle -- override this, not ApplyWidgetStyle
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowGTK)
|
||||
DECLARE_NO_COPY_CLASS(wxWindowGTK)
|
||||
};
|
||||
|
||||
extern WXDLLIMPEXP_CORE wxWindow *wxFindFocusedChild(wxWindowGTK *win);
|
||||
|
||||
#endif // __GTKWINDOWH__
|
238
include/wx/scrolwin.h
Normal file
@@ -0,0 +1,238 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: include/wx/scrolwin.h
|
||||
// Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 30.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_SCROLWIN_H_BASE_
|
||||
#define _WX_SCROLWIN_H_BASE_
|
||||
|
||||
#include "wx/window.h"
|
||||
|
||||
class WXDLLEXPORT wxScrollHelperEvtHandler;
|
||||
class WXDLLEXPORT wxTimer;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrollHelper: this class implements the scrolling logic which is used by
|
||||
// wxScrolledWindow and wxScrolledControl. It is a mix-in: just derive from it
|
||||
// to implement scrolling in your class.
|
||||
// ----------------------------------------------------------------------------
|
||||
#if !defined(__WXGTK__) || defined(__WXUNIVERSAL__)
|
||||
|
||||
class WXDLLEXPORT wxScrollHelper
|
||||
{
|
||||
public:
|
||||
// ctor and dtor
|
||||
wxScrollHelper(wxWindow *winToScroll = (wxWindow *)NULL);
|
||||
void SetWindow(wxWindow *winToScroll);
|
||||
virtual ~wxScrollHelper();
|
||||
|
||||
// configure the scrolling
|
||||
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
||||
int noUnitsX, int noUnitsY,
|
||||
int xPos = 0, int yPos = 0,
|
||||
bool noRefresh = false );
|
||||
|
||||
// scroll to the given (in logical coords) position
|
||||
virtual void Scroll(int x, int y);
|
||||
|
||||
// get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL)
|
||||
int GetScrollPageSize(int orient) const;
|
||||
void SetScrollPageSize(int orient, int pageSize);
|
||||
|
||||
// Set the x, y scrolling increments.
|
||||
void SetScrollRate( int xstep, int ystep );
|
||||
|
||||
// get the size of one logical unit in physical ones
|
||||
virtual void GetScrollPixelsPerUnit(int *pixelsPerUnitX,
|
||||
int *pixelsPerUnitY) const;
|
||||
|
||||
// Enable/disable Windows scrolling in either direction. If true, wxWidgets
|
||||
// scrolls the canvas and only a bit of the canvas is invalidated; no
|
||||
// Clear() is necessary. If false, the whole canvas is invalidated and a
|
||||
// Clear() is necessary. Disable for when the scroll increment is used to
|
||||
// actually scroll a non-constant distance
|
||||
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
|
||||
|
||||
// Get the view start
|
||||
virtual void GetViewStart(int *x, int *y) const;
|
||||
|
||||
// Set the scale factor, used in PrepareDC
|
||||
void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
|
||||
double GetScaleX() const { return m_scaleX; }
|
||||
double GetScaleY() const { return m_scaleY; }
|
||||
|
||||
// translate between scrolled and unscrolled coordinates
|
||||
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcScrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcScrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
|
||||
// Adjust the scrollbars
|
||||
virtual void AdjustScrollbars(void);
|
||||
|
||||
// Calculate scroll increment
|
||||
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
||||
|
||||
// Normally the wxScrolledWindow will scroll itself, but in some rare
|
||||
// occasions you might want it to scroll [part of] another window (e.g. a
|
||||
// child of it in order to scroll only a portion the area between the
|
||||
// scrollbars (spreadsheet: only cell area will move).
|
||||
virtual void SetTargetWindow(wxWindow *target);
|
||||
virtual wxWindow *GetTargetWindow() const;
|
||||
|
||||
void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; }
|
||||
wxRect GetTargetRect() const { return m_rectToScroll; }
|
||||
|
||||
// Override this function to draw the graphic (or just process EVT_PAINT)
|
||||
virtual void OnDraw(wxDC& WXUNUSED(dc)) { }
|
||||
|
||||
// change the DC origin according to the scroll position.
|
||||
virtual void DoPrepareDC(wxDC& dc);
|
||||
|
||||
// are we generating the autoscroll events?
|
||||
bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; }
|
||||
|
||||
// stop generating the scroll events when mouse is held outside the window
|
||||
void StopAutoScrolling();
|
||||
|
||||
// this method can be overridden in a derived class to forbid sending the
|
||||
// auto scroll events - note that unlike StopAutoScrolling() it doesn't
|
||||
// stop the timer, so it will be called repeatedly and will typically
|
||||
// return different values depending on the current mouse position
|
||||
//
|
||||
// the base class version just returns true
|
||||
virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const;
|
||||
|
||||
// the methods to be called from the window event handlers
|
||||
void HandleOnScroll(wxScrollWinEvent& event);
|
||||
void HandleOnSize(wxSizeEvent& event);
|
||||
void HandleOnPaint(wxPaintEvent& event);
|
||||
void HandleOnChar(wxKeyEvent& event);
|
||||
void HandleOnMouseEnter(wxMouseEvent& event);
|
||||
void HandleOnMouseLeave(wxMouseEvent& event);
|
||||
#if wxUSE_MOUSEWHEEL
|
||||
void HandleOnMouseWheel(wxMouseEvent& event);
|
||||
#endif // wxUSE_MOUSEWHEEL
|
||||
|
||||
// FIXME: this is needed for now for wxPlot compilation, should be removed
|
||||
// once it is fixed!
|
||||
void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); }
|
||||
|
||||
protected:
|
||||
// get pointer to our scroll rect if we use it or NULL
|
||||
const wxRect *GetScrollRect() const
|
||||
{
|
||||
return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL;
|
||||
}
|
||||
|
||||
// get the size of the target window
|
||||
wxSize GetTargetSize() const
|
||||
{
|
||||
return m_rectToScroll.width != 0 ? m_rectToScroll.GetSize()
|
||||
: m_targetWindow->GetClientSize();
|
||||
}
|
||||
|
||||
void GetTargetSize(int *w, int *h)
|
||||
{
|
||||
wxSize size = GetTargetSize();
|
||||
if ( w )
|
||||
*w = size.x;
|
||||
if ( h )
|
||||
*h = size.y;
|
||||
}
|
||||
|
||||
// change just the target window (unlike SetWindow which changes m_win as
|
||||
// well)
|
||||
void DoSetTargetWindow(wxWindow *target);
|
||||
|
||||
// delete the event handler we installed
|
||||
void DeleteEvtHandler();
|
||||
|
||||
double m_scaleX;
|
||||
double m_scaleY;
|
||||
|
||||
wxWindow *m_win,
|
||||
*m_targetWindow;
|
||||
|
||||
wxRect m_rectToScroll;
|
||||
|
||||
wxTimer *m_timerAutoScroll;
|
||||
|
||||
int m_xScrollPixelsPerLine;
|
||||
int m_yScrollPixelsPerLine;
|
||||
int m_xScrollPosition;
|
||||
int m_yScrollPosition;
|
||||
int m_xScrollLines;
|
||||
int m_yScrollLines;
|
||||
int m_xScrollLinesPerPage;
|
||||
int m_yScrollLinesPerPage;
|
||||
|
||||
bool m_xScrollingEnabled;
|
||||
bool m_yScrollingEnabled;
|
||||
|
||||
#if wxUSE_MOUSEWHEEL
|
||||
int m_wheelRotation;
|
||||
#endif // wxUSE_MOUSEWHEEL
|
||||
|
||||
wxScrollHelperEvtHandler *m_handler;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxScrollHelper)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrolledWindow: a wxWindow which knows how to scroll
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__)
|
||||
#include "wx/gtk/scrolwin.h"
|
||||
#else // !wxGTK
|
||||
#include "wx/generic/scrolwin.h"
|
||||
|
||||
class WXDLLEXPORT wxScrolledWindow : public wxGenericScrolledWindow
|
||||
{
|
||||
public:
|
||||
wxScrolledWindow() { }
|
||||
wxScrolledWindow(wxWindow *parent,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
: wxGenericScrolledWindow(parent, winid, pos, size, style, name)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow)
|
||||
};
|
||||
|
||||
#define wxSCROLLED_WINDOW_IS_GENERIC 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_SCROLWIN_H_BASE_
|
||||
|
1533
include/wx/window.h
Normal file
3023
src/common/wincmn.cpp
Normal file
1374
src/generic/scrlwing.cpp
Normal file
1044
src/gtk/scrolwin.cpp
Normal file
4904
src/gtk/window.cpp
Normal file
1044
src/gtk1/scrolwin.cpp
Normal file
4904
src/gtk1/window.cpp
Normal file
@@ -1,262 +0,0 @@
|
||||
0.1.5-3
|
||||
-------
|
||||
|
||||
xxxStdDialogButtonSizer pulldown menu with standard buttons.
|
||||
|
||||
Some fixes for selecting tools inside toolbar with test window open
|
||||
(whole toolbar is selected).
|
||||
|
||||
Toolbars can be added inside windows.
|
||||
|
||||
0.1.5-2
|
||||
-------
|
||||
|
||||
Using wx.GetDefaultPyEncoding/wx.SetDefaultPyEncoding for changing active encoding.
|
||||
|
||||
Fixed pasting siblings (Ctrl key pressed while pasting).
|
||||
|
||||
Dealed with ascii build (Python does not recognize 'ascii' as valid encoding).
|
||||
If encoding is not specified it is not written in XRC. Will add more
|
||||
customization in the future.
|
||||
|
||||
Changed to use SimpleTool instead or Toggle tool (does not work on Win32).
|
||||
|
||||
0.1.5-1
|
||||
-------
|
||||
|
||||
Added wxWizard, wxWizardPageSimple (only from pull-down menu).
|
||||
|
||||
Hide command for test window.
|
||||
|
||||
Replacing classes works better.
|
||||
|
||||
Added Locate tool.
|
||||
|
||||
0.1.4-1
|
||||
-------
|
||||
|
||||
Edit->Locate command (Ctrl-L) for quick selection of items.
|
||||
Works with event-handling controls (buttons, text fields) but
|
||||
not with labels/sizers.
|
||||
|
||||
Some improvements: relative paths for files supplied as command-
|
||||
line argument work correctly, notebook panels are highlighted
|
||||
better.
|
||||
|
||||
0.1.2-1
|
||||
_______
|
||||
|
||||
Added support for wxGridBagSizer (supported in wxPython 2.5).
|
||||
|
||||
0.1.1-5
|
||||
-------
|
||||
|
||||
Added subclass attribute.
|
||||
|
||||
0.1.1-4
|
||||
-------
|
||||
|
||||
Fixed problems with wxStaticBitmap (stock_id attribute, icon type
|
||||
switching).
|
||||
|
||||
Changed some dimensions in properties panel elements.
|
||||
|
||||
0.1.1-3
|
||||
-------
|
||||
|
||||
Sizes of some controls were not normal on wxMSW. Fixed.
|
||||
|
||||
Some changes to test window code to make it resize better and to
|
||||
have focus control with sawfish for all types of windows.
|
||||
|
||||
0.1.1-2
|
||||
-------
|
||||
|
||||
Bugs with currentEncoding and frame testing fixed.
|
||||
|
||||
Some required parameters are set to default if missing.
|
||||
|
||||
Unsupported classes are tolerated, with warning message.
|
||||
|
||||
wxScrolledWindow added (to 'control' pulldown menu, not yet to the
|
||||
tool palette).
|
||||
|
||||
Multi-line editing for labels and some values (wxTextCtrl,
|
||||
wxHtmlWindow).
|
||||
|
||||
0.1.1-1
|
||||
-------
|
||||
|
||||
Changed internationalization support. '-i' option removed, default
|
||||
encoding is used (should be defined in sitecustomize.py, or 'ascii' by
|
||||
default). When XRC file is opened with encoding specified,
|
||||
translations are not used.
|
||||
|
||||
0.1.1
|
||||
-----
|
||||
|
||||
Replace command added (not quite finished yet).
|
||||
|
||||
0.1.0
|
||||
-----
|
||||
|
||||
Finally implemented tools panel for almost all controls (except
|
||||
wxHtmlWindow, wxCalendarCtrl and wxGenericDirCtrl - they are too
|
||||
rarely used).
|
||||
|
||||
Changed some sizes in panel to better work with different fonts.
|
||||
|
||||
Fixed double-refreshing after Ctrl+R.
|
||||
|
||||
Maybe something else that I've forgot. It's been a looong day... :)
|
||||
|
||||
|
||||
0.0.9-6
|
||||
-------
|
||||
|
||||
Added dialog unit support.
|
||||
|
||||
Dealing with non-specified required values (set to defaults, if exist).
|
||||
|
||||
Added 'minsize' parameter of sizeritem.
|
||||
|
||||
Added '-i' option to turn off translations and use international characters.
|
||||
|
||||
0.0.9-5
|
||||
-------
|
||||
|
||||
Mac platform-specific checks.
|
||||
|
||||
0.0.9-4
|
||||
-------
|
||||
|
||||
Implemented standard bitmap selection.
|
||||
|
||||
Fixed a bug in FlexGridSizer code.
|
||||
|
||||
0.0.9-3
|
||||
-------
|
||||
|
||||
File browsing (for bitmaps/icons, etc.) had a small problem when current
|
||||
file was not saved yet.
|
||||
|
||||
0.0.9-2
|
||||
-------
|
||||
|
||||
Small bug fix for initial don't panic message.
|
||||
|
||||
0.0.9-1
|
||||
-------
|
||||
|
||||
Changed program structure, reduced use of global variables (grouped in
|
||||
module 'globals', which creates an instanse 'g' of class Globals.
|
||||
|
||||
First version of undo/redo working!
|
||||
|
||||
Support for toolbars inside panels and frames.
|
||||
|
||||
Added 'container' submenu for creating Panel, Notebook and ToolBar objects.
|
||||
|
||||
wxMSW-only: added code to switch focus back to main window when test
|
||||
window is updated.
|
||||
|
||||
0.0.8-2
|
||||
-------
|
||||
|
||||
Fixed unicode problem for unicode build.
|
||||
|
||||
0.0.8-1
|
||||
-------
|
||||
|
||||
Using WX_2_4_BRANCH.
|
||||
|
||||
Added new controls: wxSpinCtrl, wxGenericDirCtrl, unknown (custom
|
||||
control), improved wxXRC format suppor (menu styles, etc.).
|
||||
|
||||
Some I18N support: parsing "encoding" attribute in XML header, later
|
||||
it can be modified in "properties" panel for "XML tree".
|
||||
|
||||
UNIX note: currently XML writing for non-ascii chars works only if
|
||||
sys.getdefaultencoding() returns good value. To do this, one has to
|
||||
put following lines to "sitecustomize.py" file:
|
||||
|
||||
# Start code segment
|
||||
import sys
|
||||
sys.setdefaultencoding('iso-8859-1') # or whatever
|
||||
# End code segment
|
||||
|
||||
0.0.7
|
||||
-----
|
||||
|
||||
Some command-line arguments.
|
||||
|
||||
"Test window" command and toolbar button.
|
||||
|
||||
New panel interphace (wxHTMLWindow is not used anymore).
|
||||
|
||||
Toggling between embedded and detached panel.
|
||||
|
||||
Cache for already used windows.
|
||||
|
||||
Current top-level control is bold, if test window shown.
|
||||
|
||||
Undo/redo broken.
|
||||
|
||||
CheckListBox does not work unless wxXRC source fixed (in both wxPytnon and
|
||||
wxWin):
|
||||
|
||||
contrib/src/xrc/xmlrsall.cpp
|
||||
45,46c45,46
|
||||
< AddHandler(new wxListCtrlXmlHandler);
|
||||
< #if CHECKLISTBOX
|
||||
---
|
||||
> AddHandler(new wxListCtrlXmlHandler);
|
||||
> #if wxUSE_CHECKLISTBOX
|
||||
|
||||
This is fixed in CVS.
|
||||
|
||||
0.0.6
|
||||
-----
|
||||
|
||||
Toolbar, bitmap, icon support (no display yet).
|
||||
|
||||
Changed parameter objects, added support for multiple parameters (like
|
||||
`growablecols').
|
||||
|
||||
Fixed double-clicking problem with tree control on Windows.
|
||||
|
||||
Some performance improovements.
|
||||
|
||||
|
||||
0.0.5
|
||||
-----
|
||||
|
||||
Added notebook with properties page and style page. Fixed some problems
|
||||
on Windows.
|
||||
|
||||
|
||||
0.0.4
|
||||
-----
|
||||
|
||||
Some fixes suggested by RD
|
||||
|
||||
|
||||
0.0.3
|
||||
-----
|
||||
|
||||
Faster preview window refresh.
|
||||
|
||||
Cut/Paste works better.
|
||||
|
||||
Some tree icons.
|
||||
|
||||
Tree item names.
|
||||
|
||||
Bugfixes.
|
||||
|
||||
|
||||
0.0.2
|
||||
-----
|
||||
|
||||
The first release.
|
||||
|
@@ -1,68 +0,0 @@
|
||||
********************************************************************************
|
||||
|
||||
XRCed README
|
||||
|
||||
********************************************************************************
|
||||
|
||||
System requirements
|
||||
-------------------
|
||||
|
||||
XRCed requires wxWindows and wxPython greater or equal to 2.3.3, and
|
||||
Python 2.2 or newer (it may work with earlier version, but was not tested).
|
||||
|
||||
wxPython must be compiled with XRC support.
|
||||
|
||||
|
||||
Short manual
|
||||
------------
|
||||
|
||||
XRCed's idea is very straightforward: it is a visual tool for editing an XML
|
||||
file conforming to XRC format. Every operation performed in XRCed has direct
|
||||
correspondence to XML structure. So it is not really a usual point-and-click
|
||||
GUI builder, but don't let that scare you.
|
||||
|
||||
To start xrced, change to the directory where you installed it and run
|
||||
"python2.2 xrced.py".
|
||||
|
||||
On UNIX you can edit wrapper script "xrced.sh" to point to your installation
|
||||
directory.
|
||||
|
||||
To create an object, first you should select some object in the tree (or the
|
||||
root item if it's empty) then press the right mouse button and select an
|
||||
appropriate command. The pulldown menu is context-dependent on the selected
|
||||
object.
|
||||
|
||||
XRCed tries to guess if new object should be added as a next sibling or a
|
||||
child of current object, depending on the possibility of the object to have
|
||||
child objects and expanded state (if tree item is collapsed, new object will
|
||||
be sibling). You can change this behavior to create siblings by pressing and
|
||||
holding the Shift and Control keys before clicking the mouse.
|
||||
|
||||
Pressed Control key while pressing right button makes next item a sibling of
|
||||
selected item regardless of its expanded state.
|
||||
|
||||
Pressed Shift key changes the place for inserting new child to be before
|
||||
selected child, not after as by default.
|
||||
|
||||
Panel on the right contains object properties. Properties which are optional
|
||||
should be "checked" first. This panel can be made separate by unchecking
|
||||
"Embed Panel" in View menu.
|
||||
|
||||
All properties can be edited as text, and some are supplied with special
|
||||
editing controls.
|
||||
|
||||
The names of the properties are exactly as in XRC file, and it's usually not
|
||||
hard to guess what they do. XML ID is the name of the window, and must be
|
||||
present for top-level windows (though this is not enforced by XRCed).
|
||||
|
||||
To display the preview window double-click a top-level object (you should
|
||||
assign an XMLID to it first), press "Test" toolbar button or select command
|
||||
from View menu, or press F5. After that, if you select a child object, it
|
||||
becomes highlighted, and if you change it, preview is updated when you select
|
||||
another item or press Ctrl-R (refresh). To turn off automatic update, toggle
|
||||
"View->Auto-refresh" or toolbar auto-refresh button (to the right of the
|
||||
refresh button).
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Copyright 2001-2003 Roman Rolinsky <rollrom@xrced.sourceforge.net>
|
@@ -1,29 +0,0 @@
|
||||
TODO for XRCed
|
||||
==============
|
||||
|
||||
- better help
|
||||
|
||||
+ undo/redo
|
||||
|
||||
+ tree icons
|
||||
|
||||
- replace object with another, keeping children
|
||||
|
||||
+ write tmp file for current dialog/panel/etc.
|
||||
|
||||
+ XML indents
|
||||
|
||||
+ select same notebook pages after update
|
||||
|
||||
- put some default values in tree ctrl etc.
|
||||
|
||||
- special (fast) update for some values: pos/size, value/content, sizeritem
|
||||
stuff (?), well, as much as possible
|
||||
|
||||
- highlighting with better method
|
||||
|
||||
- import XRC/WXR files
|
||||
|
||||
+ disable some window creation when it's not valid
|
||||
|
||||
- selecting object by clicking in test window
|
Before Width: | Height: | Size: 542 B |
Before Width: | Height: | Size: 677 B |
@@ -1,4 +0,0 @@
|
||||
#
|
||||
|
||||
|
||||
|
@@ -1,34 +0,0 @@
|
||||
"""
|
||||
A simple script to encode all the images the XRCed needs into a Python module
|
||||
"""
|
||||
|
||||
import sys, os, glob
|
||||
from wx.tools import img2py
|
||||
|
||||
def main():
|
||||
output = 'images.py'
|
||||
|
||||
# get the list of PNG files
|
||||
files = glob.glob('src-images/*.png')
|
||||
files.sort()
|
||||
|
||||
# Truncate the inages module
|
||||
open(output, 'w')
|
||||
|
||||
# call img2py on each file
|
||||
for file in files:
|
||||
|
||||
# extract the basename to be used as the image name
|
||||
name = os.path.splitext(os.path.basename(file))[0]
|
||||
|
||||
# encode it
|
||||
if file == files[0]:
|
||||
cmd = "-u -i -n %s %s %s" % (name, file, output)
|
||||
else:
|
||||
cmd = "-a -u -i -n %s %s %s" % (name, file, output)
|
||||
img2py.main(cmd.split())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@@ -1,63 +0,0 @@
|
||||
# Name: globals.py
|
||||
# Purpose: XRC editor, global variables
|
||||
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
||||
# Created: 02.12.2002
|
||||
# RCS-ID: $Id$
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.xrc import *
|
||||
try:
|
||||
from wxPython.wizard import *
|
||||
except:
|
||||
pass
|
||||
import sys
|
||||
|
||||
# Global constants
|
||||
|
||||
progname = 'XRCed'
|
||||
version = '0.1.5-3'
|
||||
# Can be changed to set other default encoding different
|
||||
#defaultEncoding = ''
|
||||
# you comment above and can uncomment this:
|
||||
defaultEncoding = wxGetDefaultPyEncoding()
|
||||
|
||||
try:
|
||||
True
|
||||
except NameError:
|
||||
True = 1==1
|
||||
False = 1==0
|
||||
|
||||
# Global variables
|
||||
|
||||
class Globals:
|
||||
panel = None
|
||||
tree = None
|
||||
frame = None
|
||||
tools = None
|
||||
undoMan = None
|
||||
testWin = None
|
||||
testWinPos = wxDefaultPosition
|
||||
currentXXX = None
|
||||
currentEncoding = defaultEncoding
|
||||
|
||||
def _makeFonts(self):
|
||||
self._sysFont = wxSystemSettings_GetFont(wxSYS_SYSTEM_FONT)
|
||||
self._labelFont = wxFont(self._sysFont.GetPointSize(), wxDEFAULT, wxNORMAL, wxBOLD)
|
||||
self._modernFont = wxFont(self._sysFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL)
|
||||
self._smallerFont = wxFont(self._sysFont.GetPointSize()-2, wxDEFAULT, wxNORMAL, wxNORMAL)
|
||||
|
||||
def sysFont(self):
|
||||
if not hasattr(self, "_sysFont"): self._makeFonts()
|
||||
return self._sysFont
|
||||
def labelFont(self):
|
||||
if not hasattr(self, "_labelFont"): self._makeFonts()
|
||||
return self._labelFont
|
||||
def modernFont(self):
|
||||
if not hasattr(self, "_modernFont"): self._makeFonts()
|
||||
return self._modernFont
|
||||
def smallerFont(self):
|
||||
if not hasattr(self, "_smallerFont"): self._makeFonts()
|
||||
return self._smallerFont
|
||||
|
||||
|
||||
g = Globals()
|
@@ -1,23 +0,0 @@
|
||||
Copyright (c) 2002, Roman Rolinsky <rollrom@users.sourceforge.net>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
@@ -1,384 +0,0 @@
|
||||
# Name: panel.py
|
||||
# Purpose: XRC editor, Panel class and related
|
||||
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
||||
# Created: 02.12.2002
|
||||
# RCS-ID: $Id$
|
||||
|
||||
from xxx import * # xxx imports globals and params
|
||||
from undo import *
|
||||
from wxPython.html import wxHtmlWindow
|
||||
|
||||
# Properties panel containing notebook
|
||||
class Panel(wxNotebook):
|
||||
def __init__(self, parent, id = -1):
|
||||
if wxPlatform != '__WXMAC__': # some problems with this style on macs
|
||||
wxNotebook.__init__(self, parent, id, style=wxNB_BOTTOM)
|
||||
else:
|
||||
wxNotebook.__init__(self, parent, id)
|
||||
global panel
|
||||
g.panel = panel = self
|
||||
self.modified = False
|
||||
|
||||
# Set common button size for parameter buttons
|
||||
bTmp = wxButton(self, -1, '')
|
||||
import params
|
||||
params.buttonSize = (self.DLG_SZE(buttonSize)[0], bTmp.GetSize()[1])
|
||||
bTmp.Destroy()
|
||||
del bTmp
|
||||
|
||||
# List of child windows
|
||||
self.pages = []
|
||||
# Create scrolled windows for pages
|
||||
self.page1 = wxScrolledWindow(self, -1)
|
||||
sizer = wxBoxSizer()
|
||||
sizer.Add(wxBoxSizer()) # dummy sizer
|
||||
self.page1.SetAutoLayout(True)
|
||||
self.page1.SetSizer(sizer)
|
||||
self.AddPage(self.page1, 'Properties')
|
||||
# Second page
|
||||
self.page2 = wxScrolledWindow(self, -1)
|
||||
self.page2.Hide()
|
||||
sizer = wxBoxSizer()
|
||||
sizer.Add(wxBoxSizer()) # dummy sizer
|
||||
self.page2.SetAutoLayout(True)
|
||||
self.page2.SetSizer(sizer)
|
||||
# Cache for already used panels
|
||||
self.pageCache = {} # cached property panels
|
||||
self.stylePageCache = {} # cached style panels
|
||||
|
||||
# Delete child windows and recreate page sizer
|
||||
def ResetPage(self, page):
|
||||
topSizer = page.GetSizer()
|
||||
sizer = topSizer.GetChildren()[0].GetSizer()
|
||||
for w in page.GetChildren():
|
||||
sizer.Detach(w)
|
||||
if isinstance(w, ParamPage):
|
||||
if w.IsShown():
|
||||
w.Hide()
|
||||
else:
|
||||
w.Destroy()
|
||||
topSizer.Remove(sizer)
|
||||
# Create new windows
|
||||
sizer = wxBoxSizer(wxVERTICAL)
|
||||
# Special case - resize html window
|
||||
if g.conf.panic:
|
||||
topSizer.Add(sizer, 1, wxEXPAND)
|
||||
else:
|
||||
topSizer.Add(sizer, 0, wxALL, 5)
|
||||
return sizer
|
||||
|
||||
def SetData(self, xxx):
|
||||
self.pages = []
|
||||
# First page
|
||||
# Remove current objects and sizer
|
||||
sizer = self.ResetPage(self.page1)
|
||||
if not xxx or (not xxx.allParams and not xxx.hasName and not xxx.hasChild):
|
||||
if g.tree.selection:
|
||||
sizer.Add(wxStaticText(self.page1, -1, 'This item has no properties.'))
|
||||
else: # nothing selected
|
||||
# If first time, show some help
|
||||
if g.conf.panic:
|
||||
html = wxHtmlWindow(self.page1, -1, wxDefaultPosition,
|
||||
wxDefaultSize, wxSUNKEN_BORDER)
|
||||
html.SetPage(g.helpText)
|
||||
sizer.Add(html, 1, wxEXPAND)
|
||||
g.conf.panic = False
|
||||
else:
|
||||
sizer.Add(wxStaticText(self.page1, -1, 'Select a tree item.'))
|
||||
else:
|
||||
g.currentXXX = xxx.treeObject()
|
||||
# Normal or SizerItem page
|
||||
isGBSizerItem = isinstance(xxx.parent, xxxGridBagSizer)
|
||||
cacheID = (xxx.__class__, isGBSizerItem)
|
||||
try:
|
||||
page = self.pageCache[cacheID]
|
||||
page.box.SetLabel(xxx.panelName())
|
||||
page.Show()
|
||||
except KeyError:
|
||||
page = PropPage(self.page1, xxx.panelName(), xxx)
|
||||
self.pageCache[cacheID] = page
|
||||
page.SetValues(xxx)
|
||||
self.pages.append(page)
|
||||
sizer.Add(page, 1, wxEXPAND)
|
||||
if xxx.hasChild:
|
||||
# Special label for child objects - they may have different GUI
|
||||
cacheID = (xxx.child.__class__, xxx.__class__)
|
||||
try:
|
||||
page = self.pageCache[cacheID]
|
||||
page.box.SetLabel(xxx.child.panelName())
|
||||
page.Show()
|
||||
except KeyError:
|
||||
page = PropPage(self.page1, xxx.child.panelName(), xxx.child)
|
||||
self.pageCache[cacheID] = page
|
||||
page.SetValues(xxx.child)
|
||||
self.pages.append(page)
|
||||
sizer.Add(page, 0, wxEXPAND | wxTOP, 5)
|
||||
self.page1.Layout()
|
||||
size = self.page1.GetSizer().GetMinSize()
|
||||
self.page1.SetScrollbars(1, 1, size.width, size.height, 0, 0, True)
|
||||
|
||||
# Second page
|
||||
# Create if does not exist
|
||||
if xxx and xxx.treeObject().hasStyle:
|
||||
xxx = xxx.treeObject()
|
||||
# Simplest case: set data if class is the same
|
||||
sizer = self.ResetPage(self.page2)
|
||||
try:
|
||||
page = self.stylePageCache[xxx.__class__]
|
||||
page.Show()
|
||||
except KeyError:
|
||||
page = StylePage(self.page2, xxx.className + ' style', xxx)
|
||||
self.stylePageCache[xxx.__class__] = page
|
||||
page.SetValues(xxx)
|
||||
self.pages.append(page)
|
||||
sizer.Add(page, 0, wxEXPAND)
|
||||
# Add page if not exists
|
||||
if not self.GetPageCount() == 2:
|
||||
self.AddPage(self.page2, 'Style')
|
||||
self.page2.Layout()
|
||||
if 'wxGTK' in wx.PlatformInfo:
|
||||
self.page2.Show(True)
|
||||
size = self.page2.GetSizer().GetMinSize()
|
||||
self.page2.SetScrollbars(1, 1, size.width, size.height, 0, 0, True)
|
||||
else:
|
||||
# Remove page if exists
|
||||
if self.GetPageCount() == 2:
|
||||
self.SetSelection(0)
|
||||
self.page1.Refresh()
|
||||
self.RemovePage(1)
|
||||
self.modified = False
|
||||
|
||||
def Clear(self):
|
||||
self.SetData(None)
|
||||
self.modified = False
|
||||
|
||||
# If some parameter has changed
|
||||
def IsModified(self):
|
||||
return self.modified
|
||||
|
||||
def SetModified(self, value):
|
||||
# Register undo object when modifying first time
|
||||
if not self.modified and value:
|
||||
g.undoMan.RegisterUndo(UndoEdit())
|
||||
self.modified = value
|
||||
|
||||
def Apply(self):
|
||||
for p in self.pages: p.Apply()
|
||||
|
||||
################################################################################
|
||||
|
||||
# General class for notebook pages
|
||||
class ParamPage(wxPanel):
|
||||
def __init__(self, parent, xxx):
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
self.xxx = xxx
|
||||
# Register event handlers
|
||||
for id in paramIDs.values():
|
||||
EVT_CHECKBOX(self, id, self.OnCheckParams)
|
||||
self.checks = {}
|
||||
self.controls = {} # save python objects
|
||||
self.controlName = None
|
||||
|
||||
def OnCheckParams(self, evt):
|
||||
xxx = self.xxx
|
||||
param = evt.GetEventObject().GetName()
|
||||
w = self.controls[param]
|
||||
w.Enable(True)
|
||||
objElem = xxx.element
|
||||
if evt.IsChecked():
|
||||
# Ad new text node in order of allParams
|
||||
w.SetValue('') # set empty (default) value
|
||||
w.SetModified() # mark as changed
|
||||
elem = g.tree.dom.createElement(param)
|
||||
# Some classes are special
|
||||
if param == 'font':
|
||||
xxx.params[param] = xxxParamFont(xxx.element, elem)
|
||||
elif param in xxxObject.bitmapTags:
|
||||
xxx.params[param] = xxxParamBitmap(elem)
|
||||
else:
|
||||
xxx.params[param] = xxxParam(elem)
|
||||
# Find place to put new element: first present element after param
|
||||
found = False
|
||||
if xxx.hasStyle:
|
||||
paramStyles = xxx.allParams + xxx.styles
|
||||
else:
|
||||
paramStyles = xxx.allParams
|
||||
for p in paramStyles[paramStyles.index(param) + 1:]:
|
||||
# Content params don't have same type
|
||||
if xxx.params.has_key(p) and p != 'content':
|
||||
found = True
|
||||
break
|
||||
if found:
|
||||
nextTextElem = xxx.params[p].node
|
||||
objElem.insertBefore(elem, nextTextElem)
|
||||
else:
|
||||
objElem.appendChild(elem)
|
||||
else:
|
||||
# Remove parameter
|
||||
xxx.params[param].remove()
|
||||
del xxx.params[param]
|
||||
w.SetValue('')
|
||||
w.modified = False # mark as not changed
|
||||
w.Enable(False)
|
||||
# Set modified flag (provokes undo storing is necessary)
|
||||
panel.SetModified(True)
|
||||
def Apply(self):
|
||||
xxx = self.xxx
|
||||
if self.controlName:
|
||||
name = self.controlName.GetValue()
|
||||
if xxx.name != name:
|
||||
xxx.name = name
|
||||
xxx.element.setAttribute('name', name)
|
||||
for param, w in self.controls.items():
|
||||
if w.modified:
|
||||
paramObj = xxx.params[param]
|
||||
value = w.GetValue()
|
||||
if param in xxx.specials:
|
||||
xxx.setSpecial(param, value)
|
||||
else:
|
||||
paramObj.update(value)
|
||||
# Save current state
|
||||
def SaveState(self):
|
||||
self.origChecks = map(lambda i: (i[0], i[1].GetValue()), self.checks.items())
|
||||
self.origControls = map(lambda i: (i[0], i[1].GetValue(), i[1].IsEnabled()),
|
||||
self.controls.items())
|
||||
if self.controlName:
|
||||
self.origName = self.controlName.GetValue()
|
||||
# Return original values
|
||||
def GetState(self):
|
||||
if self.controlName:
|
||||
return (self.origChecks, self.origControls, self.origName)
|
||||
else:
|
||||
return (self.origChecks, self.origControls)
|
||||
# Set values from undo data
|
||||
def SetState(self, state):
|
||||
for k,v in state[0]:
|
||||
self.checks[k].SetValue(v)
|
||||
for k,v,e in state[1]:
|
||||
self.controls[k].SetValue(v)
|
||||
self.controls[k].Enable(e)
|
||||
if e: self.controls[k].modified = True
|
||||
if self.controlName:
|
||||
self.controlName.SetValue(state[2])
|
||||
|
||||
################################################################################
|
||||
|
||||
LABEL_WIDTH = 125
|
||||
|
||||
# Panel for displaying properties
|
||||
class PropPage(ParamPage):
|
||||
def __init__(self, parent, label, xxx):
|
||||
ParamPage.__init__(self, parent, xxx)
|
||||
self.box = wxStaticBox(self, -1, label)
|
||||
self.box.SetFont(g.labelFont())
|
||||
topSizer = wxStaticBoxSizer(self.box, wxVERTICAL)
|
||||
sizer = wxFlexGridSizer(len(xxx.allParams), 2, 1, 1)
|
||||
sizer.AddGrowableCol(1)
|
||||
if xxx.hasName:
|
||||
label = wxStaticText(self, -1, 'XML ID:', size=(LABEL_WIDTH,-1))
|
||||
control = ParamText(self, 'XML_name', 200)
|
||||
sizer.AddMany([ (label, 0, wxALIGN_CENTER_VERTICAL),
|
||||
(control, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM | wxGROW, 5) ])
|
||||
self.controlName = control
|
||||
for param in xxx.allParams:
|
||||
present = xxx.params.has_key(param)
|
||||
if param in xxx.required:
|
||||
label = wxStaticText(self, paramIDs[param], param + ':',
|
||||
size = (LABEL_WIDTH,-1), name = param)
|
||||
else:
|
||||
# Notebook has one very loooooong parameter
|
||||
if param == 'usenotebooksizer': sParam = 'usesizer:'
|
||||
else: sParam = param + ':'
|
||||
label = wxCheckBox(self, paramIDs[param], sParam,
|
||||
size = (LABEL_WIDTH,-1), name = param)
|
||||
self.checks[param] = label
|
||||
try:
|
||||
typeClass = xxx.paramDict[param]
|
||||
except KeyError:
|
||||
try:
|
||||
# Standart type
|
||||
typeClass = paramDict[param]
|
||||
except KeyError:
|
||||
# Default
|
||||
typeClass = ParamText
|
||||
control = typeClass(self, param)
|
||||
control.Enable(present)
|
||||
sizer.AddMany([ (label, 0, wxALIGN_CENTER_VERTICAL),
|
||||
(control, 0, wxALIGN_CENTER_VERTICAL | wxGROW) ])
|
||||
self.controls[param] = control
|
||||
topSizer.Add(sizer, 1, wxALL | wxEXPAND, 3)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(topSizer)
|
||||
topSizer.Fit(self)
|
||||
def SetValues(self, xxx):
|
||||
self.xxx = xxx
|
||||
self.origChecks = []
|
||||
self.origControls = []
|
||||
# Set values, checkboxes to False, disable defaults
|
||||
if xxx.hasName:
|
||||
self.controlName.SetValue(xxx.name)
|
||||
self.origName = xxx.name
|
||||
for param in xxx.allParams:
|
||||
w = self.controls[param]
|
||||
w.modified = False
|
||||
try:
|
||||
value = xxx.params[param].value()
|
||||
w.Enable(True)
|
||||
w.SetValue(value)
|
||||
if not param in xxx.required:
|
||||
self.checks[param].SetValue(True)
|
||||
self.origChecks.append((param, True))
|
||||
self.origControls.append((param, value, True))
|
||||
except KeyError:
|
||||
self.checks[param].SetValue(False)
|
||||
w.SetValue('')
|
||||
w.Enable(False)
|
||||
self.origChecks.append((param, False))
|
||||
self.origControls.append((param, '', False))
|
||||
|
||||
################################################################################
|
||||
|
||||
# Style notebook page
|
||||
class StylePage(ParamPage):
|
||||
def __init__(self, parent, label, xxx):
|
||||
ParamPage.__init__(self, parent, xxx)
|
||||
box = wxStaticBox(self, -1, label)
|
||||
box.SetFont(g.labelFont())
|
||||
topSizer = wxStaticBoxSizer(box, wxVERTICAL)
|
||||
sizer = wxFlexGridSizer(len(xxx.styles), 2, 1, 1)
|
||||
sizer.AddGrowableCol(1)
|
||||
for param in xxx.styles:
|
||||
present = xxx.params.has_key(param)
|
||||
check = wxCheckBox(self, paramIDs[param],
|
||||
param + ':', size = (LABEL_WIDTH,-1), name = param)
|
||||
check.SetValue(present)
|
||||
control = paramDict[param](self, name = param)
|
||||
control.Enable(present)
|
||||
sizer.AddMany([ (check, 0, wxALIGN_CENTER_VERTICAL),
|
||||
(control, 0, wxALIGN_CENTER_VERTICAL | wxGROW) ])
|
||||
self.checks[param] = check
|
||||
self.controls[param] = control
|
||||
topSizer.Add(sizer, 1, wxALL | wxEXPAND, 3)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(topSizer)
|
||||
topSizer.Fit(self)
|
||||
# Set data for a cahced page
|
||||
def SetValues(self, xxx):
|
||||
self.xxx = xxx
|
||||
self.origChecks = []
|
||||
self.origControls = []
|
||||
for param in xxx.styles:
|
||||
present = xxx.params.has_key(param)
|
||||
check = self.checks[param]
|
||||
check.SetValue(present)
|
||||
w = self.controls[param]
|
||||
w.modified = False
|
||||
if present:
|
||||
value = xxx.params[param].value()
|
||||
else:
|
||||
value = ''
|
||||
w.SetValue(value)
|
||||
w.Enable(present)
|
||||
self.origChecks.append((param, present))
|
||||
self.origControls.append((param, value, present))
|
||||
|
@@ -1,879 +0,0 @@
|
||||
# Name: params.py
|
||||
# Purpose: Classes for parameter introduction
|
||||
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
||||
# Created: 22.08.2001
|
||||
# RCS-ID: $Id$
|
||||
|
||||
import string
|
||||
import os.path
|
||||
from globals import *
|
||||
from types import *
|
||||
from wxPython.xrc import *
|
||||
|
||||
genericStyles = [
|
||||
'wxSIMPLE_BORDER', 'wxDOUBLE_BORDER', 'wxSUNKEN_BORDER',
|
||||
'wxRAISED_BORDER', 'wxSTATIC_BORDER', 'wxNO_BORDER',
|
||||
'wxTRANSPARENT_WINDOW', 'wxTAB_TRAVERSAL',
|
||||
'wxWANTS_CHARS',
|
||||
'wxNO_FULL_REPAINT_ON_RESIZE',
|
||||
'wxVSCROLL', 'wxHSCROLL', 'wxALWAYS_SHOW_SB',
|
||||
'wxCLIP_CHILDREN',
|
||||
'wxFULL_REPAINT_ON_RESIZE'
|
||||
]
|
||||
|
||||
genericExStyles = [
|
||||
'wxWS_EX_VALIDATE_RECURSIVELY',
|
||||
'wxWS_EX_BLOCK_EVENTS',
|
||||
'wxWS_EX_TRANSIENT',
|
||||
'wxFRAME_EX_CONTEXTHELP',
|
||||
'wxWS_EX_PROCESS_IDLE',
|
||||
'wxWS_EX_PROCESS_UI_UPDATES'
|
||||
]
|
||||
|
||||
buttonSize = (35,-1) # in dialog units, transformed to pixels in panel ctor
|
||||
|
||||
# Class that can properly disable children
|
||||
class PPanel(wxPanel):
|
||||
def __init__(self, parent, name):
|
||||
wxPanel.__init__(self, parent, -1, name=name)
|
||||
self.modified = self.freeze = False
|
||||
def Enable(self, value):
|
||||
# Something strange is going on with enable so we make sure...
|
||||
for w in self.GetChildren():
|
||||
w.Enable(value)
|
||||
wxPanel.Enable(self, value)
|
||||
def SetModified(self):
|
||||
self.modified = True
|
||||
g.panel.SetModified(True)
|
||||
# Common method to set modified state
|
||||
def OnChange(self, evt):
|
||||
if self.freeze: return
|
||||
self.SetModified()
|
||||
evt.Skip()
|
||||
|
||||
class ParamBinaryOr(PPanel):
|
||||
def __init__(self, parent, name):
|
||||
PPanel.__init__(self, parent, name)
|
||||
self.ID_TEXT_CTRL = wxNewId()
|
||||
self.ID_BUTTON_CHOICES = wxNewId()
|
||||
sizer = wxBoxSizer()
|
||||
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(200,-1))
|
||||
sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5)
|
||||
self.button = wxButton(self, self.ID_BUTTON_CHOICES, 'Edit...', size=buttonSize)
|
||||
sizer.Add(self.button, 0, wxALIGN_CENTER_VERTICAL)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(sizer)
|
||||
sizer.Fit(self)
|
||||
EVT_BUTTON(self, self.ID_BUTTON_CHOICES, self.OnButtonChoices)
|
||||
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
|
||||
def GetValue(self):
|
||||
return self.text.GetValue()
|
||||
def SetValue(self, value):
|
||||
self.freeze = True
|
||||
self.text.SetValue(value)
|
||||
self.freeze = False
|
||||
def OnButtonChoices(self, evt):
|
||||
dlg = g.frame.res.LoadDialog(self, 'DIALOG_CHOICES')
|
||||
listBox = XRCCTRL(dlg, 'CHECK_LIST')
|
||||
listBox.InsertItems(self.values, 0)
|
||||
value = map(string.strip, self.text.GetValue().split('|'))
|
||||
if value == ['']: value = []
|
||||
ignored = []
|
||||
for i in value:
|
||||
try:
|
||||
listBox.Check(self.values.index(i))
|
||||
except ValueError:
|
||||
# Try to find equal
|
||||
if self.equal.has_key(i):
|
||||
listBox.Check(self.values.index(self.equal[i]))
|
||||
else:
|
||||
print 'WARNING: unknown flag: %s: ignored.' % i
|
||||
ignored.append(i)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
value = []
|
||||
for i in range(listBox.GetCount()):
|
||||
if listBox.IsChecked(i):
|
||||
value.append(self.values[i])
|
||||
# Add ignored flags
|
||||
value.extend(ignored)
|
||||
if value:
|
||||
self.SetValue(reduce(lambda a,b: a+'|'+b, value))
|
||||
else:
|
||||
self.SetValue('')
|
||||
self.SetModified()
|
||||
dlg.Destroy()
|
||||
|
||||
class ParamFlag(ParamBinaryOr):
|
||||
values = ['wxTOP', 'wxBOTTOM', 'wxLEFT', 'wxRIGHT', 'wxALL',
|
||||
'wxEXPAND', 'wxGROW', 'wxSHAPED', 'wxALIGN_CENTRE', 'wxALIGN_RIGHT',
|
||||
'wxFIXED_MINSIZE',
|
||||
'wxALIGN_BOTTOM', 'wxALIGN_CENTRE_VERTICAL',
|
||||
'wxALIGN_CENTRE_HORIZONTAL',
|
||||
]
|
||||
equal = {'wxALIGN_CENTER': 'wxALIGN_CENTRE',
|
||||
'wxALIGN_CENTER_VERTICAL': 'wxALIGN_CENTRE_VERTICAL',
|
||||
'wxALIGN_CENTER_HORIZONTAL': 'wxALIGN_CENTRE_HORIZONTAL'}
|
||||
def __init__(self, parent, name):
|
||||
ParamBinaryOr.__init__(self, parent, name)
|
||||
|
||||
class ParamStyle(ParamBinaryOr):
|
||||
equal = {'wxALIGN_CENTER': 'wxALIGN_CENTRE'}
|
||||
def __init__(self, parent, name):
|
||||
self.values = g.currentXXX.winStyles + genericStyles
|
||||
ParamBinaryOr.__init__(self, parent, name)
|
||||
|
||||
class ParamNonGenericStyle(ParamBinaryOr):
|
||||
def __init__(self, parent, name):
|
||||
self.values = g.currentXXX.winStyles
|
||||
ParamBinaryOr.__init__(self, parent, name)
|
||||
|
||||
class ParamExStyle(ParamBinaryOr):
|
||||
def __init__(self, parent, name):
|
||||
if g.currentXXX:
|
||||
self.values = g.currentXXX.exStyles + genericExStyles
|
||||
else:
|
||||
self.values = []
|
||||
ParamBinaryOr.__init__(self, parent, name)
|
||||
|
||||
class ParamColour(PPanel):
|
||||
def __init__(self, parent, name):
|
||||
PPanel.__init__(self, parent, name)
|
||||
self.ID_TEXT_CTRL = wxNewId()
|
||||
self.ID_BUTTON = wxNewId()
|
||||
sizer = wxBoxSizer()
|
||||
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=(65,-1))
|
||||
sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5)
|
||||
self.button = wxPanel(self, self.ID_BUTTON, wxDefaultPosition, wxSize(20, 1))
|
||||
sizer.Add(self.button, 0, wxGROW | wxALIGN_CENTER_VERTICAL)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(sizer)
|
||||
sizer.Fit(self)
|
||||
self.textModified = False
|
||||
EVT_PAINT(self.button, self.OnPaintButton)
|
||||
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
|
||||
EVT_LEFT_DOWN(self.button, self.OnLeftDown)
|
||||
def GetValue(self):
|
||||
return self.text.GetValue()
|
||||
def SetValue(self, value):
|
||||
self.freeze = True
|
||||
if not value: value = '#FFFFFF'
|
||||
self.text.SetValue(str(value)) # update text ctrl
|
||||
colour = wxColour(int(value[1:3], 16), int(value[3:5], 16), int(value[5:7], 16))
|
||||
self.button.SetBackgroundColour(colour)
|
||||
self.button.Refresh()
|
||||
self.freeze = False
|
||||
def OnPaintButton(self, evt):
|
||||
dc = wxPaintDC(self.button)
|
||||
dc.SetBrush(wxTRANSPARENT_BRUSH)
|
||||
if self.IsEnabled(): dc.SetPen(wxBLACK_PEN)
|
||||
else: dc.SetPen(wxGREY_PEN)
|
||||
size = self.button.GetSize()
|
||||
dc.DrawRectangle(0, 0, size.width, size.height)
|
||||
def OnLeftDown(self, evt):
|
||||
data = wxColourData()
|
||||
data.SetColour(self.GetValue())
|
||||
dlg = wxColourDialog(self, data)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
self.SetValue('#%02X%02X%02X' % dlg.GetColourData().GetColour().Get())
|
||||
self.SetModified()
|
||||
dlg.Destroy()
|
||||
|
||||
################################################################################
|
||||
|
||||
# Mapping from wx constants ro XML strings
|
||||
fontFamiliesWx2Xml = {wxDEFAULT: 'default', wxDECORATIVE: 'decorative',
|
||||
wxROMAN: 'roman', wxSCRIPT: 'script', wxSWISS: 'swiss',
|
||||
wxMODERN: 'modern'}
|
||||
fontStylesWx2Xml = {wxNORMAL: 'normal', wxSLANT: 'slant', wxITALIC: 'italic'}
|
||||
fontWeightsWx2Xml = {wxNORMAL: 'normal', wxLIGHT: 'light', wxBOLD: 'bold'}
|
||||
def ReverseMap(m):
|
||||
rm = {}
|
||||
for k,v in m.items(): rm[v] = k
|
||||
return rm
|
||||
fontFamiliesXml2wx = ReverseMap(fontFamiliesWx2Xml)
|
||||
fontStylesXml2wx = ReverseMap(fontStylesWx2Xml)
|
||||
fontWeightsXml2wx = ReverseMap(fontWeightsWx2Xml)
|
||||
|
||||
class ParamFont(PPanel):
|
||||
def __init__(self, parent, name):
|
||||
PPanel.__init__(self, parent, name)
|
||||
self.ID_TEXT_CTRL = wxNewId()
|
||||
self.ID_BUTTON_SELECT = wxNewId()
|
||||
sizer = wxBoxSizer()
|
||||
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=(200,-1))
|
||||
sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5)
|
||||
self.button = wxButton(self, self.ID_BUTTON_SELECT, 'Select...', size=buttonSize)
|
||||
sizer.Add(self.button, 0, wxALIGN_CENTER_VERTICAL)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(sizer)
|
||||
sizer.Fit(self)
|
||||
self.textModified = False
|
||||
EVT_BUTTON(self, self.ID_BUTTON_SELECT, self.OnButtonSelect)
|
||||
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
|
||||
def OnChange(self, evt):
|
||||
PPanel.OnChange(self, evt)
|
||||
self.textModified = True
|
||||
def _defaultValue(self):
|
||||
return ['12', 'default', 'normal', 'normal', '0', '', '']
|
||||
def GetValue(self):
|
||||
if self.textModified: # text has newer value
|
||||
try:
|
||||
return eval(self.text.GetValue())
|
||||
except SyntaxError:
|
||||
wxLogError('Syntax error in parameter value: ' + self.GetName())
|
||||
return self._defaultValue()
|
||||
return self.value
|
||||
def SetValue(self, value):
|
||||
self.freeze = True # disable other handlers
|
||||
if not value: value = self._defaultValue()
|
||||
self.value = value
|
||||
self.text.SetValue(str(value)) # update text ctrl
|
||||
self.freeze = False
|
||||
def OnButtonSelect(self, evt):
|
||||
if self.textModified: # text has newer value
|
||||
try:
|
||||
self.value = eval(self.text.GetValue())
|
||||
except SyntaxError:
|
||||
wxLogError('Syntax error in parameter value: ' + self.GetName())
|
||||
self.value = self._defaultValue()
|
||||
# Make initial font
|
||||
# Default values
|
||||
size = 12
|
||||
family = wxDEFAULT
|
||||
style = weight = wxNORMAL
|
||||
underlined = 0
|
||||
face = ''
|
||||
enc = wxFONTENCODING_DEFAULT
|
||||
# Fall back to default if exceptions
|
||||
error = False
|
||||
try:
|
||||
try: size = int(self.value[0])
|
||||
except ValueError: error = True; wxLogError('Invalid size specification')
|
||||
try: family = fontFamiliesXml2wx[self.value[1]]
|
||||
except KeyError: error = True; wxLogError('Invalid family specification')
|
||||
try: style = fontStylesXml2wx[self.value[2]]
|
||||
except KeyError: error = True; wxLogError('Invalid style specification')
|
||||
try: weight = fontWeightsXml2wx[self.value[3]]
|
||||
except KeyError: error = True; wxLogError('Invalid weight specification')
|
||||
try: underlined = bool(self.value[4])
|
||||
except ValueError: error = True; wxLogError('Invalid underlined flag specification')
|
||||
face = self.value[5]
|
||||
except IndexError:
|
||||
error = True
|
||||
mapper = wxFontMapper()
|
||||
if not self.value[6]: enc = mapper.CharsetToEncoding(self.value[6])
|
||||
|
||||
if error: wxLogError('Invalid font specification')
|
||||
if enc == wxFONTENCODING_DEFAULT: enc = wxFONTENCODING_SYSTEM
|
||||
font = wxFont(size, family, style, weight, underlined, face, enc)
|
||||
data = wxFontData()
|
||||
data.SetInitialFont(font)
|
||||
dlg = wxFontDialog(self, data)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
font = dlg.GetFontData().GetChosenFont()
|
||||
print font.GetEncoding()
|
||||
if font.GetEncoding() == wxFONTENCODING_SYSTEM:
|
||||
encName = ''
|
||||
else:
|
||||
encName = wxFontMapper_GetEncodingName(font.GetEncoding()).encode()
|
||||
value = [str(font.GetPointSize()),
|
||||
fontFamiliesWx2Xml.get(font.GetFamily(), "default"),
|
||||
fontStylesWx2Xml.get(font.GetStyle(), "normal"),
|
||||
fontWeightsWx2Xml.get(font.GetWeight(), "normal"),
|
||||
str(int(font.GetUnderlined())),
|
||||
font.GetFaceName().encode(),
|
||||
encName
|
||||
]
|
||||
# Add ignored flags
|
||||
self.SetValue(value)
|
||||
self.SetModified()
|
||||
self.textModified = False
|
||||
dlg.Destroy()
|
||||
|
||||
################################################################################
|
||||
|
||||
class ParamInt(PPanel):
|
||||
def __init__(self, parent, name):
|
||||
PPanel.__init__(self, parent, name)
|
||||
self.ID_SPIN_CTRL = wxNewId()
|
||||
sizer = wxBoxSizer()
|
||||
self.spin = wxSpinCtrl(self, self.ID_SPIN_CTRL, size=(50,-1))
|
||||
sizer.Add(self.spin)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(sizer)
|
||||
sizer.Fit(self)
|
||||
EVT_SPINCTRL(self, self.ID_SPIN_CTRL, self.OnChange)
|
||||
def GetValue(self):
|
||||
return str(self.spin.GetValue())
|
||||
def SetValue(self, value):
|
||||
self.freeze = True
|
||||
if not value: value = 0
|
||||
self.spin.SetValue(int(value))
|
||||
self.freeze = False
|
||||
|
||||
# Same as int but allows dialog units (XXXd)
|
||||
class ParamUnit(PPanel):
|
||||
def __init__(self, parent, name):
|
||||
PPanel.__init__(self, parent, name)
|
||||
self.ID_TEXT_CTRL = wxNewId()
|
||||
self.ID_SPIN_BUTTON = wxNewId()
|
||||
sizer = wxBoxSizer()
|
||||
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=(35,-1))
|
||||
self.spin = wxSpinButton(self, self.ID_SPIN_BUTTON, style = wxSP_VERTICAL, size=(-1,1))
|
||||
self.spin.SetRange(-10000, 10000)
|
||||
sizer.Add(self.text, 0, wxEXPAND | wxRIGHT, 2)
|
||||
sizer.Add(self.spin, 0, wxEXPAND)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(sizer)
|
||||
sizer.Fit(self)
|
||||
EVT_SPIN_UP(self, self.ID_SPIN_BUTTON, self.OnSpinUp)
|
||||
EVT_SPIN_DOWN(self, self.ID_SPIN_BUTTON, self.OnSpinDown)
|
||||
def GetValue(self):
|
||||
return self.text.GetValue()
|
||||
def SetValue(self, value):
|
||||
self.freeze = True
|
||||
if not value: value = '0'
|
||||
self.text.SetValue(value)
|
||||
self.freeze = False
|
||||
def Change(self, x):
|
||||
# Check if we are working with dialog units
|
||||
value = self.text.GetValue()
|
||||
units = ''
|
||||
if value[-1].upper() == 'D':
|
||||
units = value[-1]
|
||||
value = value[:-1]
|
||||
try:
|
||||
intValue = int(value) + x
|
||||
self.spin.SetValue(intValue)
|
||||
self.text.SetValue(str(intValue) + units)
|
||||
self.SetModified()
|
||||
except:
|
||||
# !!! Strange, if I use wxLogWarning, event is re-generated
|
||||
print 'incorrect unit format'
|
||||
def OnSpinUp(self, evt):
|
||||
self.Change(1)
|
||||
def OnSpinDown(self, evt):
|
||||
self.Change(-1)
|
||||
|
||||
class ParamMultilineText(PPanel):
|
||||
def __init__(self, parent, name, textWidth=-1):
|
||||
PPanel.__init__(self, parent, name)
|
||||
self.ID_TEXT_CTRL = wxNewId()
|
||||
self.ID_BUTTON_EDIT = wxNewId()
|
||||
sizer = wxBoxSizer()
|
||||
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(200,-1))
|
||||
sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5)
|
||||
self.button = wxButton(self, self.ID_BUTTON_EDIT, 'Edit...', size=buttonSize)
|
||||
sizer.Add(self.button, 0, wxALIGN_CENTER_VERTICAL)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(sizer)
|
||||
sizer.Fit(self)
|
||||
EVT_BUTTON(self, self.ID_BUTTON_EDIT, self.OnButtonEdit)
|
||||
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
|
||||
def GetValue(self):
|
||||
return self.text.GetValue()
|
||||
def SetValue(self, value):
|
||||
self.freeze = True # disable other handlers
|
||||
self.text.SetValue(value)
|
||||
self.freeze = False # disable other handlers
|
||||
def OnButtonEdit(self, evt):
|
||||
dlg = g.frame.res.LoadDialog(self, 'DIALOG_TEXT')
|
||||
textCtrl = XRCCTRL(dlg, 'TEXT')
|
||||
textCtrl.SetValue(self.text.GetValue())
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
self.text.SetValue(textCtrl.GetValue())
|
||||
self.SetModified()
|
||||
dlg.Destroy()
|
||||
|
||||
class ParamText(PPanel):
|
||||
def __init__(self, parent, name, textWidth=-1):
|
||||
PPanel.__init__(self, parent, name)
|
||||
self.ID_TEXT_CTRL = wxNewId()
|
||||
# We use sizer even here to have the same size of text control
|
||||
sizer = wxBoxSizer()
|
||||
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(textWidth,-1))
|
||||
if textWidth == -1: option = 1
|
||||
else: option = 0
|
||||
sizer.Add(self.text, option, wxALIGN_CENTER_VERTICAL)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(sizer)
|
||||
sizer.Fit(self)
|
||||
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
|
||||
def GetValue(self):
|
||||
return self.text.GetValue()
|
||||
def SetValue(self, value):
|
||||
self.freeze = True # disable other handlers
|
||||
self.text.SetValue(value)
|
||||
self.freeze = False # disable other handlers
|
||||
|
||||
class ParamAccel(ParamText):
|
||||
def __init__(self, parent, name):
|
||||
ParamText.__init__(self, parent, name, 100)
|
||||
|
||||
class ParamPosSize(ParamText):
|
||||
def __init__(self, parent, name):
|
||||
ParamText.__init__(self, parent, name, 80)
|
||||
|
||||
class ParamLabel(ParamText):
|
||||
def __init__(self, parent, name):
|
||||
ParamText.__init__(self, parent, name, 200)
|
||||
|
||||
class ParamEncoding(ParamText):
|
||||
def __init__(self, parent, name):
|
||||
ParamText.__init__(self, parent, name, 100)
|
||||
|
||||
class ContentDialog(wxDialog):
|
||||
def __init__(self, parent, value):
|
||||
# Load from resource
|
||||
pre = wxPreDialog()
|
||||
g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT')
|
||||
self.this = pre.this
|
||||
self._setOORInfo(self)
|
||||
self.list = XRCCTRL(self, 'LIST')
|
||||
# Set list items
|
||||
for v in value:
|
||||
self.list.Append(v)
|
||||
self.SetAutoLayout(True)
|
||||
self.GetSizer().Fit(self)
|
||||
# Callbacks
|
||||
self.ID_BUTTON_APPEND = XRCID('BUTTON_APPEND')
|
||||
self.ID_BUTTON_REMOVE = XRCID('BUTTON_REMOVE')
|
||||
self.ID_BUTTON_UP = XRCID('BUTTON_UP')
|
||||
self.ID_BUTTON_DOWN = XRCID('BUTTON_DOWN')
|
||||
EVT_BUTTON(self, self.ID_BUTTON_UP, self.OnButtonUp)
|
||||
EVT_BUTTON(self, self.ID_BUTTON_DOWN, self.OnButtonDown)
|
||||
EVT_BUTTON(self, self.ID_BUTTON_APPEND, self.OnButtonAppend)
|
||||
EVT_BUTTON(self, self.ID_BUTTON_REMOVE, self.OnButtonRemove)
|
||||
EVT_UPDATE_UI(self, self.ID_BUTTON_UP, self.OnUpdateUI)
|
||||
EVT_UPDATE_UI(self, self.ID_BUTTON_DOWN, self.OnUpdateUI)
|
||||
EVT_UPDATE_UI(self, self.ID_BUTTON_REMOVE, self.OnUpdateUI)
|
||||
def OnButtonUp(self, evt):
|
||||
i = self.list.GetSelection()
|
||||
str = self.list.GetString(i)
|
||||
self.list.Delete(i)
|
||||
self.list.InsertItems([str], i-1)
|
||||
self.list.SetSelection(i-1)
|
||||
def OnButtonDown(self, evt):
|
||||
i = self.list.GetSelection()
|
||||
str = self.list.GetString(i)
|
||||
self.list.Delete(i)
|
||||
self.list.InsertItems([str], i+1)
|
||||
self.list.SetSelection(i+1)
|
||||
def OnButtonAppend(self, evt):
|
||||
str = wxGetTextFromUser('Enter new item:', 'Append', '', self)
|
||||
self.list.Append(str)
|
||||
def OnButtonRemove(self, evt):
|
||||
self.list.Delete(self.list.GetSelection())
|
||||
def OnUpdateUI(self, evt):
|
||||
if evt.GetId() == self.ID_BUTTON_REMOVE:
|
||||
evt.Enable(self.list.GetSelection() != -1)
|
||||
elif evt.GetId() == self.ID_BUTTON_UP:
|
||||
evt.Enable(self.list.GetSelection() > 0)
|
||||
elif evt.GetId() == self.ID_BUTTON_DOWN:
|
||||
evt.Enable(self.list.GetSelection() != -1 and \
|
||||
self.list.GetSelection() < self.list.GetCount() - 1)
|
||||
|
||||
class ContentCheckListDialog(wxDialog):
|
||||
def __init__(self, parent, value):
|
||||
pre = wxPreDialog()
|
||||
g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT_CHECK_LIST')
|
||||
self.this = pre.this
|
||||
self._setOORInfo(self)
|
||||
self.list = XRCCTRL(self, 'CHECK_LIST')
|
||||
# Set list items
|
||||
i = 0
|
||||
for v,ch in value:
|
||||
self.list.Append(v)
|
||||
self.list.Check(i, ch)
|
||||
i += 1
|
||||
self.SetAutoLayout(True)
|
||||
self.GetSizer().Fit(self)
|
||||
# Callbacks
|
||||
self.ID_BUTTON_APPEND = XRCID('BUTTON_APPEND')
|
||||
self.ID_BUTTON_REMOVE = XRCID('BUTTON_REMOVE')
|
||||
self.ID_BUTTON_UP = XRCID('BUTTON_UP')
|
||||
self.ID_BUTTON_DOWN = XRCID('BUTTON_DOWN')
|
||||
EVT_CHECKLISTBOX(self, self.list.GetId(), self.OnCheck)
|
||||
EVT_BUTTON(self, self.ID_BUTTON_UP, self.OnButtonUp)
|
||||
EVT_BUTTON(self, self.ID_BUTTON_DOWN, self.OnButtonDown)
|
||||
EVT_BUTTON(self, self.ID_BUTTON_APPEND, self.OnButtonAppend)
|
||||
EVT_BUTTON(self, self.ID_BUTTON_REMOVE, self.OnButtonRemove)
|
||||
EVT_UPDATE_UI(self, self.ID_BUTTON_UP, self.OnUpdateUI)
|
||||
EVT_UPDATE_UI(self, self.ID_BUTTON_DOWN, self.OnUpdateUI)
|
||||
EVT_UPDATE_UI(self, self.ID_BUTTON_REMOVE, self.OnUpdateUI)
|
||||
def OnCheck(self, evt):
|
||||
# !!! Wrong wxGTK (wxMSW?) behavior: toggling selection if checking
|
||||
self.list.Deselect(evt.GetSelection())
|
||||
def OnButtonUp(self, evt):
|
||||
i = self.list.GetSelection()
|
||||
str, ch = self.list.GetString(i), self.list.IsChecked(i)
|
||||
self.list.Delete(i)
|
||||
self.list.InsertItems([str], i-1)
|
||||
self.list.Check(i-1, ch)
|
||||
self.list.SetSelection(i-1)
|
||||
def OnButtonDown(self, evt):
|
||||
i = self.list.GetSelection()
|
||||
str, ch = self.list.GetString(i), self.list.IsChecked(i)
|
||||
self.list.Delete(i)
|
||||
self.list.InsertItems([str], i+1)
|
||||
self.list.Check(i+1, ch)
|
||||
self.list.SetSelection(i+1)
|
||||
def OnButtonAppend(self, evt):
|
||||
str = wxGetTextFromUser('Enter new item:', 'Append', '', self)
|
||||
self.list.Append(str)
|
||||
def OnButtonRemove(self, evt):
|
||||
self.list.Delete(self.list.GetSelection())
|
||||
def OnUpdateUI(self, evt):
|
||||
if evt.GetId() == self.ID_BUTTON_REMOVE:
|
||||
evt.Enable(self.list.GetSelection() != -1)
|
||||
elif evt.GetId() == self.ID_BUTTON_UP:
|
||||
evt.Enable(self.list.GetSelection() > 0)
|
||||
elif evt.GetId() == self.ID_BUTTON_DOWN:
|
||||
evt.Enable(self.list.GetSelection() != -1 and \
|
||||
self.list.GetSelection() < self.list.GetCount() - 1)
|
||||
|
||||
class ParamContent(PPanel):
|
||||
def __init__(self, parent, name):
|
||||
PPanel.__init__(self, parent, name)
|
||||
self.ID_TEXT_CTRL = wxNewId()
|
||||
self.ID_BUTTON_EDIT = wxNewId()
|
||||
sizer = wxBoxSizer()
|
||||
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(200,-1))
|
||||
sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5)
|
||||
self.button = wxButton(self, self.ID_BUTTON_EDIT, 'Edit...', size=buttonSize)
|
||||
sizer.Add(self.button, 0, wxALIGN_CENTER_VERTICAL)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(sizer)
|
||||
sizer.Fit(self)
|
||||
self.textModified = False
|
||||
EVT_BUTTON(self, self.ID_BUTTON_EDIT, self.OnButtonEdit)
|
||||
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
|
||||
def OnChange(self, evt):
|
||||
PPanel.OnChange(self, evt)
|
||||
self.textModified = True
|
||||
def GetValue(self):
|
||||
if self.textModified: # text has newer value
|
||||
try:
|
||||
return eval(self.text.GetValue())
|
||||
except SyntaxError:
|
||||
wxLogError('Syntax error in parameter value: ' + self.GetName())
|
||||
return []
|
||||
return self.value
|
||||
def SetValue(self, value):
|
||||
self.freeze = True
|
||||
if not value: value = []
|
||||
self.value = value
|
||||
self.text.SetValue(str(value)) # update text ctrl
|
||||
self.freeze = False
|
||||
def OnButtonEdit(self, evt):
|
||||
if self.textModified: # text has newer value
|
||||
try:
|
||||
self.value = eval(self.text.GetValue())
|
||||
except SyntaxError:
|
||||
wxLogError('Syntax error in parameter value: ' + self.GetName())
|
||||
self.value = []
|
||||
dlg = ContentDialog(self, self.value)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
value = []
|
||||
for i in range(dlg.list.GetCount()):
|
||||
value.append(dlg.list.GetString(i))
|
||||
# Add ignored flags
|
||||
self.SetValue(value)
|
||||
self.SetModified()
|
||||
self.textModified = False
|
||||
dlg.Destroy()
|
||||
|
||||
# CheckList content
|
||||
class ParamContentCheckList(ParamContent):
|
||||
def __init__(self, parent, name):
|
||||
ParamContent.__init__(self, parent, name)
|
||||
def OnButtonEdit(self, evt):
|
||||
if self.textModified: # text has newer value
|
||||
try:
|
||||
self.value = eval(self.text.GetValue())
|
||||
except SyntaxError:
|
||||
wxLogError('Syntax error in parameter value: ' + self.GetName())
|
||||
self.value = []
|
||||
dlg = ContentCheckListDialog(self, self.value)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
value = []
|
||||
for i in range(dlg.list.GetCount()):
|
||||
value.append((dlg.list.GetString(i), dlg.list.IsChecked(i)))
|
||||
# Add ignored flags
|
||||
self.SetValue(value)
|
||||
self.SetModified()
|
||||
self.textModified = False
|
||||
dlg.Destroy()
|
||||
|
||||
class IntListDialog(wxDialog):
|
||||
def __init__(self, parent, value):
|
||||
pre = wxPreDialog()
|
||||
g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_INTLIST')
|
||||
self.this = pre.this
|
||||
self._setOORInfo(self)
|
||||
self.list = XRCCTRL(self, 'LIST')
|
||||
# Set list items
|
||||
value.sort()
|
||||
for v in value:
|
||||
if type(v) != IntType:
|
||||
wxLogError('Invalid item type')
|
||||
else:
|
||||
self.list.Append(str(v))
|
||||
self.SetAutoLayout(True)
|
||||
self.GetSizer().Fit(self)
|
||||
# Callbacks
|
||||
self.ID_BUTTON_ADD = XRCID('BUTTON_ADD')
|
||||
self.ID_BUTTON_REMOVE = XRCID('BUTTON_REMOVE')
|
||||
EVT_BUTTON(self, self.ID_BUTTON_ADD, self.OnButtonAppend)
|
||||
EVT_BUTTON(self, self.ID_BUTTON_REMOVE, self.OnButtonRemove)
|
||||
EVT_UPDATE_UI(self, self.ID_BUTTON_REMOVE, self.OnUpdateUI)
|
||||
def OnButtonAppend(self, evt):
|
||||
s = wxGetTextFromUser('Enter new number:', 'Add', '', self)
|
||||
if not s: return
|
||||
# Check that it's unique
|
||||
try:
|
||||
v = int(s)
|
||||
s = str(v) # to be sure
|
||||
i = self.list.FindString(s)
|
||||
if i == -1: # ignore non-unique
|
||||
# Find place to insert
|
||||
found = False
|
||||
for i in range(self.list.GetCount()):
|
||||
if int(self.list.GetString(i)) > v:
|
||||
found = True
|
||||
break
|
||||
if found: self.list.InsertItems([s], i)
|
||||
else: self.list.Append(s)
|
||||
except ValueError:
|
||||
wxLogError('List item is not an int!')
|
||||
def OnButtonRemove(self, evt):
|
||||
self.list.Delete(self.list.GetSelection())
|
||||
def OnUpdateUI(self, evt):
|
||||
if evt.GetId() == self.ID_BUTTON_REMOVE:
|
||||
evt.Enable(self.list.GetSelection() != -1)
|
||||
|
||||
# For growable list
|
||||
class ParamIntList(ParamContent):
|
||||
def __init__(self, parent, name):
|
||||
ParamContent.__init__(self, parent, name)
|
||||
def OnButtonEdit(self, evt):
|
||||
if self.textModified: # text has newer value
|
||||
try:
|
||||
self.value = eval(self.text.GetValue())
|
||||
except SyntaxError:
|
||||
wxLogError('Syntax error in parameter value: ' + self.GetName())
|
||||
self.value = []
|
||||
dlg = IntListDialog(self, self.value)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
value = []
|
||||
for i in range(dlg.list.GetCount()):
|
||||
value.append(int(dlg.list.GetString(i)))
|
||||
# Add ignored flags
|
||||
self.SetValue(value)
|
||||
self.SetModified()
|
||||
self.textModified = False
|
||||
dlg.Destroy()
|
||||
|
||||
# Boxless radiobox
|
||||
class RadioBox(PPanel):
|
||||
def __init__(self, parent, id, choices,
|
||||
pos=wxDefaultPosition, name='radiobox'):
|
||||
PPanel.__init__(self, parent, name)
|
||||
self.choices = choices
|
||||
topSizer = wxBoxSizer()
|
||||
for i in choices:
|
||||
button = wxRadioButton(self, -1, i, size=(-1,buttonSize[1]), name=i)
|
||||
topSizer.Add(button, 0, wxRIGHT, 5)
|
||||
EVT_RADIOBUTTON(self, button.GetId(), self.OnRadioChoice)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(topSizer)
|
||||
topSizer.Fit(self)
|
||||
def SetStringSelection(self, value):
|
||||
self.freeze = True
|
||||
for i in self.choices:
|
||||
self.FindWindowByName(i).SetValue(i == value)
|
||||
self.value = value
|
||||
self.freeze = False
|
||||
def OnRadioChoice(self, evt):
|
||||
if self.freeze: return
|
||||
if evt.GetSelection():
|
||||
self.value = evt.GetEventObject().GetName()
|
||||
self.SetModified()
|
||||
def GetStringSelection(self):
|
||||
return self.value
|
||||
|
||||
class ParamBool(RadioBox):
|
||||
values = {'yes': '1', 'no': '0'}
|
||||
seulav = {'1': 'yes', '0': 'no'}
|
||||
def __init__(self, parent, name):
|
||||
RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name)
|
||||
def GetValue(self):
|
||||
return self.values[self.GetStringSelection()]
|
||||
def SetValue(self, value):
|
||||
if not value: value = '1'
|
||||
self.SetStringSelection(self.seulav[value])
|
||||
|
||||
class ParamOrient(RadioBox):
|
||||
values = {'horizontal': 'wxHORIZONTAL', 'vertical': 'wxVERTICAL'}
|
||||
seulav = {'wxHORIZONTAL': 'horizontal', 'wxVERTICAL': 'vertical'}
|
||||
def __init__(self, parent, name):
|
||||
RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name)
|
||||
def GetValue(self):
|
||||
return self.values[self.GetStringSelection()]
|
||||
def SetValue(self, value):
|
||||
if not value: value = 'wxHORIZONTAL'
|
||||
self.SetStringSelection(self.seulav[value])
|
||||
|
||||
class ParamOrientation(RadioBox):
|
||||
values = {'horizontal': 'horizontal', 'vertical': 'vertical'}
|
||||
seulav = {'horizontal': 'horizontal', 'vertical': 'vertical'}
|
||||
def __init__(self, parent, name):
|
||||
RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name)
|
||||
def GetValue(self):
|
||||
return self.values[self.GetStringSelection()]
|
||||
def SetValue(self, value):
|
||||
if not value: value = 'vertical'
|
||||
self.SetStringSelection(self.seulav[value])
|
||||
|
||||
class ParamFile(PPanel):
|
||||
def __init__(self, parent, name):
|
||||
PPanel.__init__(self, parent, name)
|
||||
self.ID_TEXT_CTRL = wxNewId()
|
||||
self.ID_BUTTON_BROWSE = wxNewId()
|
||||
sizer = wxBoxSizer()
|
||||
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(200,-1))
|
||||
sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5)
|
||||
self.button = wxButton(self, self.ID_BUTTON_BROWSE, 'Browse...',size=buttonSize)
|
||||
sizer.Add(self.button, 0, wxALIGN_CENTER_VERTICAL)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(sizer)
|
||||
sizer.Fit(self)
|
||||
self.textModified = False
|
||||
EVT_BUTTON(self, self.ID_BUTTON_BROWSE, self.OnButtonBrowse)
|
||||
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
|
||||
def OnChange(self, evt):
|
||||
PPanel.OnChange(self, evt)
|
||||
self.textModified = True
|
||||
def GetValue(self):
|
||||
if self.textModified: # text has newer value
|
||||
return self.text.GetValue()
|
||||
return self.value
|
||||
def SetValue(self, value):
|
||||
self.freeze = True
|
||||
self.value = value
|
||||
self.text.SetValue(value) # update text ctrl
|
||||
self.freeze = False
|
||||
def OnButtonBrowse(self, evt):
|
||||
if self.textModified: # text has newer value
|
||||
self.value = self.text.GetValue()
|
||||
dlg = wxFileDialog(self,
|
||||
defaultDir = os.path.abspath(os.path.dirname(self.value)),
|
||||
defaultFile = os.path.basename(self.value))
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
# Get common part of selected path and current
|
||||
if g.frame.dataFile:
|
||||
curpath = os.path.abspath(g.frame.dataFile)
|
||||
else:
|
||||
curpath = os.path.join(os.getcwd(), '')
|
||||
common = os.path.commonprefix([curpath, dlg.GetPath()])
|
||||
self.SetValue(dlg.GetPath()[len(common):])
|
||||
self.SetModified()
|
||||
self.textModified = False
|
||||
dlg.Destroy()
|
||||
|
||||
class ParamBitmap(PPanel):
|
||||
def __init__(self, parent, name):
|
||||
pre = wxPrePanel()
|
||||
g.frame.res.LoadOnPanel(pre, parent, 'PANEL_BITMAP')
|
||||
self.this = pre.this
|
||||
self._setOORInfo(self)
|
||||
self.modified = self.freeze = False
|
||||
self.radio_std = XRCCTRL(self, 'RADIO_STD')
|
||||
self.radio_file = XRCCTRL(self, 'RADIO_FILE')
|
||||
self.combo = XRCCTRL(self, 'COMBO_STD')
|
||||
self.text = XRCCTRL(self, 'TEXT_FILE')
|
||||
self.button = XRCCTRL(self, 'BUTTON_BROWSE')
|
||||
self.textModified = False
|
||||
self.SetAutoLayout(True)
|
||||
self.GetSizer().SetMinSize((260, -1))
|
||||
self.GetSizer().Fit(self)
|
||||
EVT_RADIOBUTTON(self, XRCID('RADIO_STD'), self.OnRadioStd)
|
||||
EVT_RADIOBUTTON(self, XRCID('RADIO_FILE'), self.OnRadioFile)
|
||||
EVT_BUTTON(self, XRCID('BUTTON_BROWSE'), self.OnButtonBrowse)
|
||||
EVT_COMBOBOX(self, XRCID('COMBO_STD'), self.OnCombo)
|
||||
EVT_TEXT(self, XRCID('COMBO_STD'), self.OnChange)
|
||||
EVT_TEXT(self, XRCID('TEXT_FILE'), self.OnChange)
|
||||
def OnRadioStd(self, evt):
|
||||
self.SetModified()
|
||||
self.SetValue(['wxART_MISSING_IMAGE',''])
|
||||
def OnRadioFile(self, evt):
|
||||
self.SetModified()
|
||||
self.SetValue(['',''])
|
||||
def updateRadios(self):
|
||||
if self.value[0]:
|
||||
self.radio_std.SetValue(True)
|
||||
self.radio_file.SetValue(False)
|
||||
self.text.Enable(False)
|
||||
self.button.Enable(False)
|
||||
self.combo.Enable(True)
|
||||
else:
|
||||
self.radio_std.SetValue(False)
|
||||
self.radio_file.SetValue(True)
|
||||
self.text.Enable(True)
|
||||
self.button.Enable(True)
|
||||
self.combo.Enable(False)
|
||||
def OnChange(self, evt):
|
||||
PPanel.OnChange(self, evt)
|
||||
self.textModified = True
|
||||
def OnCombo(self, evt):
|
||||
PPanel.OnChange(self, evt)
|
||||
self.value[0] = self.combo.GetValue()
|
||||
def GetValue(self):
|
||||
if self.textModified: # text has newer value
|
||||
return [self.combo.GetValue(), self.text.GetValue()]
|
||||
return self.value
|
||||
def SetValue(self, value):
|
||||
self.freeze = True
|
||||
if not value:
|
||||
self.value = ['', '']
|
||||
else:
|
||||
self.value = value
|
||||
self.combo.SetValue(self.value[0])
|
||||
self.text.SetValue(self.value[1]) # update text ctrl
|
||||
self.updateRadios()
|
||||
self.freeze = False
|
||||
def OnButtonBrowse(self, evt):
|
||||
if self.textModified: # text has newer value
|
||||
self.value[1] = self.text.GetValue()
|
||||
dlg = wxFileDialog(self,
|
||||
defaultDir = os.path.abspath(os.path.dirname(self.value[1])),
|
||||
defaultFile = os.path.basename(self.value[1]))
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
# Get common part of selected path and current
|
||||
if g.frame.dataFile:
|
||||
curpath = os.path.abspath(g.frame.dataFile)
|
||||
else:
|
||||
curpath = os.path.join(os.getcwd(), '')
|
||||
common = os.path.commonprefix([curpath, dlg.GetPath()])
|
||||
self.SetValue(['', dlg.GetPath()[len(common):]])
|
||||
self.SetModified()
|
||||
self.textModified = False
|
||||
dlg.Destroy()
|
||||
|
||||
paramDict = {
|
||||
'flag': ParamFlag,
|
||||
'style': ParamStyle, 'exstyle': ParamExStyle,
|
||||
'pos': ParamPosSize, 'size': ParamPosSize,
|
||||
'cellpos': ParamPosSize, 'cellspan': ParamPosSize,
|
||||
'border': ParamUnit, 'cols': ParamInt, 'rows': ParamInt,
|
||||
'vgap': ParamUnit, 'hgap': ParamUnit,
|
||||
'checkable': ParamBool, 'checked': ParamBool, 'radio': ParamBool,
|
||||
'accel': ParamAccel,
|
||||
'label': ParamMultilineText, 'title': ParamText, 'value': ParamText,
|
||||
'content': ParamContent, 'selection': ParamInt,
|
||||
'min': ParamInt, 'max': ParamInt,
|
||||
'fg': ParamColour, 'bg': ParamColour, 'font': ParamFont,
|
||||
'enabled': ParamBool, 'focused': ParamBool, 'hidden': ParamBool,
|
||||
'tooltip': ParamText, 'bitmap': ParamBitmap, 'icon': ParamBitmap,
|
||||
'encoding': ParamEncoding
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
(require 'sawmill-defaults)
|
||||
|
||||
;;; Define two hooks to reset focus behavior while mapping test window
|
||||
|
||||
(define (xrced-match-window-before w)
|
||||
(setq prop (aref (get-x-text-property w 'WM_CLASS) 0))
|
||||
(cond ((equal prop "_XRCED_T_W")
|
||||
(setq transients-get-focus-b transients-get-focus)
|
||||
(setq transients-get-focus nil)
|
||||
(setq focus-windows-when-mapped-b focus-windows-when-mapped)
|
||||
(setq focus-windows-when-mapped nil)
|
||||
)
|
||||
)
|
||||
)
|
||||
(define (xrced-match-window-after w)
|
||||
(setq prop (aref (get-x-text-property w 'WM_CLASS) 0))
|
||||
(cond ((equal prop "_XRCED_T_W")
|
||||
(setq transients-get-focus-b transients-get-focus-b)
|
||||
(setq focus-windows-when-mapped focus-windows-when-mapped-b)
|
||||
)
|
||||
)
|
||||
)
|
||||
(add-hook 'map-notify-hook xrced-match-window-before)
|
||||
(add-hook 'map-notify-hook xrced-match-window-after 't)
|
Before Width: | Height: | Size: 316 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 513 B |
Before Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 275 B |
Before Width: | Height: | Size: 350 B |
Before Width: | Height: | Size: 616 B |
Before Width: | Height: | Size: 141 B |
Before Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 117 B |
Before Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 139 B |
Before Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 141 B |
Before Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 135 B |
Before Width: | Height: | Size: 253 B |
Before Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 80 B |
Before Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 576 B |
Before Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 82 B |
Before Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 139 B |
Before Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 139 B |
Before Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 141 B |
Before Width: | Height: | Size: 136 B |
Before Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 177 B |
Before Width: | Height: | Size: 141 B |
Before Width: | Height: | Size: 185 B |
@@ -1,285 +0,0 @@
|
||||
# Name: tools.py
|
||||
# Purpose: XRC editor, toolbar
|
||||
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
||||
# Created: 19.03.2003
|
||||
# RCS-ID: $Id$
|
||||
|
||||
from xxx import * # xxx imports globals and params
|
||||
from tree import ID_NEW
|
||||
|
||||
# Icons
|
||||
import images
|
||||
|
||||
# Groups of controls
|
||||
GROUPNUM = 4
|
||||
GROUP_WINDOWS, GROUP_MENUS, GROUP_SIZERS, GROUP_CONTROLS = range(GROUPNUM)
|
||||
|
||||
# States depending on current selection and Control/Shift keys
|
||||
STATE_ROOT, STATE_MENUBAR, STATE_TOOLBAR, STATE_MENU, STATE_ELSE = range(5)
|
||||
|
||||
# Left toolbar for GUI elements
|
||||
class Tools(wxPanel):
|
||||
TOOL_SIZE = (30, 30)
|
||||
def __init__(self, parent):
|
||||
if wxPlatform == '__WXGTK__':
|
||||
wxPanel.__init__(self, parent, -1,
|
||||
style=wxRAISED_BORDER|wxWANTS_CHARS)
|
||||
else:
|
||||
wxPanel.__init__(self, parent, -1, style=wxWANTS_CHARS)
|
||||
# Create sizer for groups
|
||||
self.sizer = wxBoxSizer(wxVERTICAL)
|
||||
# Data to create buttons
|
||||
pullDownMenu = g.pullDownMenu
|
||||
self.groups = []
|
||||
self.ctrl = self.shift = False
|
||||
# Current state (what to enable/disable)
|
||||
self.state = None
|
||||
groups = [
|
||||
["Windows",
|
||||
(ID_NEW.FRAME, images.getToolFrameBitmap()),
|
||||
(ID_NEW.DIALOG, images.getToolDialogBitmap()),
|
||||
(ID_NEW.PANEL, images.getToolPanelBitmap())],
|
||||
["Menus",
|
||||
(ID_NEW.TOOL_BAR, images.getToolToolBarBitmap()),
|
||||
(ID_NEW.MENU_BAR, images.getToolMenuBarBitmap()),
|
||||
(ID_NEW.MENU, images.getToolMenuBitmap()),
|
||||
(ID_NEW.TOOL, images.getToolToolBitmap()),
|
||||
(ID_NEW.MENU_ITEM, images.getToolMenuItemBitmap()),
|
||||
(ID_NEW.SEPARATOR, images.getToolSeparatorBitmap())],
|
||||
["Sizers",
|
||||
(ID_NEW.BOX_SIZER, images.getToolBoxSizerBitmap()),
|
||||
(ID_NEW.STATIC_BOX_SIZER, images.getToolStaticBoxSizerBitmap()),
|
||||
(ID_NEW.GRID_SIZER, images.getToolGridSizerBitmap()),
|
||||
(ID_NEW.FLEX_GRID_SIZER, images.getToolFlexGridSizerBitmap()),
|
||||
(ID_NEW.GRID_BAG_SIZER, images.getToolGridBagSizerBitmap()),
|
||||
(ID_NEW.SPACER, images.getToolSpacerBitmap())],
|
||||
["Controls",
|
||||
(ID_NEW.STATIC_TEXT, images.getToolStaticTextBitmap()),
|
||||
(ID_NEW.STATIC_BITMAP, images.getToolStaticBitmapBitmap()),
|
||||
(ID_NEW.STATIC_LINE, images.getToolStaticLineBitmap()),
|
||||
|
||||
(ID_NEW.BUTTON, images.getToolButtonBitmap()),
|
||||
(ID_NEW.BITMAP_BUTTON, images.getToolBitmapButtonBitmap()),
|
||||
(ID_NEW.STATIC_BOX, images.getToolStaticBoxBitmap()),
|
||||
|
||||
(ID_NEW.TEXT_CTRL, images.getToolTextCtrlBitmap()),
|
||||
(ID_NEW.COMBO_BOX, images.getToolComboBoxBitmap()),
|
||||
(ID_NEW.CHOICE, images.getToolChoiceBitmap()),
|
||||
|
||||
(ID_NEW.RADIO_BUTTON, images.getToolRadioButtonBitmap()),
|
||||
(ID_NEW.CHECK_BOX, images.getToolCheckBoxBitmap()),
|
||||
(ID_NEW.RADIO_BOX, images.getToolRadioBoxBitmap()),
|
||||
|
||||
(ID_NEW.SPIN_CTRL, images.getToolSpinCtrlBitmap()),
|
||||
(ID_NEW.SPIN_BUTTON, images.getToolSpinButtonBitmap()),
|
||||
(ID_NEW.SCROLL_BAR, images.getToolScrollBarBitmap()),
|
||||
|
||||
(ID_NEW.SLIDER, images.getToolSliderBitmap()),
|
||||
(ID_NEW.GAUGE, images.getToolGaugeBitmap()),
|
||||
(ID_NEW.TREE_CTRL, images.getToolTreeCtrlBitmap()),
|
||||
|
||||
(ID_NEW.LIST_BOX, images.getToolListBoxBitmap()),
|
||||
(ID_NEW.CHECK_LIST, images.getToolCheckListBitmap()),
|
||||
(ID_NEW.LIST_CTRL, images.getToolListCtrlBitmap()),
|
||||
|
||||
(ID_NEW.NOTEBOOK, images.getToolNotebookBitmap()),
|
||||
(ID_NEW.SPLITTER_WINDOW, images.getToolSplitterWindowBitmap()),
|
||||
|
||||
(ID_NEW.UNKNOWN, images.getToolUnknownBitmap())]
|
||||
]
|
||||
for grp in groups:
|
||||
self.AddGroup(grp[0])
|
||||
for b in grp[1:]:
|
||||
self.AddButton(b[0], b[1], g.pullDownMenu.createMap[b[0]])
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizerAndFit(self.sizer)
|
||||
# Allow to be resized in vertical direction only
|
||||
self.SetSizeHints(self.GetSize()[0], -1)
|
||||
# Events
|
||||
EVT_COMMAND_RANGE(self, ID_NEW.PANEL, ID_NEW.LAST,
|
||||
wxEVT_COMMAND_BUTTON_CLICKED, g.frame.OnCreate)
|
||||
EVT_KEY_DOWN(self, self.OnKeyDown)
|
||||
EVT_KEY_UP(self, self.OnKeyUp)
|
||||
|
||||
def AddButton(self, id, image, text):
|
||||
from wxPython.lib import buttons
|
||||
button = buttons.wxGenBitmapButton(self, id, image, size=self.TOOL_SIZE,
|
||||
style=wxNO_BORDER|wxWANTS_CHARS)
|
||||
button.SetBezelWidth(0)
|
||||
EVT_KEY_DOWN(button, self.OnKeyDown)
|
||||
EVT_KEY_UP(button, self.OnKeyUp)
|
||||
button.SetToolTipString(text)
|
||||
self.curSizer.Add(button)
|
||||
self.groups[-1][1][id] = button
|
||||
|
||||
def AddGroup(self, name):
|
||||
# Each group is inside box
|
||||
box = wxStaticBox(self, -1, name, style=wxWANTS_CHARS)
|
||||
box.SetFont(g.smallerFont())
|
||||
boxSizer = wxStaticBoxSizer(box, wxVERTICAL)
|
||||
boxSizer.Add((0, 4))
|
||||
self.curSizer = wxGridSizer(0, 3)
|
||||
boxSizer.Add(self.curSizer)
|
||||
self.sizer.Add(boxSizer, 0, wxTOP | wxLEFT | wxRIGHT, 4)
|
||||
self.groups.append((box,{}))
|
||||
|
||||
# Enable/disable group
|
||||
def EnableGroup(self, gnum, enable = True):
|
||||
grp = self.groups[gnum]
|
||||
grp[0].Enable(enable)
|
||||
for b in grp[1].values(): b.Enable(enable)
|
||||
|
||||
# Enable/disable group item
|
||||
def EnableGroupItem(self, gnum, id, enable = True):
|
||||
grp = self.groups[gnum]
|
||||
grp[1][id].Enable(enable)
|
||||
|
||||
# Enable/disable group items
|
||||
def EnableGroupItems(self, gnum, ids, enable = True):
|
||||
grp = self.groups[gnum]
|
||||
for id in ids:
|
||||
grp[1][id].Enable(enable)
|
||||
|
||||
# Process key events
|
||||
def OnKeyDown(self, evt):
|
||||
if evt.GetKeyCode() == WXK_CONTROL:
|
||||
g.tree.ctrl = True
|
||||
elif evt.GetKeyCode() == WXK_SHIFT:
|
||||
g.tree.shift = True
|
||||
self.UpdateIfNeeded()
|
||||
evt.Skip()
|
||||
|
||||
def OnKeyUp(self, evt):
|
||||
if evt.GetKeyCode() == WXK_CONTROL:
|
||||
g.tree.ctrl = False
|
||||
elif evt.GetKeyCode() == WXK_SHIFT:
|
||||
g.tree.shift = False
|
||||
self.UpdateIfNeeded()
|
||||
evt.Skip()
|
||||
|
||||
def OnMouse(self, evt):
|
||||
# Update control and shift states
|
||||
g.tree.ctrl = evt.ControlDown()
|
||||
g.tree.shift = evt.ShiftDown()
|
||||
self.UpdateIfNeeded()
|
||||
evt.Skip()
|
||||
|
||||
# Update UI after key presses, if necessary
|
||||
def UpdateIfNeeded(self):
|
||||
tree = g.tree
|
||||
if self.ctrl != tree.ctrl or self.shift != tree.shift:
|
||||
# Enabling is needed only for ctrl
|
||||
if self.ctrl != tree.ctrl: self.UpdateUI()
|
||||
self.ctrl = tree.ctrl
|
||||
self.shift = tree.shift
|
||||
if tree.ctrl:
|
||||
status = 'SBL'
|
||||
elif tree.shift:
|
||||
status = 'INS'
|
||||
else:
|
||||
status = ''
|
||||
g.frame.SetStatusText(status, 1)
|
||||
|
||||
# Update interface
|
||||
def UpdateUI(self):
|
||||
if not self.IsShown(): return
|
||||
# Update status bar
|
||||
pullDownMenu = g.pullDownMenu
|
||||
tree = g.tree
|
||||
item = tree.selection
|
||||
# If nothing selected, disable everything and return
|
||||
if not item:
|
||||
# Disable everything
|
||||
for grp in range(GROUPNUM):
|
||||
self.EnableGroup(grp, False)
|
||||
self.state = None
|
||||
return
|
||||
if tree.ctrl: needInsert = True
|
||||
else: needInsert = tree.NeedInsert(item)
|
||||
# Enable depending on selection
|
||||
if item == tree.root or needInsert and tree.GetItemParent(item) == tree.root:
|
||||
state = STATE_ROOT
|
||||
else:
|
||||
xxx = tree.GetPyData(item).treeObject()
|
||||
# Check parent for possible child nodes if inserting sibling
|
||||
if needInsert: xxx = xxx.parent
|
||||
if xxx.__class__ == xxxMenuBar:
|
||||
state = STATE_MENUBAR
|
||||
elif xxx.__class__ in [xxxToolBar, xxxTool] or \
|
||||
xxx.__class__ == xxxSeparator and xxx.parent.__class__ == xxxToolBar:
|
||||
state = STATE_TOOLBAR
|
||||
elif xxx.__class__ in [xxxMenu, xxxMenuItem]:
|
||||
state = STATE_MENU
|
||||
else:
|
||||
state = STATE_ELSE
|
||||
|
||||
# Enable depending on selection
|
||||
if state != self.state:
|
||||
# Disable everything
|
||||
for grp in range(GROUPNUM):
|
||||
self.EnableGroup(grp, False)
|
||||
# Enable some
|
||||
if state == STATE_ROOT:
|
||||
self.EnableGroup(GROUP_WINDOWS, True)
|
||||
self.EnableGroup(GROUP_MENUS, True)
|
||||
# But disable items
|
||||
self.EnableGroupItems(GROUP_MENUS,
|
||||
[ ID_NEW.TOOL,
|
||||
ID_NEW.MENU_ITEM,
|
||||
ID_NEW.SEPARATOR ],
|
||||
False)
|
||||
elif state == STATE_MENUBAR:
|
||||
self.EnableGroup(GROUP_MENUS)
|
||||
self.EnableGroupItems(GROUP_MENUS,
|
||||
[ ID_NEW.TOOL_BAR,
|
||||
ID_NEW.MENU_BAR,
|
||||
ID_NEW.TOOL ],
|
||||
False)
|
||||
elif state == STATE_TOOLBAR:
|
||||
self.EnableGroup(GROUP_MENUS)
|
||||
self.EnableGroupItems(GROUP_MENUS,
|
||||
[ ID_NEW.TOOL_BAR,
|
||||
ID_NEW.MENU,
|
||||
ID_NEW.MENU_BAR,
|
||||
ID_NEW.MENU_ITEM ],
|
||||
False)
|
||||
self.EnableGroup(GROUP_CONTROLS)
|
||||
self.EnableGroupItems(GROUP_CONTROLS,
|
||||
[ ID_NEW.TREE_CTRL,
|
||||
ID_NEW.NOTEBOOK,
|
||||
ID_NEW.SPLITTER_WINDOW ],
|
||||
False)
|
||||
elif state == STATE_MENU:
|
||||
self.EnableGroup(GROUP_MENUS)
|
||||
self.EnableGroupItems(GROUP_MENUS,
|
||||
[ ID_NEW.TOOL_BAR,
|
||||
ID_NEW.MENU_BAR,
|
||||
ID_NEW.TOOL ],
|
||||
False)
|
||||
else:
|
||||
self.EnableGroup(GROUP_WINDOWS)
|
||||
self.EnableGroupItems(GROUP_WINDOWS,
|
||||
[ ID_NEW.FRAME,
|
||||
ID_NEW.DIALOG ],
|
||||
False)
|
||||
self.EnableGroup(GROUP_MENUS)
|
||||
self.EnableGroupItems(GROUP_MENUS,
|
||||
[ ID_NEW.MENU_BAR,
|
||||
ID_NEW.MENU_BAR,
|
||||
ID_NEW.MENU,
|
||||
ID_NEW.MENU_ITEM,
|
||||
ID_NEW.TOOL,
|
||||
ID_NEW.SEPARATOR ],
|
||||
False)
|
||||
self.EnableGroup(GROUP_SIZERS)
|
||||
self.EnableGroup(GROUP_CONTROLS)
|
||||
# Special case for notebook (always executed)
|
||||
if state == STATE_ELSE:
|
||||
if xxx.__class__ == xxxNotebook:
|
||||
self.EnableGroup(GROUP_SIZERS, False)
|
||||
else:
|
||||
self.EnableGroup(GROUP_SIZERS)
|
||||
if not (xxx.isSizer or xxx.parent and xxx.parent.isSizer):
|
||||
self.EnableGroupItem(GROUP_SIZERS, ID_NEW.SPACER, False)
|
||||
# Save state
|
||||
self.state = state
|
@@ -1,151 +0,0 @@
|
||||
# Name: undo.py
|
||||
# Purpose: XRC editor, undo/redo module
|
||||
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
||||
# Created: 01.12.2002
|
||||
# RCS-ID: $Id$
|
||||
|
||||
from globals import *
|
||||
#from panel import *
|
||||
|
||||
# Undo/redo classes
|
||||
class UndoManager:
|
||||
# Undo/redo stacks
|
||||
undo = []
|
||||
redo = []
|
||||
def RegisterUndo(self, undoObj):
|
||||
self.undo.append(undoObj)
|
||||
for i in self.redo: i.destroy()
|
||||
self.redo = []
|
||||
def Undo(self):
|
||||
undoObj = self.undo.pop()
|
||||
undoObj.undo()
|
||||
self.redo.append(undoObj)
|
||||
g.frame.modified = True
|
||||
g.frame.SetStatusText('Undone')
|
||||
def Redo(self):
|
||||
undoObj = self.redo.pop()
|
||||
undoObj.redo()
|
||||
self.undo.append(undoObj)
|
||||
g.frame.modified = True
|
||||
g.frame.SetStatusText('Redone')
|
||||
def Clear(self):
|
||||
for i in self.undo: i.destroy()
|
||||
self.undo = []
|
||||
for i in self.redo: i.destroy()
|
||||
self.redo = []
|
||||
def CanUndo(self):
|
||||
return not not self.undo
|
||||
def CanRedo(self):
|
||||
return not not self.redo
|
||||
|
||||
class UndoCutDelete:
|
||||
def __init__(self, itemIndex, parent, elem):
|
||||
self.itemIndex = itemIndex
|
||||
self.parent = parent
|
||||
self.elem = elem
|
||||
def destroy(self):
|
||||
if self.elem: self.elem.unlink()
|
||||
def undo(self):
|
||||
item = g.tree.InsertNode(g.tree.ItemAtFullIndex(self.itemIndex[:-1]),
|
||||
self.parent, self.elem,
|
||||
g.tree.ItemAtFullIndex(self.itemIndex))
|
||||
# Scroll to show new item (!!! redundant?)
|
||||
g.tree.EnsureVisible(item)
|
||||
g.tree.SelectItem(item)
|
||||
self.elem = None
|
||||
# Update testWin if needed
|
||||
if g.testWin and g.tree.IsHighlatable(item):
|
||||
if g.conf.autoRefresh:
|
||||
g.tree.needUpdate = True
|
||||
g.tree.pendingHighLight = item
|
||||
else:
|
||||
g.tree.pendingHighLight = None
|
||||
def redo(self):
|
||||
item = g.tree.ItemAtFullIndex(self.itemIndex)
|
||||
# Delete testWin?
|
||||
if g.testWin:
|
||||
# If deleting top-level item, delete testWin
|
||||
if item == g.testWin.item:
|
||||
g.testWin.Destroy()
|
||||
g.testWin = None
|
||||
else:
|
||||
# Remove highlight, update testWin
|
||||
if g.testWin.highLight:
|
||||
g.testWin.highLight.Remove()
|
||||
g.tree.needUpdate = True
|
||||
self.elem = g.tree.RemoveLeaf(item)
|
||||
g.tree.Unselect()
|
||||
g.panel.Clear()
|
||||
|
||||
class UndoPasteCreate:
|
||||
def __init__(self, itemParent, parent, item, selected):
|
||||
self.itemParentIndex = g.tree.ItemFullIndex(itemParent)
|
||||
self.parent = parent
|
||||
self.itemIndex = g.tree.ItemFullIndex(item) # pasted item
|
||||
self.selectedIndex = g.tree.ItemFullIndex(selected) # maybe different from item
|
||||
self.elem = None
|
||||
def destroy(self):
|
||||
if self.elem: self.elem.unlink()
|
||||
def undo(self):
|
||||
self.elem = g.tree.RemoveLeaf(g.tree.ItemAtFullIndex(self.itemIndex))
|
||||
# Restore old selection
|
||||
selected = g.tree.ItemAtFullIndex(self.selectedIndex)
|
||||
g.tree.EnsureVisible(selected)
|
||||
g.tree.SelectItem(selected)
|
||||
# Delete testWin?
|
||||
if g.testWin:
|
||||
# If deleting top-level item, delete testWin
|
||||
if selected == g.testWin.item:
|
||||
g.testWin.Destroy()
|
||||
g.testWin = None
|
||||
else:
|
||||
# Remove highlight, update testWin
|
||||
if g.testWin.highLight:
|
||||
g.testWin.highLight.Remove()
|
||||
g.tree.needUpdate = True
|
||||
def redo(self):
|
||||
item = g.tree.InsertNode(g.tree.ItemAtFullIndex(self.itemParentIndex),
|
||||
self.parent, self.elem,
|
||||
g.tree.ItemAtFullIndex(self.itemIndex))
|
||||
# Scroll to show new item
|
||||
g.tree.EnsureVisible(item)
|
||||
g.tree.SelectItem(item)
|
||||
self.elem = None
|
||||
# Update testWin if needed
|
||||
if g.testWin and g.tree.IsHighlatable(item):
|
||||
if g.conf.autoRefresh:
|
||||
g.tree.needUpdate = True
|
||||
g.tree.pendingHighLight = item
|
||||
else:
|
||||
g.tree.pendingHighLight = None
|
||||
|
||||
class UndoEdit:
|
||||
def __init__(self):
|
||||
self.pages = map(ParamPage.GetState, g.panel.pages)
|
||||
self.selectedIndex = g.tree.ItemFullIndex(g.tree.GetSelection())
|
||||
def destroy(self):
|
||||
pass
|
||||
# Update test view
|
||||
def update(self, selected):
|
||||
g.tree.Apply(g.tree.GetPyData(selected), selected)
|
||||
# Update view
|
||||
if g.testWin:
|
||||
if g.testWin.highLight:
|
||||
g.testWin.highLight.Remove()
|
||||
g.tree.pendingHighLight = selected
|
||||
if g.testWin:
|
||||
g.tree.needUpdate = True
|
||||
def undo(self):
|
||||
# Restore selection
|
||||
selected = g.tree.ItemAtFullIndex(self.selectedIndex)
|
||||
if selected != g.tree.GetSelection():
|
||||
g.tree.SelectItem(selected)
|
||||
# Save current state for redo
|
||||
map(ParamPage.SaveState, g.panel.pages)
|
||||
pages = map(ParamPage.GetState, g.panel.pages)
|
||||
map(ParamPage.SetState, g.panel.pages, self.pages)
|
||||
self.pages = pages
|
||||
self.update(selected)
|
||||
def redo(self):
|
||||
self.undo()
|
||||
self.update(g.tree.GetSelection())
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1 +0,0 @@
|
||||
python2.2 YOUR_PATH_TO_XRCED/xrced.py $*
|
@@ -1,434 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<resource>
|
||||
<object class="wxDialog" name="DIALOG_TEXT">
|
||||
<title>Text Dialog</title>
|
||||
<centered>1</centered>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxTextCtrl" name="TEXT">
|
||||
<size>250,100</size>
|
||||
<style>wxTE_MULTILINE</style>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
<label>OK</label>
|
||||
<default>1</default>
|
||||
</object>
|
||||
<flag>wxRIGHT</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
|
||||
</object>
|
||||
<object class="wxDialog" name="DIALOG_CONTENT">
|
||||
<title>Content</title>
|
||||
<centered>1</centered>
|
||||
<size>250,300</size>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxListBox" name="LIST">
|
||||
<content/>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxTOP|wxBOTTOM|wxLEFT|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_UP">
|
||||
<label>Move Up</label>
|
||||
</object>
|
||||
<flag>wxBOTTOM|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_DOWN">
|
||||
<label>Move Down</label>
|
||||
</object>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="spacer">
|
||||
<size>10,20</size>
|
||||
<option>1</option>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_APPEND">
|
||||
<label>Append...</label>
|
||||
</object>
|
||||
<flag>wxBOTTOM|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_REMOVE">
|
||||
<label>Remove</label>
|
||||
</object>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
<label>OK</label>
|
||||
<default>1</default>
|
||||
</object>
|
||||
<flag>wxRIGHT</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
|
||||
</object>
|
||||
<object class="wxDialog" name="DIALOG_CONTENT_CHECK_LIST">
|
||||
<title>Content</title>
|
||||
<centered>1</centered>
|
||||
<size>250,300</size>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxCheckListBox" name="CHECK_LIST">
|
||||
<content/>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxTOP|wxBOTTOM|wxLEFT|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_UP">
|
||||
<label>Move Up</label>
|
||||
</object>
|
||||
<flag>wxBOTTOM|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_DOWN">
|
||||
<label>Move Down</label>
|
||||
</object>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="spacer">
|
||||
<size>10,20</size>
|
||||
<option>1</option>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_APPEND">
|
||||
<label>Append...</label>
|
||||
</object>
|
||||
<flag>wxBOTTOM|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_REMOVE">
|
||||
<label>Remove</label>
|
||||
</object>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
<label>OK</label>
|
||||
<default>1</default>
|
||||
</object>
|
||||
<flag>wxRIGHT</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
|
||||
</object>
|
||||
<object class="wxDialog" name="DIALOG_CHOICES">
|
||||
<title>Choices</title>
|
||||
<centered>1</centered>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxCheckListBox" name="CHECK_LIST">
|
||||
<content/>
|
||||
<size>250,250</size>
|
||||
<style></style>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
<label>OK</label>
|
||||
<default>1</default>
|
||||
</object>
|
||||
<flag>wxRIGHT</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
|
||||
</object>
|
||||
<object class="wxDialog" name="DIALOG_INTLIST">
|
||||
<title>Numbers</title>
|
||||
<centered>1</centered>
|
||||
<size>100,300</size>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxListBox" name="LIST">
|
||||
<content/>
|
||||
<size>80,100</size>
|
||||
<style>wxLB_SORT</style>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_ADD">
|
||||
<label>Add...</label>
|
||||
</object>
|
||||
<flag>wxBOTTOM</flag>
|
||||
<border>3</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_REMOVE">
|
||||
<label>Remove</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
<label>OK</label>
|
||||
<default>1</default>
|
||||
</object>
|
||||
<flag>wxBOTTOM</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
|
||||
</object>
|
||||
<object class="wxPanel" name="PANEL_BITMAP">
|
||||
<object class="wxStaticBoxSizer">
|
||||
<label></label>
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxFlexGridSizer">
|
||||
<cols>2</cols>
|
||||
<rows>2</rows>
|
||||
<object class="sizeritem">
|
||||
<object class="wxRadioButton" name="RADIO_STD">
|
||||
<label>art:</label>
|
||||
</object>
|
||||
<flag>wxALIGN_CENTRE_VERTICAL</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxComboBox" name="COMBO_STD">
|
||||
<content>
|
||||
<item>wxART_ADD_BOOKMARK</item>
|
||||
<item>wxART_DEL_BOOKMARK</item>
|
||||
<item>wxART_HELP_SIDE_PANEL</item>
|
||||
<item>wxART_HELP_SETTINGS</item>
|
||||
<item>wxART_HELP_BOOK</item>
|
||||
<item>wxART_HELP_FOLDER</item>
|
||||
<item>wxART_HELP_PAGE</item>
|
||||
<item>wxART_GO_BACK</item>
|
||||
<item>wxART_GO_FORWARD</item>
|
||||
<item>wxART_GO_UP</item>
|
||||
<item>wxART_GO_DOWN</item>
|
||||
<item>wxART_GO_TO_PARENT</item>
|
||||
<item>wxART_GO_HOME</item>
|
||||
<item>wxART_FILE_OPEN</item>
|
||||
<item>wxART_FILE_SAVE</item>
|
||||
<item>wxART_FILE_SAVE_AS</item>
|
||||
<item>wxART_PRINT</item>
|
||||
<item>wxART_HELP</item>
|
||||
<item>wxART_TIP</item>
|
||||
<item>wxART_REPORT_VIEW</item>
|
||||
<item>wxART_LIST_VIEW</item>
|
||||
<item>wxART_NEW_DIR</item>
|
||||
<item>wxART_HARDDISK</item>
|
||||
<item>wxART_FLOPPY</item>
|
||||
<item>wxART_CDROM</item>
|
||||
<item>wxART_REMOVABLE</item>
|
||||
<item>wxART_FOLDER</item>
|
||||
<item>wxART_FOLDER_OPEN</item>
|
||||
<item>wxART_GO_DIR_UP</item>
|
||||
<item>wxART_EXECUTABLE_FILE</item>
|
||||
<item>wxART_NORMAL_FILE</item>
|
||||
<item>wxART_TICK_MARK</item>
|
||||
<item>wxART_CROSS_MARK</item>
|
||||
<item>wxART_ERROR</item>
|
||||
<item>wxART_QUESTION</item>
|
||||
<item>wxART_WARNING</item>
|
||||
<item>wxART_INFORMATION</item>
|
||||
<item>wxART_MISSING_IMAGE</item>
|
||||
<item>wxART_COPY</item>
|
||||
<item>wxART_CUT</item>
|
||||
<item>wxART_PASTE</item>
|
||||
<item>wxART_DELETE</item>
|
||||
<item>wxART_NEW</item>
|
||||
<item>wxART_UNDO</item>
|
||||
<item>wxART_REDO</item>
|
||||
<item>wxART_QUIT</item>
|
||||
<item>wxART_FIND</item>
|
||||
<item>wxART_FIND_AND_REPLACE</item>
|
||||
</content>
|
||||
</object>
|
||||
<flag>wxRIGHT|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxRadioButton" name="RADIO_FILE">
|
||||
<label>file:</label>
|
||||
</object>
|
||||
<flag>wxALIGN_CENTRE_VERTICAL</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxTextCtrl" name="TEXT_FILE"/>
|
||||
<option>1</option>
|
||||
<flag>wxRIGHT|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_BROWSE">
|
||||
<label>Browse...</label>
|
||||
<size>40,-1d</size>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<flag>wxRIGHT|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<vgap>2</vgap>
|
||||
<growablecols>1</growablecols>
|
||||
</object>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</resource>
|
@@ -1,937 +0,0 @@
|
||||
# Name: xxx.py ('xxx' is easy to distinguish from 'wx' :) )
|
||||
# Purpose: XML interface classes
|
||||
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
||||
# Created: 22.08.2001
|
||||
# RCS-ID: $Id$
|
||||
|
||||
from xml.dom import minidom
|
||||
from globals import *
|
||||
from params import *
|
||||
|
||||
# Base class for interface parameter classes
|
||||
class xxxNode:
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
def remove(self):
|
||||
self.node.parentNode.removeChild(self.node)
|
||||
self.node.unlink()
|
||||
|
||||
# Generic (text) parameter class
|
||||
class xxxParam(xxxNode):
|
||||
# Standard use: for text nodes
|
||||
def __init__(self, node):
|
||||
xxxNode.__init__(self, node)
|
||||
if not node.hasChildNodes():
|
||||
# If does not have child nodes, create empty text node
|
||||
text = g.tree.dom.createTextNode('')
|
||||
node.appendChild(text)
|
||||
else:
|
||||
text = node.childNodes[0] # first child must be text node
|
||||
assert text.nodeType == minidom.Node.TEXT_NODE
|
||||
# Append other text nodes if present and delete them
|
||||
extraText = ''
|
||||
for n in node.childNodes[1:]:
|
||||
if n.nodeType == minidom.Node.TEXT_NODE:
|
||||
extraText += n.data
|
||||
node.removeChild(n)
|
||||
n.unlink()
|
||||
else: break
|
||||
if extraText: text.data = text.data + extraText
|
||||
# Use convertion from unicode to current encoding
|
||||
self.textNode = text
|
||||
# Value returns string
|
||||
if wxUSE_UNICODE: # no conversion is needed
|
||||
def value(self):
|
||||
return self.textNode.data
|
||||
def update(self, value):
|
||||
self.textNode.data = value
|
||||
else:
|
||||
def value(self):
|
||||
try:
|
||||
return self.textNode.data.encode(g.currentEncoding)
|
||||
except LookupError:
|
||||
return self.textNode.data.encode()
|
||||
def update(self, value):
|
||||
try: # handle exception if encoding is wrong
|
||||
self.textNode.data = unicode(value, g.currentEncoding)
|
||||
except UnicodeDecodeError:
|
||||
self.textNode.data = unicode(value)
|
||||
#wxLogMessage("Unicode error: set encoding in file\nglobals.py to something appropriate")
|
||||
|
||||
# Integer parameter
|
||||
class xxxParamInt(xxxParam):
|
||||
# Standard use: for text nodes
|
||||
def __init__(self, node):
|
||||
xxxParam.__init__(self, node)
|
||||
# Value returns string
|
||||
def value(self):
|
||||
try:
|
||||
return int(self.textNode.data)
|
||||
except ValueError:
|
||||
return -1 # invalid value
|
||||
def update(self, value):
|
||||
self.textNode.data = str(value)
|
||||
|
||||
# Content parameter
|
||||
class xxxParamContent(xxxNode):
|
||||
def __init__(self, node):
|
||||
xxxNode.__init__(self, node)
|
||||
data, l = [], [] # data is needed to quicker value retrieval
|
||||
nodes = node.childNodes[:] # make a copy of the child list
|
||||
for n in nodes:
|
||||
if n.nodeType == minidom.Node.ELEMENT_NODE:
|
||||
assert n.tagName == 'item', 'bad content content'
|
||||
if not n.hasChildNodes():
|
||||
# If does not have child nodes, create empty text node
|
||||
text = g.tree.dom.createTextNode('')
|
||||
node.appendChild(text)
|
||||
else:
|
||||
# !!! normalize?
|
||||
text = n.childNodes[0] # first child must be text node
|
||||
assert text.nodeType == minidom.Node.TEXT_NODE
|
||||
l.append(text)
|
||||
data.append(str(text.data))
|
||||
else: # remove other
|
||||
node.removeChild(n)
|
||||
n.unlink()
|
||||
self.l, self.data = l, data
|
||||
def value(self):
|
||||
return self.data
|
||||
def update(self, value):
|
||||
# If number if items is not the same, recreate children
|
||||
if len(value) != len(self.l): # remove first if number of items has changed
|
||||
childNodes = self.node.childNodes[:]
|
||||
for n in childNodes:
|
||||
self.node.removeChild(n)
|
||||
l = []
|
||||
for str in value:
|
||||
itemElem = g.tree.dom.createElement('item')
|
||||
itemText = g.tree.dom.createTextNode(str)
|
||||
itemElem.appendChild(itemText)
|
||||
self.node.appendChild(itemElem)
|
||||
l.append(itemText)
|
||||
self.l = l
|
||||
else:
|
||||
for i in range(len(value)):
|
||||
self.l[i].data = value[i]
|
||||
self.data = value
|
||||
|
||||
# Content parameter for checklist
|
||||
class xxxParamContentCheckList(xxxNode):
|
||||
def __init__(self, node):
|
||||
xxxNode.__init__(self, node)
|
||||
data, l = [], [] # data is needed to quicker value retrieval
|
||||
nodes = node.childNodes[:] # make a copy of the child list
|
||||
for n in nodes:
|
||||
if n.nodeType == minidom.Node.ELEMENT_NODE:
|
||||
assert n.tagName == 'item', 'bad content content'
|
||||
checked = n.getAttribute('checked')
|
||||
if not checked: checked = 0
|
||||
if not n.hasChildNodes():
|
||||
# If does not have child nodes, create empty text node
|
||||
text = g.tree.dom.createTextNode('')
|
||||
node.appendChild(text)
|
||||
else:
|
||||
# !!! normalize?
|
||||
text = n.childNodes[0] # first child must be text node
|
||||
assert text.nodeType == minidom.Node.TEXT_NODE
|
||||
l.append((text, n))
|
||||
data.append((str(text.data), int(checked)))
|
||||
else: # remove other
|
||||
node.removeChild(n)
|
||||
n.unlink()
|
||||
self.l, self.data = l, data
|
||||
def value(self):
|
||||
return self.data
|
||||
def update(self, value):
|
||||
# If number if items is not the same, recreate children
|
||||
if len(value) != len(self.l): # remove first if number of items has changed
|
||||
childNodes = self.node.childNodes[:]
|
||||
for n in childNodes:
|
||||
self.node.removeChild(n)
|
||||
l = []
|
||||
for s,ch in value:
|
||||
itemElem = g.tree.dom.createElement('item')
|
||||
# Add checked only if True
|
||||
if ch: itemElem.setAttribute('checked', '1')
|
||||
itemText = g.tree.dom.createTextNode(s)
|
||||
itemElem.appendChild(itemText)
|
||||
self.node.appendChild(itemElem)
|
||||
l.append((itemText, itemElem))
|
||||
self.l = l
|
||||
else:
|
||||
for i in range(len(value)):
|
||||
self.l[i][0].data = value[i][0]
|
||||
self.l[i][1].setAttribute('checked', str(value[i][1]))
|
||||
self.data = value
|
||||
|
||||
# Bitmap parameter
|
||||
class xxxParamBitmap(xxxParam):
|
||||
def __init__(self, node):
|
||||
xxxParam.__init__(self, node)
|
||||
self.stock_id = node.getAttribute('stock_id')
|
||||
def value(self):
|
||||
return [self.stock_id, xxxParam.value(self)]
|
||||
def update(self, value):
|
||||
self.stock_id = value[0]
|
||||
if self.stock_id:
|
||||
self.node.setAttribute('stock_id', self.stock_id)
|
||||
elif self.node.hasAttribute('stock_id'):
|
||||
self.node.removeAttribute('stock_id')
|
||||
xxxParam.update(self, value[1])
|
||||
|
||||
################################################################################
|
||||
|
||||
# Classes to interface DOM objects
|
||||
class xxxObject:
|
||||
# Default behavior
|
||||
hasChildren = False # has children elements?
|
||||
hasStyle = True # almost everyone
|
||||
hasName = True # has name attribute?
|
||||
isSizer = hasChild = False
|
||||
allParams = None # Some nodes have no parameters
|
||||
# Style parameters (all optional)
|
||||
styles = ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'tooltip']
|
||||
# Special parameters
|
||||
specials = []
|
||||
# Bitmap tags
|
||||
bitmapTags = ['bitmap', 'bitmap2', 'icon']
|
||||
# Required paremeters: none by default
|
||||
required = []
|
||||
# Default parameters with default values
|
||||
default = {}
|
||||
# Parameter types
|
||||
paramDict = {}
|
||||
# Window styles and extended styles
|
||||
winStyles = []
|
||||
# Tree icon index
|
||||
#image = -1
|
||||
# Construct a new xxx object from DOM element
|
||||
# parent is parent xxx object (or None if none), element is DOM element object
|
||||
def __init__(self, parent, element):
|
||||
self.parent = parent
|
||||
self.element = element
|
||||
self.undo = None
|
||||
# Get attributes
|
||||
self.className = element.getAttribute('class')
|
||||
self.subclass = element.getAttribute('subclass')
|
||||
if self.hasName: self.name = element.getAttribute('name')
|
||||
# Set parameters (text element children)
|
||||
self.params = {}
|
||||
nodes = element.childNodes[:]
|
||||
for node in nodes:
|
||||
if node.nodeType == minidom.Node.ELEMENT_NODE:
|
||||
tag = node.tagName
|
||||
if tag == 'object':
|
||||
continue # do nothing for object children here
|
||||
if tag not in self.allParams and tag not in self.styles:
|
||||
print 'WARNING: unknown parameter for %s: %s' % \
|
||||
(self.className, tag)
|
||||
elif tag in self.specials:
|
||||
self.special(tag, node)
|
||||
elif tag == 'content':
|
||||
if self.className == 'wxCheckListBox':
|
||||
self.params[tag] = xxxParamContentCheckList(node)
|
||||
else:
|
||||
self.params[tag] = xxxParamContent(node)
|
||||
elif tag == 'font': # has children
|
||||
self.params[tag] = xxxParamFont(element, node)
|
||||
elif tag in self.bitmapTags:
|
||||
# Can have attributes
|
||||
self.params[tag] = xxxParamBitmap(node)
|
||||
else: # simple parameter
|
||||
self.params[tag] = xxxParam(node)
|
||||
elif node.nodeType == minidom.Node.TEXT_NODE and node.data.isspace():
|
||||
# Remove empty text nodes
|
||||
element.removeChild(node)
|
||||
node.unlink()
|
||||
|
||||
# Check that all required params are set
|
||||
for param in self.required:
|
||||
if not self.params.has_key(param):
|
||||
# If default is specified, set it
|
||||
if self.default.has_key(param):
|
||||
elem = g.tree.dom.createElement(param)
|
||||
if param == 'content':
|
||||
if self.className == 'wxCheckListBox':
|
||||
self.params[param] = xxxParamContentCheckList(elem)
|
||||
else:
|
||||
self.params[param] = xxxParamContent(elem)
|
||||
else:
|
||||
self.params[param] = xxxParam(elem)
|
||||
# Find place to put new element: first present element after param
|
||||
found = False
|
||||
paramStyles = self.allParams + self.styles
|
||||
for p in paramStyles[paramStyles.index(param) + 1:]:
|
||||
# Content params don't have same type
|
||||
if self.params.has_key(p) and p != 'content':
|
||||
found = True
|
||||
break
|
||||
if found:
|
||||
nextTextElem = self.params[p].node
|
||||
self.element.insertBefore(elem, nextTextElem)
|
||||
else:
|
||||
self.element.appendChild(elem)
|
||||
else:
|
||||
wxLogWarning('Required parameter %s of %s missing' %
|
||||
(param, self.className))
|
||||
# Returns real tree object
|
||||
def treeObject(self):
|
||||
if self.hasChild: return self.child
|
||||
return self
|
||||
# Returns tree image index
|
||||
def treeImage(self):
|
||||
if self.hasChild: return self.child.treeImage()
|
||||
return self.image
|
||||
# Class name plus wx name
|
||||
def treeName(self):
|
||||
if self.hasChild: return self.child.treeName()
|
||||
if self.subclass: className = self.subclass
|
||||
else: className = self.className
|
||||
if self.hasName and self.name: return className + ' "' + self.name + '"'
|
||||
return className
|
||||
# Class name or subclass
|
||||
def panelName(self):
|
||||
if self.subclass: return self.subclass + '(' + self.className + ')'
|
||||
else: return self.className
|
||||
# Sets name of tree object
|
||||
def setTreeName(self, name):
|
||||
if self.hasChild: obj = self.child
|
||||
else: obj = self
|
||||
obj.name = name
|
||||
obj.element.setAttribute('name', name)
|
||||
|
||||
################################################################################
|
||||
|
||||
# This is a little special: it is both xxxObject and xxxNode
|
||||
class xxxParamFont(xxxObject, xxxNode):
|
||||
allParams = ['size', 'family', 'style', 'weight', 'underlined',
|
||||
'face', 'encoding']
|
||||
def __init__(self, parent, element):
|
||||
xxxObject.__init__(self, parent, element)
|
||||
xxxNode.__init__(self, element)
|
||||
self.parentNode = parent # required to behave similar to DOM node
|
||||
v = []
|
||||
for p in self.allParams:
|
||||
try:
|
||||
v.append(str(self.params[p].value()))
|
||||
except KeyError:
|
||||
v.append('')
|
||||
self.data = v
|
||||
def update(self, value):
|
||||
# `value' is a list of strings corresponding to all parameters
|
||||
elem = self.element
|
||||
# Remove old elements first
|
||||
childNodes = elem.childNodes[:]
|
||||
for node in childNodes: elem.removeChild(node)
|
||||
i = 0
|
||||
self.params.clear()
|
||||
v = []
|
||||
for param in self.allParams:
|
||||
if value[i]:
|
||||
fontElem = g.tree.dom.createElement(param)
|
||||
textNode = g.tree.dom.createTextNode(value[i])
|
||||
self.params[param] = textNode
|
||||
fontElem.appendChild(textNode)
|
||||
elem.appendChild(fontElem)
|
||||
v.append(value[i])
|
||||
i += 1
|
||||
self.data = v
|
||||
def value(self):
|
||||
return self.data
|
||||
|
||||
################################################################################
|
||||
|
||||
class xxxContainer(xxxObject):
|
||||
hasChildren = True
|
||||
exStyles = []
|
||||
|
||||
# Simulate normal parameter for encoding
|
||||
class xxxEncoding:
|
||||
def value(self):
|
||||
return g.currentEncoding
|
||||
def update(self, val):
|
||||
g.currentEncoding = val
|
||||
|
||||
# Special class for root node
|
||||
class xxxMainNode(xxxContainer):
|
||||
allParams = ['encoding']
|
||||
hasStyle = hasName = False
|
||||
def __init__(self, dom):
|
||||
xxxContainer.__init__(self, None, dom.documentElement)
|
||||
self.className = 'XML tree'
|
||||
# Reset required parameters after processing XML, because encoding is
|
||||
# a little special
|
||||
self.required = ['encoding']
|
||||
self.params['encoding'] = xxxEncoding()
|
||||
|
||||
################################################################################
|
||||
# Top-level windwows
|
||||
|
||||
class xxxPanel(xxxContainer):
|
||||
allParams = ['pos', 'size', 'style']
|
||||
styles = ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'exstyle',
|
||||
'tooltip']
|
||||
|
||||
class xxxDialog(xxxContainer):
|
||||
allParams = ['title', 'centered', 'pos', 'size', 'style']
|
||||
paramDict = {'centered': ParamBool}
|
||||
required = ['title']
|
||||
default = {'title': ''}
|
||||
winStyles = ['wxDEFAULT_DIALOG_STYLE',
|
||||
'wxCAPTION', 'wxMINIMIZE_BOX', 'wxMAXIMIZE_BOX', 'wxCLOSE_BOX',
|
||||
'wxSTAY_ON_TOP',
|
||||
'wxTHICK_FRAME',
|
||||
'wxNO_3D', 'wxDIALOG_NO_PARENT']
|
||||
styles = ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'exstyle',
|
||||
'tooltip']
|
||||
|
||||
class xxxFrame(xxxContainer):
|
||||
allParams = ['title', 'centered', 'pos', 'size', 'style']
|
||||
paramDict = {'centered': ParamBool}
|
||||
required = ['title']
|
||||
default = {'title': ''}
|
||||
winStyles = ['wxDEFAULT_FRAME_STYLE',
|
||||
'wxCAPTION', 'wxMINIMIZE_BOX', 'wxMAXIMIZE_BOX', 'wxCLOSE_BOX',
|
||||
'wxSTAY_ON_TOP',
|
||||
'wxSYSTEM_MENU', 'wxRESIZE_BORDER',
|
||||
'wxFRAME_TOOL_WINDOW', 'wxFRAME_NO_TASKBAR',
|
||||
'wxFRAME_FLOAT_ON_PARENT', 'wxFRAME_SHAPED'
|
||||
]
|
||||
styles = ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'exstyle',
|
||||
'tooltip']
|
||||
|
||||
class xxxTool(xxxObject):
|
||||
allParams = ['bitmap', 'bitmap2', 'radio', 'toggle', 'tooltip', 'longhelp', 'label']
|
||||
required = ['bitmap']
|
||||
paramDict = {'bitmap2': ParamBitmap, 'radio': ParamBool, 'toggle': ParamBool}
|
||||
hasStyle = False
|
||||
|
||||
class xxxToolBar(xxxContainer):
|
||||
allParams = ['bitmapsize', 'margins', 'packing', 'separation', 'dontattachtoframe',
|
||||
'pos', 'size', 'style']
|
||||
hasStyle = False
|
||||
paramDict = {'bitmapsize': ParamPosSize, 'margins': ParamPosSize,
|
||||
'packing': ParamInt, 'separation': ParamInt,
|
||||
'dontattachtoframe': ParamBool, 'style': ParamNonGenericStyle}
|
||||
winStyles = ['wxTB_FLAT', 'wxTB_DOCKABLE', 'wxTB_VERTICAL', 'wxTB_HORIZONTAL',
|
||||
'wxTB_3DBUTTONS','wxTB_TEXT', 'wxTB_NOICONS', 'wxTB_NODIVIDER',
|
||||
'wxTB_NOALIGN', 'wxTB_HORZ_LAYOUT', 'wxTB_HORZ_TEXT']
|
||||
|
||||
class xxxWizard(xxxContainer):
|
||||
allParams = ['title', 'bitmap', 'pos']
|
||||
required = ['title']
|
||||
default = {'title': ''}
|
||||
winStyles = []
|
||||
exStyles = ['wxWIZARD_EX_HELPBUTTON']
|
||||
|
||||
class xxxWizardPage(xxxContainer):
|
||||
allParams = ['bitmap']
|
||||
winStyles = []
|
||||
exStyles = []
|
||||
|
||||
class xxxWizardPageSimple(xxxContainer):
|
||||
allParams = ['bitmap']
|
||||
winStyles = []
|
||||
exStyles = []
|
||||
|
||||
################################################################################
|
||||
# Bitmap, Icon
|
||||
|
||||
class xxxBitmap(xxxObject):
|
||||
allParams = ['bitmap']
|
||||
required = ['bitmap']
|
||||
|
||||
# Just like bitmap
|
||||
class xxxIcon(xxxObject):
|
||||
allParams = []
|
||||
|
||||
################################################################################
|
||||
# Controls
|
||||
|
||||
class xxxStaticText(xxxObject):
|
||||
allParams = ['label', 'pos', 'size', 'style']
|
||||
required = ['label']
|
||||
default = {'label': ''}
|
||||
winStyles = ['wxALIGN_LEFT', 'wxALIGN_RIGHT', 'wxALIGN_CENTRE', 'wxST_NO_AUTORESIZE']
|
||||
|
||||
class xxxStaticLine(xxxObject):
|
||||
allParams = ['pos', 'size', 'style']
|
||||
winStyles = ['wxLI_HORIZONTAL', 'wxLI_VERTICAL']
|
||||
|
||||
class xxxStaticBitmap(xxxObject):
|
||||
allParams = ['bitmap', 'pos', 'size', 'style']
|
||||
required = ['bitmap']
|
||||
|
||||
class xxxTextCtrl(xxxObject):
|
||||
allParams = ['value', 'pos', 'size', 'style']
|
||||
winStyles = ['wxTE_PROCESS_ENTER', 'wxTE_PROCESS_TAB', 'wxTE_MULTILINE',
|
||||
'wxTE_PASSWORD', 'wxTE_READONLY', 'wxHSCROLL']
|
||||
paramDict = {'value': ParamMultilineText}
|
||||
|
||||
class xxxChoice(xxxObject):
|
||||
allParams = ['content', 'selection', 'pos', 'size', 'style']
|
||||
required = ['content']
|
||||
default = {'content': '[]'}
|
||||
winStyles = ['wxCB_SORT']
|
||||
|
||||
class xxxSlider(xxxObject):
|
||||
allParams = ['value', 'min', 'max', 'pos', 'size', 'style',
|
||||
'tickfreq', 'pagesize', 'linesize', 'thumb', 'tick',
|
||||
'selmin', 'selmax']
|
||||
paramDict = {'value': ParamInt, 'tickfreq': ParamInt, 'pagesize': ParamInt,
|
||||
'linesize': ParamInt, 'thumb': ParamInt, 'thumb': ParamInt,
|
||||
'tick': ParamInt, 'selmin': ParamInt, 'selmax': ParamInt}
|
||||
required = ['value', 'min', 'max']
|
||||
winStyles = ['wxSL_HORIZONTAL', 'wxSL_VERTICAL', 'wxSL_AUTOTICKS', 'wxSL_LABELS',
|
||||
'wxSL_LEFT', 'wxSL_RIGHT', 'wxSL_TOP', 'wxSL_BOTTOM',
|
||||
'wxSL_BOTH', 'wxSL_SELRANGE', 'wxSL_INVERSE']
|
||||
|
||||
class xxxGauge(xxxObject):
|
||||
allParams = ['range', 'pos', 'size', 'style', 'value', 'shadow', 'bezel']
|
||||
paramDict = {'range': ParamInt, 'value': ParamInt,
|
||||
'shadow': ParamInt, 'bezel': ParamInt}
|
||||
winStyles = ['wxGA_HORIZONTAL', 'wxGA_VERTICAL', 'wxGA_PROGRESSBAR', 'wxGA_SMOOTH']
|
||||
|
||||
class xxxScrollBar(xxxObject):
|
||||
allParams = ['pos', 'size', 'style', 'value', 'thumbsize', 'range', 'pagesize']
|
||||
paramDict = {'value': ParamInt, 'range': ParamInt, 'thumbsize': ParamInt,
|
||||
'pagesize': ParamInt}
|
||||
winStyles = ['wxSB_HORIZONTAL', 'wxSB_VERTICAL']
|
||||
|
||||
class xxxListCtrl(xxxObject):
|
||||
allParams = ['pos', 'size', 'style']
|
||||
winStyles = ['wxLC_LIST', 'wxLC_REPORT', 'wxLC_ICON', 'wxLC_SMALL_ICON',
|
||||
'wxLC_ALIGN_TOP', 'wxLC_ALIGN_LEFT', 'wxLC_AUTOARRANGE',
|
||||
'wxLC_USER_TEXT', 'wxLC_EDIT_LABELS', 'wxLC_NO_HEADER',
|
||||
'wxLC_SINGLE_SEL', 'wxLC_SORT_ASCENDING', 'wxLC_SORT_DESCENDING']
|
||||
|
||||
class xxxTreeCtrl(xxxObject):
|
||||
allParams = ['pos', 'size', 'style']
|
||||
winStyles = ['wxTR_HAS_BUTTONS', 'wxTR_NO_LINES', 'wxTR_LINES_AT_ROOT',
|
||||
'wxTR_EDIT_LABELS', 'wxTR_MULTIPLE']
|
||||
|
||||
class xxxHtmlWindow(xxxObject):
|
||||
allParams = ['pos', 'size', 'style', 'borders', 'url', 'htmlcode']
|
||||
paramDict = {'borders': ParamInt, 'htmlcode':ParamMultilineText}
|
||||
winStyles = ['wxHW_SCROLLBAR_NEVER', 'wxHW_SCROLLBAR_AUTO']
|
||||
|
||||
class xxxCalendarCtrl(xxxObject):
|
||||
allParams = ['pos', 'size', 'style']
|
||||
|
||||
class xxxNotebook(xxxContainer):
|
||||
allParams = ['usenotebooksizer', 'pos', 'size', 'style']
|
||||
paramDict = {'usenotebooksizer': ParamBool}
|
||||
winStyles = ['wxNB_FIXEDWIDTH', 'wxNB_LEFT', 'wxNB_RIGHT', 'wxNB_BOTTOM']
|
||||
|
||||
class xxxSplitterWindow(xxxContainer):
|
||||
allParams = ['orientation', 'sashpos', 'minsize', 'pos', 'size', 'style']
|
||||
paramDict = {'orientation': ParamOrientation, 'sashpos': ParamUnit, 'minsize': ParamUnit }
|
||||
winStyles = ['wxSP_3D', 'wxSP_3DSASH', 'wxSP_3DBORDER', 'wxSP_BORDER',
|
||||
'wxSP_NOBORDER', 'wxSP_PERMIT_UNSPLIT', 'wxSP_LIVE_UPDATE',
|
||||
'wxSP_NO_XP_THEME' ]
|
||||
|
||||
class xxxGenericDirCtrl(xxxObject):
|
||||
allParams = ['defaultfolder', 'filter', 'defaultfilter', 'pos', 'size', 'style']
|
||||
paramDict = {'defaultfilter': ParamInt}
|
||||
winStyles = ['wxDIRCTRL_DIR_ONLY', 'wxDIRCTRL_3D_INTERNAL', 'wxDIRCTRL_SELECT_FIRST',
|
||||
'wxDIRCTRL_SHOW_FILTERS', 'wxDIRCTRL_EDIT_LABELS']
|
||||
|
||||
class xxxScrolledWindow(xxxContainer):
|
||||
allParams = ['pos', 'size', 'style']
|
||||
winStyles = ['wxHSCROLL', 'wxVSCROLL']
|
||||
|
||||
################################################################################
|
||||
# Buttons
|
||||
|
||||
class xxxButton(xxxObject):
|
||||
allParams = ['label', 'default', 'pos', 'size', 'style']
|
||||
paramDict = {'default': ParamBool}
|
||||
required = ['label']
|
||||
winStyles = ['wxBU_LEFT', 'wxBU_TOP', 'wxBU_RIGHT', 'wxBU_BOTTOM']
|
||||
|
||||
class xxxBitmapButton(xxxObject):
|
||||
allParams = ['bitmap', 'selected', 'focus', 'disabled', 'default',
|
||||
'pos', 'size', 'style']
|
||||
required = ['bitmap']
|
||||
winStyles = ['wxBU_AUTODRAW', 'wxBU_LEFT', 'wxBU_TOP',
|
||||
'wxBU_RIGHT', 'wxBU_BOTTOM']
|
||||
|
||||
class xxxRadioButton(xxxObject):
|
||||
allParams = ['label', 'value', 'pos', 'size', 'style']
|
||||
paramDict = {'value': ParamBool}
|
||||
required = ['label']
|
||||
winStyles = ['wxRB_GROUP']
|
||||
|
||||
class xxxSpinButton(xxxObject):
|
||||
allParams = ['value', 'min', 'max', 'pos', 'size', 'style']
|
||||
paramDict = {'value': ParamInt}
|
||||
winStyles = ['wxSP_HORIZONTAL', 'wxSP_VERTICAL', 'wxSP_ARROW_KEYS', 'wxSP_WRAP']
|
||||
|
||||
class xxxSpinCtrl(xxxObject):
|
||||
allParams = ['value', 'min', 'max', 'pos', 'size', 'style']
|
||||
paramDict = {'value': ParamInt}
|
||||
winStyles = ['wxSP_HORIZONTAL', 'wxSP_VERTICAL', 'wxSP_ARROW_KEYS', 'wxSP_WRAP']
|
||||
|
||||
class xxxToggleButton(xxxObject):
|
||||
allParams = ['label', 'checked', 'pos', 'size', 'style']
|
||||
paramDict = {'checked': ParamBool}
|
||||
required = ['label']
|
||||
|
||||
################################################################################
|
||||
# Boxes
|
||||
|
||||
class xxxStaticBox(xxxObject):
|
||||
allParams = ['label', 'pos', 'size', 'style']
|
||||
required = ['label']
|
||||
|
||||
class xxxRadioBox(xxxObject):
|
||||
allParams = ['label', 'content', 'selection', 'dimension', 'pos', 'size', 'style']
|
||||
paramDict = {'dimension': ParamInt}
|
||||
required = ['label', 'content']
|
||||
default = {'content': '[]'}
|
||||
winStyles = ['wxRA_SPECIFY_ROWS', 'wxRA_SPECIFY_COLS']
|
||||
|
||||
class xxxCheckBox(xxxObject):
|
||||
allParams = ['label', 'checked', 'pos', 'size', 'style']
|
||||
paramDict = {'checked': ParamBool}
|
||||
winStyles = ['wxCHK_2STATE', 'wxCHK_3STATE', 'wxCHK_ALLOW_3RD_STATE_FOR_USER',
|
||||
'wxALIGN_RIGHT']
|
||||
required = ['label']
|
||||
|
||||
class xxxComboBox(xxxObject):
|
||||
allParams = ['content', 'selection', 'value', 'pos', 'size', 'style']
|
||||
required = ['content']
|
||||
default = {'content': '[]'}
|
||||
winStyles = ['wxCB_SIMPLE', 'wxCB_SORT', 'wxCB_READONLY', 'wxCB_DROPDOWN']
|
||||
|
||||
class xxxListBox(xxxObject):
|
||||
allParams = ['content', 'selection', 'pos', 'size', 'style']
|
||||
required = ['content']
|
||||
default = {'content': '[]'}
|
||||
winStyles = ['wxLB_SINGLE', 'wxLB_MULTIPLE', 'wxLB_EXTENDED', 'wxLB_HSCROLL',
|
||||
'wxLB_ALWAYS_SB', 'wxLB_NEEDED_SB', 'wxLB_SORT']
|
||||
|
||||
class xxxCheckList(xxxObject):
|
||||
allParams = ['content', 'pos', 'size', 'style']
|
||||
required = ['content']
|
||||
default = {'content': '[]'}
|
||||
winStyles = ['wxLC_LIST', 'wxLC_REPORT', 'wxLC_ICON', 'wxLC_SMALL_ICON',
|
||||
'wxLC_ALIGN_TOP', 'wxLC_ALIGN_LEFT', 'wxLC_AUTOARRANGE',
|
||||
'wxLC_USER_TEXT', 'wxLC_EDIT_LABELS', 'wxLC_NO_HEADER',
|
||||
'wxLC_SINGLE_SEL', 'wxLC_SORT_ASCENDING', 'wxLC_SORT_DESCENDING']
|
||||
paramDict = {'content': ParamContentCheckList}
|
||||
|
||||
################################################################################
|
||||
# Sizers
|
||||
|
||||
class xxxSizer(xxxContainer):
|
||||
hasName = hasStyle = False
|
||||
paramDict = {'orient': ParamOrient}
|
||||
isSizer = True
|
||||
itemTag = 'sizeritem' # different for some sizers
|
||||
|
||||
class xxxBoxSizer(xxxSizer):
|
||||
allParams = ['orient']
|
||||
required = ['orient']
|
||||
default = {'orient': 'wxVERTICAL'}
|
||||
# Tree icon depends on orientation
|
||||
def treeImage(self):
|
||||
if self.params['orient'].value() == 'wxHORIZONTAL': return self.imageH
|
||||
else: return self.imageV
|
||||
|
||||
class xxxStaticBoxSizer(xxxBoxSizer):
|
||||
allParams = ['label', 'orient']
|
||||
required = ['label', 'orient']
|
||||
|
||||
class xxxGridSizer(xxxSizer):
|
||||
allParams = ['cols', 'rows', 'vgap', 'hgap']
|
||||
required = ['cols']
|
||||
default = {'cols': '2', 'rows': '2'}
|
||||
|
||||
class xxxStdDialogButtonSizer(xxxSizer):
|
||||
allParams = []
|
||||
itemTag = 'button'
|
||||
|
||||
# For repeated parameters
|
||||
class xxxParamMulti:
|
||||
def __init__(self, node):
|
||||
self.node = node
|
||||
self.l, self.data = [], []
|
||||
def append(self, param):
|
||||
self.l.append(param)
|
||||
self.data.append(param.value())
|
||||
def value(self):
|
||||
return self.data
|
||||
def remove(self):
|
||||
for param in self.l:
|
||||
param.remove()
|
||||
self.l, self.data = [], []
|
||||
|
||||
class xxxFlexGridSizer(xxxGridSizer):
|
||||
specials = ['growablecols', 'growablerows']
|
||||
allParams = ['cols', 'rows', 'vgap', 'hgap'] + specials
|
||||
paramDict = {'growablecols':ParamIntList, 'growablerows':ParamIntList}
|
||||
# Special processing for growable* parameters
|
||||
# (they are represented by several nodes)
|
||||
def special(self, tag, node):
|
||||
if not self.params.has_key(tag):
|
||||
# Create new multi-group
|
||||
self.params[tag] = xxxParamMulti(node)
|
||||
self.params[tag].append(xxxParamInt(node))
|
||||
def setSpecial(self, param, value):
|
||||
# Straightforward implementation: remove, add again
|
||||
self.params[param].remove()
|
||||
del self.params[param]
|
||||
for i in value:
|
||||
node = g.tree.dom.createElement(param)
|
||||
text = g.tree.dom.createTextNode(str(i))
|
||||
node.appendChild(text)
|
||||
self.element.appendChild(node)
|
||||
self.special(param, node)
|
||||
|
||||
class xxxGridBagSizer(xxxSizer):
|
||||
specials = ['growablecols', 'growablerows']
|
||||
allParams = ['vgap', 'hgap'] + specials
|
||||
paramDict = {'growablecols':ParamIntList, 'growablerows':ParamIntList}
|
||||
# Special processing for growable* parameters
|
||||
# (they are represented by several nodes)
|
||||
def special(self, tag, node):
|
||||
if not self.params.has_key(tag):
|
||||
# Create new multi-group
|
||||
self.params[tag] = xxxParamMulti(node)
|
||||
self.params[tag].append(xxxParamInt(node))
|
||||
def setSpecial(self, param, value):
|
||||
# Straightforward implementation: remove, add again
|
||||
self.params[param].remove()
|
||||
del self.params[param]
|
||||
for i in value:
|
||||
node = g.tree.dom.createElement(param)
|
||||
text = g.tree.dom.createTextNode(str(i))
|
||||
node.appendChild(text)
|
||||
self.element.appendChild(node)
|
||||
self.special(param, node)
|
||||
|
||||
# Container with only one child.
|
||||
# Not shown in tree.
|
||||
class xxxChildContainer(xxxObject):
|
||||
hasName = hasStyle = False
|
||||
hasChild = True
|
||||
def __init__(self, parent, element):
|
||||
xxxObject.__init__(self, parent, element)
|
||||
# Must have one child with 'object' tag, but we don't check it
|
||||
nodes = element.childNodes[:] # create copy
|
||||
for node in nodes:
|
||||
if node.nodeType == minidom.Node.ELEMENT_NODE:
|
||||
if node.tagName == 'object':
|
||||
# Create new xxx object for child node
|
||||
self.child = MakeXXXFromDOM(self, node)
|
||||
self.child.parent = parent
|
||||
# Copy hasChildren and isSizer attributes
|
||||
self.hasChildren = self.child.hasChildren
|
||||
self.isSizer = self.child.isSizer
|
||||
return # success
|
||||
else:
|
||||
element.removeChild(node)
|
||||
node.unlink()
|
||||
assert 0, 'no child found'
|
||||
|
||||
class xxxSizerItem(xxxChildContainer):
|
||||
allParams = ['option', 'flag', 'border', 'minsize', 'ratio']
|
||||
paramDict = {'option': ParamInt, 'minsize': ParamPosSize, 'ratio': ParamPosSize}
|
||||
#default = {'cellspan': '1,1'}
|
||||
def __init__(self, parent, element):
|
||||
# For GridBag sizer items, extra parameters added
|
||||
if isinstance(parent, xxxGridBagSizer):
|
||||
self.allParams = self.allParams + ['cellpos', 'cellspan']
|
||||
xxxChildContainer.__init__(self, parent, element)
|
||||
# Remove pos parameter - not needed for sizeritems
|
||||
if 'pos' in self.child.allParams:
|
||||
self.child.allParams = self.child.allParams[:]
|
||||
self.child.allParams.remove('pos')
|
||||
|
||||
class xxxSizerItemButton(xxxSizerItem):
|
||||
allParams = []
|
||||
paramDict = {}
|
||||
def __init__(self, parent, element):
|
||||
xxxChildContainer.__init__(self, parent, element)
|
||||
# Remove pos parameter - not needed for sizeritems
|
||||
if 'pos' in self.child.allParams:
|
||||
self.child.allParams = self.child.allParams[:]
|
||||
self.child.allParams.remove('pos')
|
||||
|
||||
class xxxNotebookPage(xxxChildContainer):
|
||||
allParams = ['label', 'selected']
|
||||
paramDict = {'selected': ParamBool}
|
||||
required = ['label']
|
||||
def __init__(self, parent, element):
|
||||
xxxChildContainer.__init__(self, parent, element)
|
||||
# pos and size dont matter for notebookpages
|
||||
if 'pos' in self.child.allParams:
|
||||
self.child.allParams = self.child.allParams[:]
|
||||
self.child.allParams.remove('pos')
|
||||
if 'size' in self.child.allParams:
|
||||
self.child.allParams = self.child.allParams[:]
|
||||
self.child.allParams.remove('size')
|
||||
|
||||
class xxxSpacer(xxxObject):
|
||||
hasName = hasStyle = False
|
||||
allParams = ['size', 'option', 'flag', 'border']
|
||||
paramDict = {'option': ParamInt}
|
||||
default = {'size': '0,0'}
|
||||
|
||||
class xxxMenuBar(xxxContainer):
|
||||
allParams = ['style']
|
||||
paramDict = {'style': ParamNonGenericStyle} # no generic styles
|
||||
winStyles = ['wxMB_DOCKABLE']
|
||||
|
||||
class xxxMenu(xxxContainer):
|
||||
allParams = ['label', 'help', 'style']
|
||||
default = {'label': ''}
|
||||
paramDict = {'style': ParamNonGenericStyle} # no generic styles
|
||||
winStyles = ['wxMENU_TEAROFF']
|
||||
|
||||
class xxxMenuItem(xxxObject):
|
||||
allParams = ['label', 'bitmap', 'accel', 'help',
|
||||
'checkable', 'radio', 'enabled', 'checked']
|
||||
default = {'label': ''}
|
||||
hasStyle = False
|
||||
|
||||
class xxxSeparator(xxxObject):
|
||||
hasName = hasStyle = False
|
||||
|
||||
################################################################################
|
||||
# Unknown control
|
||||
|
||||
class xxxUnknown(xxxObject):
|
||||
allParams = ['pos', 'size', 'style']
|
||||
paramDict = {'style': ParamNonGenericStyle} # no generic styles
|
||||
|
||||
################################################################################
|
||||
|
||||
xxxDict = {
|
||||
'wxPanel': xxxPanel,
|
||||
'wxDialog': xxxDialog,
|
||||
'wxFrame': xxxFrame,
|
||||
'tool': xxxTool,
|
||||
'wxToolBar': xxxToolBar,
|
||||
'wxWizard': xxxWizard,
|
||||
'wxWizardPage': xxxWizardPage,
|
||||
'wxWizardPageSimple': xxxWizardPageSimple,
|
||||
|
||||
'wxBitmap': xxxBitmap,
|
||||
'wxIcon': xxxIcon,
|
||||
|
||||
'wxButton': xxxButton,
|
||||
'wxBitmapButton': xxxBitmapButton,
|
||||
'wxRadioButton': xxxRadioButton,
|
||||
'wxSpinButton': xxxSpinButton,
|
||||
'wxToggleButton' : xxxToggleButton,
|
||||
|
||||
'wxStaticBox': xxxStaticBox,
|
||||
'wxStaticBitmap': xxxStaticBitmap,
|
||||
'wxRadioBox': xxxRadioBox,
|
||||
'wxComboBox': xxxComboBox,
|
||||
'wxCheckBox': xxxCheckBox,
|
||||
'wxListBox': xxxListBox,
|
||||
|
||||
'wxStaticText': xxxStaticText,
|
||||
'wxStaticLine': xxxStaticLine,
|
||||
'wxTextCtrl': xxxTextCtrl,
|
||||
'wxChoice': xxxChoice,
|
||||
'wxSlider': xxxSlider,
|
||||
'wxGauge': xxxGauge,
|
||||
'wxScrollBar': xxxScrollBar,
|
||||
'wxTreeCtrl': xxxTreeCtrl,
|
||||
'wxListCtrl': xxxListCtrl,
|
||||
'wxCheckListBox': xxxCheckList,
|
||||
'wxNotebook': xxxNotebook,
|
||||
'wxSplitterWindow': xxxSplitterWindow,
|
||||
'notebookpage': xxxNotebookPage,
|
||||
'wxHtmlWindow': xxxHtmlWindow,
|
||||
'wxCalendarCtrl': xxxCalendarCtrl,
|
||||
'wxGenericDirCtrl': xxxGenericDirCtrl,
|
||||
'wxSpinCtrl': xxxSpinCtrl,
|
||||
'wxScrolledWindow': xxxScrolledWindow,
|
||||
|
||||
'wxBoxSizer': xxxBoxSizer,
|
||||
'wxStaticBoxSizer': xxxStaticBoxSizer,
|
||||
'wxGridSizer': xxxGridSizer,
|
||||
'wxFlexGridSizer': xxxFlexGridSizer,
|
||||
'wxGridBagSizer': xxxGridBagSizer,
|
||||
'wxStdDialogButtonSizer': xxxStdDialogButtonSizer,
|
||||
'sizeritem': xxxSizerItem, 'button': xxxSizerItemButton,
|
||||
'spacer': xxxSpacer,
|
||||
|
||||
'wxMenuBar': xxxMenuBar,
|
||||
'wxMenu': xxxMenu,
|
||||
'wxMenuItem': xxxMenuItem,
|
||||
'separator': xxxSeparator,
|
||||
|
||||
'unknown': xxxUnknown,
|
||||
}
|
||||
|
||||
# Create IDs for all parameters of all classes
|
||||
paramIDs = {'fg': wxNewId(), 'bg': wxNewId(), 'exstyle': wxNewId(), 'font': wxNewId(),
|
||||
'enabled': wxNewId(), 'focused': wxNewId(), 'hidden': wxNewId(),
|
||||
'tooltip': wxNewId(), 'encoding': wxNewId(),
|
||||
'cellpos': wxNewId(), 'cellspan': wxNewId()
|
||||
}
|
||||
for cl in xxxDict.values():
|
||||
if cl.allParams:
|
||||
for param in cl.allParams + cl.paramDict.keys():
|
||||
if not paramIDs.has_key(param):
|
||||
paramIDs[param] = wxNewId()
|
||||
|
||||
################################################################################
|
||||
# Helper functions
|
||||
|
||||
# Test for object elements
|
||||
def IsObject(node):
|
||||
return node.nodeType == minidom.Node.ELEMENT_NODE and node.tagName == 'object'
|
||||
|
||||
# Make XXX object from some DOM object, selecting correct class
|
||||
def MakeXXXFromDOM(parent, element):
|
||||
try:
|
||||
klass = xxxDict[element.getAttribute('class')]
|
||||
except KeyError:
|
||||
# If we encounter a weird class, use unknown template
|
||||
print 'WARNING: unsupported class:', element.getAttribute('class')
|
||||
klass = xxxUnknown
|
||||
return klass(parent, element)
|
||||
|
||||
# Make empty DOM element
|
||||
def MakeEmptyDOM(className):
|
||||
elem = g.tree.dom.createElement('object')
|
||||
elem.setAttribute('class', className)
|
||||
# Set required and default parameters
|
||||
xxxClass = xxxDict[className]
|
||||
defaultNotRequired = filter(lambda x, l=xxxClass.required: x not in l,
|
||||
xxxClass.default.keys())
|
||||
for param in xxxClass.required + defaultNotRequired:
|
||||
textElem = g.tree.dom.createElement(param)
|
||||
try:
|
||||
textNode = g.tree.dom.createTextNode(xxxClass.default[param])
|
||||
except KeyError:
|
||||
textNode = g.tree.dom.createTextNode('')
|
||||
textElem.appendChild(textNode)
|
||||
elem.appendChild(textElem)
|
||||
return elem
|
||||
|
||||
# Make empty XXX object
|
||||
def MakeEmptyXXX(parent, className):
|
||||
# Make corresponding DOM object first
|
||||
elem = MakeEmptyDOM(className)
|
||||
# If parent is a sizer, we should create sizeritem object, except for spacers
|
||||
if parent:
|
||||
if parent.isSizer and className != 'spacer':
|
||||
sizerItemElem = MakeEmptyDOM(parent.itemTag)
|
||||
sizerItemElem.appendChild(elem)
|
||||
elem = sizerItemElem
|
||||
elif isinstance(parent, xxxNotebook):
|
||||
pageElem = MakeEmptyDOM('notebookpage')
|
||||
pageElem.appendChild(elem)
|
||||
elem = pageElem
|
||||
# Now just make object
|
||||
return MakeXXXFromDOM(parent, elem)
|
||||
|