Debian Codegraph @

sys/ButtonEditor.cpp

raw symbols SCIP
1 /* ButtonEditor.cpp
2 *
3 * Copyright (C) 1996-2022 Paul Boersma
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "ButtonEditor.h"cxx . . $ `<file>/sys/ButtonEditor.h`/
20 #include "praatP.h"cxx . . $ `<file>/sys/praatP.h`/
21 #include "praat_script.h"cxx . . $ `<file>/sys/praat_script.h`/
22 #include "EditorM.h"cxx . . $ `<file>/sys/EditorM.h`/
23 #include "machine.h"cxx . . $ `<file>/sys/machine.h`/
24
25 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (ButtonEditor, HyperPage, 0);
26
27 #if defined (_WIN32)
28 #define BUTTON_WIDTH 72
29 #elif defined (macintosh)
30 #define BUTTON_WIDTH 72
31 #else
32 #define BUTTON_WIDTHcxx . . $ `sys/ButtonEditor.cpp:32:10`! 96
33 #endif
34
35 static void drawMenuCommandcxx . . $ drawMenuCommand(58ca0734fd6fa48c). (ButtonEditorcxx . . $ ButtonEditor# me, Praat_Commandcxx . . $ Praat_Command# cmd, integercxx . . $ integer# i) {
36 static MelderStringcxx . . $ MelderString# text;
37 bool isAdded = cmd -> uniqueIDcxx . . $ structPraat_Command#uniqueID. != 0 || !! cmd -> scriptcxx . . $ structPraat_Command#script.;
38 bool isHidden = cmd -> hiddencxx . . $ structPraat_Command#hidden.;
39 bool isToggled = cmd -> toggledcxx . . $ structPraat_Command#toggled.;
40 conststring32cxx . . $ conststring32# clickText = isHidden ? (isToggled ? (isAdded ? (cmd -> uniqueIDcxx . . $ structPraat_Command#uniqueID. ? U"REMOVED" : U"HIDDEN") : U"HIDDEN") : U"hidden") :
41 (isToggled ? U"SHOWN" : (isAdded ? (cmd -> uniqueIDcxx . . $ structPraat_Command#uniqueID. ? U"ADDED" : U"START-UP") : U"shown"));
42 MelderString_emptycxx . . $ MelderString_empty(93db1090f27e5462). (& text);
43 if (cmd -> unhidablecxx . . $ structPraat_Command#unhidable.)
44 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U"#unhidable ");
45 else
46 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U"@@m", i, U"|", clickText, U"@ ");
47 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, cmd -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U": ");
48 if (cmd -> menucxx . . $ structPraat_Command#menu.)
49 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, cmd -> menucxx . . $ structPraat_Command#menu..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U": ");
50 if (cmd -> titlecxx . . $ structPraat_Command#title.) {
51 if (cmd -> executablecxx . . $ structPraat_Command#executable.)
52 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U"@@p", i, U"|", cmd -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"@");
53 else
54 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, cmd -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
55 } else {
56 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U"---------");
57 }
58 if (cmd -> aftercxx . . $ structPraat_Command#after.)
59 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U", %%%%after \"", cmd -> aftercxx . . $ structPraat_Command#after..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"\"%%");
60 if (cmd -> scriptcxx . . $ structPraat_Command#script.)
61 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U", script \"", Melder_peekExpandBackslashescxx . . $ Melder_peekExpandBackslashes(ff4c117d906607ef). (cmd -> scriptcxx . . $ structPraat_Command#script..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()), U"\"");
62 HyperPage_anycxx . . $ HyperPage_any(c88eb68d76615c12). (me, text.stringcxx . . $ MelderString#string., mycxx . . $ `melder/melder.h:44:9`! instancePref_fontcxx . . $ structHyperPage#instancePref_font(4c2ae844ad7b2533).(), mycxx . . $ `melder/melder.h:44:9`! instancePref_fontSizecxx . . $ structHyperPage#instancePref_fontSize(21b6c25e127938e2).(), cmd -> callbackcxx . . $ structPraat_Command#callback. ? 0 : Graphics_ITALICcxx . . $ `sys/Graphics.h:263:9`!, 0.0,
63 cmd -> depthcxx . . $ structPraat_Command#depth. * 0.3, 0.4, 0.0, 0.0, 0);
64 }
65
66 static void drawActioncxx . . $ drawAction(58ca0734fd6fa48c). (ButtonEditorcxx . . $ ButtonEditor# me, Praat_Commandcxx . . $ Praat_Command# cmd, integercxx . . $ integer# i) {
67 static MelderStringcxx . . $ MelderString# text;
68 bool isAdded = cmd -> uniqueIDcxx . . $ structPraat_Command#uniqueID. != 0 || !! cmd -> scriptcxx . . $ structPraat_Command#script.;
69 bool isHidden = cmd -> hiddencxx . . $ structPraat_Command#hidden., isToggled = cmd -> toggledcxx . . $ structPraat_Command#toggled.;
70 conststring32cxx . . $ conststring32# clickText = isHidden ? (isToggled ? (isAdded ? (cmd -> uniqueIDcxx . . $ structPraat_Command#uniqueID. ? U"REMOVED" : U"HIDDEN") : U"HIDDEN") : U"hidden") :
71 (isToggled ? U"SHOWN" : (isAdded ? (cmd -> uniqueIDcxx . . $ structPraat_Command#uniqueID. ? U"ADDED" : U"START-UP") : U"shown"));
72 integercxx . . $ integer# n1 = cmd -> n1cxx . . $ structPraat_Command#n1.;
73 MelderString_emptycxx . . $ MelderString_empty(93db1090f27e5462). (& text);
74 if (cmd -> class4cxx . . $ structPraat_Command#class4.)
75 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U"#unhidable ");
76 else
77 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U"@@a", i, U"|", clickText, U"@ ");
78 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, cmd -> class1cxx . . $ structPraat_Command#class1. -> classNamecxx . . $ structClassInfo#className.);
79 if (n1)
80 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U" (", n1, U")");
81 if (cmd -> class2cxx . . $ structPraat_Command#class2.) {
82 integercxx . . $ integer# n2 = cmd -> n2cxx . . $ structPraat_Command#n2.;
83 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U" & ", cmd -> class2cxx . . $ structPraat_Command#class2. -> classNamecxx . . $ structClassInfo#className.);
84 if (n2)
85 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U" (", n2, U")");
86 }
87 if (cmd -> class3cxx . . $ structPraat_Command#class3.) {
88 integercxx . . $ integer# n3 = cmd -> n3cxx . . $ structPraat_Command#n3.;
89 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U" & ", cmd -> class3cxx . . $ structPraat_Command#class3. -> classNamecxx . . $ structClassInfo#className.);
90 if (n3)
91 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U" (", n3, U")");
92 }
93 if (cmd -> class4cxx . . $ structPraat_Command#class4.) {
94 integercxx . . $ integer# n4 = cmd -> n4cxx . . $ structPraat_Command#n4.;
95 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U" & ", cmd -> class4cxx . . $ structPraat_Command#class4. -> classNamecxx . . $ structClassInfo#className.);
96 if (n4)
97 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U" (", n4, U")");
98 }
99 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U": ");
100 if (cmd -> titlecxx . . $ structPraat_Command#title.) {
101 if (cmd -> executablecxx . . $ structPraat_Command#executable.)
102 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U"@@e", i, U"|", cmd -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"@");
103 else
104 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, cmd -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
105 } else {
106 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U"---------");
107 }
108 if (cmd -> aftercxx . . $ structPraat_Command#after.)
109 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U", %%%%after \"", cmd -> aftercxx . . $ structPraat_Command#after..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"\"%%");
110 if (cmd -> scriptcxx . . $ structPraat_Command#script.)
111 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& text, U", script \"", Melder_peekExpandBackslashescxx . . $ Melder_peekExpandBackslashes(ff4c117d906607ef). (cmd -> scriptcxx . . $ structPraat_Command#script..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()), U"\"");
112 HyperPage_anycxx . . $ HyperPage_any(c88eb68d76615c12). (me, text.stringcxx . . $ MelderString#string., mycxx . . $ `melder/melder.h:44:9`! instancePref_fontcxx . . $ structHyperPage#instancePref_font(4c2ae844ad7b2533).(), mycxx . . $ `melder/melder.h:44:9`! instancePref_fontSizecxx . . $ structHyperPage#instancePref_fontSize(21b6c25e127938e2).(), cmd -> callbackcxx . . $ structPraat_Command#callback. ? 0 : Graphics_ITALICcxx . . $ `sys/Graphics.h:263:9`!, 0.0,
113 cmd -> depthcxx . . $ structPraat_Command#depth. * 0.3, 0.4, 0.0, 0.0, 0);
114 }
115
116 void structButtonEditorcxx . . $ structButtonEditor# :: v_drawcxx . . $ structButtonEditor#v_draw(49f6e7a06ebc5aa8). () {
117 switch (showcxx . . $ structButtonEditor#show.) {
118 case 1:
119 for (integercxx . . $ integer# i = 1, n = praat_getNumberOfMenuCommandscxx . . $ praat_getNumberOfMenuCommands(da6335ded91d79c2). (); i <= n; i ++) {
120 Praat_Commandcxx . . $ Praat_Command# cmd = praat_getMenuCommandcxx . . $ praat_getMenuCommand(ee05ff1469c8f4e9). (i);
121 if (str32equcxx . . $ `melder/melder_str32.h:122:9`! (cmd -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"Objects"))
122 drawMenuCommandcxx . . $ drawMenuCommand(58ca0734fd6fa48c). (this, praat_getMenuCommandcxx . . $ praat_getMenuCommand(ee05ff1469c8f4e9). (i), i);
123 }
124 break;
125 case 2:
126 for (integercxx . . $ integer# i = 1, n = praat_getNumberOfMenuCommandscxx . . $ praat_getNumberOfMenuCommands(da6335ded91d79c2). (); i <= n; i ++) {
127 Praat_Commandcxx . . $ Praat_Command# cmd = praat_getMenuCommandcxx . . $ praat_getMenuCommand(ee05ff1469c8f4e9). (i);
128 if (str32equcxx . . $ `melder/melder_str32.h:122:9`! (cmd -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"Picture"))
129 drawMenuCommandcxx . . $ drawMenuCommand(58ca0734fd6fa48c). (this, praat_getMenuCommandcxx . . $ praat_getMenuCommand(ee05ff1469c8f4e9). (i), i);
130 }
131 break;
132 case 3:
133 for (integercxx . . $ integer# i = 1, n = praat_getNumberOfMenuCommandscxx . . $ praat_getNumberOfMenuCommands(da6335ded91d79c2). (); i <= n; i ++) {
134 Praat_Commandcxx . . $ Praat_Command# cmd = praat_getMenuCommandcxx . . $ praat_getMenuCommand(ee05ff1469c8f4e9). (i);
135 if (! str32equcxx . . $ `melder/melder_str32.h:122:9`! (cmd -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"Objects") && ! str32equcxx . . $ `melder/melder_str32.h:122:9`! (cmd -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"Picture"))
136 drawMenuCommandcxx . . $ drawMenuCommand(58ca0734fd6fa48c). (this, praat_getMenuCommandcxx . . $ praat_getMenuCommand(ee05ff1469c8f4e9). (i), i);
137 }
138 break;
139 case 4:
140 for (integercxx . . $ integer# i = 1, n = praat_getNumberOfActionscxx . . $ praat_getNumberOfActions(da6335ded91d79c2). (); i <= n; i ++) {
141 Praat_Commandcxx . . $ Praat_Command# cmd = praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i);
142 conststring32cxx . . $ conststring32# klas = cmd -> class1cxx . . $ structPraat_Command#class1. -> classNamecxx . . $ structClassInfo#className.;
143 if (klas [0] >= U'A' && klas [0] <= U'D')
144 drawActioncxx . . $ drawAction(58ca0734fd6fa48c). (this, praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i), i);
145 }
146 break;
147 case 5:
148 for (integercxx . . $ integer# i = 1, n = praat_getNumberOfActionscxx . . $ praat_getNumberOfActions(da6335ded91d79c2). (); i <= n; i ++) {
149 Praat_Commandcxx . . $ Praat_Command# cmd = praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i);
150 conststring32cxx . . $ conststring32# klas = cmd -> class1cxx . . $ structPraat_Command#class1. -> classNamecxx . . $ structClassInfo#className.;
151 if (klas [0] >= U'E' && klas [0] <= U'H')
152 drawActioncxx . . $ drawAction(58ca0734fd6fa48c). (this, praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i), i);
153 }
154 break;
155 case 6:
156 for (integercxx . . $ integer# i = 1, n = praat_getNumberOfActionscxx . . $ praat_getNumberOfActions(da6335ded91d79c2). (); i <= n; i ++) {
157 Praat_Commandcxx . . $ Praat_Command# cmd = praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i);
158 conststring32cxx . . $ conststring32# klas = cmd -> class1cxx . . $ structPraat_Command#class1. -> classNamecxx . . $ structClassInfo#className.;
159 if (klas [0] >= U'I' && klas [0] <= U'L')
160 drawActioncxx . . $ drawAction(58ca0734fd6fa48c). (this, praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i), i);
161 }
162 break;
163 case 7:
164 for (integercxx . . $ integer# i = 1, n = praat_getNumberOfActionscxx . . $ praat_getNumberOfActions(da6335ded91d79c2). (); i <= n; i ++) {
165 Praat_Commandcxx . . $ Praat_Command# cmd = praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i);
166 conststring32cxx . . $ conststring32# klas = cmd -> class1cxx . . $ structPraat_Command#class1. -> classNamecxx . . $ structClassInfo#className.;
167 if (klas [0] >= U'M' && klas [0] <= U'O')
168 drawActioncxx . . $ drawAction(58ca0734fd6fa48c). (this, praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i), i);
169 }
170 break;
171 case 8:
172 for (integercxx . . $ integer# i = 1, n = praat_getNumberOfActionscxx . . $ praat_getNumberOfActions(da6335ded91d79c2). (); i <= n; i ++) {
173 Praat_Commandcxx . . $ Praat_Command# cmd = praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i);
174 conststring32cxx . . $ conststring32# klas = cmd -> class1cxx . . $ structPraat_Command#class1. -> classNamecxx . . $ structClassInfo#className.;
175 if (klas [0] >= U'P' && klas [0] <= U'S')
176 drawActioncxx . . $ drawAction(58ca0734fd6fa48c). (this, praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i), i);
177 }
178 break;
179 case 9:
180 for (integercxx . . $ integer# i = 1, n = praat_getNumberOfActionscxx . . $ praat_getNumberOfActions(da6335ded91d79c2). (); i <= n; i ++) {
181 Praat_Commandcxx . . $ Praat_Command# cmd = praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i);
182 conststring32cxx . . $ conststring32# klas = cmd -> class1cxx . . $ structPraat_Command#class1. -> classNamecxx . . $ structClassInfo#className.;
183 if (klas [0] >= U'T' && klas [0] <= U'Z')
184 drawActioncxx . . $ drawAction(58ca0734fd6fa48c). (this, praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i), i);
185 }
186 break;
187 }
188 }
189
190 int structButtonEditorcxx . . $ structButtonEditor# :: v_goToPagecxx . . $ structButtonEditor#v_goToPage(e049ab16a3067c7). (conststring32cxx . . $ conststring32# title) {
191 if (! title || ! title [0])
192 return 0;
193 if (str32equcxx . . $ `melder/melder_str32.h:122:9`! (title, U"Buttons"))
194 return 1;
195 switch (title [0]) {
196 case 'a': { // toggle visibility of action
197 integercxx . . $ integer# i = Melder_atoicxx . . $ Melder_atoi(c94c67ff4219bf83). (& title [1]);
198 Praat_Commandcxx . . $ Praat_Command# action = praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i);
199 if (! action)
200 return 0;
201 if (action -> hiddencxx . . $ structPraat_Command#hidden.)
202 praat_showActioncxx . . $ praat_showAction(312e849c2af9bc10). (action -> class1cxx . . $ structPraat_Command#class1., action -> class2cxx . . $ structPraat_Command#class2., action -> class3cxx . . $ structPraat_Command#class3., action -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
203 else
204 praat_hideActioncxx . . $ praat_hideAction(312e849c2af9bc10). (action -> class1cxx . . $ structPraat_Command#class1., action -> class2cxx . . $ structPraat_Command#class2., action -> class3cxx . . $ structPraat_Command#class3., action -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
205 } break;
206 case 'm': { // toggle visibility of menu command
207 integercxx . . $ integer# i = Melder_atoicxx . . $ Melder_atoi(c94c67ff4219bf83). (& title [1]);
208 Praat_Commandcxx . . $ Praat_Command# menuCommand = praat_getMenuCommandcxx . . $ praat_getMenuCommand(ee05ff1469c8f4e9). (i);
209 if (! menuCommand)
210 return 0;
211 if (menuCommand -> hiddencxx . . $ structPraat_Command#hidden.)
212 praat_showMenuCommandcxx . . $ praat_showMenuCommand(b6693f37175431d7). (menuCommand -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), menuCommand -> menucxx . . $ structPraat_Command#menu..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), menuCommand -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
213 else
214 praat_hideMenuCommandcxx . . $ praat_hideMenuCommand(b6693f37175431d7). (menuCommand -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), menuCommand -> menucxx . . $ structPraat_Command#menu..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), menuCommand -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
215 } break;
216 case 'e': { // execute action
217 integercxx . . $ integer# i = Melder_atoicxx . . $ Melder_atoi(c94c67ff4219bf83). (& title [1]);
218 Praat_Commandcxx . . $ Praat_Command# action = praat_getActioncxx . . $ praat_getAction(ee05ff1469c8f4e9). (i);
219 if (! action || ! action -> callbackcxx . . $ structPraat_Command#callback.)
220 return 0;
221 if (action -> titlecxx . . $ structPraat_Command#title.) {
222 UiHistory_writecxx . . $ UiHistory_write(ff00d524ab0355ec). (U"\n");
223 UiHistory_write_colonizecxx . . $ UiHistory_write_colonize(ff00d524ab0355ec). (action -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
224 }
225 if (action -> scriptcxx . . $ structPraat_Command#script.) {
226 try {
227 DO_RunTheScriptFromAnyAddedMenuCommandcxx . . $ DO_RunTheScriptFromAnyAddedMenuCommand(744a0abd3c8513c). (nullptr, 0, nullptr, action -> scriptcxx . . $ structPraat_Command#script..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), nullptr, nullptr, false, nullptr, nullptr);
228 } catch (MelderErrorcxx . . $ MelderError#) {
229 Melder_flushErrorcxx . . $ Melder_flushError(6298c93241566110). (U"Command not executed.");
230 }
231 } else {
232 try {
233 action -> callbackcxx . . $ structPraat_Command#callback. (nullptr, 0, nullptr, nullptr, nullptr, nullptr, false, nullptr, nullptr);
234 } catch (MelderErrorcxx . . $ MelderError#) {
235 Melder_flushErrorcxx . . $ Melder_flushError(6298c93241566110). (U"Command not executed.");
236 }
237 }
238 praat_updateSelectioncxx . . $ praat_updateSelection(49f6e7a06ebc5aa8). ();
239 } break;
240 case 'p': { // perform menu command
241 integercxx . . $ integer# i = Melder_atoicxx . . $ Melder_atoi(c94c67ff4219bf83). (& title [1]);
242 Praat_Commandcxx . . $ Praat_Command# menuCommand = praat_getMenuCommandcxx . . $ praat_getMenuCommand(ee05ff1469c8f4e9). (i);
243 if (! menuCommand || ! menuCommand -> callbackcxx . . $ structPraat_Command#callback.)
244 return 0;
245 if (menuCommand -> titlecxx . . $ structPraat_Command#title.) {
246 UiHistory_writecxx . . $ UiHistory_write(ff00d524ab0355ec). (U"\n");
247 UiHistory_write_colonizecxx . . $ UiHistory_write_colonize(ff00d524ab0355ec). (menuCommand -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
248 }
249 if (menuCommand -> scriptcxx . . $ structPraat_Command#script.) {
250 try {
251 DO_RunTheScriptFromAnyAddedMenuCommandcxx . . $ DO_RunTheScriptFromAnyAddedMenuCommand(744a0abd3c8513c). (nullptr, 0, nullptr, menuCommand -> scriptcxx . . $ structPraat_Command#script..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), nullptr, nullptr, false, nullptr, nullptr);
252 } catch (MelderErrorcxx . . $ MelderError#) {
253 Melder_flushErrorcxx . . $ Melder_flushError(6298c93241566110). (U"Command not executed.");
254 }
255 } else {
256 try {
257 menuCommand -> callbackcxx . . $ structPraat_Command#callback. (nullptr, 0, nullptr, nullptr, nullptr, nullptr, false, nullptr, nullptr);
258 } catch (MelderErrorcxx . . $ MelderError#) {
259 Melder_flushErrorcxx . . $ Melder_flushError(6298c93241566110). (U"Command not executed.");
260 }
261 }
262 praat_updateSelectioncxx . . $ praat_updateSelection(49f6e7a06ebc5aa8). ();
263 } break;
264 default: break;
265 }
266 return 0;
267 }
268
269 static void whichcxx . . $ which(a423d0fe2d9a4efa). (ButtonEditorcxx . . $ ButtonEditor# me, int show) {
270 mycxx . . $ `melder/melder.h:44:9`! showcxx . . $ structButtonEditor#show. = show;
271 GuiRadioButton_setcxx . . $ GuiRadioButton_set(669e3d212ae3e4fb). (show == 1 ? mycxx . . $ `melder/melder.h:44:9`! button1cxx . . $ structButtonEditor#button1. : show == 2 ? mycxx . . $ `melder/melder.h:44:9`! button2cxx . . $ structButtonEditor#button2. : show == 3 ? mycxx . . $ `melder/melder.h:44:9`! button3cxx . . $ structButtonEditor#button3. :
272 show == 4 ? mycxx . . $ `melder/melder.h:44:9`! buttonADcxx . . $ structButtonEditor#buttonAD. : show == 5 ? mycxx . . $ `melder/melder.h:44:9`! buttonEHcxx . . $ structButtonEditor#buttonEH. : show == 6 ? mycxx . . $ `melder/melder.h:44:9`! buttonILcxx . . $ structButtonEditor#buttonIL. :
273 show == 7 ? mycxx . . $ `melder/melder.h:44:9`! buttonMOcxx . . $ structButtonEditor#buttonMO. : show == 8 ? mycxx . . $ `melder/melder.h:44:9`! buttonPScxx . . $ structButtonEditor#buttonPS. : mycxx . . $ `melder/melder.h:44:9`! buttonTZcxx . . $ structButtonEditor#buttonTZ.
274 );
275 HyperPage_goToPagecxx . . $ HyperPage_goToPage(a68791b56910ee9e). (me, U"Buttons");
276 }
277
278 static void gui_radiobutton_cb_objectscxx . . $ gui_radiobutton_cb_objects(90bdfebebcbf4d2b). (ButtonEditorcxx . . $ ButtonEditor# me, GuiRadioButtonEventcxx . . $ GuiRadioButtonEvent# /* event */) { whichcxx . . $ which(a423d0fe2d9a4efa). (me, 1); }
279 static void gui_radiobutton_cb_picturecxx . . $ gui_radiobutton_cb_picture(90bdfebebcbf4d2b). (ButtonEditorcxx . . $ ButtonEditor# me, GuiRadioButtonEventcxx . . $ GuiRadioButtonEvent# /* event */) { whichcxx . . $ which(a423d0fe2d9a4efa). (me, 2); }
280 static void gui_radiobutton_cb_editorscxx . . $ gui_radiobutton_cb_editors(90bdfebebcbf4d2b). (ButtonEditorcxx . . $ ButtonEditor# me, GuiRadioButtonEventcxx . . $ GuiRadioButtonEvent# /* event */) { whichcxx . . $ which(a423d0fe2d9a4efa). (me, 3); }
281 static void gui_radiobutton_cb_actionsADcxx . . $ gui_radiobutton_cb_actionsAD(90bdfebebcbf4d2b). (ButtonEditorcxx . . $ ButtonEditor# me, GuiRadioButtonEventcxx . . $ GuiRadioButtonEvent# /* event */) { whichcxx . . $ which(a423d0fe2d9a4efa). (me, 4); }
282 static void gui_radiobutton_cb_actionsEHcxx . . $ gui_radiobutton_cb_actionsEH(90bdfebebcbf4d2b). (ButtonEditorcxx . . $ ButtonEditor# me, GuiRadioButtonEventcxx . . $ GuiRadioButtonEvent# /* event */) { whichcxx . . $ which(a423d0fe2d9a4efa). (me, 5); }
283 static void gui_radiobutton_cb_actionsILcxx . . $ gui_radiobutton_cb_actionsIL(90bdfebebcbf4d2b). (ButtonEditorcxx . . $ ButtonEditor# me, GuiRadioButtonEventcxx . . $ GuiRadioButtonEvent# /* event */) { whichcxx . . $ which(a423d0fe2d9a4efa). (me, 6); }
284 static void gui_radiobutton_cb_actionsMOcxx . . $ gui_radiobutton_cb_actionsMO(90bdfebebcbf4d2b). (ButtonEditorcxx . . $ ButtonEditor# me, GuiRadioButtonEventcxx . . $ GuiRadioButtonEvent# /* event */) { whichcxx . . $ which(a423d0fe2d9a4efa). (me, 7); }
285 static void gui_radiobutton_cb_actionsPScxx . . $ gui_radiobutton_cb_actionsPS(90bdfebebcbf4d2b). (ButtonEditorcxx . . $ ButtonEditor# me, GuiRadioButtonEventcxx . . $ GuiRadioButtonEvent# /* event */) { whichcxx . . $ which(a423d0fe2d9a4efa). (me, 8); }
286 static void gui_radiobutton_cb_actionsTZcxx . . $ gui_radiobutton_cb_actionsTZ(90bdfebebcbf4d2b). (ButtonEditorcxx . . $ ButtonEditor# me, GuiRadioButtonEventcxx . . $ GuiRadioButtonEvent# /* event */) { whichcxx . . $ which(a423d0fe2d9a4efa). (me, 9); }
287
288 void structButtonEditorcxx . . $ structButtonEditor# :: v_createChildrencxx . . $ structButtonEditor#v_createChildren(49f6e7a06ebc5aa8). () {
289 ButtonEditor_Parentcxx . . $ ButtonEditor_Parent# :: v_createChildrencxx . . $ structHyperPage#v_createChildren(49f6e7a06ebc5aa8). ();
290 int x = 3, y = Machine_getMenuBarBottomcxx . . $ Machine_getMenuBarBottom(b126dc7c1de90089). () + 4;
291 GuiRadioGroup_begincxx . . $ GuiRadioGroup_begin(49f6e7a06ebc5aa8). ();
292 constexpr int LETTER_BUTTON_WIDTH = BUTTON_WIDTHcxx . . $ `sys/ButtonEditor.cpp:32:10`! * 2 / 3;
293 button1cxx . . $ structButtonEditor#button1. = GuiRadioButton_createShowncxx . . $ GuiRadioButton_createShown(6b1e2d4d89108d7e). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., x, x + BUTTON_WIDTHcxx . . $ `sys/ButtonEditor.cpp:32:10`!, y, y + Gui_RADIOBUTTON_HEIGHTcxx . . $ `sys/Gui.h:98:9`!,
294 U"Objects", gui_radiobutton_cb_objectscxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this, GuiRadioButton_SETcxx . . $ `sys/Gui.h:1006:9`!);
295 x += BUTTON_WIDTHcxx . . $ `sys/ButtonEditor.cpp:32:10`! + 5;
296 button2cxx . . $ structButtonEditor#button2. = GuiRadioButton_createShowncxx . . $ GuiRadioButton_createShown(6b1e2d4d89108d7e). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., x, x + BUTTON_WIDTHcxx . . $ `sys/ButtonEditor.cpp:32:10`!, y, y + Gui_RADIOBUTTON_HEIGHTcxx . . $ `sys/Gui.h:98:9`!,
297 U"Picture", gui_radiobutton_cb_picturecxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this, 0);
298 x += BUTTON_WIDTHcxx . . $ `sys/ButtonEditor.cpp:32:10`! + 5;
299 button3cxx . . $ structButtonEditor#button3. = GuiRadioButton_createShowncxx . . $ GuiRadioButton_createShown(6b1e2d4d89108d7e). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., x, x + BUTTON_WIDTHcxx . . $ `sys/ButtonEditor.cpp:32:10`!, y, y + Gui_RADIOBUTTON_HEIGHTcxx . . $ `sys/Gui.h:98:9`!,
300 U"Editors", gui_radiobutton_cb_editorscxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this, 0);
301 x += BUTTON_WIDTHcxx . . $ `sys/ButtonEditor.cpp:32:10`! + 5;
302 buttonADcxx . . $ structButtonEditor#buttonAD. = GuiRadioButton_createShowncxx . . $ GuiRadioButton_createShown(6b1e2d4d89108d7e). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., x, x + BUTTON_WIDTHcxx . . $ `sys/ButtonEditor.cpp:32:10`! + 30, y, y + Gui_RADIOBUTTON_HEIGHTcxx . . $ `sys/Gui.h:98:9`!,
303 U"Actions: A–D", gui_radiobutton_cb_actionsADcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this, 0);
304 x += BUTTON_WIDTHcxx . . $ `sys/ButtonEditor.cpp:32:10`! + 35;
305 buttonEHcxx . . $ structButtonEditor#buttonEH. = GuiRadioButton_createShowncxx . . $ GuiRadioButton_createShown(6b1e2d4d89108d7e). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., x, x + LETTER_BUTTON_WIDTH, y, y + Gui_RADIOBUTTON_HEIGHTcxx . . $ `sys/Gui.h:98:9`!,
306 U"E–H", gui_radiobutton_cb_actionsEHcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this, 0);
307 x += LETTER_BUTTON_WIDTH + 5;
308 buttonILcxx . . $ structButtonEditor#buttonIL. = GuiRadioButton_createShowncxx . . $ GuiRadioButton_createShown(6b1e2d4d89108d7e). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., x, x + LETTER_BUTTON_WIDTH - 5, y, y + Gui_RADIOBUTTON_HEIGHTcxx . . $ `sys/Gui.h:98:9`!,
309 U"I–L", gui_radiobutton_cb_actionsILcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this, 0);
310 x += LETTER_BUTTON_WIDTH - 5 + 5;
311 buttonMOcxx . . $ structButtonEditor#buttonMO. = GuiRadioButton_createShowncxx . . $ GuiRadioButton_createShown(6b1e2d4d89108d7e). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., x, x + LETTER_BUTTON_WIDTH, y, y + Gui_RADIOBUTTON_HEIGHTcxx . . $ `sys/Gui.h:98:9`!,
312 U"M–O", gui_radiobutton_cb_actionsMOcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this, 0);
313 x += LETTER_BUTTON_WIDTH + 5;
314 buttonPScxx . . $ structButtonEditor#buttonPS. = GuiRadioButton_createShowncxx . . $ GuiRadioButton_createShown(6b1e2d4d89108d7e). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., x, x + LETTER_BUTTON_WIDTH, y, y + Gui_RADIOBUTTON_HEIGHTcxx . . $ `sys/Gui.h:98:9`!,
315 U"P–S", gui_radiobutton_cb_actionsPScxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this, 0);
316 x += LETTER_BUTTON_WIDTH + 5;
317 buttonTZcxx . . $ structButtonEditor#buttonTZ. = GuiRadioButton_createShowncxx . . $ GuiRadioButton_createShown(6b1e2d4d89108d7e). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., x, x + LETTER_BUTTON_WIDTH, y, y + Gui_RADIOBUTTON_HEIGHTcxx . . $ `sys/Gui.h:98:9`!,
318 U"T–Z", gui_radiobutton_cb_actionsTZcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this, 0);
319 GuiRadioGroup_endcxx . . $ GuiRadioGroup_end(49f6e7a06ebc5aa8). ();
320 }
321
322 static void menu_cb_ButtonEditorHelpcxx . . $ menu_cb_ButtonEditorHelp(5b6d11fdf98fee39). (ButtonEditorcxx . . $ ButtonEditor# /* me */, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { Melder_helpcxx . . $ Melder_help(ff00d524ab0355ec). (U"ButtonEditor"); }
323
324 void structButtonEditorcxx . . $ structButtonEditor# :: v_createMenuItems_helpcxx . . $ structButtonEditor#v_createMenuItems_help(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu# menu) {
325 ButtonEditor_Parentcxx . . $ ButtonEditor_Parent# :: v_createMenuItems_helpcxx . . $ structDataGui#v_createMenuItems_help(6ea9c8c6ea2f58a9). (menu);
326 EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, U"ButtonEditor help", '?', menu_cb_ButtonEditorHelpcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).);
327 }
328
329 autoButtonEditorcxx . . $ autoButtonEditor# ButtonEditor_createcxx . . $ ButtonEditor_create(f6a6aa80bc9d3111). () {
330 try {
331 autoButtonEditorcxx . . $ autoButtonEditor# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (ButtonEditor);
332 HyperPage_initcxx . . $ HyperPage_init(7b1f2c4aafa3d0ec). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), U"Buttons", nullptr);
333 whichcxx . . $ which(a423d0fe2d9a4efa). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 1);
334 return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).;
335 } catch (MelderErrorcxx . . $ MelderError#) {
336 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Buttons window not created.");
337 }
338 }
339
340 /* End of file ButtonEditor.cpp */