Updated patch
[sgc2.git] / praat_module / adaptPraat.patch
blobe410888b217f32791db5e28bd1c4b0f442c27195
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 @@ -1027,10 +1027,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 @@ -589,6 +589,7 @@ void praat_executeScriptFromText (wchar
25 autostring32 string = Melder_dup (text); // copy, because Interpreter will change it (UGLY)
26 Interpreter_run (interpreter.peek(), 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 2014-04-22 11:09:57.000000000 +0200
47 +++ demo_praat_sources/sys/praat.cpp 2014-04-22 11:53:58.000000000 +0200
48 # When running thePraatStandAloneScriptText, block the Melder_batch flag
49 @@ -1202,7 +1202,9 @@ void praat_init (const char32 *title, un
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 @@ -1254,7 +1256,7 @@ void praat_init (const char *title, unsi
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 @@ -1338,6 +1340,12 @@ void praat_init (const char *title, unsi
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
84 @@ -1381,9 +1389,11 @@ void praat_init (const char *title, unsi
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
94 Thing_recognizeClassesByName (classCollection, classStrings, classManPages, classSortedSetOfString, nullptr);
95 if (Melder_batch) {
96 # Seems to speed startup, but not sure whether it is necessary
97 @@ -1393,6 +1403,9 @@ void praat_init (const char *title, unsi
98 trace (U"adding fixed buttons without GUI");
99 praat_addFixedButtons (nullptr);
100 } else {
101 + #ifdef DEMOAPP
102 + Melder_backgrounding = true;
103 + #endif
105 #ifdef macintosh
106 #if ! useCarbon
107 # Supress opening the object window
108 @@ -1420,7 +1433,9 @@ void praat_init (const char *title, unsi
109 trace (U"creating the dynamic menu in the Objects window");
110 praat_actions_createDynamicMenu (raam);
111 trace (U"showing the Objects window");
112 +#ifndef DEMOAPP
113 GuiThing_show (raam);
114 +#endif
115 //Melder_fatal (U"stop");
116 #if defined (UNIX) && ! defined (NO_GRAPHICS)
117 try {
118 # Initialize a picture window, but close it immediately
119 @@ -1451,7 +1466,12 @@ void praat_init (const char *title, unsi
121 trace (U"creating the Picture window");
122 trace (U"before picture window shows: locale is ", Melder_peek8to32 (setlocale (LC_ALL, nullptr)));
123 - if (! praatP.dontUsePictureWindow) praat_picture_init ();
124 + #ifdef DEMOAPP
125 + praat_picture_init ();
126 + praat_dontUsePictureWindow ();
127 + #else
128 + if (! praatP.dontUsePictureWindow) praat_picture_init ();
129 + #endif
130 trace (U"after picture window shows: locale is ", Melder_peek8to32 (setlocale (LC_ALL, nullptr)));
132 if (unknownCommandLineOption) {
133 # No idea why this is needed?
134 @@ -1607,11 +1627,11 @@ void praat_run (void) {
135 if (! str32equ (Melder_integer (dummy), U"1000000000000"))
136 Melder_fatal (U"The number 1000000000000 is mistaken written on this machine as ", dummy, U".");
138 - { uint32_t dummy = 0xffffffff;
139 - Melder_assert ((int64) dummy == 4294967295LL);
140 - Melder_assert (str32equ (Melder_integer (dummy), U"4294967295"));
141 - Melder_assert (double (dummy) == 4294967295.0);
143 + { uint32_t dummy = 0xffffffff;
144 + Melder_assert ((int64_t) dummy == 4294967295LL);
145 + Melder_assert (str32equ (Melder_integer (dummy), U"4294967295"));
146 + Melder_assert (double (dummy) == 4294967295.0);
148 { double dummy = 3000000000.0;
149 Melder_assert ((uint32) dummy == 3000000000);
151 # Next chunk is needed to start the Demo window under Windows (motif)
152 @@ -1722,10 +1742,20 @@ void praat_run () {
153 #elif cocoa
154 [NSApp run];
155 #elif motif
156 - for (;;) {
157 - XEvent event;
158 - GuiNextEvent (& event);
159 - XtDispatchEvent (& event);
160 + if (thePraatStandAloneScriptText) {
161 + try {
162 + praat_executeScriptFromText (thePraatStandAloneScriptText);
163 + praat_exit (0);
164 + } catch (MelderError) {
165 + Melder_flushError (praatP.title, U": stand-alone script session interrupted.");
166 + praat_exit (-1);
168 + } else {
169 + for (;;) {
170 + XEvent event;
171 + GuiNextEvent (& event);
172 + XtDispatchEvent (& event);
173 + }
175 #endif
177 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat_picture.cpp demo_praat_sources/sys/praat_picture.cpp
178 --- praat_sources/sys/praat_picture.cpp 2012-09-27 09:10:50.000000000 +0200
179 +++ demo_praat_sources/sys/praat_picture.cpp 2012-10-15 13:47:43.000000000 +0200
180 # Supress picture window
181 @@ -1494,8 +1494,10 @@ void praat_picture_open (void) {
182 #elif cocoa
183 GuiThing_show (dialog);
184 #elif motif
185 +#ifndef DEMOAPP
186 XtMapWidget (dialog -> d_xmShell);
187 XMapRaised (XtDisplay (dialog -> d_xmShell), XtWindow (dialog -> d_xmShell));
188 +#endif
189 #endif
190 Picture_unhighlight (praat_picture.get());
192 @@ -1779,7 +1781,9 @@ void praat_picture_init (void) {
193 width = height = resolution * 12;
194 scrollWindow = GuiScrolledWindow_createShown (dialog, margin, 0, Machine_getMenuBarHeight () + margin, 0, 1, 1, 0);
195 drawingArea = GuiDrawingArea_createShown (scrollWindow, width, height, nullptr, nullptr, nullptr, nullptr, nullptr, 0);
196 +#ifndef DEMOAPP
197 GuiThing_show (dialog);
198 +#endif
201 // TODO: Paul: deze moet VOOR de update functies anders krijgen die void_me 0x0
202 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/fon/praat_Sound_init.cpp demo_praat_sources/fon/praat_Sound_init.cpp
203 --- praat_sources/fon/praat_Sound_init.cpp 2012-10-11 10:39:47.000000000 +0200
204 +++ demo_praat_sources/fon/praat_Sound_init.cpp 2012-10-18 15:09:22.000000000 +0200
205 # View and edit Long/Sounds in a DemoApp (when Melder_back = True)
206 @@ -168,7 +168,9 @@ DO
207 END2 }
209 DIRECT2 (LongSound_view) {
210 +#ifndef DEMOAPP
211 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a LongSound from batch.");
212 +#endif
213 LOOP {
214 iam (LongSound);
215 autoSoundEditor editor = SoundEditor_create (ID_AND_FULL_NAME, me);
216 @@ -713,7 +715,9 @@ static void cb_SoundEditor_publication (
219 DIRECT2 (Sound_edit) {
220 +#ifndef DEMOAPP
221 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a Sound from batch.");
222 +#endif
223 LOOP {
224 iam (Sound);
225 autoSoundEditor editor = SoundEditor_create (ID_AND_FULL_NAME, me);
226 @@ -1390,8 +1394,10 @@ static void cb_SoundRecorder_publication
227 praat_updateSelection ();
229 static void do_Sound_record (int numberOfChannels) {
230 +#ifndef DEMOAPP
231 if (theCurrentPraatApplication -> batch)
232 Melder_throw (U"Cannot record a Sound from batch.");
233 +#endif
234 if (theSoundRecorder && numberOfChannels == thePreviousNumberOfChannels) {
235 Editor_raise (theSoundRecorder.get());
236 } else {
237 # Handle situation where there is no sound input in Windows
238 @@ -1436,10 +1442,21 @@ FORM (Sound_recordFixedTime, U"Record So
239 POSITIVE (U"Duration (seconds)", U"1.0")
242 +#if defined (_WIN32) && defined (DEMOAPP)
243 + UINT numberOfDevices = waveInGetNumDevs (), i;
244 + if(numberOfDevices > 0) {
245 +#endif
246 autoSound me = Sound_recordFixedTime (GET_INTEGER (U"Input source"),
247 GET_REAL (U"Gain"), GET_REAL (U"Balance"),
248 Melder_atof (GET_STRING (U"Sampling frequency")), GET_REAL (U"Duration"));
249 praat_new (me.move(), U"untitled");
250 +#if defined (_WIN32) && defined (DEMOAPP)
251 + } else {
252 + // Create an empty sound if no input is available
253 + autoSound me = Sound_createSimple (1, GET_REAL (U"Duration"), GET_REAL (U"Sampling frequency"));
254 + praat_new (me.transfer(), U"untitled");
255 + };
256 +#endif
257 END2 }
259 FORM (Sound_resample, U"Sound: Resample", U"Sound: Resample...") {
260 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/Ui.cpp demo_praat_sources/sys/Ui.cpp
261 --- praat_sources/sys/Ui.cpp 2014-01-27 09:02:44.000000000 +0100
262 +++ demo_praat_sources/sys/Ui.cpp 2014-03-27 12:22:58.000000000 +0100
263 # Increase size of Pause Forms
264 @@ -718,12 +718,16 @@ void UiForm_finish (I) {
265 void UiForm_finish (UiForm me) {
266 if (! my d_dialogParent && ! my isPauseForm) return;
268 + int numberOfContinueButtons = my numberOfContinueButtons;
269 int size = my numberOfFields;
270 int dialogHeight = 0, x = Gui_LEFT_DIALOG_SPACING, y;
271 int textFieldHeight = Gui_TEXTFIELD_HEIGHT;
272 - int dialogWidth = 520, dialogCentre = dialogWidth / 2, fieldX = dialogCentre + Gui_LABEL_SPACING / 2;
273 + 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;
274 int labelWidth = fieldX - Gui_LABEL_SPACING - x, fieldWidth = labelWidth, halfFieldWidth = fieldWidth / 2 - 6;
276 + /* Ensure that the dialogs are wide enough */
277 + if (dialogWidth<520) dialogWidth = 520;
279 GuiForm form;
282 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/UiPause.cpp demo_praat_sources/sys/UiPause.cpp
283 --- praat_sources/sys/UiPause.cpp 2012-09-27 09:10:50.000000000 +0200
284 +++ demo_praat_sources/sys/UiPause.cpp 2012-09-27 13:25:18.000000000 +0200
285 # Catch close buttons of Pause window and prevent terminating the script
286 @@ -153,6 +153,7 @@ int UiPause_end (int numberOfContinueBut
287 {// scope
288 autoMelderSaveDefaultDir saveDir;
289 thePauseForm_clicked = 0;
290 + if(str32nequ(continueText1, U"DESTROY WINDOW ", 15))thePauseForm_clicked = 1;
291 Melder_assert (theEventLoopDepth == 0);
292 theEventLoopDepth ++;
293 try {
294 @@ -176,24 +177,28 @@ int UiPause_end (int numberOfContinueBut
295 [pool release];
296 } while (! thePauseForm_clicked);
297 #elif motif
298 + if(str32nequ(continueText1, U"DESTROY WINDOW ", 15) == 0){
299 do {
300 XEvent event;
301 GuiNextEvent (& event);
302 XtDispatchEvent (& event);
303 } while (! thePauseForm_clicked);
304 + };
305 #endif
306 } catch (MelderError) {
307 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");
309 theEventLoopDepth --;
311 + if(str32nequ(continueText1, U"DESTROY WINDOW ", 15))forget(thePauseForm);
312 if (wasBackgrounding) praat_background ();
313 /* BUG: should also restore praatP. editor. */
314 thePauseForm = nullptr; // undangle
315 thePauseFormRadio = nullptr; // undangle
316 if (thePauseForm_clicked == -1) {
317 - Interpreter_stop (interpreter);
318 - Melder_throw (U"You interrupted the script.");
319 + thePauseForm_clicked = cancelContinueButton;
320 + //Interpreter_stop (interpreter);
321 + //Melder_throw (U"You interrupted the script.");
322 //Melder_flushError ();
323 //Melder_clearError ();
324 } else {
325 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/dwtools/Intensity_extensions.cpp demo_praat_sources/dwtools/Intensity_extensions.cpp
326 --- praat_sources/dwtools/Intensity_extensions.cpp 2011-09-20 11:40:46.000000000 +0200
327 +++ demo_praat_sources/dwtools/Intensity_extensions.cpp 2011-09-28 11:45:46.000000000 +0200
328 @@ -66,9 +66,9 @@ TextGrid Intensity_to_TextGrid_detectSil
329 Vector_getMinimumAndX (me, 0, 0, 1, NUM_PEAK_INTERPOLATE_PARABOLIC, &intensity_min_db, &xOfMinimum);
330 double intensity_dbRange = intensity_max_db - intensity_min_db;
332 - if (intensity_dbRange < 10) {
333 - Melder_warning (U"The loudest and softest part in your sound only differ by ", intensity_dbRange, U" dB.");
335 + /*if (intensity_dbRange < 10) {
336 + Melder_warning (U"The loudest and softest part in your sound only differ by ", intensity_dbRange, U" dB.");
337 + }*/
338 double intensityThreshold = intensity_max_db - fabs (silenceThreshold_dB);
340 if (minSilenceDuration > duration || intensityThreshold < intensity_min_db) {
341 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat_objectMenus.cpp demo_praat_sources/sys/praat_objectMenus.cpp
342 --- praat_sources/sys/praat_objectMenus.cpp 2012-02-22 13:04:43.000000000 +0100
343 +++ demo_praat_sources/sys/praat_objectMenus.cpp 2012-02-22 13:48:24.000000000 +0100
344 # Allow the man pages
345 @@ -503,8 +503,10 @@ FORM (SearchManual, U"Search manual", U"
346 TEXTFIELD (U"query", U"")
349 + #ifndef DEMOAPP
350 if (theCurrentPraatApplication -> batch)
351 Melder_throw (U"Cannot view a manual from batch.");
352 + #endif
353 Manual manPage = Manual_create (U"Intro", theCurrentPraatApplication -> manPages, false);
354 Manual_search (manPage, GET_STRING (U"query"));
355 END2 }
356 @@ -515,8 +517,10 @@ FORM (GoToManualPage, U"Go to manual pag
357 LIST (U"Page", numberOfPages, pages, 1)}
360 + #ifndef DEMOAPP
361 if (theCurrentPraatApplication -> batch)
362 Melder_throw (U"Cannot view a manual from batch.");
363 + #endif
364 Manual manPage = Manual_create (U"Intro", theCurrentPraatApplication -> manPages, false);
365 HyperPage_goToPage_i (manPage, GET_INTEGER (U"Page"));
366 END2 }
367 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/GuiMenu.cpp demo_praat_sources/sys/GuiMenu.cpp
368 --- praat_sources/sys/GuiMenu.cpp 2012-09-27 09:10:50.000000000 +0200
369 +++ demo_praat_sources/sys/GuiMenu.cpp 2012-10-25 09:55:23.000000000 +0200
370 @@ -368,7 +368,9 @@ GuiMenu GuiMenu_createInWindow (GuiWindo
373 #elif motif
374 + #if not ( defined( DEMOAPP ) && defined( macintosh ) )
375 if (! window) {
376 + #endif
377 my d_xmMenuTitle = XmCreateCascadeButton (theGuiTopMenuBar, Melder_peek32to8 (title), nullptr, 0);
378 if (str32equ (title, U"Help"))
379 XtVaSetValues (theGuiTopMenuBar, XmNmenuHelpWidget, my d_xmMenuTitle, nullptr);
380 @@ -377,6 +379,7 @@ GuiMenu GuiMenu_createInWindow (GuiWindo
381 XtSetSensitive (my d_xmMenuTitle, False);
382 XtVaSetValues (my d_xmMenuTitle, XmNsubMenuId, my d_widget, nullptr);
383 XtManageChild (my d_xmMenuTitle);
384 + #if not ( defined( DEMOAPP ) && defined( macintosh ) )
385 } else {
386 my d_xmMenuTitle = XmCreateCascadeButton (window -> d_xmMenuBar, Melder_peek32to8 (title), nullptr, 0);
387 if (str32equ (title, U"Help"))
388 @@ -387,6 +390,7 @@ GuiMenu GuiMenu_createInWindow (GuiWindo
389 XtVaSetValues (my d_xmMenuTitle, XmNsubMenuId, my d_widget, nullptr);
390 XtManageChild (my d_xmMenuTitle);
392 + #endif
393 _GuiObject_setUserData (my d_widget, me.get());
394 #endif
396 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/DemoEditor.cpp demo_praat_sources/sys/DemoEditor.cpp
397 --- praat_sources/sys/DemoEditor.cpp 2014-05-09 08:59:02.000000000 +0200
398 +++ demo_praat_sources/sys/DemoEditor.cpp 2014-05-16 10:30:28.000000000 +0200
399 # Close the script and stop Praat. If you do not stop praat, you retain Zombie Praat processes under Windows
400 @@ -240,6 +240,7 @@ void Demo_waitForInput (Interpreter inte
401 if (theDemoEditor -> userWantsToClose) {
402 Interpreter_stop (interpreter);
403 forget (theDemoEditor);
404 + exit (0);
405 Melder_throw (U"You interrupted the script.");
408 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/stat/praat_Stat.cpp demo_praat_sources/stat/praat_Stat.cpp
409 --- praat_sources/stat/praat_Stat.cpp 2011-10-01 13:32:45.000000000 +0200
410 +++ demo_praat_sources/stat/praat_Stat.cpp 2011-11-18 08:55:32.000000000 +0100
411 # Allow to view tables when in a Demo app
412 @@ -420,7 +420,9 @@ DO
413 END2 }
415 DIRECT2 (Table_edit) {
416 +#ifndef DEMOAPP
417 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot edit a Table from batch.");
418 +#endif
419 LOOP {
420 iam (Table);
421 autoTableEditor editor = TableEditor_create (ID_AND_FULL_NAME, me);
422 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/fon/praat_TextGrid_init.cpp demo_praat_sources/fon/praat_TextGrid_init.cpp
423 --- praat_sources/fon/praat_TextGrid_init.cpp 2011-09-12 10:17:12.000000000 +0200
424 +++ demo_praat_sources/fon/praat_TextGrid_init.cpp 2011-09-12 10:59:25.000000000 +0200
425 # View and edit TextGrids in a DemoApp (when Melder_back = True)
426 @@ -855,7 +855,9 @@ static void cb_TextGridEditor_publicatio
429 DIRECT2 (TextGrid_edit) {
430 +#ifndef DEMOAPP
431 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
432 +#endif
433 Sound sound = nullptr;
434 LOOP {
435 if (CLASS == classSound) sound = (Sound) OBJECT; // may stay null
436 @@ -886,7 +888,9 @@ DIRECT (TextGrid_edit)
437 END2 }
439 DIRECT2 (TextGrid_LongSound_edit) {
440 +#ifndef DEMOAPP
441 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
442 +#endif
443 LongSound longSound = nullptr;
444 int ilongSound = 0;
445 LOOP {
446 @@ -902,7 +906,9 @@ DIRECT (TextGrid_LongSound_edit)
447 END2 }
449 DIRECT2 (TextGrid_SpellingChecker_edit) {
450 +#ifndef DEMOAPP
451 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
452 +#endif
453 SpellingChecker spellingChecker = nullptr;
454 int ispellingChecker = 0;
455 Sound sound = nullptr;
456 @@ -919,7 +925,9 @@ DIRECT (TextGrid_SpellingChecker_edit)
457 END2 }
459 DIRECT2 (TextGrid_LongSound_SpellingChecker_edit) {
460 +#ifndef DEMOAPP
461 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
462 +#endif
463 LongSound longSound = nullptr;
464 SpellingChecker spellingChecker = nullptr;
465 int ilongSound = 0, ispellingChecker = 0;
467 # Add DEMOAPP flag to compiler
468 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.linux.alsa demo_praat_sources/makefiles/makefile.defs.linux.alsa
469 --- praat_sources/makefiles/makefile.defs.linux.alsa 2011-09-12 10:17:12.000000000 +0200
470 +++ demo_praat_sources/makefiles/makefile.defs.linux.alsa 2011-09-12 13:28:59.000000000 +0200
471 @@ -7,7 +7,7 @@ CC = gcc -std=gnu99
473 CXX = g++ -std=c++11
475 -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
476 +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
478 CXXFLAGS = $(CFLAGS) -Wshadow
480 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.darmin32 demo_praat_sources/makefiles/makefile.defs.darmin32
481 --- praat_sources/makefiles/makefile.defs.darmin32 2011-09-19 12:26:39.000000000 +0200
482 +++ demo_praat_sources/makefiles/makefile.defs.darmin32 2011-09-19 15:33:55.000000000 +0200
483 @@ -7,7 +7,7 @@ CC = /mingw32/bin/gcc -std=gnu99 -isyste
485 CXX = /mingw32/bin/g++ -std=c++0x -isystem /mingw32/include/c++/4.7.0 -isystem /mingw32/include -Wshadow
487 -CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread
488 +CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread -DDEMOAPP
490 CXXFLAGS = $(CFLAGS)
492 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.darmin64 demo_praat_sources/makefiles/makefile.defs.darmin64
493 --- praat_sources/makefiles/makefile.defs.darmin64 2011-09-19 12:26:39.000000000 +0200
494 +++ demo_praat_sources/makefiles/makefile.defs.darmin64 2011-09-19 15:33:37.000000000 +0200
495 @@ -7,7 +7,7 @@ CC = /mingw64/bin/gcc -std=gnu99 -isyste
497 CXX = /mingw64/bin/g++ -std=c++0x -isystem /mingw64/include/c++/4.7.0 -isystem /mingw64/include -Wshadow -m64
499 -CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread
500 +CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread -DDEMOAPP
502 CXXFLAGS = $(CFLAGS)
504 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.mingw32 demo_praat_sources/makefiles/makefile.defs.mingw32
505 --- praat_sources/makefiles/makefile.defs.mingw32 2015-09-11 08:38:17.000000000 +0200
506 +++ demo_praat_sources/makefiles/makefile.defs.mingw32 2015-09-15 15:45:42.000000000 +0200
507 @@ -9,7 +9,7 @@ CC = $(PREFIX)gcc -std=gnu99
509 CXX = $(PREFIX)g++ -std=gnu++11 -Wshadow
511 -CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O1
512 +CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O1 -DDEMOAPP
513 # Probably implicit: -m32 -mwin32 -march=i686 -mtune=generic
515 CXXFLAGS = $(CFLAGS)
516 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.mingw64 demo_praat_sources/makefiles/makefile.defs.mingw64
517 --- praat_sources/makefiles/makefile.defs.mingw64 2015-09-11 08:38:17.000000000 +0200
518 +++ demo_praat_sources/makefiles/makefile.defs.mingw64 2015-09-15 15:48:18.000000000 +0200
519 @@ -9,7 +9,7 @@ CC = $(PREFIX)gcc -std=gnu99
521 CXX = $(PREFIX)g++ -std=gnu++11 -Wshadow
523 -CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O1
524 +CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O1 -DDEMOAPP
525 # Probably implicit: -m64 -mwin32 -march=x86_64 -mtune=generic
527 CXXFLAGS = $(CFLAGS)