4 #include "edlsession.h"
6 #include "mwindowgui.h"
8 #include "transition.h"
11 #include "transitionpopup.h"
14 #define _(String) gettext(String)
15 #define gettext_noop(String) String
16 #define N_(String) gettext_noop (String)
18 TransitionLengthThread::TransitionLengthThread(MWindow *mwindow, TransitionPopup *popup)
21 this->mwindow = mwindow;
25 TransitionLengthThread::~TransitionLengthThread()
29 void TransitionLengthThread::run()
31 TransitionLengthDialog window(mwindow, popup->transition);
32 window.create_objects();
33 int result = window.run_window();
41 TransitionLengthDialog::TransitionLengthDialog(MWindow *mwindow, Transition *transition)
42 : BC_Window(PROGRAM_NAME ": Transition length",
43 mwindow->gui->get_abs_cursor_x() - 150,
44 mwindow->gui->get_abs_cursor_y() - 50,
53 this->mwindow = mwindow;
54 this->transition = transition;
57 TransitionLengthDialog::~TransitionLengthDialog()
62 void TransitionLengthDialog::create_objects()
64 add_subwindow(new BC_Title(10, 10, _("Seconds:")));
65 text = new TransitionLengthText(mwindow, this, 100, 10);
66 text->create_objects();
67 add_subwindow(new BC_OKButton(this));
71 int TransitionLengthDialog::close_event()
82 TransitionLengthText::TransitionLengthText(MWindow *mwindow,
83 TransitionLengthDialog *gui,
86 : BC_TumbleTextBox(gui,
87 (float)gui->transition->edit->track->from_units(gui->transition->length),
94 this->mwindow = mwindow;
98 int TransitionLengthText::handle_event()
100 double result = atof(get_text());
101 if(!EQUIV(result, gui->transition->length))
103 gui->transition->length = gui->transition->track->to_units(result, 1);
104 if(gui->transition->edit->track->data_type == TRACK_VIDEO) mwindow->restart_brender();
105 mwindow->sync_parameters(CHANGE_PARAMS);
106 mwindow->edl->session->default_transition_length = result;
122 TransitionPopup::TransitionPopup(MWindow *mwindow, MWindowGUI *gui)
129 this->mwindow = mwindow;
133 TransitionPopup::~TransitionPopup()
135 // delete dialog_thread;
139 void TransitionPopup::create_objects()
141 length_thread = new TransitionLengthThread(mwindow, this);
142 // add_item(attach = new TransitionPopupAttach(mwindow, this));
143 add_item(show = new TransitionPopupShow(mwindow, this));
144 add_item(on = new TransitionPopupOn(mwindow, this));
145 add_item(length = new TransitionPopupLength(mwindow, this));
146 add_item(detach = new TransitionPopupDetach(mwindow, this));
149 int TransitionPopup::update(Transition *transition)
151 this->transition = transition;
152 show->set_checked(transition->show);
153 on->set_checked(transition->on);
161 TransitionPopupAttach::TransitionPopupAttach(MWindow *mwindow, TransitionPopup *popup)
162 : BC_MenuItem(_("Attach..."))
164 this->mwindow = mwindow;
168 TransitionPopupAttach::~TransitionPopupAttach()
172 int TransitionPopupAttach::handle_event()
174 // popup->dialog_thread->start();
183 TransitionPopupDetach::TransitionPopupDetach(MWindow *mwindow, TransitionPopup *popup)
184 : BC_MenuItem(_("Detach"))
186 this->mwindow = mwindow;
190 TransitionPopupDetach::~TransitionPopupDetach()
194 int TransitionPopupDetach::handle_event()
196 mwindow->detach_transition(popup->transition);
201 TransitionPopupOn::TransitionPopupOn(MWindow *mwindow, TransitionPopup *popup)
202 : BC_MenuItem(_("On"))
204 this->mwindow = mwindow;
208 TransitionPopupOn::~TransitionPopupOn()
212 int TransitionPopupOn::handle_event()
214 popup->transition->on = !get_checked();
215 mwindow->sync_parameters(CHANGE_EDL);
224 TransitionPopupShow::TransitionPopupShow(MWindow *mwindow, TransitionPopup *popup)
225 : BC_MenuItem(_("Show"))
227 this->mwindow = mwindow;
231 TransitionPopupShow::~TransitionPopupShow()
235 int TransitionPopupShow::handle_event()
237 mwindow->show_plugin(popup->transition);
248 TransitionPopupLength::TransitionPopupLength(MWindow *mwindow, TransitionPopup *popup)
249 : BC_MenuItem(_("Length"))
251 this->mwindow = mwindow;
255 TransitionPopupLength::~TransitionPopupLength()
259 int TransitionPopupLength::handle_event()
261 popup->length_thread->start();