Adapted adaptPraat.patch for new Praat version
[sgc2.git] / praat_module / adaptPraat.patch
blob87e5ea3fd59aef30f61a475869633db34b0e28fe
1 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/stat/praat_Stat.cpp demo_praat_sources/stat/praat_Stat.cpp
2 --- praat_sources/stat/praat_Stat.cpp 2011-10-01 13:32:45.000000000 +0200
3 +++ demo_praat_sources/stat/praat_Stat.cpp 2011-11-18 08:55:32.000000000 +0100
4 @@ -410,7 +410,9 @@ DO
5 END
7 DIRECT (Table_edit)
8 +#ifndef DEMOAPP
9 if (theCurrentPraatApplication -> batch) Melder_throw ("Cannot edit a Table from batch.");
10 +#endif
11 LOOP {
12 iam (Table);
13 autoTableEditor editor = TableEditor_create (theCurrentPraatApplication -> topShell, ID_AND_FULL_NAME, me);
14 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat_script.cpp demo_praat_sources/sys/praat_script.cpp
15 --- praat_sources/sys/praat_script.cpp 2011-09-02 13:53:33.000000000 +0200
16 +++ demo_praat_sources/sys/praat_script.cpp 2011-10-28 07:54:25.000000000 +0200
17 @@ -460,6 +460,7 @@ void praat_executeScriptFromText (wchar
18 autoInterpreter interpreter = Interpreter_create (NULL, NULL);
19 Interpreter_run (interpreter.peek(), text);
20 } catch (MelderError) {
21 + exit (0);
22 Melder_throw (L"Script not completed.");
25 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/Graphics_text.cpp demo_praat_sources/sys/Graphics_text.cpp
26 --- praat_sources/sys/Graphics_text.cpp 2011-09-29 12:27:01.000000000 +0200
27 +++ demo_praat_sources/sys/Graphics_text.cpp 2011-10-27 09:14:57.000000000 +0200
28 @@ -135,7 +135,7 @@ static HFONT loadFont (GraphicsScreen me
29 ipaInited = TRUE;
30 if (! charisAvailable && ! doulosAvailable) {
31 /* BUG: The next warning may cause reentry of drawing (on window exposure) and lead to crash. Some code must be non-reentrant !! */
32 - Melder_warning (L"The phonetic font is not available.\nSeveral characters will not look correct.\nSee www.praat.org");
33 + //Melder_warning (L"The phonetic font is not available.\nSeveral characters will not look correct.\nSee www.praat.org");
34 } else {
35 ipaAvailable = true;
37 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat_picture.cpp demo_praat_sources/sys/praat_picture.cpp
38 --- praat_sources/sys/praat_picture.cpp 2011-09-02 13:53:33.000000000 +0200
39 +++ demo_praat_sources/sys/praat_picture.cpp 2011-09-16 08:12:59.000000000 +0200
40 @@ -1702,8 +1702,10 @@ void praat_picture_init (void) {
41 #elif motif
42 drawingArea = GuiDrawingArea_createShown (scrollWindow, 0, width, 0, height, NULL, NULL, NULL, NULL, NULL, 0);
43 #endif
44 + #if defined (_W32) && defined (DEMOAPP)
45 GuiObject_show (scrollWindow);
46 GuiObject_show (dialog);
47 + #endif
50 // TODO: Paul: deze moet VOOR de update functies anders krijgen die void_me 0x0
51 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat.cpp demo_praat_sources/sys/praat.cpp
52 --- praat_sources/sys/praat.cpp 2011-09-14 14:37:55.000000000 +0200
53 +++ demo_praat_sources/sys/praat.cpp 2011-09-16 10:04:34.000000000 +0200
54 @@ -1121,9 +1121,9 @@ void praat_init (const char *title, unsi
55 * Make sure that the program's private directory exists.
57 #if defined (UNIX)
58 - swprintf (name, 256, L".%ls-dir", Melder_utf8ToWcs (programName)); /* For example .myProg-dir */
59 + swprintf (name, 256, L".%ls", Melder_utf8ToWcs (praatP.title)); /* For example .myProg-dir */
60 #elif defined (macintosh)
61 - swprintf (name, 256, L"%ls Prefs", Melder_utf8ToWcs (praatP.title)); /* For example MyProg Prefs */
62 + swprintf (name, 256, L"%ls", L"SpeakGoodChinese2"); /* For example MyProg Prefs */
63 #elif defined (_WIN32)
64 swprintf (name, 256, L"%ls", Melder_utf8ToWcs (praatP.title)); /* For example MyProg */
65 #endif
66 @@ -1197,6 +1197,12 @@ void praat_init (const char *title, unsi
68 GuiObject raam = NULL;
69 if (Melder_batch) {
70 + #if defined (DEMOAPP) && gtk
71 + char objectWindowTitle [100];
72 + Machine_initLookAndFeel (argc, argv);
73 + sprintf (objectWindowTitle, "%s Objects", praatP.title);
74 + GuiWindow_create (NULL, -1, Gui_AUTOMATIC, -1, 600, Melder_peekUtf8ToWcs (objectWindowTitle), gui_cb_quit_gtk, NULL, 0);
75 + #endif
76 #if defined (UNIX) || defined (macintosh) || defined (_WIN32) && defined (CONSOLE_APPLICATION)
77 MelderString_empty (& theCurrentPraatApplication -> batchName);
78 for (unsigned int i = iarg_batchName; i < argc; i ++) {
79 @@ -1253,6 +1259,9 @@ void praat_init (const char *title, unsi
80 praat_addMenus (NULL);
81 praat_addFixedButtons (NULL);
82 } else {
83 + #ifdef DEMOAPP
84 + Melder_backgrounding = true;
85 + #endif
86 GuiObject Raam = NULL;
87 #if gtk
88 GuiObject raHoriz, raLeft; /* I want to have more possibilities for GTK widgets */
89 @@ -1299,7 +1308,9 @@ void praat_init (const char *title, unsi
90 GuiObject_show (raLeft);
91 GuiObject_show (raHoriz);
92 #endif
93 - GuiObject_show (Raam);
94 + #ifndef DEMOAPP
95 + GuiObject_show (Raam);
96 + #endif
97 #ifdef UNIX
98 try {
99 autofile f = Melder_fopen (& pidFile, "a");
100 @@ -1324,7 +1335,12 @@ void praat_init (const char *title, unsi
101 Melder_setPublishProc (publishProc);
102 theCurrentPraatApplication -> manPages = ManPages_create ();
104 - if (! praatP.dontUsePictureWindow) praat_picture_init ();
105 + #ifdef DEMOAPP
106 + praat_picture_init ();
107 + praat_dontUsePictureWindow ();
108 + #else
109 + if (! praatP.dontUsePictureWindow) praat_picture_init ();
110 + #endif
113 static void executeStartUpFile (MelderDir startUpDirectory, const wchar_t *fileNameTemplate) {
114 @@ -1557,6 +1573,14 @@ void praat_run (void) {
115 Melder_flushError (NULL);
118 + else if (thePraatStandAloneScriptText != NULL) {
119 + try {
120 + praat_executeScriptFromText (thePraatStandAloneScriptText);
121 + praat_exit (0);
122 + } catch (MelderError) {
123 + Melder_flushError (NULL);
125 + };
126 #endif
127 for (;;) {
128 XEvent event;
129 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/fon/praat_TextGrid_init.cpp demo_praat_sources/fon/praat_TextGrid_init.cpp
130 --- praat_sources/fon/praat_TextGrid_init.cpp 2011-09-12 10:17:12.000000000 +0200
131 +++ demo_praat_sources/fon/praat_TextGrid_init.cpp 2011-09-12 10:59:25.000000000 +0200
132 @@ -825,7 +825,9 @@ static void cb_TextGridEditor_publicatio
135 DIRECT (TextGrid_edit)
136 +#ifndef DEMOAPP
137 if (theCurrentPraatApplication -> batch) Melder_throw ("Cannot view or edit a TextGrid from batch.");
138 +#endif
139 Sound sound = NULL;
140 LOOP {
141 if (CLASS == classSound) sound = (Sound) OBJECT; // may stay NULL
142 @@ -839,7 +841,9 @@ DIRECT (TextGrid_edit)
145 DIRECT (TextGrid_LongSound_edit)
146 +#ifndef DEMOAPP
147 if (theCurrentPraatApplication -> batch) Melder_throw ("Cannot view or edit a TextGrid from batch.");
148 +#endif
149 LongSound longSound = NULL;
150 int ilongSound = 0;
151 LOOP {
152 @@ -855,7 +859,9 @@ DIRECT (TextGrid_LongSound_edit)
155 DIRECT (TextGrid_SpellingChecker_edit)
156 +#ifndef DEMOAPP
157 if (theCurrentPraatApplication -> batch) Melder_throw ("Cannot view or edit a TextGrid from batch.");
158 +#endif
159 SpellingChecker spellingChecker = NULL;
160 int ispellingChecker = 0;
161 Sound sound = NULL;
162 @@ -872,7 +878,9 @@ DIRECT (TextGrid_SpellingChecker_edit)
165 DIRECT (TextGrid_LongSound_SpellingChecker_edit)
166 +#ifndef DEMOAPP
167 if (theCurrentPraatApplication -> batch) Melder_throw ("Cannot view or edit a TextGrid from batch.");
168 +#endif
169 LongSound longSound = NULL;
170 SpellingChecker spellingChecker = NULL;
171 int ilongSound = 0, ispellingChecker = 0;
172 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/fon/praat_Sound_init.cpp demo_praat_sources/fon/praat_Sound_init.cpp
173 --- praat_sources/fon/praat_Sound_init.cpp 2011-09-12 10:17:12.000000000 +0200
174 +++ demo_praat_sources/fon/praat_Sound_init.cpp 2011-09-12 11:03:24.000000000 +0200
175 @@ -167,7 +167,9 @@ DO
178 DIRECT (LongSound_view)
179 +#ifndef DEMOAPP
180 if (theCurrentPraatApplication -> batch) Melder_throw ("Cannot view or edit a LongSound from batch.");
181 +#endif
182 LOOP {
183 iam (LongSound);
184 autoSoundEditor editor = SoundEditor_create (theCurrentPraatApplication -> topShell, ID_AND_FULL_NAME, me);
185 @@ -698,7 +700,9 @@ static void cb_SoundEditor_publication (
188 DIRECT (Sound_edit)
189 +#ifndef DEMOAPP
190 if (theCurrentPraatApplication -> batch) Melder_throw ("Cannot view or edit a Sound from batch.");
191 +#endif
192 LOOP {
193 iam (Sound);
194 autoSoundEditor editor = SoundEditor_create (theCurrentPraatApplication -> topShell, ID_AND_FULL_NAME, me);
195 @@ -1362,8 +1366,10 @@ static void cb_SoundRecorder_publication
196 praat_updateSelection ();
198 static void do_Sound_record (int numberOfChannels) {
199 +#ifndef DEMOAPP
200 if (theCurrentPraatApplication -> batch)
201 Melder_throw ("Cannot record a Sound from batch.");
202 +#endif
203 if (theSoundRecorder) {
204 if (numberOfChannels == thePreviousNumberOfChannels) {
205 theSoundRecorder -> raise ();
206 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/UiPause.cpp demo_praat_sources/sys/UiPause.cpp
207 --- praat_sources/sys/UiPause.cpp 2011-09-20 11:40:48.000000000 +0200
208 +++ demo_praat_sources/sys/UiPause.cpp 2011-10-25 14:01:49.000000000 +0200
209 @@ -159,6 +159,7 @@ int UiPause_end (int numberOfContinueBut
210 { // scope
211 autoMelderSaveDefaultDir saveDir;
212 thePauseForm_clicked = 0;
213 + if(wcsnequ(continueText1, L"DESTROY WINDOW ", 15))thePauseForm_clicked = 1;
214 Melder_assert (theEventLoopDepth == 0);
215 theEventLoopDepth ++;
216 try {
217 @@ -167,24 +168,28 @@ int UiPause_end (int numberOfContinueBut
218 gtk_main_iteration ();
219 } while (! thePauseForm_clicked);
220 #else
221 + if(wcsnequ(continueText1, L"DESTROY WINDOW ", 15) == 0){
222 do {
223 XEvent event;
224 GuiNextEvent (& event);
225 XtDispatchEvent (& event);
226 } while (! thePauseForm_clicked);
227 + };
228 #endif
229 } catch (MelderError) {
230 Melder_flushError ("An error made it to the outer level in a pause window; should not occur! Please write to paul.boersma@uva.nl");
232 theEventLoopDepth --;
234 + if(wcsnequ(continueText1, L"DESTROY WINDOW ", 15))forget(thePauseForm);
235 if (wasBackgrounding) praat_background ();
236 /* BUG: should also restore praatP. editor. */
237 thePauseForm = NULL; // undangle
238 thePauseFormRadio = NULL; // undangle
239 if (thePauseForm_clicked == -1) {
240 - Interpreter_stop (interpreter);
241 - Melder_throw ("You interrupted the script.");
242 + thePauseForm_clicked = cancelContinueButton;
243 + //Interpreter_stop (interpreter);
244 + //Melder_throw ("You interrupted the script.");
245 //Melder_flushError (NULL);
246 //Melder_clearError ();
247 } else {
248 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.linux demo_praat_sources/makefiles/makefile.defs.linux
249 --- praat_sources/makefiles/makefile.defs.linux 2011-09-12 10:17:12.000000000 +0200
250 +++ demo_praat_sources/makefiles/makefile.defs.linux 2011-09-12 13:28:59.000000000 +0200
251 @@ -7,7 +7,7 @@ CC = gcc -std=gnu99
253 CXX = g++
255 -CFLAGS = -DUNIX -Dlinux `pkg-config --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O
256 +CFLAGS = -DUNIX -Dlinux `pkg-config --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -DDEMOAPP -O
258 CXXFLAGS = $(CFLAGS) -Wshadow
260 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.mingw32 demo_praat_sources/makefiles/makefile.defs.mingw32
261 --- praat_sources/makefiles/makefile.defs.mingw32 2011-09-19 12:26:39.000000000 +0200
262 +++ demo_praat_sources/makefiles/makefile.defs.mingw32 2011-09-19 15:33:55.000000000 +0200
263 @@ -7,7 +7,7 @@ CC = /mingw32/bin/gcc -std=gnu99 -isyste
265 CXX = /mingw32/bin/g++ -isystem /mingw32/include/c++/4.7.0 -isystem /mingw32/include -Wshadow
267 -CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -Dmain=wingwmain -O2
268 +CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -Dmain=wingwmain -DDEMOAPP
270 CXXFLAGS = $(CFLAGS)
272 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/makefiles/makefile.defs.mingw64 demo_praat_sources/makefiles/makefile.defs.mingw64--- praat_sources/makefiles/makefile.defs.mingw32 2011-09-19 12:26:39.000000000 +0200
273 --- praat_sources/makefiles/makefile.defs.mingw64 2011-09-19 12:26:39.000000000 +0200
274 +++ demo_praat_sources/makefiles/makefile.defs.mingw64 2011-09-19 15:33:37.000000000 +0200
275 @@ -7,7 +7,7 @@ CC = /mingw64/bin/gcc -std=gnu99 -isyste
277 CXX = /mingw64/bin/g++ -isystem /mingw64/include/c++/4.7.0 -isystem /mingw64/include -Wshadow -m64
279 -CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -Dmain=wingwmain -O2
280 +CFLAGS = -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 -DUNICODE -Dmain=wingwmain -DDEMOAPP
282 CXXFLAGS = $(CFLAGS)
284 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/dwtools/Intensity_extensions.cpp demo_praat_sources/dwtools/Intensity_extensions.cpp
285 --- praat_sources/dwtools/Intensity_extensions.cpp 2011-09-20 11:40:46.000000000 +0200
286 +++ demo_praat_sources/dwtools/Intensity_extensions.cpp 2011-09-28 11:45:46.000000000 +0200
287 @@ -67,8 +67,8 @@ TextGrid Intensity_to_TextGrid_detectSil
288 Vector_getMinimumAndX (me, 0, 0, 1, NUM_PEAK_INTERPOLATE_PARABOLIC, &intensity_min_db, &xOfMinimum);
289 double intensity_dbRange = intensity_max_db - intensity_min_db;
291 - if (intensity_dbRange < 10) Melder_warning (L"The loudest and softest part in your sound only differ by ",
292 - Melder_double (intensity_dbRange), L" dB.");
293 + /*if (intensity_dbRange < 10) Melder_warning (L"The loudest and softest part in your sound only differ by ",
294 + Melder_double (intensity_dbRange), L" dB.");*/
296 double intensityThreshold = intensity_max_db - fabs (silenceThreshold_dB);
298 diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat_objectMenus.cpp demo_praat_sources/sys/praat_objectMenus.cpp
299 --- praat_sources/sys/praat_objectMenus.cpp 2012-02-22 13:04:43.000000000 +0100
300 +++ demo_praat_sources/sys/praat_objectMenus.cpp 2012-02-22 13:48:24.000000000 +0100
301 @@ -456,8 +456,10 @@ FORM (SearchManual, L"Search manual", L"
302 TEXTFIELD (L"query", L"")
305 + #ifndef DEMOAPP
306 if (theCurrentPraatApplication -> batch)
307 Melder_throw (L"Cannot view a manual from batch.");
308 + #endif
309 Manual manPage = Manual_create (theCurrentPraatApplication -> topShell, L"Intro", theCurrentPraatApplication -> manPages, false);
310 Manual_search (manPage, GET_STRING (L"query"));
312 @@ -468,8 +470,10 @@ FORM (GoToManualPage, L"Go to manual pag
313 LIST (L"Page", numberOfPages, pages, 1)}
316 + #ifndef DEMOAPP
317 if (theCurrentPraatApplication -> batch)
318 Melder_throw (L"Cannot view a manual from batch.");
319 + #endif
320 Manual manPage = Manual_create (theCurrentPraatApplication -> topShell, L"Intro", theCurrentPraatApplication -> manPages, false);
321 HyperPage_goToPage_i (manPage, GET_INTEGER (L"Page")); therror