fixup auto-connection of new MIDI tracks and MIDI tracks with newly-added audio ports
[ardour2.git] / gtk2_ardour / visual_time_axis.h
blobdf0a061ba65de01edcdb1e4fb5dfd5e222a309f0
1 /*
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.
20 #ifndef __ardour_visual_time_axis_h__
21 #define __ardour_visual_time_axis_h__
23 #include <gtkmm/box.h>
24 #include <gtkmm/button.h>
26 #include <gtkmm2ext/selector.h>
28 #include "ardour_dialog.h"
29 #include "route_ui.h"
30 #include "enums.h"
31 #include "time_axis_view.h"
32 #include "canvas.h"
34 namespace ARDOUR
36 class Session ;
39 class PublicEditor;
40 class ImageFrameView;
41 class ImageFrameTimeAxisView;
42 class MarkersTimeAxisView;
43 class TimeSelection;
44 class RegionSelection;
45 class MarkerTimeAxis;
46 class TimeAxisViewStrip;
48 /**
49 * Base Abstact Class for TimeAxis views that operate purely within the visual domain.
51 * This class provides many of the common methods required for visual TimeAxis views. The aim is
52 * to provide an abstract layer during the developmnt of the visual based time axis'. Many of these
53 * methods have a better home further up the class heirarchy, and in fact some are replication of
54 * methods found within RouteUI. This, however, has been required due to various problems with previous
55 * versions of g++, mainly 2.95, which are not correctly handling virtual methods, virtual base classes,
56 * and virtual methods when used with Multiple Inheritance. Perhaps these could be combined once the
57 * compilers all agree on hos do to do stuff...
59 class VisualTimeAxis : public TimeAxisView
61 public:
62 //---------------------------------------------------------------------------------------//
63 // Constructor / Desctructor
65 /**
66 * VisualTimeAxis Destructor
69 virtual ~VisualTimeAxis() ;
71 //---------------------------------------------------------------------------------------//
72 // Name/Id Accessors/Mutators
74 /**
75 * Returns the name of this TimeAxis
77 * @return the name of this TimeAxis
79 virtual std::string name() const ;
81 /**
82 * Sets the name of this TimeAxis
84 * @param name the new name of this TimeAxis
85 * @param src the identity of the object that initiated the change
87 virtual void set_time_axis_name(const std::string & name, void* src) ;
90 //---------------------------------------------------------------------------------------//
91 // ui methods & data
93 /**
94 * Sets the height of this TrackView to one of the defined TrackHeghts
96 * @param h the number of pixels to set the height to
98 virtual void set_height (uint32_t);
100 //---------------------------------------------------------------------------------------//
101 // Selection Methods
102 // selection methods are not handled by visual time axis object yet...
105 * Not implemented
107 virtual void set_selected_regionviews(RegionSelection&) ;
110 //---------------------------------------------------------------------------------//
111 // Emitted Signals
114 * Emitted when we have changed the gui, and what we have shanged
116 sigc::signal<void,const std::string &,void*> gui_changed ;
119 * Emitted when this Visual Time Axis has been removed
120 * This is different to the CatchDeletion signal in that this signal
121 * is emitted during the deletion of this Time Axis, and not during
122 * the destructor, this allows us to capture the source of the deletion
123 * event
125 sigc::signal<void,const std::string &,void*> VisualTimeAxisRemoved ;
128 * Emitted when we have changed the name of this TimeAxis
130 sigc::signal<void,const std::string &,const std::string &,void*> NameChanged ;
133 * Emitted when this time axis has been selected for removal
135 //sigc::signal<void,std::std::string,void*> VisualTimeAxisRemoved ;
137 //---------------------------------------------------------------------------------------//
138 // Constructor / Desctructor
141 * Abstract Constructor for base visual time axis classes
143 * @param name the name/Id of thie TimeAxis
144 * @param ed the Ardour PublicEditor
145 * @param sess the current session
146 * @param canvas the parent canvas object
148 VisualTimeAxis(const std::string & name, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas) ;
151 //---------------------------------------------------------------------------------------//
152 // Handle time axis removal
155 * Handles the Removal of this VisualTimeAxis
157 * @param src the identity of the object that initiated the change
159 virtual void remove_this_time_axis(void* src) ;
162 * Callback used to remove this time axis during the gtk idle loop
163 * This is used to avoid deleting the obejct while inside the remove_this_time_axis
164 * method
166 * @param ta the VisualTimeAxis to remove
167 * @param src the identity of the object that initiated the change
169 static gint idle_remove_this_time_axis(VisualTimeAxis* ta, void* src) ;
173 //---------------------------------------------------------------------------------------//
174 // ui methods & data
177 * Handle the visuals button click
180 void visual_click() ;
183 * Handle the hide buttons click
186 void hide_click() ;
189 * Allows the selection of a new color for this TimeAxis
192 virtual void select_track_color() ;
195 * Provides a color chooser for the selection of a new time axis color.
198 bool choose_time_axis_color() ;
201 * Sets the color of this TimeAxis to the specified color c
203 * @param c the new TimeAxis color
205 void set_time_axis_color(Gdk::Color c) ;
208 //---------------------------------------------------------------------------------------//
209 // Handle TimeAxis rename
212 * Construct a new prompt to receive a new name for this TimeAxis
214 * @see finish_time_axis_rename()
216 void start_time_axis_rename() ;
219 * Handles the new name for this TimeAxis from the name prompt
221 * @see start_time_axis_rename()
223 virtual void label_view() ;
226 //---------------------------------------------------------------------------------------//
227 // Handle name entry signals
229 void name_entry_changed() ;
230 bool name_entry_focus_out_handler(GdkEventFocus*) ;
231 bool name_entry_key_release_handler(GdkEventKey*) ;
232 bool name_entry_button_release_handler(GdkEventButton*) ;
233 bool name_entry_button_press_handler(GdkEventButton*) ;
235 //---------------------------------------------------------------------------------------//
236 // VisualTimeAxis Widgets
237 Gtk::HBox other_button_hbox ;
238 Gtk::Button hide_button ;
239 Gtk::Button visual_button ;
240 Gtk::Button size_button ;
242 /** the name of this TimeAxis object */
243 std::string time_axis_name ;
245 //---------------------------------------------------------------------------------------//
246 // Super class methods not handled by VisualTimeAxis
249 * Not handled by purely Visual TimeAxis
251 * @todo should VisualTimeAxis handle this?
253 void show_timestretch (nframes_t start, nframes_t end);
256 * Not handle by purely visual TimeAxis
257 * @see show_timestratch
259 virtual void hide_timestretch() ;
261 private:
265 #endif /* __ardour_visual_time_axis_h__ */