add sliders to cwdw proj/cam tools, edit id tweaks, deltrk shortcut tweak
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / edits.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008-2013 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef EDITS_H
23 #define EDITS_H
24
25
26 #include "asset.inc"
27 #include "assets.inc"
28 #include "edl.inc"
29 #include "guicast.h"
30 #include "edit.h"
31 #include "filexml.inc"
32 #include "linklist.h"
33 #include "track.inc"
34 #include "transition.inc"
35
36 // Generic list of edits of something
37
38 class Edits : public List<Edit>
39 {
40 public:
41         Edits(EDL *edl, Track *track);
42         virtual ~Edits();
43
44         void equivalent_output(Edits *edits, int64_t *result);
45         virtual void copy_from(Edits *edits);
46 // Insert edits from different EDL
47         void insert_edits(Edits *edits,
48                 int64_t position,
49                 int64_t min_length,
50                 int edit_autos);
51 // Insert asset from same EDL
52         void insert_asset(Asset *asset,
53                 EDL *nested_edl,
54                 int64_t length,
55                 int64_t sample,
56                 int track_number);
57 // Split edit containing position.
58 // Return the second edit in the split.
59         Edit* split_edit(int64_t position);
60 // Create a blank edit in the native data format
61         int clear_handle(double start,
62                 double end,
63                 int edit_plugins,
64                 int edit_autos,
65                 double &distance);
66         virtual Edit* create_edit() { return 0; };
67 // Insert a 0 length edit at the position
68         Edit* insert_new_edit(int64_t sample);
69         int save(FileXML *xml, const char *output_path);
70         int copy(int64_t start, int64_t end, FileXML *xml, const char *output_path);
71 // Clear region of edits
72         virtual void clear(int64_t start, int64_t end);
73 // Clear edits and plugins for a handle modification
74         virtual void clear_recursive(int64_t start,
75                 int64_t end,
76                 int edit_edits,
77                 int edit_labels,
78                 int edit_plugins,
79                 int edit_autos,
80                 Edits *trim_edits);
81         virtual void shift_keyframes_recursive(int64_t position, int64_t length);
82         virtual void shift_effects_recursive(int64_t position, int64_t length, int edit_autos);
83         void paste_silence(int64_t start, int64_t end);
84 // Returns the newly created edit
85         Edit *create_silence(int64_t start, int64_t end);
86
87         void resample(double old_rate, double new_rate);
88 // Shift edits on or after position by distance
89 // Return the edit now on the position.
90         virtual Edit* shift(int64_t position, int64_t difference);
91
92         EDL *edl;
93         Track *track;
94
95
96 // ================================== file operations
97
98         void load(FileXML *xml, int track_offset);
99         int load_edit(FileXML *xml, int64_t &startproject, int track_offset);
100
101         virtual Edit* append_new_edit() { return 0; }
102         virtual Edit* insert_edit_after(Edit *previous_edit) { return 0; }
103         virtual int load_edit_properties(FileXML *xml) { return 0; }
104
105
106 // ==================================== accounting
107
108         Edit* editof(int64_t position, int direction, int use_nudge);
109 // Return an edit if position is over an edit and the edit has a source file
110         Edit* get_playable_edit(int64_t position, int use_nudge);
111 //      int64_t total_length();
112         int64_t length();         // end position of last edit
113 // audio edit shorter than .5 frames is a glitch
114         int is_glitch(Edit *edit);
115
116 // ==================================== editing
117
118         int modify_handles(double oldposition, double newposition,
119                 int currentend, int edit_mode, int edit_edits, int edit_labels,
120                 int edit_plugins, int edit_autos, Edits *trim_edits, int group_id);
121
122         virtual int optimize();
123
124         virtual int clone_derived(Edit* new_edit, Edit* old_edit) { return 0; }
125 };
126
127
128
129 #endif