e321fe40031b51c5085758261568ae189307ac6a
[ardour.git] / gtk2_ardour / marker_time_axis.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 __ardour_marker_time_axis_h__
22 #define __ardour_marker_time_axis_h__
23
24 #include <string>
25 #include <libgnomecanvas/libgnomecanvas.h>
26
27 #include "ardour_dialog.h"
28 #include "route_ui.h"
29 #include "enums.h"
30 #include "time_axis_view.h"
31 #include "canvas.h"
32 #include "visual_time_axis.h"
33
34 namespace ARDOUR {
35         class Session;
36 }
37 namespace ARDOUR {
38         class Menu;
39 }
40
41 class PublicEditor;
42 class ImageFrameView ;
43 class ImageFrameTimeAxisView ;
44 class MarkerTimeAxisView ;
45 class MarkerView ;
46
47 /**
48  * MarkerTimeAxis defines a visual time axis for holding marker items associated with other time axis, and time axis items.
49  *
50  * The intention of this time axis is to allow markers with duration to be arranged on the time line
51  * to add additional timing information to items on an associated time axis, for instance the addition
52  * of effect duration and timings
53  */
54 class MarkerTimeAxis : public VisualTimeAxis
55 {
56         public:
57                 //---------------------------------------------------------------------------------------//
58                 // Constructor / Desctructor
59                 
60                 /**
61                  * Constructs a new MarkerTimeAxis
62                  *
63                  * @param ed the PublicEditor
64                  * @param sess the current session
65                  * @param canvas the parent canvas item
66                  * @param name the name/id of this time axis
67                  * @param tav the associated track view that this MarkerTimeAxis is marking up
68                  */
69                 MarkerTimeAxis(PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas, const string & name, TimeAxisView* tav) ;
70                 
71                 /**
72                  * Destructor
73                  * Responsible for destroying any marker items upon this time axis
74                  */
75                 virtual ~MarkerTimeAxis() ;
76                 
77                 
78                 //---------------------------------------------------------------------------------------//
79                 // ui methods & data
80                 
81                 /**
82                  * Sets the height of this TrackView to one of the defined TrackHeights
83                  *
84                  * @param h the TrackHeight value to set
85                  */
86                 virtual void set_height(TimeAxisView::TrackHeight h) ;
87                 
88                 /**
89                  * Sets the number of samples per unit that are used.
90                  * This is used to determine the sizes of items upon this time axis
91                  *
92                  * @param spu the number of samples per unit
93                  */
94                 virtual void set_samples_per_unit(double spu) ;
95                 
96                 
97                 /**
98                  * Show the popup edit menu
99                  *
100                  * @param button the mouse button pressed
101                  * @param time when to show the popup
102                  * @param clicked_mv the MarkerView that the event ocured upon, or 0 if none
103                  * @param with_item true if an item has been selected upon the time axis, used to set context menu
104                  */
105                 void popup_marker_time_axis_edit_menu(int button, int32_t time, MarkerView* clicked_mv, bool with_item) ;
106                 
107                 
108                 //---------------------------------------------------------------------------------------//
109                 // Parent/Child helper object accessors
110
111                 /**
112                  * Returns the view helper of this TimeAxis
113                  *
114                  * @return the view helper of this TimeAxis
115                  */
116                 MarkerTimeAxisView* get_view() ;
117                 
118                 /**
119                  * Returns the TimeAxisView that this markerTimeAxis is marking up
120                  *
121                  * @return the TimeAXisView that this MarkerTimeAxis is marking
122                  */
123                 TimeAxisView* get_marked_time_axis() ;
124
125
126         private:
127         
128                 /**
129                  * convenience method to select a new track color and apply it to the view and view items
130                  *
131                  */
132                 void select_track_color() ;
133                 
134                 /**
135                  * Handles the building of the popup menu
136                  */
137                 virtual void build_display_menu() ;
138                 
139                 /**
140                  * handles the building of the MarkerView sub menu
141                  */
142                 void build_marker_menu() ;
143
144                 /** The associated TimeAxis that this MarkerTimeAxis is marking up */
145                 TimeAxisView* marked_time_axis ;
146                 
147                 /** Our time axis view helper */
148                 MarkerTimeAxisView *view ;
149
150                 /** the popup menu available by clicking upon this time axis */         
151                 Gtk::Menu *marker_menu ;
152                 
153                 /** specialized sub menu available when clicking upon and item upon this time axis */
154                 Gtk::Menu *marker_item_menu ;
155                 
156                 
157 } ; /* class MarkerTimeAxis */
158
159 #endif /* __ardour_imageframe_time_axis_h__ */
160