| 1 |
/* DataGui.cpp |
| 2 |
* |
| 3 |
* Copyright (C) 1992-2024 Paul Boersma, 2008 Stefan de Konink, 2010 Franz Brausse |
| 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 "DataGui.h" |
| 20 |
#include "ScriptEditor.h" |
| 21 |
#include "EditorM.h" |
| 22 |
|
| 23 |
#include "enums_getText.h" |
| 24 |
#include "DataGui_enums.h" |
| 25 |
#include "enums_getValue.h" |
| 26 |
#include "DataGui_enums.h" |
| 27 |
|
| 28 |
Thing_implement_pureVirtual (DataGui, Thing, 0); |
| 29 |
|
| 30 |
#include "Prefs_define.h" |
| 31 |
#include "DataGui_prefs.h" |
| 32 |
#include "Prefs_install.h" |
| 33 |
#include "DataGui_prefs.h" |
| 34 |
#include "Prefs_copyToInstance.h" |
| 35 |
#include "DataGui_prefs.h" |
| 36 |
|
| 37 |
BOOLEAN_VARIABLE (v_form_pictureWindow__eraseFirst) |
| 38 |
void structDataGui :: v_form_pictureWindow (EditorCommand cmd) { |
| 39 |
COMMENT (U"Picture window:") |
| 40 |
BOOLEAN_FIELD (v_form_pictureWindow__eraseFirst, U"Erase first", true) |
| 41 |
} |
| 42 |
void structDataGui :: v_ok_pictureWindow (EditorCommand cmd) { |
| 43 |
SET_BOOLEAN (v_form_pictureWindow__eraseFirst, our instancePref_picture_eraseFirst()) |
| 44 |
} |
| 45 |
void structDataGui :: v_do_pictureWindow (EditorCommand /* cmd */) { |
| 46 |
our setInstancePref_picture_eraseFirst (v_form_pictureWindow__eraseFirst); |
| 47 |
} |
| 48 |
|
| 49 |
OPTIONMENU_ENUM_VARIABLE (kDataGui_writeNameAtTop, v_form_pictureMargins__writeNameAtTop) |
| 50 |
void structDataGui :: v_form_pictureMargins (EditorCommand cmd) { |
| 51 |
COMMENT (U"Margins:") |
| 52 |
OPTIONMENU_ENUM_FIELD (kDataGui_writeNameAtTop, v_form_pictureMargins__writeNameAtTop, |
| 53 |
U"Write name at top", kDataGui_writeNameAtTop::DEFAULT) |
| 54 |
} |
| 55 |
void structDataGui :: v_ok_pictureMargins (EditorCommand cmd) { |
| 56 |
SET_ENUM (v_form_pictureMargins__writeNameAtTop, kDataGui_writeNameAtTop, our classPref_picture_writeNameAtTop()) |
| 57 |
} |
| 58 |
void structDataGui :: v_do_pictureMargins (EditorCommand /* cmd */) { |
| 59 |
our setClassPref_picture_writeNameAtTop (v_form_pictureMargins__writeNameAtTop); |
| 60 |
} |
| 61 |
|
| 62 |
/* |
| 63 |
The following definitions cannot directly refer to existing Melder colours such as Melder_WHITE, |
| 64 |
because that might lead to an initialization race. |
| 65 |
Therefore, all of these definitions have to invoke their own MelderColour initialization. |
| 66 |
*/ |
| 67 |
MelderColour |
| 68 |
DataGuiColour_WINDOW_BACKGROUND = MelderColour (0.95, 0.95, 0.90), // cream |
| 69 |
DataGuiColour_AREA_BACKGROUND = MelderColour (1.0, 1.0, 1.0), // whitish; DON'T REPLACE with Melder_WHITE |
| 70 |
DataGuiColour_EDITABLE = MelderColour (0.0, 0.4, 0.5), // greenish blue (almost teal) |
| 71 |
DataGuiColour_EDITABLE_FRAME = MelderColour (0.0, 0.8, 1.0), // same hue as the lines |
| 72 |
DataGuiColour_EDITABLE_SELECTED = MelderColour (0.75, 0.35, 0.0), // orangy |
| 73 |
DataGuiColour_NONEDITABLE = MelderColour (0.25), // dark grey |
| 74 |
DataGuiColour_NONEDITABLE_FRAME = MelderColour (0.85), // same hue as the lines; DON'T REPLACE with Melder_SILVER |
| 75 |
DataGuiColour_NONEDITABLE_SELECTED = MelderColour (0.8, 0.0, 0.0); // reddish |
| 76 |
|
| 77 |
void DataGui_openPraatPicture (DataGui me) { |
| 78 |
my _pictureGraphics = praat_picture_datagui_open (my instancePref_picture_eraseFirst()); |
| 79 |
} |
| 80 |
void DataGui_closePraatPicture (DataGui me) { |
| 81 |
const Daata theDataWhoseNameWeMayWantToWriteAtTheTop = my boss() -> data(); |
| 82 |
// same as the title of the window (may not be precise, if we are editing two objects at a time) |
| 83 |
if (theDataWhoseNameWeMayWantToWriteAtTheTop && my classPref_picture_writeNameAtTop() != kDataGui_writeNameAtTop::NO_) { |
| 84 |
Graphics_setNumberSignIsBold (my pictureGraphics(), false); |
| 85 |
Graphics_setPercentSignIsItalic (my pictureGraphics(), false); |
| 86 |
Graphics_setCircumflexIsSuperscript (my pictureGraphics(), false); |
| 87 |
Graphics_setUnderscoreIsSubscript (my pictureGraphics(), false); |
| 88 |
Graphics_textTop (my pictureGraphics(), |
| 89 |
my classPref_picture_writeNameAtTop() == kDataGui_writeNameAtTop::FAR_, |
| 90 |
theDataWhoseNameWeMayWantToWriteAtTheTop -> name.get() |
| 91 |
); |
| 92 |
Graphics_setNumberSignIsBold (my pictureGraphics(), true); |
| 93 |
Graphics_setPercentSignIsItalic (my pictureGraphics(), true); |
| 94 |
Graphics_setCircumflexIsSuperscript (my pictureGraphics(), true); |
| 95 |
Graphics_setUnderscoreIsSubscript (my pictureGraphics(), true); |
| 96 |
} |
| 97 |
praat_picture_datagui_close (); |
| 98 |
} |
| 99 |
|
| 100 |
/* End of file DataGui.cpp */ |