7 #include "bezierauto.inc"
9 #include "edithandles.inc"
10 #include "floatauto.inc"
11 #include "floatautos.inc"
13 #include "mwindow.inc"
14 #include "mwindowgui.inc"
16 #include "resourcepixmap.inc"
19 #include "transitionhandles.inc"
21 class TrackCanvas
: public BC_SubWindow
24 TrackCanvas(MWindow
*mwindow
, MWindowGUI
*gui
);
29 int drag_start_event();
30 int drag_motion_event();
31 int drag_stop_event();
33 void draw_resources(int force
= 0, // Redraw everything
34 int indexes_only
= 0, // Redraw only certain audio resources with indexes
35 Asset
*index_asset
= 0);
36 void draw_highlight_rectangle(int x
, int y
, int w
, int h
);
37 void draw_playback_cursor();
38 void draw_highlighting();
39 // User can either call draw or draw_overlays to copy a fresh
40 // canvas and just draw the overlays over it
42 void update_handles();
43 // Convert edit coords to transition coords
44 void get_transition_coords(int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
45 void get_handle_coords(Edit
*edit
,
51 void draw_title(Edit
*edit
,
56 void draw_automation();
57 void draw_inout_points();
58 void draw_auto(Auto
*current
,
64 void draw_floatauto(Auto
*current
,
74 int test_auto(Auto
*current
,
82 int test_floatauto(Auto
*current
,
94 void draw_floatline(int center_pixel
,
106 int test_floatline(int center_pixel
,
116 void draw_toggleline(int center_pixel
,
122 int test_toggleline(Autos
*autos
,
131 int do_keyframes(int cursor_x
,
139 int do_float_autos(Track
*track
,
146 int do_toggle_autos(Track
*track
,
153 int do_autos(Track
*track
,
160 int do_plugin_autos(Track
*track
,
167 void calculate_viewport(Track
*track
,
177 void draw_brender_start();
178 void draw_loop_points();
179 void draw_transitions();
180 void draw_drag_handle();
182 void update_edit_handles(Edit
*edit
, int64_t edit_x
, int64_t edit_y
, int64_t edit_w
, int64_t edit_h
);
183 void update_transitions();
184 void update_keyframe_handles(Track
*track
);
185 void get_keyframe_sizes(Track
*track
, BezierAuto
*current
, int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
186 // Draw everything to synchronize with the view
187 void draw(int force
= 0, int hide_cursor
= 1);
188 // Draw resources during index building
189 void draw_indexes(Asset
*asset
);
190 // Get location of edit on screen without boundary checking
191 void edit_dimensions(Edit
*edit
, int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
192 void track_dimensions(Track
*track
, int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
193 void plugin_dimensions(Plugin
*plugin
, int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
194 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
);
195 ResourcePixmap
* create_pixmap(Edit
*edit
, int64_t edit_x
, int64_t pixmap_x
, int64_t pixmap_w
, int64_t pixmap_h
);
196 int set_index_file(int flash
, Asset
*asset
);
197 void update_cursor();
198 // Get edit and handle the cursor is over
199 int test_edit_handles(int cursor_x
,
204 // Get plugin and handle the cursor if over
205 int test_plugin_handles(int cursor_x
,
210 // Get edit the cursor is over
211 int test_edits(int cursor_x
,
219 int test_tracks(int cursor_x
,
222 int test_resources(int cursor_x
, int cursor_y
);
223 int test_plugins(int cursor_x
,
227 int test_transitions(int cursor_x
,
232 int button_press_event();
233 int button_release_event();
234 int cursor_motion_event();
237 int repeat_event(int64_t duration
);
238 void start_dragscroll();
239 void stop_dragscroll();
240 int start_selection(double position
);
243 void end_edithandle_selection();
244 void end_pluginhandle_selection();
245 // Number of seconds spanned by the trackcanvas
246 double time_visible();
247 void update_drag_handle();
248 int update_drag_edit();
249 int update_drag_floatauto(int cursor_x
, int cursor_y
);
250 int update_drag_toggleauto(int cursor_x
, int cursor_y
);
251 int update_drag_auto(int cursor_x
, int cursor_y
);
253 // Update status bar to reflect drag operation
254 void update_drag_caption();
261 ArrayList
<ResourcePixmap
*> resource_pixmaps
;
262 // Allows overlays to get redrawn without redrawing the resources
263 BC_Pixmap
*background_pixmap
;
264 BC_Pixmap
*drag_pixmap
;
265 BC_DragWindow
*drag_popup
;
266 BC_Pixmap
*transition_pixmap
;
267 EditHandles
*edit_handles
;
268 // TransitionHandles *transition_handles;
269 BC_Pixmap
*keyframe_pixmap
;
270 BC_Pixmap
*camerakeyframe_pixmap
;
271 BC_Pixmap
*modekeyframe_pixmap
;
272 BC_Pixmap
*pankeyframe_pixmap
;
273 BC_Pixmap
*projectorkeyframe_pixmap
;
274 BC_Pixmap
*maskkeyframe_pixmap
;
276 // Currently in a drag scroll operation
295 int button_release();
296 int draw_playback_cursor(int pixel
, int flash
= 1);
297 int draw_loop_point(int64_t position
, int flash
);
298 void draw_paste_destination();
300 int draw_floating_handle(int flash
);
304 int end_translation();
306 // ====================================== cursor selection type
307 int auto_selected
; // 1 if automation selected
308 int translate_selected
; // 1 if video translation selected
310 int handle_selected
; // if a handle is selected
311 // 1 if not floating yet
313 int which_handle
; // 1 left or 2 right handle
314 int64_t handle_oldposition
; // original position of handle
315 int64_t handle_position
; // current position of handle
316 int handle_pixel
; // original pixel position of pointer in window
317 int handle_mode
; // Determined by which button was pressed
319 int current_end
; // end of selection 1 left 2 right
320 double selection_midpoint1
, selection_midpoint2
; // division between current ends
321 int region_selected
; // 1 if region selected
322 int selection_type
; // Whether an edit or a sample is selected
324 int auto_reposition(int &cursor_x
, int &cursor_y
, int64_t cursor_position
);
325 int update_selection(int64_t cursor_position
);
326 int update_handle_selection(int64_t cursor_position
);