2006-03-04 Tim Mayberry <mojofunk@gmail.com>
[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     $Id$
19 */
20
21 #ifndef __gtk_ardour_crossfade_view_h__
22 #define __gtk_ardour_crossfade_view_h__
23
24 #include <vector>
25 #include <libgnomecanvasmm.h>
26 #include <sigc++/signal.h>
27 #include <ardour/crossfade.h>
28
29 #include "time_axis_view_item.h"
30
31 class AudioTimeAxisView;
32 class AudioRegionView;
33
34 struct CrossfadeView : public TimeAxisViewItem
35 {
36     CrossfadeView (ArdourCanvas::Group*, 
37                    AudioTimeAxisView&,
38                    ARDOUR::Crossfade&,
39                    double initial_samples_per_unit, 
40                    Gdk::Color& basic_color,
41                    AudioRegionView& leftview,
42                    AudioRegionView& rightview);
43     ~CrossfadeView ();
44
45     ARDOUR::Crossfade& crossfade;  // ok, let 'em have it
46     AudioRegionView& left_view;    // and these too
47     AudioRegionView& right_view;
48
49     std::string get_item_name();
50     void set_height (double);
51
52     bool valid() const { return _valid; }
53     bool visible() const { return _visible; }
54     void set_valid (bool yn);
55
56     static sigc::signal<void,CrossfadeView*> GoingAway;
57
58     AudioRegionView& upper_regionview () const;
59
60     void fake_hide ();
61     void hide ();
62     void show ();
63     
64   protected:
65     void reset_width_dependent_items (double pixel_width);
66
67   private:
68     bool _valid;
69     bool _visible;
70
71     double spu;
72
73     ArdourCanvas::Item *overlap_rect;
74     ArdourCanvas::Line *fade_in;
75     ArdourCanvas::Line *fade_out;
76     ArdourCanvas::Item *active_button;
77
78     void crossfade_changed (ARDOUR::Change);
79     void active_changed ();
80     void redraw_curves ();
81 };
82
83 #endif /* __gtk_ardour_crossfade_view_h__ */