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_imageframe_time_axis_view_h__
21 #define __ardour_imageframe_time_axis_view_h__
26 #include <gdkmm/color.h>
28 #include <jack/jack.h>
33 class ImageFrameTimeAxis ;
34 class ImageFrameView ;
35 class ImageFrameTimeAxisGroup ;
38 * ImageFrameTimeAxisView defines the time axis view helper
39 * This object is responsible for the time axis canvas view, and
40 * maintains the list of items that have been added to it
43 class ImageFrameTimeAxisView : public sigc::trackable
46 //---------------------------------------------------------------------------------------//
47 // Constructor / Desctructor
50 * Constructs a new ImageFrameTimeAxisView.
52 * @param ifta the parent ImageFrameTimeAxis of this view helper
54 ImageFrameTimeAxisView(ImageFrameTimeAxis& ifta) ;
58 * Responsible for destroying all items tat may have been added to this time axis
60 ~ImageFrameTimeAxisView () ;
62 //---------------------------------------------------------------------------------------//
63 // Parent/Child helper object accessors
66 * Returns the TimeAxisView thatt his object is acting as a helper for
68 * @return the TimeAxisView that this object is acting as a view helper for
70 ImageFrameTimeAxis& trackview() { return _trackview; }
75 ArdourCanvas::Group * canvas_item() { return &canvas_group; }
78 //---------------------------------------------------------------------------------------//
82 * Sets the height of the time axis view and the item upon it
84 * @param height the new height
86 int set_height(gdouble) ;
89 * Sets the position of this view helper on the canvas
91 * @param x the x position upon the canvas
92 * @param y the y position upon the canvas
94 int set_position(gdouble x, gdouble y) ;
96 int set_frames_per_pixel (double);
97 double get_frames_per_pixel () { return _frames_per_pixel; }
100 * Sets the color of the items contained uopn this view helper
102 * @param color the new base color
104 void apply_color (Gdk::Color&) ;
106 //---------------------------------------------------------------------------------------//
107 // Child ImageFrameTimeAxisGroup Accessors/Mutators
110 * Adds an ImageFrameTimeAxisGroup to the list of items upon this time axis view helper
111 * the new ImageFrameTimeAxisGroup is returned
113 * @param group_id the unique id of the new group
114 * @param src the identity of the object that initiated the change
116 ImageFrameTimeAxisGroup* add_imageframe_group(std::string group_id, void* src) ;
119 * Returns the named ImageFrameTimeAxisGroup or 0 if the named group does not exist on this view helper
121 * @param group_id the unique id of the group to search for
122 * @return the named ImageFrameTimeAxisGroup, or 0 if it is not held upon this view
124 ImageFrameTimeAxisGroup* get_named_imageframe_group(std::string group_id) ;
127 * Removes and returns the named ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroup held by this view helper
129 * @param group_id the ImageFrameTimeAxisGroup unique id to remove
130 * @param src the identity of the object that initiated the change
131 * @see add_imageframe_group
133 ImageFrameTimeAxisGroup* remove_named_imageframe_group(std::string group_id, void* src) ;
136 * Removes the specified ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroups upon this TimeAxis.
138 * @param iftag the ImageFrameView to remove
140 void remove_imageframe_group(ImageFrameTimeAxisGroup* iftag, void* src) ;
143 //---------------------------------------------------------------------------------------//
144 // Selected group methods
147 * Sets the currently selected group upon this time axis
149 * @param ifv the item to set selected
151 void set_selected_imageframe_group(ImageFrameTimeAxisGroup* iftag) ;
154 * Clears the currently selected image frame group unpo this time axis
157 void clear_selected_imageframe_group() ;
160 * Returns the currently selected group upon this time axis
162 * @return the currently selected group upon this time axis
164 ImageFrameTimeAxisGroup* get_selected_imageframe_group() const ;
168 * Sets the duration of the selected ImageFrameView to the specified number of seconds
170 * @param sec the duration to set the ImageFrameView to, in seconds
172 void set_imageframe_duration_sec(double sec) ;
174 //---------------------------------------------------------------------------------------//
175 // Selected item methods
178 * Sets the currently selected image frame view item
180 * @param iftag the group the selected item is part
181 * @param ifv the selected item
183 void set_selected_imageframe_view(ImageFrameTimeAxisGroup* iftag, ImageFrameView* ifv) ;
186 * Clears the currently selected image frame view item
188 * @param clear_group set true if the selected parent group of the item should be cleared also
190 void clear_selected_imageframe_item(bool clear_group) ;
193 * Returns the currently selected image frame view item upon this time axis
195 * @return the currently selected image frame view item
197 ImageFrameView* get_selected_imageframe_view() const ;
202 * Removes the currently selected ImageFrameTimeAxisGroup
204 * @param src the identity of the object that initiated the change
205 * @see add_imageframe_group
207 void remove_selected_imageframe_item(void* src) ;
210 //---------------------------------------------------------------------------------//
213 /** Emitted when and ImageFrameGroup is added to this time axis */
214 sigc::signal<void,ImageFrameTimeAxisGroup*,void*> ImageFrameGroupAdded ;
216 /** Emitted when an ImageFrameGroup is removed from this time axis */
217 sigc::signal<void,std::string,void*> ImageFrameGroupRemoved ;
224 * convenience method to re-get the samples per unit and tell items upon this view
226 void reset_frames_per_pixel ();
229 * The list of ImageFrameViews held by this view helper */
230 typedef std::list<ImageFrameTimeAxisGroup *> ImageFrameGroupList ;
231 ImageFrameGroupList imageframe_groups ;
233 /** the currently selected time axis item upon this time axis */
234 ImageFrameTimeAxisGroup* selected_imageframe_group ;
237 * thecurrently selected image frame view
238 * we keep this here so that we only have one per view, not one per group
240 ImageFrameView* selected_imageframe_view ;
244 /* the TimeAxisView that this object is acting as the view helper for */
245 ImageFrameTimeAxis& _trackview ;
247 ArdourCanvas::Group canvas_group ;
248 ArdourCanvas::Rectangle canvas_rect; /* frame around the whole thing */
250 /** the current frames per pixel */
251 double _frames_per_pixel;
253 /* XXX why are these different? */
254 Gdk::Color region_color ;
255 uint32_t stream_base_color ;
257 } ; /* class ImageFrameTimeAxisView */
259 #endif /* __ardour_imageframe_time_axis_view_h__ */