Prepare VCA Automation Lanes -- refactor TAV
[ardour.git] / gtk2_ardour / vca_time_axis.h
1 /*
2     Copyright (C) 2016 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (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., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __ardour_vca_time_axis_h__
21 #define __ardour_vca_time_axis_h__
22
23 #include "ardour_button.h"
24 #include "stripable_time_axis.h"
25 #include "gain_meter.h"
26
27 namespace ArdourCanvas {
28         class Canvas;
29 }
30
31 namespace ARDOUR {
32         class Session;
33         class VCA;
34 }
35
36 class VCATimeAxisView : public StripableTimeAxisView
37 {
38   public:
39         VCATimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas);
40         virtual ~VCATimeAxisView ();
41
42         boost::shared_ptr<ARDOUR::Stripable> stripable() const;
43         ARDOUR::PresentationInfo const & presentation_info () const;
44
45         void set_vca (boost::shared_ptr<ARDOUR::VCA>);
46         boost::shared_ptr<ARDOUR::VCA> vca() const { return _vca; }
47
48         std::string name() const;
49         Gdk::Color color () const;
50         std::string state_id() const;
51
52         void set_height (uint32_t h, TrackHeightMode m = OnlySelf);
53
54         bool selectable() const { return false; }
55         bool marked_for_display () const;
56         bool set_marked_for_display (bool);
57
58  protected:
59         boost::shared_ptr<ARDOUR::VCA> _vca;
60         ArdourButton  solo_button;
61         ArdourButton  mute_button;
62         ArdourButton  automation_button;
63         ArdourButton  drop_button;
64         ArdourButton  number_label;
65         GainMeterBase gain_meter;
66         PBD::ScopedConnectionList vca_connections;
67
68         void create_gain_automation_child (const Evoral::Parameter &, bool);
69         void create_trim_automation_child (const Evoral::Parameter &, bool) {}
70         void create_mute_automation_child (const Evoral::Parameter &, bool);
71
72         virtual void show_all_automation (bool apply_to_selection = false);
73         virtual void show_existing_automation (bool apply_to_selection = false);
74         virtual void hide_all_automation (bool apply_to_selection = false);
75
76         void create_automation_child (const Evoral::Parameter& param, bool show);
77         virtual void build_automation_action_menu (bool);
78         Gtk::Menu* automation_action_menu;
79
80         void parameter_changed (std::string const& p);
81         void vca_property_changed (PBD::PropertyChange const&);
82         void update_vca_name ();
83         void set_button_names ();
84         void update_solo_display ();
85         void update_mute_display ();
86         void update_track_number_visibility ();
87         bool solo_release (GdkEventButton*);
88         bool mute_release (GdkEventButton*);
89         bool automation_click (GdkEventButton*);
90         bool drop_release (GdkEventButton*);
91         void self_delete ();
92 };
93
94 #endif /* __ardour_vca_time_axis_h__ */