Reformat.
[ardour.git] / gtk2_ardour / crossfade_view.h
1 /*
2     Copyright (C) 2003 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 __gtk_ardour_crossfade_view_h__
21 #define __gtk_ardour_crossfade_view_h__
22
23 #include <vector>
24 #include <libgnomecanvasmm.h>
25 #include "pbd/signals.h"
26 #include "ardour/crossfade.h"
27
28 #include "time_axis_view_item.h"
29
30 class RouteTimeAxisView;
31 class AudioRegionView;
32
33 class CrossfadeView : public TimeAxisViewItem
34 {
35 public:
36         CrossfadeView (ArdourCanvas::Group*,
37                        RouteTimeAxisView&,
38                        boost::shared_ptr<ARDOUR::Crossfade>,
39                        double initial_samples_per_unit,
40                        Gdk::Color& basic_color,
41                        AudioRegionView& leftview,
42                        AudioRegionView& rightview);
43         
44         ~CrossfadeView ();
45
46         boost::shared_ptr<ARDOUR::Crossfade> crossfade;  // ok, let 'em have it
47
48         AudioRegionView& left_view;    // and these too
49         AudioRegionView& right_view;
50         
51         void set_height (double);
52         
53         bool valid() const { return _valid; }
54         bool visible() const { return _visible; }
55         void set_valid (bool yn);
56         
57         static PBD::Signal1<void,CrossfadeView*> CatchDeletion;
58         
59         AudioRegionView& upper_regionview () const;
60         
61         void fake_hide ();
62         void hide ();
63         void show ();
64         void horizontal_position_changed ();
65         
66 protected:
67         void reset_width_dependent_items (double pixel_width);
68         
69 private:
70         bool _valid;
71         bool _visible;
72         bool _all_in_view;   
73         
74         ArdourCanvas::Line *fade_in;
75         ArdourCanvas::Line *fade_out;
76         ArdourCanvas::Item *active_button;
77         
78         void crossfade_changed (const PBD::PropertyChange&);
79         void crossfade_fades_changed ();
80         void active_changed ();
81         void redraw_curves ();
82         void color_handler ();
83 };
84
85 #endif /* __gtk_ardour_crossfade_view_h__ */