fix drawing of zero-length notes
[ardour.git] / gtk2_ardour / vca_time_axis.h
1 /*
2  * Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19
20 #ifndef __ardour_vca_time_axis_h__
21 #define __ardour_vca_time_axis_h__
22
23 #include "widgets/ardour_button.h"
24
25 #include "stripable_colorpicker.h"
26 #include "stripable_time_axis.h"
27 #include "gain_meter.h"
28
29 namespace ArdourCanvas {
30         class Canvas;
31 }
32
33 namespace ARDOUR {
34         class Session;
35         class VCA;
36 }
37
38 class VCATimeAxisView : public StripableTimeAxisView
39 {
40 public:
41         VCATimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas);
42         virtual ~VCATimeAxisView ();
43
44         boost::shared_ptr<ARDOUR::Stripable> stripable() const;
45         ARDOUR::PresentationInfo const & presentation_info () const;
46
47         void set_vca (boost::shared_ptr<ARDOUR::VCA>);
48         boost::shared_ptr<ARDOUR::VCA> vca() const { return _vca; }
49
50         std::string name() const;
51         Gdk::Color color () const;
52         std::string state_id() const;
53
54         void set_height (uint32_t h, TrackHeightMode m = OnlySelf);
55
56         bool marked_for_display () const;
57         bool set_marked_for_display (bool);
58
59 protected:
60         boost::shared_ptr<ARDOUR::VCA> _vca;
61         ArdourWidgets::ArdourButton    solo_button;
62         ArdourWidgets::ArdourButton    mute_button;
63         ArdourWidgets::ArdourButton    automation_button;
64         ArdourWidgets::ArdourButton    drop_button;
65         ArdourWidgets::ArdourButton    number_label;
66         GainMeterBase                  gain_meter;
67         PBD::ScopedConnectionList      vca_connections;
68
69         void create_gain_automation_child (const Evoral::Parameter &, bool);
70         void create_trim_automation_child (const Evoral::Parameter &, bool) {}
71         void create_mute_automation_child (const Evoral::Parameter &, bool);
72
73         virtual void show_all_automation (bool apply_to_selection = false);
74         virtual void show_existing_automation (bool apply_to_selection = false);
75         virtual void hide_all_automation (bool apply_to_selection = false);
76
77         void create_automation_child (const Evoral::Parameter& param, bool show);
78         virtual void build_automation_action_menu (bool);
79         void         build_display_menu ();
80         Gtk::Menu* automation_action_menu;
81
82         bool name_entry_changed (std::string const&);
83
84         void parameter_changed (std::string const& p);
85         void vca_property_changed (PBD::PropertyChange const&);
86         void update_vca_name ();
87         void set_button_names ();
88         void update_solo_display ();
89         void update_mute_display ();
90         void update_track_number_visibility ();
91         bool solo_release (GdkEventButton*);
92         bool mute_release (GdkEventButton*);
93         bool automation_click (GdkEventButton*);
94         bool drop_release (GdkEventButton*);
95         void self_delete ();
96
97         void drop_all_slaves ();
98         void choose_color ();
99
100 private:
101         StripableColorDialog _color_picker;
102 };
103
104 #endif /* __ardour_vca_time_axis_h__ */