static void menu_cb_DrawSelectedSound (TimeSoundEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Draw selected sound", nullptr) my v_form_pictureWindow (cmd); LABEL (U"", U"Sound:") BOOLEAN (U"Preserve times", my default_picture_preserveTimes ()); REAL (U"left Vertical range", my default_picture_bottom ()); REAL (U"right Vertical range", my default_picture_top ()); my v_form_pictureMargins (cmd); BOOLEAN (U"Garnish", my default_picture_garnish ()); EDITOR_OK my v_ok_pictureWindow (cmd); SET_INTEGER (U"Preserve times", my pref_picture_preserveTimes ()); SET_REAL (U"left Vertical range", my pref_picture_bottom ()); SET_REAL (U"right Vertical range", my pref_picture_top ()); my v_ok_pictureMargins (cmd); SET_INTEGER (U"Garnish", my pref_picture_garnish ()); EDITOR_DO my v_do_pictureWindow (cmd); my pref_picture_preserveTimes () = GET_INTEGER (U"Preserve times"); my pref_picture_bottom () = GET_REAL (U"left Vertical range"); my pref_picture_top () = GET_REAL (U"right Vertical range"); my v_do_pictureMargins (cmd); my pref_picture_garnish () = GET_INTEGER (U"Garnish"); if (! my d_longSound.data && ! my d_sound.data) Melder_throw (U"There is no sound to draw."); autoSound publish = my d_longSound.data ? LongSound_extractPart (my d_longSound.data, my d_startSelection, my d_endSelection, my pref_picture_preserveTimes ()) : Sound_extractPart (my d_sound.data, my d_startSelection, my d_endSelection, kSound_windowShape_RECTANGULAR, 1.0, my pref_picture_preserveTimes ()); Editor_openPraatPicture (me); Sound_draw (publish.peek(), my pictureGraphics, 0.0, 0.0, my pref_picture_bottom (), my pref_picture_top (), my pref_picture_garnish (), U"Curve"); Editor_closePraatPicture (me); EDITOR_END }
static void menu_cb_print (EDITOR_ARGS) { EDITOR_IAM (HyperPage); EDITOR_FORM (L"Print", 0) SENTENCE (L"Left or inside header", L"") SENTENCE (L"Middle header", L"") LABEL (L"", L"Right or outside header:") TEXTFIELD (L"Right or outside header", L"") SENTENCE (L"Left or inside footer", L"") SENTENCE (L"Middle footer", L"") SENTENCE (L"Right or outside footer", L"") BOOLEAN (L"Mirror even/odd headers", TRUE) INTEGER (L"First page number", L"0 (= no page numbers)") EDITOR_OK my v_defaultHeaders (cmd); if (my d_printingPageNumber) SET_INTEGER (L"First page number", my d_printingPageNumber + 1) EDITOR_DO my insideHeader = GET_STRING (L"Left or inside header"); my middleHeader = GET_STRING (L"Middle header"); my outsideHeader = GET_STRING (L"Right or outside header"); my insideFooter = GET_STRING (L"Left or inside footer"); my middleFooter = GET_STRING (L"Middle footer"); my outsideFooter = GET_STRING (L"Right or outside footer"); my mirror = GET_INTEGER (L"Mirror even/odd headers"); my d_printingPageNumber = GET_INTEGER (L"First page number"); Printer_print (print, me); EDITOR_END }
static void menu_cb_editRanking (EDITOR_ARGS) { EDITOR_IAM (OTMultiEditor); EDITOR_FORM (U"Edit ranking", 0) LABEL (U"constraint", U""); REAL (U"Ranking value", U"100.0"); REAL (U"Disharmony", U"100.0"); EDITOR_OK OTMulti grammar = (OTMulti) my data; OTConstraint constraint; if (my selectedConstraint < 1 || my selectedConstraint > grammar -> numberOfConstraints) Melder_throw (U"Select a constraint first."); constraint = & grammar -> constraints [grammar -> index [my selectedConstraint]]; SET_STRING (U"constraint", constraint -> name) SET_REAL (U"Ranking value", constraint -> ranking) SET_REAL (U"Disharmony", constraint -> disharmony) EDITOR_DO OTMulti grammar = (OTMulti) my data; OTConstraint constraint = & grammar -> constraints [grammar -> index [my selectedConstraint]]; Editor_save (me, U"Edit ranking"); constraint -> ranking = GET_REAL (U"Ranking value"); constraint -> disharmony = GET_REAL (U"Disharmony"); OTMulti_sort (grammar); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_addToDynamicMenu (EDITOR_ARGS) { EDITOR_IAM (ScriptEditor); EDITOR_FORM (U"Add to dynamic menu", U"Add to dynamic menu...") WORD (U"Class 1", U"Sound") INTEGER (U"Number 1", U"0") WORD (U"Class 2", U"") INTEGER (U"Number 2", U"0") WORD (U"Class 3", U"") INTEGER (U"Number 3", U"0") SENTENCE (U"Command", U"Do it...") SENTENCE (U"After command", U"") INTEGER (U"Depth", U"0") LABEL (U"", U"Script file:") TEXTFIELD (U"Script", U"") EDITOR_OK if (my name [0]) SET_STRING (U"Script", my name) else SET_STRING (U"Script", U"(please save your script first)") EDITOR_DO praat_addActionScript (GET_STRING (U"Class 1"), GET_INTEGER (U"Number 1"), GET_STRING (U"Class 2"), GET_INTEGER (U"Number 2"), GET_STRING (U"Class 3"), GET_INTEGER (U"Number 3"), GET_STRING (U"Command"), GET_STRING (U"After command"), GET_INTEGER (U"Depth"), GET_STRING (U"Script")); praat_show (); EDITOR_END }
static void menu_cb_editConstraint (EDITOR_ARGS) { EDITOR_IAM (OTGrammarEditor); EDITOR_FORM (U"Edit constraint", 0) LABEL (U"constraint", U""); REAL (U"Ranking value", U"100.0"); REAL (U"Disharmony", U"100.0"); REAL (U"Plasticity", U"1.0"); EDITOR_OK OTGrammar ot = (OTGrammar) my data; OTGrammarConstraint constraint; if (my selected < 1 || my selected > ot -> numberOfConstraints) Melder_throw (U"Select a constraint first."); constraint = & ot -> constraints [ot -> index [my selected]]; SET_STRING (U"constraint", constraint -> name) SET_REAL (U"Ranking value", constraint -> ranking) SET_REAL (U"Disharmony", constraint -> disharmony) SET_REAL (U"Plasticity", constraint -> plasticity) EDITOR_DO OTGrammar ot = (OTGrammar) my data; OTGrammarConstraint constraint = & ot -> constraints [ot -> index [my selected]]; Editor_save (me, U"Edit constraint"); constraint -> ranking = GET_REAL (U"Ranking value"); constraint -> disharmony = GET_REAL (U"Disharmony"); constraint -> plasticity = GET_REAL (U"Plasticity"); OTGrammar_sort (ot); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_pitchSettings (EDITOR_ARGS) { EDITOR_IAM (FormantGridEditor); EDITOR_FORM (L"Source pitch settings", 0) LABEL (L"", L"These settings apply to the pitch curve") LABEL (L"", L"that you hear when playing the FormantGrid.") REAL (L"Starting time", L"0.0%") POSITIVE (L"Starting pitch (Hz)", L"150.0") REAL (L"Mid time", L"25.0%") POSITIVE (L"Mid pitch (Hz)", L"180.0") REAL (L"End time", L"100.0%") POSITIVE (L"End pitch (Hz)", L"120") EDITOR_OK SET_REAL (L"Starting time", my source.pitch.tStart) SET_REAL (L"Starting pitch", my source.pitch.f0Start) SET_REAL (L"Mid time", my source.pitch.tMid) SET_REAL (L"Mid pitch", my source.pitch.f0Mid) SET_REAL (L"End time", my source.pitch.tEnd) SET_REAL (L"End pitch", my source.pitch.f0End) EDITOR_DO preferences.source.pitch.tStart = my source.pitch.tStart = GET_REAL (L"Starting time"); preferences.source.pitch.f0Start = my source.pitch.f0Start = GET_REAL (L"Starting pitch"); preferences.source.pitch.tMid = my source.pitch.tMid = GET_REAL (L"Mid time"); preferences.source.pitch.f0Mid = my source.pitch.f0Mid = GET_REAL (L"Mid pitch"); preferences.source.pitch.tEnd = my source.pitch.tEnd = GET_REAL (L"End time"); preferences.source.pitch.f0End = my source.pitch.f0End = GET_REAL (L"End pitch"); EDITOR_END }
static void menu_cb_pitchSettings (EDITOR_ARGS) { EDITOR_IAM (FormantGridEditor); EDITOR_FORM (U"Source pitch settings", 0) LABEL (U"", U"These settings apply to the pitch curve") LABEL (U"", U"that you hear when playing the FormantGrid.") REAL (U"Starting time", my default_source_pitch_tStart ()) POSITIVE (U"Starting pitch (Hz)", my default_source_pitch_f0Start ()) REAL (U"Mid time", my default_source_pitch_tMid ()) POSITIVE (U"Mid pitch (Hz)", my default_source_pitch_f0Mid ()) REAL (U"End time", my default_source_pitch_tEnd ()) POSITIVE (U"End pitch (Hz)", my default_source_pitch_f0End ()) EDITOR_OK SET_REAL (U"Starting time", my p_source_pitch_tStart) SET_REAL (U"Starting pitch", my p_source_pitch_f0Start) SET_REAL (U"Mid time", my p_source_pitch_tMid) SET_REAL (U"Mid pitch", my p_source_pitch_f0Mid) SET_REAL (U"End time", my p_source_pitch_tEnd) SET_REAL (U"End pitch", my p_source_pitch_f0End) EDITOR_DO my pref_source_pitch_tStart () = my p_source_pitch_tStart = GET_REAL (U"Starting time"); my pref_source_pitch_f0Start () = my p_source_pitch_f0Start = GET_REAL (U"Starting pitch"); my pref_source_pitch_tMid () = my p_source_pitch_tMid = GET_REAL (U"Mid time"); my pref_source_pitch_f0Mid () = my p_source_pitch_f0Mid = GET_REAL (U"Mid pitch"); my pref_source_pitch_tEnd () = my p_source_pitch_tEnd = GET_REAL (U"End time"); my pref_source_pitch_f0End () = my p_source_pitch_f0End = GET_REAL (U"End pitch"); EDITOR_END }
static void menu_cb_searchForPage (EDITOR_ARGS) { EDITOR_IAM (HyperPage); EDITOR_FORM (L"Search for page", 0) TEXTFIELD (L"Page", L"a") EDITOR_OK EDITOR_DO HyperPage_goToPage (me, GET_STRING (L"Page")); // BUG EDITOR_END }
static void menu_cb_selectFormantOrBandwidth (FormantGridEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Select formant or bandwidth", nullptr) NATURAL (U"Formant number", U"1") EDITOR_OK SET_INTEGER (U"Formant number", my selectedFormant) EDITOR_DO selectFormantOrBandwidth (me, GET_INTEGER (U"Formant number")); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_fontSize (EDITOR_ARGS) { EDITOR_IAM (HyperPage); EDITOR_FORM (L"Font size", 0) NATURAL (L"Font size (points)", L"12") EDITOR_OK SET_INTEGER (L"Font size", my fontSize) EDITOR_DO setFontSize (me, GET_INTEGER (L"Font size")); EDITOR_END }
static void menu_cb_selectFormantOrBandwidth (EDITOR_ARGS) { EDITOR_IAM (FormantGridEditor); EDITOR_FORM (L"Select formant or bandwidth", 0) NATURAL (L"Formant number", L"1") EDITOR_OK SET_INTEGER (L"Formant number", my selectedFormant) EDITOR_DO selectFormantOrBandwidth (me, GET_INTEGER (L"Formant number")); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_searchForPageList (Manual me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Search for page", nullptr) ManPages manPages = (ManPages) my data; long numberOfPages; const char32 **pages = ManPages_getTitles (manPages, & numberOfPages); LIST (U"Page", manPages -> pages.size, pages, 1) EDITOR_OK EDITOR_DO HyperPage_goToPage_i (me, GET_INTEGER (U"Page")); EDITOR_END }
static void menu_cb_evaluate (EDITOR_ARGS) { EDITOR_IAM (OTGrammarEditor); EDITOR_FORM (L"Evaluate", 0) REAL (L"Noise", L"2.0") EDITOR_OK EDITOR_DO Editor_save (me, L"Evaluate"); OTGrammar_newDisharmonies ((OTGrammar) my data, GET_REAL (L"Noise")); Graphics_updateWs (my g); my broadcastDataChanged (); EDITOR_END }
static void menu_cb_addPointAt (PointEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Add point", nullptr) REAL (U"Position", U"0.0"); EDITOR_OK SET_REAL (U"Position", 0.5 * (my startSelection + my endSelection)); EDITOR_DO Editor_save (me, U"Add point"); PointProcess_addPoint ((PointProcess) my data, GET_REAL (U"Position")); FunctionEditor_redraw (me); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_searchForPageList (EDITOR_ARGS) { EDITOR_IAM (Manual); EDITOR_FORM (L"Search for page", 0) ManPages manPages = (ManPages) my data; long numberOfPages; const wchar_t **pages = ManPages_getTitles (manPages, & numberOfPages); LIST (L"Page", manPages -> pages -> size, pages, 1) EDITOR_OK EDITOR_DO HyperPage_goToPage_i (me, GET_INTEGER (L"Page")); EDITOR_END }
static void menu_cb_setDynamicRange (EDITOR_ARGS) { EDITOR_IAM (SpectrumEditor); EDITOR_FORM (L"Set dynamic range", 0) POSITIVE (L"Dynamic range (dB)", my default_dynamicRange ()) EDITOR_OK SET_REAL (L"Dynamic range", my p_dynamicRange) EDITOR_DO my pref_dynamicRange () = my p_dynamicRange = GET_REAL (L"Dynamic range"); updateRange (me); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_resetAllRankings (EDITOR_ARGS) { EDITOR_IAM (OTGrammarEditor); EDITOR_FORM (L"Reset all rankings", 0) REAL (L"Ranking", L"100.0") EDITOR_OK EDITOR_DO Editor_save (me, L"Reset all rankings"); OTGrammar_reset ((OTGrammar) my data, GET_REAL (L"Ranking")); Graphics_updateWs (my g); my broadcastDataChanged (); EDITOR_END }
static void menu_cb_preferences (TableEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"TableEditor preferences", nullptr); OPTIONMENU (U"The symbols %#_^ in labels", my default_useTextStyles () + 1) OPTION (U"are shown as typed") OPTION (U"mean italic/bold/sub/super") EDITOR_OK SET_INTEGER (U"The symbols %#_^ in labels", my p_useTextStyles + 1) EDITOR_DO my pref_useTextStyles () = my p_useTextStyles = GET_INTEGER (U"The symbols %#_^ in labels") - 1; Graphics_updateWs (my graphics.get()); EDITOR_END }
static void menu_cb_evaluate (EDITOR_ARGS) { EDITOR_IAM (OTMultiEditor); EDITOR_FORM (U"Evaluate", 0) REAL (U"Evaluation noise", U"2.0") EDITOR_OK EDITOR_DO Editor_save (me, U"Evaluate"); OTMulti_newDisharmonies ((OTMulti) my data, GET_REAL (U"Evaluation noise")); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_resetAllRankings (EDITOR_ARGS) { EDITOR_IAM (OTMultiEditor); EDITOR_FORM (U"Reset all rankings", 0) REAL (U"Ranking", U"100.0") EDITOR_OK EDITOR_DO Editor_save (me, U"Reset all rankings"); OTMulti_reset ((OTMulti) my data, GET_REAL (U"Ranking")); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_writeAllToHtmlDir (Manual me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Save all pages as HTML files", nullptr) LABEL (U"", U"Type a directory name:") TEXTFIELD (U"directory", U"") EDITOR_OK structMelderDir currentDirectory { { 0 } }; Melder_getDefaultDir (& currentDirectory); SET_STRING (U"directory", Melder_dirToPath (& currentDirectory)) EDITOR_DO char32 *directory = GET_STRING (U"directory"); ManPages_writeAllToHtmlDir ((ManPages) my data, directory); EDITOR_END }
static void menu_cb_addPointAt (EDITOR_ARGS) { EDITOR_IAM (PointEditor); EDITOR_FORM (L"Add point", 0) REAL (L"Position", L"0.0"); EDITOR_OK SET_REAL (L"Position", 0.5 * (my d_startSelection + my d_endSelection)); EDITOR_DO Editor_save (me, L"Add point"); PointProcess_addPoint ((PointProcess) my data, GET_REAL (L"Position")); FunctionEditor_redraw (me); my broadcastDataChanged (); EDITOR_END }
static void menu_cb_setFormantRange (FormantGridEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Set formant range", nullptr) REAL (U"Minimum formant (Hz)", my default_formantFloor ()) REAL (U"Maximum formant (Hz)", my default_formantCeiling ()) EDITOR_OK SET_REAL (U"Minimum formant", my p_formantFloor) SET_REAL (U"Maximum formant", my p_formantCeiling) EDITOR_DO my pref_formantFloor () = my p_formantFloor = GET_REAL (U"Minimum formant"); my pref_formantCeiling () = my p_formantCeiling = GET_REAL (U"Maximum formant"); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_setBandwidthRange (FormantGridEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Set bandwidth range", nullptr) REAL (U"Minimum bandwidth (Hz)", my default_bandwidthFloor ()) REAL (U"Maximum bandwidth (Hz)", my default_bandwidthCeiling ()) EDITOR_OK SET_REAL (U"Minimum bandwidth", my p_bandwidthFloor) SET_REAL (U"Maximum bandwidth", my p_bandwidthCeiling) EDITOR_DO my pref_bandwidthFloor () = my p_bandwidthFloor = GET_REAL (U"Minimum bandwidth"); my pref_bandwidthCeiling () = my p_bandwidthCeiling = GET_REAL (U"Maximum bandwidth"); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_writeAllToHtmlDir (EDITOR_ARGS) { EDITOR_IAM (Manual); EDITOR_FORM (L"Save all pages as HTML files", 0) LABEL (L"", L"Type a directory name:") TEXTFIELD (L"directory", L"") EDITOR_OK structMelderDir currentDirectory = { { 0 } }; Melder_getDefaultDir (& currentDirectory); SET_STRING (L"directory", Melder_dirToPath (& currentDirectory)) EDITOR_DO wchar *directory = GET_STRING (L"directory"); ManPages_writeAllToHtmlDir ((ManPages) my data, directory); EDITOR_END }
static void menu_cb_setBandwidthRange (EDITOR_ARGS) { EDITOR_IAM (FormantGridEditor); EDITOR_FORM (L"Set bandwidth range", 0) REAL (L"Minimum bandwidth (Hz)", L"0.0") REAL (L"Maximum bandwidth (Hz)", L"1000.0") EDITOR_OK SET_REAL (L"Minimum bandwidth", my bandwidthFloor) SET_REAL (L"Maximum bandwidth", my bandwidthCeiling) EDITOR_DO preferences.bandwidthFloor = my bandwidthFloor = GET_REAL (L"Minimum bandwidth"); preferences.bandwidthCeiling = my bandwidthCeiling = GET_REAL (L"Maximum bandwidth"); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_setFormantRange (EDITOR_ARGS) { EDITOR_IAM (FormantGridEditor); EDITOR_FORM (L"Set formant range", 0) REAL (L"Minimum formant (Hz)", L"0.0") REAL (L"Maximum formant (Hz)", L"11000.0") EDITOR_OK SET_REAL (L"Minimum formant", my formantFloor) SET_REAL (L"Maximum formant", my formantCeiling) EDITOR_DO preferences.formantFloor = my formantFloor = GET_REAL (L"Minimum formant"); preferences.formantCeiling = my formantCeiling = GET_REAL (L"Maximum formant"); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_stopBand (EDITOR_ARGS) { EDITOR_IAM (SpectrumEditor); EDITOR_FORM (L"Filter (stop Hann band)", 0) REAL (L"Band smoothing (Hz)", my default_bandSmoothing ()) EDITOR_OK SET_REAL (L"Band smoothing", my p_bandSmoothing) EDITOR_DO my pref_bandSmoothing () = my p_bandSmoothing = GET_REAL (L"Band smoothing"); if (my d_endSelection <= my d_startSelection) Melder_throw (L"To apply a band-stop filter, first make a selection."); Editor_save (me, L"Stop band"); Spectrum_stopHannBand ((Spectrum) my data, my d_startSelection, my d_endSelection, my p_bandSmoothing); FunctionEditor_redraw (me); my broadcastDataChanged (); EDITOR_END }
static void menu_cb_setCeiling (EDITOR_ARGS) { EDITOR_IAM (PitchEditor); EDITOR_FORM (L"Change ceiling", 0) POSITIVE (L"Ceiling (Hz)", L"600") EDITOR_OK Pitch pitch = (Pitch) my data; SET_REAL (L"Ceiling", pitch -> ceiling) EDITOR_DO Pitch pitch = (Pitch) my data; Editor_save (me, L"Change ceiling"); Pitch_setCeiling (pitch, GET_REAL (L"Ceiling")); FunctionEditor_redraw (me); my broadcastDataChanged (); EDITOR_END }
static void menu_cb_font (EDITOR_ARGS) { EDITOR_IAM (HyperPage); EDITOR_FORM (L"Font", 0) RADIO (L"Font", 1) RADIOBUTTON (L"Times") RADIOBUTTON (L"Helvetica") EDITOR_OK SET_INTEGER (L"Font", my font == kGraphics_font_TIMES ? 1 : my font == kGraphics_font_HELVETICA ? 2 : my font == kGraphics_font_PALATINO ? 3 : 1); EDITOR_DO int font = GET_INTEGER (L"Font"); prefs_font = my font = font == 1 ? kGraphics_font_TIMES : kGraphics_font_HELVETICA; if (my g) Graphics_updateWs (my g); EDITOR_END }