| 1 | #cxx . . $ `<file>/foned/FunctionEditor.h`/ifndef _FunctionEditor_h_ |
| 2 | #define _FunctionEditor_h_cxx . . $ `foned/FunctionEditor.h:2:9`! |
| 3 | /* FunctionEditor.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2023,2025,2026 Paul Boersma |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "ScriptEditor.h"cxx . . $ `<file>/sys/ScriptEditor.h`/ |
| 22 | #include "Graphics.h"cxx . . $ `<file>/sys/Graphics.h`/ |
| 23 | #include "Function.h"cxx . . $ `<file>/fon/Function.h`/ |
| 24 | |
| 25 | struct FunctionEditor_picturecxx . . $ FunctionEditor_picture# { |
| 26 | /* KEEP IN SYNC WITH PREFS. */ |
| 27 | bool garnishcxx . . $ FunctionEditor_picture#garnish.; |
| 28 | }; |
| 29 | |
| 30 | constexpr integercxx . . $ integer# FunctionEditor_MAXIMUM_NUMBER_OF_FUNCTION_AREAScxx . . $ FunctionEditor_MAXIMUM_NUMBER_OF_FUNCTION_AREAS. = 5; |
| 31 | |
| 32 | Thing_definecxx . . $ ClassInfo# (FunctionEditor, Editor) { |
| 33 | /* |
| 34 | Inherited attributes: |
| 35 | data: must be a Function. |
| 36 | */ |
| 37 | Functioncxx . . $ Function# functioncxx . . $ structFunctionEditor#function(bc0cc0faa3cceeeb).() { return static_cast <Functioncxx . . $ Function#> (ourcxx . . $ `melder/melder.h:42:9`! datacxx . . $ structDataGui#data(e8441e10bf3a9c6e).()); } |
| 38 | |
| 39 | autoDataGuicxx . . $ autoDataGui# functionAreascxx . . $ structFunctionEditor#functionAreas. [1 + FunctionEditor_MAXIMUM_NUMBER_OF_FUNCTION_AREAScxx . . $ FunctionEditor_MAXIMUM_NUMBER_OF_FUNCTION_AREAS.]; |
| 40 | |
| 41 | /* |
| 42 | Subclasses may change the following attributes, |
| 43 | but have to respect the invariants, |
| 44 | and have to call FunctionEditor_windowMarksChanged() or FunctionEditor_selectionMarksChanged() |
| 45 | immediately after making those changes. |
| 46 | Invariants: |
| 47 | tmin <= startWindow < endWindow <= tmax; |
| 48 | tmin <= startSelection <= endSelection <= tmax; |
| 49 | */ |
| 50 | double tmincxx . . $ structFunctionEditor#tmin., tmaxcxx . . $ structFunctionEditor#tmax., startWindowcxx . . $ structFunctionEditor#startWindow., endWindowcxx . . $ structFunctionEditor#endWindow.; |
| 51 | double startSelectioncxx . . $ structFunctionEditor#startSelection., endSelectioncxx . . $ structFunctionEditor#endSelection.; // markers |
| 52 | |
| 53 | autoGraphicscxx . . $ autoGraphics# graphicscxx . . $ structFunctionEditor#graphics.; // used in the expose callback |
| 54 | /* |
| 55 | The Normalized Device cordinates are in "pixelettes", which are a bit smaller than pixels. |
| 56 | The purpose of this is optimal look and feel. |
| 57 | The extent to which a pixelette is smaller than a pixel depends on the size of the drawing area: |
| 58 | for smaller drawing areas, texts are a bit more cramped in their rectangles |
| 59 | than for larger drawing areas. |
| 60 | */ |
| 61 | double width_pxltcxx . . $ structFunctionEditor#width_pxlt., height_pxltcxx . . $ structFunctionEditor#height_pxlt.; // size of drawing area in pixelettes |
| 62 | double _functionViewerLeftcxx . . $ structFunctionEditor#_functionViewerLeft., _functionViewerRightcxx . . $ structFunctionEditor#_functionViewerRight.; // location of function viewer in pixelettes |
| 63 | double _selectionViewerLeftcxx . . $ structFunctionEditor#_selectionViewerLeft., _selectionViewerRightcxx . . $ structFunctionEditor#_selectionViewerRight.; // location of selection viewer in pixelettes |
| 64 | void updateGeometrycxx . . $ structFunctionEditor#updateGeometry(3e454b8ccf442868). (int width_pixels, int height_pixels) { |
| 65 | Graphics_setWsViewportcxx . . $ Graphics_setWsViewport(4ffe5bb10b2fb6bd). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.0, width_pixels, 0.0, height_pixels); |
| 66 | ourcxx . . $ `melder/melder.h:42:9`! width_pxltcxx . . $ structFunctionEditor#width_pxlt. = width_pixels + 21; // the +21 means that the horizontal margin becomes a tiny bit larger when the window grows |
| 67 | ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt. = height_pixels + 111; // the +111 means that the vertical margins become a bit larger when the window grows |
| 68 | Graphics_setWsWindowcxx . . $ Graphics_setWsWindow(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.0, ourcxx . . $ `melder/melder.h:42:9`! width_pxltcxx . . $ structFunctionEditor#width_pxlt., 0.0, ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt.); |
| 69 | //my viewAllAsPixelettes (); |
| 70 | /* |
| 71 | Put the function viewer at the left and the selection viewer at the right. |
| 72 | */ |
| 73 | ourcxx . . $ `melder/melder.h:42:9`! _functionViewerLeftcxx . . $ structFunctionEditor#_functionViewerLeft. = 0; |
| 74 | ourcxx . . $ `melder/melder.h:42:9`! _functionViewerRightcxx . . $ structFunctionEditor#_functionViewerRight. = ( ourcxx . . $ `melder/melder.h:42:9`! instancePref_showSelectionViewercxx . . $ structFunctionEditor#instancePref_showSelectionViewer(50ce9a9e25b4a850).() ? ourcxx . . $ `melder/melder.h:42:9`! width_pxltcxx . . $ structFunctionEditor#width_pxlt. * (2.0/3.0) : ourcxx . . $ `melder/melder.h:42:9`! width_pxltcxx . . $ structFunctionEditor#width_pxlt. ); |
| 75 | ourcxx . . $ `melder/melder.h:42:9`! _selectionViewerLeftcxx . . $ structFunctionEditor#_selectionViewerLeft. = ourcxx . . $ `melder/melder.h:42:9`! _functionViewerRightcxx . . $ structFunctionEditor#_functionViewerRight.; |
| 76 | ourcxx . . $ `melder/melder.h:42:9`! _selectionViewerRightcxx . . $ structFunctionEditor#_selectionViewerRight. = ourcxx . . $ `melder/melder.h:42:9`! width_pxltcxx . . $ structFunctionEditor#width_pxlt.; |
| 77 | } |
| 78 | bool isInSelectionViewercxx . . $ structFunctionEditor#isInSelectionViewer(b32f3370ca1a96a1). (double x_pxlt) const { |
| 79 | return x_pxlt > ourcxx . . $ `melder/melder.h:42:9`! _selectionViewerLeftcxx . . $ structFunctionEditor#_selectionViewerLeft.; |
| 80 | } |
| 81 | void viewAllAsPixelettescxx . . $ structFunctionEditor#viewAllAsPixelettes(83f5f38750778ac8). () const { |
| 82 | Graphics_setViewportcxx . . $ Graphics_setViewport(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.0, ourcxx . . $ `melder/melder.h:42:9`! width_pxltcxx . . $ structFunctionEditor#width_pxlt., 0.0, ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt.); |
| 83 | Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.0, ourcxx . . $ `melder/melder.h:42:9`! width_pxltcxx . . $ structFunctionEditor#width_pxlt., 0.0, ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt.); |
| 84 | } |
| 85 | void viewFunctionViewerAsPixelettescxx . . $ structFunctionEditor#viewFunctionViewerAsPixelettes(83f5f38750778ac8). () const { |
| 86 | Graphics_setViewportcxx . . $ Graphics_setViewport(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! _functionViewerLeftcxx . . $ structFunctionEditor#_functionViewerLeft., ourcxx . . $ `melder/melder.h:42:9`! _functionViewerRightcxx . . $ structFunctionEditor#_functionViewerRight., 0.0, ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt.); |
| 87 | Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! _functionViewerLeftcxx . . $ structFunctionEditor#_functionViewerLeft., ourcxx . . $ `melder/melder.h:42:9`! _functionViewerRightcxx . . $ structFunctionEditor#_functionViewerRight., 0.0, ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt.); |
| 88 | } |
| 89 | void viewSelectionViewerAsPixelettescxx . . $ structFunctionEditor#viewSelectionViewerAsPixelettes(83f5f38750778ac8). () const { |
| 90 | Graphics_setViewportcxx . . $ Graphics_setViewport(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! _selectionViewerLeftcxx . . $ structFunctionEditor#_selectionViewerLeft., ourcxx . . $ `melder/melder.h:42:9`! _selectionViewerRightcxx . . $ structFunctionEditor#_selectionViewerRight., 0.0, ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt.); |
| 91 | Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! _selectionViewerLeftcxx . . $ structFunctionEditor#_selectionViewerLeft., ourcxx . . $ `melder/melder.h:42:9`! _selectionViewerRightcxx . . $ structFunctionEditor#_selectionViewerRight., 0.0, ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt.); |
| 92 | } |
| 93 | constexpr static double spacecxx . . $ structFunctionEditor#space. = 30.0; |
| 94 | constexpr static double MARGINcxx . . $ structFunctionEditor#MARGIN. = 107.0; |
| 95 | constexpr static double BOTTOM_MARGINcxx . . $ structFunctionEditor#BOTTOM_MARGIN. = 2.0; |
| 96 | constexpr static double TOP_MARGINcxx . . $ structFunctionEditor#TOP_MARGIN. = 3.0; |
| 97 | double dataLeft_pxltcxx . . $ structFunctionEditor#dataLeft_pxlt(21b6c25e127938e2). () const { return ourcxx . . $ `melder/melder.h:42:9`! _functionViewerLeftcxx . . $ structFunctionEditor#_functionViewerLeft. + ourcxx . . $ `melder/melder.h:42:9`! MARGINcxx . . $ structFunctionEditor#MARGIN.; } |
| 98 | double dataRight_pxltcxx . . $ structFunctionEditor#dataRight_pxlt(21b6c25e127938e2). () const { return ourcxx . . $ `melder/melder.h:42:9`! _functionViewerRightcxx . . $ structFunctionEditor#_functionViewerRight. - ourcxx . . $ `melder/melder.h:42:9`! MARGINcxx . . $ structFunctionEditor#MARGIN.; } |
| 99 | double dataBottom_pxltcxx . . $ structFunctionEditor#dataBottom_pxlt(21b6c25e127938e2). () const { return ourcxx . . $ `melder/melder.h:42:9`! BOTTOM_MARGINcxx . . $ structFunctionEditor#BOTTOM_MARGIN. + ourcxx . . $ `melder/melder.h:42:9`! spacecxx . . $ structFunctionEditor#space. * 3; } |
| 100 | double dataTop_pxltcxx . . $ structFunctionEditor#dataTop_pxlt(21b6c25e127938e2). () const { return ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt. - (ourcxx . . $ `melder/melder.h:42:9`! TOP_MARGINcxx . . $ structFunctionEditor#TOP_MARGIN. + ourcxx . . $ `melder/melder.h:42:9`! spacecxx . . $ structFunctionEditor#space.); } |
| 101 | void viewDataAsWorldByFractioncxx . . $ structFunctionEditor#viewDataAsWorldByFraction(83f5f38750778ac8). () const { |
| 102 | Graphics_setViewportcxx . . $ Graphics_setViewport(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! dataLeft_pxltcxx . . $ structFunctionEditor#dataLeft_pxlt(21b6c25e127938e2).(), ourcxx . . $ `melder/melder.h:42:9`! dataRight_pxltcxx . . $ structFunctionEditor#dataRight_pxlt(21b6c25e127938e2).(), ourcxx . . $ `melder/melder.h:42:9`! dataBottom_pxltcxx . . $ structFunctionEditor#dataBottom_pxlt(21b6c25e127938e2).(), ourcxx . . $ `melder/melder.h:42:9`! dataTop_pxltcxx . . $ structFunctionEditor#dataTop_pxlt(21b6c25e127938e2).()); |
| 103 | Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! startWindowcxx . . $ structFunctionEditor#startWindow., ourcxx . . $ `melder/melder.h:42:9`! endWindowcxx . . $ structFunctionEditor#endWindow., 0.0, 1.0); |
| 104 | } |
| 105 | void viewTallDataAsWorldByPixelettescxx . . $ structFunctionEditor#viewTallDataAsWorldByPixelettes(83f5f38750778ac8). () const { |
| 106 | Graphics_setViewportcxx . . $ Graphics_setViewport(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! dataLeft_pxltcxx . . $ structFunctionEditor#dataLeft_pxlt(21b6c25e127938e2).(), ourcxx . . $ `melder/melder.h:42:9`! dataRight_pxltcxx . . $ structFunctionEditor#dataRight_pxlt(21b6c25e127938e2).(), 0.0, ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt.); |
| 107 | Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! startWindowcxx . . $ structFunctionEditor#startWindow., ourcxx . . $ `melder/melder.h:42:9`! endWindowcxx . . $ structFunctionEditor#endWindow., 0.0, ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt.); |
| 108 | } |
| 109 | constexpr static double SELECTION_VIEWER_MARGINcxx . . $ structFunctionEditor#SELECTION_VIEWER_MARGIN. = 0.0; |
| 110 | void viewInnerSelectionViewerAsFractionByFractioncxx . . $ structFunctionEditor#viewInnerSelectionViewerAsFractionByFraction(83f5f38750778ac8). () const { |
| 111 | Graphics_setViewportcxx . . $ Graphics_setViewport(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), ourcxx . . $ `melder/melder.h:42:9`! _selectionViewerLeftcxx . . $ structFunctionEditor#_selectionViewerLeft. + ourcxx . . $ `melder/melder.h:42:9`! MARGINcxx . . $ structFunctionEditor#MARGIN., ourcxx . . $ `melder/melder.h:42:9`! _selectionViewerRightcxx . . $ structFunctionEditor#_selectionViewerRight. - ourcxx . . $ `melder/melder.h:42:9`! MARGINcxx . . $ structFunctionEditor#MARGIN., |
| 112 | ourcxx . . $ `melder/melder.h:42:9`! BOTTOM_MARGINcxx . . $ structFunctionEditor#BOTTOM_MARGIN. + ourcxx . . $ `melder/melder.h:42:9`! spacecxx . . $ structFunctionEditor#space. * 3, ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt. - (ourcxx . . $ `melder/melder.h:42:9`! TOP_MARGINcxx . . $ structFunctionEditor#TOP_MARGIN. + ourcxx . . $ `melder/melder.h:42:9`! spacecxx . . $ structFunctionEditor#space.)); |
| 113 | Graphics_setViewportcxx . . $ Graphics_setViewport(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), |
| 114 | ourcxx . . $ `melder/melder.h:42:9`! _selectionViewerLeftcxx . . $ structFunctionEditor#_selectionViewerLeft. + ourcxx . . $ `melder/melder.h:42:9`! SELECTION_VIEWER_MARGINcxx . . $ structFunctionEditor#SELECTION_VIEWER_MARGIN., ourcxx . . $ `melder/melder.h:42:9`! _selectionViewerRightcxx . . $ structFunctionEditor#_selectionViewerRight. - ourcxx . . $ `melder/melder.h:42:9`! SELECTION_VIEWER_MARGINcxx . . $ structFunctionEditor#SELECTION_VIEWER_MARGIN., |
| 115 | ourcxx . . $ `melder/melder.h:42:9`! SELECTION_VIEWER_MARGINcxx . . $ structFunctionEditor#SELECTION_VIEWER_MARGIN., ourcxx . . $ `melder/melder.h:42:9`! height_pxltcxx . . $ structFunctionEditor#height_pxlt. - ourcxx . . $ `melder/melder.h:42:9`! spacecxx . . $ structFunctionEditor#space. - ourcxx . . $ `melder/melder.h:42:9`! SELECTION_VIEWER_MARGINcxx . . $ structFunctionEditor#SELECTION_VIEWER_MARGIN. |
| 116 | ); |
| 117 | Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.0, 1.0, 0.0, 1.0); |
| 118 | } |
| 119 | double functionViewerLeft_WCcxx . . $ structFunctionEditor#functionViewerLeft_WC(21b6c25e127938e2). () const { |
| 120 | return ourcxx . . $ `melder/melder.h:42:9`! startWindowcxx . . $ structFunctionEditor#startWindow. - ourcxx . . $ `melder/melder.h:42:9`! MARGINcxx . . $ structFunctionEditor#MARGIN. * (ourcxx . . $ `melder/melder.h:42:9`! endWindowcxx . . $ structFunctionEditor#endWindow. - ourcxx . . $ `melder/melder.h:42:9`! startWindowcxx . . $ structFunctionEditor#startWindow.) / (ourcxx . . $ `melder/melder.h:42:9`! dataRight_pxltcxx . . $ structFunctionEditor#dataRight_pxlt(21b6c25e127938e2).() - ourcxx . . $ `melder/melder.h:42:9`! dataLeft_pxltcxx . . $ structFunctionEditor#dataLeft_pxlt(21b6c25e127938e2).()); |
| 121 | } |
| 122 | double functionViewerRight_WCcxx . . $ structFunctionEditor#functionViewerRight_WC(21b6c25e127938e2). () const { |
| 123 | return ourcxx . . $ `melder/melder.h:42:9`! endWindowcxx . . $ structFunctionEditor#endWindow. + ourcxx . . $ `melder/melder.h:42:9`! MARGINcxx . . $ structFunctionEditor#MARGIN. * (ourcxx . . $ `melder/melder.h:42:9`! endWindowcxx . . $ structFunctionEditor#endWindow. - ourcxx . . $ `melder/melder.h:42:9`! startWindowcxx . . $ structFunctionEditor#startWindow.) / (ourcxx . . $ `melder/melder.h:42:9`! dataRight_pxltcxx . . $ structFunctionEditor#dataRight_pxlt(21b6c25e127938e2).() - ourcxx . . $ `melder/melder.h:42:9`! dataLeft_pxltcxx . . $ structFunctionEditor#dataLeft_pxlt(21b6c25e127938e2).()); |
| 124 | } |
| 125 | |
| 126 | GuiTextcxx . . $ GuiText# textAreacxx . . $ structFunctionEditor#textArea.; // optional text at top |
| 127 | bool clickWasModifiedByShiftKeycxx . . $ structFunctionEditor#clickWasModifiedByShiftKey., clickWasModifiedByOptionKeycxx . . $ structFunctionEditor#clickWasModifiedByOptionKey., clickWasModifiedByCommandKeycxx . . $ structFunctionEditor#clickWasModifiedByCommandKey.; // information for drag-and-drop and for start of play |
| 128 | bool duringPlaycxx . . $ structFunctionEditor#duringPlay., backgroundIsUpToDatecxx . . $ structFunctionEditor#backgroundIsUpToDate.; |
| 129 | struct FunctionEditor_picturecxx . . $ FunctionEditor_picture# picturecxx . . $ structFunctionEditor#picture.; |
| 130 | bool anchorIsInSelectionViewercxx . . $ structFunctionEditor#anchorIsInSelectionViewer. = false; |
| 131 | bool anchorIsInWideDataViewcxx . . $ structFunctionEditor#anchorIsInWideDataView. = false; |
| 132 | |
| 133 | /* Private: */ |
| 134 | GuiDrawingAreacxx . . $ GuiDrawingArea# drawingAreacxx . . $ structFunctionEditor#drawingArea.; |
| 135 | GuiScrollBarcxx . . $ GuiScrollBar# scrollBarcxx . . $ structFunctionEditor#scrollBar.; |
| 136 | GuiCheckButtoncxx . . $ GuiCheckButton# groupButtoncxx . . $ structFunctionEditor#groupButton.; |
| 137 | GuiObjectcxx . . $ GuiObject# bottomAreacxx . . $ structFunctionEditor#bottomArea.; |
| 138 | bool groupcxx . . $ structFunctionEditor#group., enableUpdatescxx . . $ structFunctionEditor#enableUpdates.; |
| 139 | int nrectcxx . . $ structFunctionEditor#nrect.; |
| 140 | structcxx . . $ structFunctionEditor#$anonymous_type_0# { double leftcxx . . $ structFunctionEditor#$anonymous_type_0#left., rightcxx . . $ structFunctionEditor#$anonymous_type_0#right., bottomcxx . . $ structFunctionEditor#$anonymous_type_0#bottom., topcxx . . $ structFunctionEditor#$anonymous_type_0#top.; } rectcxx . . $ structFunctionEditor#rect. [8]; |
| 141 | double markercxx . . $ structFunctionEditor#marker. [1 + 3], playCursorcxx . . $ structFunctionEditor#playCursor., startZoomHistorycxx . . $ structFunctionEditor#startZoomHistory., endZoomHistorycxx . . $ structFunctionEditor#endZoomHistory.; |
| 142 | int numberOfMarkerscxx . . $ structFunctionEditor#numberOfMarkers.; |
| 143 | |
| 144 | void v9_destroycxx . . $ structFunctionEditor#v9_destroy(ced63f7c635d850d). () noexcept |
| 145 | override; |
| 146 | void v1_infocxx . . $ structFunctionEditor#v1_info(49f6e7a06ebc5aa8). () |
| 147 | override; |
| 148 | |
| 149 | bool v_hasPlayMenucxx . . $ structFunctionEditor#v_hasPlayMenu(c9857a73d68e59ba). () override { return true; } |
| 150 | void v_createMenuscxx . . $ structFunctionEditor#v_createMenus(49f6e7a06ebc5aa8). () |
| 151 | override; |
| 152 | void v_createMenuItems_prefscxx . . $ structFunctionEditor#v_createMenuItems_prefs(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu#) |
| 153 | override; |
| 154 | void v_createMenuItems_savecxx . . $ structFunctionEditor#v_createMenuItems_save(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu#) |
| 155 | override; |
| 156 | void v_createMenuItems_editcxx . . $ structFunctionEditor#v_createMenuItems_edit(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu#) |
| 157 | override; |
| 158 | void v_createMenuItems_playcxx . . $ structFunctionEditor#v_createMenuItems_play(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu#) |
| 159 | override; |
| 160 | void v_createChildrencxx . . $ structFunctionEditor#v_createChildren(49f6e7a06ebc5aa8). () |
| 161 | override; |
| 162 | void v_createMenuItems_helpcxx . . $ structFunctionEditor#v_createMenuItems_help(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu#) |
| 163 | override; |
| 164 | void v_updateMenuItemscxx . . $ structFunctionEditor#v_updateMenuItems(49f6e7a06ebc5aa8). () |
| 165 | override; |
| 166 | void v_prefs_addFieldscxx . . $ structFunctionEditor#v_prefs_addFields(2b98fae8e13abb61). (EditorCommandcxx . . $ EditorCommand#) |
| 167 | override; |
| 168 | void v_prefs_setValuescxx . . $ structFunctionEditor#v_prefs_setValues(2b98fae8e13abb61). (EditorCommandcxx . . $ EditorCommand#) |
| 169 | override; |
| 170 | void v_prefs_getValuescxx . . $ structFunctionEditor#v_prefs_getValues(2b98fae8e13abb61). (EditorCommandcxx . . $ EditorCommand#) |
| 171 | override; |
| 172 | |
| 173 | void v1_dataChangedcxx . . $ structFunctionEditor#v1_dataChanged(c0154a85f79216c7). (Editorcxx . . $ Editor# sender) |
| 174 | override; |
| 175 | |
| 176 | virtual void v_distributeAreascxx . . $ structFunctionEditor#v_distributeAreas(49f6e7a06ebc5aa8). () { } |
| 177 | virtual void v_drawcxx . . $ structFunctionEditor#v_draw(49f6e7a06ebc5aa8). (); |
| 178 | virtual void v_windowChangedcxx . . $ structFunctionEditor#v_windowChanged(49f6e7a06ebc5aa8). (); |
| 179 | /* |
| 180 | Behaviour of structFunctionEditor::v_windowChanged (): |
| 181 | dispatches to a function area. |
| 182 | */ |
| 183 | virtual bool v_hasSelectionViewercxx . . $ structFunctionEditor#v_hasSelectionViewer(c9857a73d68e59ba). () { return false; } |
| 184 | virtual void v_drawSelectionViewercxx . . $ structFunctionEditor#v_drawSelectionViewer(49f6e7a06ebc5aa8). () { } |
| 185 | virtual void v_drawRealTimeSelectionViewercxx . . $ structFunctionEditor#v_drawRealTimeSelectionViewer(ba8836b59fb42830). (double /* time */) { } |
| 186 | virtual conststring32cxx . . $ conststring32# v_domainNamecxx . . $ structFunctionEditor#v_domainName(1912f6684645c851). () { return U"time"; } |
| 187 | virtual conststring32cxx . . $ conststring32# v_selectionViewerNamecxx . . $ structFunctionEditor#v_selectionViewerName(1912f6684645c851). () { return U"selection viewer"; } |
| 188 | virtual conststring32cxx . . $ conststring32# v_format_domaincxx . . $ structFunctionEditor#v_format_domain(1912f6684645c851). () { return U"Time"; } |
| 189 | virtual const char *v_format_shortcxx . . $ structFunctionEditor#v_format_short(33a1f659e94feb42). () { return u8"%.3f"; } |
| 190 | virtual const char *v_format_longcxx . . $ structFunctionEditor#v_format_long(33a1f659e94feb42). () { return u8"%f"; } |
| 191 | virtual conststring32cxx . . $ conststring32# v_format_units_longcxx . . $ structFunctionEditor#v_format_units_long(1912f6684645c851). () { return U"seconds"; } |
| 192 | virtual conststring32cxx . . $ conststring32# v_format_units_shortcxx . . $ structFunctionEditor#v_format_units_short(1912f6684645c851). () { return U"s"; } |
| 193 | virtual const char *v_format_totalDurationcxx . . $ structFunctionEditor#v_format_totalDuration(33a1f659e94feb42). () { return u8"Total duration %f seconds"; } |
| 194 | virtual const char *v_format_windowcxx . . $ structFunctionEditor#v_format_window(33a1f659e94feb42). () { return u8"Visible part %f seconds"; } |
| 195 | virtual const char *v_format_selectioncxx . . $ structFunctionEditor#v_format_selection(33a1f659e94feb42). () { return u8"%f (%.3f / s)"; } |
| 196 | virtual int v_fixedPrecision_longcxx . . $ structFunctionEditor#v_fixedPrecision_long(b126dc7c1de90089). () { return 6; } |
| 197 | virtual bool v_hasTextcxx . . $ structFunctionEditor#v_hasText(c9857a73d68e59ba). () { return false; } |
| 198 | virtual void v_playcxx . . $ structFunctionEditor#v_play(bc12c9ec15586e6a). (double /* startTime */, double /* endTime */) { } |
| 199 | virtual bool v_mouseInWideDataViewcxx . . $ structFunctionEditor#v_mouseInWideDataView(3d5a26054778c78d). (GuiDrawingArea_MouseEventcxx . . $ GuiDrawingArea_MouseEvent# event, double x_world, double globalY_fraction); |
| 200 | /* |
| 201 | Message: "they clicked in the data part of the window, or in the left or right margin." |
| 202 | 'event' is the mouse event, with still relevant info on phase and modifier keys; |
| 203 | 'x_world' is the time (or another world unit); |
| 204 | 'globalY_fraction' is a value between 0.0 (bottom) and 1.0 (top); |
| 205 | Behaviour of structFunctionEditor::v_mouseInWideDataView (): |
| 206 | dispatches to a function area, or otherwise calls FunctionEditor_defaultMouseInWideDataView(). |
| 207 | */ |
| 208 | virtual void v_clickSelectionViewercxx . . $ structFunctionEditor#v_clickSelectionViewer(bc12c9ec15586e6a). (double x_fraction, double y_fraction); |
| 209 | virtual int v_playCallbackcxx . . $ structFunctionEditor#v_playCallback(a93637906a4cc8d4). (int phase, double startTime, double endTime, double currentTime); |
| 210 | virtual void v_updateTextcxx . . $ structFunctionEditor#v_updateText(49f6e7a06ebc5aa8). (); |
| 211 | virtual void v_drawLegendscxx . . $ structFunctionEditor#v_drawLegends(49f6e7a06ebc5aa8). () { } |
| 212 | |
| 213 | #include "FunctionEditor_prefs.h"cxx . . $ `<file>/foned/FunctionEditor_prefs.h`/ |
| 214 | |
| 215 | public: |
| 216 | double anchorTimecxx . . $ structFunctionEditor#anchorTime. = undefinedcxx . . $ undefined.; |
| 217 | bool hasBeenDraggedBeyondVicinityRadiusAtLeastOncecxx . . $ structFunctionEditor#hasBeenDraggedBeyondVicinityRadiusAtLeastOnce. = false; |
| 218 | }; |
| 219 | |
| 220 | int theFunctionEditor_playCallbackcxx . . $ theFunctionEditor_playCallback(c95eeed177d4ccf8). (FunctionEditorcxx . . $ FunctionEditor# me, int phase, double startTime, double endTime, double currentTime); |
| 221 | |
| 222 | #define FunctionEditor_UPDATE_NEEDEDcxx . . $ `foned/FunctionEditor.h:222:9`! true |
| 223 | #define FunctionEditor_NO_UPDATE_NEEDEDcxx . . $ `foned/FunctionEditor.h:223:9`! false |
| 224 | |
| 225 | void FunctionEditor_initcxx . . $ FunctionEditor_init(719bc58b4917372e). (FunctionEditorcxx . . $ FunctionEditor# me, conststring32cxx . . $ conststring32# title, Functioncxx . . $ Function# data); |
| 226 | /* |
| 227 | Function: |
| 228 | creates an Editor with a drawing area, a scroll bar and some buttons. |
| 229 | Postconditions: |
| 230 | my drawingArea is attached to the form at all sides, |
| 231 | my scrollBar only to the bottom, left and right sides. |
| 232 | */ |
| 233 | |
| 234 | void FunctionEditor_windowMarksChangedcxx . . $ FunctionEditor_windowMarksChanged(ce925ac19f5bbd22). (FunctionEditorcxx . . $ FunctionEditor# me, const bool selectionChanged); |
| 235 | /* |
| 236 | Function: |
| 237 | update the scroll bar, the drawing area and the buttons |
| 238 | (and if `selectionChanged` is true also the optional text field), |
| 239 | from the current total time and window |
| 240 | (and if `selectionChanged` is true also the current cursor and selection), |
| 241 | and redraw the contents. |
| 242 | Usage: |
| 243 | call this after a change in window marks. |
| 244 | (Upon a change in the domain, ungroup before calling this.) |
| 245 | */ |
| 246 | void FunctionEditor_selectionMarksChangedcxx . . $ FunctionEditor_selectionMarksChanged(8d3b84f45830d365). (FunctionEditorcxx . . $ FunctionEditor# me); |
| 247 | /* |
| 248 | Function: |
| 249 | update optional text field, the drawing area and the buttons, |
| 250 | from the current cursor and selection, and redraw the contents. |
| 251 | Usage: |
| 252 | call this after a change in cursor or selection marks. |
| 253 | */ |
| 254 | |
| 255 | void FunctionEditor_scrollToNewSelectioncxx . . $ FunctionEditor_scrollToNewSelection(ff1c6b8a68b21137). (FunctionEditorcxx . . $ FunctionEditor# me, double t); |
| 256 | /* |
| 257 | Function: |
| 258 | shift (scroll) the window through time, to the new selection, keeping the window length constant. |
| 259 | Usage: |
| 260 | call this after a search. |
| 261 | */ |
| 262 | |
| 263 | void FunctionEditor_updateTextcxx . . $ FunctionEditor_updateText(8d3b84f45830d365). (FunctionEditorcxx . . $ FunctionEditor# me); |
| 264 | /* |
| 265 | Function: |
| 266 | update the optional text widget. |
| 267 | Usage: |
| 268 | call this after moving the cursor, if that would have to change the text. |
| 269 | The generic FunctionEditor also calls this if one of the other marks have changed. |
| 270 | Behaviour: |
| 271 | we just call the updateText method, which the inheritor will have to modify, |
| 272 | since FunctionEditor::updateText does nothing. |
| 273 | */ |
| 274 | |
| 275 | void FunctionEditor_redrawcxx . . $ FunctionEditor_redraw(8d3b84f45830d365). (FunctionEditorcxx . . $ FunctionEditor# me); |
| 276 | /* |
| 277 | Function: |
| 278 | update the drawing area of a single editor. |
| 279 | Usage: |
| 280 | call this after she changes a view option (font, scaling, hide/show xx) |
| 281 | or after any of the data have changed. In the latter case, also call Editor_broadcastChange. |
| 282 | Behaviour: |
| 283 | we just call Graphics_updateWs (my graphics). |
| 284 | */ |
| 285 | |
| 286 | void FunctionEditor_enableUpdatescxx . . $ FunctionEditor_enableUpdates(ce925ac19f5bbd22). (FunctionEditorcxx . . $ FunctionEditor# me, bool enable); |
| 287 | /* |
| 288 | Function: |
| 289 | temporarily disable update event to cause 'draw' messages. |
| 290 | Usage: |
| 291 | If you call from your 'draw' method functions that may trigger expose events, |
| 292 | you should bracket those routines between |
| 293 | FunctionEditor_enableUpdates (me, false); |
| 294 | and |
| 295 | FunctionEditor_enableUpdates (me, true); |
| 296 | This may happen if you call an analysis routine which calls Melder_progress. |
| 297 | */ |
| 298 | |
| 299 | void FunctionEditor_ungroupcxx . . $ FunctionEditor_ungroup(fde123624714e72). (Daatacxx . . $ Daata# data); |
| 300 | /* |
| 301 | Function: |
| 302 | force all editors containing `data` out of the group. |
| 303 | Usage: |
| 304 | Start cut or paste methods by calling this function, |
| 305 | as the grouped editors will not be synchronized |
| 306 | after either of those actions. Worse, the selection |
| 307 | may get outside the common interval of the editors. |
| 308 | */ |
| 309 | |
| 310 | /* |
| 311 | Some functions to enforce a common look to all function editors. |
| 312 | The x axis of the window is supposed to have been set to [my startWindow, my endWindow]. |
| 313 | Preconditions: |
| 314 | default line type, default line width. |
| 315 | Postconditions: |
| 316 | default line type, default line width, undefined colour, undefined text alignment. |
| 317 | */ |
| 318 | void FunctionEditor_drawRangeMarkcxx . . $ FunctionEditor_drawRangeMark(6891a0eec242374c). (FunctionEditorcxx . . $ FunctionEditor# me, double yWC, conststring32cxx . . $ conststring32# yWC_string, conststring32cxx . . $ conststring32# units, int verticalAlignment); |
| 319 | void FunctionEditor_insertCursorFunctionValuecxx . . $ FunctionEditor_insertCursorFunctionValue(39eff85a52becdb4). (FunctionEditorcxx . . $ FunctionEditor# me, double yWC, conststring32cxx . . $ conststring32# yWC_string, conststring32cxx . . $ conststring32# units, double minimum, double maximum); |
| 320 | void FunctionEditor_drawHorizontalHaircxx . . $ FunctionEditor_drawHorizontalHair(9ee54d933d3f4330). (FunctionEditorcxx . . $ FunctionEditor# me, double yWC, conststring32cxx . . $ conststring32# yWC_string, conststring32cxx . . $ conststring32# units); |
| 321 | void FunctionEditor_drawGridLinecxx . . $ FunctionEditor_drawGridLine(ff1c6b8a68b21137). (FunctionEditorcxx . . $ FunctionEditor# me, double yWC); |
| 322 | |
| 323 | bool FunctionEditor_defaultMouseInWideDataViewcxx . . $ FunctionEditor_defaultMouseInWideDataView(f60eeae5fe5430ba). (FunctionEditorcxx . . $ FunctionEditor# me, GuiDrawingArea_MouseEventcxx . . $ GuiDrawingArea_MouseEvent# event, double x_world); |
| 324 | /* |
| 325 | Behaviour: |
| 326 | moves the cursor to 'x_world', drags to create a selection, or extends the selection. |
| 327 | */ |
| 328 | |
| 329 | /* End of file FunctionEditor.h */ |
| 330 | #endif |