NO-OP, whitespace
[ardour.git] / gtk2_ardour / plugin_pin_dialog.h
1 /*
2  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18
19 #ifndef __gtkardour_plugin_pin_dialog_h__
20 #define __gtkardour_plugin_pin_dialog_h__
21
22 #include <gtkmm/drawingarea.h>
23
24 #include "pbd/stateful.h"
25 #include "pbd/signals.h"
26
27 #include "ardour/plugin_insert.h"
28 #include "ardour/route.h"
29
30 #include "ardour_button.h"
31 #include "ardour_window.h"
32
33 class PluginPinDialog : public ArdourWindow
34 {
35 public:
36         PluginPinDialog (boost::shared_ptr<ARDOUR::PluginInsert>);
37         ~PluginPinDialog ();
38
39 private:
40         typedef enum {
41                 Input,
42                 Sink,
43                 Source,
44                 Output
45         } CtrlType;
46
47         struct _CtrlElem {
48                 _CtrlElem (CtrlType c, ARDOUR::DataType d, uint32_t i, uint32_t p = -1)
49                         : ct (c), dt (d), id (i), ip (p) {}
50                 CtrlType ct;
51                 ARDOUR::DataType dt;
52                 uint32_t id; // port/pin ID
53                 uint32_t ip; // plugin ID (for Sink, Source only)
54         };
55
56         typedef boost::shared_ptr<_CtrlElem> CtrlElem;
57
58         struct CtrlWidget {
59                 CtrlWidget (CtrlType ct, ARDOUR::DataType dt, uint32_t id, uint32_t ip = 0)
60                         : x(0), y(0), w (0), h (0), prelight (false)
61                 {
62                         e = CtrlElem (new _CtrlElem (ct, dt, id, ip));
63                 }
64                 double x,y;
65                 double w,h;
66                 bool prelight;
67                 CtrlElem e;
68         };
69
70         typedef std::vector<CtrlWidget> CtrlElemList;
71
72         CtrlElem _selection;
73         CtrlElem _actor;
74         CtrlElem _hover;
75         CtrlElemList _elements;
76
77
78         Gtk::DrawingArea darea;
79         ArdourButton _ind_strict_io;
80         ArdourButton _ind_customized;
81         ArdourButton _rst_config;
82         ArdourButton _rst_mapping;
83         ArdourButton _add_plugin;
84         ArdourButton _del_plugin;
85         ArdourButton _add_output_audio;
86         ArdourButton _del_output_audio;
87         ArdourButton _add_output_midi;
88         ArdourButton _del_output_midi;
89
90         void plugin_reconfigured ();
91         void update_elements ();
92         void update_element_pos ();
93
94         void darea_size_request (Gtk::Requisition*);
95         void darea_size_allocate (Gtk::Allocation&);
96         bool darea_expose_event (GdkEventExpose*);
97         bool darea_motion_notify_event (GdkEventMotion*);
98         bool darea_button_press_event (GdkEventButton*);
99         bool darea_button_release_event (GdkEventButton*);
100
101         void draw_io_pin (cairo_t*, const CtrlWidget&);
102         void draw_plugin_pin (cairo_t*, const CtrlWidget&);
103
104         void set_color (cairo_t*, bool);
105         double pin_x_pos (uint32_t, double, double, uint32_t, uint32_t, bool);
106         void draw_connection (cairo_t*, double, double, double, double, bool, bool dashed = false);
107
108         void reset_mapping ();
109         void reset_configuration ();
110         void add_remove_plugin_clicked (bool);
111         void add_remove_port_clicked (bool, ARDOUR::DataType);
112         void handle_input_action (const CtrlElem &, const CtrlElem &);
113         void handle_output_action (const CtrlElem &, const CtrlElem &);
114
115         PBD::ScopedConnectionList _plugin_connections;
116         boost::shared_ptr<ARDOUR::PluginInsert> _pi;
117
118         uint32_t _n_plugins;
119         ARDOUR::ChanCount _in, _out;
120         ARDOUR::ChanCount _sinks, _sources;
121
122         double _pin_box_size;
123         double _width, _height;
124         double _min_width;
125         bool _position_valid;
126         bool _ignore_updates;
127         ARDOUR::Route* _route () { return static_cast<ARDOUR::Route*> (_pi->owner ()); }
128 };
129
130 #endif