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);
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)
179 file->tag.get_property("TITLE", title);
180 length = file->tag.get_property("LENGTH", length);
184 result = file->read_tag();
187 if(file->tag.title_is("/TRANSITION"))
192 if(file->tag.title_is("ON"))
197 if(file->tag.title_is("KEYFRAME"))
199 keyframes->default_auto->load(file);;
207 int Transition::popup_transition(int x, int y)
209 // if(mwindow->session->tracks_vertical)
210 // mwindow->gui->transition_popup->activate_menu(this, PROGRAM_NAME ": Transition", y, x);
212 // mwindow->gui->transition_popup->activate_menu(this, PROGRAM_NAME ": Transition", x, y);
216 int Transition::update_derived()
218 // Redraw transition titles
222 int Transition::update_display()
224 // Don't draw anything during loads.
228 const char* Transition::default_title()
230 return _("Transition");
233 void Transition::dump(FILE *fp)
235 fprintf(fp," title: %s length: %jd\n", title, length);