r974: configure: Check for presence of libtiff headers and libraries.
[cinelerra_cv.git] / cinelerra / transitionpopup.C
blobe9d1df4ac384ac2d92ded410a2a04f219667aab4
1 #include "clip.h"
2 #include "edit.h"
3 #include "edl.h"
4 #include "edlsession.h"
5 #include "language.h"
6 #include "mwindow.h"
7 #include "mwindowgui.h"
8 #include "plugin.h"
9 #include "transition.h"
10 #include "track.h"
11 #include "tracks.h"
12 #include "transitionpopup.h"
15 TransitionLengthThread::TransitionLengthThread(MWindow *mwindow, TransitionPopup *popup)
16  : Thread()
18         this->mwindow = mwindow;
19         this->popup = popup;
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,
42                                 300, 
43                                 100, 
44                                 -1, 
45                                 -1, 
46                                 0,
47                                 0, 
48                                 1)
50         this->mwindow = mwindow;
51         this->transition = transition;
54 TransitionLengthDialog::~TransitionLengthDialog()
58         
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));
65         show_window();
68 int TransitionLengthDialog::close_event()
70         set_done(0);
71         return 1;
79 TransitionLengthText::TransitionLengthText(MWindow *mwindow, 
80         TransitionLengthDialog *gui,
81         int x, 
82         int y)
83  : BC_TumbleTextBox(gui, 
84         (float)gui->transition->edit->track->from_units(gui->transition->length),
85         (float)0, 
86         (float)100, 
87         x,
88         y,
89         100)
91         this->mwindow = mwindow;
92         this->gui = gui;
95 int TransitionLengthText::handle_event()
97         double result = atof(get_text());
98         if(!EQUIV(result, gui->transition->length))
99         {
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->lock_window();
105                 mwindow->gui->update(0,
106                         1,
107                         0,
108                         0,
109                         0, 
110                         0,
111                         0);
112                 mwindow->gui->unlock_window();
113         }
114         
115         return 1;
128 TransitionPopup::TransitionPopup(MWindow *mwindow, MWindowGUI *gui)
129  : BC_PopupMenu(0, 
130                 0, 
131                 0, 
132                 "", 
133                 0)
135         this->mwindow = mwindow;
136         this->gui = gui;
139 TransitionPopup::~TransitionPopup()
141 //      delete dialog_thread;
145 void TransitionPopup::create_objects()
147         length_thread = new TransitionLengthThread(mwindow, this);
148 //      add_item(attach = new TransitionPopupAttach(mwindow, this));
149         add_item(show = new TransitionPopupShow(mwindow, this));
150         add_item(on = new TransitionPopupOn(mwindow, this));
151         add_item(length = new TransitionPopupLength(mwindow, this));
152         add_item(detach = new TransitionPopupDetach(mwindow, this));
155 int TransitionPopup::update(Transition *transition)
157         this->transition = transition;
158         show->set_checked(transition->show);
159         on->set_checked(transition->on);
160         char len_text[50];
161         sprintf(len_text, _("Length: %2.2f sec"), transition->track->from_units(transition->length));
162         length->set_text(len_text);
163         return 0;
170 TransitionPopupAttach::TransitionPopupAttach(MWindow *mwindow, TransitionPopup *popup)
171  : BC_MenuItem(_("Attach..."))
173         this->mwindow = mwindow;
174         this->popup = popup;
177 TransitionPopupAttach::~TransitionPopupAttach()
181 int TransitionPopupAttach::handle_event()
183 //      popup->dialog_thread->start();
192 TransitionPopupDetach::TransitionPopupDetach(MWindow *mwindow, TransitionPopup *popup)
193  : BC_MenuItem(_("Detach"))
195         this->mwindow = mwindow;
196         this->popup = popup;
199 TransitionPopupDetach::~TransitionPopupDetach()
203 int TransitionPopupDetach::handle_event()
205         mwindow->detach_transition(popup->transition);
206         return 1;
210 TransitionPopupOn::TransitionPopupOn(MWindow *mwindow, TransitionPopup *popup)
211  : BC_MenuItem(_("On"))
213         this->mwindow = mwindow;
214         this->popup = popup;
217 TransitionPopupOn::~TransitionPopupOn()
221 int TransitionPopupOn::handle_event()
223         popup->transition->on = !get_checked();
224         mwindow->sync_parameters(CHANGE_EDL);
225         return 1;
233 TransitionPopupShow::TransitionPopupShow(MWindow *mwindow, TransitionPopup *popup)
234  : BC_MenuItem(_("Show"))
236         this->mwindow = mwindow;
237         this->popup = popup;
240 TransitionPopupShow::~TransitionPopupShow()
244 int TransitionPopupShow::handle_event()
246         mwindow->show_plugin(popup->transition);
247         return 1;
257 TransitionPopupLength::TransitionPopupLength(MWindow *mwindow, TransitionPopup *popup)
258  : BC_MenuItem(_("Length"))
260         this->mwindow = mwindow;
261         this->popup = popup;
264 TransitionPopupLength::~TransitionPopupLength()
268 int TransitionPopupLength::handle_event()
270         popup->length_thread->start();
271         return 1;