Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

canvas.h

Go to the documentation of this file.
00001 #ifndef CANVAS_H
00002 #define CANVAS_H
00003 
00004 #include "edl.inc"
00005 #include "guicast.h"
00006 
00007 // Output for all X11 video
00008 
00009 class CanvasOutput;
00010 class CanvasXScroll;
00011 class CanvasYScroll;
00012 class CanvasPopup;
00013 class CanvasToggleControls;
00014 
00015 // The EDL arguments can be set to 0 if the canvas_w and canvas_h are used
00016 class Canvas
00017 {
00018 public:
00019         Canvas(BC_WindowBase *subwindow, 
00020                 int x, 
00021                 int y, 
00022                 int w, 
00023                 int h,
00024                 int output_w,
00025                 int output_h,
00026                 int use_scrollbars,
00027                 int use_cwindow = 0,
00028                 int use_rwindow = 0,
00029                 int use_vwindow = 0); // Use menu different options for different windows
00030         virtual ~Canvas();
00031 
00032         void reset();
00033 // Get dimensions given a zoom
00034         void calculate_sizes(float aspect_ratio, 
00035                 int output_w, 
00036                 int output_h, 
00037                 float zoom, 
00038                 int &w, 
00039                 int &h);
00040 
00041         int create_objects(EDL *edl);
00042         void set_cursor(int cursor);
00043 // Start video playback
00044         void start_video();
00045         void stop_video();
00046 
00047 // Start single frame processing.  Causes the status indicator to update
00048         void start_single();
00049         void stop_single();
00050 
00051 // Processing or video playback changed.
00052         virtual void status_event() {};
00053 
00054 
00055         virtual void reset_camera() {};
00056         virtual void reset_projector() {};
00057         virtual void zoom_resize_window(float percentage) {};
00058         virtual int cursor_leave_event() { return 0; };
00059         virtual int cursor_enter_event() { return 0; };
00060         virtual int button_release_event() { return 0; };
00061         virtual int button_press_event();
00062         virtual int cursor_motion_event() { return 0; };
00063         virtual void draw_overlays() { };
00064         virtual void toggle_controls() { } ;
00065         virtual int get_cwindow_controls() { return 0; };
00066 // Provide canvas dimensions since a BC_Bitmap containing obsolete dimensions
00067 // is often the output being transferred to
00068         void get_transfers(EDL *edl, int &in_x, 
00069                 int &in_y, 
00070                 int &in_w, 
00071                 int &in_h,
00072                 int &out_x, 
00073                 int &out_y, 
00074                 int &out_w, 
00075                 int &out_h,
00076                 int canvas_w = -1,
00077                 int canvas_h = -1);
00078         void reposition_window(EDL *edl, int x, int y, int w, int h);
00079         virtual void reset_translation() {};
00080         virtual void close_source() {};
00081 // Updates the stores
00082         virtual void update_zoom(int x, int y, float zoom) {};
00083         void check_boundaries(EDL *edl, int &x, int &y, float &zoom);
00084         void update_scrollbars();
00085 // Get scrollbar positions relative to output.
00086 // No correction is done if output is smaller than canvas
00087         virtual int get_xscroll() { return 0; };
00088         virtual int get_yscroll() { return 0; };
00089         virtual float get_zoom() { return 0; };
00090 // Redraws the image
00091         virtual void draw_refresh() {};
00092 
00093 // Get top left offset of canvas relative to output.
00094 // Normally negative.  Can be positive if output is smaller than canvas.
00095         float get_x_offset(EDL *edl, 
00096                 int single_channel, 
00097                 float zoom_x, 
00098                 float conformed_w,
00099                 float conformed_h);
00100         float get_y_offset(EDL *edl, 
00101                 int single_channel, 
00102                 float zoom_y, 
00103                 float conformed_w,
00104                 float conformed_h);
00105         void get_zooms(EDL *edl, 
00106                 int single_channel, 
00107                 float &zoom_x, 
00108                 float &zoom_y,
00109                 float &conformed_w,
00110                 float &conformed_h);
00111         
00112         
00113 // Convert coord from output to canvas position, including
00114 // x and y scroll offsets
00115         void output_to_canvas(EDL *edl, int single_channel, float &x, float &y);
00116 // Convert coord from canvas to output position
00117         void canvas_to_output(EDL *edl, int single_channel, float &x, float &y);
00118 
00119 // Get dimensions of frame being sent to canvas
00120         virtual int get_output_w(EDL *edl);
00121         virtual int get_output_h(EDL *edl);
00122 // Get if scrollbars exist
00123         int scrollbars_exist();
00124 // Get cursor locations relative to canvas and not offset by scrollbars
00125         int get_cursor_x();
00126         int get_cursor_y();
00127         int get_buttonpress();
00128 
00129         BC_WindowBase *subwindow;
00130         CanvasOutput *canvas;
00131         CanvasXScroll *xscroll;
00132         CanvasYScroll *yscroll;
00133         CanvasPopup *canvas_menu;
00134         int x, y, w, h;
00135         int use_scrollbars;
00136         int use_cwindow;
00137         int use_rwindow;
00138         int use_vwindow;
00139 // Used in record monitor
00140         int output_w, output_h;
00141 // Store frame in native format after playback for refreshes
00142         VFrame *refresh_frame;
00143 // Results from last get_scrollbars
00144         int w_needed;
00145         int h_needed;
00146         int w_visible;
00147         int h_visible;
00148 // For cases where video is not enabled on the canvas but processing is 
00149 // occurring for a single frame, this causes the status to update.
00150         int is_processing;
00151 
00152 private:
00153         void get_scrollbars(EDL *edl, 
00154                 int &canvas_x, 
00155                 int &canvas_y, 
00156                 int &canvas_w, 
00157                 int &canvas_h);
00158 };
00159 
00160 
00161 class CanvasOutput : public BC_SubWindow
00162 {
00163 public:
00164         CanvasOutput(EDL *edl, 
00165             Canvas *canvas,
00166         int x,
00167         int y,
00168         int w,
00169         int h);
00170         ~CanvasOutput();
00171 
00172         int handle_event();
00173         int cursor_leave_event();
00174         int cursor_enter_event();
00175         int button_press_event();
00176         int button_release_event();
00177         int cursor_motion_event();
00178 
00179         EDL *edl;
00180         Canvas *canvas;
00181         int cursor_inside;
00182 };
00183 
00184 class CanvasXScroll : public BC_ScrollBar
00185 {
00186 public:
00187         CanvasXScroll(EDL *edl, 
00188                 Canvas *canvas, 
00189                 int x, 
00190                 int y, 
00191                 int length, 
00192                 int position, 
00193                 int handle_length, 
00194                 int pixels);
00195         ~CanvasXScroll();
00196 
00197         int handle_event();
00198 
00199         Canvas *canvas;
00200         EDL *edl;
00201 };
00202 
00203 class CanvasYScroll : public BC_ScrollBar
00204 {
00205 public:
00206         CanvasYScroll(EDL *edl, 
00207                 Canvas *canvas, 
00208                 int x, 
00209                 int y, 
00210                 int length, 
00211                 int position, 
00212                 int handle_length, 
00213                 int pixels);
00214         ~CanvasYScroll();
00215 
00216         int handle_event();
00217 
00218         Canvas *canvas;
00219         EDL *edl;
00220 };
00221 
00222 class CanvasPopup : public BC_PopupMenu
00223 {
00224 public:
00225         CanvasPopup(Canvas *canvas);
00226         ~CanvasPopup();
00227 
00228         void create_objects();
00229 
00230         Canvas *canvas;
00231         CanvasToggleControls *toggle_controls;
00232 };
00233 
00234 class CanvasPopupSize : public BC_MenuItem
00235 {
00236 public:
00237         CanvasPopupSize(Canvas *canvas, char *text, float percentage);
00238         ~CanvasPopupSize();
00239         int handle_event();
00240         Canvas *canvas;
00241         float percentage;
00242 };
00243 
00244 class CanvasPopupResetCamera : public BC_MenuItem
00245 {
00246 public:
00247         CanvasPopupResetCamera(Canvas *canvas);
00248         int handle_event();
00249         Canvas *canvas;
00250 };
00251 
00252 class CanvasPopupResetProjector : public BC_MenuItem
00253 {
00254 public:
00255         CanvasPopupResetProjector(Canvas *canvas);
00256         int handle_event();
00257         Canvas *canvas;
00258 };
00259 
00260 class CanvasToggleControls : public BC_MenuItem
00261 {
00262 public:
00263         CanvasToggleControls(Canvas *canvas);
00264         int handle_event();
00265         static char* calculate_text(int cwindow_controls);
00266         Canvas *canvas;
00267 };
00268 
00269 class CanvasPopupResetTranslation : public BC_MenuItem
00270 {
00271 public:
00272         CanvasPopupResetTranslation(Canvas *canvas);
00273         int handle_event();
00274         Canvas *canvas;
00275 };
00276 
00277 
00278 class CanvasPopupRemoveSource : public BC_MenuItem
00279 {
00280 public:
00281         CanvasPopupRemoveSource(Canvas *canvas);
00282         int handle_event();
00283         Canvas *canvas;
00284 };
00285 
00286 
00287 
00288 
00289 
00290 #endif

Generated on Sun Jan 8 13:38:51 2006 for Cinelerra-svn by  doxygen 1.4.4