Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

transitionpopup.C

Go to the documentation of this file.
00001 #include "clip.h"
00002 #include "edit.h"
00003 #include "edl.h"
00004 #include "edlsession.h"
00005 #include "language.h"
00006 #include "mwindow.h"
00007 #include "mwindowgui.h"
00008 #include "plugin.h"
00009 #include "transition.h"
00010 #include "track.h"
00011 #include "tracks.h"
00012 #include "transitionpopup.h"
00013 
00014 
00015 TransitionLengthThread::TransitionLengthThread(MWindow *mwindow, TransitionPopup *popup)
00016  : Thread()
00017 {
00018         this->mwindow = mwindow;
00019         this->popup = popup;
00020 }
00021 
00022 TransitionLengthThread::~TransitionLengthThread()
00023 {
00024 }
00025 
00026 void TransitionLengthThread::run()
00027 {
00028         TransitionLengthDialog window(mwindow, popup->transition);
00029         window.create_objects();
00030         int result = window.run_window();
00031 }
00032 
00033 
00034 
00035 
00036 
00037 
00038 TransitionLengthDialog::TransitionLengthDialog(MWindow *mwindow, Transition *transition)
00039  : BC_Window(PROGRAM_NAME ": Transition length", 
00040                                 mwindow->gui->get_abs_cursor_x(1) - 150,
00041                                 mwindow->gui->get_abs_cursor_y(1) - 50,
00042                                 300, 
00043                                 100, 
00044                                 -1, 
00045                                 -1, 
00046                                 0,
00047                                 0, 
00048                                 1)
00049 {
00050         this->mwindow = mwindow;
00051         this->transition = transition;
00052 }
00053 
00054 TransitionLengthDialog::~TransitionLengthDialog()
00055 {
00056 }
00057 
00058         
00059 void TransitionLengthDialog::create_objects()
00060 {
00061         add_subwindow(new BC_Title(10, 10, _("Seconds:")));
00062         text = new TransitionLengthText(mwindow, this, 100, 10);
00063         text->create_objects();
00064         add_subwindow(new BC_OKButton(this));
00065         show_window();
00066 }
00067 
00068 int TransitionLengthDialog::close_event()
00069 {
00070         set_done(0);
00071         return 1;
00072 }
00073 
00074 
00075 
00076 
00077 
00078 
00079 TransitionLengthText::TransitionLengthText(MWindow *mwindow, 
00080         TransitionLengthDialog *gui,
00081         int x, 
00082         int y)
00083  : BC_TumbleTextBox(gui, 
00084         (float)gui->transition->edit->track->from_units(gui->transition->length),
00085         (float)0, 
00086         (float)100, 
00087         x,
00088         y,
00089         100)
00090 {
00091         this->mwindow = mwindow;
00092         this->gui = gui;
00093 }
00094 
00095 int TransitionLengthText::handle_event()
00096 {
00097         double result = atof(get_text());
00098         if(!EQUIV(result, gui->transition->length))
00099         {
00100                 gui->transition->length = gui->transition->track->to_units(result, 1);
00101                 if(gui->transition->edit->track->data_type == TRACK_VIDEO) mwindow->restart_brender();
00102                 mwindow->sync_parameters(CHANGE_PARAMS);
00103                 mwindow->edl->session->default_transition_length = result;
00104                 mwindow->gui->update(0,
00105                         1,
00106                         0,
00107                         0,
00108                         0, 
00109                         0,
00110                         0);
00111         }
00112         
00113         return 1;
00114 }
00115 
00116 
00117 
00118 
00119 
00120 
00121 
00122 
00123 
00124 
00125 
00126 TransitionPopup::TransitionPopup(MWindow *mwindow, MWindowGUI *gui)
00127  : BC_PopupMenu(0, 
00128                 0, 
00129                 0, 
00130                 "", 
00131                 0)
00132 {
00133         this->mwindow = mwindow;
00134         this->gui = gui;
00135 }
00136 
00137 TransitionPopup::~TransitionPopup()
00138 {
00139 //      delete dialog_thread;
00140 }
00141 
00142 
00143 void TransitionPopup::create_objects()
00144 {
00145         length_thread = new TransitionLengthThread(mwindow, this);
00146 //      add_item(attach = new TransitionPopupAttach(mwindow, this));
00147         add_item(show = new TransitionPopupShow(mwindow, this));
00148         add_item(on = new TransitionPopupOn(mwindow, this));
00149         add_item(length = new TransitionPopupLength(mwindow, this));
00150         add_item(detach = new TransitionPopupDetach(mwindow, this));
00151 }
00152 
00153 int TransitionPopup::update(Transition *transition)
00154 {
00155         this->transition = transition;
00156         show->set_checked(transition->show);
00157         on->set_checked(transition->on);
00158         char len_text[50];
00159         sprintf(len_text, _("Length: %2.2f sec"), transition->track->from_units(transition->length));
00160         length->set_text(len_text);
00161         return 0;
00162 }
00163 
00164 
00165 
00166 
00167 
00168 TransitionPopupAttach::TransitionPopupAttach(MWindow *mwindow, TransitionPopup *popup)
00169  : BC_MenuItem(_("Attach..."))
00170 {
00171         this->mwindow = mwindow;
00172         this->popup = popup;
00173 }
00174 
00175 TransitionPopupAttach::~TransitionPopupAttach()
00176 {
00177 }
00178 
00179 int TransitionPopupAttach::handle_event()
00180 {
00181 //      popup->dialog_thread->start();
00182 }
00183 
00184 
00185 
00186 
00187 
00188 
00189 
00190 TransitionPopupDetach::TransitionPopupDetach(MWindow *mwindow, TransitionPopup *popup)
00191  : BC_MenuItem(_("Detach"))
00192 {
00193         this->mwindow = mwindow;
00194         this->popup = popup;
00195 }
00196 
00197 TransitionPopupDetach::~TransitionPopupDetach()
00198 {
00199 }
00200 
00201 int TransitionPopupDetach::handle_event()
00202 {
00203         mwindow->detach_transition(popup->transition);
00204         return 1;
00205 }
00206 
00207 
00208 TransitionPopupOn::TransitionPopupOn(MWindow *mwindow, TransitionPopup *popup)
00209  : BC_MenuItem(_("On"))
00210 {
00211         this->mwindow = mwindow;
00212         this->popup = popup;
00213 }
00214 
00215 TransitionPopupOn::~TransitionPopupOn()
00216 {
00217 }
00218 
00219 int TransitionPopupOn::handle_event()
00220 {
00221         popup->transition->on = !get_checked();
00222         mwindow->sync_parameters(CHANGE_EDL);
00223         return 1;
00224 }
00225 
00226 
00227 
00228 
00229 
00230 
00231 TransitionPopupShow::TransitionPopupShow(MWindow *mwindow, TransitionPopup *popup)
00232  : BC_MenuItem(_("Show"))
00233 {
00234         this->mwindow = mwindow;
00235         this->popup = popup;
00236 }
00237 
00238 TransitionPopupShow::~TransitionPopupShow()
00239 {
00240 }
00241 
00242 int TransitionPopupShow::handle_event()
00243 {
00244         mwindow->show_plugin(popup->transition);
00245         return 1;
00246 }
00247 
00248 
00249 
00250 
00251 
00252 
00253 
00254 
00255 TransitionPopupLength::TransitionPopupLength(MWindow *mwindow, TransitionPopup *popup)
00256  : BC_MenuItem(_("Length"))
00257 {
00258         this->mwindow = mwindow;
00259         this->popup = popup;
00260 }
00261 
00262 TransitionPopupLength::~TransitionPopupLength()
00263 {
00264 }
00265 
00266 int TransitionPopupLength::handle_event()
00267 {
00268         popup->length_thread->start();
00269         return 1;
00270 }
00271 

Generated on Sun Jan 8 13:39:01 2006 for Cinelerra-svn by  doxygen 1.4.4