fix up file renaming code a little bit
[ArdourMidi.git] / gtk2_ardour / imageframe_time_axis.h
blob52c2f73e67b7ab3cca4719296af34c1d2f683bcd
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_imageframe_time_axis_h__
21 #define __ardour_imageframe_time_axis_h__
23 #include <list>
25 //#include <libgnomecanvas.h>
27 #include "ardour_dialog.h"
28 #include "enums.h"
29 #include "time_axis_view.h"
30 #include "canvas.h"
31 #include "visual_time_axis.h"
33 namespace ARDOUR
35 class Session ;
37 namespace Gtk {
38 class Menu;
41 class PublicEditor ;
42 class ImageFrameView ;
43 class ImageFrameTimeAxisView ;
44 class MarkersTimeAxisView ;
45 class MarkerTimeAxis;
47 /**
48 * ImageFrameTimeAxis defines a visual time axis view for holding and arranging image items.
51 class ImageFrameTimeAxis : public VisualTimeAxis
53 public:
54 //---------------------------------------------------------------------------------------//
55 // Constructor / Desctructor
57 /**
58 * Constructs a new ImageFrameTimeAxis.
60 * @param track_id the track name/id
61 * @param ed the PublicEditor
62 * @param sess the current session
63 * @param canvas the parent canvas item
65 ImageFrameTimeAxis(const std::string & track_id, PublicEditor& ed, ARDOUR::Session* sess, ArdourCanvas::Canvas& canvas) ;
67 /**
68 * Destructor
69 * Responsible for destroying any child image items that may have been added to thie time axis
71 virtual ~ImageFrameTimeAxis() ;
73 //---------------------------------------------------------------------------------------//
74 // ui methods & data
76 /**
77 * Sets the height of this TrackView to one of ths TrackHeghts
79 * @param h the number of pixels to set the height too
81 virtual void set_height(uint32_t h) ;
83 /**
84 * Sets the number of samples per unit that are used.
85 * This is used to determine the siezes of items upon this time axis
87 * @param spu the number of samples per unit
89 virtual void set_samples_per_unit(double spu) ;
91 /**
92 * Returns the available height for images to be drawn onto
94 * @return the available height for an image item to be drawn onto
96 int get_image_display_height() ;
99 /**
100 * Show the popup edit menu
102 * @param button the mouse button pressed
103 * @param time when to show the popup
104 * @param clicked_imageframe the ImageFrameItem that the event ocured upon, or 0 if none
105 * @param with_item true if an item has been selected upon the time axis, used to set context menu
107 void popup_imageframe_edit_menu(int button, int32_t time, ImageFrameView* clicked_imageframe, bool with_item) ;
110 //---------------------------------------------------------------------------------------//
111 // Marker Time Axis Methods
114 * Add a MarkerTimeAxis to the ilst of MarkerTimeAxis' associated with this ImageFrameTimeAxis
116 * @param marker_track the MarkerTimeAxis to add
117 * @param src the identity of the object that initiated the change
118 * @return true if the addition was a success,
119 * false otherwise
121 bool add_marker_time_axis(MarkerTimeAxis* marker_track, void* src) ;
124 * Returns the named MarkerTimeAxis associated with this ImageFrameTimeAxis
126 * @param track_id the track_id of the MarkerTimeAxis to search for
127 * @return the named markerTimeAxis, or 0 if the named MarkerTimeAxis is not associated with this ImageFrameTimeAxis
129 MarkerTimeAxis* get_named_marker_time_axis(const std::string & track_id) ;
132 * Removes the named markerTimeAxis from those associated with this ImageFrameTimeAxis
134 * @param track_id the track id of the MarkerTimeAxis to remove
135 * @param src the identity of the object that initiated the change
136 * @return the removed MarkerTimeAxis
138 MarkerTimeAxis* remove_named_marker_time_axis(const std::string & track_id, void* src) ;
141 * Potentially removes a MarkerTimeAxisView from the list of MarkerTimaAxis associated with this ImageFrameTimeAxis
143 * @param tav the TimeAxis to remove
144 * @param src the identity of the object that initiated the change
146 void remove_time_axis_view (TimeAxisView* av);
149 //---------------------------------------------------------------------------------------//
150 // Parent/Child helper object accessors
153 * Returns the view helper of this TimeAxis
155 * @return the view helper of this TimeAxis
157 ImageFrameTimeAxisView* get_view() ;
160 //---------------------------------------------------------------------------------//
161 // Emitted Signals
163 /** Emitted when a Marker Time Axis is Added, or associated with, this time axis */
164 sigc::signal<void,MarkerTimeAxis*,void*> MarkerTimeAxisAdded ;
166 /** Emitted when a Marker Time Axis is removed, from this time axis */
167 sigc::signal<void,std::string,void*> MarkerTimeAxisRemoved ;
169 protected:
171 private:
173 * convenience method to select a new track color and apply it to the view and view items
176 void select_track_color() ;
179 * Handles the building of the popup menu
181 virtual void build_display_menu() ;
184 * handles the building of the ImageFrameView sub menu
186 void create_imageframe_menu() ;
188 /* We may have multiple marker views, but each marker view should only be associated with one timeaxisview */
189 typedef std::list<MarkerTimeAxis*> MarkerTimeAxisList ;
190 MarkerTimeAxisList marker_time_axis_list;
192 /* the TimeAxis view helper */
193 ImageFrameTimeAxisView *view ;
195 // popup menu widgets
196 Gtk::Menu *image_action_menu ;
197 Gtk::Menu *imageframe_menu ;
198 Gtk::Menu *imageframe_item_menu ;
200 }; /* class ImageFrameTimeAxis */
202 #endif /* __ardour_imageframe_time_axis_h__ */