1 /*
2  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
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 along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __ardour_stripable_time_axis_h__
20 #define __ardour_stripable_time_axis_h__
21 
22 #include "automation_time_axis.h"
23 #include "time_axis_view.h"
24 
25 class StripableTimeAxisView : public TimeAxisView
26 {
27 public:
28 	StripableTimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas);
29 	virtual ~StripableTimeAxisView ();
30 
31 	void set_stripable (boost::shared_ptr<ARDOUR::Stripable>);
stripable()32 	boost::shared_ptr<ARDOUR::Stripable> stripable() const { return _stripable; }
33 
34 	typedef std::map<Evoral::Parameter, boost::shared_ptr<AutomationTimeAxisView> > AutomationTracks;
automation_tracks()35 	const AutomationTracks& automation_tracks() const { return _automation_tracks; }
36 	virtual Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
37 
38 	virtual void create_automation_child (const Evoral::Parameter& param, bool show) = 0;
39 	virtual boost::shared_ptr<AutomationTimeAxisView> automation_child (Evoral::Parameter param, PBD::ID ctrl_id = PBD::ID(0));
40 
41 	virtual boost::shared_ptr<AutomationLine> automation_child_by_alist_id (PBD::ID);
42 
43 	void request_redraw ();
44 
45 	virtual void show_all_automation (bool apply_to_selection = false);
46 	virtual void show_existing_automation (bool apply_to_selection = false);
47 	virtual void hide_all_automation (bool apply_to_selection = false);
48 
49 protected:
50 	void reset_samples_per_pixel ();
51 	virtual void set_samples_per_pixel (double);
52 	void add_automation_child(Evoral::Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show=true);
53 
54 	virtual void create_gain_automation_child (const Evoral::Parameter &, bool) = 0;
55 	virtual void create_trim_automation_child (const Evoral::Parameter &, bool) = 0;
56 	virtual void create_mute_automation_child (const Evoral::Parameter &, bool) = 0;
57 
58 	void automation_track_hidden (Evoral::Parameter param);
59 
60 	void update_gain_track_visibility ();
61 	void update_trim_track_visibility ();
62 	void update_mute_track_visibility ();
63 
64 	boost::shared_ptr<ARDOUR::Stripable> _stripable;
65 
66 	boost::shared_ptr<AutomationTimeAxisView> gain_track;
67 	boost::shared_ptr<AutomationTimeAxisView> trim_track;
68 	boost::shared_ptr<AutomationTimeAxisView> mute_track;
69 
70 	typedef std::map<Evoral::Parameter, Gtk::CheckMenuItem*> ParameterMenuMap;
71 	/** parameter -> menu item map for the main automation menu */
72 	ParameterMenuMap _main_automation_menu_map;
73 
74 	Gtk::CheckMenuItem* gain_automation_item;
75 	Gtk::CheckMenuItem* trim_automation_item;
76 	Gtk::CheckMenuItem* mute_automation_item;
77 
78 	AutomationTracks _automation_tracks;
79 
80 	ArdourCanvas::Canvas& parent_canvas;
81 	bool                  no_redraw;
82 };
83 
84 #endif /* __ardour_stripable_time_axis_h__ */
85