r1053: Add Russian translation.
[cinelerra_cv.git] / cinelerra / autos.h
blob722e3a30f1d28e4a1208fa5ba50e46cfb399d044
1 #ifndef AUTOS_H
2 #define AUTOS_H
4 // Base class for automation lists.
5 // Units are the native units for the track data type.
7 #include "auto.h"
8 #include "edl.inc"
9 #include "guicast.h"
10 #include "filexml.inc"
11 #include "track.inc"
13 #define AUTOS_VIRTUAL_HEIGHT 160
15 class Autos : public List<Auto>
17 public:
18 Autos(EDL *edl,
19 Track *track);
21 virtual ~Autos();
23 void resample(double old_rate, double new_rate);
25 virtual void create_objects();
26 void equivalent_output(Autos *autos, int64_t startproject, int64_t *result);
27 void copy_from(Autos *autos);
28 virtual Auto* new_auto();
29 // Get existing auto on or before position.
30 // If use_default is true, return default_auto if none exists
31 // on or before position.
32 // Return 0 if none exists and use_default is false.
33 // If &current is nonzero it is used as a starting point for searching.
34 Auto* get_prev_auto(int64_t position, int direction, Auto* &current, int use_default = 1);
35 Auto* get_prev_auto(int direction, Auto* &current);
36 Auto* get_next_auto(int64_t position, int direction, Auto* &current, int use_default = 1);
37 // Determine if a keyframe exists before creating it.
38 int auto_exists_for_editing(double position);
39 // Returns auto at exact position, null if non-existent. ignores autokeyframming and align on frames
40 Auto* get_auto_at_position(double position = -1);
42 // Get keyframe for editing with automatic creation if enabled
43 Auto* get_auto_for_editing(double position = -1);
45 // Insert keyframe at the point if it doesn't exist
46 Auto* insert_auto(int64_t position);
47 // Insert keyframe at the point if it doesn't exist
48 // Interpolate it insead of copying
49 Auto* insert_auto_for_editing(int64_t position);
50 void insert_track(Autos *automation,
51 int64_t start_unit,
52 int64_t length_units,
53 int replace_default);
54 virtual int load(FileXML *xml);
55 void paste(int64_t start,
56 int64_t length,
57 double scale,
58 FileXML *file,
59 int default_only);
60 void remove_nonsequential(Auto *keyframe);
61 void optimize();
63 // Returns a type enumeration
64 int get_type();
65 int64_t get_length();
66 virtual void get_extents(float *min,
67 float *max,
68 int *coords_undefined,
69 int64_t unit_start,
70 int64_t unit_end);
72 EDL *edl;
73 Track *track;
74 // Default settings if no autos.
75 // Having a persistent keyframe created problems when files were loaded and
76 // we wanted to keep only 1 auto.
77 // Default auto has position 0 except in effects, where multiple default autos
78 // exist.
79 Auto *default_auto;
81 int autoidx;
82 int autogrouptype;
83 int type;
87 virtual void dump();
94 int clear_all();
95 int insert(int64_t start, int64_t end);
96 int paste_silence(int64_t start, int64_t end);
97 int copy(int64_t start,
98 int64_t end,
99 FileXML *xml,
100 int default_only,
101 int autos_only);
102 // Stores the background rendering position in result
103 void clear(int64_t start,
104 int64_t end,
105 int shift_autos);
106 virtual void straighten(int64_t start, int64_t end);
107 int clear_auto(int64_t position);
108 int save(FileXML *xml);
109 virtual int slope_adjustment(int64_t ax, double slope);
110 int release_auto();
111 virtual int release_auto_derived() {};
112 Auto* append_auto();
113 int scale_time(float rate_scale, int scale_edits, int scale_autos, int64_t start, int64_t end);
115 // rendering utilities
116 int get_neighbors(int64_t start, int64_t end, Auto **before, Auto **after);
117 // 1 if automation doesn't change
118 virtual int automation_is_constant(int64_t start, int64_t end);
119 virtual double get_automation_constant(int64_t start, int64_t end);
120 int init_automation(int64_t &buffer_position,
121 int64_t &input_start,
122 int64_t &input_end,
123 int &automate,
124 double &constant,
125 int64_t input_position,
126 int64_t buffer_len,
127 Auto **before,
128 Auto **after,
129 int reverse);
131 int init_slope(Auto **current_auto,
132 double &slope_start,
133 double &slope_value,
134 double &slope_position,
135 int64_t &input_start,
136 int64_t &input_end,
137 Auto **before,
138 Auto **after,
139 int reverse);
141 int get_slope(Auto **current_auto,
142 double &slope_start,
143 double &slope_end,
144 double &slope_value,
145 double &slope,
146 int64_t buffer_len,
147 int64_t buffer_position,
148 int reverse);
150 int advance_slope(Auto **current_auto,
151 double &slope_start,
152 double &slope_value,
153 double &slope_position,
154 int reverse);
156 Auto* autoof(int64_t position); // return nearest auto equal to or after position
157 // 0 if after all autos
158 Auto* nearest_before(int64_t position); // return nearest auto before or 0
159 Auto* nearest_after(int64_t position); // return nearest auto after or 0
161 Auto *selected;
162 int skip_selected; // if selected was added
163 int64_t selected_position, selected_position_; // original position for moves
164 double selected_value, selected_value_; // original position for moves
165 float virtual_h; // height cursor moves to cover entire range when track height is less than this
166 int virtual_center;
167 int stack_number;
168 int stack_total;
176 #endif