r1014: Enable horizontal scrolling with the mouse wheel by pressing Ctrl.
[cinelerra_cv/ct.git] / cinelerra / edit.h
blob3cd6d4104442facedda7c1c44fce20f760a835de
1 #ifndef EDIT_H
2 #define EDIT_H
4 #include "asset.inc"
5 #include "edl.inc"
6 #include "guicast.h"
7 #include "edits.inc"
8 #include "filexml.inc"
9 #include "mwindow.inc"
10 #include "plugin.inc"
11 #include "track.inc"
12 #include "transition.inc"
14 // UNITS ARE SAMPLES FOR AUDIO / FRAMES FOR VIDEO
15 // zoom_units was mwindow->zoom_sample for AEdit
17 // Generic edit of something
19 class Edit : public ListItem<Edit>
21 public:
22 Edit(EDL *edl, Edits *edits);
23 Edit(EDL *edl, Track *track);
24 Edit();
25 virtual ~Edit();
27 void reset();
28 virtual void copy_from(Edit *edit);
29 virtual int identical(Edit &edit);
30 virtual Edit& operator=(Edit& edit);
31 // Called by Edits and PluginSet
32 virtual void equivalent_output(Edit *edit, int64_t *result);
33 virtual int operator==(Edit& edit);
34 // When inherited by a plugin need to resample keyframes
35 virtual void synchronize_params(Edit *edit);
36 // Used by Edits::insert_edits to shift plugin keyframes
37 virtual void shift_keyframes(int64_t position) {};
39 // Get size of frame to draw on timeline
40 double picon_w();
41 int picon_h();
42 double frame_w();
43 double frames_per_picon();
44 int copy(int64_t start, int64_t end, FileXML *xml, char *output_path);
45 // When inherited by a plugin need to resample keyframes
46 virtual void resample(double old_rate, double new_rate) {};
48 // Shift in time
49 virtual void shift(int64_t difference);
50 int shift_start_in(int edit_mode,
51 int64_t newposition,
52 int64_t oldposition,
53 int edit_edits,
54 int edit_labels,
55 int edit_plugins,
56 Edits *trim_edits);
57 int shift_start_out(int edit_mode,
58 int64_t newposition,
59 int64_t oldposition,
60 int edit_edits,
61 int edit_labels,
62 int edit_plugins,
63 Edits *trim_edits);
64 int shift_end_in(int edit_mode,
65 int64_t newposition,
66 int64_t oldposition,
67 int edit_edits,
68 int edit_labels,
69 int edit_plugins,
70 Edits *trim_edits);
71 int shift_end_out(int edit_mode,
72 int64_t newposition,
73 int64_t oldposition,
74 int edit_edits,
75 int edit_labels,
76 int edit_plugins,
77 Edits *trim_edits);
79 void insert_transition(char *title);
80 void detach_transition();
81 // Determine if silence depending on existance of asset or plugin title
82 virtual int silence();
84 // Media edit information
85 // Units are native units for the track.
86 // Start of edit in source file normalized to project sample rate.
87 // Normalized because all the editing operations clip startsource relative
88 // to the project sample rate;
89 int64_t startsource;
90 // Start of edit in project file.
91 int64_t startproject;
92 // # of units in edit.
93 int64_t length;
94 // Channel or layer of source
95 int channel;
96 // ID for resource pixmaps
97 int id;
98 // User defined title for timeline
99 char user_title[BCTEXTLEN];
102 // Transition if one is present at the beginning of this edit
103 // This stores the length of the transition
104 Transition *transition;
105 EDL *edl;
107 Edits *edits;
109 Track *track;
111 // Asset is 0 if silence, otherwise points an object in edl->assets
112 Asset *asset;
127 // ============================= initialization
129 int load_properties(FileXML *xml, int64_t &startproject);
130 virtual int load_properties_derived(FileXML *xml) {};
132 // ============================= drawing
134 virtual int draw(int flash, int center_pixel, int x, int w, int y, int h, int set_index_file) {};
135 virtual int set_index_file(int flash, int center_pixel, int x, int y, int w, int h) {};
136 int draw_transition(int flash, int center_pixel, int x, int w, int y, int h, int set_index_file);
138 int draw_handles(BC_SubWindow *canvas, float view_start, float view_units, float zoom_units, int view_pixels, int center_pixel);
139 int draw_titles(BC_SubWindow *canvas, float view_start, float zoom_units, int view_pixels, int center_pixel);
141 // ============================= editing
143 virtual int copy_properties_derived(FileXML *xml, int64_t length_in_selection) {};
145 int popup_transition(float view_start, float zoom_units, int cursor_x, int cursor_y);
147 // Return 1 if the left handle was selected 2 if the right handle was selected
148 int select_handle(float view_start, float zoom_units, int cursor_x, int cursor_y, int64_t &selection);
149 virtual int get_handle_parameters(int64_t &left, int64_t &right, int64_t &left_sample, int64_t &right_sample, float view_start, float zoom_units) {};
150 virtual int64_t get_source_end(int64_t default_);
151 int dump();
152 virtual int dump_derived() {};
160 #endif