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