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