| 1 | /* praat_menuCommands.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2018,2020-2025 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 3 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 "praatP.h"cxx . . $ `<file>/sys/praatP.h`/ |
| 20 | #include "praat_script.h"cxx . . $ `<file>/sys/praat_script.h`/ |
| 21 | #include "GuiP.h"cxx . . $ `<file>/sys/GuiP.h`/ |
| 22 | |
| 23 | static OrderedOfcxx . . $ OrderedOf# <structPraat_Commandcxx . . $ structPraat_Command#> theCommandscxx . . $ theCommands.; |
| 24 | void praat_menuCommands_exit_optimizeByLeakingcxx . . $ praat_menuCommands_exit_optimizeByLeaking(49f6e7a06ebc5aa8). () { theCommandscxx . . $ theCommands.. _ownItemscxx . . $ CollectionOf#_ownItems. = false; } |
| 25 | |
| 26 | void praat_sortMenuCommandscxx . . $ praat_sortMenuCommands(49f6e7a06ebc5aa8). () { |
| 27 | for (integercxx . . $ integer# i = 1; i <= theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size.; i ++) { |
| 28 | Praat_Commandcxx . . $ Praat_Command# command = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 29 | command -> sortingTailcxx . . $ structPraat_Command#sortingTail. = i; |
| 30 | } |
| 31 | stdcxx . . $ std/::sortcxx . . $ std/sort(4d3091562df4e52e). (theCommandscxx . . $ theCommands..begincxx . . $ CollectionOf#begin(3871cfe815cb200).(), theCommandscxx . . $ theCommands..endcxx . . $ CollectionOf#end(3871cfe815cb200).(), |
| 32 | [] (Praat_Commandcxx . . $ Praat_Command# me, Praat_Commandcxx . . $ Praat_Command# thee) { |
| 33 | if (mycxx . . $ `melder/melder.h:44:9`! windowcxx . . $ structPraat_Command#window.) { |
| 34 | if (! thycxx . . $ `melder/melder.h:45:9`! windowcxx . . $ structPraat_Command#window.) |
| 35 | return false; |
| 36 | int compare = str32cmpcxx . . $ str32cmp(937dacc22d2a7919). (mycxx . . $ `melder/melder.h:44:9`! windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), thycxx . . $ `melder/melder.h:45:9`! windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 37 | if (compare != 0) |
| 38 | return compare < 0; |
| 39 | } else if (thycxx . . $ `melder/melder.h:45:9`! windowcxx . . $ structPraat_Command#window.) |
| 40 | return true; |
| 41 | if (mycxx . . $ `melder/melder.h:44:9`! menucxx . . $ structPraat_Command#menu.) { |
| 42 | if (! thycxx . . $ `melder/melder.h:45:9`! menucxx . . $ structPraat_Command#menu.) |
| 43 | return false; |
| 44 | int compare = str32cmpcxx . . $ str32cmp(937dacc22d2a7919). (mycxx . . $ `melder/melder.h:44:9`! menucxx . . $ structPraat_Command#menu..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), thycxx . . $ `melder/melder.h:45:9`! menucxx . . $ structPraat_Command#menu..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 45 | if (compare != 0) |
| 46 | return compare < 0; |
| 47 | } else if (thycxx . . $ `melder/melder.h:45:9`! menucxx . . $ structPraat_Command#menu.) |
| 48 | return true; |
| 49 | return mycxx . . $ `melder/melder.h:44:9`! sortingTailcxx . . $ structPraat_Command#sortingTail. < thycxx . . $ `melder/melder.h:45:9`! sortingTailcxx . . $ structPraat_Command#sortingTail.; |
| 50 | } |
| 51 | ); |
| 52 | } |
| 53 | |
| 54 | static integercxx . . $ integer# lookUpMatchingMenuCommand_0cxx . . $ lookUpMatchingMenuCommand_0(36900045abcf76c3). (conststring32cxx . . $ conststring32# window, conststring32cxx . . $ conststring32# menu, conststring32cxx . . $ conststring32# title) { |
| 55 | /* |
| 56 | A menu command is fully specified by its environment (window + menu) and its title. |
| 57 | */ |
| 58 | for (integercxx . . $ integer# i = 1; i <= theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size.; i ++) { |
| 59 | Praat_Commandcxx . . $ Praat_Command# command = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 60 | conststring32cxx . . $ conststring32# tryWindow = command -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(); |
| 61 | conststring32cxx . . $ conststring32# tryMenu = command -> menucxx . . $ structPraat_Command#menu..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(); |
| 62 | conststring32cxx . . $ conststring32# tryTitle = command -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(); |
| 63 | if ( |
| 64 | (window == tryWindow || (window && tryWindow && str32equcxx . . $ `melder/melder_str32.h:122:9`! (window, tryWindow))) && |
| 65 | (menu == tryMenu || (menu && tryMenu && str32equcxx . . $ `melder/melder_str32.h:122:9`! (menu, tryMenu))) && |
| 66 | (title == tryTitle || (title && tryTitle && str32equcxx . . $ `melder/melder_str32.h:122:9`! (title, tryTitle))) |
| 67 | ) |
| 68 | return i; |
| 69 | } |
| 70 | return 0; // not found |
| 71 | } |
| 72 | |
| 73 | static void do_menucxx . . $ do_menu(6ee09e51a76297e7). (Praat_Commandcxx . . $ Praat_Command# me, bool isModified) { |
| 74 | if (mycxx . . $ `melder/melder.h:44:9`! callbackcxx . . $ structPraat_Command#callback. == DO_RunTheScriptFromAnyAddedMenuCommandcxx . . $ DO_RunTheScriptFromAnyAddedMenuCommand(744a0abd3c8513c).) { |
| 75 | UiHistory_writecxx . . $ UiHistory_write(ff00d524ab0355ec). (U"\nrunScript: "); |
| 76 | try { |
| 77 | DO_RunTheScriptFromAnyAddedMenuCommandcxx . . $ DO_RunTheScriptFromAnyAddedMenuCommand(744a0abd3c8513c). (nullptr, 0, nullptr, mycxx . . $ `melder/melder.h:44:9`! scriptcxx . . $ structPraat_Command#script..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), nullptr, nullptr, false, nullptr, nullptr); |
| 78 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 79 | Melder_flushErrorcxx . . $ Melder_flushError(6298c93241566110). (U"Command \"", mycxx . . $ `melder/melder.h:44:9`! titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"\" not executed."); |
| 80 | } |
| 81 | praat_updateSelectioncxx . . $ praat_updateSelection(49f6e7a06ebc5aa8). (); |
| 82 | } else { |
| 83 | if (mycxx . . $ `melder/melder.h:44:9`! titlecxx . . $ structPraat_Command#title. && ! str32strcxx . . $ str32str(2de17cd8f7c584a6). (mycxx . . $ `melder/melder.h:44:9`! titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"...")) { |
| 84 | UiHistory_writecxx . . $ UiHistory_write(ff00d524ab0355ec). (U"\n"); |
| 85 | UiHistory_writecxx . . $ UiHistory_write(ff00d524ab0355ec). (mycxx . . $ `melder/melder.h:44:9`! titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 86 | } |
| 87 | try { |
| 88 | mycxx . . $ `melder/melder.h:44:9`! callbackcxx . . $ structPraat_Command#callback. (nullptr, 0, nullptr, nullptr, nullptr, mycxx . . $ `melder/melder.h:44:9`! titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), isModified, nullptr, nullptr); |
| 89 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 90 | Melder_flushErrorcxx . . $ Melder_flushError(6298c93241566110). (U"Command \"", mycxx . . $ `melder/melder.h:44:9`! titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"\" not executed."); |
| 91 | } |
| 92 | praat_updateSelectioncxx . . $ praat_updateSelection(49f6e7a06ebc5aa8). (); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | static void gui_button_cb_menucxx . . $ gui_button_cb_menu(914af3e9f2ef2bd2). (Praat_Commandcxx . . $ Praat_Command# me, GuiButtonEventcxx . . $ GuiButtonEvent# event) { |
| 97 | const bool isModified = event -> shiftKeyPressedcxx . . $ structGuiButtonEvent#shiftKeyPressed. || event -> commandKeyPressedcxx . . $ structGuiButtonEvent#commandKeyPressed. || event -> optionKeyPressedcxx . . $ structGuiButtonEvent#optionKeyPressed.; |
| 98 | do_menucxx . . $ do_menu(6ee09e51a76297e7). (me, isModified); |
| 99 | } |
| 100 | |
| 101 | static void gui_cb_menucxx . . $ gui_cb_menu(6d044108b20850e2). (Praat_Commandcxx . . $ Praat_Command# me, GuiMenuItemEventcxx . . $ GuiMenuItemEvent# event) { |
| 102 | const bool isModified = event -> shiftKeyPressedcxx . . $ structGuiMenuItemEvent#shiftKeyPressed. || event -> commandKeyPressedcxx . . $ structGuiMenuItemEvent#commandKeyPressed. || event -> optionKeyPressedcxx . . $ structGuiMenuItemEvent#optionKeyPressed.; |
| 103 | do_menucxx . . $ do_menu(6ee09e51a76297e7). (me, isModified); |
| 104 | } |
| 105 | |
| 106 | static GuiMenucxx . . $ GuiMenu# windowMenuToWidgetcxx . . $ windowMenuToWidget(16bb3ea2864a6a19). (conststring32cxx . . $ conststring32# window, conststring32cxx . . $ conststring32# menu) { |
| 107 | return |
| 108 | str32equcxx . . $ `melder/melder_str32.h:122:9`! (window, U"Picture") ? praat_picture_resolveMenucxx . . $ praat_picture_resolveMenu(b07c1ab83d47ef20). (menu) : |
| 109 | str32equcxx . . $ `melder/melder_str32.h:122:9`! (window, U"Objects") ? praat_objects_resolveMenucxx . . $ praat_objects_resolveMenu(b07c1ab83d47ef20). (menu) : nullptr; |
| 110 | } |
| 111 | |
| 112 | static GuiMenuItemcxx . . $ GuiMenuItem# praat_addMenuCommand__cxx . . $ praat_addMenuCommand__(36e798a1b8f9bedc). (conststring32cxx . . $ conststring32# window, conststring32cxx . . $ conststring32# menu, conststring32cxx . . $ conststring32# title /* cattable */, |
| 113 | conststring32cxx . . $ conststring32# after, uint32cxx . . $ uint32# flags, UiCallbackcxx . . $ UiCallback# callback, conststring32cxx . . $ conststring32# nameOfCallback) |
| 114 | { |
| 115 | uint32cxx . . $ uint32# depth = flags, key = 0; |
| 116 | bool unhidable = false, hidden = false, noApi = false, forceApi = false; |
| 117 | int deprecationYear = 0; |
| 118 | uint32cxx . . $ uint32# guiFlags = 0; |
| 119 | if (flags > 7) { |
| 120 | depth = (flags & GuiMenu_DEPTH_7cxx . . $ `sys/Gui.h:868:9`!) >> 16; |
| 121 | unhidable = (flags & GuiMenu_UNHIDABLEcxx . . $ `sys/Gui.h:870:9`!) != 0; |
| 122 | hidden = (flags & GuiMenu_HIDDENcxx . . $ `sys/Gui.h:869:9`!) != 0 && ! unhidable; |
| 123 | key = flags & 0x000000FF; |
| 124 | noApi = (flags & GuiMenu_NO_APIcxx . . $ `sys/Gui.h:871:9`!) != 0; |
| 125 | forceApi = (flags & GuiMenu_FORCE_APIcxx . . $ `sys/Gui.h:872:9`!) != 0; |
| 126 | deprecationYear = (flags & GuiMenu_DEPRECATEDcxx . . $ `sys/Gui.h:873:9`!) == GuiMenu_DEPRECATEDcxx . . $ `sys/Gui.h:873:9`! ? 2000 + (flags >> 24) : 0; |
| 127 | guiFlags = key ? flags & (0x000000FF | GuiMenu_SHIFTcxx . . $ `sys/Gui.h:811:9`! | GuiMenu_OPTIONcxx . . $ `sys/Gui.h:810:9`! | GuiMenu_BUTTON_STATE_MASKcxx . . $ `sys/Gui.h:859:9`!) : flags & GuiMenu_BUTTON_STATE_MASKcxx . . $ `sys/Gui.h:859:9`!; |
| 128 | } |
| 129 | if (callback && ! title) { |
| 130 | Melder_flushErrorcxx . . $ Melder_flushError(6298c93241566110). (U"praat_addMenuCommand: command with callback has no title. Window \"", window, U"\", menu \"", menu, U"\"."); |
| 131 | return nullptr; |
| 132 | } |
| 133 | |
| 134 | /* |
| 135 | Determine the position of the new command. |
| 136 | */ |
| 137 | integercxx . . $ integer# position; |
| 138 | if (after) { // search for existing command with same selection |
| 139 | const integercxx . . $ integer# found = lookUpMatchingMenuCommand_0cxx . . $ lookUpMatchingMenuCommand_0(36900045abcf76c3). (window, menu, after); |
| 140 | if (found == 0) { |
| 141 | Melder_flushErrorcxx . . $ Melder_flushError(6298c93241566110). (U"praat_addMenuCommand: the command \"", title, U"\" cannot be put after \"", after, U"\",\n" |
| 142 | U"in the menu \"", menu, U"\" in the window \"", window, U"\"\n" |
| 143 | U"because the latter command does not exist."); |
| 144 | return nullptr; |
| 145 | } |
| 146 | position = found + 1; // after 'after' |
| 147 | } else { |
| 148 | position = theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size. + 1; // at end |
| 149 | } |
| 150 | |
| 151 | /* |
| 152 | Make new command. |
| 153 | */ |
| 154 | autoPraat_Commandcxx . . $ autoPraat_Command# command = Thing_newcxx . . $ `sys/Thing.h:514:9`! (Praat_Command); |
| 155 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). windowcxx . . $ structPraat_Command#window. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dup_fcxx . . $ Melder_dup_f(87bf156b1f548402). (window); |
| 156 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). menucxx . . $ structPraat_Command#menu. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dup_fcxx . . $ Melder_dup_f(87bf156b1f548402). (menu); |
| 157 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). titlecxx . . $ structPraat_Command#title. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dup_fcxx . . $ Melder_dup_f(87bf156b1f548402). (title); |
| 158 | tracecxx . . $ `melder/melder_debug.h:60:10`! (U"insert new command \"", title, U"\""); |
| 159 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). depthcxx . . $ structPraat_Command#depth. = depth; |
| 160 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). callbackcxx . . $ structPraat_Command#callback. = callback; // null for a separator or cascade button |
| 161 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback. = nameOfCallback; |
| 162 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). executablecxx . . $ structPraat_Command#executable. = !! callback; |
| 163 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). scriptcxx . . $ structPraat_Command#script. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). autostring32cxx . . $ _autostring#_autostring(49f6e7a06ebc5aa8).(); |
| 164 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). hiddencxx . . $ structPraat_Command#hidden. = hidden; |
| 165 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). unhidablecxx . . $ structPraat_Command#unhidable. = unhidable; |
| 166 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). deprecationYearcxx . . $ structPraat_Command#deprecationYear. = deprecationYear; |
| 167 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). noApicxx . . $ structPraat_Command#noApi. = noApi; |
| 168 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). forceApicxx . . $ structPraat_Command#forceApi. = forceApi; |
| 169 | |
| 170 | if (! theCurrentPraatApplicationcxx . . $ theCurrentPraatApplication. -> batchcxx . . $ structPraatApplication#batch.) { |
| 171 | GuiMenucxx . . $ GuiMenu# parentMenu = nullptr; |
| 172 | |
| 173 | /* |
| 174 | WHERE TO PUT IT? |
| 175 | Determine parent menu widget. |
| 176 | This is not going to fail: |
| 177 | if 'depth' is inappropriate, the alleged subitem will be put in the top menu. |
| 178 | */ |
| 179 | if (depth == 0) { |
| 180 | /* |
| 181 | Put the new command in the window's top menu. |
| 182 | */ |
| 183 | parentMenu = windowMenuToWidgetcxx . . $ windowMenuToWidget(16bb3ea2864a6a19). (window, menu); |
| 184 | } else { |
| 185 | /* |
| 186 | Put the new command in a submenu. |
| 187 | The supermenu to put the new command in is the first menu that we find when going up. |
| 188 | */ |
| 189 | for (integercxx . . $ integer# parentPosition = position - 1; parentPosition > 0; parentPosition --) { |
| 190 | Praat_Commandcxx . . $ Praat_Command# parentCommand = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).parentPosition]; |
| 191 | if (parentCommand -> depthcxx . . $ structPraat_Command#depth. == depth - 1 && str32equcxx . . $ `melder/melder_str32.h:122:9`! (parentCommand -> menucxx . . $ structPraat_Command#menu..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). menucxx . . $ structPraat_Command#menu..getcxx . . $ _autostring#get(5a2a78a048fb49a8).())) { |
| 192 | /* |
| 193 | We found the supermenu. |
| 194 | */ |
| 195 | if (! parentCommand -> callbackcxx . . $ structPraat_Command#callback. && parentCommand -> titlecxx . . $ structPraat_Command#title. && parentCommand -> titlecxx . . $ structPraat_Command#title. [cxx . . $ _autostring#`operator[]`(b190d49faf30c5be).0] != U'-') { |
| 196 | if (! parentCommand -> buttoncxx . . $ structPraat_Command#button.) |
| 197 | Melder_crashcxx . . $ `melder/melder_error.h:98:9`! (U"No button for ", window, U"/", menu, U"/", title, U"."); |
| 198 | Thing_castcxx . . $ `sys/Thing.h:246:9`! (GuiMenuItem, parentButton_as_GuiMenuItem, parentCommand -> button); |
| 199 | parentMenu = parentButton_as_GuiMenuItem -> d_menucxx . . $ structGuiMenuItem#d_menu.; |
| 200 | } |
| 201 | break; |
| 202 | } |
| 203 | } |
| 204 | if (! parentMenu) |
| 205 | parentMenu = windowMenuToWidgetcxx . . $ windowMenuToWidget(16bb3ea2864a6a19). (window, menu); // fallback: put the command in the window's top menu |
| 206 | } |
| 207 | if (! parentMenu) { |
| 208 | tracecxx . . $ `melder/melder_debug.h:60:10`! (U"WARNING: no parent menu for ", window, U"/", menu, U"/", title, U"."); |
| 209 | return nullptr; |
| 210 | } |
| 211 | |
| 212 | /* |
| 213 | WHAT TO PUT THERE? |
| 214 | */ |
| 215 | if (! title || title [0] == U'-') { |
| 216 | tracecxx . . $ `melder/melder_debug.h:60:10`! (U"insert the command as a separator"); |
| 217 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). buttoncxx . . $ structPraat_Command#button. = GuiMenu_addSeparatorcxx . . $ GuiMenu_addSeparator(d5bd5aafbfbb56aa). (parentMenu); |
| 218 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (command -> button); |
| 219 | } else if (! callback) { |
| 220 | tracecxx . . $ `melder/melder_debug.h:60:10`! (U"insert the command as a submenu"); |
| 221 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). buttoncxx . . $ structPraat_Command#button. = GuiMenu_createInMenucxx . . $ GuiMenu_createInMenu(d27ae244131fab25). (parentMenu, title, 0) -> d_menuItemcxx . . $ structGuiMenu#d_menuItem..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(); |
| 222 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (command -> button); |
| 223 | } else { |
| 224 | tracecxx . . $ `melder/melder_debug.h:60:10`! (U"insert the command as a normal menu item"); |
| 225 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). buttoncxx . . $ structPraat_Command#button. = GuiMenu_addItemcxx . . $ GuiMenu_addItem(c4b605a971e4b555). (parentMenu, title, guiFlags, gui_cb_menucxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., command.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 226 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (command -> button); |
| 227 | } |
| 228 | if (hidden) |
| 229 | GuiThing_hidecxx . . $ GuiThing_hide(20e88c25f0ba841). (command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). buttoncxx . . $ structPraat_Command#button.); |
| 230 | } |
| 231 | Thing_castcxx . . $ `sys/Thing.h:246:9`! (GuiMenuItem, button_as_GuiMenuItem, command -> button); |
| 232 | theCommandscxx . . $ theCommands.. addItemAtPosition_movecxx . . $ OrderedOf#addItemAtPosition_move(ca501a207ce7a6c1). (commandcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).(), position); |
| 233 | return button_as_GuiMenuItem; |
| 234 | } |
| 235 | GuiMenuItemcxx . . $ GuiMenuItem# praat_addMenuCommand_cxx . . $ praat_addMenuCommand_(36e798a1b8f9bedc). (conststring32cxx . . $ conststring32# window, conststring32cxx . . $ conststring32# menu, conststring32cxx . . $ conststring32# title /* cattable */, |
| 236 | conststring32cxx . . $ conststring32# after, uint32cxx . . $ uint32# flags, UiCallbackcxx . . $ UiCallback# callback, conststring32cxx . . $ conststring32# nameOfCallback) |
| 237 | { |
| 238 | const char32cxx . . $ char32# *pSeparator = str32strcxx . . $ str32str(2de17cd8f7c584a6). (title, U" || "); |
| 239 | if (! pSeparator) |
| 240 | return praat_addMenuCommand__cxx . . $ praat_addMenuCommand__(36e798a1b8f9bedc). (window, menu, title, after, flags, callback, nameOfCallback); |
| 241 | if (flags < 8) |
| 242 | flags *= GuiMenu_DEPTH_1cxx . . $ `sys/Gui.h:862:9`!; // turn 1..7 into GuiMenu_DEPTH_1..GuiMenu_DEPTH_7, because the flags are ORed below |
| 243 | integercxx . . $ integer# positionOfSeparator = pSeparator - title; |
| 244 | static MelderStringcxx . . $ MelderString# string; |
| 245 | MelderString_copycxx . . $ MelderString_copy(65be51a793e0ff96). (& string, title); |
| 246 | char32cxx . . $ char32# *pTitle = & string.stringcxx . . $ MelderString#string. [0]; |
| 247 | GuiMenuItemcxx . . $ GuiMenuItem# result = nullptr; |
| 248 | do { |
| 249 | pTitle [positionOfSeparator] = U'\0'; |
| 250 | GuiMenuItemcxx . . $ GuiMenuItem# menuItem = praat_addMenuCommand__cxx . . $ praat_addMenuCommand__(36e798a1b8f9bedc). (window, menu, pTitle, after, flags, callback, nameOfCallback); |
| 251 | if (menuItem) |
| 252 | result = menuItem; // only the first |
| 253 | pTitle += positionOfSeparator + 4; // step past " || " |
| 254 | pSeparator = str32strcxx . . $ str32str(2de17cd8f7c584a6). (pTitle, U" || "); |
| 255 | if (pSeparator) |
| 256 | positionOfSeparator = pSeparator - pTitle; |
| 257 | flags |= GuiMenu_HIDDENcxx . . $ `sys/Gui.h:869:9`!; |
| 258 | } while (pSeparator); |
| 259 | (void) praat_addMenuCommand__cxx . . $ praat_addMenuCommand__(36e798a1b8f9bedc). (window, menu, pTitle, after, flags | GuiMenu_HIDDENcxx . . $ `sys/Gui.h:869:9`!, callback, nameOfCallback); |
| 260 | return result; |
| 261 | } |
| 262 | |
| 263 | void praat_addMenuCommandScriptcxx . . $ praat_addMenuCommandScript(ce2dc7cf61cce937). (conststring32cxx . . $ conststring32# window, conststring32cxx . . $ conststring32# menu, conststring32cxx . . $ conststring32# title, |
| 264 | conststring32cxx . . $ conststring32# after, integercxx . . $ integer# depth, conststring32cxx . . $ conststring32# script) |
| 265 | { |
| 266 | try { |
| 267 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (window && menu && title && after && script); |
| 268 | if (script [0] != U'\0' && title [0] == U'\0') |
| 269 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Command with script has no title. Window \"", window, U"\", menu \"", menu, U"\"."); |
| 270 | |
| 271 | /* |
| 272 | Determine the position of the new command. |
| 273 | */ |
| 274 | integercxx . . $ integer# position; |
| 275 | if (Melder_lengthcxx . . $ Melder_length(3fae411214b133ad). (after)) { // search for existing command with same selection |
| 276 | const integercxx . . $ integer# found = lookUpMatchingMenuCommand_0cxx . . $ lookUpMatchingMenuCommand_0(36900045abcf76c3). (window, menu, after); |
| 277 | if (found == 0) { |
| 278 | /*Melder_throw (U"The menu command \"", title, U"\" cannot be put after \"", after, U"\",\n" |
| 279 | U"in the menu \"", menu, "\" in the window \"", window, U"\"\n" |
| 280 | U"because the latter command does not exist.");*/ |
| 281 | position = theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size. + 1; // default: at end |
| 282 | } else |
| 283 | position = found + 1; // after 'after' |
| 284 | } else { |
| 285 | position = theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size. + 1; // at end |
| 286 | } |
| 287 | |
| 288 | /* |
| 289 | Make new command. |
| 290 | */ |
| 291 | autoPraat_Commandcxx . . $ autoPraat_Command# command = Thing_newcxx . . $ `sys/Thing.h:514:9`! (Praat_Command); |
| 292 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). windowcxx . . $ structPraat_Command#window. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dup_fcxx . . $ Melder_dup_f(87bf156b1f548402). (window); |
| 293 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). menucxx . . $ structPraat_Command#menu. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dup_fcxx . . $ Melder_dup_f(87bf156b1f548402). (menu); |
| 294 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). titlecxx . . $ structPraat_Command#title. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). ( title [0] != U'\0' ? Melder_dup_fcxx . . $ Melder_dup_f(87bf156b1f548402). (title) : autostring32cxx . . $ _autostring#_autostring(49f6e7a06ebc5aa8).() ); // allow old-fashioned untitled separators |
| 295 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). depthcxx . . $ structPraat_Command#depth. = depth; |
| 296 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). callbackcxx . . $ structPraat_Command#callback. = ( script [0] != U'\0' ? DO_RunTheScriptFromAnyAddedMenuCommandcxx . . $ DO_RunTheScriptFromAnyAddedMenuCommand(744a0abd3c8513c). : nullptr ); // null for a separator or cascade button |
| 297 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). executablecxx . . $ structPraat_Command#executable. = ( script [0] != U'\0' ); |
| 298 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). noApicxx . . $ structPraat_Command#noApi. = true; |
| 299 | if (script [0] == U'\0') { |
| 300 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). scriptcxx . . $ structPraat_Command#script. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dup_fcxx . . $ Melder_dup_f(87bf156b1f548402). (U""); // empty string, which will be needed to signal origin |
| 301 | } else { |
| 302 | structMelderFilecxx . . $ structMelderFile# file { }; |
| 303 | Melder_relativePathToFilecxx . . $ Melder_relativePathToFile(82691f2ee21fbb13). (script, & file); |
| 304 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). scriptcxx . . $ structPraat_Command#script. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dup_fcxx . . $ Melder_dup_f(87bf156b1f548402). (MelderFile_peekPathcxx . . $ MelderFile_peekPath(d9f043369fa9b55b). (& file)); |
| 305 | } |
| 306 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). aftercxx . . $ structPraat_Command#after. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). ( after [0] != U'\0' ? Melder_dup_fcxx . . $ Melder_dup_f(87bf156b1f548402). (after) : autostring32cxx . . $ _autostring#_autostring(49f6e7a06ebc5aa8).() ); |
| 307 | if (praatPcxx . . $ praatP..phasecxx . . $ PraatP#phase. >= praat_READING_BUTTONScxx . . $ `sys/praatP.h:95:9`!) { |
| 308 | static integercxx . . $ integer# uniqueID = 0; |
| 309 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). uniqueIDcxx . . $ structPraat_Command#uniqueID. = ++ uniqueID; |
| 310 | } |
| 311 | |
| 312 | if (! theCurrentPraatApplicationcxx . . $ theCurrentPraatApplication. -> batchcxx . . $ structPraatApplication#batch.) { |
| 313 | GuiMenucxx . . $ GuiMenu# parentMenu = nullptr; |
| 314 | |
| 315 | /* |
| 316 | WHERE TO PUT IT? |
| 317 | Determine parent menu widget. |
| 318 | This is not going to fail: |
| 319 | if 'depth' is inappropriate, the alleged subitem will be put in the top menu. |
| 320 | */ |
| 321 | if (depth == 0) { |
| 322 | parentMenu = windowMenuToWidgetcxx . . $ windowMenuToWidget(16bb3ea2864a6a19). (window, menu); // not a subitem: in the top menu |
| 323 | } else { |
| 324 | for (integercxx . . $ integer# parentPosition = position - 1; parentPosition > 0; parentPosition --) { |
| 325 | Praat_Commandcxx . . $ Praat_Command# parentCommand = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).parentPosition]; |
| 326 | if (parentCommand -> depthcxx . . $ structPraat_Command#depth. == depth - 1) { |
| 327 | if (! parentCommand -> callbackcxx . . $ structPraat_Command#callback. && parentCommand -> titlecxx . . $ structPraat_Command#title. && parentCommand -> titlecxx . . $ structPraat_Command#title. [cxx . . $ _autostring#`operator[]`(b190d49faf30c5be).0] != U'-') { |
| 328 | if (! parentCommand -> buttoncxx . . $ structPraat_Command#button.) |
| 329 | Melder_crashcxx . . $ `melder/melder_error.h:98:9`! (U"No button for ", window, U"/", menu, U"/", title, U"."); |
| 330 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (parentCommand -> button -> classInfo == classGuiMenuItem); |
| 331 | parentMenu = (static_cast <GuiMenuItemcxx . . $ GuiMenuItem#> (parentCommand -> buttoncxx . . $ structPraat_Command#button.)) -> d_menucxx . . $ structGuiMenuItem#d_menu.; |
| 332 | } |
| 333 | break; |
| 334 | } |
| 335 | } |
| 336 | if (! parentMenu) |
| 337 | parentMenu = windowMenuToWidgetcxx . . $ windowMenuToWidget(16bb3ea2864a6a19). (window, menu); // fallback: a subitem without a menu title |
| 338 | } |
| 339 | if (parentMenu) { |
| 340 | /* |
| 341 | WHAT TO PUT THERE? |
| 342 | */ |
| 343 | if (title [0] == U'\0' || title [0] == U'-') { |
| 344 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). buttoncxx . . $ structPraat_Command#button. = GuiMenu_addSeparatorcxx . . $ GuiMenu_addSeparator(d5bd5aafbfbb56aa). (parentMenu); |
| 345 | } else if (script [0] == U'\0') { |
| 346 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). buttoncxx . . $ structPraat_Command#button. = GuiMenu_createInMenucxx . . $ GuiMenu_createInMenu(d27ae244131fab25). (parentMenu, Melder_catcxx . . $ Melder_cat(7fbf27f4d367f442). (U"\u207A", title), 0) -> d_menuItemcxx . . $ structGuiMenu#d_menuItem..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(); |
| 347 | } else { |
| 348 | command ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). buttoncxx . . $ structPraat_Command#button. = GuiMenu_addItemcxx . . $ GuiMenu_addItem(c4b605a971e4b555). (parentMenu, Melder_catcxx . . $ Melder_cat(7fbf27f4d367f442). (U"\u207A", title), 0, gui_cb_menucxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., command.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | theCommandscxx . . $ theCommands.. addItemAtPosition_movecxx . . $ OrderedOf#addItemAtPosition_move(ca501a207ce7a6c1). (commandcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).(), position); |
| 353 | |
| 354 | if (praatPcxx . . $ praatP..phasecxx . . $ PraatP#phase. >= praat_HANDLING_EVENTScxx . . $ `sys/praatP.h:96:9`!) |
| 355 | praat_sortMenuCommandscxx . . $ praat_sortMenuCommands(49f6e7a06ebc5aa8). (); |
| 356 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 357 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Script menu command not added."); |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | void praat_hideMenuCommandcxx . . $ praat_hideMenuCommand(b6693f37175431d7). (conststring32cxx . . $ conststring32# window, conststring32cxx . . $ conststring32# menu, conststring32cxx . . $ conststring32# title) { |
| 362 | if (theCurrentPraatApplicationcxx . . $ theCurrentPraatApplication. -> batchcxx . . $ structPraatApplication#batch. || ! window || ! menu || ! title) |
| 363 | return; |
| 364 | const integercxx . . $ integer# found = lookUpMatchingMenuCommand_0cxx . . $ lookUpMatchingMenuCommand_0(36900045abcf76c3). (window, menu, title); |
| 365 | if (found == 0) |
| 366 | return; |
| 367 | Praat_Commandcxx . . $ Praat_Command# command = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).found]; |
| 368 | if (! command -> hiddencxx . . $ structPraat_Command#hidden. && ! command -> unhidablecxx . . $ structPraat_Command#unhidable.) { |
| 369 | command -> hiddencxx . . $ structPraat_Command#hidden. = true; |
| 370 | if (praatPcxx . . $ praatP..phasecxx . . $ PraatP#phase. >= praat_READING_BUTTONScxx . . $ `sys/praatP.h:95:9`!) |
| 371 | command -> toggledcxx . . $ structPraat_Command#toggled. = ! command -> toggledcxx . . $ structPraat_Command#toggled.; |
| 372 | if (command -> buttoncxx . . $ structPraat_Command#button.) |
| 373 | GuiThing_hidecxx . . $ GuiThing_hide(20e88c25f0ba841). (command -> buttoncxx . . $ structPraat_Command#button.); |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | void praat_showMenuCommandcxx . . $ praat_showMenuCommand(b6693f37175431d7). (conststring32cxx . . $ conststring32# window, conststring32cxx . . $ conststring32# menu, conststring32cxx . . $ conststring32# title) { |
| 378 | if (theCurrentPraatApplicationcxx . . $ theCurrentPraatApplication. -> batchcxx . . $ structPraatApplication#batch. || ! window || ! menu || ! title) |
| 379 | return; |
| 380 | const integercxx . . $ integer# found = lookUpMatchingMenuCommand_0cxx . . $ lookUpMatchingMenuCommand_0(36900045abcf76c3). (window, menu, title); |
| 381 | if (found == 0) |
| 382 | return; |
| 383 | Praat_Commandcxx . . $ Praat_Command# command = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).found]; |
| 384 | if (command -> hiddencxx . . $ structPraat_Command#hidden.) { |
| 385 | command -> hiddencxx . . $ structPraat_Command#hidden. = false; |
| 386 | if (praatPcxx . . $ praatP..phasecxx . . $ PraatP#phase. >= praat_READING_BUTTONScxx . . $ `sys/praatP.h:95:9`!) |
| 387 | command -> toggledcxx . . $ structPraat_Command#toggled. = ! command -> toggledcxx . . $ structPraat_Command#toggled.; |
| 388 | if (command -> buttoncxx . . $ structPraat_Command#button.) |
| 389 | GuiThing_showcxx . . $ GuiThing_show(20e88c25f0ba841). (command -> buttoncxx . . $ structPraat_Command#button.); |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | void praat_saveAddedMenuCommandscxx . . $ praat_saveAddedMenuCommands(93db1090f27e5462). (MelderStringcxx . . $ MelderString# *buffer) { |
| 394 | /* |
| 395 | The procedure as it is now, runs in M*N time, |
| 396 | where M is the number of added commands and N is the total number of commands. |
| 397 | Sorting first instead runs in N log N time and will therefore be faster if M >> log N ≈ 10. |
| 398 | */ |
| 399 | integercxx . . $ integer# maxID = 0; |
| 400 | for (integercxx . . $ integer# i = 1; i <= theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size.; i ++) { |
| 401 | Praat_Commandcxx . . $ Praat_Command# command = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 402 | if (command -> uniqueIDcxx . . $ structPraat_Command#uniqueID. > maxID) |
| 403 | maxID = command -> uniqueIDcxx . . $ structPraat_Command#uniqueID.; |
| 404 | } |
| 405 | for (integercxx . . $ integer# id = 1; id <= maxID; id ++) // sorted |
| 406 | for (integercxx . . $ integer# i = 1; i <= theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size.; i ++) { |
| 407 | Praat_Commandcxx . . $ Praat_Command# me = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 408 | if (mycxx . . $ `melder/melder.h:44:9`! uniqueIDcxx . . $ structPraat_Command#uniqueID. == id && ! mycxx . . $ `melder/melder.h:44:9`! hiddencxx . . $ structPraat_Command#hidden. && mycxx . . $ `melder/melder.h:44:9`! windowcxx . . $ structPraat_Command#window. && mycxx . . $ `melder/melder.h:44:9`! menucxx . . $ structPraat_Command#menu. && mycxx . . $ `melder/melder.h:44:9`! titlecxx . . $ structPraat_Command#title.) { |
| 409 | MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (buffer, U"Add menu command... \"", mycxx . . $ `melder/melder.h:44:9`! windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"\" \"", mycxx . . $ `melder/melder.h:44:9`! menucxx . . $ structPraat_Command#menu..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"\" \"", mycxx . . $ `melder/melder.h:44:9`! titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"\" \"", |
| 410 | ( mycxx . . $ `melder/melder.h:44:9`! aftercxx . . $ structPraat_Command#after. ? mycxx . . $ `melder/melder.h:44:9`! aftercxx . . $ structPraat_Command#after..getcxx . . $ _autostring#get(5a2a78a048fb49a8).() : U"" ), U"\" ", mycxx . . $ `melder/melder.h:44:9`! depthcxx . . $ structPraat_Command#depth., U" ", ( mycxx . . $ `melder/melder.h:44:9`! scriptcxx . . $ structPraat_Command#script. ? mycxx . . $ `melder/melder.h:44:9`! scriptcxx . . $ structPraat_Command#script..getcxx . . $ _autostring#get(5a2a78a048fb49a8).() : U"" ), U"\n"); |
| 411 | break; |
| 412 | } |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | void praat_saveToggledMenuCommandscxx . . $ praat_saveToggledMenuCommands(93db1090f27e5462). (MelderStringcxx . . $ MelderString# *buffer) { |
| 417 | for (integercxx . . $ integer# i = 1; i <= theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size.; i ++) { |
| 418 | Praat_Commandcxx . . $ Praat_Command# me = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 419 | if (mycxx . . $ `melder/melder.h:44:9`! toggledcxx . . $ structPraat_Command#toggled. && mycxx . . $ `melder/melder.h:44:9`! windowcxx . . $ structPraat_Command#window. && mycxx . . $ `melder/melder.h:44:9`! menucxx . . $ structPraat_Command#menu. && mycxx . . $ `melder/melder.h:44:9`! titlecxx . . $ structPraat_Command#title. && ! mycxx . . $ `melder/melder.h:44:9`! uniqueIDcxx . . $ structPraat_Command#uniqueID. && ! mycxx . . $ `melder/melder.h:44:9`! scriptcxx . . $ structPraat_Command#script.) |
| 420 | MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (buffer, mycxx . . $ `melder/melder.h:44:9`! hiddencxx . . $ structPraat_Command#hidden. ? U"Hide" : U"Show", U" menu command... \"", |
| 421 | mycxx . . $ `melder/melder.h:44:9`! windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"\" \"", mycxx . . $ `melder/melder.h:44:9`! menucxx . . $ structPraat_Command#menu..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"\" ", mycxx . . $ `melder/melder.h:44:9`! titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"\n"); |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | /***** FIXED BUTTONS *****/ |
| 426 | |
| 427 | void praat_addFixedButtonCommand_cxx . . $ praat_addFixedButtonCommand_(77077bbeb1d2048a). (GuiFormcxx . . $ GuiForm# parent, conststring32cxx . . $ conststring32# title, UiCallbackcxx . . $ UiCallback# callback, conststring32cxx . . $ conststring32# nameOfCallback, int x, int y) { |
| 428 | autoPraat_Commandcxx . . $ autoPraat_Command# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (Praat_Command); |
| 429 | mycxx . . $ `melder/melder.h:44:9`! windowcxx . . $ structPraat_Command#window. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dup_fcxx . . $ Melder_dup_f(87bf156b1f548402). (U"Objects"); |
| 430 | mycxx . . $ `melder/melder.h:44:9`! titlecxx . . $ structPraat_Command#title. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dup_fcxx . . $ Melder_dup_f(87bf156b1f548402). (title); |
| 431 | mycxx . . $ `melder/melder.h:44:9`! callbackcxx . . $ structPraat_Command#callback. = callback; |
| 432 | mycxx . . $ `melder/melder.h:44:9`! nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback. = nameOfCallback; |
| 433 | mycxx . . $ `melder/melder.h:44:9`! unhidablecxx . . $ structPraat_Command#unhidable. = true; |
| 434 | mycxx . . $ `melder/melder.h:44:9`! noApicxx . . $ structPraat_Command#noApi. = ( str32equcxx . . $ `melder/melder_str32.h:122:9`! (title, U"Inspect") ); |
| 435 | if (theCurrentPraatApplicationcxx . . $ theCurrentPraatApplication. -> batchcxx . . $ structPraatApplication#batch.) { |
| 436 | mycxx . . $ `melder/melder.h:44:9`! buttoncxx . . $ structPraat_Command#button. = nullptr; |
| 437 | } else { |
| 438 | GuiThingcxx . . $ GuiThing# button = mycxx . . $ `melder/melder.h:44:9`! buttoncxx . . $ structPraat_Command#button. = GuiButton_createcxx . . $ GuiButton_create(653ed9987c16d9c1). (parent, x, x + 82, -y - Gui_PUSHBUTTON_HEIGHTcxx . . $ `sys/Gui.h:103:9`!, -y, |
| 439 | title, gui_button_cb_menucxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0); |
| 440 | GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (button, false); |
| 441 | GuiThing_showcxx . . $ GuiThing_show(20e88c25f0ba841). (button); |
| 442 | } |
| 443 | mycxx . . $ `melder/melder.h:44:9`! executablecxx . . $ structPraat_Command#executable. = false; |
| 444 | theCommandscxx . . $ theCommands.. addItemAtPosition_movecxx . . $ OrderedOf#addItemAtPosition_move(ca501a207ce7a6c1). (mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).(), 0); |
| 445 | } |
| 446 | |
| 447 | void praat_sensitivizeFixedButtonCommandcxx . . $ praat_sensitivizeFixedButtonCommand(7004b68cc6c23ea2). (conststring32cxx . . $ conststring32# title, bool sensitive) { |
| 448 | Praat_Commandcxx . . $ Praat_Command# commandFound = nullptr; |
| 449 | for (integercxx . . $ integer# i = 1; i <= theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size.; i ++) { |
| 450 | Praat_Commandcxx . . $ Praat_Command# command = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 451 | if (str32equcxx . . $ `melder/melder_str32.h:122:9`! (command -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), title)) { |
| 452 | commandFound = command; |
| 453 | break; |
| 454 | } |
| 455 | } |
| 456 | if (! commandFound) |
| 457 | Melder_crashcxx . . $ `melder/melder_error.h:98:9`! (U"Unkown fixed button <<", title, U">>"); |
| 458 | commandFound -> executablecxx . . $ structPraat_Command#executable. = sensitive; |
| 459 | if (! theCurrentPraatApplicationcxx . . $ theCurrentPraatApplication. -> batchcxx . . $ structPraatApplication#batch. && ! Melder_backgroundingcxx . . $ Melder_backgrounding.) |
| 460 | GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (commandFound -> buttoncxx . . $ structPraat_Command#button., sensitive); |
| 461 | } |
| 462 | |
| 463 | int praat_doMenuCommandcxx . . $ praat_doMenuCommand(3dcbaa6862792959). (conststring32cxx . . $ conststring32# title, conststring32cxx . . $ conststring32# arguments, Interpretercxx . . $ Interpreter# interpreter) { |
| 464 | Praat_Commandcxx . . $ Praat_Command# commandFound = nullptr; |
| 465 | for (integercxx . . $ integer# i = 1; i <= theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size.; i ++) { |
| 466 | Praat_Commandcxx . . $ Praat_Command# command = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 467 | if (command -> executablecxx . . $ structPraat_Command#executable. && str32equcxx . . $ `melder/melder_str32.h:122:9`! (command -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), title) && |
| 468 | (str32equcxx . . $ `melder/melder_str32.h:122:9`! (command -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"Objects") || str32equcxx . . $ `melder/melder_str32.h:122:9`! (command -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"Picture"))) |
| 469 | { |
| 470 | commandFound = command; |
| 471 | break; |
| 472 | } |
| 473 | } |
| 474 | if (! commandFound) |
| 475 | return 0; |
| 476 | if (commandFound -> callbackcxx . . $ structPraat_Command#callback. == DO_RunTheScriptFromAnyAddedMenuCommandcxx . . $ DO_RunTheScriptFromAnyAddedMenuCommand(744a0abd3c8513c).) { |
| 477 | const conststring32cxx . . $ conststring32# scriptPath = commandFound -> scriptcxx . . $ structPraat_Command#script..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(); |
| 478 | const conststring32cxx . . $ conststring32# preferencesFolderPath = MelderFolder_peekPathcxx . . $ MelderFolder_peekPath(fbe3b4f4d15c56ee). (Melder_preferencesFoldercxx . . $ Melder_preferencesFolder(3f0bf42ba8f9aa29).()); |
| 479 | const bool scriptIsInPlugin = Melder_startsWithcxx . . $ Melder_startsWith(1652f10ed0f82783). (scriptPath, preferencesFolderPath); |
| 480 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! ( |
| 481 | U"From a script you cannot directly call a menu command that calls another script. Use instead: \nrunScript: ", |
| 482 | scriptIsInPlugin ? U"preferencesDirectory$ + " : U"", |
| 483 | U"\"", |
| 484 | scriptIsInPlugin ? scriptPath + Melder_length (preferencesFolderPath) : scriptPath, |
| 485 | U"\"", |
| 486 | arguments && arguments [0] ? U", " : U"", |
| 487 | arguments && arguments [0] ? arguments : U"", |
| 488 | U"\n" |
| 489 | ); |
| 490 | } |
| 491 | commandFound -> callbackcxx . . $ structPraat_Command#callback. (nullptr, 0, nullptr, arguments, interpreter, title, false, nullptr, nullptr); |
| 492 | return 1; |
| 493 | } |
| 494 | |
| 495 | int praat_doMenuCommandcxx . . $ praat_doMenuCommand(738317ad6fa3f573). (conststring32cxx . . $ conststring32# title, integercxx . . $ integer# narg, Stackelcxx . . $ Stackel# args, Interpretercxx . . $ Interpreter# interpreter) { |
| 496 | Praat_Commandcxx . . $ Praat_Command# commandFound = nullptr; |
| 497 | for (integercxx . . $ integer# i = 1; i <= theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size.; i ++) { |
| 498 | Praat_Commandcxx . . $ Praat_Command# command = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 499 | if (command -> executablecxx . . $ structPraat_Command#executable. && str32equcxx . . $ `melder/melder_str32.h:122:9`! (command -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), title) && |
| 500 | (str32equcxx . . $ `melder/melder_str32.h:122:9`! (command -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"Objects") || str32equcxx . . $ `melder/melder_str32.h:122:9`! (command -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"Picture"))) |
| 501 | { |
| 502 | commandFound = command; |
| 503 | break; |
| 504 | } |
| 505 | } |
| 506 | if (! commandFound) |
| 507 | return 0; |
| 508 | if (commandFound -> callbackcxx . . $ structPraat_Command#callback. == DO_RunTheScriptFromAnyAddedMenuCommandcxx . . $ DO_RunTheScriptFromAnyAddedMenuCommand(744a0abd3c8513c).) { |
| 509 | const conststring32cxx . . $ conststring32# scriptPath = commandFound -> scriptcxx . . $ structPraat_Command#script..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(); |
| 510 | const conststring32cxx . . $ conststring32# preferencesFolderPath = MelderFolder_peekPathcxx . . $ MelderFolder_peekPath(fbe3b4f4d15c56ee). (Melder_preferencesFoldercxx . . $ Melder_preferencesFolder(3f0bf42ba8f9aa29).()); |
| 511 | const bool scriptIsInPlugin = Melder_startsWithcxx . . $ Melder_startsWith(1652f10ed0f82783). (scriptPath, preferencesFolderPath); |
| 512 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! ( |
| 513 | U"From a script you cannot directly call a menu command that calls another script. Use instead: \nrunScript: ", |
| 514 | scriptIsInPlugin ? U"preferencesDirectory$ + " : U"", |
| 515 | U"\"", |
| 516 | scriptIsInPlugin ? scriptPath + Melder_length (preferencesFolderPath) : scriptPath, |
| 517 | U"\"", |
| 518 | narg > 0 ? U", ..." : U"", |
| 519 | U"\n" |
| 520 | ); |
| 521 | } |
| 522 | commandFound -> callbackcxx . . $ structPraat_Command#callback. (nullptr, narg, args, nullptr, interpreter, title, false, nullptr, nullptr); |
| 523 | return 1; |
| 524 | } |
| 525 | |
| 526 | integercxx . . $ integer# praat_getNumberOfMenuCommandscxx . . $ praat_getNumberOfMenuCommands(da6335ded91d79c2). () { return theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size.; } |
| 527 | |
| 528 | Praat_Commandcxx . . $ Praat_Command# praat_getMenuCommandcxx . . $ praat_getMenuCommand(ee05ff1469c8f4e9). (integercxx . . $ integer# i) |
| 529 | { return i < 1 || i > theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size. ? nullptr : theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; } |
| 530 | |
| 531 | void praat_addCommandsToEditorcxx . . $ praat_addCommandsToEditor(c0154a85f79216c7). (Editorcxx . . $ Editor# me) { |
| 532 | conststring32cxx . . $ conststring32# windowClassName = mycxx . . $ `melder/melder.h:44:9`! classInfocxx . . $ structThing#classInfo. -> classNamecxx . . $ structClassInfo#className.; |
| 533 | for (integercxx . . $ integer# i = 1; i <= theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size.; i ++) { |
| 534 | Praat_Commandcxx . . $ Praat_Command# command = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 535 | if (str32equcxx . . $ `melder/melder_str32.h:122:9`! (command -> windowcxx . . $ structPraat_Command#window..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), windowClassName)) |
| 536 | Editor_addCommandScriptcxx . . $ Editor_addCommandScript(da070d3f88f8d7de). (me, command -> menucxx . . $ structPraat_Command#menu..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), command -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), |
| 537 | ((uint32cxx . . $ uint32#) command -> depthcxx . . $ structPraat_Command#depth.) << 16, command -> scriptcxx . . $ structPraat_Command#script..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | static bool commandIsToBeIncludedcxx . . $ commandIsToBeIncluded(454cb5346b4fc409). (Praat_Commandcxx . . $ Praat_Command# command, bool deprecated, bool includeCreateAPI, bool includeReadAPI, |
| 542 | bool includeRecordAPI, bool includePlayAPI, bool includeDrawAPI, bool includeHelpAPI, bool includeWindowAPI) |
| 543 | { |
| 544 | const bool obsolete = ( deprecated && (command -> deprecationYearcxx . . $ structPraat_Command#deprecationYear. < Melder_appYearcxx . . $ Melder_appYear(da6335ded91d79c2).() - 10 || command -> deprecationYearcxx . . $ structPraat_Command#deprecationYear. < 2023) ); |
| 545 | const bool hiddenByDefault = ( command -> hiddencxx . . $ structPraat_Command#hidden. != command -> toggledcxx . . $ structPraat_Command#toggled. ); |
| 546 | const bool explicitlyHidden = hiddenByDefault && ! deprecated; |
| 547 | const bool hidden = explicitlyHidden || ! command -> callbackcxx . . $ structPraat_Command#callback. || command -> noApicxx . . $ structPraat_Command#noApi. || obsolete || |
| 548 | (! includeWindowAPI && Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"WINDOW_", 7)) || |
| 549 | (! includeHelpAPI && Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"HELP_", 5)) || |
| 550 | (! includeDrawAPI && Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"GRAPHICS_", 9)) || |
| 551 | (! includePlayAPI && Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"PLAY_", 5)) || |
| 552 | (! includeRecordAPI && Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"RECORD_", 7)) || |
| 553 | (! includeReadAPI && Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"READ_MULTIPLE__", 5)) || |
| 554 | (! includeReadAPI && Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"READ_ONE__", 10)) || |
| 555 | (! includeCreateAPI && Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"NEW1_", 5)); |
| 556 | return (command -> forceApicxx . . $ structPraat_Command#forceApi. || ! hidden) && command -> callbackcxx . . $ structPraat_Command#callback. != DO_RunTheScriptFromAnyAddedMenuCommandcxx . . $ DO_RunTheScriptFromAnyAddedMenuCommand(744a0abd3c8513c).; |
| 557 | } |
| 558 | |
| 559 | static bool commandHasFileNameArgumentcxx . . $ commandHasFileNameArgument(7a3a722a7704ae08). (Praat_Commandcxx . . $ Praat_Command# command) { |
| 560 | const bool hasFileNameArgument = |
| 561 | Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"READ_ONE__", 10) || |
| 562 | Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"SAVE_", 5) |
| 563 | ; |
| 564 | return hasFileNameArgument; |
| 565 | } |
| 566 | |
| 567 | static conststring32cxx . . $ conststring32# getReturnTypecxx . . $ getReturnType(152f281cc90b9344). (Praat_Commandcxx . . $ Praat_Command# command) { |
| 568 | const conststring32cxx . . $ conststring32# returnType = |
| 569 | Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"NEW1_", 5) ? U"PraatObject" : |
| 570 | Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"READ_ONE__", 10) ? U"PraatObject" : |
| 571 | Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"REAL_", 5) ? U"double" : |
| 572 | Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"INTEGER_", 8) ? U"int64_t" : |
| 573 | Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"STRING_", 7) ? U"char *" : |
| 574 | Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"REPORT_", 7) ? U"char *" : |
| 575 | Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"LIST_", 5) ? U"char *" : |
| 576 | Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"INFO_", 5) ? U"char *" : |
| 577 | Melder_nequcxx . . $ `melder/melder_str32.h:131:9`! (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U"HINT_", 5) ? U"char *" : |
| 578 | U"void"; |
| 579 | return returnType; |
| 580 | } |
| 581 | |
| 582 | void praat_menuCommands_writeCcxx . . $ praat_menuCommands_writeC(b669ee56f6de5309). (bool isInHeaderFile, bool includeCreateAPI, bool includeReadAPI, |
| 583 | bool includeRecordAPI, bool includePlayAPI, bool includeDrawAPI, bool includeHelpAPI, bool includeWindowAPI) |
| 584 | { |
| 585 | try { |
| 586 | integercxx . . $ integer# numberOfApiMenuCommands = 0; |
| 587 | for (integercxx . . $ integer# i = 1; i <= theCommandscxx . . $ theCommands..sizecxx . . $ CollectionOf#size.; i ++) { |
| 588 | Praat_Commandcxx . . $ Praat_Command# command = theCommandscxx . . $ theCommands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 589 | const bool deprecated = ( command -> deprecationYearcxx . . $ structPraat_Command#deprecationYear. > 0 ); |
| 590 | if (! commandIsToBeIncludedcxx . . $ commandIsToBeIncluded(454cb5346b4fc409). (command, deprecated, includeCreateAPI, includeReadAPI, |
| 591 | includeRecordAPI, includePlayAPI, includeDrawAPI, includeHelpAPI, includeWindowAPI)) continue; |
| 592 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\n/* Menu command \"", command -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"\"", |
| 593 | deprecated ? U", deprecated " : U"", deprecated ? Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (command -> deprecationYearcxx . . $ structPraat_Command#deprecationYear.) : U"", |
| 594 | U" */"); |
| 595 | conststring32cxx . . $ conststring32# returnType = getReturnTypecxx . . $ getReturnType(152f281cc90b9344). (command); |
| 596 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (returnType, U" Praat", str32chrcxx . . $ str32chr(328a9ede0fba853a). (command -> nameOfCallbackcxx . . $ structPraat_Command#nameOfCallback., U'_'), U" ("); |
| 597 | const bool isDirect = ! str32strcxx . . $ str32str(2de17cd8f7c584a6). (command -> titlecxx . . $ structPraat_Command#title..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"..."); |
| 598 | if (isDirect) { |
| 599 | } else { |
| 600 | command -> callbackcxx . . $ structPraat_Command#callback. (nullptr, -1, nullptr, nullptr, nullptr, nullptr, false, nullptr, nullptr); |
| 601 | } |
| 602 | if (commandHasFileNameArgumentcxx . . $ commandHasFileNameArgument(7a3a722a7704ae08). (command)) |
| 603 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tconst char *fileName"); |
| 604 | MelderInfo_writecxx . . $ MelderInfo_write(3eb398314feba58b). (U")"); |
| 605 | if (isInHeaderFile) { |
| 606 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U";"); |
| 607 | } else { |
| 608 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" {"); |
| 609 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"}"); |
| 610 | } |
| 611 | numberOfApiMenuCommands += 1; |
| 612 | } |
| 613 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 614 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Menu commands not written to C library."); |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | /* End of file praat_menuCommands.cpp */ |