| 1 | /* TextGridEditor.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2022 Paul Boersma |
| 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 2 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 "TextGridEditor.h"cxx . . $ `<file>/foned/TextGridEditor.h`/ |
| 20 | #include "EditorM.h"cxx . . $ `<file>/sys/EditorM.h`/ |
| 21 | |
| 22 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (TextGridEditor, FunctionEditor, 0); |
| 23 | |
| 24 | #include "Prefs_define.h"cxx . . $ `<file>/sys/Prefs_define.h`/ |
| 25 | #include "TextGridEditor_prefs.h"cxx . . $ `<file>/foned/TextGridEditor_prefs.h`/ |
| 26 | #include "Prefs_install.h"cxx . . $ `<file>/sys/Prefs_install.h`/ |
| 27 | #include "TextGridEditor_prefs.h"cxx . . $ `<file>/foned/TextGridEditor_prefs.h`/ |
| 28 | #include "Prefs_copyToInstance.h"cxx . . $ `<file>/sys/Prefs_copyToInstance.h`/ |
| 29 | #include "TextGridEditor_prefs.h"cxx . . $ `<file>/foned/TextGridEditor_prefs.h`/ |
| 30 | |
| 31 | static void menu_cb_TextGridEditorHelpcxx . . $ menu_cb_TextGridEditorHelp(568cfbf2efd050dc). (TextGridEditorcxx . . $ TextGridEditor#, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { HELPcxx . . $ `sys/EditorM.h:631:9`! (U"TextGridEditor") } |
| 32 | static void menu_cb_AboutSpecialSymbolscxx . . $ menu_cb_AboutSpecialSymbols(568cfbf2efd050dc). (TextGridEditorcxx . . $ TextGridEditor#, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { HELPcxx . . $ `sys/EditorM.h:631:9`! (U"Special symbols") } |
| 33 | static void menu_cb_PhoneticSymbolscxx . . $ menu_cb_PhoneticSymbols(568cfbf2efd050dc). (TextGridEditorcxx . . $ TextGridEditor#, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { HELPcxx . . $ `sys/EditorM.h:631:9`! (U"Phonetic symbols") } |
| 34 | static void menu_cb_AboutTextStylescxx . . $ menu_cb_AboutTextStyles(568cfbf2efd050dc). (TextGridEditorcxx . . $ TextGridEditor#, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { HELPcxx . . $ `sys/EditorM.h:631:9`! (U"Text styles") } |
| 35 | |
| 36 | void structTextGridEditorcxx . . $ structTextGridEditor# :: v_createMenuItems_helpcxx . . $ structTextGridEditor#v_createMenuItems_help(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu# menu) { |
| 37 | TextGridEditor_Parentcxx . . $ TextGridEditor_Parent# :: v_createMenuItems_helpcxx . . $ structFunctionEditor#v_createMenuItems_help(6ea9c8c6ea2f58a9). (menu); |
| 38 | EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, U"TextGridEditor help", '?', menu_cb_TextGridEditorHelpcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 39 | EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, U"About special symbols", 0, menu_cb_AboutSpecialSymbolscxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 40 | EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, U"Phonetic symbols", 0, menu_cb_PhoneticSymbolscxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 41 | EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, U"About text styles", 0, menu_cb_AboutTextStylescxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 42 | } |
| 43 | |
| 44 | autoTextGridEditorcxx . . $ autoTextGridEditor# TextGridEditor_createcxx . . $ TextGridEditor_create(14111359858baa66). (conststring32cxx . . $ conststring32# title, TextGridcxx . . $ TextGrid# textGrid, |
| 45 | SampledXYcxx . . $ SampledXY# optionalSoundOrLongSound, SpellingCheckercxx . . $ SpellingChecker# spellingChecker, conststring32cxx . . $ conststring32# callbackSocket) |
| 46 | { |
| 47 | try { |
| 48 | autoTextGridEditorcxx . . $ autoTextGridEditor# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (TextGridEditor); |
| 49 | mycxx . . $ `melder/melder.h:44:9`! textGridAreacxx . . $ structTextGridEditor#textGridArea(fd24f7f644037235).() =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). TextGridArea_createcxx . . $ TextGridArea_create(f68f4a3a607552fc). (true, nullptr, me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 50 | if (optionalSoundOrLongSound) { |
| 51 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (optionalSoundOrLongSound -> ny > 0); |
| 52 | if (Thing_isacxx . . $ Thing_isa(8cbb12e93d03b2a1). (optionalSoundOrLongSound, classSoundcxx . . $ classSound.)) |
| 53 | mycxx . . $ `melder/melder.h:44:9`! soundAreacxx . . $ structTextGridEditor#soundArea(f75ec617f241a3e6).() =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). SoundArea_createcxx . . $ SoundArea_create(4b60938fec9a8242). (false, static_cast <Soundcxx . . $ Sound#> (optionalSoundOrLongSound), me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 54 | else |
| 55 | mycxx . . $ `melder/melder.h:44:9`! soundAreacxx . . $ structTextGridEditor#soundArea(f75ec617f241a3e6).() =cxx . . $ autoSomeThing#`operator=`(ed6a1a4da6aedae3). LongSoundArea_createcxx . . $ LongSoundArea_create(bb83e7d8d927335f). (false, static_cast <LongSoundcxx . . $ LongSound#> (optionalSoundOrLongSound), me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 56 | mycxx . . $ `melder/melder.h:44:9`! soundAnalysisAreacxx . . $ structTextGridEditor#soundAnalysisArea(189f664f81248f0).() =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). SoundAnalysisArea_createcxx . . $ SoundAnalysisArea_create(7f82e0b8b2569e74). (false, nullptr, me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 57 | mycxx . . $ `melder/melder.h:44:9`! textGridAreacxx . . $ structTextGridEditor#textGridArea(fd24f7f644037235).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). borrowedSoundAreacxx . . $ structTextGridArea#borrowedSoundArea. = mycxx . . $ `melder/melder.h:44:9`! soundAreacxx . . $ structTextGridEditor#soundArea(f75ec617f241a3e6).().getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(); |
| 58 | mycxx . . $ `melder/melder.h:44:9`! textGridAreacxx . . $ structTextGridEditor#textGridArea(fd24f7f644037235).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). borrowedSoundAnalysisAreacxx . . $ structTextGridArea#borrowedSoundAnalysisArea. = mycxx . . $ `melder/melder.h:44:9`! soundAnalysisAreacxx . . $ structTextGridEditor#soundAnalysisArea(189f664f81248f0).().getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(); |
| 59 | } |
| 60 | mycxx . . $ `melder/melder.h:44:9`! textGridAreacxx . . $ structTextGridEditor#textGridArea(fd24f7f644037235).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). spellingCheckercxx . . $ structTextGridArea#spellingChecker. = spellingChecker; |
| 61 | mycxx . . $ `melder/melder.h:44:9`! callbackSocketcxx . . $ structEditor#callbackSocket. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (callbackSocket); |
| 62 | FunctionEditor_initcxx . . $ FunctionEditor_init(719bc58b4917372e). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), title, textGrid); |
| 63 | |
| 64 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (isdefined (mycxx . . $ `melder/melder.h:44:9`! startSelection)); // precondition of v_updateText() |
| 65 | mycxx . . $ `melder/melder.h:44:9`! v_updateTextcxx . . $ structFunctionEditor#v_updateText(49f6e7a06ebc5aa8). (); // to reflect changed tier selection AND to get first text; BUG: should not be needed |
| 66 | if (spellingChecker) |
| 67 | GuiText_setSelectioncxx . . $ GuiText_setSelection(e06f404191ddd8ec). (mycxx . . $ `melder/melder.h:44:9`! textAreacxx . . $ structFunctionEditor#textArea., 0, 0); |
| 68 | if (optionalSoundOrLongSound && |
| 69 | optionalSoundOrLongSound -> xmincxx . . $ structFunction#xmin. == 0.0 && |
| 70 | mycxx . . $ `melder/melder.h:44:9`! textGridcxx . . $ structTextGridEditor#textGrid(5278f8d4efff58bd).() -> xmincxx . . $ structFunction#xmin. != 0.0 && |
| 71 | mycxx . . $ `melder/melder.h:44:9`! textGridcxx . . $ structTextGridEditor#textGrid(5278f8d4efff58bd).() -> xmaxcxx . . $ structFunction#xmax. > optionalSoundOrLongSound -> xmaxcxx . . $ structFunction#xmax. |
| 72 | ) |
| 73 | Melder_warningcxx . . $ Melder_warning(6298c93241566110). (U"The time domain of the TextGrid (starting at ", |
| 74 | Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (mycxx . . $ `melder/melder.h:44:9`! textGridcxx . . $ structTextGridEditor#textGrid(5278f8d4efff58bd).() -> xmincxx . . $ structFunction#xmin., 6), U" seconds) does not overlap with that of the sound " |
| 75 | U"(which starts at 0 seconds).\nIf you want to repair this, you can select the TextGrid " |
| 76 | U"and choose “Shift times to...” from the Modify menu " |
| 77 | U"to shift the starting time of the TextGrid to zero."); |
| 78 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 79 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 80 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"TextGrid window not created."); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /* End of file TextGridEditor.cpp */ |