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_h__
22 #define __ardour_imageframe_time_axis_h__
25 #include <libgnomecanvas/libgnomecanvas.h>
27 #include "ardour_dialog.h"
29 #include "time_axis_view.h"
31 #include "visual_time_axis.h"
39 class ImageFrameView ;
40 class ImageFrameTimeAxisView ;
41 class MarkersTimeAxisView ;
45 * ImageFrameTimeAxis defines a visual time axis view for holding and arranging image items.
48 class ImageFrameTimeAxis : public VisualTimeAxis
51 //---------------------------------------------------------------------------------------//
52 // Constructor / Desctructor
55 * Constructs a new ImageFrameTimeAxis.
57 * @param track_id the track name/id
58 * @param ed the PublicEditor
59 * @param sess the current session
60 * @param canvas the parent canvas item
62 ImageFrameTimeAxis(std::string track_id, PublicEditor& ed, ARDOUR::Session& sess, Gtk::Widget *canvas) ;
66 * Responsible for destroying any child image items that may have been added to thie time axis
68 virtual ~ImageFrameTimeAxis() ;
70 //---------------------------------------------------------------------------------------//
74 * Sets the height of this TrackView to one of ths TrackHeghts
76 * @param h the TrackHeight value to set
78 virtual void set_height(TimeAxisView::TrackHeight) ;
81 * Sets the number of samples per unit that are used.
82 * This is used to determine the siezes of items upon this time axis
84 * @param spu the number of samples per unit
86 virtual void set_samples_per_unit(double spu) ;
89 * Returns the available height for images to be drawn onto
91 * @return the available height for an image item to be drawn onto
93 int get_image_display_height() ;
97 * Show the popup edit menu
99 * @param button the mouse button pressed
100 * @param time when to show the popup
101 * @param clicked_imageframe the ImageFrameItem that the event ocured upon, or 0 if none
102 * @param with_item true if an item has been selected upon the time axis, used to set context menu
104 void popup_imageframe_edit_menu(int button, int32_t time, ImageFrameView* clicked_imageframe, bool with_item) ;
107 //---------------------------------------------------------------------------------------//
108 // Marker Time Axis Methods
111 * Add a MarkerTimeAxis to the ilst of MarkerTimeAxis' associated with this ImageFrameTimeAxis
113 * @param marker_track the MarkerTimeAxis to add
114 * @param src the identity of the object that initiated the change
115 * @return true if the addition was a success,
118 bool add_marker_time_axis(MarkerTimeAxis* marker_track, void* src) ;
121 * Returns the named MarkerTimeAxis associated with this ImageFrameTimeAxis
123 * @param track_id the track_id of the MarkerTimeAxis to search for
124 * @return the named markerTimeAxis, or 0 if the named MarkerTimeAxis is not associated with this ImageFrameTimeAxis
126 MarkerTimeAxis* get_named_marker_time_axis(std::string track_id) ;
129 * Removes the named markerTimeAxis from those associated with this ImageFrameTimeAxis
131 * @param track_id the track id of the MarkerTimeAxis to remove
132 * @param src the identity of the object that initiated the change
133 * @return the removed MarkerTimeAxis
135 MarkerTimeAxis* remove_named_marker_time_axis(std::string track_id, void* src) ;
138 * Removes tav from the list of MarkerTimaAxis associated with this ImageFrameTimeAxis
140 * @param tav the TimeAxis to remove
141 * @param src the identity of the object that initiated the change
143 void remove_time_axis_view(MarkerTimeAxis* tav, void* src) ;
146 //---------------------------------------------------------------------------------------//
147 // Parent/Child helper object accessors
150 * Returns the view helper of this TimeAxis
152 * @return the view helper of this TimeAxis
154 ImageFrameTimeAxisView* get_view() ;
157 //---------------------------------------------------------------------------------//
160 /** Emitted when a Marker Time Axis is Added, or associated with, this time axis */
161 sigc::signal<void,MarkerTimeAxis*,void*> MarkerTimeAxisAdded ;
163 /** Emitted when a Marker Time Axis is removed, from this time axis */
164 sigc::signal<void,std::string,void*> MarkerTimeAxisRemoved ;
170 * convenience method to select a new track color and apply it to the view and view items
173 void select_track_color() ;
176 * Handles the building of the popup menu
178 virtual void build_display_menu() ;
181 * handles the building of the ImageFrameView sub menu
183 void create_imageframe_menu() ;
185 /* We may have multiple marker views, but each marker view should only be associated with one timeaxisview */
186 typedef std::list<MarkerTimeAxis*> MarkerTimeAxisList ;
187 MarkerTimeAxisList marker_time_axis_list;
189 /* the TimeAxis view helper */
190 ImageFrameTimeAxisView *view ;
192 // popup menu widgets
193 Gtk::Menu *image_action_menu ;
194 Gtk::Menu *imageframe_menu ;
195 Gtk::Menu *imageframe_item_menu ;
197 }; /* class ImageFrameTimeAxis */
199 #endif /* __ardour_imageframe_time_axis_h__ */