remove <gtkmm/gtkmm.h> from all files, plus a small fix related to map/realize handling
[ardour.git] / gtk2_ardour / imageframe_view.h
1 /*
2     Copyright (C) 2003 Paul Davis 
3
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.
8
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.
13
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.
17
18     $Id$
19 */
20
21 #ifndef __gtk_ardour_imageframe_view_h__
22 #define __gtk_ardour_imageframe_view_h__
23
24 #include <string>
25 #include <gdkmm/color.h>
26 #include <libgnomecanvas/libgnomecanvas.h>
27 #include <sigc++/signal.h>
28 #include <list>
29
30 #include "canvas.h"
31 #include "enums.h"
32 #include "time_axis_view_item.h"
33 #include "marker_view.h"
34
35 class ImageFrameTimeAxis;
36 class ImageFrameTimeAxisGroup ;
37
38 /**
39  * An ImageFrameItem to display an image upon the ardour time line
40  *
41  */
42 class ImageFrameView : public TimeAxisViewItem
43 {
44         public:
45                 //---------------------------------------------------------------------------------------//
46                 // Constructor / Desctructor
47                 
48                 /**
49                  * Constructs a new ImageFrameView upon the canvas
50                  *
51                  * @param item_id unique id of this item
52                  * @param parent the parent canvas item
53                  * @param tv the time axis view that this item is to be placed upon
54                  * @param group the ImageFrameGroup that this item is a member of
55                  * @param spu the current samples per canvas unit
56                  * @param start the start frame ogf this item
57                  * @param duration the duration of this item
58                  * @param rgb_data the rgb data of the image
59                  * @param width the width of the original rgb_data image data
60                  * @param height the width of the origianl rgb_data image data
61                  * @param num_channels the number of color channels within rgb_data
62                  */
63                 ImageFrameView(std::string item_id,
64                          ArdourCanvas::Group *parent,
65                         ImageFrameTimeAxis *tv,
66                         ImageFrameTimeAxisGroup* group,
67                         double spu,
68                         Gdk::Color& base_color,
69                         jack_nframes_t start,
70                         jack_nframes_t duration,
71                         unsigned char* rgb_data,
72                         uint32_t width,
73                         uint32_t height,
74                         uint32_t num_channels) ;
75
76                 /**
77                  * Destructor
78                  * Reposible for removing and destroying all marker items associated with this item
79                  */
80                 ~ImageFrameView() ;
81                 
82                 static sigc::signal<void,ImageFrameView*> GoingAway;
83     
84                 //---------------------------------------------------------------------------------------//
85                 // Position and duration Accessors/Mutators
86                 
87                 /**
88                  * Set the position of this item to the specified value
89                  *
90                  * @param pos the new position
91                  * @param src the identity of the object that initiated the change
92                  * @return true if the position change was a success, false otherwise
93                  */
94                 virtual bool set_position(jack_nframes_t pos, void* src) ;
95                 
96                 /**
97                  * Sets the duration of this item
98                  *
99                  * @param dur the new duration of this item
100                  * @param src the identity of the object that initiated the change
101                  * @return true if the duration change was succesful, false otherwise
102                  */
103                 virtual bool set_duration(jack_nframes_t dur, void* src) ;
104                 
105                 //---------------------------------------------------------------------------------------//
106                 // Parent Component Methods
107                 
108                 /**
109                  * Sets the parent ImageFrameTimeAxisGroup of thie item
110                  * each Item must be part of exactly one group (or 'scene') upon the timeline
111                  *
112                  * @param group the new parent group
113                  */
114                 void set_time_axis_group(ImageFrameTimeAxisGroup* group) ;
115                 
116                 /**
117                  * Returns the parent group of this item
118                  *
119                  * @return the parent group of this item
120                  */
121                 ImageFrameTimeAxisGroup* get_time_axis_group() ;
122                 
123                 //---------------------------------------------------------------------------------------//
124                 // ui methods
125                 
126                 /**
127                  * Set the height of this item
128                  *
129                  * @param h the new height
130                  */
131                 virtual void set_height(gdouble h) ;
132         
133                 
134                 //---------------------------------------------------------------------------------------//
135                 // MarkerView methods
136
137                 /**
138                  * Adds a markerView to the list of marker views associated with this item
139                  *
140                  * @param item the marker item to add
141                  * @param src the identity of the object that initiated the change
142                  */
143                 void add_marker_view_item(MarkerView* item, void* src) ;
144                 
145                 /**
146                  * Removes the named marker view from the list of marker view associated with this item
147                  * The Marker view is not destroyed on removal, so the caller must handle the item themself
148                  *
149                  * @param markId the id/name of the item to remove
150                  * @param src the identity of the object that initiated the change
151                  * @return the removed marker item
152                  */
153                 MarkerView* remove_named_marker_view_item(std::string markId, void* src) ;
154                 
155                 /**
156                  * Removes item from the list of marker views assocaited with this item
157                  * This method will do nothing if item if not assiciated with this item
158                  * The Marker view is not destroyed on removal, so the caller must handle the item themself
159                  *
160                  * @param item the item to remove
161                  * @param src the identity of the object that initiated the change
162                  */
163                 void remove_marker_view_item(MarkerView* item, void* src) ;
164                 
165                 /**
166                  * Determines if the named marker is one of those associated with this item
167                  *
168                  * @param markId the id/name of the item to search for
169                  */
170                 bool has_marker_view_item(std::string markId) ;
171
172                 
173                 //---------------------------------------------------------------------------------//
174                 // Emitted Signals
175                 
176                 /** Emitted when a marker Item is added to this Item */
177                 sigc::signal<void,MarkerView*,void*> MarkerViewAdded ;
178                 
179                 /** Emitted when a Marker Item is added to this Item */
180                 sigc::signal<void,MarkerView*,void*> MarkerViewRemoved ;
181
182         private:
183                 /** the list of MarkerViews associated with this item */
184                 typedef std::list<MarkerView*> MarkerViewList ;
185                 MarkerViewList marker_view_list ;
186                 
187                 
188                 /** The parent group that this item is a member of */
189                 ImageFrameTimeAxisGroup* the_parent_group ;
190                 
191                 // ------- Image data -----------
192                 
193                 /** the image data that we display */
194                 //unsigned char* the_rgb_data ;
195                 
196                 /** The width of the image contained within the_rgb_data */
197                 uint32_t image_data_width ;
198                 
199                 /** The height of the image contained within the_rgb_data */
200                 uint32_t image_data_height ;
201                 
202                 /** the number of channels contained in the_rgb_data */
203                 uint32_t image_data_num_channels ;
204                 
205                 
206                 // ------- Our canvas element -----------
207                 
208                 /** the CanvasImageFrame to display the image */
209                 ArdourCanvas::ImageFrame* imageframe ;
210                 
211 } ; /* class ImageFrameView */
212
213 #endif /* __gtk_ardour_imageframe_view_h__ */