replace ::cast_dynamic() with relevant ActionManager::get_*_action() calls
[ardour.git] / gtk2_ardour / stripable_time_axis.h
1 /*
2  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
3  * Copyright (C) 2016 Paul Davis
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (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
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #ifndef __ardour_stripable_time_axis_h__
21 #define __ardour_stripable_time_axis_h__
22
23 #include "automation_time_axis.h"
24 #include "time_axis_view.h"
25
26 class StripableTimeAxisView : public TimeAxisView
27 {
28 public:
29         StripableTimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas);
30         virtual ~StripableTimeAxisView ();
31
32         void set_stripable (boost::shared_ptr<ARDOUR::Stripable>);
33         boost::shared_ptr<ARDOUR::Stripable> stripable() const { return _stripable; }
34
35         typedef std::map<Evoral::Parameter, boost::shared_ptr<AutomationTimeAxisView> > AutomationTracks;
36         const AutomationTracks& automation_tracks() const { return _automation_tracks; }
37         virtual Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
38
39         virtual void create_automation_child (const Evoral::Parameter& param, bool show) = 0;
40         boost::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param);
41
42         void request_redraw ();
43
44 protected:
45         void reset_samples_per_pixel ();
46         virtual void set_samples_per_pixel (double);
47         void add_automation_child(Evoral::Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show=true);
48
49         virtual void create_gain_automation_child (const Evoral::Parameter &, bool) = 0;
50         virtual void create_trim_automation_child (const Evoral::Parameter &, bool) = 0;
51         virtual void create_mute_automation_child (const Evoral::Parameter &, bool) = 0;
52
53         void automation_track_hidden (Evoral::Parameter param);
54
55         void update_gain_track_visibility ();
56         void update_trim_track_visibility ();
57         void update_mute_track_visibility ();
58
59         virtual void show_all_automation (bool apply_to_selection = false);
60         virtual void show_existing_automation (bool apply_to_selection = false);
61         virtual void hide_all_automation (bool apply_to_selection = false);
62
63         boost::shared_ptr<ARDOUR::Stripable> _stripable;
64
65         boost::shared_ptr<AutomationTimeAxisView> gain_track;
66         boost::shared_ptr<AutomationTimeAxisView> trim_track;
67         boost::shared_ptr<AutomationTimeAxisView> mute_track;
68
69         typedef std::map<Evoral::Parameter, Gtk::CheckMenuItem*> ParameterMenuMap;
70         /** parameter -> menu item map for the main automation menu */
71         ParameterMenuMap _main_automation_menu_map;
72
73         Gtk::CheckMenuItem* gain_automation_item;
74         Gtk::CheckMenuItem* trim_automation_item;
75         Gtk::CheckMenuItem* mute_automation_item;
76
77         AutomationTracks _automation_tracks;
78
79         ArdourCanvas::Canvas& parent_canvas;
80         bool                  no_redraw;
81 };
82
83 #endif /* __ardour_stripable_time_axis_h__ */