rework keyframe hide popup, keyframe auto render, textbox set_selection wide text
[goodguy/history.git] / cinelerra-5.1 / cinelerra / plugin.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 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 PLUGIN_H
23 #define PLUGIN_H
24
25 #include <stdio.h>
26 #include <stdint.h>
27
28 #include "guicast.h"
29 #include "edit.h"
30 #include "edl.inc"
31 #include "filexml.inc"
32 #include "keyframe.inc"
33 #include "keyframes.inc"
34 #include "module.inc"
35 #include "plugin.inc"
36 #include "pluginset.inc"
37 #include "pluginpopup.inc"
38 #include "pluginserver.inc"
39 #include "sharedlocation.h"
40 #include "virtualnode.inc"
41
42 class PluginOnToggle;
43
44
45
46 // Plugin is inherited by Transition, Plugins
47 class Plugin : public Edit
48 {
49 public:
50 // Plugin which belongs to a transition.
51         Plugin(EDL *edl,
52                 Track *track,
53                 const char *title);
54 // Called by  PluginSet::create_edit, PluginSet::insert_edit_after.
55 // Plugin can't take a track because it would get the edits pointer from
56 // the track instead of the plugin set.
57         Plugin(EDL *edl,
58                 PluginSet *plugin_set,
59                 const char *title);
60         virtual ~Plugin();
61
62         virtual Plugin& operator=(Plugin& edit);
63         virtual Edit& operator=(Edit& edit);
64
65 // Called by Edits::equivalent_output to override the keyframe behavior and check
66 // title.
67         void equivalent_output(Edit *edit, int64_t *result);
68
69 // Called by playable tracks to test for playable server.
70 // Descends the plugin tree without creating a virtual console.
71         int is_synthesis(int64_t position,
72                 int direction);
73
74         virtual int operator==(Plugin& that);
75         virtual int operator==(Edit& that);
76
77         virtual void copy_from(Edit *edit);
78
79
80 // Called by == operators, Edit::equivalent output
81 // to test title and keyframe of transition.
82         virtual int identical(Plugin *that);
83 // Called by render_gui.  Only need the track, position, and pluginset
84 // to determine a corresponding GUI.
85         int identical_location(Plugin *that);
86         virtual void synchronize_params(Edit *edit);
87 // Used by Edits::insert_edits and Plugin::shift to shift plugin keyframes
88         void shift_keyframes(int64_t position);
89
90         void change_plugin(char *title,
91                 SharedLocation *shared_location,
92                 int plugin_type);
93 // For synchronizing parameters
94         void copy_keyframes(Plugin *plugin);
95 // For copying to clipboard
96         void copy_keyframes(int64_t start,
97                 int64_t end,
98                 FileXML *file,
99                 int default_only,
100                 int autos_only);
101 // For editing automation.
102 // Returns the point to restart background rendering at.
103 // -1 means nothing changed.
104         void clear_keyframes(int64_t start, int64_t end);
105         void copy(int64_t start, int64_t end, FileXML *file);
106         void paste(FileXML *file);
107         void load(FileXML *file);
108 // Shift in time
109         void shift(int64_t difference);
110         void dump(FILE *fp=stdout);
111 // Called by PluginClient sequence to get rendering parameters
112         KeyFrame* get_prev_keyframe(int64_t position, int direction);
113         KeyFrame* get_next_keyframe(int64_t position, int direction);
114 // If this is a standalone plugin fill its location in the result.
115 // If it's shared copy the shared location into the result
116         void get_shared_location(SharedLocation *result);
117 // Get keyframes for editing with automatic creation if enabled.
118 // The direction is always assumed to be forward.
119         virtual KeyFrame* get_keyframe();
120 // Called by KeyFrameThread
121         int keyframe_exists(KeyFrame *ptr);
122         int silence();
123 // Calculate title given plugin type.  Used by TrackCanvas::draw_plugins
124         void calculate_title(char *string, int use_nudge);
125 // Resolve objects pointed to by shared_location
126         Track* get_shared_track();
127 //      Plugin* get_shared_plugin();
128
129 // Need to resample keyframes
130         void resample(double old_rate, double new_rate);
131
132 // The title of the plugin is stored and not the plugindb entry in case it doesn't exist in the db
133 // Title of the plugin currently attached
134         char title[BCTEXTLEN];
135         int plugin_type;
136 // In and out aren't used anymore.
137         int in, out;
138         int show, on;
139         PluginSet *plugin_set;
140
141 // Data for the plugin is stored here.  Default keyframe always exists.
142 // As for storing in PluginSet instead of Plugin:
143
144 // Each plugin needs a default keyframe of its own.
145 // The keyframes are meaningless except for the plugin they're stored in.
146 // Default keyframe has position = 0.
147 // Other keyframes have absolute position.
148         KeyFrames *keyframes;
149
150 // location of plugin if shared
151         SharedLocation shared_location;
152 };
153
154
155
156
157
158
159 #endif