Adapted to praat 6.0.14 (15?)
[sgc2.git] / praat_module / adaptPraat.patch
blob35a2b86e0b00eaca838ff9daf14797398f522f8f
1 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/melder_audio.cpp demo_praat_sources/sys/melder_audio.cpp
2 --- praat_sources/sys/melder_audio.cpp 2014-12-29 08:24:04.000000000 +0100
3 +++ demo_praat_sources/sys/melder_audio.cpp 2015-05-12 09:48:06.000000000 +0200
4 # Allow playback in the background
5 @@ -1033,10 +1033,14 @@ void MelderAudio_play16 (int16_t *buffer
6 my numberOfChannels = numberOfChannels;
7 my callback = playCallback;
8 my closure = playClosure;
9 + #ifdef DEMOAPP
10 + my asynchronicity = kMelder_asynchronicityLevel_ASYNCHRONOUS;
11 + #else
12 my asynchronicity =
13 Melder_batch ? kMelder_asynchronicityLevel_SYNCHRONOUS :
14 (Melder_backgrounding && ! Melder_asynchronous) ? kMelder_asynchronicityLevel_INTERRUPTABLE :
15 kMelder_asynchronicityLevel_ASYNCHRONOUS;
16 + #endif
17 if (my asynchronicity > preferences. maximumAsynchronicity)
18 my asynchronicity = preferences. maximumAsynchronicity;
19 trace (U"asynchronicity ", my asynchronicity);
20 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat_script.cpp demo_praat_sources/sys/praat_script.cpp
21 --- praat_sources/sys/praat_script.cpp 2011-09-02 13:53:33.000000000 +0200
22 +++ demo_praat_sources/sys/praat_script.cpp 2011-10-28 07:54:25.000000000 +0200
23 # In case of an error, terminate the program
24 @@ -603,6 +603,7 @@ void praat_executeScriptFromText (wchar
25 autostring32 string = Melder_dup (text); // copy, because Interpreter will change it (UGLY)
26 Interpreter_run (interpreter.get(), string.peek());
27 } catch (MelderError) {
28 + exit (0);
29 Melder_throw (U"Script not completed.");
32 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/Graphics_text.cpp demo_praat_sources/sys/Graphics_text.cpp
33 --- praat_sources/sys/Graphics_text.cpp 2011-09-29 12:27:01.000000000 +0200
34 +++ demo_praat_sources/sys/Graphics_text.cpp 2011-10-27 09:14:57.000000000 +0200
35 # Supress the annoying message about the phonetic font not being installed
36 @@ -151,7 +151,7 @@ static HFONT loadFont (GraphicsScreen me
37 ipaInited = true;
38 if (! charisAvailable && ! doulosAvailable) {
39 /* BUG: The next warning may cause reentry of drawing (on window exposure) and lead to crash. Some code must be non-reentrant !! */
40 - Melder_warning (U"The phonetic font is not available.\nSeveral characters may not look correct.\nSee www.praat.org");
41 + //Melder_warning (U"The phonetic font is not available.\nSeveral characters may not look correct.\nSee www.praat.org");
44 wcscpy (spec. lfFaceName,
45 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat.cpp demo_praat_sources/sys/praat.cpp
46 --- praat_sources/sys/praat.cpp 2016-01-11 08:45:44.000000000 +0100
47 +++ demo_praat_sources/sys/praat.cpp 2016-01-27 15:29:23.000000000 +0100
48 # When running thePraatStandAloneScriptText, block the Melder_batch flag
49 @@ -1204,7 +1204,9 @@ void praat_init (const char32 *title, in
51 //Melder_casual (U"Script file name <<", theCurrentPraatApplication -> batchName.string, U">>");
53 + #if ! ( defined (_WIN32) && defined (DEMOAPP) )
54 Melder_batch |= !! thePraatStandAloneScriptText;
55 + #endif
58 * Running the Praat shell from the command line:
59 # Change the name of the Unix preference dir
60 @@ -1256,7 +1258,7 @@ void praat_init (const char32 *title, in
62 char32 name [256];
63 #if defined (UNIX)
64 - Melder_sprint (name,256, U".", programName, U"-dir"); // for example .myProg-dir
65 + Melder_sprint (name,256, U".", programName, U""); // for example .myProg-dir
66 #elif defined (macintosh)
67 Melder_sprint (name,256, praatP.title, U" Prefs"); // for example MyProg Prefs
68 #elif defined (_WIN32)
69 # Something in Linux (GTK)? Do not know what?
70 @@ -1340,6 +1342,12 @@ void praat_init (const char32 *title, in
72 GuiWindow raam = nullptr;
73 if (Melder_batch) {
74 + #if defined (DEMOAPP) && gtk
75 + Machine_initLookAndFeel (argc, argv);
76 + char32 objectWindowTitle [100];
77 + Melder_sprint (objectWindowTitle,100, praatP.title, U"");
78 + GuiWindow_create (0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 1, 1, objectWindowTitle, gui_cb_quit, NULL, 0);
79 + #endif
80 MelderString_empty (& theCurrentPraatApplication -> batchName);
81 for (unsigned int i = praatP.argumentNumber - 1; i < argc; i ++) {
82 if (i >= praatP.argumentNumber) MelderString_append (& theCurrentPraatApplication -> batchName, U" ");
83 # Supress opening the object window, initialize praat under Mac 64 bit (cocoa) Needed for 10.7
84 @@ -1383,10 +1391,32 @@ void praat_init (const char32 *title, in
85 #if motif
86 GuiApp_setApplicationShell (theCurrentPraatApplication -> topShell -> d_xmShell);
87 #endif
88 +#ifndef DEMOAPP
89 trace (U"before objects window shows locale ", Melder_peek8to32 (setlocale (LC_ALL, nullptr)));
90 GuiThing_show (raam);
91 trace (U"after objects window shows locale ", Melder_peek8to32 (setlocale (LC_ALL, nullptr)));
92 +#endif
95 + #if cocoa
96 + {
97 + trace (U"starting the application");
98 + Machine_initLookAndFeel (argc, argv);
99 + /*
100 + * Start the application.
101 + */
102 + //[NSApplication sharedApplication];
103 + [GuiCocoaApplication sharedApplication];
105 + trace (U"creating and installing the Objects window");
106 + char32 objectWindowTitle [100];
107 + double x, y;
108 + trace (U"locale ", Melder_peek8to32 (setlocale (LC_ALL, nullptr)));
109 + Gui_getWindowPositioningBounds (& x, & y, nullptr, nullptr);
110 + trace (U"locale ", Melder_peek8to32 (setlocale (LC_ALL, nullptr)));
112 + #endif
114 Thing_recognizeClassesByName (classCollection, classStrings, classManPages, classStringSet, nullptr);
115 Thing_recognizeClassByOtherName (classStringSet, U"SortedSetOfString");
116 if (Melder_batch) {
117 # Seems to speed startup, but not sure whether it is necessary
118 @@ -1396,6 +1426,9 @@ void praat_init (const char32 *title, in
119 trace (U"adding fixed buttons without GUI");
120 praat_addFixedButtons (nullptr);
121 } else {
122 + #ifdef DEMOAPP
123 + Melder_backgrounding = true;
124 + #endif
126 #ifdef macintosh
127 #if ! useCarbon
128 # Supress opening the object window
129 @@ -1423,7 +1456,9 @@ void praat_init (const char32 *title, in
130 trace (U"creating the dynamic menu in the Objects window");
131 praat_actions_createDynamicMenu (raam);
132 trace (U"showing the Objects window");
133 +#ifndef DEMOAPP
134 GuiThing_show (raam);
135 +#endif
136 //Melder_fatal (U"stop");
137 #if defined (UNIX) && ! defined (NO_GRAPHICS)
138 try {
139 # Initialize a picture window, but close it immediately
140 @@ -1454,7 +1489,12 @@ void praat_init (const char32 *title, in
142 trace (U"creating the Picture window");
143 trace (U"before picture window shows: locale is ", Melder_peek8to32 (setlocale (LC_ALL, nullptr)));
144 - if (! praatP.dontUsePictureWindow) praat_picture_init ();
145 + #ifdef DEMOAPP
146 + praat_picture_init ();
147 + praat_dontUsePictureWindow ();
148 + #else
149 + if (! praatP.dontUsePictureWindow) praat_picture_init ();
150 + #endif
151 trace (U"after picture window shows: locale is ", Melder_peek8to32 (setlocale (LC_ALL, nullptr)));
153 if (unknownCommandLineOption) {
154 # No idea why this is needed?
155 @@ -1615,7 +1655,7 @@ void praat_run () {
156 Melder_fatal (U"The number 1000000000000 is mistaken written on this machine as ", dummy, U".");
158 { uint32_t dummy = 0xffffffff;
159 - Melder_assert ((int64) dummy == 4294967295LL);
160 + Melder_assert ((int64_t) dummy == 4294967295LL);
161 Melder_assert (str32equ (Melder_integer (dummy), U"4294967295"));
162 Melder_assert (double (dummy) == 4294967295.0);
164 # Next chunk is needed to start the Demo window under Windows (motif)
165 @@ -1729,10 +1769,20 @@ void praat_run () {
166 #elif cocoa
167 [NSApp run];
168 #elif motif
169 - for (;;) {
170 - XEvent event;
171 - GuiNextEvent (& event);
172 - XtDispatchEvent (& event);
173 + if (thePraatStandAloneScriptText) {
174 + try {
175 + praat_executeScriptFromText (thePraatStandAloneScriptText);
176 + praat_exit (0);
177 + } catch (MelderError) {
178 + Melder_flushError (praatP.title, U": stand-alone script session interrupted.");
179 + praat_exit (-1);
181 + } else {
182 + for (;;) {
183 + XEvent event;
184 + GuiNextEvent (& event);
185 + XtDispatchEvent (& event);
186 + }
188 #endif
190 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat_picture.cpp demo_praat_sources/sys/praat_picture.cpp
191 --- praat_sources/sys/praat_picture.cpp 2012-09-27 09:10:50.000000000 +0200
192 +++ demo_praat_sources/sys/praat_picture.cpp 2012-10-15 13:47:43.000000000 +0200
193 # Supress picture window
194 @@ -1494,8 +1494,10 @@ void praat_picture_open (void) {
195 #elif cocoa
196 GuiThing_show (dialog);
197 #elif motif
198 +#ifndef DEMOAPP
199 XtMapWidget (dialog -> d_xmShell);
200 XMapRaised (XtDisplay (dialog -> d_xmShell), XtWindow (dialog -> d_xmShell));
201 +#endif
202 #endif
203 Picture_unhighlight (praat_picture.get());
205 @@ -1779,7 +1781,9 @@ void praat_picture_init (void) {
206 width = height = resolution * 12;
207 scrollWindow = GuiScrolledWindow_createShown (dialog, margin, 0, Machine_getMenuBarHeight () + margin, 0, 1, 1, 0);
208 drawingArea = GuiDrawingArea_createShown (scrollWindow, width, height, nullptr, nullptr, nullptr, nullptr, nullptr, 0);
209 +#ifndef DEMOAPP
210 GuiThing_show (dialog);
211 +#endif
214 // TODO: Paul: deze moet VOOR de update functies anders krijgen die void_me 0x0
215 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/fon/praat_Sound_init.cpp demo_praat_sources/fon/praat_Sound_init.cpp
216 --- praat_sources/fon/praat_Sound_init.cpp 2012-10-11 10:39:47.000000000 +0200
217 +++ demo_praat_sources/fon/praat_Sound_init.cpp 2012-10-18 15:09:22.000000000 +0200
218 # View and edit Long/Sounds in a DemoApp (when Melder_back = True)
219 @@ -168,7 +168,9 @@ DO
220 END2 }
222 DIRECT2 (LongSound_view) {
223 +#ifndef DEMOAPP
224 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a LongSound from batch.");
225 +#endif
226 LOOP {
227 iam (LongSound);
228 autoSoundEditor editor = SoundEditor_create (ID_AND_FULL_NAME, me);
229 @@ -774,7 +776,9 @@ static void cb_SoundEditor_publication (
232 DIRECT2 (Sound_edit) {
233 +#ifndef DEMOAPP
234 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a Sound from batch.");
235 +#endif
236 LOOP {
237 iam (Sound);
238 autoSoundEditor editor = SoundEditor_create (ID_AND_FULL_NAME, me);
239 @@ -1453,8 +1457,10 @@ static void cb_SoundRecorder_publication
240 praat_updateSelection ();
242 static void do_Sound_record (int numberOfChannels) {
243 +#ifndef DEMOAPP
244 if (theCurrentPraatApplication -> batch)
245 Melder_throw (U"Cannot record a Sound from batch.");
246 +#endif
247 if (theReferenceToTheOnlySoundRecorder && numberOfChannels == thePreviousNumberOfChannels) {
248 Editor_raise (theReferenceToTheOnlySoundRecorder);
249 } else {
250 # Handle situation where there is no sound input in Windows
251 @@ -1502,10 +1508,21 @@ FORM (Sound_recordFixedTime, U"Record So
252 POSITIVE (U"Duration (seconds)", U"1.0")
255 +#if defined (_WIN32) && defined (DEMOAPP)
256 + UINT numberOfDevices = waveInGetNumDevs (), i;
257 + if(numberOfDevices > 0) {
258 +#endif
259 autoSound me = Sound_recordFixedTime (GET_INTEGER (U"Input source"),
260 GET_REAL (U"Gain"), GET_REAL (U"Balance"),
261 Melder_atof (GET_STRING (U"Sampling frequency")), GET_REAL (U"Duration"));
262 praat_new (me.move(), U"untitled");
263 +#if defined (_WIN32) && defined (DEMOAPP)
264 + } else {
265 + // Create an empty sound if no input is available
266 + autoSound me = Sound_createSimple (1, GET_REAL (U"Duration"), GET_REAL (U"Sampling frequency"));
267 + praat_new (me.move(), U"untitled");
268 + };
269 +#endif
270 END2 }
272 FORM (Sound_resample, U"Sound: Resample", U"Sound: Resample...") {
273 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/Ui.cpp demo_praat_sources/sys/Ui.cpp
274 --- praat_sources/sys/Ui.cpp 2014-01-27 09:02:44.000000000 +0100
275 +++ demo_praat_sources/sys/Ui.cpp 2014-03-27 12:22:58.000000000 +0100
276 # Increase size of Pause Forms
277 @@ -716,12 +716,16 @@ void UiForm_finish (I) {
278 void UiForm_finish (UiForm me) {
279 if (! my d_dialogParent && ! my isPauseForm) return;
281 + int numberOfContinueButtons = my numberOfContinueButtons;
282 int size = my numberOfFields;
283 int dialogHeight = 0, x = Gui_LEFT_DIALOG_SPACING, y;
284 int textFieldHeight = Gui_TEXTFIELD_HEIGHT;
285 - int dialogWidth = 520, dialogCentre = dialogWidth / 2, fieldX = dialogCentre + Gui_LABEL_SPACING / 2;
286 + int dialogWidth = REVERT_BUTTON_WIDTH + STOP_BUTTON_WIDTH + 2*Gui_LABEL_SPACING + numberOfContinueButtons*(STANDARDS_BUTTON_WIDTH + Gui_LABEL_SPACING), dialogCentre = dialogWidth / 2, fieldX = dialogCentre + Gui_LABEL_SPACING / 2;
287 int labelWidth = fieldX - Gui_LABEL_SPACING - x, fieldWidth = labelWidth, halfFieldWidth = fieldWidth / 2 - 6;
289 + /* Ensure that the dialogs are wide enough */
290 + if (dialogWidth<520) dialogWidth = 520;
292 GuiForm form;
295 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/UiPause.cpp demo_praat_sources/sys/UiPause.cpp
296 --- praat_sources/sys/UiPause.cpp 2012-09-27 09:10:50.000000000 +0200
297 +++ demo_praat_sources/sys/UiPause.cpp 2012-09-27 13:25:18.000000000 +0200
298 # Catch close buttons of Pause window and prevent terminating the script
299 @@ -153,6 +153,7 @@ int UiPause_end (int numberOfContinueBut
300 {// scope
301 autoMelderSaveDefaultDir saveDir;
302 thePauseForm_clicked = 0;
303 + if(str32nequ(continueText1, U"DESTROY WINDOW ", 15))thePauseForm_clicked = 1;
304 Melder_assert (theEventLoopDepth == 0);
305 theEventLoopDepth ++;
306 try {
307 @@ -176,24 +177,28 @@ int UiPause_end (int numberOfContinueBut
308 [pool release];
309 } while (! thePauseForm_clicked);
310 #elif motif
311 + if(str32nequ(continueText1, U"DESTROY WINDOW ", 15) == 0){
312 do {
313 XEvent event;
314 GuiNextEvent (& event);
315 XtDispatchEvent (& event);
316 } while (! thePauseForm_clicked);
317 + };
318 #endif
319 } catch (MelderError) {
320 Melder_flushError (U"An error made it to the outer level in a pause window; should not occur! Please write to paul.boersma@uva.nl");
322 theEventLoopDepth --;
324 + if(str32nequ(continueText1, U"DESTROY WINDOW ", 15))forget(thePauseForm);
325 if (wasBackgrounding) praat_background ();
326 /* BUG: should also restore praatP. editor. */
327 thePauseForm = nullptr; // undangle
328 thePauseFormRadio = nullptr; // undangle
329 if (thePauseForm_clicked == -1) {
330 - Interpreter_stop (interpreter);
331 - Melder_throw (U"You interrupted the script.");
332 + thePauseForm_clicked = cancelContinueButton;
333 + //Interpreter_stop (interpreter);
334 + //Melder_throw (U"You interrupted the script.");
335 //Melder_flushError ();
336 //Melder_clearError ();
337 } else {
338 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/dwtools/Intensity_extensions.cpp demo_praat_sources/dwtools/Intensity_extensions.cpp
339 --- praat_sources/dwtools/Intensity_extensions.cpp 2011-09-20 11:40:46.000000000 +0200
340 +++ demo_praat_sources/dwtools/Intensity_extensions.cpp 2011-09-28 11:45:46.000000000 +0200
341 @@ -66,9 +66,9 @@ TextGrid Intensity_to_TextGrid_detectSil
342 Vector_getMinimumAndX (me, 0, 0, 1, NUM_PEAK_INTERPOLATE_PARABOLIC, &intensity_min_db, &xOfMinimum);
343 double intensity_dbRange = intensity_max_db - intensity_min_db;
345 - if (intensity_dbRange < 10) {
346 - Melder_warning (U"The loudest and softest part in your sound only differ by ", intensity_dbRange, U" dB.");
348 + /*if (intensity_dbRange < 10) {
349 + Melder_warning (U"The loudest and softest part in your sound only differ by ", intensity_dbRange, U" dB.");
350 + }*/
351 double intensityThreshold = intensity_max_db - fabs (silenceThreshold_dB);
353 if (minSilenceDuration > duration || intensityThreshold < intensity_min_db) {
354 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat_objectMenus.cpp demo_praat_sources/sys/praat_objectMenus.cpp
355 --- praat_sources/sys/praat_objectMenus.cpp 2012-02-22 13:04:43.000000000 +0100
356 +++ demo_praat_sources/sys/praat_objectMenus.cpp 2012-02-22 13:48:24.000000000 +0100
357 # Allow the man pages
358 @@ -508,8 +508,10 @@ FORM (SearchManual, U"Search manual", U"
359 TEXTFIELD (U"query", U"")
362 + #ifndef DEMOAPP
363 if (theCurrentPraatApplication -> batch)
364 Melder_throw (U"Cannot view a manual from batch.");
365 + #endif
366 autoManual manual = Manual_create (U"Intro", theCurrentPraatApplication -> manPages, false);
367 Manual_search (manual.get(), GET_STRING (U"query"));
368 manual.releaseToUser();
369 @@ -521,8 +523,10 @@ FORM (GoToManualPage, U"Go to manual pag
370 LIST (U"Page", numberOfPages, pages, 1)}
373 + #ifndef DEMOAPP
374 if (theCurrentPraatApplication -> batch)
375 Melder_throw (U"Cannot view a manual from batch.");
376 + #endif
377 autoManual manual = Manual_create (U"Intro", theCurrentPraatApplication -> manPages, false);
378 HyperPage_goToPage_i (manual.get(), GET_INTEGER (U"Page"));
379 manual.releaseToUser();
380 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/GuiMenu.cpp demo_praat_sources/sys/GuiMenu.cpp
381 --- praat_sources/sys/GuiMenu.cpp 2012-09-27 09:10:50.000000000 +0200
382 +++ demo_praat_sources/sys/GuiMenu.cpp 2012-10-25 09:55:23.000000000 +0200
383 @@ -387,7 +387,9 @@ GuiMenu GuiMenu_createInWindow (GuiWindo
386 #elif motif
387 + #if not ( defined( DEMOAPP ) && defined( macintosh ) )
388 if (! window) {
389 + #endif
390 my d_xmMenuTitle = XmCreateCascadeButton (theGuiTopMenuBar, Melder_peek32to8 (title), nullptr, 0);
391 if (str32equ (title, U"Help"))
392 XtVaSetValues (theGuiTopMenuBar, XmNmenuHelpWidget, my d_xmMenuTitle, nullptr);
393 @@ -396,6 +398,7 @@ GuiMenu GuiMenu_createInWindow (GuiWindo
394 XtSetSensitive (my d_xmMenuTitle, False);
395 XtVaSetValues (my d_xmMenuTitle, XmNsubMenuId, my d_widget, nullptr);
396 XtManageChild (my d_xmMenuTitle);
397 + #if not ( defined( DEMOAPP ) && defined( macintosh ) )
398 } else {
399 my d_xmMenuTitle = XmCreateCascadeButton (window -> d_xmMenuBar, Melder_peek32to8 (title), nullptr, 0);
400 if (str32equ (title, U"Help"))
401 @@ -406,6 +409,7 @@ GuiMenu GuiMenu_createInWindow (GuiWindo
402 XtVaSetValues (my d_xmMenuTitle, XmNsubMenuId, my d_widget, nullptr);
403 XtManageChild (my d_xmMenuTitle);
405 + #endif
406 _GuiObject_setUserData (my d_widget, me.get());
407 #endif
409 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/DemoEditor.cpp demo_praat_sources/sys/DemoEditor.cpp
410 --- praat_sources/sys/DemoEditor.cpp 2014-05-09 08:59:02.000000000 +0200
411 +++ demo_praat_sources/sys/DemoEditor.cpp 2014-05-16 10:30:28.000000000 +0200
412 # Close the script and stop Praat. If you do not stop praat, you retain Zombie Praat processes under Windows
413 @@ -253,6 +253,7 @@ void Demo_waitForInput (Interpreter inte
414 if (theReferenceToTheOnlyDemoEditor -> userWantsToClose) {
415 Interpreter_stop (interpreter);
416 forget (theReferenceToTheOnlyDemoEditor);
417 + exit (0);
418 Melder_throw (U"You interrupted the script.");
421 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/stat/praat_Stat.cpp demo_praat_sources/stat/praat_Stat.cpp
422 --- praat_sources/stat/praat_Stat.cpp 2011-10-01 13:32:45.000000000 +0200
423 +++ demo_praat_sources/stat/praat_Stat.cpp 2011-11-18 08:55:32.000000000 +0100
424 # Allow to view tables when in a Demo app
425 @@ -424,7 +424,9 @@ DO
426 END2 }
428 DIRECT2 (Table_edit) {
429 +#ifndef DEMOAPP
430 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot edit a Table from batch.");
431 +#endif
432 LOOP {
433 iam (Table);
434 autoTableEditor editor = TableEditor_create (ID_AND_FULL_NAME, me);
435 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/fon/praat_TextGrid_init.cpp demo_praat_sources/fon/praat_TextGrid_init.cpp
436 --- praat_sources/fon/praat_TextGrid_init.cpp 2011-09-12 10:17:12.000000000 +0200
437 +++ demo_praat_sources/fon/praat_TextGrid_init.cpp 2011-09-12 10:59:25.000000000 +0200
438 # View and edit TextGrids in a DemoApp (when Melder_back = True)
439 @@ -861,7 +861,9 @@ static void cb_TextGridEditor_publicatio
442 DIRECT2 (TextGrid_edit) {
443 +#ifndef DEMOAPP
444 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
445 +#endif
446 Sound sound = nullptr;
447 LOOP {
448 if (CLASS == classSound) sound = (Sound) OBJECT; // may stay null
449 @@ -894,7 +896,9 @@ DIRECT (TextGrid_edit)
450 END2 }
452 DIRECT2 (TextGrid_LongSound_edit) {
453 +#ifndef DEMOAPP
454 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
455 +#endif
456 LongSound longSound = nullptr;
457 int ilongSound = 0;
458 LOOP {
459 @@ -911,7 +915,9 @@ DIRECT (TextGrid_LongSound_edit)
460 END2 }
462 DIRECT2 (TextGrid_SpellingChecker_edit) {
463 +#ifndef DEMOAPP
464 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
465 +#endif
466 SpellingChecker spellingChecker = nullptr;
467 int ispellingChecker = 0;
468 Sound sound = nullptr;
469 @@ -929,7 +935,9 @@ DIRECT (TextGrid_SpellingChecker_edit)
470 END2 }
472 DIRECT2 (TextGrid_LongSound_SpellingChecker_edit) {
473 +#ifndef DEMOAPP
474 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
475 +#endif
476 LongSound longSound = nullptr;
477 SpellingChecker spellingChecker = nullptr;
478 int ilongSound = 0, ispellingChecker = 0;
480 # Add DEMOAPP flag to compiler
481 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.linux.alsa demo_praat_sources/makefiles/makefile.defs.linux.alsa
482 --- praat_sources/makefiles/makefile.defs.linux.alsa 2011-09-12 10:17:12.000000000 +0200
483 +++ demo_praat_sources/makefiles/makefile.defs.linux.alsa 2011-09-12 13:28:59.000000000 +0200
484 @@ -7,7 +7,7 @@ CC = gcc -std=gnu99
486 CXX = g++ -std=c++11
488 -CFLAGS = -DUNIX -Dlinux -DALSA -D_FILE_OFFSET_BITS=64 `pkg-config --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O1 -g1 -pthread
489 +CFLAGS = -DUNIX -Dlinux -DALSA -D_FILE_OFFSET_BITS=64 `pkg-config --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -DDEMOAPP -O1 -g1 -pthread
491 CXXFLAGS = $(CFLAGS) -Wshadow
493 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.darmin32 demo_praat_sources/makefiles/makefile.defs.darmin32
494 --- praat_sources/makefiles/makefile.defs.darmin32 2011-09-19 12:26:39.000000000 +0200
495 +++ demo_praat_sources/makefiles/makefile.defs.darmin32 2011-09-19 15:33:55.000000000 +0200
496 @@ -7,7 +7,7 @@ CC = /mingw32/bin/gcc -std=gnu99 -isyste
498 CXX = /mingw32/bin/g++ -std=c++0x -isystem /mingw32/include/c++/4.7.0 -isystem /mingw32/include -Wshadow
500 -CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread
501 +CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread -DDEMOAPP
503 CXXFLAGS = $(CFLAGS)
505 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.darmin64 demo_praat_sources/makefiles/makefile.defs.darmin64
506 --- praat_sources/makefiles/makefile.defs.darmin64 2011-09-19 12:26:39.000000000 +0200
507 +++ demo_praat_sources/makefiles/makefile.defs.darmin64 2011-09-19 15:33:37.000000000 +0200
508 @@ -7,7 +7,7 @@ CC = /mingw64/bin/gcc -std=gnu99 -isyste
510 CXX = /mingw64/bin/g++ -std=c++0x -isystem /mingw64/include/c++/4.7.0 -isystem /mingw64/include -Wshadow -m64
512 -CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread
513 +CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread -DDEMOAPP
515 CXXFLAGS = $(CFLAGS)
517 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.mingw32 demo_praat_sources/makefiles/makefile.defs.mingw32
518 --- praat_sources/makefiles/makefile.defs.mingw32 2015-09-11 08:38:17.000000000 +0200
519 +++ demo_praat_sources/makefiles/makefile.defs.mingw32 2015-09-15 15:45:42.000000000 +0200
520 @@ -9,7 +9,7 @@ CC = $(PREFIX)gcc -std=gnu99
522 CXX = $(PREFIX)g++ -std=gnu++11 -Wshadow
524 -CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O3
525 +CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O3 -DDEMOAPP
526 # Probably implicit: -m32 -mwin32 -march=i686 -mtune=generic
528 CXXFLAGS = $(CFLAGS)
529 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.mingw64 demo_praat_sources/makefiles/makefile.defs.mingw64
530 --- praat_sources/makefiles/makefile.defs.mingw64 2015-09-11 08:38:17.000000000 +0200
531 +++ demo_praat_sources/makefiles/makefile.defs.mingw64 2015-09-15 15:48:18.000000000 +0200
532 @@ -9,7 +9,7 @@ CC = $(PREFIX)gcc -std=gnu99
534 CXX = $(PREFIX)g++ -std=gnu++11 -Wshadow
536 -CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O3
537 +CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O3 -DDEMOAPP
538 # Probably implicit: -m64 -mwin32 -march=x86_64 -mtune=generic
540 CXXFLAGS = $(CFLAGS)