| 1 | /* OTMultiEditor.cpp |
| 2 | * |
| 3 | * Copyright (C) 2005-2022,2024 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 | /* |
| 20 | * a selection of changes: |
| 21 | * pb 2005/07/04 created |
| 22 | * pb 2007/10/01 constraint plasticity |
| 23 | * pb 2011/03/01 multiple update rules |
| 24 | */ |
| 25 | |
| 26 | #include "OTMultiEditor.h"cxx . . $ `<file>/gram/OTMultiEditor.h`/ |
| 27 | #include "EditorM.h"cxx . . $ `<file>/sys/EditorM.h`/ |
| 28 | #include "machine.h"cxx . . $ `<file>/sys/machine.h`/ |
| 29 | |
| 30 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (OTMultiEditor, HyperPage, 0); |
| 31 | |
| 32 | static void menu_cb_evaluatecxx . . $ menu_cb_evaluate(1db10c97150ed7d). (OTMultiEditorcxx . . $ OTMultiEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 33 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Evaluate", nullptr) |
| 34 | REALcxx . . $ `sys/EditorM.h:95:9`! (evaluationNoise, U"Evaluation noise", U"2.0") |
| 35 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 36 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 37 | Editor_savecxx . . $ Editor_save(ed6f6b1571b749af). (me, U"Evaluate"); |
| 38 | OTMulti_newDisharmoniescxx . . $ OTMulti_newDisharmonies(8663bcc155b161db). (mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).(), evaluationNoise); |
| 39 | Graphics_updateWscxx . . $ Graphics_updateWs(2d838ed765120c5d). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structHyperPage#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 40 | Editor_broadcastDataChangedcxx . . $ Editor_broadcastDataChanged(c0154a85f79216c7). (me); |
| 41 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 42 | } |
| 43 | |
| 44 | static void menu_cb_evaluate_noise_2_0cxx . . $ menu_cb_evaluate_noise_2_0(1db10c97150ed7d). (OTMultiEditorcxx . . $ OTMultiEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 45 | Editor_savecxx . . $ Editor_save(ed6f6b1571b749af). (me, U"Evaluate (noise 2.0)"); |
| 46 | OTMulti_newDisharmoniescxx . . $ OTMulti_newDisharmonies(8663bcc155b161db). (mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).(), 2.0); |
| 47 | Graphics_updateWscxx . . $ Graphics_updateWs(2d838ed765120c5d). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structHyperPage#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 48 | Editor_broadcastDataChangedcxx . . $ Editor_broadcastDataChanged(c0154a85f79216c7). (me); |
| 49 | } |
| 50 | |
| 51 | static void menu_cb_evaluate_tinyNoisecxx . . $ menu_cb_evaluate_tinyNoise(1db10c97150ed7d). (OTMultiEditorcxx . . $ OTMultiEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 52 | Editor_savecxx . . $ Editor_save(ed6f6b1571b749af). (me, U"Evaluate (tiny noise)"); |
| 53 | OTMulti_newDisharmoniescxx . . $ OTMulti_newDisharmonies(8663bcc155b161db). (mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).(), 1e-9); |
| 54 | Graphics_updateWscxx . . $ Graphics_updateWs(2d838ed765120c5d). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structHyperPage#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 55 | Editor_broadcastDataChangedcxx . . $ Editor_broadcastDataChanged(c0154a85f79216c7). (me); |
| 56 | } |
| 57 | |
| 58 | static void menu_cb_editRankingcxx . . $ menu_cb_editRanking(1db10c97150ed7d). (OTMultiEditorcxx . . $ OTMultiEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 59 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Edit ranking", nullptr) |
| 60 | MUTABLE_COMMENTcxx . . $ `sys/EditorM.h:247:9`! (constraintLabel, U"") |
| 61 | REALcxx . . $ `sys/EditorM.h:95:9`! (rankingValue, U"Ranking value", U"100.0") |
| 62 | REALcxx . . $ `sys/EditorM.h:95:9`! (disharmony, U"Disharmony", U"100.0") |
| 63 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 64 | if (mycxx . . $ `melder/melder.h:44:9`! selectedConstraintcxx . . $ structOTMultiEditor#selectedConstraint. < 1 || mycxx . . $ `melder/melder.h:44:9`! selectedConstraintcxx . . $ structOTMultiEditor#selectedConstraint. > mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> numberOfConstraintscxx . . $ structOTMulti#numberOfConstraints.) |
| 65 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Select a constraint first."); |
| 66 | OTConstraintcxx . . $ OTConstraint# constraint = & mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> constraintscxx . . $ structOTMulti#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> indexcxx . . $ structOTMulti#index. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).mycxx . . $ `melder/melder.h:44:9`! selectedConstraintcxx . . $ structOTMultiEditor#selectedConstraint.]]; |
| 67 | SET_STRINGcxx . . $ `sys/EditorM.h:477:9`! (constraintLabel, constraint -> name.get()) |
| 68 | SET_REALcxx . . $ `sys/EditorM.h:462:9`! (rankingValue, constraint -> ranking) |
| 69 | SET_REALcxx . . $ `sys/EditorM.h:462:9`! (disharmony, constraint -> disharmony) |
| 70 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 71 | OTConstraintcxx . . $ OTConstraint# constraint = & mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> constraintscxx . . $ structOTMulti#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> indexcxx . . $ structOTMulti#index. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).mycxx . . $ `melder/melder.h:44:9`! selectedConstraintcxx . . $ structOTMultiEditor#selectedConstraint.]]; |
| 72 | Editor_savecxx . . $ Editor_save(ed6f6b1571b749af). (me, U"Edit ranking"); |
| 73 | constraint -> rankingcxx . . $ structOTConstraint#ranking. = rankingValue; |
| 74 | constraint -> disharmonycxx . . $ structOTConstraint#disharmony. = disharmony; |
| 75 | OTMulti_sortcxx . . $ OTMulti_sort(a34eed4b1c1d1bc5). (mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).()); |
| 76 | Graphics_updateWscxx . . $ Graphics_updateWs(2d838ed765120c5d). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structHyperPage#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 77 | Editor_broadcastDataChangedcxx . . $ Editor_broadcastDataChanged(c0154a85f79216c7). (me); |
| 78 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 79 | } |
| 80 | |
| 81 | static void menu_cb_learnOnecxx . . $ menu_cb_learnOne(1db10c97150ed7d). (OTMultiEditorcxx . . $ OTMultiEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 82 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Learn one", U"OTGrammar: Learn one...") |
| 83 | OPTIONMENU_ENUMcxx . . $ `sys/EditorM.h:426:9`! (kOTGrammar_rerankingStrategy, updateRule, |
| 84 | U"Update rule", kOTGrammar_rerankingStrategy::SYMMETRIC_ALL) |
| 85 | OPTIONMENUcxx . . $ `sys/EditorM.h:377:9`! (direction, U"Direction", 3) |
| 86 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"forward") |
| 87 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"backward") |
| 88 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"bidirectionally") |
| 89 | REALcxx . . $ `sys/EditorM.h:95:9`! (plasticity, U"Plasticity", U"0.1") |
| 90 | REALcxx . . $ `sys/EditorM.h:95:9`! (relativePlasticitySpreading, U"Rel. plasticity spreading", U"0.1") |
| 91 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 92 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 93 | Editor_savecxx . . $ Editor_save(ed6f6b1571b749af). (me, U"Learn one"); |
| 94 | mycxx . . $ `melder/melder.h:44:9`! form1cxx . . $ structOTMultiEditor#form1. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). GuiText_getStringcxx . . $ GuiText_getString(9a61f82c13ba8ebc). (mycxx . . $ `melder/melder.h:44:9`! form1Textcxx . . $ structOTMultiEditor#form1Text.); |
| 95 | mycxx . . $ `melder/melder.h:44:9`! form2cxx . . $ structOTMultiEditor#form2. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). GuiText_getStringcxx . . $ GuiText_getString(9a61f82c13ba8ebc). (mycxx . . $ `melder/melder.h:44:9`! form2Textcxx . . $ structOTMultiEditor#form2Text.); |
| 96 | OTMulti_learnOnecxx . . $ OTMulti_learnOne(359a3fa70914d01b). (mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).(), mycxx . . $ `melder/melder.h:44:9`! form1cxx . . $ structOTMultiEditor#form1..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), mycxx . . $ `melder/melder.h:44:9`! form2cxx . . $ structOTMultiEditor#form2..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), |
| 97 | updateRule, direction, |
| 98 | plasticity, relativePlasticitySpreading); |
| 99 | Graphics_updateWscxx . . $ Graphics_updateWs(2d838ed765120c5d). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structHyperPage#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 100 | Editor_broadcastDataChangedcxx . . $ Editor_broadcastDataChanged(c0154a85f79216c7). (me); |
| 101 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 102 | } |
| 103 | |
| 104 | static void menu_cb_removeConstraintcxx . . $ menu_cb_removeConstraint(1db10c97150ed7d). (OTMultiEditorcxx . . $ OTMultiEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 105 | if (mycxx . . $ `melder/melder.h:44:9`! selectedConstraintcxx . . $ structOTMultiEditor#selectedConstraint. < 1 || mycxx . . $ `melder/melder.h:44:9`! selectedConstraintcxx . . $ structOTMultiEditor#selectedConstraint. > mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> numberOfConstraintscxx . . $ structOTMulti#numberOfConstraints.) |
| 106 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Select a constraint first."); |
| 107 | OTConstraintcxx . . $ OTConstraint# constraint = & mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> constraintscxx . . $ structOTMulti#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> indexcxx . . $ structOTMulti#index. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).mycxx . . $ `melder/melder.h:44:9`! selectedConstraintcxx . . $ structOTMultiEditor#selectedConstraint.]]; |
| 108 | Editor_savecxx . . $ Editor_save(ed6f6b1571b749af). (me, U"Remove constraint"); |
| 109 | OTMulti_removeConstraintcxx . . $ OTMulti_removeConstraint(53c7497ad62bed0). (mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).(), constraint -> namecxx . . $ structOTConstraint#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 110 | Graphics_updateWscxx . . $ Graphics_updateWs(2d838ed765120c5d). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structHyperPage#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 111 | Editor_broadcastDataChangedcxx . . $ Editor_broadcastDataChanged(c0154a85f79216c7). (me); |
| 112 | } |
| 113 | |
| 114 | static void menu_cb_resetAllRankingscxx . . $ menu_cb_resetAllRankings(1db10c97150ed7d). (OTMultiEditorcxx . . $ OTMultiEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 115 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Reset all rankings", nullptr) |
| 116 | REALcxx . . $ `sys/EditorM.h:95:9`! (ranking, U"Ranking", U"100.0") |
| 117 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 118 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 119 | Editor_savecxx . . $ Editor_save(ed6f6b1571b749af). (me, U"Reset all rankings"); |
| 120 | OTMulti_resetcxx . . $ OTMulti_reset(8663bcc155b161db). (mycxx . . $ `melder/melder.h:44:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).(), ranking); |
| 121 | Graphics_updateWscxx . . $ Graphics_updateWs(2d838ed765120c5d). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structHyperPage#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 122 | Editor_broadcastDataChangedcxx . . $ Editor_broadcastDataChanged(c0154a85f79216c7). (me); |
| 123 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 124 | } |
| 125 | |
| 126 | static void menu_cb_OTLearningTutorialcxx . . $ menu_cb_OTLearningTutorial(1db10c97150ed7d). (OTMultiEditorcxx . . $ OTMultiEditor#, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 127 | Melder_helpcxx . . $ Melder_help(ff00d524ab0355ec). (U"OT learning"); |
| 128 | } |
| 129 | |
| 130 | static void do_limitcxx . . $ do_limit(d4c3d4e1320ccfde). (OTMultiEditorcxx . . $ OTMultiEditor# me) { |
| 131 | mycxx . . $ `melder/melder.h:44:9`! form1cxx . . $ structOTMultiEditor#form1. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). GuiText_getStringcxx . . $ GuiText_getString(9a61f82c13ba8ebc). (mycxx . . $ `melder/melder.h:44:9`! form1Textcxx . . $ structOTMultiEditor#form1Text.); |
| 132 | mycxx . . $ `melder/melder.h:44:9`! form2cxx . . $ structOTMultiEditor#form2. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). GuiText_getStringcxx . . $ GuiText_getString(9a61f82c13ba8ebc). (mycxx . . $ `melder/melder.h:44:9`! form2Textcxx . . $ structOTMultiEditor#form2Text.); |
| 133 | Graphics_updateWscxx . . $ Graphics_updateWs(2d838ed765120c5d). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structHyperPage#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 134 | } |
| 135 | |
| 136 | static void gui_button_cb_limitcxx . . $ gui_button_cb_limit(522801e12152b7d6). (OTMultiEditorcxx . . $ OTMultiEditor# me, GuiButtonEventcxx . . $ GuiButtonEvent# /* event */) { |
| 137 | do_limitcxx . . $ do_limit(d4c3d4e1320ccfde). (me); |
| 138 | } |
| 139 | |
| 140 | void structOTMultiEditorcxx . . $ structOTMultiEditor# :: v_createChildrencxx . . $ structOTMultiEditor#v_createChildren(49f6e7a06ebc5aa8). () { |
| 141 | OTMultiEditor_Parentcxx . . $ OTMultiEditor_Parent# :: v_createChildrencxx . . $ structHyperPage#v_createChildren(49f6e7a06ebc5aa8). (); |
| 142 | #if defined (macintosh) |
| 143 | #define STRING_SPACING 8 |
| 144 | #else |
| 145 | #define STRING_SPACINGcxx . . $ `gram/OTMultiEditor.cpp:145:11`! 2 |
| 146 | #endif |
| 147 | int height = Machine_getTextHeightcxx . . $ Machine_getTextHeight(b126dc7c1de90089). (), y = Machine_getMenuBarBottomcxx . . $ Machine_getMenuBarBottom(b126dc7c1de90089). () + 4; |
| 148 | GuiButton_createShowncxx . . $ GuiButton_createShown(653ed9987c16d9c1). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., 4, 124, y, y + height, |
| 149 | U"Partial forms:", gui_button_cb_limitcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this, GuiButton_DEFAULTcxx . . $ `sys/Gui.h:467:9`!); |
| 150 | form1Textcxx . . $ structOTMultiEditor#form1Text. = GuiText_createShowncxx . . $ GuiText_createShown(8bcb1f2be7fc31ee). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., |
| 151 | 124 + STRING_SPACINGcxx . . $ `gram/OTMultiEditor.cpp:145:11`!, 274 + STRING_SPACINGcxx . . $ `gram/OTMultiEditor.cpp:145:11`!, y, y + Gui_TEXTFIELD_HEIGHTcxx . . $ `sys/Gui.h:96:9`!, 0); |
| 152 | form2Textcxx . . $ structOTMultiEditor#form2Text. = GuiText_createShowncxx . . $ GuiText_createShown(8bcb1f2be7fc31ee). (ourcxx . . $ `melder/melder.h:42:9`! windowFormcxx . . $ structEditor#windowForm., |
| 153 | 274 + 2 * STRING_SPACINGcxx . . $ `gram/OTMultiEditor.cpp:145:11`!, 424 + 2 * STRING_SPACINGcxx . . $ `gram/OTMultiEditor.cpp:145:11`!, y, y + Gui_TEXTFIELD_HEIGHTcxx . . $ `sys/Gui.h:96:9`!, 0); |
| 154 | } |
| 155 | |
| 156 | void structOTMultiEditorcxx . . $ structOTMultiEditor# :: v_createMenuscxx . . $ structOTMultiEditor#v_createMenus(49f6e7a06ebc5aa8). () { |
| 157 | OTMultiEditor_Parentcxx . . $ OTMultiEditor_Parent# :: v_createMenuscxx . . $ structHyperPage#v_createMenus(49f6e7a06ebc5aa8). (); |
| 158 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Edit", U"-- edit ot --", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).); |
| 159 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Edit", U"Evaluate...", 0, menu_cb_evaluatecxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 160 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Edit", U"Evaluate (noise 2.0)", '2', menu_cb_evaluate_noise_2_0cxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 161 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Edit", U"Evaluate (tiny noise)", '9', menu_cb_evaluate_tinyNoisecxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 162 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Edit", U"Edit ranking...", 'E', menu_cb_editRankingcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 163 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Edit", U"Reset all rankings...", 'R', menu_cb_resetAllRankingscxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 164 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Edit", U"Learn one...", '1', menu_cb_learnOnecxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 165 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Edit", U"-- remove --", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).); |
| 166 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Edit", U"Remove constraint", 0, menu_cb_removeConstraintcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 167 | } |
| 168 | |
| 169 | void structOTMultiEditorcxx . . $ structOTMultiEditor# :: v_createMenuItems_helpcxx . . $ structOTMultiEditor#v_createMenuItems_help(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu# menu) { |
| 170 | OTMultiEditor_Parentcxx . . $ OTMultiEditor_Parent# :: v_createMenuItems_helpcxx . . $ structDataGui#v_createMenuItems_help(6ea9c8c6ea2f58a9). (menu); |
| 171 | EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, U"OT learning tutorial", 0, menu_cb_OTLearningTutorialcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 172 | } |
| 173 | |
| 174 | static OTMulticxx . . $ OTMulti# drawTableau_grammarcxx . . $ drawTableau_grammar.; |
| 175 | static conststring32cxx . . $ conststring32# drawTableau_form1cxx . . $ drawTableau_form1., drawTableau_form2cxx . . $ drawTableau_form2.; |
| 176 | static bool drawTableau_constraintsAreDrawnVerticallycxx . . $ drawTableau_constraintsAreDrawnVertically.; |
| 177 | static void drawTableaucxx . . $ drawTableau(2d838ed765120c5d). (Graphicscxx . . $ Graphics# g) { |
| 178 | OTMulti_drawTableaucxx . . $ OTMulti_drawTableau(6da0ce92984dc4c7). (drawTableau_grammarcxx . . $ drawTableau_grammar., g, drawTableau_form1cxx . . $ drawTableau_form1., drawTableau_form2cxx . . $ drawTableau_form2., drawTableau_constraintsAreDrawnVerticallycxx . . $ drawTableau_constraintsAreDrawnVertically., true); |
| 179 | } |
| 180 | |
| 181 | void structOTMultiEditorcxx . . $ structOTMultiEditor# :: v_drawcxx . . $ structOTMultiEditor#v_draw(49f6e7a06ebc5aa8). () { |
| 182 | static MelderStringcxx . . $ MelderString# buffer; |
| 183 | const double rowHeight = 0.25; |
| 184 | longdoublecxx . . $ longdouble# tableauHeight = 2 * rowHeight; |
| 185 | HyperPage_listItemcxx . . $ HyperPage_listItem(9d6e0dd96656f536). (this, U"\t\t %%ranking value\t %disharmony\t %plasticity"); |
| 186 | for (integercxx . . $ integer# icons = 1; icons <= ourcxx . . $ `melder/melder.h:42:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> numberOfConstraintscxx . . $ structOTMulti#numberOfConstraints.; icons ++) { |
| 187 | const OTConstraintcxx . . $ OTConstraint# constraint = & ourcxx . . $ `melder/melder.h:42:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> constraintscxx . . $ structOTMulti#constraints. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ourcxx . . $ `melder/melder.h:42:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> indexcxx . . $ structOTMulti#index. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).icons]]; |
| 188 | MelderString_copycxx . . $ MelderString_copy(65be51a793e0ff96). (& buffer, U"\t", ( icons == selectedConstraintcxx . . $ structOTMultiEditor#selectedConstraint. ? U"♠︎ " : U" " ), U"@@", icons, |
| 189 | U"|", constraint -> namecxx . . $ structOTConstraint#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U"@\t ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (constraint -> rankingcxx . . $ structOTConstraint#ranking., 3), |
| 190 | U"\t ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (constraint -> disharmonycxx . . $ structOTConstraint#disharmony., 3), |
| 191 | U"\t ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (constraint -> plasticitycxx . . $ structOTConstraint#plasticity., 6) |
| 192 | ); |
| 193 | HyperPage_listItemcxx . . $ HyperPage_listItem(9d6e0dd96656f536). (this, buffer.stringcxx . . $ MelderString#string.); |
| 194 | } |
| 195 | Graphics_setAtSignIsLinkcxx . . $ Graphics_setAtSignIsLink(b5ae742079ad918c). (graphicscxx . . $ structHyperPage#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), false); |
| 196 | drawTableau_grammarcxx . . $ drawTableau_grammar. = ourcxx . . $ `melder/melder.h:42:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).(); |
| 197 | for (integercxx . . $ integer# icand = 1; icand <= ourcxx . . $ `melder/melder.h:42:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).() -> numberOfCandidatescxx . . $ structOTMulti#numberOfCandidates.; icand ++) |
| 198 | if (OTMulti_candidateMatchescxx . . $ OTMulti_candidateMatches(17cb9c47ac4309ff). (ourcxx . . $ `melder/melder.h:42:9`! otMulticxx . . $ structOTMultiEditor#otMulti(f1b6b6657502af56).(), icand, ourcxx . . $ `melder/melder.h:42:9`! form1cxx . . $ structOTMultiEditor#form1..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), ourcxx . . $ `melder/melder.h:42:9`! form2cxx . . $ structOTMultiEditor#form2..getcxx . . $ _autostring#get(5a2a78a048fb49a8).())) |
| 199 | tableauHeight += rowHeight; |
| 200 | drawTableau_form1cxx . . $ drawTableau_form1. = ourcxx . . $ `melder/melder.h:42:9`! form1cxx . . $ structOTMultiEditor#form1..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(); // BUG: dangle |
| 201 | drawTableau_form2cxx . . $ drawTableau_form2. = ourcxx . . $ `melder/melder.h:42:9`! form2cxx . . $ structOTMultiEditor#form2..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(); |
| 202 | drawTableau_constraintsAreDrawnVerticallycxx . . $ drawTableau_constraintsAreDrawnVertically. = ourcxx . . $ `melder/melder.h:42:9`! d_constraintsAreDrawnVerticallycxx . . $ structOTMultiEditor#d_constraintsAreDrawnVertically.; |
| 203 | HyperPage_picturecxx . . $ HyperPage_picture(33f50d1d203ff172). (this, 20, tableauHeight, drawTableaucxx . . $ drawTableau(2d838ed765120c5d).); |
| 204 | Graphics_setAtSignIsLinkcxx . . $ Graphics_setAtSignIsLink(b5ae742079ad918c). (graphicscxx . . $ structHyperPage#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), true); |
| 205 | } |
| 206 | |
| 207 | int structOTMultiEditorcxx . . $ structOTMultiEditor# :: v_goToPagecxx . . $ structOTMultiEditor#v_goToPage(e049ab16a3067c7). (conststring32cxx . . $ conststring32# title) { |
| 208 | if (! title) |
| 209 | return 1; |
| 210 | selectedConstraintcxx . . $ structOTMultiEditor#selectedConstraint. = Melder_atoicxx . . $ Melder_atoi(c94c67ff4219bf83). (title); |
| 211 | return 1; |
| 212 | } |
| 213 | |
| 214 | autoOTMultiEditorcxx . . $ autoOTMultiEditor# OTMultiEditor_createcxx . . $ OTMultiEditor_create(3fdefbd777bc61a2). (conststring32cxx . . $ conststring32# title, OTMulticxx . . $ OTMulti# otMulti) { |
| 215 | try { |
| 216 | autoOTMultiEditorcxx . . $ autoOTMultiEditor# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (OTMultiEditor); |
| 217 | mycxx . . $ `melder/melder.h:44:9`! form1cxx . . $ structOTMultiEditor#form1. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U""); |
| 218 | mycxx . . $ `melder/melder.h:44:9`! form2cxx . . $ structOTMultiEditor#form2. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (U""); |
| 219 | HyperPage_initcxx . . $ HyperPage_init(7b1f2c4aafa3d0ec). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), title, otMulti); |
| 220 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 221 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 222 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"OTMulti window not created."); |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | /* End of file OTMultiEditor.cpp */ |