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