| 1 | #ifndef _TextGridArea_h_ |
| 2 | #define _TextGridArea_h_ |
| 3 | /* TextGridArea.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2005,2007-2022 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 2 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 "FunctionArea.h" |
| 22 | #include "TextGrid.h" |
| 23 | #include "SpellingChecker.h" |
| 24 | #include "Preferences.h" |
| 25 | |
| 26 | #include "TextGridArea_enums.h" |
| 27 | |
| 28 | Thing_declare (SoundArea); |
| 29 | Thing_declare (SoundAnalysisArea); |
| 30 | |
| 31 | Thing_define (TextGridArea, FunctionArea) { |
| 32 | TextGrid textGrid() const { return static_cast <TextGrid> (our function()); } |
| 33 | SoundArea borrowedSoundArea = nullptr; |
| 34 | SoundAnalysisArea borrowedSoundAnalysisArea = nullptr; |
| 35 | |
| 36 | integer selectedTier = 1; |
| 37 | bool suppressRedraw, suppressTextCursorJump; |
| 38 | autostring32 findString; |
| 39 | SpellingChecker spellingChecker; |
| 40 | |
| 41 | private: |
| 42 | void v_specializedHighlightBackground () const |
| 43 | override; |
| 44 | |
| 45 | private: |
| 46 | /* only in v_mouse: */ |
| 47 | double anchorTime = undefined; |
| 48 | integer clickedLeftBoundary = 0; |
| 49 | double leftDraggingBoundary = undefined, rightDraggingBoundary = undefined; // initial dragging range |
| 50 | double draggingTime = undefined; |
| 51 | autoBOOLVEC draggingTiers; |
| 52 | bool hasBeenDraggedBeyondVicinityRadiusAtLeastOnce = false; |
| 53 | public: |
| 54 | void v1_info () |
| 55 | override; |
| 56 | void v_drawInside () |
| 57 | override; |
| 58 | bool v_mouse (GuiDrawingArea_MouseEvent event, double x_world, double localY_fraction) |
| 59 | override; |
| 60 | GuiMenuItem extractSelectedTextGridPreserveTimesButton, extractSelectedTextGridTimeFromZeroButton; |
| 61 | void v_createMenuItems_save (EditorMenu menu) |
| 62 | override; |
| 63 | void v_createMenuItems_edit (EditorMenu menu) |
| 64 | override; |
| 65 | void v_createMenus () |
| 66 | override; |
| 67 | void v_updateMenuItems () |
| 68 | override; |
| 69 | double maximumInitialLengthOfWindow () override { |
| 70 | return 30.0; |
| 71 | } |
| 72 | void v_updateText () override; |
| 73 | |
| 74 | #include "TextGridArea_prefs.h" |
| 75 | }; |
| 76 | |
| 77 | DEFINE_FunctionArea_create (TextGridArea, TextGrid) |
| 78 | |
| 79 | void TextGridArea_drawSelectionViewer (TextGridArea me); |
| 80 | void TextGridArea_clickSelectionViewer (TextGridArea me, double x_fraction, double y_fraction); |
| 81 | |
| 82 | /* End of file TextGridArea.h */ |
| 83 | #endif |