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 AssetMatchRate(mwindow, this));
00048 add_item(new AssetPopupProjectRemove(mwindow, this));
00049 add_item(new AssetPopupDiskRemove(mwindow, this));
00050 }
00051
00052 void AssetPopup::paste_assets()
00053 {
00054
00055 gui->lock_window("AssetPopup::paste_assets");
00056 mwindow->gui->lock_window("AssetPopup::paste_assets");
00057 mwindow->cwindow->gui->lock_window("AssetPopup::paste_assets");
00058
00059 gui->collect_assets();
00060 mwindow->paste_assets(mwindow->edl->local_session->get_selectionstart(1),
00061 mwindow->edl->tracks->first,
00062 0);
00063
00064 gui->unlock_window();
00065 mwindow->gui->unlock_window();
00066 mwindow->cwindow->gui->unlock_window();
00067 }
00068
00069 void AssetPopup::match_size()
00070 {
00071
00072 gui->collect_assets();
00073 mwindow->gui->lock_window("AssetPopup::match_size");
00074 mwindow->asset_to_size();
00075 mwindow->gui->unlock_window();
00076 }
00077
00078 void AssetPopup::match_rate()
00079 {
00080
00081 gui->collect_assets();
00082 mwindow->gui->lock_window("AssetPopup::match_rate");
00083 mwindow->asset_to_rate();
00084 mwindow->gui->unlock_window();
00085 }
00086
00087 int AssetPopup::update()
00088 {
00089 format->update();
00090 gui->collect_assets();
00091 return 0;
00092 }
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 AssetPopupInfo::AssetPopupInfo(MWindow *mwindow, AssetPopup *popup)
00103 : BC_MenuItem(_("Info..."))
00104 {
00105 this->mwindow = mwindow;
00106 this->popup = popup;
00107 }
00108
00109 AssetPopupInfo::~AssetPopupInfo()
00110 {
00111 }
00112
00113 int AssetPopupInfo::handle_event()
00114 {
00115 if(mwindow->session->drag_assets->total)
00116 {
00117 if(mwindow->awindow->asset_edit->running() &&
00118 mwindow->awindow->asset_edit->window)
00119 {
00120 mwindow->awindow->asset_edit->window->raise_window();
00121 mwindow->awindow->asset_edit->window->flush();
00122 }
00123 else
00124 {
00125 mwindow->awindow->asset_edit->edit_asset(
00126 mwindow->session->drag_assets->values[0]);
00127 }
00128 }
00129 else
00130 if(mwindow->session->drag_clips->total)
00131 {
00132 popup->gui->awindow->clip_edit->edit_clip(
00133 mwindow->session->drag_clips->values[0]);
00134 }
00135 return 1;
00136 }
00137
00138
00139
00140
00141
00142
00143
00144 AssetPopupBuildIndex::AssetPopupBuildIndex(MWindow *mwindow, AssetPopup *popup)
00145 : BC_MenuItem(_("Rebuild index"))
00146 {
00147 this->mwindow = mwindow;
00148 this->popup = popup;
00149 }
00150
00151 AssetPopupBuildIndex::~AssetPopupBuildIndex()
00152 {
00153 }
00154
00155 int AssetPopupBuildIndex::handle_event()
00156 {
00157
00158 mwindow->rebuild_indices();
00159 return 1;
00160 }
00161
00162
00163
00164
00165
00166
00167
00168 AssetPopupSort::AssetPopupSort(MWindow *mwindow, AssetPopup *popup)
00169 : BC_MenuItem(_("Sort items"))
00170 {
00171 this->mwindow = mwindow;
00172 this->popup = popup;
00173 }
00174
00175 AssetPopupSort::~AssetPopupSort()
00176 {
00177 }
00178
00179 int AssetPopupSort::handle_event()
00180 {
00181 mwindow->awindow->gui->sort_assets();
00182 return 1;
00183 }
00184
00185
00186
00187
00188
00189
00190
00191 AssetPopupView::AssetPopupView(MWindow *mwindow, AssetPopup *popup)
00192 : BC_MenuItem(_("View"))
00193 {
00194 this->mwindow = mwindow;
00195 this->popup = popup;
00196 }
00197
00198 AssetPopupView::~AssetPopupView()
00199 {
00200 }
00201
00202 int AssetPopupView::handle_event()
00203 {
00204 mwindow->vwindow->gui->lock_window("AssetPopupView::handle_event");
00205
00206 if(mwindow->session->drag_assets->total)
00207 mwindow->vwindow->change_source(
00208 mwindow->session->drag_assets->values[0]);
00209 else
00210 if(mwindow->session->drag_clips->total)
00211 mwindow->vwindow->change_source(
00212 mwindow->session->drag_clips->values[0]);
00213
00214 mwindow->vwindow->gui->unlock_window();
00215 return 1;
00216 }
00217
00218
00219
00220
00221
00222
00223
00224 AssetPopupPaste::AssetPopupPaste(MWindow *mwindow, AssetPopup *popup)
00225 : BC_MenuItem(_("Paste"))
00226 {
00227 this->mwindow = mwindow;
00228 this->popup = popup;
00229 }
00230
00231 AssetPopupPaste::~AssetPopupPaste()
00232 {
00233 }
00234
00235 int AssetPopupPaste::handle_event()
00236 {
00237 popup->paste_assets();
00238 return 1;
00239 }
00240
00241
00242
00243
00244
00245
00246
00247
00248 AssetMatchSize::AssetMatchSize(MWindow *mwindow, AssetPopup *popup)
00249 : BC_MenuItem(_("Match project size"))
00250 {
00251 this->mwindow = mwindow;
00252 this->popup = popup;
00253 }
00254
00255 int AssetMatchSize::handle_event()
00256 {
00257 popup->match_size();
00258 return 1;
00259 }
00260
00261
00262
00263
00264
00265
00266
00267
00268 AssetMatchRate::AssetMatchRate(MWindow *mwindow, AssetPopup *popup)
00269 : BC_MenuItem(_("Match frame rate"))
00270 {
00271 this->mwindow = mwindow;
00272 this->popup = popup;
00273 }
00274
00275 int AssetMatchRate::handle_event()
00276 {
00277 popup->match_rate();
00278 return 1;
00279 }
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294 AssetPopupProjectRemove::AssetPopupProjectRemove(MWindow *mwindow, AssetPopup *popup)
00295 : BC_MenuItem(_("Remove from project"))
00296 {
00297 this->mwindow = mwindow;
00298 this->popup = popup;
00299 }
00300
00301
00302
00303 AssetPopupProjectRemove::~AssetPopupProjectRemove()
00304 {
00305 }
00306
00307 int AssetPopupProjectRemove::handle_event()
00308 {
00309 mwindow->remove_assets_from_project(1);
00310 return 1;
00311 }
00312
00313
00314
00315
00316 AssetPopupDiskRemove::AssetPopupDiskRemove(MWindow *mwindow, AssetPopup *popup)
00317 : BC_MenuItem(_("Remove from disk"))
00318 {
00319 this->mwindow = mwindow;
00320 this->popup = popup;
00321 }
00322
00323
00324 AssetPopupDiskRemove::~AssetPopupDiskRemove()
00325 {
00326 }
00327
00328
00329 int AssetPopupDiskRemove::handle_event()
00330 {
00331 mwindow->awindow->asset_remove->start();
00332 return 1;
00333 }
00334
00335
00336
00337