00001 #ifndef TRACKCANVAS_H
00002 #define TRACKCANVAS_H
00003
00004 #include "asset.inc"
00005 #include "auto.inc"
00006 #include "autos.inc"
00007 #include "bctimer.inc"
00008 #include "edit.inc"
00009 #include "edithandles.inc"
00010 #include "floatauto.inc"
00011 #include "floatautos.inc"
00012 #include "guicast.h"
00013 #include "keyframe.inc"
00014 #include "mwindow.inc"
00015 #include "mwindowgui.inc"
00016 #include "resourcethread.inc"
00017 #include "plugin.inc"
00018 #include "plugintoggles.inc"
00019 #include "resourcepixmap.inc"
00020 #include "track.inc"
00021 #include "tracks.inc"
00022 #include "transitionhandles.inc"
00023 #include "keyframe.inc"
00024 #include "floatauto.inc"
00025
00026 class TrackCanvas : public BC_SubWindow
00027 {
00028 public:
00029 TrackCanvas(MWindow *mwindow, MWindowGUI *gui);
00030 ~TrackCanvas();
00031
00032 int create_objects();
00033 void resize_event();
00034 int drag_start_event();
00035 int drag_motion_event();
00036 int cursor_leave_event();
00037 int drag_stop_event();
00038 int keypress_event();
00039
00040
00041
00042 void draw_resources(int mode = 0,
00043 int indexes_only = 0,
00044 Asset *index_asset = 0);
00045 void draw_highlight_rectangle(int x, int y, int w, int h);
00046 void draw_highlight_insertion(int x, int y, int w, int h);
00047 void draw_playback_cursor();
00048 void draw_highlighting();
00049
00050
00051 void draw_overlays();
00052 void update_handles();
00053
00054 void get_transition_coords(int64_t &x, int64_t &y, int64_t &w, int64_t &h);
00055 void get_handle_coords(Edit *edit,
00056 int64_t &x,
00057 int64_t &y,
00058 int64_t &w,
00059 int64_t &h,
00060 int side);
00061 void draw_title(Edit *edit,
00062 int64_t edit_x,
00063 int64_t edit_y,
00064 int64_t edit_w,
00065 int64_t edit_h);
00066 void draw_automation();
00067 void draw_inout_points();
00068 void draw_auto(Auto *current,
00069 int x,
00070 int y,
00071 int center_pixel,
00072 int zoom_track,
00073 int color);
00074 void draw_floatauto(Auto *current,
00075 int x,
00076 int y,
00077 int in_x,
00078 int in_y,
00079 int out_x,
00080 int out_y,
00081 int center_pixel,
00082 int zoom_track,
00083 int color);
00084 int test_auto(Auto *current,
00085 int x,
00086 int y,
00087 int center_pixel,
00088 int zoom_track,
00089 int cursor_x,
00090 int cursor_y,
00091 int buttonpress);
00092 int test_floatauto(Auto *current,
00093 int x,
00094 int y,
00095 int in_x,
00096 int in_y,
00097 int out_x,
00098 int out_y,
00099 int center_pixel,
00100 int zoom_track,
00101 int cursor_x,
00102 int cursor_y,
00103 int buttonpress);
00104 void draw_floatline(int center_pixel,
00105 FloatAuto *previous,
00106 FloatAuto *current,
00107 FloatAutos *autos,
00108 double unit_start,
00109 double zoom_units,
00110 double yscale,
00111 int ax,
00112 int ay,
00113 int ax2,
00114 int ay2,
00115 int color,
00116 int autogrouptype);
00117 int test_floatline(int center_pixel,
00118 FloatAutos *autos,
00119 double unit_start,
00120 double zoom_units,
00121 double yscale,
00122 int x1,
00123 int x2,
00124 int cursor_x,
00125 int cursor_y,
00126 int buttonpress,
00127 int autogrouptype);
00128 void draw_toggleline(int center_pixel,
00129 int ax,
00130 int ay,
00131 int ax2,
00132 int ay2,
00133 int color);
00134 int test_toggleline(Autos *autos,
00135 int center_pixel,
00136 int x1,
00137 int y1,
00138 int x2,
00139 int y2,
00140 int cursor_x,
00141 int cursor_y,
00142 int buttonpress);
00143 int do_keyframes(int cursor_x,
00144 int cursor_y,
00145 int draw,
00146 int buttonpress,
00147 int &new_cursor,
00148 int &update_cursor,
00149 int &rerender);
00150
00151 int do_float_autos(Track *track,
00152 Autos *autos,
00153 int cursor_x,
00154 int cursor_y,
00155 int draw,
00156 int buttonpress,
00157 int color,
00158 Auto * &auto_instance,
00159 int autogrouptype);
00160 int do_toggle_autos(Track *track,
00161 Autos *autos,
00162 int cursor_x,
00163 int cursor_y,
00164 int draw,
00165 int buttonpress,
00166 int color,
00167 Auto * &auto_instance);
00168 int do_autos(Track *track,
00169 Autos *autos,
00170 int cursor_x,
00171 int cursor_y,
00172 int draw,
00173 int buttonpress,
00174 BC_Pixmap *pixmap,
00175 Auto * &auto_instance);
00176 int do_plugin_autos(Track *track,
00177 int cursor_x,
00178 int cursor_y,
00179 int draw,
00180 int buttonpress,
00181 Plugin* &keyframe_plugin,
00182 KeyFrame* &keyframe_instance);
00183
00184
00185 void calculate_viewport(Track *track,
00186 double &view_start,
00187 double &unit_start,
00188 double &view_end,
00189 double &unit_end,
00190 double &yscale,
00191 int ¢er_pixel,
00192 double &zoom_sample,
00193 double &zoom_units);
00194
00195
00196
00197
00198
00199 float percentage_to_value(float percentage,
00200 int is_toggle,
00201 Auto *reference,
00202 int autogrouptype);
00203
00204
00205 void calculate_auto_position(double *x,
00206 double *y,
00207 double *in_x,
00208 double *in_y,
00209 double *out_x,
00210 double *out_y,
00211 Auto *current,
00212 double unit_start,
00213 double zoom_units,
00214 double yscale,
00215 int autogrouptype);
00216 void synchronize_autos(float change, Track *skip, FloatAuto *fauto, int fill_gangs);
00217
00218
00219 void draw_brender_start();
00220 void draw_loop_points();
00221 void draw_transitions();
00222 void draw_drag_handle();
00223 void draw_plugins();
00224 void refresh_plugintoggles();
00225 void update_edit_handles(Edit *edit, int64_t edit_x, int64_t edit_y, int64_t edit_w, int64_t edit_h);
00226 void update_transitions();
00227 void update_keyframe_handles(Track *track);
00228
00229
00230
00231 void draw(int mode = 0, int hide_cursor = 1);
00232
00233 void draw_indexes(Asset *asset);
00234
00235 void edit_dimensions(Edit *edit, int64_t &x, int64_t &y, int64_t &w, int64_t &h);
00236 void track_dimensions(Track *track, int64_t &x, int64_t &y, int64_t &w, int64_t &h);
00237 void plugin_dimensions(Plugin *plugin, int64_t &x, int64_t &y, int64_t &w, int64_t &h);
00238 void get_pixmap_size(Edit *edit, int64_t edit_x, int64_t edit_w, int64_t &pixmap_x, int64_t &pixmap_w, int64_t &pixmap_h);
00239 ResourcePixmap* create_pixmap(Edit *edit, int64_t edit_x, int64_t pixmap_x, int64_t pixmap_w, int64_t pixmap_h);
00240 int set_index_file(int flash, Asset *asset);
00241 void update_cursor();
00242
00243 int do_edit_handles(int cursor_x,
00244 int cursor_y,
00245 int button_press,
00246 int &rerender,
00247 int &update_overlay,
00248 int &new_cursor,
00249 int &update_cursor);
00250
00251 int do_plugin_handles(int cursor_x,
00252 int cursor_y,
00253 int button_press,
00254 int &rerender,
00255 int &update_overlay,
00256 int &new_cursor,
00257 int &update_cursor);
00258
00259 int do_edits(int cursor_x,
00260 int cursor_y,
00261 int button_press,
00262 int drag_start,
00263 int &redraw,
00264 int &rerender,
00265 int &new_cursor,
00266 int &update_cursor);
00267 int do_tracks(int cursor_x,
00268 int cursor_y,
00269 int button_press);
00270 int test_resources(int cursor_x, int cursor_y);
00271 int do_plugins(int cursor_x,
00272 int cursor_y,
00273 int drag_start,
00274 int button_press,
00275 int &redraw,
00276 int &rerender);
00277 int do_transitions(int cursor_x,
00278 int cursor_y,
00279 int button_press,
00280 int &new_cursor,
00281 int &update_cursor);
00282 int button_press_event();
00283 int button_release_event();
00284 int cursor_motion_event();
00285 int activate();
00286 int deactivate();
00287 int repeat_event(int64_t duration);
00288 void start_dragscroll();
00289 void stop_dragscroll();
00290 int start_selection(double position);
00291 int drag_motion();
00292 int drag_stop();
00293 int64_t get_drop_position (int *is_insertion, Edit *moved_edit, int64_t moved_edit_length);
00294 void end_edithandle_selection();
00295 void end_pluginhandle_selection();
00296
00297 double time_visible();
00298 void update_drag_handle();
00299 int update_drag_edit();
00300 int update_drag_floatauto(int cursor_x, int cursor_y);
00301 int update_drag_toggleauto(int cursor_x, int cursor_y);
00302 int update_drag_auto(int cursor_x, int cursor_y);
00303 int update_drag_pluginauto(int cursor_x, int cursor_y);
00304
00305
00306 void update_drag_caption();
00307
00308 int get_title_h();
00309 int resource_h();
00310
00311
00312 void test_timer();
00313
00314
00315 MWindow *mwindow;
00316 MWindowGUI *gui;
00317 ArrayList<ResourcePixmap*> resource_pixmaps;
00318
00319 BC_Pixmap *background_pixmap;
00320 BC_DragWindow *drag_popup;
00321 BC_Pixmap *transition_pixmap;
00322 EditHandles *edit_handles;
00323
00324 BC_Pixmap *keyframe_pixmap;
00325 BC_Pixmap *camerakeyframe_pixmap;
00326 BC_Pixmap *modekeyframe_pixmap;
00327 BC_Pixmap *pankeyframe_pixmap;
00328 BC_Pixmap *projectorkeyframe_pixmap;
00329 BC_Pixmap *maskkeyframe_pixmap;
00330
00331 int active;
00332
00333 int drag_scroll;
00334
00335 int hourglass_enabled;
00336
00337
00338 VFrame *temp_picon;
00339
00340 Timer *resource_timer;
00341
00342
00343 ArrayList<PluginOn*> plugin_on_toggles;
00344 ArrayList<PluginShow*> plugin_show_toggles;
00345
00346 ResourceThread *resource_thread;
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360 int button_release();
00361 int draw_playback_cursor(int pixel, int flash = 1);
00362 int draw_loop_point(int64_t position, int flash);
00363 void draw_paste_destination();
00364
00365 int draw_floating_handle(int flash);
00366
00367
00368 private:
00369 int end_translation();
00370
00371
00372 int auto_selected;
00373 int translate_selected;
00374
00375 int handle_selected;
00376
00377
00378 int which_handle;
00379 int64_t handle_oldposition;
00380 int64_t handle_position;
00381 int handle_pixel;
00382 int handle_mode;
00383
00384 int current_end;
00385 double selection_midpoint1, selection_midpoint2;
00386 int region_selected;
00387 int selection_type;
00388
00389 int auto_reposition(int &cursor_x, int &cursor_y, int64_t cursor_position);
00390 int update_selection(int64_t cursor_position);
00391 int update_handle_selection(int64_t cursor_position);
00392 };
00393
00394 #endif