Gnome::Canvas -> ArdourCanvas and some other small fixes
[ardour.git] / gtk2_ardour / marker_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_marker_view_h__
22 #define __gtk_ardour_marker_view_h__
23
24 #include <string>
25 #include <gtkmm.h>
26 #include "time_axis_view_item.h"
27
28 #include "canvas.h"
29
30 class MarkerTimeAxisView ;
31 class ImageFrameView ;
32
33 /**
34  * MarkerView defines a marker item that may be placed upon a MarkerTimeAxis.
35  *
36  * The aim of the MarkerView is to provide additional timing details for visual based time axis.
37  * The MarkerView item is associated with one other TimeAxisViewItem and has a start and a duration.  
38  */
39 class MarkerView : public TimeAxisViewItem
40 {
41         public:
42                 //---------------------------------------------------------------------------------------//
43                 // Constructor / Desctructor
44                 
45                 /**
46                  * Constructs a new MarkerView
47                  * 
48                  * @param parent the parent canvas item
49                  * @param tv the parent TimeAxisView of this item
50                  * @param marked the Item that this item is to be assciated (marking) with
51                  * @param spu the current samples per unit 
52                  * @param base_color
53                  * @param mark_type the marker type/name text, eg fade out, pan up etc.
54                  * @param mark_id unique name/id of this item
55                  * @param start the start time of this item
56                  * @param duration the duration of this item
57                  */
58                  MarkerView(ArdourCanvas::Group *parent,
59                         TimeAxisView *tv,
60                         ImageFrameView* marked,
61                         double spu,
62                         Gdk::Color& base_color,
63                         std::string mark_type,
64                         std::string mark_id,
65                         jack_nframes_t start,
66                         jack_nframes_t duration) ;
67
68                 /**
69                  * Destructor
70                  * Destroys this Marker Item and removes the association between itself and the item it is marking.
71                  */
72                 ~MarkerView() ;
73                 
74                 static sigc::signal<void,MarkerView*> GoingAway;
75                 
76                 //---------------------------------------------------------------------------------------//
77                 // Marker Type Methods
78                 
79                 /**
80                  * Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc. 
81                  *
82                  * @param type_text the marker type text of this item
83                  */
84                 void set_mark_type_text(std::string type_text) ;
85                 
86                 /**
87                  * Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc. 
88                  *
89                  * @return the marker type text of this item
90                  */
91                 std::string get_mark_type_text() const ;
92
93                 
94                 //---------------------------------------------------------------------------------------//
95                 // Marked Item Methods
96
97                 /**
98                  * Returns the time axis item being marked by this item
99                  *
100                  * @return the time axis item being marked by this item
101                  */
102                 ImageFrameView* get_marked_item() ;
103                 
104                 /**
105                  * Sets the time axis item being marker by this item
106                  *
107                  * @param item the time axis item to be marked by this item
108                  * @return the previously marked item, or 0 if no previous marked item exists
109                  */
110                 ImageFrameView* set_marked_item(ImageFrameView* item) ;
111                 
112                 //---------------------------------------------------------------------------------//
113                 // Emitted Signals
114                 
115                 /** Emitted when the mark type text is changed */
116                 sigc::signal<void,std::string,void*> MarkTypeChanged ;
117                 
118                 /** Emitted when the Marked Item is changed */
119                 sigc::signal<void,ImageFrameView*,void*> MarkedItemChanged ;
120
121                 
122         protected:
123
124         private:
125                 /** the unique name/id of this item */
126                 std::string mark_type_text ;
127
128                 /* a pointer to the time axis item this marker is assoiated(marking up) with */
129                 ImageFrameView* marked_item ;
130                 
131 } ; /* class MarkerView */
132
133
134 #endif /* __gtk_ardour_imageframe_view_h__ */