r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / editpopup.C
blobf4279446be220dd6bcc942a8c6efd55cb0ae435e
1 #include "edit.h"
2 #include "editpopup.h"
3 #include "mwindow.h"
4 #include "mwindowgui.h"
5 #include "plugindialog.h"
6 #include "resizetrackthread.h"
7 #include "track.h"
8 #include "tracks.h"
9 #include "trackcanvas.h"
11 #include <libintl.h>
12 #define _(String) gettext(String)
13 #define gettext_noop(String) String
14 #define N_(String) gettext_noop (String)
16 EditPopup::EditPopup(MWindow *mwindow, MWindowGUI *gui)
17  : BC_PopupMenu(0, 
18                 0, 
19                 0, 
20                 "", 
21                 0)
23         this->mwindow = mwindow;
24         this->gui = gui;
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         resize_option = 0;
41 int EditPopup::update(Track *track, Edit *edit)
43 //      this->edit = edit;
44         this->track = track;
46         if(track->data_type == TRACK_VIDEO && !resize_option)
47         {
48                 add_item(resize_option = new EditPopupResize(mwindow, this));
49                 add_item(matchsize_option = new EditPopupMatchSize(mwindow, this));
50         }
51         else
52         if(track->data_type == TRACK_AUDIO && resize_option)
53         {
54                 remove_item(resize_option);
55                 remove_item(matchsize_option);
56                 resize_option = 0;
57                 matchsize_option = 0;
58         }
59         return 0;
70 EditAttachEffect::EditAttachEffect(MWindow *mwindow, EditPopup *popup)
71  : BC_MenuItem(_("Attach effect..."))
73         this->mwindow = mwindow;
74         this->popup = popup;
75         dialog_thread = new PluginDialogThread(mwindow);
78 EditAttachEffect::~EditAttachEffect()
80         delete dialog_thread;
83 int EditAttachEffect::handle_event()
85         dialog_thread->start_window(popup->track,
86                 0, 
87                 PROGRAM_NAME ": Attach Effect");
88         return 1;
92 EditMoveTrackUp::EditMoveTrackUp(MWindow *mwindow, EditPopup *popup)
93  : BC_MenuItem(_("Move up"))
95         this->mwindow = mwindow;
96         this->popup = popup;
98 EditMoveTrackUp::~EditMoveTrackUp()
101 int EditMoveTrackUp::handle_event()
103         mwindow->move_track_up(popup->track);
104         return 1;
109 EditMoveTrackDown::EditMoveTrackDown(MWindow *mwindow, EditPopup *popup)
110  : BC_MenuItem(_("Move down"))
112         this->mwindow = mwindow;
113         this->popup = popup;
115 EditMoveTrackDown::~EditMoveTrackDown()
118 int EditMoveTrackDown::handle_event()
120         mwindow->move_track_down(popup->track);
121         return 1;
127 EditPopupResize::EditPopupResize(MWindow *mwindow, EditPopup *popup)
128  : BC_MenuItem(_("Resize track..."))
130         this->mwindow = mwindow;
131         this->popup = popup;
132         dialog_thread = new ResizeTrackThread(mwindow, 
133                 popup->track->tracks->number_of(popup->track));
135 EditPopupResize::~EditPopupResize()
137         delete dialog_thread;
140 int EditPopupResize::handle_event()
142         dialog_thread->start_window(popup->track, popup->track->tracks->number_of(popup->track));
143         return 1;
151 EditPopupMatchSize::EditPopupMatchSize(MWindow *mwindow, EditPopup *popup)
152  : BC_MenuItem(_("Match output size"))
154         this->mwindow = mwindow;
155         this->popup = popup;
157 EditPopupMatchSize::~EditPopupMatchSize()
161 int EditPopupMatchSize::handle_event()
163         mwindow->match_output_size(popup->track);
164         return 1;
173 EditPopupDeleteTrack::EditPopupDeleteTrack(MWindow *mwindow, EditPopup *popup)
174  : BC_MenuItem(_("Delete track"))
176         this->mwindow = mwindow;
177         this->popup = popup;
179 int EditPopupDeleteTrack::handle_event()
181         mwindow->delete_track(popup->track);
182         return 1;
190 EditPopupAddTrack::EditPopupAddTrack(MWindow *mwindow, EditPopup *popup)
191  : BC_MenuItem(_("Add track"))
193         this->mwindow = mwindow;
194         this->popup = popup;
197 int EditPopupAddTrack::handle_event()
199         if(popup->track->data_type == TRACK_AUDIO)
200                 mwindow->add_audio_track_entry(1, popup->track);
201         else
202                 mwindow->add_video_track_entry(popup->track);
203         return 1;