| 1 | /* CubeGridEditor.cpp |
| 2 | * |
| 3 | * Copyright (C) 2023 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 | #include "CubeGridEditor.h"cxx . . $ `<file>/gram/CubeGridEditor.h`/ |
| 20 | #include "EditorM.h"cxx . . $ `<file>/sys/EditorM.h`/ |
| 21 | |
| 22 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (CubeGridEditor, FunctionEditor, 0); |
| 23 | |
| 24 | #include "Prefs_define.h"cxx . . $ `<file>/sys/Prefs_define.h`/ |
| 25 | #include "CubeGridEditor_prefs.h"cxx . . $ `<file>/gram/CubeGridEditor_prefs.h`/ |
| 26 | #include "Prefs_install.h"cxx . . $ `<file>/sys/Prefs_install.h`/ |
| 27 | #include "CubeGridEditor_prefs.h"cxx . . $ `<file>/gram/CubeGridEditor_prefs.h`/ |
| 28 | #include "Prefs_copyToInstance.h"cxx . . $ `<file>/sys/Prefs_copyToInstance.h`/ |
| 29 | #include "CubeGridEditor_prefs.h"cxx . . $ `<file>/gram/CubeGridEditor_prefs.h`/ |
| 30 | |
| 31 | static void drawSelectionOrWindowcxx . . $ drawSelectionOrWindow(9b593d032d86449c). (CubeGridEditorcxx . . $ CubeGridEditor# me, double tmin, double tmax, conststring32cxx . . $ conststring32# header) { |
| 32 | for (integercxx . . $ integer# itier = 1; itier <= mycxx . . $ `melder/melder.h:44:9`! cubeGridcxx . . $ structCubeGridEditor#cubeGrid(20f26e4902a37d54).() -> tierscxx . . $ structCubeGrid#tiers..sizecxx . . $ CollectionOf#size.; itier ++) { |
| 33 | if (itier == 1) { |
| 34 | Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), Melder_BLACKcxx . . $ Melder_BLACK.); |
| 35 | Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kGraphics_horizontalAlignmentcxx . . $ kGraphics_horizontalAlignment#::CENTREcxx . . $ kGraphics_horizontalAlignment#CENTRE., Graphics_BOTTOMcxx . . $ `sys/Graphics.h:252:9`!); |
| 36 | Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.0, 1.0, header); |
| 37 | } |
| 38 | autoCubePointcxx . . $ autoCubePoint# average = CubeGrid_averagecxx . . $ CubeGrid_average(f42ff99261c680e). (mycxx . . $ `melder/melder.h:44:9`! cubeGridcxx . . $ structCubeGridEditor#cubeGrid(20f26e4902a37d54).(), itier, tmin, tmax); |
| 39 | Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), MelderColourcxx . . $ MelderColour#MelderColour(98dd472ac7e5c3d4). (average ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). redcxx . . $ structCubePoint#red., average ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). greencxx . . $ structCubePoint#green., average ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bluecxx . . $ structCubePoint#blue.)); |
| 40 | Graphics_fillRectanglecxx . . $ Graphics_fillRectangle(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.15, 0.85, 0.3, 1.0); |
| 41 | Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), Melder_BLACKcxx . . $ Melder_BLACK.); |
| 42 | Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), kGraphics_horizontalAlignmentcxx . . $ kGraphics_horizontalAlignment#::CENTREcxx . . $ kGraphics_horizontalAlignment#CENTRE., Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!); |
| 43 | Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.5, 0.25, |
| 44 | Melder_catcxx . . $ Melder_cat(7fbf27f4d367f442). (mycxx . . $ `melder/melder.h:44:9`! cubeGridcxx . . $ structCubeGridEditor#cubeGrid(20f26e4902a37d54).() -> redNamecxx . . $ structCubeGrid#redName..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U": ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (average ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). redcxx . . $ structCubePoint#red., 6))); |
| 45 | Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.5, 0.15, |
| 46 | Melder_catcxx . . $ Melder_cat(7fbf27f4d367f442). (mycxx . . $ `melder/melder.h:44:9`! cubeGridcxx . . $ structCubeGridEditor#cubeGrid(20f26e4902a37d54).() -> greenNamecxx . . $ structCubeGrid#greenName..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U": ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (average ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). greencxx . . $ structCubePoint#green., 6))); |
| 47 | Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.5, 0.05, |
| 48 | Melder_catcxx . . $ Melder_cat(7fbf27f4d367f442). (mycxx . . $ `melder/melder.h:44:9`! cubeGridcxx . . $ structCubeGridEditor#cubeGrid(20f26e4902a37d54).() -> blueNamecxx . . $ structCubeGrid#blueName..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U": ", Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (average ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). bluecxx . . $ structCubePoint#blue., 6))); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | void structCubeGridEditorcxx . . $ structCubeGridEditor# :: v_drawSelectionViewercxx . . $ structCubeGridEditor#v_drawSelectionViewer(49f6e7a06ebc5aa8). () { |
| 53 | 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); |
| 54 | Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), DataGuiColour_WINDOW_BACKGROUNDcxx . . $ DataGuiColour_WINDOW_BACKGROUND.); |
| 55 | Graphics_fillRectanglecxx . . $ Graphics_fillRectangle(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionEditor#graphics..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 0.0, 1.0, 0.0, 1.0); |
| 56 | drawSelectionOrWindowcxx . . $ drawSelectionOrWindow(9b593d032d86449c). (this, ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionEditor#startSelection., ourcxx . . $ `melder/melder.h:42:9`! endSelectioncxx . . $ structFunctionEditor#endSelection., U""); |
| 57 | } |
| 58 | |
| 59 | void structCubeGridEditorcxx . . $ structCubeGridEditor# :: v_drawRealTimeSelectionViewercxx . . $ structCubeGridEditor#v_drawRealTimeSelectionViewer(ba8836b59fb42830). (double time) { |
| 60 | 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); |
| 61 | drawSelectionOrWindowcxx . . $ drawSelectionOrWindow(9b593d032d86449c). (this, time - 1.0, time + 1.0, U""); |
| 62 | } |
| 63 | |
| 64 | autoCubeGridEditorcxx . . $ autoCubeGridEditor# CubeGridEditor_createcxx . . $ CubeGridEditor_create(dbad0b4e43ce1320). (conststring32cxx . . $ conststring32# title, CubeGridcxx . . $ CubeGrid# cubeGrid, Soundcxx . . $ Sound# optionalSoundToCopy) { |
| 65 | try { |
| 66 | autoCubeGridEditorcxx . . $ autoCubeGridEditor# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (CubeGridEditor); |
| 67 | mycxx . . $ `melder/melder.h:44:9`! cubeGridAreacxx . . $ structCubeGridEditor#cubeGridArea(706caed2b05d3bac).() =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). CubeGridArea_createcxx . . $ CubeGridArea_create(4616eda8168cc574). (true, nullptr, me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 68 | if (optionalSoundToCopy) |
| 69 | mycxx . . $ `melder/melder.h:44:9`! soundAreacxx . . $ structCubeGridEditor#soundArea(f75ec617f241a3e6).() =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). SoundArea_createcxx . . $ SoundArea_create(4b60938fec9a8242). (false, optionalSoundToCopy, me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 70 | FunctionEditor_initcxx . . $ FunctionEditor_init(719bc58b4917372e). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), title, cubeGrid); |
| 71 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 72 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 73 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"CubeGrid window not created."); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | /* End of file CubeGridEditor.cpp */ |
| 78 |