| 1 | #cxx . . $ `<file>/sys/EditorM.h`/ifndef _EditorM_h_ |
| 2 | #define _EditorM_h_cxx . . $ `sys/EditorM.h:2:9`! |
| 3 | /* EditorM.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2013,2015-2024,2026 Paul Boersma, 2026 Anastasia Shchupak |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #ifdef _praatM_h_ |
| 22 | #error Include either praatM.h or EditorM.h, but not both. |
| 23 | #endif |
| 24 | |
| 25 | #define EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`! \ |
| 26 | [[maybe_unused]] EditorCommand cmd, \ |
| 27 | [[maybe_unused]] UiForm _sendingForm_, \ |
| 28 | [[maybe_unused]] integer _narg_, \ |
| 29 | [[maybe_unused]] Stackel _args_, \ |
| 30 | [[maybe_unused]] conststring32 _sendingString_, \ |
| 31 | [[maybe_unused]] Interpreter optionalInterpreter |
| 32 | |
| 33 | #define EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`!(title, helpTitle) \ |
| 34 | if (cmd -> d_uiform) \ |
| 35 | goto _form_inited_; \ |
| 36 | cmd -> d_uiform = UiForm_createE (cmd, title, cmd -> itemTitle.get(), helpTitle); |
| 37 | |
| 38 | #define EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! \ |
| 39 | UiForm_finish (cmd -> d_uiform.get()); \ |
| 40 | _form_inited_: \ |
| 41 | if (! _args_ && ! _sendingForm_ && ! _sendingString_) { |
| 42 | |
| 43 | #define EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! \ |
| 44 | UiForm_do (cmd -> d_uiform.get(), false); \ |
| 45 | } else if (! _sendingForm_) { \ |
| 46 | UiForm_parseStringE (cmd, _narg_, _args_, _sendingString_, optionalInterpreter); \ |
| 47 | } else { |
| 48 | |
| 49 | #define EDITOR_DO_ALTERNATIVEcxx . . $ `sys/EditorM.h:49:9`!(alternative) \ |
| 50 | UiForm_do (cmd -> d_uiform.get(), false); \ |
| 51 | } else if (! _sendingForm_) { \ |
| 52 | try { \ |
| 53 | UiForm_parseStringE (cmd, _narg_, _args_, _sendingString_, optionalInterpreter); \ |
| 54 | } catch (MelderError) { \ |
| 55 | if (Melder_hasCrash ()) \ |
| 56 | throw; \ |
| 57 | autostring32 _parkedError = Melder_dup_f (Melder_getError ()); \ |
| 58 | Melder_clearError (); \ |
| 59 | try { \ |
| 60 | static autoEditorCommand _alternativeCmd; \ |
| 61 | if (! _alternativeCmd) \ |
| 62 | _alternativeCmd = Thing_new (EditorCommand); \ |
| 63 | _alternativeCmd -> d_editor = cmd -> d_editor; \ |
| 64 | _alternativeCmd -> sender = cmd -> sender; \ |
| 65 | _alternativeCmd -> menu = cmd -> menu; \ |
| 66 | _alternativeCmd -> itemTitle = Melder_dup (cmd -> itemTitle.get()); \ |
| 67 | _alternativeCmd -> itemWidget = nullptr; \ |
| 68 | _alternativeCmd -> commandCallback = cmd -> commandCallback; \ |
| 69 | _alternativeCmd -> script = Melder_dup (cmd -> script.get()); \ |
| 70 | _alternativeCmd -> d_uiform = autoUiForm (); \ |
| 71 | alternative (me, _alternativeCmd.get(), _sendingForm_, _narg_, _args_, _sendingString_, optionalInterpreter); \ |
| 72 | } catch (MelderError) { \ |
| 73 | Melder_clearError (); \ |
| 74 | Melder_appendError (_parkedError.get()); \ |
| 75 | throw; \ |
| 76 | } \ |
| 77 | } \ |
| 78 | } else { |
| 79 | |
| 80 | #define EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! \ |
| 81 | } |
| 82 | |
| 83 | /* |
| 84 | Functions to define the fields in a form on the basis of the label text |
| 85 | and factory default value. |
| 86 | They are to be called between EDITOR_FORM and EDITOR_OK. |
| 87 | */ |
| 88 | |
| 89 | #define REAL_VARIABLEcxx . . $ `sys/EditorM.h:89:9`!(realVariable) \ |
| 90 | static double realVariable; |
| 91 | |
| 92 | #define REAL_FIELDcxx . . $ `sys/EditorM.h:92:9`!(realVariable, labelText, defaultStringValue) \ |
| 93 | UiForm_addReal (cmd -> d_uiform.get(), & realVariable, nullptr, labelText, defaultStringValue); |
| 94 | |
| 95 | #define REALcxx . . $ `sys/EditorM.h:95:9`!(realVariable, labelText, defaultStringValue) \ |
| 96 | REAL_VARIABLE (realVariable) \ |
| 97 | REAL_FIELD (realVariable, labelText, defaultStringValue) |
| 98 | |
| 99 | |
| 100 | #define REAL_OR_UNDEFINED_VARIABLEcxx . . $ `sys/EditorM.h:100:9`!(realVariable) \ |
| 101 | static double realVariable; |
| 102 | |
| 103 | #define REAL_OR_UNDEFINED_FIELDcxx . . $ `sys/EditorM.h:103:9`!(realVariable, labelText, defaultStringValue) \ |
| 104 | UiForm_addRealOrUndefined (cmd -> d_uiform.get(), & realVariable, nullptr, labelText, defaultStringValue); |
| 105 | |
| 106 | #define REAL_OR_UNDEFINEDcxx . . $ `sys/EditorM.h:106:9`!(realVariable, labelText, defaultStringValue) \ |
| 107 | REAL_OR_UNDEFINED_VARIABLE (realVariable) \ |
| 108 | REAL_OR_UNDEFINED_FIELD (realVariable, labelText, defaultStringValue) |
| 109 | |
| 110 | |
| 111 | #define POSITIVE_VARIABLEcxx . . $ `sys/EditorM.h:111:9`!(realVariable) \ |
| 112 | static double realVariable; |
| 113 | |
| 114 | #define POSITIVE_FIELDcxx . . $ `sys/EditorM.h:114:9`!(realVariable, labelText, defaultStringValue) \ |
| 115 | UiForm_addPositive (cmd -> d_uiform.get(), & realVariable, nullptr, labelText, defaultStringValue); |
| 116 | |
| 117 | #define POSITIVEcxx . . $ `sys/EditorM.h:117:9`!(realVariable, labelText, defaultStringValue) \ |
| 118 | POSITIVE_VARIABLE (realVariable) \ |
| 119 | POSITIVE_FIELD (realVariable, labelText, defaultStringValue) |
| 120 | |
| 121 | |
| 122 | #define NONNEGATIVE_VARIABLEcxx . . $ `sys/EditorM.h:122:9`!(realVariable) \ |
| 123 | static double realVariable; |
| 124 | |
| 125 | #define NONNEGATIVE_FIELDcxx . . $ `sys/EditorM.h:125:9`!(realVariable, labelText, defaultStringValue) \ |
| 126 | UiForm_addNonnegative (cmd -> d_uiform.get(), & realVariable, nullptr, labelText, defaultStringValue); |
| 127 | |
| 128 | #define NONNEGATIVEcxx . . $ `sys/EditorM.h:128:9`!(realVariable, labelText, defaultStringValue) \ |
| 129 | NONNEGATIVE_VARIABLE (realVariable) \ |
| 130 | NONNEGATIVE_FIELD (realVariable, labelText, defaultStringValue) |
| 131 | |
| 132 | |
| 133 | #define INTEGER_VARIABLEcxx . . $ `sys/EditorM.h:133:9`!(integerVariable) \ |
| 134 | static integer integerVariable; |
| 135 | |
| 136 | #define INTEGER_FIELDcxx . . $ `sys/EditorM.h:136:9`!(integerVariable, labelText, defaultStringValue) \ |
| 137 | UiForm_addInteger (cmd -> d_uiform.get(), & integerVariable, nullptr, labelText, defaultStringValue); |
| 138 | |
| 139 | #define INTEGERcxx . . $ `sys/EditorM.h:139:9`!(integerVariable, labelText, defaultStringValue) \ |
| 140 | INTEGER_VARIABLE (integerVariable) \ |
| 141 | INTEGER_FIELD (integerVariable, labelText, defaultStringValue) |
| 142 | |
| 143 | |
| 144 | #define NATURAL0_VARIABLEcxx . . $ `sys/EditorM.h:144:9`!(integerVariable) \ |
| 145 | static integer integerVariable; |
| 146 | |
| 147 | #define NATURAL0_FIELDcxx . . $ `sys/EditorM.h:147:9`!(integerVariable, labelText, defaultStringValue) \ |
| 148 | UiForm_addNatural0 (cmd -> d_uiform.get(), & integerVariable, nullptr, labelText, defaultStringValue); |
| 149 | |
| 150 | #define NATURAL0cxx . . $ `sys/EditorM.h:150:9`!(integerVariable, labelText, defaultStringValue) \ |
| 151 | NATURAL0_VARIABLE (integerVariable) \ |
| 152 | NATURAL0_FIELD (integerVariable, labelText, defaultStringValue) |
| 153 | |
| 154 | |
| 155 | #define NATURAL1_VARIABLEcxx . . $ `sys/EditorM.h:155:9`!(integerVariable) \ |
| 156 | static integer integerVariable; |
| 157 | |
| 158 | #define NATURAL1_FIELDcxx . . $ `sys/EditorM.h:158:9`!(integerVariable, labelText, defaultStringValue) \ |
| 159 | UiForm_addNatural1 (cmd -> d_uiform.get(), & integerVariable, nullptr, labelText, defaultStringValue); |
| 160 | |
| 161 | #define NATURAL1cxx . . $ `sys/EditorM.h:161:9`!(integerVariable, labelText, defaultStringValue) \ |
| 162 | NATURAL1_VARIABLE (integerVariable) \ |
| 163 | NATURAL1_FIELD (integerVariable, labelText, defaultStringValue) |
| 164 | |
| 165 | |
| 166 | /* TODO: remove */ |
| 167 | #define NATURAL_VARIABLEcxx . . $ `sys/EditorM.h:167:9`!(integerVariable) \ |
| 168 | static integer integerVariable; |
| 169 | |
| 170 | #define NATURAL_FIELDcxx . . $ `sys/EditorM.h:170:9`!(integerVariable, labelText, defaultStringValue) \ |
| 171 | UiForm_addNatural1 (cmd -> d_uiform.get(), & integerVariable, nullptr, labelText, defaultStringValue); |
| 172 | |
| 173 | #define NATURALcxx . . $ `sys/EditorM.h:173:9`!(integerVariable, labelText, defaultStringValue) \ |
| 174 | NATURAL_VARIABLE (integerVariable) \ |
| 175 | NATURAL_FIELD (integerVariable, labelText, defaultStringValue) |
| 176 | |
| 177 | |
| 178 | #define WORD_VARIABLEcxx . . $ `sys/EditorM.h:178:9`!(stringVariable) \ |
| 179 | static conststring32 stringVariable; |
| 180 | |
| 181 | #define WORD_FIELDcxx . . $ `sys/EditorM.h:181:9`!(stringVariable, labelText, defaultStringValue) \ |
| 182 | UiForm_addWord (cmd -> d_uiform.get(), & stringVariable, nullptr, labelText, defaultStringValue); |
| 183 | |
| 184 | #define WORDcxx . . $ `sys/EditorM.h:184:9`!(stringVariable, labelText, defaultStringValue) \ |
| 185 | WORD_VARIABLE (stringVariable) \ |
| 186 | WORD_FIELD (stringVariable, labelText, defaultStringValue) |
| 187 | |
| 188 | |
| 189 | #define SENTENCE_VARIABLEcxx . . $ `sys/EditorM.h:189:9`!(stringVariable) \ |
| 190 | static conststring32 stringVariable; |
| 191 | |
| 192 | #define SENTENCE_FIELDcxx . . $ `sys/EditorM.h:192:9`!(stringVariable, labelText, defaultStringValue) \ |
| 193 | UiForm_addSentence (cmd -> d_uiform.get(), & stringVariable, nullptr, labelText, defaultStringValue); |
| 194 | |
| 195 | #define SENTENCEcxx . . $ `sys/EditorM.h:195:9`!(stringVariable, labelText, defaultStringValue) \ |
| 196 | SENTENCE_VARIABLE (stringVariable) \ |
| 197 | SENTENCE_FIELD (stringVariable, labelText, defaultStringValue) |
| 198 | |
| 199 | |
| 200 | #define COLOUR_VARIABLEcxx . . $ `sys/EditorM.h:200:9`!(colourVariable) \ |
| 201 | static MelderColour colourVariable; |
| 202 | |
| 203 | #define COLOUR_FIELDcxx . . $ `sys/EditorM.h:203:9`!(colourVariable, labelText, defaultStringValue) \ |
| 204 | UiForm_addColour (cmd -> d_uiform.get(), & colourVariable, nullptr, labelText, defaultStringValue); |
| 205 | |
| 206 | #define COLOURcxx . . $ `sys/EditorM.h:206:9`!(colourVariable, labelText, defaultStringValue) \ |
| 207 | COLOUR_VARIABLE (colourVariable) \ |
| 208 | COLOUR_FIELD (colourVariable, labelText, defaultStringValue) |
| 209 | |
| 210 | |
| 211 | #define CHANNEL_VARIABLEcxx . . $ `sys/EditorM.h:211:9`!(integerVariable) \ |
| 212 | static integer integerVariable; |
| 213 | |
| 214 | #define CHANNEL_FIELDcxx . . $ `sys/EditorM.h:214:9`!(integerVariable, labelText, defaultStringValue) \ |
| 215 | UiForm_addChannel (cmd -> d_uiform.get(), & integerVariable, nullptr, labelText, defaultStringValue); |
| 216 | |
| 217 | #define CHANNELcxx . . $ `sys/EditorM.h:217:9`!(integerVariable, labelText, defaultStringValue) \ |
| 218 | CHANNEL_VARIABLE (integerVariable) \ |
| 219 | CHANNEL_FIELD (integerVariable, labelText, defaultStringValue) |
| 220 | |
| 221 | |
| 222 | #define BOOLEAN_VARIABLEcxx . . $ `sys/EditorM.h:222:9`!(booleanVariable) \ |
| 223 | static bool booleanVariable; |
| 224 | |
| 225 | #define BOOLEAN_FIELDcxx . . $ `sys/EditorM.h:225:9`!(booleanVariable, labelText, defaultBooleanValue) \ |
| 226 | UiForm_addBoolean (cmd -> d_uiform.get(), & booleanVariable, nullptr, labelText, defaultBooleanValue); |
| 227 | |
| 228 | #define BOOLEANcxx . . $ `sys/EditorM.h:228:9`!(booleanVariable, labelText, defaultBooleanValue) \ |
| 229 | BOOLEAN_VARIABLE (booleanVariable) \ |
| 230 | BOOLEAN_FIELD (booleanVariable, labelText, defaultBooleanValue) |
| 231 | |
| 232 | |
| 233 | #define HEADINGcxx . . $ `sys/EditorM.h:233:9`!(labelText) \ |
| 234 | UiForm_addHeading (cmd -> d_uiform.get(), nullptr, labelText); |
| 235 | |
| 236 | |
| 237 | #define COMMENTcxx . . $ `sys/EditorM.h:237:9`!(labelText) \ |
| 238 | UiForm_addComment (cmd -> d_uiform.get(), nullptr, labelText); |
| 239 | |
| 240 | |
| 241 | #define MUTABLE_COMMENT_VARIABLEcxx . . $ `sys/EditorM.h:241:9`!(stringVariable) \ |
| 242 | static conststring32 stringVariable; |
| 243 | |
| 244 | #define MUTABLE_COMMENT_FIELDcxx . . $ `sys/EditorM.h:244:9`!(stringVariable, labelText) \ |
| 245 | UiForm_addComment (cmd -> d_uiform.get(), & stringVariable, labelText); |
| 246 | |
| 247 | #define MUTABLE_COMMENTcxx . . $ `sys/EditorM.h:247:9`!(stringVariable, labelText) \ |
| 248 | MUTABLE_COMMENT_VARIABLE (stringVariable) \ |
| 249 | MUTABLE_COMMENT_FIELD (stringVariable, labelText) |
| 250 | |
| 251 | |
| 252 | #define CAPTIONcxx . . $ `sys/EditorM.h:252:9`!(labelText) \ |
| 253 | UiForm_addCaption (cmd -> d_uiform.get(), nullptr, labelText); |
| 254 | |
| 255 | |
| 256 | #define MUTABLE_CAPTION_VARIABLEcxx . . $ `sys/EditorM.h:256:9`!(stringVariable) \ |
| 257 | static conststring32 stringVariable; |
| 258 | |
| 259 | #define MUTABLE_CAPTION_FIELDcxx . . $ `sys/EditorM.h:259:9`!(stringVariable, labelText) \ |
| 260 | UiForm_addCaption (cmd -> d_uiform.get(), & stringVariable, labelText); |
| 261 | |
| 262 | #define MUTABLE_CAPTIONcxx . . $ `sys/EditorM.h:262:9`!(stringVariable, labelText) \ |
| 263 | MUTABLE_CAPTION_VARIABLE (stringVariable) \ |
| 264 | MUTABLE_CAPTION_FIELD (stringVariable, labelText) |
| 265 | |
| 266 | |
| 267 | #define TEXTFIELD_VARIABLEcxx . . $ `sys/EditorM.h:267:9`!(stringVariable) \ |
| 268 | static conststring32 stringVariable; |
| 269 | |
| 270 | #define TEXTFIELD_FIELDcxx . . $ `sys/EditorM.h:270:9`!(stringVariable, labelText, defaultValue, numberOfLines) \ |
| 271 | UiForm_addText (cmd -> d_uiform.get(), & stringVariable, nullptr, labelText, defaultValue, numberOfLines); |
| 272 | |
| 273 | #define TEXTFIELDcxx . . $ `sys/EditorM.h:273:9`!(stringVariable, labelText, defaultValue, numberOfLines) \ |
| 274 | TEXTFIELD_VARIABLE (stringVariable) \ |
| 275 | TEXTFIELD_FIELD (stringVariable, labelText, defaultValue, numberOfLines) |
| 276 | |
| 277 | |
| 278 | #define FORMULA_VARIABLEcxx . . $ `sys/EditorM.h:278:9`!(stringVariable) \ |
| 279 | static conststring32 stringVariable; |
| 280 | |
| 281 | #define FORMULA_FIELDcxx . . $ `sys/EditorM.h:281:9`!(stringVariable, labelText, defaultValue) \ |
| 282 | UiForm_addFormula (cmd -> d_uiform.get(), & stringVariable, nullptr, labelText, defaultValue); |
| 283 | |
| 284 | #define FORMULAcxx . . $ `sys/EditorM.h:284:9`!(stringVariable, labelText, defaultValue) \ |
| 285 | FORMULA_VARIABLE (stringVariable) \ |
| 286 | FORMULA_FIELD (stringVariable, labelText, defaultValue) |
| 287 | |
| 288 | |
| 289 | #define INFILE_VARIABLEcxx . . $ `sys/EditorM.h:289:9`!(stringVariable) \ |
| 290 | static conststring32 stringVariable; |
| 291 | |
| 292 | #define INFILE_FIELDcxx . . $ `sys/EditorM.h:292:9`!(stringVariable, labelText, defaultValue) \ |
| 293 | UiForm_addInfile (cmd -> d_uiform.get(), & stringVariable, nullptr, labelText, defaultValue); |
| 294 | |
| 295 | #define INFILEcxx . . $ `sys/EditorM.h:295:9`!(stringVariable, labelText, defaultValue) \ |
| 296 | INFILE_VARIABLE (stringVariable) \ |
| 297 | INFILE_FIELD (stringVariable, labelText, defaultValue) |
| 298 | |
| 299 | |
| 300 | #define OUTFILE_VARIABLEcxx . . $ `sys/EditorM.h:300:9`!(stringVariable) \ |
| 301 | static conststring32 stringVariable; |
| 302 | |
| 303 | #define OUTFILE_FIELDcxx . . $ `sys/EditorM.h:303:9`!(stringVariable, labelText, defaultValue) \ |
| 304 | UiForm_addOutfile (cmd -> d_uiform.get(), & stringVariable, nullptr, labelText, defaultValue); |
| 305 | |
| 306 | #define OUTFILEcxx . . $ `sys/EditorM.h:306:9`!(stringVariable, labelText, defaultValue) \ |
| 307 | OUTFILE_VARIABLE (stringVariable) \ |
| 308 | OUTFILE_FIELD (stringVariable, labelText, defaultValue) |
| 309 | |
| 310 | |
| 311 | #define FOLDER_VARIABLEcxx . . $ `sys/EditorM.h:311:9`!(stringVariable) \ |
| 312 | static conststring32 stringVariable; |
| 313 | |
| 314 | #define FOLDER_FIELDcxx . . $ `sys/EditorM.h:314:9`!(stringVariable, labelText, defaultValue) \ |
| 315 | UiForm_addFolder (cmd -> d_uiform.get(), & stringVariable, nullptr, labelText, defaultValue); |
| 316 | |
| 317 | #define FOLDERcxx . . $ `sys/EditorM.h:317:9`!(stringVariable, labelText, defaultValue) \ |
| 318 | FOLDER_VARIABLE (stringVariable) \ |
| 319 | FOLDER_FIELD (stringVariable, labelText, defaultValue) |
| 320 | |
| 321 | |
| 322 | #define REALVECTOR_VARIABLEcxx . . $ `sys/EditorM.h:322:9`!(realVectorVariable) \ |
| 323 | static constVEC realVectorVariable; |
| 324 | |
| 325 | #define REALVECTOR_FIELDcxx . . $ `sys/EditorM.h:325:9`!(realVectorVariable, labelText, defaultFormat, defaultStringValue) \ |
| 326 | UiForm_addRealVector (cmd -> d_uiform.get(), & realVectorVariable, nullptr, labelText, kUi_realVectorFormat::defaultFormat, defaultStringValue); |
| 327 | |
| 328 | #define REALVECTORcxx . . $ `sys/EditorM.h:328:9`!(realVectorVariable, labelText, defaultFormat, defaultStringValue) \ |
| 329 | REALVECTOR_VARIABLE (realVectorVariable) \ |
| 330 | REALVECTOR_FIELD (realVectorVariable, labelText, defaultFormat, defaultStringValue) |
| 331 | |
| 332 | |
| 333 | #define NATURAL0VECTOR_VARIABLEcxx . . $ `sys/EditorM.h:333:9`!(integerVectorVariable) \ |
| 334 | static constINTVEC integerVectorVariable; |
| 335 | |
| 336 | #define NATURAL0VECTOR_FIELDcxx . . $ `sys/EditorM.h:336:9`!(integerVectorVariable, labelText, defaultFormat, defaultStringValue) \ |
| 337 | UiForm_addNatural0Vector (cmd -> d_uiform.get(), & integerVectorVariable, nullptr, labelText, kUi_integerVectorFormat::defaultFormat, defaultStringValue); |
| 338 | |
| 339 | #define NATURAL0VECTORcxx . . $ `sys/EditorM.h:339:9`!(integerVectorVariable, labelText, defaultFormat, defaultStringValue) \ |
| 340 | NATURAL0VECTOR_VARIABLE (integerVectorVariable) \ |
| 341 | NATURAL0VECTOR_FIELD (integerVectorVariable, labelText, defaultFormat, defaultStringValue) |
| 342 | |
| 343 | |
| 344 | #define NATURAL1VECTOR_VARIABLEcxx . . $ `sys/EditorM.h:344:9`!(integerVectorVariable) \ |
| 345 | static constINTVEC integerVectorVariable; |
| 346 | |
| 347 | #define NATURAL1VECTOR_FIELDcxx . . $ `sys/EditorM.h:347:9`!(integerVectorVariable, labelText, defaultFormat, defaultStringValue) \ |
| 348 | UiForm_addNatural1Vector (cmd -> d_uiform.get(), & integerVectorVariable, nullptr, labelText, kUi_integerVectorFormat::defaultFormat, defaultStringValue); |
| 349 | |
| 350 | #define NATURAL1VECTORcxx . . $ `sys/EditorM.h:350:9`!(integerVectorVariable, labelText, defaultFormat, defaultStringValue) \ |
| 351 | NATURAL1VECTOR_VARIABLE (integerVectorVariable) \ |
| 352 | NATURAL1VECTOR_FIELD (integerVectorVariable, labelText, defaultFormat, defaultStringValue) |
| 353 | |
| 354 | |
| 355 | #define CHOICE_VARIABLEcxx . . $ `sys/EditorM.h:355:9`!(optionVariable) \ |
| 356 | static int optionVariable; |
| 357 | |
| 358 | #define CHOICE_FIELDcxx . . $ `sys/EditorM.h:358:9`!(optionVariable, labelText, defaultValue) \ |
| 359 | UiForm_addChoice (cmd -> d_uiform.get(), & optionVariable, nullptr, nullptr, labelText, defaultValue, 1); |
| 360 | |
| 361 | #define CHOICEcxx . . $ `sys/EditorM.h:361:9`!(optionVariable, labelText, defaultValue) \ |
| 362 | CHOICE_VARIABLE (optionVariable) \ |
| 363 | CHOICE_FIELD (optionVariable, labelText, defaultValue) |
| 364 | |
| 365 | |
| 366 | #define CHOICESTRcxx . . $ `sys/EditorM.h:366:9`!(stringVariable, labelText, defaultValue) \ |
| 367 | static conststring32 stringVariable; \ |
| 368 | UiForm_addChoice (cmd -> d_uiform.get(), nullptr, & stringVariable, nullptr, labelText, defaultValue, 1); |
| 369 | |
| 370 | |
| 371 | #define OPTIONMENU_VARIABLEcxx . . $ `sys/EditorM.h:371:9`!(optionVariable) \ |
| 372 | static int optionVariable; |
| 373 | |
| 374 | #define OPTIONMENU_FIELDcxx . . $ `sys/EditorM.h:374:9`!(optionVariable, labelText, defaultValue) \ |
| 375 | UiForm_addOptionMenu (cmd -> d_uiform.get(), & optionVariable, nullptr, nullptr, labelText, defaultValue, 1); |
| 376 | |
| 377 | #define OPTIONMENUcxx . . $ `sys/EditorM.h:377:9`!(optionVariable, labelText, defaultValue) \ |
| 378 | OPTIONMENU_VARIABLE (optionVariable) \ |
| 379 | OPTIONMENU_FIELD(optionVariable, labelText, defaultValue) |
| 380 | |
| 381 | |
| 382 | #define OPTIONMENUSTRcxx . . $ `sys/EditorM.h:382:9`!(stringVariable, labelText, defaultValue) \ |
| 383 | static conststring32 stringVariable; \ |
| 384 | UiForm_addOptionMenu (cmd -> d_uiform.get(), nullptr, & stringVariable, nullptr, labelText, defaultValue, 1); |
| 385 | |
| 386 | |
| 387 | #define OPTIONcxx . . $ `sys/EditorM.h:387:9`!(labelText) \ |
| 388 | UiForm_addOption (cmd -> d_uiform.get(), labelText); |
| 389 | |
| 390 | |
| 391 | #define CHOICE_ENUM_VARIABLEcxx . . $ `sys/EditorM.h:391:9`!(EnumeratedType, enumeratedVariable) \ |
| 392 | static enum EnumeratedType enumeratedVariable; \ |
| 393 | |
| 394 | #define CHOICE_ENUM_FIELDcxx . . $ `sys/EditorM.h:394:9`!(EnumeratedType, enumeratedVariable, labelText, defaultValue) \ |
| 395 | {/* type checks */ \ |
| 396 | [[maybe_unused]] enum EnumeratedType _compilerTypeCheckDummy = defaultValue; \ |
| 397 | _compilerTypeCheckDummy = enumeratedVariable; \ |
| 398 | } \ |
| 399 | UiForm_addChoiceEnum (cmd -> d_uiform.get(), (int *) & enumeratedVariable, nullptr, nullptr, labelText, \ |
| 400 | (int) defaultValue - (int) EnumeratedType::MIN + 1, (int) EnumeratedType::MIN, \ |
| 401 | (enum_generic_getValue) EnumeratedType##_getValue \ |
| 402 | ); \ |
| 403 | for (int _ienum = (int) EnumeratedType::MIN; _ienum <= (int) EnumeratedType::MAX; _ienum ++) \ |
| 404 | UiForm_addOption (cmd -> d_uiform.get(), EnumeratedType##_getText ((enum EnumeratedType) _ienum)); \ |
| 405 | |
| 406 | #define CHOICE_ENUMcxx . . $ `sys/EditorM.h:406:9`!(EnumeratedType, enumeratedVariable, labelText, defaultValue) \ |
| 407 | CHOICE_ENUM_VARIABLE (EnumeratedType, enumeratedVariable) \ |
| 408 | CHOICE_ENUM_FIELD (EnumeratedType, enumeratedVariable, labelText, defaultValue) |
| 409 | |
| 410 | |
| 411 | #define OPTIONMENU_ENUM_VARIABLEcxx . . $ `sys/EditorM.h:411:9`!(EnumeratedType, enumeratedVariable) \ |
| 412 | static enum EnumeratedType enumeratedVariable; \ |
| 413 | |
| 414 | #define OPTIONMENU_ENUM_FIELDcxx . . $ `sys/EditorM.h:414:9`!(EnumeratedType, enumeratedVariable, labelText, defaultValue) \ |
| 415 | {/* type checks */ \ |
| 416 | [[maybe_unused]] enum EnumeratedType _compilerTypeCheckDummy = defaultValue; \ |
| 417 | _compilerTypeCheckDummy = enumeratedVariable; \ |
| 418 | } \ |
| 419 | UiForm_addOptionMenuEnum (cmd -> d_uiform.get(), (int *) & enumeratedVariable, nullptr, nullptr, labelText, \ |
| 420 | (int) defaultValue - (int) EnumeratedType::MIN + 1, (int) EnumeratedType::MIN, \ |
| 421 | (enum_generic_getValue) EnumeratedType##_getValue \ |
| 422 | ); \ |
| 423 | for (int _ienum = (int) EnumeratedType::MIN; _ienum <= (int) EnumeratedType::MAX; _ienum ++) \ |
| 424 | UiForm_addOption (cmd -> d_uiform.get(), EnumeratedType##_getText ((enum EnumeratedType) _ienum)); \ |
| 425 | |
| 426 | #define OPTIONMENU_ENUMcxx . . $ `sys/EditorM.h:426:9`!(EnumeratedType, enumeratedVariable, labelText, defaultValue) \ |
| 427 | OPTIONMENU_ENUM_VARIABLE (EnumeratedType, enumeratedVariable) \ |
| 428 | OPTIONMENU_ENUM_FIELD (EnumeratedType, enumeratedVariable, labelText, defaultValue) |
| 429 | |
| 430 | |
| 431 | /* |
| 432 | LIST will throw if the supplied string is not in the list. |
| 433 | */ |
| 434 | #define LISTcxx . . $ `sys/EditorM.h:434:9`!(integerVariable, labelText, strings, defaultOptionNumber) \ |
| 435 | static integer integerVariable; \ |
| 436 | UiForm_addList (cmd -> d_uiform.get(), & integerVariable, nullptr, U"" #integerVariable, \ |
| 437 | labelText, strings, defaultOptionNumber); |
| 438 | |
| 439 | /* |
| 440 | LISTSTR will throw if the supplied string is not in the list. |
| 441 | */ |
| 442 | #define LISTSTRcxx . . $ `sys/EditorM.h:442:9`!(stringVariable, labelText, strings, defaultOptionNumber) \ |
| 443 | static conststring32 stringVariable; \ |
| 444 | UiForm_addList (cmd -> d_uiform.get(), nullptr, & stringVariable, U"" #stringVariable, \ |
| 445 | labelText, strings, defaultOptionNumber); |
| 446 | |
| 447 | /* |
| 448 | If the supplied string is not in the list, LISTNUMSTR will return 0 as well as the supplied string, for later handling. |
| 449 | */ |
| 450 | #define LISTNUMSTRcxx . . $ `sys/EditorM.h:450:9`!(integerVariable, stringVariable, labelText, strings, defaultOptionNumber) \ |
| 451 | static integer integerVariable; \ |
| 452 | static conststring32 stringVariable; \ |
| 453 | UiForm_addList (cmd -> d_uiform.get(), & integerVariable, & stringVariable, U"" #stringVariable, \ |
| 454 | labelText, strings, defaultOptionNumber); |
| 455 | |
| 456 | /* |
| 457 | Seven optional functions to change the content of a field on the basis of the current |
| 458 | editor setting rather than on the basis of the factory default. |
| 459 | They are to be called between EDITOR_OK and EDITOR_DO. |
| 460 | */ |
| 461 | |
| 462 | #define SET_REALcxx . . $ `sys/EditorM.h:462:9`!(realVariable, realValue) \ |
| 463 | UiForm_setReal (cmd -> d_uiform.get(), & realVariable, realValue); |
| 464 | |
| 465 | #define SET_INTEGERcxx . . $ `sys/EditorM.h:465:9`!(integerVariable, integerValue) \ |
| 466 | UiForm_setInteger (cmd -> d_uiform.get(), & integerVariable, integerValue); |
| 467 | |
| 468 | #define SET_INTEGER_AS_STRINGcxx . . $ `sys/EditorM.h:468:9`!(integerVariable, stringValue) \ |
| 469 | UiForm_setIntegerAsString (cmd -> d_uiform.get(), & integerVariable, stringValue); |
| 470 | |
| 471 | #define SET_BOOLEANcxx . . $ `sys/EditorM.h:471:9`!(booleanVariable, booleanValue) \ |
| 472 | UiForm_setBoolean (cmd -> d_uiform.get(), & booleanVariable, booleanValue); |
| 473 | |
| 474 | #define SET_OPTIONcxx . . $ `sys/EditorM.h:474:9`!(optionVariable, optionValue) \ |
| 475 | UiForm_setOption (cmd -> d_uiform.get(), & optionVariable, optionValue); |
| 476 | |
| 477 | #define SET_STRINGcxx . . $ `sys/EditorM.h:477:9`!(stringVariable, stringValue) \ |
| 478 | UiForm_setString (cmd -> d_uiform.get(), & stringVariable, stringValue); |
| 479 | |
| 480 | #define SET_ENUMcxx . . $ `sys/EditorM.h:480:9`!(enumeratedVariable, EnumeratedType, enumeratedValue) \ |
| 481 | enumeratedVariable = enumeratedValue /* type check */; \ |
| 482 | UiForm_setOption (cmd -> d_uiform.get(), (int *) & enumeratedVariable, (int) enumeratedValue - (int) EnumeratedType::MIN + 1); |
| 483 | |
| 484 | #define SET_LISTcxx . . $ `sys/EditorM.h:484:9`!(integerVariable, stringVariable, strings, defaultValue) \ |
| 485 | UiForm_setList (cmd -> d_uiform.get(), & integerVariable, & stringVariable, strings, defaultValue); |
| 486 | |
| 487 | #define DIALOGcxx . . $ `sys/EditorM.h:487:9`! cmd -> d_uiform |
| 488 | |
| 489 | #define EDITOR_FORM_SAVEcxx . . $ `sys/EditorM.h:489:9`!(title, helpTitle) \ |
| 490 | if (! cmd -> d_uiform) { \ |
| 491 | cmd -> d_uiform = UiOutfile_createE (cmd, title, cmd -> itemTitle.get(), helpTitle); \ |
| 492 | } if (! _args_ && ! _sendingForm_ && ! _sendingString_) { char32 defaultName [300]; defaultName [0] = U'\0'; |
| 493 | #define EDITOR_DO_SAVEcxx . . $ `sys/EditorM.h:493:9`! \ |
| 494 | UiOutfile_do (cmd -> d_uiform.get(), defaultName); } else { MelderFile file; structMelderFile _file2 { }; \ |
| 495 | if (_args_) { \ |
| 496 | Melder_require (_narg_ == 1, \ |
| 497 | U"Command requires exactly 1 argument, the name of the file to write, instead of the given ", _narg_, U" arguments."); \ |
| 498 | Melder_require (_args_ [1]. which == Stackel_STRING, \ |
| 499 | U"The file name argument should be a string, not ", _args_ [1]. whichText(), U"."); \ |
| 500 | Melder_relativePathToFile (_args_ [1]. getString(), & _file2); \ |
| 501 | file = & _file2; \ |
| 502 | } else if (_sendingString_) { \ |
| 503 | Melder_relativePathToFile (_sendingString_, & _file2); \ |
| 504 | file = & _file2; \ |
| 505 | } else { \ |
| 506 | file = UiFile_getFile (cmd -> d_uiform.get()); \ |
| 507 | } |
| 508 | |
| 509 | #define EDITOR_FORM_READcxx . . $ `sys/EditorM.h:509:9`!(title, helpTitle) \ |
| 510 | if (! cmd -> d_uiform) { \ |
| 511 | cmd -> d_uiform = UiInfile_createE (cmd, title, cmd -> itemTitle.get(), helpTitle); \ |
| 512 | } if (! _args_ && ! _sendingForm_ && ! _sendingString_) { |
| 513 | #define EDITOR_DO_READcxx . . $ `sys/EditorM.h:513:9`! \ |
| 514 | UiInfile_do (cmd -> d_uiform.get()); } else { MelderFile file; structMelderFile _file2 { }; \ |
| 515 | if (_args_) { \ |
| 516 | Melder_require (_narg_ == 1, \ |
| 517 | U"Command requires exactly 1 argument, the name of the file to read, instead of the given ", _narg_, U" arguments."); \ |
| 518 | Melder_require (_args_ [1]. which == Stackel_STRING, \ |
| 519 | U"The file name argument should be a string, not ", _args_ [1]. whichText(), U"."); \ |
| 520 | Melder_relativePathToFile (_args_ [1]. getString(), & _file2); \ |
| 521 | file = & _file2; \ |
| 522 | } else if (_sendingString_) { \ |
| 523 | Melder_relativePathToFile (_sendingString_, & _file2); \ |
| 524 | file = & _file2; \ |
| 525 | } else { \ |
| 526 | file = UiFile_getFile (cmd -> d_uiform.get()); \ |
| 527 | } |
| 528 | |
| 529 | #define VOID_EDITORcxx . . $ `sys/EditorM.h:529:9`! |
| 530 | #define VOID_EDITOR_ENDcxx . . $ `sys/EditorM.h:530:9`! |
| 531 | |
| 532 | #define DATA_BEGIN__cxx . . $ `sys/EditorM.h:532:9`! \ |
| 533 | Melder_assert (my data()); |
| 534 | |
| 535 | #define PLAY_DATAcxx . . $ `sys/EditorM.h:535:9`! \ |
| 536 | DATA_BEGIN__ |
| 537 | #define PLAY_DATA_ENDcxx . . $ `sys/EditorM.h:537:9`! |
| 538 | |
| 539 | #define INFO_EDITORcxx . . $ `sys/EditorM.h:539:9`! |
| 540 | #define INFO_EDITOR_ENDcxx . . $ `sys/EditorM.h:540:9`! \ |
| 541 | if (optionalInterpreter) \ |
| 542 | optionalInterpreter -> returnType = kInterpreter_ReturnType::STRING_; |
| 543 | |
| 544 | #define INFO_DATAcxx . . $ `sys/EditorM.h:544:9`! \ |
| 545 | DATA_BEGIN__ |
| 546 | #define INFO_DATA_ENDcxx . . $ `sys/EditorM.h:546:9`! \ |
| 547 | if (optionalInterpreter) \ |
| 548 | optionalInterpreter -> returnType = kInterpreter_ReturnType::STRING_; |
| 549 | |
| 550 | #define FOR_REAL__cxx . . $ `sys/EditorM.h:550:9`!(...) \ |
| 551 | if (optionalInterpreter) \ |
| 552 | optionalInterpreter -> returnType = kInterpreter_ReturnType::REAL_; \ |
| 553 | Melder_information (result, __VA_ARGS__); |
| 554 | |
| 555 | #define FOR_INTEGER__cxx . . $ `sys/EditorM.h:555:9`!(...) \ |
| 556 | if (optionalInterpreter) \ |
| 557 | optionalInterpreter -> returnType = kInterpreter_ReturnType::INTEGER_; \ |
| 558 | Melder_information (double (result), __VA_ARGS__); |
| 559 | |
| 560 | #define FOR_BOOLEAN__cxx . . $ `sys/EditorM.h:560:9`!(...) \ |
| 561 | if (optionalInterpreter) \ |
| 562 | optionalInterpreter -> returnType = kInterpreter_ReturnType::BOOLEAN_; \ |
| 563 | Melder_information (double (result), __VA_ARGS__); |
| 564 | |
| 565 | #define FOR_COMPLEX__cxx . . $ `sys/EditorM.h:565:9`!(...) \ |
| 566 | if (optionalInterpreter) \ |
| 567 | optionalInterpreter -> returnType = kInterpreter_ReturnType::STRING_; /* TODO: make true complex types in script */ \ |
| 568 | Melder_information (result, __VA_ARGS__); |
| 569 | |
| 570 | #define FOR_STRING__cxx . . $ `sys/EditorM.h:570:9`! \ |
| 571 | if (optionalInterpreter) \ |
| 572 | optionalInterpreter -> returnType = kInterpreter_ReturnType::STRING_; \ |
| 573 | Melder_information (result); |
| 574 | |
| 575 | #define QUERY_EDITOR_FOR_REALcxx . . $ `sys/EditorM.h:575:9`! |
| 576 | #define QUERY_EDITOR_FOR_REAL_ENDcxx . . $ `sys/EditorM.h:576:9`!(...) \ |
| 577 | FOR_REAL__ (__VA_ARGS__) |
| 578 | |
| 579 | #define QUERY_EDITOR_FOR_INTEGERcxx . . $ `sys/EditorM.h:579:9`! |
| 580 | #define QUERY_EDITOR_FOR_INTEGER_ENDcxx . . $ `sys/EditorM.h:580:9`!(...) \ |
| 581 | FOR_INTEGER__ (__VA_ARGS__) |
| 582 | |
| 583 | #define QUERY_EDITOR_FOR_BOOLEANcxx . . $ `sys/EditorM.h:583:9`! |
| 584 | #define QUERY_EDITOR_FOR_BOOLEAN_ENDcxx . . $ `sys/EditorM.h:584:9`!(...) \ |
| 585 | FOR_BOOLEAN__ (__VA_ARGS__) |
| 586 | |
| 587 | #define QUERY_EDITOR_FOR_STRINGcxx . . $ `sys/EditorM.h:587:9`! |
| 588 | #define QUERY_EDITOR_FOR_STRING_ENDcxx . . $ `sys/EditorM.h:588:9`! \ |
| 589 | FOR_STRING__ |
| 590 | |
| 591 | #define QUERY_DATA_FOR_REALcxx . . $ `sys/EditorM.h:591:9`! \ |
| 592 | DATA_BEGIN__ |
| 593 | #define QUERY_DATA_FOR_REAL_ENDcxx . . $ `sys/EditorM.h:593:9`!(...) \ |
| 594 | FOR_REAL__ (__VA_ARGS__) |
| 595 | |
| 596 | #define QUERY_DATA_FOR_INTEGERcxx . . $ `sys/EditorM.h:596:9`! \ |
| 597 | DATA_BEGIN__ |
| 598 | #define QUERY_DATA_FOR_INTEGER_ENDcxx . . $ `sys/EditorM.h:598:9`!(...) \ |
| 599 | FOR_INTEGER__ (__VA_ARGS__) |
| 600 | |
| 601 | #define QUERY_DATA_FOR_BOOLEANcxx . . $ `sys/EditorM.h:601:9`! \ |
| 602 | DATA_BEGIN__ |
| 603 | #define QUERY_DATA_FOR_BOOLEAN_ENDcxx . . $ `sys/EditorM.h:603:9`!(...) \ |
| 604 | FOR_BOOLEAN__ (__VA_ARGS__) |
| 605 | |
| 606 | #define QUERY_DATA_FOR_STRINGcxx . . $ `sys/EditorM.h:606:9`! \ |
| 607 | DATA_BEGIN__ |
| 608 | #define QUERY_DATA_FOR_STRING_ENDcxx . . $ `sys/EditorM.h:608:9`! \ |
| 609 | FOR_STRING__ |
| 610 | |
| 611 | #define MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`!(undoTitle) \ |
| 612 | Editor_save (my boss(), undoTitle); |
| 613 | #define MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! \ |
| 614 | Editor_broadcastDataChanged (my boss()); |
| 615 | |
| 616 | #define CONVERT_DATA_TO_ONEcxx . . $ `sys/EditorM.h:616:9`! \ |
| 617 | DATA_BEGIN__ |
| 618 | #define CONVERT_DATA_TO_ONE_ENDcxx . . $ `sys/EditorM.h:618:9`!(...) \ |
| 619 | if (optionalInterpreter) \ |
| 620 | optionalInterpreter -> returnType = kInterpreter_ReturnType::OBJECT_; \ |
| 621 | Thing_setName (result.get(), __VA_ARGS__); \ |
| 622 | Editor_broadcastPublication (my boss(), result.move()); |
| 623 | |
| 624 | #define CREATE_ONEcxx . . $ `sys/EditorM.h:624:9`! |
| 625 | #define CREATE_ONE_ENDcxx . . $ `sys/EditorM.h:625:9`!(...) \ |
| 626 | if (optionalInterpreter) \ |
| 627 | optionalInterpreter -> returnType = kInterpreter_ReturnType::OBJECT_; \ |
| 628 | Thing_setName (result.get(), __VA_ARGS__); \ |
| 629 | Editor_broadcastPublication (my boss(), result.move()); |
| 630 | |
| 631 | #define HELPcxx . . $ `sys/EditorM.h:631:9`!(title) \ |
| 632 | Melder_help (title); |
| 633 | |
| 634 | /* End of file EditorM.h */ |
| 635 | #endif |