Updated patch to Praat 6.0.29
[sgc2.git] / praat_module / adaptPraat.patch
blobf33f84583497250a278efae07ad33517a84d7d22
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 @@ -1019,10 +1019,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 @@ -602,6 +602,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 @@ -105,7 +105,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 @@ -1136,7 +1136,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 @@ -1188,7 +1190,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 @@ -1272,6 +1274,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 (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 @@ -1313,10 +1321,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 @@ -1326,6 +1356,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 AEInstallEventHandler (758934755, 0, (AEEventHandlerProcPtr) (mac_processSignal8), 0, false); // for receiving sendpraat
128 # Supress opening the object window
129 @@ -1347,7 +1380,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 @@ -1378,7 +1413,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 @@ -1541,7 +1581,7 @@ void praat_run () {
156 Melder_fatal (U"The number 1000000000000 is mistakenly 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 @@ -1653,10 +1693,20 @@ void praat_run () {
166 trace (U"locale is ", Melder_peek8to32 (setlocale (LC_ALL, nullptr)));
167 gtk_main ();
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 #elif cocoa
189 [NSApp run];
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 @@ -1595,8 +1595,10 @@ void praat_picture_open (void) {
195 #if gtk
196 gtk_window_present (GTK_WINDOW (dialog -> d_gtkWindow));
197 #elif motif
198 +#ifndef DEMOAPP
199 XtMapWidget (dialog -> d_xmShell);
200 XMapRaised (XtDisplay (dialog -> d_xmShell), XtWindow (dialog -> d_xmShell));
201 +#endif
202 #elif cocoa
203 GuiThing_show (dialog);
204 #endif
205 @@ -1888,7 +1890,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.cpp demo_praat_sources/fon/praat_Sound.cpp
216 --- praat_sources/fon/praat_Sound.cpp 2017-06-08 11:26:20.000000000 +0200
217 +++ demo_praat_sources/fon/praat_Sound.cpp 2017-06-08 12:22:45.000000000 +0200
218 # View and edit Long/Sounds in a DemoApp (when Melder_back = True)
219 @@ -157,7 +157,9 @@ DO
222 DIRECT (WINDOW_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 @@ -671,7 +673,9 @@ static void cb_SoundEditor_publication (
232 DIRECT (WINDOW_Sound_viewAndEdit) {
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 # Handle situation where there is no sound input in Windows
240 @@ -1285,10 +1289,21 @@ FORM (RECORD1_Sound_record_fixedTime, U"
241 POSITIVE4 (duration, U"Duration (seconds)", U"1.0")
244 +#if defined (_WIN32) && defined (DEMOAPP)
245 + UINT numberOfDevices = waveInGetNumDevs (), i;
246 + if(numberOfDevices > 0) {
247 +#endif
248 CREATE_ONE
249 autoSound result = Sound_record_fixedTime (inputSource,
250 gain, balance, Melder_atof (samplingFrequency), duration);
251 CREATE_ONE_END (U"untitled")
252 +#if defined (_WIN32) && defined (DEMOAPP)
253 + } else {
254 + // Create an empty sound if no input is available
255 + autoSound me = Sound_createSimple (1, GET_REAL (U"Duration"), GET_REAL (U"Sampling frequency"));
256 + praat_new (me.move(), U"untitled");
257 + };
258 +#endif
261 extern "C" void* Praat_Sound_resample (void* sound, double newSamplingFrequency, int precision);
262 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/Ui.cpp demo_praat_sources/sys/Ui.cpp
263 --- praat_sources/sys/Ui.cpp 2014-01-27 09:02:44.000000000 +0100
264 +++ demo_praat_sources/sys/Ui.cpp 2014-03-27 12:22:58.000000000 +0100
265 # Increase size of Pause Forms
266 @@ -841,12 +841,16 @@ void UiForm_finish (I) {
267 void UiForm_finish (UiForm me) {
268 if (! my d_dialogParent && ! my isPauseForm) return;
270 + int numberOfContinueButtons = my numberOfContinueButtons;
271 int size = my numberOfFields;
272 int dialogHeight = 0, x = Gui_LEFT_DIALOG_SPACING, y;
273 int textFieldHeight = Gui_TEXTFIELD_HEIGHT;
274 - int dialogWidth = 520, dialogCentre = dialogWidth / 2, fieldX = dialogCentre + Gui_LABEL_SPACING / 2;
275 + 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;
276 int labelWidth = fieldX - Gui_LABEL_SPACING - x, fieldWidth = labelWidth, halfFieldWidth = fieldWidth / 2 - 6;
278 + /* Ensure that the dialogs are wide enough */
279 + if (dialogWidth<520) dialogWidth = 520;
281 GuiForm form;
284 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/UiPause.cpp demo_praat_sources/sys/UiPause.cpp
285 --- praat_sources/sys/UiPause.cpp 2012-09-27 09:10:50.000000000 +0200
286 +++ demo_praat_sources/sys/UiPause.cpp 2012-09-27 13:25:18.000000000 +0200
287 # Catch close buttons of Pause window and prevent terminating the script
288 @@ -143,6 +143,7 @@ int UiPause_end (int numberOfContinueBut
289 {// scope
290 autoMelderSaveDefaultDir saveDir;
291 thePauseForm_clicked = 0;
292 + if(str32nequ(continueText1, U"DESTROY WINDOW ", 15))thePauseForm_clicked = 1;
293 Melder_assert (theEventLoopDepth == 0);
294 theEventLoopDepth ++;
295 try {
296 @@ -166,24 +167,28 @@ int UiPause_end (int numberOfContinueBut
297 [pool release];
298 } while (! thePauseForm_clicked);
299 #elif motif
300 + if(str32nequ(continueText1, U"DESTROY WINDOW ", 15) == 0){
301 do {
302 XEvent event;
303 GuiNextEvent (& event);
304 XtDispatchEvent (& event);
305 } while (! thePauseForm_clicked);
306 + };
307 #endif
308 } catch (MelderError) {
309 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");
311 theEventLoopDepth --;
313 + if(str32nequ(continueText1, U"DESTROY WINDOW ", 15))forget(thePauseForm);
314 if (wasBackgrounding) praat_background ();
315 /* BUG: should also restore praatP. editor. */
316 thePauseForm = nullptr; // undangle
317 thePauseFormRadio = nullptr; // undangle
318 if (thePauseForm_clicked == -1) {
319 - Interpreter_stop (interpreter);
320 - Melder_throw (U"You interrupted the script.");
321 + thePauseForm_clicked = cancelContinueButton;
322 + //Interpreter_stop (interpreter);
323 + //Melder_throw (U"You interrupted the script.");
324 //Melder_flushError ();
325 //Melder_clearError ();
326 } else {
327 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/dwtools/Intensity_extensions.cpp demo_praat_sources/dwtools/Intensity_extensions.cpp
328 --- praat_sources/dwtools/Intensity_extensions.cpp 2011-09-20 11:40:46.000000000 +0200
329 +++ demo_praat_sources/dwtools/Intensity_extensions.cpp 2011-09-28 11:45:46.000000000 +0200
330 @@ -65,9 +65,9 @@ TextGrid Intensity_to_TextGrid_detectSil
331 Vector_getMinimumAndX (me, 0, 0, 1, NUM_PEAK_INTERPOLATE_PARABOLIC, &intensity_min_db, &xOfMinimum);
332 double intensity_dbRange = intensity_max_db - intensity_min_db;
334 - if (intensity_dbRange < 10) {
335 - Melder_warning (U"The loudest and softest part in your sound only differ by ", intensity_dbRange, U" dB.");
337 + /*if (intensity_dbRange < 10) {
338 + Melder_warning (U"The loudest and softest part in your sound only differ by ", intensity_dbRange, U" dB.");
339 + }*/
340 double intensityThreshold = intensity_max_db - fabs (silenceThreshold_dB);
342 if (minSilenceDuration > duration || intensityThreshold < intensity_min_db) {
343 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat_objectMenus.cpp demo_praat_sources/sys/praat_objectMenus.cpp
344 --- praat_sources/sys/praat_objectMenus.cpp 2012-02-22 13:04:43.000000000 +0100
345 +++ demo_praat_sources/sys/praat_objectMenus.cpp 2012-02-22 13:48:24.000000000 +0100
346 # Allow the man pages
347 @@ -511,8 +511,10 @@ FORM (SearchManual, U"Search manual", U"
348 TEXTFIELD4 (query, U"query", U"")
351 + #ifndef DEMOAPP
352 if (theCurrentPraatApplication -> batch)
353 Melder_throw (U"Cannot view a manual from batch.");
354 + #endif
355 autoManual manual = Manual_create (U"Intro", theCurrentPraatApplication -> manPages, false);
356 Manual_search (manual.get(), query);
357 manual.releaseToUser();
358 @@ -524,8 +526,10 @@ FORM (GoToManualPage, U"Go to manual pag
359 LIST (U"Page", numberOfPages, pages, 1)
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 HyperPage_goToPage_i (manual.get(), GET_INTEGER (U"Page"));
368 manual.releaseToUser();
369 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/GuiMenu.cpp demo_praat_sources/sys/GuiMenu.cpp
370 --- praat_sources/sys/GuiMenu.cpp 2017-06-08 11:26:20.000000000 +0200
371 +++ demo_praat_sources/sys/GuiMenu.cpp 2017-06-09 15:29:42.000000000 +0200
372 @@ -313,7 +313,9 @@ GuiMenu GuiMenu_createInWindow (GuiWindo
373 gtk_menu_item_set_submenu (GTK_MENU_ITEM (my d_gtkMenuTitle), GTK_WIDGET (my d_widget));
374 _GuiObject_setUserData (my d_widget, me.get());
375 #elif motif
376 + #if not ( defined( DEMOAPP ) && defined( macintosh ) )
377 Melder_assert (window);
378 + #endif
379 my d_xmMenuTitle = XmCreateCascadeButton (window -> d_xmMenuBar, Melder_peek32to8 (title), nullptr, 0);
380 if (str32equ (title, U"Help"))
381 XtVaSetValues (window -> d_xmMenuBar, XmNmenuHelpWidget, my d_xmMenuTitle, nullptr);
382 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/DemoEditor.cpp demo_praat_sources/sys/DemoEditor.cpp
383 --- praat_sources/sys/DemoEditor.cpp 2014-05-09 08:59:02.000000000 +0200
384 +++ demo_praat_sources/sys/DemoEditor.cpp 2014-05-16 10:30:28.000000000 +0200
385 # Close the script and stop Praat. If you do not stop praat, you retain Zombie Praat processes under Windows
386 @@ -266,6 +266,7 @@ void Demo_waitForInput (Interpreter inte
387 if (theReferenceToTheOnlyDemoEditor -> userWantsToClose) {
388 Interpreter_stop (interpreter);
389 forget (theReferenceToTheOnlyDemoEditor);
390 + exit (0);
391 Melder_throw (U"You interrupted the script.");
394 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/stat/praat_Stat.cpp demo_praat_sources/stat/praat_Stat.cpp
395 --- praat_sources/stat/praat_Stat.cpp 2017-06-08 11:26:20.000000000 +0200
396 +++ demo_praat_sources/stat/praat_Stat.cpp 2017-06-09 15:14:12.000000000 +0200
397 # Allow to view tables when in a Demo app
398 @@ -291,7 +291,9 @@ DIRECT (HELP_StatisticsTutorial) {
399 // MARK: View & Edit
401 DIRECT (WINDOW_Table_viewAndEdit) {
402 +#ifndef DEMOAPP
403 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot edit a Table from batch.");
404 +#endif
405 LOOP {
406 iam_LOOP (Table);
407 autoTableEditor editor = TableEditor_create (ID_AND_FULL_NAME, me);
408 --- praat_sources/stat/praat_Stat.cpp 2011-10-01 13:32:45.000000000 +0200
409 +++ demo_praat_sources/stat/praat_Stat.cpp 2011-11-18 08:55:32.000000000 +0100
410 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/fon/praat_TextGrid_init.cpp demo_praat_sources/fon/praat_TextGrid_init.cpp
411 --- praat_sources/fon/praat_TextGrid_init.cpp 2017-06-08 11:26:20.000000000 +0200
412 +++ demo_praat_sources/fon/praat_TextGrid_init.cpp 2017-06-09 15:49:13.000000000 +0200
413 # View and edit TextGrids in a DemoApp (when Melder_back = True)
414 @@ -703,7 +703,9 @@ static void cb_TextGridEditor_publicatio
417 DIRECT (WINDOW_TextGrid_viewAndEdit) {
418 +#ifndef DEMOAPP
419 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
420 +#endif
421 Sound sound = nullptr;
422 LOOP {
423 if (CLASS == classSound) sound = (Sound) OBJECT; // may stay null
424 @@ -721,7 +723,9 @@ FORM (WINDOW_TextGrid_viewAndEditWithCal
425 SENTENCE4 (callbackText, U"Callback text", U"r1")
428 +#ifndef DEMOAPP
429 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
430 +#endif
431 Sound sound = nullptr;
432 LOOP {
433 if (CLASS == classSound) sound = (Sound) OBJECT; // may stay null
434 @@ -736,7 +740,9 @@ DO
435 END }
437 DIRECT (WINDOW_TextGrid_LongSound_viewAndEdit) {
438 +#ifndef DEMOAPP
439 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
440 +#endif
441 LongSound longSound = nullptr;
442 int ilongSound = 0;
443 LOOP {
444 @@ -753,7 +759,9 @@ DIRECT (WINDOW_TextGrid_LongSound_viewAn
445 END }
447 DIRECT (WINDOW_TextGrid_SpellingChecker_viewAndEdit) {
448 +#ifndef DEMOAPP
449 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
450 +#endif
451 SpellingChecker spellingChecker = nullptr;
452 int ispellingChecker = 0;
453 Sound sound = nullptr;
454 @@ -771,7 +779,9 @@ DIRECT (WINDOW_TextGrid_SpellingChecker_
455 END }
457 DIRECT (WINDOW_TextGrid_LongSound_SpellingChecker_viewAndEdit) {
458 +#ifndef DEMOAPP
459 if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a TextGrid from batch.");
460 +#endif
461 LongSound longSound = nullptr;
462 SpellingChecker spellingChecker = nullptr;
463 int ilongSound = 0, ispellingChecker = 0;
465 # Add DEMOAPP flag to compiler
466 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.linux.alsa demo_praat_sources/makefiles/makefile.defs.linux.alsa
467 --- praat_sources/makefiles/makefile.defs.linux.alsa 2011-09-12 10:17:12.000000000 +0200
468 +++ demo_praat_sources/makefiles/makefile.defs.linux.alsa 2011-09-12 13:28:59.000000000 +0200
469 @@ -7,7 +7,7 @@ CC = gcc -std=gnu99
471 CXX = g++ -std=c++11
473 -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
474 +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
476 CXXFLAGS = $(CFLAGS) -Wshadow
478 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.darmin32 demo_praat_sources/makefiles/makefile.defs.darmin32
479 --- praat_sources/makefiles/makefile.defs.darmin32 2011-09-19 12:26:39.000000000 +0200
480 +++ demo_praat_sources/makefiles/makefile.defs.darmin32 2011-09-19 15:33:55.000000000 +0200
481 @@ -7,7 +7,7 @@ CC = /mingw32/bin/gcc -std=gnu99 -isyste
483 CXX = /mingw32/bin/g++ -std=c++0x -isystem /mingw32/include/c++/4.7.0 -isystem /mingw32/include -Wshadow
485 -CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread
486 +CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread -DDEMOAPP
488 CXXFLAGS = $(CFLAGS)
490 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.darmin64 demo_praat_sources/makefiles/makefile.defs.darmin64
491 --- praat_sources/makefiles/makefile.defs.darmin64 2011-09-19 12:26:39.000000000 +0200
492 +++ demo_praat_sources/makefiles/makefile.defs.darmin64 2011-09-19 15:33:37.000000000 +0200
493 @@ -7,7 +7,7 @@ CC = /mingw64/bin/gcc -std=gnu99 -isyste
495 CXX = /mingw64/bin/g++ -std=c++0x -isystem /mingw64/include/c++/4.7.0 -isystem /mingw64/include -Wshadow -m64
497 -CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread
498 +CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -D_FILE_OFFSET_BITS=64 -Dmain=wingwmain -O1 -pthread -DDEMOAPP
500 CXXFLAGS = $(CFLAGS)
502 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.mingw32 demo_praat_sources/makefiles/makefile.defs.mingw32
503 --- praat_sources/makefiles/makefile.defs.mingw32 2015-09-11 08:38:17.000000000 +0200
504 +++ demo_praat_sources/makefiles/makefile.defs.mingw32 2015-09-15 15:45:42.000000000 +0200
505 @@ -9,7 +9,7 @@ CC = $(PREFIX)gcc -std=gnu99
507 CXX = $(PREFIX)g++ -std=gnu++11 -Wshadow
509 -CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O3
510 +CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O3 -DDEMOAPP
511 # Probably implicit: -m32 -mwin32 -march=i686 -mtune=generic
513 CXXFLAGS = $(CFLAGS)
514 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.mingw64 demo_praat_sources/makefiles/makefile.defs.mingw64
515 --- praat_sources/makefiles/makefile.defs.mingw64 2015-09-11 08:38:17.000000000 +0200
516 +++ demo_praat_sources/makefiles/makefile.defs.mingw64 2015-09-15 15:48:18.000000000 +0200
517 @@ -9,7 +9,7 @@ CC = $(PREFIX)gcc -std=gnu99
519 CXX = $(PREFIX)g++ -std=gnu++11 -Wshadow
521 -CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O3
522 +CFLAGS = -municode -D_FILE_OFFSET_BITS=64 -O3 -DDEMOAPP
523 # Probably implicit: -m64 -mwin32 -march=x86_64 -mtune=generic
525 CXXFLAGS = $(CFLAGS)