r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / transitionpopup.C
blob4612a24fe91ea60ed3cbd038465d74775d196b16
1 #include "clip.h"
2 #include "edit.h"
3 #include "edl.h"
4 #include "edlsession.h"
5 #include "mwindow.h"
6 #include "mwindowgui.h"
7 #include "plugin.h"
8 #include "transition.h"
9 #include "track.h"
10 #include "tracks.h"
11 #include "transitionpopup.h"
13 #include <libintl.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)
19  : Thread()
21         this->mwindow = mwindow;
22         this->popup = popup;
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,
45                                 300, 
46                                 100, 
47                                 -1, 
48                                 -1, 
49                                 0,
50                                 0, 
51                                 1)
53         this->mwindow = mwindow;
54         this->transition = transition;
57 TransitionLengthDialog::~TransitionLengthDialog()
61         
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));
68         show_window();
71 int TransitionLengthDialog::close_event()
73         set_done(0);
74         return 1;
82 TransitionLengthText::TransitionLengthText(MWindow *mwindow, 
83         TransitionLengthDialog *gui,
84         int x, 
85         int y)
86  : BC_TumbleTextBox(gui, 
87         (float)gui->transition->edit->track->from_units(gui->transition->length),
88         (float)0, 
89         (float)100, 
90         x,
91         y,
92         100)
94         this->mwindow = mwindow;
95         this->gui = gui;
98 int TransitionLengthText::handle_event()
100         double result = atof(get_text());
101         if(!EQUIV(result, gui->transition->length))
102         {
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;
107         }
108         
109         return 1;
122 TransitionPopup::TransitionPopup(MWindow *mwindow, MWindowGUI *gui)
123  : BC_PopupMenu(0, 
124                 0, 
125                 0, 
126                 "", 
127                 0)
129         this->mwindow = mwindow;
130         this->gui = gui;
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);
154         return 0;
161 TransitionPopupAttach::TransitionPopupAttach(MWindow *mwindow, TransitionPopup *popup)
162  : BC_MenuItem(_("Attach..."))
164         this->mwindow = mwindow;
165         this->popup = popup;
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;
187         this->popup = popup;
190 TransitionPopupDetach::~TransitionPopupDetach()
194 int TransitionPopupDetach::handle_event()
196         mwindow->detach_transition(popup->transition);
197         return 1;
201 TransitionPopupOn::TransitionPopupOn(MWindow *mwindow, TransitionPopup *popup)
202  : BC_MenuItem(_("On"))
204         this->mwindow = mwindow;
205         this->popup = popup;
208 TransitionPopupOn::~TransitionPopupOn()
212 int TransitionPopupOn::handle_event()
214         popup->transition->on = !get_checked();
215         mwindow->sync_parameters(CHANGE_EDL);
216         return 1;
224 TransitionPopupShow::TransitionPopupShow(MWindow *mwindow, TransitionPopup *popup)
225  : BC_MenuItem(_("Show"))
227         this->mwindow = mwindow;
228         this->popup = popup;
231 TransitionPopupShow::~TransitionPopupShow()
235 int TransitionPopupShow::handle_event()
237         mwindow->show_plugin(popup->transition);
238         return 1;
248 TransitionPopupLength::TransitionPopupLength(MWindow *mwindow, TransitionPopup *popup)
249  : BC_MenuItem(_("Length"))
251         this->mwindow = mwindow;
252         this->popup = popup;
255 TransitionPopupLength::~TransitionPopupLength()
259 int TransitionPopupLength::handle_event()
261         popup->length_thread->start();
262         return 1;