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__
24 #include <gtkmm/box.h>
25 #include <gtkmm/button.h>
27 #include <gtkmm2ext/selector.h>
29 #include "ardour_dialog.h"
32 #include "time_axis_view.h"
42 class ImageFrameTimeAxisView;
43 class MarkersTimeAxisView;
45 class RegionSelection;
47 class TimeAxisViewStrip;
50 * Base Abstact Class for TimeAxis views that operate purely within the visual domain.
52 * This class provides many of the common methods required for visual TimeAxis views. The aim is
53 * to provide an abstract layer during the developmnt of the visual based time axis'. Many of these
54 * methods have a better home further up the class heirarchy, and in fact some are replication of
55 * methods found within RouteUI. This, however, has been required due to various problems with previous
56 * versions of g++, mainly 2.95, which are not correctly handling virtual methods, virtual base classes,
57 * and virtual methods when used with Multiple Inheritance. Perhaps these could be combined once the
58 * compilers all agree on hos do to do stuff...
60 class VisualTimeAxis : public TimeAxisView
63 //---------------------------------------------------------------------------------------//
64 // Constructor / Desctructor
67 * VisualTimeAxis Destructor
70 virtual ~VisualTimeAxis() ;
72 //---------------------------------------------------------------------------------------//
73 // Name/Id Accessors/Mutators
76 * Returns the name of this TimeAxis
78 * @return the name of this TimeAxis
80 virtual std::string name() const ;
83 * Sets the name of this TimeAxis
85 * @param name the new name of this TimeAxis
86 * @param src the identity of the object that initiated the change
88 virtual void set_time_axis_name(const string & name, void* src) ;
91 //---------------------------------------------------------------------------------------//
95 * Sets the height of this TrackView to one of the defined TrackHeghts
97 * @param h the TrackHeight value to set
99 virtual void set_height (TrackHeight h);
101 //---------------------------------------------------------------------------------------//
103 // selection methods are not handled by visual time axis object yet...
108 virtual void set_selected_regionviews(RegionSelection&) ;
111 //---------------------------------------------------------------------------------//
115 * Emitted when we have changed the gui, and what we have shanged
117 sigc::signal<void,const string &,void*> gui_changed ;
120 * Emitted when this Visual Time Axis has been removed
121 * This is different to the GoingAway signal in that this signal
122 * is emitted during the deletion of this Time Axis, and not during
123 * the destructor, this allows us to capture the source of the deletion
126 sigc::signal<void,const string &,void*> VisualTimeAxisRemoved ;
129 * Emitted when we have changed the name of this TimeAxis
131 sigc::signal<void,const string &,const string &,void*> NameChanged ;
134 * Emitted when this time axis has been selected for removal
136 //sigc::signal<void,std::string,void*> VisualTimeAxisRemoved ;
138 //---------------------------------------------------------------------------------------//
139 // Constructor / Desctructor
142 * Abstract Constructor for base visual time axis classes
144 * @param name the name/Id of thie TimeAxis
145 * @param ed the Ardour PublicEditor
146 * @param sess the current session
147 * @param canvas the parent canvas object
149 VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas) ;
152 //---------------------------------------------------------------------------------------//
153 // Handle time axis removal
156 * Handles the Removal of this VisualTimeAxis
158 * @param src the identity of the object that initiated the change
160 virtual void remove_this_time_axis(void* src) ;
163 * Callback used to remove this time axis during the gtk idle loop
164 * This is used to avoid deleting the obejct while inside the remove_this_time_axis
167 * @param ta the VisualTimeAxis to remove
168 * @param src the identity of the object that initiated the change
170 static gint idle_remove_this_time_axis(VisualTimeAxis* ta, void* src) ;
174 //---------------------------------------------------------------------------------------//
178 * Handle the visuals button click
181 void visual_click() ;
184 * Handle the hide buttons click
190 * Allows the selection of a new color for this TimeAxis
193 virtual void select_track_color() ;
196 * Provides a color chooser for the selection of a new time axis color.
199 bool choose_time_axis_color() ;
202 * Sets the color of this TimeAxis to the specified color c
204 * @param c the new TimeAxis color
206 void set_time_axis_color(Gdk::Color c) ;
209 //---------------------------------------------------------------------------------------//
210 // Handle TimeAxis rename
213 * Construct a new prompt to receive a new name for this TimeAxis
215 * @see finish_time_axis_rename()
217 void start_time_axis_rename() ;
220 * Handles the new name for this TimeAxis from the name prompt
222 * @see start_time_axis_rename()
224 virtual void label_view() ;
227 //---------------------------------------------------------------------------------------//
228 // Handle name entry signals
230 void name_entry_changed() ;
231 gint name_entry_focus_out_handler(GdkEventFocus*) ;
232 gint name_entry_key_release_handler(GdkEventKey*) ;
233 gint name_entry_button_release_handler(GdkEventButton*) ;
234 gint name_entry_button_press_handler(GdkEventButton*) ;
236 //---------------------------------------------------------------------------------------//
237 // VisualTimeAxis Widgets
238 Gtk::HBox other_button_hbox ;
239 Gtk::Button hide_button ;
240 Gtk::Button visual_button ;
241 Gtk::Button size_button ;
243 /** the name of this TimeAxis object */
244 std::string time_axis_name ;
246 //---------------------------------------------------------------------------------------//
247 // Super class methods not handled by VisualTimeAxis
250 * Not handled by purely Visual TimeAxis
252 * @todo should VisualTimeAxis handle this?
254 void show_timestretch (nframes_t start, nframes_t end);
257 * Not handle by purely visual TimeAxis
258 * @see show_timestratch
260 virtual void hide_timestretch() ;
266 #endif /* __ardour_visual_time_axis_h__ */