2 Copyright (C) 2003 Paul Davis
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.
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.
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.
21 #ifndef __ardour_visual_time_axis_h__
22 #define __ardour_visual_time_axis_h__
25 #include <gtkmm2ext/selector.h>
27 #include "ardour_dialog.h"
30 #include "time_axis_view.h"
40 class ImageFrameTimeAxisView;
41 class MarkersTimeAxisView;
43 class AudioRegionSelection;
45 class TimeAxisViewStrip;
48 * Base Abstact Class for TimeAxis views that operate purely within the visual domain.
50 * This class provides many of the common methods required for visual TimeAxis views. The aim is
51 * to provide an abstract layer during the developmnt of the visual based time axis'. Many of these
52 * methods have a better home further up the class heirarchy, and in fact some are replication of
53 * methods found within RouteUI. This, however, has been required due to various problems with previous
54 * versions of g++, mainly 2.95, which are not correctly handling virtual methods, virtual base classes,
55 * and virtual methods when used with Multiple Inheritance. Perhaps these could be combined once the
56 * compilers all agree on hos do to do stuff...
58 class VisualTimeAxis : public TimeAxisView
61 //---------------------------------------------------------------------------------------//
62 // Constructor / Desctructor
65 * VisualTimeAxis Destructor
68 virtual ~VisualTimeAxis() ;
70 //---------------------------------------------------------------------------------------//
71 // Name/Id Accessors/Mutators
74 * Returns the name of this TimeAxis
76 * @return the name of this TimeAxis
78 virtual std::string name() const ;
81 * Sets the name of this TimeAxis
83 * @param name the new name of this TimeAxis
84 * @param src the identity of the object that initiated the change
86 virtual void set_time_axis_name(std::string name, void* src) ;
89 //---------------------------------------------------------------------------------------//
93 * Sets the height of this TrackView to one of the defined TrackHeghts
95 * @param h the TrackHeight value to set
97 virtual void set_height (TrackHeight h);
99 //---------------------------------------------------------------------------------------//
101 // selection methods are not handled by visual time axis object yet...
106 virtual void set_selected_regionviews(AudioRegionSelection&) ;
109 //---------------------------------------------------------------------------------//
113 * Emitted when we have changed the gui, and what we have shanged
115 sigc::signal<void,string,void*> gui_changed ;
118 * Emitted when this Visual Time Axis has been removed
119 * This is different to the GoingAway signal in that this signal
120 * is emitted during the deletion of this Time Axis, and not during
121 * the destructor, this allows us to capture the source of the deletion
124 sigc::signal<void,std::string,void*> VisualTimeAxisRemoved ;
127 * Emitted when we have changed the name of this TimeAxis
129 sigc::signal<void,std::string,std::string,void*> NameChanged ;
132 * Emitted when this time axis has been selected for removal
134 //sigc::signal<void,std::string,void*> VisualTimeAxisRemoved ;
136 //---------------------------------------------------------------------------------------//
137 // Constructor / Desctructor
140 * Abstract Constructor for base visual time axis classes
142 * @param name the name/Id of thie TimeAxis
143 * @param ed the Ardour PublicEditor
144 * @param sess the current session
145 * @param canvas the parent canvas object
147 VisualTimeAxis(std::string name, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas) ;
150 //---------------------------------------------------------------------------------------//
151 // Handle time axis removal
154 * Handles the Removal of this VisualTimeAxis
156 * @param src the identity of the object that initiated the change
158 virtual void remove_this_time_axis(void* src) ;
161 * Callback used to remove this time axis during the gtk idle loop
162 * This is used to avoid deleting the obejct while inside the remove_this_time_axis
165 * @param ta the VisualTimeAxis to remove
166 * @param src the identity of the object that initiated the change
168 static gint idle_remove_this_time_axis(VisualTimeAxis* ta, void* src) ;
172 //---------------------------------------------------------------------------------------//
176 * Handle the visuals button click
179 void visual_click() ;
182 * Handle the hide buttons click
188 * Allows the selection of a new color for this TimeAxis
191 virtual void select_track_color() ;
194 * Provides a color chooser for the selection of a new time axis color.
197 bool choose_time_axis_color() ;
200 * Sets the color of this TimeAxis to the specified color c
202 * @param c the new TimeAxis color
204 void set_time_axis_color(Gdk::Color c) ;
207 //---------------------------------------------------------------------------------------//
208 // Handle TimeAxis rename
211 * Construct a new prompt to receive a new name for this TimeAxis
213 * @see finish_time_axis_rename()
215 void start_time_axis_rename() ;
218 * Handles the new name for this TimeAxis from the name prompt
220 * @see start_time_axis_rename()
222 virtual void label_view() ;
225 //---------------------------------------------------------------------------------------//
226 // Handle name entry signals
228 void name_entry_changed() ;
229 gint name_entry_focus_out_handler(GdkEventFocus*) ;
230 gint name_entry_key_release_handler(GdkEventKey*) ;
231 gint name_entry_button_release_handler(GdkEventButton*) ;
232 gint name_entry_button_press_handler(GdkEventButton*) ;
234 //---------------------------------------------------------------------------------------//
235 // VisualTimeAxis Widgets
236 Gtk::HBox other_button_hbox ;
237 Gtk::Button hide_button ;
238 Gtk::Button visual_button ;
239 Gtk::Button size_button ;
241 /** the name of this TimeAxis object */
242 std::string time_axis_name ;
244 /** used to get a new name for this TimeAxis */
245 ArdourPrompter* name_prompter ;
248 //---------------------------------------------------------------------------------------//
249 // Super class methods not handled by VisualTimeAxis
252 * Not handled by purely Visual TimeAxis
254 * @todo should VisualTimeAxis handle this?
256 void show_timestretch (jack_nframes_t start, jack_nframes_t end);
259 * Not handle by purely visual TimeAxis
260 * @see show_timestratch
262 virtual void hide_timestretch() ;
268 #endif /* __ardour_visual_time_axis_h__ */