1 /*
2  * Copyright (C) 2016-2017 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
4  * Copyright (C) 2017-2018 Ben Loftis <ben@harrisonconsoles.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program 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 General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef __ardour_vca_master_strip__
22 #define __ardour_vca_master_strip__
23 
24 #include <boost/shared_ptr.hpp>
25 
26 #include <gtkmm/box.h>
27 #include <gtkmm/colorselection.h>
28 #include <gtkmm/menuitem.h>
29 #include <gtkmm/messagedialog.h>
30 
31 #include "widgets/ardour_button.h"
32 
33 #include "axis_view.h"
34 #include "control_slave_ui.h"
35 #include "gain_meter.h"
36 #include "stripable_colorpicker.h"
37 
38 namespace ARDOUR {
39 	class GainControl;
40 	class VCA;
41 }
42 
43 class FloatingTextEntry;
44 
45 class VCAMasterStrip : public AxisView, public Gtk::EventBox
46 {
47 public:
48 	VCAMasterStrip (ARDOUR::Session*, boost::shared_ptr<ARDOUR::VCA>);
49 	~VCAMasterStrip ();
50 
51 	boost::shared_ptr<ARDOUR::Stripable> stripable() const;
52 	ARDOUR::PresentationInfo const & presentation_info () const;
53 
54 	std::string name() const;
55 	Gdk::Color color () const;
56 	std::string state_id() const;
vca()57 	boost::shared_ptr<ARDOUR::VCA> vca() const { return _vca; }
58 
59 	static PBD::Signal1<void,VCAMasterStrip*> CatchDeletion;
60 
61 	bool marked_for_display () const;
62 	bool set_marked_for_display (bool);
63 
64 private:
65 	boost::shared_ptr<ARDOUR::VCA> _vca;
66 	GainMeter    gain_meter;
67 
68 	Gtk::Frame                  global_frame;
69 	Gtk::VBox                   global_vpacker;
70 	Gtk::HBox                   bottom_padding;
71 	Gtk::HBox                   solo_mute_box;
72 	ArdourWidgets::ArdourButton width_button;
73 	ArdourWidgets::ArdourButton color_button;
74 	ArdourWidgets::ArdourButton hide_button;
75 	ArdourWidgets::ArdourButton number_label;
76 	ArdourWidgets::ArdourButton solo_button;
77 	ArdourWidgets::ArdourButton mute_button;
78 	Gtk::Menu*                  context_menu;
79 	Gtk::MessageDialog*         delete_dialog;
80 	ArdourWidgets::ArdourButton vertical_button;
81 	ControlSlaveUI              control_slave_ui;
82 	PBD::ScopedConnectionList   vca_connections;
83 
84 	void spill ();
85 	void spill_change (boost::shared_ptr<ARDOUR::Stripable>);
86 	void hide_clicked();
87 	bool width_button_pressed (GdkEventButton *);
88 	void set_selected (bool);
89 	bool solo_release (GdkEventButton*);
90 	bool mute_release (GdkEventButton*);
91 	void set_width (bool wide);
92 	void set_solo_text ();
93 	void solo_changed ();
94 	void mute_changed ();
95 	void unassign ();
96 	void start_name_edit ();
97 	void finish_name_edit (std::string, int);
98 	bool vertical_button_press (GdkEventButton*);
99 	bool number_button_press (GdkEventButton*);
100 	void vca_property_changed (PBD::PropertyChange const & what_changed);
101 	void update_vca_name ();
102 	void build_context_menu ();
103 	void hide_confirmation (int);
104 	void self_delete ();
105 	void remove ();
106 	void drop_all_slaves ();
107 	void assign_all_selected ();
108 	void unassign_all_selected ();
109 
110 	void parameter_changed (std::string const& p);
111 	void set_button_names ();
112 	void update_bottom_padding ();
113 
114 	void start_color_edit ();
115 	StripableColorDialog _color_picker;
116 };
117 
118 
119 #endif /* __ardour_vca_master_strip__ */
120