00001 #include "assetedit.h"
00002 #include "assetpopup.h"
00003 #include "assetremove.h"
00004 #include "awindow.h"
00005 #include "awindowgui.h"
00006 #include "awindowmenu.h"
00007 #include "clipedit.h"
00008 #include "cwindow.h"
00009 #include "cwindowgui.h"
00010 #include "edl.h"
00011 #include "language.h"
00012 #include "localsession.h"
00013 #include "mainindexes.h"
00014 #include "mainsession.h"
00015 #include "mwindow.h"
00016 #include "mwindowgui.h"
00017 #include "tracks.h"
00018 #include "vwindow.h"
00019 #include "vwindowgui.h"
00020
00021
00022
00023 AssetPopup::AssetPopup(MWindow *mwindow, AWindowGUI *gui)
00024 : BC_PopupMenu(0,
00025 0,
00026 0,
00027 "",
00028 0)
00029 {
00030 this->mwindow = mwindow;
00031 this->gui = gui;
00032 }
00033
00034 AssetPopup::~AssetPopup()
00035 {
00036 }
00037
00038 void AssetPopup::create_objects()
00039 {
00040 add_item(format = new AssetListFormat(mwindow));
00041 add_item(info = new AssetPopupInfo(mwindow, this));
00042 add_item(new AssetPopupSort(mwindow, this));
00043 add_item(index = new AssetPopupBuildIndex(mwindow, this));
00044 add_item(view = new AssetPopupView(mwindow, this));
00045 add_item(new AssetPopupPaste(mwindow, this));
00046 add_item(new AssetMatchSize(mwindow, this));
00047 add_item(new AssetPopupProjectRemove(mwindow, this));
00048 add_item(new AssetPopupDiskRemove(mwindow, this));
00049 }
00050
00051 void AssetPopup::paste_assets()
00052 {
00053
00054 gui->lock_window("AssetPopup::paste_assets");
00055 mwindow->gui->lock_window("AssetPopup::paste_assets");
00056 mwindow->cwindow->gui->lock_window("AssetPopup::paste_assets");
00057
00058 gui->collect_assets();
00059 mwindow->paste_assets(mwindow->edl->local_session->get_selectionstart(1),
00060 mwindow->edl->tracks->first);
00061
00062 gui->unlock_window();
00063 mwindow->gui->unlock_window();
00064 mwindow->cwindow->gui->unlock_window();
00065 }
00066
00067 void AssetPopup::match_size()
00068 {
00069
00070 gui->collect_assets();
00071 mwindow->gui->lock_window("AssetPopup::match_size");
00072 mwindow->asset_to_size();
00073 mwindow->gui->unlock_window();
00074 }
00075
00076 int AssetPopup::update()
00077 {
00078 format->update();
00079 gui->collect_assets();
00080 return 0;
00081 }
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 AssetPopupInfo::AssetPopupInfo(MWindow *mwindow, AssetPopup *popup)
00092 : BC_MenuItem(_("Info..."))
00093 {
00094 this->mwindow = mwindow;
00095 this->popup = popup;
00096 }
00097
00098 AssetPopupInfo::~AssetPopupInfo()
00099 {
00100 }
00101
00102 int AssetPopupInfo::handle_event()
00103 {
00104 if(mwindow->session->drag_assets->total)
00105 {
00106 if(mwindow->awindow->asset_edit->running() &&
00107 mwindow->awindow->asset_edit->window)
00108 {
00109 mwindow->awindow->asset_edit->window->raise_window();
00110 mwindow->awindow->asset_edit->window->flush();
00111 }
00112 else
00113 {
00114 mwindow->awindow->asset_edit->edit_asset(
00115 mwindow->session->drag_assets->values[0]);
00116 }
00117 }
00118 else
00119 if(mwindow->session->drag_clips->total)
00120 {
00121 popup->gui->awindow->clip_edit->edit_clip(
00122 mwindow->session->drag_clips->values[0]);
00123 }
00124 return 1;
00125 }
00126
00127
00128
00129
00130
00131
00132
00133 AssetPopupBuildIndex::AssetPopupBuildIndex(MWindow *mwindow, AssetPopup *popup)
00134 : BC_MenuItem(_("Rebuild index"))
00135 {
00136 this->mwindow = mwindow;
00137 this->popup = popup;
00138 }
00139
00140 AssetPopupBuildIndex::~AssetPopupBuildIndex()
00141 {
00142 }
00143
00144 int AssetPopupBuildIndex::handle_event()
00145 {
00146
00147 mwindow->rebuild_indices();
00148 return 1;
00149 }
00150
00151
00152
00153
00154
00155
00156
00157 AssetPopupSort::AssetPopupSort(MWindow *mwindow, AssetPopup *popup)
00158 : BC_MenuItem(_("Sort items"))
00159 {
00160 this->mwindow = mwindow;
00161 this->popup = popup;
00162 }
00163
00164 AssetPopupSort::~AssetPopupSort()
00165 {
00166 }
00167
00168 int AssetPopupSort::handle_event()
00169 {
00170 mwindow->awindow->gui->sort_assets();
00171 return 1;
00172 }
00173
00174
00175
00176
00177
00178
00179
00180 AssetPopupView::AssetPopupView(MWindow *mwindow, AssetPopup *popup)
00181 : BC_MenuItem(_("View"))
00182 {
00183 this->mwindow = mwindow;
00184 this->popup = popup;
00185 }
00186
00187 AssetPopupView::~AssetPopupView()
00188 {
00189 }
00190
00191 int AssetPopupView::handle_event()
00192 {
00193 mwindow->vwindow->gui->lock_window("AssetPopupView::handle_event");
00194
00195 if(mwindow->session->drag_assets->total)
00196 mwindow->vwindow->change_source(
00197 mwindow->session->drag_assets->values[0]);
00198 else
00199 if(mwindow->session->drag_clips->total)
00200 mwindow->vwindow->change_source(
00201 mwindow->session->drag_clips->values[0]);
00202
00203 mwindow->vwindow->gui->unlock_window();
00204 return 1;
00205 }
00206
00207
00208
00209
00210
00211
00212
00213 AssetPopupPaste::AssetPopupPaste(MWindow *mwindow, AssetPopup *popup)
00214 : BC_MenuItem(_("Paste"))
00215 {
00216 this->mwindow = mwindow;
00217 this->popup = popup;
00218 }
00219
00220 AssetPopupPaste::~AssetPopupPaste()
00221 {
00222 }
00223
00224 int AssetPopupPaste::handle_event()
00225 {
00226 popup->paste_assets();
00227 return 1;
00228 }
00229
00230
00231
00232
00233
00234
00235
00236
00237 AssetMatchSize::AssetMatchSize(MWindow *mwindow, AssetPopup *popup)
00238 : BC_MenuItem(_("Match project size"))
00239 {
00240 this->mwindow = mwindow;
00241 this->popup = popup;
00242 }
00243
00244 AssetMatchSize::~AssetMatchSize()
00245 {
00246 }
00247
00248 int AssetMatchSize::handle_event()
00249 {
00250 popup->match_size();
00251 return 1;
00252 }
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267 AssetPopupProjectRemove::AssetPopupProjectRemove(MWindow *mwindow, AssetPopup *popup)
00268 : BC_MenuItem(_("Remove from project"))
00269 {
00270 this->mwindow = mwindow;
00271 this->popup = popup;
00272 }
00273
00274
00275
00276 AssetPopupProjectRemove::~AssetPopupProjectRemove()
00277 {
00278 }
00279
00280 int AssetPopupProjectRemove::handle_event()
00281 {
00282 mwindow->remove_assets_from_project(1);
00283 return 1;
00284 }
00285
00286
00287
00288
00289 AssetPopupDiskRemove::AssetPopupDiskRemove(MWindow *mwindow, AssetPopup *popup)
00290 : BC_MenuItem(_("Remove from disk"))
00291 {
00292 this->mwindow = mwindow;
00293 this->popup = popup;
00294 }
00295
00296
00297 AssetPopupDiskRemove::~AssetPopupDiskRemove()
00298 {
00299 }
00300
00301
00302 int AssetPopupDiskRemove::handle_event()
00303 {
00304 mwindow->awindow->asset_remove->start();
00305 return 1;
00306 }