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