Compare commits
1455 Commits
widget-cla
...
matthiasc/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f6ea7c418 | ||
|
|
ba8f39a90a | ||
|
|
6d17e74d0e | ||
|
|
9ab78cd215 | ||
|
|
8ae8fe9e4c | ||
|
|
d63a729ab1 | ||
|
|
444323244c | ||
|
|
ce44bd7fa4 | ||
|
|
3568a591f1 | ||
|
|
1577db0092 | ||
|
|
ea7ab799ad | ||
|
|
6535af8424 | ||
|
|
7821cb1417 | ||
|
|
8c50312abf | ||
|
|
723010ed09 | ||
|
|
f0affa8886 | ||
|
|
8b3304820e | ||
|
|
5592af40ad | ||
|
|
d3268b3af0 | ||
|
|
c5e1c97ca4 | ||
|
|
7d99339c39 | ||
|
|
1e2c03beee | ||
|
|
b24e10fa30 | ||
|
|
173952cbc8 | ||
|
|
b31f4f2bae | ||
|
|
df9d9c1f8a | ||
|
|
7dcb25bd46 | ||
|
|
d131c8d0e7 | ||
|
|
0582a4ef1b | ||
|
|
a9b1d4a389 | ||
|
|
ea810f176b | ||
|
|
262ac4247a | ||
|
|
8e4f0b9484 | ||
|
|
7669e6e42e | ||
|
|
a3f14a3395 | ||
|
|
73b8212bf3 | ||
|
|
6ba6f361be | ||
|
|
726909d735 | ||
|
|
04899e3707 | ||
|
|
7a27122dab | ||
|
|
73ce437459 | ||
|
|
ca4ae81170 | ||
|
|
21a7dfae96 | ||
|
|
6c188f7c93 | ||
|
|
c30e0f78ad | ||
|
|
76795ffba9 | ||
|
|
c38c5c4ce1 | ||
|
|
108aac9ee3 | ||
|
|
c427c2b22a | ||
|
|
59111d100f | ||
|
|
cee8f78c6e | ||
|
|
0fc35b2124 | ||
|
|
eebe67cf0a | ||
|
|
b9726901a5 | ||
|
|
df1d2b8417 | ||
|
|
8b1af398a0 | ||
|
|
982d73df0b | ||
|
|
1e55e01692 | ||
|
|
412fcb0330 | ||
|
|
b8d1c3ab55 | ||
|
|
4fb519f04d | ||
|
|
054d69aaf9 | ||
|
|
1dea6d4fc7 | ||
|
|
022d19a4c6 | ||
|
|
ef7276c398 | ||
|
|
0a8ca49b5e | ||
|
|
74f18f71d3 | ||
|
|
c0d4a6fc81 | ||
|
|
1dd31d58fb | ||
|
|
766d4dff76 | ||
|
|
e62f135c6a | ||
|
|
4788f88840 | ||
|
|
587bc82c37 | ||
|
|
750dc8dbe2 | ||
|
|
d490d8f1f3 | ||
|
|
cb2f523994 | ||
|
|
075a0ccb5e | ||
|
|
db91b6dc61 | ||
|
|
44ac2d5abb | ||
|
|
d7df56b6cb | ||
|
|
6a9bc5daef | ||
|
|
b8aa51d522 | ||
|
|
f79c807645 | ||
|
|
d0d2ad9f5b | ||
|
|
0b8298038a | ||
|
|
6ef0bb8bea | ||
|
|
91472b2ecd | ||
|
|
80ddcf38d4 | ||
|
|
1477882b31 | ||
|
|
73f2167fe4 | ||
|
|
2079c898e7 | ||
|
|
c79c18f39c | ||
|
|
cef7f7f87d | ||
|
|
fdce30d3f8 | ||
|
|
f07397f4dd | ||
|
|
f1751f514c | ||
|
|
2cbfb0e980 | ||
|
|
8dd7f5aefe | ||
|
|
398f49ad31 | ||
|
|
3d260a950e | ||
|
|
f31667f437 | ||
|
|
219493c818 | ||
|
|
06f63764fb | ||
|
|
1243174e53 | ||
|
|
cc909b160f | ||
|
|
d12dde07c3 | ||
|
|
5191b6fccd | ||
|
|
2e6e6c1779 | ||
|
|
a29b8fbef4 | ||
|
|
5b072e716c | ||
|
|
49845795d9 | ||
|
|
ab04c74ec9 | ||
|
|
4744bb9099 | ||
|
|
91522dda63 | ||
|
|
095a378dbc | ||
|
|
0956c30ee5 | ||
|
|
f85448ffbf | ||
|
|
d3852ca33a | ||
|
|
9d9a730659 | ||
|
|
3f4cd4190f | ||
|
|
448a402353 | ||
|
|
2ee9752822 | ||
|
|
f8a1f796b5 | ||
|
|
3b5a4cf215 | ||
|
|
759d53cfa0 | ||
|
|
814d20d61a | ||
|
|
6cef520804 | ||
|
|
8c77491150 | ||
|
|
709ebcedd4 | ||
|
|
47e6b88555 | ||
|
|
df58d0acf3 | ||
|
|
9c2c5665df | ||
|
|
1be9c6aa3f | ||
|
|
96d2bf10b9 | ||
|
|
7a1aefc7f3 | ||
|
|
f7f06f810b | ||
|
|
e02fd80adb | ||
|
|
4b818495ca | ||
|
|
1841ec4f8e | ||
|
|
21708e4352 | ||
|
|
662bcb34b1 | ||
|
|
f8a19506ab | ||
|
|
67d1d5ec80 | ||
|
|
49c6e99970 | ||
|
|
15242d66e1 | ||
|
|
94a0bc01f9 | ||
|
|
677c4b140c | ||
|
|
838ad5ed6d | ||
|
|
772ac2b0c5 | ||
|
|
68b3b66c03 | ||
|
|
0d1614be63 | ||
|
|
62b95e33b8 | ||
|
|
dc5c8d2d29 | ||
|
|
425d5cc7c6 | ||
|
|
baf99bb868 | ||
|
|
538efd0cc6 | ||
|
|
9ba184adf7 | ||
|
|
710b8d7f40 | ||
|
|
a6244a95be | ||
|
|
133b6f2f23 | ||
|
|
53a634e23e | ||
|
|
156935e0e9 | ||
|
|
f31a016efb | ||
|
|
e56eb7b17b | ||
|
|
de694958b5 | ||
|
|
e12a580b0b | ||
|
|
52e0eef6cb | ||
|
|
85bf4cf895 | ||
|
|
b06331218d | ||
|
|
9b165c8bec | ||
|
|
3fd427cfce | ||
|
|
0bb9fc65ad | ||
|
|
3dd6cc405e | ||
|
|
06860bb2be | ||
|
|
7ee5779efc | ||
|
|
53d9445715 | ||
|
|
54b2727b50 | ||
|
|
a2aefa83bb | ||
|
|
0854140b22 | ||
|
|
57a861723c | ||
|
|
b59521bb82 | ||
|
|
7e8393ba0f | ||
|
|
9e15f3df75 | ||
|
|
5c97f09796 | ||
|
|
bf4ec504b2 | ||
|
|
59aeae3c8e | ||
|
|
941f22c033 | ||
|
|
27543120f2 | ||
|
|
901518ec25 | ||
|
|
4c9b0d82af | ||
|
|
2c5f4c5871 | ||
|
|
8ee44d200d | ||
|
|
57b7e87d76 | ||
|
|
e424246134 | ||
|
|
ca87048045 | ||
|
|
5ec9b15d84 | ||
|
|
6b691bc02d | ||
|
|
abcd83dd78 | ||
|
|
5d2113ff5d | ||
|
|
5c086b9d44 | ||
|
|
8efa612288 | ||
|
|
928f7faf7d | ||
|
|
4b4cf36b03 | ||
|
|
5d821425b3 | ||
|
|
8b3066127f | ||
|
|
360239a6c8 | ||
|
|
80e903afeb | ||
|
|
62e9ea412a | ||
|
|
3d4acf6360 | ||
|
|
0cf1e1e106 | ||
|
|
b23fbe1f39 | ||
|
|
f5e79b9bc5 | ||
|
|
94e238c467 | ||
|
|
22f6787283 | ||
|
|
6255dcd8ec | ||
|
|
6f80eee962 | ||
|
|
fd0f01bcad | ||
|
|
0b6e521dc5 | ||
|
|
ad6fe9d6a0 | ||
|
|
7078765903 | ||
|
|
a73947e54f | ||
|
|
7525271de1 | ||
|
|
0bc65f0bde | ||
|
|
4a0476752c | ||
|
|
9543a5daeb | ||
|
|
28b91a4450 | ||
|
|
6b89d8a199 | ||
|
|
e999016273 | ||
|
|
7c6e620f16 | ||
|
|
267d5ae011 | ||
|
|
08d4bb4785 | ||
|
|
a02e25ffff | ||
|
|
280bdb0567 | ||
|
|
1a94e5fb0e | ||
|
|
b6cfe59460 | ||
|
|
7db2abf918 | ||
|
|
b398af914f | ||
|
|
29e1dac1ff | ||
|
|
3af8a658a7 | ||
|
|
b5aeb29146 | ||
|
|
85b702b0d1 | ||
|
|
77c57b4b14 | ||
|
|
10d260ec71 | ||
|
|
1ac8bb0128 | ||
|
|
28539ba838 | ||
|
|
f1bb6ef658 | ||
|
|
24c66f831f | ||
|
|
87502b4f2e | ||
|
|
3644d3a100 | ||
|
|
9e3147f78d | ||
|
|
cc3ecac6d8 | ||
|
|
72932d2776 | ||
|
|
58bc9452f6 | ||
|
|
2a7b5d8229 | ||
|
|
245546de61 | ||
|
|
a3793ff137 | ||
|
|
0a98817a6f | ||
|
|
663fb93af7 | ||
|
|
db42c23c0a | ||
|
|
33716d1e50 | ||
|
|
65769fd7a6 | ||
|
|
e6d3f3d91e | ||
|
|
79a17d5a25 | ||
|
|
c924b48a6c | ||
|
|
519ff576cd | ||
|
|
5bc3bed461 | ||
|
|
442f13ef6f | ||
|
|
95aeadf36c | ||
|
|
267ea7552b | ||
|
|
08f7526f8f | ||
|
|
0604924c20 | ||
|
|
5ef2748cef | ||
|
|
8f8229dcd2 | ||
|
|
a5b5657e96 | ||
|
|
0f2281e267 | ||
|
|
994a807819 | ||
|
|
79f42cec8e | ||
|
|
0546fd7c8a | ||
|
|
d51e3e835e | ||
|
|
3d8d4921af | ||
|
|
ba3549fa34 | ||
|
|
721595edea | ||
|
|
46d960ddfd | ||
|
|
ed24f93fb9 | ||
|
|
c4043a8eef | ||
|
|
dff86c0e12 | ||
|
|
9a5ec33d61 | ||
|
|
78227bf5b0 | ||
|
|
bf2c29a36a | ||
|
|
47285c6642 | ||
|
|
e4fb4116fd | ||
|
|
6d3373cb2c | ||
|
|
6ddc214e68 | ||
|
|
91a802a1e5 | ||
|
|
886ab54eda | ||
|
|
4470e5bc93 | ||
|
|
9bbacd3e4c | ||
|
|
353df67c0b | ||
|
|
050eb9ba73 | ||
|
|
4fa5f5497a | ||
|
|
21a032b783 | ||
|
|
207efd8932 | ||
|
|
43c943e48a | ||
|
|
d6dc5da6db | ||
|
|
12d787286e | ||
|
|
c33a7670d0 | ||
|
|
bbb56d8216 | ||
|
|
a20c8af678 | ||
|
|
0eb2b382a2 | ||
|
|
101298c54d | ||
|
|
f6bdfc32d3 | ||
|
|
5015730212 | ||
|
|
f8a7f30a0d | ||
|
|
1f94028ff7 | ||
|
|
512c4c13a6 | ||
|
|
552db7cb08 | ||
|
|
d564cb2a7e | ||
|
|
a6e3fc2d2f | ||
|
|
e54049bc26 | ||
|
|
e331b39ca5 | ||
|
|
e6270ca43f | ||
|
|
88da95d921 | ||
|
|
44f9c67466 | ||
|
|
02bbe399df | ||
|
|
41bb40feee | ||
|
|
336d652be5 | ||
|
|
d3e8678955 | ||
|
|
503d988c1b | ||
|
|
7a46378e71 | ||
|
|
9f6d12551f | ||
|
|
43c93d6f85 | ||
|
|
d683d085c0 | ||
|
|
92ab450983 | ||
|
|
7b14c65b41 | ||
|
|
c89c652401 | ||
|
|
f0f57d156b | ||
|
|
cecf4f2763 | ||
|
|
4eeed47c7b | ||
|
|
bd1f7e057a | ||
|
|
174d8b72a5 | ||
|
|
1437b0856c | ||
|
|
917181cb67 | ||
|
|
a207a4b3cd | ||
|
|
39a1d27960 | ||
|
|
5ef4a64084 | ||
|
|
baacd9efbf | ||
|
|
abde37a4d7 | ||
|
|
3ee9b0cf4b | ||
|
|
88049915a2 | ||
|
|
585397937d | ||
|
|
256b6f1aff | ||
|
|
acabdafb35 | ||
|
|
168c1f440d | ||
|
|
33a8ef4bce | ||
|
|
33bd8f322c | ||
|
|
bfe4255807 | ||
|
|
a15fb95c46 | ||
|
|
292371932b | ||
|
|
564e8f483c | ||
|
|
ba74f41a70 | ||
|
|
d6a6313493 | ||
|
|
9b5a7ae802 | ||
|
|
e4b8481dd0 | ||
|
|
d868b23c76 | ||
|
|
56b456ff21 | ||
|
|
b91913d10d | ||
|
|
ac1497eb2d | ||
|
|
1854f3f49c | ||
|
|
a75523da68 | ||
|
|
ca66e9788c | ||
|
|
83ec7d562a | ||
|
|
05e9a9b572 | ||
|
|
bc7b37d307 | ||
|
|
fb5dc73841 | ||
|
|
8d61d9f627 | ||
|
|
22b6085c32 | ||
|
|
2deb1a05a0 | ||
|
|
8ca46169b1 | ||
|
|
642ced0cfc | ||
|
|
a635076106 | ||
|
|
23d8aa40fe | ||
|
|
0933630ee5 | ||
|
|
797cecd9ae | ||
|
|
4c2707916c | ||
|
|
ab32b1bba2 | ||
|
|
619c892032 | ||
|
|
87ea0253aa | ||
|
|
e81a90c432 | ||
|
|
fe385c28f6 | ||
|
|
6c4ab7d208 | ||
|
|
dd52dd8bb0 | ||
|
|
174cdb09a7 | ||
|
|
c3ca34cf51 | ||
|
|
85950afbbd | ||
|
|
da063a8aa5 | ||
|
|
9d94627f75 | ||
|
|
5bdd25627f | ||
|
|
7bb8a480f1 | ||
|
|
be74be0e3b | ||
|
|
982890515d | ||
|
|
1817025f46 | ||
|
|
c5d24fc5cd | ||
|
|
965e37bee9 | ||
|
|
def700739d | ||
|
|
5590bcb9cc | ||
|
|
9f69c7f3e8 | ||
|
|
0df45f0de0 | ||
|
|
9c5ea8eba4 | ||
|
|
8f6de1f955 | ||
|
|
4f532224e0 | ||
|
|
1c2661ed12 | ||
|
|
91f7ac2d58 | ||
|
|
3d1a9c7484 | ||
|
|
25e4174a38 | ||
|
|
04bb5aad36 | ||
|
|
4f82a0de89 | ||
|
|
9e4901e8ce | ||
|
|
7523a3f2f2 | ||
|
|
fd1630e049 | ||
|
|
e3c3cbbbcb | ||
|
|
4fbb0d7ce4 | ||
|
|
245fdc8b38 | ||
|
|
420169d5cd | ||
|
|
b025ee428c | ||
|
|
82395a93b0 | ||
|
|
b7ff017f8d | ||
|
|
0627bba5a0 | ||
|
|
ab53731f4a | ||
|
|
094c537001 | ||
|
|
27d05102ab | ||
|
|
f5e4dc824c | ||
|
|
80acc8f296 | ||
|
|
e3860d25e9 | ||
|
|
a2634077e7 | ||
|
|
c72c0f4d43 | ||
|
|
d92cfa2179 | ||
|
|
bbdaa4a0ff | ||
|
|
5e11a2ae6a | ||
|
|
053360df85 | ||
|
|
39a48de025 | ||
|
|
600ce68210 | ||
|
|
604f44da11 | ||
|
|
581f5bd749 | ||
|
|
ecc40cf115 | ||
|
|
3d7817154c | ||
|
|
232e313823 | ||
|
|
914e2a6656 | ||
|
|
9a88d17ef2 | ||
|
|
907a86fd93 | ||
|
|
d4180931f8 | ||
|
|
dd913423d3 | ||
|
|
c296101a2f | ||
|
|
a439be5161 | ||
|
|
1ba2923616 | ||
|
|
1ec4cb7f17 | ||
|
|
b70e4f6de9 | ||
|
|
3c11c57755 | ||
|
|
1b7c6e5687 | ||
|
|
d32cd210bb | ||
|
|
e056e4ff58 | ||
|
|
ae66c07a70 | ||
|
|
3936412332 | ||
|
|
ea5eeb7c7a | ||
|
|
767df50eda | ||
|
|
baae2920dc | ||
|
|
832419b2c3 | ||
|
|
ff78adb25d | ||
|
|
e05f404fc5 | ||
|
|
d572b5d94c | ||
|
|
c2306d3ba6 | ||
|
|
edf56b438e | ||
|
|
cd3cd64769 | ||
|
|
fb0b0ddfe0 | ||
|
|
3180cdb9ef | ||
|
|
07d1ea4356 | ||
|
|
e5f1ff6a4d | ||
|
|
f8303c7a22 | ||
|
|
af6d1839e1 | ||
|
|
b4b7fe122e | ||
|
|
e36940fa8c | ||
|
|
d2e13dd3e4 | ||
|
|
13f4d639fd | ||
|
|
ad48bbb849 | ||
|
|
2497d982b0 | ||
|
|
bb9c07d8fe | ||
|
|
ace2208f45 | ||
|
|
b8c4009686 | ||
|
|
6f0ff3a8cb | ||
|
|
209e8b54e9 | ||
|
|
bfa0509f08 | ||
|
|
07d17c5bc1 | ||
|
|
e26c361d2d | ||
|
|
290e250886 | ||
|
|
22d5b9bc41 | ||
|
|
ab407ba57c | ||
|
|
07f2024bfc | ||
|
|
accbfc0083 | ||
|
|
e8d890ae0c | ||
|
|
bfc1e77b7f | ||
|
|
dba9298c14 | ||
|
|
67c0f88c00 | ||
|
|
e93408e962 | ||
|
|
6d193d7cb4 | ||
|
|
fb4fbfb2a8 | ||
|
|
7e77afe94c | ||
|
|
7587996279 | ||
|
|
15b3c0f563 | ||
|
|
5e341210a1 | ||
|
|
fbea677a5c | ||
|
|
b271db4f5b | ||
|
|
b5ed2d310e | ||
|
|
3bf9277de6 | ||
|
|
53c9eb5a5b | ||
|
|
6e5da14294 | ||
|
|
427b5d187c | ||
|
|
5d07877b35 | ||
|
|
3086715d54 | ||
|
|
44093f4966 | ||
|
|
6d16f7ad35 | ||
|
|
5f627a2cb6 | ||
|
|
34d002121d | ||
|
|
22bb1bd568 | ||
|
|
28898445ff | ||
|
|
828b58247c | ||
|
|
de29c3e193 | ||
|
|
8ccf2a722a | ||
|
|
fa8ce17e1e | ||
|
|
4a2f3130d2 | ||
|
|
eaa6301e53 | ||
|
|
41c52e955d | ||
|
|
eca7fa075e | ||
|
|
19a4e76034 | ||
|
|
6cacff9df1 | ||
|
|
2d309725c9 | ||
|
|
a5c00685c5 | ||
|
|
48cc26246f | ||
|
|
4b41dd4eb1 | ||
|
|
41beae1956 | ||
|
|
c48fe6d7ec | ||
|
|
a31a80277c | ||
|
|
745a701b3d | ||
|
|
d4c97ea2b4 | ||
|
|
03738634ac | ||
|
|
9dd8652a66 | ||
|
|
cb81a06793 | ||
|
|
4d9cc483c9 | ||
|
|
4cca27a7af | ||
|
|
553a9c292d | ||
|
|
abd4754648 | ||
|
|
e79d585b00 | ||
|
|
1f0310ddff | ||
|
|
0284d40e24 | ||
|
|
ffaf26fdf5 | ||
|
|
5b508ea94a | ||
|
|
472d8eebbe | ||
|
|
dd316c8051 | ||
|
|
1038bc781a | ||
|
|
44137574a1 | ||
|
|
6b07ce2b13 | ||
|
|
008e8076a1 | ||
|
|
2cd4b255cd | ||
|
|
11a38dd455 | ||
|
|
dfcc40ef9a | ||
|
|
1882034323 | ||
|
|
aaaa3e141b | ||
|
|
15af87345d | ||
|
|
640db05b18 | ||
|
|
31ae93475d | ||
|
|
8fc4d229da | ||
|
|
a62efb8257 | ||
|
|
acf927fe14 | ||
|
|
ca71340c6b | ||
|
|
350495cf1c | ||
|
|
426d5ca1b7 | ||
|
|
aaae141687 | ||
|
|
4826255ea3 | ||
|
|
9ba08a09cb | ||
|
|
bb2c68452c | ||
|
|
23be10cf69 | ||
|
|
17a111968b | ||
|
|
d3431f569c | ||
|
|
7a73f43de3 | ||
|
|
ba7649b388 | ||
|
|
1dd55ed600 | ||
|
|
416b2cd18d | ||
|
|
15dffb47dc | ||
|
|
20e70a78c4 | ||
|
|
e190b4536a | ||
|
|
3c219bf968 | ||
|
|
c3de5e3624 | ||
|
|
dd69bcabf7 | ||
|
|
6373ced608 | ||
|
|
2ea95a7674 | ||
|
|
dbbb7eef15 | ||
|
|
233d096261 | ||
|
|
239c178ef4 | ||
|
|
fdbb925654 | ||
|
|
aeabe3c40e | ||
|
|
222b6c2b58 | ||
|
|
5ab5ff7677 | ||
|
|
8a603ff5bd | ||
|
|
468295a9f7 | ||
|
|
6c92b824f3 | ||
|
|
77e9788517 | ||
|
|
0b1845b0cb | ||
|
|
342d88a1dc | ||
|
|
bab7f56f64 | ||
|
|
9b87cace47 | ||
|
|
c2a32afe97 | ||
|
|
d0e14f79a6 | ||
|
|
7f2ab0d576 | ||
|
|
d36d7d93e6 | ||
|
|
d777300d4e | ||
|
|
173bb2e1e8 | ||
|
|
0895f0211e | ||
|
|
be13a23722 | ||
|
|
7197743938 | ||
|
|
dd5ee87b5b | ||
|
|
e34d1b8a26 | ||
|
|
c5af463843 | ||
|
|
49748c9c23 | ||
|
|
b53fa48794 | ||
|
|
97f3371709 | ||
|
|
58d57e1087 | ||
|
|
571068af12 | ||
|
|
a00d12c62a | ||
|
|
7fc74eaeae | ||
|
|
4eb077979f | ||
|
|
9c1b1eb894 | ||
|
|
14c34a7014 | ||
|
|
427deb4f13 | ||
|
|
a1a70a1130 | ||
|
|
19304c1d2c | ||
|
|
01be7f0666 | ||
|
|
1b68e76852 | ||
|
|
9f5ee77a44 | ||
|
|
6d20fe0bf9 | ||
|
|
bb56b4ef5d | ||
|
|
5ea21f7910 | ||
|
|
acb7f437fa | ||
|
|
7bff3abe8e | ||
|
|
e46a7ca706 | ||
|
|
e9ba7eda47 | ||
|
|
88649b6aae | ||
|
|
60d63bbada | ||
|
|
b8f62d1e10 | ||
|
|
989307e4c2 | ||
|
|
7344723a95 | ||
|
|
4c4bca0c39 | ||
|
|
d570121704 | ||
|
|
93122ac935 | ||
|
|
f9e100cb1e | ||
|
|
d3ad178d95 | ||
|
|
123cbd42bb | ||
|
|
977ac2b31f | ||
|
|
bcdc3b706c | ||
|
|
61db797f29 | ||
|
|
0a876f11a0 | ||
|
|
019e3c02ed | ||
|
|
1c17316f9c | ||
|
|
646c5f369f | ||
|
|
8839e10d44 | ||
|
|
9b61bfb3c8 | ||
|
|
60e2242256 | ||
|
|
4f5a9be465 | ||
|
|
6a4c778791 | ||
|
|
1caa95b814 | ||
|
|
cf44ba7847 | ||
|
|
30433d7659 | ||
|
|
849b950763 | ||
|
|
8937cd992d | ||
|
|
e296c6a356 | ||
|
|
136400e8a2 | ||
|
|
90199534e0 | ||
|
|
f7c64b4ebb | ||
|
|
f4f060c843 | ||
|
|
2977e91aed | ||
|
|
0b999c73d1 | ||
|
|
9b1e0dd4a3 | ||
|
|
a29826bb71 | ||
|
|
a181136646 | ||
|
|
5b04201da8 | ||
|
|
528297f5e5 | ||
|
|
b29feb193e | ||
|
|
75b5c2a293 | ||
|
|
e32c992886 | ||
|
|
c7a5d99286 | ||
|
|
c9ca60c201 | ||
|
|
d9f6f26cd8 | ||
|
|
e4a00f864d | ||
|
|
329f7c1c40 | ||
|
|
c23afb2c86 | ||
|
|
e838ea3bc8 | ||
|
|
e5de03144f | ||
|
|
e325f65c8a | ||
|
|
2a40ff1b47 | ||
|
|
371c325ed1 | ||
|
|
542b95e7e8 | ||
|
|
3d3525a589 | ||
|
|
553c458e5a | ||
|
|
7cdb8d8565 | ||
|
|
172f68e77d | ||
|
|
fb1145d72d | ||
|
|
bd9687a4f2 | ||
|
|
8928323c6b | ||
|
|
c7203550a2 | ||
|
|
49887d4c81 | ||
|
|
d8c940325c | ||
|
|
3944d64d08 | ||
|
|
e20f547317 | ||
|
|
a3cef6c05e | ||
|
|
11ee72fc7e | ||
|
|
bcd8941769 | ||
|
|
355d3f070a | ||
|
|
b5b81dea7f | ||
|
|
5803366f7d | ||
|
|
d3fc47e149 | ||
|
|
b8f37da911 | ||
|
|
722f8e825e | ||
|
|
a743412c58 | ||
|
|
a6f14555d1 | ||
|
|
1c091a03f3 | ||
|
|
2dfb8de0ec | ||
|
|
876e256f94 | ||
|
|
eb834b8370 | ||
|
|
dbabdf8341 | ||
|
|
703fda3be8 | ||
|
|
2f6d6f2473 | ||
|
|
3f3c8436c5 | ||
|
|
d8b0a78c1e | ||
|
|
013538daf9 | ||
|
|
919d823311 | ||
|
|
075c77325b | ||
|
|
5f8dc5459e | ||
|
|
adff8c2c60 | ||
|
|
3b959456ac | ||
|
|
47ef5af778 | ||
|
|
76ea157f17 | ||
|
|
f354a7787a | ||
|
|
83eeeb6a19 | ||
|
|
6db181980a | ||
|
|
023bb2c984 | ||
|
|
a3cfb42888 | ||
|
|
578dc9e70b | ||
|
|
6769db160d | ||
|
|
56d16aae42 | ||
|
|
d614f4c96d | ||
|
|
98f0d85c4a | ||
|
|
b3115454ce | ||
|
|
cb3b6ff624 | ||
|
|
a795d6635b | ||
|
|
a2b49322fb | ||
|
|
0b2006b74f | ||
|
|
a91d0ac156 | ||
|
|
d71995ab5c | ||
|
|
fea2a82ef6 | ||
|
|
8373cc6c47 | ||
|
|
872d2046fd | ||
|
|
44ec142fa9 | ||
|
|
b70f389b64 | ||
|
|
1c73edd9b0 | ||
|
|
94d9088034 | ||
|
|
cbd9e560b0 | ||
|
|
abc595b810 | ||
|
|
7d26d3926c | ||
|
|
0e55f7a52f | ||
|
|
febe128e72 | ||
|
|
3afc7b0883 | ||
|
|
655c9dd526 | ||
|
|
bcea96528a | ||
|
|
7336e18410 | ||
|
|
412af0269d | ||
|
|
5e17afbc0a | ||
|
|
912236439c | ||
|
|
0ad4166482 | ||
|
|
7ce1055656 | ||
|
|
78a376aa7f | ||
|
|
43f2b47fc9 | ||
|
|
413cfed7d7 | ||
|
|
e05b87c8d0 | ||
|
|
1b4bce4182 | ||
|
|
387587dedb | ||
|
|
5d8c8f33c0 | ||
|
|
d032396031 | ||
|
|
12438b30a0 | ||
|
|
ea1ff9c482 | ||
|
|
8122156e84 | ||
|
|
991f4ed993 | ||
|
|
29244c5c40 | ||
|
|
ca3d855c44 | ||
|
|
3fcd39f659 | ||
|
|
c2b823f185 | ||
|
|
7de076481e | ||
|
|
58cfa3fd49 | ||
|
|
87e7fa9917 | ||
|
|
b14b0efefe | ||
|
|
1b271f3335 | ||
|
|
03e30431a8 | ||
|
|
5a93449b89 | ||
|
|
222e05c2d2 | ||
|
|
c0071a0676 | ||
|
|
97231ca231 | ||
|
|
67bd28eaaf | ||
|
|
51b2fd1777 | ||
|
|
ff5eac6da5 | ||
|
|
4987cb0407 | ||
|
|
7927f7a440 | ||
|
|
605284bc36 | ||
|
|
54ed31ebaf | ||
|
|
6320bd5849 | ||
|
|
86cc7f6925 | ||
|
|
adb77e1a92 | ||
|
|
097f3c9514 | ||
|
|
f0266cbef3 | ||
|
|
519967cc69 | ||
|
|
a7b9a33efc | ||
|
|
32b84b8ab6 | ||
|
|
8ec1c866e1 | ||
|
|
3a06394fde | ||
|
|
ce72154913 | ||
|
|
ed11f2a9e4 | ||
|
|
60f2e452a1 | ||
|
|
76103ee286 | ||
|
|
73042bfc54 | ||
|
|
ff23397701 | ||
|
|
96b37f4eb8 | ||
|
|
135cea76fb | ||
|
|
ff087e126f | ||
|
|
9501fc2c14 | ||
|
|
7547291450 | ||
|
|
0603b4431a | ||
|
|
5f48f60a93 | ||
|
|
cc9faf3cfa | ||
|
|
7d93e9963a | ||
|
|
32cec6c1cb | ||
|
|
c0827e2c54 | ||
|
|
1a931da046 | ||
|
|
8eb62f138b | ||
|
|
6a8921ec6b | ||
|
|
53132d0235 | ||
|
|
32bed34935 | ||
|
|
1873b38a94 | ||
|
|
38b4a2a8e2 | ||
|
|
b65d9ca955 | ||
|
|
0b472c23d7 | ||
|
|
bb89ee184f | ||
|
|
eb087c9943 | ||
|
|
eeec6f8fb9 | ||
|
|
71339225eb | ||
|
|
590e70d4d1 | ||
|
|
fd16ac4d5e | ||
|
|
f3099afcc5 | ||
|
|
37f8e6aabd | ||
|
|
e0fe2882ad | ||
|
|
4413592a70 | ||
|
|
4c28ee80a6 | ||
|
|
f4c4fe860b | ||
|
|
4766b475d0 | ||
|
|
ae75d4b565 | ||
|
|
c102387916 | ||
|
|
86ad215deb | ||
|
|
c3f82534bd | ||
|
|
2ffbb37783 | ||
|
|
6821fe0c13 | ||
|
|
a0947232fa | ||
|
|
e3f1a3d27c | ||
|
|
d98e05b91a | ||
|
|
fa85f4fc2e | ||
|
|
44352b375e | ||
|
|
ebe88ea322 | ||
|
|
6d77723fe0 | ||
|
|
c5ed51a188 | ||
|
|
1339c425a8 | ||
|
|
7c723dfc58 | ||
|
|
72814a8153 | ||
|
|
9952f72680 | ||
|
|
b9473bc99c | ||
|
|
cbc3ce5b03 | ||
|
|
d223752c55 | ||
|
|
74208e9e0c | ||
|
|
14b7fa1dd6 | ||
|
|
4bfe8605cb | ||
|
|
e86bf764a8 | ||
|
|
80411fb905 | ||
|
|
c9241e83dd | ||
|
|
9166b03c42 | ||
|
|
31efc882db | ||
|
|
1db59d1c89 | ||
|
|
afb3715700 | ||
|
|
6be4279f39 | ||
|
|
5782871f91 | ||
|
|
0e9ac9e64b | ||
|
|
13df99fd1e | ||
|
|
9f62bd1da6 | ||
|
|
75c1562df0 | ||
|
|
0821d5b29d | ||
|
|
b3cffc0516 | ||
|
|
80a58672d1 | ||
|
|
18714e25a8 | ||
|
|
b29c30c9d5 | ||
|
|
d8df197489 | ||
|
|
514e60c1bb | ||
|
|
32a256bd03 | ||
|
|
b9316a404a | ||
|
|
ea2a3f3e62 | ||
|
|
5cd8009c53 | ||
|
|
26aa620efe | ||
|
|
e0cf6e4775 | ||
|
|
df2d43c893 | ||
|
|
8d6c5ba90e | ||
|
|
629f528f6d | ||
|
|
191e3bc7e1 | ||
|
|
ecad4743bd | ||
|
|
ceb8aedf97 | ||
|
|
0cf4eb379f | ||
|
|
f3fdf58ff7 | ||
|
|
3073e65851 | ||
|
|
a75529f3c0 | ||
|
|
75a48aed0b | ||
|
|
a7f23ebe7d | ||
|
|
0f9a02e6f4 | ||
|
|
4b4b77ca04 | ||
|
|
a231648607 | ||
|
|
eeb5cd2321 | ||
|
|
5c705ae9a5 | ||
|
|
19f69f6ac8 | ||
|
|
ad1340cab4 | ||
|
|
3a3a59c188 | ||
|
|
6ed6cc46de | ||
|
|
6837e80d14 | ||
|
|
4f3e65e745 | ||
|
|
36a1b69a19 | ||
|
|
1f11892de4 | ||
|
|
1bc8f3ac6e | ||
|
|
e62f10d5f0 | ||
|
|
822547dfef | ||
|
|
c0214cfcc1 | ||
|
|
cb6d96d65f | ||
|
|
4cc4868e93 | ||
|
|
6c90d3a1b6 | ||
|
|
ffab342fc4 | ||
|
|
1203dc501c | ||
|
|
3cbf1845a9 | ||
|
|
ea44eade21 | ||
|
|
c75a368bab | ||
|
|
bc8d2add04 | ||
|
|
c53f58e839 | ||
|
|
50543a7948 | ||
|
|
f7cd22d5ec | ||
|
|
b136c77031 | ||
|
|
6bfe171058 | ||
|
|
5e49da1d73 | ||
|
|
cc7ae525ef | ||
|
|
a29853f53b | ||
|
|
7cea21043e | ||
|
|
cbdea09c92 | ||
|
|
31393704de | ||
|
|
3eec90cdc0 | ||
|
|
b9d8eb54b7 | ||
|
|
a2fdb55384 | ||
|
|
848a19a013 | ||
|
|
98bc89968a | ||
|
|
9c0e9e462b | ||
|
|
57d762d5ea | ||
|
|
9018ce1125 | ||
|
|
1b32f5c28b | ||
|
|
0e35e50f8f | ||
|
|
88b617646a | ||
|
|
27fa7eace1 | ||
|
|
ca996e0e85 | ||
|
|
df683205d9 | ||
|
|
6905935fd3 | ||
|
|
5504c62af9 | ||
|
|
9bb58c3eca | ||
|
|
c0b8eb30de | ||
|
|
8a734f947e | ||
|
|
e4904f6644 | ||
|
|
6ded38de2b | ||
|
|
4fa1f459dd | ||
|
|
25644aa6b1 | ||
|
|
a3f13f9c58 | ||
|
|
d940d801a4 | ||
|
|
7b0af75a57 | ||
|
|
5329ac6d4b | ||
|
|
2b123702cc | ||
|
|
56c2431ed1 | ||
|
|
0ed5f939e9 | ||
|
|
f3fa4fcb75 | ||
|
|
bd35ff61e3 | ||
|
|
aa6f3a627f | ||
|
|
ee27587428 | ||
|
|
d2f76d689f | ||
|
|
20cd6cc155 | ||
|
|
960e766206 | ||
|
|
1c9fbe3773 | ||
|
|
6669ddad09 | ||
|
|
6e872715ef | ||
|
|
dc582b478f | ||
|
|
55839dc508 | ||
|
|
6dd23b2bf0 | ||
|
|
afd64f3740 | ||
|
|
a7b6663b33 | ||
|
|
487e095d24 | ||
|
|
b487e8f694 | ||
|
|
171e3454ad | ||
|
|
164ebee129 | ||
|
|
76f2c4f0aa | ||
|
|
9999ac1255 | ||
|
|
3242174f81 | ||
|
|
6f1cade817 | ||
|
|
c6961f1b61 | ||
|
|
8c88453816 | ||
|
|
0415574acf | ||
|
|
c812e1dc94 | ||
|
|
251bf45cf2 | ||
|
|
13c0a9e27b | ||
|
|
4c70bf6c9c | ||
|
|
2914c360a9 | ||
|
|
8d1a2247e0 | ||
|
|
4fba7f8c59 | ||
|
|
a93745238f | ||
|
|
b812ff2597 | ||
|
|
8a51796150 | ||
|
|
dd7d171186 | ||
|
|
0ac20f978e | ||
|
|
0a96c3f062 | ||
|
|
42e6630c3e | ||
|
|
1125d08f0d | ||
|
|
0544633755 | ||
|
|
a642883e33 | ||
|
|
c1bb699151 | ||
|
|
120cfcc120 | ||
|
|
55af84d359 | ||
|
|
4ae362d138 | ||
|
|
fd201e4df7 | ||
|
|
21123a1264 | ||
|
|
87aeec2b63 | ||
|
|
ea5fc348fa | ||
|
|
ebc0d3760f | ||
|
|
b4a6d69f5d | ||
|
|
1c8b746b42 | ||
|
|
05cdce2e8d | ||
|
|
509b781079 | ||
|
|
c38deef753 | ||
|
|
4b7a6a885d | ||
|
|
68869a0e0f | ||
|
|
048957cd49 | ||
|
|
434d32bf95 | ||
|
|
1178a0011a | ||
|
|
0af2e65c80 | ||
|
|
e8f3b47bf3 | ||
|
|
8b16e44d26 | ||
|
|
002abc6d48 | ||
|
|
aca31c3ab6 | ||
|
|
f43d344aa3 | ||
|
|
a3609c3f6d | ||
|
|
ddc74a08be | ||
|
|
76614ea5f2 | ||
|
|
2eabe21aae | ||
|
|
72f574a9c0 | ||
|
|
02935afe94 | ||
|
|
234d0443b2 | ||
|
|
822deabdfe | ||
|
|
b2e94f81cf | ||
|
|
109df77d87 | ||
|
|
76e3284ca1 | ||
|
|
576504390d | ||
|
|
660f46fcb1 | ||
|
|
2bd93c1e9e | ||
|
|
1612e38cda | ||
|
|
176ab784dc | ||
|
|
b576aef2b1 | ||
|
|
a357995484 | ||
|
|
5d10100fc0 | ||
|
|
6118dfba74 | ||
|
|
d276d2629a | ||
|
|
e3ee1df456 | ||
|
|
2691e4e949 | ||
|
|
20d7b7f59b | ||
|
|
1fcd08d76a | ||
|
|
060a9f072c | ||
|
|
4a631787bd | ||
|
|
032473fef8 | ||
|
|
5dd8801ee5 | ||
|
|
5c9643b6eb | ||
|
|
4de670b0b4 | ||
|
|
ade40a7a0c | ||
|
|
9926e6ebde | ||
|
|
b930c5a8a2 | ||
|
|
7eb5dfd294 | ||
|
|
8752564fea | ||
|
|
988fac404a | ||
|
|
7a3eaad193 | ||
|
|
3fccb16ca6 | ||
|
|
2c38b71ca5 | ||
|
|
1c93bef0d5 | ||
|
|
eea76e8cce | ||
|
|
3b604331ec | ||
|
|
92546cf9f7 | ||
|
|
3c9f9d598b | ||
|
|
ed46053dc9 | ||
|
|
a3db7437b3 | ||
|
|
b2d639b6d9 | ||
|
|
f1c7803f80 | ||
|
|
c179fce6c7 | ||
|
|
795899f9d5 | ||
|
|
88ab3a6942 | ||
|
|
58e8dd1c0d | ||
|
|
b8bbf7b63b | ||
|
|
05e28fb498 | ||
|
|
c6d9963d1a | ||
|
|
2d3a902beb | ||
|
|
8b1f3936b6 | ||
|
|
108ea50179 | ||
|
|
df1892c052 | ||
|
|
0820a79bf5 | ||
|
|
4427bde8a7 | ||
|
|
dec4db5943 | ||
|
|
fd7f6ca7ad | ||
|
|
dea309144b | ||
|
|
f1e4efebb7 | ||
|
|
0885eb0a7b | ||
|
|
fc68d1b1e6 | ||
|
|
b329090e69 | ||
|
|
6314ebd435 | ||
|
|
e89e182565 | ||
|
|
552fe0406c | ||
|
|
b062dea1aa | ||
|
|
9b561581d5 | ||
|
|
7f6c31c041 | ||
|
|
717c55c9aa | ||
|
|
7d1c6272be | ||
|
|
2f387c2a23 | ||
|
|
0d95c5dfe2 | ||
|
|
f2a2908c59 | ||
|
|
f4cb60dcca | ||
|
|
b3d0629709 | ||
|
|
30f55c4d07 | ||
|
|
f00d964f4f | ||
|
|
d2920c501d | ||
|
|
af528b08dc | ||
|
|
a628907891 | ||
|
|
19ad4d67ef | ||
|
|
a4e427b44a | ||
|
|
5b94e3c2f2 | ||
|
|
3278e9ab6c | ||
|
|
02d8e95b73 | ||
|
|
e0b9b51e9f | ||
|
|
fb06b7fa94 | ||
|
|
7b451678f5 | ||
|
|
3be9e819d6 | ||
|
|
758c54eab8 | ||
|
|
c39cc15573 | ||
|
|
8999bb0b78 | ||
|
|
7a81b7c7be | ||
|
|
e475d4bdc5 | ||
|
|
980a6a20b1 | ||
|
|
064ad42432 | ||
|
|
4ff9163c47 | ||
|
|
45ebe47d94 | ||
|
|
2803bd93ce | ||
|
|
51161fb0d6 | ||
|
|
63fd97749c | ||
|
|
f2d736d2cc | ||
|
|
9b9a656e54 | ||
|
|
8f734b01b2 | ||
|
|
69250371b0 | ||
|
|
731613d70b | ||
|
|
5f21c45f75 | ||
|
|
8beea4d958 | ||
|
|
1583200e24 | ||
|
|
03fa8ed259 | ||
|
|
0bd939624e | ||
|
|
b658a1a8e3 | ||
|
|
7eae9d115c | ||
|
|
2ca56d4c4c | ||
|
|
f6d7967e96 | ||
|
|
9bddc0ff85 | ||
|
|
6e47ebe030 | ||
|
|
9728dabf12 | ||
|
|
e904c49e8a | ||
|
|
27ddd39d69 | ||
|
|
86e907b088 | ||
|
|
8b46538af9 | ||
|
|
5910a28aa5 | ||
|
|
3935027880 | ||
|
|
8665828d7f | ||
|
|
a8b559e99f | ||
|
|
5674a3db46 | ||
|
|
dd3acc9014 | ||
|
|
a9364bc053 | ||
|
|
59313e1459 | ||
|
|
3e54d374de | ||
|
|
9856218073 | ||
|
|
97cdf87350 | ||
|
|
d8f91e7df9 | ||
|
|
91d4e2b3e3 | ||
|
|
e5cccbf5a0 | ||
|
|
5cfe9ab603 | ||
|
|
01a6bbdc73 | ||
|
|
24a4063645 | ||
|
|
4f11bbc59b | ||
|
|
9ceb41f9a4 | ||
|
|
831309eed2 | ||
|
|
4bb4a98493 | ||
|
|
70b0f712ad | ||
|
|
c6e9372ba3 | ||
|
|
13b055ab2d | ||
|
|
38f4a7708e | ||
|
|
6abcd8d013 | ||
|
|
37906a2200 | ||
|
|
b9b5072668 | ||
|
|
459edfa77b | ||
|
|
92a79d3f96 | ||
|
|
984dff54ab | ||
|
|
1866aa93e3 | ||
|
|
2884691740 | ||
|
|
b8549a142e | ||
|
|
0f3ca349e7 | ||
|
|
a13d6bbbdf | ||
|
|
d15dc6f90b | ||
|
|
58e6c277b0 | ||
|
|
1d29d44ddb | ||
|
|
bda3c6c084 | ||
|
|
159913be2f | ||
|
|
b05d1676d3 | ||
|
|
0b21ed0c7a | ||
|
|
564a92830b | ||
|
|
a20fd5e14e | ||
|
|
138986f064 | ||
|
|
f286c99338 | ||
|
|
ea48d1de5e | ||
|
|
dbd2a81501 | ||
|
|
be6ec8f50b | ||
|
|
264d4bada6 | ||
|
|
633172fd66 | ||
|
|
042f7d117f | ||
|
|
b062594ae6 | ||
|
|
95f30fee87 | ||
|
|
dbc49e7742 | ||
|
|
449c96ffb3 | ||
|
|
1459ca2c26 | ||
|
|
4123c85021 | ||
|
|
d1c37c41d9 | ||
|
|
ea6d3f589f | ||
|
|
1e6120e776 | ||
|
|
a77f8e886b | ||
|
|
96b782c026 | ||
|
|
6455a54f6c | ||
|
|
3bae6fa1c7 | ||
|
|
68f19a8e6a | ||
|
|
12ebbd1b24 | ||
|
|
9b7bda6137 | ||
|
|
1b4ed58331 | ||
|
|
b2868d7218 | ||
|
|
bdc8f9dccf | ||
|
|
9768f35931 | ||
|
|
19a4ee031d | ||
|
|
a7ee1b4e85 | ||
|
|
5db079b052 | ||
|
|
a2ff6af4b3 | ||
|
|
f66e764855 | ||
|
|
a8c23d06ac | ||
|
|
36b4cd4bfc | ||
|
|
46c59e3c3d | ||
|
|
b5aee936a9 | ||
|
|
aa8687316f | ||
|
|
5a3cf5a194 | ||
|
|
c5e1b00994 | ||
|
|
377f0c1a0a | ||
|
|
a442e6e8de | ||
|
|
274c47e5ba | ||
|
|
b2f15a622d | ||
|
|
04aaf02881 | ||
|
|
d5f8e1bf29 | ||
|
|
33bd7051f2 | ||
|
|
61345b3216 | ||
|
|
129691f3a6 | ||
|
|
4eaf860e86 | ||
|
|
72814c54a8 | ||
|
|
4d4e02c9d0 | ||
|
|
8ab609e4e7 | ||
|
|
6bc156c237 | ||
|
|
b435dc4366 | ||
|
|
4dd1de4129 | ||
|
|
48e6cd4255 | ||
|
|
658397fad0 | ||
|
|
670fc5bb94 | ||
|
|
b224df8109 | ||
|
|
c88e7c180d | ||
|
|
2aabd64f1a | ||
|
|
7990b24287 | ||
|
|
c76c1a46e4 | ||
|
|
68fed63eac | ||
|
|
46403bac12 | ||
|
|
74c626f835 | ||
|
|
d45a662679 | ||
|
|
f6019f1a16 | ||
|
|
514de0b91a | ||
|
|
9a463056d0 | ||
|
|
035baa092c | ||
|
|
499738c903 | ||
|
|
f2d7433bf6 | ||
|
|
405121bccc | ||
|
|
cb96b34315 | ||
|
|
9edf6fb6cb | ||
|
|
e3c4fb67ca | ||
|
|
a9dfca04e4 | ||
|
|
71b52f485e | ||
|
|
f62fc4e2f2 | ||
|
|
511e2b435e | ||
|
|
3f36340921 | ||
|
|
b1f0f4478e | ||
|
|
90f8dcc5e1 | ||
|
|
5a019bfccd | ||
|
|
b39a5fe5dc | ||
|
|
c7ef8411bd | ||
|
|
dab8a8b5c5 | ||
|
|
8b9c5e3a04 | ||
|
|
3d3a672deb | ||
|
|
2f97134a08 | ||
|
|
47237d32eb | ||
|
|
139a59cae3 | ||
|
|
60fb9092fe | ||
|
|
61b4febbaf | ||
|
|
4f4ba8c4f6 | ||
|
|
651adbfb39 | ||
|
|
3204347bb0 | ||
|
|
b929846cc1 | ||
|
|
fe65da05be | ||
|
|
06c825df90 | ||
|
|
46430ea85b | ||
|
|
859c95b435 | ||
|
|
5ea8167802 | ||
|
|
92d3d55164 | ||
|
|
ba2125d8e1 | ||
|
|
7c96326c18 | ||
|
|
38d353dc1a | ||
|
|
7ae04ba36b | ||
|
|
39c284c490 | ||
|
|
895e8e25a8 | ||
|
|
04562a76e3 | ||
|
|
b6781e06c1 | ||
|
|
54104b6676 | ||
|
|
21450d5f23 | ||
|
|
a39bbb2041 | ||
|
|
176d9c6baf | ||
|
|
64afa765c8 | ||
|
|
a246d8c926 | ||
|
|
0531e663ee | ||
|
|
bd2349c0a0 | ||
|
|
636fbc0f1a | ||
|
|
cdf80f1d65 | ||
|
|
e7b2c530c5 | ||
|
|
e07098da03 | ||
|
|
98a21bf498 | ||
|
|
c694dd6049 | ||
|
|
6b308cd71e | ||
|
|
3b6ee32f83 | ||
|
|
3bc3e140dd | ||
|
|
a6a9853676 | ||
|
|
6b42e5b433 | ||
|
|
99c01607f1 | ||
|
|
071748592d | ||
|
|
8dd74eac2e | ||
|
|
f6a2678486 | ||
|
|
e28ec2a3eb | ||
|
|
c4fd786866 | ||
|
|
8fa7de5563 | ||
|
|
9e6b4e82c9 | ||
|
|
4be2e804ae | ||
|
|
1056e9976a | ||
|
|
851bb61455 | ||
|
|
3aadc29af4 | ||
|
|
3d55b74197 | ||
|
|
19b1fcfee3 | ||
|
|
98cfbd3712 | ||
|
|
112f49b23c | ||
|
|
4d36fdc176 | ||
|
|
31d79b07b7 | ||
|
|
2405e2711e | ||
|
|
1527407c3d | ||
|
|
f524a9315b | ||
|
|
a5f22897f9 | ||
|
|
03840fb687 | ||
|
|
6e65c16b60 | ||
|
|
23e4d05383 | ||
|
|
489e9e0934 | ||
|
|
3acc014499 | ||
|
|
3ebe30bf32 | ||
|
|
996f011ed8 | ||
|
|
0611370a5f | ||
|
|
1be850d806 | ||
|
|
b903d8ee33 | ||
|
|
8fd968e5bf | ||
|
|
366e8da927 | ||
|
|
203d612afd | ||
|
|
135580108a | ||
|
|
4515604511 | ||
|
|
ad4a81e9df | ||
|
|
95e5472ade | ||
|
|
06ff4a8b6f | ||
|
|
1f0904d3df | ||
|
|
35a88c1440 | ||
|
|
d1f4068b94 | ||
|
|
7e73da5f73 | ||
|
|
c789a39660 | ||
|
|
3c6045e300 | ||
|
|
9389768a17 | ||
|
|
412006ad23 | ||
|
|
ea456b80da | ||
|
|
152eabbaba | ||
|
|
9be0b3d76f | ||
|
|
27644dc573 | ||
|
|
41595cf336 | ||
|
|
8f3fb4109f | ||
|
|
417a70b096 | ||
|
|
6f82fd8b2e | ||
|
|
53d43dff46 | ||
|
|
3ef8af3be9 | ||
|
|
fe6507f875 | ||
|
|
9b0d87c5a7 | ||
|
|
a515fca63f | ||
|
|
b6baa15e0a | ||
|
|
955ae40cd6 | ||
|
|
dee9e40ad3 | ||
|
|
a933a9bc79 | ||
|
|
6a4a082660 | ||
|
|
a7cdcdf92c | ||
|
|
a7a0a34da1 | ||
|
|
299bd5fa93 | ||
|
|
c25e948375 | ||
|
|
a03e531772 | ||
|
|
1420408858 | ||
|
|
4414e7ec7b | ||
|
|
217f9ea3b8 | ||
|
|
ab7b9d882e | ||
|
|
4a19bab5b3 | ||
|
|
27d6276212 | ||
|
|
d8d5cc9788 | ||
|
|
2687a2eb8d | ||
|
|
c0bbfd950d | ||
|
|
d541aed165 | ||
|
|
c2ac141031 | ||
|
|
cdee8270e2 | ||
|
|
6581d66652 | ||
|
|
7dbeee5d50 | ||
|
|
01e89f9142 | ||
|
|
dafb7054a1 | ||
|
|
04bace1982 | ||
|
|
90701cb655 | ||
|
|
ccccaa2681 | ||
|
|
421e9c3502 | ||
|
|
ef031e1a9d | ||
|
|
afbadc5e1b |
@@ -1,7 +1,7 @@
|
|||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- flatpak
|
- flatpak
|
||||||
- deploy
|
# - deploy
|
||||||
|
|
||||||
.cache-paths: &cache-paths
|
.cache-paths: &cache-paths
|
||||||
paths:
|
paths:
|
||||||
@@ -12,8 +12,8 @@ stages:
|
|||||||
- subprojects/libepoxy/
|
- subprojects/libepoxy/
|
||||||
- subprojects/pango/
|
- subprojects/pango/
|
||||||
|
|
||||||
fedora-x86_64:
|
fedora-x86_64: &fedora-x86_64-defaults
|
||||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v6
|
image: registry.gitlab.gnome.org/gnome/gtk/master:v8
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- bash -x ./.gitlab-ci/test-docker.sh
|
- bash -x ./.gitlab-ci/test-docker.sh
|
||||||
@@ -33,6 +33,11 @@ fedora-x86_64:
|
|||||||
key: "$CI_JOB_NAME"
|
key: "$CI_JOB_NAME"
|
||||||
<<: *cache-paths
|
<<: *cache-paths
|
||||||
|
|
||||||
|
fedora-x86_64-staticlibs:
|
||||||
|
variables:
|
||||||
|
EXTRA_MESON_FLAGS: "-Ddefault_library=both"
|
||||||
|
<<: *fedora-x86_64-defaults
|
||||||
|
|
||||||
.mingw-defaults: &mingw-defaults
|
.mingw-defaults: &mingw-defaults
|
||||||
stage: build
|
stage: build
|
||||||
tags:
|
tags:
|
||||||
@@ -101,20 +106,19 @@ flatpak-master:icon-browser:
|
|||||||
APPID: org.gtk.IconBrowser4
|
APPID: org.gtk.IconBrowser4
|
||||||
<<: *flatpak-master
|
<<: *flatpak-master
|
||||||
|
|
||||||
pages:
|
#pages:
|
||||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v6
|
# image: registry.gitlab.gnome.org/gnome/gtk/master:v6
|
||||||
stage: deploy
|
# stage: deploy
|
||||||
script:
|
# script:
|
||||||
- meson -Ddocumentation=true _build .
|
# - meson -Dgtk_doc=true _build .
|
||||||
- ninja -C _build
|
# - ninja -C _build
|
||||||
- ninja -C _build gdk4-doc gsk4-doc gtk4-doc
|
# - ninja -C _build gdk4-doc gsk4-doc gtk4-doc
|
||||||
|
# - mkdir -p public/
|
||||||
- mkdir -p public/
|
# - mv _build/docs/reference/gtk/html/ public/gtk/
|
||||||
- mv _build/docs/reference/gtk/html/ public/gtk/
|
# - mv _build/docs/reference/gdk/html/ public/gdk/
|
||||||
- mv _build/docs/reference/gdk/html/ public/gdk/
|
# - mv _build/docs/reference/gsk/html/ public/gsk/
|
||||||
- mv _build/docs/reference/gsk/html/ public/gsk/
|
# artifacts:
|
||||||
artifacts:
|
# paths:
|
||||||
paths:
|
# - public
|
||||||
- public
|
# only:
|
||||||
only:
|
# - master
|
||||||
- master
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
FROM fedora:30
|
FROM fedora:31
|
||||||
|
|
||||||
RUN dnf -y install \
|
RUN dnf -y install \
|
||||||
hicolor-icon-theme \
|
|
||||||
adwaita-icon-theme \
|
adwaita-icon-theme \
|
||||||
atk-devel \
|
atk-devel \
|
||||||
at-spi2-atk-devel \
|
at-spi2-atk-devel \
|
||||||
@@ -14,6 +13,7 @@ RUN dnf -y install \
|
|||||||
dbus-daemon \
|
dbus-daemon \
|
||||||
dejavu-sans-mono-fonts \
|
dejavu-sans-mono-fonts \
|
||||||
desktop-file-utils \
|
desktop-file-utils \
|
||||||
|
diffutils \
|
||||||
elfutils-libelf-devel \
|
elfutils-libelf-devel \
|
||||||
fribidi-devel \
|
fribidi-devel \
|
||||||
gcc \
|
gcc \
|
||||||
@@ -32,6 +32,7 @@ RUN dnf -y install \
|
|||||||
gstreamer1-plugins-bad-free-devel \
|
gstreamer1-plugins-bad-free-devel \
|
||||||
gstreamer1-plugins-base-devel \
|
gstreamer1-plugins-base-devel \
|
||||||
gtk-doc \
|
gtk-doc \
|
||||||
|
hicolor-icon-theme \
|
||||||
iso-codes \
|
iso-codes \
|
||||||
itstool \
|
itstool \
|
||||||
json-glib-devel \
|
json-glib-devel \
|
||||||
@@ -52,6 +53,7 @@ RUN dnf -y install \
|
|||||||
libxkbcommon-devel \
|
libxkbcommon-devel \
|
||||||
libXrandr-devel \
|
libXrandr-devel \
|
||||||
libXrender-devel \
|
libXrender-devel \
|
||||||
|
libXtst-devel \
|
||||||
libxslt \
|
libxslt \
|
||||||
mesa-dri-drivers \
|
mesa-dri-drivers \
|
||||||
mesa-libEGL-devel \
|
mesa-libEGL-devel \
|
||||||
|
|||||||
@@ -149,11 +149,11 @@ ul.images li {
|
|||||||
<article>
|
<article>
|
||||||
<section>
|
<section>
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
<h3>Summary</h3>
|
<h3><a name="summary">Summary</a></h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>Total units:</strong> {{ report.total_units }}</li>
|
<li><strong>Total units:</strong> {{ report.total_units }}</li>
|
||||||
<li><strong>Passed:</strong> {{ report.total_successes }}</li>
|
<li><strong>Passed:</strong> <a href="#passed">{{ report.total_successes }}</a></li>
|
||||||
<li><strong>Failed:</strong> {{ report.total_failures }}</li>
|
<li><strong>Failed:</strong> <a href="#failures">{{ report.total_failures }}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -161,7 +161,7 @@ ul.images li {
|
|||||||
{% for suite_result in report.results_list %}
|
{% for suite_result in report.results_list %}
|
||||||
<section>
|
<section>
|
||||||
<div class="result">
|
<div class="result">
|
||||||
<h3>Suite: {{ suite_result.suite_name }}</h3>
|
<h3><a name="results">Suite: {{ suite_result.suite_name }}</a></h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>Units:</strong> {{ suite_result.n_units }}</li>
|
<li><strong>Units:</strong> {{ suite_result.n_units }}</li>
|
||||||
<li><strong>Passed:</strong> {{ suite_result.n_successes }}</li>
|
<li><strong>Passed:</strong> {{ suite_result.n_successes }}</li>
|
||||||
@@ -169,7 +169,7 @@ ul.images li {
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="successes">
|
<div class="successes">
|
||||||
<h4>Passed</h4>
|
<h4><a name="passed">Passed</a></h4>
|
||||||
<ul class="passed">
|
<ul class="passed">
|
||||||
{% for success in suite_result.successes if success.result == 'OK' %}
|
{% for success in suite_result.successes if success.result == 'OK' %}
|
||||||
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
|
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
|
||||||
@@ -178,7 +178,7 @@ ul.images li {
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h4>Skipped</h4>
|
<h4><a name="skipped">Skipped</a></h4>
|
||||||
<ul>
|
<ul>
|
||||||
{% for success in suite_result.successes if success.result == 'SKIP' %}
|
{% for success in suite_result.successes if success.result == 'SKIP' %}
|
||||||
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
|
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
|
||||||
@@ -187,10 +187,10 @@ ul.images li {
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h4>Expected failures</h4>
|
<h4><a name="expected-fail">Expected failures</a></h4>
|
||||||
<ul>
|
<ul>
|
||||||
{% for success in suite_result.successes if success.result == 'EXPECTEDFAIL' %}
|
{% for success in suite_result.successes if success.result == 'EXPECTEDFAIL' %}
|
||||||
<li>{{ success.name }} - result: <span class="result xfail">{{ success.result }}</span><br/>
|
<li><a name="{{ success.name }}">{{ success.name }}</a> - result: <span class="result xfail">{{ success.result }}</span><br/>
|
||||||
{% if success.stdout %}
|
{% if success.stdout %}
|
||||||
Output: <pre>{{ success.stdout }}</pre>
|
Output: <pre>{{ success.stdout }}</pre>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -209,10 +209,10 @@ ul.images li {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="failures">
|
<div class="failures">
|
||||||
<h4>Failed</h4>
|
<h4><a name="failed">Failed</a></h4>
|
||||||
<ul class="failed">
|
<ul class="failed">
|
||||||
{% for failure in suite_result.failures if failure.result == 'FAIL' %}
|
{% for failure in suite_result.failures if failure.result == 'FAIL' %}
|
||||||
<li>{{ failure.name }} - result: <span class="result fail">{{ failure.result }}</span><br/>
|
<li><a name="{{ failure.name }}">{{ failure.name }}</a> - result: <span class="result fail">{{ failure.result }}</span><br/>
|
||||||
{% if failure.stdout %}
|
{% if failure.stdout %}
|
||||||
Output: <pre>{{ failure.stdout }}</pre>
|
Output: <pre>{{ failure.stdout }}</pre>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -229,10 +229,10 @@ ul.images li {
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h4>Timed out</h4>
|
<h4><a name="timed-out">Timed out</a></h4>
|
||||||
<ul class="failed">
|
<ul class="failed">
|
||||||
{% for failure in suite_result.failures if failure.result == 'TIMEOUT' %}
|
{% for failure in suite_result.failures if failure.result == 'TIMEOUT' %}
|
||||||
<li>{{ failure.name }} - result: <span class="result fail">{{ failure.result }}</span><br/>
|
<li><a name="{{ failure.name }}">{{ failure.name }}</a> - result: <span class="result fail">{{ failure.result }}</span><br/>
|
||||||
{% if failure.stdout %}
|
{% if failure.stdout %}
|
||||||
Output: <pre>{{ failure.stdout }}</pre>
|
Output: <pre>{{ failure.stdout }}</pre>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v6"
|
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v7"
|
||||||
|
|
||||||
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
|
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
|
||||||
--file "Dockerfile" .
|
--file "Dockerfile" .
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ meson \
|
|||||||
-Dbroadway-backend=true \
|
-Dbroadway-backend=true \
|
||||||
-Dvulkan=yes \
|
-Dvulkan=yes \
|
||||||
--werror \
|
--werror \
|
||||||
|
${EXTRA_MESON_FLAGS:-} \
|
||||||
_build $srcdir
|
_build $srcdir
|
||||||
unset CCACHE_DISABLE
|
unset CCACHE_DISABLE
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ pacman --noconfirm -S --needed \
|
|||||||
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
|
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
|
||||||
mingw-w64-$MSYS2_ARCH-shared-mime-info
|
mingw-w64-$MSYS2_ARCH-shared-mime-info
|
||||||
|
|
||||||
|
# https://gitlab.gnome.org/GNOME/gtk/issues/2243
|
||||||
|
wget "https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner/raw/master/pango/mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
|
||||||
|
pacman --noconfirm -U "mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
|
||||||
|
|
||||||
mkdir -p _ccache
|
mkdir -p _ccache
|
||||||
export CCACHE_BASEDIR="$(pwd)"
|
export CCACHE_BASEDIR="$(pwd)"
|
||||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ maintainers review your contribution.
|
|||||||
|
|
||||||
Each contribution is reviewed by the core developers of the GTK project.
|
Each contribution is reviewed by the core developers of the GTK project.
|
||||||
|
|
||||||
The [CODE-OWNERS](./docs/CODE-OWNERS) document contains the list of core
|
The [CODEOWNERS](./docs/CODEOWNERS) document contains the list of core
|
||||||
contributors to GTK and the areas for which they are responsible; you
|
contributors to GTK and the areas for which they are responsible; you
|
||||||
should ensure to receive their review and signoff on your changes.
|
should ensure to receive their review and signoff on your changes.
|
||||||
|
|
||||||
|
|||||||
@@ -56,12 +56,6 @@
|
|||||||
/* Define if GStreamer support is available */
|
/* Define if GStreamer support is available */
|
||||||
#mesondefine HAVE_GSTREAMER
|
#mesondefine HAVE_GSTREAMER
|
||||||
|
|
||||||
/* Define to 1 if you have the `httpGetAuthString' function. */
|
|
||||||
#mesondefine HAVE_HTTPGETAUTHSTRING
|
|
||||||
|
|
||||||
/* Define if cups http_t authstring field is accessible */
|
|
||||||
#mesondefine HAVE_HTTP_AUTHSTRING
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#mesondefine HAVE_INTTYPES_H
|
#mesondefine HAVE_INTTYPES_H
|
||||||
|
|
||||||
@@ -191,9 +185,6 @@
|
|||||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||||
#mesondefine LT_OBJDIR
|
#mesondefine LT_OBJDIR
|
||||||
|
|
||||||
/* Define if <X11/extensions/XIproto.h> needed for xReply */
|
|
||||||
#mesondefine NEED_XIPROTO_H_FOR_XREPLY
|
|
||||||
|
|
||||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||||
#mesondefine NO_MINUS_C_MINUS_O
|
#mesondefine NO_MINUS_C_MINUS_O
|
||||||
|
|
||||||
|
|||||||
115
demos/constraint-editor/constraint-editor-application.c
Normal file
115
demos/constraint-editor/constraint-editor-application.c
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "constraint-editor-application.h"
|
||||||
|
#include "constraint-editor-window.h"
|
||||||
|
|
||||||
|
struct _ConstraintEditorApplication
|
||||||
|
{
|
||||||
|
GtkApplication parent_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE(ConstraintEditorApplication, constraint_editor_application, GTK_TYPE_APPLICATION);
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_application_init (ConstraintEditorApplication *app)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
quit_activated (GSimpleAction *action,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
g_application_quit (G_APPLICATION (data));
|
||||||
|
}
|
||||||
|
|
||||||
|
static GActionEntry app_entries[] =
|
||||||
|
{
|
||||||
|
{ "quit", quit_activated, NULL, NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_application_startup (GApplication *app)
|
||||||
|
{
|
||||||
|
const char *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||||
|
const char *open_accels[2] = { "<Ctrl>O", NULL };
|
||||||
|
GtkCssProvider *provider;
|
||||||
|
|
||||||
|
G_APPLICATION_CLASS (constraint_editor_application_parent_class)->startup (app);
|
||||||
|
|
||||||
|
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||||
|
app_entries, G_N_ELEMENTS (app_entries),
|
||||||
|
app);
|
||||||
|
gtk_application_set_accels_for_action (GTK_APPLICATION (app), "app.quit", quit_accels);
|
||||||
|
gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.open", open_accels);
|
||||||
|
|
||||||
|
provider = gtk_css_provider_new ();
|
||||||
|
gtk_css_provider_load_from_resource (provider, "/org/gtk/gtk4/constraint-editor/constraint-editor.css");
|
||||||
|
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
|
GTK_STYLE_PROVIDER (provider),
|
||||||
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_application_activate (GApplication *app)
|
||||||
|
{
|
||||||
|
ConstraintEditorWindow *win;
|
||||||
|
|
||||||
|
win = constraint_editor_window_new (CONSTRAINT_EDITOR_APPLICATION (app));
|
||||||
|
gtk_window_present (GTK_WINDOW (win));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_application_open (GApplication *app,
|
||||||
|
GFile **files,
|
||||||
|
gint n_files,
|
||||||
|
const gchar *hint)
|
||||||
|
{
|
||||||
|
ConstraintEditorWindow *win;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
for (i = 0; i < n_files; i++)
|
||||||
|
{
|
||||||
|
win = constraint_editor_window_new (CONSTRAINT_EDITOR_APPLICATION (app));
|
||||||
|
constraint_editor_window_load (win, files[i]);
|
||||||
|
gtk_window_present (GTK_WINDOW (win));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_application_class_init (ConstraintEditorApplicationClass *class)
|
||||||
|
{
|
||||||
|
GApplicationClass *application_class = G_APPLICATION_CLASS (class);
|
||||||
|
|
||||||
|
application_class->startup = constraint_editor_application_startup;
|
||||||
|
application_class->activate = constraint_editor_application_activate;
|
||||||
|
application_class->open = constraint_editor_application_open;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConstraintEditorApplication *
|
||||||
|
constraint_editor_application_new (void)
|
||||||
|
{
|
||||||
|
return g_object_new (CONSTRAINT_EDITOR_APPLICATION_TYPE,
|
||||||
|
"application-id", "org.gtk.gtk4.ConstraintEditor",
|
||||||
|
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
28
demos/constraint-editor/constraint-editor-application.h
Normal file
28
demos/constraint-editor/constraint-editor-application.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#define CONSTRAINT_EDITOR_APPLICATION_TYPE (constraint_editor_application_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (ConstraintEditorApplication, constraint_editor_application, CONSTRAINT, EDITOR_APPLICATION, GtkApplication)
|
||||||
|
|
||||||
|
ConstraintEditorApplication *constraint_editor_application_new (void);
|
||||||
639
demos/constraint-editor/constraint-editor-window.c
Normal file
639
demos/constraint-editor/constraint-editor-window.c
Normal file
@@ -0,0 +1,639 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "constraint-editor-window.h"
|
||||||
|
#include "constraint-view.h"
|
||||||
|
#include "constraint-editor.h"
|
||||||
|
#include "guide-editor.h"
|
||||||
|
|
||||||
|
struct _ConstraintEditorWindow
|
||||||
|
{
|
||||||
|
GtkApplicationWindow parent_instance;
|
||||||
|
|
||||||
|
GtkWidget *paned;
|
||||||
|
GtkWidget *view;
|
||||||
|
GtkWidget *list;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE(ConstraintEditorWindow, constraint_editor_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||||
|
|
||||||
|
static GtkConstraintTarget *
|
||||||
|
find_target (GListModel *model,
|
||||||
|
GtkConstraintTarget *orig)
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
const char *model_name;
|
||||||
|
gpointer item;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (orig == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (GTK_IS_LABEL (orig))
|
||||||
|
name = gtk_label_get_label (GTK_LABEL (orig));
|
||||||
|
else if (GTK_IS_CONSTRAINT_GUIDE (orig))
|
||||||
|
name = gtk_constraint_guide_get_name (GTK_CONSTRAINT_GUIDE (orig));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_warning ("Don't know how to handle %s targets", G_OBJECT_TYPE_NAME (orig));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
for (i = 0; i < g_list_model_get_n_items (model); i++)
|
||||||
|
{
|
||||||
|
item = g_list_model_get_item (model, i);
|
||||||
|
g_object_unref (item);
|
||||||
|
if (GTK_IS_WIDGET (item))
|
||||||
|
model_name = gtk_widget_get_name (GTK_WIDGET (item));
|
||||||
|
else
|
||||||
|
model_name = gtk_constraint_guide_get_name (GTK_CONSTRAINT_GUIDE (item));
|
||||||
|
|
||||||
|
if (strcmp (name, model_name) == 0)
|
||||||
|
return GTK_CONSTRAINT_TARGET (item);
|
||||||
|
}
|
||||||
|
g_warning ("Failed to find target '%s'", name);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
constraint_editor_window_load (ConstraintEditorWindow *self,
|
||||||
|
GFile *file)
|
||||||
|
{
|
||||||
|
char *path;
|
||||||
|
GtkBuilder *builder;
|
||||||
|
GError *error = NULL;
|
||||||
|
GtkWidget *view;
|
||||||
|
GtkLayoutManager *layout;
|
||||||
|
GtkWidget *child;
|
||||||
|
const char *name;
|
||||||
|
gpointer item;
|
||||||
|
int i;
|
||||||
|
GListModel *list;
|
||||||
|
|
||||||
|
path = g_file_get_path (file);
|
||||||
|
|
||||||
|
builder = gtk_builder_new ();
|
||||||
|
if (!gtk_builder_add_from_file (builder, path, &error))
|
||||||
|
{
|
||||||
|
g_print ("Could not load %s: %s", path, error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
g_free (path);
|
||||||
|
g_object_unref (builder);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
view = GTK_WIDGET (gtk_builder_get_object (builder, "view"));
|
||||||
|
if (!GTK_IS_BOX (view))
|
||||||
|
{
|
||||||
|
g_print ("Could not load %s: No GtkBox named 'view'", path);
|
||||||
|
g_free (path);
|
||||||
|
g_object_unref (builder);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
layout = gtk_widget_get_layout_manager (view);
|
||||||
|
if (!GTK_IS_CONSTRAINT_LAYOUT (layout))
|
||||||
|
{
|
||||||
|
g_print ("Could not load %s: Widget 'view' does not use GtkConstraintLayout", path);
|
||||||
|
g_free (path);
|
||||||
|
g_object_unref (builder);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (child = gtk_widget_get_first_child (view);
|
||||||
|
child;
|
||||||
|
child = gtk_widget_get_next_sibling (child))
|
||||||
|
{
|
||||||
|
if (!GTK_IS_LABEL (child))
|
||||||
|
{
|
||||||
|
g_print ("Skipping non-GtkLabel child\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
name = gtk_label_get_label (GTK_LABEL (child));
|
||||||
|
constraint_view_add_child (CONSTRAINT_VIEW (self->view), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
list = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (layout));
|
||||||
|
for (i = 0; i < g_list_model_get_n_items (list); i++)
|
||||||
|
{
|
||||||
|
GtkConstraintGuide *guide, *clone;
|
||||||
|
int w, h;
|
||||||
|
|
||||||
|
item = g_list_model_get_item (list, i);
|
||||||
|
guide = GTK_CONSTRAINT_GUIDE (item);
|
||||||
|
|
||||||
|
/* need to clone here, to attach to the right targets */
|
||||||
|
clone = gtk_constraint_guide_new ();
|
||||||
|
gtk_constraint_guide_set_name (clone, gtk_constraint_guide_get_name (guide));
|
||||||
|
gtk_constraint_guide_set_strength (clone, gtk_constraint_guide_get_strength (guide));
|
||||||
|
gtk_constraint_guide_get_min_size (guide, &w, &h);
|
||||||
|
gtk_constraint_guide_set_min_size (clone, w, h);
|
||||||
|
gtk_constraint_guide_get_nat_size (guide, &w, &h);
|
||||||
|
gtk_constraint_guide_set_nat_size (clone, w, h);
|
||||||
|
gtk_constraint_guide_get_max_size (guide, &w, &h);
|
||||||
|
gtk_constraint_guide_set_max_size (clone, w, h);
|
||||||
|
constraint_view_add_guide (CONSTRAINT_VIEW (self->view), clone);
|
||||||
|
g_object_unref (guide);
|
||||||
|
g_object_unref (clone);
|
||||||
|
}
|
||||||
|
g_object_unref (list);
|
||||||
|
|
||||||
|
list = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (layout));
|
||||||
|
for (i = 0; i < g_list_model_get_n_items (list); i++)
|
||||||
|
{
|
||||||
|
GtkConstraint *constraint;
|
||||||
|
GtkConstraint *clone;
|
||||||
|
GtkConstraintTarget *target;
|
||||||
|
GtkConstraintTarget *source;
|
||||||
|
|
||||||
|
item = g_list_model_get_item (list, i);
|
||||||
|
constraint = GTK_CONSTRAINT (item);
|
||||||
|
|
||||||
|
target = gtk_constraint_get_target (constraint);
|
||||||
|
source = gtk_constraint_get_source (constraint);
|
||||||
|
clone = gtk_constraint_new (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
|
||||||
|
gtk_constraint_get_target_attribute (constraint),
|
||||||
|
gtk_constraint_get_relation (constraint),
|
||||||
|
find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), source),
|
||||||
|
gtk_constraint_get_target_attribute (constraint),
|
||||||
|
gtk_constraint_get_multiplier (constraint),
|
||||||
|
gtk_constraint_get_constant (constraint),
|
||||||
|
gtk_constraint_get_strength (constraint));
|
||||||
|
|
||||||
|
constraint_view_add_constraint (CONSTRAINT_VIEW (self->view), clone);
|
||||||
|
|
||||||
|
g_object_unref (constraint);
|
||||||
|
g_object_unref (clone);
|
||||||
|
}
|
||||||
|
g_object_unref (list);
|
||||||
|
|
||||||
|
g_free (path);
|
||||||
|
g_object_unref (builder);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
open_response_cb (GtkNativeDialog *dialog,
|
||||||
|
gint response,
|
||||||
|
ConstraintEditorWindow *self)
|
||||||
|
{
|
||||||
|
gtk_native_dialog_hide (dialog);
|
||||||
|
|
||||||
|
if (response == GTK_RESPONSE_ACCEPT)
|
||||||
|
{
|
||||||
|
GFile *file;
|
||||||
|
|
||||||
|
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||||
|
constraint_editor_window_load (self, file);
|
||||||
|
g_object_unref (file);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_native_dialog_destroy (dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
open_cb (GtkWidget *button,
|
||||||
|
ConstraintEditorWindow *self)
|
||||||
|
{
|
||||||
|
GtkFileChooserNative *dialog;
|
||||||
|
|
||||||
|
dialog = gtk_file_chooser_native_new ("Open file",
|
||||||
|
GTK_WINDOW (self),
|
||||||
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||||
|
"_Load",
|
||||||
|
"_Cancel");
|
||||||
|
|
||||||
|
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
|
||||||
|
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), ".");
|
||||||
|
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), self);
|
||||||
|
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
serialize_child (GString *str,
|
||||||
|
int indent,
|
||||||
|
GtkWidget *child)
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
|
||||||
|
name = gtk_widget_get_name (child);
|
||||||
|
g_string_append_printf (str, "%*s<child>\n", indent, "");
|
||||||
|
g_string_append_printf (str, "%*s <object class=\"GtkLabel\" id=\"%s\">\n", indent, "", name);
|
||||||
|
g_string_append_printf (str, "%*s <property name=\"label\">%s</property>\n", indent, "", name);
|
||||||
|
g_string_append_printf (str, "%*s </object>\n", indent, "");
|
||||||
|
g_string_append_printf (str, "%*s</child>\n", indent, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
serialize_model (GListModel *list)
|
||||||
|
{
|
||||||
|
GString *str = g_string_new ("");
|
||||||
|
int i;
|
||||||
|
|
||||||
|
g_string_append (str, "<interface>\n");
|
||||||
|
g_string_append (str, " <object class=\"GtkBox\" id=\"view\">\n");
|
||||||
|
g_string_append (str, " <property name=\"layout-manager\">\n");
|
||||||
|
g_string_append (str, " <object class=\"GtkConstraintLayout\">\n");
|
||||||
|
g_string_append (str, " <constraints>\n");
|
||||||
|
for (i = 0; i < g_list_model_get_n_items (list); i++)
|
||||||
|
{
|
||||||
|
gpointer item = g_list_model_get_item (list, i);
|
||||||
|
g_object_unref (item);
|
||||||
|
if (GTK_IS_CONSTRAINT (item))
|
||||||
|
constraint_editor_serialize_constraint (str, 10, GTK_CONSTRAINT (item));
|
||||||
|
else if (GTK_IS_CONSTRAINT_GUIDE (item))
|
||||||
|
guide_editor_serialize_guide (str, 10, GTK_CONSTRAINT_GUIDE (item));
|
||||||
|
}
|
||||||
|
g_string_append (str, " </constraints>\n");
|
||||||
|
g_string_append (str, " </object>\n");
|
||||||
|
g_string_append (str, " </property>\n");
|
||||||
|
for (i = 0; i < g_list_model_get_n_items (list); i++)
|
||||||
|
{
|
||||||
|
gpointer item = g_list_model_get_item (list, i);
|
||||||
|
g_object_unref (item);
|
||||||
|
if (GTK_IS_WIDGET (item))
|
||||||
|
serialize_child (str, 4, GTK_WIDGET (item));
|
||||||
|
}
|
||||||
|
g_string_append (str, " </object>\n");
|
||||||
|
g_string_append (str, "</interface>\n");
|
||||||
|
|
||||||
|
return g_string_free (str, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
save_response_cb (GtkNativeDialog *dialog,
|
||||||
|
gint response,
|
||||||
|
ConstraintEditorWindow *self)
|
||||||
|
{
|
||||||
|
gtk_native_dialog_hide (dialog);
|
||||||
|
|
||||||
|
if (response == GTK_RESPONSE_ACCEPT)
|
||||||
|
{
|
||||||
|
GListModel *model;
|
||||||
|
char *text, *filename;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
model = constraint_view_get_model (CONSTRAINT_VIEW (self->view));
|
||||||
|
text = serialize_model (model);
|
||||||
|
|
||||||
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||||
|
if (!g_file_set_contents (filename, text, -1, &error))
|
||||||
|
{
|
||||||
|
GtkWidget *dialog;
|
||||||
|
|
||||||
|
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
|
||||||
|
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
GTK_MESSAGE_INFO,
|
||||||
|
GTK_BUTTONS_OK,
|
||||||
|
"Saving failed");
|
||||||
|
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||||
|
"%s", error->message);
|
||||||
|
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||||
|
gtk_widget_show (dialog);
|
||||||
|
g_error_free (error);
|
||||||
|
}
|
||||||
|
g_free (filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_native_dialog_destroy (dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
save_cb (GtkWidget *button,
|
||||||
|
ConstraintEditorWindow *self)
|
||||||
|
{
|
||||||
|
GtkFileChooserNative *dialog;
|
||||||
|
|
||||||
|
dialog = gtk_file_chooser_native_new ("Save constraints",
|
||||||
|
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
|
||||||
|
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||||
|
"_Save",
|
||||||
|
"_Cancel");
|
||||||
|
|
||||||
|
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
|
||||||
|
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), ".");
|
||||||
|
g_signal_connect (dialog, "response", G_CALLBACK (save_response_cb), self);
|
||||||
|
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_window_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
//ConstraintEditorWindow *self = (ConstraintEditorWindow *)object;
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (constraint_editor_window_parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int child_counter;
|
||||||
|
static int guide_counter;
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_child (ConstraintEditorWindow *win)
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
child_counter++;
|
||||||
|
name = g_strdup_printf ("Child %d", child_counter);
|
||||||
|
constraint_view_add_child (CONSTRAINT_VIEW (win->view), name);
|
||||||
|
g_free (name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_guide (ConstraintEditorWindow *win)
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
GtkConstraintGuide *guide;
|
||||||
|
|
||||||
|
guide_counter++;
|
||||||
|
name = g_strdup_printf ("Guide %d", guide_counter);
|
||||||
|
guide = gtk_constraint_guide_new ();
|
||||||
|
gtk_constraint_guide_set_name (guide, name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
|
constraint_view_add_guide (CONSTRAINT_VIEW (win->view), guide);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_done (ConstraintEditor *editor,
|
||||||
|
GtkConstraint *constraint,
|
||||||
|
ConstraintEditorWindow *win)
|
||||||
|
{
|
||||||
|
GtkConstraint *old_constraint;
|
||||||
|
|
||||||
|
g_object_get (editor, "constraint", &old_constraint, NULL);
|
||||||
|
|
||||||
|
if (old_constraint)
|
||||||
|
constraint_view_remove_constraint (CONSTRAINT_VIEW (win->view), old_constraint);
|
||||||
|
|
||||||
|
constraint_view_add_constraint (CONSTRAINT_VIEW (win->view), constraint);
|
||||||
|
|
||||||
|
g_clear_object (&old_constraint);
|
||||||
|
|
||||||
|
gtk_widget_destroy (gtk_widget_get_ancestor (GTK_WIDGET (editor), GTK_TYPE_WINDOW));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
edit_constraint (ConstraintEditorWindow *win,
|
||||||
|
GtkConstraint *constraint)
|
||||||
|
{
|
||||||
|
GtkWidget *window;
|
||||||
|
ConstraintEditor *editor;
|
||||||
|
GListModel *model;
|
||||||
|
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (win));
|
||||||
|
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||||
|
if (constraint)
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "Edit Constraint");
|
||||||
|
else
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "Create Constraint");
|
||||||
|
|
||||||
|
model = constraint_view_get_model (CONSTRAINT_VIEW (win->view));
|
||||||
|
|
||||||
|
editor = constraint_editor_new (model, constraint);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (editor));
|
||||||
|
|
||||||
|
g_signal_connect (editor, "done", G_CALLBACK (constraint_editor_done), win);
|
||||||
|
|
||||||
|
gtk_widget_show (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_constraint (ConstraintEditorWindow *win)
|
||||||
|
{
|
||||||
|
edit_constraint (win, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
guide_editor_done (GuideEditor *editor,
|
||||||
|
GtkConstraintGuide *guide,
|
||||||
|
ConstraintEditorWindow *win)
|
||||||
|
{
|
||||||
|
gtk_widget_destroy (gtk_widget_get_ancestor (GTK_WIDGET (editor), GTK_TYPE_WINDOW));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
edit_guide (ConstraintEditorWindow *win,
|
||||||
|
GtkConstraintGuide *guide)
|
||||||
|
{
|
||||||
|
GtkWidget *window;
|
||||||
|
GuideEditor *editor;
|
||||||
|
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (win));
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "Edit Guide");
|
||||||
|
|
||||||
|
editor = guide_editor_new (guide);
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (editor));
|
||||||
|
|
||||||
|
g_signal_connect (editor, "done", G_CALLBACK (guide_editor_done), win);
|
||||||
|
gtk_widget_show (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
row_activated (GtkListBox *list,
|
||||||
|
GtkListBoxRow *row,
|
||||||
|
ConstraintEditorWindow *win)
|
||||||
|
{
|
||||||
|
GObject *item;
|
||||||
|
|
||||||
|
item = G_OBJECT (g_object_get_data (G_OBJECT (row), "item"));
|
||||||
|
|
||||||
|
if (GTK_IS_CONSTRAINT (item))
|
||||||
|
edit_constraint (win, GTK_CONSTRAINT (item));
|
||||||
|
else if (GTK_IS_CONSTRAINT_GUIDE (item))
|
||||||
|
edit_guide (win, GTK_CONSTRAINT_GUIDE (item));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_window_class_init (ConstraintEditorWindowClass *class)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||||
|
|
||||||
|
g_type_ensure (CONSTRAINT_VIEW_TYPE);
|
||||||
|
|
||||||
|
object_class->finalize = constraint_editor_window_finalize;
|
||||||
|
|
||||||
|
gtk_widget_class_set_template_from_resource (widget_class,
|
||||||
|
"/org/gtk/gtk4/constraint-editor/constraint-editor-window.ui");
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditorWindow, paned);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditorWindow, view);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditorWindow, list);
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, open_cb);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, save_cb);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, add_child);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, add_guide);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, add_constraint);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, row_activated);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
row_edit (GtkButton *button,
|
||||||
|
ConstraintEditorWindow *win)
|
||||||
|
{
|
||||||
|
GtkWidget *row;
|
||||||
|
GObject *item;
|
||||||
|
|
||||||
|
row = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_LIST_BOX_ROW);
|
||||||
|
item = (GObject *)g_object_get_data (G_OBJECT (row), "item");
|
||||||
|
if (GTK_IS_CONSTRAINT (item))
|
||||||
|
edit_constraint (win, GTK_CONSTRAINT (item));
|
||||||
|
else if (GTK_IS_CONSTRAINT_GUIDE (item))
|
||||||
|
edit_guide (win, GTK_CONSTRAINT_GUIDE (item));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mark_constraints_invalid (ConstraintEditorWindow *win,
|
||||||
|
gpointer removed)
|
||||||
|
{
|
||||||
|
GtkWidget *child;
|
||||||
|
GObject *item;
|
||||||
|
|
||||||
|
for (child = gtk_widget_get_first_child (win->list);
|
||||||
|
child;
|
||||||
|
child = gtk_widget_get_next_sibling (child))
|
||||||
|
{
|
||||||
|
item = (GObject *)g_object_get_data (G_OBJECT (child), "item");
|
||||||
|
if (GTK_IS_CONSTRAINT (item))
|
||||||
|
{
|
||||||
|
GtkConstraint *constraint = GTK_CONSTRAINT (item);
|
||||||
|
|
||||||
|
if (gtk_constraint_get_target (constraint) == (GtkConstraintTarget *)removed ||
|
||||||
|
gtk_constraint_get_source (constraint) == (GtkConstraintTarget *)removed)
|
||||||
|
{
|
||||||
|
GtkWidget *button;
|
||||||
|
button = (GtkWidget *)g_object_get_data (G_OBJECT (child), "edit");
|
||||||
|
gtk_button_set_icon_name (GTK_BUTTON (button), "dialog-warning-symbolic");
|
||||||
|
gtk_widget_set_tooltip_text (button, "Constraint is invalid");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
row_delete (GtkButton *button,
|
||||||
|
ConstraintEditorWindow *win)
|
||||||
|
{
|
||||||
|
GtkWidget *row;
|
||||||
|
GObject *item;
|
||||||
|
|
||||||
|
row = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_LIST_BOX_ROW);
|
||||||
|
item = (GObject *)g_object_get_data (G_OBJECT (row), "item");
|
||||||
|
if (GTK_IS_CONSTRAINT (item))
|
||||||
|
constraint_view_remove_constraint (CONSTRAINT_VIEW (win->view),
|
||||||
|
GTK_CONSTRAINT (item));
|
||||||
|
else if (GTK_IS_CONSTRAINT_GUIDE (item))
|
||||||
|
{
|
||||||
|
mark_constraints_invalid (win, item);
|
||||||
|
constraint_view_remove_guide (CONSTRAINT_VIEW (win->view),
|
||||||
|
GTK_CONSTRAINT_GUIDE (item));
|
||||||
|
}
|
||||||
|
else if (GTK_IS_WIDGET (item))
|
||||||
|
{
|
||||||
|
mark_constraints_invalid (win, item);
|
||||||
|
constraint_view_remove_child (CONSTRAINT_VIEW (win->view),
|
||||||
|
GTK_WIDGET (item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static GtkWidget *
|
||||||
|
create_widget_func (gpointer item,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
ConstraintEditorWindow *win = user_data;
|
||||||
|
const char *name;
|
||||||
|
char *freeme = NULL;
|
||||||
|
GtkWidget *row, *box, *label, *button;
|
||||||
|
|
||||||
|
if (GTK_IS_WIDGET (item))
|
||||||
|
name = gtk_widget_get_name (GTK_WIDGET (item));
|
||||||
|
else if (GTK_IS_CONSTRAINT_GUIDE (item))
|
||||||
|
name = gtk_constraint_guide_get_name (GTK_CONSTRAINT_GUIDE (item));
|
||||||
|
else if (GTK_IS_CONSTRAINT (item))
|
||||||
|
name = freeme = constraint_editor_constraint_to_string (GTK_CONSTRAINT (item));
|
||||||
|
else
|
||||||
|
name = "";
|
||||||
|
|
||||||
|
row = gtk_list_box_row_new ();
|
||||||
|
g_object_set_data_full (G_OBJECT (row), "item", g_object_ref (item), g_object_unref);
|
||||||
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
|
label = gtk_label_new (name);
|
||||||
|
if (GTK_IS_WIDGET (item) || GTK_IS_CONSTRAINT_GUIDE (item))
|
||||||
|
g_object_bind_property (item, "name",
|
||||||
|
label, "label",
|
||||||
|
G_BINDING_DEFAULT);
|
||||||
|
g_object_set (label, "margin", 10, NULL);
|
||||||
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
||||||
|
gtk_widget_set_hexpand (label, TRUE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (row), box);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), label);
|
||||||
|
|
||||||
|
if (GTK_IS_CONSTRAINT (item) || GTK_IS_CONSTRAINT_GUIDE (item))
|
||||||
|
{
|
||||||
|
button = gtk_button_new_from_icon_name ("document-edit-symbolic");
|
||||||
|
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
|
||||||
|
g_signal_connect (button, "clicked", G_CALLBACK (row_edit), win);
|
||||||
|
g_object_set_data (G_OBJECT (row), "edit", button);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), button);
|
||||||
|
button = gtk_button_new_from_icon_name ("edit-delete-symbolic");
|
||||||
|
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
|
||||||
|
g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), button);
|
||||||
|
}
|
||||||
|
else if (GTK_IS_WIDGET (item))
|
||||||
|
{
|
||||||
|
button = gtk_button_new_from_icon_name ("edit-delete-symbolic");
|
||||||
|
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
|
||||||
|
g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), button);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (freeme);
|
||||||
|
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_window_init (ConstraintEditorWindow *self)
|
||||||
|
{
|
||||||
|
gtk_widget_init_template (GTK_WIDGET (self));
|
||||||
|
|
||||||
|
gtk_list_box_bind_model (GTK_LIST_BOX (self->list),
|
||||||
|
constraint_view_get_model (CONSTRAINT_VIEW (self->view)),
|
||||||
|
create_widget_func,
|
||||||
|
self,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConstraintEditorWindow *
|
||||||
|
constraint_editor_window_new (ConstraintEditorApplication *application)
|
||||||
|
{
|
||||||
|
return g_object_new (CONSTRAINT_EDITOR_WINDOW_TYPE,
|
||||||
|
"application", application,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
34
demos/constraint-editor/constraint-editor-window.h
Normal file
34
demos/constraint-editor/constraint-editor-window.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#include "constraint-editor-application.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define CONSTRAINT_EDITOR_WINDOW_TYPE (constraint_editor_window_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (ConstraintEditorWindow, constraint_editor_window, CONSTRAINT, EDITOR_WINDOW, GtkApplicationWindow)
|
||||||
|
|
||||||
|
ConstraintEditorWindow * constraint_editor_window_new (ConstraintEditorApplication *application);
|
||||||
|
|
||||||
|
gboolean constraint_editor_window_load (ConstraintEditorWindow *self,
|
||||||
|
GFile *file);
|
||||||
82
demos/constraint-editor/constraint-editor-window.ui
Normal file
82
demos/constraint-editor/constraint-editor-window.ui
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<template class="ConstraintEditorWindow" parent="GtkApplicationWindow">
|
||||||
|
<style>
|
||||||
|
<class name="devel"/>
|
||||||
|
</style>
|
||||||
|
<property name="title" translatable="yes">GTK Constraint Editor</property>
|
||||||
|
<property name="default-width">1024</property>
|
||||||
|
<property name="default-height">768</property>
|
||||||
|
<child type="titlebar">
|
||||||
|
<object class="GtkHeaderBar" id="header">
|
||||||
|
<property name="title" translatable="yes">GTK Constraint Editor</property>
|
||||||
|
<property name="show-title-buttons">1</property>
|
||||||
|
<child type="start">
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="icon-name">document-open-symbolic</property>
|
||||||
|
<property name="tooltip-text">Open ui file</property>
|
||||||
|
<signal name="clicked" handler="open_cb"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="start">
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="icon-name">document-save-symbolic</property>
|
||||||
|
<property name="tooltip-text">Save to ui file</property>
|
||||||
|
<signal name="clicked" handler="save_cb"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkPaned" id="paned">
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label">Add Child</property>
|
||||||
|
<signal name="clicked" handler="add_child" swapped="yes"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label">Add Guide</property>
|
||||||
|
<signal name="clicked" handler="add_guide" swapped="yes"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label">Add Constraint</property>
|
||||||
|
<signal name="clicked" handler="add_constraint" swapped="yes"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow">
|
||||||
|
<property name="hscrollbar-policy">never</property>
|
||||||
|
<property name="vscrollbar-policy">automatic</property>
|
||||||
|
<property name="vexpand">1</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="list">
|
||||||
|
<property name="show-separators">1</property>
|
||||||
|
<property name="selection-mode">none</property>
|
||||||
|
<signal name="row-activated" handler="row_activated"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="ConstraintView" id="view">
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</template>
|
||||||
|
</interface>
|
||||||
656
demos/constraint-editor/constraint-editor.c
Normal file
656
demos/constraint-editor/constraint-editor.c
Normal file
@@ -0,0 +1,656 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "constraint-editor.h"
|
||||||
|
|
||||||
|
struct _ConstraintEditor
|
||||||
|
{
|
||||||
|
GtkWidget parent_instance;
|
||||||
|
|
||||||
|
GtkWidget *grid;
|
||||||
|
GtkWidget *target;
|
||||||
|
GtkWidget *target_attr;
|
||||||
|
GtkWidget *relation;
|
||||||
|
GtkWidget *source;
|
||||||
|
GtkWidget *source_attr;
|
||||||
|
GtkWidget *multiplier;
|
||||||
|
GtkWidget *constant;
|
||||||
|
GtkWidget *strength;
|
||||||
|
GtkWidget *preview;
|
||||||
|
GtkWidget *button;
|
||||||
|
|
||||||
|
GtkConstraint *constraint;
|
||||||
|
GListModel *model;
|
||||||
|
|
||||||
|
gboolean constructed;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_MODEL = 1,
|
||||||
|
PROP_CONSTRAINT,
|
||||||
|
LAST_PROP
|
||||||
|
};
|
||||||
|
|
||||||
|
static GParamSpec *pspecs[LAST_PROP];
|
||||||
|
|
||||||
|
enum {
|
||||||
|
DONE,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint signals[LAST_SIGNAL];
|
||||||
|
|
||||||
|
G_DEFINE_TYPE(ConstraintEditor, constraint_editor, GTK_TYPE_WIDGET);
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
get_target_name (GtkConstraintTarget *target)
|
||||||
|
{
|
||||||
|
if (target == NULL)
|
||||||
|
return "super";
|
||||||
|
else if (GTK_IS_WIDGET (target))
|
||||||
|
return gtk_widget_get_name (GTK_WIDGET (target));
|
||||||
|
else if (GTK_IS_CONSTRAINT_GUIDE (target))
|
||||||
|
return gtk_constraint_guide_get_name (GTK_CONSTRAINT_GUIDE (target));
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_target_combo (GListModel *model,
|
||||||
|
GtkWidget *combo,
|
||||||
|
gboolean is_source)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "super", "Super");
|
||||||
|
|
||||||
|
if (model)
|
||||||
|
{
|
||||||
|
for (i = 0; i < g_list_model_get_n_items (model); i++)
|
||||||
|
{
|
||||||
|
GObject *item = g_list_model_get_object (model, i);
|
||||||
|
const char *name;
|
||||||
|
|
||||||
|
if (GTK_IS_CONSTRAINT (item))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
name = get_target_name (GTK_CONSTRAINT_TARGET (item));
|
||||||
|
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), name, name);
|
||||||
|
g_object_unref (item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_attribute_combo (GtkWidget *combo,
|
||||||
|
gboolean is_source)
|
||||||
|
{
|
||||||
|
if (is_source)
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "none", "None");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "left", "Left");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "right", "Right");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "top", "Top");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "bottom", "Bottom");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "start", "Start");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "end", "End");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "width", "Width");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "height", "Height");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center-x", "Center X");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center-y", "Center Y");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "baseline", "Baseline");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_relation_combo (GtkWidget *combo)
|
||||||
|
{
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "le", "≤");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "eq", "=");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "ge", "≥");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_strength_combo (GtkWidget *combo)
|
||||||
|
{
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "weak", "Weak");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "medium", "Medium");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "strong", "Strong");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "required", "Required");
|
||||||
|
}
|
||||||
|
|
||||||
|
static gpointer
|
||||||
|
get_target (GListModel *model,
|
||||||
|
const char *id)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (strcmp ("super", id) == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < g_list_model_get_n_items (model); i++)
|
||||||
|
{
|
||||||
|
GObject *item = g_list_model_get_object (model, i);
|
||||||
|
g_object_unref (item);
|
||||||
|
if (GTK_IS_CONSTRAINT (item))
|
||||||
|
continue;
|
||||||
|
else if (GTK_IS_WIDGET (item))
|
||||||
|
{
|
||||||
|
if (strcmp (id, gtk_widget_get_name (GTK_WIDGET (item))) == 0)
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
else if (GTK_IS_CONSTRAINT_GUIDE (item))
|
||||||
|
{
|
||||||
|
if (strcmp (id, gtk_constraint_guide_get_name (GTK_CONSTRAINT_GUIDE (item))) == 0)
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GtkConstraintAttribute
|
||||||
|
get_target_attr (const char *id)
|
||||||
|
{
|
||||||
|
GtkConstraintAttribute attr;
|
||||||
|
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_ATTRIBUTE);
|
||||||
|
GEnumValue *value = g_enum_get_value_by_nick (class, id);
|
||||||
|
attr = value->value;
|
||||||
|
g_type_class_unref (class);
|
||||||
|
|
||||||
|
return attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
get_attr_nick (GtkConstraintAttribute attr)
|
||||||
|
{
|
||||||
|
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_ATTRIBUTE);
|
||||||
|
GEnumValue *value = g_enum_get_value (class, attr);
|
||||||
|
const char *nick = value->value_nick;
|
||||||
|
g_type_class_unref (class);
|
||||||
|
|
||||||
|
return nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GtkConstraintRelation
|
||||||
|
get_relation (const char *id)
|
||||||
|
{
|
||||||
|
GtkConstraintRelation relation;
|
||||||
|
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_RELATION);
|
||||||
|
GEnumValue *value = g_enum_get_value_by_nick (class, id);
|
||||||
|
relation = value->value;
|
||||||
|
g_type_class_unref (class);
|
||||||
|
|
||||||
|
return relation;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
get_relation_nick (GtkConstraintRelation relation)
|
||||||
|
{
|
||||||
|
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_RELATION);
|
||||||
|
GEnumValue *value = g_enum_get_value (class, relation);
|
||||||
|
const char *nick = value->value_nick;
|
||||||
|
g_type_class_unref (class);
|
||||||
|
|
||||||
|
return nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GtkConstraintStrength
|
||||||
|
get_strength (const char *id)
|
||||||
|
{
|
||||||
|
GtkConstraintStrength strength;
|
||||||
|
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_STRENGTH);
|
||||||
|
GEnumValue *value = g_enum_get_value_by_nick (class, id);
|
||||||
|
strength = value->value;
|
||||||
|
g_type_class_unref (class);
|
||||||
|
|
||||||
|
return strength;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
get_strength_nick (GtkConstraintStrength strength)
|
||||||
|
{
|
||||||
|
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_STRENGTH);
|
||||||
|
GEnumValue *value = g_enum_get_value (class, strength);
|
||||||
|
const char *nick = value->value_nick;
|
||||||
|
g_type_class_unref (class);
|
||||||
|
|
||||||
|
return nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
constraint_editor_serialize_constraint (GString *str,
|
||||||
|
int indent,
|
||||||
|
GtkConstraint *constraint)
|
||||||
|
{
|
||||||
|
const char *target;
|
||||||
|
const char *target_attr;
|
||||||
|
const char *relation;
|
||||||
|
const char *source;
|
||||||
|
const char *source_attr;
|
||||||
|
double multiplier;
|
||||||
|
double constant;
|
||||||
|
const char *strength;
|
||||||
|
|
||||||
|
target = get_target_name (gtk_constraint_get_target (constraint));
|
||||||
|
target_attr = get_attr_nick (gtk_constraint_get_target_attribute (constraint));
|
||||||
|
relation = get_relation_nick (gtk_constraint_get_relation (constraint));
|
||||||
|
source = get_target_name (gtk_constraint_get_source (constraint));
|
||||||
|
source_attr = get_attr_nick (gtk_constraint_get_source_attribute (constraint));
|
||||||
|
multiplier = gtk_constraint_get_multiplier (constraint);
|
||||||
|
constant = gtk_constraint_get_constant (constraint);
|
||||||
|
strength = get_strength_nick (gtk_constraint_get_strength (constraint));
|
||||||
|
|
||||||
|
g_string_append_printf (str, "%*s<constraint target=\"%s\" target-attribute=\"%s\"\n", indent, "", target, target_attr);
|
||||||
|
g_string_append_printf (str, "%*s relation=\"%s\"\n", indent, "", relation);
|
||||||
|
if (strcmp (source_attr, "none") != 0)
|
||||||
|
{
|
||||||
|
g_string_append_printf (str, "%*s source=\"%s\" source-attribute=\"%s\"\n", indent, "", source, source_attr);
|
||||||
|
g_string_append_printf (str, "%*s multiplier=\"%g\"\n", indent, "", multiplier);
|
||||||
|
}
|
||||||
|
g_string_append_printf (str, "%*s constant=\"%g\"\n", indent, "", constant);
|
||||||
|
g_string_append_printf (str, "%*s strength=\"%s\" />\n", indent, "", strength);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
create_constraint (GtkButton *button,
|
||||||
|
ConstraintEditor *editor)
|
||||||
|
{
|
||||||
|
const char *id;
|
||||||
|
gpointer target;
|
||||||
|
GtkConstraintAttribute target_attr;
|
||||||
|
gpointer source;
|
||||||
|
GtkConstraintAttribute source_attr;
|
||||||
|
GtkConstraintRelation relation;
|
||||||
|
double multiplier;
|
||||||
|
double constant;
|
||||||
|
int strength;
|
||||||
|
GtkConstraint *constraint;
|
||||||
|
|
||||||
|
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target));
|
||||||
|
target = get_target (editor->model, id);
|
||||||
|
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target_attr));
|
||||||
|
target_attr = get_target_attr (id);
|
||||||
|
|
||||||
|
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source));
|
||||||
|
source = get_target (editor->model, id);
|
||||||
|
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source_attr));
|
||||||
|
source_attr = get_target_attr (id);
|
||||||
|
|
||||||
|
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->relation));
|
||||||
|
relation = get_relation (id);
|
||||||
|
|
||||||
|
multiplier = g_ascii_strtod (gtk_editable_get_text (GTK_EDITABLE (editor->multiplier)), NULL);
|
||||||
|
|
||||||
|
constant = g_ascii_strtod (gtk_editable_get_text (GTK_EDITABLE (editor->constant)), NULL);
|
||||||
|
|
||||||
|
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->strength));
|
||||||
|
strength = get_strength (id);
|
||||||
|
|
||||||
|
constraint = gtk_constraint_new (target, target_attr,
|
||||||
|
relation,
|
||||||
|
source, source_attr,
|
||||||
|
multiplier,
|
||||||
|
constant,
|
||||||
|
strength);
|
||||||
|
g_signal_emit (editor, signals[DONE], 0, constraint);
|
||||||
|
g_object_unref (constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
source_attr_changed (ConstraintEditor *editor)
|
||||||
|
{
|
||||||
|
const char *id;
|
||||||
|
|
||||||
|
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source_attr));
|
||||||
|
if (strcmp (id, "none") == 0)
|
||||||
|
{
|
||||||
|
gtk_combo_box_set_active (GTK_COMBO_BOX (editor->source), -1);
|
||||||
|
gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), "");
|
||||||
|
gtk_widget_set_sensitive (editor->source, FALSE);
|
||||||
|
gtk_widget_set_sensitive (editor->multiplier, FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_widget_set_sensitive (editor->source, TRUE);
|
||||||
|
gtk_widget_set_sensitive (editor->multiplier, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
constraint_editor_constraint_to_string (GtkConstraint *constraint)
|
||||||
|
{
|
||||||
|
GString *str;
|
||||||
|
const char *name;
|
||||||
|
const char *attr;
|
||||||
|
const char *relation;
|
||||||
|
double c, m;
|
||||||
|
|
||||||
|
str = g_string_new ("");
|
||||||
|
|
||||||
|
name = get_target_name (gtk_constraint_get_target (constraint));
|
||||||
|
attr = get_attr_nick (gtk_constraint_get_target_attribute (constraint));
|
||||||
|
relation = get_relation_nick (gtk_constraint_get_relation (constraint));
|
||||||
|
|
||||||
|
if (name == NULL)
|
||||||
|
name = "[ ]";
|
||||||
|
|
||||||
|
g_string_append_printf (str, "%s.%s %s ", name, attr, relation);
|
||||||
|
|
||||||
|
c = gtk_constraint_get_constant (constraint);
|
||||||
|
|
||||||
|
attr = get_attr_nick (gtk_constraint_get_source_attribute (constraint));
|
||||||
|
if (strcmp (attr, "none") != 0)
|
||||||
|
{
|
||||||
|
name = get_target_name (gtk_constraint_get_source (constraint));
|
||||||
|
m = gtk_constraint_get_multiplier (constraint);
|
||||||
|
|
||||||
|
if (name == NULL)
|
||||||
|
name = "[ ]";
|
||||||
|
|
||||||
|
g_string_append_printf (str, "%s.%s", name, attr);
|
||||||
|
|
||||||
|
if (m != 1.0)
|
||||||
|
g_string_append_printf (str, " × %g", m);
|
||||||
|
|
||||||
|
if (c > 0.0)
|
||||||
|
g_string_append_printf (str, " + %g", c);
|
||||||
|
else if (c < 0.0)
|
||||||
|
g_string_append_printf (str, " - %g", -c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_string_append_printf (str, "%g", c);
|
||||||
|
|
||||||
|
return g_string_free (str, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_preview (ConstraintEditor *editor)
|
||||||
|
{
|
||||||
|
GString *str;
|
||||||
|
const char *name;
|
||||||
|
const char *attr;
|
||||||
|
char *relation;
|
||||||
|
const char *multiplier;
|
||||||
|
const char *constant;
|
||||||
|
double c, m;
|
||||||
|
|
||||||
|
if (!editor->constructed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
str = g_string_new ("");
|
||||||
|
|
||||||
|
name = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target));
|
||||||
|
attr = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target_attr));
|
||||||
|
relation = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (editor->relation));
|
||||||
|
|
||||||
|
if (name == NULL)
|
||||||
|
name = "[ ]";
|
||||||
|
|
||||||
|
g_string_append_printf (str, "%s.%s %s ", name, attr, relation);
|
||||||
|
g_free (relation);
|
||||||
|
|
||||||
|
constant = gtk_editable_get_text (GTK_EDITABLE (editor->constant));
|
||||||
|
c = g_ascii_strtod (constant, NULL);
|
||||||
|
|
||||||
|
attr = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source_attr));
|
||||||
|
if (strcmp (attr, "none") != 0)
|
||||||
|
{
|
||||||
|
name = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source));
|
||||||
|
multiplier = gtk_editable_get_text (GTK_EDITABLE (editor->multiplier));
|
||||||
|
m = g_ascii_strtod (multiplier, NULL);
|
||||||
|
|
||||||
|
if (name == NULL)
|
||||||
|
name = "[ ]";
|
||||||
|
|
||||||
|
g_string_append_printf (str, "%s.%s", name, attr);
|
||||||
|
|
||||||
|
if (m != 1.0)
|
||||||
|
g_string_append_printf (str, " × %g", m);
|
||||||
|
|
||||||
|
if (c > 0.0)
|
||||||
|
g_string_append_printf (str, " + %g", c);
|
||||||
|
else if (c < 0.0)
|
||||||
|
g_string_append_printf (str, " - %g", -c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_string_append_printf (str, "%g", c);
|
||||||
|
|
||||||
|
gtk_label_set_label (GTK_LABEL (editor->preview), str->str);
|
||||||
|
|
||||||
|
g_string_free (str, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_button (ConstraintEditor *editor)
|
||||||
|
{
|
||||||
|
if (gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target)) != NULL &&
|
||||||
|
gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source)) != NULL)
|
||||||
|
gtk_widget_set_sensitive (editor->button, TRUE);
|
||||||
|
else
|
||||||
|
gtk_widget_set_sensitive (editor->button, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_init (ConstraintEditor *editor)
|
||||||
|
{
|
||||||
|
gtk_widget_init_template (GTK_WIDGET (editor));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_constructed (GObject *object)
|
||||||
|
{
|
||||||
|
ConstraintEditor *editor = CONSTRAINT_EDITOR (object);
|
||||||
|
|
||||||
|
constraint_target_combo (editor->model, editor->target, FALSE);
|
||||||
|
constraint_attribute_combo (editor->target_attr, FALSE);
|
||||||
|
constraint_relation_combo (editor->relation);
|
||||||
|
constraint_target_combo (editor->model, editor->source, TRUE);
|
||||||
|
constraint_attribute_combo (editor->source_attr, TRUE);
|
||||||
|
|
||||||
|
constraint_strength_combo (editor->strength);
|
||||||
|
|
||||||
|
if (editor->constraint)
|
||||||
|
{
|
||||||
|
GtkConstraintTarget *target;
|
||||||
|
GtkConstraintAttribute attr;
|
||||||
|
GtkConstraintRelation relation;
|
||||||
|
GtkConstraintStrength strength;
|
||||||
|
const char *nick;
|
||||||
|
char *val;
|
||||||
|
double multiplier;
|
||||||
|
double constant;
|
||||||
|
|
||||||
|
target = gtk_constraint_get_target (editor->constraint);
|
||||||
|
nick = get_target_name (target);
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->target), nick);
|
||||||
|
|
||||||
|
attr = gtk_constraint_get_target_attribute (editor->constraint);
|
||||||
|
nick = get_attr_nick (attr);
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->target_attr), nick);
|
||||||
|
|
||||||
|
target = gtk_constraint_get_source (editor->constraint);
|
||||||
|
nick = get_target_name (target);
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->source), nick);
|
||||||
|
|
||||||
|
attr = gtk_constraint_get_source_attribute (editor->constraint);
|
||||||
|
nick = get_attr_nick (attr);
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->source_attr), nick);
|
||||||
|
|
||||||
|
relation = gtk_constraint_get_relation (editor->constraint);
|
||||||
|
nick = get_relation_nick (relation);
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->relation), nick);
|
||||||
|
|
||||||
|
multiplier = gtk_constraint_get_multiplier (editor->constraint);
|
||||||
|
val = g_strdup_printf ("%g", multiplier);
|
||||||
|
gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), val);
|
||||||
|
g_free (val);
|
||||||
|
|
||||||
|
constant = gtk_constraint_get_constant (editor->constraint);
|
||||||
|
val = g_strdup_printf ("%g", constant);
|
||||||
|
gtk_editable_set_text (GTK_EDITABLE (editor->constant), val);
|
||||||
|
g_free (val);
|
||||||
|
|
||||||
|
strength = gtk_constraint_get_strength (editor->constraint);
|
||||||
|
nick = get_strength_nick (strength);
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->strength), nick);
|
||||||
|
|
||||||
|
gtk_button_set_label (GTK_BUTTON (editor->button), "Apply");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->target_attr), "left");
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->source_attr), "left");
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->relation), "eq");
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->strength), "required");
|
||||||
|
|
||||||
|
gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), "1.0");
|
||||||
|
gtk_editable_set_text (GTK_EDITABLE (editor->constant), "0.0");
|
||||||
|
|
||||||
|
gtk_button_set_label (GTK_BUTTON (editor->button), "Create");
|
||||||
|
}
|
||||||
|
|
||||||
|
editor->constructed = TRUE;
|
||||||
|
update_preview (editor);
|
||||||
|
update_button (editor);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_set_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
ConstraintEditor *self = CONSTRAINT_EDITOR (object);
|
||||||
|
|
||||||
|
switch (property_id)
|
||||||
|
{
|
||||||
|
case PROP_MODEL:
|
||||||
|
self->model = g_value_dup_object (value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_CONSTRAINT:
|
||||||
|
self->constraint = g_value_dup_object (value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_get_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
ConstraintEditor *self = CONSTRAINT_EDITOR (object);
|
||||||
|
|
||||||
|
switch (property_id)
|
||||||
|
{
|
||||||
|
case PROP_MODEL:
|
||||||
|
g_value_set_object (value, self->model);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_CONSTRAINT:
|
||||||
|
g_value_set_object (value, self->constraint);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
ConstraintEditor *self = (ConstraintEditor *)object;
|
||||||
|
|
||||||
|
g_clear_pointer (&self->grid, gtk_widget_unparent);
|
||||||
|
g_clear_object (&self->model);
|
||||||
|
g_clear_object (&self->constraint);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (constraint_editor_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_editor_class_init (ConstraintEditorClass *class)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||||
|
|
||||||
|
object_class->constructed = constraint_editor_constructed;
|
||||||
|
object_class->dispose = constraint_editor_dispose;
|
||||||
|
object_class->set_property = constraint_editor_set_property;
|
||||||
|
object_class->get_property = constraint_editor_get_property;
|
||||||
|
|
||||||
|
pspecs[PROP_CONSTRAINT] =
|
||||||
|
g_param_spec_object ("constraint", "constraint", "constraint",
|
||||||
|
GTK_TYPE_CONSTRAINT,
|
||||||
|
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
|
||||||
|
pspecs[PROP_MODEL] =
|
||||||
|
g_param_spec_object ("model", "model", "model",
|
||||||
|
G_TYPE_LIST_MODEL,
|
||||||
|
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
|
||||||
|
g_object_class_install_properties (object_class, LAST_PROP, pspecs);
|
||||||
|
|
||||||
|
signals[DONE] =
|
||||||
|
g_signal_new ("done",
|
||||||
|
G_TYPE_FROM_CLASS (object_class),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
0,
|
||||||
|
NULL, NULL,
|
||||||
|
NULL,
|
||||||
|
G_TYPE_NONE, 1, GTK_TYPE_CONSTRAINT);
|
||||||
|
|
||||||
|
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||||
|
|
||||||
|
gtk_widget_class_set_template_from_resource (widget_class,
|
||||||
|
"/org/gtk/gtk4/constraint-editor/constraint-editor.ui");
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, grid);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, target);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, target_attr);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, relation);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, source);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, source_attr);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, multiplier);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, constant);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, strength);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, preview);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, button);
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, update_preview);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, update_button);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, create_constraint);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, source_attr_changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConstraintEditor *
|
||||||
|
constraint_editor_new (GListModel *model,
|
||||||
|
GtkConstraint *constraint)
|
||||||
|
{
|
||||||
|
return g_object_new (CONSTRAINT_EDITOR_TYPE,
|
||||||
|
"model", model,
|
||||||
|
"constraint", constraint,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
12
demos/constraint-editor/constraint-editor.css
Normal file
12
demos/constraint-editor/constraint-editor.css
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
constraintview {
|
||||||
|
background: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
constraintview .child {
|
||||||
|
background: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
constraintview .guide {
|
||||||
|
background: blue;
|
||||||
|
}
|
||||||
9
demos/constraint-editor/constraint-editor.gresource.xml
Normal file
9
demos/constraint-editor/constraint-editor.gresource.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<gresources>
|
||||||
|
<gresource prefix="/org/gtk/gtk4/constraint-editor">
|
||||||
|
<file preprocess="xml-stripblanks">constraint-editor-window.ui</file>
|
||||||
|
<file preprocess="xml-stripblanks">constraint-editor.ui</file>
|
||||||
|
<file preprocess="xml-stripblanks">guide-editor.ui</file>
|
||||||
|
<file>constraint-editor.css</file>
|
||||||
|
</gresource>
|
||||||
|
</gresources>
|
||||||
34
demos/constraint-editor/constraint-editor.h
Normal file
34
demos/constraint-editor/constraint-editor.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#define CONSTRAINT_EDITOR_TYPE (constraint_editor_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (ConstraintEditor, constraint_editor, CONSTRAINT, EDITOR, GtkWidget)
|
||||||
|
|
||||||
|
ConstraintEditor * constraint_editor_new (GListModel *model,
|
||||||
|
GtkConstraint *constraint);
|
||||||
|
|
||||||
|
void constraint_editor_serialize_constraint (GString *str,
|
||||||
|
int indent,
|
||||||
|
GtkConstraint *constraint);
|
||||||
|
char *constraint_editor_constraint_to_string (GtkConstraint *constraint);
|
||||||
163
demos/constraint-editor/constraint-editor.ui
Normal file
163
demos/constraint-editor/constraint-editor.ui
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<template class="ConstraintEditor" parent="GtkWidget">
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="grid">
|
||||||
|
<property name="margin">20</property>
|
||||||
|
<property name="row-spacing">10</property>
|
||||||
|
<property name="column-spacing">10</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Target</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBoxText" id="target">
|
||||||
|
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||||
|
<signal name="changed" handler="update_button" swapped="yes"/>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBoxText" id="target_attr">
|
||||||
|
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Relation</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBoxText" id="relation">
|
||||||
|
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Source</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBoxText" id="source">
|
||||||
|
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||||
|
<signal name="changed" handler="update_button" swapped="yes"/>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBoxText" id="source_attr">
|
||||||
|
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||||
|
<signal name="changed" handler="source_attr_changed" swapped="yes"/>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Multiplier</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">4</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="multiplier">
|
||||||
|
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">4</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Constant</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">5</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="constant">
|
||||||
|
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">5</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Strength</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">6</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBoxText" id="strength">
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">6</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="preview">
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">7</property>
|
||||||
|
<property name="column-span">2</property>
|
||||||
|
</layout>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="scale" value="1.44"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button">
|
||||||
|
<property name="label">Create</property>
|
||||||
|
<signal name="clicked" handler="create_constraint"/>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">8</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</template>
|
||||||
|
</interface>
|
||||||
93
demos/constraint-editor/constraint-view-child.c
Normal file
93
demos/constraint-editor/constraint-view-child.c
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "constraint-view-child.h"
|
||||||
|
|
||||||
|
struct _ConstraintViewChild
|
||||||
|
{
|
||||||
|
GObject parent_instance;
|
||||||
|
|
||||||
|
char *name;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_NAME = 1,
|
||||||
|
LAST_PROP
|
||||||
|
};
|
||||||
|
|
||||||
|
static GParamSpec props[LAST_PROP];
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (ConstraintViewChild, constraint_view_child, G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_view_child_init (ConstraintViewChild *child)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_view_child_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
ConstraintViewChild *child = CONSTRAINT_VIEW_CHILD (object);
|
||||||
|
|
||||||
|
g_free (child->name);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (constraint_view_child_parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_view_child_set_property (GObject *object,
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_view_child_class_init (ConstraintViewChildClass *class)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||||
|
|
||||||
|
object_class->finalize = constraint_view_child_finalize;
|
||||||
|
object_class->get_property = constraint_view_child_get_property;
|
||||||
|
object_class->set_property = constraint_view_child_set_property;
|
||||||
|
|
||||||
|
props[PROP_NAME] =
|
||||||
|
g_param_spec_string ("name", "name", "name",
|
||||||
|
NULL,
|
||||||
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
|
g_object_class_install_properties (object_class, LAST_PROP, props);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CONSTRAINT_VIEW_CHILD_TYPE (constraint_view_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_TYPE (ConstraintViewChild, constraint_view_child, CONSTRAINT, VIEW_CHILD, GObject)
|
||||||
|
|
||||||
|
#define CONSTRAINT_VIEW_WIDGET_TYPE (constraint_view_widget_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (ConstraintViewWidget, constraint_view_widget, CONSTRAINT, VIEW_WIDGET, ConstraintViewChild)
|
||||||
|
|
||||||
|
ConstraintViewWidget * constraint_view_widget_new (void);
|
||||||
|
|
||||||
|
#define CONSTRAINT_VIEW_GUIDE_TYPE (constraint_view_guide_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (ConstraintViewGuide, constraint_view_guide, CONSTRAINT, VIEW_GUIDE, ConstraintViewChild)
|
||||||
|
|
||||||
|
ConstraintViewGuide * constraint_view_guide_new (void);
|
||||||
|
|
||||||
|
#define CONSTRAINT_VIEW_CONSTRAINT_TYPE (constraint_view_constraint_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (ConstraintViewConstraint, constraint_view_constraint, CONSTRAINT, VIEW_CONSTRAINT, ConstraintViewChild)
|
||||||
|
|
||||||
|
ConstraintViewGuide * constraint_view_constraint_new (void);
|
||||||
44
demos/constraint-editor/constraint-view-child.h
Normal file
44
demos/constraint-editor/constraint-view-child.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#define CONSTRAINT_VIEW_CHILD_TYPE (constraint_view_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_TYPE (ConstraintViewChild, constraint_view_child, CONSTRAINT, VIEW_CHILD, GObject)
|
||||||
|
|
||||||
|
#define CONSTRAINT_VIEW_WIDGET_TYPE (constraint_view_widget_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (ConstraintViewWidget, constraint_view_widget, CONSTRAINT, VIEW_WIDGET, ConstraintViewChild)
|
||||||
|
|
||||||
|
ConstraintViewWidget * constraint_view_widget_new (void);
|
||||||
|
|
||||||
|
#define CONSTRAINT_VIEW_GUIDE_TYPE (constraint_view_guide_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (ConstraintViewGuide, constraint_view_guide, CONSTRAINT, VIEW_GUIDE, ConstraintViewChild)
|
||||||
|
|
||||||
|
ConstraintViewGuide * constraint_view_guide_new (void);
|
||||||
|
|
||||||
|
#define CONSTRAINT_VIEW_CONSTRAINT_TYPE (constraint_view_constraint_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (ConstraintViewConstraint, constraint_view_constraint, CONSTRAINT, VIEW_CONSTRAINT, ConstraintViewChild)
|
||||||
|
|
||||||
|
ConstraintViewGuide * constraint_view_constraint_new (void);
|
||||||
343
demos/constraint-editor/constraint-view.c
Normal file
343
demos/constraint-editor/constraint-view.c
Normal file
@@ -0,0 +1,343 @@
|
|||||||
|
/* Copyright (C) 2019 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include "constraint-view.h"
|
||||||
|
|
||||||
|
struct _ConstraintView
|
||||||
|
{
|
||||||
|
GtkWidget parent;
|
||||||
|
|
||||||
|
GListModel *model;
|
||||||
|
|
||||||
|
GtkWidget *drag_widget;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (ConstraintView, constraint_view, GTK_TYPE_WIDGET);
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_view_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
ConstraintView *view = CONSTRAINT_VIEW (object);
|
||||||
|
GtkWidget *child;
|
||||||
|
|
||||||
|
while ((child = gtk_widget_get_first_child (GTK_WIDGET (view))) != NULL)
|
||||||
|
gtk_widget_unparent (child);
|
||||||
|
|
||||||
|
g_clear_object (&view->model);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (constraint_view_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_view_class_init (ConstraintViewClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->dispose = constraint_view_dispose;
|
||||||
|
|
||||||
|
gtk_widget_class_set_css_name (widget_class, "constraintview");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_weak_position (ConstraintView *self,
|
||||||
|
GtkWidget *child,
|
||||||
|
double x,
|
||||||
|
double y)
|
||||||
|
{
|
||||||
|
GtkLayoutManager *manager;
|
||||||
|
GtkConstraint *constraint;
|
||||||
|
|
||||||
|
manager = gtk_widget_get_layout_manager (GTK_WIDGET (self));
|
||||||
|
constraint = (GtkConstraint *)g_object_get_data (G_OBJECT (child), "x-constraint");
|
||||||
|
if (constraint)
|
||||||
|
{
|
||||||
|
gtk_constraint_layout_remove_constraint (GTK_CONSTRAINT_LAYOUT (manager),
|
||||||
|
constraint);
|
||||||
|
g_object_set_data (G_OBJECT (child), "x-constraint", NULL);
|
||||||
|
}
|
||||||
|
if (x != -100)
|
||||||
|
{
|
||||||
|
constraint = gtk_constraint_new_constant (child,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_CENTER_X,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
x,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_WEAK);
|
||||||
|
g_object_set_data (G_OBJECT (constraint), "internal", "yes");
|
||||||
|
gtk_constraint_layout_add_constraint (GTK_CONSTRAINT_LAYOUT (manager),
|
||||||
|
constraint);
|
||||||
|
g_object_set_data (G_OBJECT (child), "x-constraint", constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
constraint = (GtkConstraint *)g_object_get_data (G_OBJECT (child), "y-constraint");
|
||||||
|
if (constraint)
|
||||||
|
{
|
||||||
|
gtk_constraint_layout_remove_constraint (GTK_CONSTRAINT_LAYOUT (manager),
|
||||||
|
constraint);
|
||||||
|
g_object_set_data (G_OBJECT (child), "y-constraint", NULL);
|
||||||
|
}
|
||||||
|
if (y != -100)
|
||||||
|
{
|
||||||
|
constraint = gtk_constraint_new_constant (child,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_CENTER_Y,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
y,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_WEAK);
|
||||||
|
g_object_set_data (G_OBJECT (constraint), "internal", "yes");
|
||||||
|
gtk_constraint_layout_add_constraint (GTK_CONSTRAINT_LAYOUT (manager),
|
||||||
|
constraint);
|
||||||
|
g_object_set_data (G_OBJECT (child), "y-constraint", constraint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
drag_begin (GtkGestureDrag *drag,
|
||||||
|
double start_x,
|
||||||
|
double start_y,
|
||||||
|
ConstraintView *self)
|
||||||
|
{
|
||||||
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
widget = gtk_widget_pick (GTK_WIDGET (self), start_x, start_y, GTK_PICK_DEFAULT);
|
||||||
|
|
||||||
|
if (GTK_IS_LABEL (widget))
|
||||||
|
{
|
||||||
|
widget = gtk_widget_get_ancestor (widget, GTK_TYPE_FRAME);
|
||||||
|
if (widget &&
|
||||||
|
gtk_widget_get_parent (widget) == (GtkWidget *)self)
|
||||||
|
{
|
||||||
|
self->drag_widget = widget;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
drag_update (GtkGestureDrag *drag,
|
||||||
|
double offset_x,
|
||||||
|
double offset_y,
|
||||||
|
ConstraintView *self)
|
||||||
|
{
|
||||||
|
double x, y;
|
||||||
|
|
||||||
|
if (!self->drag_widget)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_gesture_drag_get_start_point (drag, &x, &y);
|
||||||
|
update_weak_position (self, self->drag_widget, x + offset_x, y + offset_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
drag_end (GtkGestureDrag *drag,
|
||||||
|
double offset_x,
|
||||||
|
double offset_y,
|
||||||
|
ConstraintView *self)
|
||||||
|
{
|
||||||
|
self->drag_widget = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
omit_internal (gpointer item, gpointer user_data)
|
||||||
|
{
|
||||||
|
if (g_object_get_data (G_OBJECT (item), "internal"))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
constraint_view_init (ConstraintView *self)
|
||||||
|
{
|
||||||
|
GtkLayoutManager *manager;
|
||||||
|
GtkEventController *controller;
|
||||||
|
GListStore *list;
|
||||||
|
GListModel *all_children;
|
||||||
|
GListModel *all_constraints;
|
||||||
|
GListModel *guides;
|
||||||
|
GListModel *children;
|
||||||
|
GListModel *constraints;
|
||||||
|
|
||||||
|
manager = gtk_constraint_layout_new ();
|
||||||
|
gtk_widget_set_layout_manager (GTK_WIDGET (self), manager);
|
||||||
|
|
||||||
|
all_children = gtk_widget_observe_children (GTK_WIDGET (self));
|
||||||
|
all_constraints = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (manager));
|
||||||
|
guides = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (manager));
|
||||||
|
constraints = (GListModel *)gtk_filter_list_model_new (all_constraints, omit_internal, NULL, NULL);
|
||||||
|
children = (GListModel *)gtk_filter_list_model_new (all_children, omit_internal, NULL, NULL);
|
||||||
|
|
||||||
|
list = g_list_store_new (G_TYPE_LIST_MODEL);
|
||||||
|
g_list_store_append (list, children);
|
||||||
|
g_list_store_append (list, guides);
|
||||||
|
g_list_store_append (list, constraints);
|
||||||
|
self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_TYPE_OBJECT, G_LIST_MODEL (list)));
|
||||||
|
g_object_unref (children);
|
||||||
|
g_object_unref (guides);
|
||||||
|
g_object_unref (constraints);
|
||||||
|
g_object_unref (all_children);
|
||||||
|
g_object_unref (all_constraints);
|
||||||
|
g_object_unref (list);
|
||||||
|
|
||||||
|
|
||||||
|
controller = (GtkEventController *)gtk_gesture_drag_new ();
|
||||||
|
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);
|
||||||
|
g_signal_connect (controller, "drag-update", G_CALLBACK (drag_update), self);
|
||||||
|
g_signal_connect (controller, "drag-end", G_CALLBACK (drag_end), self);
|
||||||
|
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConstraintView *
|
||||||
|
constraint_view_new (void)
|
||||||
|
{
|
||||||
|
return g_object_new (CONSTRAINT_VIEW_TYPE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
constraint_view_add_child (ConstraintView *view,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
GtkWidget *frame;
|
||||||
|
GtkWidget *label;
|
||||||
|
|
||||||
|
label = gtk_label_new (name);
|
||||||
|
frame = gtk_frame_new (NULL);
|
||||||
|
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "child");
|
||||||
|
gtk_widget_set_name (frame, name);
|
||||||
|
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||||
|
gtk_widget_set_parent (frame, GTK_WIDGET (view));
|
||||||
|
|
||||||
|
update_weak_position (view, frame, 100, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
constraint_view_remove_child (ConstraintView *view,
|
||||||
|
GtkWidget *child)
|
||||||
|
{
|
||||||
|
update_weak_position (view, child, -100, -100);
|
||||||
|
gtk_widget_unparent (child);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
constraint_view_add_guide (ConstraintView *view,
|
||||||
|
GtkConstraintGuide *guide)
|
||||||
|
{
|
||||||
|
GtkConstraintLayout *layout;
|
||||||
|
GtkWidget *frame;
|
||||||
|
GtkWidget *label;
|
||||||
|
const char *name;
|
||||||
|
GtkConstraint *constraint;
|
||||||
|
struct {
|
||||||
|
const char *name;
|
||||||
|
GtkConstraintAttribute attr;
|
||||||
|
} names[] = {
|
||||||
|
{ "left-constraint", GTK_CONSTRAINT_ATTRIBUTE_LEFT },
|
||||||
|
{ "top-constraint", GTK_CONSTRAINT_ATTRIBUTE_TOP },
|
||||||
|
{ "width-constraint", GTK_CONSTRAINT_ATTRIBUTE_WIDTH },
|
||||||
|
{ "height-constraint", GTK_CONSTRAINT_ATTRIBUTE_HEIGHT },
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
|
||||||
|
name = gtk_constraint_guide_get_name (guide);
|
||||||
|
label = gtk_label_new (name);
|
||||||
|
g_object_bind_property (guide, "name",
|
||||||
|
label, "label",
|
||||||
|
G_BINDING_DEFAULT);
|
||||||
|
|
||||||
|
frame = gtk_frame_new (NULL);
|
||||||
|
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "guide");
|
||||||
|
g_object_set_data (G_OBJECT (frame), "internal", "yes");
|
||||||
|
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||||
|
gtk_widget_insert_after (frame, GTK_WIDGET (view), NULL);
|
||||||
|
|
||||||
|
g_object_set_data (G_OBJECT (guide), "frame", frame);
|
||||||
|
|
||||||
|
layout = GTK_CONSTRAINT_LAYOUT (gtk_widget_get_layout_manager (GTK_WIDGET (view)));
|
||||||
|
gtk_constraint_layout_add_guide (layout, g_object_ref (guide));
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (names); i++)
|
||||||
|
{
|
||||||
|
constraint = gtk_constraint_new (frame,
|
||||||
|
names[i].attr,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
guide,
|
||||||
|
names[i].attr,
|
||||||
|
1.0, 0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED);
|
||||||
|
g_object_set_data (G_OBJECT (constraint), "internal", "yes");
|
||||||
|
gtk_constraint_layout_add_constraint (layout, constraint);
|
||||||
|
g_object_set_data (G_OBJECT (guide), names[i].name, constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
update_weak_position (view, frame, 150, 150);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
constraint_view_remove_guide (ConstraintView *view,
|
||||||
|
GtkConstraintGuide *guide)
|
||||||
|
{
|
||||||
|
GtkConstraintLayout *layout;
|
||||||
|
GtkWidget *frame;
|
||||||
|
GtkConstraint *constraint;
|
||||||
|
const char *names[] = {
|
||||||
|
"left-constraint",
|
||||||
|
"top-constraint",
|
||||||
|
"width-constraint",
|
||||||
|
"height-constraint"
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
|
||||||
|
layout = GTK_CONSTRAINT_LAYOUT (gtk_widget_get_layout_manager (GTK_WIDGET (view)));
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (names); i++)
|
||||||
|
{
|
||||||
|
constraint = (GtkConstraint*)g_object_get_data (G_OBJECT (guide), names[i]);
|
||||||
|
gtk_constraint_layout_remove_constraint (layout, constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
frame = (GtkWidget *)g_object_get_data (G_OBJECT (guide), "frame");
|
||||||
|
update_weak_position (view, frame, -100, -100);
|
||||||
|
gtk_widget_unparent (frame);
|
||||||
|
|
||||||
|
gtk_constraint_layout_remove_guide (layout, guide);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
constraint_view_add_constraint (ConstraintView *view,
|
||||||
|
GtkConstraint *constraint)
|
||||||
|
{
|
||||||
|
GtkLayoutManager *manager;
|
||||||
|
|
||||||
|
manager = gtk_widget_get_layout_manager (GTK_WIDGET (view));
|
||||||
|
gtk_constraint_layout_add_constraint (GTK_CONSTRAINT_LAYOUT (manager),
|
||||||
|
g_object_ref (constraint));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
constraint_view_remove_constraint (ConstraintView *view,
|
||||||
|
GtkConstraint *constraint)
|
||||||
|
{
|
||||||
|
GtkLayoutManager *manager;
|
||||||
|
|
||||||
|
manager = gtk_widget_get_layout_manager (GTK_WIDGET (view));
|
||||||
|
gtk_constraint_layout_remove_constraint (GTK_CONSTRAINT_LAYOUT (manager),
|
||||||
|
constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
GListModel *
|
||||||
|
constraint_view_get_model (ConstraintView *view)
|
||||||
|
{
|
||||||
|
return view->model;
|
||||||
|
}
|
||||||
44
demos/constraint-editor/constraint-view.h
Normal file
44
demos/constraint-editor/constraint-view.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#define CONSTRAINT_VIEW_TYPE (constraint_view_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (ConstraintView, constraint_view, CONSTRAINT, VIEW, GtkWidget)
|
||||||
|
|
||||||
|
ConstraintView * constraint_view_new (void);
|
||||||
|
|
||||||
|
void constraint_view_add_child (ConstraintView *view,
|
||||||
|
const char *name);
|
||||||
|
void constraint_view_remove_child (ConstraintView *view,
|
||||||
|
GtkWidget *child);
|
||||||
|
void constraint_view_add_guide (ConstraintView *view,
|
||||||
|
GtkConstraintGuide *guide);
|
||||||
|
void constraint_view_remove_guide (ConstraintView *view,
|
||||||
|
GtkConstraintGuide *guide);
|
||||||
|
void constraint_view_guide_changed (ConstraintView *view,
|
||||||
|
GtkConstraintGuide *guide);
|
||||||
|
void constraint_view_add_constraint (ConstraintView *view,
|
||||||
|
GtkConstraint *constraint);
|
||||||
|
void constraint_view_remove_constraint (ConstraintView *view,
|
||||||
|
GtkConstraint *constraint);
|
||||||
|
GListModel * constraint_view_get_model (ConstraintView *view);
|
||||||
411
demos/constraint-editor/guide-editor.c
Normal file
411
demos/constraint-editor/guide-editor.c
Normal file
@@ -0,0 +1,411 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "guide-editor.h"
|
||||||
|
|
||||||
|
struct _GuideEditor
|
||||||
|
{
|
||||||
|
GtkWidget parent_instance;
|
||||||
|
|
||||||
|
GtkWidget *grid;
|
||||||
|
GtkWidget *name;
|
||||||
|
GtkWidget *min_width;
|
||||||
|
GtkWidget *min_height;
|
||||||
|
GtkWidget *nat_width;
|
||||||
|
GtkWidget *nat_height;
|
||||||
|
GtkWidget *max_width;
|
||||||
|
GtkWidget *max_height;
|
||||||
|
GtkWidget *strength;
|
||||||
|
GtkWidget *button;
|
||||||
|
|
||||||
|
GtkConstraintGuide *guide;
|
||||||
|
|
||||||
|
gboolean constructed;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_GUIDE = 1,
|
||||||
|
LAST_PROP
|
||||||
|
};
|
||||||
|
|
||||||
|
static GParamSpec *pspecs[LAST_PROP];
|
||||||
|
|
||||||
|
enum {
|
||||||
|
DONE,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint signals[LAST_SIGNAL];
|
||||||
|
|
||||||
|
G_DEFINE_TYPE(GuideEditor, guide_editor, GTK_TYPE_WIDGET);
|
||||||
|
|
||||||
|
static void
|
||||||
|
guide_strength_combo (GtkWidget *combo)
|
||||||
|
{
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "weak", "Weak");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "medium", "Medium");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "strong", "Strong");
|
||||||
|
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "required", "Required");
|
||||||
|
}
|
||||||
|
|
||||||
|
static GtkConstraintStrength
|
||||||
|
get_strength (const char *id)
|
||||||
|
{
|
||||||
|
GtkConstraintStrength strength;
|
||||||
|
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_STRENGTH);
|
||||||
|
GEnumValue *value = g_enum_get_value_by_nick (class, id);
|
||||||
|
strength = value->value;
|
||||||
|
g_type_class_unref (class);
|
||||||
|
|
||||||
|
return strength;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
get_strength_nick (GtkConstraintStrength strength)
|
||||||
|
{
|
||||||
|
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_STRENGTH);
|
||||||
|
GEnumValue *value = g_enum_get_value (class, strength);
|
||||||
|
const char *nick = value->value_nick;
|
||||||
|
g_type_class_unref (class);
|
||||||
|
|
||||||
|
return nick;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
guide_editor_serialize_guide (GString *str,
|
||||||
|
int indent,
|
||||||
|
GtkConstraintGuide *guide)
|
||||||
|
{
|
||||||
|
int min_width, min_height;
|
||||||
|
int nat_width, nat_height;
|
||||||
|
int max_width, max_height;
|
||||||
|
const char *name;
|
||||||
|
const char *strength;
|
||||||
|
|
||||||
|
gtk_constraint_guide_get_min_size (guide, &min_width, &min_height);
|
||||||
|
gtk_constraint_guide_get_nat_size (guide, &nat_width, &nat_height);
|
||||||
|
gtk_constraint_guide_get_max_size (guide, &max_width, &max_height);
|
||||||
|
name = gtk_constraint_guide_get_name (guide);
|
||||||
|
strength = get_strength_nick (gtk_constraint_guide_get_strength (guide));
|
||||||
|
|
||||||
|
g_string_append_printf (str, "%*s<guide min-width=\"%d\" min-height=\"%d\"\n", indent, "", min_width, min_height);
|
||||||
|
g_string_append_printf (str, "%*s nat-width=\"%d\" nat-height=\"%d\"\n", indent, "", nat_width, nat_height);
|
||||||
|
g_string_append_printf (str, "%*s max-width=\"%d\" max-height=\"%d\"\n", indent, "", max_width, max_height);
|
||||||
|
g_string_append_printf (str, "%*s name=\"%s\" strength=\"%s\" />\n", indent, "", name, strength);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
create_guide (GtkButton *button,
|
||||||
|
GuideEditor *editor)
|
||||||
|
{
|
||||||
|
const char *id;
|
||||||
|
int strength;
|
||||||
|
const char *name;
|
||||||
|
int w, h;
|
||||||
|
GtkConstraintGuide *guide;
|
||||||
|
|
||||||
|
if (editor->guide)
|
||||||
|
guide = g_object_ref (editor->guide);
|
||||||
|
else
|
||||||
|
guide = gtk_constraint_guide_new ();
|
||||||
|
|
||||||
|
name = gtk_editable_get_text (GTK_EDITABLE (editor->name));
|
||||||
|
gtk_constraint_guide_set_name (guide, name);
|
||||||
|
|
||||||
|
w = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->min_width));
|
||||||
|
h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->min_height));
|
||||||
|
gtk_constraint_guide_set_min_size (guide, w, h);
|
||||||
|
|
||||||
|
w = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->nat_width));
|
||||||
|
h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->nat_height));
|
||||||
|
gtk_constraint_guide_set_nat_size (guide, w, h);
|
||||||
|
|
||||||
|
w = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->max_width));
|
||||||
|
h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->max_height));
|
||||||
|
gtk_constraint_guide_set_max_size (guide, w, h);
|
||||||
|
|
||||||
|
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->strength));
|
||||||
|
strength = get_strength (id);
|
||||||
|
gtk_constraint_guide_set_strength (guide, strength);
|
||||||
|
|
||||||
|
g_signal_emit (editor, signals[DONE], 0, guide);
|
||||||
|
g_object_unref (guide);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
guide_editor_init (GuideEditor *editor)
|
||||||
|
{
|
||||||
|
gtk_widget_init_template (GTK_WIDGET (editor));
|
||||||
|
}
|
||||||
|
|
||||||
|
static int guide_counter;
|
||||||
|
|
||||||
|
static int
|
||||||
|
min_input (GtkSpinButton *spin_button,
|
||||||
|
double *new_val)
|
||||||
|
{
|
||||||
|
if (strcmp (gtk_editable_get_text (GTK_EDITABLE (spin_button)), "") == 0)
|
||||||
|
{
|
||||||
|
*new_val = 0.0;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
max_input (GtkSpinButton *spin_button,
|
||||||
|
double *new_val)
|
||||||
|
{
|
||||||
|
if (strcmp (gtk_editable_get_text (GTK_EDITABLE (spin_button)), "") == 0)
|
||||||
|
{
|
||||||
|
*new_val = G_MAXINT;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
min_output (GtkSpinButton *spin_button)
|
||||||
|
{
|
||||||
|
GtkAdjustment *adjustment;
|
||||||
|
double value;
|
||||||
|
GtkWidget *box, *text;
|
||||||
|
|
||||||
|
adjustment = gtk_spin_button_get_adjustment (spin_button);
|
||||||
|
value = gtk_adjustment_get_value (adjustment);
|
||||||
|
|
||||||
|
box = gtk_widget_get_first_child (GTK_WIDGET (spin_button));
|
||||||
|
text = gtk_widget_get_first_child (box);
|
||||||
|
|
||||||
|
if (value == 0.0)
|
||||||
|
{
|
||||||
|
gtk_editable_set_text (GTK_EDITABLE (spin_button), "");
|
||||||
|
gtk_text_set_placeholder_text (GTK_TEXT (text), "unset");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_text_set_placeholder_text (GTK_TEXT (text), "");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
max_output (GtkSpinButton *spin_button)
|
||||||
|
{
|
||||||
|
GtkAdjustment *adjustment;
|
||||||
|
double value;
|
||||||
|
GtkWidget *box, *text;
|
||||||
|
|
||||||
|
adjustment = gtk_spin_button_get_adjustment (spin_button);
|
||||||
|
value = gtk_adjustment_get_value (adjustment);
|
||||||
|
|
||||||
|
box = gtk_widget_get_first_child (GTK_WIDGET (spin_button));
|
||||||
|
text = gtk_widget_get_first_child (box);
|
||||||
|
|
||||||
|
if (value == (double)G_MAXINT)
|
||||||
|
{
|
||||||
|
gtk_editable_set_text (GTK_EDITABLE (spin_button), "");
|
||||||
|
gtk_text_set_placeholder_text (GTK_TEXT (text), "unset");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_text_set_placeholder_text (GTK_TEXT (text), "");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
guide_editor_constructed (GObject *object)
|
||||||
|
{
|
||||||
|
GuideEditor *editor = GUIDE_EDITOR (object);
|
||||||
|
|
||||||
|
guide_strength_combo (editor->strength);
|
||||||
|
|
||||||
|
g_signal_connect (editor->min_width, "input", G_CALLBACK (min_input), NULL);
|
||||||
|
g_signal_connect (editor->min_width, "output", G_CALLBACK (min_output), NULL);
|
||||||
|
|
||||||
|
g_signal_connect (editor->min_height, "input", G_CALLBACK (min_input), NULL);
|
||||||
|
g_signal_connect (editor->min_height, "output", G_CALLBACK (min_output), NULL);
|
||||||
|
|
||||||
|
g_signal_connect (editor->max_width, "input", G_CALLBACK (max_input), NULL);
|
||||||
|
g_signal_connect (editor->max_width, "output", G_CALLBACK (max_output), NULL);
|
||||||
|
|
||||||
|
g_signal_connect (editor->max_height, "input", G_CALLBACK (max_input), NULL);
|
||||||
|
g_signal_connect (editor->max_height, "output", G_CALLBACK (max_output), NULL);
|
||||||
|
|
||||||
|
if (editor->guide)
|
||||||
|
{
|
||||||
|
GtkConstraintStrength strength;
|
||||||
|
const char *nick;
|
||||||
|
int w, h;
|
||||||
|
|
||||||
|
nick = gtk_constraint_guide_get_name (editor->guide);
|
||||||
|
if (nick)
|
||||||
|
gtk_editable_set_text (GTK_EDITABLE (editor->name), nick);
|
||||||
|
|
||||||
|
gtk_constraint_guide_get_min_size (editor->guide, &w, &h);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->min_width), w);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->min_height), h);
|
||||||
|
|
||||||
|
gtk_constraint_guide_get_nat_size (editor->guide, &w, &h);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->nat_width), w);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->nat_height), h);
|
||||||
|
|
||||||
|
gtk_constraint_guide_get_max_size (editor->guide, &w, &h);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->max_width), w);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->max_height), h);
|
||||||
|
|
||||||
|
strength = gtk_constraint_guide_get_strength (editor->guide);
|
||||||
|
nick = get_strength_nick (strength);
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->strength), nick);
|
||||||
|
|
||||||
|
gtk_button_set_label (GTK_BUTTON (editor->button), "Apply");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
guide_counter++;
|
||||||
|
name = g_strdup_printf ("Guide %d", guide_counter);
|
||||||
|
gtk_editable_set_text (GTK_EDITABLE (editor->name), name);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->min_width), 0.0);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->min_height), 0.0);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->nat_width), 0.0);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->nat_height), 0.0);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->max_width), G_MAXINT);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->max_height), G_MAXINT);
|
||||||
|
|
||||||
|
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->strength), "medium");
|
||||||
|
|
||||||
|
gtk_button_set_label (GTK_BUTTON (editor->button), "Create");
|
||||||
|
}
|
||||||
|
|
||||||
|
editor->constructed = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
guide_editor_set_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GuideEditor *self = GUIDE_EDITOR (object);
|
||||||
|
|
||||||
|
switch (property_id)
|
||||||
|
{
|
||||||
|
case PROP_GUIDE:
|
||||||
|
self->guide = g_value_dup_object (value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
guide_editor_get_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GuideEditor *self = GUIDE_EDITOR (object);
|
||||||
|
|
||||||
|
switch (property_id)
|
||||||
|
{
|
||||||
|
case PROP_GUIDE:
|
||||||
|
g_value_set_object (value, self->guide);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
guide_editor_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
GuideEditor *self = (GuideEditor *)object;
|
||||||
|
|
||||||
|
g_clear_pointer (&self->grid, gtk_widget_unparent);
|
||||||
|
g_clear_object (&self->guide);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (guide_editor_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
guide_editor_class_init (GuideEditorClass *class)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||||
|
|
||||||
|
object_class->constructed = guide_editor_constructed;
|
||||||
|
object_class->dispose = guide_editor_dispose;
|
||||||
|
object_class->set_property = guide_editor_set_property;
|
||||||
|
object_class->get_property = guide_editor_get_property;
|
||||||
|
|
||||||
|
pspecs[PROP_GUIDE] =
|
||||||
|
g_param_spec_object ("guide", "guide", "guide",
|
||||||
|
GTK_TYPE_CONSTRAINT_GUIDE,
|
||||||
|
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
|
||||||
|
g_object_class_install_properties (object_class, LAST_PROP, pspecs);
|
||||||
|
|
||||||
|
signals[DONE] =
|
||||||
|
g_signal_new ("done",
|
||||||
|
G_TYPE_FROM_CLASS (object_class),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
0,
|
||||||
|
NULL, NULL,
|
||||||
|
NULL,
|
||||||
|
G_TYPE_NONE, 1, GTK_TYPE_CONSTRAINT_GUIDE);
|
||||||
|
|
||||||
|
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||||
|
|
||||||
|
gtk_widget_class_set_template_from_resource (widget_class,
|
||||||
|
"/org/gtk/gtk4/constraint-editor/guide-editor.ui");
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GuideEditor, grid);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GuideEditor, name);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GuideEditor, min_width);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GuideEditor, min_height);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GuideEditor, nat_width);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GuideEditor, nat_height);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GuideEditor, max_width);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GuideEditor, max_height);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GuideEditor, strength);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, GuideEditor, button);
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, create_guide);
|
||||||
|
}
|
||||||
|
|
||||||
|
GuideEditor *
|
||||||
|
guide_editor_new (GtkConstraintGuide *guide)
|
||||||
|
{
|
||||||
|
return g_object_new (GUIDE_EDITOR_TYPE,
|
||||||
|
"guide", guide,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
32
demos/constraint-editor/guide-editor.h
Normal file
32
demos/constraint-editor/guide-editor.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#define GUIDE_EDITOR_TYPE (guide_editor_get_type ())
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (GuideEditor, guide_editor, GUIDE, EDITOR, GtkWidget)
|
||||||
|
|
||||||
|
GuideEditor * guide_editor_new (GtkConstraintGuide *guide);
|
||||||
|
|
||||||
|
void guide_editor_serialize_guide (GString *str,
|
||||||
|
int indent,
|
||||||
|
GtkConstraintGuide *guide);
|
||||||
188
demos/constraint-editor/guide-editor.ui
Normal file
188
demos/constraint-editor/guide-editor.ui
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<object class="GtkAdjustment" id="min_width_adj">
|
||||||
|
<property name="lower">0</property>
|
||||||
|
<property name="upper">2147483647</property>
|
||||||
|
<property name="step-increment">1</property>
|
||||||
|
<property name="page-increment">10</property>
|
||||||
|
<property name="page-size">0</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkAdjustment" id="min_height_adj">
|
||||||
|
<property name="lower">0</property>
|
||||||
|
<property name="upper">2147483647</property>
|
||||||
|
<property name="step-increment">1</property>
|
||||||
|
<property name="page-increment">10</property>
|
||||||
|
<property name="page-size">0</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkAdjustment" id="nat_width_adj">
|
||||||
|
<property name="lower">0</property>
|
||||||
|
<property name="upper">2147483647</property>
|
||||||
|
<property name="step-increment">1</property>
|
||||||
|
<property name="page-increment">10</property>
|
||||||
|
<property name="page-size">0</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkAdjustment" id="nat_height_adj">
|
||||||
|
<property name="lower">0</property>
|
||||||
|
<property name="upper">2147483647</property>
|
||||||
|
<property name="step-increment">1</property>
|
||||||
|
<property name="page-increment">10</property>
|
||||||
|
<property name="page-size">0</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkAdjustment" id="max_width_adj">
|
||||||
|
<property name="lower">0</property>
|
||||||
|
<property name="upper">2147483647</property>
|
||||||
|
<property name="step-increment">1</property>
|
||||||
|
<property name="page-increment">10</property>
|
||||||
|
<property name="page-size">0</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkAdjustment" id="max_height_adj">
|
||||||
|
<property name="lower">0</property>
|
||||||
|
<property name="upper">2147483647</property>
|
||||||
|
<property name="step-increment">1</property>
|
||||||
|
<property name="page-increment">10</property>
|
||||||
|
<property name="page-size">0</property>
|
||||||
|
</object>
|
||||||
|
<template class="GuideEditor" parent="GtkWidget">
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="grid">
|
||||||
|
<property name="margin">20</property>
|
||||||
|
<property name="row-spacing">10</property>
|
||||||
|
<property name="column-spacing">10</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Name</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="name">
|
||||||
|
<property name="max-width-chars">20</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
<property name="column-span">2</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Min Size</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSpinButton" id="min_width">
|
||||||
|
<property name="adjustment">min_width_adj</property>
|
||||||
|
<property name="max-width-chars">5</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSpinButton" id="min_height">
|
||||||
|
<property name="adjustment">min_height_adj</property>
|
||||||
|
<property name="max-width-chars">5</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Nat Size</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSpinButton" id="nat_width">
|
||||||
|
<property name="adjustment">nat_width_adj</property>
|
||||||
|
<property name="max-width-chars">5</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSpinButton" id="nat_height">
|
||||||
|
<property name="adjustment">nat_height_adj</property>
|
||||||
|
<property name="max-width-chars">5</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Max Size</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSpinButton" id="max_width">
|
||||||
|
<property name="adjustment">max_width_adj</property>
|
||||||
|
<property name="max-width-chars">5</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSpinButton" id="max_height">
|
||||||
|
<property name="adjustment">max_height_adj</property>
|
||||||
|
<property name="max-width-chars">5</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Strength</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">4</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBoxText" id="strength">
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">4</property>
|
||||||
|
<property name="column-span">2</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button">
|
||||||
|
<property name="label">Create</property>
|
||||||
|
<signal name="clicked" handler="create_guide"/>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">5</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</template>
|
||||||
|
</interface>
|
||||||
28
demos/constraint-editor/main.c
Normal file
28
demos/constraint-editor/main.c
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2019 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: Matthias Clasen <mclasen@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <constraint-editor-application.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char *argv[])
|
||||||
|
{
|
||||||
|
return g_application_run (G_APPLICATION (constraint_editor_application_new ()), argc, argv);
|
||||||
|
}
|
||||||
20
demos/constraint-editor/meson.build
Normal file
20
demos/constraint-editor/meson.build
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
constraint_editor_sources = [
|
||||||
|
'main.c',
|
||||||
|
'constraint-editor-application.c',
|
||||||
|
'constraint-editor-window.c',
|
||||||
|
'constraint-view.c',
|
||||||
|
'constraint-editor.c',
|
||||||
|
'guide-editor.c',
|
||||||
|
]
|
||||||
|
|
||||||
|
constraint_editor_resources = gnome.compile_resources('constraint_editor_resources',
|
||||||
|
'constraint-editor.gresource.xml',
|
||||||
|
source_dir: '.')
|
||||||
|
|
||||||
|
executable('gtk4-constraint-editor',
|
||||||
|
constraint_editor_sources, constraint_editor_resources,
|
||||||
|
dependencies: libgtk_dep,
|
||||||
|
include_directories: confinc,
|
||||||
|
gui_app: true,
|
||||||
|
link_args: extra_demo_ldflags,
|
||||||
|
install: false)
|
||||||
@@ -419,7 +419,7 @@ demo_application_window_load_state (DemoApplicationWindow *win)
|
|||||||
static void
|
static void
|
||||||
demo_application_window_init (DemoApplicationWindow *window)
|
demo_application_window_init (DemoApplicationWindow *window)
|
||||||
{
|
{
|
||||||
GtkWidget *menu;
|
GtkWidget *popover;
|
||||||
|
|
||||||
window->width = -1;
|
window->width = -1;
|
||||||
window->height = -1;
|
window->height = -1;
|
||||||
@@ -428,8 +428,8 @@ demo_application_window_init (DemoApplicationWindow *window)
|
|||||||
|
|
||||||
gtk_widget_init_template (GTK_WIDGET (window));
|
gtk_widget_init_template (GTK_WIDGET (window));
|
||||||
|
|
||||||
menu = gtk_menu_new_from_model (window->toolmenu);
|
popover = gtk_popover_menu_new_from_model (window->menutool, window->toolmenu);
|
||||||
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (window->menutool), menu);
|
gtk_menu_tool_button_set_popover (GTK_MENU_TOOL_BUTTON (window->menutool), popover);
|
||||||
|
|
||||||
g_action_map_add_action_entries (G_ACTION_MAP (window),
|
g_action_map_add_action_entries (G_ACTION_MAP (window),
|
||||||
win_entries, G_N_ELEMENTS (win_entries),
|
win_entries, G_N_ELEMENTS (win_entries),
|
||||||
|
|||||||
@@ -43,25 +43,17 @@
|
|||||||
<object class="GtkInfoBar" id="infobar">
|
<object class="GtkInfoBar" id="infobar">
|
||||||
<property name="visible">0</property>
|
<property name="visible">0</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<child internal-child="content_area">
|
<child>
|
||||||
<object class="GtkBox" id="content_area">
|
<object class="GtkLabel" id="message">
|
||||||
<child>
|
<property name="hexpand">1</property>
|
||||||
<object class="GtkLabel" id="message">
|
|
||||||
<property name="hexpand">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child internal-child="action_area">
|
<child type="action">
|
||||||
<object class="GtkBox">
|
<object class="GtkButton">
|
||||||
<child>
|
<property name="valign">center</property>
|
||||||
<object class="GtkButton">
|
<property name="label" translatable="yes">_OK</property>
|
||||||
<property name="valign">center</property>
|
<property name="use-underline">1</property>
|
||||||
<property name="label" translatable="yes">_OK</property>
|
<signal name="clicked" handler="clicked_cb"/>
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<signal name="clicked" handler="clicked_cb"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<layout>
|
<layout>
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ create_page1 (GtkWidget *assistant)
|
|||||||
GtkWidget *box, *label, *entry;
|
GtkWidget *box, *label, *entry;
|
||||||
|
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
||||||
|
g_object_set (box, "margin", 12, NULL);
|
||||||
|
|
||||||
label = gtk_label_new ("You must fill out this entry to continue:");
|
label = gtk_label_new ("You must fill out this entry to continue:");
|
||||||
gtk_container_add (GTK_CONTAINER (box), label);
|
gtk_container_add (GTK_CONTAINER (box), label);
|
||||||
@@ -115,10 +116,12 @@ create_page2 (GtkWidget *assistant)
|
|||||||
{
|
{
|
||||||
GtkWidget *box, *checkbutton;
|
GtkWidget *box, *checkbutton;
|
||||||
|
|
||||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
||||||
|
g_object_set (box, "margin", 12, NULL);
|
||||||
|
|
||||||
checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue "
|
checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue "
|
||||||
"even if you do not check this");
|
"even if you do not check this");
|
||||||
|
gtk_widget_set_valign (checkbutton, GTK_ALIGN_CENTER);
|
||||||
gtk_container_add (GTK_CONTAINER (box), checkbutton);
|
gtk_container_add (GTK_CONTAINER (box), checkbutton);
|
||||||
|
|
||||||
gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);
|
gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);
|
||||||
|
|||||||
@@ -38,7 +38,22 @@ help_activate (GSimpleAction *action,
|
|||||||
g_print ("Help not available\n");
|
g_print ("Help not available\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
not_implemented (GSimpleAction *action,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
g_print ("Action “%s” not implemented\n", g_action_get_name (G_ACTION (action)));
|
||||||
|
}
|
||||||
|
|
||||||
static GActionEntry win_entries[] = {
|
static GActionEntry win_entries[] = {
|
||||||
|
{ "new", not_implemented, NULL, NULL, NULL },
|
||||||
|
{ "open", not_implemented, NULL, NULL, NULL },
|
||||||
|
{ "save", not_implemented, NULL, NULL, NULL },
|
||||||
|
{ "save-as", not_implemented, NULL, NULL, NULL },
|
||||||
|
{ "copy", not_implemented, NULL, NULL, NULL },
|
||||||
|
{ "cut", not_implemented, NULL, NULL, NULL },
|
||||||
|
{ "paste", not_implemented, NULL, NULL, NULL },
|
||||||
{ "quit", quit_activate, NULL, NULL, NULL },
|
{ "quit", quit_activate, NULL, NULL, NULL },
|
||||||
{ "about", about_activate, NULL, NULL, NULL },
|
{ "about", about_activate, NULL, NULL, NULL },
|
||||||
{ "help", help_activate, NULL, NULL, NULL }
|
{ "help", help_activate, NULL, NULL, NULL }
|
||||||
@@ -50,8 +65,6 @@ do_builder (GtkWidget *do_widget)
|
|||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
GtkWidget *toolbar;
|
GtkWidget *toolbar;
|
||||||
GActionGroup *actions;
|
GActionGroup *actions;
|
||||||
GtkAccelGroup *accel_group;
|
|
||||||
GtkWidget *item;
|
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
@@ -59,7 +72,6 @@ do_builder (GtkWidget *do_widget)
|
|||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/builder/demo.ui");
|
builder = gtk_builder_new_from_resource ("/builder/demo.ui");
|
||||||
|
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
@@ -73,44 +85,6 @@ do_builder (GtkWidget *do_widget)
|
|||||||
win_entries, G_N_ELEMENTS (win_entries),
|
win_entries, G_N_ELEMENTS (win_entries),
|
||||||
window);
|
window);
|
||||||
gtk_widget_insert_action_group (window, "win", actions);
|
gtk_widget_insert_action_group (window, "win", actions);
|
||||||
accel_group = gtk_accel_group_new ();
|
|
||||||
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
|
|
||||||
|
|
||||||
item = (GtkWidget*)gtk_builder_get_object (builder, "new_item");
|
|
||||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
|
||||||
GDK_KEY_n, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
|
||||||
|
|
||||||
item = (GtkWidget*)gtk_builder_get_object (builder, "open_item");
|
|
||||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
|
||||||
GDK_KEY_o, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
|
||||||
|
|
||||||
item = (GtkWidget*)gtk_builder_get_object (builder, "save_item");
|
|
||||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
|
||||||
GDK_KEY_s, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
|
||||||
|
|
||||||
item = (GtkWidget*)gtk_builder_get_object (builder, "quit_item");
|
|
||||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
|
||||||
GDK_KEY_q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
|
||||||
|
|
||||||
item = (GtkWidget*)gtk_builder_get_object (builder, "copy_item");
|
|
||||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
|
||||||
GDK_KEY_c, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
|
||||||
|
|
||||||
item = (GtkWidget*)gtk_builder_get_object (builder, "cut_item");
|
|
||||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
|
||||||
GDK_KEY_x, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
|
||||||
|
|
||||||
item = (GtkWidget*)gtk_builder_get_object (builder, "paste_item");
|
|
||||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
|
||||||
GDK_KEY_v, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
|
||||||
|
|
||||||
item = (GtkWidget*)gtk_builder_get_object (builder, "help_item");
|
|
||||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
|
||||||
GDK_KEY_F1, 0, GTK_ACCEL_VISIBLE);
|
|
||||||
|
|
||||||
item = (GtkWidget*)gtk_builder_get_object (builder, "about_item");
|
|
||||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
|
||||||
GDK_KEY_F7, 0, GTK_ACCEL_VISIBLE);
|
|
||||||
|
|
||||||
g_object_set_data_full (G_OBJECT(window), "builder", builder, g_object_unref);
|
g_object_set_data_full (G_OBJECT(window), "builder", builder, g_object_unref);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,551 +0,0 @@
|
|||||||
/* Change Display
|
|
||||||
*
|
|
||||||
* Demonstrates migrating a window between different displays.
|
|
||||||
* A display is a mouse and keyboard with some number of
|
|
||||||
* associated monitors. The neat thing about having multiple
|
|
||||||
* displays is that they can be on a completely separate
|
|
||||||
* computers, as long as there is a network connection to the
|
|
||||||
* computer where the application is running.
|
|
||||||
*
|
|
||||||
* Only some of the windowing systems where GTK runs have the
|
|
||||||
* concept of multiple displays. (The X Window System is the
|
|
||||||
* main example.) Other windowing systems can only handle one
|
|
||||||
* keyboard and mouse, and combine all monitors into
|
|
||||||
* a single display.
|
|
||||||
*
|
|
||||||
* This is a moderately complex example, and demonstrates:
|
|
||||||
*
|
|
||||||
* - Tracking the currently open displays
|
|
||||||
*
|
|
||||||
* - Changing the display for a window
|
|
||||||
*
|
|
||||||
* - Letting the user choose a window by clicking on it
|
|
||||||
*
|
|
||||||
* - Using GtkListStore and GtkTreeView
|
|
||||||
*
|
|
||||||
* - Using GtkDialog
|
|
||||||
*/
|
|
||||||
#include <string.h>
|
|
||||||
#include <glib/gi18n.h>
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
/* The ChangeDisplayInfo structure corresponds to a toplevel window and
|
|
||||||
* holds pointers to widgets inside the toplevel window along with other
|
|
||||||
* information about the contents of the window.
|
|
||||||
* This is a common organizational structure in real applications.
|
|
||||||
*/
|
|
||||||
typedef struct _ChangeDisplayInfo ChangeDisplayInfo;
|
|
||||||
|
|
||||||
struct _ChangeDisplayInfo
|
|
||||||
{
|
|
||||||
GtkWidget *window;
|
|
||||||
GtkSizeGroup *size_group;
|
|
||||||
|
|
||||||
GtkTreeModel *display_model;
|
|
||||||
|
|
||||||
GdkDisplay *current_display;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* These enumerations provide symbolic names for the columns
|
|
||||||
* in the two GtkListStore models.
|
|
||||||
*/
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
DISPLAY_COLUMN_NAME,
|
|
||||||
DISPLAY_COLUMN_DISPLAY,
|
|
||||||
DISPLAY_NUM_COLUMNS
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
SCREEN_COLUMN_NUMBER,
|
|
||||||
SCREEN_COLUMN_SCREEN,
|
|
||||||
SCREEN_NUM_COLUMNS
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Finds the toplevel window under the mouse pointer, if any.
|
|
||||||
*/
|
|
||||||
static GtkWidget *
|
|
||||||
find_toplevel_at_pointer (GdkDisplay *display)
|
|
||||||
{
|
|
||||||
GdkSurface *pointer_window;
|
|
||||||
GtkWidget *widget = NULL;
|
|
||||||
|
|
||||||
pointer_window = gdk_device_get_surface_at_position (gtk_get_current_event_device (), NULL, NULL);
|
|
||||||
|
|
||||||
if (pointer_window)
|
|
||||||
widget = GTK_WIDGET (gtk_native_get_for_surface (pointer_window));
|
|
||||||
|
|
||||||
return widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
released_cb (GtkGestureClick *gesture,
|
|
||||||
guint n_press,
|
|
||||||
gdouble x,
|
|
||||||
gdouble y,
|
|
||||||
gboolean *clicked)
|
|
||||||
{
|
|
||||||
*clicked = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Asks the user to click on a window, then waits for them click
|
|
||||||
* the mouse. When the mouse is released, returns the toplevel
|
|
||||||
* window under the pointer, or NULL, if there is none.
|
|
||||||
*/
|
|
||||||
static GtkWidget *
|
|
||||||
query_for_toplevel (GdkDisplay *display,
|
|
||||||
const char *prompt)
|
|
||||||
{
|
|
||||||
GtkWidget *popup, *label, *frame;
|
|
||||||
GdkCursor *cursor;
|
|
||||||
GtkWidget *toplevel = NULL;
|
|
||||||
GdkDevice *device;
|
|
||||||
|
|
||||||
popup = gtk_window_new (GTK_WINDOW_POPUP);
|
|
||||||
gtk_window_set_display (GTK_WINDOW (popup), display);
|
|
||||||
gtk_window_set_modal (GTK_WINDOW (popup), TRUE);
|
|
||||||
|
|
||||||
frame = gtk_frame_new (NULL);
|
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
|
||||||
gtk_container_add (GTK_CONTAINER (popup), frame);
|
|
||||||
|
|
||||||
label = gtk_label_new (prompt);
|
|
||||||
g_object_set (label, "margin", 10, NULL);
|
|
||||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
|
||||||
|
|
||||||
gtk_widget_show (popup);
|
|
||||||
cursor = gdk_cursor_new_from_name ("crosshair", NULL);
|
|
||||||
device = gtk_get_current_event_device ();
|
|
||||||
|
|
||||||
if (gdk_seat_grab (gdk_device_get_seat (device),
|
|
||||||
gtk_native_get_surface (GTK_NATIVE (popup)),
|
|
||||||
GDK_SEAT_CAPABILITY_ALL_POINTING,
|
|
||||||
FALSE, cursor, NULL, NULL, NULL) == GDK_GRAB_SUCCESS)
|
|
||||||
{
|
|
||||||
GtkGesture *gesture = gtk_gesture_click_new ();
|
|
||||||
gboolean clicked = FALSE;
|
|
||||||
|
|
||||||
g_signal_connect (gesture, "released",
|
|
||||||
G_CALLBACK (released_cb), &clicked);
|
|
||||||
gtk_widget_add_controller (popup, GTK_EVENT_CONTROLLER (gesture));
|
|
||||||
|
|
||||||
/* Process events until clicked is set by our button release event handler.
|
|
||||||
* We pass in may_block=TRUE since we want to wait if there
|
|
||||||
* are no events currently.
|
|
||||||
*/
|
|
||||||
while (!clicked)
|
|
||||||
g_main_context_iteration (NULL, TRUE);
|
|
||||||
|
|
||||||
gdk_seat_ungrab (gdk_device_get_seat (device));
|
|
||||||
|
|
||||||
toplevel = find_toplevel_at_pointer (display);
|
|
||||||
if (toplevel == popup)
|
|
||||||
toplevel = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (cursor);
|
|
||||||
gtk_widget_destroy (popup);
|
|
||||||
|
|
||||||
return toplevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Prompts the user for a toplevel window to move, and then moves
|
|
||||||
* that window to the currently selected display
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
query_change_display (ChangeDisplayInfo *info)
|
|
||||||
{
|
|
||||||
GdkDisplay *display = gtk_widget_get_display (info->window);
|
|
||||||
GtkWidget *toplevel;
|
|
||||||
|
|
||||||
toplevel = query_for_toplevel (display,
|
|
||||||
"Please select the toplevel\n"
|
|
||||||
"to move to the new display");
|
|
||||||
|
|
||||||
if (toplevel)
|
|
||||||
gtk_window_set_display (GTK_WINDOW (toplevel), info->current_display);
|
|
||||||
else
|
|
||||||
gdk_display_beep (display);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Called when the user clicks on a button in our dialog or
|
|
||||||
* closes the dialog through the window manager. Unless the
|
|
||||||
* "Change" button was clicked, we destroy the dialog.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
response_cb (GtkDialog *dialog,
|
|
||||||
gint response_id,
|
|
||||||
ChangeDisplayInfo *info)
|
|
||||||
{
|
|
||||||
if (response_id == GTK_RESPONSE_OK)
|
|
||||||
query_change_display (info);
|
|
||||||
else
|
|
||||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Called when the user clicks on "Open..." in the display
|
|
||||||
* frame. Prompts for a new display, and then opens a connection
|
|
||||||
* to that display.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
open_display_cb (GtkWidget *button,
|
|
||||||
ChangeDisplayInfo *info)
|
|
||||||
{
|
|
||||||
GtkWidget *content_area;
|
|
||||||
GtkWidget *dialog;
|
|
||||||
GtkWidget *display_entry;
|
|
||||||
GtkWidget *dialog_label;
|
|
||||||
gchar *new_screen_name = NULL;
|
|
||||||
GdkDisplay *result = NULL;
|
|
||||||
|
|
||||||
dialog = gtk_dialog_new_with_buttons ("Open Display",
|
|
||||||
GTK_WINDOW (info->window),
|
|
||||||
GTK_DIALOG_MODAL,
|
|
||||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
||||||
_("_OK"), GTK_RESPONSE_OK,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
|
||||||
display_entry = gtk_entry_new ();
|
|
||||||
gtk_entry_set_activates_default (GTK_ENTRY (display_entry), TRUE);
|
|
||||||
dialog_label =
|
|
||||||
gtk_label_new ("Please enter the name of\nthe new display\n");
|
|
||||||
|
|
||||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (content_area), dialog_label);
|
|
||||||
gtk_container_add (GTK_CONTAINER (content_area), display_entry);
|
|
||||||
|
|
||||||
gtk_widget_grab_focus (display_entry);
|
|
||||||
|
|
||||||
while (!result)
|
|
||||||
{
|
|
||||||
gint response_id = gtk_dialog_run (GTK_DIALOG (dialog));
|
|
||||||
if (response_id != GTK_RESPONSE_OK)
|
|
||||||
break;
|
|
||||||
|
|
||||||
new_screen_name = gtk_editable_get_chars (GTK_EDITABLE (display_entry),
|
|
||||||
0, -1);
|
|
||||||
|
|
||||||
if (strcmp (new_screen_name, "") != 0)
|
|
||||||
{
|
|
||||||
result = gdk_display_open (new_screen_name);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
gchar *error_msg =
|
|
||||||
g_strdup_printf ("Can't open display:\n\t%s\nplease try another one\n",
|
|
||||||
new_screen_name);
|
|
||||||
gtk_label_set_text (GTK_LABEL (dialog_label), error_msg);
|
|
||||||
g_free (error_msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (new_screen_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_destroy (dialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Called when the user clicks on the "Close" button in the
|
|
||||||
* "Display" frame. Closes the selected display.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
close_display_cb (GtkWidget *button,
|
|
||||||
ChangeDisplayInfo *info)
|
|
||||||
{
|
|
||||||
if (info->current_display)
|
|
||||||
gdk_display_close (info->current_display);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Called when the selected row in the display list changes.
|
|
||||||
* Updates info->current_display, then refills the list of
|
|
||||||
* screens.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
display_changed_cb (GtkTreeSelection *selection,
|
|
||||||
ChangeDisplayInfo *info)
|
|
||||||
{
|
|
||||||
GtkTreeModel *model;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
|
|
||||||
if (info->current_display)
|
|
||||||
g_object_unref (info->current_display);
|
|
||||||
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
|
||||||
gtk_tree_model_get (model, &iter,
|
|
||||||
DISPLAY_COLUMN_DISPLAY, &info->current_display,
|
|
||||||
-1);
|
|
||||||
else
|
|
||||||
info->current_display = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function is used both for creating the "Display" and
|
|
||||||
* "Screen" frames, since they have a similar structure. The
|
|
||||||
* caller hooks up the right context for the value returned
|
|
||||||
* in tree_view, and packs any relevant buttons into button_vbox.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
create_frame (ChangeDisplayInfo *info,
|
|
||||||
const char *title,
|
|
||||||
GtkWidget **frame,
|
|
||||||
GtkWidget **tree_view,
|
|
||||||
GtkWidget **button_vbox)
|
|
||||||
{
|
|
||||||
GtkTreeSelection *selection;
|
|
||||||
GtkWidget *scrollwin;
|
|
||||||
GtkWidget *hbox;
|
|
||||||
|
|
||||||
*frame = gtk_frame_new (title);
|
|
||||||
|
|
||||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
|
|
||||||
g_object_set (hbox, "margin", 8, NULL);
|
|
||||||
gtk_container_add (GTK_CONTAINER (*frame), hbox);
|
|
||||||
|
|
||||||
scrollwin = gtk_scrolled_window_new (NULL, NULL);
|
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
|
|
||||||
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
|
||||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollwin),
|
|
||||||
GTK_SHADOW_IN);
|
|
||||||
gtk_container_add (GTK_CONTAINER (hbox), scrollwin);
|
|
||||||
|
|
||||||
*tree_view = gtk_tree_view_new ();
|
|
||||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (*tree_view), FALSE);
|
|
||||||
gtk_container_add (GTK_CONTAINER (scrollwin), *tree_view);
|
|
||||||
|
|
||||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (*tree_view));
|
|
||||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
|
|
||||||
|
|
||||||
*button_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
|
||||||
gtk_container_add (GTK_CONTAINER (hbox), *button_vbox);
|
|
||||||
|
|
||||||
if (!info->size_group)
|
|
||||||
info->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
||||||
|
|
||||||
gtk_size_group_add_widget (GTK_SIZE_GROUP (info->size_group), *button_vbox);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we have a stack of buttons, it often looks better if their contents
|
|
||||||
* are left-aligned, rather than centered. This function creates a button
|
|
||||||
* and left-aligns it contents.
|
|
||||||
*/
|
|
||||||
GtkWidget *
|
|
||||||
left_align_button_new (const char *label)
|
|
||||||
{
|
|
||||||
GtkWidget *button = gtk_button_new_with_mnemonic (label);
|
|
||||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (button));
|
|
||||||
|
|
||||||
gtk_widget_set_halign (child, GTK_ALIGN_START);
|
|
||||||
gtk_widget_set_valign (child, GTK_ALIGN_CENTER);
|
|
||||||
|
|
||||||
return button;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Creates the "Display" frame in the main window.
|
|
||||||
*/
|
|
||||||
GtkWidget *
|
|
||||||
create_display_frame (ChangeDisplayInfo *info)
|
|
||||||
{
|
|
||||||
GtkWidget *frame;
|
|
||||||
GtkWidget *tree_view;
|
|
||||||
GtkWidget *button_vbox;
|
|
||||||
GtkTreeViewColumn *column;
|
|
||||||
GtkTreeSelection *selection;
|
|
||||||
GtkWidget *button;
|
|
||||||
|
|
||||||
create_frame (info, "Display", &frame, &tree_view, &button_vbox);
|
|
||||||
|
|
||||||
button = left_align_button_new ("_Open...");
|
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (open_display_cb), info);
|
|
||||||
gtk_container_add (GTK_CONTAINER (button_vbox), button);
|
|
||||||
|
|
||||||
button = left_align_button_new ("_Close");
|
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (close_display_cb), info);
|
|
||||||
gtk_container_add (GTK_CONTAINER (button_vbox), button);
|
|
||||||
|
|
||||||
info->display_model = (GtkTreeModel *)gtk_list_store_new (DISPLAY_NUM_COLUMNS,
|
|
||||||
G_TYPE_STRING,
|
|
||||||
GDK_TYPE_DISPLAY);
|
|
||||||
|
|
||||||
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), info->display_model);
|
|
||||||
|
|
||||||
column = gtk_tree_view_column_new_with_attributes ("Name",
|
|
||||||
gtk_cell_renderer_text_new (),
|
|
||||||
"text", DISPLAY_COLUMN_NAME,
|
|
||||||
NULL);
|
|
||||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
|
||||||
|
|
||||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
|
||||||
g_signal_connect (selection, "changed",
|
|
||||||
G_CALLBACK (display_changed_cb), info);
|
|
||||||
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Called when one of the currently open displays is closed.
|
|
||||||
* Remove it from our list of displays.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
display_closed_cb (GdkDisplay *display,
|
|
||||||
gboolean is_error,
|
|
||||||
ChangeDisplayInfo *info)
|
|
||||||
{
|
|
||||||
GtkTreeIter iter;
|
|
||||||
gboolean valid;
|
|
||||||
|
|
||||||
for (valid = gtk_tree_model_get_iter_first (info->display_model, &iter);
|
|
||||||
valid;
|
|
||||||
valid = gtk_tree_model_iter_next (info->display_model, &iter))
|
|
||||||
{
|
|
||||||
GdkDisplay *tmp_display;
|
|
||||||
|
|
||||||
gtk_tree_model_get (info->display_model, &iter,
|
|
||||||
DISPLAY_COLUMN_DISPLAY, &tmp_display,
|
|
||||||
-1);
|
|
||||||
if (tmp_display == display)
|
|
||||||
{
|
|
||||||
gtk_list_store_remove (GTK_LIST_STORE (info->display_model), &iter);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adds a new display to our list of displays, and connects
|
|
||||||
* to the "closed" signal so that we can remove it from the
|
|
||||||
* list of displays again.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
add_display (ChangeDisplayInfo *info,
|
|
||||||
GdkDisplay *display)
|
|
||||||
{
|
|
||||||
const gchar *name = gdk_display_get_name (display);
|
|
||||||
GtkTreeIter iter;
|
|
||||||
|
|
||||||
gtk_list_store_append (GTK_LIST_STORE (info->display_model), &iter);
|
|
||||||
gtk_list_store_set (GTK_LIST_STORE (info->display_model), &iter,
|
|
||||||
DISPLAY_COLUMN_NAME, name,
|
|
||||||
DISPLAY_COLUMN_DISPLAY, display,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
g_signal_connect (display, "closed",
|
|
||||||
G_CALLBACK (display_closed_cb), info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Called when a new display is opened
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
display_opened_cb (GdkDisplayManager *manager,
|
|
||||||
GdkDisplay *display,
|
|
||||||
ChangeDisplayInfo *info)
|
|
||||||
{
|
|
||||||
add_display (info, display);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adds all currently open displays to our list of displays,
|
|
||||||
* and set up a signal connection so that we'll be notified
|
|
||||||
* when displays are opened in the future as well.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
initialize_displays (ChangeDisplayInfo *info)
|
|
||||||
{
|
|
||||||
GdkDisplayManager *manager = gdk_display_manager_get ();
|
|
||||||
GSList *displays = gdk_display_manager_list_displays (manager);
|
|
||||||
GSList *tmp_list;
|
|
||||||
|
|
||||||
for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
|
|
||||||
add_display (info, tmp_list->data);
|
|
||||||
|
|
||||||
g_slist_free (tmp_list);
|
|
||||||
|
|
||||||
g_signal_connect (manager, "display-opened",
|
|
||||||
G_CALLBACK (display_opened_cb), info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cleans up when the toplevel is destroyed; we remove the
|
|
||||||
* connections we use to track currently open displays, then
|
|
||||||
* free the ChangeDisplayInfo structure.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
destroy_info (ChangeDisplayInfo *info)
|
|
||||||
{
|
|
||||||
GdkDisplayManager *manager = gdk_display_manager_get ();
|
|
||||||
GSList *displays = gdk_display_manager_list_displays (manager);
|
|
||||||
GSList *tmp_list;
|
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (manager,
|
|
||||||
display_opened_cb,
|
|
||||||
info);
|
|
||||||
|
|
||||||
for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
|
|
||||||
g_signal_handlers_disconnect_by_func (tmp_list->data,
|
|
||||||
display_closed_cb,
|
|
||||||
info);
|
|
||||||
|
|
||||||
g_slist_free (tmp_list);
|
|
||||||
|
|
||||||
g_object_unref (info->size_group);
|
|
||||||
g_object_unref (info->display_model);
|
|
||||||
|
|
||||||
if (info->current_display)
|
|
||||||
g_object_unref (info->current_display);
|
|
||||||
|
|
||||||
g_free (info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
destroy_cb (GObject *object,
|
|
||||||
ChangeDisplayInfo **info)
|
|
||||||
{
|
|
||||||
destroy_info (*info);
|
|
||||||
*info = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Main entry point. If the dialog for this demo doesn't yet exist, creates
|
|
||||||
* it. Otherwise, destroys it.
|
|
||||||
*/
|
|
||||||
GtkWidget *
|
|
||||||
do_changedisplay (GtkWidget *do_widget)
|
|
||||||
{
|
|
||||||
static ChangeDisplayInfo *info = NULL;
|
|
||||||
|
|
||||||
if (!info)
|
|
||||||
{
|
|
||||||
GtkWidget *content_area;
|
|
||||||
GtkWidget *vbox;
|
|
||||||
GtkWidget *frame;
|
|
||||||
|
|
||||||
info = g_new0 (ChangeDisplayInfo, 1);
|
|
||||||
|
|
||||||
info->window = gtk_dialog_new_with_buttons ("Change Display",
|
|
||||||
GTK_WINDOW (do_widget),
|
|
||||||
0,
|
|
||||||
"Close", GTK_RESPONSE_CLOSE,
|
|
||||||
"Change", GTK_RESPONSE_OK,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
gtk_window_set_default_size (GTK_WINDOW (info->window), 300, 400);
|
|
||||||
|
|
||||||
g_signal_connect (info->window, "response",
|
|
||||||
G_CALLBACK (response_cb), info);
|
|
||||||
g_signal_connect (info->window, "destroy",
|
|
||||||
G_CALLBACK (destroy_cb), &info);
|
|
||||||
|
|
||||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (info->window));
|
|
||||||
|
|
||||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
|
||||||
g_object_set (vbox, "margin", 8, NULL);
|
|
||||||
gtk_container_add (GTK_CONTAINER (content_area), vbox);
|
|
||||||
|
|
||||||
frame = create_display_frame (info);
|
|
||||||
gtk_container_add (GTK_CONTAINER (vbox), frame);
|
|
||||||
|
|
||||||
initialize_displays (info);
|
|
||||||
|
|
||||||
gtk_widget_show (info->window);
|
|
||||||
return info->window;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gtk_widget_destroy (info->window);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -110,7 +110,7 @@ get_image_paintable (GtkImage *image)
|
|||||||
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
||||||
if (icon_info == NULL)
|
if (icon_info == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return GDK_PAINTABLE (gtk_icon_info_load_texture (icon_info));
|
return gtk_icon_info_load_icon (icon_info, NULL);
|
||||||
default:
|
default:
|
||||||
g_warning ("Image storage type %d not handled",
|
g_warning ("Image storage type %d not handled",
|
||||||
gtk_image_get_storage_type (image));
|
gtk_image_get_storage_type (image));
|
||||||
@@ -164,17 +164,19 @@ drag_data_received (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
copy_image (GtkMenuItem *item,
|
copy_image (GSimpleAction *action,
|
||||||
gpointer data)
|
GVariant *value,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
GdkClipboard *clipboard;
|
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
|
||||||
GdkPaintable *paintable;
|
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (data));
|
||||||
|
|
||||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
|
|
||||||
paintable = get_image_paintable (GTK_IMAGE (data));
|
|
||||||
|
|
||||||
|
g_print ("copy image\n");
|
||||||
if (GDK_IS_TEXTURE (paintable))
|
if (GDK_IS_TEXTURE (paintable))
|
||||||
gdk_clipboard_set_texture (clipboard, GDK_TEXTURE (paintable));
|
{
|
||||||
|
g_print ("set clipboard\n");
|
||||||
|
gdk_clipboard_set_texture (clipboard, GDK_TEXTURE (paintable));
|
||||||
|
}
|
||||||
|
|
||||||
if (paintable)
|
if (paintable)
|
||||||
g_object_unref (paintable);
|
g_object_unref (paintable);
|
||||||
@@ -196,16 +198,12 @@ paste_image_received (GObject *source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paste_image (GtkMenuItem *item,
|
paste_image (GSimpleAction *action,
|
||||||
gpointer data)
|
GVariant *value,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
GdkClipboard *clipboard;
|
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
|
||||||
|
gdk_clipboard_read_texture_async (clipboard, NULL, paste_image_received, data);
|
||||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
|
|
||||||
gdk_clipboard_read_texture_async (clipboard,
|
|
||||||
NULL,
|
|
||||||
paste_image_received,
|
|
||||||
data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -215,22 +213,23 @@ pressed_cb (GtkGesture *gesture,
|
|||||||
double y,
|
double y,
|
||||||
GtkWidget *image)
|
GtkWidget *image)
|
||||||
{
|
{
|
||||||
GtkWidget *menu;
|
GtkWidget *popover;
|
||||||
GtkWidget *item;
|
GMenu *menu;
|
||||||
|
GMenuItem *item;
|
||||||
|
|
||||||
menu = gtk_menu_new ();
|
menu = g_menu_new ();
|
||||||
|
item = g_menu_item_new (_("_Copy"), "clipboard.copy");
|
||||||
|
g_menu_append_item (menu, item);
|
||||||
|
|
||||||
item = gtk_menu_item_new_with_mnemonic (_("_Copy"));
|
item = g_menu_item_new (_("_Paste"), "clipboard.paste");
|
||||||
g_signal_connect (item, "activate", G_CALLBACK (copy_image), image);
|
g_menu_append_item (menu, item);
|
||||||
gtk_widget_show (item);
|
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
|
||||||
|
|
||||||
item = gtk_menu_item_new_with_mnemonic (_("_Paste"));
|
popover = gtk_popover_menu_new_from_model (image, G_MENU_MODEL (menu));
|
||||||
g_signal_connect (item, "activate", G_CALLBACK (paste_image), image);
|
|
||||||
gtk_widget_show (item);
|
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
|
||||||
|
|
||||||
gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
|
gtk_popover_set_pointing_to (GTK_POPOVER (popover), &(GdkRectangle) { x, y, 1, 1});
|
||||||
|
gtk_popover_popup (GTK_POPOVER (popover));
|
||||||
|
|
||||||
|
g_object_unref (menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
@@ -243,6 +242,11 @@ do_clipboard (GtkWidget *do_widget)
|
|||||||
GtkWidget *entry, *button;
|
GtkWidget *entry, *button;
|
||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
GtkGesture *gesture;
|
GtkGesture *gesture;
|
||||||
|
GActionEntry entries[] = {
|
||||||
|
{ "copy", copy_image, NULL, NULL, NULL },
|
||||||
|
{ "paste", paste_image, NULL, NULL, NULL },
|
||||||
|
};
|
||||||
|
GActionGroup *actions;
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
@@ -324,6 +328,13 @@ do_clipboard (GtkWidget *do_widget)
|
|||||||
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
||||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
||||||
|
|
||||||
|
actions = G_ACTION_GROUP (g_simple_action_group_new ());
|
||||||
|
g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS (entries), image);
|
||||||
|
|
||||||
|
gtk_widget_insert_action_group (image, "clipboard", actions);
|
||||||
|
|
||||||
|
g_object_unref (actions);
|
||||||
|
|
||||||
/* Create the second image */
|
/* Create the second image */
|
||||||
image = gtk_image_new_from_icon_name ("process-stop");
|
image = gtk_image_new_from_icon_name ("process-stop");
|
||||||
gtk_container_add (GTK_CONTAINER (hbox), image);
|
gtk_container_add (GTK_CONTAINER (hbox), image);
|
||||||
@@ -348,6 +359,13 @@ do_clipboard (GtkWidget *do_widget)
|
|||||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||||
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
||||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
||||||
|
|
||||||
|
actions = G_ACTION_GROUP (g_simple_action_group_new ());
|
||||||
|
g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS (entries), image);
|
||||||
|
|
||||||
|
gtk_widget_insert_action_group (image, "clipboard", actions);
|
||||||
|
|
||||||
|
g_object_unref (actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
|
|||||||
289
demos/gtk-demo/constraints.c
Normal file
289
demos/gtk-demo/constraints.c
Normal file
@@ -0,0 +1,289 @@
|
|||||||
|
/* Constraints/Simple
|
||||||
|
*
|
||||||
|
* GtkConstraintLayout provides a layout manager that uses relations
|
||||||
|
* between widgets (also known as "constraints") to compute the position
|
||||||
|
* and size of each child.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <glib/gi18n.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (SimpleGrid, simple_grid, SIMPLE, GRID, GtkWidget)
|
||||||
|
|
||||||
|
struct _SimpleGrid
|
||||||
|
{
|
||||||
|
GtkWidget parent_instance;
|
||||||
|
|
||||||
|
GtkWidget *button1, *button2;
|
||||||
|
GtkWidget *button3;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (SimpleGrid, simple_grid, GTK_TYPE_WIDGET)
|
||||||
|
|
||||||
|
static void
|
||||||
|
simple_grid_destroy (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
SimpleGrid *self = SIMPLE_GRID (widget);
|
||||||
|
|
||||||
|
g_clear_pointer (&self->button1, gtk_widget_destroy);
|
||||||
|
g_clear_pointer (&self->button2, gtk_widget_destroy);
|
||||||
|
g_clear_pointer (&self->button3, gtk_widget_destroy);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (simple_grid_parent_class)->destroy (widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
simple_grid_class_init (SimpleGridClass *klass)
|
||||||
|
{
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
|
||||||
|
widget_class->destroy = simple_grid_destroy;
|
||||||
|
|
||||||
|
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Layout:
|
||||||
|
*
|
||||||
|
* +-------------------------------------+
|
||||||
|
* | +-----------++-------++-----------+ |
|
||||||
|
* | | Child 1 || Space || Child 2 | |
|
||||||
|
* | +-----------++-------++-----------+ |
|
||||||
|
* | +---------------------------------+ |
|
||||||
|
* | | Child 3 | |
|
||||||
|
* | +---------------------------------+ |
|
||||||
|
* +-------------------------------------+
|
||||||
|
*
|
||||||
|
* Constraints:
|
||||||
|
*
|
||||||
|
* super.start = child1.start - 8
|
||||||
|
* child1.width = child2.width
|
||||||
|
* child1.end = space.start
|
||||||
|
* space.end = child2.start
|
||||||
|
* child2.end = super.end - 8
|
||||||
|
* super.start = child3.start - 8
|
||||||
|
* child3.end = super.end - 8
|
||||||
|
* super.top = child1.top - 8
|
||||||
|
* super.top = child2.top - 8
|
||||||
|
* child1.bottom = child3.top - 12
|
||||||
|
* child2.bottom = child3.top - 12
|
||||||
|
* child3.height = child1.height
|
||||||
|
* child3.height = child2.height
|
||||||
|
* child3.bottom = super.bottom - 8
|
||||||
|
*
|
||||||
|
* To add some flexibility, we make the space
|
||||||
|
* stretchable:
|
||||||
|
*
|
||||||
|
* space.width >= 10
|
||||||
|
* space.width = 100
|
||||||
|
* space.width <= 200
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
build_constraints (SimpleGrid *self,
|
||||||
|
GtkConstraintLayout *manager)
|
||||||
|
{
|
||||||
|
GtkConstraintGuide *guide;
|
||||||
|
|
||||||
|
guide = gtk_constraint_guide_new ();
|
||||||
|
gtk_constraint_guide_set_name (guide, "space");
|
||||||
|
gtk_constraint_guide_set_min_size (guide, 10, 10);
|
||||||
|
gtk_constraint_guide_set_nat_size (guide, 100, 10);
|
||||||
|
gtk_constraint_guide_set_max_size (guide, 200, 20);
|
||||||
|
gtk_constraint_guide_set_strength (guide, GTK_CONSTRAINT_STRENGTH_STRONG);
|
||||||
|
gtk_constraint_layout_add_guide (manager, guide);
|
||||||
|
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new_constant (GTK_CONSTRAINT_TARGET (self->button1),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_WIDTH,
|
||||||
|
GTK_CONSTRAINT_RELATION_LE,
|
||||||
|
200.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
self->button1,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (self->button1,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_WIDTH,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
self->button2,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_WIDTH,
|
||||||
|
1.0,
|
||||||
|
0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (self->button1,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_END,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
guide,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
1.0,
|
||||||
|
0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (guide,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_END,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
self->button2,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
1.0,
|
||||||
|
0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (self->button2,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_END,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_END,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
self->button3,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (self->button3,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_END,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_END,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_TOP,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
self->button1,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_TOP,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_TOP,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
self->button2,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_TOP,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (self->button1,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_BOTTOM,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
self->button3,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_TOP,
|
||||||
|
1.0,
|
||||||
|
-12.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (self->button2,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_BOTTOM,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
self->button3,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_TOP,
|
||||||
|
1.0,
|
||||||
|
-12.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (self->button3,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_HEIGHT,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
self->button1,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_HEIGHT,
|
||||||
|
1.0,
|
||||||
|
0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (self->button3,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_HEIGHT,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
self->button2,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_HEIGHT,
|
||||||
|
1.0,
|
||||||
|
0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (self->button3,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_BOTTOM,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_BOTTOM,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
simple_grid_init (SimpleGrid *self)
|
||||||
|
{
|
||||||
|
GtkWidget *widget = GTK_WIDGET (self);
|
||||||
|
|
||||||
|
self->button1 = gtk_button_new_with_label ("Child 1");
|
||||||
|
gtk_widget_set_parent (self->button1, widget);
|
||||||
|
gtk_widget_set_name (self->button1, "button1");
|
||||||
|
|
||||||
|
self->button2 = gtk_button_new_with_label ("Child 2");
|
||||||
|
gtk_widget_set_parent (self->button2, widget);
|
||||||
|
gtk_widget_set_name (self->button2, "button2");
|
||||||
|
|
||||||
|
self->button3 = gtk_button_new_with_label ("Child 3");
|
||||||
|
gtk_widget_set_parent (self->button3, widget);
|
||||||
|
gtk_widget_set_name (self->button3, "button3");
|
||||||
|
|
||||||
|
GtkLayoutManager *manager = gtk_widget_get_layout_manager (GTK_WIDGET (self));
|
||||||
|
build_constraints (self, GTK_CONSTRAINT_LAYOUT (manager));
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
do_constraints (GtkWidget *do_widget)
|
||||||
|
{
|
||||||
|
static GtkWidget *window;
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
GtkWidget *header, *box, *grid, *button;
|
||||||
|
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||||
|
|
||||||
|
header = gtk_header_bar_new ();
|
||||||
|
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Constraints");
|
||||||
|
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
|
||||||
|
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||||
|
g_signal_connect (window, "destroy",
|
||||||
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
|
||||||
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), box);
|
||||||
|
|
||||||
|
grid = g_object_new (simple_grid_get_type (), NULL);
|
||||||
|
gtk_widget_set_hexpand (grid, TRUE);
|
||||||
|
gtk_widget_set_vexpand (grid, TRUE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), grid);
|
||||||
|
|
||||||
|
button = gtk_button_new_with_label ("Close");
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), button);
|
||||||
|
gtk_widget_set_hexpand (grid, TRUE);
|
||||||
|
g_signal_connect_swapped (button, "clicked",
|
||||||
|
G_CALLBACK (gtk_widget_destroy), window);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gtk_widget_get_visible (window))
|
||||||
|
gtk_widget_show (window);
|
||||||
|
else
|
||||||
|
gtk_widget_destroy (window);
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
245
demos/gtk-demo/constraints2.c
Normal file
245
demos/gtk-demo/constraints2.c
Normal file
@@ -0,0 +1,245 @@
|
|||||||
|
/* Constraints/Interactive
|
||||||
|
*
|
||||||
|
* Demonstrate how constraints can be updates during
|
||||||
|
* user interaction.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <glib/gi18n.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (InteractiveGrid, interactive_grid, INTERACTIVE, GRID, GtkWidget)
|
||||||
|
|
||||||
|
struct _InteractiveGrid
|
||||||
|
{
|
||||||
|
GtkWidget parent_instance;
|
||||||
|
|
||||||
|
GtkWidget *button1, *button2;
|
||||||
|
GtkWidget *button3;
|
||||||
|
GtkConstraintGuide *guide;
|
||||||
|
GtkConstraint *constraint;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (InteractiveGrid, interactive_grid, GTK_TYPE_WIDGET)
|
||||||
|
|
||||||
|
static void
|
||||||
|
interactive_grid_destroy (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
InteractiveGrid *self = INTERACTIVE_GRID (widget);
|
||||||
|
|
||||||
|
g_clear_pointer (&self->button1, gtk_widget_destroy);
|
||||||
|
g_clear_pointer (&self->button2, gtk_widget_destroy);
|
||||||
|
g_clear_pointer (&self->button3, gtk_widget_destroy);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (interactive_grid_parent_class)->destroy (widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
interactive_grid_class_init (InteractiveGridClass *klass)
|
||||||
|
{
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
|
||||||
|
widget_class->destroy = interactive_grid_destroy;
|
||||||
|
|
||||||
|
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
build_constraints (InteractiveGrid *self,
|
||||||
|
GtkConstraintLayout *manager)
|
||||||
|
{
|
||||||
|
self->guide = g_object_new (GTK_TYPE_CONSTRAINT_GUIDE, NULL);
|
||||||
|
gtk_constraint_layout_add_guide (manager, self->guide);
|
||||||
|
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new_constant (GTK_CONSTRAINT_TARGET (self->guide),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_WIDTH,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
GTK_CONSTRAINT_TARGET (self->button1),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (GTK_CONSTRAINT_TARGET (self->button1),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_END,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
GTK_CONSTRAINT_TARGET (self->guide),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
1.0,
|
||||||
|
0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (GTK_CONSTRAINT_TARGET (self->button2),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
GTK_CONSTRAINT_TARGET (self->guide),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_END,
|
||||||
|
1.0,
|
||||||
|
0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (GTK_CONSTRAINT_TARGET (self->button2),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_END,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_END,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
GTK_CONSTRAINT_TARGET (self->button3),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (GTK_CONSTRAINT_TARGET (self->button3),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_END,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
GTK_CONSTRAINT_TARGET (self->guide),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_START,
|
||||||
|
1.0,
|
||||||
|
0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_TOP,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
GTK_CONSTRAINT_TARGET (self->button1),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_TOP,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (GTK_CONSTRAINT_TARGET (self->button2),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_TOP,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
GTK_CONSTRAINT_TARGET (self->button1),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_BOTTOM,
|
||||||
|
1.0,
|
||||||
|
0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (GTK_CONSTRAINT_TARGET (self->button3),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_TOP,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
GTK_CONSTRAINT_TARGET (self->button2),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_BOTTOM,
|
||||||
|
1.0,
|
||||||
|
0.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
gtk_constraint_layout_add_constraint (manager,
|
||||||
|
gtk_constraint_new (GTK_CONSTRAINT_TARGET (self->button3),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_BOTTOM,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
NULL,
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_BOTTOM,
|
||||||
|
1.0,
|
||||||
|
-8.0,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
drag_cb (GtkGestureDrag *drag,
|
||||||
|
double offset_x,
|
||||||
|
double offset_y,
|
||||||
|
InteractiveGrid *self)
|
||||||
|
{
|
||||||
|
GtkConstraintLayout *layout = GTK_CONSTRAINT_LAYOUT (gtk_widget_get_layout_manager (GTK_WIDGET (self)));
|
||||||
|
double x, y;
|
||||||
|
|
||||||
|
if (self->constraint)
|
||||||
|
{
|
||||||
|
gtk_constraint_layout_remove_constraint (layout, self->constraint);
|
||||||
|
g_clear_object (&self->constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_gesture_drag_get_start_point (drag, &x, &y);
|
||||||
|
self->constraint = gtk_constraint_new_constant (GTK_CONSTRAINT_TARGET (self->guide),
|
||||||
|
GTK_CONSTRAINT_ATTRIBUTE_LEFT,
|
||||||
|
GTK_CONSTRAINT_RELATION_EQ,
|
||||||
|
x + offset_x,
|
||||||
|
GTK_CONSTRAINT_STRENGTH_REQUIRED);
|
||||||
|
gtk_constraint_layout_add_constraint (layout, g_object_ref (self->constraint));
|
||||||
|
gtk_widget_queue_allocate (GTK_WIDGET (self));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
interactive_grid_init (InteractiveGrid *self)
|
||||||
|
{
|
||||||
|
GtkWidget *widget = GTK_WIDGET (self);
|
||||||
|
GtkGesture *drag;
|
||||||
|
|
||||||
|
self->button1 = gtk_button_new_with_label ("Child 1");
|
||||||
|
gtk_widget_set_parent (self->button1, widget);
|
||||||
|
gtk_widget_set_name (self->button1, "button1");
|
||||||
|
|
||||||
|
self->button2 = gtk_button_new_with_label ("Child 2");
|
||||||
|
gtk_widget_set_parent (self->button2, widget);
|
||||||
|
gtk_widget_set_name (self->button2, "button2");
|
||||||
|
|
||||||
|
self->button3 = gtk_button_new_with_label ("Child 3");
|
||||||
|
gtk_widget_set_parent (self->button3, widget);
|
||||||
|
gtk_widget_set_name (self->button3, "button3");
|
||||||
|
|
||||||
|
GtkLayoutManager *manager = gtk_widget_get_layout_manager (GTK_WIDGET (self));
|
||||||
|
build_constraints (self, GTK_CONSTRAINT_LAYOUT (manager));
|
||||||
|
|
||||||
|
drag = gtk_gesture_drag_new ();
|
||||||
|
g_signal_connect (drag, "drag-update", G_CALLBACK (drag_cb), self);
|
||||||
|
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (drag));
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
do_constraints2 (GtkWidget *do_widget)
|
||||||
|
{
|
||||||
|
static GtkWidget *window;
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
GtkWidget *header, *box, *grid, *button;
|
||||||
|
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||||
|
|
||||||
|
header = gtk_header_bar_new ();
|
||||||
|
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Constraints");
|
||||||
|
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
|
||||||
|
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||||
|
g_signal_connect (window, "destroy",
|
||||||
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
|
||||||
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), box);
|
||||||
|
|
||||||
|
grid = g_object_new (interactive_grid_get_type (), NULL);
|
||||||
|
gtk_widget_set_hexpand (grid, TRUE);
|
||||||
|
gtk_widget_set_vexpand (grid, TRUE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), grid);
|
||||||
|
|
||||||
|
button = gtk_button_new_with_label ("Close");
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), button);
|
||||||
|
gtk_widget_set_hexpand (grid, TRUE);
|
||||||
|
g_signal_connect_swapped (button, "clicked",
|
||||||
|
G_CALLBACK (gtk_widget_destroy), window);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gtk_widget_get_visible (window))
|
||||||
|
gtk_widget_show (window);
|
||||||
|
else
|
||||||
|
gtk_widget_destroy (window);
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
165
demos/gtk-demo/constraints3.c
Normal file
165
demos/gtk-demo/constraints3.c
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
/* Constraints/VFL
|
||||||
|
*
|
||||||
|
* GtkConstraintLayout allows defining constraints using a
|
||||||
|
* compact syntax called Visual Format Language, or VFL.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <glib/gi18n.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE (VflGrid, vfl_grid, VFL, GRID, GtkWidget)
|
||||||
|
|
||||||
|
struct _VflGrid
|
||||||
|
{
|
||||||
|
GtkWidget parent_instance;
|
||||||
|
|
||||||
|
GtkWidget *button1, *button2;
|
||||||
|
GtkWidget *button3;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (VflGrid, vfl_grid, GTK_TYPE_WIDGET)
|
||||||
|
|
||||||
|
static void
|
||||||
|
vfl_grid_destroy (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
VflGrid *self = VFL_GRID (widget);
|
||||||
|
|
||||||
|
g_clear_pointer (&self->button1, gtk_widget_destroy);
|
||||||
|
g_clear_pointer (&self->button2, gtk_widget_destroy);
|
||||||
|
g_clear_pointer (&self->button3, gtk_widget_destroy);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (vfl_grid_parent_class)->destroy (widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vfl_grid_class_init (VflGridClass *klass)
|
||||||
|
{
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
|
||||||
|
widget_class->destroy = vfl_grid_destroy;
|
||||||
|
|
||||||
|
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Layout:
|
||||||
|
*
|
||||||
|
* +-----------------------------+
|
||||||
|
* | +-----------+ +-----------+ |
|
||||||
|
* | | Child 1 | | Child 2 | |
|
||||||
|
* | +-----------+ +-----------+ |
|
||||||
|
* | +-------------------------+ |
|
||||||
|
* | | Child 3 | |
|
||||||
|
* | +-------------------------+ |
|
||||||
|
* +-----------------------------+
|
||||||
|
*
|
||||||
|
* Constraints:
|
||||||
|
*
|
||||||
|
* super.start = child1.start - 8
|
||||||
|
* child1.width = child2.width
|
||||||
|
* child1.end = child2.start - 12
|
||||||
|
* child2.end = super.end - 8
|
||||||
|
* super.start = child3.start - 8
|
||||||
|
* child3.end = super.end - 8
|
||||||
|
* super.top = child1.top - 8
|
||||||
|
* super.top = child2.top - 8
|
||||||
|
* child1.bottom = child3.top - 12
|
||||||
|
* child2.bottom = child3.top - 12
|
||||||
|
* child3.height = child1.height
|
||||||
|
* child3.height = child2.height
|
||||||
|
* child3.bottom = super.bottom - 8
|
||||||
|
*
|
||||||
|
* Visual format:
|
||||||
|
*
|
||||||
|
* H:|-8-[view1(==view2)-12-[view2]-8-|
|
||||||
|
* H:|-8-[view3]-8-|
|
||||||
|
* V:|-8-[view1]-12-[view3(==view1)]-8-|
|
||||||
|
* V:|-8-[view2]-12-[view3(==view2)]-8-|
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
build_constraints (VflGrid *self,
|
||||||
|
GtkConstraintLayout *manager)
|
||||||
|
{
|
||||||
|
const char * const vfl[] = {
|
||||||
|
"H:|-[button1(==button2)]-12-[button2]-|",
|
||||||
|
"H:|-[button3]-|",
|
||||||
|
"V:|-[button1]-12-[button3(==button1)]-|",
|
||||||
|
"V:|-[button2]-12-[button3(==button2)]-|",
|
||||||
|
};
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
gtk_constraint_layout_add_constraints_from_description (manager, vfl, G_N_ELEMENTS (vfl),
|
||||||
|
8, 8,
|
||||||
|
&error,
|
||||||
|
"button1", self->button1,
|
||||||
|
"button2", self->button2,
|
||||||
|
"button3", self->button3,
|
||||||
|
NULL);
|
||||||
|
if (error != NULL)
|
||||||
|
{
|
||||||
|
g_printerr ("VFL parsing error:\n%s", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vfl_grid_init (VflGrid *self)
|
||||||
|
{
|
||||||
|
GtkWidget *widget = GTK_WIDGET (self);
|
||||||
|
|
||||||
|
self->button1 = gtk_button_new_with_label ("Child 1");
|
||||||
|
gtk_widget_set_parent (self->button1, widget);
|
||||||
|
gtk_widget_set_name (self->button1, "button1");
|
||||||
|
|
||||||
|
self->button2 = gtk_button_new_with_label ("Child 2");
|
||||||
|
gtk_widget_set_parent (self->button2, widget);
|
||||||
|
gtk_widget_set_name (self->button2, "button2");
|
||||||
|
|
||||||
|
self->button3 = gtk_button_new_with_label ("Child 3");
|
||||||
|
gtk_widget_set_parent (self->button3, widget);
|
||||||
|
gtk_widget_set_name (self->button3, "button3");
|
||||||
|
|
||||||
|
GtkLayoutManager *manager = gtk_widget_get_layout_manager (GTK_WIDGET (self));
|
||||||
|
build_constraints (self, GTK_CONSTRAINT_LAYOUT (manager));
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
do_constraints3 (GtkWidget *do_widget)
|
||||||
|
{
|
||||||
|
static GtkWidget *window;
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
GtkWidget *header, *box, *grid, *button;
|
||||||
|
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||||
|
|
||||||
|
header = gtk_header_bar_new ();
|
||||||
|
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Constraints");
|
||||||
|
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
|
||||||
|
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||||
|
g_signal_connect (window, "destroy",
|
||||||
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
|
||||||
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), box);
|
||||||
|
|
||||||
|
grid = g_object_new (vfl_grid_get_type (), NULL);
|
||||||
|
gtk_widget_set_hexpand (grid, TRUE);
|
||||||
|
gtk_widget_set_vexpand (grid, TRUE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), grid);
|
||||||
|
|
||||||
|
button = gtk_button_new_with_label ("Close");
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), button);
|
||||||
|
gtk_widget_set_hexpand (grid, TRUE);
|
||||||
|
g_signal_connect_swapped (button, "clicked",
|
||||||
|
G_CALLBACK (gtk_widget_destroy), window);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gtk_widget_get_visible (window))
|
||||||
|
gtk_widget_show (window);
|
||||||
|
else
|
||||||
|
gtk_widget_destroy (window);
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
@@ -24,7 +24,6 @@ do_cursors (GtkWidget *do_widget)
|
|||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
|
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
|
|||||||
@@ -104,6 +104,9 @@
|
|||||||
<file>gtkfishbowl.c</file>
|
<file>gtkfishbowl.c</file>
|
||||||
<file>gtkfishbowl.h</file>
|
<file>gtkfishbowl.h</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
|
<gresource prefix="/iconscroll">
|
||||||
|
<file>iconscroll.ui</file>
|
||||||
|
</gresource>
|
||||||
<gresource prefix="/iconview">
|
<gresource prefix="/iconview">
|
||||||
<file>gnome-fs-directory.png</file>
|
<file>gnome-fs-directory.png</file>
|
||||||
<file>gnome-fs-regular.png</file>
|
<file>gnome-fs-regular.png</file>
|
||||||
@@ -146,10 +149,12 @@
|
|||||||
<file>application_demo.c</file>
|
<file>application_demo.c</file>
|
||||||
<file>assistant.c</file>
|
<file>assistant.c</file>
|
||||||
<file>builder.c</file>
|
<file>builder.c</file>
|
||||||
<file>changedisplay.c</file>
|
|
||||||
<file>clipboard.c</file>
|
<file>clipboard.c</file>
|
||||||
<file>colorsel.c</file>
|
<file>colorsel.c</file>
|
||||||
<file>combobox.c</file>
|
<file>combobox.c</file>
|
||||||
|
<file>constraints.c</file>
|
||||||
|
<file>constraints2.c</file>
|
||||||
|
<file>constraints3.c</file>
|
||||||
<file>css_accordion.c</file>
|
<file>css_accordion.c</file>
|
||||||
<file>css_basics.c</file>
|
<file>css_basics.c</file>
|
||||||
<file>css_blendmodes.c</file>
|
<file>css_blendmodes.c</file>
|
||||||
@@ -161,8 +166,8 @@
|
|||||||
<file>drawingarea.c</file>
|
<file>drawingarea.c</file>
|
||||||
<file>dnd.c</file>
|
<file>dnd.c</file>
|
||||||
<file>editable_cells.c</file>
|
<file>editable_cells.c</file>
|
||||||
<file>entry_buffer.c</file>
|
|
||||||
<file>entry_completion.c</file>
|
<file>entry_completion.c</file>
|
||||||
|
<file>entry_undo.c</file>
|
||||||
<file>expander.c</file>
|
<file>expander.c</file>
|
||||||
<file>filtermodel.c</file>
|
<file>filtermodel.c</file>
|
||||||
<file>fishbowl.c</file>
|
<file>fishbowl.c</file>
|
||||||
@@ -171,10 +176,12 @@
|
|||||||
<file>foreigndrawing.c</file>
|
<file>foreigndrawing.c</file>
|
||||||
<file>font_features.c</file>
|
<file>font_features.c</file>
|
||||||
<file>fontplane.c</file>
|
<file>fontplane.c</file>
|
||||||
|
<file>fontrendering.c</file>
|
||||||
<file>gestures.c</file>
|
<file>gestures.c</file>
|
||||||
<file>glarea.c</file>
|
<file>glarea.c</file>
|
||||||
<file>headerbar.c</file>
|
<file>headerbar.c</file>
|
||||||
<file>hypertext.c</file>
|
<file>hypertext.c</file>
|
||||||
|
<file>iconscroll.c</file>
|
||||||
<file>iconview.c</file>
|
<file>iconview.c</file>
|
||||||
<file>iconview_edit.c</file>
|
<file>iconview_edit.c</file>
|
||||||
<file>images.c</file>
|
<file>images.c</file>
|
||||||
@@ -183,7 +190,6 @@
|
|||||||
<file>listbox.c</file>
|
<file>listbox.c</file>
|
||||||
<file>list_store.c</file>
|
<file>list_store.c</file>
|
||||||
<file>markup.c</file>
|
<file>markup.c</file>
|
||||||
<file>menus.c</file>
|
|
||||||
<file>modelbutton.c</file>
|
<file>modelbutton.c</file>
|
||||||
<file>overlay.c</file>
|
<file>overlay.c</file>
|
||||||
<file>overlay2.c</file>
|
<file>overlay2.c</file>
|
||||||
@@ -212,6 +218,7 @@
|
|||||||
<file>spinner.c</file>
|
<file>spinner.c</file>
|
||||||
<file>tabs.c</file>
|
<file>tabs.c</file>
|
||||||
<file>tagged_entry.c</file>
|
<file>tagged_entry.c</file>
|
||||||
|
<file>textundo.c</file>
|
||||||
<file>textview.c</file>
|
<file>textview.c</file>
|
||||||
<file>textscroll.c</file>
|
<file>textscroll.c</file>
|
||||||
<file>theming_style_classes.c</file>
|
<file>theming_style_classes.c</file>
|
||||||
@@ -278,6 +285,9 @@
|
|||||||
<gresource prefix="/fixed">
|
<gresource prefix="/fixed">
|
||||||
<file>fixed.css</file>
|
<file>fixed.css</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
|
<gresource prefix="/fontrendering">
|
||||||
|
<file>fontrendering.ui</file>
|
||||||
|
</gresource>
|
||||||
<gresource prefix="/org/gtk/Demo4">
|
<gresource prefix="/org/gtk/Demo4">
|
||||||
<file>icons/16x16/actions/application-exit.png</file>
|
<file>icons/16x16/actions/application-exit.png</file>
|
||||||
<file>icons/16x16/actions/document-new.png</file>
|
<file>icons/16x16/actions/document-new.png</file>
|
||||||
|
|||||||
@@ -22,6 +22,75 @@
|
|||||||
</row>
|
</row>
|
||||||
</data>
|
</data>
|
||||||
</object>
|
</object>
|
||||||
|
<menu id="menubar">
|
||||||
|
<submenu>
|
||||||
|
<attribute name="label" translatable="yes">_File</attribute>
|
||||||
|
<section>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">_New</attribute>
|
||||||
|
<attribute name="action">win.new</attribute>
|
||||||
|
<attribute name="accel"><Primary>n</attribute>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">_Open</attribute>
|
||||||
|
<attribute name="action">win.open</attribute>
|
||||||
|
<attribute name="accel"><Primary>o</attribute>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">_Save</attribute>
|
||||||
|
<attribute name="action">win.save</attribute>
|
||||||
|
<attribute name="accel"><Primary>s</attribute>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">Save _As</attribute>
|
||||||
|
<attribute name="action">win.save-as</attribute>
|
||||||
|
<attribute name="accel"><Primary>q</attribute>
|
||||||
|
</item>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||||
|
<attribute name="action">win.quit</attribute>
|
||||||
|
<attribute name="accel"><Primary><Shift>s</attribute>
|
||||||
|
</item>
|
||||||
|
</section>
|
||||||
|
</submenu>
|
||||||
|
<submenu>
|
||||||
|
<attribute name="label" translatable="yes">_Edit</attribute>
|
||||||
|
<section>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">_Copy</attribute>
|
||||||
|
<attribute name="action">win.copy</attribute>
|
||||||
|
<attribute name="accel"><Primary>c</attribute>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">_Cut</attribute>
|
||||||
|
<attribute name="action">win.cut</attribute>
|
||||||
|
<attribute name="accel"><Primary>x</attribute>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">_Paste</attribute>
|
||||||
|
<attribute name="action">win.paste</attribute>
|
||||||
|
<attribute name="accel"><Primary>v</attribute>
|
||||||
|
</item>
|
||||||
|
</section>
|
||||||
|
</submenu>
|
||||||
|
<submenu>
|
||||||
|
<attribute name="label" translatable="yes">_Help</attribute>
|
||||||
|
<section>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">_Help</attribute>
|
||||||
|
<attribute name="action">win.help</attribute>
|
||||||
|
<attribute name="accel">F1</attribute>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">_About</attribute>
|
||||||
|
<attribute name="action">win.about</attribute>
|
||||||
|
<attribute name="accel">F7</attribute>
|
||||||
|
</item>
|
||||||
|
</section>
|
||||||
|
</submenu>
|
||||||
|
</menu>
|
||||||
<object class="GtkAboutDialog" id="aboutdialog1">
|
<object class="GtkAboutDialog" id="aboutdialog1">
|
||||||
<property name="program-name" translatable="yes">Builder demo</property>
|
<property name="program-name" translatable="yes">Builder demo</property>
|
||||||
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
|
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
|
||||||
@@ -37,109 +106,8 @@
|
|||||||
<object class="GtkBox" id="vbox1">
|
<object class="GtkBox" id="vbox1">
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuBar" id="menubar1">
|
<object class="GtkPopoverMenuBar" id="menubar1">
|
||||||
<child internal-child="accessible">
|
<property name="menu-model">menubar</property>
|
||||||
<object class="AtkObject" id="a11y-menubar">
|
|
||||||
<property name="AtkObject::accessible-name">The menubar</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem">
|
|
||||||
<property name="label" translatable="yes">_File</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<child type="submenu">
|
|
||||||
<object class="GtkMenu">
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="new_item">
|
|
||||||
<property name="label" translatable="yes">_New</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="open_item">
|
|
||||||
<property name="label" translatable="yes">_Open</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="save_item">
|
|
||||||
<property name="label" translatable="yes">_Save</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="save_as_item">
|
|
||||||
<property name="label" translatable="yes">Save _As</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<accelerator key="s" modifiers="primary | shift-mask" signal="activate"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSeparatorMenuItem"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="quit_item">
|
|
||||||
<property name="label" translatable="yes">_Quit</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="action-name">win.quit</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem">
|
|
||||||
<property name="label" translatable="yes">_Edit</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<child type="submenu">
|
|
||||||
<object class="GtkMenu">
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="copy_item">
|
|
||||||
<property name="label" translatable="yes">_Copy</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="cut_item">
|
|
||||||
<property name="label" translatable="yes">_Cut</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="paste_item">
|
|
||||||
<property name="label" translatable="yes">_Paste</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem">
|
|
||||||
<property name="label" translatable="yes">_Help</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<child type="submenu">
|
|
||||||
<object class="GtkMenu">
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="help_item">
|
|
||||||
<property name="label" translatable="yes">_Help</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="action-name">win.help</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="about_item">
|
|
||||||
<property name="label" translatable="yes">_About</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="action-name">win.about</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
|||||||
@@ -129,13 +129,13 @@ demo_tagged_entry_size_allocate (GtkWidget *widget,
|
|||||||
baseline);
|
baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
demo_tagged_entry_grab_focus (GtkWidget *widget)
|
demo_tagged_entry_grab_focus (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
|
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
|
||||||
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
|
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
|
||||||
|
|
||||||
gtk_widget_grab_focus (priv->entry);
|
return gtk_widget_grab_focus (priv->entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
/* Drag-and-Drop
|
/* Drag-and-Drop
|
||||||
*
|
*
|
||||||
* I can't believe its not glade!
|
* I can't believe its not glade!
|
||||||
|
*
|
||||||
|
* Try right-clicking in the window.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
@@ -92,7 +94,7 @@ deserialize_widget (GtkDemoWidget *demo)
|
|||||||
static double pos_x, pos_y;
|
static double pos_x, pos_y;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
new_label_cb (GtkMenuItem *item,
|
new_label_cb (GtkWidget *button,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkFixed *fixed = data;
|
GtkFixed *fixed = data;
|
||||||
@@ -100,10 +102,12 @@ new_label_cb (GtkMenuItem *item,
|
|||||||
|
|
||||||
widget = gtk_label_new ("Label");
|
widget = gtk_label_new ("Label");
|
||||||
gtk_fixed_put (fixed, widget, pos_x, pos_y);
|
gtk_fixed_put (fixed, widget, pos_x, pos_y);
|
||||||
|
|
||||||
|
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
new_spinner_cb (GtkMenuItem *item,
|
new_spinner_cb (GtkWidget *button,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkFixed *fixed = data;
|
GtkFixed *fixed = data;
|
||||||
@@ -113,33 +117,39 @@ new_spinner_cb (GtkMenuItem *item,
|
|||||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
|
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
|
||||||
gtk_spinner_start (GTK_SPINNER (widget));
|
gtk_spinner_start (GTK_SPINNER (widget));
|
||||||
gtk_fixed_put (fixed, widget, pos_x, pos_y);
|
gtk_fixed_put (fixed, widget, pos_x, pos_y);
|
||||||
|
|
||||||
|
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
copy_cb (GtkWidget *child)
|
copy_cb (GtkWidget *button, GtkWidget *child)
|
||||||
{
|
{
|
||||||
GdkClipboard *clipboard;
|
GdkClipboard *clipboard;
|
||||||
GtkDemoWidget *demo;
|
GtkDemoWidget *demo;
|
||||||
|
|
||||||
g_print ("Copy %s\n", G_OBJECT_TYPE_NAME (child));
|
|
||||||
|
|
||||||
demo = serialize_widget (child);
|
demo = serialize_widget (child);
|
||||||
|
|
||||||
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
|
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
|
||||||
gdk_clipboard_set (clipboard, GTK_TYPE_DEMO_WIDGET, demo);
|
gdk_clipboard_set (clipboard, GTK_TYPE_DEMO_WIDGET, demo);
|
||||||
|
|
||||||
|
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
delete_cb (GtkWidget *child)
|
delete_cb (GtkWidget *button, GtkWidget *child)
|
||||||
{
|
{
|
||||||
gtk_widget_destroy (child);
|
gtk_widget_destroy (child);
|
||||||
|
|
||||||
|
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cut_cb (GtkWidget *child)
|
cut_cb (GtkWidget *button, GtkWidget *child)
|
||||||
{
|
{
|
||||||
copy_cb (child);
|
copy_cb (button, child);
|
||||||
delete_cb (child);
|
delete_cb (button, child);
|
||||||
|
|
||||||
|
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -175,7 +185,7 @@ value_read (GObject *source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paste_cb (GtkWidget *fixed)
|
paste_cb (GtkWidget *button, GtkWidget *fixed)
|
||||||
{
|
{
|
||||||
GdkClipboard *clipboard;
|
GdkClipboard *clipboard;
|
||||||
|
|
||||||
@@ -187,6 +197,8 @@ paste_cb (GtkWidget *fixed)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_print ("Don't know how to handle clipboard contents\n");
|
g_print ("Don't know how to handle clipboard contents\n");
|
||||||
|
|
||||||
|
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -205,7 +217,7 @@ edit_label_done (GtkWidget *entry, gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
edit_cb (GtkWidget *child)
|
edit_cb (GtkWidget *button, GtkWidget *child)
|
||||||
{
|
{
|
||||||
GtkWidget *fixed = gtk_widget_get_parent (child);
|
GtkWidget *fixed = gtk_widget_get_parent (child);
|
||||||
int x, y;
|
int x, y;
|
||||||
@@ -219,6 +231,7 @@ edit_cb (GtkWidget *child)
|
|||||||
g_object_set_data (G_OBJECT (entry), "label", child);
|
g_object_set_data (G_OBJECT (entry), "label", child);
|
||||||
|
|
||||||
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_label_get_text (GTK_LABEL (child)));
|
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_label_get_text (GTK_LABEL (child)));
|
||||||
|
gtk_editable_set_width_chars (GTK_EDITABLE (entry), 12);
|
||||||
g_signal_connect (entry, "activate", G_CALLBACK (edit_label_done), NULL);
|
g_signal_connect (entry, "activate", G_CALLBACK (edit_label_done), NULL);
|
||||||
gtk_fixed_put (GTK_FIXED (fixed), entry, x, y);
|
gtk_fixed_put (GTK_FIXED (fixed), entry, x, y);
|
||||||
gtk_widget_grab_focus (entry);
|
gtk_widget_grab_focus (entry);
|
||||||
@@ -230,6 +243,9 @@ edit_cb (GtkWidget *child)
|
|||||||
g_object_get (child, "active", &active, NULL);
|
g_object_get (child, "active", &active, NULL);
|
||||||
g_object_set (child, "active", !active, NULL);
|
g_object_set (child, "active", !active, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (button)
|
||||||
|
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -247,65 +263,65 @@ pressed_cb (GtkGesture *gesture,
|
|||||||
|
|
||||||
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_SECONDARY)
|
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_SECONDARY)
|
||||||
{
|
{
|
||||||
GdkRectangle rect;
|
|
||||||
GtkWidget *menu;
|
GtkWidget *menu;
|
||||||
|
GtkWidget *box;
|
||||||
GtkWidget *item;
|
GtkWidget *item;
|
||||||
GdkClipboard *clipboard;
|
GdkClipboard *clipboard;
|
||||||
|
|
||||||
pos_x = x;
|
pos_x = x;
|
||||||
pos_y = y;
|
pos_y = y;
|
||||||
|
|
||||||
menu = gtk_menu_new ();
|
menu = gtk_popover_new (widget);
|
||||||
item = gtk_menu_item_new_with_label ("New Label");
|
gtk_popover_set_has_arrow (GTK_POPOVER (menu), FALSE);
|
||||||
g_signal_connect (item, "activate", G_CALLBACK (new_label_cb), widget);
|
gtk_popover_set_pointing_to (GTK_POPOVER (menu), &(GdkRectangle){ x, y, 1, 1});
|
||||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
item = gtk_menu_item_new_with_label ("New Spinner");
|
gtk_container_add (GTK_CONTAINER (menu), box);
|
||||||
g_signal_connect (item, "activate", G_CALLBACK (new_spinner_cb), widget);
|
|
||||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
|
||||||
|
|
||||||
item = gtk_separator_menu_item_new ();
|
item = gtk_button_new_with_label ("New Label");
|
||||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||||
|
g_signal_connect (item, "clicked", G_CALLBACK (new_label_cb), widget);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), item);
|
||||||
|
item = gtk_button_new_with_label ("New Spinner");
|
||||||
|
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||||
|
g_signal_connect (item, "clicked", G_CALLBACK (new_spinner_cb), widget);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), item);
|
||||||
|
|
||||||
item = gtk_menu_item_new_with_label ("Edit");
|
item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), item);
|
||||||
|
|
||||||
|
item = gtk_button_new_with_label ("Edit");
|
||||||
|
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||||
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
||||||
g_signal_connect_swapped (item, "activate", G_CALLBACK (edit_cb), child);
|
g_signal_connect (item, "clicked", G_CALLBACK (edit_cb), child);
|
||||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
gtk_container_add (GTK_CONTAINER (box), item);
|
||||||
|
|
||||||
item = gtk_separator_menu_item_new ();
|
item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
|
||||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
gtk_container_add (GTK_CONTAINER (box), item);
|
||||||
|
|
||||||
item = gtk_menu_item_new_with_label ("Cut");
|
item = gtk_button_new_with_label ("Cut");
|
||||||
|
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||||
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
||||||
g_signal_connect_swapped (item, "activate", G_CALLBACK (cut_cb), child);
|
g_signal_connect (item, "clicked", G_CALLBACK (cut_cb), child);
|
||||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
gtk_container_add (GTK_CONTAINER (box), item);
|
||||||
item = gtk_menu_item_new_with_label ("Copy");
|
item = gtk_button_new_with_label ("Copy");
|
||||||
|
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||||
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
||||||
g_signal_connect_swapped (item, "activate", G_CALLBACK (copy_cb), child);
|
g_signal_connect (item, "clicked", G_CALLBACK (copy_cb), child);
|
||||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
gtk_container_add (GTK_CONTAINER (box), item);
|
||||||
item = gtk_menu_item_new_with_label ("Paste");
|
item = gtk_button_new_with_label ("Paste");
|
||||||
|
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||||
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
|
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
|
||||||
gtk_widget_set_sensitive (item,
|
gtk_widget_set_sensitive (item,
|
||||||
gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GTK_TYPE_DEMO_WIDGET));
|
gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GTK_TYPE_DEMO_WIDGET));
|
||||||
g_signal_connect_swapped (item, "activate", G_CALLBACK (paste_cb), widget);
|
g_signal_connect (item, "clicked", G_CALLBACK (paste_cb), widget);
|
||||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
gtk_container_add (GTK_CONTAINER (box), item);
|
||||||
item = gtk_menu_item_new_with_label ("Delete");
|
item = gtk_button_new_with_label ("Delete");
|
||||||
|
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
|
||||||
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
gtk_widget_set_sensitive (item, child != NULL && child != widget);
|
||||||
g_signal_connect_swapped (item, "activate", G_CALLBACK (delete_cb), child);
|
g_signal_connect (item, "clicked", G_CALLBACK (delete_cb), child);
|
||||||
gtk_container_add (GTK_CONTAINER (menu), item);
|
gtk_container_add (GTK_CONTAINER (box), item);
|
||||||
|
|
||||||
rect.x = x;
|
gtk_popover_popup (GTK_POPOVER (menu));
|
||||||
rect.y = y;
|
|
||||||
rect.width = 0;
|
|
||||||
rect.height = 0;
|
|
||||||
|
|
||||||
gtk_menu_popup_at_rect (GTK_MENU (menu),
|
|
||||||
gtk_native_get_surface (gtk_widget_get_native (widget)),
|
|
||||||
&rect,
|
|
||||||
GDK_GRAVITY_NORTH_WEST,
|
|
||||||
GDK_GRAVITY_NORTH_WEST,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,7 +341,7 @@ released_cb (GtkGesture *gesture,
|
|||||||
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_PRIMARY)
|
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_PRIMARY)
|
||||||
{
|
{
|
||||||
if (child != NULL && child != widget)
|
if (child != NULL && child != widget)
|
||||||
edit_cb (child);
|
edit_cb (NULL, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,29 @@
|
|||||||
/* Entry/Entry Buffer
|
/* Entry/Entry Undo
|
||||||
*
|
*
|
||||||
* GtkEntryBuffer provides the text content in a GtkEntry.
|
* GtkEntry can provide basic Undo/Redo support using standard keyboard
|
||||||
* Applications can provide their own buffer implementation,
|
* accelerators such as Primary+z to undo and Primary+Shift+z to redo.
|
||||||
* e.g. to provide secure handling for passwords in memory.
|
* Additionally, Primary+y can be used to redo.
|
||||||
|
*
|
||||||
|
* Use gtk_entry_set_enable_undo() to enable undo/redo support.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
do_entry_buffer (GtkWidget *do_widget)
|
do_entry_undo (GtkWidget *do_widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
GtkEntryBuffer *buffer;
|
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
gtk_window_set_title (GTK_WINDOW (window), "Entry Buffer");
|
gtk_window_set_title (GTK_WINDOW (window), "Entry Undo");
|
||||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
@@ -33,22 +34,13 @@ do_entry_buffer (GtkWidget *do_widget)
|
|||||||
|
|
||||||
label = gtk_label_new (NULL);
|
label = gtk_label_new (NULL);
|
||||||
gtk_label_set_markup (GTK_LABEL (label),
|
gtk_label_set_markup (GTK_LABEL (label),
|
||||||
"Entries share a buffer. Typing in one is reflected in the other.");
|
"Use Primary+z or Primary+Shift+z to undo or redo changes");
|
||||||
gtk_container_add (GTK_CONTAINER (vbox), label);
|
gtk_container_add (GTK_CONTAINER (vbox), label);
|
||||||
|
|
||||||
/* Create a buffer */
|
/* Create our entry */
|
||||||
buffer = gtk_entry_buffer_new (NULL, 0);
|
entry = gtk_entry_new ();
|
||||||
|
gtk_editable_set_enable_undo (GTK_EDITABLE (entry), TRUE);
|
||||||
/* Create our first entry */
|
|
||||||
entry = gtk_entry_new_with_buffer (buffer);
|
|
||||||
gtk_container_add (GTK_CONTAINER (vbox), entry);
|
gtk_container_add (GTK_CONTAINER (vbox), entry);
|
||||||
|
|
||||||
/* Create the second entry */
|
|
||||||
entry = gtk_entry_new_with_buffer (buffer);
|
|
||||||
gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
|
|
||||||
gtk_container_add (GTK_CONTAINER (vbox), entry);
|
|
||||||
|
|
||||||
g_object_unref (buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
@@ -52,7 +52,7 @@ do_expander (GtkWidget *do_widget)
|
|||||||
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (window));
|
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (window));
|
||||||
|
|
||||||
label = gtk_widget_get_last_child (area);
|
label = gtk_widget_get_last_child (area);
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (label), FALSE);
|
gtk_label_set_wrap (GTK_LABEL (label), FALSE);
|
||||||
gtk_widget_set_vexpand (label, FALSE);
|
gtk_widget_set_vexpand (label, FALSE);
|
||||||
|
|
||||||
expander = gtk_expander_new ("Details:");
|
expander = gtk_expander_new ("Details:");
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ do_filtermodel (GtkWidget *do_widget)
|
|||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/filtermodel/filtermodel.ui");
|
builder = gtk_builder_new_from_resource ("/filtermodel/filtermodel.ui");
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ create_label (void)
|
|||||||
{
|
{
|
||||||
GtkWidget *w = gtk_label_new ("pLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
|
GtkWidget *w = gtk_label_new ("pLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
|
||||||
|
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
|
gtk_label_set_wrap (GTK_LABEL (w), TRUE);
|
||||||
gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
|
gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
@@ -226,8 +226,8 @@ set_widget_type (GtkFishbowl *fishbowl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
next_button_clicked_cb (GtkButton *source,
|
fishbowl_next_button_clicked_cb (GtkButton *source,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkFishbowl *fishbowl = user_data;
|
GtkFishbowl *fishbowl = user_data;
|
||||||
int new_index;
|
int new_index;
|
||||||
@@ -241,8 +241,8 @@ next_button_clicked_cb (GtkButton *source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prev_button_clicked_cb (GtkButton *source,
|
fishbowl_prev_button_clicked_cb (GtkButton *source,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkFishbowl *fishbowl = user_data;
|
GtkFishbowl *fishbowl = user_data;
|
||||||
int new_index;
|
int new_index;
|
||||||
@@ -256,8 +256,8 @@ prev_button_clicked_cb (GtkButton *source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
changes_toggled_cb (GtkToggleButton *button,
|
fishbowl_changes_toggled_cb (GtkToggleButton *button,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
if (gtk_toggle_button_get_active (button))
|
if (gtk_toggle_button_get_active (button))
|
||||||
gtk_button_set_icon_name (GTK_BUTTON (button), "changes-prevent");
|
gtk_button_set_icon_name (GTK_BUTTON (button), "changes-prevent");
|
||||||
@@ -288,12 +288,6 @@ do_fishbowl (GtkWidget *do_widget)
|
|||||||
g_type_ensure (GTK_TYPE_FISHBOWL);
|
g_type_ensure (GTK_TYPE_FISHBOWL);
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/fishbowl/fishbowl.ui");
|
builder = gtk_builder_new_from_resource ("/fishbowl/fishbowl.ui");
|
||||||
gtk_builder_add_callback_symbols (builder,
|
|
||||||
"next_button_clicked_cb", G_CALLBACK (next_button_clicked_cb),
|
|
||||||
"prev_button_clicked_cb", G_CALLBACK (prev_button_clicked_cb),
|
|
||||||
"changes_toggled_cb", G_CALLBACK (changes_toggled_cb),
|
|
||||||
NULL);
|
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
@@ -306,6 +300,7 @@ do_fishbowl (GtkWidget *do_widget)
|
|||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
|
||||||
gtk_widget_realize (window);
|
gtk_widget_realize (window);
|
||||||
|
g_object_unref (builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
|
|||||||
@@ -15,13 +15,13 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="icon-name">pan-start-symbolic</property>
|
<property name="icon-name">pan-start-symbolic</property>
|
||||||
<signal name="clicked" handler="prev_button_clicked_cb" object="bowl" swapped="no"/>
|
<signal name="clicked" handler="fishbowl_prev_button_clicked_cb" object="bowl" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="icon-name">pan-end-symbolic</property>
|
<property name="icon-name">pan-end-symbolic</property>
|
||||||
<signal name="clicked" handler="next_button_clicked_cb" object="bowl" swapped="no"/>
|
<signal name="clicked" handler="fishbowl_next_button_clicked_cb" object="bowl" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<object class="GtkToggleButton" id="changes_allow">
|
<object class="GtkToggleButton" id="changes_allow">
|
||||||
<property name="icon-name">changes-allow</property>
|
<property name="icon-name">changes-allow</property>
|
||||||
<property name="relief">none</property>
|
<property name="relief">none</property>
|
||||||
<signal name="notify::active" handler="changes_toggled_cb"/>
|
<signal name="notify::active" handler="fishbowl_changes_toggled_cb"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<property name="can-focus">1</property>
|
<property name="can-focus">1</property>
|
||||||
<property name="receives-default">1</property>
|
<property name="receives-default">1</property>
|
||||||
<property name="tooltip-text">Reset</property>
|
<property name="tooltip-text">Reset</property>
|
||||||
<signal name="clicked" handler="reset" swapped="no"/>
|
<signal name="clicked" handler="font_features_reset_features" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage">
|
<object class="GtkImage">
|
||||||
<property name="icon-name">view-refresh-symbolic</property>
|
<property name="icon-name">view-refresh-symbolic</property>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<property name="receives-default">1</property>
|
<property name="receives-default">1</property>
|
||||||
<property name="font">Sans 12</property>
|
<property name="font">Sans 12</property>
|
||||||
<property name="level">family|style|size|variations|features</property>
|
<property name="level">family|style|size|variations|features</property>
|
||||||
<signal name="font-set" handler="font_changed" swapped="no"/>
|
<signal name="font-set" handler="font_features_font_changed" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
<object class="GtkComboBox" id="script_lang">
|
<object class="GtkComboBox" id="script_lang">
|
||||||
<property name="can-focus">1</property>
|
<property name="can-focus">1</property>
|
||||||
<property name="margin-top">10</property>
|
<property name="margin-top">10</property>
|
||||||
<signal name="changed" handler="script_changed" swapped="no"/>
|
<signal name="changed" handler="font_features_script_changed" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCellRendererText"/>
|
<object class="GtkCellRendererText"/>
|
||||||
<attributes>
|
<attributes>
|
||||||
@@ -137,7 +137,7 @@
|
|||||||
Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. Наш банк вчера же выплатил Ф.Я. Эйхгольду комиссию за ценные вещи. Эх, чужак, общий съём цен шляп (юфть) – вдрызг! В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
|
Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. Наш банк вчера же выплатил Ф.Я. Эйхгольду комиссию за ценные вещи. Эх, чужак, общий съём цен шляп (юфть) – вдрызг! В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
|
||||||
|
|
||||||
Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός</property>
|
Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός</property>
|
||||||
<signal name="activate" handler="stop_edit"/>
|
<signal name="activate" handler="font_features_stop_edit"/>
|
||||||
<property name="valign">start</property>
|
<property name="valign">start</property>
|
||||||
<property name="width-chars">50</property>
|
<property name="width-chars">50</property>
|
||||||
</object>
|
</object>
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
<property name="icon-name">document-edit-symbolic</property>
|
<property name="icon-name">document-edit-symbolic</property>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">end</property>
|
<property name="valign">end</property>
|
||||||
<signal name="toggled" handler="toggle_edit"/>
|
<signal name="toggled" handler="font_features_toggle_edit"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -15,10 +15,6 @@
|
|||||||
#include <pango/pangofc-font.h>
|
#include <pango/pangofc-font.h>
|
||||||
#include <hb.h>
|
#include <hb.h>
|
||||||
#include <hb-ot.h>
|
#include <hb-ot.h>
|
||||||
#include <hb-ft.h>
|
|
||||||
#include <freetype/ftmm.h>
|
|
||||||
#include <freetype/ftsnames.h>
|
|
||||||
#include <freetype/ttnameid.h>
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
#include "open-type-layout.h"
|
#include "open-type-layout.h"
|
||||||
@@ -484,7 +480,6 @@ update_script_combo (void)
|
|||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
hb_font_t *hb_font;
|
hb_font_t *hb_font;
|
||||||
gint i, j, k;
|
gint i, j, k;
|
||||||
FT_Face ft_face;
|
|
||||||
PangoFont *pango_font;
|
PangoFont *pango_font;
|
||||||
GHashTable *tags;
|
GHashTable *tags;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
@@ -505,8 +500,7 @@ update_script_combo (void)
|
|||||||
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
|
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
|
||||||
|
|
||||||
pango_font = get_pango_font ();
|
pango_font = get_pango_font ();
|
||||||
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
|
hb_font = pango_font_get_hb_font (pango_font);
|
||||||
hb_font = hb_ft_font_create (ft_face, NULL);
|
|
||||||
|
|
||||||
tags = g_hash_table_new_full (tag_pair_hash, tag_pair_equal, g_free, NULL);
|
tags = g_hash_table_new_full (tag_pair_hash, tag_pair_equal, g_free, NULL);
|
||||||
|
|
||||||
@@ -545,11 +539,8 @@ update_script_combo (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_face_destroy (hb_face);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
|
|
||||||
g_object_unref (pango_font);
|
g_object_unref (pango_font);
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, tags);
|
g_hash_table_iter_init (&iter, tags);
|
||||||
@@ -607,7 +598,6 @@ update_features (void)
|
|||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
guint script_index, lang_index;
|
guint script_index, lang_index;
|
||||||
PangoFont *pango_font;
|
PangoFont *pango_font;
|
||||||
FT_Face ft_face;
|
|
||||||
hb_font_t *hb_font;
|
hb_font_t *hb_font;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
@@ -632,8 +622,7 @@ update_features (void)
|
|||||||
-1);
|
-1);
|
||||||
|
|
||||||
pango_font = get_pango_font ();
|
pango_font = get_pango_font ();
|
||||||
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
|
hb_font = pango_font_get_hb_font (pango_font);
|
||||||
hb_font = hb_ft_font_create (ft_face, NULL);
|
|
||||||
|
|
||||||
if (hb_font)
|
if (hb_font)
|
||||||
{
|
{
|
||||||
@@ -715,11 +704,8 @@ update_features (void)
|
|||||||
|
|
||||||
g_free (feat);
|
g_free (feat);
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_face_destroy (hb_face);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
|
|
||||||
g_object_unref (pango_font);
|
g_object_unref (pango_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,24 +786,29 @@ axes_equal (gconstpointer v1, gconstpointer v2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_axis (FT_Var_Axis *ax, FT_Fixed value, int i)
|
add_axis (hb_face_t *hb_face,
|
||||||
|
hb_ot_var_axis_info_t *ax,
|
||||||
|
float value,
|
||||||
|
int i)
|
||||||
{
|
{
|
||||||
GtkWidget *axis_label;
|
GtkWidget *axis_label;
|
||||||
GtkWidget *axis_entry;
|
GtkWidget *axis_entry;
|
||||||
GtkWidget *axis_scale;
|
GtkWidget *axis_scale;
|
||||||
GtkAdjustment *adjustment;
|
GtkAdjustment *adjustment;
|
||||||
Axis *axis;
|
Axis *axis;
|
||||||
|
char name[20];
|
||||||
|
unsigned int name_len = 20;
|
||||||
|
|
||||||
axis_label = gtk_label_new (ax->name);
|
hb_ot_name_get_utf8 (hb_face, ax->name_id, HB_LANGUAGE_INVALID, &name_len, name);
|
||||||
|
|
||||||
|
axis_label = gtk_label_new (name);
|
||||||
gtk_widget_set_halign (axis_label, GTK_ALIGN_START);
|
gtk_widget_set_halign (axis_label, GTK_ALIGN_START);
|
||||||
gtk_widget_set_valign (axis_label, GTK_ALIGN_BASELINE);
|
gtk_widget_set_valign (axis_label, GTK_ALIGN_BASELINE);
|
||||||
gtk_grid_attach (GTK_GRID (variations_grid), axis_label, 0, i, 1, 1);
|
gtk_grid_attach (GTK_GRID (variations_grid), axis_label, 0, i, 1, 1);
|
||||||
adjustment = gtk_adjustment_new ((double)FixedToFloat(value),
|
adjustment = gtk_adjustment_new (value, ax->min_value, ax->max_value,
|
||||||
(double)FixedToFloat(ax->minimum),
|
|
||||||
(double)FixedToFloat(ax->maximum),
|
|
||||||
1.0, 10.0, 0.0);
|
1.0, 10.0, 0.0);
|
||||||
axis_scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
|
axis_scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
|
||||||
gtk_scale_add_mark (GTK_SCALE (axis_scale), (double)FixedToFloat(ax->def), GTK_POS_TOP, NULL);
|
gtk_scale_add_mark (GTK_SCALE (axis_scale), ax->default_value, GTK_POS_TOP, NULL);
|
||||||
gtk_widget_set_valign (axis_scale, GTK_ALIGN_BASELINE);
|
gtk_widget_set_valign (axis_scale, GTK_ALIGN_BASELINE);
|
||||||
gtk_widget_set_hexpand (axis_scale, TRUE);
|
gtk_widget_set_hexpand (axis_scale, TRUE);
|
||||||
gtk_widget_set_size_request (axis_scale, 100, -1);
|
gtk_widget_set_size_request (axis_scale, 100, -1);
|
||||||
@@ -842,9 +833,7 @@ add_axis (FT_Var_Axis *ax, FT_Fixed value, int i)
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
int n_axes;
|
unsigned int index;
|
||||||
guint32 *axes;
|
|
||||||
float *coords;
|
|
||||||
} Instance;
|
} Instance;
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
@@ -870,559 +859,32 @@ free_instance (gpointer data)
|
|||||||
Instance *instance = data;
|
Instance *instance = data;
|
||||||
|
|
||||||
g_free (instance->name);
|
g_free (instance->name);
|
||||||
g_free (instance->axes);
|
|
||||||
g_free (instance->coords);
|
|
||||||
g_free (instance);
|
g_free (instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GHashTable *instances;
|
static GHashTable *instances;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const FT_UShort platform_id;
|
|
||||||
const FT_UShort encoding_id;
|
|
||||||
const char fromcode[12];
|
|
||||||
} FtEncoding;
|
|
||||||
|
|
||||||
#define TT_ENCODING_DONT_CARE 0xffff
|
|
||||||
|
|
||||||
static const FtEncoding ftEncoding[] = {
|
|
||||||
{ TT_PLATFORM_APPLE_UNICODE, TT_ENCODING_DONT_CARE, "UTF-16BE" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, "MACINTOSH" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_ID_JAPANESE, "SJIS" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_SYMBOL_CS, "UTF-16BE" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, "UTF-16BE" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, "SJIS-WIN" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_GB2312, "GB2312" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, "BIG-5" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_WANSUNG, "Wansung" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_JOHAB, "Johab" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_UCS_4, "UTF-16BE" },
|
|
||||||
{ TT_PLATFORM_ISO, TT_ISO_ID_7BIT_ASCII, "ASCII" },
|
|
||||||
{ TT_PLATFORM_ISO, TT_ISO_ID_10646, "UTF-16BE" },
|
|
||||||
{ TT_PLATFORM_ISO, TT_ISO_ID_8859_1, "ISO-8859-1" },
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const FT_UShort platform_id;
|
|
||||||
const FT_UShort language_id;
|
|
||||||
const char lang[8];
|
|
||||||
} FtLanguage;
|
|
||||||
|
|
||||||
#define TT_LANGUAGE_DONT_CARE 0xffff
|
|
||||||
|
|
||||||
static const FtLanguage ftLanguage[] = {
|
|
||||||
{ TT_PLATFORM_APPLE_UNICODE, TT_LANGUAGE_DONT_CARE, "" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ENGLISH, "en" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FRENCH, "fr" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GERMAN, "de" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ITALIAN, "it" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_DUTCH, "nl" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SWEDISH, "sv" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SPANISH, "es" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_DANISH, "da" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_PORTUGUESE, "pt" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_NORWEGIAN, "no" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_HEBREW, "he" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_JAPANESE, "ja" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ARABIC, "ar" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FINNISH, "fi" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GREEK, "el" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ICELANDIC, "is" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALTESE, "mt" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TURKISH, "tr" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CROATIAN, "hr" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CHINESE_TRADITIONAL, "zh-tw" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_URDU, "ur" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_HINDI, "hi" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_THAI, "th" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KOREAN, "ko" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LITHUANIAN, "lt" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_POLISH, "pl" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_HUNGARIAN, "hu" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ESTONIAN, "et" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LETTISH, "lv" },
|
|
||||||
/* { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SAAMISK, ??? */
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FAEROESE, "fo" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FARSI, "fa" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_RUSSIAN, "ru" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CHINESE_SIMPLIFIED, "zh-cn" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FLEMISH, "nl" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_IRISH, "ga" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ALBANIAN, "sq" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ROMANIAN, "ro" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CZECH, "cs" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SLOVAK, "sk" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SLOVENIAN, "sl" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_YIDDISH, "yi" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SERBIAN, "sr" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MACEDONIAN, "mk" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BULGARIAN, "bg" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_UKRAINIAN, "uk" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BYELORUSSIAN, "be" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_UZBEK, "uz" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KAZAKH, "kk" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI, "az" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT, "az" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT, "ar" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ARMENIAN, "hy" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GEORGIAN, "ka" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MOLDAVIAN, "mo" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KIRGHIZ, "ky" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TAJIKI, "tg" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TURKMEN, "tk" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MONGOLIAN, "mo" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT,"mo" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT, "mo" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_PASHTO, "ps" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KURDISH, "ku" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KASHMIRI, "ks" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SINDHI, "sd" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TIBETAN, "bo" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_NEPALI, "ne" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SANSKRIT, "sa" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MARATHI, "mr" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BENGALI, "bn" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ASSAMESE, "as" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GUJARATI, "gu" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_PUNJABI, "pa" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ORIYA, "or" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAYALAM, "ml" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KANNADA, "kn" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TAMIL, "ta" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TELUGU, "te" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SINHALESE, "si" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BURMESE, "my" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KHMER, "km" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LAO, "lo" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_VIETNAMESE, "vi" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_INDONESIAN, "id" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TAGALOG, "tl" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAY_ROMAN_SCRIPT, "ms" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAY_ARABIC_SCRIPT, "ms" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AMHARIC, "am" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TIGRINYA, "ti" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GALLA, "om" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SOMALI, "so" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SWAHILI, "sw" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_RUANDA, "rw" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_RUNDI, "rn" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CHEWA, "ny" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAGASY, "mg" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ESPERANTO, "eo" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_WELSH, "cy" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BASQUE, "eu" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CATALAN, "ca" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LATIN, "la" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_QUECHUA, "qu" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GUARANI, "gn" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AYMARA, "ay" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TATAR, "tt" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_UIGHUR, "ug" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_DZONGKHA, "dz" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_JAVANESE, "jw" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SUNDANESE, "su" },
|
|
||||||
|
|
||||||
#if 0 /* these seem to be errors that have been dropped */
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SCOTTISH_GAELIC },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_IRISH_GAELIC },
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The following codes are new as of 2000-03-10 */
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GALICIAN, "gl" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AFRIKAANS, "af" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BRETON, "br" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_INUKTITUT, "iu" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SCOTTISH_GAELIC, "gd" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MANX_GAELIC, "gv" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_IRISH_GAELIC, "ga" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TONGAN, "to" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GREEK_POLYTONIC, "el" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GREELANDIC, "ik" },
|
|
||||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT,"az" },
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_SAUDI_ARABIA, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_IRAQ, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_EGYPT, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_LIBYA, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_ALGERIA, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_MOROCCO, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_TUNISIA, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_OMAN, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_YEMEN, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_SYRIA, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_JORDAN, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_LEBANON, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_KUWAIT, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_UAE, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_BAHRAIN, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_QATAR, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BULGARIAN_BULGARIA, "bg" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CATALAN_SPAIN, "ca" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_TAIWAN, "zh-tw" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_PRC, "zh-cn" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_HONG_KONG, "zh-hk" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_SINGAPORE, "zh-sg" },
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_MACAU, "zh-mo" },
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CZECH_CZECH_REPUBLIC, "cs" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DANISH_DENMARK, "da" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_GERMANY, "de" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_SWITZERLAND, "de" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_AUSTRIA, "de" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_LUXEMBOURG, "de" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_LIECHTENSTEI, "de" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GREEK_GREECE, "el" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_UNITED_STATES, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_UNITED_KINGDOM, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_AUSTRALIA, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_CANADA, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_NEW_ZEALAND, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_IRELAND, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_SOUTH_AFRICA, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_JAMAICA, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_CARIBBEAN, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_BELIZE, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_TRINIDAD, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_ZIMBABWE, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_PHILIPPINES, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT,"es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_MEXICO, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT,"es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_GUATEMALA, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_COSTA_RICA, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PANAMA, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC,"es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_VENEZUELA, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_COLOMBIA, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PERU, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_ARGENTINA, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_ECUADOR, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_CHILE, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_URUGUAY, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PARAGUAY, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_BOLIVIA, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_EL_SALVADOR, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_HONDURAS, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_NICARAGUA, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PUERTO_RICO, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FINNISH_FINLAND, "fi" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_FRANCE, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_BELGIUM, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_CANADA, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_SWITZERLAND, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_LUXEMBOURG, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_MONACO, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HEBREW_ISRAEL, "he" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HUNGARIAN_HUNGARY, "hu" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ICELANDIC_ICELAND, "is" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ITALIAN_ITALY, "it" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ITALIAN_SWITZERLAND, "it" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_JAPANESE_JAPAN, "ja" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA,"ko" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KOREAN_JOHAB_KOREA, "ko" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DUTCH_NETHERLANDS, "nl" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DUTCH_BELGIUM, "nl" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL, "no" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK, "nn" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_POLISH_POLAND, "pl" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PORTUGUESE_BRAZIL, "pt" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PORTUGUESE_PORTUGAL, "pt" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND,"rm" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ROMANIAN_ROMANIA, "ro" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MOLDAVIAN_MOLDAVIA, "mo" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_RUSSIAN_RUSSIA, "ru" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_RUSSIAN_MOLDAVIA, "ru" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CROATIAN_CROATIA, "hr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SERBIAN_SERBIA_LATIN, "sr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC, "sr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SLOVAK_SLOVAKIA, "sk" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ALBANIAN_ALBANIA, "sq" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SWEDISH_SWEDEN, "sv" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SWEDISH_FINLAND, "sv" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_THAI_THAILAND, "th" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TURKISH_TURKEY, "tr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_URDU_PAKISTAN, "ur" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_INDONESIAN_INDONESIA, "id" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_UKRAINIAN_UKRAINE, "uk" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BELARUSIAN_BELARUS, "be" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SLOVENE_SLOVENIA, "sl" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ESTONIAN_ESTONIA, "et" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LATVIAN_LATVIA, "lv" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LITHUANIAN_LITHUANIA, "lt" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA,"lt" },
|
|
||||||
|
|
||||||
#ifdef TT_MS_LANGID_MAORI_NEW_ZELAND
|
|
||||||
/* this seems to be an error that have been dropped */
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MAORI_NEW_ZEALAND, "mi" },
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FARSI_IRAN, "fa" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_VIETNAMESE_VIET_NAM, "vi" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARMENIAN_ARMENIA, "hy" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN, "az" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC, "az" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BASQUE_SPAIN, "eu" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SORBIAN_GERMANY, "wen" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MACEDONIAN_MACEDONIA, "mk" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SUTU_SOUTH_AFRICA, "st" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TSONGA_SOUTH_AFRICA, "ts" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TSWANA_SOUTH_AFRICA, "tn" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_VENDA_SOUTH_AFRICA, "ven" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_XHOSA_SOUTH_AFRICA, "xh" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ZULU_SOUTH_AFRICA, "zu" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA, "af" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GEORGIAN_GEORGIA, "ka" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS, "fo" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HINDI_INDIA, "hi" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALTESE_MALTA, "mt" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SAAMI_LAPONIA, "se" },
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM,"gd" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_IRISH_GAELIC_IRELAND, "ga" },
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALAY_MALAYSIA, "ms" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM, "ms" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KAZAK_KAZAKSTAN, "kk" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SWAHILI_KENYA, "sw" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN, "uz" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC, "uz" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TATAR_TATARSTAN, "tt" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BENGALI_INDIA, "bn" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PUNJABI_INDIA, "pa" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GUJARATI_INDIA, "gu" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ORIYA_INDIA, "or" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAMIL_INDIA, "ta" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TELUGU_INDIA, "te" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KANNADA_INDIA, "kn" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALAYALAM_INDIA, "ml" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ASSAMESE_INDIA, "as" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MARATHI_INDIA, "mr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SANSKRIT_INDIA, "sa" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KONKANI_INDIA, "kok" },
|
|
||||||
|
|
||||||
/* new as of 2001-01-01 */
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_GENERAL, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_GENERAL, "zh" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_GENERAL, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_WEST_INDIES, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_REUNION, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_CONGO, "fr" },
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_SENEGAL, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_CAMEROON, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_COTE_D_IVOIRE, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_MALI, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA,"bs" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_URDU_INDIA, "ur" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAJIK_TAJIKISTAN, "tg" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_YIDDISH_GERMANY, "yi" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN, "ky" },
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TURKMEN_TURKMENISTAN, "tk" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MONGOLIAN_MONGOLIA, "mn" },
|
|
||||||
|
|
||||||
/* the following seems to be inconsistent;
|
|
||||||
here is the current "official" way: */
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIBETAN_BHUTAN, "bo" },
|
|
||||||
/* and here is what is used by Passport SDK */
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIBETAN_CHINA, "bo" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DZONGHKA_BHUTAN, "dz" },
|
|
||||||
/* end of inconsistency */
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_WELSH_WALES, "cy" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KHMER_CAMBODIA, "km" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LAO_LAOS, "lo" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BURMESE_MYANMAR, "my" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GALICIAN_SPAIN, "gl" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MANIPURI_INDIA, "mni" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SINDHI_INDIA, "sd" },
|
|
||||||
/* the following one is only encountered in Microsoft RTF specification */
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KASHMIRI_PAKISTAN, "ks" },
|
|
||||||
/* the following one is not in the Passport list, looks like an omission */
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KASHMIRI_INDIA, "ks" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NEPALI_NEPAL, "ne" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NEPALI_INDIA, "ne" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRISIAN_NETHERLANDS, "fy" },
|
|
||||||
|
|
||||||
/* new as of 2001-03-01 (from Office Xp) */
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_HONG_KONG, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_INDIA, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_MALAYSIA, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_SINGAPORE, "en" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SYRIAC_SYRIA, "syr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SINHALESE_SRI_LANKA, "si" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHEROKEE_UNITED_STATES, "chr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_INUKTITUT_CANADA, "iu" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AMHARIC_ETHIOPIA, "am" },
|
|
||||||
#if 0
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAMAZIGHT_MOROCCO },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN },
|
|
||||||
#endif
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PASHTO_AFGHANISTAN, "ps" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FILIPINO_PHILIPPINES, "phi" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DHIVEHI_MALDIVES, "div" },
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_OROMO_ETHIOPIA, "om" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIGRIGNA_ETHIOPIA, "ti" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIGRIGNA_ERYTHREA, "ti" },
|
|
||||||
|
|
||||||
/* New additions from Windows Xp/Passport SDK 2001-11-10. */
|
|
||||||
|
|
||||||
/* don't ask what this one means... It is commented out currently. */
|
|
||||||
#if 0
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GREEK_GREECE2 },
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_UNITED_STATES, "es" },
|
|
||||||
/* The following two IDs blatantly violate MS specs by using a */
|
|
||||||
/* sublanguage >,. */
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_LATIN_AMERICA, "es" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_NORTH_AFRICA, "fr" },
|
|
||||||
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_MOROCCO, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_HAITI, "fr" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BENGALI_BANGLADESH, "bn" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN, "ar" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN,"mn" },
|
|
||||||
#if 0
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_EDO_NIGERIA },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FULFULDE_NIGERIA },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_IBIBIO_NIGERIA },
|
|
||||||
#endif
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HAUSA_NIGERIA, "ha" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_YORUBA_NIGERIA, "yo" },
|
|
||||||
/* language codes from, to, are (still) unknown. */
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_IGBO_NIGERIA, "ibo" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KANURI_NIGERIA, "kau" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GUARANI_PARAGUAY, "gn" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HAWAIIAN_UNITED_STATES, "haw" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LATIN, "la" },
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SOMALI_SOMALIA, "so" },
|
|
||||||
#if 0
|
|
||||||
/* Note: Yi does not have a (proper) ISO 639-2 code, since it is mostly */
|
|
||||||
/* not written (but OTOH the peculiar writing system is worth */
|
|
||||||
/* studying). */
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_YI_CHINA },
|
|
||||||
#endif
|
|
||||||
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES,"pap" },
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
FcSfntNameLanguage (FT_SfntName *sname)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
FT_UShort platform_id = sname->platform_id;
|
|
||||||
FT_UShort language_id = sname->language_id;
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (ftLanguage); i++)
|
|
||||||
if (ftLanguage[i].platform_id == platform_id &&
|
|
||||||
(ftLanguage[i].language_id == TT_LANGUAGE_DONT_CARE ||
|
|
||||||
ftLanguage[i].language_id == language_id))
|
|
||||||
{
|
|
||||||
if (ftLanguage[i].lang[0] == '\0')
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
return ftLanguage[i].lang;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
FcSfntNameTranscode (FT_SfntName *name)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
const char *fromcode;
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (ftEncoding); i++)
|
|
||||||
if (ftEncoding[i].platform_id == name->platform_id &&
|
|
||||||
(ftEncoding[i].encoding_id == TT_ENCODING_DONT_CARE ||
|
|
||||||
ftEncoding[i].encoding_id == name->encoding_id))
|
|
||||||
break;
|
|
||||||
if (i == G_N_ELEMENTS (ftEncoding))
|
|
||||||
return NULL;
|
|
||||||
fromcode = ftEncoding[i].fromcode;
|
|
||||||
|
|
||||||
return g_convert ((const char *)name->string, name->string_len, "UTF-8", fromcode, NULL, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
get_sfnt_name (FT_Face ft_face,
|
|
||||||
guint nameid)
|
|
||||||
{
|
|
||||||
guint count;
|
|
||||||
guint i, j;
|
|
||||||
const char * const *langs = g_get_language_names ();
|
|
||||||
char *res = NULL;
|
|
||||||
guint pos = G_MAXUINT;
|
|
||||||
|
|
||||||
count = FT_Get_Sfnt_Name_Count (ft_face);
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
FT_SfntName name;
|
|
||||||
const char *lang;
|
|
||||||
|
|
||||||
if (FT_Get_Sfnt_Name (ft_face, i, &name) != 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (name.name_id != nameid)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
lang = FcSfntNameLanguage (&name);
|
|
||||||
for (j = 0; j < pos && langs[j]; j++)
|
|
||||||
{
|
|
||||||
if (strcmp (lang, langs[j]) == 0)
|
|
||||||
{
|
|
||||||
pos = j;
|
|
||||||
g_free (res);
|
|
||||||
res = FcSfntNameTranscode (&name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pos == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
is_valid_subfamily_id (guint id)
|
|
||||||
{
|
|
||||||
return id == 2 || id == 17 || (255 < id && id < 32768);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_instance (FT_Face ft_face,
|
add_instance (hb_face_t *face,
|
||||||
FT_MM_Var *ft_mm_var,
|
unsigned int index,
|
||||||
FT_Var_Named_Style *ns,
|
GtkWidget *combo,
|
||||||
GtkWidget *combo,
|
int pos)
|
||||||
int pos)
|
|
||||||
{
|
{
|
||||||
Instance *instance;
|
Instance *instance;
|
||||||
int i;
|
hb_ot_name_id_t name_id;
|
||||||
|
char name[20];
|
||||||
|
unsigned int name_len = 20;
|
||||||
|
|
||||||
instance = g_new0 (Instance, 1);
|
instance = g_new0 (Instance, 1);
|
||||||
|
|
||||||
if (is_valid_subfamily_id (ns->strid))
|
name_id = hb_ot_var_named_instance_get_subfamily_name_id (face, index);
|
||||||
instance->name = get_sfnt_name (ft_face, ns->strid);
|
hb_ot_name_get_utf8 (face, name_id, HB_LANGUAGE_INVALID, &name_len, name);
|
||||||
if (!instance->name)
|
|
||||||
instance->name = g_strdup_printf ("Instance %d", pos);
|
instance->name = g_strdup (name);
|
||||||
|
instance->index = index;
|
||||||
|
|
||||||
g_hash_table_add (instances, instance);
|
g_hash_table_add (instances, instance);
|
||||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), instance->name);
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), instance->name);
|
||||||
|
|
||||||
instance->n_axes = ft_mm_var->num_axis;
|
|
||||||
instance->axes = g_new (guint32, ft_mm_var->num_axis);
|
|
||||||
instance->coords = g_new (float, ft_mm_var->num_axis);
|
|
||||||
|
|
||||||
for (i = 0; i < ft_mm_var->num_axis; i++)
|
|
||||||
{
|
|
||||||
instance->axes[i] = ft_mm_var->axis[i].tag;
|
|
||||||
instance->coords[i] = FixedToFloat(ns->coords[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1439,6 +901,13 @@ instance_changed (GtkComboBox *combo)
|
|||||||
Instance *instance;
|
Instance *instance;
|
||||||
Instance ikey;
|
Instance ikey;
|
||||||
int i;
|
int i;
|
||||||
|
unsigned int coords_length;
|
||||||
|
float *coords = NULL;
|
||||||
|
hb_ot_var_axis_info_t *ai = NULL;
|
||||||
|
unsigned int n_axes;
|
||||||
|
PangoFont *pango_font = NULL;
|
||||||
|
hb_font_t *hb_font;
|
||||||
|
hb_face_t *hb_face;
|
||||||
|
|
||||||
text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo));
|
text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo));
|
||||||
if (text[0] == '\0')
|
if (text[0] == '\0')
|
||||||
@@ -1452,17 +921,29 @@ instance_changed (GtkComboBox *combo)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < instance->n_axes; i++)
|
pango_font = get_pango_font ();
|
||||||
|
hb_font = pango_font_get_hb_font (pango_font);
|
||||||
|
hb_face = hb_font_get_face (hb_font);
|
||||||
|
|
||||||
|
n_axes = hb_ot_var_get_axis_infos (hb_face, 0, NULL, NULL);
|
||||||
|
ai = g_new (hb_ot_var_axis_info_t, n_axes);
|
||||||
|
hb_ot_var_get_axis_infos (hb_face, 0, &n_axes, ai);
|
||||||
|
|
||||||
|
coords = g_new (float, n_axes);
|
||||||
|
hb_ot_var_named_instance_get_design_coords (hb_face,
|
||||||
|
instance->index,
|
||||||
|
&coords_length,
|
||||||
|
coords);
|
||||||
|
|
||||||
|
for (i = 0; i < n_axes; i++)
|
||||||
{
|
{
|
||||||
Axis *axis;
|
Axis *axis;
|
||||||
Axis akey;
|
Axis akey;
|
||||||
guint32 tag;
|
|
||||||
gdouble value;
|
gdouble value;
|
||||||
|
|
||||||
tag = instance->axes[i];
|
value = coords[ai[i].axis_index];
|
||||||
value = instance->coords[i];
|
|
||||||
|
|
||||||
akey.tag = tag;
|
akey.tag = ai[i].tag;
|
||||||
axis = g_hash_table_lookup (axes, &akey);
|
axis = g_hash_table_lookup (axes, &akey);
|
||||||
if (axis)
|
if (axis)
|
||||||
{
|
{
|
||||||
@@ -1474,17 +955,31 @@ instance_changed (GtkComboBox *combo)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
g_free (text);
|
g_free (text);
|
||||||
|
g_clear_object (&pango_font);
|
||||||
|
g_free (ai);
|
||||||
|
g_free (coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
matches_instance (FT_Var_Named_Style *instance,
|
matches_instance (hb_face_t *hb_face,
|
||||||
FT_Fixed *coords,
|
unsigned int index,
|
||||||
FT_UInt num_coords)
|
unsigned int n_axes,
|
||||||
|
float *coords)
|
||||||
{
|
{
|
||||||
FT_UInt i;
|
float *instance_coords;
|
||||||
|
unsigned int coords_length;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < num_coords; i++)
|
instance_coords = g_new (float, n_axes);
|
||||||
if (coords[i] != instance->coords[i])
|
coords_length = n_axes;
|
||||||
|
|
||||||
|
hb_ot_var_named_instance_get_design_coords (hb_face,
|
||||||
|
index,
|
||||||
|
&coords_length,
|
||||||
|
instance_coords);
|
||||||
|
|
||||||
|
for (i = 0; i < n_axes; i++)
|
||||||
|
if (instance_coords[i] != coords[i])
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1515,14 +1010,31 @@ add_font_plane (int i)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: This doesn't work if the font has an avar table */
|
||||||
|
static float
|
||||||
|
denorm_coord (hb_ot_var_axis_info_t *axis, int coord)
|
||||||
|
{
|
||||||
|
float r = coord / 16384.0;
|
||||||
|
|
||||||
|
if (coord < 0)
|
||||||
|
return axis->default_value + r * (axis->default_value - axis->min_value);
|
||||||
|
else
|
||||||
|
return axis->default_value + r * (axis->max_value - axis->default_value);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_font_variations (void)
|
update_font_variations (void)
|
||||||
{
|
{
|
||||||
GtkWidget *child, *next;
|
GtkWidget *child, *next;
|
||||||
PangoFont *pango_font;
|
PangoFont *pango_font = NULL;
|
||||||
FT_Face ft_face;
|
hb_font_t *hb_font;
|
||||||
FT_MM_Var *ft_mm_var;
|
hb_face_t *hb_face;
|
||||||
FT_Error ret;
|
unsigned int n_axes;
|
||||||
|
hb_ot_var_axis_info_t *ai = NULL;
|
||||||
|
float *design_coords = NULL;
|
||||||
|
const int *coords;
|
||||||
|
unsigned int length;
|
||||||
|
int i;
|
||||||
|
|
||||||
child = gtk_widget_get_first_child (variations_grid);
|
child = gtk_widget_get_first_child (variations_grid);
|
||||||
while (child != NULL)
|
while (child != NULL)
|
||||||
@@ -1538,81 +1050,82 @@ update_font_variations (void)
|
|||||||
g_hash_table_remove_all (instances);
|
g_hash_table_remove_all (instances);
|
||||||
|
|
||||||
pango_font = get_pango_font ();
|
pango_font = get_pango_font ();
|
||||||
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
|
hb_font = pango_font_get_hb_font (pango_font);
|
||||||
|
hb_face = hb_font_get_face (hb_font);
|
||||||
|
|
||||||
ret = FT_Get_MM_Var (ft_face, &ft_mm_var);
|
n_axes = hb_ot_var_get_axis_infos (hb_face, 0, NULL, NULL);
|
||||||
if (ret == 0)
|
if (n_axes == 0)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
ai = g_new0 (hb_ot_var_axis_info_t, n_axes);
|
||||||
|
design_coords = g_new (float, n_axes);
|
||||||
|
|
||||||
|
hb_ot_var_get_axis_infos (hb_face, 0, &n_axes, ai);
|
||||||
|
coords = hb_font_get_var_coords_normalized (hb_font, &length);
|
||||||
|
for (i = 0; i < length; i++)
|
||||||
|
design_coords[i] = denorm_coord (&ai[i], coords[i]);
|
||||||
|
|
||||||
|
if (hb_ot_var_get_named_instance_count (hb_face) > 0)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
GtkWidget *label;
|
||||||
FT_Fixed *coords;
|
GtkWidget *combo;
|
||||||
|
|
||||||
coords = g_new (FT_Fixed, ft_mm_var->num_axis);
|
label = gtk_label_new ("Instance");
|
||||||
ret = FT_Get_Var_Design_Coordinates (ft_face, ft_mm_var->num_axis, coords);
|
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||||
|
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||||
|
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
||||||
|
gtk_grid_attach (GTK_GRID (variations_grid), label, 0, -1, 2, 1);
|
||||||
|
|
||||||
if (ft_mm_var->num_namedstyles > 0)
|
combo = gtk_combo_box_text_new ();
|
||||||
|
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "");
|
||||||
|
|
||||||
|
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
|
||||||
|
add_instance (hb_face, i, combo, i);
|
||||||
|
|
||||||
|
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
|
||||||
{
|
{
|
||||||
GtkWidget *label;
|
if (matches_instance (hb_face, i, n_axes, design_coords))
|
||||||
GtkWidget *combo;
|
{
|
||||||
|
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i + 1);
|
||||||
label = gtk_label_new ("Instance");
|
break;
|
||||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
}
|
||||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
|
||||||
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
|
||||||
gtk_grid_attach (GTK_GRID (variations_grid), label, 0, -1, 2, 1);
|
|
||||||
|
|
||||||
combo = gtk_combo_box_text_new ();
|
|
||||||
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
|
|
||||||
g_signal_connect (combo, "changed", G_CALLBACK (instance_changed), NULL);
|
|
||||||
gtk_grid_attach (GTK_GRID (variations_grid), combo, 1, -1, 2, 1);
|
|
||||||
|
|
||||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "");
|
|
||||||
|
|
||||||
for (i = 0; i < ft_mm_var->num_namedstyles; i++)
|
|
||||||
add_instance (ft_face, ft_mm_var, &ft_mm_var->namedstyle[i], combo, i);
|
|
||||||
for (i = 0; i < ft_mm_var->num_namedstyles; i++)
|
|
||||||
{
|
|
||||||
if (matches_instance (&ft_mm_var->namedstyle[i], coords, ft_mm_var->num_axis))
|
|
||||||
{
|
|
||||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i + 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
instance_combo = combo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0)
|
gtk_grid_attach (GTK_GRID (variations_grid), combo, 1, -1, 2, 1);
|
||||||
{
|
g_signal_connect (combo, "changed", G_CALLBACK (instance_changed), NULL);
|
||||||
for (i = 0; i < ft_mm_var->num_axis; i++)
|
instance_combo = combo;
|
||||||
add_axis (&ft_mm_var->axis[i], coords[i], i);
|
}
|
||||||
|
|
||||||
add_font_plane (ft_mm_var->num_axis);
|
for (i = 0; i < n_axes; i++)
|
||||||
}
|
add_axis (hb_face, &ai[i], design_coords[i], i);
|
||||||
g_free (coords);
|
|
||||||
free (ft_mm_var);
|
|
||||||
}
|
|
||||||
|
|
||||||
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
|
add_font_plane (n_axes);
|
||||||
g_object_unref (pango_font);
|
|
||||||
|
done:
|
||||||
|
g_clear_object (&pango_font);
|
||||||
|
g_free (ai);
|
||||||
|
g_free (design_coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
font_changed (void)
|
font_features_font_changed (void)
|
||||||
{
|
{
|
||||||
update_script_combo ();
|
update_script_combo ();
|
||||||
update_features ();
|
update_features ();
|
||||||
update_font_variations ();
|
update_font_variations ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
script_changed (void)
|
font_features_script_changed (void)
|
||||||
{
|
{
|
||||||
update_features ();
|
update_features ();
|
||||||
update_display ();
|
update_display ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
reset_features (void)
|
font_features_reset_features (void)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
@@ -1657,8 +1170,8 @@ switch_to_label (void)
|
|||||||
update_display ();
|
update_display ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
toggle_edit (void)
|
font_features_toggle_edit (void)
|
||||||
{
|
{
|
||||||
if (strcmp (gtk_stack_get_visible_child_name (GTK_STACK (stack)), "label") == 0)
|
if (strcmp (gtk_stack_get_visible_child_name (GTK_STACK (stack)), "label") == 0)
|
||||||
switch_to_entry ();
|
switch_to_entry ();
|
||||||
@@ -1666,8 +1179,8 @@ toggle_edit (void)
|
|||||||
switch_to_label ();
|
switch_to_label ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
stop_edit (void)
|
font_features_stop_edit (void)
|
||||||
{
|
{
|
||||||
g_signal_emit_by_name (edit_toggle, "clicked");
|
g_signal_emit_by_name (edit_toggle, "clicked");
|
||||||
}
|
}
|
||||||
@@ -1682,7 +1195,7 @@ entry_key_press (GtkEventController *controller,
|
|||||||
if (keyval == GDK_KEY_Escape)
|
if (keyval == GDK_KEY_Escape)
|
||||||
{
|
{
|
||||||
gtk_editable_set_text (GTK_EDITABLE (entry), text);
|
gtk_editable_set_text (GTK_EDITABLE (entry), text);
|
||||||
stop_edit ();
|
font_features_stop_edit ();
|
||||||
return GDK_EVENT_STOP;
|
return GDK_EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1702,14 +1215,6 @@ do_font_features (GtkWidget *do_widget)
|
|||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/font_features/font-features.ui");
|
builder = gtk_builder_new_from_resource ("/font_features/font-features.ui");
|
||||||
|
|
||||||
gtk_builder_add_callback_symbol (builder, "update_display", update_display);
|
|
||||||
gtk_builder_add_callback_symbol (builder, "font_changed", font_changed);
|
|
||||||
gtk_builder_add_callback_symbol (builder, "script_changed", script_changed);
|
|
||||||
gtk_builder_add_callback_symbol (builder, "reset", reset_features);
|
|
||||||
gtk_builder_add_callback_symbol (builder, "stop_edit", G_CALLBACK (stop_edit));
|
|
||||||
gtk_builder_add_callback_symbol (builder, "toggle_edit", G_CALLBACK (toggle_edit));
|
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
|
||||||
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||||
feature_list = GTK_WIDGET (gtk_builder_get_object (builder, "feature_list"));
|
feature_list = GTK_WIDGET (gtk_builder_get_object (builder, "feature_list"));
|
||||||
label = GTK_WIDGET (gtk_builder_get_object (builder, "label"));
|
label = GTK_WIDGET (gtk_builder_get_object (builder, "label"));
|
||||||
@@ -1723,7 +1228,7 @@ do_font_features (GtkWidget *do_widget)
|
|||||||
edit_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "edit_toggle"));
|
edit_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "edit_toggle"));
|
||||||
|
|
||||||
controller = gtk_event_controller_key_new ();
|
controller = gtk_event_controller_key_new ();
|
||||||
g_object_set_data_full (G_OBJECT (entry), "controller", controller, g_object_unref);
|
g_object_set_data_full (G_OBJECT (entry), "controller", g_object_ref (controller), g_object_unref);
|
||||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), entry);
|
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), entry);
|
||||||
gtk_widget_add_controller (entry, controller);
|
gtk_widget_add_controller (entry, controller);
|
||||||
|
|
||||||
@@ -1826,12 +1331,14 @@ do_font_features (GtkWidget *do_widget)
|
|||||||
else
|
else
|
||||||
g_hash_table_remove_all (axes);
|
g_hash_table_remove_all (axes);
|
||||||
|
|
||||||
font_changed ();
|
font_features_font_changed ();
|
||||||
|
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
|
||||||
g_object_unref (builder);
|
g_object_unref (builder);
|
||||||
|
|
||||||
|
update_display ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
#include "fontplane.h"
|
#include "fontplane.h"
|
||||||
|
|
||||||
#include "gtk.h"
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_WEIGHT_ADJUSTMENT,
|
PROP_WEIGHT_ADJUSTMENT,
|
||||||
|
|||||||
287
demos/gtk-demo/fontrendering.c
Normal file
287
demos/gtk-demo/fontrendering.c
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
/* Pango/Font rendering
|
||||||
|
*
|
||||||
|
* Demonstrates various aspects of font rendering.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
static GtkWidget *window = NULL;
|
||||||
|
static GtkWidget *font_button = NULL;
|
||||||
|
static GtkWidget *entry = NULL;
|
||||||
|
static GtkWidget *image = NULL;
|
||||||
|
static GtkWidget *hinting = NULL;
|
||||||
|
static GtkWidget *hint_metrics = NULL;
|
||||||
|
static GtkWidget *up_button = NULL;
|
||||||
|
static GtkWidget *down_button = NULL;
|
||||||
|
static GtkWidget *text_radio = NULL;
|
||||||
|
static GtkWidget *show_grid = NULL;
|
||||||
|
static GtkWidget *show_extents = NULL;
|
||||||
|
|
||||||
|
static PangoContext *context;
|
||||||
|
|
||||||
|
static int scale = 10;
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_destroy (gpointer data)
|
||||||
|
{
|
||||||
|
window = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_image (void)
|
||||||
|
{
|
||||||
|
const char *text;
|
||||||
|
PangoFontDescription *desc;
|
||||||
|
PangoLayout *layout;
|
||||||
|
PangoRectangle ink, pink, logical;
|
||||||
|
int baseline;
|
||||||
|
cairo_surface_t *surface;
|
||||||
|
cairo_t *cr;
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
GdkPixbuf *pixbuf2;
|
||||||
|
const char *hint;
|
||||||
|
cairo_font_options_t *fopt;
|
||||||
|
cairo_hint_style_t hintstyle;
|
||||||
|
cairo_hint_metrics_t hintmetrics;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!context)
|
||||||
|
context = gtk_widget_create_pango_context (image);
|
||||||
|
|
||||||
|
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||||
|
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (font_button));
|
||||||
|
|
||||||
|
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
|
||||||
|
|
||||||
|
hint = gtk_combo_box_get_active_id (GTK_COMBO_BOX (hinting));
|
||||||
|
if (strcmp (hint, "none") == 0)
|
||||||
|
hintstyle = CAIRO_HINT_STYLE_NONE;
|
||||||
|
else if (strcmp (hint, "slight") == 0)
|
||||||
|
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
|
||||||
|
else if (strcmp (hint, "medium") == 0)
|
||||||
|
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
|
||||||
|
else if (strcmp (hint, "full") == 0)
|
||||||
|
hintstyle = CAIRO_HINT_STYLE_FULL;
|
||||||
|
else
|
||||||
|
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
|
||||||
|
cairo_font_options_set_hint_style (fopt, hintstyle);
|
||||||
|
|
||||||
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hint_metrics)))
|
||||||
|
hintmetrics = CAIRO_HINT_METRICS_ON;
|
||||||
|
else
|
||||||
|
hintmetrics = CAIRO_HINT_METRICS_OFF;
|
||||||
|
cairo_font_options_set_hint_metrics (fopt, hintmetrics);
|
||||||
|
|
||||||
|
pango_cairo_context_set_font_options (context, fopt);
|
||||||
|
cairo_font_options_destroy (fopt);
|
||||||
|
pango_context_changed (context);
|
||||||
|
|
||||||
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (text_radio)))
|
||||||
|
{
|
||||||
|
layout = pango_layout_new (context);
|
||||||
|
pango_layout_set_font_description (layout, desc);
|
||||||
|
pango_layout_set_text (layout, text, -1);
|
||||||
|
pango_layout_get_extents (layout, &ink, &logical);
|
||||||
|
pink = ink;
|
||||||
|
baseline = pango_layout_get_baseline (layout);
|
||||||
|
|
||||||
|
pango_extents_to_pixels (&ink, NULL);
|
||||||
|
|
||||||
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, ink.width + 20, ink.height + 20);
|
||||||
|
cr = cairo_create (surface);
|
||||||
|
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||||
|
cairo_paint (cr);
|
||||||
|
|
||||||
|
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||||
|
cairo_move_to (cr, 10, 10);
|
||||||
|
pango_cairo_show_layout (cr, layout);
|
||||||
|
|
||||||
|
cairo_destroy (cr);
|
||||||
|
g_object_unref (layout);
|
||||||
|
|
||||||
|
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
|
||||||
|
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
|
||||||
|
|
||||||
|
g_object_unref (pixbuf);
|
||||||
|
cairo_surface_destroy (surface);
|
||||||
|
|
||||||
|
surface = cairo_image_surface_create_for_data (gdk_pixbuf_get_pixels (pixbuf2),
|
||||||
|
CAIRO_FORMAT_ARGB32,
|
||||||
|
gdk_pixbuf_get_width (pixbuf2),
|
||||||
|
gdk_pixbuf_get_height (pixbuf2),
|
||||||
|
gdk_pixbuf_get_rowstride (pixbuf2));
|
||||||
|
|
||||||
|
cr = cairo_create (surface);
|
||||||
|
cairo_set_line_width (cr, 1);
|
||||||
|
|
||||||
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_grid)))
|
||||||
|
{
|
||||||
|
cairo_set_source_rgba (cr, 0.2, 0, 0, 0.2);
|
||||||
|
for (i = 1; i < ink.height + 20; i++)
|
||||||
|
{
|
||||||
|
cairo_move_to (cr, 0, scale * i - 0.5);
|
||||||
|
cairo_line_to (cr, scale * (ink.width + 20), scale * i - 0.5);
|
||||||
|
cairo_stroke (cr);
|
||||||
|
}
|
||||||
|
for (i = 1; i < ink.width + 20; i++)
|
||||||
|
{
|
||||||
|
cairo_move_to (cr, scale * i - 0.5, 0);
|
||||||
|
cairo_line_to (cr, scale * i - 0.5, scale * (ink.height + 20));
|
||||||
|
cairo_stroke (cr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_extents)))
|
||||||
|
{
|
||||||
|
cairo_set_source_rgba (cr, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
cairo_rectangle (cr,
|
||||||
|
scale * (10 + pango_units_to_double (logical.x)) - 0.5,
|
||||||
|
scale * (10 + pango_units_to_double (logical.y)) - 0.5,
|
||||||
|
scale * pango_units_to_double (logical.width) + 1,
|
||||||
|
scale * pango_units_to_double (logical.height) + 1);
|
||||||
|
cairo_stroke (cr);
|
||||||
|
cairo_move_to (cr, scale * (10 + pango_units_to_double (logical.x)) - 0.5,
|
||||||
|
scale * (10 + pango_units_to_double (baseline)) - 0.5);
|
||||||
|
cairo_line_to (cr, scale * (10 + pango_units_to_double (logical.x + logical.width)) + 1,
|
||||||
|
scale * (10 + pango_units_to_double (baseline)) - 0.5);
|
||||||
|
cairo_stroke (cr);
|
||||||
|
cairo_set_source_rgba (cr, 1, 0, 0, 1);
|
||||||
|
cairo_rectangle (cr,
|
||||||
|
scale * (10 + pango_units_to_double (pink.x)) + 0.5,
|
||||||
|
scale * (10 + pango_units_to_double (pink.y)) + 0.5,
|
||||||
|
scale * pango_units_to_double (pink.width) - 1,
|
||||||
|
scale * pango_units_to_double (pink.height) - 1);
|
||||||
|
cairo_stroke (cr);
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_surface_destroy (surface);
|
||||||
|
cairo_destroy (cr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PangoLayoutIter *iter;
|
||||||
|
PangoLayoutRun *run;
|
||||||
|
PangoGlyphInfo *g;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
layout = pango_layout_new (context);
|
||||||
|
pango_layout_set_font_description (layout, desc);
|
||||||
|
pango_layout_set_text (layout, "aaaa", -1);
|
||||||
|
pango_layout_get_extents (layout, &ink, &logical);
|
||||||
|
pango_extents_to_pixels (&logical, NULL);
|
||||||
|
|
||||||
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, logical.width * 3 / 2, 4*logical.height);
|
||||||
|
cr = cairo_create (surface);
|
||||||
|
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||||
|
cairo_paint (cr);
|
||||||
|
|
||||||
|
iter = pango_layout_get_iter (layout);
|
||||||
|
run = pango_layout_iter_get_run (iter);
|
||||||
|
|
||||||
|
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
g = &(run->glyphs->glyphs[i]);
|
||||||
|
g->geometry.width = PANGO_UNITS_ROUND (g->geometry.width * 3 / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j = 0; j < 4; j++)
|
||||||
|
{
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
g = &(run->glyphs->glyphs[i]);
|
||||||
|
g->geometry.x_offset = i * (PANGO_SCALE / 4);
|
||||||
|
g->geometry.y_offset = j * (PANGO_SCALE / 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_move_to (cr, 0, j * logical.height);
|
||||||
|
pango_cairo_show_layout (cr, layout);
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_destroy (cr);
|
||||||
|
pango_layout_iter_free (iter);
|
||||||
|
g_object_unref (layout);
|
||||||
|
|
||||||
|
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
|
||||||
|
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
|
||||||
|
g_object_unref (pixbuf);
|
||||||
|
cairo_surface_destroy (surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
|
||||||
|
|
||||||
|
g_object_unref (pixbuf2);
|
||||||
|
|
||||||
|
pango_font_description_free (desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_buttons (void)
|
||||||
|
{
|
||||||
|
gtk_widget_set_sensitive (up_button, scale < 32);
|
||||||
|
gtk_widget_set_sensitive (down_button, scale > 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
scale_up (void)
|
||||||
|
{
|
||||||
|
scale += 1;
|
||||||
|
update_buttons ();
|
||||||
|
update_image ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
scale_down (void)
|
||||||
|
{
|
||||||
|
scale -= 1;
|
||||||
|
update_buttons ();
|
||||||
|
update_image ();
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
do_fontrendering (GtkWidget *do_widget)
|
||||||
|
{
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
GtkBuilder *builder;
|
||||||
|
|
||||||
|
builder = gtk_builder_new_from_resource ("/fontrendering/fontrendering.ui");
|
||||||
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||||
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
|
gtk_widget_get_display (do_widget));
|
||||||
|
g_signal_connect (window, "destroy",
|
||||||
|
G_CALLBACK (on_destroy), NULL);
|
||||||
|
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);
|
||||||
|
font_button = GTK_WIDGET (gtk_builder_get_object (builder, "font_button"));
|
||||||
|
up_button = GTK_WIDGET (gtk_builder_get_object (builder, "up_button"));
|
||||||
|
down_button = GTK_WIDGET (gtk_builder_get_object (builder, "down_button"));
|
||||||
|
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
||||||
|
image = GTK_WIDGET (gtk_builder_get_object (builder, "image"));
|
||||||
|
hinting = GTK_WIDGET (gtk_builder_get_object (builder, "hinting"));
|
||||||
|
hint_metrics = GTK_WIDGET (gtk_builder_get_object (builder, "hint_metrics"));
|
||||||
|
text_radio = GTK_WIDGET (gtk_builder_get_object (builder, "text_radio"));
|
||||||
|
show_grid = GTK_WIDGET (gtk_builder_get_object (builder, "show_grid"));
|
||||||
|
show_extents = GTK_WIDGET (gtk_builder_get_object (builder, "show_extents"));
|
||||||
|
|
||||||
|
g_signal_connect (up_button, "clicked", G_CALLBACK (scale_up), NULL);
|
||||||
|
g_signal_connect (down_button, "clicked", G_CALLBACK (scale_down), NULL);
|
||||||
|
g_signal_connect (entry, "notify::text", G_CALLBACK (update_image), NULL);
|
||||||
|
g_signal_connect (font_button, "notify::font-desc", G_CALLBACK (update_image), NULL);
|
||||||
|
g_signal_connect (hinting, "notify::active", G_CALLBACK (update_image), NULL);
|
||||||
|
g_signal_connect (hint_metrics, "notify::active", G_CALLBACK (update_image), NULL);
|
||||||
|
g_signal_connect (text_radio, "notify::active", G_CALLBACK (update_image), NULL);
|
||||||
|
g_signal_connect (show_grid, "notify::active", G_CALLBACK (update_image), NULL);
|
||||||
|
g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL);
|
||||||
|
|
||||||
|
update_image ();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gtk_widget_get_visible (window))
|
||||||
|
gtk_widget_show (window);
|
||||||
|
else
|
||||||
|
gtk_widget_destroy (window);
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
216
demos/gtk-demo/fontrendering.ui
Normal file
216
demos/gtk-demo/fontrendering.ui
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<object class="GtkAdjustment" id="scale_adj">
|
||||||
|
<property name="upper">24</property>
|
||||||
|
<property name="step-increment">1</property>
|
||||||
|
<property name="page-increment">4</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkWindow" id="window">
|
||||||
|
<property name="default-width">600</property>
|
||||||
|
<property name="default-height">300</property>
|
||||||
|
<property name="title">Font rendering</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid">
|
||||||
|
<property name="margin-top">10</property>
|
||||||
|
<property name="row-spacing">10</property>
|
||||||
|
<property name="column-spacing">10</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="margin-start">10</property>
|
||||||
|
<property name="label">Text</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
<style>
|
||||||
|
<class name="dim-label"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="entry">
|
||||||
|
<property name="text">Fonts render</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="margin-start">10</property>
|
||||||
|
<property name="label">Font</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
<style>
|
||||||
|
<class name="dim-label"/>
|
||||||
|
</style>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFontButton" id="font_button">
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Hinting</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
<style>
|
||||||
|
<class name="dim-label"/>
|
||||||
|
</style>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBoxText" id="hinting">
|
||||||
|
<property name="active">0</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<items>
|
||||||
|
<item translatable="yes" id="none">None</item>
|
||||||
|
<item translatable="yes" id="slight">Slight</item>
|
||||||
|
<item translatable="yes" id="medium">Medium</item>
|
||||||
|
<item translatable="yes" id="full">Full</item>
|
||||||
|
</items>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">3</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="hint_metrics">
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Hint Metrics</property>
|
||||||
|
<style>
|
||||||
|
<class name="dim-label"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">3</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="show_extents">
|
||||||
|
<property name="active">1</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Show Extents</property>
|
||||||
|
<style>
|
||||||
|
<class name="dim-label"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">4</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="show_grid">
|
||||||
|
<property name="active">1</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Show Grid</property>
|
||||||
|
<style>
|
||||||
|
<class name="dim-label"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">4</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="up_button">
|
||||||
|
<property name="icon-name">list-add-symbolic</property>
|
||||||
|
<style>
|
||||||
|
<class name="circular"/>
|
||||||
|
</style>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">5</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="down_button">
|
||||||
|
<property name="icon-name">list-remove-symbolic</property>
|
||||||
|
<style>
|
||||||
|
<class name="circular"/>
|
||||||
|
</style>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">5</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="hexpand">1</property>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">6</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<style>
|
||||||
|
<class name="linked"/>
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRadioButton" id="text_radio">
|
||||||
|
<property name="draw-indicator">0</property>
|
||||||
|
<property name="label">Text</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRadioButton" id="grid_radio">
|
||||||
|
<property name="draw-indicator">0</property>
|
||||||
|
<property name="label">Grid</property>
|
||||||
|
<property name="group">text_radio</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
<property name="column-span">7</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow">
|
||||||
|
<property name="propagate-natural-height">1</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<property name="hexpand">1</property>
|
||||||
|
<property name="vexpand">1</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkPicture" id="image">
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<property name="can-shrink">0</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">4</property>
|
||||||
|
<property name="column-span">7</property>
|
||||||
|
</layout>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
||||||
@@ -414,7 +414,7 @@ draw_menubar (GtkWidget *widget,
|
|||||||
frame_context = get_style (NULL, "frame");
|
frame_context = get_style (NULL, "frame");
|
||||||
border_context = get_style (frame_context, "border");
|
border_context = get_style (frame_context, "border");
|
||||||
|
|
||||||
/* This information is taken from the GtkMenuBar docs, see "CSS nodes" */
|
/* This information is taken from the GtkPopoverMenuBar docs, see "CSS nodes" */
|
||||||
menubar_context = get_style (NULL, "menubar");
|
menubar_context = get_style (NULL, "menubar");
|
||||||
hovered_menuitem_context = get_style (menubar_context, "menuitem:hover");
|
hovered_menuitem_context = get_style (menubar_context, "menuitem:hover");
|
||||||
menuitem_context = get_style (menubar_context, "menuitem");
|
menuitem_context = get_style (menubar_context, "menuitem");
|
||||||
@@ -829,7 +829,6 @@ draw_spinbutton (GtkWidget *widget,
|
|||||||
GtkStyleContext *down_context;
|
GtkStyleContext *down_context;
|
||||||
GtkIconTheme *icon_theme;
|
GtkIconTheme *icon_theme;
|
||||||
GtkIconInfo *icon_info;
|
GtkIconInfo *icon_info;
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
gint icon_width, icon_height, icon_size;
|
gint icon_width, icon_height, icon_size;
|
||||||
gint button_width;
|
gint button_width;
|
||||||
@@ -857,26 +856,22 @@ draw_spinbutton (GtkWidget *widget,
|
|||||||
"min-width", &icon_width, "min-height", &icon_height, NULL);
|
"min-width", &icon_width, "min-height", &icon_height, NULL);
|
||||||
icon_size = MIN (icon_width, icon_height);
|
icon_size = MIN (icon_width, icon_height);
|
||||||
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-add-symbolic", icon_size, 0);
|
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-add-symbolic", icon_size, 0);
|
||||||
pixbuf = gtk_icon_info_load_symbolic_for_context (icon_info, up_context, NULL, NULL);
|
texture = GDK_TEXTURE (gtk_icon_info_load_symbolic_for_context (icon_info, up_context, NULL, NULL));
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
|
||||||
g_object_unref (icon_info);
|
g_object_unref (icon_info);
|
||||||
draw_style_common (up_context, cr, x + width - button_width, y, button_width, *height,
|
draw_style_common (up_context, cr, x + width - button_width, y, button_width, *height,
|
||||||
&contents_x, &contents_y, &contents_width, &contents_height);
|
&contents_x, &contents_y, &contents_width, &contents_height);
|
||||||
gtk_render_icon (up_context, cr, texture, contents_x, contents_y + (contents_height - icon_size) / 2);
|
gtk_render_icon (up_context, cr, texture, contents_x, contents_y + (contents_height - icon_size) / 2);
|
||||||
g_object_unref (pixbuf);
|
|
||||||
g_object_unref (texture);
|
g_object_unref (texture);
|
||||||
|
|
||||||
gtk_style_context_get (down_context,
|
gtk_style_context_get (down_context,
|
||||||
"min-width", &icon_width, "min-height", &icon_height, NULL);
|
"min-width", &icon_width, "min-height", &icon_height, NULL);
|
||||||
icon_size = MIN (icon_width, icon_height);
|
icon_size = MIN (icon_width, icon_height);
|
||||||
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-remove-symbolic", icon_size, 0);
|
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-remove-symbolic", icon_size, 0);
|
||||||
pixbuf = gtk_icon_info_load_symbolic_for_context (icon_info, down_context, NULL, NULL);
|
texture = GDK_TEXTURE (gtk_icon_info_load_symbolic_for_context (icon_info, down_context, NULL, NULL));
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
|
||||||
g_object_unref (icon_info);
|
g_object_unref (icon_info);
|
||||||
draw_style_common (down_context, cr, x + width - 2 * button_width, y, button_width, *height,
|
draw_style_common (down_context, cr, x + width - 2 * button_width, y, button_width, *height,
|
||||||
&contents_x, &contents_y, &contents_width, &contents_height);
|
&contents_x, &contents_y, &contents_width, &contents_height);
|
||||||
gtk_render_icon (down_context, cr, texture, contents_x, contents_y + (contents_height - icon_size) / 2);
|
gtk_render_icon (down_context, cr, texture, contents_x, contents_y + (contents_height - icon_size) / 2);
|
||||||
g_object_unref (pixbuf);
|
|
||||||
g_object_unref (texture);
|
g_object_unref (texture);
|
||||||
|
|
||||||
g_object_unref (down_context);
|
g_object_unref (down_context);
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ realize (GtkWidget *widget)
|
|||||||
fragment_path = "/glarea/glarea-gl.fs.glsl";
|
fragment_path = "/glarea/glarea-gl.fs.glsl";
|
||||||
}
|
}
|
||||||
|
|
||||||
init_buffers (&position_buffer, NULL);
|
init_buffers (NULL, &position_buffer);
|
||||||
init_shaders (vertex_path, fragment_path, &program, &mvp_location);
|
init_shaders (vertex_path, fragment_path, &program, &mvp_location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ show_page (GtkTextBuffer *buffer,
|
|||||||
|
|
||||||
gtk_text_buffer_set_text (buffer, "", 0);
|
gtk_text_buffer_set_text (buffer, "", 0);
|
||||||
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
|
||||||
|
gtk_text_buffer_begin_irreversible_action (buffer);
|
||||||
if (page == 1)
|
if (page == 1)
|
||||||
{
|
{
|
||||||
gtk_text_buffer_insert (buffer, &iter, "Some text to show that simple ", -1);
|
gtk_text_buffer_insert (buffer, &iter, "Some text to show that simple ", -1);
|
||||||
@@ -73,6 +74,7 @@ show_page (GtkTextBuffer *buffer,
|
|||||||
"so that related items of information are connected.\n", -1);
|
"so that related items of information are connected.\n", -1);
|
||||||
insert_link (buffer, &iter, "Go back", 1);
|
insert_link (buffer, &iter, "Go back", 1);
|
||||||
}
|
}
|
||||||
|
gtk_text_buffer_end_irreversible_action (buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Looks at all tags covering the position of iter in the text view,
|
/* Looks at all tags covering the position of iter in the text view,
|
||||||
@@ -258,6 +260,7 @@ do_hypertext (GtkWidget *do_widget)
|
|||||||
gtk_widget_add_controller (view, controller);
|
gtk_widget_add_controller (view, controller);
|
||||||
|
|
||||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||||
|
gtk_text_buffer_set_enable_undo (buffer, TRUE);
|
||||||
|
|
||||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||||
|
|||||||
229
demos/gtk-demo/iconscroll.c
Normal file
229
demos/gtk-demo/iconscroll.c
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
/* Benchmark/Scrolling
|
||||||
|
*
|
||||||
|
* This demo scrolls a view with various content.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
static guint tick_cb;
|
||||||
|
static GtkAdjustment *hadjustment;
|
||||||
|
static GtkAdjustment *vadjustment;
|
||||||
|
static GtkWidget *window = NULL;
|
||||||
|
static GtkWidget *scrolledwindow;
|
||||||
|
static int selected;
|
||||||
|
|
||||||
|
#define N_WIDGET_TYPES 4
|
||||||
|
|
||||||
|
|
||||||
|
static int hincrement = 5;
|
||||||
|
static int vincrement = 5;
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
scroll_cb (GtkWidget *widget,
|
||||||
|
GdkFrameClock *frame_clock,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
double value;
|
||||||
|
|
||||||
|
value = gtk_adjustment_get_value (vadjustment);
|
||||||
|
if (value + vincrement <= gtk_adjustment_get_lower (vadjustment) ||
|
||||||
|
(value + vincrement >= gtk_adjustment_get_upper (vadjustment) - gtk_adjustment_get_page_size (vadjustment)))
|
||||||
|
vincrement = - vincrement;
|
||||||
|
|
||||||
|
gtk_adjustment_set_value (vadjustment, value + vincrement);
|
||||||
|
|
||||||
|
value = gtk_adjustment_get_value (hadjustment);
|
||||||
|
if (value + hincrement <= gtk_adjustment_get_lower (hadjustment) ||
|
||||||
|
(value + hincrement >= gtk_adjustment_get_upper (hadjustment) - gtk_adjustment_get_page_size (hadjustment)))
|
||||||
|
hincrement = - hincrement;
|
||||||
|
|
||||||
|
gtk_adjustment_set_value (hadjustment, value + hincrement);
|
||||||
|
|
||||||
|
return G_SOURCE_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern GtkWidget *create_icon (void);
|
||||||
|
|
||||||
|
static void
|
||||||
|
populate_icons (void)
|
||||||
|
{
|
||||||
|
GtkWidget *grid;
|
||||||
|
int top, left;
|
||||||
|
|
||||||
|
grid = gtk_grid_new ();
|
||||||
|
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
|
||||||
|
g_object_set (grid, "margin", 10, NULL);
|
||||||
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
|
||||||
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
|
||||||
|
|
||||||
|
for (top = 0; top < 100; top++)
|
||||||
|
for (left = 0; left < 15; left++)
|
||||||
|
gtk_grid_attach (GTK_GRID (grid), create_icon (), left, top, 1, 1);
|
||||||
|
|
||||||
|
hincrement = 0;
|
||||||
|
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||||
|
GTK_POLICY_NEVER,
|
||||||
|
GTK_POLICY_AUTOMATIC);
|
||||||
|
gtk_container_add (GTK_CONTAINER (scrolledwindow), grid);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *content;
|
||||||
|
static gsize content_len;
|
||||||
|
|
||||||
|
extern void fontify (GtkTextBuffer *buffer);
|
||||||
|
|
||||||
|
static void
|
||||||
|
populate_text (gboolean hilight)
|
||||||
|
{
|
||||||
|
GtkWidget *textview;
|
||||||
|
GtkTextBuffer *buffer;
|
||||||
|
|
||||||
|
if (!content)
|
||||||
|
{
|
||||||
|
GBytes *bytes;
|
||||||
|
|
||||||
|
bytes = g_resources_lookup_data ("/sources/font_features.c", 0, NULL);
|
||||||
|
content = g_bytes_unref_to_data (bytes, &content_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer = gtk_text_buffer_new (NULL);
|
||||||
|
gtk_text_buffer_set_text (buffer, content, (int)content_len);
|
||||||
|
|
||||||
|
if (hilight)
|
||||||
|
fontify (buffer);
|
||||||
|
|
||||||
|
textview = gtk_text_view_new ();
|
||||||
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||||
|
|
||||||
|
hincrement = 0;
|
||||||
|
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||||
|
GTK_POLICY_NEVER,
|
||||||
|
GTK_POLICY_AUTOMATIC);
|
||||||
|
gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
populate_image (void)
|
||||||
|
{
|
||||||
|
GtkWidget *image;
|
||||||
|
|
||||||
|
if (!content)
|
||||||
|
{
|
||||||
|
GBytes *bytes;
|
||||||
|
|
||||||
|
bytes = g_resources_lookup_data ("/sources/font_features.c", 0, NULL);
|
||||||
|
content = g_bytes_unref_to_data (bytes, &content_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
image = gtk_picture_new_for_resource ("/sliding_puzzle/portland-rose.jpg");
|
||||||
|
gtk_picture_set_can_shrink (GTK_PICTURE (image), FALSE);
|
||||||
|
|
||||||
|
hincrement = 5;
|
||||||
|
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||||
|
GTK_POLICY_AUTOMATIC,
|
||||||
|
GTK_POLICY_AUTOMATIC);
|
||||||
|
gtk_container_add (GTK_CONTAINER (scrolledwindow), image);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
set_widget_type (int type)
|
||||||
|
{
|
||||||
|
if (tick_cb)
|
||||||
|
gtk_widget_remove_tick_callback (window, tick_cb);
|
||||||
|
|
||||||
|
if (gtk_bin_get_child (GTK_BIN (scrolledwindow)))
|
||||||
|
gtk_container_remove (GTK_CONTAINER (scrolledwindow),
|
||||||
|
gtk_bin_get_child (GTK_BIN (scrolledwindow)));
|
||||||
|
|
||||||
|
selected = type;
|
||||||
|
|
||||||
|
switch (selected)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "Scrolling icons");
|
||||||
|
populate_icons ();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "Scrolling plain text");
|
||||||
|
populate_text (FALSE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "Scrolling complex text");
|
||||||
|
populate_text (TRUE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a big image");
|
||||||
|
populate_image ();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
|
|
||||||
|
tick_cb = gtk_widget_add_tick_callback (window, scroll_cb, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
iconscroll_next_clicked_cb (GtkButton *source,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
int new_index;
|
||||||
|
|
||||||
|
if (selected + 1 >= N_WIDGET_TYPES)
|
||||||
|
new_index = 0;
|
||||||
|
else
|
||||||
|
new_index = selected + 1;
|
||||||
|
|
||||||
|
|
||||||
|
set_widget_type (new_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
iconscroll_prev_clicked_cb (GtkButton *source,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
int new_index;
|
||||||
|
|
||||||
|
if (selected - 1 < 0)
|
||||||
|
new_index = N_WIDGET_TYPES - 1;
|
||||||
|
else
|
||||||
|
new_index = selected - 1;
|
||||||
|
|
||||||
|
set_widget_type (new_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
do_iconscroll (GtkWidget *do_widget)
|
||||||
|
{
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
GtkBuilder *builder;
|
||||||
|
|
||||||
|
builder = gtk_builder_new_from_resource ("/iconscroll/iconscroll.ui");
|
||||||
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||||
|
g_signal_connect (window, "destroy",
|
||||||
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
|
gtk_widget_get_display (do_widget));
|
||||||
|
g_signal_connect (window, "destroy",
|
||||||
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
scrolledwindow = GTK_WIDGET (gtk_builder_get_object (builder, "scrolledwindow"));
|
||||||
|
gtk_widget_realize (window);
|
||||||
|
hadjustment = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "hadjustment"));
|
||||||
|
vadjustment = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "vadjustment"));
|
||||||
|
set_widget_type (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gtk_widget_get_visible (window))
|
||||||
|
gtk_widget_show (window);
|
||||||
|
else
|
||||||
|
gtk_widget_destroy (window);
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
43
demos/gtk-demo/iconscroll.ui
Normal file
43
demos/gtk-demo/iconscroll.ui
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<object class="GtkWindow" id="window">
|
||||||
|
<property name="resizable">0</property>
|
||||||
|
<property name="default-width">500</property>
|
||||||
|
<property name="default-height">500</property>
|
||||||
|
<child type="titlebar">
|
||||||
|
<object class="GtkHeaderBar">
|
||||||
|
<property name="show-title-buttons">1</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<style>
|
||||||
|
<class name="linked"/>
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="icon-name">pan-start-symbolic</property>
|
||||||
|
<signal name="clicked" handler="iconscroll_prev_clicked_cb"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="icon-name">pan-end-symbolic</property>
|
||||||
|
<signal name="clicked" handler="iconscroll_next_clicked_cb"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow" id="scrolledwindow">
|
||||||
|
<property name="hscrollbar-policy">never</property>
|
||||||
|
<property name="hadjustment">
|
||||||
|
<object class="GtkAdjustment" id="hadjustment"/>
|
||||||
|
</property>
|
||||||
|
<property name="vadjustment">
|
||||||
|
<object class="GtkAdjustment" id="vadjustment"/>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
||||||
@@ -68,7 +68,7 @@ do_infobar (GtkWidget *do_widget)
|
|||||||
gtk_container_add (GTK_CONTAINER (vbox), bar);
|
gtk_container_add (GTK_CONTAINER (vbox), bar);
|
||||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_INFO);
|
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_INFO);
|
||||||
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_INFO");
|
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_INFO");
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
|
||||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||||
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
|
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ do_infobar (GtkWidget *do_widget)
|
|||||||
gtk_container_add (GTK_CONTAINER (vbox), bar);
|
gtk_container_add (GTK_CONTAINER (vbox), bar);
|
||||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_WARNING);
|
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_WARNING);
|
||||||
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_WARNING");
|
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_WARNING");
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
|
||||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||||
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
|
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ do_infobar (GtkWidget *do_widget)
|
|||||||
gtk_container_add (GTK_CONTAINER (vbox), bar);
|
gtk_container_add (GTK_CONTAINER (vbox), bar);
|
||||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_QUESTION);
|
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_QUESTION);
|
||||||
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_QUESTION");
|
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_QUESTION");
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
|
||||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||||
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
|
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ do_infobar (GtkWidget *do_widget)
|
|||||||
gtk_container_add (GTK_CONTAINER (vbox), bar);
|
gtk_container_add (GTK_CONTAINER (vbox), bar);
|
||||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_ERROR);
|
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_ERROR);
|
||||||
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_ERROR");
|
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_ERROR");
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
|
||||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||||
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
|
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ do_infobar (GtkWidget *do_widget)
|
|||||||
gtk_container_add (GTK_CONTAINER (vbox), bar);
|
gtk_container_add (GTK_CONTAINER (vbox), bar);
|
||||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_OTHER);
|
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_OTHER);
|
||||||
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_OTHER");
|
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_OTHER");
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
|
||||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||||
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
|
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
|
|
||||||
#include "language-names.h"
|
#include "language-names.h"
|
||||||
|
|
||||||
|
#ifndef ISO_CODES_PREFIX
|
||||||
|
#define ISO_CODES_PREFIX "/usr"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
|
#define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
|
||||||
#define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
|
#define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
|
||||||
|
|
||||||
@@ -202,7 +206,7 @@ languages_variant_init (const char *variant)
|
|||||||
else
|
else
|
||||||
g_warning ("Failed to load '%s': %s\n", filename, error->message);
|
g_warning ("Failed to load '%s': %s\n", filename, error->message);
|
||||||
|
|
||||||
g_free (error);
|
g_clear_error (&error);
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
g_free (buf);
|
g_free (buf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<interface domain="gtk40">
|
<interface domain="gtk40">
|
||||||
<object class="GtkMenu" id="menu1">
|
<menu id="menu1">
|
||||||
<child>
|
<section>
|
||||||
<object class="GtkMenuItem" id="menuitem1">
|
<item>
|
||||||
<property name="label" translatable="yes">Email message</property>
|
<attribute name="label" translatable="yes">Email message</attribute>
|
||||||
<property name="use-underline">1</property>
|
</item>
|
||||||
</object>
|
<item>
|
||||||
</child>
|
<attribute name="label" translatable="yes">Embed message</attribute>
|
||||||
<child>
|
</item>
|
||||||
<object class="GtkMenuItem" id="menuitem2">
|
</section>
|
||||||
<property name="label" translatable="yes">Embed message</property>
|
</menu>
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<template class="GtkMessageRow" parent="GtkListBoxRow">
|
<template class="GtkMessageRow" parent="GtkListBoxRow">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkGrid" id="grid1">
|
<object class="GtkGrid" id="grid1">
|
||||||
@@ -171,7 +167,7 @@
|
|||||||
<object class="GtkMenuButton" id="more-button">
|
<object class="GtkMenuButton" id="more-button">
|
||||||
<property name="can-focus">1</property>
|
<property name="can-focus">1</property>
|
||||||
<property name="receives-default">1</property>
|
<property name="receives-default">1</property>
|
||||||
<property name="popup">menu1</property>
|
<property name="menu-model">menu1</property>
|
||||||
<property name="relief">none</property>
|
<property name="relief">none</property>
|
||||||
<property name="label" translatable="yes">More...</property>
|
<property name="label" translatable="yes">More...</property>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ parse_chars (gchar *text,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* While not as cool as c-mode, this will do as a quick attempt at highlighting */
|
/* While not as cool as c-mode, this will do as a quick attempt at highlighting */
|
||||||
static void
|
void
|
||||||
fontify (GtkTextBuffer *source_buffer)
|
fontify (GtkTextBuffer *source_buffer)
|
||||||
{
|
{
|
||||||
GtkTextIter start_iter, next_iter, tmp_iter;
|
GtkTextIter start_iter, next_iter, tmp_iter;
|
||||||
@@ -639,7 +639,7 @@ display_nothing (const char *resource)
|
|||||||
|
|
||||||
str = g_strdup_printf ("The lazy GTK developers forgot to add a way to display the resource '%s'", resource);
|
str = g_strdup_printf ("The lazy GTK developers forgot to add a way to display the resource '%s'", resource);
|
||||||
widget = gtk_label_new (str);
|
widget = gtk_label_new (str);
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
|
gtk_label_set_wrap (GTK_LABEL (widget), TRUE);
|
||||||
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
@@ -748,6 +748,9 @@ load_file (const gchar *demoname,
|
|||||||
|
|
||||||
source_buffer = gtk_text_buffer_new (NULL);
|
source_buffer = gtk_text_buffer_new (NULL);
|
||||||
|
|
||||||
|
gtk_text_buffer_begin_irreversible_action (info_buffer);
|
||||||
|
gtk_text_buffer_begin_irreversible_action (source_buffer);
|
||||||
|
|
||||||
resource_filename = g_strconcat ("/sources/", filename, NULL);
|
resource_filename = g_strconcat ("/sources/", filename, NULL);
|
||||||
bytes = g_resources_lookup_data (resource_filename, 0, &err);
|
bytes = g_resources_lookup_data (resource_filename, 0, &err);
|
||||||
g_free (resource_filename);
|
g_free (resource_filename);
|
||||||
@@ -880,9 +883,11 @@ load_file (const gchar *demoname,
|
|||||||
|
|
||||||
fontify (source_buffer);
|
fontify (source_buffer);
|
||||||
|
|
||||||
|
gtk_text_buffer_end_irreversible_action (source_buffer);
|
||||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (source_view), source_buffer);
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (source_view), source_buffer);
|
||||||
g_object_unref (source_buffer);
|
g_object_unref (source_buffer);
|
||||||
|
|
||||||
|
gtk_text_buffer_end_irreversible_action (info_buffer);
|
||||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (info_view), info_buffer);
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (info_view), info_buffer);
|
||||||
g_object_unref (info_buffer);
|
g_object_unref (info_buffer);
|
||||||
}
|
}
|
||||||
@@ -998,32 +1003,6 @@ row_activated_cb (GtkWidget *tree_view,
|
|||||||
run_example_for_row (window, model, &iter);
|
run_example_for_row (window, model, &iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
start_cb (GtkMenuItem *item, GtkWidget *scrollbar)
|
|
||||||
{
|
|
||||||
GtkAdjustment *adj;
|
|
||||||
|
|
||||||
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
|
|
||||||
gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
end_cb (GtkMenuItem *item, GtkWidget *scrollbar)
|
|
||||||
{
|
|
||||||
GtkAdjustment *adj;
|
|
||||||
|
|
||||||
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
|
|
||||||
gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
scrollbar_popup (GtkWidget *scrollbar, GtkWidget *menu)
|
|
||||||
{
|
|
||||||
gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
activate (GApplication *app)
|
activate (GApplication *app)
|
||||||
{
|
{
|
||||||
@@ -1032,23 +1011,12 @@ activate (GApplication *app)
|
|||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GError *error = NULL;
|
|
||||||
GtkWidget *sw;
|
|
||||||
GtkWidget *scrollbar;
|
|
||||||
GtkWidget *menu;
|
|
||||||
GtkWidget *item;
|
|
||||||
|
|
||||||
static GActionEntry win_entries[] = {
|
static GActionEntry win_entries[] = {
|
||||||
{ "run", activate_run, NULL, NULL, NULL }
|
{ "run", activate_run, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
builder = gtk_builder_new ();
|
builder = gtk_builder_new_from_resource ("/ui/main.ui");
|
||||||
gtk_builder_add_from_resource (builder, "/ui/main.ui", &error);
|
|
||||||
if (error != NULL)
|
|
||||||
{
|
|
||||||
g_critical ("%s", error->message);
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
|
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
|
||||||
gtk_application_add_window (GTK_APPLICATION (app), window);
|
gtk_application_add_window (GTK_APPLICATION (app), window);
|
||||||
@@ -1064,21 +1032,6 @@ activate (GApplication *app)
|
|||||||
treeview = (GtkWidget *)gtk_builder_get_object (builder, "treeview");
|
treeview = (GtkWidget *)gtk_builder_get_object (builder, "treeview");
|
||||||
model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
|
model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
|
||||||
|
|
||||||
sw = (GtkWidget *)gtk_builder_get_object (builder, "source-scrolledwindow");
|
|
||||||
scrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (sw));
|
|
||||||
|
|
||||||
menu = gtk_menu_new ();
|
|
||||||
|
|
||||||
item = gtk_menu_item_new_with_label ("Start");
|
|
||||||
g_signal_connect (item, "activate", G_CALLBACK (start_cb), scrollbar);
|
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
|
||||||
|
|
||||||
item = gtk_menu_item_new_with_label ("End");
|
|
||||||
g_signal_connect (item, "activate", G_CALLBACK (end_cb), scrollbar);
|
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
|
||||||
|
|
||||||
g_signal_connect (scrollbar, "popup-menu", G_CALLBACK (scrollbar_popup), menu);
|
|
||||||
|
|
||||||
load_file (gtk_demos[0].name, gtk_demos[0].filename);
|
load_file (gtk_demos[0].name, gtk_demos[0].filename);
|
||||||
|
|
||||||
populate_model (model);
|
populate_model (model);
|
||||||
|
|||||||
@@ -29,8 +29,10 @@ source_toggled (GtkToggleButton *button)
|
|||||||
|
|
||||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||||
|
gtk_text_buffer_begin_irreversible_action (buffer);
|
||||||
gtk_text_buffer_delete (buffer, &start, &end);
|
gtk_text_buffer_delete (buffer, &start, &end);
|
||||||
gtk_text_buffer_insert_markup (buffer, &start, markup, -1);
|
gtk_text_buffer_insert_markup (buffer, &start, markup, -1);
|
||||||
|
gtk_text_buffer_end_irreversible_action (buffer);
|
||||||
g_free (markup);
|
g_free (markup);
|
||||||
|
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), "formatted");
|
gtk_stack_set_visible_child_name (GTK_STACK (stack), "formatted");
|
||||||
@@ -106,11 +108,15 @@ do_markup (GtkWidget *do_widget)
|
|||||||
|
|
||||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||||
gtk_text_buffer_get_start_iter (buffer, &iter);
|
gtk_text_buffer_get_start_iter (buffer, &iter);
|
||||||
|
gtk_text_buffer_begin_irreversible_action (buffer);
|
||||||
gtk_text_buffer_insert_markup (buffer, &iter, markup, -1);
|
gtk_text_buffer_insert_markup (buffer, &iter, markup, -1);
|
||||||
|
gtk_text_buffer_end_irreversible_action (buffer);
|
||||||
|
|
||||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view2));
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view2));
|
||||||
gtk_text_buffer_get_start_iter (buffer, &iter);
|
gtk_text_buffer_get_start_iter (buffer, &iter);
|
||||||
|
gtk_text_buffer_begin_irreversible_action (buffer);
|
||||||
gtk_text_buffer_insert (buffer, &iter, markup, -1);
|
gtk_text_buffer_insert (buffer, &iter, markup, -1);
|
||||||
|
gtk_text_buffer_end_irreversible_action (buffer);
|
||||||
|
|
||||||
g_bytes_unref (bytes);
|
g_bytes_unref (bytes);
|
||||||
|
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
/* Menus
|
|
||||||
*
|
|
||||||
* There are several widgets involved in displaying menus. The
|
|
||||||
* GtkMenuBar widget is a menu bar, which normally appears horizontally
|
|
||||||
* at the top of an application, but can also be layed out vertically.
|
|
||||||
* The GtkMenu widget is the actual menu that pops up. Both GtkMenuBar
|
|
||||||
* and GtkMenu are subclasses of GtkMenuShell; a GtkMenuShell contains
|
|
||||||
* menu items (GtkMenuItem). Each menu item contains text and/or images
|
|
||||||
* and can be selected by the user.
|
|
||||||
*
|
|
||||||
* There are several kinds of menu item, including plain GtkMenuItem,
|
|
||||||
* GtkCheckMenuItem which can be checked/unchecked, GtkRadioMenuItem
|
|
||||||
* which is a check menu item that's in a mutually exclusive group,
|
|
||||||
* GtkSeparatorMenuItem which is a separator bar, GtkTearoffMenuItem
|
|
||||||
* which allows a GtkMenu to be torn off, and GtkImageMenuItem which
|
|
||||||
* can place a GtkImage or other widget next to the menu text.
|
|
||||||
*
|
|
||||||
* A GtkMenuItem can have a submenu, which is simply a GtkMenu to pop
|
|
||||||
* up when the menu item is selected. Typically, all menu items in a menu bar
|
|
||||||
* have submenus.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
#include <gdk/gdkkeysyms.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
static GtkWidget *
|
|
||||||
create_menu (gint depth)
|
|
||||||
{
|
|
||||||
GtkWidget *menu;
|
|
||||||
GtkRadioMenuItem *last_item;
|
|
||||||
char buf[32];
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
if (depth < 1)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
menu = gtk_menu_new ();
|
|
||||||
last_item = NULL;
|
|
||||||
|
|
||||||
for (i = 0, j = 1; i < 5; i++, j++)
|
|
||||||
{
|
|
||||||
GtkWidget *menu_item;
|
|
||||||
|
|
||||||
sprintf (buf, "item %2d - %d", depth, j);
|
|
||||||
|
|
||||||
menu_item = gtk_radio_menu_item_new_with_label_from_widget (NULL, buf);
|
|
||||||
gtk_radio_menu_item_join_group (GTK_RADIO_MENU_ITEM (menu_item), last_item);
|
|
||||||
last_item = GTK_RADIO_MENU_ITEM (menu_item);
|
|
||||||
|
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
|
|
||||||
gtk_widget_show (menu_item);
|
|
||||||
if (i == 3)
|
|
||||||
gtk_widget_set_sensitive (menu_item, FALSE);
|
|
||||||
|
|
||||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), create_menu (depth - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
change_orientation (GtkWidget *button,
|
|
||||||
GtkWidget *menubar)
|
|
||||||
{
|
|
||||||
GtkWidget *parent;
|
|
||||||
GtkOrientation orientation;
|
|
||||||
|
|
||||||
parent = gtk_widget_get_parent (menubar);
|
|
||||||
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (parent));
|
|
||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (parent), 1 - orientation);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkWidget *window = NULL;
|
|
||||||
|
|
||||||
GtkWidget *
|
|
||||||
do_menus (GtkWidget *do_widget)
|
|
||||||
{
|
|
||||||
GtkWidget *box;
|
|
||||||
GtkWidget *box1;
|
|
||||||
GtkWidget *box2;
|
|
||||||
GtkWidget *button;
|
|
||||||
|
|
||||||
if (!window)
|
|
||||||
{
|
|
||||||
GtkWidget *menubar;
|
|
||||||
GtkWidget *menu;
|
|
||||||
GtkWidget *menuitem;
|
|
||||||
GtkAccelGroup *accel_group;
|
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
|
||||||
gtk_widget_get_display (do_widget));
|
|
||||||
gtk_window_set_title (GTK_WINDOW (window), "Menus");
|
|
||||||
g_signal_connect (window, "destroy",
|
|
||||||
G_CALLBACK(gtk_widget_destroyed), &window);
|
|
||||||
|
|
||||||
accel_group = gtk_accel_group_new ();
|
|
||||||
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
|
|
||||||
|
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
|
||||||
gtk_container_add (GTK_CONTAINER (window), box);
|
|
||||||
|
|
||||||
box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
|
||||||
gtk_container_add (GTK_CONTAINER (box), box1);
|
|
||||||
|
|
||||||
menubar = gtk_menu_bar_new ();
|
|
||||||
gtk_widget_set_hexpand (menubar, TRUE);
|
|
||||||
gtk_container_add (GTK_CONTAINER (box1), menubar);
|
|
||||||
|
|
||||||
menu = create_menu (2);
|
|
||||||
|
|
||||||
menuitem = gtk_menu_item_new_with_label ("test\nline2");
|
|
||||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
|
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
|
||||||
|
|
||||||
menuitem = gtk_menu_item_new_with_label ("foo");
|
|
||||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3));
|
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
|
||||||
|
|
||||||
menuitem = gtk_menu_item_new_with_label ("bar");
|
|
||||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4));
|
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
|
||||||
|
|
||||||
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
|
||||||
gtk_container_add (GTK_CONTAINER (box1), box2);
|
|
||||||
|
|
||||||
button = gtk_button_new_with_label ("Flip");
|
|
||||||
g_signal_connect (button, "clicked",
|
|
||||||
G_CALLBACK (change_orientation), menubar);
|
|
||||||
gtk_container_add (GTK_CONTAINER (box2), button);
|
|
||||||
|
|
||||||
button = gtk_button_new_with_label ("Close");
|
|
||||||
g_signal_connect_swapped (button, "clicked",
|
|
||||||
G_CALLBACK(gtk_widget_destroy), window);
|
|
||||||
gtk_container_add (GTK_CONTAINER (box2), button);
|
|
||||||
gtk_window_set_default_widget (GTK_WINDOW (window), button);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
|
||||||
gtk_widget_show (window);
|
|
||||||
else
|
|
||||||
gtk_widget_destroy (window);
|
|
||||||
|
|
||||||
return window;
|
|
||||||
}
|
|
||||||
@@ -4,10 +4,12 @@ demos = files([
|
|||||||
'application_demo.c',
|
'application_demo.c',
|
||||||
'assistant.c',
|
'assistant.c',
|
||||||
'builder.c',
|
'builder.c',
|
||||||
'changedisplay.c',
|
|
||||||
'clipboard.c',
|
'clipboard.c',
|
||||||
'colorsel.c',
|
'colorsel.c',
|
||||||
'combobox.c',
|
'combobox.c',
|
||||||
|
'constraints.c',
|
||||||
|
'constraints2.c',
|
||||||
|
'constraints3.c',
|
||||||
'css_accordion.c',
|
'css_accordion.c',
|
||||||
'css_basics.c',
|
'css_basics.c',
|
||||||
'css_blendmodes.c',
|
'css_blendmodes.c',
|
||||||
@@ -19,17 +21,19 @@ demos = files([
|
|||||||
'drawingarea.c',
|
'drawingarea.c',
|
||||||
'dnd.c',
|
'dnd.c',
|
||||||
'editable_cells.c',
|
'editable_cells.c',
|
||||||
'entry_buffer.c',
|
|
||||||
'entry_completion.c',
|
'entry_completion.c',
|
||||||
|
'entry_undo.c',
|
||||||
'expander.c',
|
'expander.c',
|
||||||
'filtermodel.c',
|
'filtermodel.c',
|
||||||
'fishbowl.c',
|
'fishbowl.c',
|
||||||
'fixed.c',
|
'fixed.c',
|
||||||
|
'fontrendering.c',
|
||||||
'foreigndrawing.c',
|
'foreigndrawing.c',
|
||||||
'gestures.c',
|
'gestures.c',
|
||||||
'glarea.c',
|
'glarea.c',
|
||||||
'headerbar.c',
|
'headerbar.c',
|
||||||
'hypertext.c',
|
'hypertext.c',
|
||||||
|
'iconscroll.c',
|
||||||
'iconview.c',
|
'iconview.c',
|
||||||
'iconview_edit.c',
|
'iconview_edit.c',
|
||||||
'images.c',
|
'images.c',
|
||||||
@@ -39,7 +43,6 @@ demos = files([
|
|||||||
'flowbox.c',
|
'flowbox.c',
|
||||||
'list_store.c',
|
'list_store.c',
|
||||||
'markup.c',
|
'markup.c',
|
||||||
'menus.c',
|
|
||||||
'modelbutton.c',
|
'modelbutton.c',
|
||||||
'overlay.c',
|
'overlay.c',
|
||||||
'overlay2.c',
|
'overlay2.c',
|
||||||
@@ -68,6 +71,7 @@ demos = files([
|
|||||||
'tabs.c',
|
'tabs.c',
|
||||||
'tagged_entry.c',
|
'tagged_entry.c',
|
||||||
'textmask.c',
|
'textmask.c',
|
||||||
|
'textundo.c',
|
||||||
'textview.c',
|
'textview.c',
|
||||||
'textscroll.c',
|
'textscroll.c',
|
||||||
'themes.c',
|
'themes.c',
|
||||||
|
|||||||
@@ -378,7 +378,7 @@
|
|||||||
378|GTK+ and friends|GTKtoolkit|#GNUStep gets #GTK+ theming http://is.gd/95vHl more at http://is.gd/95wt8|1267029498|0||0|1
|
378|GTK+ and friends|GTKtoolkit|#GNUStep gets #GTK+ theming http://is.gd/95vHl more at http://is.gd/95wt8|1267029498|0||0|1
|
||||||
379|GTK+ and friends|GTKtoolkit|GTK+ 2.19.6 released: http://mail.gnome.org/archives/gtk-devel-list/2010-February/msg00050.html #gtk|1266966985|0||0|0
|
379|GTK+ and friends|GTKtoolkit|GTK+ 2.19.6 released: http://mail.gnome.org/archives/gtk-devel-list/2010-February/msg00050.html #gtk|1266966985|0||0|0
|
||||||
380|GTK+ and friends|GTKtoolkit|Did you know that #GTK+ is the official toolkit for the #LiMo software stack? http://bit.ly/cuEdHx|1266925406|0||0|0
|
380|GTK+ and friends|GTKtoolkit|Did you know that #GTK+ is the official toolkit for the #LiMo software stack? http://bit.ly/cuEdHx|1266925406|0||0|0
|
||||||
381|GTK+ and friends|GTKtoolkit|@lmedinas publishes a #javascript #example on how to put an status icon with #Gtk+ http://bit.ly/9py1uC Thanks a lot Luis!|1266886644|0||1|1
|
381|GTK+ and friends|GTKtoolkit|@lmedinas publishes a #javascript #example on how to put a status icon with #Gtk+ http://bit.ly/9py1uC Thanks a lot Luis!|1266886644|0||1|1
|
||||||
382|GTK+ and friends|GTKtoolkit|♺ @ebassi: I should really finish up the GDom API as well|1266880653|0||0|0
|
382|GTK+ and friends|GTKtoolkit|♺ @ebassi: I should really finish up the GDom API as well|1266880653|0||0|0
|
||||||
383|GTK+ and friends|GTKtoolkit|♺ @ebassi: I hope to work on this for the next GIO release, and the GTK+ side for 3.0|1266880641|0||0|0
|
383|GTK+ and friends|GTKtoolkit|♺ @ebassi: I hope to work on this for the next GIO release, and the GTK+ side for 3.0|1266880641|0||0|0
|
||||||
384|GTK+ and friends|GTKtoolkit|♺ @ebassi: just updated the ApplicationClass design wiki page with the stuff @Cwiiis did for Mx - http://bit.ly/cfAOJk|1266880559|0||0|0
|
384|GTK+ and friends|GTKtoolkit|♺ @ebassi: just updated the ApplicationClass design wiki page with the stuff @Cwiiis did for Mx - http://bit.ly/cfAOJk|1266880559|0||0|0
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
static void
|
void
|
||||||
tool_clicked (GtkButton *button)
|
modelbutton_tool_clicked (GtkButton *button)
|
||||||
{
|
{
|
||||||
gboolean active;
|
gboolean active;
|
||||||
|
|
||||||
@@ -40,8 +40,6 @@ do_modelbutton (GtkWidget *do_widget)
|
|||||||
GActionGroup *actions;
|
GActionGroup *actions;
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/modelbutton/modelbutton.ui");
|
builder = gtk_builder_new_from_resource ("/modelbutton/modelbutton.ui");
|
||||||
gtk_builder_add_callback_symbol (builder, "tool_clicked", G_CALLBACK (tool_clicked));
|
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
|
|||||||
@@ -14,34 +14,19 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuButton">
|
<object class="GtkMenuButton">
|
||||||
<property name="popover">thing_a</property>
|
<property name="popover">thing_a</property>
|
||||||
<child>
|
<property name="label">Color</property>
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="label">Color</property>
|
|
||||||
<property name="hexpand">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuButton">
|
<object class="GtkMenuButton">
|
||||||
<property name="popover">thing_b</property>
|
<property name="popover">thing_b</property>
|
||||||
<child>
|
<property name="label">Flavors</property>
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="label">Flavors</property>
|
|
||||||
<property name="hexpand">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuButton">
|
<object class="GtkMenuButton">
|
||||||
<property name="popover">thing_c</property>
|
<property name="popover">thing_c</property>
|
||||||
<child>
|
<property name="label">Tools</property>
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="label">Tools</property>
|
|
||||||
<property name="hexpand">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -57,7 +42,6 @@
|
|||||||
<property name="action-name">win.color</property>
|
<property name="action-name">win.color</property>
|
||||||
<property name="action-target">'red'</property>
|
<property name="action-target">'red'</property>
|
||||||
<property name="text">Red</property>
|
<property name="text">Red</property>
|
||||||
<property name="inverted">1</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -65,7 +49,6 @@
|
|||||||
<property name="action-name">win.color</property>
|
<property name="action-name">win.color</property>
|
||||||
<property name="action-target">'green'</property>
|
<property name="action-target">'green'</property>
|
||||||
<property name="text">Green</property>
|
<property name="text">Green</property>
|
||||||
<property name="inverted">1</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -73,7 +56,6 @@
|
|||||||
<property name="action-name">win.color</property>
|
<property name="action-name">win.color</property>
|
||||||
<property name="action-target">'blue'</property>
|
<property name="action-target">'blue'</property>
|
||||||
<property name="text">Blue</property>
|
<property name="text">Blue</property>
|
||||||
<property name="inverted">1</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -119,21 +101,21 @@
|
|||||||
<object class="GtkModelButton">
|
<object class="GtkModelButton">
|
||||||
<property name="text">Hammer</property>
|
<property name="text">Hammer</property>
|
||||||
<property name="role">check</property>
|
<property name="role">check</property>
|
||||||
<signal name="clicked" handler="tool_clicked"/>
|
<signal name="clicked" handler="modelbutton_tool_clicked"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkModelButton">
|
<object class="GtkModelButton">
|
||||||
<property name="text">Screwdriver</property>
|
<property name="text">Screwdriver</property>
|
||||||
<property name="role">check</property>
|
<property name="role">check</property>
|
||||||
<signal name="clicked" handler="tool_clicked"/>
|
<signal name="clicked" handler="modelbutton_tool_clicked"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkModelButton">
|
<object class="GtkModelButton">
|
||||||
<property name="text">Drill</property>
|
<property name="text">Drill</property>
|
||||||
<property name="role">check</property>
|
<property name="role">check</property>
|
||||||
<signal name="clicked" handler="tool_clicked"/>
|
<signal name="clicked" handler="modelbutton_tool_clicked"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* GTK uses for videos. This allows treating the icon like a
|
* GTK uses for videos. This allows treating the icon like a
|
||||||
* regular video, so we can for example attach controls to it.
|
* regular video, so we can for example attach controls to it.
|
||||||
*
|
*
|
||||||
* After all, what good is an media_stream if one cannot pause
|
* After all, what good is a media_stream if one cannot pause
|
||||||
* it.
|
* it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ do_revealer (GtkWidget *do_widget)
|
|||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/revealer/revealer.ui");
|
builder = gtk_builder_new_from_resource ("/revealer/revealer.ui");
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ do_scale (GtkWidget *do_widget)
|
|||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/scale/scale.ui");
|
builder = gtk_builder_new_from_resource ("/scale/scale.ui");
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
|
|||||||
@@ -75,11 +75,11 @@
|
|||||||
<property name="adjustment">adjustment2</property>
|
<property name="adjustment">adjustment2</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<marks>
|
<marks>
|
||||||
<mark value="0" position="bottom"/>
|
<mark value="0" position="bottom"></mark>
|
||||||
<mark value="1" position="bottom"/>
|
<mark value="1" position="bottom"></mark>
|
||||||
<mark value="2" position="bottom"/>
|
<mark value="2" position="bottom"></mark>
|
||||||
<mark value="3" position="bottom"/>
|
<mark value="3" position="bottom"></mark>
|
||||||
<mark value="4" position="bottom"/>
|
<mark value="4" position="bottom"></mark>
|
||||||
</marks>
|
</marks>
|
||||||
<accessibility>
|
<accessibility>
|
||||||
<relation type="labelled-by" target="label_marks"/>
|
<relation type="labelled-by" target="label_marks"/>
|
||||||
@@ -115,11 +115,11 @@
|
|||||||
<relation type="labelled-by" target="label_discrete"/>
|
<relation type="labelled-by" target="label_discrete"/>
|
||||||
</accessibility>
|
</accessibility>
|
||||||
<marks>
|
<marks>
|
||||||
<mark value="0" position="bottom"/>
|
<mark value="0" position="bottom"></mark>
|
||||||
<mark value="1" position="bottom"/>
|
<mark value="1" position="bottom"></mark>
|
||||||
<mark value="2" position="bottom"/>
|
<mark value="2" position="bottom"></mark>
|
||||||
<mark value="3" position="bottom"/>
|
<mark value="3" position="bottom"></mark>
|
||||||
<mark value="4" position="bottom"/>
|
<mark value="4" position="bottom"></mark>
|
||||||
</marks>
|
</marks>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
|
|||||||
@@ -25,44 +25,44 @@ show_shortcuts (GtkWidget *window,
|
|||||||
g_object_unref (builder);
|
g_object_unref (builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
builder_shortcuts (GtkWidget *window)
|
shortcuts_builder_shortcuts (GtkWidget *window)
|
||||||
{
|
{
|
||||||
show_shortcuts (window, "shortcuts-builder", NULL);
|
show_shortcuts (window, "shortcuts-builder", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
gedit_shortcuts (GtkWidget *window)
|
shortcuts_gedit_shortcuts (GtkWidget *window)
|
||||||
{
|
{
|
||||||
show_shortcuts (window, "shortcuts-gedit", NULL);
|
show_shortcuts (window, "shortcuts-gedit", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
clocks_shortcuts (GtkWidget *window)
|
shortcuts_clocks_shortcuts (GtkWidget *window)
|
||||||
{
|
{
|
||||||
show_shortcuts (window, "shortcuts-clocks", NULL);
|
show_shortcuts (window, "shortcuts-clocks", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
clocks_shortcuts_stopwatch (GtkWidget *window)
|
shortcuts_clocks_shortcuts_stopwatch (GtkWidget *window)
|
||||||
{
|
{
|
||||||
show_shortcuts (window, "shortcuts-clocks", "stopwatch");
|
show_shortcuts (window, "shortcuts-clocks", "stopwatch");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
boxes_shortcuts (GtkWidget *window)
|
shortcuts_boxes_shortcuts (GtkWidget *window)
|
||||||
{
|
{
|
||||||
show_shortcuts (window, "shortcuts-boxes", NULL);
|
show_shortcuts (window, "shortcuts-boxes", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
boxes_shortcuts_wizard (GtkWidget *window)
|
shortcuts_boxes_shortcuts_wizard (GtkWidget *window)
|
||||||
{
|
{
|
||||||
show_shortcuts (window, "shortcuts-boxes", "wizard");
|
show_shortcuts (window, "shortcuts-boxes", "wizard");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
boxes_shortcuts_display (GtkWidget *window)
|
shortcuts_boxes_shortcuts_display (GtkWidget *window)
|
||||||
{
|
{
|
||||||
show_shortcuts (window, "shortcuts-boxes", "display");
|
show_shortcuts (window, "shortcuts-boxes", "display");
|
||||||
}
|
}
|
||||||
@@ -86,16 +86,6 @@ do_shortcuts (GtkWidget *do_widget)
|
|||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/shortcuts/shortcuts.ui");
|
builder = gtk_builder_new_from_resource ("/shortcuts/shortcuts.ui");
|
||||||
gtk_builder_add_callback_symbols (builder,
|
|
||||||
"builder_shortcuts", G_CALLBACK (builder_shortcuts),
|
|
||||||
"gedit_shortcuts", G_CALLBACK (gedit_shortcuts),
|
|
||||||
"clocks_shortcuts", G_CALLBACK (clocks_shortcuts),
|
|
||||||
"clocks_shortcuts_stopwatch", G_CALLBACK (clocks_shortcuts_stopwatch),
|
|
||||||
"boxes_shortcuts", G_CALLBACK (boxes_shortcuts),
|
|
||||||
"boxes_shortcuts_wizard", G_CALLBACK (boxes_shortcuts_wizard),
|
|
||||||
"boxes_shortcuts_display", G_CALLBACK (boxes_shortcuts_display),
|
|
||||||
NULL);
|
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
|
|||||||
@@ -10,43 +10,43 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="label">Builder</property>
|
<property name="label">Builder</property>
|
||||||
<signal name="clicked" handler="builder_shortcuts" swapped="1" object="window1"/>
|
<signal name="clicked" handler="shortcuts_builder_shortcuts" swapped="1" object="window1"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="label">GEdit</property>
|
<property name="label">GEdit</property>
|
||||||
<signal name="clicked" handler="gedit_shortcuts" swapped="1" object="window1"/>
|
<signal name="clicked" handler="shortcuts_gedit_shortcuts" swapped="1" object="window1"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="label">Clocks - All</property>
|
<property name="label">Clocks - All</property>
|
||||||
<signal name="clicked" handler="clocks_shortcuts" swapped="1" object="window1"/>
|
<signal name="clicked" handler="shortcuts_clocks_shortcuts" swapped="1" object="window1"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="label">Clocks - Stopwatch</property>
|
<property name="label">Clocks - Stopwatch</property>
|
||||||
<signal name="clicked" handler="clocks_shortcuts_stopwatch" swapped="1" object="window1"/>
|
<signal name="clicked" handler="shortcuts_clocks_shortcuts_stopwatch" swapped="1" object="window1"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="label">Boxes</property>
|
<property name="label">Boxes</property>
|
||||||
<signal name="clicked" handler="boxes_shortcuts" swapped="1" object="window1"/>
|
<signal name="clicked" handler="shortcuts_boxes_shortcuts" swapped="1" object="window1"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="label">Boxes - Wizard</property>
|
<property name="label">Boxes - Wizard</property>
|
||||||
<signal name="clicked" handler="boxes_shortcuts_wizard" swapped="1" object="window1"/>
|
<signal name="clicked" handler="shortcuts_boxes_shortcuts_wizard" swapped="1" object="window1"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="label">Boxes - Display</property>
|
<property name="label">Boxes - Display</property>
|
||||||
<signal name="clicked" handler="boxes_shortcuts_display" swapped="1" object="window1"/>
|
<signal name="clicked" handler="shortcuts_boxes_shortcuts_display" swapped="1" object="window1"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -54,10 +54,7 @@ do_sidebar (GtkWidget *do_widget)
|
|||||||
stack = gtk_stack_new ();
|
stack = gtk_stack_new ();
|
||||||
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN);
|
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN);
|
||||||
gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack));
|
gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack));
|
||||||
|
gtk_widget_set_hexpand (stack, TRUE);
|
||||||
/* Separator between sidebar and stack */
|
|
||||||
widget = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
|
||||||
gtk_container_add (GTK_CONTAINER(box), widget);
|
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (box), stack);
|
gtk_container_add (GTK_CONTAINER (box), stack);
|
||||||
|
|
||||||
@@ -66,6 +63,7 @@ do_sidebar (GtkWidget *do_widget)
|
|||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
widget = gtk_image_new_from_icon_name ("org.gtk.Demo4");
|
widget = gtk_image_new_from_icon_name ("org.gtk.Demo4");
|
||||||
|
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "icon-dropshadow");
|
||||||
gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
|
gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static gint
|
gint
|
||||||
hex_spin_input (GtkSpinButton *spin_button,
|
spinbutton_hex_spin_input (GtkSpinButton *spin_button,
|
||||||
gdouble *new_val)
|
gdouble *new_val)
|
||||||
{
|
{
|
||||||
const gchar *buf;
|
const gchar *buf;
|
||||||
gchar *err;
|
gchar *err;
|
||||||
@@ -28,8 +28,8 @@ hex_spin_input (GtkSpinButton *spin_button,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
gint
|
||||||
hex_spin_output (GtkSpinButton *spin_button)
|
spinbutton_hex_spin_output (GtkSpinButton *spin_button)
|
||||||
{
|
{
|
||||||
GtkAdjustment *adjustment;
|
GtkAdjustment *adjustment;
|
||||||
gchar *buf;
|
gchar *buf;
|
||||||
@@ -48,9 +48,9 @@ hex_spin_output (GtkSpinButton *spin_button)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
gint
|
||||||
time_spin_input (GtkSpinButton *spin_button,
|
spinbutton_time_spin_input (GtkSpinButton *spin_button,
|
||||||
gdouble *new_val)
|
gdouble *new_val)
|
||||||
{
|
{
|
||||||
const gchar *text;
|
const gchar *text;
|
||||||
gchar **str;
|
gchar **str;
|
||||||
@@ -87,8 +87,8 @@ time_spin_input (GtkSpinButton *spin_button,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
gint
|
||||||
time_spin_output (GtkSpinButton *spin_button)
|
spinbutton_time_spin_output (GtkSpinButton *spin_button)
|
||||||
{
|
{
|
||||||
GtkAdjustment *adjustment;
|
GtkAdjustment *adjustment;
|
||||||
gchar *buf;
|
gchar *buf;
|
||||||
@@ -121,9 +121,9 @@ static gchar *month[12] = {
|
|||||||
"December"
|
"December"
|
||||||
};
|
};
|
||||||
|
|
||||||
static gint
|
gint
|
||||||
month_spin_input (GtkSpinButton *spin_button,
|
spinbutton_month_spin_input (GtkSpinButton *spin_button,
|
||||||
gdouble *new_val)
|
gdouble *new_val)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
gchar *tmp1, *tmp2;
|
gchar *tmp1, *tmp2;
|
||||||
@@ -150,8 +150,8 @@ month_spin_input (GtkSpinButton *spin_button,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
gint
|
||||||
month_spin_output (GtkSpinButton *spin_button)
|
spinbutton_month_spin_output (GtkSpinButton *spin_button)
|
||||||
{
|
{
|
||||||
GtkAdjustment *adjustment;
|
GtkAdjustment *adjustment;
|
||||||
gdouble value;
|
gdouble value;
|
||||||
@@ -191,15 +191,6 @@ do_spinbutton (GtkWidget *do_widget)
|
|||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/spinbutton/spinbutton.ui");
|
builder = gtk_builder_new_from_resource ("/spinbutton/spinbutton.ui");
|
||||||
gtk_builder_add_callback_symbols (builder,
|
|
||||||
"hex_spin_input", G_CALLBACK (hex_spin_input),
|
|
||||||
"hex_spin_output", G_CALLBACK (hex_spin_output),
|
|
||||||
"time_spin_input", G_CALLBACK (time_spin_input),
|
|
||||||
"time_spin_output", G_CALLBACK (time_spin_output),
|
|
||||||
"month_spin_input", G_CALLBACK (month_spin_input),
|
|
||||||
"month_spin_output", G_CALLBACK (month_spin_output),
|
|
||||||
NULL);
|
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
|
|||||||
@@ -83,8 +83,8 @@
|
|||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="width-chars">4</property>
|
<property name="width-chars">4</property>
|
||||||
<property name="adjustment">hex_adjustment</property>
|
<property name="adjustment">hex_adjustment</property>
|
||||||
<signal name="input" handler="hex_spin_input"/>
|
<signal name="input" handler="spinbutton_hex_spin_input"/>
|
||||||
<signal name="output" handler="hex_spin_output"/>
|
<signal name="output" handler="spinbutton_hex_spin_output"/>
|
||||||
<property name="wrap">1</property>
|
<property name="wrap">1</property>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
@@ -119,8 +119,8 @@
|
|||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="width-chars">5</property>
|
<property name="width-chars">5</property>
|
||||||
<property name="adjustment">time_adjustment</property>
|
<property name="adjustment">time_adjustment</property>
|
||||||
<signal name="input" handler="time_spin_input"/>
|
<signal name="input" handler="spinbutton_time_spin_input"/>
|
||||||
<signal name="output" handler="time_spin_output"/>
|
<signal name="output" handler="spinbutton_time_spin_output"/>
|
||||||
<property name="wrap">1</property>
|
<property name="wrap">1</property>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
@@ -154,8 +154,8 @@
|
|||||||
<object class="GtkSpinButton" id="month_spin">
|
<object class="GtkSpinButton" id="month_spin">
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="width-chars">9</property>
|
<property name="width-chars">9</property>
|
||||||
<signal name="input" handler="month_spin_input"/>
|
<signal name="input" handler="spinbutton_month_spin_input"/>
|
||||||
<signal name="output" handler="month_spin_output"/>
|
<signal name="output" handler="spinbutton_month_spin_output"/>
|
||||||
<property name="adjustment">month_adjustment</property>
|
<property name="adjustment">month_adjustment</property>
|
||||||
<property name="wrap">1</property>
|
<property name="wrap">1</property>
|
||||||
<property name="update-policy">if-valid</property>
|
<property name="update-policy">if-valid</property>
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ do_stack (GtkWidget *do_widget)
|
|||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/stack/stack.ui");
|
builder = gtk_builder_new_from_resource ("/stack/stack.ui");
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||||
gtk_window_set_display (GTK_WINDOW (window),
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
|
|||||||
71
demos/gtk-demo/textundo.c
Normal file
71
demos/gtk-demo/textundo.c
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/* Text View/Undo and Redo
|
||||||
|
*
|
||||||
|
* The GtkTextView supports undo and redo through the use of a
|
||||||
|
* GtkTextBuffer. You can enable or disable undo support using
|
||||||
|
* gtk_text_buffer_set_enable_undo().
|
||||||
|
*
|
||||||
|
* Use Primary+Z to undo and Primary+Shift+Z or Primary+Y to
|
||||||
|
* redo previously undone operations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include <stdlib.h> /* for exit() */
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
do_textundo (GtkWidget *do_widget)
|
||||||
|
{
|
||||||
|
static GtkWidget *window = NULL;
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
GtkWidget *view;
|
||||||
|
GtkWidget *sw;
|
||||||
|
GtkTextBuffer *buffer;
|
||||||
|
GtkTextIter iter;
|
||||||
|
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_window_set_display (GTK_WINDOW (window),
|
||||||
|
gtk_widget_get_display (do_widget));
|
||||||
|
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||||
|
450, 450);
|
||||||
|
|
||||||
|
g_signal_connect (window, "destroy",
|
||||||
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "TextView Undo");
|
||||||
|
|
||||||
|
view = gtk_text_view_new ();
|
||||||
|
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
|
||||||
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||||
|
gtk_text_buffer_set_enable_undo (buffer, TRUE);
|
||||||
|
|
||||||
|
/* this text cannot be undone */
|
||||||
|
gtk_text_buffer_begin_irreversible_action (buffer);
|
||||||
|
gtk_text_buffer_get_start_iter (buffer, &iter);
|
||||||
|
gtk_text_buffer_insert (buffer, &iter,
|
||||||
|
"Type to add more text.\n"
|
||||||
|
"Use Primary+Z to undo and Primary+Shift+Z to redo a previously undone action.\n"
|
||||||
|
"\n",
|
||||||
|
-1);
|
||||||
|
gtk_text_buffer_end_irreversible_action (buffer);
|
||||||
|
|
||||||
|
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||||
|
GTK_POLICY_AUTOMATIC,
|
||||||
|
GTK_POLICY_AUTOMATIC);
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), sw);
|
||||||
|
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gtk_widget_get_visible (window))
|
||||||
|
{
|
||||||
|
gtk_widget_show (window);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_widget_destroy (window);
|
||||||
|
window = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
@@ -128,24 +128,23 @@ insert_text (GtkTextBuffer *buffer)
|
|||||||
{
|
{
|
||||||
GtkTextIter iter;
|
GtkTextIter iter;
|
||||||
GtkTextIter start, end;
|
GtkTextIter start, end;
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
GtkIconTheme *icon_theme;
|
GtkIconTheme *icon_theme;
|
||||||
|
|
||||||
icon_theme = gtk_icon_theme_get_default ();
|
icon_theme = gtk_icon_theme_get_default ();
|
||||||
pixbuf = gtk_icon_theme_load_icon (icon_theme,
|
texture = GDK_TEXTURE (gtk_icon_theme_load_icon (icon_theme,
|
||||||
"gtk3-demo",
|
"gtk3-demo",
|
||||||
32,
|
32,
|
||||||
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
|
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
|
||||||
NULL);
|
NULL));
|
||||||
g_assert (pixbuf);
|
g_assert (texture);
|
||||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
|
||||||
|
|
||||||
/* get start of buffer; each insertion will revalidate the
|
/* get start of buffer; each insertion will revalidate the
|
||||||
* iterator to point to just after the inserted text.
|
* iterator to point to just after the inserted text.
|
||||||
*/
|
*/
|
||||||
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
|
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
|
||||||
|
|
||||||
|
gtk_text_buffer_begin_irreversible_action (buffer);
|
||||||
gtk_text_buffer_insert (buffer, &iter,
|
gtk_text_buffer_insert (buffer, &iter,
|
||||||
"The text widget can display text with all kinds of nifty attributes. "
|
"The text widget can display text with all kinds of nifty attributes. "
|
||||||
"It also supports multiple views of the same buffer; this demo is "
|
"It also supports multiple views of the same buffer; this demo is "
|
||||||
@@ -379,7 +378,8 @@ insert_text (GtkTextBuffer *buffer)
|
|||||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||||
gtk_text_buffer_apply_tag_by_name (buffer, "word_wrap", &start, &end);
|
gtk_text_buffer_apply_tag_by_name (buffer, "word_wrap", &start, &end);
|
||||||
|
|
||||||
g_object_unref (pixbuf);
|
gtk_text_buffer_end_irreversible_action (buffer);
|
||||||
|
|
||||||
g_object_unref (texture);
|
g_object_unref (texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,236 +6,235 @@
|
|||||||
<object class="GtkHeaderBar" id="header">
|
<object class="GtkHeaderBar" id="header">
|
||||||
<property name="show-title-buttons">1</property>
|
<property name="show-title-buttons">1</property>
|
||||||
<child type="end">
|
<child type="end">
|
||||||
<object class="GtkLabel" id="fps">
|
<object class="GtkLabel" id="fps"/>
|
||||||
</object>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkGrid" id="grid">
|
<object class="GtkGrid" id="grid">
|
||||||
<property name="margin">10</property>
|
<property name="margin">10</property>
|
||||||
<property name="row-spacing">10</property>
|
<property name="row-spacing">10</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
|
||||||
<object class="GtkToolbar">
|
|
||||||
<property name="hexpand">1</property>
|
|
||||||
<property name="show-arrow">0</property>
|
|
||||||
<style>
|
|
||||||
<class name="primary-toolbar"/>
|
|
||||||
</style>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleToolButton">
|
<object class="GtkToolbar">
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="label" translatable="yes">Normal</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="is-important">1</property>
|
|
||||||
<property name="icon-name">edit-find</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleToolButton">
|
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="label" translatable="yes">Active</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="is-important">1</property>
|
|
||||||
<property name="icon-name">edit-find</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleToolButton">
|
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="sensitive">0</property>
|
|
||||||
<property name="label" translatable="yes">Insensitive</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="is-important">1</property>
|
|
||||||
<property name="icon-name">edit-find</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleToolButton">
|
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="label" translatable="yes">Raised</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="is-important">1</property>
|
|
||||||
<property name="icon-name">edit-find</property>
|
|
||||||
<style>
|
|
||||||
<class name="raised"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleToolButton">
|
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="label" translatable="yes">Raised Active</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="is-important">1</property>
|
|
||||||
<property name="icon-name">edit-find</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
<style>
|
|
||||||
<class name="raised"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleToolButton">
|
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="sensitive">0</property>
|
|
||||||
<property name="label" translatable="yes">Insensitive Active</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="icon-name">edit-find</property>
|
|
||||||
<property name="is-important">1</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToolItem">
|
|
||||||
<child>
|
|
||||||
<object class="GtkEntry" id="entry1">
|
|
||||||
<property name="can-focus">1</property>
|
|
||||||
<property name="width-chars">10</property>
|
|
||||||
<property name="invisible-char">•</property>
|
|
||||||
<property name="placeholder-text" translatable="yes">Search...</property>
|
|
||||||
<property name="secondary-icon-name">edit-find-symbolic</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToolItem">
|
|
||||||
<child>
|
|
||||||
<object class="GtkSwitch" id="switch1">
|
|
||||||
<property name="can-focus">1</property>
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<property name="tooltip_text">Switch it</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox">
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<property name="halign">center</property>
|
|
||||||
<style>
|
|
||||||
<class name="linked"/>
|
|
||||||
</style>
|
|
||||||
<child>
|
|
||||||
<object class="GtkButton">
|
|
||||||
<property name="label" translatable="yes">Hi, I am a button</property>
|
|
||||||
<property name="can-focus">1</property>
|
|
||||||
<property name="receives-default">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkButton">
|
|
||||||
<property name="label" translatable="yes">And I'm another button</property>
|
|
||||||
<property name="can-focus">1</property>
|
|
||||||
<property name="receives-default">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkButton">
|
|
||||||
<property name="label" translatable="yes">This is a button party!</property>
|
|
||||||
<property name="can-focus">1</property>
|
|
||||||
<property name="receives-default">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToolbar">
|
|
||||||
<property name="hexpand">1</property>
|
|
||||||
<property name="toolbar-style">icons</property>
|
|
||||||
<style>
|
|
||||||
<class name="inline-toolbar"/>
|
|
||||||
</style>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleToolButton">
|
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="label" translatable="yes">Normal</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="icon-name">list-add-symbolic</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleToolButton">
|
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="label" translatable="yes">Normal</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="icon-name">list-add-symbolic</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleToolButton">
|
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="label" translatable="yes">Active</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="icon-name">list-remove-symbolic</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleToolButton">
|
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="label" translatable="yes">Active</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="icon-name">list-remove-symbolic</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleToolButton">
|
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="sensitive">0</property>
|
|
||||||
<property name="label" translatable="yes">Insensitive</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="icon-name">edit-find-symbolic</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleToolButton">
|
|
||||||
<property name="homogeneous">1</property>
|
|
||||||
<property name="sensitive">0</property>
|
|
||||||
<property name="label" translatable="yes">Insensitive Active</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="icon-name">go-up-symbolic</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox">
|
|
||||||
<property name="spacing">10</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkButton">
|
|
||||||
<property name="label">Plain</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<property name="vexpand">1</property>
|
<property name="show-arrow">0</property>
|
||||||
|
<style>
|
||||||
|
<class name="primary-toolbar"/>
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="label" translatable="yes">Normal</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="is-important">1</property>
|
||||||
|
<property name="icon-name">edit-find</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="label" translatable="yes">Active</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="is-important">1</property>
|
||||||
|
<property name="icon-name">edit-find</property>
|
||||||
|
<property name="active">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="sensitive">0</property>
|
||||||
|
<property name="label" translatable="yes">Insensitive</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="is-important">1</property>
|
||||||
|
<property name="icon-name">edit-find</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="label" translatable="yes">Raised</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="is-important">1</property>
|
||||||
|
<property name="icon-name">edit-find</property>
|
||||||
|
<style>
|
||||||
|
<class name="raised"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="label" translatable="yes">Raised Active</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="is-important">1</property>
|
||||||
|
<property name="icon-name">edit-find</property>
|
||||||
|
<property name="active">1</property>
|
||||||
|
<style>
|
||||||
|
<class name="raised"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="sensitive">0</property>
|
||||||
|
<property name="label" translatable="yes">Insensitive Active</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="icon-name">edit-find</property>
|
||||||
|
<property name="is-important">1</property>
|
||||||
|
<property name="active">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToolItem">
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="entry1">
|
||||||
|
<property name="can-focus">1</property>
|
||||||
|
<property name="width-chars">10</property>
|
||||||
|
<property name="invisible-char">•</property>
|
||||||
|
<property name="placeholder-text" translatable="yes">Search...</property>
|
||||||
|
<property name="secondary-icon-name">edit-find-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToolItem">
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="switch1">
|
||||||
|
<property name="can-focus">1</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<property name="tooltip_text">Switch it</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkBox">
|
||||||
<property name="label">Destructive</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="destructive-action"/>
|
<class name="linked"/>
|
||||||
</style>
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label" translatable="yes">Hi, I am a button</property>
|
||||||
|
<property name="can-focus">1</property>
|
||||||
|
<property name="receives-default">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label" translatable="yes">And I'm another button</property>
|
||||||
|
<property name="can-focus">1</property>
|
||||||
|
<property name="receives-default">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label" translatable="yes">This is a button party!</property>
|
||||||
|
<property name="can-focus">1</property>
|
||||||
|
<property name="receives-default">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkToolbar">
|
||||||
<property name="label">Suggested</property>
|
<property name="hexpand">1</property>
|
||||||
|
<property name="toolbar-style">icons</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="suggested-action"/>
|
<class name="inline-toolbar"/>
|
||||||
</style>
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="label" translatable="yes">Normal</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="icon-name">list-add-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="label" translatable="yes">Normal</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="icon-name">list-add-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="label" translatable="yes">Active</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="icon-name">list-remove-symbolic</property>
|
||||||
|
<property name="active">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="label" translatable="yes">Active</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="icon-name">list-remove-symbolic</property>
|
||||||
|
<property name="active">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="sensitive">0</property>
|
||||||
|
<property name="label" translatable="yes">Insensitive</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="icon-name">edit-find-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleToolButton">
|
||||||
|
<property name="homogeneous">1</property>
|
||||||
|
<property name="sensitive">0</property>
|
||||||
|
<property name="label" translatable="yes">Insensitive Active</property>
|
||||||
|
<property name="use-underline">1</property>
|
||||||
|
<property name="icon-name">go-up-symbolic</property>
|
||||||
|
<property name="active">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="spacing">10</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label">Plain</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="hexpand">1</property>
|
||||||
|
<property name="vexpand">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label">Destructive</property>
|
||||||
|
<style>
|
||||||
|
<class name="destructive-action"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label">Suggested</property>
|
||||||
|
<style>
|
||||||
|
<class name="suggested-action"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</interface>
|
</interface>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<interface>
|
<interface>
|
||||||
<object class="GtkGrid" id="grid">
|
<object class="GtkGrid" id="grid">
|
||||||
<property name="row-spacing">10</property>
|
<property name="row-spacing">10</property>
|
||||||
|
<property name="margin">10</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToolbar">
|
<object class="GtkToolbar">
|
||||||
@@ -92,6 +93,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkSwitch" id="switch1">
|
<object class="GtkSwitch" id="switch1">
|
||||||
<property name="can-focus">1</property>
|
<property name="can-focus">1</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
<property name="tooltip_text">Switch it</property>
|
<property name="tooltip_text">Switch it</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ user-trash=The icon for the user's “Trash” place in the file system
|
|||||||
user-trash-full=The icon for the user's “Trash” in the file system, when there are items in the “Trash” waiting for disposal or recovery
|
user-trash-full=The icon for the user's “Trash” in the file system, when there are items in the “Trash” waiting for disposal or recovery
|
||||||
emblem-system=The icon used as an emblem for directories that contain system libraries, settings, and data
|
emblem-system=The icon used as an emblem for directories that contain system libraries, settings, and data
|
||||||
avatar-default=The generic avatar icon, which is used to represent a user that doesn't have a personalized avatar
|
avatar-default=The generic avatar icon, which is used to represent a user that doesn't have a personalized avatar
|
||||||
emblem-synchronizing=The icon used as an emblem to indicate that a a synchronizing operation is in process
|
emblem-synchronizing=The icon used as an emblem to indicate that a synchronizing operation is in process
|
||||||
emblem-shared=The icon used as an emblem for files and directories that are shared to other users
|
emblem-shared=The icon used as an emblem for files and directories that are shared to other users
|
||||||
help-browser=The icon used for the desktop's help browsing application
|
help-browser=The icon used for the desktop's help browsing application
|
||||||
|
|
||||||
|
|||||||
@@ -81,11 +81,14 @@ get_icon (GtkWidget *image, const gchar *name, gint size)
|
|||||||
{
|
{
|
||||||
GtkIconInfo *info;
|
GtkIconInfo *info;
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
|
GdkTexture *texture;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (image);
|
context = gtk_widget_get_style_context (image);
|
||||||
info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), name, size, 0);
|
info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), name, size, 0);
|
||||||
pixbuf = gtk_icon_info_load_symbolic_for_context (info, context, NULL, NULL);
|
texture = GDK_TEXTURE (gtk_icon_info_load_symbolic_for_context (info, context, NULL, NULL));
|
||||||
|
pixbuf = gdk_pixbuf_get_from_texture (texture);
|
||||||
|
g_object_unref (texture);
|
||||||
g_object_unref (info);
|
g_object_unref (info);
|
||||||
|
|
||||||
return pixbuf;
|
return pixbuf;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
subdir('constraint-editor')
|
||||||
subdir('gtk-demo')
|
subdir('gtk-demo')
|
||||||
subdir('icon-browser')
|
subdir('icon-browser')
|
||||||
subdir('node-editor')
|
subdir('node-editor')
|
||||||
|
|||||||
@@ -26,9 +26,9 @@
|
|||||||
static const char *css =
|
static const char *css =
|
||||||
"textview.editor {"
|
"textview.editor {"
|
||||||
" color: rgb(192, 197, 206);"
|
" color: rgb(192, 197, 206);"
|
||||||
" caret-color: white;"
|
" caret-color: currentColor;"
|
||||||
"}"
|
"}"
|
||||||
"textview.editor text {"
|
"textview.editor > text {"
|
||||||
" background-color: rgb(43, 48, 59);"
|
" background-color: rgb(43, 48, 59);"
|
||||||
"}"
|
"}"
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -707,6 +707,14 @@ static void
|
|||||||
node_editor_window_unrealize (GtkWidget *widget)
|
node_editor_window_unrealize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i ++)
|
||||||
|
{
|
||||||
|
gpointer item = g_list_model_get_item (G_LIST_MODEL (self->renderers), i);
|
||||||
|
gsk_renderer_unrealize (gtk_renderer_paintable_get_renderer (item));
|
||||||
|
g_object_unref (item);
|
||||||
|
}
|
||||||
|
|
||||||
g_list_store_remove_all (self->renderers);
|
g_list_store_remove_all (self->renderers);
|
||||||
|
|
||||||
|
|||||||
@@ -1003,6 +1003,9 @@ populate_flowbox (GtkWidget *flowbox)
|
|||||||
|
|
||||||
while ((name = g_dir_read_name (dir)) != NULL)
|
while ((name = g_dir_read_name (dir)) != NULL)
|
||||||
{
|
{
|
||||||
|
if (g_str_has_suffix (name, ".xml"))
|
||||||
|
continue;
|
||||||
|
|
||||||
filename = g_build_filename (location, name, NULL);
|
filename = g_build_filename (location, name, NULL);
|
||||||
file = g_file_new_for_path (filename);
|
file = g_file_new_for_path (filename);
|
||||||
stream = G_INPUT_STREAM (g_file_read (file, NULL, &error));
|
stream = G_INPUT_STREAM (g_file_read (file, NULL, &error));
|
||||||
@@ -1017,7 +1020,7 @@ populate_flowbox (GtkWidget *flowbox)
|
|||||||
bd = g_new (BackgroundData, 1);
|
bd = g_new (BackgroundData, 1);
|
||||||
bd->flowbox = flowbox;
|
bd->flowbox = flowbox;
|
||||||
bd->filename = filename;
|
bd->filename = filename;
|
||||||
gdk_pixbuf_new_from_stream_at_scale_async (stream, 110, 110, TRUE, NULL,
|
gdk_pixbuf_new_from_stream_at_scale_async (stream, 110, 110, TRUE, NULL,
|
||||||
background_loaded_cb, bd);
|
background_loaded_cb, bd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1050,27 +1053,6 @@ row_activated (GtkListBox *box, GtkListBoxRow *row)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
set_accel (GtkApplication *app, GtkWidget *widget)
|
|
||||||
{
|
|
||||||
GtkWidget *accel_label;
|
|
||||||
const gchar *action;
|
|
||||||
gchar **accels;
|
|
||||||
guint key;
|
|
||||||
GdkModifierType mods;
|
|
||||||
|
|
||||||
accel_label = gtk_bin_get_child (GTK_BIN (widget));
|
|
||||||
g_assert (GTK_IS_ACCEL_LABEL (accel_label));
|
|
||||||
|
|
||||||
action = gtk_actionable_get_action_name (GTK_ACTIONABLE (widget));
|
|
||||||
accels = gtk_application_get_accels_for_action (app, action);
|
|
||||||
|
|
||||||
gtk_accelerator_parse (accels[0], &key, &mods);
|
|
||||||
gtk_accel_label_set_accel (GTK_ACCEL_LABEL (accel_label), key, mods);
|
|
||||||
|
|
||||||
g_strfreev (accels);
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GtkTextView tv;
|
GtkTextView tv;
|
||||||
@@ -1405,8 +1387,10 @@ text_view_add_to_context_menu (GtkTextView *text_view)
|
|||||||
item = g_menu_item_new (_("Underline"), "format.underline");
|
item = g_menu_item_new (_("Underline"), "format.underline");
|
||||||
g_menu_item_set_attribute (item, "touch-icon", "s", "format-text-underline-symbolic");
|
g_menu_item_set_attribute (item, "touch-icon", "s", "format-text-underline-symbolic");
|
||||||
g_menu_append_item (G_MENU (menu), item);
|
g_menu_append_item (G_MENU (menu), item);
|
||||||
|
g_object_unref (item);
|
||||||
|
|
||||||
gtk_text_view_set_extra_menu (text_view, G_MENU_MODEL (menu));
|
gtk_text_view_set_extra_menu (text_view, G_MENU_MODEL (menu));
|
||||||
|
g_object_unref (menu);
|
||||||
|
|
||||||
g_signal_connect (gtk_text_view_get_buffer (text_view), "changed", G_CALLBACK (text_changed), NULL);
|
g_signal_connect (gtk_text_view_get_buffer (text_view), "changed", G_CALLBACK (text_changed), NULL);
|
||||||
g_signal_connect (gtk_text_view_get_buffer (text_view), "mark-set", G_CALLBACK (text_changed), NULL);
|
g_signal_connect (gtk_text_view_get_buffer (text_view), "mark-set", G_CALLBACK (text_changed), NULL);
|
||||||
@@ -1601,14 +1585,14 @@ reset_icon_size (GtkWidget *iv)
|
|||||||
gtk_widget_queue_resize (iv);
|
gtk_widget_queue_resize (iv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static char *
|
||||||
scale_format_value_blank (GtkScale *scale, gdouble value)
|
scale_format_value_blank (GtkScale *scale, double value, gpointer user_data)
|
||||||
{
|
{
|
||||||
return g_strdup (" ");
|
return g_strdup (" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static char *
|
||||||
scale_format_value (GtkScale *scale, gdouble value)
|
scale_format_value (GtkScale *scale, double value, gpointer user_data)
|
||||||
{
|
{
|
||||||
return g_strdup_printf ("%0.*f", 1, value);
|
return g_strdup_printf ("%0.*f", 1, value);
|
||||||
}
|
}
|
||||||
@@ -1647,7 +1631,7 @@ set_up_context_popover (GtkWidget *widget,
|
|||||||
GtkWidget *popover = gtk_popover_menu_new_from_model (widget, model);
|
GtkWidget *popover = gtk_popover_menu_new_from_model (widget, model);
|
||||||
GtkGesture *gesture;
|
GtkGesture *gesture;
|
||||||
|
|
||||||
g_object_set (popover, "has-arrow", FALSE, NULL);
|
gtk_popover_set_has_arrow (GTK_POPOVER (popover), FALSE);
|
||||||
gesture = gtk_gesture_click_new ();
|
gesture = gtk_gesture_click_new ();
|
||||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||||
g_signal_connect (gesture, "pressed", G_CALLBACK (clicked_cb), popover);
|
g_signal_connect (gesture, "pressed", G_CALLBACK (clicked_cb), popover);
|
||||||
@@ -1658,6 +1642,7 @@ static void
|
|||||||
activate (GApplication *app)
|
activate (GApplication *app)
|
||||||
{
|
{
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
|
GtkBuilderScope *scope;
|
||||||
GtkWindow *window;
|
GtkWindow *window;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GtkWidget *widget2;
|
GtkWidget *widget2;
|
||||||
@@ -1707,26 +1692,28 @@ activate (GApplication *app)
|
|||||||
gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory4/widget-factory.css");
|
gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory4/widget-factory.css");
|
||||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
GTK_STYLE_PROVIDER (provider),
|
GTK_STYLE_PROVIDER (provider),
|
||||||
GTK_STYLE_PROVIDER_PRIORITY_USER);
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
g_object_unref (provider);
|
g_object_unref (provider);
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/org/gtk/WidgetFactory4/widget-factory.ui");
|
builder = gtk_builder_new ();
|
||||||
gtk_builder_add_callback_symbol (builder, "on_entry_icon_release", (GCallback)on_entry_icon_release);
|
scope = gtk_builder_cscope_new ();
|
||||||
gtk_builder_add_callback_symbol (builder, "on_scale_button_value_changed", (GCallback)on_scale_button_value_changed);
|
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
|
||||||
gtk_builder_add_callback_symbol (builder, "on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip);
|
"on_entry_icon_release", (GCallback)on_entry_icon_release,
|
||||||
gtk_builder_add_callback_symbol (builder, "on_record_button_toggled", (GCallback)on_record_button_toggled);
|
"on_scale_button_value_changed", (GCallback)on_scale_button_value_changed,
|
||||||
gtk_builder_add_callback_symbol (builder, "on_page_combo_changed", (GCallback)on_page_combo_changed);
|
"on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip,
|
||||||
gtk_builder_add_callback_symbol (builder, "on_range_from_changed", (GCallback)on_range_from_changed);
|
"on_record_button_toggled", (GCallback)on_record_button_toggled,
|
||||||
gtk_builder_add_callback_symbol (builder, "on_range_to_changed", (GCallback)on_range_to_changed);
|
"on_page_combo_changed", (GCallback)on_page_combo_changed,
|
||||||
gtk_builder_add_callback_symbol (builder, "tab_close_cb", (GCallback)tab_close_cb);
|
"on_range_from_changed", (GCallback)on_range_from_changed,
|
||||||
gtk_builder_add_callback_symbol (builder, "increase_icon_size", (GCallback)increase_icon_size);
|
"on_range_to_changed", (GCallback)on_range_to_changed,
|
||||||
gtk_builder_add_callback_symbol (builder, "decrease_icon_size", (GCallback)decrease_icon_size);
|
"tab_close_cb", (GCallback)tab_close_cb,
|
||||||
gtk_builder_add_callback_symbol (builder, "reset_icon_size", (GCallback)reset_icon_size);
|
"increase_icon_size", (GCallback)increase_icon_size,
|
||||||
gtk_builder_add_callback_symbol (builder, "scale_format_value", (GCallback)scale_format_value);
|
"decrease_icon_size", (GCallback)decrease_icon_size,
|
||||||
gtk_builder_add_callback_symbol (builder, "scale_format_value_blank", (GCallback)scale_format_value_blank);
|
"reset_icon_size", (GCallback)reset_icon_size,
|
||||||
gtk_builder_add_callback_symbol (builder, "osd_frame_pressed", (GCallback)osd_frame_pressed);
|
"osd_frame_pressed", (GCallback)osd_frame_pressed,
|
||||||
|
NULL);
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
gtk_builder_set_scope (builder, scope);
|
||||||
|
g_object_unref (scope);
|
||||||
|
gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", NULL);
|
||||||
|
|
||||||
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
|
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
|
||||||
gtk_application_add_window (GTK_APPLICATION (app), window);
|
gtk_application_add_window (GTK_APPLICATION (app), window);
|
||||||
@@ -1855,13 +1842,6 @@ activate (GApplication *app)
|
|||||||
g_object_set_data (G_OBJECT (widget2), "range_to_spin", widget3);
|
g_object_set_data (G_OBJECT (widget2), "range_to_spin", widget3);
|
||||||
g_object_set_data (G_OBJECT (widget), "print_button", widget4);
|
g_object_set_data (G_OBJECT (widget), "print_button", widget4);
|
||||||
|
|
||||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "quitmenuitem")));
|
|
||||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "deletemenuitem")));
|
|
||||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "searchmenuitem")));
|
|
||||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "darkmenuitem")));
|
|
||||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "aboutmenuitem")));
|
|
||||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "bgmenuitem")));
|
|
||||||
|
|
||||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "tooltextview");
|
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "tooltextview");
|
||||||
|
|
||||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbutton1");
|
widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbutton1");
|
||||||
@@ -1943,6 +1923,12 @@ activate (GApplication *app)
|
|||||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "extra_info_entry");
|
widget = (GtkWidget *)gtk_builder_get_object (builder, "extra_info_entry");
|
||||||
g_timeout_add (100, (GSourceFunc)pulse_it, widget);
|
g_timeout_add (100, (GSourceFunc)pulse_it, widget);
|
||||||
|
|
||||||
|
widget = (GtkWidget *)gtk_builder_get_object (builder, "scale3");
|
||||||
|
gtk_scale_set_format_value_func (GTK_SCALE (widget), scale_format_value, NULL, NULL);
|
||||||
|
|
||||||
|
widget = (GtkWidget *)gtk_builder_get_object (builder, "scale4");
|
||||||
|
gtk_scale_set_format_value_func (GTK_SCALE (widget), scale_format_value_blank, NULL, NULL);
|
||||||
|
|
||||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "box_for_context");
|
widget = (GtkWidget *)gtk_builder_get_object (builder, "box_for_context");
|
||||||
model = (GMenuModel *)gtk_builder_get_object (builder, "new_style_context_menu_model");
|
model = (GMenuModel *)gtk_builder_get_object (builder, "new_style_context_menu_model");
|
||||||
set_up_context_popover (widget, model);
|
set_up_context_popover (widget, model);
|
||||||
|
|||||||
@@ -598,10 +598,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
<property name="label" translatable="yes">checkbutton</property>
|
<property name="label" translatable="yes">checkbutton</property>
|
||||||
<property name="can-focus">1</property>
|
<property name="can-focus">1</property>
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<layout>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</layout>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -666,8 +662,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
<property name="can-focus">1</property>
|
<property name="can-focus">1</property>
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<layout>
|
<layout>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</layout>
|
</layout>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
@@ -740,7 +736,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="left-attach">2</property>
|
<property name="left-attach">2</property>
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</layout>
|
</layout>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
@@ -971,11 +966,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
<property name="adjustment">adjustment3</property>
|
<property name="adjustment">adjustment3</property>
|
||||||
<property name="restrict-to-fill-level">0</property>
|
<property name="restrict-to-fill-level">0</property>
|
||||||
<marks>
|
<marks>
|
||||||
<mark value="0" position="bottom"/>
|
<mark value="0" position="bottom"></mark>
|
||||||
<mark value="1" position="bottom"/>
|
<mark value="1" position="bottom"></mark>
|
||||||
<mark value="2" position="bottom"/>
|
<mark value="2" position="bottom"></mark>
|
||||||
<mark value="3" position="bottom"/>
|
<mark value="3" position="bottom"></mark>
|
||||||
<mark value="4" position="bottom"/>
|
<mark value="4" position="bottom"></mark>
|
||||||
</marks>
|
</marks>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
@@ -1019,7 +1014,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
<property name="fill-level">75</property>
|
<property name="fill-level">75</property>
|
||||||
<property name="digits">-1</property>
|
<property name="digits">-1</property>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<signal name="format-value" handler="scale_format_value"/>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -1033,7 +1027,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
<property name="fill-level">75</property>
|
<property name="fill-level">75</property>
|
||||||
<property name="digits">-1</property>
|
<property name="digits">-1</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<signal name="format-value" handler="scale_format_value_blank"/>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -1577,7 +1570,7 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<property name="icon-name">org.gtk.WidgetFactory4</property>
|
<property name="icon-name">org.gtk.WidgetFactory4</property>
|
||||||
<property name="pixel-size">256</property>
|
<property name="pixel-size">256</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="icon-dropshadow" />
|
<class name="icon-dropshadow"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
@@ -1728,15 +1721,11 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage">
|
<object class="GtkSpinButton">
|
||||||
<property name="icon-name">object-select-symbolic</property>
|
<property name="adjustment">adjustment1</property>
|
||||||
|
<property name="hexpand">1</property>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="margin-top">6</property>
|
|
||||||
<property name="margin-bottom">6</property>
|
|
||||||
<property name="margin-start">12</property>
|
|
||||||
<property name="margin-end">12</property>
|
|
||||||
<property name="opacity">0</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -1825,253 +1814,6 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<property name="menu-model">menu_bar_model</property>
|
<property name="menu-model">menu_bar_model</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkMenuBar">
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="menuitem1">
|
|
||||||
<property name="label" translatable="yes">File</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<child type="submenu">
|
|
||||||
<object class="GtkMenu" id="menu1">
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="menuitem101">
|
|
||||||
<property name="label" translatable="yes">_New</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="menuitem102">
|
|
||||||
<property name="label" translatable="yes">_Open</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="menuitem103">
|
|
||||||
<property name="label" translatable="yes">_Save</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="menuitem104">
|
|
||||||
<property name="label" translatable="yes">Save _As</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem1"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="quitmenuitem">
|
|
||||||
<property name="label" translatable="yes">_Quit</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="action-name">app.quit</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="menuitem2">
|
|
||||||
<property name="label" translatable="yes">Edit</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<child type="submenu">
|
|
||||||
<object class="GtkMenu" id="menu2">
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="menuitem106">
|
|
||||||
<property name="label" translatable="yes">Cu_t</property>
|
|
||||||
<property name="can-focus">1</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="menuitem107">
|
|
||||||
<property name="label" translatable="yes">_Copy</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="menuitem108">
|
|
||||||
<property name="label" translatable="yes">_Paste</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="deletemenuitem">
|
|
||||||
<property name="label" translatable="yes">_Delete</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="action-name">win.delete</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="searchmenuitem">
|
|
||||||
<property name="label" translatable="yes">_Search</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="action-name">win.search</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="togglesmenuitem">
|
|
||||||
<property name="label">Checks & Radios</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<child type="submenu">
|
|
||||||
<object class="GtkMenu" id="togglessubmenu">
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckMenuItem" id="checkmenuitem1">
|
|
||||||
<property name="label">_Check</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckMenuItem" id="checkmenuitem2">
|
|
||||||
<property name="label">_Check</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
<property name="sensitive">0</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckMenuItem" id="checkmenuitem3">
|
|
||||||
<property name="label">_Check</property>
|
|
||||||
<property name="inconsistent">1</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckMenuItem" id="checkmenuitem4">
|
|
||||||
<property name="label">_Check</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckMenuItem" id="checkmenuitem5">
|
|
||||||
<property name="label">_Check</property>
|
|
||||||
<property name="sensitive">0</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckMenuItem" id="checkmenuitem6">
|
|
||||||
<property name="label">_Check</property>
|
|
||||||
<property name="inconsistent">1</property>
|
|
||||||
<property name="sensitive">0</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkRadioMenuItem" id="radiomenuitem1">
|
|
||||||
<property name="label">_Radio</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkRadioMenuItem" id="radiomenuitem2">
|
|
||||||
<property name="label">_Radio</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
<property name="sensitive">0</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkRadioMenuItem" id="radiomenuitem3">
|
|
||||||
<property name="label">_Radio</property>
|
|
||||||
<property name="inconsistent">1</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkRadioMenuItem" id="radiomenuitem4">
|
|
||||||
<property name="label">_Radio</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkRadioMenuItem" id="radiomenuitem5">
|
|
||||||
<property name="label">_Radio</property>
|
|
||||||
<property name="sensitive">0</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkRadioMenuItem" id="radiomenuitem6">
|
|
||||||
<property name="label">_Radio</property>
|
|
||||||
<property name="inconsistent">1</property>
|
|
||||||
<property name="sensitive">0</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="menuitem3">
|
|
||||||
<property name="label" translatable="yes">View</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<child type="submenu">
|
|
||||||
<object class="GtkMenu" id="view-menu">
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckMenuItem" id="darkmenuitem">
|
|
||||||
<property name="label">_Dark theme</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="action-name">win.dark</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckMenuItem" id="toolbarmenuitem">
|
|
||||||
<property name="label">_Toolbar</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="action-name">win.toolbar</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckMenuItem" id="statusbarmenuitem">
|
|
||||||
<property name="label">_Statusbar</property>
|
|
||||||
<property name="active">1</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="action-name">win.statusbar</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="bgmenuitem">
|
|
||||||
<property name="label">_Select Background</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="action-name">win.background</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="menuitem4">
|
|
||||||
<property name="label" translatable="yes">Help</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<child type="submenu">
|
|
||||||
<object class="GtkMenu" id="menu3">
|
|
||||||
<child>
|
|
||||||
<object class="GtkMenuItem" id="aboutmenuitem">
|
|
||||||
<property name="label" translatable="yes">_About</property>
|
|
||||||
<property name="use-underline">1</property>
|
|
||||||
<property name="action-name">app.about</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToolbar" id="toolbar">
|
<object class="GtkToolbar" id="toolbar">
|
||||||
<child>
|
<child>
|
||||||
@@ -2120,7 +1862,7 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<object class="GtkInfoBar" id="infobar">
|
<object class="GtkInfoBar" id="infobar">
|
||||||
<property name="visible">0</property>
|
<property name="visible">0</property>
|
||||||
<property name="show-close-button">1</property>
|
<property name="show-close-button">1</property>
|
||||||
<child internal-child="content_area">
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
@@ -2131,9 +1873,11 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator"/>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow">
|
<object class="GtkScrolledWindow">
|
||||||
<property name="shadow-type">in</property>
|
|
||||||
<property name="vexpand">1</property>
|
<property name="vexpand">1</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="MyTextView" id="text3">
|
<object class="MyTextView" id="text3">
|
||||||
@@ -2147,6 +1891,9 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator"/>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStatusbar" id="statusbar"/>
|
<object class="GtkStatusbar" id="statusbar"/>
|
||||||
</child>
|
</child>
|
||||||
@@ -2437,11 +2184,9 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<property name="spacing">10</property>
|
<property name="spacing">10</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="halign">fill</property>
|
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="lockbox">
|
<object class="GtkBox" id="lockbox">
|
||||||
<property name="halign">fill</property>
|
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
@@ -2518,9 +2263,6 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<object class="GtkMenuButton">
|
<object class="GtkMenuButton">
|
||||||
<property name="icon-name">view-more-symbolic</property>
|
<property name="icon-name">view-more-symbolic</property>
|
||||||
<property name="popover">new_style_menu</property>
|
<property name="popover">new_style_menu</property>
|
||||||
<!--
|
|
||||||
<property name="menu-model">new_style_menu_model</property>
|
|
||||||
-->
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@@ -3355,10 +3097,6 @@ bad things might happen.</property>
|
|||||||
<accessibility>
|
<accessibility>
|
||||||
<relation type="label-for" target="open_popover_entry"/>
|
<relation type="label-for" target="open_popover_entry"/>
|
||||||
</accessibility>
|
</accessibility>
|
||||||
<layout>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</layout>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@@ -3370,7 +3108,6 @@ bad things might happen.</property>
|
|||||||
<relation type="label-for" target="open_popover_textview"/>
|
<relation type="label-for" target="open_popover_textview"/>
|
||||||
</accessibility>
|
</accessibility>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">1</property>
|
<property name="top-attach">1</property>
|
||||||
</layout>
|
</layout>
|
||||||
</object>
|
</object>
|
||||||
@@ -3405,7 +3142,6 @@ bad things might happen.</property>
|
|||||||
</accessibility>
|
</accessibility>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
<property name="top-attach">0</property>
|
|
||||||
<property name="column-span">2</property>
|
<property name="column-span">2</property>
|
||||||
</layout>
|
</layout>
|
||||||
</object>
|
</object>
|
||||||
@@ -3435,6 +3171,7 @@ bad things might happen.</property>
|
|||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="icon-name">emblem-system-symbolic</property>
|
<property name="icon-name">emblem-system-symbolic</property>
|
||||||
<property name="menu-model">gear_menu</property>
|
<property name="menu-model">gear_menu</property>
|
||||||
|
<property name="tooltip-text">This is a menu button</property>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
<property name="top-attach">3</property>
|
<property name="top-attach">3</property>
|
||||||
@@ -3443,7 +3180,6 @@ bad things might happen.</property>
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="open_popover_button">
|
<object class="GtkButton" id="open_popover_button">
|
||||||
<property name="halign">fill</property>
|
|
||||||
<property name="label">_Open</property>
|
<property name="label">_Open</property>
|
||||||
<property name="use-underline">1</property>
|
<property name="use-underline">1</property>
|
||||||
<property name="sensitive">0</property>
|
<property name="sensitive">0</property>
|
||||||
@@ -3492,7 +3228,7 @@ bad things might happen.</property>
|
|||||||
<property name="autohide">0</property>
|
<property name="autohide">0</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="label">You're in too deep!</property>
|
<property name="label">You're in too deep!</property>
|
||||||
<accessibility>
|
<accessibility>
|
||||||
<role type="static"/>
|
<role type="static"/>
|
||||||
</accessibility>
|
</accessibility>
|
||||||
@@ -3503,7 +3239,6 @@ bad things might happen.</property>
|
|||||||
<property name="autohide">0</property>
|
<property name="autohide">0</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="orientation">horizontal</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="label">Hidden gems:</property>
|
<property name="label">Hidden gems:</property>
|
||||||
@@ -3523,222 +3258,246 @@ bad things might happen.</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkPopoverMenu" id="new_style_menu">
|
<object class="GtkPopover" id="new_style_menu">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkStack">
|
||||||
<property name="name">main</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkStackPage">
|
||||||
<property name="halign">fill</property>
|
<property name="name">main</property>
|
||||||
<style>
|
<property name="child">
|
||||||
<class name="circular-buttons"/>
|
<object class="GtkBox">
|
||||||
</style>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkModelButton">
|
<object class="GtkBox">
|
||||||
<property name="icon"><object class="GThemedIcon"><property name="name">printer-symbolic</property></object></property>
|
<style>
|
||||||
<property name="iconic">1</property>
|
<class name="circular-buttons"/>
|
||||||
<property name="action-name">app.print</property>
|
</style>
|
||||||
<property name="hexpand">1</property>
|
<child>
|
||||||
<property name="halign">center</property>
|
<object class="GtkModelButton">
|
||||||
<style>
|
<property name="icon">
|
||||||
<class name="circular"/>
|
<object class="GThemedIcon">
|
||||||
</style>
|
<property name="name">printer-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
<property name="iconic">1</property>
|
||||||
|
<property name="action-name">app.print</property>
|
||||||
|
<property name="hexpand">1</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<style>
|
||||||
|
<class name="circular"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="icon">
|
||||||
|
<object class="GThemedIcon">
|
||||||
|
<property name="name">emblem-shared-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
<property name="iconic">1</property>
|
||||||
|
<property name="action-name">app.share</property>
|
||||||
|
<property name="hexpand">1</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<style>
|
||||||
|
<class name="circular"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator"/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Open in New Window</property>
|
||||||
|
<property name="action-name">app.open-in</property>
|
||||||
|
<property name="indicator-size-group">main-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator"/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<style>
|
||||||
|
<class name="inline-buttons"/>
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="cut_copy_paste_filler"/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label">Edit</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="hexpand">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="icon">
|
||||||
|
<object class="GThemedIcon">
|
||||||
|
<property name="name">edit-cut-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
<property name="iconic">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="icon">
|
||||||
|
<object class="GThemedIcon">
|
||||||
|
<property name="name">edit-copy-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
<property name="iconic">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="icon">
|
||||||
|
<object class="GThemedIcon">
|
||||||
|
<property name="name">edit-paste-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
<property name="iconic">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator"/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Pin</property>
|
||||||
|
<property name="action-name">app.pin</property>
|
||||||
|
<property name="indicator-size-group">main-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Select Labels…</property>
|
||||||
|
<property name="action-name">app.labels</property>
|
||||||
|
<property name="indicator-size-group">main-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Share…</property>
|
||||||
|
<property name="action-name">app.share</property>
|
||||||
|
<property name="indicator-size-group">main-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator"/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Basement</property>
|
||||||
|
<property name="menu-name">basement</property>
|
||||||
|
<property name="indicator-size-group">main-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator"/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Large</property>
|
||||||
|
<property name="action-name">app.size</property>
|
||||||
|
<property name="action-target">'large'</property>
|
||||||
|
<property name="indicator-size-group">main-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Medium</property>
|
||||||
|
<property name="action-name">app.size</property>
|
||||||
|
<property name="action-target">'medium'</property>
|
||||||
|
<property name="indicator-size-group">main-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Small</property>
|
||||||
|
<property name="action-name">app.size</property>
|
||||||
|
<property name="action-target">'small'</property>
|
||||||
|
<property name="indicator-size-group">main-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator"/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Move to Trash</property>
|
||||||
|
<property name="action-name">win.delete</property>
|
||||||
|
<property name="indicator-size-group">main-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
<child>
|
</object>
|
||||||
<object class="GtkModelButton">
|
</child>
|
||||||
<property name="icon"><object class="GThemedIcon"><property name="name">emblem-shared-symbolic</property></object></property>
|
<child>
|
||||||
<property name="iconic">1</property>
|
<object class="GtkStackPage">
|
||||||
<property name="action-name">app.share</property>
|
<property name="name">basement</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="child">
|
||||||
<property name="halign">center</property>
|
<object class="GtkBox">
|
||||||
<style>
|
<property name="orientation">vertical</property>
|
||||||
<class name="circular"/>
|
<child>
|
||||||
</style>
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Basement</property>
|
||||||
|
<property name="role">title</property>
|
||||||
|
<property name="menu-name">main</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator"/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Berk</property>
|
||||||
|
<property name="action-name">app.berk</property>
|
||||||
|
<property name="indicator-size-group">basement-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Broni</property>
|
||||||
|
<property name="action-name">app.broni</property>
|
||||||
|
<property name="indicator-size-group">basement-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">Drutt</property>
|
||||||
|
<property name="action-name">app.drutt</property>
|
||||||
|
<property name="indicator-size-group">basement-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkModelButton">
|
||||||
|
<property name="text">The Thing Upstairs</property>
|
||||||
|
<property name="action-name">app.upstairs</property>
|
||||||
|
<property name="indicator-size-group">basement-indicators</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSeparator"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Open in New Window</property>
|
|
||||||
<property name="action-name">app.open-in</property>
|
|
||||||
<property name="indicator-size-group">main-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSeparator"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox">
|
|
||||||
<style>
|
|
||||||
<class name="inline-buttons"/>
|
|
||||||
</style>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="cut_copy_paste_filler">
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="label">Edit</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="hexpand">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="icon"><object class="GThemedIcon"><property name="name">edit-cut-symbolic</property></object></property>
|
|
||||||
<property name="iconic">1</property>
|
|
||||||
<property name="relief">none</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="icon"><object class="GThemedIcon"><property name="name">edit-copy-symbolic</property></object></property>
|
|
||||||
<property name="iconic">1</property>
|
|
||||||
<property name="relief">none</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="icon"><object class="GThemedIcon"><property name="name">edit-paste-symbolic</property></object></property>
|
|
||||||
<property name="iconic">1</property>
|
|
||||||
<property name="relief">none</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSeparator"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Pin</property>
|
|
||||||
<property name="action-name">app.pin</property>
|
|
||||||
<property name="indicator-size-group">main-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Select Labels…</property>
|
|
||||||
<property name="action-name">app.labels</property>
|
|
||||||
<property name="indicator-size-group">main-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Share…</property>
|
|
||||||
<property name="action-name">app.share</property>
|
|
||||||
<property name="indicator-size-group">main-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSeparator"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Basement</property>
|
|
||||||
<property name="menu-name">basement</property>
|
|
||||||
<property name="indicator-size-group">main-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSeparator"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Large</property>
|
|
||||||
<property name="action-name">app.size</property>
|
|
||||||
<property name="action-target">'large'</property>
|
|
||||||
<property name="indicator-size-group">main-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Medium</property>
|
|
||||||
<property name="action-name">app.size</property>
|
|
||||||
<property name="action-target">'medium'</property>
|
|
||||||
<property name="indicator-size-group">main-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Small</property>
|
|
||||||
<property name="action-name">app.size</property>
|
|
||||||
<property name="action-target">'small'</property>
|
|
||||||
<property name="indicator-size-group">main-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSeparator"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Move to Trash</property>
|
|
||||||
<property name="action-name">win.delete</property>
|
|
||||||
<property name="indicator-size-group">main-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox">
|
|
||||||
<property name="name">basement</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Basement</property>
|
|
||||||
<property name="role">title</property>
|
|
||||||
<property name="menu-name">main</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSeparator"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Berk</property>
|
|
||||||
<property name="action-name">app.berk</property>
|
|
||||||
<property name="indicator-size-group">basement-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Broni</property>
|
|
||||||
<property name="action-name">app.broni</property>
|
|
||||||
<property name="indicator-size-group">basement-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">Drutt</property>
|
|
||||||
<property name="action-name">app.drutt</property>
|
|
||||||
<property name="indicator-size-group">basement-indicators</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton">
|
|
||||||
<property name="text">The Thing Upstairs</property>
|
|
||||||
<property name="action-name">app.upstairs</property>
|
|
||||||
<property name="indicator-size-group">basement-indicators</property>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkSizeGroup" id="main-indicators">
|
<object class="GtkSizeGroup" id="main-indicators">
|
||||||
<property name="mode">horizontal</property>
|
|
||||||
<widgets>
|
<widgets>
|
||||||
<widget name="cut_copy_paste_filler"/>
|
<widget name="cut_copy_paste_filler"/>
|
||||||
</widgets>
|
</widgets>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkSizeGroup" id="basement-indicators">
|
<object class="GtkSizeGroup" id="basement-indicators"/>
|
||||||
<property name="mode">horizontal</property>
|
|
||||||
</object>
|
|
||||||
<menu id="new_style_menu_model">
|
<menu id="new_style_menu_model">
|
||||||
<section>
|
<section>
|
||||||
<attribute name="display-hint">circular-buttons</attribute>
|
<attribute name="display-hint">circular-buttons</attribute>
|
||||||
@@ -3828,10 +3587,10 @@ bad things might happen.</property>
|
|||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Move to Trash</attribute>
|
<attribute name="label" translatable="yes">Move to Trash</attribute>
|
||||||
<attribute name="action">win.delete</attribute>
|
<attribute name="action">win.delete</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
</menu>
|
</menu>
|
||||||
<menu id="new_style_context_menu_model">
|
<menu id="new_style_context_menu_model">
|
||||||
@@ -3945,7 +3704,7 @@ bad things might happen.</property>
|
|||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<submenu>
|
<submenu>
|
||||||
<attribute name="label" translatable="yes">Checks & Radios</attribute>
|
<attribute name="label" translatable="yes">C_hecks</attribute>
|
||||||
<section>
|
<section>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Check</attribute>
|
<attribute name="label" translatable="yes">Check</attribute>
|
||||||
@@ -3969,6 +3728,9 @@ bad things might happen.</property>
|
|||||||
<attribute name="hidden-when">action-missing</attribute>
|
<attribute name="hidden-when">action-missing</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
|
</submenu>
|
||||||
|
<submenu>
|
||||||
|
<attribute name="label" translatable="yes">_Radios</attribute>
|
||||||
<section>
|
<section>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Radio</attribute>
|
<attribute name="label" translatable="yes">Radio</attribute>
|
||||||
@@ -4019,14 +3781,13 @@ bad things might happen.</property>
|
|||||||
<attribute name="action">win.background</attribute>
|
<attribute name="action">win.background</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</submenu>
|
</submenu>
|
||||||
<submenu>
|
<submenu>
|
||||||
<attribute name="label" translatable="yes">_Help</attribute>
|
<attribute name="label" translatable="yes">_Help</attribute>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">About</attribute>
|
<attribute name="label" translatable="yes">About</attribute>
|
||||||
<attribute name="action">app.about</attribute>
|
<attribute name="action">app.about</attribute>
|
||||||
</item>
|
</item>
|
||||||
</submenu>
|
</submenu>
|
||||||
</menu>
|
</menu>
|
||||||
</interface>
|
</interface>
|
||||||
|
|||||||
@@ -192,8 +192,8 @@ gdk_surface_is_destroyed
|
|||||||
gdk_surface_is_visible
|
gdk_surface_is_visible
|
||||||
gdk_surface_is_viewable
|
gdk_surface_is_viewable
|
||||||
gdk_surface_get_state
|
gdk_surface_get_state
|
||||||
gdk_surface_iconify
|
gdk_surface_minimize
|
||||||
gdk_surface_deiconify
|
gdk_surface_unminimize
|
||||||
gdk_surface_stick
|
gdk_surface_stick
|
||||||
gdk_surface_unstick
|
gdk_surface_unstick
|
||||||
gdk_surface_maximize
|
gdk_surface_maximize
|
||||||
@@ -544,8 +544,6 @@ GdkSeatCapabilities
|
|||||||
GdkGrabStatus
|
GdkGrabStatus
|
||||||
GdkSeatGrabPrepareFunc
|
GdkSeatGrabPrepareFunc
|
||||||
gdk_seat_get_display
|
gdk_seat_get_display
|
||||||
gdk_seat_grab
|
|
||||||
gdk_seat_ungrab
|
|
||||||
gdk_seat_get_capabilities
|
gdk_seat_get_capabilities
|
||||||
gdk_seat_get_pointer
|
gdk_seat_get_pointer
|
||||||
gdk_seat_get_keyboard
|
gdk_seat_get_keyboard
|
||||||
@@ -789,8 +787,6 @@ gdk_drop_get_type
|
|||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<INCLUDE>gdk/gdkx.h</INCLUDE>
|
|
||||||
<TITLE>X Window System Interaction</TITLE>
|
|
||||||
<FILE>x_interaction</FILE>
|
<FILE>x_interaction</FILE>
|
||||||
GDK_SURFACE_XID
|
GDK_SURFACE_XID
|
||||||
GDK_DISPLAY_XDISPLAY
|
GDK_DISPLAY_XDISPLAY
|
||||||
@@ -941,8 +937,6 @@ gdk_surface_impl_x11_get_type
|
|||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<INCLUDE>gdk/gdkwayland.h</INCLUDE>
|
|
||||||
<TITLE>Wayland Interaction</TITLE>
|
|
||||||
<FILE>wayland_interaction</FILE>
|
<FILE>wayland_interaction</FILE>
|
||||||
gdk_wayland_seat_get_wl_seat
|
gdk_wayland_seat_get_wl_seat
|
||||||
gdk_wayland_device_get_wl_keyboard
|
gdk_wayland_device_get_wl_keyboard
|
||||||
@@ -1128,6 +1122,7 @@ gdk_monitor_get_width_mm
|
|||||||
gdk_monitor_get_height_mm
|
gdk_monitor_get_height_mm
|
||||||
gdk_monitor_get_manufacturer
|
gdk_monitor_get_manufacturer
|
||||||
gdk_monitor_get_model
|
gdk_monitor_get_model
|
||||||
|
gdk_monitor_get_connector
|
||||||
gdk_monitor_get_scale_factor
|
gdk_monitor_get_scale_factor
|
||||||
gdk_monitor_get_refresh_rate
|
gdk_monitor_get_refresh_rate
|
||||||
GdkSubpixelLayout
|
GdkSubpixelLayout
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ if wayland_enabled
|
|||||||
src_dir += [ gdkwayland_inc ]
|
src_dir += [ gdkwayland_inc ]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('documentation')
|
if get_option('gtk_doc')
|
||||||
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
|
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
|
||||||
|
|
||||||
gnome.gtkdoc('gdk4',
|
gnome.gtkdoc('gdk4',
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ GskRenderNodeType
|
|||||||
gsk_render_node_get_node_type
|
gsk_render_node_get_node_type
|
||||||
gsk_render_node_draw
|
gsk_render_node_draw
|
||||||
GskSerializationError
|
GskSerializationError
|
||||||
|
GskParseErrorFunc
|
||||||
gsk_render_node_serialize
|
gsk_render_node_serialize
|
||||||
gsk_render_node_deserialize
|
gsk_render_node_deserialize
|
||||||
gsk_render_node_write_to_file
|
gsk_render_node_write_to_file
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ private_headers = [
|
|||||||
images = [
|
images = [
|
||||||
]
|
]
|
||||||
|
|
||||||
if get_option('documentation')
|
if get_option('gtk_doc')
|
||||||
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
|
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
|
||||||
|
|
||||||
gnome.gtkdoc('gsk4',
|
gnome.gtkdoc('gsk4',
|
||||||
|
|||||||
@@ -258,9 +258,11 @@
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Actions are added to their relevant scope (application or
|
Actions are added to their relevant scope (application,
|
||||||
window) either using the GActionMap interface, or by using
|
window or widget) either using the GActionMap interface,
|
||||||
gtk_widget_insert_action_group().
|
or by using gtk_widget_insert_action_group(). Actions that
|
||||||
|
will be the same for all instances of a widget class can
|
||||||
|
be added globally using gtk_widget_class_install_action().
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
</refsect2>
|
</refsect2>
|
||||||
@@ -312,13 +314,13 @@
|
|||||||
be connected to an action just by setting the ::action-name
|
be connected to an action just by setting the ::action-name
|
||||||
property. If the action has a parameter, you will also need
|
property. If the action has a parameter, you will also need
|
||||||
to set the ::action-target property.
|
to set the ::action-target property.
|
||||||
Widgets that implement GtkAction include GtkSwitch, GtkButton,
|
Widgets that implement GtkActionable include GtkSwitch, GtkButton,
|
||||||
GtkMenuItem and their respective subclasses.
|
and their respective subclasses.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Another of obtaining widgets that are connected to actions is
|
Another way of obtaining widgets that are connected to actions
|
||||||
to create a menu using a GMenu menu model. GMenu provides an
|
is to create a menu using a GMenu menu model. GMenu provides an
|
||||||
abstract way to describe typical menus: nested groups of items
|
abstract way to describe typical menus: nested groups of items
|
||||||
where each item can have a label, and icon, and an action.
|
where each item can have a label, and icon, and an action.
|
||||||
</para>
|
</para>
|
||||||
@@ -364,6 +366,25 @@
|
|||||||
(typically a GtkWindow, GtkDialog or GtkPopover)
|
(typically a GtkWindow, GtkDialog or GtkPopover)
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>clipboard.cut, clipboard.copy, clipboard.paste</term>
|
||||||
|
<listitem><para>Clipboard operations on entries, text view
|
||||||
|
and labels, typically used in the context menu
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>selection.delete, selection.select-all</term>
|
||||||
|
<listitem><para>Selection operations on entries, text view
|
||||||
|
and labels
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>color.select, color.customize</term>
|
||||||
|
<listitem><para>Operations on colors in GtkColorChooserWidget.
|
||||||
|
These actions are unusual in that they have the non-trivial
|
||||||
|
parameter type (dddd).
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|||||||
@@ -76,10 +76,10 @@ How to compile GTK itself
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Several environment variables are useful to pass to set before
|
Several environment variables are useful to pass to set before
|
||||||
running configure. <envar>CPPFLAGS</envar> contains options to
|
running <application>meson</application>. <envar>CPPFLAGS</envar>
|
||||||
pass to the C compiler, and is used to tell the compiler where
|
contains options to pass to the C compiler, and is used to tell
|
||||||
to look for include files. The <envar>LDFLAGS</envar> variable
|
the compiler where to look for include files. The <envar>LDFLAGS</envar>
|
||||||
is used in a similar fashion for the linker. Finally the
|
variable is used in a similar fashion for the linker. Finally the
|
||||||
<envar>PKG_CONFIG_PATH</envar> environment variable contains
|
<envar>PKG_CONFIG_PATH</envar> environment variable contains
|
||||||
a search path that <command>pkg-config</command> (see below)
|
a search path that <command>pkg-config</command> (see below)
|
||||||
uses when looking for files describing how to compile
|
uses when looking for files describing how to compile
|
||||||
@@ -106,6 +106,61 @@ How to compile GTK itself
|
|||||||
export LD_LIBRARY_PATH PATH
|
export LD_LIBRARY_PATH PATH
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 id="build-types">
|
||||||
|
<title>Build types</title>
|
||||||
|
|
||||||
|
<para>Meson has different build types, exposed by the <literal>buildtype</literal>
|
||||||
|
configuration option. GTK enables and disables functionality depending on
|
||||||
|
the build type used when calling <application>meson</application> to
|
||||||
|
configure the build.</para>
|
||||||
|
|
||||||
|
<formalpara>
|
||||||
|
<title><systemitem>debug</systemitem> and <systemitem>debugoptimized</systemitem></title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
GTK will enable debugging code paths in both the
|
||||||
|
<literal>debug</literal> and <literal>debugoptimized</literal>
|
||||||
|
build types. Builds with <literal>buildtype</literal> set
|
||||||
|
to <literal>debug</literal> will additionally enable
|
||||||
|
consistency checks on the internal state of the toolkit.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
It is recommended to use the <literal>debug</literal> or
|
||||||
|
<literal>debugoptimized</literal> build types when developing
|
||||||
|
GTK itself. Additionally, <literal>debug</literal> builds of
|
||||||
|
GTK are recommended for profiling and debugging GTK applications,
|
||||||
|
as they include additional validation of the internal state.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The <literal>debugoptimized</literal> build type is the
|
||||||
|
default for GTK if no build type is specified when calling
|
||||||
|
<application>meson</application>
|
||||||
|
</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<formalpara>
|
||||||
|
<title><systemitem>release</systemitem></title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The <literal>release</literal> build type will disable
|
||||||
|
debugging code paths and additional run time safeties, like
|
||||||
|
checked casts for object instances.
|
||||||
|
</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The <literal>plain</literal> build type provided by Meson
|
||||||
|
should only be used when packaging GTK, and it's expected
|
||||||
|
that packagers will provide their own compiler flags when
|
||||||
|
building GTK. See the previous section for the list of
|
||||||
|
environment variables to be used to define compiler and
|
||||||
|
linker flags.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
<refsect1 id="dependencies">
|
<refsect1 id="dependencies">
|
||||||
<title>Dependencies</title>
|
<title>Dependencies</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -283,184 +338,181 @@ How to compile GTK itself
|
|||||||
See <xref linkend="gtk-resources"/> for more information.
|
See <xref linkend="gtk-resources"/> for more information.
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
<refsect1 id="extra-configuration-options">
|
|
||||||
<title>Extra Configuration Options</title>
|
<refsect1 id="extra-configuration-options">
|
||||||
|
<title>Extra Configuration Options</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
In addition to the normal options provided by Meson, GTK defines
|
||||||
|
various arguments that modify what should be built.
|
||||||
|
|
||||||
|
<cmdsynopsis>
|
||||||
|
<command>meson</command>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dx11-backend=true</arg>
|
||||||
|
<arg choice="plain">-Dx11-backend=false</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dwayland-backend=true</arg>
|
||||||
|
<arg choice="plain">-Dwayland-backend=false</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dbroadway-backend=true</arg>
|
||||||
|
<arg choice="plain">-Dbroadway-backend=false</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dwin32-backend=true</arg>
|
||||||
|
<arg choice="plain">-Dwin32-backend=false</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dquartz-backend=true</arg>
|
||||||
|
<arg choice="plain">-Dquartz-backend=false</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dmedia=gstreamer</arg>
|
||||||
|
<arg choice="plain">-Dmedia=ffmpeg</arg>
|
||||||
|
<arg choice="plain">-Dmedia=all</arg>
|
||||||
|
<arg choice="plain">-Dmedia=none</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dvulkan=yes</arg>
|
||||||
|
<arg choice="plain">-Dvulkan=no</arg>
|
||||||
|
<arg choice="plain">-Dvulkan=auto</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dxinerama=yes</arg>
|
||||||
|
<arg choice="plain">-Dxinerama=no</arg>
|
||||||
|
<arg choice="plain">-Dxinerama=auto</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dcloudproviders=true</arg>
|
||||||
|
<arg choice="plain">-Dcloudproviders=false</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dprint-backends=all</arg>
|
||||||
|
<arg choice="plain">-Dprint-backends=none</arg>
|
||||||
|
<arg choice="plain">-Dprint-backends=cups,lpr,...</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dcolord=yes</arg>
|
||||||
|
<arg choice="plain">-Dcolord=no</arg>
|
||||||
|
<arg choice="plain">-Dcolord=auto</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dgtk_doc=true</arg>
|
||||||
|
<arg choice="plain">-Dgtk_doc=false</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dman-pages=true</arg>
|
||||||
|
<arg choice="plain">-Dman-pages=false</arg>
|
||||||
|
</group>
|
||||||
|
<sbr/>
|
||||||
|
<group>
|
||||||
|
<arg choice="plain">-Dintrospection=true</arg>
|
||||||
|
<arg choice="plain">-Dintrospection=false</arg>
|
||||||
|
</group>
|
||||||
|
</cmdsynopsis>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<formalpara>
|
||||||
|
<title><systemitem>xinerama</systemitem></title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
In addition to the normal options provided by Meson, GTK defines
|
By default GTK will try to link against the Xinerama libraries
|
||||||
various arguments that modify what should be built.
|
if they are found. This options can be used to explicitly control
|
||||||
|
whether Xinerama should be used.
|
||||||
<cmdsynopsis>
|
|
||||||
<command>meson</command>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dx11-backend=true</arg>
|
|
||||||
<arg choice="plain">-Dx11-backend=false</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dwayland-backend=true</arg>
|
|
||||||
<arg choice="plain">-Dwayland-backend=false</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dbroadway-backend=true</arg>
|
|
||||||
<arg choice="plain">-Dbroadway-backend=false</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dwin32-backend=true</arg>
|
|
||||||
<arg choice="plain">-Dwin32-backend=false</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dquartz-backend=true</arg>
|
|
||||||
<arg choice="plain">-Dquartz-backend=false</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dmedia=gstreamer</arg>
|
|
||||||
<arg choice="plain">-Dmedia=ffmpeg</arg>
|
|
||||||
<arg choice="plain">-Dmedia=all</arg>
|
|
||||||
<arg choice="plain">-Dmedia=none</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dvulkan=yes</arg>
|
|
||||||
<arg choice="plain">-Dvulkan=no</arg>
|
|
||||||
<arg choice="plain">-Dvulkan=auto</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dxinerama=yes</arg>
|
|
||||||
<arg choice="plain">-Dxinerama=no</arg>
|
|
||||||
<arg choice="plain">-Dxinerama=auto</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dcloudproviders=true</arg>
|
|
||||||
<arg choice="plain">-Dcloudproviders=false</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dprint-backends=all</arg>
|
|
||||||
<arg choice="plain">-Dprint-backends=none</arg>
|
|
||||||
<arg choice="plain">-Dprint-backends=cups,lpr,...</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dcolord=yes</arg>
|
|
||||||
<arg choice="plain">-Dcolord=no</arg>
|
|
||||||
<arg choice="plain">-Dcolord=auto</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Ddocumentation=true</arg>
|
|
||||||
<arg choice="plain">-Ddocumentation=false</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dman-pages=true</arg>
|
|
||||||
<arg choice="plain">-Dman-pages=false</arg>
|
|
||||||
</group>
|
|
||||||
<sbr/>
|
|
||||||
<group>
|
|
||||||
<arg choice="plain">-Dintrospection=true</arg>
|
|
||||||
<arg choice="plain">-Dintrospection=false</arg>
|
|
||||||
</group>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</para>
|
</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
<formalpara>
|
<formalpara>
|
||||||
<title><systemitem>xinerama</systemitem></title>
|
<title><systemitem>gtk_doc</systemitem> and
|
||||||
|
<systemitem>man-pages</systemitem></title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
By default GTK will try to link against the Xinerama libraries
|
The <application>gtk-doc</application> package is
|
||||||
if they are found. This options can be used to explicitly control
|
used to generate the reference documentation included
|
||||||
whether Xinerama should be used.
|
with GTK. By default support for <application>gtk-doc</application>
|
||||||
</para>
|
is disabled because it requires various extra dependencies
|
||||||
</formalpara>
|
to be installed. If you have
|
||||||
|
<application>gtk-doc</application> installed and
|
||||||
|
are modifying GTK, you may want to enable
|
||||||
|
<application>gtk-doc</application> support by passing
|
||||||
|
in <systemitem>gtk_doc</systemitem>.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Additionally, some tools provided by GTK have their own
|
||||||
|
manual pages generated using a similar set of dependencies;
|
||||||
|
if you have <application>xsltproc</application> then you
|
||||||
|
can generate manual pages by passing <systemitem>man-pages</systemitem>
|
||||||
|
when configuring the build.
|
||||||
|
</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
<formalpara>
|
<formalpara>
|
||||||
<title><systemitem>documentation</systemitem> and
|
<title><systemitem>print-backends</systemitem></title>
|
||||||
<systemitem>man-pages</systemitem></title>
|
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The <application>gtk-doc</application> package is
|
By default, GTK will try to build various print backends if
|
||||||
used to generate the reference documentation included
|
their dependencies are found. This option can be used to
|
||||||
with GTK. By default support for <application>gtk-doc</application>
|
explicitly control which print backends should be built.
|
||||||
is disabled because it requires various extra dependencies
|
</para>
|
||||||
to be installed. If you have
|
</formalpara>
|
||||||
<application>gtk-doc</application> installed and
|
|
||||||
are modifying GTK, you may want to enable
|
|
||||||
<application>gtk-doc</application> support by passing
|
|
||||||
in <systemitem>documentation</systemitem>.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Additionally, some tools provided by GTK have their own
|
|
||||||
manual pages generated using a similar set of dependencies;
|
|
||||||
if you have <application>xsltproc</application> then you
|
|
||||||
can generate manual pages by passing <systemitem>man-pages</systemitem>
|
|
||||||
when configuring the build.
|
|
||||||
</para>
|
|
||||||
</formalpara>
|
|
||||||
|
|
||||||
<formalpara>
|
<formalpara>
|
||||||
<title><systemitem>print-backends</systemitem></title>
|
<title><systemitem>x11-backend</systemitem>,
|
||||||
|
<systemitem>win32-backend</systemitem>,
|
||||||
|
<systemitem>quartz-backend</systemitem>,
|
||||||
|
<systemitem>broadway-backend</systemitem> and
|
||||||
|
<systemitem>wayland-backend</systemitem></title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
By default, GTK will try to build various print backends if
|
Enable specific backends for GDK. If none of these options
|
||||||
their dependencies are found. This option can be used to
|
are given, the Wayland backend will be enabled by default,
|
||||||
explicitly control which print backends should be built.
|
if the platform is Linux; the X11 backend will also be enabled
|
||||||
</para>
|
by default, unless the platform is Windows, in which case the
|
||||||
</formalpara>
|
default is win32, or the platform is macOS, in which case the
|
||||||
|
default is quartz. If any backend is explicitly enabled or disabled,
|
||||||
|
no other platform will be enabled automatically.
|
||||||
|
</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
<formalpara>
|
<formalpara>
|
||||||
<title><systemitem>x11-backend</systemitem>,
|
<title><systemitem>introspection</systemitem></title>
|
||||||
<systemitem>win32-backend</systemitem>,
|
|
||||||
<systemitem>quartz-backend</systemitem>,
|
|
||||||
<systemitem>broadway-backend</systemitem> and
|
|
||||||
<systemitem>wayland-backend</systemitem></title>
|
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Enable specific backends for GDK. If none of these options
|
Allows to disable building introspection support. This is option
|
||||||
are given, the Wayland backend will be enabled by default,
|
is mainly useful for shortening turnaround times on developer
|
||||||
if the platform is Linux; the X11 backend will also be enabled
|
systems. Installed builds of GTK should always have introspection
|
||||||
by default, unless the platform is Windows, in which case the
|
support.
|
||||||
default is win32, or the platform is macOS, in which case the
|
</para>
|
||||||
default is quartz. If any backend is explicitly enabled or disabled,
|
</formalpara>
|
||||||
no other platform will be enabled automatically.
|
|
||||||
</para>
|
|
||||||
</formalpara>
|
|
||||||
|
|
||||||
<formalpara>
|
<formalpara>
|
||||||
<title><systemitem>introspection</systemitem></title>
|
<title><systemitem>build-tests</systemitem>,
|
||||||
|
<systemitem>install-tests</systemitem>,
|
||||||
|
<systemitem>demos</systemitem></title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Allows to disable building introspection support. This is option
|
By default, GTK will build quite a few tests and demos.
|
||||||
is mainly useful for shortening turnaround times on developer
|
While these are useful on a developer system, they are not
|
||||||
systems. Installed builds of GTK should always have introspection
|
needed when GTK is built e.g. for a flatpak runtime. These
|
||||||
support.
|
options allow to disable building tests and demos.
|
||||||
</para>
|
</para>
|
||||||
</formalpara>
|
</formalpara>
|
||||||
|
|
||||||
<formalpara>
|
</refsect1>
|
||||||
<title><systemitem>build-tests</systemitem>,
|
|
||||||
<systemitem>install-tests</systemitem>,
|
|
||||||
<systemitem>demos</systemitem></title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
By default, GTK will build quite a few tests and demos.
|
|
||||||
While these are useful on a developer system, they are not
|
|
||||||
needed when GTK is built e.g. for a flatpak runtime. These
|
|
||||||
options allow to disable building tests and demos.
|
|
||||||
</para>
|
|
||||||
</formalpara>
|
|
||||||
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
</refentry>
|
</refentry>
|
||||||
|
|
||||||
<!-- Local Variables: -->
|
|
||||||
<!-- sgml-parent-document: ("gtk-docs.sgml" "chapter" "refentry") -->
|
|
||||||
<!-- End: -->
|
|
||||||
@@ -224,10 +224,3 @@
|
|||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
</refentry>
|
</refentry>
|
||||||
|
|
||||||
<!--
|
|
||||||
Local variables:
|
|
||||||
mode: xml
|
|
||||||
sgml-parent-document: ("gtk-docs.sgml" "book" "part" "refentry")
|
|
||||||
End:
|
|
||||||
-->
|
|
||||||
|
|||||||
@@ -364,10 +364,3 @@
|
|||||||
</glossdef>
|
</glossdef>
|
||||||
</glossentry>
|
</glossentry>
|
||||||
</glossary>
|
</glossary>
|
||||||
|
|
||||||
<!--
|
|
||||||
Local variables:
|
|
||||||
mode: sgml
|
|
||||||
sgml-parent-document: ("gtk-docs.sgml" "book" "glossary")
|
|
||||||
End:
|
|
||||||
-->
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
<title>GTK Overview</title>
|
<title>GTK Overview</title>
|
||||||
<xi:include href="overview.xml"/>
|
<xi:include href="overview.xml"/>
|
||||||
<xi:include href="xml/getting_started.xml"/>
|
<xi:include href="xml/getting_started.xml"/>
|
||||||
<xi:include href="resources.sgml" />
|
<xi:include href="resources.xml" />
|
||||||
<xi:include href="xml/question_index.sgml" />
|
<xi:include href="xml/question_index.xml" />
|
||||||
<xi:include href="xml/drawing-model.xml" />
|
<xi:include href="xml/drawing-model.xml" />
|
||||||
<xi:include href="xml/input-handling.xml" />
|
<xi:include href="xml/input-handling.xml" />
|
||||||
<xi:include href="xml/actions.xml" />
|
<xi:include href="xml/actions.xml" />
|
||||||
@@ -49,11 +49,16 @@
|
|||||||
<xi:include href="xml/gtkmaplistmodel.xml" />
|
<xi:include href="xml/gtkmaplistmodel.xml" />
|
||||||
<xi:include href="xml/gtkslicelistmodel.xml" />
|
<xi:include href="xml/gtkslicelistmodel.xml" />
|
||||||
<xi:include href="xml/gtksortlistmodel.xml" />
|
<xi:include href="xml/gtksortlistmodel.xml" />
|
||||||
<xi:include href="xml/gtktreelistmodel.xml" />
|
|
||||||
<xi:include href="xml/gtkselectionmodel.xml" />
|
<xi:include href="xml/gtkselectionmodel.xml" />
|
||||||
|
<xi:include href="xml/gtknoselection.xml" />
|
||||||
<xi:include href="xml/gtksingleselection.xml" />
|
<xi:include href="xml/gtksingleselection.xml" />
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="Trees">
|
||||||
|
<xi:include href="xml/gtktreelistrow.xml" />
|
||||||
|
<xi:include href="xml/gtktreelistmodel.xml" />
|
||||||
|
</chapter>
|
||||||
|
|
||||||
<chapter id="Application">
|
<chapter id="Application">
|
||||||
<title>Application support</title>
|
<title>Application support</title>
|
||||||
<xi:include href="xml/gtkapplication.xml" />
|
<xi:include href="xml/gtkapplication.xml" />
|
||||||
@@ -65,11 +70,13 @@
|
|||||||
<title>Interface builder</title>
|
<title>Interface builder</title>
|
||||||
<xi:include href="xml/gtkbuilder.xml" />
|
<xi:include href="xml/gtkbuilder.xml" />
|
||||||
<xi:include href="xml/gtkbuildable.xml" />
|
<xi:include href="xml/gtkbuildable.xml" />
|
||||||
|
<xi:include href="xml/gtkbuilderscope.xml" />
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<chapter id="WindowWidgets">
|
<chapter id="WindowWidgets">
|
||||||
<title>Windows</title>
|
<title>Windows</title>
|
||||||
<xi:include href="xml/gtkroot.xml" />
|
<xi:include href="xml/gtkroot.xml" />
|
||||||
|
<xi:include href="xml/gtknative.xml" />
|
||||||
<xi:include href="xml/gtkwindow.xml" />
|
<xi:include href="xml/gtkwindow.xml" />
|
||||||
<xi:include href="xml/gtkdialog.xml" />
|
<xi:include href="xml/gtkdialog.xml" />
|
||||||
<xi:include href="xml/gtkmessagedialog.xml" />
|
<xi:include href="xml/gtkmessagedialog.xml" />
|
||||||
@@ -109,6 +116,9 @@
|
|||||||
<xi:include href="xml/gtkcustomlayout.xml" />
|
<xi:include href="xml/gtkcustomlayout.xml" />
|
||||||
<xi:include href="xml/gtkfixedlayout.xml" />
|
<xi:include href="xml/gtkfixedlayout.xml" />
|
||||||
<xi:include href="xml/gtkgridlayout.xml" />
|
<xi:include href="xml/gtkgridlayout.xml" />
|
||||||
|
<xi:include href="xml/gtkconstraintlayout.xml" />
|
||||||
|
<xi:include href="xml/gtkconstraint.xml" />
|
||||||
|
<xi:include href="xml/gtkconstraintguide.xml" />
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<chapter id="DisplayWidgets">
|
<chapter id="DisplayWidgets">
|
||||||
@@ -145,7 +155,6 @@
|
|||||||
<xi:include href="xml/gtkscalebutton.xml" />
|
<xi:include href="xml/gtkscalebutton.xml" />
|
||||||
<xi:include href="xml/gtkvolumebutton.xml" />
|
<xi:include href="xml/gtkvolumebutton.xml" />
|
||||||
<xi:include href="xml/gtklockbutton.xml" />
|
<xi:include href="xml/gtklockbutton.xml" />
|
||||||
<xi:include href="xml/gtkmodelbutton.xml" />
|
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<chapter id="NumericEntry">
|
<chapter id="NumericEntry">
|
||||||
@@ -164,7 +173,7 @@
|
|||||||
|
|
||||||
<chapter id="TextWidgetObjects">
|
<chapter id="TextWidgetObjects">
|
||||||
<title>Multiline Text Editor</title>
|
<title>Multiline Text Editor</title>
|
||||||
<xi:include href="xml/text_widget.sgml" />
|
<xi:include href="xml/text_widget.xml" />
|
||||||
<xi:include href="xml/gtktextiter.xml" />
|
<xi:include href="xml/gtktextiter.xml" />
|
||||||
<xi:include href="xml/gtktextmark.xml" />
|
<xi:include href="xml/gtktextmark.xml" />
|
||||||
<xi:include href="xml/gtktextbuffer.xml" />
|
<xi:include href="xml/gtktextbuffer.xml" />
|
||||||
@@ -175,7 +184,7 @@
|
|||||||
|
|
||||||
<chapter id="TreeWidgetObjects">
|
<chapter id="TreeWidgetObjects">
|
||||||
<title>Tree, List and Icon Grid Widgets</title>
|
<title>Tree, List and Icon Grid Widgets</title>
|
||||||
<xi:include href="xml/tree_widget.sgml" />
|
<xi:include href="xml/tree_widget.xml" />
|
||||||
<xi:include href="xml/gtktreemodel.xml" />
|
<xi:include href="xml/gtktreemodel.xml" />
|
||||||
<xi:include href="xml/gtktreeselection.xml" />
|
<xi:include href="xml/gtktreeselection.xml" />
|
||||||
<xi:include href="xml/gtktreeviewcolumn.xml" />
|
<xi:include href="xml/gtktreeviewcolumn.xml" />
|
||||||
@@ -208,12 +217,6 @@
|
|||||||
<title>Menus, Combo Box, Toolbar</title>
|
<title>Menus, Combo Box, Toolbar</title>
|
||||||
<xi:include href="xml/gtkcombobox.xml" />
|
<xi:include href="xml/gtkcombobox.xml" />
|
||||||
<xi:include href="xml/gtkcomboboxtext.xml" />
|
<xi:include href="xml/gtkcomboboxtext.xml" />
|
||||||
<xi:include href="xml/gtkmenu.xml" />
|
|
||||||
<xi:include href="xml/gtkmenubar.xml" />
|
|
||||||
<xi:include href="xml/gtkmenuitem.xml" />
|
|
||||||
<xi:include href="xml/gtkradiomenuitem.xml" />
|
|
||||||
<xi:include href="xml/gtkcheckmenuitem.xml" />
|
|
||||||
<xi:include href="xml/gtkseparatormenuitem.xml" />
|
|
||||||
<xi:include href="xml/gtktoolshell.xml" />
|
<xi:include href="xml/gtktoolshell.xml" />
|
||||||
<xi:include href="xml/gtktoolbar.xml" />
|
<xi:include href="xml/gtktoolbar.xml" />
|
||||||
<xi:include href="xml/gtktoolitem.xml" />
|
<xi:include href="xml/gtktoolitem.xml" />
|
||||||
@@ -302,7 +305,6 @@
|
|||||||
<xi:include href="xml/gtkwidget.xml" />
|
<xi:include href="xml/gtkwidget.xml" />
|
||||||
<xi:include href="xml/gtkcontainer.xml" />
|
<xi:include href="xml/gtkcontainer.xml" />
|
||||||
<xi:include href="xml/gtkbin.xml" />
|
<xi:include href="xml/gtkbin.xml" />
|
||||||
<xi:include href="xml/gtkmenushell.xml" />
|
|
||||||
<xi:include href="xml/gtkrange.xml" />
|
<xi:include href="xml/gtkrange.xml" />
|
||||||
<xi:include href="xml/gtkimcontext.xml" />
|
<xi:include href="xml/gtkimcontext.xml" />
|
||||||
<xi:include href="xml/gtknativedialog.xml" />
|
<xi:include href="xml/gtknativedialog.xml" />
|
||||||
@@ -403,12 +405,12 @@
|
|||||||
|
|
||||||
<part id="platform-support">
|
<part id="platform-support">
|
||||||
<title>GTK Platform Support</title>
|
<title>GTK Platform Support</title>
|
||||||
<xi:include href="building.sgml" />
|
<xi:include href="building.xml" />
|
||||||
<xi:include href="xml/compiling.sgml" />
|
<xi:include href="xml/compiling.xml" />
|
||||||
<xi:include href="running.sgml" />
|
<xi:include href="running.xml" />
|
||||||
<xi:include href="x11.sgml" />
|
<xi:include href="x11.xml" />
|
||||||
<xi:include href="windows.sgml" />
|
<xi:include href="windows.xml" />
|
||||||
<xi:include href="osx.sgml" />
|
<xi:include href="osx.xml" />
|
||||||
<xi:include href="broadway.xml" />
|
<xi:include href="broadway.xml" />
|
||||||
<xi:include href="wayland.xml" />
|
<xi:include href="wayland.xml" />
|
||||||
</part>
|
</part>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -49,7 +49,7 @@
|
|||||||
files for icon themes.
|
files for icon themes.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
It expects to be given the <replaceable>PATH</replaceable> to a icon theme
|
It expects to be given the <replaceable>PATH</replaceable> to an icon theme
|
||||||
directory containing an <filename>index.theme</filename>, e.g.
|
directory containing an <filename>index.theme</filename>, e.g.
|
||||||
<filename>/usr/share/icons/hicolor</filename>, and writes a
|
<filename>/usr/share/icons/hicolor</filename>, and writes a
|
||||||
<filename>icon-theme.cache</filename> containing cached information about
|
<filename>icon-theme.cache</filename> containing cached information about
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user