4 #include "mainsession.h"
6 #include "mwindowgui.h"
7 #include "plugindialog.h"
8 #include "resizetrackthread.h"
11 #include "trackcanvas.h"
16 EditPopup::EditPopup(MWindow *mwindow, MWindowGUI *gui)
23 this->mwindow = mwindow;
27 EditPopup::~EditPopup()
31 void EditPopup::create_objects()
33 add_item(new EditAttachEffect(mwindow, this));
34 add_item(new EditMoveTrackUp(mwindow, this));
35 add_item(new EditMoveTrackDown(mwindow, this));
36 add_item(new EditPopupDeleteTrack(mwindow, this));
37 add_item(new EditPopupAddTrack(mwindow, this));
38 // add_item(new EditPopupTitle(mwindow, this));
42 int EditPopup::update(Track *track, Edit *edit)
47 if(track->data_type == TRACK_VIDEO && !resize_option)
49 add_item(resize_option = new EditPopupResize(mwindow, this));
50 add_item(matchsize_option = new EditPopupMatchSize(mwindow, this));
53 if(track->data_type == TRACK_AUDIO && resize_option)
55 remove_item(resize_option);
56 remove_item(matchsize_option);
71 EditAttachEffect::EditAttachEffect(MWindow *mwindow, EditPopup *popup)
72 : BC_MenuItem(_("Attach effect..."))
74 this->mwindow = mwindow;
76 dialog_thread = new PluginDialogThread(mwindow);
79 EditAttachEffect::~EditAttachEffect()
84 int EditAttachEffect::handle_event()
86 dialog_thread->start_window(popup->track,
88 PROGRAM_NAME ": Attach Effect");
93 EditMoveTrackUp::EditMoveTrackUp(MWindow *mwindow, EditPopup *popup)
94 : BC_MenuItem(_("Move up"))
96 this->mwindow = mwindow;
99 EditMoveTrackUp::~EditMoveTrackUp()
102 int EditMoveTrackUp::handle_event()
104 mwindow->move_track_up(popup->track);
110 EditMoveTrackDown::EditMoveTrackDown(MWindow *mwindow, EditPopup *popup)
111 : BC_MenuItem(_("Move down"))
113 this->mwindow = mwindow;
116 EditMoveTrackDown::~EditMoveTrackDown()
119 int EditMoveTrackDown::handle_event()
121 mwindow->move_track_down(popup->track);
128 EditPopupResize::EditPopupResize(MWindow *mwindow, EditPopup *popup)
129 : BC_MenuItem(_("Resize track..."))
131 this->mwindow = mwindow;
133 dialog_thread = new ResizeTrackThread(mwindow,
134 popup->track->tracks->number_of(popup->track));
136 EditPopupResize::~EditPopupResize()
138 delete dialog_thread;
141 int EditPopupResize::handle_event()
143 dialog_thread->start_window(popup->track, popup->track->tracks->number_of(popup->track));
152 EditPopupMatchSize::EditPopupMatchSize(MWindow *mwindow, EditPopup *popup)
153 : BC_MenuItem(_("Match output size"))
155 this->mwindow = mwindow;
158 EditPopupMatchSize::~EditPopupMatchSize()
162 int EditPopupMatchSize::handle_event()
164 mwindow->match_output_size(popup->track);
174 EditPopupDeleteTrack::EditPopupDeleteTrack(MWindow *mwindow, EditPopup *popup)
175 : BC_MenuItem(_("Delete track"))
177 this->mwindow = mwindow;
180 int EditPopupDeleteTrack::handle_event()
182 mwindow->delete_track(popup->track);
191 EditPopupAddTrack::EditPopupAddTrack(MWindow *mwindow, EditPopup *popup)
192 : BC_MenuItem(_("Add track"))
194 this->mwindow = mwindow;
198 int EditPopupAddTrack::handle_event()
200 if(popup->track->data_type == TRACK_AUDIO)
201 mwindow->add_audio_track_entry(1, popup->track);
203 mwindow->add_video_track_entry(popup->track);
212 EditPopupTitle::EditPopupTitle(MWindow *mwindow, EditPopup *popup)
213 : BC_MenuItem(_("User title..."))
215 this->mwindow = mwindow;
220 EditPopupTitle::~EditPopupTitle()
225 int EditPopupTitle::handle_event()
229 Track *trc = mwindow->session->track_highlighted;
231 if (trc && trc->record)
233 Edit *edt = mwindow->session->edit_highlighted;
236 window = new EditPopupTitleWindow (mwindow, popup);
237 window->create_objects();
238 result = window->run_window();
243 strcpy(edt->user_title, window->title_text->get_text());
254 EditPopupTitleWindow::EditPopupTitleWindow (MWindow *mwindow, EditPopup *popup)
255 : BC_Window (PROGRAM_NAME ": Set edit title",
256 mwindow->gui->get_abs_cursor_x(0) - 400 / 2,
257 mwindow->gui->get_abs_cursor_y(0) - 500 / 2,
266 this->mwindow = mwindow;
268 this->edt = this->mwindow->session->edit_highlighted;
271 strcpy(new_text, this->edt->user_title);
275 EditPopupTitleWindow::~EditPopupTitleWindow()
279 int EditPopupTitleWindow::close_event()
285 int EditPopupTitleWindow::create_objects()
290 add_subwindow (new BC_Title (x, y, _("User title")));
291 add_subwindow (title_text = new EditPopupTitleText (this,
292 mwindow, x, y + 20));
293 add_tool(new BC_OKButton(this));
294 add_tool(new BC_CancelButton(this));
303 EditPopupTitleText::EditPopupTitleText (EditPopupTitleWindow *window,
304 MWindow *mwindow, int x, int y)
305 : BC_TextBox(x, y, 250, 1, (char*)(window->edt ? window->edt->user_title : ""))
307 this->window = window;
308 this->mwindow = mwindow;
311 EditPopupTitleText::~EditPopupTitleText()
315 int EditPopupTitleText::handle_event()
329 // c-file-style: "linux"