7 #include "bezierauto.inc"
9 #include "edithandles.inc"
10 #include "floatauto.inc"
11 #include "floatautos.inc"
13 #include "keyframe.inc"
14 #include "mwindow.inc"
15 #include "mwindowgui.inc"
17 #include "resourcepixmap.inc"
20 #include "transitionhandles.inc"
21 #include "keyframe.inc"
22 #include "floatauto.inc"
24 class TrackCanvas
: public BC_SubWindow
27 TrackCanvas(MWindow
*mwindow
, MWindowGUI
*gui
);
32 int drag_start_event();
33 int drag_motion_event();
34 int cursor_leave_event();
35 int drag_stop_event();
37 void draw_resources(int force
= 0, // Redraw everything
38 int indexes_only
= 0, // Redraw only certain audio resources with indexes
39 Asset
*index_asset
= 0);
40 void draw_highlight_rectangle(int x
, int y
, int w
, int h
);
41 void draw_playback_cursor();
42 void draw_highlighting();
43 // User can either call draw or draw_overlays to copy a fresh
44 // canvas and just draw the overlays over it
46 void update_handles();
47 // Convert edit coords to transition coords
48 void get_transition_coords(int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
49 void get_handle_coords(Edit
*edit
,
55 void draw_title(Edit
*edit
,
60 void draw_automation();
61 void draw_inout_points();
62 void draw_auto(Auto
*current
,
68 void draw_floatauto(Auto
*current
,
78 int test_auto(Auto
*current
,
86 int test_floatauto(Auto
*current
,
98 void draw_floatline(int center_pixel
,
110 int test_floatline(int center_pixel
,
120 void draw_toggleline(int center_pixel
,
126 int test_toggleline(Autos
*autos
,
135 int do_keyframes(int cursor_x
,
143 int do_float_autos(Track
*track
,
150 Auto
* &auto_instance
);
152 int do_toggle_autos(Track
*track
,
159 Auto
* &auto_instance
);
160 int do_autos(Track
*track
,
167 Auto
* &auto_instance
);
168 int do_plugin_autos(Track
*track
,
173 Plugin
* &keyframe_plugin
,
174 KeyFrame
* &keyframe_instance
);
177 void calculate_viewport(Track
*track
,
187 void synchronize_autos(float change
, Track
*skip
, FloatAuto
*fauto
, int fill_gangs
);
190 void draw_brender_start();
191 void draw_loop_points();
192 void draw_transitions();
193 void draw_drag_handle();
195 void update_edit_handles(Edit
*edit
, int64_t edit_x
, int64_t edit_y
, int64_t edit_w
, int64_t edit_h
);
196 void update_transitions();
197 void update_keyframe_handles(Track
*track
);
198 void get_keyframe_sizes(Track
*track
, BezierAuto
*current
, int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
199 // Draw everything to synchronize with the view
200 void draw(int force
= 0, int hide_cursor
= 1);
201 // Draw resources during index building
202 void draw_indexes(Asset
*asset
);
203 // Get location of edit on screen without boundary checking
204 void edit_dimensions(Edit
*edit
, int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
205 void track_dimensions(Track
*track
, int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
206 void plugin_dimensions(Plugin
*plugin
, int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
207 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
);
208 ResourcePixmap
* create_pixmap(Edit
*edit
, int64_t edit_x
, int64_t pixmap_x
, int64_t pixmap_w
, int64_t pixmap_h
);
209 int set_index_file(int flash
, Asset
*asset
);
210 void update_cursor();
211 // Get edit and handle the cursor is over
212 int test_edit_handles(int cursor_x
,
217 // Get plugin and handle the cursor if over
218 int test_plugin_handles(int cursor_x
,
223 // Get edit the cursor is over
224 int test_edits(int cursor_x
,
232 int test_tracks(int cursor_x
,
235 int test_resources(int cursor_x
, int cursor_y
);
236 int test_plugins(int cursor_x
,
242 int test_transitions(int cursor_x
,
247 int button_press_event();
248 int button_release_event();
249 int cursor_motion_event();
252 int repeat_event(int64_t duration
);
253 void start_dragscroll();
254 void stop_dragscroll();
255 int start_selection(double position
);
258 void end_edithandle_selection();
259 void end_pluginhandle_selection();
260 // Number of seconds spanned by the trackcanvas
261 double time_visible();
262 void update_drag_handle();
263 int update_drag_edit();
264 int update_drag_floatauto(int cursor_x
, int cursor_y
);
265 int update_drag_toggleauto(int cursor_x
, int cursor_y
);
266 int update_drag_auto(int cursor_x
, int cursor_y
);
267 int update_drag_pluginauto(int cursor_x
, int cursor_y
);
269 // Update status bar to reflect drag operation
270 void update_drag_caption();
277 ArrayList
<ResourcePixmap
*> resource_pixmaps
;
278 // Allows overlays to get redrawn without redrawing the resources
279 BC_Pixmap
*background_pixmap
;
280 BC_DragWindow
*drag_popup
;
281 BC_Pixmap
*transition_pixmap
;
282 EditHandles
*edit_handles
;
283 // TransitionHandles *transition_handles;
284 BC_Pixmap
*keyframe_pixmap
;
285 BC_Pixmap
*camerakeyframe_pixmap
;
286 BC_Pixmap
*modekeyframe_pixmap
;
287 BC_Pixmap
*pankeyframe_pixmap
;
288 BC_Pixmap
*projectorkeyframe_pixmap
;
289 BC_Pixmap
*maskkeyframe_pixmap
;
291 // Currently in a drag scroll operation
295 // Temporary for picon drawing
311 int button_release();
312 int draw_playback_cursor(int pixel
, int flash
= 1);
313 int draw_loop_point(int64_t position
, int flash
);
314 void draw_paste_destination();
316 int draw_floating_handle(int flash
);
320 int end_translation();
322 // ====================================== cursor selection type
323 int auto_selected
; // 1 if automation selected
324 int translate_selected
; // 1 if video translation selected
326 int handle_selected
; // if a handle is selected
327 // 1 if not floating yet
329 int which_handle
; // 1 left or 2 right handle
330 int64_t handle_oldposition
; // original position of handle
331 int64_t handle_position
; // current position of handle
332 int handle_pixel
; // original pixel position of pointer in window
333 int handle_mode
; // Determined by which button was pressed
335 int current_end
; // end of selection 1 left 2 right
336 double selection_midpoint1
, selection_midpoint2
; // division between current ends
337 int region_selected
; // 1 if region selected
338 int selection_type
; // Whether an edit or a sample is selected
340 int auto_reposition(int &cursor_x
, int &cursor_y
, int64_t cursor_position
);
341 int update_selection(int64_t cursor_position
);
342 int update_handle_selection(int64_t cursor_position
);