| 1 | #ifndef _DataEditor_h_ |
| 2 | #define _DataEditor_h_ |
| 3 | /* DataEditor.h |
| 4 | * |
| 5 | * Copyright (C) 1995-2012,2014-2018,2022,2023 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 "ScriptEditor.h" |
| 22 | |
| 23 | Thing_declare (DataSubEditor); |
| 24 | Thing_declare (VectorEditor); |
| 25 | Thing_declare (MatrixEditor); |
| 26 | Thing_declare (StructEditor); |
| 27 | Thing_declare (ClassEditor); |
| 28 | Thing_declare (DataEditor); |
| 29 | |
| 30 | typedef struct structDataSubEditor_FieldData { |
| 31 | GuiLabel label; |
| 32 | GuiButton button; |
| 33 | GuiText text; |
| 34 | void *address; |
| 35 | Data_Description description; |
| 36 | integer minimum, maximum, min2, max2; |
| 37 | autostring32 history; // the full prefix of the members |
| 38 | int rank; // should the button open a StructEditor (0) or VectorEditor (1) or MatrixEditor (2) ? |
| 39 | int y; |
| 40 | } *DataSubEditor_FieldData; |
| 41 | |
| 42 | #define kDataSubEditor_MAXNUM_ROWS 12 |
| 43 | |
| 44 | Thing_define (DataSubEditor, Editor) { |
| 45 | DataEditor root; |
| 46 | void *d_address; |
| 47 | Data_Description d_description; |
| 48 | GuiScrollBar d_scrollBar; |
| 49 | int d_irow, d_topField, d_numberOfFields; |
| 50 | struct structDataSubEditor_FieldData d_fieldData [1 + kDataSubEditor_MAXNUM_ROWS]; |
| 51 | |
| 52 | void v9_destroy () noexcept |
| 53 | override; |
| 54 | bool v_scriptable () |
| 55 | override { return false; } |
| 56 | void v_createChildren () |
| 57 | override; |
| 58 | void v_createMenuItems_help (EditorMenu menu) |
| 59 | override; |
| 60 | |
| 61 | virtual integer v_countFields () { return 0; } |
| 62 | virtual void v_showMembers () { } |
| 63 | }; |
| 64 | |
| 65 | Thing_define (VectorEditor, DataSubEditor) { |
| 66 | integer d_minimum, d_maximum; |
| 67 | |
| 68 | integer v_countFields () |
| 69 | override; |
| 70 | void v_showMembers () |
| 71 | override; |
| 72 | }; |
| 73 | |
| 74 | Thing_define (MatrixEditor, DataSubEditor) { |
| 75 | integer d_minimum, d_maximum, d_min2, d_max2; |
| 76 | |
| 77 | integer v_countFields () |
| 78 | override; |
| 79 | void v_showMembers () |
| 80 | override; |
| 81 | }; |
| 82 | |
| 83 | Thing_define (StructEditor, DataSubEditor) { |
| 84 | integer v_countFields () |
| 85 | override; |
| 86 | void v_showMembers () |
| 87 | override; |
| 88 | }; |
| 89 | |
| 90 | Thing_define (ClassEditor, StructEditor) { |
| 91 | void v_showMembers () |
| 92 | override; |
| 93 | }; |
| 94 | |
| 95 | Thing_define (DataEditor, ClassEditor) { |
| 96 | CollectionOf <structDataSubEditor> children; |
| 97 | |
| 98 | void v9_destroy () noexcept |
| 99 | override; |
| 100 | void v1_dataChanged (Editor sender) |
| 101 | override; |
| 102 | }; |
| 103 | |
| 104 | autoDataEditor DataEditor_create (conststring32 title, Daata data); |
| 105 | |
| 106 | /* End of file DataEditor.h */ |
| 107 | #endif |