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_imageframe_time_axis_view_h__
22 #define __ardour_imageframe_time_axis_view_h__
28 #include <gtk-canvas.h>
29 #include <jack/jack.h>
32 class ImageFrameTimeAxis ;
33 class ImageFrameView ;
34 class ImageFrameTimeAxisGroup ;
37 * ImageFrameTimeAxisView defines the time axis view helper
38 * This object is responsible for the time axis canvas view, and
39 * maintains the list of items that have been added to it
42 class ImageFrameTimeAxisView : public SigC::Object
45 //---------------------------------------------------------------------------------------//
46 // Constructor / Desctructor
49 * Constructs a new ImageFrameTimeAxisView.
51 * @param ifta the parent ImageFrameTimeAxis of this view helper
53 ImageFrameTimeAxisView(ImageFrameTimeAxis& ifta) ;
57 * Responsible for destroying all items tat may have been added to this time axis
59 ~ImageFrameTimeAxisView () ;
61 //---------------------------------------------------------------------------------------//
62 // Parent/Child helper object accessors
65 * Returns the TimeAxisView thatt his object is acting as a helper for
67 * @return the TimeAxisView that this object is acting as a view helper for
69 ImageFrameTimeAxis& trackview() { return _trackview; }
74 GtkCanvasItem* canvas_item() { return canvas_group; }
77 //---------------------------------------------------------------------------------------//
81 * Sets the height of the time axis view and the item upon it
83 * @param height the new height
85 int set_height(gdouble) ;
88 * Sets the position of this view helper on the canvas
90 * @param x the x position upon the canvas
91 * @param y the y position upon the canvas
93 int set_position(gdouble x, gdouble y) ;
96 * Sets the current samples per unit.
97 * this method tells each item upon the time axis of the change
99 * @param spu the new samples per canvas unit value
101 int set_samples_per_unit(gdouble spu) ;
104 * Returns the current samples per unit of this time axis view helper
106 * @return the current samples per unit of this time axis view helper
108 gdouble get_samples_per_unit() { return _samples_per_unit; }
111 * Sets the color of the items contained uopn this view helper
113 * @param color the new base color
115 void apply_color (GdkColor&) ;
117 //---------------------------------------------------------------------------------------//
118 // Child ImageFrameTimeAxisGroup Accessors/Mutators
121 * Adds an ImageFrameTimeAxisGroup to the list of items upon this time axis view helper
122 * the new ImageFrameTimeAxisGroup is returned
124 * @param group_id the unique id of the new group
125 * @param src the identity of the object that initiated the change
127 ImageFrameTimeAxisGroup* add_imageframe_group(std::string group_id, void* src) ;
130 * Returns the named ImageFrameTimeAxisGroup or 0 if the named group does not exist on this view helper
132 * @param group_id the unique id of the group to search for
133 * @return the named ImageFrameTimeAxisGroup, or 0 if it is not held upon this view
135 ImageFrameTimeAxisGroup* get_named_imageframe_group(std::string group_id) ;
138 * Removes and returns the named ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroup held by this view helper
140 * @param group_id the ImageFrameTimeAxisGroup unique id to remove
141 * @param src the identity of the object that initiated the change
142 * @see add_imageframe_group
144 ImageFrameTimeAxisGroup* remove_named_imageframe_group(std::string group_id, void* src) ;
147 * Removes the specified ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroups upon this TimeAxis.
149 * @param iftag the ImageFrameView to remove
151 void remove_imageframe_group(ImageFrameTimeAxisGroup* iftag, void* src) ;
154 //---------------------------------------------------------------------------------------//
155 // Selected group methods
158 * Sets the currently selected group upon this time axis
160 * @param ifv the item to set selected
162 void set_selected_imageframe_group(ImageFrameTimeAxisGroup* iftag) ;
165 * Clears the currently selected image frame group unpo this time axis
168 void clear_selected_imageframe_group() ;
171 * Returns the currently selected group upon this time axis
173 * @return the currently selected group upon this time axis
175 ImageFrameTimeAxisGroup* get_selected_imageframe_group() const ;
179 * Sets the duration of the selected ImageFrameView to the specified number of seconds
181 * @param sec the duration to set the ImageFrameView to, in seconds
183 void set_imageframe_duration_sec(double sec) ;
185 //---------------------------------------------------------------------------------------//
186 // Selected item methods
189 * Sets the currently selected image frame view item
191 * @param iftag the group the selected item is part
192 * @param ifv the selected item
194 void set_selected_imageframe_view(ImageFrameTimeAxisGroup* iftag, ImageFrameView* ifv) ;
197 * Clears the currently selected image frame view item
199 * @param clear_group set true if the selected parent group of the item should be cleared also
201 void clear_selected_imageframe_item(bool clear_group) ;
204 * Returns the currently selected image frame view item upon this time axis
206 * @return the currently selected image frame view item
208 ImageFrameView* get_selected_imageframe_view() const ;
213 * Removes the currently selected ImageFrameTimeAxisGroup
215 * @param src the identity of the object that initiated the change
216 * @see add_imageframe_group
218 void remove_selected_imageframe_item(void* src) ;
221 //---------------------------------------------------------------------------------//
224 /** Emitted when and ImageFrameGroup is added to this time axis */
225 SigC::Signal2<void,ImageFrameTimeAxisGroup*,void*> ImageFrameGroupAdded ;
227 /** Emitted when an ImageFrameGroup is removed from this time axis */
228 SigC::Signal2<void,std::string,void*> ImageFrameGroupRemoved ;
235 * convenience method to re-get the samples per unit and tell items upon this view
238 void reset_samples_per_unit() ;
241 * The list of ImageFrameViews held by this view helper */
242 typedef std::list<ImageFrameTimeAxisGroup *> ImageFrameGroupList ;
243 ImageFrameGroupList imageframe_groups ;
245 /** the currently selected time axis item upon this time axis */
246 ImageFrameTimeAxisGroup* selected_imageframe_group ;
249 * thecurrently selected image frame view
250 * we keep this here so that we only have one per view, not one per group
252 ImageFrameView* selected_imageframe_view ;
256 /* the TimeAxisView that this object is acting as the view helper for */
257 ImageFrameTimeAxis& _trackview ;
259 GtkCanvasItem *canvas_group ;
260 GtkCanvasItem *canvas_rect; /* frame around the whole thing */
262 /** the current samples per unit */
263 double _samples_per_unit ;
265 /* XXX why are these different? */
266 GdkColor region_color ;
267 uint32_t stream_base_color ;
269 } ; /* class ImageFrameTimeAxisView */
271 #endif /* __ardour_imageframe_time_axis_view_h__ */