summaryrefslogtreecommitdiff
path: root/gtk2_ardour/visual_time_axis.h
blob: 6d1396bc54a2e1b6c70fa398ca554c726e412ee5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/*
    Copyright (C) 2003 Paul Davis 

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef __ardour_visual_time_axis_h__
#define __ardour_visual_time_axis_h__

#include <gtkmm/box.h>
#include <gtkmm/button.h>

#include <gtkmm2ext/selector.h>

#include "ardour_dialog.h"
#include "route_ui.h"
#include "enums.h"
#include "time_axis_view.h"
#include "canvas.h"

namespace ARDOUR
{
	class Session ;
}

class PublicEditor;
class ImageFrameView;
class ImageFrameTimeAxisView;
class MarkersTimeAxisView;
class TimeSelection;
class RegionSelection;
class MarkerTimeAxis;
class TimeAxisViewStrip;

/**
 * Base Abstact Class for TimeAxis views that operate purely within the visual domain.
 * 
 * This class provides many of the common methods required for visual TimeAxis views. The aim is
 * to provide an abstract layer during the developmnt of the visual based time axis'. Many of these
 * methods have a better home further up the class heirarchy, and in fact some are replication of 
 * methods found within RouteUI. This, however, has been required due to various problems with previous
 * versions of g++, mainly 2.95, which are not correctly handling virtual methods, virtual base classes,
 * and virtual methods when used with Multiple Inheritance. Perhaps these could be combined once the
 * compilers all agree on hos do to do stuff...
 */ 
class VisualTimeAxis : public TimeAxisView
{
	public:
		//---------------------------------------------------------------------------------------//
		// Constructor / Desctructor
		
		/**
		 * VisualTimeAxis Destructor
		 *
		 */
		virtual ~VisualTimeAxis() ;
		
		//---------------------------------------------------------------------------------------//
		// Name/Id Accessors/Mutators
		
		/**
		 * Returns the name of this TimeAxis
		 *
		 * @return the name of this TimeAxis
		 */
		virtual std::string name() const ;
		
		/**
		 * Sets the name of this TimeAxis
		 *
		 * @param name the new name of this TimeAxis
		 * @param src the identity of the object that initiated the change
		 */
		virtual void set_time_axis_name(const string & name, void* src) ;

		
		//---------------------------------------------------------------------------------------//
		// ui methods & data
		
		/**
		 * Sets the height of this TrackView to one of the defined TrackHeghts
		 *
		 * @param h the TrackHeight value to set
		 */
		virtual void set_height (TrackHeight h);	

		//---------------------------------------------------------------------------------------//
		// Selection Methods
		// selection methods are not handled by visual time axis object yet...
	
		/**
		 * Not implemented
		 */
		virtual void set_selected_regionviews(RegionSelection&) ;
	

		//---------------------------------------------------------------------------------//
		// Emitted Signals
		
		/**
		 * Emitted when we have changed the gui, and what we have shanged
		 */
		sigc::signal<void,const string &,void*> gui_changed ;
		
		/**
		 * Emitted when this Visual Time Axis has been removed
		 * This is different to the GoingAway signal in that this signal
		 * is emitted during the deletion of this Time Axis, and not during
		 * the destructor, this allows us to capture the source of the deletion
		 * event
		 */
		sigc::signal<void,const string &,void*> VisualTimeAxisRemoved ;
		
		/**
		 * Emitted when we have changed the name of this TimeAxis
		 */
		sigc::signal<void,const string &,const string &,void*> NameChanged ;

		/**
		 * Emitted when this time axis has been selected for removal
		 */
		//sigc::signal<void,std::string,void*> VisualTimeAxisRemoved ;

		//---------------------------------------------------------------------------------------//
		// Constructor / Desctructor
		
		/**
		 * Abstract Constructor for base visual time axis classes
		 *
		 * @param name the name/Id of thie TimeAxis
		 * @param ed the Ardour PublicEditor
		 * @param sess the current session
		 * @param canvas the parent canvas object
		 */
		VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas) ;
		
		
		//---------------------------------------------------------------------------------------//
		// Handle time axis removal
		
		/**
		 * Handles the Removal of this VisualTimeAxis
		 *
		 * @param src the identity of the object that initiated the change
		 */
		virtual void remove_this_time_axis(void* src) ;
		
		/**
		 * Callback used to remove this time axis during the gtk idle loop
		 * This is used to avoid deleting the obejct while inside the remove_this_time_axis
		 * method
		 *
		 * @param ta the VisualTimeAxis to remove
		 * @param src the identity of the object that initiated the change
		 */
		static gint idle_remove_this_time_axis(VisualTimeAxis* ta, void* src) ;

		
		
		//---------------------------------------------------------------------------------------//
		// ui methods & data
		
		/**
		 * Handle the visuals button click
		 *
		 */
		void visual_click() ;
		
		/**
		 * Handle the hide buttons click
		 *
		 */
		void hide_click() ;
		
		/**
		 * Allows the selection of a new color for this TimeAxis
		 *
		 */
		virtual void select_track_color() ;
		
		/**
		 * Provides a color chooser for the selection of a new time axis color.
		 *
		 */
		 bool choose_time_axis_color() ;
		
		/**
		 * Sets the color of this TimeAxis to the specified color c
		 *
		 * @param c the new TimeAxis color
		 */
		void set_time_axis_color(Gdk::Color c) ;
		
		
		//---------------------------------------------------------------------------------------//
		// Handle TimeAxis rename
		
		/**
		 * Construct a new prompt to receive a new name for this TimeAxis
		 *
		 * @see finish_time_axis_rename()
		 */
		void start_time_axis_rename() ;
		
		/**
		 * Handles the new name for this TimeAxis from the name prompt
		 *
		 * @see start_time_axis_rename()
		 */
		virtual void label_view() ;
		
		
		//---------------------------------------------------------------------------------------//
		// Handle name entry signals 
		
		void name_entry_changed() ;
		gint name_entry_focus_out_handler(GdkEventFocus*) ;
		gint name_entry_key_release_handler(GdkEventKey*) ;
		gint name_entry_button_release_handler(GdkEventButton*) ;
		gint name_entry_button_press_handler(GdkEventButton*) ;

		//---------------------------------------------------------------------------------------//
		// VisualTimeAxis Widgets
		Gtk::HBox other_button_hbox ;
		Gtk::Button hide_button ;
		Gtk::Button visual_button ;
		Gtk::Button size_button ;

		/** the name of this TimeAxis object */
		std::string time_axis_name ;
		
		//---------------------------------------------------------------------------------------//
		// Super class methods not handled by VisualTimeAxis
		
		/**
		 * Not handled by purely Visual TimeAxis
		 *
		 * @todo should VisualTimeAxis handle this?
		 */
		void show_timestretch (nframes_t start, nframes_t end);
		
		/**
		 * Not handle by purely visual TimeAxis
		 * @see show_timestratch
		 */
		virtual void hide_timestretch() ;
		
	private:
	
};

#endif /* __ardour_visual_time_axis_h__ */