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