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_highlight_insertion(int x
, int y
, int w
, int h
);
42 void draw_playback_cursor();
43 void draw_highlighting();
44 // User can either call draw or draw_overlays to copy a fresh
45 // canvas and just draw the overlays over it
47 void update_handles();
48 // Convert edit coords to transition coords
49 void get_transition_coords(int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
50 void get_handle_coords(Edit
*edit
,
56 void draw_title(Edit
*edit
,
61 void draw_automation();
62 void draw_inout_points();
63 void draw_auto(Auto
*current
,
69 void draw_floatauto(Auto
*current
,
79 int test_auto(Auto
*current
,
87 int test_floatauto(Auto
*current
,
99 void draw_floatline(int center_pixel
,
111 int test_floatline(int center_pixel
,
121 void draw_toggleline(int center_pixel
,
127 int test_toggleline(Autos
*autos
,
136 int do_keyframes(int cursor_x
,
144 int do_float_autos(Track
*track
,
151 Auto
* &auto_instance
);
153 int do_toggle_autos(Track
*track
,
160 Auto
* &auto_instance
);
161 int do_autos(Track
*track
,
168 Auto
* &auto_instance
);
169 int do_plugin_autos(Track
*track
,
174 Plugin
* &keyframe_plugin
,
175 KeyFrame
* &keyframe_instance
);
178 void calculate_viewport(Track
*track
,
188 // Convert percentage position inside track to value.
189 // if is_toggle is 1, the result is either 0 or 1.
190 // if reference is nonzero and a FloatAuto,
191 // the result is made relative to the value in reference.
192 float percentage_to_value(float percentage
,
196 // Get x and y of a FloatAuto relative to center_pixel
197 void calculate_auto_position(double *x
,
207 void synchronize_autos(float change
, Track
*skip
, FloatAuto
*fauto
, int fill_gangs
);
210 void draw_brender_start();
211 void draw_loop_points();
212 void draw_transitions();
213 void draw_drag_handle();
215 void update_edit_handles(Edit
*edit
, int64_t edit_x
, int64_t edit_y
, int64_t edit_w
, int64_t edit_h
);
216 void update_transitions();
217 void update_keyframe_handles(Track
*track
);
218 // Draw everything to synchronize with the view
219 void draw(int force
= 0, int hide_cursor
= 1);
220 // Draw resources during index building
221 void draw_indexes(Asset
*asset
);
222 // Get location of edit on screen without boundary checking
223 void edit_dimensions(Edit
*edit
, int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
224 void track_dimensions(Track
*track
, int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
225 void plugin_dimensions(Plugin
*plugin
, int64_t &x
, int64_t &y
, int64_t &w
, int64_t &h
);
226 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
);
227 ResourcePixmap
* create_pixmap(Edit
*edit
, int64_t edit_x
, int64_t pixmap_x
, int64_t pixmap_w
, int64_t pixmap_h
);
228 int set_index_file(int flash
, Asset
*asset
);
229 void update_cursor();
230 // Get edit and handle the cursor is over
231 int do_edit_handles(int cursor_x
,
236 // Get plugin and handle the cursor if over
237 int do_plugin_handles(int cursor_x
,
242 // Get edit the cursor is over
243 int do_edits(int cursor_x
,
251 int do_tracks(int cursor_x
,
254 int test_resources(int cursor_x
, int cursor_y
);
255 int do_plugins(int cursor_x
,
261 int do_transitions(int cursor_x
,
266 int button_press_event();
267 int button_release_event();
268 int cursor_motion_event();
271 int repeat_event(int64_t duration
);
272 void start_dragscroll();
273 void stop_dragscroll();
274 int start_selection(double position
);
277 int64_t get_drop_position (int *is_insertion
, Edit
*moved_edit
, int64_t moved_edit_length
);
278 void end_edithandle_selection();
279 void end_pluginhandle_selection();
280 // Number of seconds spanned by the trackcanvas
281 double time_visible();
282 void update_drag_handle();
283 int update_drag_edit();
284 int update_drag_floatauto(int cursor_x
, int cursor_y
);
285 int update_drag_toggleauto(int cursor_x
, int cursor_y
);
286 int update_drag_auto(int cursor_x
, int cursor_y
);
287 int update_drag_pluginauto(int cursor_x
, int cursor_y
);
289 // Update status bar to reflect drag operation
290 void update_drag_caption();
295 // Display hourglass if timer expired
301 ArrayList
<ResourcePixmap
*> resource_pixmaps
;
302 // Allows overlays to get redrawn without redrawing the resources
303 BC_Pixmap
*background_pixmap
;
304 BC_DragWindow
*drag_popup
;
305 BC_Pixmap
*transition_pixmap
;
306 EditHandles
*edit_handles
;
307 // TransitionHandles *transition_handles;
308 BC_Pixmap
*keyframe_pixmap
;
309 BC_Pixmap
*camerakeyframe_pixmap
;
310 BC_Pixmap
*modekeyframe_pixmap
;
311 BC_Pixmap
*pankeyframe_pixmap
;
312 BC_Pixmap
*projectorkeyframe_pixmap
;
313 BC_Pixmap
*maskkeyframe_pixmap
;
315 // Currently in a drag scroll operation
317 // Don't stop hourglass if it was never started before the operation.
318 int hourglass_enabled
;
320 // Temporary for picon drawing
322 // Timer for hourglass
323 Timer
*resource_timer
;
341 int button_release();
342 int draw_playback_cursor(int pixel
, int flash
= 1);
343 int draw_loop_point(int64_t position
, int flash
);
344 void draw_paste_destination();
346 int draw_floating_handle(int flash
);
350 int end_translation();
352 // ====================================== cursor selection type
353 int auto_selected
; // 1 if automation selected
354 int translate_selected
; // 1 if video translation selected
356 int handle_selected
; // if a handle is selected
357 // 1 if not floating yet
359 int which_handle
; // 1 left or 2 right handle
360 int64_t handle_oldposition
; // original position of handle
361 int64_t handle_position
; // current position of handle
362 int handle_pixel
; // original pixel position of pointer in window
363 int handle_mode
; // Determined by which button was pressed
365 int current_end
; // end of selection 1 left 2 right
366 double selection_midpoint1
, selection_midpoint2
; // division between current ends
367 int region_selected
; // 1 if region selected
368 int selection_type
; // Whether an edit or a sample is selected
370 int auto_reposition(int &cursor_x
, int &cursor_y
, int64_t cursor_position
);
371 int update_selection(int64_t cursor_position
);
372 int update_handle_selection(int64_t cursor_position
);