4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5 * Copyright (C) 2003-2016 Cinelerra CV contributors
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include "keyframes.h"
30 #include "mwindowgui.h"
32 #include "plugindialog.h"
33 #include "pluginset.h"
34 #include "mainsession.h"
36 #include "trackcanvas.h"
38 #include "transition.h"
39 #include "transitionpopup.h"
43 TransitionMenuItem::TransitionMenuItem(MWindow *mwindow, int audio, int video)
44 : BC_MenuItem(_("Paste Transition"))
50 TransitionMenuItem::~TransitionMenuItem()
54 int TransitionMenuItem::handle_event()
60 PasteTransition::PasteTransition(MWindow *mwindow, int audio, int video)
63 this->mwindow = mwindow;
68 PasteTransition::~PasteTransition()
72 void PasteTransition::run()
88 Transition::Transition(EDL *edl, Edit *edit, const char *title, long unit_length)
89 : Plugin(edl, (PluginSet*)edit->edits, title)
92 this->length = unit_length;
93 //printf("Transition::Transition %p %p %p %p\n", this, keyframes, keyframes->first, keyframes->last);
96 Transition::~Transition()
100 KeyFrame* Transition::get_keyframe()
102 return (KeyFrame*)keyframes->default_auto;
105 Transition& Transition::operator=(Transition &that)
107 //printf("Transition::operator= 1\n");
112 Plugin& Transition::operator=(Plugin &that)
114 copy_from((Transition*)&that);
118 Edit& Transition::operator=(Edit &that)
120 copy_from((Transition*)&that);
125 int Transition::operator==(Transition &that)
127 return identical(&that);
130 int Transition::operator==(Plugin &that)
132 return identical((Transition*)&that);
135 int Transition::operator==(Edit &that)
137 return identical((Transition*)&that);
141 void Transition::copy_from(Transition *that)
143 Plugin::copy_from(that);
146 int Transition::identical(Transition *that)
148 return this->length == that->length && Plugin::identical(that);
152 int Transition::reset_parameters()
157 void Transition::save_xml(FileXML *file)
159 file->append_newline();
160 file->tag.set_title("TRANSITION");
161 file->tag.set_property("TITLE", title);
162 file->tag.set_property("LENGTH", length);
165 file->tag.set_title("ON");
167 file->tag.set_title("/ON");
170 keyframes->copy(0, 0, file, 1, 0);
171 file->tag.set_title("/TRANSITION");
173 file->append_newline();
176 void Transition::load_xml(FileXML *file)
178 file->tag.get_property("TITLE", title);
179 Plugin::fix_plugin_title(title);
180 length = file->tag.get_property("LENGTH", length);
183 while( !file->read_tag() ) {
184 if( file->tag.title_is("/TRANSITION") ) break;
185 if( file->tag.title_is("ON") ) { on = 1; continue; }
186 if( file->tag.title_is("KEYFRAME") )
187 keyframes->default_auto->load(file);;
192 int Transition::popup_transition(int x, int y)
194 // if(mwindow->session->tracks_vertical)
195 // mwindow->gui->transition_popup->activate_menu(this, PROGRAM_NAME ": Transition", y, x);
197 // mwindow->gui->transition_popup->activate_menu(this, PROGRAM_NAME ": Transition", x, y);
201 int Transition::update_derived()
203 // Redraw transition titles
207 int Transition::update_display()
209 // Don't draw anything during loads.
213 const char* Transition::default_title()
215 return _("Transition");
218 void Transition::dump(FILE *fp)
220 fprintf(fp," title: %s length: %jd\n", title, length);