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

editpopup.C

Go to the documentation of this file.
00001 #include "edit.h"
00002 #include "editpopup.h"
00003 #include "language.h"
00004 #include "mainsession.h"
00005 #include "mwindow.h"
00006 #include "mwindowgui.h"
00007 #include "plugindialog.h"
00008 #include "resizetrackthread.h"
00009 #include "track.h"
00010 #include "tracks.h"
00011 #include "trackcanvas.h"
00012 
00013 
00014 #include <string.h>
00015 
00016 EditPopup::EditPopup(MWindow *mwindow, MWindowGUI *gui)
00017  : BC_PopupMenu(0, 
00018                 0, 
00019                 0, 
00020                 "", 
00021                 0)
00022 {
00023         this->mwindow = mwindow;
00024         this->gui = gui;
00025 }
00026 
00027 EditPopup::~EditPopup()
00028 {
00029 }
00030 
00031 void EditPopup::create_objects()
00032 {
00033         add_item(new EditAttachEffect(mwindow, this));
00034         add_item(new EditMoveTrackUp(mwindow, this));
00035         add_item(new EditMoveTrackDown(mwindow, this));
00036         add_item(new EditPopupDeleteTrack(mwindow, this));
00037         add_item(new EditPopupAddTrack(mwindow, this));
00038 //      add_item(new EditPopupTitle(mwindow, this));
00039         resize_option = 0;
00040 }
00041 
00042 int EditPopup::update(Track *track, Edit *edit)
00043 {
00044         this->edit = edit;
00045         this->track = track;
00046 
00047         if(track->data_type == TRACK_VIDEO && !resize_option)
00048         {
00049                 add_item(resize_option = new EditPopupResize(mwindow, this));
00050                 add_item(matchsize_option = new EditPopupMatchSize(mwindow, this));
00051         }
00052         else
00053         if(track->data_type == TRACK_AUDIO && resize_option)
00054         {
00055                 remove_item(resize_option);
00056                 remove_item(matchsize_option);
00057                 resize_option = 0;
00058                 matchsize_option = 0;
00059         }
00060         return 0;
00061 }
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 EditAttachEffect::EditAttachEffect(MWindow *mwindow, EditPopup *popup)
00072  : BC_MenuItem(_("Attach effect..."))
00073 {
00074         this->mwindow = mwindow;
00075         this->popup = popup;
00076         dialog_thread = new PluginDialogThread(mwindow);
00077 }
00078 
00079 EditAttachEffect::~EditAttachEffect()
00080 {
00081         delete dialog_thread;
00082 }
00083 
00084 int EditAttachEffect::handle_event()
00085 {
00086         dialog_thread->start_window(popup->track,
00087                 0, 
00088                 PROGRAM_NAME ": Attach Effect");
00089         return 1;
00090 }
00091 
00092 
00093 EditMoveTrackUp::EditMoveTrackUp(MWindow *mwindow, EditPopup *popup)
00094  : BC_MenuItem(_("Move up"))
00095 {
00096         this->mwindow = mwindow;
00097         this->popup = popup;
00098 }
00099 EditMoveTrackUp::~EditMoveTrackUp()
00100 {
00101 }
00102 int EditMoveTrackUp::handle_event()
00103 {
00104         mwindow->move_track_up(popup->track);
00105         return 1;
00106 }
00107 
00108 
00109 
00110 EditMoveTrackDown::EditMoveTrackDown(MWindow *mwindow, EditPopup *popup)
00111  : BC_MenuItem(_("Move down"))
00112 {
00113         this->mwindow = mwindow;
00114         this->popup = popup;
00115 }
00116 EditMoveTrackDown::~EditMoveTrackDown()
00117 {
00118 }
00119 int EditMoveTrackDown::handle_event()
00120 {
00121         mwindow->move_track_down(popup->track);
00122         return 1;
00123 }
00124 
00125 
00126 
00127 
00128 EditPopupResize::EditPopupResize(MWindow *mwindow, EditPopup *popup)
00129  : BC_MenuItem(_("Resize track..."))
00130 {
00131         this->mwindow = mwindow;
00132         this->popup = popup;
00133         dialog_thread = new ResizeTrackThread(mwindow, 
00134                 popup->track->tracks->number_of(popup->track));
00135 }
00136 EditPopupResize::~EditPopupResize()
00137 {
00138         delete dialog_thread;
00139 }
00140 
00141 int EditPopupResize::handle_event()
00142 {
00143         dialog_thread->start_window(popup->track, popup->track->tracks->number_of(popup->track));
00144         return 1;
00145 }
00146 
00147 
00148 
00149 
00150 
00151 
00152 EditPopupMatchSize::EditPopupMatchSize(MWindow *mwindow, EditPopup *popup)
00153  : BC_MenuItem(_("Match output size"))
00154 {
00155         this->mwindow = mwindow;
00156         this->popup = popup;
00157 }
00158 EditPopupMatchSize::~EditPopupMatchSize()
00159 {
00160 }
00161 
00162 int EditPopupMatchSize::handle_event()
00163 {
00164         mwindow->match_output_size(popup->track);
00165         return 1;
00166 }
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00174 EditPopupDeleteTrack::EditPopupDeleteTrack(MWindow *mwindow, EditPopup *popup)
00175  : BC_MenuItem(_("Delete track"))
00176 {
00177         this->mwindow = mwindow;
00178         this->popup = popup;
00179 }
00180 int EditPopupDeleteTrack::handle_event()
00181 {
00182         mwindow->delete_track(popup->track);
00183         return 1;
00184 }
00185 
00186 
00187 
00188 
00189 
00190 
00191 EditPopupAddTrack::EditPopupAddTrack(MWindow *mwindow, EditPopup *popup)
00192  : BC_MenuItem(_("Add track"))
00193 {
00194         this->mwindow = mwindow;
00195         this->popup = popup;
00196 }
00197 
00198 int EditPopupAddTrack::handle_event()
00199 {
00200         if(popup->track->data_type == TRACK_AUDIO)
00201                 mwindow->add_audio_track_entry(1, popup->track);
00202         else
00203                 mwindow->add_video_track_entry(popup->track);
00204         return 1;
00205 }
00206 
00207 
00208 
00209 
00210 
00211 
00212 EditPopupTitle::EditPopupTitle(MWindow *mwindow, EditPopup *popup)
00213  : BC_MenuItem(_("User title..."))
00214 {
00215         this->mwindow = mwindow;
00216         this->popup = popup;
00217         window = 0;
00218 }
00219 
00220 EditPopupTitle::~EditPopupTitle()
00221 {
00222         delete popup;
00223 }
00224 
00225 int EditPopupTitle::handle_event()
00226 {
00227         int result;
00228 
00229         Track *trc = mwindow->session->track_highlighted;
00230 
00231         if (trc && trc->record)
00232         {
00233                 Edit *edt = mwindow->session->edit_highlighted;
00234                 if(!edt) return 1;
00235 
00236                 window = new EditPopupTitleWindow (mwindow, popup);
00237                 window->create_objects();
00238                 result = window->run_window();
00239 
00240 
00241                 if(!result && edt)
00242                 {
00243                         strcpy(edt->user_title, window->title_text->get_text());
00244                 }
00245 
00246                 delete window;
00247                 window = 0;
00248         }
00249 
00250         return 1;
00251 }
00252 
00253 
00254 EditPopupTitleWindow::EditPopupTitleWindow (MWindow *mwindow, EditPopup *popup)
00255  : BC_Window (PROGRAM_NAME ": Set edit title",
00256         mwindow->gui->get_abs_cursor_x(0) - 400 / 2,
00257         mwindow->gui->get_abs_cursor_y(0) - 500 / 2,
00258         300,
00259         100,
00260         300,
00261         100,
00262         0,
00263         0,
00264         1)
00265 {
00266         this->mwindow = mwindow;
00267         this->popup = popup;
00268         this->edt = this->mwindow->session->edit_highlighted;
00269         if(this->edt)
00270         {
00271                 strcpy(new_text, this->edt->user_title);
00272         }
00273 }
00274 
00275 EditPopupTitleWindow::~EditPopupTitleWindow()
00276 {
00277 }
00278 
00279 int EditPopupTitleWindow::close_event()
00280 {
00281         set_done(1);
00282         return 1;
00283 }
00284 
00285 int EditPopupTitleWindow::create_objects()
00286 {
00287         int x = 5;
00288         int y = 10;
00289 
00290         add_subwindow (new BC_Title (x, y, _("User title")));
00291         add_subwindow (title_text = new EditPopupTitleText (this,
00292                 mwindow, x, y + 20));
00293         add_tool(new BC_OKButton(this));
00294         add_tool(new BC_CancelButton(this));
00295 
00296 
00297         show_window();
00298         flush();
00299         return 0;
00300 }
00301 
00302 
00303 EditPopupTitleText::EditPopupTitleText (EditPopupTitleWindow *window, 
00304         MWindow *mwindow, int x, int y)
00305  : BC_TextBox(x, y, 250, 1, (char*)(window->edt ? window->edt->user_title : ""))
00306 {
00307         this->window = window;
00308         this->mwindow = mwindow;
00309 }
00310 
00311 EditPopupTitleText::~EditPopupTitleText() 
00312 { 
00313 }
00314  
00315 int EditPopupTitleText::handle_event()
00316 {
00317         return 1;
00318 }
00319 
00320 
00321 
00322 
00323 
00324 
00325 

Generated on Sun Jan 8 13:38:53 2006 for Cinelerra-svn by  doxygen 1.4.4