r999: maintainers added to README_en.
[cinelerra_cv/mob.git] / cinelerra / transition.C
blob28d7a67e89aea3c8dd12d2b87cfa4c96c19114b9
1 #include "edit.h"
2 #include "edits.h"
3 #include "errorbox.h"
4 #include "filexml.h"
5 #include "keyframes.h"
6 #include "mainundo.h"
7 #include "mwindow.h"
8 #include "mwindowgui.h"
9 #include "patch.h"
10 #include "plugindialog.h"
11 #include "pluginset.h"
12 #include "mainsession.h"
13 #include "track.h"
14 #include "trackcanvas.h"
15 #include "tracks.h"
16 #include "transition.h"
17 #include "transitionpopup.h"
18 #include <string.h>
21 TransitionMenuItem::TransitionMenuItem(MWindow *mwindow, int audio, int video)
22  : BC_MenuItem("Paste Transition")
24         this->audio = audio;
25         this->video = video;
28 TransitionMenuItem::~TransitionMenuItem()
32 int TransitionMenuItem::handle_event()
37 PasteTransition::PasteTransition(MWindow *mwindow, int audio, int video)
38  : Thread()
40         this->mwindow = mwindow;
41         this->audio = audio;
42         this->video = video;
45 PasteTransition::~PasteTransition()
49 void PasteTransition::run()
65 Transition::Transition(EDL *edl, Edit *edit, char *title, long unit_length)
66  : Plugin(edl, (PluginSet*)edit->edits, title)
68         this->edit = edit;
69         this->length = unit_length;
70 //printf("Transition::Transition %p %p %p %p\n", this, keyframes, keyframes->first, keyframes->last);
73 Transition::~Transition()
77 KeyFrame* Transition::get_keyframe()
79         return (KeyFrame*)keyframes->default_auto;
82 Transition& Transition::operator=(Transition &that)
84 //printf("Transition::operator= 1\n");
85         copy_from(&that);
86         return *this;
89 Plugin& Transition::operator=(Plugin &that)
91         copy_from((Transition*)&that);
92         return *this;
95 Edit& Transition::operator=(Edit &that)
97         copy_from((Transition*)&that);
98         return *this;
102 int Transition::operator==(Transition &that)
104         return identical(&that);
107 int Transition::operator==(Plugin &that)
109         return identical((Transition*)&that);
112 int Transition::operator==(Edit &that)
114         return identical((Transition*)&that);
118 void Transition::copy_from(Transition *that)
120         Plugin::copy_from(that);
123 int Transition::identical(Transition *that)
125         return this->length == that->length && Plugin::identical(that);
129 int Transition::reset_parameters()
131         return 0;
134 void Transition::save_xml(FileXML *file)
136         file->append_newline();
137         file->tag.set_title("TRANSITION");
138         file->tag.set_property("TITLE", title);
139         file->tag.set_property("LENGTH", length);
140         file->append_tag();
141         if(on)
142         {
143                 file->tag.set_title("ON");
144                 file->append_tag();
145                 file->tag.set_title("/ON");
146                 file->append_tag();
147         }
148         keyframes->copy(0, 0, file, 1, 0);
149         file->tag.set_title("/TRANSITION");
150         file->append_tag();
151         file->append_newline();
154 void Transition::load_xml(FileXML *file)
156         int result = 0;
157         file->tag.get_property("TITLE", title);
158         length = file->tag.get_property("LENGTH", length);
159         on = 0;
160         
161         do{
162                 result = file->read_tag();
163                 if(!result)
164                 {
165                         if(file->tag.title_is("/TRANSITION"))
166                         {
167                                 result = 1;
168                         }
169                         else
170                         if(file->tag.title_is("ON"))
171                         {
172                                 on = 1;
173                         }
174                         else
175                         if(file->tag.title_is("KEYFRAME"))
176                         {
177                                 keyframes->default_auto->load(file);;
178                         }
179                 }
180         }while(!result);
185 int Transition::popup_transition(int x, int y)
187 //      if(mwindow->session->tracks_vertical)
188 //              mwindow->gui->transition_popup->activate_menu(this, PROGRAM_NAME ": Transition", y, x);
189 //      else
190 //              mwindow->gui->transition_popup->activate_menu(this, PROGRAM_NAME ": Transition", x, y);
193 int Transition::update_derived()
195 // Redraw transition titles
198 int Transition::update_display()
200 // Don't draw anything during loads.
201         return 0;
204 char* Transition::default_title()
206         return "Transition";
209 void Transition::dump()
211         printf("       title: %s length: %d\n", title, length);