1 /*
2  * Copyright (C) 2020 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 Zrythm.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 /**
21  * \file
22  *
23  * Plugin strip expander widget.
24  */
25 
26 #ifndef __GUI_WIDGETS_PLUGIN_STRIP_EXPANDER_H__
27 #define __GUI_WIDGETS_PLUGIN_STRIP_EXPANDER_H__
28 
29 #include "gui/widgets/expander_box.h"
30 
31 #include <gtk/gtk.h>
32 
33 #define PLUGIN_STRIP_EXPANDER_WIDGET_TYPE \
34   (plugin_strip_expander_widget_get_type ())
35 G_DECLARE_FINAL_TYPE (
36   PluginStripExpanderWidget,
37   plugin_strip_expander_widget,
38   Z, PLUGIN_STRIP_EXPANDER_WIDGET,
39   ExpanderBoxWidget);
40 
41 typedef struct Track Track;
42 typedef struct _ChannelSlotWidget ChannelSlotWidget;
43 
44 /**
45  * @addtogroup widgets
46  *
47  * @{
48  */
49 
50 typedef enum PluginStripExpanderPosition
51 {
52   PSE_POSITION_CHANNEL,
53   PSE_POSITION_INSPECTOR,
54 } PluginStripExpanderPosition;
55 
56 /**
57  * A TwoColExpanderBoxWidget for showing the ports
58  * in the InspectorWidget.
59  */
60 typedef struct _PluginStripExpanderWidget
61 {
62   ExpanderBoxWidget parent_instance;
63 
64   PluginSlotType    slot_type;
65   PluginStripExpanderPosition position;
66 
67   /** Scrolled window for the vbox inside. */
68   GtkScrolledWindow * scroll;
69   GtkViewport *     viewport;
70 
71   /** VBox containing each slot. */
72   GtkBox *          box;
73 
74   /** 1 box for each item. */
75   GtkBox *          strip_boxes[STRIP_SIZE];
76 
77   /** Channel slots, if type is inserts. */
78   ChannelSlotWidget * slots[STRIP_SIZE];
79 
80   /** Owner track. */
81   Track *           track;
82 } PluginStripExpanderWidget;
83 
84 /**
85  * Queues a redraw of the given slot.
86  */
87 void
88 plugin_strip_expander_widget_redraw_slot (
89   PluginStripExpanderWidget * self,
90   int                         slot);
91 
92 /**
93  * Unsets state flags and redraws the widget at the
94  * given slot.
95  *
96  * @param slot Slot, or -1 for all slots.
97  * @param set True to set, false to unset.
98  */
99 void
100 plugin_strip_expander_widget_set_state_flags (
101   PluginStripExpanderWidget * self,
102   int                         slot,
103   GtkStateFlags               flags,
104   bool                        set);
105 
106 /**
107  * Refreshes each field.
108  */
109 void
110 plugin_strip_expander_widget_refresh (
111   PluginStripExpanderWidget * self);
112 
113 /**
114  * Sets up the PluginStripExpanderWidget.
115  */
116 void
117 plugin_strip_expander_widget_setup (
118   PluginStripExpanderWidget * self,
119   PluginSlotType              type,
120   PluginStripExpanderPosition position,
121   Track *                     track);
122 
123 /**
124  * @}
125  */
126 
127 #endif
128