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 Zrythm.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 /**
21  * \file
22  *
23  * Ports expander widget.
24  */
25 
26 #ifndef __GUI_WIDGETS_PORTS_EXPANDER_H__
27 #define __GUI_WIDGETS_PORTS_EXPANDER_H__
28 
29 #include "audio/port.h"
30 #include "gui/widgets/two_col_expander_box.h"
31 
32 #include <gtk/gtk.h>
33 
34 typedef struct _EditableLabelWidget
35   EditableLabelWidget;
36 typedef struct Track Track;
37 typedef struct Plugin Plugin;
38 
39 #define PORTS_EXPANDER_WIDGET_TYPE \
40   (ports_expander_widget_get_type ())
41 G_DECLARE_FINAL_TYPE (
42   PortsExpanderWidget,
43   ports_expander_widget,
44   Z, PORTS_EXPANDER_WIDGET,
45   TwoColExpanderBoxWidget);
46 
47 /**
48  * @addtogroup widgets
49  *
50  * @{
51  */
52 
53 /**
54  * Used for Track's.
55  */
56 typedef enum PortsExpanderTrackPortType
57 {
58   PE_TRACK_PORT_TYPE_CONTROLS,
59   PE_TRACK_PORT_TYPE_SENDS,
60   PE_TRACK_PORT_TYPE_STEREO_IN,
61   PE_TRACK_PORT_TYPE_MIDI_IN,
62   PE_TRACK_PORT_TYPE_MIDI_OUT,
63 } PortsExpanderTrackPortType;
64 
65 /**
66  * A TwoColExpanderBoxWidget for showing the ports
67  * in the InspectorWidget.
68  */
69 typedef struct _PortsExpanderWidget
70 {
71   TwoColExpanderBoxWidget parent_instance;
72 
73   PortFlow      flow;
74   PortType      type;
75   PortOwnerType owner_type;
76 
77   /** Plugin, in case of owner type Plugin. */
78   Plugin *      plugin;
79 
80   /** Track, in case of owner type Track. */
81   Track *       track;
82 } PortsExpanderWidget;
83 
84 /**
85  * Refreshes each field.
86  */
87 void
88 ports_expander_widget_refresh (
89   PortsExpanderWidget * self);
90 
91 /**
92  * Sets up the PortsExpanderWidget for a Plugin.
93  */
94 void
95 ports_expander_widget_setup_plugin (
96   PortsExpanderWidget * self,
97   PortFlow      flow,
98   PortType      type,
99   Plugin *      pl);
100 
101 /**
102  * Sets up the PortsExpanderWidget for Track ports.
103  *
104  * @param type The type of ports to include.
105  */
106 void
107 ports_expander_widget_setup_track (
108   PortsExpanderWidget *      self,
109   Track *                    tr,
110   PortsExpanderTrackPortType type);
111 
112 /**
113  * @}
114  */
115 
116 #endif
117