4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
31 #include "filexml.inc"
32 #include "keyframe.inc"
33 #include "keyframes.inc"
36 #include "pluginset.inc"
37 #include "pluginpopup.inc"
38 #include "pluginserver.inc"
39 #include "sharedlocation.h"
40 #include "virtualnode.inc"
46 // Plugin is inherited by Transition, Plugins
47 class Plugin : public Edit
50 // Plugin which belongs to a transition.
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.
58 PluginSet *plugin_set,
62 // Called by Edits::equivalent_output to override the keyframe behavior and check
64 void equivalent_output(Edit *edit, int64_t *result);
66 const char* type_to_text(int type);
67 // Called by playable tracks to test for playable server.
68 // Descends the plugin tree without creating a virtual console.
69 int is_synthesis(int64_t position, int direction, int depth);
71 void init(const char *title,
72 int64_t unit_position, int64_t unit_length, int plugin_type,
73 SharedLocation *shared_location, KeyFrame *default_keyframe);
74 void copy_base(Edit *edit);
75 virtual void copy_from(Edit *edit);
78 // to test title and keyframe of transition.
79 virtual int identical(Plugin *that);
80 virtual void synchronize_params(Edit *edit);
81 // Used by Edits::insert_edits and Plugin::shift to shift plugin keyframes
82 void shift_keyframes(int64_t position);
84 void change_plugin(char *title,
85 SharedLocation *shared_location,
87 // For synchronizing parameters
88 void copy_keyframes(Plugin *plugin);
89 // For copying to clipboard
90 void copy_keyframes(int64_t start,
95 // For editing automation.
96 // Returns the point to restart background rendering at.
97 // -1 means nothing changed.
98 void clear_keyframes(int64_t start, int64_t end);
99 void copy(int64_t start, int64_t end, FileXML *file);
100 void paste(FileXML *file);
101 void load(FileXML *file);
103 void shift(int64_t difference);
104 void dump(FILE *fp=stdout);
105 static void fix_plugin_title(char *title);
106 // Called by PluginClient sequence to get rendering parameters
107 KeyFrame* get_prev_keyframe(int64_t position, int direction);
108 KeyFrame* get_next_keyframe(int64_t position, int direction);
109 // If this is a standalone plugin fill its location in the result.
110 // If it's shared copy the shared location into the result
111 void get_shared_location(SharedLocation *result);
112 // Get keyframes for editing with automatic creation if enabled.
113 // The direction is always assumed to be forward.
114 virtual KeyFrame* get_keyframe();
115 // Called by KeyFrameThread
116 int keyframe_exists(KeyFrame *ptr);
118 // Calculate title given plugin type. Used by TrackCanvas::draw_plugins
119 void calculate_title(char *string, int use_nudge);
120 // Resolve objects pointed to by shared_location
121 Track* get_shared_track();
122 // Plugin* get_shared_plugin();
124 // Need to resample keyframes
125 void resample(double old_rate, double new_rate);
127 // The title of the plugin is stored and not the plugindb entry in case it doesn't exist in the db
128 // Title of the plugin currently attached
129 char title[BCTEXTLEN];
131 // In and out aren't used anymore.
133 int show, on, gui_id;
134 PluginSet *plugin_set;
136 // Data for the plugin is stored here. Default keyframe always exists.
137 // As for storing in PluginSet instead of Plugin:
139 // Each plugin needs a default keyframe of its own.
140 // The keyframes are meaningless except for the plugin they're stored in.
141 // Default keyframe has position = 0.
142 // Other keyframes have absolute position.
143 KeyFrames *keyframes;
145 // location of plugin if shared
146 SharedLocation shared_location;