1 /*
2  * Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
3  *
4  * This file is part of Zrythm
5  *
6  * Zrythm is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Zrythm is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 /**
21  * \file
22  *
23  * Piano roll widget.
24  */
25 
26 #ifndef __GUI_WIDGETS_MIDI_EDITOR_SPACE_H__
27 #define __GUI_WIDGETS_MIDI_EDITOR_SPACE_H__
28 
29 #include <gtk/gtk.h>
30 
31 #define MIDI_EDITOR_SPACE_WIDGET_TYPE \
32   (midi_editor_space_widget_get_type ())
33 G_DECLARE_FINAL_TYPE (
34   MidiEditorSpaceWidget,
35   midi_editor_space_widget,
36   Z, MIDI_EDITOR_SPACE_WIDGET,
37   GtkBox)
38 
39 typedef struct _ArrangerWidget ArrangerWidget;
40 typedef struct _PianoRollKeysWidget
41   PianoRollKeysWidget;
42 
43 /**
44  * @addtogroup widgets
45  *
46  * @{
47  */
48 
49 #define MW_MIDI_EDITOR_SPACE \
50   MW_CLIP_EDITOR_INNER->midi_editor_space
51 
52 /**
53  * The piano roll widget is the whole space inside
54  * the clip editor tab when a MIDI region is selected.
55  */
56 typedef struct _MidiEditorSpaceWidget
57 {
58   GtkBox               parent_instance;
59 
60   GtkPaned *           midi_arranger_velocity_paned;
61 
62   GtkScrolledWindow *  piano_roll_keys_scroll;
63   GtkViewport *        piano_roll_keys_viewport;
64 
65   GtkBox *             midi_notes_box;
66 
67   PianoRollKeysWidget * piano_roll_keys;
68 
69   /** Piano roll. */
70   GtkBox *             midi_arranger_box;
71   GtkScrolledWindow *  arranger_scroll;
72   GtkViewport *        arranger_viewport;
73   ArrangerWidget *     arranger;
74   GtkScrolledWindow *  modifier_arranger_scroll;
75   GtkViewport *        modifier_arranger_viewport;
76   ArrangerWidget *     modifier_arranger;
77 
78   GtkBox *             midi_vel_chooser_box;
79   GtkComboBoxText *    midi_modifier_chooser;
80 
81   /** Vertical size goup for the keys and the
82    * arranger. */
83   GtkSizeGroup *    arranger_and_keys_vsize_group;
84 } MidiEditorSpaceWidget;
85 
86 void
87 midi_editor_space_widget_setup (
88   MidiEditorSpaceWidget * self);
89 
90 /**
91  * See CLIP_EDITOR_INNER_WIDGET_ADD_TO_SIZEGROUP.
92  */
93 void
94 midi_editor_space_widget_update_size_group (
95   MidiEditorSpaceWidget * self,
96   int                     visible);
97 
98 void
99 midi_editor_space_widget_refresh (
100   MidiEditorSpaceWidget * self);
101 
102 /**
103  * @}
104  */
105 
106 #endif
107