From 4b6c39e6cf4a3fd9c1b347db6de686ab55d6cac8 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Sat, 15 Jul 2017 13:03:05 -0600 Subject: [PATCH] awindowgui / mwindowedit / label rework remove reel/timecode, preserve render took msg add env vars for cin paths fixes: filebox embed cr, rebuild index, ffmpeg asset info codec --- cinelerra-5.1/cinelerra/Makefile | 4 +- cinelerra-5.1/cinelerra/asset.C | 81 +- cinelerra-5.1/cinelerra/asset.h | 9 - cinelerra-5.1/cinelerra/assetedit.C | 125 +- cinelerra-5.1/cinelerra/assetedit.h | 38 +- cinelerra-5.1/cinelerra/assetedit.inc | 18 + cinelerra-5.1/cinelerra/assetpopup.C | 340 +++-- cinelerra-5.1/cinelerra/assetpopup.h | 100 +- cinelerra-5.1/cinelerra/assetpopup.inc | 18 + cinelerra-5.1/cinelerra/assets.C | 11 +- cinelerra-5.1/cinelerra/assets.h | 19 +- cinelerra-5.1/cinelerra/awindow.C | 1 + cinelerra-5.1/cinelerra/awindow.h | 1 + cinelerra-5.1/cinelerra/awindowgui.C | 455 +++---- cinelerra-5.1/cinelerra/awindowgui.h | 85 +- cinelerra-5.1/cinelerra/awindowgui.inc | 23 + cinelerra-5.1/cinelerra/clippopup.C | 432 ++++++ cinelerra-5.1/cinelerra/clippopup.h | 222 ++++ cinelerra-5.1/cinelerra/clippopup.inc | 41 + cinelerra-5.1/cinelerra/cwindowgui.C | 2 +- cinelerra-5.1/cinelerra/edl.C | 19 +- cinelerra-5.1/cinelerra/exportedl.C | 35 +- cinelerra-5.1/cinelerra/exportedl.h | 5 +- cinelerra-5.1/cinelerra/file.C | 47 +- cinelerra-5.1/cinelerra/file.h | 1 + cinelerra-5.1/cinelerra/file.inc | 24 + cinelerra-5.1/cinelerra/fileffmpeg.C | 2 + .../{awindowmenu.C => folderlistmenu.C} | 122 +- .../{awindowmenu.h => folderlistmenu.h} | 60 +- .../{awindowmenu.inc => folderlistmenu.inc} | 13 +- cinelerra-5.1/cinelerra/indexfile.C | 4 +- cinelerra-5.1/cinelerra/labeledit.C | 77 +- cinelerra-5.1/cinelerra/labeledit.h | 31 +- cinelerra-5.1/cinelerra/labeledit.inc | 10 +- cinelerra-5.1/cinelerra/labelpopup.C | 155 +++ cinelerra-5.1/cinelerra/labelpopup.h | 101 ++ cinelerra-5.1/cinelerra/labelpopup.inc | 29 + cinelerra-5.1/cinelerra/mbuttons.C | 2 +- cinelerra-5.1/cinelerra/mwindow.C | 59 +- cinelerra-5.1/cinelerra/mwindow.h | 2 +- cinelerra-5.1/cinelerra/mwindowedit.C | 1153 ++++++----------- cinelerra-5.1/cinelerra/mwindowgui.C | 6 - cinelerra-5.1/cinelerra/mwindowgui.h | 1 - cinelerra-5.1/cinelerra/render.C | 16 - cinelerra-5.1/cinelerra/timebar.C | 2 +- cinelerra-5.1/cinelerra/vtracking.C | 11 - cinelerra-5.1/cinelerra/vwindow.C | 8 - cinelerra-5.1/configure.ac | 3 + cinelerra-5.1/guicast/bcfilebox.C | 15 +- cinelerra-5.1/guicast/bcresources.C | 6 +- cinelerra-5.1/guicast/bcresources.inc | 3 +- cinelerra-5.1/guicast/guicast.h | 1 + cinelerra-5.1/guicast/images/file_label.png | Bin 0 -> 1382 bytes cinelerra-5.1/guicast/images/file_label_png.h | 96 ++ 54 files changed, 2313 insertions(+), 1831 deletions(-) create mode 100644 cinelerra-5.1/cinelerra/clippopup.C create mode 100644 cinelerra-5.1/cinelerra/clippopup.h create mode 100644 cinelerra-5.1/cinelerra/clippopup.inc rename cinelerra-5.1/cinelerra/{awindowmenu.C => folderlistmenu.C} (50%) rename cinelerra-5.1/cinelerra/{awindowmenu.h => folderlistmenu.h} (67%) rename cinelerra-5.1/cinelerra/{awindowmenu.inc => folderlistmenu.inc} (89%) create mode 100644 cinelerra-5.1/cinelerra/labelpopup.C create mode 100644 cinelerra-5.1/cinelerra/labelpopup.h create mode 100644 cinelerra-5.1/cinelerra/labelpopup.inc create mode 100644 cinelerra-5.1/guicast/images/file_label.png create mode 100644 cinelerra-5.1/guicast/images/file_label_png.h diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile index 512fe837..846e8284 100644 --- a/cinelerra-5.1/cinelerra/Makefile +++ b/cinelerra-5.1/cinelerra/Makefile @@ -40,7 +40,6 @@ OBJS = \ $(OBJDIR)/avc1394control.o \ $(OBJDIR)/avc1394transport.o \ $(OBJDIR)/awindowgui.o \ - $(OBJDIR)/awindowmenu.o \ $(OBJDIR)/awindow.o \ $(OBJDIR)/batch.o \ $(OBJDIR)/batchrender.o \ @@ -61,6 +60,7 @@ OBJS = \ $(OBJDIR)/chantables.o \ $(OBJDIR)/cicolors.o \ $(OBJDIR)/clipedit.o \ + $(OBJDIR)/clippopup.o \ $(OBJDIR)/colorpicker.o \ $(OBJDIR)/commercials.o \ $(OBJDIR)/commonrender.o \ @@ -124,6 +124,7 @@ OBJS = \ $(OBJDIR)/filexml.o \ $(OBJDIR)/floatauto.o \ $(OBJDIR)/floatautos.o \ + $(OBJDIR)/folderlistmenu.o \ $(OBJDIR)/formatcheck.o \ $(OBJDIR)/formatpopup.o \ $(OBJDIR)/formatpresets.o \ @@ -149,6 +150,7 @@ OBJS = \ $(OBJDIR)/keyframepopup.o \ $(OBJDIR)/keyframes.o \ $(OBJDIR)/labeledit.o \ + $(OBJDIR)/labelpopup.o \ $(OBJDIR)/labelnavigate.o \ $(OBJDIR)/labels.o \ $(OBJDIR)/levelwindowgui.o \ diff --git a/cinelerra-5.1/cinelerra/asset.C b/cinelerra-5.1/cinelerra/asset.C index 5a17fde8..4665551c 100644 --- a/cinelerra-5.1/cinelerra/asset.C +++ b/cinelerra-5.1/cinelerra/asset.C @@ -136,7 +136,6 @@ int Asset::init_values() use_header = 1; id = EDL::next_id(); - reset_timecode(); return 0; } @@ -175,17 +174,6 @@ void Asset::boundaries() //printf("Asset::boundaries %d %d %f\n", __LINE__, sample_rate, frame_rate); } -int Asset::reset_timecode() -{ - strcpy(reel_name, "cin0000"); - reel_number = 0; - tcstart = 0; - tcend = 0; - tcformat = 0; - - return 0; -} - void Asset::copy_from(Asset *asset, int do_index) { copy_location(asset); @@ -282,12 +270,6 @@ void Asset::copy_format(Asset *asset, int do_index) tiff_cmodel = asset->tiff_cmodel; tiff_compression = asset->tiff_compression; - - strcpy(reel_name, asset->reel_name); - reel_number = asset->reel_number; - tcstart = asset->tcstart; - tcend = asset->tcend; - tcformat = asset->tcformat; } int64_t Asset::get_index_offset(int channel) @@ -377,12 +359,7 @@ int Asset::equivalent(Asset &asset, int test_audio, int test_video, EDL *edl) interlace_fixmethod == asset.interlace_fixmethod && width == asset.width && height == asset.height && - !strcmp(vcodec, asset.vcodec) && - strcmp(reel_name, asset.reel_name) == 0 && - reel_number == asset.reel_number && - tcstart == asset.tcstart && - tcend == asset.tcend && - tcformat == asset.tcformat); + !strcmp(vcodec, asset.vcodec)); if(result && format == FILE_FFMPEG) result = !strcmp(ff_video_options, asset.ff_video_options) && ff_video_bitrate == asset.ff_video_bitrate && @@ -507,13 +484,6 @@ int Asset::read_audio(FileXML *file) audio_length = file->tag.get_property("AUDIO_LENGTH", (int64_t)0); acodec[0] = 0; file->tag.get_property("ACODEC", acodec); - - if(!video_data) - { - tcstart = 0; - tcend = audio_length; - tcformat = 0; - } return 0; } @@ -545,12 +515,6 @@ int Asset::read_video(FileXML *file) ilacefixmethod_to_xmltext(string, ILACE_FIXMETHOD_NONE); interlace_fixmethod = ilacefixmethod_from_xmltext(file->tag.get_property("INTERLACE_FIXMETHOD",string), ILACE_FIXMETHOD_NONE); - file->tag.get_property("REEL_NAME", reel_name); - reel_number = file->tag.get_property("REEL_NUMBER", reel_number); - tcstart = file->tag.get_property("TCSTART", tcstart); - tcend = file->tag.get_property("TCEND", tcend); - tcformat = file->tag.get_property("TCFORMAT", tcformat); - return 0; } @@ -706,13 +670,6 @@ int Asset::write_video(FileXML *file) ilacefixmethod_to_xmltext(string, interlace_fixmethod); file->tag.set_property("INTERLACE_FIXMETHOD", string); - - file->tag.set_property("REEL_NAME", reel_name); - file->tag.set_property("REEL_NUMBER", reel_number); - file->tag.set_property("TCSTART", tcstart); - file->tag.set_property("TCEND", tcend); - file->tag.set_property("TCFORMAT", tcformat); - file->append_tag(); if(video_data) file->tag.set_title("/VIDEO"); @@ -867,12 +824,6 @@ void Asset::load_defaults(BC_Hash *defaults, tiff_cmodel = GET_DEFAULT("TIFF_CMODEL", tiff_cmodel); tiff_compression = GET_DEFAULT("TIFF_COMPRESSION", tiff_compression); - GET_DEFAULT("REEL_NAME", reel_name); - reel_number = GET_DEFAULT("REEL_NUMBER", reel_number); - tcstart = GET_DEFAULT("TCSTART", tcstart); - tcend = GET_DEFAULT("TCEND", tcend); - tcformat = GET_DEFAULT("TCFORMAT", tcformat); - boundaries(); } @@ -992,12 +943,6 @@ void Asset::save_defaults(BC_Hash *defaults, UPDATE_DEFAULT("SINGLE_FRAME", single_frame); } - - UPDATE_DEFAULT("REEL_NAME", reel_name); - UPDATE_DEFAULT("REEL_NUMBER", reel_number); - UPDATE_DEFAULT("TCSTART", tcstart); - UPDATE_DEFAULT("TCEND", tcend); - UPDATE_DEFAULT("TCFORMAT", tcformat); } @@ -1031,11 +976,7 @@ int Asset::dump(FILE *fp) " height %d vcodec %4.4s aspect_ratio %f ilace_mode %s\n", video_data, layers, program, frame_rate, width, height, vcodec, aspect_ratio,string); - fprintf(fp," reel_name %s reel_number %i tcstart %jd tcend %jd tcf %d\n", - reel_name, reel_number, tcstart, tcend, tcformat); fprintf(fp," video_length %jd repeat %d\n", video_length, single_frame); - - return 0; } @@ -1114,23 +1055,3 @@ double Asset::total_length_framealigned(double fps) return 0; } -int Asset::set_timecode(char *tc, int format, int end) -{ - int hr, min, sec; - - hr = ((int) tc[0] - 48) * 10 + (int) tc[1] - 48; - min = ((int) tc[3] - 48) * 10 + (int) tc[4] - 48; - sec = ((int) tc[6] - 48) * 10 + (int) tc[7] - 48; - - // This needs to be modified to handle drop-frame - - if(end) - tcend = (int64_t) (((hr * 3600) + (min * 60) + sec) * frame_rate); - else - tcstart = (int64_t) (((hr * 3600) + (min * 60) + sec) * frame_rate); - - tcformat = format; - return 0; -} - - diff --git a/cinelerra-5.1/cinelerra/asset.h b/cinelerra-5.1/cinelerra/asset.h index 26fbfd70..4fa58aa4 100644 --- a/cinelerra-5.1/cinelerra/asset.h +++ b/cinelerra-5.1/cinelerra/asset.h @@ -96,8 +96,6 @@ public: int read_index(FileXML *xml); void reset_audio(); void reset_video(); - int set_timecode(char *tc, int format, int end); - int reset_timecode(); // Output path is the path of the output file if name truncation is desired. // It is a "" if; complete names should be used. @@ -146,13 +144,6 @@ public: int layers, program; double frame_rate; -// Timecode information. User setable, in case of errors in source - char reel_name[BCTEXTLEN]; - int reel_number; - int64_t tcstart; - int64_t tcend; - int tcformat; - int actual_width, actual_height; int width, height; // String or FourCC describing compression diff --git a/cinelerra-5.1/cinelerra/assetedit.C b/cinelerra-5.1/cinelerra/assetedit.C index 83833513..eebc32af 100644 --- a/cinelerra-5.1/cinelerra/assetedit.C +++ b/cinelerra-5.1/cinelerra/assetedit.C @@ -106,13 +106,6 @@ void AssetEdit::edit_asset(Indexable *indexable) void AssetEdit::handle_done_event(int result) { - if( !result && window->tc_hours_textbox ) { - changed_params->tcstart = ceil(indexable->get_frame_rate() * - (atoi(window->tc_hours_textbox->get_text()) * 3600 + - atoi(window->tc_minutes_textbox->get_text()) * 60 + - atoi(window->tc_seconds_textbox->get_text()))) + - atoi(window->tc_rest_textbox->get_text()); - } } void AssetEdit::handle_close_event(int result) @@ -194,23 +187,29 @@ BC_Window* AssetEdit::new_gui() return window; } - - - - - - - +int AssetEdit::window_height() +{ + int h = 128 + 64; + if( indexable->have_audio() ) + h += 180; + if( indexable->have_video() ) { + h += 200; + if( indexable->is_asset ) { + Asset *asset = (Asset *)indexable; + if( asset->format == FILE_MPEG || + asset->format == FILE_FFMPEG ) { + h += 40; + } + } + } + return h; +} AssetEditWindow::AssetEditWindow(MWindow *mwindow, AssetEdit *asset_edit) : BC_Window(_(PROGRAM_NAME ": Asset Info"), mwindow->gui->get_abs_cursor_x(1) - 400 / 2, - mwindow->gui->get_abs_cursor_y(1) - (128 + 64 + - (!asset_edit->indexable->have_audio() ? 0 : 180) + - (!asset_edit->indexable->have_video() ? 0 : 350)) / 2, - 450, (128 + 64 + - (!asset_edit->indexable->have_audio() ? 0 : 180) + - (!asset_edit->indexable->have_video() ? 0 : 350)), 0, 0, 1) + mwindow->gui->get_abs_cursor_y(1) - asset_edit->window_height() / 2, + 450, asset_edit->window_height(), 0, 0, 1) { this->mwindow = mwindow; this->asset_edit = asset_edit; @@ -221,10 +220,6 @@ AssetEditWindow::AssetEditWindow(MWindow *mwindow, AssetEdit *asset_edit) lohi = 0; allow_edits = 0; detail_thread = 0; - tc_hours_textbox = 0; - tc_minutes_textbox = 0; - tc_seconds_textbox = 0; - tc_rest_textbox = 0; win_width = 0; win_height = 0; } @@ -589,47 +584,6 @@ void AssetEditWindow::create_objects() ilacefixoption_chkboxw->ilacefixmethod_listbox = listboxw; ilacefixoption_chkboxw->showhideotherwidgets(); y += textboxw->get_h() + 5; - - x = x1; - add_subwindow(new BC_Title(x, y, _("Reel Name:"))); - x = x2; - add_subwindow(new AssetEditReelName(this, x, y)); - y += 30; - - x = x1; - add_subwindow(new BC_Title(x, y, _("Reel Number:"))); - x = x2; - add_subwindow(new AssetEditReelNumber(this, x, y)); - y += 30; - - x = x1; - add_subwindow(new BC_Title(x, y, _("Time Code Start:"))); - x = x2; - -// Calculate values to enter into textboxes - char text[32], *tc = text; - if( asset ) - Units::totext(tc, asset->tcstart / asset->frame_rate, - TIME_HMSF, asset->sample_rate, asset->frame_rate); - else - strcpy(tc, "0:00:00:00"); - - const char *tc_hours = tc, *tc_minutes, *tc_seconds, *tc_rest; - tc = strchr(tc, ':'); *tc++ = 0; tc_minutes = tc; - tc = strchr(tc, ':'); *tc++ = 0; tc_seconds = tc; - tc = strchr(tc, ':'); *tc++ = 0; tc_rest = tc; - - int padw = BC_Title::calculate_w(this, ":", MEDIUMFONT); - int fldw = BC_Title::calculate_w(this, "00", MEDIUMFONT) + 5; - add_subwindow(tc_hours_textbox = new BC_TextBox(x, y, fldw, 1, tc_hours)); - add_subwindow(new BC_Title(x += tc_hours_textbox->get_w(), y, ":")); - add_subwindow(tc_minutes_textbox = new BC_TextBox(x += padw, y, fldw, 1, tc_minutes)); - add_subwindow(new BC_Title(x += tc_minutes_textbox->get_w(), y, ":")); - add_subwindow(tc_seconds_textbox = new BC_TextBox(x += padw, y , fldw, 1, tc_seconds)); - add_subwindow(new BC_Title(x += tc_seconds_textbox->get_w(), y, ":")); - add_subwindow(tc_rest_textbox = new BC_TextBox(x += 10, y, fldw, 1, tc_rest)); - - y += 30; } add_subwindow(new BC_OKButton(this)); @@ -1071,44 +1025,3 @@ void DetailAssetThread::run() dwindow = 0; } - - - - -AssetEditReelName::AssetEditReelName(AssetEditWindow *fwindow, int x, int y) - : BC_TextBox(x, y, 220, 1, fwindow->asset_edit->changed_params->reel_name, - 1, MEDIUMFONT, 1) -{ - this->fwindow = fwindow; -} -AssetEditReelName::~AssetEditReelName() -{ -} -int AssetEditReelName::handle_event() -{ - Asset *asset = fwindow->asset_edit->changed_params; - strcpy(asset->reel_name, get_text()); - return 1; -} - - - - - -AssetEditReelNumber::AssetEditReelNumber(AssetEditWindow *fwindow, int x, int y) - : BC_TextBox(x, y, 200, 1, fwindow->asset_edit->changed_params->reel_number) -{ - this->fwindow = fwindow; -} -AssetEditReelNumber::~AssetEditReelNumber() -{ -} -int AssetEditReelNumber::handle_event() -{ - Asset *asset = fwindow->asset_edit->changed_params; - asset->reel_number = atoi(get_text()); - return 1; -} - - - diff --git a/cinelerra-5.1/cinelerra/assetedit.h b/cinelerra-5.1/cinelerra/assetedit.h index bc5503c9..a0070c81 100644 --- a/cinelerra-5.1/cinelerra/assetedit.h +++ b/cinelerra-5.1/cinelerra/assetedit.h @@ -23,6 +23,7 @@ #define ASSETEDIT_H #include "asset.inc" +#include "assetedit.inc" #include "awindow.inc" #include "bcdialog.h" #include "bitspopup.inc" @@ -35,18 +36,6 @@ #include "resizetrackthread.inc" -class AssetEditReelNumber; -class AssetEditReelName; -class AssetEditByteOrderHILO; -class AssetEditByteOrderLOHI; -class AssetEditPath; -class AssetEditPathText; -class AssetEditWindow; - -class DetailAssetWindow; -class DetailAssetThread; -class DetailAssetButton; - class AssetEdit : public BC_DialogThread { public: @@ -58,6 +47,7 @@ public: void handle_done_event(int result); void handle_close_event(int result); BC_Window* new_gui(); + int window_height(); Indexable *indexable; MWindow *mwindow; @@ -84,8 +74,6 @@ public: AssetEditPath *path_button; AssetEditByteOrderHILO *hilo; AssetEditByteOrderLOHI *lohi; - BC_TextBox *tc_hours_textbox, *tc_minutes_textbox; - BC_TextBox *tc_seconds_textbox, *tc_rest_textbox; BitsPopup *bitspopup; int allow_edits; MWindow *mwindow; @@ -276,28 +264,6 @@ public: AssetEditWindow *fwindow; }; -class AssetEditReelName : public BC_TextBox -{ -public: - AssetEditReelName(AssetEditWindow *fwindow, int x, int y); - ~AssetEditReelName(); - - int handle_event(); - - AssetEditWindow *fwindow; -}; - -class AssetEditReelNumber : public BC_TextBox -{ -public: - AssetEditReelNumber(AssetEditWindow *fwindow, int x, int y); - ~AssetEditReelNumber(); - - int handle_event(); - - AssetEditWindow *fwindow; -}; - class DetailAssetWindow : public BC_Window { MWindow *mwindow; diff --git a/cinelerra-5.1/cinelerra/assetedit.inc b/cinelerra-5.1/cinelerra/assetedit.inc index edadb2f0..2f0b5309 100644 --- a/cinelerra-5.1/cinelerra/assetedit.inc +++ b/cinelerra-5.1/cinelerra/assetedit.inc @@ -24,5 +24,23 @@ class AssetEdit; class AssetEditWindow; +class AssetEditPath; +class AssetEditPathText; +class AssetEditFormat; +class AssetEditChannels; +class AssetEditRate; +class AssetEditFRate; +class Interlaceautofix; +class AssetEditILaceautofixoption; +class AssetEditILacemode; +class AssetEditInterlacemodePulldown; +class AssetEditILacefixmethod; +class AssetEditHeader; +class AssetEditByteOrderLOHI; +class AssetEditByteOrderHILO; +class AssetEditSigned; +class DetailAssetWindow; +class DetailAssetThread; +class DetailAssetButton; #endif diff --git a/cinelerra-5.1/cinelerra/assetpopup.C b/cinelerra-5.1/cinelerra/assetpopup.C index 478b4568..14a538bb 100644 --- a/cinelerra-5.1/cinelerra/assetpopup.C +++ b/cinelerra-5.1/cinelerra/assetpopup.C @@ -19,19 +19,24 @@ * */ +#include "asset.h" #include "assetedit.h" #include "assetpopup.h" #include "assetremove.h" #include "awindow.h" #include "awindowgui.h" -#include "awindowmenu.h" +#include "bcdisplayinfo.h" #include "bcsignals.h" #include "clipedit.h" +#include "cstrdup.h" #include "cwindow.h" #include "cwindowgui.h" #include "edl.h" +#include "edlsession.h" +#include "filexml.h" #include "language.h" #include "localsession.h" +#include "mainerror.h" #include "mainindexes.h" #include "mainsession.h" #include "mwindow.h" @@ -41,13 +46,8 @@ #include "vwindowgui.h" - AssetPopup::AssetPopup(MWindow *mwindow, AWindowGUI *gui) - : BC_PopupMenu(0, - 0, - 0, - "", - 0) + : BC_PopupMenu(0, 0, 0, "", 0) { this->mwindow = mwindow; this->gui = gui; @@ -59,18 +59,24 @@ AssetPopup::~AssetPopup() void AssetPopup::create_objects() { + BC_MenuItem *menu_item; + BC_SubMenu *submenu; add_item(info = new AssetPopupInfo(mwindow, this)); - add_item(format = new AssetListFormat(mwindow)); + add_item(format = new AWindowListFormat(mwindow)); add_item(new AssetPopupSort(mwindow, this)); add_item(index = new AssetPopupBuildIndex(mwindow, this)); add_item(view = new AssetPopupView(mwindow, this)); add_item(view_window = new AssetPopupViewWindow(mwindow, this)); add_item(new AssetPopupPaste(mwindow, this)); - add_item(new AssetMatchSize(mwindow, this)); - add_item(new AssetMatchRate(mwindow, this)); - add_item(new AssetMatchAll(mwindow, this)); - add_item(new AssetPopupProjectRemove(mwindow, this)); - add_item(new AssetPopupDiskRemove(mwindow, this)); + add_item(menu_item = new BC_MenuItem(_("Match..."))); + menu_item->add_submenu(submenu = new BC_SubMenu()); + submenu->add_submenuitem(new AssetMatchSize(mwindow, this)); + submenu->add_submenuitem(new AssetMatchRate(mwindow, this)); + submenu->add_submenuitem(new AssetMatchAll(mwindow, this)); + add_item(menu_item = new BC_MenuItem(_("Remove..."))); + menu_item->add_submenu(submenu = new BC_SubMenu()); + submenu->add_submenuitem(new AssetPopupProjectRemove(mwindow, this)); + submenu->add_submenuitem(new AssetPopupDiskRemove(mwindow, this)); } void AssetPopup::paste_assets() @@ -125,13 +131,6 @@ int AssetPopup::update() } - - - - - - - AssetPopupInfo::AssetPopupInfo(MWindow *mwindow, AssetPopup *popup) : BC_MenuItem(_("Info...")) { @@ -160,10 +159,6 @@ int AssetPopupInfo::handle_event() } - - - - AssetPopupBuildIndex::AssetPopupBuildIndex(MWindow *mwindow, AssetPopup *popup) : BC_MenuItem(_("Rebuild index")) { @@ -183,11 +178,6 @@ int AssetPopupBuildIndex::handle_event() } - - - - - AssetPopupSort::AssetPopupSort(MWindow *mwindow, AssetPopup *popup) : BC_MenuItem(_("Sort items")) { @@ -206,11 +196,6 @@ int AssetPopupSort::handle_event() } - - - - - AssetPopupView::AssetPopupView(MWindow *mwindow, AssetPopup *popup) : BC_MenuItem(_("View")) { @@ -240,11 +225,6 @@ int AssetPopupView::handle_event() } - - - - - AssetPopupViewWindow::AssetPopupViewWindow(MWindow *mwindow, AssetPopup *popup) : BC_MenuItem(_("View in new window")) { @@ -277,11 +257,6 @@ int AssetPopupViewWindow::handle_event() } - - - - - AssetPopupPaste::AssetPopupPaste(MWindow *mwindow, AssetPopup *popup) : BC_MenuItem(_("Paste")) { @@ -300,12 +275,6 @@ int AssetPopupPaste::handle_event() } - - - - - - AssetMatchSize::AssetMatchSize(MWindow *mwindow, AssetPopup *popup) : BC_MenuItem(_("Match project size")) { @@ -319,13 +288,6 @@ int AssetMatchSize::handle_event() return 1; } - - - - - - - AssetMatchRate::AssetMatchRate(MWindow *mwindow, AssetPopup *popup) : BC_MenuItem(_("Match frame rate")) { @@ -339,83 +301,303 @@ int AssetMatchRate::handle_event() return 1; } +AssetMatchAll::AssetMatchAll(MWindow *mwindow, AssetPopup *popup) + : BC_MenuItem(_("Match all")) +{ + this->mwindow = mwindow; + this->popup = popup; +} +int AssetMatchAll::handle_event() +{ + popup->match_all(); + return 1; +} +AssetPopupProjectRemove::AssetPopupProjectRemove(MWindow *mwindow, AssetPopup *popup) + : BC_MenuItem(_("Remove from project")) +{ + this->mwindow = mwindow; + this->popup = popup; +} +AssetPopupProjectRemove::~AssetPopupProjectRemove() +{ +} +int AssetPopupProjectRemove::handle_event() +{ + mwindow->remove_assets_from_project(1, + 1, + mwindow->session->drag_assets, + mwindow->session->drag_clips); + return 1; +} -AssetMatchAll::AssetMatchAll(MWindow *mwindow, AssetPopup *popup) - : BC_MenuItem(_("Match all")) +AssetPopupDiskRemove::AssetPopupDiskRemove(MWindow *mwindow, AssetPopup *popup) + : BC_MenuItem(_("Remove from disk")) { this->mwindow = mwindow; this->popup = popup; } -int AssetMatchAll::handle_event() + +AssetPopupDiskRemove::~AssetPopupDiskRemove() { - popup->match_all(); +} + +int AssetPopupDiskRemove::handle_event() +{ + mwindow->awindow->asset_remove->start(); return 1; } +AssetListMenu::AssetListMenu(MWindow *mwindow, AWindowGUI *gui) + : BC_PopupMenu(0, 0, 0, "", 0) +{ + this->mwindow = mwindow; + this->gui = gui; +} +AssetListMenu::~AssetListMenu() +{ +} +void AssetListMenu::create_objects() +{ + add_item(format = new AWindowListFormat(mwindow)); + add_item(new AWindowListSort(mwindow)); + add_item(new AssetListCopy(mwindow)); + add_item(new AssetListPaste(mwindow)); + update_titles(); +} +void AssetListMenu::update_titles() +{ + format->update(); +} +AssetListCopy::AssetListCopy(MWindow *mwindow) + : BC_MenuItem(_("Copy file list")) +{ + this->mwindow = mwindow; + copy_dialog = 0; +} +AssetListCopy::~AssetListCopy() +{ + delete copy_dialog; +} +int AssetListCopy::handle_event() +{ + int len = 0; + MWindowGUI *gui = mwindow->gui; + gui->lock_window("AssetListCopy::handle_event"); + mwindow->awindow->gui->collect_assets(); + int n = mwindow->session->drag_assets->total; + for( int i=0; isession->drag_assets->values[i]; + const char *path = indexable->path; + if( !*path ) continue; + len += strlen(path) + 1; + } + char *text = new char[len+1], *cp = text; + for( int i=0; isession->drag_assets->values[i]; + const char *path = indexable->path; + if( !*path ) continue; + cp += sprintf(cp, "%s\n", path); + } + *cp = 0; + gui->unlock_window(); + if( n ) { + if( !copy_dialog ) + copy_dialog = new AssetCopyDialog(this); + copy_dialog->start(text); + } + else { + eprintf(_("Nothing selected")); + delete [] text; + } + return 1; +} +AssetCopyDialog::AssetCopyDialog(AssetListCopy *copy) + : BC_DialogThread() +{ + this->copy = copy; + copy_window = 0; +} +void AssetCopyDialog::start(char *text) +{ + close_window(); + this->text = text; + BC_DialogThread::start(); +} +AssetCopyDialog::~AssetCopyDialog() +{ + close_window(); +} +BC_Window* AssetCopyDialog::new_gui() +{ + BC_DisplayInfo display_info; + int x = display_info.get_abs_cursor_x(); + int y = display_info.get_abs_cursor_y(); + copy_window = new AssetCopyWindow(this, x, y); + copy_window->create_objects(); + return copy_window; +} -AssetPopupProjectRemove::AssetPopupProjectRemove(MWindow *mwindow, AssetPopup *popup) - : BC_MenuItem(_("Remove from project")) +void AssetCopyDialog::handle_done_event(int result) { - this->mwindow = mwindow; - this->popup = popup; + delete [] text; text = 0; } +void AssetCopyDialog::handle_close_event(int result) +{ + copy_window = 0; +} -AssetPopupProjectRemove::~AssetPopupProjectRemove() +AssetCopyWindow::AssetCopyWindow(AssetCopyDialog *copy_dialog, int x, int y) + : BC_Window(_(PROGRAM_NAME ": Copy File List"), x, y, 500, 200, 500, 200, 0, 0, 1) { + this->copy_dialog = copy_dialog; } -int AssetPopupProjectRemove::handle_event() +AssetCopyWindow::~AssetCopyWindow() { - mwindow->remove_assets_from_project(1, - 1, - mwindow->session->drag_assets, - mwindow->session->drag_clips); - return 1; } +void AssetCopyWindow::create_objects() +{ + BC_Title *title; + int x = 10, y = 10, pad = 5; + add_subwindow(title = new BC_Title(x, y, _("List of asset paths:"))); + y += title->get_h() + pad; + int text_w = get_w() - x - 10; + int text_h = get_h() - y - BC_OKButton::calculate_h() - pad; + int text_rows = BC_TextBox::pixels_to_rows(this, MEDIUMFONT, text_h); + char *text = copy_dialog->text; + int len = strlen(text) + BCTEXTLEN; + file_list = new BC_ScrollTextBox(this, x, y, text_w, text_rows, text, len); + file_list->create_objects(); + add_subwindow(new BC_OKButton(this)); + show_window(); +} -AssetPopupDiskRemove::AssetPopupDiskRemove(MWindow *mwindow, AssetPopup *popup) - : BC_MenuItem(_("Remove from disk")) +AssetListPaste::AssetListPaste(MWindow *mwindow) + : BC_MenuItem(_("Paste file list")) { this->mwindow = mwindow; - this->popup = popup; + paste_dialog = 0; +} +AssetListPaste::~AssetListPaste() +{ + delete paste_dialog; } +int AssetListPaste::handle_event() +{ + if( !paste_dialog ) + paste_dialog = new AssetPasteDialog(this); + paste_dialog->start(); + return 1; +} -AssetPopupDiskRemove::~AssetPopupDiskRemove() +AssetPasteDialog::AssetPasteDialog(AssetListPaste *paste) + : BC_DialogThread() { + this->paste = paste; + paste_window = 0; } +AssetPasteDialog::~AssetPasteDialog() +{ + close_window(); +} -int AssetPopupDiskRemove::handle_event() +BC_Window* AssetPasteDialog::new_gui() { - mwindow->awindow->asset_remove->start(); - return 1; + BC_DisplayInfo display_info; + int x = display_info.get_abs_cursor_x(); + int y = display_info.get_abs_cursor_y(); + + paste_window = new AssetPasteWindow(this, x, y); + paste_window->create_objects(); + return paste_window; +} + +void AssetPasteDialog::handle_done_event(int result) +{ + if( result ) return; + const char *bp = paste_window->file_list->get_text(), *ep = bp+strlen(bp); + ArrayList path_list; + path_list.set_array_delete(); + + for( const char *cp=bp; cp0 && cpmwindow; + mwindow->interrupt_indexes(); + mwindow->gui->lock_window("AssetPasteDialog::handle_done_event"); + result = mwindow->load_filenames(&path_list, LOADMODE_RESOURCESONLY, 0); + mwindow->gui->unlock_window(); + path_list.remove_all_objects(); + mwindow->save_backup(); + mwindow->restart_brender(); + mwindow->session->changes_made = 1; } +void AssetPasteDialog::handle_close_event(int result) +{ + paste_window = 0; +} + + +AssetPasteWindow::AssetPasteWindow(AssetPasteDialog *paste_dialog, int x, int y) + : BC_Window(_(PROGRAM_NAME ": Paste File List"), x, y, 500, 200, 500, 200, 0, 0, 1) +{ + this->paste_dialog = paste_dialog; +} +AssetPasteWindow::~AssetPasteWindow() +{ +} +void AssetPasteWindow::create_objects() +{ + BC_Title *title; + int x = 10, y = 10, pad = 5; + add_subwindow(title = new BC_Title(x, y, _("Enter list of asset paths:"))); + y += title->get_h() + pad; + int text_w = get_w() - x - 10; + int text_h = get_h() - y - BC_OKButton::calculate_h() - pad; + int text_rows = BC_TextBox::pixels_to_rows(this, MEDIUMFONT, text_h); + file_list = new BC_ScrollTextBox(this, x, y, text_w, text_rows, (char*)0, 65536); + file_list->create_objects(); + add_subwindow(new BC_OKButton(this)); + add_subwindow(new BC_CancelButton(this)); + show_window(); +} diff --git a/cinelerra-5.1/cinelerra/assetpopup.h b/cinelerra-5.1/cinelerra/assetpopup.h index 8bb458f9..e0611ecf 100644 --- a/cinelerra-5.1/cinelerra/assetpopup.h +++ b/cinelerra-5.1/cinelerra/assetpopup.h @@ -22,14 +22,9 @@ #ifndef ASSETPOPUP_H #define ASSETPOPUP_H -class AssetPopupInfo; -class AssetPopupBuildIndex; -class AssetPopupView; -class AssetPopupViewWindow; - #include "assetedit.inc" +#include "assetpopup.inc" #include "awindowgui.inc" -#include "awindowmenu.inc" #include "edl.inc" #include "guicast.h" #include "assets.inc" @@ -59,7 +54,7 @@ public: AssetPopupBuildIndex *index; AssetPopupView *view; AssetPopupViewWindow *view_window; - AssetListFormat *format; + AWindowListFormat *format; }; class AssetPopupInfo : public BC_MenuItem @@ -194,5 +189,96 @@ public: AssetPopup *popup; }; +class AssetListMenu : public BC_PopupMenu +{ +public: + AssetListMenu(MWindow *mwindow, AWindowGUI *gui); + ~AssetListMenu(); + + void create_objects(); + void update_titles(); + + MWindow *mwindow; + AWindowGUI *gui; + AWindowListFormat *format; +}; + +class AssetListCopy : public BC_MenuItem +{ +public: + AssetListCopy(MWindow *mwindow); + ~AssetListCopy(); + + int handle_event(); + + MWindow *mwindow; + AssetCopyDialog *copy_dialog; +}; + +class AssetCopyDialog : public BC_DialogThread +{ +public: + AssetCopyDialog(AssetListCopy *copy); + ~AssetCopyDialog(); + + void start(char *text); + BC_Window* new_gui(); + void handle_done_event(int result); + void handle_close_event(int result); + + char *text; + AssetListCopy *copy; + AssetCopyWindow *copy_window; +}; + +class AssetCopyWindow : public BC_Window +{ +public: + AssetCopyWindow(AssetCopyDialog *copy_dialog, int x, int y); + ~AssetCopyWindow(); + + void create_objects(); + + AssetCopyDialog *copy_dialog; + BC_ScrollTextBox *file_list; +}; + +class AssetListPaste : public BC_MenuItem +{ +public: + AssetListPaste(MWindow *mwindow); + ~AssetListPaste(); + + int handle_event(); + + MWindow *mwindow; + AssetPasteDialog *paste_dialog; +}; + +class AssetPasteDialog : public BC_DialogThread +{ +public: + AssetPasteDialog(AssetListPaste *paste); + ~AssetPasteDialog(); + + BC_Window* new_gui(); + void handle_done_event(int result); + void handle_close_event(int result); + + AssetListPaste *paste; + AssetPasteWindow *paste_window; +}; + +class AssetPasteWindow : public BC_Window +{ +public: + AssetPasteWindow(AssetPasteDialog *paste_dialog, int x, int y); + ~AssetPasteWindow(); + + void create_objects(); + + AssetPasteDialog *paste_dialog; + BC_ScrollTextBox *file_list; +}; #endif diff --git a/cinelerra-5.1/cinelerra/assetpopup.inc b/cinelerra-5.1/cinelerra/assetpopup.inc index 52384571..537f1174 100644 --- a/cinelerra-5.1/cinelerra/assetpopup.inc +++ b/cinelerra-5.1/cinelerra/assetpopup.inc @@ -23,5 +23,23 @@ #define ASSETPOPUP_INC class AssetPopup; +class AssetPopupInfo; +class AssetPopupSort; +class AssetPopupBuildIndex; +class AssetPopupView; +class AssetPopupViewWindow; +class AssetPopupPaste; +class AssetMatchSize; +class AssetMatchRate; +class AssetMatchAll; +class AssetPopupProjectRemove; +class AssetPopupDiskRemove; +class AssetListMenu; +class AssetListCopy; +class AssetCopyDialog; +class AssetCopyWindow; +class AssetListPaste; +class AssetPasteDialog; +class AssetPasteWindow; #endif diff --git a/cinelerra-5.1/cinelerra/assets.C b/cinelerra-5.1/cinelerra/assets.C index 7411b59a..7585966e 100644 --- a/cinelerra-5.1/cinelerra/assets.C +++ b/cinelerra-5.1/cinelerra/assets.C @@ -65,8 +65,7 @@ int Assets::load(FileXML *file, uint32_t load_flags) { Asset *new_asset = new Asset(path); new_asset->read(file); - Asset *asset = update(new_asset); - asset->copy_from(new_asset,1); + update(new_asset); new_asset->Garbage::remove_user(); } } @@ -107,14 +106,6 @@ void Assets::copy_from(Assets *assets) } } -Assets& Assets::operator=(Assets &assets) -{ -printf("Assets::operator= 1\n"); - copy_from(&assets); - return *this; -} - - void Assets::update_index(Asset *asset) { if(!asset) return; diff --git a/cinelerra-5.1/cinelerra/assets.h b/cinelerra-5.1/cinelerra/assets.h index 32412925..1ce7dc90 100644 --- a/cinelerra-5.1/cinelerra/assets.h +++ b/cinelerra-5.1/cinelerra/assets.h @@ -43,11 +43,8 @@ public: Assets(EDL *edl); virtual ~Assets(); - int load(FileXML *xml, - uint32_t load_flags); - int save(FileXML *xml, - char *output_path); - Assets& operator=(Assets &assets); + int load(FileXML *xml, uint32_t load_flags); + int save(FileXML *xml, char *output_path); void copy_from(Assets *assets); // Enter a new asset into the table. @@ -57,18 +54,9 @@ public: // Update the index information for assets with the same path void update_index(Asset *asset); - // Parent EDL EDL *edl; - - - - - - - - int delete_all(); int dump(FILE *fp=stdout); @@ -91,7 +79,4 @@ public: int update_old_filename(char *old_filename, char *new_filename); }; - - - #endif diff --git a/cinelerra-5.1/cinelerra/awindow.C b/cinelerra-5.1/cinelerra/awindow.C index f6a87ed8..e416b130 100644 --- a/cinelerra-5.1/cinelerra/awindow.C +++ b/cinelerra-5.1/cinelerra/awindow.C @@ -26,6 +26,7 @@ #include "bcsignals.h" #include "clipedit.h" #include "labeledit.h" +#include "labelpopup.h" AWindow::AWindow(MWindow *mwindow) : Thread(1, 0, 0) diff --git a/cinelerra-5.1/cinelerra/awindow.h b/cinelerra-5.1/cinelerra/awindow.h index 6b1584bd..3a3af095 100644 --- a/cinelerra-5.1/cinelerra/awindow.h +++ b/cinelerra-5.1/cinelerra/awindow.h @@ -29,6 +29,7 @@ #include "bcwindowbase.inc" #include "clipedit.inc" #include "labeledit.inc" +#include "labelpopup.inc" #include "mwindow.inc" #include "thread.h" diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 89080802..049be4e8 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -24,13 +24,12 @@ #include "assetpopup.h" #include "assets.h" #include "awindowgui.h" -#include "awindowgui.inc" #include "awindow.h" -#include "awindowmenu.h" #include "bcsignals.h" #include "bchash.h" #include "cache.h" #include "bccmodels.h" +#include "clippopup.h" #include "cursors.h" #include "cwindowgui.h" #include "cwindow.h" @@ -38,11 +37,12 @@ #include "edlsession.h" #include "file.h" #include "filesystem.h" +#include "folderlistmenu.h" #include "indexable.h" #include "keys.h" #include "language.h" #include "labels.h" -#include "labeledit.h" +#include "labelpopup.h" #include "localsession.h" #include "mainmenu.h" #include "mainsession.h" @@ -211,8 +211,8 @@ AssetPicon::~AssetPicon() { if( vicon ) gui->vicon_thread->del_vicon(vicon); - if(indexable) indexable->remove_user(); - if(edl) edl->remove_user(); + if( indexable ) indexable->remove_user(); + if( edl ) edl->remove_user(); if( icon && !gui->protected_pixmap(icon) ) { delete icon; if( !plugin ) delete icon_vframe; @@ -242,53 +242,46 @@ void AssetPicon::create_objects() pixmap_h = 50 * BC_WindowBase::get_resources()->icon_scale; - if(debug) printf("AssetPicon::create_objects %d\n", __LINE__); - if(indexable) - { + if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__); + if( indexable ) { fs.extract_name(name, indexable->path); set_text(name); } - if(indexable && indexable->is_asset) - { - if(debug) printf("AssetPicon::create_objects %d\n", __LINE__); + if( indexable && indexable->is_asset ) { + if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__); Asset *asset = (Asset*)indexable; - if(asset->video_data) - { - if(mwindow->preferences->use_thumbnails) - { + if( asset->video_data ) { + if( mwindow->preferences->use_thumbnails ) { gui->unlock_window(); - if(debug) printf("AssetPicon::create_objects %d\n", __LINE__); + if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__); File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1); - if(debug) printf("AssetPicon::create_objects %d\n", __LINE__); + if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__); - if(file) - { + if( file ) { int height = asset->height > 0 ? asset->height : 1; pixmap_w = pixmap_h * asset->width / height; file->set_layer(0); file->set_video_position(0, 0); - if(gui->temp_picon && + if( gui->temp_picon && (gui->temp_picon->get_w() != asset->width || - gui->temp_picon->get_h() != asset->height)) - { + gui->temp_picon->get_h() != asset->height) ) { delete gui->temp_picon; gui->temp_picon = 0; } - if(!gui->temp_picon) - { + if( !gui->temp_picon ) { gui->temp_picon = new VFrame(0, -1, asset->width, asset->height, BC_RGB888, -1); } file->read_frame(gui->temp_picon); - if(debug) printf("AssetPicon::create_objects %d\n", __LINE__); + if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__); mwindow->video_cache->check_in(asset); gui->lock_window("AssetPicon::create_objects 1"); @@ -308,49 +301,43 @@ void AssetPicon::create_objects() int64_t length = secs * gui->vicon_thread->refresh_rate; vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length); gui->vicon_thread->add_vicon(vicon); - if(debug) printf("AssetPicon::create_objects %d\n", __LINE__); + if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__); } - else - { + else { gui->lock_window("AssetPicon::create_objects 2"); icon = gui->video_icon; icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM]; } } - else - { + else { icon = gui->video_icon; icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM]; } } else - if(asset->audio_data) - { + if( asset->audio_data ) { icon = gui->audio_icon; icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND]; } //printf("AssetPicon::create_objects 2\n"); - if(debug) printf("AssetPicon::create_objects %d\n", __LINE__); + if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__); } else - if(indexable && !indexable->is_asset) - { + if( indexable && !indexable->is_asset ) { icon = gui->video_icon; icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM]; } else - if(edl) - { + if( edl ) { //printf("AssetPicon::create_objects 4 %s\n", edl->local_session->clip_title); set_text(strcpy(name, edl->local_session->clip_title)); icon = gui->clip_icon; icon_vframe = mwindow->theme->get_image("clip_icon"); } else - if(plugin) - { + if( plugin ) { strcpy(name, _(plugin->title)); set_text(name); icon_vframe = plugin->get_picon(); @@ -390,7 +377,7 @@ void AssetPicon::create_objects() } } else - if(label) { + if( label ) { Units::totext(name, label->position, mwindow->edl->session->time_format, @@ -398,8 +385,8 @@ void AssetPicon::create_objects() mwindow->edl->session->frame_rate, mwindow->edl->session->frames_per_foot); set_text(name); - icon = gui->file_icon; - icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_UNKNOWN]; + icon = gui->label_icon; + icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_LABEL]; set_icon(icon); set_icon_vframe(icon_vframe); } @@ -410,7 +397,7 @@ void AssetPicon::create_objects() set_icon(icon); set_icon_vframe(icon_vframe); - if(debug) printf("AssetPicon::create_objects %d\n", __LINE__); + if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__); } @@ -436,6 +423,7 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow) video_icon = 0; folder_icon = 0; clip_icon = 0; + label_icon = 0; atransition_icon = 0; atransition_vframe = 0; vtransition_icon = 0; vtransition_vframe = 0; aeffect_icon = 0; aeffect_vframe = 0; @@ -447,6 +435,8 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow) newfolder_thread = 0; asset_menu = 0; assetlist_menu = 0; + cliplist_menu = 0; + labellist_menu = 0; folderlist_menu = 0; temp_picon = 0; allow_iconlisting = 1; @@ -472,6 +462,7 @@ AWindowGUI::~AWindowGUI() delete video_icon; delete folder_icon; delete clip_icon; + delete label_icon; delete atransition_icon; delete vtransition_icon; delete aeffect_icon; @@ -484,10 +475,13 @@ AWindowGUI::~AWindowGUI() delete veffect_icon; delete newfolder_thread; delete asset_menu; + delete clip_menu; delete label_menu; delete assetlist_menu; + delete cliplist_menu; + delete labellist_menu; delete folderlist_menu; - if(temp_picon) delete temp_picon; + if( temp_picon ) delete temp_picon; delete remove_plugin; } @@ -498,6 +492,7 @@ bool AWindowGUI::protected_pixmap(BC_Pixmap *icon) icon == audio_icon || icon == video_icon || icon == clip_icon || + icon == label_icon || icon == vtransition_icon || icon == atransition_icon || icon == veffect_icon || @@ -536,6 +531,10 @@ SET_TRACE BC_WindowBase::get_resources()->type_to_icon[ICON_FILM], PIXMAP_ALPHA); + label_icon = new BC_Pixmap(this, + BC_WindowBase::get_resources()->type_to_icon[ICON_LABEL], + PIXMAP_ALPHA); + SET_TRACE clip_vframe = mwindow->theme->get_image("clip_icon"); @@ -626,24 +625,24 @@ SET_TRACE add_subwindow(asset_menu = new AssetPopup(mwindow, this)); asset_menu->create_objects(); - + add_subwindow(clip_menu = new ClipPopup(mwindow, this)); + clip_menu->create_objects(); add_subwindow(label_menu = new LabelPopup(mwindow, this)); label_menu->create_objects(); -SET_TRACE - add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this)); - -SET_TRACE assetlist_menu->create_objects(); - + add_subwindow(cliplist_menu = new ClipListMenu(mwindow, this)); + cliplist_menu->create_objects(); + add_subwindow(labellist_menu = new LabelListMenu(mwindow, this)); + labellist_menu->create_objects(); SET_TRACE add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this)); folderlist_menu->create_objects(); +SET_TRACE //printf("AWindowGUI::create_objects 2\n"); -SET_TRACE create_custom_xatoms(); unlock_window(); } @@ -860,15 +859,15 @@ BC_Window* AWindowRemovePlugin::new_gui() int AWindowGUI::keypress_event() { - switch(get_keypress()) { + switch( get_keypress() ) { case 'w': case 'W': - if(ctrl_down()) { + if( ctrl_down() ) { close_event(); return 1; } break; case DELETE: - if(shift_down()) { + if( shift_down() ) { PluginServer* plugin = selected_plugin(); if( !plugin ) break; remove_plugin = new AWindowRemovePlugin(awindow, plugin); @@ -913,33 +912,28 @@ void AWindowGUI::update_folder_list() { stop_vicon_drawing(); //printf("AWindowGUI::update_folder_list 1\n"); - for(int i = 0; i < folders.total; i++) - { + for( int i = 0; i < folders.total; i++ ) { AssetPicon *picon = (AssetPicon*)folders.values[i]; picon->in_use--; } //printf("AWindowGUI::update_folder_list 1\n"); // Search assets for folders - for(int i = 0; i < mwindow->edl->folders.total; i++) - { + for( int i = 0; i < mwindow->edl->folders.total; i++ ) { const char *folder = mwindow->edl->folders.values[i]; int exists = 0; //printf("AWindowGUI::update_folder_list 1.1\n"); - for(int j = 0; j < folders.total; j++) - { + for( int j = 0; j < folders.total; j++ ) { AssetPicon *picon = (AssetPicon*)folders.values[j]; - if(!strcasecmp(picon->get_text(), folder)) - { + if( !strcasecmp(picon->get_text(), folder) ) { exists = 1; picon->in_use = 1; break; } } - if(!exists) - { + if( !exists ) { int aw_folder = folder_number(folder); AssetPicon *picon = aw_folder >= 0 ? new AssetPicon(mwindow, this, aw_folder) : @@ -950,20 +944,18 @@ void AWindowGUI::update_folder_list() //printf("AWindowGUI::update_folder_list 1.3\n"); } //printf("AWindowGUI::update_folder_list 1\n"); -//for(int i = 0; i < folders.total; i++) +//for( int i = 0; i < folders.total; i++ ) // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text()); // Delete excess - for(int i = folders.total - 1; i >= 0; i--) - { + for( int i = folders.total - 1; i >= 0; i-- ) { AssetPicon *picon = (AssetPicon*)folders.values[i]; - if(!picon->in_use && !picon->persistent) - { + if( !picon->in_use && !picon->persistent ) { delete picon; folders.remove_number(i); } } -//for(int i = 0; i < folders.total; i++) +//for( int i = 0; i < folders.total; i++ ) // printf("AWindowGUI::update_folder_list %s\n", folders.values[i]->get_text()); //printf("AWindowGUI::update_folder_list 2\n"); start_vicon_drawing(); @@ -977,10 +969,10 @@ void AWindowGUI::create_persistent_folder(ArrayList *output, mwindow->search_plugindb(do_audio, do_video, is_realtime, is_transition, 0, plugin_list); - for(int i = 0; i < plugin_list.total; i++) { + for( int i = 0; i < plugin_list.total; i++ ) { PluginServer *server = plugin_list.values[i]; int visible = plugin_visibility & (1<dir_idx); - if(!visible) continue; + if( !visible ) continue; // Create new listitem AssetPicon *picon = new AssetPicon(mwindow, this, server); picon->create_objects(); @@ -991,7 +983,7 @@ void AWindowGUI::create_persistent_folder(ArrayList *output, void AWindowGUI::create_label_folder() { Label *current; - for(current = mwindow->edl->labels->first; current; current = NEXT) { + for( current = mwindow->edl->labels->first; current; current = NEXT ) { AssetPicon *picon = new AssetPicon(mwindow, this, current); picon->create_objects(); labellist.append(picon); @@ -1002,8 +994,7 @@ void AWindowGUI::create_label_folder() void AWindowGUI::update_asset_list() { //printf("AWindowGUI::update_asset_list 1\n"); - for(int i = 0; i < assets.total; i++) - { + for( int i = 0; i < assets.total; i++ ) { AssetPicon *picon = (AssetPicon*)assets.values[i]; picon->in_use--; } @@ -1016,17 +1007,14 @@ void AWindowGUI::update_asset_list() // Synchronize EDL clips - for(int i = 0; i < mwindow->edl->clips.total; i++) - { + for( int i = 0; i < mwindow->edl->clips.total; i++ ) { int exists = 0; // Look for clip in existing listitems - for(int j = 0; j < assets.total && !exists; j++) - { + for( int j = 0; j < assets.total && !exists; j++ ) { AssetPicon *picon = (AssetPicon*)assets.values[j]; - if(picon->id == mwindow->edl->clips.values[i]->id) - { + if( picon->id == mwindow->edl->clips.values[i]->id ) { picon->edl = mwindow->edl->clips.values[i]; picon->set_text(mwindow->edl->clips.values[i]->local_session->clip_title); exists = 1; @@ -1035,8 +1023,7 @@ void AWindowGUI::update_asset_list() } // Create new listitem - if(!exists) - { + if( !exists ) { AssetPicon *picon = new AssetPicon(mwindow, this, mwindow->edl->clips.values[i]); @@ -1053,19 +1040,16 @@ void AWindowGUI::update_asset_list() // Synchronize EDL assets - for(Asset *current = mwindow->edl->assets->first; + for( Asset *current = mwindow->edl->assets->first; current; - current = NEXT) - { + current = NEXT ) { int exists = 0; // Look for asset in existing listitems - for(int j = 0; j < assets.total && !exists; j++) - { + for( int j = 0; j < assets.total && !exists; j++ ) { AssetPicon *picon = (AssetPicon*)assets.values[j]; - if(picon->id == current->id) - { + if( picon->id == current->id ) { picon->indexable = current; exists = 1; picon->in_use = 1; @@ -1074,8 +1058,7 @@ void AWindowGUI::update_asset_list() } // Create new listitem - if(!exists) - { + if( !exists ) { //printf("AWindowGUI::update_asset_list %d\n", __LINE__); AssetPicon *picon = new AssetPicon(mwindow, this, current); //printf("AWindowGUI::update_asset_list %d\n", __LINE__); @@ -1091,18 +1074,15 @@ void AWindowGUI::update_asset_list() // Synchronize nested EDLs - for(int i = 0; i < mwindow->edl->nested_edls->size(); i++) - { + for( int i = 0; i < mwindow->edl->nested_edls->size(); i++ ) { int exists = 0; Indexable *indexable = mwindow->edl->nested_edls->get(i); // Look for asset in existing listitems - for(int j = 0; j < assets.total && !exists; j++) - { + for( int j = 0; j < assets.total && !exists; j++ ) { AssetPicon *picon = (AssetPicon*)assets.values[j]; - if(picon->id == indexable->id) - { + if( picon->id == indexable->id ) { picon->indexable = indexable; exists = 1; picon->in_use = 1; @@ -1111,8 +1091,7 @@ void AWindowGUI::update_asset_list() } // Create new listitem - if(!exists) - { + if( !exists ) { AssetPicon *picon = new AssetPicon(mwindow, this, indexable); @@ -1130,12 +1109,10 @@ void AWindowGUI::update_asset_list() //printf("AWindowGUI::update_asset_list %d\n", __LINE__); - for(int i = assets.size() - 1; i >= 0; i--) - { + for( int i = assets.size() - 1; i >= 0; i-- ) { AssetPicon *picon = (AssetPicon*)assets.get(i); //printf("AWindowGUI::update_asset_list %s %d\n", picon->asset->path, picon->in_use); - if(!picon->in_use) - { + if( !picon->in_use ) { delete picon; assets.remove_number(i); } @@ -1147,7 +1124,7 @@ void AWindowGUI::update_picon(Indexable *indexable) { //printf("AWindowGUI::update_asset_list 1\n"); VIcon *vicon = 0; - for(int i = 0; i < assets.total; i++) { + for( int i = 0; i < assets.total; i++ ) { AssetPicon *picon = (AssetPicon*)assets.values[i]; if( picon->indexable == indexable || picon->edl == (EDL *)indexable ) { @@ -1184,7 +1161,7 @@ void AWindowGUI::sort_assets() sort_picons(&vtransitions); break; case AW_LABEL_FOLDER: - // Labels should ALWAYS be sorted by time + sort_picons(&labellist); break; default: sort_picons(&assets); @@ -1201,10 +1178,10 @@ void AWindowGUI::collect_assets() while(1) { AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++); - if(!result) break; + if( !result ) break; - if(result->indexable) mwindow->session->drag_assets->append(result->indexable); - if(result->edl) mwindow->session->drag_clips->append(result->edl); + if( result->indexable ) mwindow->session->drag_assets->append(result->indexable); + if( result->edl ) mwindow->session->drag_clips->append(result->edl); } } @@ -1216,9 +1193,8 @@ void AWindowGUI::copy_picons(ArrayList *dst, dst[1].remove_all_objects(); // Create new pointers -//if(folder) printf("AWindowGUI::copy_picons 1 %s\n", folder); - for(int i = 0; i < src->total; i++) - { +//if( folder ) printf("AWindowGUI::copy_picons 1 %s\n", folder); + for( int i = 0; i < src->total; i++ ) { AssetPicon *picon = (AssetPicon*)src->values[i]; //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder); if( folder < 0 || @@ -1226,10 +1202,10 @@ void AWindowGUI::copy_picons(ArrayList *dst, (picon->edl && picon->edl->local_session->awindow_folder == folder) ) { BC_ListBoxItem *item2, *item1; dst[0].append(item1 = picon); - if(picon->edl) + if( picon->edl ) dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes)); else - if(picon->label && picon->label->textstr) + if( picon->label && picon->label->textstr ) dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr)); else dst[1].append(item2 = new BC_ListBoxItem("")); @@ -1247,16 +1223,14 @@ void AWindowGUI::sort_picons(ArrayList *src) while(!done) { done = 1; - for(int i = 0; i < src->total - 1; i++) - { + for( int i = 0; i < src->total - 1; i++ ) { BC_ListBoxItem *item1 = src->values[i]; BC_ListBoxItem *item2 = src->values[i + 1]; item1->set_autoplace_icon(1); item2->set_autoplace_icon(1); item1->set_autoplace_text(1); item2->set_autoplace_text(1); - if(strcmp(item1->get_text(), item2->get_text()) > 0) - { + if( strcmp(item1->get_text(), item2->get_text()) > 0 ) { src->values[i + 1] = item1; src->values[i] = item2; done = 0; @@ -1268,7 +1242,7 @@ void AWindowGUI::sort_picons(ArrayList *src) void AWindowGUI::filter_displayed_assets() { - allow_iconlisting = 1; + //allow_iconlisting = 1; asset_titles[0] = _("Title"); asset_titles[1] = _("Comments"); @@ -1289,7 +1263,7 @@ void AWindowGUI::filter_displayed_assets() copy_picons(displayed_assets, &labellist, AW_NO_FOLDER); asset_titles[0] = _("Time Stamps"); asset_titles[1] = _("Title"); - allow_iconlisting = 0; + //allow_iconlisting = 0; break; default: copy_picons(displayed_assets, &assets, mwindow->edl->session->awindow_folder); @@ -1297,7 +1271,7 @@ void AWindowGUI::filter_displayed_assets() } // Ensure the current folder icon is highlighted - for(int i = 0; i < folders.total; i++) + for( int i = 0; i < folders.total; i++ ) folders.values[i]->set_selected(0); folders.values[mwindow->edl->session->awindow_folder]->set_selected(1); @@ -1315,33 +1289,27 @@ void AWindowGUI::update_assets() //printf("AWindowGUI::update_assets 3\n"); filter_displayed_assets(); -//for(int i = 0; i < folders.total; i++) +//for( int i = 0; i < folders.total; i++ ) //printf("AWindowGUI::update_assets 4\n"); // printf("AWindowGUI::update_assets %s\n", folders.values[i]->get_text()); - if(mwindow->edl->session->folderlist_format != folder_list->get_format()) + if( mwindow->edl->session->folderlist_format != folder_list->get_format() ) folder_list->update_format(mwindow->edl->session->folderlist_format, 0); - folder_list->update(&folders, - 0, - 0, - 1, + folder_list->update(&folders, 0, 0, 1, folder_list->get_xposition(), folder_list->get_yposition(), -1); //printf("AWindowGUI::update_assets 5\n"); - if(mwindow->edl->session->assetlist_format != asset_list->get_format()) + if( mwindow->edl->session->assetlist_format != asset_list->get_format() ) asset_list->update_format(mwindow->edl->session->assetlist_format, 0); //printf("AWindowGUI::update_assets 6 %d\n", displayed_assets[0].total); - asset_list->update(displayed_assets, - asset_titles, - mwindow->edl->session->asset_columns, - ASSET_COLUMNS, + asset_list->update(displayed_assets, asset_titles, + mwindow->edl->session->asset_columns, ASSET_COLUMNS, asset_list->get_xposition(), asset_list->get_yposition(), - -1, - 0); + -1, 0); asset_list->center_selection(); //printf("AWindowGUI::update_assets 7\n"); @@ -1364,7 +1332,7 @@ void AWindowGUI::update_effects() int AWindowGUI::folder_number(const char *name) { - for(int i = 0; i < AWINDOW_FOLDERS; i++) { + for( int i = 0; i < AWINDOW_FOLDERS; i++ ) { if( !strcasecmp(name, folder_names[i]) ) return i; } return AW_NO_FOLDER; @@ -1372,7 +1340,7 @@ int AWindowGUI::folder_number(const char *name) int AWindowGUI::drag_motion() { - if(get_hidden()) return 0; + if( get_hidden() ) return 0; int result = 0; return result; @@ -1380,7 +1348,7 @@ int AWindowGUI::drag_motion() int AWindowGUI::drag_stop() { - if(get_hidden()) return 0; + if( get_hidden() ) return 0; return 0; } @@ -1422,8 +1390,7 @@ AWindowDivider::~AWindowDivider() int AWindowDivider::button_press_event() { - if(is_event_win() && cursor_inside()) - { + if( is_event_win() && cursor_inside() ) { mwindow->session->current_operation = DRAG_PARTITION; return 1; } @@ -1432,8 +1399,7 @@ int AWindowDivider::button_press_event() int AWindowDivider::cursor_motion_event() { - if(mwindow->session->current_operation == DRAG_PARTITION) - { + if( mwindow->session->current_operation == DRAG_PARTITION ) { int wmin = 25; int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin; int fw = gui->get_relative_cursor_x(); @@ -1449,8 +1415,7 @@ int AWindowDivider::cursor_motion_event() int AWindowDivider::button_release_event() { - if(mwindow->session->current_operation == DRAG_PARTITION) - { + if( mwindow->session->current_operation == DRAG_PARTITION ) { mwindow->session->current_operation = NO_OPERATION; return 1; } @@ -1491,12 +1456,10 @@ AWindowFolders::~AWindowFolders() int AWindowFolders::selection_changed() { AssetPicon *picon = (AssetPicon*)get_selection(0, 0); - if(picon) - { + if( picon ) { gui->stop_vicon_drawing(); - if(get_button_down() && get_buttonpress() == 3) - { + if( get_button_down() && get_buttonpress() == 3 ) { gui->folderlist_menu->update_titles(); gui->folderlist_menu->activate_menu(); } @@ -1517,10 +1480,8 @@ int AWindowFolders::button_press_event() result = BC_ListBox::button_press_event(); - if(!result) - { - if(get_buttonpress() == 3 && is_event_win() && cursor_inside()) - { + if( !result ) { + if( get_buttonpress() == 3 && is_event_win() && cursor_inside() ) { gui->folderlist_menu->update_titles(); gui->folderlist_menu->activate_menu(); result = 1; @@ -1538,10 +1499,7 @@ int AWindowFolders::button_press_event() AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h) - : BC_ListBox(x, - y, - w, - h, + : BC_ListBox(x, y, w, h, (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ? LISTBOX_ICONS : LISTBOX_TEXT, &gui->assets, // Each column has an ArrayList of BC_ListBoxItems. @@ -1569,11 +1527,23 @@ int AWindowAssets::button_press_event() result = BC_ListBox::button_press_event(); - if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside()) - { + if( !result && get_buttonpress() == 3 && is_event_win() && cursor_inside() ) { BC_ListBox::deactivate_selection(); - gui->assetlist_menu->update_titles(); - gui->assetlist_menu->activate_menu(); + int folder = mwindow->edl->session->awindow_folder; + switch( folder ) { + case AW_LABEL_FOLDER: + gui->labellist_menu->update(); + gui->labellist_menu->activate_menu(); + break; + case AW_CLIP_FOLDER: + gui->cliplist_menu->update(); + gui->cliplist_menu->activate_menu(); + break; + default: + gui->assetlist_menu->update_titles(); + gui->assetlist_menu->activate_menu(); + break; + } result = 1; } @@ -1610,8 +1580,11 @@ int AWindowAssets::handle_event() int AWindowAssets::selection_changed() { // Show popup window - if( get_button_down() && get_buttonpress() == 3 && get_selection(0, 0) ) { - switch( mwindow->edl->session->awindow_folder ) { + AssetPicon *item; + if( get_button_down() && get_buttonpress() == 3 && + (item = (AssetPicon*)get_selection(0, 0)) ) { + int folder = mwindow->edl->session->awindow_folder; + switch( folder ) { case AW_AEFFECT_FOLDER: case AW_VEFFECT_FOLDER: case AW_ATRANSITION_FOLDER: @@ -1620,27 +1593,29 @@ int AWindowAssets::selection_changed() gui->assetlist_menu->activate_menu(); break; case AW_LABEL_FOLDER: - if(((AssetPicon*)get_selection(0, 0))->label) - gui->label_menu->activate_menu(); + if( !item->label ) break; + gui->label_menu->activate_menu(); + break; + case AW_CLIP_FOLDER: + if( !item->indexable && !item->edl ) break; + gui->clip_menu->update(); + gui->clip_menu->activate_menu(); break; default: - if(((AssetPicon*)get_selection(0, 0))->indexable) - gui->asset_menu->update(); - else - if(((AssetPicon*)get_selection(0, 0))->edl) - gui->asset_menu->update(); - + if( !item->indexable && !item->edl ) break; + gui->asset_menu->update(); gui->asset_menu->activate_menu(); + break; } BC_ListBox::deactivate_selection(); return 1; } - else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) { + else if( get_button_down() && get_buttonpress() == 1 && + (item = (AssetPicon*)get_selection(0, 0)) ) { VIcon *vicon = 0; if( !gui->vicon_thread->viewing ) { - AssetPicon *picon = (AssetPicon*)get_selection(0, 0); - vicon = picon->vicon; + vicon = item->vicon; } gui->vicon_thread->set_view_popup(vicon); @@ -1692,21 +1667,19 @@ int AWindowAssets::drag_start_event() break; } - if(collect_pluginservers) - { + if( collect_pluginservers ) { int i = 0; mwindow->session->drag_pluginservers->remove_all(); while(1) { AssetPicon *result = (AssetPicon*)get_selection(0, i++); - if(!result) break; + if( !result ) break; mwindow->session->drag_pluginservers->append(result->plugin); } } - if(collect_assets) - { + if( collect_assets ) { gui->collect_assets(); } @@ -1724,8 +1697,7 @@ int AWindowAssets::drag_motion_event() mwindow->gui->drag_motion(); mwindow->gui->unlock_window(); - for(int i = 0; i < mwindow->vwindows.size(); i++) - { + for( int i = 0; i < mwindow->vwindows.size(); i++ ) { VWindow *vwindow = mwindow->vwindows.get(i); if( !vwindow->is_running() ) continue; vwindow->gui->lock_window("AWindowAssets::drag_motion_event"); @@ -1749,17 +1721,14 @@ int AWindowAssets::drag_stop_event() unlock_window(); - if(!result) - { + if( !result ) { mwindow->gui->lock_window("AWindowAssets::drag_stop_event"); result = mwindow->gui->drag_stop(); mwindow->gui->unlock_window(); } - if(!result) - { - for(int i = 0; !result && i < mwindow->vwindows.size(); i++) - { + if( !result ) { + for( int i = 0; !result && i < mwindow->vwindows.size(); i++ ) { VWindow *vwindow = mwindow->vwindows.get(i); if( !vwindow ) continue; if( !vwindow->is_running() ) continue; @@ -1773,8 +1742,7 @@ int AWindowAssets::drag_stop_event() } } - if(!result) - { + if( !result ) { mwindow->cwindow->gui->lock_window("AWindowAssets::drag_stop_event"); result = mwindow->cwindow->gui->drag_stop(); mwindow->cwindow->gui->unlock_window(); @@ -1782,7 +1750,7 @@ int AWindowAssets::drag_stop_event() lock_window("AWindowAssets::drag_stop_event"); - if(result) get_drag_popup()->set_animation(0); + if( result ) get_drag_popup()->set_animation(0); BC_ListBox::drag_stop_event(); mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope... @@ -1843,8 +1811,7 @@ AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int int AWindowDeleteFolder::handle_event() { - if(gui->folder_list->get_selection(0, 0)) - { + if( gui->folder_list->get_selection(0, 0) ) { BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0); mwindow->delete_folder(folder->get_text()); } @@ -1956,63 +1923,6 @@ int AWindowView::handle_event() return 1; } - -LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui) - : BC_PopupMenu(0, - 0, - 0, - "", - 0) -{ - this->mwindow = mwindow; - this->gui = gui; -} - -LabelPopup::~LabelPopup() -{ -} - -void LabelPopup::create_objects() -{ - add_item(editlabel = new LabelPopupEdit(mwindow, this)); -} - -int LabelPopup::update() -{ - gui->collect_assets(); - return 0; -} - - - -LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, LabelPopup *popup) - : BC_MenuItem(_("Edit...")) -{ - this->mwindow = mwindow; - this->popup = popup; -} - -LabelPopupEdit::~LabelPopupEdit() -{ -} - -int LabelPopupEdit::handle_event() -{ - int i = 0; - while(1) - { - AssetPicon *result = (AssetPicon*)mwindow->awindow->gui->asset_list->get_selection(0, i++); - if(!result) break; - - if(result->label) { - mwindow->awindow->gui->awindow->label_edit->edit_label(result->label); - break; - } - } - - return 1; -} - AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title) : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4) { @@ -2110,3 +2020,54 @@ int AVIconDrawing::handle_event() return 1; } + +AWindowListFormat::AWindowListFormat(MWindow *mwindow) + : BC_MenuItem("") +{ + this->mwindow = mwindow; +} + +int AWindowListFormat::handle_event() +{ + AWindowGUI *gui = mwindow->awindow->gui; + gui->stop_vicon_drawing(); + + EDLSession *session = mwindow->edl->session; + switch( session->assetlist_format ) { + case ASSETS_TEXT: + session->assetlist_format = ASSETS_ICONS; + break; + case ASSETS_ICONS: + session->assetlist_format = ASSETS_TEXT; + break; + } + + gui->asset_list->update_format(session->assetlist_format, 1); + if( !mwindow->awindow->gui->allow_iconlisting ) { + mwindow->edl->session->assetlist_format = ASSETS_TEXT; + } + + gui->start_vicon_drawing(); + return 1; +} + +void AWindowListFormat::update() +{ + set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ? + (char*)_("Display icons") : (char*)_("Display text")); +} + +AWindowListSort::AWindowListSort(MWindow *mwindow) + : BC_MenuItem(_("Sort items")) +{ + this->mwindow = mwindow; +} + +int AWindowListSort::handle_event() +{ + AWindowGUI *gui = mwindow->awindow->gui; + gui->sort_assets(); + return 1; +} + + diff --git a/cinelerra-5.1/cinelerra/awindowgui.h b/cinelerra-5.1/cinelerra/awindowgui.h index 04fac704..d77efbbf 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.h +++ b/cinelerra-5.1/cinelerra/awindowgui.h @@ -28,9 +28,13 @@ #include "asset.inc" #include "assets.inc" #include "awindow.inc" -#include "awindowmenu.inc" +#include "awindowgui.inc" +#include "clippopup.inc" #include "edl.inc" +#include "folderlistmenu.inc" #include "guicast.h" +#include "labeledit.inc" +#include "labelpopup.inc" #include "labels.h" #include "indexable.inc" #include "mwindow.inc" @@ -38,30 +42,6 @@ #include "pluginserver.inc" #include "vicon.h" -class AWindowAssets; -class AWindowFolders; -class AWindowNewFolder; -class AWindowDeleteFolder; -class AWindowRenameFolder; -class AWindowDeleteDisk; -class AWindowDeleteProject; -class AWindowDivider; -class AWindowInfo; -class AWindowRedrawIndex; -class AWindowPaste; -class AWindowAppend; -class AWindowView; -class AddTools; -class AddPluginsMenu; -class AddPluginItem; -class AVIconDrawing; - -class AssetPicon; -class AssetVIcon; -class LabelPopup; -class LabelPopupEdit; -class AWindowGUI; - class AssetPicon : public BC_ListBoxItem { public: @@ -216,6 +196,7 @@ public: BC_Pixmap *file_icon; BC_Pixmap *audio_icon; BC_Pixmap *video_icon; + BC_Pixmap *label_icon; BC_Pixmap *clip_icon; VFrame *clip_vframe; BC_Pixmap *atransition_icon; VFrame *atransition_vframe; BC_Pixmap *vtransition_icon; VFrame *vtransition_vframe; @@ -228,8 +209,11 @@ public: // Popup menus AssetPopup *asset_menu; + ClipPopup *clip_menu; LabelPopup *label_menu; AssetListMenu *assetlist_menu; + ClipListMenu *cliplist_menu; + LabelListMenu *labellist_menu; FolderListMenu *folderlist_menu; AddTools *add_tools; // Temporary for reading picons from files @@ -406,34 +390,6 @@ public: int x, y; }; -class LabelPopup : public BC_PopupMenu -{ -public: - LabelPopup(MWindow *mwindow, AWindowGUI *gui); - ~LabelPopup(); - - void create_objects(); -// Set mainsession with the current selections - int update(); - - MWindow *mwindow; - AWindowGUI *gui; - - LabelPopupEdit *editlabel; -}; - -class LabelPopupEdit : public BC_MenuItem -{ -public: - LabelPopupEdit(MWindow *mwindow, LabelPopup *popup); - ~LabelPopupEdit(); - - int handle_event(); - - MWindow *mwindow; - LabelPopup *popup; -}; - class AddTools : public BC_PopupMenu { public: @@ -442,7 +398,6 @@ public: MWindow *mwindow; AWindowGUI *gui; - AddPluginsMenu *add_plugins; }; class AddPluginItem : public BC_MenuItem @@ -467,4 +422,26 @@ public: ~AVIconDrawing(); }; + +class AWindowListFormat : public BC_MenuItem +{ +public: + AWindowListFormat(MWindow *mwindow); + + void update(); + int handle_event(); + MWindow *mwindow; +}; + + +class AWindowListSort : public BC_MenuItem +{ +public: + AWindowListSort(MWindow *mwindow); + + void update(); + int handle_event(); + MWindow *mwindow; +}; + #endif diff --git a/cinelerra-5.1/cinelerra/awindowgui.inc b/cinelerra-5.1/cinelerra/awindowgui.inc index 9e0ac970..e83b8de0 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.inc +++ b/cinelerra-5.1/cinelerra/awindowgui.inc @@ -22,6 +22,29 @@ #ifndef AWINDOWGUI_INC #define AWINDOWGUI_INC +class AssetPicon; +class AssetVIcon; +class AWindowRemovePlugin; +class AWindowRemovePluginGUI; +class AWindowRemovePlugin; class AWindowGUI; +class AWindowAssets; +class AWindowDivider; +class AWindowFolders; +class AWindowNewFolder; +class AWindowDeleteFolder; +class AWindowRenameFolder; +class AWindowDeleteDisk; +class AWindowDeleteProject; +class AWindowInfo; +class AWindowRedrawIndex; +class AWindowPaste; +class AWindowAppend; +class AWindowView; +class AddTools; +class AddPluginItem; +class AVIconDrawing; +class AWindowListFormat; +class AWindowListSort; #endif diff --git a/cinelerra-5.1/cinelerra/clippopup.C b/cinelerra-5.1/cinelerra/clippopup.C new file mode 100644 index 00000000..e3cc1a53 --- /dev/null +++ b/cinelerra-5.1/cinelerra/clippopup.C @@ -0,0 +1,432 @@ + +/* + * CINELERRA + * Copyright (C) 1997-2012 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "assetedit.h" +#include "clippopup.h" +#include "assetremove.h" +#include "awindow.h" +#include "awindowgui.h" +#include "bcsignals.h" +#include "clipedit.h" +#include "cwindow.h" +#include "cwindowgui.h" +#include "edl.h" +#include "filexml.h" +#include "language.h" +#include "localsession.h" +#include "mainerror.h" +#include "mainsession.h" +#include "mwindow.h" +#include "mwindowgui.h" +#include "tracks.h" +#include "vwindow.h" +#include "vwindowgui.h" + + + +ClipPopup::ClipPopup(MWindow *mwindow, AWindowGUI *gui) + : BC_PopupMenu(0, 0, 0, "", 0) +{ + this->mwindow = mwindow; + this->gui = gui; +} + +ClipPopup::~ClipPopup() +{ +} + +void ClipPopup::create_objects() +{ + BC_MenuItem *menu_item; + BC_SubMenu *submenu; + add_item(info = new ClipPopupInfo(mwindow, this)); + add_item(format = new AWindowListFormat(mwindow)); + add_item(new ClipPopupSort(mwindow, this)); + add_item(view = new ClipPopupView(mwindow, this)); + add_item(view_window = new ClipPopupViewWindow(mwindow, this)); + add_item(new ClipPopupCopy(mwindow, this)); + add_item(new ClipPopupPaste(mwindow, this)); + add_item(menu_item = new BC_MenuItem(_("Match..."))); + menu_item->add_submenu(submenu = new BC_SubMenu()); + submenu->add_submenuitem(new ClipMatchSize(mwindow, this)); + submenu->add_submenuitem(new ClipMatchRate(mwindow, this)); + submenu->add_submenuitem(new ClipMatchAll(mwindow, this)); + add_item(menu_item = new BC_MenuItem(_("Remove..."))); + menu_item->add_submenu(submenu = new BC_SubMenu()); + submenu->add_submenuitem(new ClipPopupProjectRemove(mwindow, this)); + submenu->add_submenuitem(new ClipPopupDiskRemove(mwindow, this)); +} + +void ClipPopup::paste_assets() +{ +// Collect items into the drag vectors for temporary storage + gui->lock_window("ClipPopup::paste_assets"); + mwindow->gui->lock_window("ClipPopup::paste_assets"); + mwindow->cwindow->gui->lock_window("ClipPopup::paste_assets"); + + gui->collect_assets(); + mwindow->paste_assets(mwindow->edl->local_session->get_selectionstart(1), + mwindow->edl->tracks->first, + 0); // do not overwrite + + gui->unlock_window(); + mwindow->gui->unlock_window(); + mwindow->cwindow->gui->unlock_window(); +} + +void ClipPopup::match_size() +{ +// Collect items into the drag vectors for temporary storage + gui->collect_assets(); + mwindow->gui->lock_window("ClipPopup::match_size"); + mwindow->asset_to_size(); + mwindow->gui->unlock_window(); +} + +void ClipPopup::match_rate() +{ +// Collect items into the drag vectors for temporary storage + gui->collect_assets(); + mwindow->gui->lock_window("ClipPopup::match_rate"); + mwindow->asset_to_rate(); + mwindow->gui->unlock_window(); +} + +void ClipPopup::match_all() +{ +// Collect items into the drag vectors for temporary storage + gui->collect_assets(); + mwindow->gui->lock_window("ClipPopup::match_rate"); + mwindow->asset_to_all(); + mwindow->gui->unlock_window(); +} + +int ClipPopup::update() +{ + format->update(); + gui->collect_assets(); + return 0; +} + + +ClipPopupInfo::ClipPopupInfo(MWindow *mwindow, ClipPopup *popup) + : BC_MenuItem(_("Info...")) +{ + this->mwindow = mwindow; + this->popup = popup; +} + +ClipPopupInfo::~ClipPopupInfo() +{ +} + +int ClipPopupInfo::handle_event() +{ + if(mwindow->session->drag_assets->total) + { + mwindow->awindow->asset_edit->edit_asset( + mwindow->session->drag_assets->values[0]); + } + else + if(mwindow->session->drag_clips->total) + { + popup->gui->awindow->clip_edit->edit_clip( + mwindow->session->drag_clips->values[0]); + } + return 1; +} + + +ClipPopupSort::ClipPopupSort(MWindow *mwindow, ClipPopup *popup) + : BC_MenuItem(_("Sort items")) +{ + this->mwindow = mwindow; + this->popup = popup; +} + +ClipPopupSort::~ClipPopupSort() +{ +} + +int ClipPopupSort::handle_event() +{ + mwindow->awindow->gui->sort_assets(); + return 1; +} + + +ClipPopupView::ClipPopupView(MWindow *mwindow, ClipPopup *popup) + : BC_MenuItem(_("View")) +{ + this->mwindow = mwindow; + this->popup = popup; +} + +ClipPopupView::~ClipPopupView() +{ +} + +int ClipPopupView::handle_event() +{ + VWindow *vwindow = mwindow->get_viewer(1, DEFAULT_VWINDOW); + vwindow->gui->lock_window("ClipPopupView::handle_event"); + + if(mwindow->session->drag_assets->total) + vwindow->change_source( + mwindow->session->drag_assets->values[0]); + else + if(mwindow->session->drag_clips->total) + vwindow->change_source( + mwindow->session->drag_clips->values[0]); + + vwindow->gui->unlock_window(); + return 1; +} + + +ClipPopupViewWindow::ClipPopupViewWindow(MWindow *mwindow, ClipPopup *popup) + : BC_MenuItem(_("View in new window")) +{ + this->mwindow = mwindow; + this->popup = popup; +} + +ClipPopupViewWindow::~ClipPopupViewWindow() +{ +} + +int ClipPopupViewWindow::handle_event() +{ +// Find window with nothing + VWindow *vwindow = mwindow->get_viewer(1); + +// TODO: create new vwindow or change current vwindow + vwindow->gui->lock_window("ClipPopupView::handle_event"); + + if(mwindow->session->drag_assets->total) + vwindow->change_source( + mwindow->session->drag_assets->values[0]); + else + if(mwindow->session->drag_clips->total) + vwindow->change_source( + mwindow->session->drag_clips->values[0]); + + vwindow->gui->unlock_window(); + return 1; +} + + +ClipPopupCopy::ClipPopupCopy(MWindow *mwindow, ClipPopup *popup) + : BC_MenuItem(_("Copy")) +{ + this->mwindow = mwindow; + this->popup = popup; +} +ClipPopupCopy::~ClipPopupCopy() +{ +} + +int ClipPopupCopy::handle_event() +{ + MWindowGUI *gui = mwindow->gui; + gui->lock_window("ClipPopupCopy::handle_event"); + if( mwindow->session->drag_clips->total > 0 ) { + FileXML file; + EDL *edl = mwindow->session->drag_clips->values[0]; + double start = 0, end = edl->tracks->total_length(); + edl->copy(start, end, 1, 0, 0, &file, "", 1); + const char *file_string = file.string(); + long file_length = strlen(file_string); + gui->get_clipboard()->to_clipboard(file_string, file_length, + SECONDARY_SELECTION); + gui->get_clipboard()->to_clipboard(file_string, file_length, + BC_PRIMARY_SELECTION); + } + gui->unlock_window(); + return 1; +} + + +ClipPopupPaste::ClipPopupPaste(MWindow *mwindow, ClipPopup *popup) + : BC_MenuItem(_("Paste")) +{ + this->mwindow = mwindow; + this->popup = popup; +} + +ClipPopupPaste::~ClipPopupPaste() +{ +} + +int ClipPopupPaste::handle_event() +{ + popup->paste_assets(); + return 1; +} + + +ClipMatchSize::ClipMatchSize(MWindow *mwindow, ClipPopup *popup) + : BC_MenuItem(_("Match project size")) +{ + this->mwindow = mwindow; + this->popup = popup; +} + +int ClipMatchSize::handle_event() +{ + popup->match_size(); + return 1; +} + + +ClipMatchRate::ClipMatchRate(MWindow *mwindow, ClipPopup *popup) + : BC_MenuItem(_("Match frame rate")) +{ + this->mwindow = mwindow; + this->popup = popup; +} + +int ClipMatchRate::handle_event() +{ + popup->match_rate(); + return 1; +} + + +ClipMatchAll::ClipMatchAll(MWindow *mwindow, ClipPopup *popup) + : BC_MenuItem(_("Match all")) +{ + this->mwindow = mwindow; + this->popup = popup; +} + +int ClipMatchAll::handle_event() +{ + popup->match_all(); + return 1; +} + + +ClipPopupProjectRemove::ClipPopupProjectRemove(MWindow *mwindow, ClipPopup *popup) + : BC_MenuItem(_("Remove from project")) +{ + this->mwindow = mwindow; + this->popup = popup; +} + + +ClipPopupProjectRemove::~ClipPopupProjectRemove() +{ +} + +int ClipPopupProjectRemove::handle_event() +{ + mwindow->remove_assets_from_project(1, + 1, + mwindow->session->drag_assets, + mwindow->session->drag_clips); + return 1; +} + + +ClipPopupDiskRemove::ClipPopupDiskRemove(MWindow *mwindow, ClipPopup *popup) + : BC_MenuItem(_("Remove from disk")) +{ + this->mwindow = mwindow; + this->popup = popup; +} + +ClipPopupDiskRemove::~ClipPopupDiskRemove() +{ +} + +int ClipPopupDiskRemove::handle_event() +{ + mwindow->awindow->asset_remove->start(); + return 1; +} + + +ClipPasteToFolder::ClipPasteToFolder(MWindow *mwindow) + : BC_MenuItem(_("Paste Clip")) +{ + this->mwindow = mwindow; +} + +int ClipPasteToFolder::handle_event() +{ + MWindowGUI *gui = mwindow->gui; + gui->lock_window("ClipPasteToFolder::handle_event 1"); + int64_t len = gui->get_clipboard()->clipboard_len(SECONDARY_SELECTION); + if( len ) { + char *string = new char[len + 1]; + gui->get_clipboard()->from_clipboard(string, len, BC_PRIMARY_SELECTION); + const char *clip_header = " 32 ) string[32] = 0; + eprintf("paste buffer is not EDL:\n%s", string); + } + delete [] string; + } + else { + eprintf("paste buffer empty"); + } + gui->unlock_window(); + return 1; +} + + +ClipListMenu::ClipListMenu(MWindow *mwindow, AWindowGUI *gui) + : BC_PopupMenu(0, 0, 0, "", 0) +{ + this->mwindow = mwindow; + this->gui = gui; +} + +ClipListMenu::~ClipListMenu() +{ +} + +void ClipListMenu::create_objects() +{ + add_item(format = new AWindowListFormat(mwindow)); + add_item(new AWindowListSort(mwindow)); + add_item(new ClipPasteToFolder(mwindow)); + update(); +} + +void ClipListMenu::update() +{ + format->update(); +} + diff --git a/cinelerra-5.1/cinelerra/clippopup.h b/cinelerra-5.1/cinelerra/clippopup.h new file mode 100644 index 00000000..de6d7f67 --- /dev/null +++ b/cinelerra-5.1/cinelerra/clippopup.h @@ -0,0 +1,222 @@ + +/* + * CINELERRA + * Copyright (C) 2008 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef CLIPPOPUP_H +#define CLIPPOPUP_H + +#include "assetedit.inc" +#include "awindowgui.inc" +#include "clippopup.inc" +#include "edl.inc" +#include "guicast.h" +#include "assets.inc" +#include "mwindow.inc" + + + +class ClipPopup : public BC_PopupMenu +{ +public: + ClipPopup(MWindow *mwindow, AWindowGUI *gui); + ~ClipPopup(); + + void create_objects(); +// Set mainsession with the current selections + int update(); + void paste_assets(); + void match_size(); + void match_rate(); + void match_all(); + + MWindow *mwindow; + AWindowGUI *gui; + + + ClipPopupInfo *info; + ClipPopupView *view; + ClipPopupViewWindow *view_window; + AWindowListFormat *format; +}; + +class ClipPopupInfo : public BC_MenuItem +{ +public: + ClipPopupInfo(MWindow *mwindow, ClipPopup *popup); + ~ClipPopupInfo(); + + int handle_event(); + int button_press_event(); + + MWindow *mwindow; + ClipPopup *popup; +}; + +class ClipPopupSort : public BC_MenuItem +{ +public: + ClipPopupSort(MWindow *mwindow, ClipPopup *popup); + ~ClipPopupSort(); + + int handle_event(); + + MWindow *mwindow; + ClipPopup *popup; +}; + +class ClipPopupView : public BC_MenuItem +{ +public: + ClipPopupView(MWindow *mwindow, ClipPopup *popup); + ~ClipPopupView(); + + int handle_event(); + + MWindow *mwindow; + ClipPopup *popup; +}; + + +class ClipPopupViewWindow : public BC_MenuItem +{ +public: + ClipPopupViewWindow(MWindow *mwindow, ClipPopup *popup); + ~ClipPopupViewWindow(); + + int handle_event(); + + MWindow *mwindow; + ClipPopup *popup; +}; + +class ClipPopupCopy : public BC_MenuItem +{ +public: + ClipPopupCopy(MWindow *mwindow, ClipPopup *popup); + ~ClipPopupCopy(); + + int handle_event(); + + MWindow *mwindow; + ClipPopup *popup; +}; + +class ClipPopupPaste : public BC_MenuItem +{ +public: + ClipPopupPaste(MWindow *mwindow, ClipPopup *popup); + ~ClipPopupPaste(); + + int handle_event(); + + MWindow *mwindow; + ClipPopup *popup; +}; + +class ClipMatchSize : public BC_MenuItem +{ +public: + ClipMatchSize(MWindow *mwindow, ClipPopup *popup); + + int handle_event(); + + MWindow *mwindow; + ClipPopup *popup; +}; + +class ClipMatchRate : public BC_MenuItem +{ +public: + ClipMatchRate(MWindow *mwindow, ClipPopup *popup); + + int handle_event(); + + MWindow *mwindow; + ClipPopup *popup; +}; + +class ClipMatchAll : public BC_MenuItem +{ +public: + ClipMatchAll(MWindow *mwindow, ClipPopup *popup); + + int handle_event(); + + MWindow *mwindow; + ClipPopup *popup; +}; + +class ClipPopupProjectRemove : public BC_MenuItem +{ +public: + ClipPopupProjectRemove(MWindow *mwindow, ClipPopup *popup); + ~ClipPopupProjectRemove(); + + int handle_event(); + + MWindow *mwindow; + ClipPopup *popup; +}; + +class ClipPopupDiskRemove : public BC_MenuItem +{ +public: + ClipPopupDiskRemove(MWindow *mwindow, ClipPopup *popup); + ~ClipPopupDiskRemove(); + + int handle_event(); + + MWindow *mwindow; + ClipPopup *popup; +}; + +class ClipPasteToFolder : public BC_MenuItem +{ +public: + ClipPasteToFolder(MWindow *mwindow); + + int handle_event(); + MWindow *mwindow; +}; + +class ClipListFormat : public BC_MenuItem +{ +public: + ClipListFormat(MWindow *mwindow, ClipListMenu *menu); + + int handle_event(); + MWindow *mwindow; + ClipListMenu *menu; +}; + +class ClipListMenu : public BC_PopupMenu +{ +public: + ClipListMenu(MWindow *mwindow, AWindowGUI *gui); + ~ClipListMenu(); + + void create_objects(); + void update(); + AWindowListFormat *format; + MWindow *mwindow; + AWindowGUI *gui; +}; + +#endif diff --git a/cinelerra-5.1/cinelerra/clippopup.inc b/cinelerra-5.1/cinelerra/clippopup.inc new file mode 100644 index 00000000..365d4725 --- /dev/null +++ b/cinelerra-5.1/cinelerra/clippopup.inc @@ -0,0 +1,41 @@ + +/* + * CINELERRA + * Copyright (C) 2008 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef CLIPPOPUP_INC +#define CLIPPOPUP_INC + +class ClipPopup; +class ClipPopupInfo; +class ClipPopupSort; +class ClipPopupView; +class ClipPopupViewWindow; +class ClipPopupCopy; +class ClipPopupPaste; +class ClipMatchSize; +class ClipMatchRate; +class ClipMatchAll; +class ClipPopupProjectRemove; +class ClipPopupDiskRemove; +class ClipPasteToFolder; +class ClipListMenu; +class ClipListFormat; + +#endif diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 9301f19d..94887b5b 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -721,7 +721,7 @@ CWrapper(next_edit) void CWindowEditing::to_clip() { - mwindow->to_clip(_("composer window: ")); + mwindow->to_clip(mwindow->edl, _("composer window: ")); } diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index 9e14b082..5d9ff496 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -301,8 +301,7 @@ int EDL::load_xml(FileXML *file, else if(file->tag.title_is("ASSETS")) { - if((load_flags & LOAD_ASSETS) && - !parent_edl) + if(load_flags & LOAD_ASSETS) assets->load(file, load_flags); else result = file->skip_tag(); @@ -610,14 +609,9 @@ int EDL::copy(double start, // Media // Don't replicate all assets for every clip. -// The assets for the clips are probably in the mane EDL. - if(!is_clip) - copy_assets(start, - end, - file, - all, - output_path); - +// The assets for the clips are probably in the main EDL. + if( !is_clip ) + copy_assets(start, end, file, all, output_path); // Clips // Don't want this if using clipboard if(all) @@ -650,10 +644,9 @@ int EDL::copy(double start, //printf("EDL::copy 2\n"); // terminate file - if(is_clip) + if( is_clip ) file->tag.set_title("/CLIP_EDL"); - else - if(is_vwindow) + else if( is_vwindow ) file->tag.set_title("/VWINDOW_EDL"); else file->tag.set_title("/EDL"); diff --git a/cinelerra-5.1/cinelerra/exportedl.C b/cinelerra-5.1/cinelerra/exportedl.C index 6e34caaa..06982c95 100644 --- a/cinelerra-5.1/cinelerra/exportedl.C +++ b/cinelerra-5.1/cinelerra/exportedl.C @@ -80,9 +80,11 @@ void ExportEDLAsset::double_to_CMX3600(double seconds, double frame_rate, char * //sprintf(str, "%02d:%02d:%02d:%02d", hour, minute, second, hundredths); } -int ExportEDLAsset::edit_to_timecodes(Edit *edit, char *sourceinpoint, char *sourceoutpoint, char *destinpoint, char *destoutpoint, char *reel_name) +int ExportEDLAsset::edit_to_timecodes(Edit *edit, + char *sourceinpoint, char *sourceoutpoint, + char *destinpoint, char *destoutpoint, + char *reel_name) { - Asset *asset = edit->asset; Track *track = edit->track; double frame_rate = edit->track->edl->session->frame_rate; @@ -91,30 +93,9 @@ int ExportEDLAsset::edit_to_timecodes(Edit *edit, char *sourceinpoint, char *sou double edit_deststart; double edit_destend; - if (asset) - { - // reelname should be 8 chars long - - strncpy(reel_name, asset->reel_name, 9); - if (strlen(asset->reel_name) > 8) - { - printf(_("Warning: chopping the reel name to eight characters!\n")); - }; - reel_name[8] = 0; - for (int i = strlen(reel_name); i<8; i++) - reel_name[i] = ' '; - - edit_sourcestart = (double)asset->tcstart / asset->frame_rate - + track->from_units(edit->startsource); - edit_sourceend = (double)asset->tcstart / asset->frame_rate - + track->from_units(edit->startsource + edit->length); - - } else - { - strcpy(reel_name, " BL "); - edit_sourcestart = 0; - edit_sourceend = track->from_units(edit->length); - } + strcpy(reel_name, " BL "); + edit_sourcestart = 0; + edit_sourceend = track->from_units(edit->length); edit_deststart = track->from_units(edit->startproject); edit_destend = track->from_units(edit->startproject + edit->length); @@ -201,7 +182,7 @@ void ExportEDLAsset::export_it() last_dissolve = 1; } else { - edit_to_timecodes(edit, sourceinpoint, sourceoutpoint, destinpoint, destoutpoint, reel_name); + edit_to_timecodes(edit, sourceinpoint, sourceoutpoint, destinpoint, destoutpoint, reel_name); fprintf(fh, "%03d %8s %s %4s %3s", colnum, reel_name, avselect, edittype, cutinfo); fprintf(fh, " %s %s", sourceinpoint, sourceoutpoint); fprintf(fh, " %s %s", destinpoint, destoutpoint); diff --git a/cinelerra-5.1/cinelerra/exportedl.h b/cinelerra-5.1/cinelerra/exportedl.h index 03c99464..fdd183bb 100644 --- a/cinelerra-5.1/cinelerra/exportedl.h +++ b/cinelerra-5.1/cinelerra/exportedl.h @@ -64,7 +64,10 @@ public: int load_defaults(); int save_defaults(); private: - int edit_to_timecodes(Edit *edit, char *sourceinpoint, char *sourceoutpoint, char *destinpoint, char *destoutpoint, char *reel_name); + int edit_to_timecodes(Edit *edit, + char *sourceinpoint, char *sourceoutpoint, + char *destinpoint, char *destoutpoint, + char *reel_name); void double_to_CMX3600(double seconds, double frame_rate, char *str); }; diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C index 2923c746..f5ce25de 100644 --- a/cinelerra-5.1/cinelerra/file.C +++ b/cinelerra-5.1/cinelerra/file.C @@ -1664,6 +1664,16 @@ void File::getenv_path(char *result, const char *path) *rp = 0; } +void File::setenv_path(char *result, const char *var, const char *path) +{ + char *env = getenv(var); + if( env ) return; + char env_path[BCTEXTLEN]; + getenv_path(env_path, path); + sprintf(result, "%s=%s", var, env_path); + putenv(result); +} + char File::cinexe_path[BCTEXTLEN]; char File::cinpkg_path[BCTEXTLEN]; char File::cindat_path[BCTEXTLEN]; @@ -1684,36 +1694,13 @@ void File::init_cin_path() snprintf(cinpkg_path, sizeof(cinpkg_path), "CIN_PKG=%s", env_pkg); putenv(cinpkg_path); - getenv_path(env_path, CINDAT_DIR); - snprintf(cindat_path, sizeof(cindat_path), "CIN_DAT=%s", env_path); - putenv(cindat_path); - - getenv_path(env_path, CINLIB_DIR); - snprintf(cinlib_path, sizeof(cinlib_path), "CIN_LIB=%s", env_path); - putenv(cinlib_path); - - getenv_path(env_path, CONFIG_DIR); - snprintf(cincfg_path, sizeof(cincfg_path), "CIN_CONFIG=%s", env_path); - putenv(cincfg_path); - - getenv_path(env_path, PLUGIN_DIR); - snprintf(cinplg_path, sizeof(cinplg_path), "CIN_PLUGIN=%s", env_path); - putenv(cinplg_path); - - getenv_path(env_path, LADSPA_DIR); - snprintf(cinlad_path, sizeof(cinlad_path), "CIN_LADSPA=%s", env_path); - putenv(cinlad_path); - - getenv_path(env_path, LOCALE_DIR); - snprintf(cinlcl_path, sizeof(cinlcl_path), "CIN_LOCALE=%s", env_path); - putenv(cinlcl_path); - -#ifndef CIN_BROWSER -#define CIN_BROWSER "firefox" -#endif - getenv_path(env_path, CIN_BROWSER); - snprintf(cinbwr_path, sizeof(cinlcl_path), "CIN_BROWSER=%s", env_path); - putenv(cinbwr_path); + setenv_path(cindat_path, "CIN_DAT", CINDAT_DIR); + setenv_path(cinlib_path, "CIN_LIB", CINLIB_DIR); + setenv_path(cincfg_path, "CIN_CONFIG", CONFIG_DIR); + setenv_path(cinplg_path, "CIN_PLUGIN", PLUGIN_DIR); + setenv_path(cinlad_path, "CIN_LADSPA", LADSPA_DIR); + setenv_path(cinlcl_path, "CIN_LOCALE", LOCALE_DIR); + setenv_path(cinbwr_path, "CIN_BROWSER", CIN_BROWSER); } diff --git a/cinelerra-5.1/cinelerra/file.h b/cinelerra-5.1/cinelerra/file.h index 08fdf709..5378a76f 100644 --- a/cinelerra-5.1/cinelerra/file.h +++ b/cinelerra-5.1/cinelerra/file.h @@ -317,6 +317,7 @@ public: static void init_cin_path(); static void get_exe_path(char *result, char *bnp=0); static void getenv_path(char *result, const char *path); + static void setenv_path(char *result, const char *var, const char *path); static char cinexe_path[BCTEXTLEN], cinpkg_path[BCTEXTLEN]; static char cindat_path[BCTEXTLEN], cinlib_path[BCTEXTLEN]; static char cincfg_path[BCTEXTLEN], cinplg_path[BCTEXTLEN]; diff --git a/cinelerra-5.1/cinelerra/file.inc b/cinelerra-5.1/cinelerra/file.inc index ecc7a2b9..b14162e3 100644 --- a/cinelerra-5.1/cinelerra/file.inc +++ b/cinelerra-5.1/cinelerra/file.inc @@ -22,6 +22,30 @@ #ifndef FILE_INC #define FILE_INC +// Normally, these are sourced from the compiler command line +// as: c++ -Dvar=value defines +#ifndef CIN_CONFIG +#define CIN_CONFIG "~/.bcast5" +#endif +#ifndef LOCALE_DIR +#define LOCALE_DIR "$CIN_LIB/locale" +#endif +#ifndef CINDAT_DIR +#define CINDAT_DIR "$CIN_PATH" +#endif +#ifndef CINLIB_DIR +#define CINLIB_DIR "$CIN_PATH" +#endif +#ifndef PLUGIN_DIR +#define PLUGIN_DIR "$CIN_LIB/plugins" +#endif +#ifndef LADSPA_DIR +#define LADSPA_DIR "$CIN_LIB/ladspa" +#endif +#ifndef CIN_BROWSER +#define CIN_BROWSER "firefox" +#endif + #include "language.h" // Return values for open_file diff --git a/cinelerra-5.1/cinelerra/fileffmpeg.C b/cinelerra-5.1/cinelerra/fileffmpeg.C index 33f3fa47..27bd7de4 100644 --- a/cinelerra-5.1/cinelerra/fileffmpeg.C +++ b/cinelerra-5.1/cinelerra/fileffmpeg.C @@ -240,6 +240,7 @@ int FileFFMPEG::open_file(int rd, int wr) asset->channels = audio_channels; asset->sample_rate = ff->ff_sample_rate(0); asset->audio_length = ff->ff_audio_samples(0); + strcpy(asset->acodec, ff->ff_audio_format(0)); } int video_layers = ff->ff_total_video_layers(); if( video_layers > 0 ) { @@ -253,6 +254,7 @@ int FileFFMPEG::open_file(int rd, int wr) (asset->video_length = ff->ff_video_frames(0)) < 2 ) asset->video_length = asset->video_length < 0 ? 0 : -1; if( !asset->frame_rate ) asset->frame_rate = ff->ff_frame_rate(0); + strcpy(asset->vcodec, ff->ff_video_format(0)); } IndexState *index_state = asset->index_state; index_state->read_markers(file->preferences->index_directory, asset->path); diff --git a/cinelerra-5.1/cinelerra/awindowmenu.C b/cinelerra-5.1/cinelerra/folderlistmenu.C similarity index 50% rename from cinelerra-5.1/cinelerra/awindowmenu.C rename to cinelerra-5.1/cinelerra/folderlistmenu.C index 3aacf321..0eb39c2a 100644 --- a/cinelerra-5.1/cinelerra/awindowmenu.C +++ b/cinelerra-5.1/cinelerra/folderlistmenu.C @@ -21,110 +21,15 @@ #include "awindow.h" #include "awindowgui.h" -#include "awindowmenu.h" +#include "folderlistmenu.h" #include "edl.h" #include "edlsession.h" #include "language.h" #include "mwindow.h" - - - -AssetListMenu::AssetListMenu(MWindow *mwindow, AWindowGUI *gui) - : BC_PopupMenu(0, - 0, - 0, - "", - 0) -{ - this->mwindow = mwindow; - this->gui = gui; -} - -AssetListMenu::~AssetListMenu() -{ -} - -void AssetListMenu::create_objects() -{ - add_item(format = new AssetListFormat(mwindow)); - add_item(new AssetListSort(mwindow)); - update_titles(); -} - -void AssetListMenu::update_titles() -{ - format->update(); -} - - - - - - - - -AssetListFormat::AssetListFormat(MWindow *mwindow) - : BC_MenuItem("") -{ - this->mwindow = mwindow; -} - -void AssetListFormat::update() -{ - set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ? - (char*)_("Display icons") : (char*)_("Display text")); -} - -int AssetListFormat::handle_event() -{ - AWindowGUI *agui = mwindow->awindow->gui; - agui->stop_vicon_drawing(); - - EDLSession *session = mwindow->edl->session; - switch(session->assetlist_format) { - case ASSETS_TEXT: - session->assetlist_format = ASSETS_ICONS; - break; - case ASSETS_ICONS: - session->assetlist_format = ASSETS_TEXT; - break; - } - - agui->asset_list->update_format(session->assetlist_format, 1); - if (!mwindow->awindow->gui->allow_iconlisting) { - mwindow->edl->session->assetlist_format = ASSETS_TEXT; - } - - agui->start_vicon_drawing(); - return 1; -} - - - - -AssetListSort::AssetListSort(MWindow *mwindow) - : BC_MenuItem(_("Sort items")) -{ - this->mwindow = mwindow; -} - -int AssetListSort::handle_event() -{ - mwindow->awindow->gui->sort_assets(); - return 1; -} - - - - FolderListMenu::FolderListMenu(MWindow *mwindow, AWindowGUI *gui) - : BC_PopupMenu(0, - 0, - 0, - "", - 0) + : BC_PopupMenu(0, 0, 0, "", 0) { this->mwindow = mwindow; this->gui = gui; @@ -141,7 +46,6 @@ void FolderListMenu::create_objects() } - void FolderListMenu::update_titles() { format->set_text(mwindow->edl->session->folderlist_format == FOLDERS_TEXT ? @@ -150,26 +54,22 @@ void FolderListMenu::update_titles() - - - - FolderListFormat::FolderListFormat(MWindow *mwindow, FolderListMenu *menu) : BC_MenuItem("") { this->mwindow = mwindow; this->menu = menu; } + int FolderListFormat::handle_event() { - switch(mwindow->edl->session->folderlist_format) - { - case FOLDERS_TEXT: - mwindow->edl->session->folderlist_format = FOLDERS_ICONS; - break; - case FOLDERS_ICONS: - mwindow->edl->session->folderlist_format = FOLDERS_TEXT; - break; + switch(mwindow->edl->session->folderlist_format) { + case FOLDERS_TEXT: + mwindow->edl->session->folderlist_format = FOLDERS_ICONS; + break; + case FOLDERS_ICONS: + mwindow->edl->session->folderlist_format = FOLDERS_TEXT; + break; } mwindow->awindow->gui->folder_list->update_format( @@ -179,5 +79,3 @@ int FolderListFormat::handle_event() return 1; } - - diff --git a/cinelerra-5.1/cinelerra/awindowmenu.h b/cinelerra-5.1/cinelerra/folderlistmenu.h similarity index 67% rename from cinelerra-5.1/cinelerra/awindowmenu.h rename to cinelerra-5.1/cinelerra/folderlistmenu.h index 843da442..41f0860c 100644 --- a/cinelerra-5.1/cinelerra/awindowmenu.h +++ b/cinelerra-5.1/cinelerra/folderlistmenu.h @@ -19,61 +19,24 @@ * */ -#ifndef AWINDOWMENU_H -#define AWINDOWMENU_H +#ifndef FOLDERLISTMENU_H +#define FOLDERLISTMENU_H #include "awindowgui.inc" #include "edl.inc" #include "guicast.h" #include "mwindow.inc" -class AssetListFormat; - -class AssetListMenu : public BC_PopupMenu -{ -public: - AssetListMenu(MWindow *mwindow, AWindowGUI *gui); - ~AssetListMenu(); - - void create_objects(); - void update_titles(); - - AssetListFormat *format; - - MWindow *mwindow; - AWindowGUI *gui; -}; - - -class AssetListFormat : public BC_MenuItem -{ -public: - AssetListFormat(MWindow *mwindow); - - void update(); - int handle_event(); - MWindow *mwindow; -}; - - -class AssetListSort : public BC_MenuItem +class FolderListFormat : public BC_MenuItem { public: - AssetListSort(MWindow *mwindow); + FolderListFormat(MWindow *mwindow, FolderListMenu *menu); - void update(); int handle_event(); MWindow *mwindow; + FolderListMenu *menu; }; - - - - -class FolderListFormat; - - - class FolderListMenu : public BC_PopupMenu { public: @@ -89,17 +52,4 @@ public: AWindowGUI *gui; }; - -class FolderListFormat : public BC_MenuItem -{ -public: - FolderListFormat(MWindow *mwindow, FolderListMenu *menu); - - int handle_event(); - MWindow *mwindow; - FolderListMenu *menu; -}; - - - #endif diff --git a/cinelerra-5.1/cinelerra/awindowmenu.inc b/cinelerra-5.1/cinelerra/folderlistmenu.inc similarity index 89% rename from cinelerra-5.1/cinelerra/awindowmenu.inc rename to cinelerra-5.1/cinelerra/folderlistmenu.inc index a04e6841..b3659f0b 100644 --- a/cinelerra-5.1/cinelerra/awindowmenu.inc +++ b/cinelerra-5.1/cinelerra/folderlistmenu.inc @@ -1,4 +1,3 @@ - /* * CINELERRA * Copyright (C) 2008 Adam Williams @@ -19,16 +18,10 @@ * */ -#ifndef AWINDOWMENU_INC -#define AWINDOWMENU_INC - - +#ifndef FOLDERLISTMENU_INC +#define FOLDERLISTMENU_INC - -class AssetListMenu; +class FolderListFormat; class FolderListMenu; -class AssetListFormat; - - #endif diff --git a/cinelerra-5.1/cinelerra/indexfile.C b/cinelerra-5.1/cinelerra/indexfile.C index a5f12bca..61e81cb5 100644 --- a/cinelerra-5.1/cinelerra/indexfile.C +++ b/cinelerra-5.1/cinelerra/indexfile.C @@ -141,7 +141,6 @@ IndexFile::IndexFile(MWindow *mwindow, this->mwindow = mwindow; this->indexable = indexable; redraw_timer = new Timer; - if(indexable) { indexable->add_user(); @@ -433,6 +432,9 @@ SET_TRACE // open the source file if(open_source()) return 1; + source_channels = indexable->get_audio_channels(); + source_samplerate = indexable->get_sample_rate(); + source_length = indexable->get_audio_samples(); SET_TRACE diff --git a/cinelerra-5.1/cinelerra/labeledit.C b/cinelerra-5.1/cinelerra/labeledit.C index 8b5ed03b..945d306a 100644 --- a/cinelerra-5.1/cinelerra/labeledit.C +++ b/cinelerra-5.1/cinelerra/labeledit.C @@ -1,7 +1,7 @@ - /* * CINELERRA * Copyright (C) 2006 Pierre Dumuid + * Copyright (C) 1997-2012 Adam Williams * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,71 +21,59 @@ #include "awindow.h" #include "awindowgui.h" +#include "bcdialog.h" #include "labeledit.h" -#include "edl.h" -#include "fonts.h" #include "language.h" -#include "localsession.h" -#include "mainsession.h" #include "mwindow.h" #include "mwindowgui.h" #include "vwindow.h" #include "vwindowgui.h" - LabelEdit::LabelEdit(MWindow *mwindow, AWindow *awindow, VWindow *vwindow) - : Thread() + : BC_DialogThread() { this->mwindow = mwindow; this->awindow = awindow; this->vwindow = vwindow; - this->label = 0; + label = 0; + label_edit_window = 0; } LabelEdit::~LabelEdit() { + close_window(); } -void LabelEdit::edit_label(Label *label) +void LabelEdit::start(Label *label) { -// Allow more than one window so we don't have to delete the clip in handle_event - if(label) - { - this->label = label; - Thread::start(); - } + this->label = label; + BC_DialogThread::start(); } -void LabelEdit::run() +void LabelEdit::handle_close_event(int result) { - if(label) - { - LabelEditWindow *window = new LabelEditWindow(mwindow, this); - window->create_objects(); - /*int result = */ window->run_window(); - delete window; - if (awindow) awindow->gui->async_update_assets(); - } + label_edit_window = 0; } +void LabelEdit::handle_done_event(int result) +{ + awindow->gui->async_update_assets(); +} +BC_Window *LabelEdit::new_gui() +{ + int x = mwindow->gui->get_abs_cursor_x(1) - 400 / 2; + int y = mwindow->gui->get_abs_cursor_y(1) - 350 / 2; + label_edit_window = new LabelEditWindow(mwindow, this, x, y); + label_edit_window->create_objects(); + return label_edit_window; +} - - - -LabelEditWindow::LabelEditWindow(MWindow *mwindow, LabelEdit *thread) - : BC_Window(_(PROGRAM_NAME ": Label Info"), - mwindow->gui->get_abs_cursor_x(1) - 400 / 2, - mwindow->gui->get_abs_cursor_y(1) - 350 / 2, - 400, - 350, - 400, - 430, - 0, - 0, - 1) +LabelEditWindow::LabelEditWindow(MWindow *mwindow, LabelEdit *thread, int x, int y) + : BC_Window(_(PROGRAM_NAME ": Label Info"), x, y, + 400, 350, 400, 430, 0, 0, 1) { this->mwindow = mwindow; this->thread = thread; @@ -95,7 +83,6 @@ LabelEditWindow::~LabelEditWindow() { } - void LabelEditWindow::create_objects() { this->label = thread->label; @@ -107,24 +94,15 @@ void LabelEditWindow::create_objects() add_subwindow(title = new BC_Title(x1, y, _("Label Text:"))); y += title->get_h() + 5; - add_subwindow(textbox = new LabelEditComments(this, - x1, - y, - get_w() - x1 * 2, + add_subwindow(textbox = new LabelEditComments(this, x1, y, get_w() - x1 * 2, BC_TextBox::pixels_to_rows(this, MEDIUMFONT, get_h() - 10 - 40 - y))); - add_subwindow(new BC_OKButton(this)); add_subwindow(new BC_CancelButton(this)); show_window(); textbox->activate(); } - - - - - LabelEditComments::LabelEditComments(LabelEditWindow *window, int x, int y, int w, int rows) : BC_TextBox(x, y, w, rows, window->label->textstr, 1, MEDIUMFONT, 1) { @@ -136,3 +114,4 @@ int LabelEditComments::handle_event() strcpy(window->label->textstr, get_text()); return 1; } + diff --git a/cinelerra-5.1/cinelerra/labeledit.h b/cinelerra-5.1/cinelerra/labeledit.h index 9a9d04bb..094c9f41 100644 --- a/cinelerra-5.1/cinelerra/labeledit.h +++ b/cinelerra-5.1/cinelerra/labeledit.h @@ -1,7 +1,7 @@ - /* * CINELERRA * Copyright (C) 2006 Pierre Dumuid + * Copyright (C) 2008 Adam Williams * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,22 +22,26 @@ #ifndef LABELEDIT_H #define LABELEDIT_H +#include "assetedit.inc" +#include "assets.inc" #include "awindow.inc" -#include "edl.inc" +#include "awindowgui.inc" #include "guicast.h" +#include "labeledit.inc" #include "mwindow.inc" -#include "thread.h" #include "vwindow.inc" -class LabelEdit : public Thread +class LabelEdit : public BC_DialogThread { public: LabelEdit(MWindow *mwindow, AWindow *awindow, VWindow *vwindow); ~LabelEdit(); - void run(); - void edit_label(Label *label); + BC_Window *new_gui(); + void start(Label *label); + void handle_close_event(int result); + void handle_done_event(int result); // If it is being created or edited MWindow *mwindow; @@ -45,28 +49,23 @@ public: VWindow *vwindow; Label *label; + LabelEditWindow *label_edit_window; }; - - - class LabelEditWindow : public BC_Window { public: - LabelEditWindow(MWindow *mwindow, LabelEdit *thread); + LabelEditWindow(MWindow *mwindow, LabelEdit *thread, int x, int y); ~LabelEditWindow(); void create_objects(); - // Use this copy of the pointer in LabelEdit since multiple windows are possible Label *label; MWindow *mwindow; LabelEdit *thread; }; - - class LabelEditTitle : public BC_TextBox { public: @@ -75,7 +74,6 @@ public: LabelEditWindow *window; }; - class LabelEditComments : public BC_TextBox { public: @@ -84,9 +82,4 @@ public: LabelEditWindow *window; }; - - - - - #endif diff --git a/cinelerra-5.1/cinelerra/labeledit.inc b/cinelerra-5.1/cinelerra/labeledit.inc index f8ccd064..1a2929f0 100644 --- a/cinelerra-5.1/cinelerra/labeledit.inc +++ b/cinelerra-5.1/cinelerra/labeledit.inc @@ -1,7 +1,7 @@ - /* * CINELERRA * Copyright (C) 2006 Pierre Dumuid + * Copyright (C) 2008 Adam Williams * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,11 +22,9 @@ #ifndef LABELEDIT_INC #define LABELEDIT_INC - - - class LabelEdit; - - +class LabelEditWindow; +class LabelEditTitle; +class LabelEditComments; #endif diff --git a/cinelerra-5.1/cinelerra/labelpopup.C b/cinelerra-5.1/cinelerra/labelpopup.C new file mode 100644 index 00000000..ee25db46 --- /dev/null +++ b/cinelerra-5.1/cinelerra/labelpopup.C @@ -0,0 +1,155 @@ +/* + * CINELERRA + * Copyright (C) 2006 Pierre Dumuid + * Copyright (C) 1997-2012 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "awindow.h" +#include "awindowgui.h" +#include "bcdialog.h" +#include "labeledit.h" +#include "labelpopup.h" +#include "edl.h" +#include "fonts.h" +#include "language.h" +#include "localsession.h" +#include "mainsession.h" +#include "mbuttons.h" +#include "mwindow.h" +#include "mwindowgui.h" +#include "vwindow.h" +#include "vwindowgui.h" + + +LabelPopup::LabelPopup(MWindow *mwindow, AWindowGUI *gui) + : BC_PopupMenu(0, 0, 0, "", 0) +{ + this->mwindow = mwindow; + this->gui = gui; +} + +LabelPopup::~LabelPopup() +{ +} + +void LabelPopup::create_objects() +{ + add_item(editlabel = new LabelPopupEdit(mwindow, gui)); + add_item(new LabelPopupDelete(mwindow, gui)); + add_item(new LabelPopupGoTo(mwindow, gui)); +} + +int LabelPopup::update() +{ + gui->collect_assets(); + return 0; +} + + +LabelPopupEdit::LabelPopupEdit(MWindow *mwindow, AWindowGUI *gui) + : BC_MenuItem(_("Edit...")) +{ + this->mwindow = mwindow; + this->gui = gui; +} + +LabelPopupEdit::~LabelPopupEdit() +{ +} + +int LabelPopupEdit::handle_event() +{ + AssetPicon *result = (AssetPicon*)gui->asset_list->get_selection(0,0); + if( result && result->label ) + gui->awindow->label_edit->start(result->label); + return 1; +} + +LabelPopupDelete::LabelPopupDelete(MWindow *mwindow, AWindowGUI *gui) + : BC_MenuItem(_("Delete")) +{ + this->mwindow = mwindow; + this->gui = gui; +} +LabelPopupDelete::~LabelPopupDelete() +{ +} + +int LabelPopupDelete::handle_event() +{ + AssetPicon *result = (AssetPicon*)gui->asset_list->get_selection(0,0); + if( result && result->label ) { + delete result->label; + mwindow->gui->lock_window("LabelPopupDelete::handle_event"); + mwindow->gui->update_timebar(0); + mwindow->gui->unlock_window(); + gui->async_update_assets(); + } + return 1; +} + + +LabelPopupGoTo::LabelPopupGoTo(MWindow *mwindow, AWindowGUI *gui) + : BC_MenuItem(_("Go to")) +{ + this->mwindow = mwindow; + this->gui = gui; +} +LabelPopupGoTo::~LabelPopupGoTo() +{ +} + +int LabelPopupGoTo::handle_event() +{ + AssetPicon *result = (AssetPicon*)gui->asset_list->get_selection(0,0); + if( result && result->label ) { + double position = result->label->position; + gui->unlock_window(); + int locked = mwindow->gui->get_window_lock(); + if( locked ) mwindow->gui->unlock_window(); + PlayTransport *transport = mwindow->gui->mbuttons->transport; + transport->change_position(position); + if( locked ) mwindow->gui->lock_window("LabelPopupGoTo::handle_event"); + gui->lock_window("LabelPopupGoTo::handle_event 1"); + } + return 1; +} + + +LabelListMenu::LabelListMenu(MWindow *mwindow, AWindowGUI *gui) + : BC_PopupMenu(0, 0, 0, "", 0) +{ + this->mwindow = mwindow; + this->gui = gui; +} + +LabelListMenu:: ~LabelListMenu() +{ +} + +void LabelListMenu::create_objects() +{ + add_item(format = new AWindowListFormat(mwindow)); + add_item(new AWindowListSort(mwindow)); +} + +void LabelListMenu::update() +{ + format->update(); +} + diff --git a/cinelerra-5.1/cinelerra/labelpopup.h b/cinelerra-5.1/cinelerra/labelpopup.h new file mode 100644 index 00000000..6e531fa4 --- /dev/null +++ b/cinelerra-5.1/cinelerra/labelpopup.h @@ -0,0 +1,101 @@ +/* + * CINELERRA + * Copyright (C) 2006 Pierre Dumuid + * Copyright (C) 2008 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef LABELPOPUP_H +#define LABELPOPUP_H + +#include "assetedit.inc" +#include "assets.inc" +#include "awindowgui.inc" +#include "clippopup.inc" +#include "edl.inc" +#include "guicast.h" +#include "labelpopup.inc" +#include "mwindow.inc" + + +class LabelPopup : public BC_PopupMenu +{ +public: + LabelPopup(MWindow *mwindow, AWindowGUI *gui); + ~LabelPopup(); + + void create_objects(); +// Set mainsession with the current selections + int update(); + + MWindow *mwindow; + AWindowGUI *gui; + + LabelPopupEdit *editlabel; +}; + +class LabelPopupEdit : public BC_MenuItem +{ +public: + LabelPopupEdit(MWindow *mwindow, AWindowGUI *gui); + ~LabelPopupEdit(); + + int handle_event(); + + MWindow *mwindow; + AWindowGUI *gui; +}; + +class LabelPopupDelete : public BC_MenuItem +{ +public: + LabelPopupDelete(MWindow *mwindow, AWindowGUI *gui); + ~LabelPopupDelete(); + + int handle_event(); + + MWindow *mwindow; + AWindowGUI *gui; +}; + +class LabelPopupGoTo : public BC_MenuItem +{ +public: + LabelPopupGoTo(MWindow *mwindow, AWindowGUI *gui); + ~LabelPopupGoTo(); + + int handle_event(); + + MWindow *mwindow; + AWindowGUI *gui; +}; + +class LabelListMenu : public BC_PopupMenu +{ +public: + LabelListMenu(MWindow *mwindow, AWindowGUI *gui); + ~LabelListMenu(); + + void create_objects(); + void update(); + + MWindow *mwindow; + AWindowGUI *gui; + AWindowListFormat *format; +}; + +#endif diff --git a/cinelerra-5.1/cinelerra/labelpopup.inc b/cinelerra-5.1/cinelerra/labelpopup.inc new file mode 100644 index 00000000..53dd3a93 --- /dev/null +++ b/cinelerra-5.1/cinelerra/labelpopup.inc @@ -0,0 +1,29 @@ +/* + * CINELERRA + * Copyright (C) 2006 Pierre Dumuid + * Copyright (C) 2008 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef LABELPOPUP_INC +#define LABELPOPUP_INC + +class LabelPopup; +class LabelPopupEdit; +class LabelListMenu; + +#endif diff --git a/cinelerra-5.1/cinelerra/mbuttons.C b/cinelerra-5.1/cinelerra/mbuttons.C index a310aa63..49a08538 100644 --- a/cinelerra-5.1/cinelerra/mbuttons.C +++ b/cinelerra-5.1/cinelerra/mbuttons.C @@ -137,7 +137,7 @@ void MainEditing::to_clip() { MWindowGUI *gui = mwindow->gui; gui->unlock_window(); - mwindow->to_clip(_("main window: ")); + mwindow->to_clip(mwindow->edl, _("main window: ")); gui->lock_window("MainEditing::to_clip"); } diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 920176a5..8fc55bca 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -1610,6 +1610,15 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); if(update_filename) set_filename(new_edl->local_session->clip_title); } + else + if( load_mode == LOADMODE_RESOURCESONLY ) { + strcpy(new_edl->local_session->clip_title, + filenames->get(i)); + struct stat st; + time_t t = !stat(filenames->get(i),&st) ? + st.st_mtime : time(&t); + ctime_r(&t, new_edl->local_session->clip_notes); + } } new_edls.append(new_edl); @@ -1630,12 +1639,10 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); if(debug) printf("MWindow::load_filenames %d\n", __LINE__); - if(!result) gui->statusbar->default_message(); - - - - - + if(!result) { + gui->reset_default_message(); + gui->default_message(); + } if(debug) printf("MWindow::load_filenames %d\n", __LINE__); @@ -1689,32 +1696,26 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); } if(debug) printf("MWindow::load_filenames %d\n", __LINE__); - if(new_assets.size()) + for(int i = 0; i < new_assets.size(); i++) { - for(int i = 0; i < new_assets.size(); i++) - { - Asset *new_asset = new_assets[i]; + Asset *new_asset = new_assets[i]; - File *new_file = 0; - int got_it = 0; - for(int j = 0; j < new_files.size(); j++) + File *new_file = 0; + int got_it = 0; + for(int j = 0; j < new_files.size(); j++) + { + new_file = new_files[j]; + if(!strcmp(new_file->asset->path, + new_asset->path)) { - new_file = new_files[j]; - if(!strcmp(new_file->asset->path, - new_asset->path)) - { - got_it = 1; - break; - } + got_it = 1; + break; } - - mainindexes->add_next_asset(got_it ? new_file : 0, new_asset); - got_indexes = 1; - edl->assets->update(new_asset); - } - + mainindexes->add_next_asset(got_it ? new_file : 0, new_asset); + got_indexes = 1; + edl->assets->update(new_asset); } if(debug) printf("MWindow::load_filenames %d\n", __LINE__); @@ -2983,9 +2984,13 @@ void MWindow::rebuild_indices() index_state->index_status = INDEX_NOTTESTED; if( indexable->is_asset ) { Asset *asset = (Asset *)indexable; - if( asset->format != FILE_PCM ) + if( asset->format != FILE_PCM ) { + asset->format = FILE_UNKNOWN; asset->reset_audio(); + } asset->reset_video(); +// File file; // re-probe the asset +// file.open_file(preferences, asset, 1, 0); } mainindexes->add_next_asset(0, indexable); } diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 4f49de7b..2d041fbc 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -466,8 +466,8 @@ public: // Synchronize EDL settings with all playback engines depending on current // operation. Doesn't redraw anything. void sync_parameters(int change_type = CHANGE_PARAMS); + void save_clip(EDL *new_edl, const char *txt); void to_clip(EDL *edl, const char *txt); - void to_clip(const char *txt); int toggle_label(int is_mwindow); void undo_entry(BC_WindowBase *calling_window_gui); void redo_entry(BC_WindowBase *calling_window_gui); diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index 0c8ad109..b0930084 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -77,14 +77,8 @@ #include "automation.h" #include "maskautos.h" - #include - - - - - void MWindow::add_audio_track_entry(int above, Track *dst) { undo->update_undo_before(); @@ -93,13 +87,7 @@ void MWindow::add_audio_track_entry(int above, Track *dst) undo->update_undo_after(_("add track"), LOAD_ALL); restart_brender(); - gui->update(1, - 1, - 0, - 0, - 1, - 0, - 0); + gui->update(1, 1, 0, 0, 1, 0, 0); gui->activate_timeline(); // gui->get_scrollbars(0); @@ -108,10 +96,8 @@ void MWindow::add_audio_track_entry(int above, Track *dst) // gui->cursor->draw(1); // gui->canvas->flash(); // gui->canvas->activate(); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_EDL, - edl, - 1); + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); } void MWindow::add_video_track_entry(Track *dst) @@ -181,15 +167,12 @@ int MWindow::add_subttl_track(int above, Track *dst) return 0; } - - - void MWindow::asset_to_all() { - if(!session->drag_assets->size()) return; + if( !session->drag_assets->size() ) return; Indexable *indexable = session->drag_assets->get(0); -// if(indexable->have_video()) +// if( indexable->have_video() ) { int w, h; @@ -204,108 +187,81 @@ void MWindow::asset_to_all() int new_samplerate = session->drag_assets->get(0)->get_sample_rate(); - if(indexable->have_video()) - { + if( indexable->have_video() ) { edl->session->output_w = w; edl->session->output_h = h; edl->session->frame_rate = new_framerate; - create_aspect_ratio(edl->session->aspect_w, + create_aspect_ratio( + edl->session->aspect_w, edl->session->aspect_h, - w, - h); + w, h); - for(Track *current = edl->tracks->first; - current; - current = NEXT) - { - if(current->data_type == TRACK_VIDEO /* && - current->record */ ) - { + for( Track *current = edl->tracks->first; current; current = NEXT ) { + if( current->data_type == TRACK_VIDEO /* && + current->record */ ) { current->track_w = w; current->track_h = h; } } - if(((edl->session->output_w % 4) || + if( ((edl->session->output_w % 4) || (edl->session->output_h % 4)) && - edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL) - { + edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL ) { MainError::show_error( _("This project's dimensions are not multiples of 4 so\n" "it can't be rendered by OpenGL.")); } - // Get aspect ratio - if(defaults->get("AUTOASPECT", 0)) - { - create_aspect_ratio(edl->session->aspect_w, + if( defaults->get("AUTOASPECT", 0) ) { + create_aspect_ratio( + edl->session->aspect_w, edl->session->aspect_h, - w, - h); + w, h); } } - if(indexable->have_audio()) - { + if( indexable->have_audio() ) { edl->session->sample_rate = new_samplerate; edl->resample(old_framerate, new_framerate, TRACK_VIDEO); edl->resample(old_samplerate, new_samplerate, TRACK_AUDIO); } - save_backup(); undo->update_undo_after(_("asset to all"), LOAD_ALL); restart_brender(); - gui->update(1, - 2, - 1, - 1, - 1, - 1, - 0); + gui->update(1, 2, 1, 1, 1, 1, 0); sync_parameters(CHANGE_ALL); } } - - - - - void MWindow::asset_to_size() { - if(!session->drag_assets->size()) return; + if( !session->drag_assets->size() ) return; Indexable *indexable = session->drag_assets->get(0); - if(indexable->have_video()) - { + if( indexable->have_video() ) { int w, h; undo->update_undo_before(); // Get w and h w = indexable->get_w(); h = indexable->get_h(); - - edl->session->output_w = w; edl->session->output_h = h; - if(((edl->session->output_w % 4) || + if( ((edl->session->output_w % 4) || (edl->session->output_h % 4)) && - edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL) - { + edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL ) { MainError::show_error( _("This project's dimensions are not multiples of 4 so\n" "it can't be rendered by OpenGL.")); } - // Get aspect ratio - if(defaults->get("AUTOASPECT", 0)) - { + if( defaults->get("AUTOASPECT", 0) ) { create_aspect_ratio(edl->session->aspect_w, edl->session->aspect_h, w, @@ -323,9 +279,8 @@ void MWindow::asset_to_size() void MWindow::asset_to_rate() { - if(session->drag_assets->size() && - session->drag_assets->get(0)->have_video()) - { + if( session->drag_assets->size() && + session->drag_assets->get(0)->have_video() ) { double new_framerate = session->drag_assets->get(0)->get_frame_rate(); double old_framerate = edl->session->frame_rate; undo->update_undo_before(); @@ -337,19 +292,12 @@ void MWindow::asset_to_rate() undo->update_undo_after(_("asset to rate"), LOAD_ALL); restart_brender(); - gui->update(1, - 2, - 1, - 1, - 1, - 1, - 0); + gui->update(1, 2, 1, 1, 1, 1, 0); sync_parameters(CHANGE_ALL); } } - void MWindow::clear_entry() { undo->update_undo_before(); @@ -363,18 +311,15 @@ void MWindow::clear_entry() update_plugin_guis(); gui->update(1, 2, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_EDL, - edl, - 1); + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); } void MWindow::clear(int clear_handle) { double start = edl->local_session->get_selectionstart(); double end = edl->local_session->get_selectionend(); - if(clear_handle || !EQUIV(start, end)) - { + if( clear_handle || !EQUIV(start, end) ) { edl->clear(start, end, edl->session->labels_follow_edits, @@ -463,10 +408,8 @@ void MWindow::concatenate_tracks() restart_brender(); gui->update(1, 1, 0, 0, 1, 0, 0); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_EDL, - edl, - 1); + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); } @@ -478,32 +421,16 @@ void MWindow::copy() int MWindow::copy(double start, double end) { - if(start == end) return 1; + if( start == end ) return 1; -//printf("MWindow::copy 1\n"); FileXML file; -//printf("MWindow::copy 1\n"); - edl->copy(start, - end, - 0, - 0, - 0, - &file, - "", - 1); -//printf("MWindow::copy 1\n"); - -// File is now terminated and rewound - -//printf("MWindow::copy 1\n"); + edl->copy(start, end, 0, 0, 0, &file, "", 1); const char *file_string = file.string(); long file_length = strlen(file_string); gui->get_clipboard()->to_clipboard(file_string, file_length, SECONDARY_SELECTION); gui->get_clipboard()->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION); -//printf("MWindow::copy\n%s\n", file.string); -//printf("MWindow::copy 2\n"); save_backup(); return 0; } @@ -511,11 +438,9 @@ int MWindow::copy(double start, double end) int MWindow::copy_automation() { FileXML file; - edl->tracks->copy_automation(edl->local_session->get_selectionstart(), - edl->local_session->get_selectionend(), - &file, - 0, - 1); + double start = edl->local_session->get_selectionstart(); + double end = edl->local_session->get_selectionend(); + edl->tracks->copy_automation(start, end, &file, 0, 1); const char *file_string = file.string(); long file_length = strlen(file_string); gui->get_clipboard()->to_clipboard(file_string, file_length, @@ -528,11 +453,9 @@ int MWindow::copy_automation() int MWindow::copy_default_keyframe() { FileXML file; - edl->tracks->copy_automation(edl->local_session->get_selectionstart(), - edl->local_session->get_selectionend(), - &file, - 1, - 0); + double start = edl->local_session->get_selectionstart(); + double end = edl->local_session->get_selectionend(); + edl->tracks->copy_automation(start, end, &file, 1, 0); const char *file_string = file.string(); long file_length = strlen(file_string); gui->get_clipboard()->to_clipboard(file_string, file_length, @@ -550,14 +473,12 @@ void MWindow::crop_video() undo->update_undo_before(); // Clamp EDL crop region - if(edl->session->crop_x1 > edl->session->crop_x2) - { + if( edl->session->crop_x1 > edl->session->crop_x2 ) { edl->session->crop_x1 ^= edl->session->crop_x2; edl->session->crop_x2 ^= edl->session->crop_x1; edl->session->crop_x1 ^= edl->session->crop_x2; } - if(edl->session->crop_y1 > edl->session->crop_y2) - { + if( edl->session->crop_y1 > edl->session->crop_y2 ) { edl->session->crop_y1 ^= edl->session->crop_y2; edl->session->crop_y2 ^= edl->session->crop_y1; edl->session->crop_y1 ^= edl->session->crop_y2; @@ -580,8 +501,7 @@ void MWindow::crop_video() edl->session->crop_y2 = edl->session->output_h; // Recalculate aspect ratio - if(defaults->get("AUTOASPECT", 0)) - { + if( defaults->get("AUTOASPECT", 0) ) { create_aspect_ratio(edl->session->aspect_w, edl->session->aspect_h, edl->session->output_w, @@ -591,10 +511,8 @@ void MWindow::crop_video() undo->update_undo_after(_("crop"), LOAD_ALL); restart_brender(); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_ALL, - edl, - 1); + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_ALL, edl, 1); save_backup(); } @@ -606,8 +524,7 @@ void MWindow::cut() double end = edl->local_session->get_selectionend(); copy(start, end); - edl->clear(start, - end, + edl->clear(start, end, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits); @@ -621,10 +538,8 @@ void MWindow::cut() update_plugin_guis(); gui->update(1, 2, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_EDL, - edl, - 1); + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); } int MWindow::cut_automation() @@ -683,7 +598,7 @@ void MWindow::delete_outpoint() void MWindow::delete_track() { - if (edl->tracks->last) + if( edl->tracks->last ) delete_track(edl->tracks->last); } @@ -719,11 +634,8 @@ void MWindow::delete_track(Track *track) // Insert data from clipboard -void MWindow::insert(double position, - FileXML *file, - int edit_labels, - int edit_plugins, - int edit_autos, +void MWindow::insert(double position, FileXML *file, + int edit_labels, int edit_plugins, int edit_autos, EDL *parent_edl) { // For clipboard pasting make the new edl use a separate session @@ -740,9 +652,9 @@ void MWindow::insert(double position, - if(parent_edl) load_flags &= ~LOAD_SESSION; - if(!edl->session->autos_follow_edits) load_flags &= ~LOAD_AUTOMATION; - if(!edl->session->labels_follow_edits) load_flags &= ~LOAD_TIMEBAR; + if( parent_edl ) load_flags &= ~LOAD_SESSION; + if( !edl->session->autos_follow_edits ) load_flags &= ~LOAD_AUTOMATION; + if( !edl->session->labels_follow_edits ) load_flags &= ~LOAD_TIMEBAR; edl->load_xml(file, load_flags); @@ -751,15 +663,9 @@ void MWindow::insert(double position, - paste_edls(&new_edls, - LOADMODE_PASTE, - 0, - position, - edit_labels, - edit_plugins, - edit_autos, - 0); // overwrite -// if(vwindow->edl) + paste_edls(&new_edls, LOADMODE_PASTE, 0, position, + edit_labels, edit_plugins, edit_autos, 0); // overwrite +// if( vwindow->edl ) // printf("MWindow::insert 5 %f %f\n", // vwindow->edl->local_session->in_point, // vwindow->edl->local_session->out_point); @@ -772,21 +678,15 @@ void MWindow::insert_effects_canvas(double start, double length) { Track *dest_track = session->track_highlighted; - if(!dest_track) return; + if( !dest_track ) return; undo->update_undo_before(); - for(int i = 0; i < session->drag_pluginservers->total; i++) - { + for( int i = 0; i < session->drag_pluginservers->total; i++ ) { PluginServer *plugin = session->drag_pluginservers->values[i]; - - insert_effect(plugin->title, - 0, - dest_track, + insert_effect(plugin->title, 0, dest_track, i == 0 ? session->pluginset_highlighted : 0, - start, - length, - PLUGIN_STANDALONE); + start, length, PLUGIN_STANDALONE); } save_backup(); @@ -798,46 +698,31 @@ void MWindow::insert_effects_canvas(double start, void MWindow::insert_effects_cwindow(Track *dest_track) { - if(!dest_track) return; + if( !dest_track ) return; undo->update_undo_before(); double start = 0; double length = dest_track->get_length(); - if(edl->local_session->get_selectionend() > - edl->local_session->get_selectionstart()) - { + if( edl->local_session->get_selectionend() > + edl->local_session->get_selectionstart() ) { start = edl->local_session->get_selectionstart(); length = edl->local_session->get_selectionend() - edl->local_session->get_selectionstart(); } - for(int i = 0; i < session->drag_pluginservers->total; i++) - { + for( int i = 0; i < session->drag_pluginservers->total; i++ ) { PluginServer *plugin = session->drag_pluginservers->values[i]; - - - insert_effect(plugin->title, - 0, - dest_track, - 0, - start, - length, - PLUGIN_STANDALONE); + insert_effect(plugin->title, 0, dest_track, 0, + start, length, PLUGIN_STANDALONE); } save_backup(); undo->update_undo_after(_("insert effect"), LOAD_EDITS | LOAD_PATCHES); restart_brender(); sync_parameters(CHANGE_EDL); - gui->update(1, - 1, - 0, - 0, - 1, - 0, - 0); + gui->update(1, 1, 0, 0, 1, 0, 0); } void MWindow::insert_effect(char *title, @@ -850,23 +735,14 @@ void MWindow::insert_effect(char *title, SharedLocation shared_location_local; shared_location_local.copy_from(shared_location); int first_track = 1; - for( ; current; current = NEXT) - { - if(current->data_type == data_type && - current->record) - { - insert_effect(title, - &shared_location_local, - current, - 0, - 0, - 0, - plugin_type); - - if(first_track) - { - if(plugin_type == PLUGIN_STANDALONE && single_standalone) - { + for( ; current; current = NEXT) { + if( current->data_type == data_type && + current->record ) { + insert_effect(title, &shared_location_local, + current, 0, 0, 0, plugin_type); + + if( first_track ) { + if( plugin_type == PLUGIN_STANDALONE && single_standalone ) { plugin_type = PLUGIN_SHAREDPLUGIN; shared_location_local.module = edl->tracks->number_of(current); shared_location_local.plugin = current->plugin_set.total - 1; @@ -888,38 +764,21 @@ void MWindow::insert_effect(char *title, { KeyFrame *default_keyframe = 0; PluginServer *server = 0; - - - - - - // Get default keyframe - if(plugin_type == PLUGIN_STANDALONE) - { + if( plugin_type == PLUGIN_STANDALONE ) { default_keyframe = new KeyFrame; server = new PluginServer(*scan_plugindb(title, track->data_type)); server->open_plugin(0, preferences, edl, 0); server->save_data(default_keyframe); } - - - // Insert plugin object - track->insert_effect(title, - shared_location, - default_keyframe, - plugin_set, - start, - length, - plugin_type); - + track->insert_effect(title, shared_location, + default_keyframe, plugin_set, + start, length, plugin_type); track->optimize(); - - if(plugin_type == PLUGIN_STANDALONE) - { + if( plugin_type == PLUGIN_STANDALONE ) { server->close_plugin(); delete server; delete default_keyframe; @@ -938,8 +797,6 @@ int MWindow::modify_edithandles() edl->session->autos_follow_edits); finish_modify_handles(); - - //printf("MWindow::modify_handles 1\n"); return 0; } @@ -967,21 +824,18 @@ void MWindow::finish_modify_handles() { int edit_mode = edl->session->edit_handle_mode[session->drag_button]; - if((session->drag_handle == 1 && edit_mode != MOVE_NO_EDITS) || - (session->drag_handle == 0 && edit_mode == MOVE_ONE_EDIT)) - { + if( (session->drag_handle == 1 && edit_mode != MOVE_NO_EDITS) || + (session->drag_handle == 0 && edit_mode == MOVE_ONE_EDIT) ) { edl->local_session->set_selectionstart(session->drag_position); edl->local_session->set_selectionend(session->drag_position); } else - if(edit_mode != MOVE_NO_EDITS) - { + if( edit_mode != MOVE_NO_EDITS ) { edl->local_session->set_selectionstart(session->drag_start); edl->local_session->set_selectionend(session->drag_start); } - if(edl->local_session->get_selectionstart(1) < 0) - { + if( edl->local_session->get_selectionstart(1) < 0 ) { edl->local_session->set_selectionstart(0); edl->local_session->set_selectionend(0); } @@ -1027,19 +881,12 @@ void MWindow::move_edits(ArrayList *edits, undo->update_undo_after(_("move edit"), LOAD_ALL); restart_brender(); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_EDL, - edl, - 1); + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); update_plugin_guis(); - gui->update(1, - 1, // 1 for incremental drawing. 2 for full refresh - 1, - 0, - 0, - 0, - 0); + gui->update(1, 1, // 1 for incremental drawing. 2 for full refresh + 1, 0, 0, 0, 0); } void MWindow::move_effect(Plugin *plugin, Track *track, int64_t position) @@ -1050,9 +897,8 @@ void MWindow::move_effect(Plugin *plugin, Track *track, int64_t position) undo->update_undo_after(_("paste effect"), LOAD_ALL); restart_brender(); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_EDL, edl, 1); - + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); update_plugin_guis(); gui->update(1, 1, // 1 for incremental drawing. 2 for full refresh 0, 0, 0, 0, 0); @@ -1066,7 +912,8 @@ void MWindow::move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t positio undo->update_undo_after(_("move effect"), LOAD_ALL); restart_brender(); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); update_plugin_guis(); gui->update(1, 1, // 1 for incremental drawing. 2 for full refresh 0, 0, 0, 0, 0); @@ -1081,13 +928,8 @@ void MWindow::move_plugins_up(PluginSet *plugin_set) save_backup(); undo->update_undo_after(_("move effect up"), LOAD_ALL); restart_brender(); - gui->update(1, - 1, // 1 for incremental drawing. 2 for full refresh - 0, - 0, - 0, - 0, - 0); + gui->update(1, 1, // 1 for incremental drawing. 2 for full refresh + 0, 0, 0, 0, 0); sync_parameters(CHANGE_EDL); } @@ -1100,13 +942,8 @@ void MWindow::move_plugins_down(PluginSet *plugin_set) save_backup(); undo->update_undo_after(_("move effect down"), LOAD_ALL); restart_brender(); - gui->update(1, - 1, // 1 for incremental drawing. 2 for full refresh - 0, - 0, - 0, - 0, - 0); + gui->update(1, 1, // 1 for incremental drawing. 2 for full refresh + 0, 0, 0, 0, 0); sync_parameters(CHANGE_EDL); } @@ -1164,19 +1001,14 @@ void MWindow::mute_selection() { double start = edl->local_session->get_selectionstart(); double end = edl->local_session->get_selectionend(); - if(start != end) - { + if( start != end ) { undo->update_undo_before(); - edl->clear(start, - end, - 0, + edl->clear(start, end, 0, edl->session->plugins_follow_edits, edl->session->autos_follow_edits); edl->local_session->set_selectionend(end); edl->local_session->set_selectionstart(start); - edl->paste_silence(start, - end, - 0, + edl->paste_silence(start, end, 0, edl->session->plugins_follow_edits, edl->session->autos_follow_edits); save_backup(); @@ -1185,15 +1017,12 @@ void MWindow::mute_selection() restart_brender(); update_plugin_guis(); gui->update(1, 2, 1, 1, 1, 1, 0); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_EDL, - edl, - 1); + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); } } - void MWindow::overwrite(EDL *source) { FileXML file; @@ -1204,39 +1033,24 @@ void MWindow::overwrite(EDL *source) double dst_len = edl->local_session->get_selectionend() - dst_start; undo->update_undo_before(); - if (!EQUIV(dst_len, 0) && (dst_len < overwrite_len)) - { + if( !EQUIV(dst_len, 0) && (dst_len < overwrite_len) ) { // in/out points or selection present and shorter than overwrite range // shorten the copy range overwrite_len = dst_len; } - source->copy(src_start, - src_start + overwrite_len, - 1, - 0, - 0, - &file, - "", - 1); + source->copy(src_start, src_start + overwrite_len, + 1, 0, 0, &file, "", 1); // HACK around paste_edl get_start/endselection on its own // so we need to clear only when not using both io points // FIXME: need to write simple overwrite_edl to be used for overwrite function - if (edl->local_session->get_inpoint() < 0 || - edl->local_session->get_outpoint() < 0) - edl->clear(dst_start, - dst_start + overwrite_len, - 0, - 0, - 0); + if( edl->local_session->get_inpoint() < 0 || + edl->local_session->get_outpoint() < 0 ) + edl->clear(dst_start, dst_start + overwrite_len, 0, 0, 0); - paste(dst_start, - dst_start + overwrite_len, - &file, - 0, - 0, - 0); + paste(dst_start, dst_start + overwrite_len, + &file, 0, 0, 0); edl->local_session->set_selectionstart(dst_start + overwrite_len); edl->local_session->set_selectionend(dst_start + overwrite_len); @@ -1261,12 +1075,9 @@ int MWindow::paste(double start, clear(0); // Want to insert with assets shared with the master EDL. - insert(start, - file, - edit_labels, - edit_plugins, - edit_autos, - edl); + insert(start, file, + edit_labels, edit_plugins, edit_autos, + edl); return 0; } @@ -1278,41 +1089,25 @@ void MWindow::paste() //double end = edl->local_session->get_selectionend(); int64_t len = gui->get_clipboard()->clipboard_len(SECONDARY_SELECTION); - if(len) - { + if( len ) { char *string = new char[len + 1]; - undo->update_undo_before(); - - - gui->get_clipboard()->from_clipboard(string, - len, - BC_PRIMARY_SELECTION); + gui->get_clipboard()->from_clipboard(string, len, BC_PRIMARY_SELECTION); FileXML file; file.read_from_string(string); - - - - clear(0); - insert(start, - &file, + insert(start, &file, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits, 0); edl->optimize(); - - delete [] string; - - save_backup(); - undo->update_undo_after(_("paste"), LOAD_EDITS | LOAD_TIMEBAR); restart_brender(); update_plugin_guis(); @@ -1326,18 +1121,11 @@ void MWindow::paste() int MWindow::paste_assets(double position, Track *dest_track, int overwrite) { int result = 0; - undo->update_undo_before(); - - - if(session->drag_assets->total) - { + if( session->drag_assets->total ) { load_assets(session->drag_assets, - position, - LOADMODE_PASTE, - dest_track, - 0, + position, LOADMODE_PASTE, dest_track, 0, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits, @@ -1345,13 +1133,9 @@ int MWindow::paste_assets(double position, Track *dest_track, int overwrite) result = 1; } - - if(session->drag_clips->total) - { + if( session->drag_clips->total ) { paste_edls(session->drag_clips, - LOADMODE_PASTE, - dest_track, - position, + LOADMODE_PASTE, dest_track, position, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits, @@ -1359,18 +1143,11 @@ int MWindow::paste_assets(double position, Track *dest_track, int overwrite) result = 1; } - save_backup(); undo->update_undo_after(_("paste assets"), LOAD_EDITS); restart_brender(); - gui->update(1, - 2, - 1, - 0, - 0, - 1, - 0); + gui->update(1, 2, 1, 0, 0, 1, 0); sync_parameters(CHANGE_EDL); return result; } @@ -1386,15 +1163,13 @@ void MWindow::load_assets(ArrayList *new_assets, int overwrite) { const int debug = 0; -if(debug) printf("MWindow::load_assets %d\n", __LINE__); - if(position < 0) position = edl->local_session->get_selectionstart(); +if( debug ) printf("MWindow::load_assets %d\n", __LINE__); + if( position < 0 ) position = edl->local_session->get_selectionstart(); ArrayList new_edls; - for(int i = 0; i < new_assets->total; i++) - { + for( int i = 0; i < new_assets->total; i++ ) { Indexable *indexable = new_assets->get(i); - if(indexable->is_asset) - { + if( indexable->is_asset ) { remove_asset_from_caches((Asset*)indexable); } EDL *new_edl = new EDL; @@ -1403,51 +1178,40 @@ if(debug) printf("MWindow::load_assets %d\n", __LINE__); new_edls.append(new_edl); - if(indexable->is_asset) - { -if(debug) printf("MWindow::load_assets %d\n", __LINE__); -if(debug) ((Asset*)indexable)->dump(); + if( indexable->is_asset ) { +if( debug ) printf("MWindow::load_assets %d\n", __LINE__); +if( debug ) ((Asset*)indexable)->dump(); asset_to_edl(new_edl, (Asset*)indexable); } else edl_to_nested(new_edl, (EDL*)indexable); -if(debug) printf("MWindow::load_assets %d\n", __LINE__); +if( debug ) printf("MWindow::load_assets %d\n", __LINE__); - if(labels) - { - for(RecordLabel *label = labels->first; label; label = label->next) - { + if( labels ) { + for( RecordLabel *label = labels->first; label; label = label->next ) { new_edl->labels->toggle_label(label->position, label->position); } } } -if(debug) printf("MWindow::load_assets %d\n", __LINE__); - - paste_edls(&new_edls, - load_mode, - first_track, - position, - edit_labels, - edit_plugins, - edit_autos, - overwrite); -if(debug) printf("MWindow::load_assets %d\n", __LINE__); +if( debug ) printf("MWindow::load_assets %d\n", __LINE__); + paste_edls(&new_edls, load_mode, first_track, position, + edit_labels, edit_plugins, edit_autos, overwrite); +if( debug ) printf("MWindow::load_assets %d\n", __LINE__); save_backup(); - for(int i = 0; i < new_edls.size(); i++) + for( int i = 0; i < new_edls.size(); i++ ) new_edls.get(i)->Garbage::remove_user(); -if(debug) printf("MWindow::load_assets %d\n", __LINE__); +if( debug ) printf("MWindow::load_assets %d\n", __LINE__); } int MWindow::paste_automation() { int64_t len = gui->get_clipboard()->clipboard_len(SECONDARY_SELECTION); - if(len) - { + if( len ) { undo->update_undo_before(); char *string = new char[len + 1]; gui->get_clipboard()->from_clipboard(string, @@ -1456,18 +1220,15 @@ int MWindow::paste_automation() FileXML file; file.read_from_string(string); - edl->tracks->clear_automation(edl->local_session->get_selectionstart(), - edl->local_session->get_selectionend()); - edl->tracks->paste_automation(edl->local_session->get_selectionstart(), - &file, - 0, - 1, + double start = edl->local_session->get_selectionstart(); + double end = edl->local_session->get_selectionend(); + edl->tracks->clear_automation(start, end); + edl->tracks->paste_automation(start, &file, 0, 1, edl->session->typeless_keyframes); save_backup(); undo->update_undo_after(_("paste keyframes"), LOAD_AUTOMATION); delete [] string; - restart_brender(); update_plugin_guis(); gui->draw_overlays(1); @@ -1483,8 +1244,7 @@ int MWindow::paste_default_keyframe() { int64_t len = gui->get_clipboard()->clipboard_len(SECONDARY_SELECTION); - if(len) - { + if( len ) { undo->update_undo_before(); char *string = new char[len + 1]; gui->get_clipboard()->from_clipboard(string, @@ -1492,15 +1252,12 @@ int MWindow::paste_default_keyframe() BC_PRIMARY_SELECTION); FileXML file; file.read_from_string(string); - edl->tracks->paste_automation(edl->local_session->get_selectionstart(), - &file, - 1, - 0, + double start = edl->local_session->get_selectionstart(); + edl->tracks->paste_automation(start, &file, 1, 0, edl->session->typeless_keyframes); // edl->tracks->paste_default_keyframe(&file); undo->update_undo_after(_("paste default keyframe"), LOAD_AUTOMATION); - restart_brender(); update_plugin_guis(); gui->draw_overlays(1); @@ -1516,13 +1273,9 @@ int MWindow::paste_default_keyframe() // Insert edls with project deletion and index file generation. -int MWindow::paste_edls(ArrayList *new_edls, - int load_mode, - Track *first_track, - double current_position, - int edit_labels, - int edit_plugins, - int edit_autos, +int MWindow::paste_edls(ArrayList *new_edls, int load_mode, + Track *first_track, double current_position, + int edit_labels, int edit_plugins, int edit_autos, int overwrite) { @@ -1530,7 +1283,7 @@ int MWindow::paste_edls(ArrayList *new_edls, int need_new_tracks = 0; //PRINT_TRACE - if(!new_edls->total) return 0; + if( !new_edls->total ) return 0; //PRINT_TRACE // double original_length = edl->tracks->total_playable_length(); @@ -1538,33 +1291,20 @@ int MWindow::paste_edls(ArrayList *new_edls, //PRINT_TRACE // Delete current project - if(load_mode == LOADMODE_REPLACE || - load_mode == LOADMODE_REPLACE_CONCATENATE) - { + if( load_mode == LOADMODE_REPLACE || + load_mode == LOADMODE_REPLACE_CONCATENATE ) { reset_caches(); - edl->save_defaults(defaults); - hide_plugins(); - edl->Garbage::remove_user(); - edl = new EDL; - edl->create_objects(); - edl->copy_session(new_edls->values[0]); - gui->mainmenu->update_toggles(0); - - gui->unlock_window(); - gwindow->gui->update_toggles(1); - gui->lock_window("MWindow::paste_edls"); - // Insert labels for certain modes constitutively edit_labels = 1; edit_plugins = 1; @@ -1578,34 +1318,28 @@ int MWindow::paste_edls(ArrayList *new_edls, //PRINT_TRACE // Create new tracks in master EDL - if(load_mode == LOADMODE_REPLACE || - load_mode == LOADMODE_REPLACE_CONCATENATE || - load_mode == LOADMODE_NEW_TRACKS) - { + if( load_mode == LOADMODE_REPLACE || + load_mode == LOADMODE_REPLACE_CONCATENATE || + load_mode == LOADMODE_NEW_TRACKS ) { need_new_tracks = 1; - for(int i = 0; i < new_edls->total; i++) - { + for( int i = 0; i < new_edls->total; i++ ) { EDL *new_edl = new_edls->values[i]; - for(Track *current = new_edl->tracks->first; + for( Track *current = new_edl->tracks->first; current; - current = NEXT) - { - if(current->data_type == TRACK_VIDEO) - { + current = NEXT ) { + if( current->data_type == TRACK_VIDEO ) { edl->tracks->add_video_track(0, 0); - if(current->draw) edl->tracks->last->draw = 1; + if( current->draw ) edl->tracks->last->draw = 1; destination_tracks.append(edl->tracks->last); } else - if(current->data_type == TRACK_AUDIO) - { + if( current->data_type == TRACK_AUDIO ) { edl->tracks->add_audio_track(0, 0); destination_tracks.append(edl->tracks->last); } else - if(current->data_type == TRACK_SUBTITLE) - { + if( current->data_type == TRACK_SUBTITLE ) { edl->tracks->add_subttl_track(0, 0); destination_tracks.append(edl->tracks->last); } @@ -1613,33 +1347,29 @@ int MWindow::paste_edls(ArrayList *new_edls, } // Base track count on first EDL only for concatenation - if(load_mode == LOADMODE_REPLACE_CONCATENATE) break; + if( load_mode == LOADMODE_REPLACE_CONCATENATE ) break; } } else // Recycle existing tracks of master EDL - if(load_mode == LOADMODE_CONCATENATE || - load_mode == LOADMODE_PASTE || - load_mode == LOADMODE_NESTED) - { + if( load_mode == LOADMODE_CONCATENATE || + load_mode == LOADMODE_PASTE || + load_mode == LOADMODE_NESTED ) { //PRINT_TRACE // The point of this is to shift forward labels after the selection so they can // then be shifted back to their original locations without recursively // shifting back every paste. - if((load_mode == LOADMODE_PASTE || - load_mode == LOADMODE_NESTED) && - edl->session->labels_follow_edits) + if( (load_mode == LOADMODE_PASTE || load_mode == LOADMODE_NESTED) && + edl->session->labels_follow_edits ) edl->labels->clear(edl->local_session->get_selectionstart(), edl->local_session->get_selectionend(), 1); Track *current = first_track ? first_track : edl->tracks->first; - for( ; current; current = NEXT) - { - if(current->record) - { + for( ; current; current = NEXT) { + if( current->record ) { destination_tracks.append(current); } } @@ -1647,20 +1377,11 @@ int MWindow::paste_edls(ArrayList *new_edls, } //PRINT_TRACE - - - - int destination_track = 0; double *paste_position = new double[destination_tracks.total]; - - - - // Iterate through the edls - for(int i = 0; i < new_edls->total; i++) - { + for( int i = 0; i < new_edls->total; i++ ) { EDL *new_edl = new_edls->values[i]; double edl_length = new_edl->local_session->clipboard_length ? @@ -1670,9 +1391,6 @@ int MWindow::paste_edls(ArrayList *new_edls, // new_edl->local_session->clipboard_length, // new_edl->tracks->total_length()); // new_edl->dump(); - - - //PRINT_TRACE // Convert EDL to master rates @@ -1683,71 +1401,54 @@ int MWindow::paste_edls(ArrayList *new_edls, edl->session->frame_rate, TRACK_VIDEO); //PRINT_TRACE - - - - // Add assets and prepare index files - for(Asset *new_asset = new_edl->assets->first; - new_asset; - new_asset = new_asset->next) - { + for( Asset *new_asset = new_edl->assets->first; + new_asset; + new_asset = new_asset->next ) { mainindexes->add_next_asset(0, new_asset); } // Capture index file status from mainindex test edl->update_assets(new_edl); //PRINT_TRACE - - - // Get starting point of insertion. Need this to paste labels. - switch(load_mode) - { - case LOADMODE_REPLACE: - case LOADMODE_NEW_TRACKS: - current_position = 0; - break; - - case LOADMODE_CONCATENATE: - case LOADMODE_REPLACE_CONCATENATE: - destination_track = 0; - if(destination_tracks.total) - current_position = destination_tracks.values[0]->get_length(); - else - current_position = 0; - break; - - case LOADMODE_PASTE: - case LOADMODE_NESTED: - destination_track = 0; - if(i == 0) - { - for(int j = 0; j < destination_tracks.total; j++) - { - paste_position[j] = (current_position >= 0) ? - current_position : - edl->local_session->get_selectionstart(); - } + switch( load_mode ) { + case LOADMODE_REPLACE: + case LOADMODE_NEW_TRACKS: + current_position = 0; + break; + + case LOADMODE_CONCATENATE: + case LOADMODE_REPLACE_CONCATENATE: + destination_track = 0; + if( destination_tracks.total ) + current_position = destination_tracks.values[0]->get_length(); + else + current_position = 0; + break; + + case LOADMODE_PASTE: + case LOADMODE_NESTED: + destination_track = 0; + if( i == 0 ) { + for( int j = 0; j < destination_tracks.total; j++ ) { + paste_position[j] = (current_position >= 0) ? + current_position : + edl->local_session->get_selectionstart(); } - break; + } + break; - case LOADMODE_RESOURCESONLY: - edl->add_clip(new_edl); - break; + case LOADMODE_RESOURCESONLY: + edl->add_clip(new_edl); + break; } - - - //PRINT_TRACE - - // Insert edl - if(load_mode != LOADMODE_RESOURCESONLY) - { + if( load_mode != LOADMODE_RESOURCESONLY ) { // Insert labels //printf("MWindow::paste_edls %f %f\n", current_position, edl_length); - if(load_mode == LOADMODE_PASTE || - load_mode == LOADMODE_NESTED) + if( load_mode == LOADMODE_PASTE || + load_mode == LOADMODE_NESTED ) edl->labels->insert_labels(new_edl->labels, destination_tracks.total ? paste_position[0] : 0.0, edl_length, @@ -1759,24 +1460,21 @@ int MWindow::paste_edls(ArrayList *new_edls, edit_labels); //PRINT_TRACE - for(Track *new_track = new_edl->tracks->first; - new_track; - new_track = new_track->next) - { + for( Track *new_track = new_edl->tracks->first; + new_track; + new_track = new_track->next ) { // Get destination track of same type as new_track - for(int k = 0; + for( int k = 0; k < destination_tracks.total && destination_tracks.values[destination_track]->data_type != new_track->data_type; - k++, destination_track++) - { - if(destination_track >= destination_tracks.total - 1) + k++, destination_track++ ) { + if( destination_track >= destination_tracks.total - 1 ) destination_track = 0; } // Insert data into destination track - if(destination_track < destination_tracks.total && - destination_tracks.values[destination_track]->data_type == new_track->data_type) - { + if( destination_track < destination_tracks.total && + destination_tracks.values[destination_track]->data_type == new_track->data_type ) { Track *track = destination_tracks.values[destination_track]; // Replace default keyframes if first EDL and new tracks were created. @@ -1788,49 +1486,41 @@ int MWindow::paste_edls(ArrayList *new_edls, //printf("MWindow::paste_edls 1 %d\n", replace_default); // Insert new track at current position - switch(load_mode) - { - case LOADMODE_REPLACE_CONCATENATE: - case LOADMODE_CONCATENATE: - current_position = track->get_length(); - break; - - case LOADMODE_PASTE: - case LOADMODE_NESTED: - current_position = paste_position[destination_track]; - paste_position[destination_track] += new_track->get_length(); - break; + switch( load_mode ) { + case LOADMODE_REPLACE_CONCATENATE: + case LOADMODE_CONCATENATE: + current_position = track->get_length(); + break; + + case LOADMODE_PASTE: + case LOADMODE_NESTED: + current_position = paste_position[destination_track]; + paste_position[destination_track] += new_track->get_length(); + break; } - if (overwrite) + if( overwrite ) { track->clear(current_position, - current_position + new_track->get_length(), - 1, // edit edits - edit_labels, - edit_plugins, - edit_autos, - 1, // convert units - 0); // trim edits - - + current_position + new_track->get_length(), + 1, // edit edits + edit_labels, edit_plugins, edit_autos, + 1, // convert units + 0); // trim edits + } //PRINT_TRACE - track->insert_track(new_track, - current_position, - replace_default, - edit_plugins, - edit_autos, - edl_length); + track->insert_track(new_track, current_position, replace_default, + edit_plugins, edit_autos, edl_length); //PRINT_TRACE } // Get next destination track destination_track++; - if(destination_track >= destination_tracks.total) + if( destination_track >= destination_tracks.total ) destination_track = 0; } } - if(load_mode == LOADMODE_PASTE || - load_mode == LOADMODE_NESTED) + if( load_mode == LOADMODE_PASTE || + load_mode == LOADMODE_NESTED ) current_position += edl_length; } @@ -1839,25 +1529,21 @@ int MWindow::paste_edls(ArrayList *new_edls, // strange issue, for index not being shown // Assume any paste operation from the same EDL won't contain any clips. // If it did it would duplicate every clip here. - for(int i = 0; i < new_edls->total; i++) - { + for( int i = 0; i < new_edls->total; i++ ) { EDL *new_edl = new_edls->values[i]; - for(int j = 0; j < new_edl->clips.total; j++) - { + for( int j = 0; j < new_edl->clips.total; j++ ) { edl->add_clip(new_edl->clips.values[j]); } - if(new_edl->total_vwindow_edls()) - { -// if(edl->vwindow_edl) + if( new_edl->total_vwindow_edls() ) { +// if( edl->vwindow_edl ) // edl->vwindow_edl->Garbage::remove_user(); // edl->vwindow_edl = new EDL(edl); // edl->vwindow_edl->create_objects(); // edl->vwindow_edl->copy_all(new_edl->vwindow_edl); - for(int j = 0; j < new_edl->total_vwindow_edls(); j++) - { + for( int j = 0; j < new_edl->total_vwindow_edls(); j++ ) { EDL *vwindow_edl = new EDL(edl); vwindow_edl->create_objects(); vwindow_edl->copy_all(new_edl->get_vwindow_edl(j)); @@ -1866,27 +1552,21 @@ int MWindow::paste_edls(ArrayList *new_edls, } } - - if(paste_position) delete [] paste_position; - + if( paste_position ) delete [] paste_position; // This is already done in load_filenames and everything else that uses paste_edls // update_project(load_mode); // Fix preview range -// if(EQUIV(original_length, original_preview_end)) +// if( EQUIV(original_length, original_preview_end) ) // { // edl->local_session->preview_end = edl->tracks->total_playable_length(); // } - // Start examining next batch of index files mainindexes->start_build(); - // Don't save a backup after loading since the loaded file is on disk already. - - //PRINT_TRACE return 0; } @@ -1896,8 +1576,7 @@ void MWindow::paste_silence() double start = edl->local_session->get_selectionstart(); double end = edl->local_session->get_selectionend(); undo->update_undo_before(); - edl->paste_silence(start, - end, + edl->paste_silence(start, end, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits); @@ -1909,10 +1588,8 @@ void MWindow::paste_silence() restart_brender(); gui->update(1, 2, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_EDL, - edl, - 1); + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); } void MWindow::detach_transition(Transition *transition) @@ -1924,14 +1601,8 @@ void MWindow::detach_transition(Transition *transition) save_backup(); undo->update_undo_after(_("detach transition"), LOAD_ALL); - if(is_video) restart_brender(); - gui->update(0, - 1, - 0, - 0, - 0, - 0, - 0); + if( is_video ) restart_brender(); + gui->update(0, 1, 0, 0, 0, 0, 0); sync_parameters(CHANGE_EDL); } @@ -1958,7 +1629,7 @@ void MWindow::paste_transition() PluginServer *server = session->drag_pluginservers->values[0]; undo->update_undo_before(); - if(server->audio) + if( server->audio ) strcpy(edl->session->default_atransition, server->title); else strcpy(edl->session->default_vtransition, server->title); @@ -1967,7 +1638,7 @@ void MWindow::paste_transition() save_backup(); undo->update_undo_after(_("transition"), LOAD_EDITS); - if(server->video) restart_brender(); + if( server->video ) restart_brender(); sync_parameters(CHANGE_ALL); } @@ -2004,8 +1675,7 @@ void MWindow::paste_audio_transition() { PluginServer *server = scan_plugindb(edl->session->default_atransition, TRACK_AUDIO); - if(!server) - { + if( !server ) { char string[BCTEXTLEN]; sprintf(string, _("No default transition %s found."), edl->session->default_atransition); gui->show_message(string); @@ -2025,8 +1695,7 @@ void MWindow::paste_video_transition() { PluginServer *server = scan_plugindb(edl->session->default_vtransition, TRACK_VIDEO); - if(!server) - { + if( !server ) { char string[BCTEXTLEN]; sprintf(string, _("No default transition %s found."), edl->session->default_vtransition); gui->show_message(string); @@ -2166,31 +1835,22 @@ void MWindow::redo_entry(BC_WindowBase *calling_window_gui) calling_window_gui->unlock_window(); - cwindow->playback_engine->que->send_command(STOP, - CHANGE_NONE, - 0, - 0); + cwindow->playback_engine->que-> + send_command(STOP, CHANGE_NONE, 0, 0); cwindow->playback_engine->interrupt_playback(0); - for(int i = 0; i < vwindows.size(); i++) - { - if(vwindows.get(i)->is_running()) - { - vwindows.get(i)->playback_engine->que->send_command(STOP, - CHANGE_NONE, - 0, - 0); + for( int i = 0; i < vwindows.size(); i++ ) { + if( vwindows.get(i)->is_running() ) { + vwindows.get(i)->playback_engine->que-> + send_command(STOP, CHANGE_NONE, 0, 0); vwindows.get(i)->playback_engine->interrupt_playback(0); } } cwindow->gui->lock_window("MWindow::redo_entry"); - for(int i = 0; i < vwindows.size(); i++) - { - if(vwindows.get(i)->is_running()) - { - if (calling_window_gui != vwindows.get(i)->gui) - { + for( int i = 0; i < vwindows.size(); i++ ) { + if( vwindows.get(i)->is_running() ) { + if( calling_window_gui != vwindows.get(i)->gui ) { vwindows.get(i)->gui->lock_window("MWindow::redo_entry 2"); } } @@ -2206,28 +1866,22 @@ void MWindow::redo_entry(BC_WindowBase *calling_window_gui) gui->update(1, 2, 1, 1, 1, 1, 1); cwindow->update(1, 1, 1, 1, 1); - if (calling_window_gui != cwindow->gui) + if( calling_window_gui != cwindow->gui ) cwindow->gui->unlock_window(); - if (calling_window_gui != gui) + if( calling_window_gui != gui ) gui->unlock_window(); - for(int i = 0; i < vwindows.size(); i++) - { - if(vwindows.get(i)->is_running()) - { - if (calling_window_gui != vwindows.get(i)->gui) - { + for( int i = 0; i < vwindows.size(); i++ ) { + if( vwindows.get(i)->is_running() ) { + if( calling_window_gui != vwindows.get(i)->gui ) { vwindows.get(i)->gui->unlock_window(); } } } - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_ALL, - edl, - 1); - + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_ALL, edl, 1); } @@ -2255,23 +1909,19 @@ void MWindow::set_inpoint(int is_mwindow) save_backup(); undo->update_undo_after(_("in point"), LOAD_TIMEBAR); - if(!is_mwindow) - { + if( !is_mwindow ) { gui->lock_window("MWindow::set_inpoint 1"); } gui->update_timebar(1); - if(!is_mwindow) - { + if( !is_mwindow ) { gui->unlock_window(); } - if(is_mwindow) - { + if( is_mwindow ) { cwindow->gui->lock_window("MWindow::set_inpoint 2"); } cwindow->gui->timebar->update(1); - if(is_mwindow) - { + if( is_mwindow ) { cwindow->gui->unlock_window(); } } @@ -2283,23 +1933,19 @@ void MWindow::set_outpoint(int is_mwindow) save_backup(); undo->update_undo_after(_("out point"), LOAD_TIMEBAR); - if(!is_mwindow) - { + if( !is_mwindow ) { gui->lock_window("MWindow::set_outpoint 1"); } gui->update_timebar(1); - if(!is_mwindow) - { + if( !is_mwindow ) { gui->unlock_window(); } - if(is_mwindow) - { + if( is_mwindow ) { cwindow->gui->lock_window("MWindow::set_outpoint 2"); } cwindow->gui->timebar->update(1); - if(is_mwindow) - { + if( is_mwindow ) { cwindow->gui->unlock_window(); } } @@ -2309,37 +1955,21 @@ void MWindow::splice(EDL *source) FileXML file; undo->update_undo_before(); - source->copy(source->local_session->get_selectionstart(), - source->local_session->get_selectionend(), - 1, - 0, - 0, - &file, - "", - 1); - - - + double source_start = source->local_session->get_selectionstart(); + double source_end = source->local_session->get_selectionend(); + source->copy(source_start, source_end, 1, 0, 0, &file, "", 1); //file.dump(); double start = edl->local_session->get_selectionstart(); //double end = edl->local_session->get_selectionend(); - double source_start = source->local_session->get_selectionstart(); - double source_end = source->local_session->get_selectionend(); - paste(start, - start, - &file, + paste(start, start, &file, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits); // Position at end of clip - edl->local_session->set_selectionstart(start + - source_end - - source_start); - edl->local_session->set_selectionend(start + - source_end - - source_start); + edl->local_session->set_selectionstart(start + source_end - source_start); + edl->local_session->set_selectionend(start + source_end - source_start); save_backup(); undo->update_undo_after(_("splice"), LOAD_EDITS | LOAD_TIMEBAR); @@ -2349,39 +1979,24 @@ void MWindow::splice(EDL *source) sync_parameters(CHANGE_EDL); } -void MWindow::to_clip(EDL *edl, const char *txt) +void MWindow::save_clip(EDL *new_edl, const char *txt) { - FileXML file; - double start, end; - - gui->lock_window("MWindow::to_clip 1"); - start = edl->local_session->get_selectionstart(); - end = edl->local_session->get_selectionend(); - - if(EQUIV(end, start)) { - start = 0; - end = edl->tracks->total_length(); - } - -// Don't copy all since we don't want the clips twice. - edl->copy(start, end, 0, 0, 0, &file, "", 1); - - EDL *new_edl = new EDL(edl); - new_edl->create_objects(); - new_edl->load_xml(&file, LOAD_ALL); - sprintf(new_edl->local_session->clip_title, _("Clip %d"), session->clip_number++); + new_edl->local_session->set_selectionstart(0); + new_edl->local_session->set_selectionend(0); + sprintf(new_edl->local_session->clip_title, _("Clip %d"), + session->clip_number++); char duration[BCTEXTLEN]; - Units::totext(duration, end - start, - edl->session->time_format, - edl->session->sample_rate, - edl->session->frame_rate, - edl->session->frames_per_foot); + Units::totext(duration, new_edl->tracks->total_length(), + new_edl->session->time_format, + new_edl->session->sample_rate, + new_edl->session->frame_rate, + new_edl->session->frames_per_foot); + Track *track = new_edl->tracks->first; const char *path = edl->path; - Track *track=edl->tracks->first; - for(; (!path || !*path) && track; track=track->next ) { + for( ; (!path || !*path) && track; track=track->next ) { if( !track->record ) continue; - Edit *edit = track->edits->editof(start, PLAY_FORWARD, 0); + Edit *edit = track->edits->first; if( !edit ) continue; Indexable *indexable = edit->get_source(); if( !indexable ) continue; @@ -2410,20 +2025,37 @@ void MWindow::to_clip(EDL *edl, const char *txt) } cp[n] = 0; - new_edl->local_session->set_selectionstart(0); - new_edl->local_session->set_selectionend(0); - + edl->update_assets(new_edl); gui->unlock_window(); awindow->clip_edit->create_clip(new_edl); - gui->lock_window("MWindow::to_clip 2"); + gui->lock_window("MWindow::save_clip"); save_backup(); - gui->unlock_window(); } -void MWindow::to_clip(const char *txt) + +void MWindow::to_clip(EDL *edl, const char *txt) { - to_clip(edl, txt); + FileXML file; + double start, end; + + gui->lock_window("MWindow::to_clip 1"); + start = edl->local_session->get_selectionstart(); + end = edl->local_session->get_selectionend(); + + if( EQUIV(end, start) ) { + start = 0; + end = edl->tracks->total_length(); + } + +// Don't copy all since we don't want the clips twice. + edl->copy(start, end, 0, 0, 0, &file, "", 1); + + EDL *new_edl = new EDL(edl); + new_edl->create_objects(); + new_edl->load_xml(&file, LOAD_ALL); + save_clip(new_edl, txt); + gui->unlock_window(); } int MWindow::toggle_label(int is_mwindow) @@ -2431,13 +2063,11 @@ int MWindow::toggle_label(int is_mwindow) double position1, position2; undo->update_undo_before(); - if(cwindow->playback_engine->is_playing_back) - { + if( cwindow->playback_engine->is_playing_back ) { position1 = position2 = cwindow->playback_engine->get_tracking_position(); } - else - { + else { position1 = edl->local_session->get_selectionstart(1); position2 = edl->local_session->get_selectionend(1); } @@ -2450,25 +2080,21 @@ int MWindow::toggle_label(int is_mwindow) edl->labels->toggle_label(position1, position2); save_backup(); - if(!is_mwindow) - { + if( !is_mwindow ) { gui->lock_window("MWindow::toggle_label 1"); } gui->update_timebar(0); gui->activate_timeline(); gui->flush(); - if(!is_mwindow) - { + if( !is_mwindow ) { gui->unlock_window(); } - if(is_mwindow) - { + if( is_mwindow ) { cwindow->gui->lock_window("MWindow::toggle_label 2"); } cwindow->gui->timebar->update(1); - if(is_mwindow) - { + if( is_mwindow ) { cwindow->gui->unlock_window(); } @@ -2495,44 +2121,32 @@ void MWindow::trim_selection() gui->update(1, 2, 1, 1, 1, 1, 0); cwindow->update(1, 0, 0, 0, 1); restart_brender(); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_EDL, - edl, - 1); + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); } - void MWindow::undo_entry(BC_WindowBase *calling_window_gui) { calling_window_gui->unlock_window(); - cwindow->playback_engine->que->send_command(STOP, - CHANGE_NONE, - 0, - 0); + cwindow->playback_engine->que-> + send_command(STOP, CHANGE_NONE, 0, 0); cwindow->playback_engine->interrupt_playback(0); //printf("MWindow::undo_entry %d %d\n", __LINE__, vwindows.size()); - for(int i = 0; i < vwindows.size(); i++) - { - if(vwindows.get(i)->is_running()) - { - vwindows.get(i)->playback_engine->que->send_command(STOP, - CHANGE_NONE, - 0, - 0); + for( int i = 0; i < vwindows.size(); i++ ) { + if( vwindows.get(i)->is_running() ) { + vwindows.get(i)->playback_engine->que-> + send_command(STOP, CHANGE_NONE, 0, 0); vwindows.get(i)->playback_engine->interrupt_playback(0); } } cwindow->gui->lock_window("MWindow::undo_entry 1"); - for(int i = 0; i < vwindows.size(); i++) - { - if(vwindows.get(i)->is_running()) - { - if (calling_window_gui != vwindows.get(i)->gui) - { + for( int i = 0; i < vwindows.size(); i++ ) { + if( vwindows.get(i)->is_running() ) { + if( calling_window_gui != vwindows.get(i)->gui ) { vwindows.get(i)->gui->lock_window("MWindow::undo_entry 4"); } } @@ -2546,42 +2160,30 @@ void MWindow::undo_entry(BC_WindowBase *calling_window_gui) update_plugin_states(); update_plugin_guis(); - - gui->update(1, 2, 1, 1, 1, 1, 1); - gui->unlock_window(); - cwindow->update(1, 1, 1, 1, 1); - cwindow->gui->unlock_window(); - for(int i = 0; i < vwindows.size(); i++) - { - if(vwindows.get(i)->is_running()) - { - if (calling_window_gui != vwindows.get(i)->gui) - { + for( int i = 0; i < vwindows.size(); i++ ) { + if( vwindows.get(i)->is_running() ) { + if( calling_window_gui != vwindows.get(i)->gui ) { vwindows.get(i)->gui->unlock_window(); } } } - if (calling_window_gui != gui) + if( calling_window_gui != gui ) gui->unlock_window(); - awindow->gui->async_update_assets(); - cwindow->playback_engine->que->send_command(CURRENT_FRAME, - CHANGE_ALL, - edl, - 1); + cwindow->playback_engine->que-> + send_command(CURRENT_FRAME, CHANGE_ALL, edl, 1); calling_window_gui->lock_window("MWindow::undo_entry 4"); } - void MWindow::new_folder(const char *new_folder) { undo->update_undo_before(); @@ -2603,7 +2205,6 @@ void MWindow::select_point(double position) // Que the CWindow cwindow->update(1, 0, 0, 0, 1); - update_plugin_guis(); gui->update_patchbay(); gui->hide_cursor(0); @@ -2633,62 +2234,52 @@ void MWindow::remap_audio(int pattern) { int current_channel = 0; int current_track = 0; - for(Track *current = edl->tracks->first; current; current = NEXT) - { - if(current->data_type == TRACK_AUDIO && - current->record) - { + for( Track *current = edl->tracks->first; current; current = NEXT ) { + if( current->data_type == TRACK_AUDIO && + current->record ) { Autos *pan_autos = current->automation->autos[AUTOMATION_PAN]; PanAuto *pan_auto = (PanAuto*)pan_autos->get_auto_for_editing(-1); - for(int i = 0; i < MAXCHANNELS; i++) - { + for( int i = 0; i < MAXCHANNELS; i++ ) { pan_auto->values[i] = 0.0; } - if(pattern == MWindow::AUDIO_1_TO_1) - { + if( pattern == MWindow::AUDIO_1_TO_1 ) { pan_auto->values[current_channel] = 1.0; } else - if(pattern == MWindow::AUDIO_5_1_TO_2) - { - switch(current_track) - { - case 0: - pan_auto->values[0] = 0.5; - pan_auto->values[1] = 0.5; - break; - case 1: - pan_auto->values[0] = 1; - break; - case 2: - pan_auto->values[1] = 1; - break; - case 3: - pan_auto->values[0] = 1; - break; - case 4: - pan_auto->values[1] = 1; - break; - case 5: - pan_auto->values[0] = 0.5; - pan_auto->values[1] = 0.5; - break; + if( pattern == MWindow::AUDIO_5_1_TO_2 ) { + switch( current_track ) { + case 0: + pan_auto->values[0] = 0.5; + pan_auto->values[1] = 0.5; + break; + case 1: + pan_auto->values[0] = 1; + break; + case 2: + pan_auto->values[1] = 1; + break; + case 3: + pan_auto->values[0] = 1; + break; + case 4: + pan_auto->values[1] = 1; + break; + case 5: + pan_auto->values[0] = 0.5; + pan_auto->values[1] = 0.5; + break; } } BC_Pan::calculate_stick_position(edl->session->audio_channels, - edl->session->achannel_positions, - pan_auto->values, - MAX_PAN, - PAN_RADIUS, - pan_auto->handle_x, - pan_auto->handle_y); + edl->session->achannel_positions, pan_auto->values, + MAX_PAN, PAN_RADIUS, pan_auto->handle_x, pan_auto->handle_y); current_channel++; current_track++; - if(current_channel >= edl->session->audio_channels) + if( current_channel >= edl->session->audio_channels ) current_channel = 0; } } diff --git a/cinelerra-5.1/cinelerra/mwindowgui.C b/cinelerra-5.1/cinelerra/mwindowgui.C index 78cbb2a1..3c0213af 100644 --- a/cinelerra-5.1/cinelerra/mwindowgui.C +++ b/cinelerra-5.1/cinelerra/mwindowgui.C @@ -382,12 +382,6 @@ void MWindowGUI::redraw_time_dependancies() mainclock->update(mwindow->edl->local_session->get_selectionstart(1)); } -int MWindowGUI::cursor_enter_event() -{ - reset_default_message(); - return 0; -} - int MWindowGUI::focus_in_event() { for(int i = 0; i < TOTAL_PANES; i++) diff --git a/cinelerra-5.1/cinelerra/mwindowgui.h b/cinelerra-5.1/cinelerra/mwindowgui.h index 5b8d6bfe..de21ee81 100644 --- a/cinelerra-5.1/cinelerra/mwindowgui.h +++ b/cinelerra-5.1/cinelerra/mwindowgui.h @@ -129,7 +129,6 @@ public: void set_meter_format(int mode, int min, int max); int translation_event(); - int cursor_enter_event(); int resize_event(int w, int h); // handle a resize event int button_release_event(); int keypress_event(); diff --git a/cinelerra-5.1/cinelerra/render.C b/cinelerra-5.1/cinelerra/render.C index 642552d1..cf088108 100644 --- a/cinelerra-5.1/cinelerra/render.C +++ b/cinelerra-5.1/cinelerra/render.C @@ -409,19 +409,11 @@ int Render::check_asset(EDL *edl, Asset &asset) asset.width = edl->session->output_w; asset.height = edl->session->output_h; asset.interlace_mode = edl->session->interlace_mode; - asset.tcstart = (int64_t) (edl->session->get_frame_offset() + - edl->local_session->get_selectionstart() * - edl->session->frame_rate); - asset.tcend = (int64_t) (edl->session->get_frame_offset() + - edl->local_session->get_selectionend() * - edl->session->frame_rate); } else { asset.video_data = 0; asset.layers = 0; - asset.tcstart = 0; - asset.tcend = 0; } if(asset.audio_data && @@ -430,19 +422,11 @@ int Render::check_asset(EDL *edl, Asset &asset) { asset.audio_data = 1; asset.channels = edl->session->audio_channels; - asset.tcstart = (int64_t) (edl->session->get_frame_offset() + - edl->local_session->get_selectionstart() * - edl->session->sample_rate); - asset.tcend = (int64_t) (edl->session->get_frame_offset() + - edl->local_session->get_selectionend() * - edl->session->sample_rate); } else { asset.audio_data = 0; asset.channels = 0; - asset.tcstart = 0; - asset.tcend = 0; } if(!asset.audio_data && diff --git a/cinelerra-5.1/cinelerra/timebar.C b/cinelerra-5.1/cinelerra/timebar.C index a09257bc..b295c323 100644 --- a/cinelerra-5.1/cinelerra/timebar.C +++ b/cinelerra-5.1/cinelerra/timebar.C @@ -101,7 +101,7 @@ int LabelGUI::button_press_event() if (this->is_event_win() && get_buttonpress() == 3) { if (label) - timebar->label_edit->edit_label(label); + timebar->label_edit->start(label); result = 1; } else { result = BC_Toggle::button_press_event(); diff --git a/cinelerra-5.1/cinelerra/vtracking.C b/cinelerra-5.1/cinelerra/vtracking.C index c459f974..cb818d92 100644 --- a/cinelerra-5.1/cinelerra/vtracking.C +++ b/cinelerra-5.1/cinelerra/vtracking.C @@ -58,21 +58,10 @@ void VTracking::update_tracker(double position) vwindow->gui->lock_window("VTracking::update_tracker"); vwindow->get_edl()->local_session->set_selectionstart(position); vwindow->get_edl()->local_session->set_selectionend(position); - - Asset *asset = vwindow->get_edl()->assets->first; - if( asset && asset->tcstart ) { - double rate = asset->video_data ? asset->frame_rate : - asset->audio_data ? asset->sample_rate : 0; - if( rate > 0 ) - position += asset->tcstart / rate; - } vwindow->gui->clock->update(position); - // This is going to boost the latency but we need to update the timebar vwindow->gui->timebar->update(1); - vwindow->gui->unlock_window(); - update_meters((int64_t)(position * mwindow->edl->session->sample_rate)); } diff --git a/cinelerra-5.1/cinelerra/vwindow.C b/cinelerra-5.1/cinelerra/vwindow.C index 428a7b23..2f96447c 100644 --- a/cinelerra-5.1/cinelerra/vwindow.C +++ b/cinelerra-5.1/cinelerra/vwindow.C @@ -334,14 +334,6 @@ void VWindow::update_position(int change_type, 1); double position = edl->local_session->get_selectionstart(1); - Asset *asset = edl->assets->first; - if( asset && asset->tcstart ) { - double rate = asset->video_data ? asset->frame_rate : - asset->audio_data ? asset->sample_rate : 0; - if( rate > 0 ) - position += asset->tcstart / rate; - } - if(lock_window) gui->lock_window("VWindow::update_position"); gui->clock->update(position); if(lock_window) gui->unlock_window(); diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac index b4325d5e..576b1eee 100644 --- a/cinelerra-5.1/configure.ac +++ b/cinelerra-5.1/configure.ac @@ -33,6 +33,7 @@ CHECK_WITH([cindat],[cinelerra share path],[CINDAT_DIR],[auto]) CHECK_WITH([plugin-dir],[plugin install dir],[PLUGIN_DIR],[auto]) CHECK_WITH([ladspa-dir],[ladspa install dir],[LADSPA_DIR],[auto]) CHECK_WITH([config-dir],[.bcast config dir],[CONFIG_DIR],[$$HOME/.bcast5]) +CHECK_WITH([browser],[cin_browser path],[CIN_BROWSER],[firefox]) if test "x$WANT_CINBIN_BUILD" = "xyes"; then WANT_LOCALE_DIR='$$CIN_LIB/locale' @@ -670,6 +671,7 @@ echo " using: exec-name = $WANT_CIN" echo " using: with-cinlib = $WANT_CINLIB_DIR" echo " using: with-cindat = $WANT_CINDAT_DIR" echo " using: with-config-dir = $WANT_CONFIG_DIR" +echo " using: with-browser = $WANT_CIN_BROWSER" echo " using: with-plugin-dir = $WANT_PLUGIN_DIR" echo " using: with-ladspa-dir = $WANT_LADSPA_DIR" echo "" @@ -745,6 +747,7 @@ echo "CFLAGS += '-DCONFIG_DIR=\"$WANT_CONFIG_DIR\"'" echo "CFLAGS += '-DPLUGIN_DIR=\"$WANT_PLUGIN_DIR\"'" echo "CFLAGS += '-DLOCALE_DIR=\"$WANT_LOCALE_DIR\"'" echo "CFLAGS += '-DLADSPA_DIR=\"$WANT_LADSPA_DIR\"'" +echo "CFLAGS += '-DCIN_BROWSER=\"$WANT_CIN_BROWSER\"'" for flg in $CFG_CFLAGS; do echo "CFLAGS += $flg"; done echo "" for flg in $CFG_CXXFLAGS; do echo "CXXFLAGS += $flg"; done diff --git a/cinelerra-5.1/guicast/bcfilebox.C b/cinelerra-5.1/guicast/bcfilebox.C index 0fae1250..207084d7 100644 --- a/cinelerra-5.1/guicast/bcfilebox.C +++ b/cinelerra-5.1/guicast/bcfilebox.C @@ -1038,12 +1038,17 @@ int BC_FileBox::submit_dir(char *dir) int BC_FileBox::submit_file(const char *path, int use_this) { + char path1[BCTEXTLEN]; + strcpy(path1, path); + char *cp = strchr(path1,'\n'); + if( cp ) *cp = 0; + // Deactivate textbox to hide suggestions textbox->deactivate(); // If file wanted, take the current directory as the desired file. // If directory wanted, ignore it. - if(!path[0] && !want_directory) + if(!path1[0] && !want_directory) { // save complete path strcpy(this->current_path, directory); @@ -1057,9 +1062,9 @@ int BC_FileBox::submit_file(const char *path, int use_this) } // is a directory, change directories - if(fs->is_dir(path) && !use_this) + if(fs->is_dir(path1) && !use_this) { - fs->change_dir(path, 0); + fs->change_dir(path1, 0); refresh(1); directory_title->update(fs->get_current_dir()); strcpy(this->current_path, fs->get_current_dir()); @@ -1078,7 +1083,7 @@ int BC_FileBox::submit_file(const char *path, int use_this) // Is a file or desired directory. Quit the operation. { char path2[BCTEXTLEN]; - strcpy(path2, path); + strcpy(path2, path1); // save directory for defaults fs->extract_dir(directory, path2); @@ -1114,7 +1119,7 @@ void BC_FileBox::update_history() strcpy(path, directory); // enfore one trailing slash char *cp = path; - while( *cp ) ++cp; + while( *cp && *cp != '\n' ) ++cp; while( cp > path && *(cp-1) == '/' ) --cp; *cp++ = '/'; *cp = 0; diff --git a/cinelerra-5.1/guicast/bcresources.C b/cinelerra-5.1/guicast/bcresources.C index 8c9d1b24..ba67eeff 100644 --- a/cinelerra-5.1/guicast/bcresources.C +++ b/cinelerra-5.1/guicast/bcresources.C @@ -234,10 +234,11 @@ BC_Resources::BC_Resources() wide_encoding = little_endian ? "UTF32LE" : "UTF32BE"; use_xvideo = 1; -#include "images/file_film_png.h" #include "images/file_folder_png.h" -#include "images/file_sound_png.h" #include "images/file_unknown_png.h" +#include "images/file_film_png.h" +#include "images/file_sound_png.h" +#include "images/file_label_png.h" #include "images/file_column_png.h" static VFrame* default_type_to_icon[] = { @@ -245,6 +246,7 @@ BC_Resources::BC_Resources() new VFramePng(file_unknown_png), new VFramePng(file_film_png), new VFramePng(file_sound_png), + new VFramePng(file_label_png), new VFramePng(file_column_png) }; type_to_icon = default_type_to_icon; diff --git a/cinelerra-5.1/guicast/bcresources.inc b/cinelerra-5.1/guicast/bcresources.inc index 38e1cba4..1f103082 100644 --- a/cinelerra-5.1/guicast/bcresources.inc +++ b/cinelerra-5.1/guicast/bcresources.inc @@ -40,6 +40,7 @@ class BC_Resources; #define ICON_UNKNOWN 1 // Private bitmap #define ICON_FILM 2 // Private bitmap #define ICON_SOUND 3 // Private bitmap -#define ICON_COLUMN 4 // Private bitmap +#define ICON_LABEL 4 // Private bitmap +#define ICON_COLUMN 5 // Private bitmap #endif diff --git a/cinelerra-5.1/guicast/guicast.h b/cinelerra-5.1/guicast/guicast.h index 86c16247..fe3dffde 100644 --- a/cinelerra-5.1/guicast/guicast.h +++ b/cinelerra-5.1/guicast/guicast.h @@ -28,6 +28,7 @@ #include "bcbitmap.h" #include "bcbutton.h" #include "bcclipboard.h" +#include "bcdialog.h" #include "bcdragwindow.h" #include "bclistboxitem.h" #include "bcpan.h" diff --git a/cinelerra-5.1/guicast/images/file_label.png b/cinelerra-5.1/guicast/images/file_label.png new file mode 100644 index 0000000000000000000000000000000000000000..a01d001bebbc1626c545dd9e619befa2fddb8993 GIT binary patch literal 1382 zcmV-s1)2JZP)G1#n1oKHm zK~!ko?O4l;97P=dzN+pSXP2G4BoWbzdWaw)dPxj=5WILvAmGIZA|4bx`>*&H2tmCV z4>>8~NdymqhwMV42)Y=8akJ~r?96okJ`dIJ?b(@)5lrY03c9PS>i2$B106ba=+L1< zhYlS&bm-8b!~YR%n@lv7x6KJ=2EeOal?YP)CNKpgfC%$u%H|0uTV+K4k|YFRfDD2` zB1j8|*s7B2tz_3 z-~obRZJHF!!ZLayB$ta2*5yJa*=s?@Lm3TMP{Yy!X}TlqUf+Qx5sU;QAXk@nb&I-5 zZe_wOv$-S8Ss_FeJ3tC-C}%C#d2U8!G_pBa@lEjAniOzuk;~NtQaTZ48+XAy55@*Z z1Q*K$N?AWJbwOByNSz8dW}5BcLXGBHsIOy5lT@%~v4%?tBufmV-}aD>JQ%6mCmqaF zrqp1(%sqWcJDHVM1asG7BZf;$DJDP~ zKNX3=%KbcamMb}Tmcoq%7E0i9oJkN=VW=wIB6rh%S8I*6rM2X0j})MYOSyf!cJHNZ zxY8YKW)Tk0NGXsJ0QmCL8FcK#@i*vsgz{s9_b5=&%@ zeKwo`&p@^qRmQVyM;GFVzO)(%n9J7B7wER69Z7#9jxp#>aB8rPY-kG;F~-KRLY{`%!h ztE(7dhu7eGvpKwRpD;9l%HpxPb}9E%-JOfrvPEI!UOS0n05Bcn#qIuhaB1?=3m5O| z#>MCG^_6XZ=ExI2tzo+JD}2wuWwk8^C${_6jvYSB0eE}+`8(D3AAz@qJhP6Y(-W|f zs}#yc+=w-;ngM1E^G%B|TWcssO^8NjW92zs*eST($$X7mz4YPPQC%Wpp1)z4p@L5w%ho)Xle)kZeRyMtV7L ztL;BnTNm%@M*ebTxOrk_yovF^Fwoi-Zf|X3xN;UYnjnoFENv^_YzS7jgmczfI4x~c zO69yv80RW=&WGl5c<%U8&FM<|m!a>{!Nd`6vWnw_r!gK)L!+j)MzbkQ!~dI>P_s9( zmNT<6ibloqMsXR`uMg8HfiaMHUj{hJY~@_NaZBaFYARF1)queqMI!j}2%lm6)T2lS zzOKF4!gazQq8J|djTO4VwG=rhA{71mEVpl_cX9;~;Z1Onfdm`{PYad5RzI?iK>0;F z+?|*QwaV|1756q$a1O=U@B*Dc2+oCPpN%4v7_K!uxVrBXh=V8l5At81b{qGP_n_M& z7#u9ATml=nJho&$hTlNJO31S#%gbs`nIZmU0-OP9NIqqfVZEIT=3Z2ZS_NYN^qOYt zw=mlRST&fn#D-L1w){UshKpaBMhN=KZ!l+|W9XfH