Debian Codegraph @

sys/Editor.cpp

raw symbols SCIP
1 /* Editor.cpp
2 *
3 * Copyright (C) 1992-2024,2026 Paul Boersma, 2008 Stefan de Konink, 2010 Franz Brausse
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 <time.h>
20 #include "ScriptEditor.h"cxx . . $ `<file>/sys/ScriptEditor.h`/
21 #include "machine.h"cxx . . $ `<file>/sys/machine.h`/
22 #include "EditorM.h"cxx . . $ `<file>/sys/EditorM.h`/
23 #include "praat_script.h"cxx . . $ `<file>/sys/praat_script.h`/
24
25 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (Editor, DataGui, 0);
26
27 #include "Prefs_define.h"cxx . . $ `<file>/sys/Prefs_define.h`/
28 #include "Editor_prefs.h"cxx . . $ `<file>/sys/Editor_prefs.h`/
29 #include "Prefs_install.h"cxx . . $ `<file>/sys/Prefs_install.h`/
30 #include "Editor_prefs.h"cxx . . $ `<file>/sys/Editor_prefs.h`/
31 #include "Prefs_copyToInstance.h"cxx . . $ `<file>/sys/Prefs_copyToInstance.h`/
32 #include "Editor_prefs.h"cxx . . $ `<file>/sys/Editor_prefs.h`/
33
34 /********** class EditorCommand **********/
35
36 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (EditorCommand, Thing, 0);
37
38 /********** class EditorMenu **********/
39
40 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (EditorMenu, Thing, 0);
41
42 /********** functions **********/
43
44 static void commonCallbackcxx . . $ commonCallback(7297613cadf363f3). (EditorCommandcxx . . $ EditorCommand# me, GuiMenuItemEventcxx . . $ GuiMenuItemEvent# /* event */) {
45 if (mycxx . . $ `melder/melder.h:44:9`! d_editorcxx . . $ structEditorCommand#d_editor. && mycxx . . $ `melder/melder.h:44:9`! d_editorcxx . . $ structEditorCommand#d_editor. -> v_scriptablecxx . . $ structEditor#v_scriptable(c9857a73d68e59ba). () && ! str32strcxx . . $ str32str(2de17cd8f7c584a6). (mycxx . . $ `melder/melder.h:44:9`! itemTitlecxx . . $ structEditorCommand#itemTitle..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"...")) {
46 UiHistory_writecxx . . $ UiHistory_write(ff00d524ab0355ec). (U"\n");
47 UiHistory_write_colonizecxx . . $ UiHistory_write_colonize(ff00d524ab0355ec). (mycxx . . $ `melder/melder.h:44:9`! itemTitlecxx . . $ structEditorCommand#itemTitle..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
48 }
49 try {
50 mycxx . . $ `melder/melder.h:44:9`! commandCallbackcxx . . $ structEditorCommand#commandCallback. (cxx . . $ MelderCallback#`operator()`(e7ade0e2880b4e44).mycxx . . $ `melder/melder.h:44:9`! sendercxx . . $ structEditorCommand#sender., me, nullptr, 0, nullptr, nullptr, nullptr);
51 } catch (MelderErrorcxx . . $ MelderError#) {
52 if (! Melder_hasErrorcxx . . $ Melder_hasError(2df281243f91fe91). (U"Script exited."))
53 Melder_appendErrorcxx . . $ Melder_appendError(6298c93241566110). (U"Menu command “", mycxx . . $ `melder/melder.h:44:9`! itemTitlecxx . . $ structEditorCommand#itemTitle..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"” not completed.");
54 Melder_flushErrorcxx . . $ Melder_flushError(49f6e7a06ebc5aa8). ();
55 }
56 }
57
58 static GuiMenuItemcxx . . $ GuiMenuItem# DataGuiMenu_addCommand_cxx . . $ DataGuiMenu_addCommand_(234e92b25f9579fc). (EditorMenucxx . . $ EditorMenu# me, conststring32cxx . . $ conststring32# itemTitle /* cattable */, uint32cxx . . $ uint32# flags,
59 DataGuiCommandCallbackcxx . . $ DataGuiCommandCallback# commandCallback, DataGuicxx . . $ DataGui# optionalSender)
60 {
61 autoEditorCommandcxx . . $ autoEditorCommand# thee = Thing_newcxx . . $ `sys/Thing.h:514:9`! (EditorCommand);
62 thycxx . . $ `melder/melder.h:45:9`! d_editorcxx . . $ structEditorCommand#d_editor. = mycxx . . $ `melder/melder.h:44:9`! d_editorcxx . . $ structEditorMenu#d_editor.;
63 thycxx . . $ `melder/melder.h:45:9`! sendercxx . . $ structEditorCommand#sender. = ( optionalSender ? optionalSender : thycxx . . $ `melder/melder.h:45:9`! d_editorcxx . . $ structEditorCommand#d_editor. );
64 thycxx . . $ `melder/melder.h:45:9`! menucxx . . $ structEditorCommand#menu. = me;
65 const bool titleIsHeader = Melder_endsWithcxx . . $ Melder_endsWith(1652f10ed0f82783). (itemTitle, U":");
66 if (titleIsHeader) {
67 flags |= GuiMenu_UNDERLINEDcxx . . $ `sys/Gui.h:856:9`!;
68 if (itemTitle [0] == U'-' && itemTitle [1] == U' ') {
69 GuiMenu_addSeparatorcxx . . $ GuiMenu_addSeparator(d5bd5aafbfbb56aa). (mycxx . . $ `melder/melder.h:44:9`! menuWidgetcxx . . $ structEditorMenu#menuWidget.);
70 itemTitle += 2;
71 }
72 }
73 const int depth = (flags & GuiMenu_DEPTH_3cxx . . $ `sys/Gui.h:864:9`!) >> 16; // the maximum depth in editor windows is 3
74 thycxx . . $ `melder/melder.h:45:9`! itemTitlecxx . . $ structEditorCommand#itemTitle. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (itemTitle);
75 if (depth > 0) {
76 /*
77 bikeshed choices for indented menu items
78 */
79 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# space = U" "; // minimalist
80 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# fourDots = U"\u205E "; // not evenly dispersed
81 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# twoDots = U"\u205A "; // dispersion OKish
82 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# oneDot = U"· "; // dispersion good, not too prominent, not really thin
83 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# hyphenationPoint = U"\u2027 "; // xx
84 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# pipe = U"| "; // not long enough, prominent
85 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# boxDrawingLightVertical = U"\u2502 "; // not long enough, prominent
86 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# boxDrawingLightQuadrupleDashVertical = U"\u250A "; // not long enough, but nicely thin
87 itemTitle = Melder_catcxx . . $ Melder_cat(7fbf27f4d367f442). (space, itemTitle);
88 }
89 if (! commandCallback)
90 flags |= GuiMenu_INSENSITIVEcxx . . $ `sys/Gui.h:852:9`!;
91 thycxx . . $ `melder/melder.h:45:9`! itemWidgetcxx . . $ structEditorCommand#itemWidget. =
92 titleIsHeader ? GuiMenu_addItemcxx . . $ GuiMenu_addItem(c4b605a971e4b555). (mycxx . . $ `melder/melder.h:44:9`! menuWidgetcxx . . $ structEditorMenu#menuWidget., itemTitle, flags, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., nullptr) :
93 ! commandCallback ? GuiMenu_addSeparatorcxx . . $ GuiMenu_addSeparator(d5bd5aafbfbb56aa). (mycxx . . $ `melder/melder.h:44:9`! menuWidgetcxx . . $ structEditorMenu#menuWidget.) :
94 flags & GuiMenu_HIDDENcxx . . $ `sys/Gui.h:869:9`! ? nullptr :
95 GuiMenu_addItemcxx . . $ GuiMenu_addItem(c4b605a971e4b555). (mycxx . . $ `melder/melder.h:44:9`! menuWidgetcxx . . $ structEditorMenu#menuWidget., itemTitle, flags, commonCallbackcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).())
96 ; // DANGLE BUG: me can be killed by Collection_addItem(), but EditorCommand::destroy doesn't remove the item
97 thycxx . . $ `melder/melder.h:45:9`! commandCallbackcxx . . $ structEditorCommand#commandCallback. =cxx . . $ MelderCallback#`operator=`(57d817aef42c36c6). commandCallback;
98 GuiMenuItemcxx . . $ GuiMenuItem# result = thycxx . . $ `melder/melder.h:45:9`! itemWidgetcxx . . $ structEditorCommand#itemWidget.;
99 mycxx . . $ `melder/melder.h:44:9`! commandscxx . . $ structEditorMenu#commands.. addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).());
100 return result;
101 }
102 GuiMenuItemcxx . . $ GuiMenuItem# DataGuiMenu_addCommandcxx . . $ DataGuiMenu_addCommand(234e92b25f9579fc). (EditorMenucxx . . $ EditorMenu# me, conststring32cxx . . $ conststring32# itemTitle /* cattable */, uint32cxx . . $ uint32# flags,
103 DataGuiCommandCallbackcxx . . $ DataGuiCommandCallback# commandCallback, DataGuicxx . . $ DataGui# optionalSender)
104 {
105 if (flags < 3) // the maximum depth in editor windows is 3
106 flags *= GuiMenu_DEPTH_1cxx . . $ `sys/Gui.h:862:9`!; // turn 1..3 into GuiMenu_DEPTH_1..GuiMenu_DEPTH_3, because the flags are ORed below
107 const char32cxx . . $ char32# *pSeparator = str32strcxx . . $ str32str(2de17cd8f7c584a6). (itemTitle, U" || ");
108 if (! pSeparator)
109 return DataGuiMenu_addCommand_cxx . . $ DataGuiMenu_addCommand_(234e92b25f9579fc). (me, itemTitle, flags, commandCallback, optionalSender);
110 integercxx . . $ integer# positionOfSeparator = pSeparator - itemTitle;
111 static MelderStringcxx . . $ MelderString# string;
112 MelderString_copycxx . . $ MelderString_copy(65be51a793e0ff96). (& string, itemTitle);
113 char32cxx . . $ char32# *pTitle = & string.stringcxx . . $ MelderString#string. [0];
114 GuiMenuItemcxx . . $ GuiMenuItem# result = nullptr;
115 do {
116 pTitle [positionOfSeparator] = U'\0';
117 GuiMenuItemcxx . . $ GuiMenuItem# menuItem = DataGuiMenu_addCommand_cxx . . $ DataGuiMenu_addCommand_(234e92b25f9579fc). (me, pTitle, flags, commandCallback, optionalSender);
118 if (menuItem)
119 result = menuItem; // only the first
120 pTitle += positionOfSeparator + 4; // step past " || "
121 pSeparator = str32strcxx . . $ str32str(2de17cd8f7c584a6). (pTitle, U" || ");
122 if (pSeparator)
123 positionOfSeparator = pSeparator - pTitle;
124 flags |= GuiMenu_HIDDENcxx . . $ `sys/Gui.h:869:9`!;
125 } while (pSeparator);
126 (void) DataGuiMenu_addCommand_cxx . . $ DataGuiMenu_addCommand_(234e92b25f9579fc). (me, pTitle, flags, commandCallback, optionalSender);
127 return result;
128 }
129 GuiMenuItemcxx . . $ GuiMenuItem# EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (EditorMenucxx . . $ EditorMenu# me, conststring32cxx . . $ conststring32# itemTitle /* cattable */, uint32cxx . . $ uint32# flags,
130 EditorCommandCallbackcxx . . $ EditorCommandCallback# commandCallback)
131 {
132 return DataGuiMenu_addCommandcxx . . $ DataGuiMenu_addCommand(234e92b25f9579fc). (me, itemTitle, flags, commandCallbackcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)..getcxx . . $ MelderCallback#get(ac3d6dcac2633a48).(), nullptr);
133 }
134
135 /*GuiObject EditorCommand_getItemWidget (EditorCommand me) { return my itemWidget; }*/
136
137 EditorMenucxx . . $ EditorMenu# Editor_addMenucxx . . $ Editor_addMenu(8b39ac34ca8e016f). (Editorcxx . . $ Editor# me, conststring32cxx . . $ conststring32# menuTitle, uint32cxx . . $ uint32# flags) {
138 autoEditorMenucxx . . $ autoEditorMenu# thee = Thing_newcxx . . $ `sys/Thing.h:514:9`! (EditorMenu);
139 thycxx . . $ `melder/melder.h:45:9`! d_editorcxx . . $ structEditorMenu#d_editor. = me;
140 thycxx . . $ `melder/melder.h:45:9`! menuTitlecxx . . $ structEditorMenu#menuTitle. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (menuTitle);
141 thycxx . . $ `melder/melder.h:45:9`! menuWidgetcxx . . $ structEditorMenu#menuWidget. = GuiMenu_createInWindowcxx . . $ GuiMenu_createInWindow(cfd6777f6dee287d). (mycxx . . $ `melder/melder.h:44:9`! windowFormcxx . . $ structEditor#windowForm., menuTitle, flags);
142 return mycxx . . $ `melder/melder.h:44:9`! menuscxx . . $ structEditor#menus.. addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).());
143 }
144
145 /*GuiObject EditorMenu_getMenuWidget (EditorMenu me) { return my menuWidget; }*/
146
147 GuiMenuItemcxx . . $ GuiMenuItem# Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (Editorcxx . . $ Editor# me, conststring32cxx . . $ conststring32# menuTitle, conststring32cxx . . $ conststring32# itemTitle, uint32cxx . . $ uint32# flags, EditorCommandCallbackcxx . . $ EditorCommandCallback# commandCallback)
148 {
149 try {
150 integercxx . . $ integer# numberOfMenus = mycxx . . $ `melder/melder.h:44:9`! menuscxx . . $ structEditor#menus..sizecxx . . $ CollectionOf#size.;
151 for (integercxx . . $ integer# imenu = 1; imenu <= numberOfMenus; imenu ++) {
152 EditorMenucxx . . $ EditorMenu# menu = mycxx . . $ `melder/melder.h:44:9`! menuscxx . . $ structEditor#menus..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).imenu];
153 if (str32equcxx . . $ `melder/melder_str32.h:122:9`! (menuTitle, menu -> menuTitlecxx . . $ structEditorMenu#menuTitle..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()))
154 return EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, itemTitle, flags, commandCallback);
155 }
156 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Menu “", menuTitle, U"” does not exist.");
157 } catch (MelderErrorcxx . . $ MelderError#) {
158 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Command “", itemTitle, U"” not inserted in menu “", menuTitle, U"”.");
159 }
160 }
161
162 static void Editor_scriptCallbackcxx . . $ Editor_scriptCallback(8b4cc4166db3712c). (Editorcxx . . $ Editor# me, EditorCommandcxx . . $ EditorCommand# cmd, UiFormcxx . . $ UiForm# /* sendingForm */,
163 integercxx . . $ integer# /* narg */, Stackelcxx . . $ Stackel# /* args */, conststring32cxx . . $ conststring32# /* sendingString */, Interpretercxx . . $ Interpreter# /* interpreter */)
164 {
165 praat_executeScriptFromEditorCommandcxx . . $ praat_executeScriptFromEditorCommand(d13209d459650523). (me, cmd, cmd -> scriptcxx . . $ structEditorCommand#script..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
166 }
167
168 static EditorMenucxx . . $ EditorMenu# findMenucxx . . $ findMenu(4d13588b74455ec7). (Editorcxx . . $ Editor# me, conststring32cxx . . $ conststring32# menuTitle) {
169 const integercxx . . $ integer# numberOfMenus = mycxx . . $ `melder/melder.h:44:9`! menuscxx . . $ structEditor#menus..sizecxx . . $ CollectionOf#size.;
170 for (integercxx . . $ integer# imenu = 1; imenu <= numberOfMenus; imenu ++) {
171 EditorMenucxx . . $ EditorMenu# menu = mycxx . . $ `melder/melder.h:44:9`! menuscxx . . $ structEditor#menus..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).imenu];
172 if (str32equcxx . . $ `melder/melder_str32.h:122:9`! (menu -> menuTitlecxx . . $ structEditorMenu#menuTitle..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), menuTitle))
173 return menu;
174 }
175 return nullptr;
176 }
177 static GuiMenuItemcxx . . $ GuiMenuItem# EditorMenu_addCommandScriptcxx . . $ EditorMenu_addCommandScript(93c33b07a6428468). (EditorMenucxx . . $ EditorMenu# me, conststring32cxx . . $ conststring32# itemTitle, uint32cxx . . $ uint32# flags, conststring32cxx . . $ conststring32# script) {
178 autoEditorCommandcxx . . $ autoEditorCommand# cmd = Thing_newcxx . . $ `sys/Thing.h:514:9`! (EditorCommand);
179 cmd ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). d_editorcxx . . $ structEditorCommand#d_editor. = mycxx . . $ `melder/melder.h:44:9`! d_editorcxx . . $ structEditorMenu#d_editor.;
180 cmd ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). sendercxx . . $ structEditorCommand#sender. = mycxx . . $ `melder/melder.h:44:9`! d_editorcxx . . $ structEditorMenu#d_editor.;
181 cmd ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). menucxx . . $ structEditorCommand#menu. = me;
182 const bool titleIsHeader = Melder_endsWithcxx . . $ Melder_endsWith(1652f10ed0f82783). (itemTitle, U":");
183 if (titleIsHeader) {
184 if (itemTitle [0] == U'-' && itemTitle [1] == U' ') {
185 flags |= GuiMenu_UNDERLINEDcxx . . $ `sys/Gui.h:856:9`!;
186 GuiMenu_addSeparatorcxx . . $ GuiMenu_addSeparator(d5bd5aafbfbb56aa). (mycxx . . $ `melder/melder.h:44:9`! menuWidgetcxx . . $ structEditorMenu#menuWidget.);
187 itemTitle += 2;
188 }
189 cmd ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). commandCallbackcxx . . $ structEditorCommand#commandCallback. =cxx . . $ MelderCallback#`operator=`(6bd8fbd1288f2d22). nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).;
190 flags |= GuiMenu_INSENSITIVEcxx . . $ `sys/Gui.h:852:9`!;
191 } else
192 cmd ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). commandCallbackcxx . . $ structEditorCommand#commandCallback. =cxx . . $ MelderCallback#`operator=`(6bd8fbd1288f2d22). Editor_scriptCallbackcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).;
193 if (itemTitle && itemTitle [0] != U'-')
194 itemTitle = Melder_catcxx . . $ Melder_cat(7fbf27f4d367f442). (U"\u207A", itemTitle);
195 const int depth = (flags & GuiMenu_DEPTH_3cxx . . $ `sys/Gui.h:864:9`!) >> 16; // the maximum depth in editor windows is 3
196 if (depth > 0) {
197 /*
198 bikeshed choices for indented menu items
199 */
200 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# space = U" "; // minimalist
201 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# fourDots = U"\u205E "; // not evenly dispersed
202 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# twoDots = U"\u205A "; // dispersion OKish
203 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# oneDot = U"· "; // dispersion good, not too prominent, not really thin
204 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# hyphenationPoint = U"\u2027 "; // xx
205 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# pipe = U"| "; // not long enough, prominent
206 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# boxDrawingLightVertical = U"\u2502 "; // not long enough, prominent
207 [[maybe_unused]] constexpr conststring32cxx . . $ conststring32# boxDrawingLightQuadrupleDashVertical = U"\u250A "; // not long enough, but nicely thin
208 itemTitle = Melder_catcxx . . $ Melder_cat(7fbf27f4d367f442). (space, itemTitle);
209 }
210 cmd ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). itemTitlecxx . . $ structEditorCommand#itemTitle. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (itemTitle);
211 cmd ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). itemWidgetcxx . . $ structEditorCommand#itemWidget. = ( script == nullptr || ! itemTitle || itemTitle [0] == U'-' ? GuiMenu_addSeparatorcxx . . $ GuiMenu_addSeparator(d5bd5aafbfbb56aa). (mycxx . . $ `melder/melder.h:44:9`! menuWidgetcxx . . $ structEditorMenu#menuWidget.) :
212 titleIsHeader ?
213 GuiMenu_addItemcxx . . $ GuiMenu_addItem(c4b605a971e4b555). (mycxx . . $ `melder/melder.h:44:9`! menuWidgetcxx . . $ structEditorMenu#menuWidget., itemTitle, flags, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., nullptr) :
214 GuiMenu_addItemcxx . . $ GuiMenu_addItem(c4b605a971e4b555). (mycxx . . $ `melder/melder.h:44:9`! menuWidgetcxx . . $ structEditorMenu#menuWidget., itemTitle, flags, commonCallbackcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., cmd.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()) ); // DANGLE BUG
215 if (script [0] == U'\0') {
216 cmd ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). scriptcxx . . $ structEditorCommand#script. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U"");
217 } else {
218 structMelderFilecxx . . $ structMelderFile# file { };
219 Melder_relativePathToFilecxx . . $ Melder_relativePathToFile(82691f2ee21fbb13). (script, & file);
220 cmd ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). scriptcxx . . $ structEditorCommand#script. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (MelderFile_peekPathcxx . . $ MelderFile_peekPath(d9f043369fa9b55b). (& file));
221 }
222 GuiMenuItemcxx . . $ GuiMenuItem# result = cmd ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). itemWidgetcxx . . $ structEditorCommand#itemWidget.;
223 mycxx . . $ `melder/melder.h:44:9`! commandscxx . . $ structEditorMenu#commands.. addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (cmdcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).());
224 return result;
225 }
226 GuiMenuItemcxx . . $ GuiMenuItem# Editor_addCommandScriptcxx . . $ Editor_addCommandScript(da070d3f88f8d7de). (Editorcxx . . $ Editor# me, conststring32cxx . . $ conststring32# menuTitle, conststring32cxx . . $ conststring32# itemTitle, uint32cxx . . $ uint32# flags,
227 conststring32cxx . . $ conststring32# script)
228 {
229 EditorMenucxx . . $ EditorMenu# menu = findMenucxx . . $ findMenu(4d13588b74455ec7). (me, menuTitle);
230 if (menu)
231 return EditorMenu_addCommandScriptcxx . . $ EditorMenu_addCommandScript(93c33b07a6428468). (menu, itemTitle, flags, script);
232 /*
233 Try again, in case the menu title is obsolete.
234 */
235 conststring32cxx . . $ conststring32# alternativeMenuTitle =
236 str32equcxx . . $ `melder/melder_str32.h:122:9`! (menuTitle, U"Spectrum") ? U"Spectrogram" :
237 str32equcxx . . $ `melder/melder_str32.h:122:9`! (menuTitle, U"View") || str32equcxx . . $ `melder/melder_str32.h:122:9`! (menuTitle, U"Select") ? U"Time" : // or "Play", but we cannot know
238 str32equcxx . . $ `melder/melder_str32.h:122:9`! (menuTitle, U"Formant") ? U"Formants" :
239 str32equcxx . . $ `melder/melder_str32.h:122:9`! (menuTitle, U"Query") ? U"Edit" : // not appropriate, but better than nothing
240 nullptr;
241 if (alternativeMenuTitle) {
242 EditorMenucxx . . $ EditorMenu# alternativeMenu = findMenucxx . . $ findMenu(4d13588b74455ec7). (me, alternativeMenuTitle);
243 if (alternativeMenu) {
244 GuiMenuItemcxx . . $ GuiMenuItem# menuItem = EditorMenu_addCommandScriptcxx . . $ EditorMenu_addCommandScript(93c33b07a6428468). (alternativeMenu, itemTitle, flags, script);
245 static bool warningGiven = false;
246 if (! warningGiven) {
247 warningGiven = true;
248 Melder_warningcxx . . $ Melder_warning(6298c93241566110). (U"The menu “", menuTitle, U"” no longer exists. The command “", itemTitle,
249 U"” has been installed in the menu “", alternativeMenuTitle, U"” instead. "
250 U"You could consider updating the script that installed “", script, U"”, "
251 U"which is either the buttons file or a plug-in."
252 );
253 }
254 return menuItem;
255 } // else issue the original warning
256 }
257 Melder_warningcxx . . $ Melder_warning(6298c93241566110). (
258 U"Menu “", menuTitle, U"” does not exist.\n"
259 U"Command “", itemTitle, U"” not inserted in menu “", menuTitle, U"”.\n"
260 U"To fix this, go to Praat->Preferences->Buttons->Editors, and remove the script from this menu.\n"
261 U"You may then want to install the script in a different menu."
262 );
263 return nullptr;
264 }
265
266 void Editor_setMenuSensitivecxx . . $ Editor_setMenuSensitive(7aff99cae56b3576). (Editorcxx . . $ Editor# me, conststring32cxx . . $ conststring32# menuTitle, bool sensitive) {
267 integercxx . . $ integer# numberOfMenus = mycxx . . $ `melder/melder.h:44:9`! menuscxx . . $ structEditor#menus..sizecxx . . $ CollectionOf#size.;
268 for (integercxx . . $ integer# imenu = 1; imenu <= numberOfMenus; imenu ++) {
269 EditorMenucxx . . $ EditorMenu# menu = mycxx . . $ `melder/melder.h:44:9`! menuscxx . . $ structEditor#menus..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).imenu];
270 if (str32equcxx . . $ `melder/melder_str32.h:122:9`! (menuTitle, menu -> menuTitlecxx . . $ structEditorMenu#menuTitle..getcxx . . $ _autostring#get(5a2a78a048fb49a8).())) {
271 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (menu -> menuWidgetcxx . . $ structEditorMenu#menuWidget., sensitive);
272 return;
273 }
274 }
275 }
276
277 EditorCommandcxx . . $ EditorCommand# Editor_getMenuCommandcxx . . $ Editor_getMenuCommand(6b867f4f43663f0). (Editorcxx . . $ Editor# me, conststring32cxx . . $ conststring32# menuTitle, conststring32cxx . . $ conststring32# itemTitle) {
278 integercxx . . $ integer# numberOfMenus = mycxx . . $ `melder/melder.h:44:9`! menuscxx . . $ structEditor#menus..sizecxx . . $ CollectionOf#size.;
279 for (int imenu = 1; imenu <= numberOfMenus; imenu ++) {
280 EditorMenucxx . . $ EditorMenu# menu = mycxx . . $ `melder/melder.h:44:9`! menuscxx . . $ structEditor#menus..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).imenu];
281 if (str32equcxx . . $ `melder/melder_str32.h:122:9`! (menuTitle, menu -> menuTitlecxx . . $ structEditorMenu#menuTitle..getcxx . . $ _autostring#get(5a2a78a048fb49a8).())) {
282 integercxx . . $ integer# numberOfCommands = menu -> commandscxx . . $ structEditorMenu#commands..sizecxx . . $ CollectionOf#size., icommand;
283 for (icommand = 1; icommand <= numberOfCommands; icommand ++) {
284 EditorCommandcxx . . $ EditorCommand# command = menu -> commandscxx . . $ structEditorMenu#commands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).icommand];
285 if (str32equcxx . . $ `melder/melder_str32.h:122:9`! (itemTitle, command -> itemTitlecxx . . $ structEditorCommand#itemTitle..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()))
286 return command;
287 }
288 }
289 }
290 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Command “", itemTitle, U"” not found in menu “", menuTitle, U"”.");
291 }
292
293 void Editor_doMenuCommandcxx . . $ Editor_doMenuCommand(11ddb24ea6d4513). (Editorcxx . . $ Editor# me, conststring32cxx . . $ conststring32# commandTitle, integercxx . . $ integer# narg, Stackelcxx . . $ Stackel# args, conststring32cxx . . $ conststring32# arguments, Interpretercxx . . $ Interpreter# interpreter) {
294 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (me);
295 integercxx . . $ integer# numberOfMenus = mycxx . . $ `melder/melder.h:44:9`! menuscxx . . $ structEditor#menus..sizecxx . . $ CollectionOf#size.;
296 for (int imenu = 1; imenu <= numberOfMenus; imenu ++) {
297 EditorMenucxx . . $ EditorMenu# menu = mycxx . . $ `melder/melder.h:44:9`! menuscxx . . $ structEditor#menus..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).imenu];
298 integercxx . . $ integer# numberOfCommands = menu -> commandscxx . . $ structEditorMenu#commands..sizecxx . . $ CollectionOf#size.;
299 for (integercxx . . $ integer# icommand = 1; icommand <= numberOfCommands; icommand ++) {
300 EditorCommandcxx . . $ EditorCommand# command = menu -> commandscxx . . $ structEditorMenu#commands..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).icommand];
301 if (str32equcxx . . $ `melder/melder_str32.h:122:9`! (commandTitle, command -> itemTitlecxx . . $ structEditorCommand#itemTitle..getcxx . . $ _autostring#get(5a2a78a048fb49a8).())) {
302 command -> commandCallbackcxx . . $ structEditorCommand#commandCallback. (cxx . . $ MelderCallback#`operator()`(e7ade0e2880b4e44).command -> sendercxx . . $ structEditorCommand#sender., command, nullptr, narg, args, arguments, interpreter);
303 return;
304 }
305 }
306 }
307 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! classInfo);
308 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Command not available in ", mycxx . . $ `melder/melder.h:44:9`! classInfo -> className, U".");
309 }
310
311 /********** class Editor **********/
312
313 void structEditorcxx . . $ structEditor# :: v9_destroycxx . . $ structEditor#v9_destroy(ced63f7c635d850d). () noexcept {
314 MelderAudio_stopPlayingcxx . . $ MelderAudio_stopPlaying(efaadfb7dc14930a). (MelderAudio_IMPLICITcxx . . $ `melder/melder_audio.h:57:9`!);
315 /*
316 The following command must be performed before the shell is destroyed.
317 Otherwise, we would be forgetting dangling command dialogs here.
318 */
319 ourcxx . . $ `melder/melder.h:42:9`! menuscxx . . $ structEditor#menus..removeAllItemscxx . . $ CollectionOf#removeAllItems(49f6e7a06ebc5aa8).();
320 for (integercxx . . $ integer# i = theReferencesToAllOpenScriptEditorscxx . . $ theReferencesToAllOpenScriptEditors..sizecxx . . $ CollectionOf#size.; i >= 1; i --) {
321 ScriptEditorcxx . . $ ScriptEditor# scriptEditor = theReferencesToAllOpenScriptEditorscxx . . $ theReferencesToAllOpenScriptEditors..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i];
322 if (scriptEditor -> optionalReferenceToOwningEditorcxx . . $ structScriptEditor#optionalReferenceToOwningEditor. != this)
323 continue;
324 // if (scriptEditor -> dirty || scriptEditor -> interpreter && scriptEditor -> interpreter -> running) {
325 // scriptEditor -> optionalReferenceToOwningEditor = nullptr; // undangle
326 // if (scriptEditor -> interpreter)
327 // scriptEditor -> interpreter -> undangleEditorEnvironments();
328 // Thing_setName (scriptEditor, nullptr);
329 // Editor_setMenuSensitive (scriptEditor, U"Run", false);
330 // } else
331 forgetcxx . . $ `sys/Thing.h:158:9`! (scriptEditor);
332 }
333 Interpreters_undangleEnvironmentcxx . . $ Interpreters_undangleEnvironment(804f629ae7a06da5). (this);
334
335 Editor_broadcastDestructioncxx . . $ Editor_broadcastDestruction(c0154a85f79216c7). (this);
336 if (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm.) {
337 #if gtkcxx . . $ `sys/Gui.h:33:10`!
338 if (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm. -> d_gtkWindowcxx . . $ structGuiShell#d_gtkWindow.) {
339 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (GTK_IS_WIDGETcxx . . $ `<external>/6031079988677191796/gtkwidget.h:60:9`! (ourcxx . . $ `melder/melder.h:42:9`! windowForm -> d_gtkWindow));
340 gtk_widget_destroy (GTK_WIDGETcxx . . $ `<external>/6031079988677191796/gtkwidget.h:58:9`! (ourcxx . . $ `melder/melder.h:42:9`! windowForm -> d_gtkWindow));
341 }
342 #elif motif
343 if (our windowForm -> d_xmShell) {
344 XtDestroyWidget (our windowForm -> d_xmShell);
345 }
346 #elif cocoa
347 if (our windowForm -> drawingArea) {
348 GuiCocoaDrawingArea *cocoaDrawingArea = (GuiCocoaDrawingArea *) our windowForm -> drawingArea -> d_widget;
349 if (cocoaDrawingArea)
350 [cocoaDrawingArea setUserData: nullptr];
351 }
352 if (our windowForm -> d_cocoaShell) {
353 NSWindow *cocoaWindow = our windowForm -> d_cocoaShell;
354 //our windowForm -> d_cocoaShell = nullptr;
355 [cocoaWindow close]; // this should *release* the window as well, because `releasedWhenClosed` is on by default for NSWindows
356 }
357 #endif
358 }
359 Editor_Parentcxx . . $ Editor_Parent# :: v9_destroycxx . . $ structThing#v9_destroy(ced63f7c635d850d). ();
360 }
361
362 void structEditorcxx . . $ structEditor# :: v1_infocxx . . $ structEditor#v1_info(49f6e7a06ebc5aa8). () {
363 // skipping parent classes
364 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Editor type: ", Thing_classNamecxx . . $ Thing_className(fbb3dc34e3ef688d). (this));
365 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Editor name: ", ourcxx . . $ `melder/melder.h:42:9`! namecxx . . $ structThing#name. ? ourcxx . . $ `melder/melder.h:42:9`! namecxx . . $ structThing#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).() : U"<no name>");
366 time_tcxx . . $ time_t# today = time (nullptr);
367 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Date: ", Melder_peek8to32_u (ctime (& today))); // includes a newline
368 if (ourcxx . . $ `melder/melder.h:42:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).()) {
369 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Data type: ", ourcxx . . $ `melder/melder.h:42:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).() -> classInfocxx . . $ structThing#classInfo. -> classNamecxx . . $ structClassInfo#className.);
370 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Data name: ", ourcxx . . $ `melder/melder.h:42:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).() -> namecxx . . $ structThing#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
371 }
372 }
373
374 void structEditorcxx . . $ structEditor# :: v_nameChangedcxx . . $ structEditor#v_nameChanged(49f6e7a06ebc5aa8). () {
375 if (ourcxx . . $ `melder/melder.h:42:9`! namecxx . . $ structThing#name.) {
376 GuiShell_setTitlecxx . . $ GuiShell_setTitle(3a9df304850abc11). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., ourcxx . . $ `melder/melder.h:42:9`! namecxx . . $ structThing#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
377 for (integercxx . . $ integer# i = 1; i <= theReferencesToAllOpenScriptEditorscxx . . $ theReferencesToAllOpenScriptEditors..sizecxx . . $ CollectionOf#size.; i ++) {
378 ScriptEditorcxx . . $ ScriptEditor# scriptEditor = theReferencesToAllOpenScriptEditorscxx . . $ theReferencesToAllOpenScriptEditors..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i];
379 if (scriptEditor -> optionalReferenceToOwningEditorcxx . . $ structScriptEditor#optionalReferenceToOwningEditor. == this)
380 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (theReferencesToAllOpenScriptEditorscxx . . $ theReferencesToAllOpenScriptEditors..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i], nullptr);
381 }
382 }
383 }
384
385 static void menu_cb_sendBackToCallingProgramcxx . . $ menu_cb_sendBackToCallingProgram(8b4cc4166db3712c). (Editorcxx . . $ Editor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
386 if (mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).()) {
387 structMelderFilecxx . . $ structMelderFile# file { };
388 MelderFolder_getFilecxx . . $ MelderFolder_getFile(fcdc1f9d1818a0a1). (Melder_preferencesFoldercxx . . $ Melder_preferencesFolder(3f0bf42ba8f9aa29).(), U"praat_backToCaller.Data", & file);
389 Data_writeToTextFilecxx . . $ Data_writeToTextFile(c3dcdea1be00195). (mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).(), & file);
390 /*
391 We used to do:
392 */
393 //sendsocket (Melder_peek32to8 (my callbackSocket.get()), Melder_peek32to8 (my data() -> name.get()));
394 /*
395 From Praat 7 on, this is no longer possible.
396 Either we have to find a different way to notify the calling program,
397 or we don't notify them, so that they will have to poll (which was needed on the Mac anyway).
398 (this comment 2024-11-16)
399 */
400 }
401 mycxx . . $ `melder/melder.h:44:9`! v_goAwaycxx . . $ structEditor#v_goAway(49f6e7a06ebc5aa8). ();
402 }
403
404 static void menu_cb_closecxx . . $ menu_cb_close(8b4cc4166db3712c). (Editorcxx . . $ Editor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
405 mycxx . . $ `melder/melder.h:44:9`! v_goAwaycxx . . $ structEditor#v_goAway(49f6e7a06ebc5aa8). ();
406 if (optionalInterpreter && (optionalInterpreter -> optionalOwningEnvironmentEditorcxx . . $ structInterpreter#optionalOwningEnvironmentEditor(480fba2ddcd094f3).() == me || optionalInterpreter -> optionalDynamicEnvironmentEditorcxx . . $ structInterpreter#optionalDynamicEnvironmentEditor(480fba2ddcd094f3).() == me))
407 optionalInterpreter -> undangleEditorEnvironmentscxx . . $ structInterpreter#undangleEditorEnvironments(ced63f7c635d850d). ();
408 }
409
410 static void menu_cb_quitcxx . . $ menu_cb_quit(8b4cc4166db3712c). (Editorcxx . . $ Editor# /* me */, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
411 Gui_runQuitApplicationCallbackcxx . . $ Gui_runQuitApplicationCallback(49f6e7a06ebc5aa8). ();
412 }
413
414 static void menu_cb_undocxx . . $ menu_cb_undo(8b4cc4166db3712c). (Editorcxx . . $ Editor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
415 if (! mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).())
416 return; // apparently we aren't *meant* to have data
417 if (mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. == 0)
418 return; // nothing to restore (just in case the Undo button is inappropriately active)
419 Daatacxx . . $ Daata# savedData = mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..datacxx . . $ structEditor#Undo#data. [mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position.].getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
420 conststring32cxx . . $ conststring32# savedDescription = mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..descriptioncxx . . $ structEditor#Undo#description. [mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position.].getcxx . . $ _autostring#get(5a2a78a048fb49a8).();
421 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. -= 1;
422 if (! savedData)
423 return;
424 mycxx . . $ `melder/melder.h:44:9`! v_restoreDataFromUndocxx . . $ structEditor#v_restoreDataFromUndo(fde123624714e72). (savedData);
425 /*
426 The new text on the Undo button will be the description of the next-lower saved commmand.
427 */
428 char32cxx . . $ char32# buttonText [100];
429 if (mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. == 0) {
430 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (mycxx . . $ `melder/melder.h:44:9`! undoButtoncxx . . $ structEditor#undoButton., false);
431 GuiMenuItem_setTextcxx . . $ GuiMenuItem_setText(ca20014d6c2b902c). (mycxx . . $ `melder/melder.h:44:9`! undoButtoncxx . . $ structEditor#undoButton., U"Can't undo");
432 } else {
433 conststring32cxx . . $ conststring32# nextLowerSavedDescription = mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..descriptioncxx . . $ structEditor#Undo#description. [mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position.].getcxx . . $ _autostring#get(5a2a78a048fb49a8).();
434 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (buttonText,100, U"Undo ", nextLowerSavedDescription);
435 GuiMenuItem_setTextcxx . . $ GuiMenuItem_setText(ca20014d6c2b902c). (mycxx . . $ `melder/melder.h:44:9`! undoButtoncxx . . $ structEditor#undoButton., buttonText);
436 }
437 /*
438 The new text on the Redo button will be the description of the commmand just undone.
439 */
440 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (mycxx . . $ `melder/melder.h:44:9`! redoButtoncxx . . $ structEditor#redoButton., true);
441 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (buttonText,100, U"Redo ", savedDescription);
442 GuiMenuItem_setTextcxx . . $ GuiMenuItem_setText(ca20014d6c2b902c). (mycxx . . $ `melder/melder.h:44:9`! redoButtoncxx . . $ structEditor#redoButton., buttonText);
443
444 Editor_broadcastDataChangedcxx . . $ Editor_broadcastDataChanged(c0154a85f79216c7). (me);
445 }
446
447 static void menu_cb_redocxx . . $ menu_cb_redo(8b4cc4166db3712c). (Editorcxx . . $ Editor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
448 if (! mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).())
449 return; // apparently we aren't *meant* to have data
450 if (mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. == mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..MAX_DEPTHcxx . . $ structEditor#Undo#MAX_DEPTH.)
451 return; // nothing to restore (just in case the Redo button is inappropriately active)
452 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. += 1;
453 Daatacxx . . $ Daata# savedData = mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..datacxx . . $ structEditor#Undo#data. [mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position.].getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).();
454 conststring32cxx . . $ conststring32# savedDescription = mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..descriptioncxx . . $ structEditor#Undo#description. [mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position.].getcxx . . $ _autostring#get(5a2a78a048fb49a8).();
455 if (! savedData)
456 return;
457 mycxx . . $ `melder/melder.h:44:9`! v_restoreDataFromUndocxx . . $ structEditor#v_restoreDataFromUndo(fde123624714e72). (savedData);
458 /*
459 The new text on the Redo button will be the description of the next-higher saved commmand.
460 */
461 char32cxx . . $ char32# buttonText [100];
462 if (mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. == mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..MAX_DEPTHcxx . . $ structEditor#Undo#MAX_DEPTH. || ! mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..datacxx . . $ structEditor#Undo#data. [mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. + 1]) {
463 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (mycxx . . $ `melder/melder.h:44:9`! redoButtoncxx . . $ structEditor#redoButton., false);
464 GuiMenuItem_setTextcxx . . $ GuiMenuItem_setText(ca20014d6c2b902c). (mycxx . . $ `melder/melder.h:44:9`! redoButtoncxx . . $ structEditor#redoButton., U"Can't redo");
465 } else {
466 conststring32cxx . . $ conststring32# nextHigherSavedDescription = mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..descriptioncxx . . $ structEditor#Undo#description. [mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. + 1].getcxx . . $ _autostring#get(5a2a78a048fb49a8).();
467 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (buttonText,100, U"Redo ", nextHigherSavedDescription);
468 GuiMenuItem_setTextcxx . . $ GuiMenuItem_setText(ca20014d6c2b902c). (mycxx . . $ `melder/melder.h:44:9`! redoButtoncxx . . $ structEditor#redoButton., buttonText);
469 }
470 /*
471 The new text on the Undo button will be the description of the commmand just redone.
472 */
473 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (mycxx . . $ `melder/melder.h:44:9`! undoButtoncxx . . $ structEditor#undoButton., true);
474 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (buttonText,100, U"Undo ", savedDescription);
475 GuiMenuItem_setTextcxx . . $ GuiMenuItem_setText(ca20014d6c2b902c). (mycxx . . $ `melder/melder.h:44:9`! undoButtoncxx . . $ structEditor#undoButton., buttonText);
476
477 Editor_broadcastDataChangedcxx . . $ Editor_broadcastDataChanged(c0154a85f79216c7). (me);
478 }
479
480 static void menu_cb_clearUndoHistorycxx . . $ menu_cb_clearUndoHistory(8b4cc4166db3712c). (Editorcxx . . $ Editor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
481 for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..MAX_DEPTHcxx . . $ structEditor#Undo#MAX_DEPTH.; i ++) {
482 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..datacxx . . $ structEditor#Undo#data. [i]. resetcxx . . $ autoSomeThing#reset(ced63f7c635d850d).();
483 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..descriptioncxx . . $ structEditor#Undo#description. [i]. resetcxx . . $ _autostring#reset(49f6e7a06ebc5aa8).();
484 }
485 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. = 0;
486 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (mycxx . . $ `melder/melder.h:44:9`! undoButtoncxx . . $ structEditor#undoButton., false);
487 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (mycxx . . $ `melder/melder.h:44:9`! redoButtoncxx . . $ structEditor#redoButton., false);
488 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (mycxx . . $ `melder/melder.h:44:9`! clearUndoHistoryButtoncxx . . $ structEditor#clearUndoHistoryButton., false);
489 GuiMenuItem_setTextcxx . . $ GuiMenuItem_setText(ca20014d6c2b902c). (mycxx . . $ `melder/melder.h:44:9`! undoButtoncxx . . $ structEditor#undoButton., U"Can't undo");
490 GuiMenuItem_setTextcxx . . $ GuiMenuItem_setText(ca20014d6c2b902c). (mycxx . . $ `melder/melder.h:44:9`! redoButtoncxx . . $ structEditor#redoButton., U"Can't redo");
491 }
492
493 static void menu_cb_searchManualcxx . . $ menu_cb_searchManual(8b4cc4166db3712c). (Editorcxx . . $ Editor# /* me */, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
494 Melder_searchcxx . . $ Melder_search(49f6e7a06ebc5aa8). ();
495 }
496
497 static void menu_cb_newScriptcxx . . $ menu_cb_newScript(8b4cc4166db3712c). (Editorcxx . . $ Editor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
498 autoScriptEditorcxx . . $ autoScriptEditor# scriptEditor = ScriptEditor_createFromTextcxx . . $ ScriptEditor_createFromText(53cc301a35858397). (me, nullptr);
499 scriptEditor.releaseToUsercxx . . $ autoSomeThing#releaseToUser(ced63f7c635d850d).();
500 }
501
502 static void menu_cb_openScriptcxx . . $ menu_cb_openScript(8b4cc4166db3712c). (Editorcxx . . $ Editor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
503 autoScriptEditorcxx . . $ autoScriptEditor# scriptEditor = ScriptEditor_createFromTextcxx . . $ ScriptEditor_createFromText(53cc301a35858397). (me, nullptr);
504 TextEditor_showOpencxx . . $ TextEditor_showOpen(22283699a15c80c8). (scriptEditor.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
505 scriptEditor.releaseToUsercxx . . $ autoSomeThing#releaseToUser(ced63f7c635d850d).();
506 }
507
508 void structEditorcxx . . $ structEditor# :: v_createMenuItems_editcxx . . $ structEditor#v_createMenuItems_edit(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu# menu) {
509 if (ourcxx . . $ `melder/melder.h:42:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).()) {
510 ourcxx . . $ `melder/melder.h:42:9`! undoButtoncxx . . $ structEditor#undoButton. = EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, U"Can't undo", GuiMenu_INSENSITIVEcxx . . $ `sys/Gui.h:852:9`! + 'Z', menu_cb_undocxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
511 ourcxx . . $ `melder/melder.h:42:9`! redoButtoncxx . . $ structEditor#redoButton. = EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, U"Can't redo", GuiMenu_INSENSITIVEcxx . . $ `sys/Gui.h:852:9`! + 'Y', menu_cb_redocxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
512 ourcxx . . $ `melder/melder.h:42:9`! clearUndoHistoryButtoncxx . . $ structEditor#clearUndoHistoryButton. = EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, U"Clear undo history", GuiMenu_INSENSITIVEcxx . . $ `sys/Gui.h:852:9`!, menu_cb_clearUndoHistorycxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
513 }
514 }
515
516 static void INFO_EDITOR__settingsReportcxx . . $ INFO_EDITOR__settingsReport(8b4cc4166db3712c). (Editorcxx . . $ Editor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
517 INFO_EDITORcxx . . $ `sys/EditorM.h:539:9`!
518 Thing_infocxx . . $ Thing_info(97cddd01752945f6). (me);
519 INFO_EDITOR_ENDcxx . . $ `sys/EditorM.h:540:9`!
520 }
521
522 static void INFO_DATA__infocxx . . $ INFO_DATA__info(8b4cc4166db3712c). (Editorcxx . . $ Editor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
523 INFO_DATAcxx . . $ `sys/EditorM.h:544:9`!
524 if (mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).())
525 Thing_infocxx . . $ Thing_info(97cddd01752945f6). (mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).());
526 INFO_DATA_ENDcxx . . $ `sys/EditorM.h:546:9`!
527 }
528
529 void structEditorcxx . . $ structEditor# :: v_createMenuscxx . . $ structEditor#v_createMenus(49f6e7a06ebc5aa8). () {
530 v_createMenuItems_prefscxx . . $ structDataGui#v_createMenuItems_prefs(6ea9c8c6ea2f58a9). (ourcxx . . $ `melder/melder.h:42:9`! fileMenucxx . . $ structEditor#fileMenu.);
531 v_createMenuItems_savecxx . . $ structDataGui#v_createMenuItems_save(6ea9c8c6ea2f58a9). (ourcxx . . $ `melder/melder.h:42:9`! fileMenucxx . . $ structEditor#fileMenu.);
532 if (ourcxx . . $ `melder/melder.h:42:9`! v_hasEditMenucxx . . $ structEditor#v_hasEditMenu(c9857a73d68e59ba). ()) {
533 ourcxx . . $ `melder/melder.h:42:9`! editMenucxx . . $ structEditor#editMenu. = Editor_addMenucxx . . $ Editor_addMenu(8b39ac34ca8e016f). (this, U"Edit", 0);
534 v_createMenuItems_editcxx . . $ structEditor#v_createMenuItems_edit(6ea9c8c6ea2f58a9). (ourcxx . . $ `melder/melder.h:42:9`! editMenucxx . . $ structEditor#editMenu.);
535 }
536 }
537
538 static void gui_window_cb_goAwaycxx . . $ gui_window_cb_goAway(c0154a85f79216c7). (Editorcxx . . $ Editor# me) {
539 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (me);
540 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (Thing_isa (me, classEditor));
541 mycxx . . $ `melder/melder.h:44:9`! v_goAwaycxx . . $ structEditor#v_goAway(49f6e7a06ebc5aa8). ();
542 }
543
544 void praat_addCommandsToEditorcxx . . $ praat_addCommandsToEditor(c0154a85f79216c7). (Editorcxx . . $ Editor# me);
545 void Editor_initcxx . . $ Editor_init(13f379e38ac41ed6). (Editorcxx . . $ Editor# me, int x, int y, int width, int height, conststring32cxx . . $ conststring32# title, Daatacxx . . $ Daata# data) {
546 DataGui_initcxx . . $ DataGui_init(9b97872e44568997). (me, data, true, me); // I am my own boss! BUG: check editability
547 /*
548 Zero widths are taken from the preferences.
549 */
550 if (width == 0)
551 width = mycxx . . $ `melder/melder.h:44:9`! classPref_shellWidthcxx . . $ structEditor#classPref_shellWidth(455f465bc33b4cdf).();
552 if (height == 0)
553 height = mycxx . . $ `melder/melder.h:44:9`! classPref_shellHeightcxx . . $ structEditor#classPref_shellHeight(455f465bc33b4cdf).();
554
555 double xmin, ymin, widthmax, heightmax;
556 Gui_getWindowPositioningBoundscxx . . $ Gui_getWindowPositioningBounds(dec26d86168e59a). (& xmin, & ymin, & widthmax, & heightmax);
557 /*
558 Negative widths are relative to the whole screen.
559 */
560 if (width < 0)
561 width += (int) widthmax;
562 if (height < 0)
563 height += (int) heightmax;
564 /*
565 Don't start with a maximized window, because then the user doesn't know what a click on the maximize button means.
566 */
567 Melder_clipRightcxx . . $ Melder_clipRight(5b63ce711df1ade7). (& width, (int) widthmax - 100);
568 Melder_clipRightcxx . . $ Melder_clipRight(5b63ce711df1ade7). (& height, (int) heightmax - 100);
569 /*
570 Make sure that the window has at least a sane size,
571 just in case the user made the previous window very small (Praat's FunctionEditor saves the last size),
572 or the user edited the preferences file (which might save a window size).
573 */
574 Melder_clipLeftcxx . . $ Melder_clipLeft(6245cd023a7d1552). (200, & width);
575 Melder_clipLeftcxx . . $ Melder_clipLeft(6245cd023a7d1552). (150, & height);
576 /*
577 Now that the size is right, establish the position.
578 */
579 int left, right, top, bottom;
580 if (x > 0) {
581 /*
582 Positive x: relative to the left edge of the screen.
583 */
584 left = (int) xmin + x;
585 right = left + width;
586 } else if (x < 0) {
587 /*
588 Negative x: relative to the right edge of the screen.
589 */
590 right = (int) xmin + (int) widthmax + x;
591 left = right - width;
592 } else {
593 /*
594 Zero x: randomize between the left and right edge of the screen.
595 */
596 left = (int) NUMrandomIntegercxx . . $ NUMrandomInteger(d0a0e4c270da0eca). ((int) xmin + 4, (int) xmin + (int) widthmax - width - 4);
597 right = left + width;
598 }
599 if (y > 0) {
600 /*
601 Positive y: relative to the top of the screen.
602 */
603 top = (int) ymin + y;
604 bottom = top + height;
605 } else if (y < 0) {
606 /*
607 Negative y: relative to the bottom of the screen.
608 */
609 bottom = (int) ymin + (int) heightmax + y;
610 top = bottom - height;
611 } else {
612 /*
613 Zero y: randomize between the top and bottom of the screen.
614 */
615 top = (int) NUMrandomIntegercxx . . $ NUMrandomInteger(d0a0e4c270da0eca). ((int) ymin + 4, (int) ymin + (int) heightmax - height - 4);
616 //Melder_casual (ymin, U" ", heightmax, U" ", height, U" ", top);
617 bottom = top + height;
618 }
619 #if defined (macintoshXXX) || gtkcxx . . $ `sys/Gui.h:33:10`!
620 top += Machine_getTitleBarHeightcxx . . $ Machine_getTitleBarHeight(b126dc7c1de90089). ();
621 bottom += Machine_getTitleBarHeightcxx . . $ Machine_getTitleBarHeight(b126dc7c1de90089). ();
622 #endif
623 mycxx . . $ `melder/melder.h:44:9`! windowFormcxx . . $ structEditor#windowForm. = GuiWindow_createcxx . . $ GuiWindow_create(f24bfc1968593561). (left, top, width, height, 450, 350, title,
624 gui_window_cb_goAwaycxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., me, mycxx . . $ `melder/melder.h:44:9`! v_canFullScreencxx . . $ structEditor#v_canFullScreen(c9857a73d68e59ba). () ? GuiWindow_FULLSCREENcxx . . $ `sys/Gui.h:1172:9`! : 0);
625 Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (me, title);
626
627 /*
628 Create menus.
629 */
630
631 if (mycxx . . $ `melder/melder.h:44:9`! v_hasMenuBarcxx . . $ structEditor#v_hasMenuBar(c9857a73d68e59ba). ())
632 GuiWindow_addMenuBarcxx . . $ GuiWindow_addMenuBar(20efc9fbfef198b1). (mycxx . . $ `melder/melder.h:44:9`! windowFormcxx . . $ structEditor#windowForm.);
633
634 mycxx . . $ `melder/melder.h:44:9`! v_createChildrencxx . . $ structEditor#v_createChildren(49f6e7a06ebc5aa8). ();
635
636 if (mycxx . . $ `melder/melder.h:44:9`! v_hasMenuBarcxx . . $ structEditor#v_hasMenuBar(c9857a73d68e59ba). ()) {
637 mycxx . . $ `melder/melder.h:44:9`! fileMenucxx . . $ structEditor#fileMenu. = Editor_addMenucxx . . $ Editor_addMenu(8b39ac34ca8e016f). (me, U"File", 0);
638 if (mycxx . . $ `melder/melder.h:44:9`! v_canReportSettingscxx . . $ structEditor#v_canReportSettings(c9857a73d68e59ba). ()) {
639 EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (mycxx . . $ `melder/melder.h:44:9`! fileMenucxx . . $ structEditor#fileMenu., U"Editor info || Settings report", 0, INFO_EDITOR__settingsReportcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
640 if (mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).())
641 EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (mycxx . . $ `melder/melder.h:44:9`! fileMenucxx . . $ structEditor#fileMenu., Melder_catcxx . . $ Melder_cat(7fbf27f4d367f442). (Thing_classNamecxx . . $ Thing_className(fbb3dc34e3ef688d). (mycxx . . $ `melder/melder.h:44:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).()), U" info"), 0, INFO_DATA__infocxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
642 }
643 mycxx . . $ `melder/melder.h:44:9`! v_createMenuscxx . . $ structEditor#v_createMenus(49f6e7a06ebc5aa8). ();
644 EditorMenucxx . . $ EditorMenu# helpMenu = Editor_addMenucxx . . $ Editor_addMenu(8b39ac34ca8e016f). (me, U"Help", 0);
645 mycxx . . $ `melder/melder.h:44:9`! v_createMenuItems_helpcxx . . $ structDataGui#v_createMenuItems_help(6ea9c8c6ea2f58a9). (helpMenu);
646 EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (helpMenu, U"-- search --", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
647 mycxx . . $ `melder/melder.h:44:9`! searchButtoncxx . . $ structEditor#searchButton. = EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (helpMenu, U"Search manual...", 'M', menu_cb_searchManualcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
648 if (mycxx . . $ `melder/melder.h:44:9`! v_scriptablecxx . . $ structEditor#v_scriptable(c9857a73d68e59ba). ()) {
649 EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (mycxx . . $ `melder/melder.h:44:9`! fileMenucxx . . $ structEditor#fileMenu., U"-- scripting --", 0, 0cxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
650 EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (mycxx . . $ `melder/melder.h:44:9`! fileMenucxx . . $ structEditor#fileMenu., U"New editor script", 0, menu_cb_newScriptcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
651 EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (mycxx . . $ `melder/melder.h:44:9`! fileMenucxx . . $ structEditor#fileMenu., U"Open editor script...", 0, menu_cb_openScriptcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
652 }
653 /*
654 Add the scripted commands.
655 */
656 praat_addCommandsToEditorcxx . . $ praat_addCommandsToEditor(c0154a85f79216c7). (me);
657 EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (mycxx . . $ `melder/melder.h:44:9`! fileMenucxx . . $ structEditor#fileMenu., U"-- closing --", 0, 0cxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
658 if (mycxx . . $ `melder/melder.h:44:9`! callbackSocketcxx . . $ structEditor#callbackSocket.)
659 EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (mycxx . . $ `melder/melder.h:44:9`! fileMenucxx . . $ structEditor#fileMenu., U"Send back to calling program", 0, menu_cb_sendBackToCallingProgramcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
660 EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (mycxx . . $ `melder/melder.h:44:9`! fileMenucxx . . $ structEditor#fileMenu., U"Close", 'W', menu_cb_closecxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
661 #ifndef macintosh
662 EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (mycxx . . $ `melder/melder.h:44:9`! fileMenucxx . . $ structEditor#fileMenu., Melder_catcxx . . $ Melder_cat(7fbf27f4d367f442). (U"Quit ", Melder_upperCaseAppNamecxx . . $ Melder_upperCaseAppName(1912f6684645c851). (), U" || Quit"), 'Q', menu_cb_quitcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).);
663 #endif
664 }
665 GuiThing_showcxx . . $ GuiThing_show(20e88c25f0ba841). (mycxx . . $ `melder/melder.h:44:9`! windowFormcxx . . $ structEditor#windowForm.);
666 }
667
668 void Editor_savecxx . . $ Editor_save(ed6f6b1571b749af). (Editorcxx . . $ Editor# me, conststring32cxx . . $ conststring32# cattableDescription) {
669 /*
670 Construct the text for the Undo button before `cattableDescription` goes invalid.
671 */
672 char32cxx . . $ char32# undoText [100];
673 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (undoText,100, U"Undo ", cattableDescription);
674 /*
675 Save the data and description into the undo buffer.
676 */
677 autostring32cxx . . $ autostring32# descriptionToSaveForUndo = Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (cattableDescription); // uncat before calling any virtual function
678 autoDaatacxx . . $ autoDaata# dataToSaveForUndo = mycxx . . $ `melder/melder.h:44:9`! v_dataToSaveForUndocxx . . $ structEditor#v_dataToSaveForUndo(3481808043203226).();
679 if (! dataToSaveForUndo)
680 return;
681 if (mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. == mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..MAX_DEPTHcxx . . $ structEditor#Undo#MAX_DEPTH.)
682 for (integercxx . . $ integer# i = 1; i < mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..MAX_DEPTHcxx . . $ structEditor#Undo#MAX_DEPTH.; i ++) {
683 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..datacxx . . $ structEditor#Undo#data. [i] =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..datacxx . . $ structEditor#Undo#data. [i + 1].movecxx . . $ autoSomeThing#move(25acc3554b7d1642).();
684 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..descriptioncxx . . $ structEditor#Undo#description. [i] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..descriptioncxx . . $ structEditor#Undo#description. [i + 1].movecxx . . $ _autostring#move(bd43c759570f178f).();
685 }
686 else
687 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. += 1;
688 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..datacxx . . $ structEditor#Undo#data. [mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position.] =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). dataToSaveForUndo.movecxx . . $ autoSomeThing#move(25acc3554b7d1642).();
689 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..descriptioncxx . . $ structEditor#Undo#description. [mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position.] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). descriptionToSaveForUndo.movecxx . . $ _autostring#move(bd43c759570f178f).();
690 for (integercxx . . $ integer# i = mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..positioncxx . . $ structEditor#Undo#position. + 1; i < mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..MAX_DEPTHcxx . . $ structEditor#Undo#MAX_DEPTH.; i ++) {
691 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..datacxx . . $ structEditor#Undo#data. [i]. resetcxx . . $ autoSomeThing#reset(ced63f7c635d850d).();
692 mycxx . . $ `melder/melder.h:44:9`! undocxx . . $ structEditor#undo..descriptioncxx . . $ structEditor#Undo#description. [i]. resetcxx . . $ _autostring#reset(49f6e7a06ebc5aa8).();
693 }
694 /*
695 Update some Undo buttons.
696 */
697 if (! mycxx . . $ `melder/melder.h:44:9`! undoButtoncxx . . $ structEditor#undoButton.)
698 return;
699 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (mycxx . . $ `melder/melder.h:44:9`! undoButtoncxx . . $ structEditor#undoButton., true);
700 GuiMenuItem_setTextcxx . . $ GuiMenuItem_setText(ca20014d6c2b902c). (mycxx . . $ `melder/melder.h:44:9`! undoButtoncxx . . $ structEditor#undoButton., undoText);
701 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (mycxx . . $ `melder/melder.h:44:9`! clearUndoHistoryButtoncxx . . $ structEditor#clearUndoHistoryButton., true);
702 }
703
704 /* End of file Editor.cpp */