4 #include "edlsession.h"
7 #include "mwindowgui.h"
9 #include "transition.h"
12 #include "transitionpopup.h"
15 TransitionLengthThread::TransitionLengthThread(MWindow *mwindow, TransitionPopup *popup)
18 this->mwindow = mwindow;
22 TransitionLengthThread::~TransitionLengthThread()
26 void TransitionLengthThread::run()
28 TransitionLengthDialog window(mwindow, popup->transition);
29 window.create_objects();
30 int result = window.run_window();
38 TransitionLengthDialog::TransitionLengthDialog(MWindow *mwindow, Transition *transition)
39 : BC_Window(PROGRAM_NAME ": Transition length",
40 mwindow->gui->get_abs_cursor_x(1) - 150,
41 mwindow->gui->get_abs_cursor_y(1) - 50,
50 this->mwindow = mwindow;
51 this->transition = transition;
54 TransitionLengthDialog::~TransitionLengthDialog()
59 void TransitionLengthDialog::create_objects()
61 add_subwindow(new BC_Title(10, 10, _("Seconds:")));
62 text = new TransitionLengthText(mwindow, this, 100, 10);
63 text->create_objects();
64 add_subwindow(new BC_OKButton(this));
68 int TransitionLengthDialog::close_event()
79 TransitionLengthText::TransitionLengthText(MWindow *mwindow,
80 TransitionLengthDialog *gui,
83 : BC_TumbleTextBox(gui,
84 (float)gui->transition->edit->track->from_units(gui->transition->length),
91 this->mwindow = mwindow;
95 int TransitionLengthText::handle_event()
97 double result = atof(get_text());
98 if(!EQUIV(result, gui->transition->length))
100 gui->transition->length = gui->transition->track->to_units(result, 1);
101 if(gui->transition->edit->track->data_type == TRACK_VIDEO) mwindow->restart_brender();
102 mwindow->sync_parameters(CHANGE_PARAMS);
103 mwindow->edl->session->default_transition_length = result;
104 mwindow->gui->update(0,
126 TransitionPopup::TransitionPopup(MWindow *mwindow, MWindowGUI *gui)
133 this->mwindow = mwindow;
137 TransitionPopup::~TransitionPopup()
139 // delete dialog_thread;
143 void TransitionPopup::create_objects()
145 length_thread = new TransitionLengthThread(mwindow, this);
146 // add_item(attach = new TransitionPopupAttach(mwindow, this));
147 add_item(show = new TransitionPopupShow(mwindow, this));
148 add_item(on = new TransitionPopupOn(mwindow, this));
149 add_item(length = new TransitionPopupLength(mwindow, this));
150 add_item(detach = new TransitionPopupDetach(mwindow, this));
153 int TransitionPopup::update(Transition *transition)
155 this->transition = transition;
156 show->set_checked(transition->show);
157 on->set_checked(transition->on);
159 sprintf(len_text, _("Length: %2.2f sec"), transition->track->from_units(transition->length));
160 length->set_text(len_text);
168 TransitionPopupAttach::TransitionPopupAttach(MWindow *mwindow, TransitionPopup *popup)
169 : BC_MenuItem(_("Attach..."))
171 this->mwindow = mwindow;
175 TransitionPopupAttach::~TransitionPopupAttach()
179 int TransitionPopupAttach::handle_event()
181 // popup->dialog_thread->start();
190 TransitionPopupDetach::TransitionPopupDetach(MWindow *mwindow, TransitionPopup *popup)
191 : BC_MenuItem(_("Detach"))
193 this->mwindow = mwindow;
197 TransitionPopupDetach::~TransitionPopupDetach()
201 int TransitionPopupDetach::handle_event()
203 mwindow->detach_transition(popup->transition);
208 TransitionPopupOn::TransitionPopupOn(MWindow *mwindow, TransitionPopup *popup)
209 : BC_MenuItem(_("On"))
211 this->mwindow = mwindow;
215 TransitionPopupOn::~TransitionPopupOn()
219 int TransitionPopupOn::handle_event()
221 popup->transition->on = !get_checked();
222 mwindow->sync_parameters(CHANGE_EDL);
231 TransitionPopupShow::TransitionPopupShow(MWindow *mwindow, TransitionPopup *popup)
232 : BC_MenuItem(_("Show"))
234 this->mwindow = mwindow;
238 TransitionPopupShow::~TransitionPopupShow()
242 int TransitionPopupShow::handle_event()
244 mwindow->show_plugin(popup->transition);
255 TransitionPopupLength::TransitionPopupLength(MWindow *mwindow, TransitionPopup *popup)
256 : BC_MenuItem(_("Length"))
258 this->mwindow = mwindow;
262 TransitionPopupLength::~TransitionPopupLength()
266 int TransitionPopupLength::handle_event()
268 popup->length_thread->start();