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
26 #include "keyframes.h"
29 #include "mwindowgui.h"
31 #include "plugindialog.h"
32 #include "pluginset.h"
33 #include "mainsession.h"
35 #include "trackcanvas.h"
37 #include "transition.h"
38 #include "transitionpopup.h"
42 TransitionMenuItem::TransitionMenuItem(MWindow *mwindow, int audio, int video)
43 : BC_MenuItem(_("Paste Transition"))
49 TransitionMenuItem::~TransitionMenuItem()
53 int TransitionMenuItem::handle_event()
59 PasteTransition::PasteTransition(MWindow *mwindow, int audio, int video)
62 this->mwindow = mwindow;
67 PasteTransition::~PasteTransition()
71 void PasteTransition::run()
87 Transition::Transition(EDL *edl, Edit *edit, const char *title, long unit_length)
88 : Plugin(edl, (PluginSet*)edit->edits, title)
91 this->length = unit_length;
92 //printf("Transition::Transition %p %p %p %p\n", this, keyframes, keyframes->first, keyframes->last);
95 Transition::~Transition()
99 KeyFrame* Transition::get_keyframe()
101 return (KeyFrame*)keyframes->default_auto;
104 Transition& Transition::operator=(Transition &that)
106 //printf("Transition::operator= 1\n");
111 Plugin& Transition::operator=(Plugin &that)
113 copy_from((Transition*)&that);
117 Edit& Transition::operator=(Edit &that)
119 copy_from((Transition*)&that);
124 int Transition::operator==(Transition &that)
126 return identical(&that);
129 int Transition::operator==(Plugin &that)
131 return identical((Transition*)&that);
134 int Transition::operator==(Edit &that)
136 return identical((Transition*)&that);
140 void Transition::copy_from(Transition *that)
142 Plugin::copy_from(that);
145 int Transition::identical(Transition *that)
147 return this->length == that->length && Plugin::identical(that);
151 int Transition::reset_parameters()
156 void Transition::save_xml(FileXML *file)
158 file->append_newline();
159 file->tag.set_title("TRANSITION");
160 file->tag.set_property("TITLE", title);
161 file->tag.set_property("LENGTH", length);
164 file->tag.set_title("ON");
166 file->tag.set_title("/ON");
169 keyframes->copy(0, 0, file, 1, 0);
170 file->tag.set_title("/TRANSITION");
172 file->append_newline();
175 void Transition::load_xml(FileXML *file)
177 file->tag.get_property("TITLE", title);
178 Plugin::fix_plugin_title(title);
179 length = file->tag.get_property("LENGTH", length);
182 while( !file->read_tag() ) {
183 if( file->tag.title_is("/TRANSITION") ) break;
184 if( file->tag.title_is("ON") ) { on = 1; continue; }
185 if( file->tag.title_is("KEYFRAME") )
186 keyframes->default_auto->load(file);;
191 int Transition::popup_transition(int x, int y)
193 // if(mwindow->session->tracks_vertical)
194 // mwindow->gui->transition_popup->activate_menu(this, PROGRAM_NAME ": Transition", y, x);
196 // mwindow->gui->transition_popup->activate_menu(this, PROGRAM_NAME ": Transition", x, y);
200 int Transition::update_derived()
202 // Redraw transition titles
206 int Transition::update_display()
208 // Don't draw anything during loads.
212 const char* Transition::default_title()
214 return _("Transition");
217 void Transition::dump(FILE *fp)
219 fprintf(fp," title: %s length: %jd\n", title, length);