sams folder icons, snap drag, sort folders, in/out ptr bug, interp bg fix, filebox...
authorGood Guy <good1.2guy@gmail.com>
Wed, 11 Oct 2017 02:20:09 +0000 (20:20 -0600)
committerGood Guy <good1.2guy@gmail.com>
Wed, 11 Oct 2017 02:20:09 +0000 (20:20 -0600)
23 files changed:
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/awindowgui.h
cinelerra-5.1/cinelerra/edl.C
cinelerra-5.1/cinelerra/folderlistmenu.C
cinelerra-5.1/cinelerra/folderlistmenu.h
cinelerra-5.1/cinelerra/interp.h
cinelerra-5.1/cinelerra/mwindowedit.C
cinelerra-5.1/cinelerra/mwindowmove.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/trackcanvas.h
cinelerra-5.1/guicast/bcfilebox.C
cinelerra-5.1/guicast/bcresources.C
cinelerra-5.1/guicast/bcresources.h
cinelerra-5.1/guicast/bcresources.inc
cinelerra-5.1/picon_cinfinity/aeffect_folder.png [new file with mode: 0644]
cinelerra-5.1/picon_cinfinity/atransition_folder.png [new file with mode: 0644]
cinelerra-5.1/picon_cinfinity/clip_folder.png [new file with mode: 0644]
cinelerra-5.1/picon_cinfinity/label_folder.png [new file with mode: 0644]
cinelerra-5.1/picon_cinfinity/media_folder.png [new file with mode: 0644]
cinelerra-5.1/picon_cinfinity/proxy_folder.png [new file with mode: 0644]
cinelerra-5.1/picon_cinfinity/proxy_icon.png [new file with mode: 0644]
cinelerra-5.1/picon_cinfinity/veffect_folder.png [new file with mode: 0644]
cinelerra-5.1/picon_cinfinity/vtransition_folder.png [new file with mode: 0644]

index dcc9aed32d2030fad16f1f230a26f7eaca2f9e63..5bca38f3687eb34c281042fc881da2a708d65fce 100644 (file)
@@ -136,9 +136,9 @@ int AssetVIcon::get_vy()
        return lbox->get_item_y(picon) + lbox->get_title_h();
 }
 
+
 AssetPicon::AssetPicon(MWindow *mwindow,
-       AWindowGUI *gui,
-       Indexable *indexable)
+       AWindowGUI *gui, Indexable *indexable)
  : BC_ListBoxItem()
 {
        reset();
@@ -150,8 +150,7 @@ AssetPicon::AssetPicon(MWindow *mwindow,
 }
 
 AssetPicon::AssetPicon(MWindow *mwindow,
-       AWindowGUI *gui,
-       EDL *edl)
+       AWindowGUI *gui, EDL *edl)
  : BC_ListBoxItem()
 {
        reset();
@@ -164,7 +163,9 @@ AssetPicon::AssetPicon(MWindow *mwindow,
 
 AssetPicon::AssetPicon(MWindow *mwindow,
        AWindowGUI *gui, int folder, int persist)
- : BC_ListBoxItem(_(AWindowGUI::folder_names[folder]), gui->folder_icon)
+ : BC_ListBoxItem(_(AWindowGUI::folder_names[folder]),
+       folder>=0 && folder<AWINDOW_FOLDERS ?
+               gui->folder_icons[folder]: gui->folder_icon)
 {
        reset();
        foldernum = folder;
@@ -174,18 +175,7 @@ AssetPicon::AssetPicon(MWindow *mwindow,
 }
 
 AssetPicon::AssetPicon(MWindow *mwindow,
-       AWindowGUI *gui, const char *folder_name, int folder_num)
- : BC_ListBoxItem(folder_name, gui->folder_icon)
-{
-       reset();
-       foldernum = folder_num;
-       this->mwindow = mwindow;
-       this->gui = gui;
-}
-
-AssetPicon::AssetPicon(MWindow *mwindow,
-       AWindowGUI *gui,
-       PluginServer *plugin)
+       AWindowGUI *gui, PluginServer *plugin)
  : BC_ListBoxItem()
 {
        reset();
@@ -194,10 +184,8 @@ AssetPicon::AssetPicon(MWindow *mwindow,
        this->plugin = plugin;
 }
 
-
 AssetPicon::AssetPicon(MWindow *mwindow,
-       AWindowGUI *gui,
-       Label *label)
+       AWindowGUI *gui, Label *label)
  : BC_ListBoxItem()
 {
        reset();
@@ -445,19 +433,19 @@ AWindowGUI::~AWindowGUI()
        displayed_assets[1].remove_all_objects();
 
        delete vicon_thread;
-       delete file_icon;         delete file_res;
-       delete audio_icon;        delete audio_res;
-       delete video_icon;        delete video_res;
-       delete folder_icon;       delete folder_res;
-       delete clip_icon;         delete clip_res;
-       delete label_icon;        delete label_res;
-       delete atransition_icon;  delete atrans_res;
-       delete vtransition_icon;  delete vtrans_res;
-       delete aeffect_icon;      delete aeffect_res;
-       delete veffect_icon;      delete veffect_res;
-       delete ladspa_icon;       delete ladspa_res;
-       delete ff_aud_icon;       delete ff_aud_res;
-       delete ff_vid_icon;       delete ff_vid_res;
+       delete file_icon;
+       delete audio_icon;
+       delete video_icon;
+       delete folder_icon;
+       delete clip_icon;
+       delete label_icon;
+       delete atransition_icon;
+       delete vtransition_icon;
+       delete aeffect_icon;
+       delete veffect_icon;
+       delete ladspa_icon;
+       delete ff_aud_icon;
+       delete ff_vid_icon;
        delete newfolder_thread;
        delete asset_menu;
        delete clip_menu;
@@ -485,7 +473,15 @@ bool AWindowGUI::protected_pixmap(BC_Pixmap *icon)
                icon == aeffect_icon ||
                icon == ladspa_icon ||
                icon == ff_aud_icon ||
-               icon == ff_vid_icon;
+               icon == ff_vid_icon ||
+               icon == aeffect_folder_icon ||
+               icon == veffect_folder_icon ||
+               icon == atransition_folder_icon ||
+               icon == vtransition_folder_icon ||
+               icon == label_folder_icon ||
+               icon == clip_folder_icon ||
+               icon == media_folder_icon ||
+               icon == proxy_folder_icon;
 }
 
 VFrame *AWindowGUI::get_picon(const char *name, const char *plugin_icons)
@@ -504,26 +500,23 @@ VFrame *AWindowGUI::get_picon(const char *name)
        return vframe;
 }
 
-VFrame *AWindowGUI::resource_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, int idx)
+void AWindowGUI::resource_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, int idx)
 {
-       VFrame *ret = vfrm = get_picon(fn);
-       if( !ret ) vfrm = BC_WindowBase::get_resources()->type_to_icon[idx];
+       vfrm = get_picon(fn);
+       if( !vfrm ) vfrm = BC_WindowBase::get_resources()->type_to_icon[idx];
        icon = new BC_Pixmap(this, vfrm, PIXMAP_ALPHA);
-       return ret;
 }
-VFrame *AWindowGUI::theme_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn)
+void AWindowGUI::theme_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn)
 {
-       VFrame *ret = vfrm = get_picon(fn);
-       if( !ret ) vfrm = mwindow->theme->get_image(fn);
+       vfrm = get_picon(fn);
+       if( !vfrm ) vfrm = mwindow->theme->get_image(fn);
        icon = new BC_Pixmap(this, vfrm, PIXMAP_ALPHA);
-       return ret;
 }
-VFrame *AWindowGUI::plugin_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, unsigned char *png)
+void AWindowGUI::plugin_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, unsigned char *png)
 {
-       VFrame *ret = vfrm = get_picon(fn);
-       if( !ret ) vfrm = new VFramePng(png);
+       vfrm = get_picon(fn);
+       if( !vfrm ) vfrm = new VFramePng(png);
        icon = new BC_Pixmap(this, vfrm, PIXMAP_ALPHA);
-       return vfrm;
 }
 
 void AWindowGUI::create_objects()
@@ -534,21 +527,39 @@ void AWindowGUI::create_objects()
 
        set_icon(mwindow->theme->get_image("awindow_icon"));
 
-       file_res    = resource_icon(file_vframe,   file_icon,   "film_icon",   ICON_UNKNOWN);
-       folder_res  = resource_icon(folder_vframe, folder_icon, "folder_icon", ICON_FOLDER);
-       audio_res   = resource_icon(audio_vframe,  audio_icon,  "audio_icon",  ICON_SOUND);
-       video_res   = resource_icon(video_vframe,  video_icon,  "video_icon",  ICON_FILM);
-       label_res   = resource_icon(label_vframe,  label_icon,  "label_icon",  ICON_LABEL);
-
-       clip_res    = theme_icon(clip_vframe,        clip_icon,        "clip_icon");
-       atrans_res  = theme_icon(atransition_vframe, atransition_icon, "atransition_icon");
-       vtrans_res  = theme_icon(vtransition_vframe, vtransition_icon, "vtransition_icon");
-       aeffect_res = theme_icon(aeffect_vframe,     aeffect_icon,     "aeffect_icon");
-       veffect_res = theme_icon(veffect_vframe,     veffect_icon,     "veffect_icon");
-
-       ladspa_res  = plugin_icon(ladspa_vframe, ladspa_icon, "lad_picon", lad_picon_png);
-       ff_aud_res  = plugin_icon(ff_aud_vframe, ff_aud_icon, "ff_audio",  ff_audio_png);
-       ff_vid_res  = plugin_icon(ff_vid_vframe, ff_vid_icon, "ff_video",  ff_video_png);
+       resource_icon(file_vframe,   file_icon,   "film_icon",   ICON_UNKNOWN);
+       resource_icon(folder_vframe, folder_icon, "folder_icon", ICON_FOLDER);
+       resource_icon(audio_vframe,  audio_icon,  "audio_icon",  ICON_SOUND);
+       resource_icon(video_vframe,  video_icon,  "video_icon",  ICON_FILM);
+       resource_icon(label_vframe,  label_icon,  "label_icon",  ICON_LABEL);
+
+       theme_icon(aeffect_folder_vframe,      aeffect_folder_icon,     "aeffect_folder");
+       theme_icon(atransition_folder_vframe,  atransition_folder_icon, "atransition_folder");
+       theme_icon(clip_folder_vframe,         clip_folder_icon,        "clip_folder");
+       theme_icon(label_folder_vframe,        label_folder_icon,       "label_folder");
+       theme_icon(media_folder_vframe,        media_folder_icon,       "media_folder");
+       theme_icon(proxy_folder_vframe,        proxy_folder_icon,       "proxy_folder");
+       theme_icon(veffect_folder_vframe,      veffect_folder_icon,     "veffect_folder");
+       theme_icon(vtransition_folder_vframe,  vtransition_folder_icon, "vtransition_folder");
+
+       folder_icons[AW_AEFFECT_FOLDER] = aeffect_folder_icon;
+       folder_icons[AW_VEFFECT_FOLDER] = veffect_folder_icon;
+       folder_icons[AW_ATRANSITION_FOLDER] = atransition_folder_icon;
+       folder_icons[AW_VTRANSITION_FOLDER] = vtransition_folder_icon;
+       folder_icons[AW_LABEL_FOLDER] = label_folder_icon;
+       folder_icons[AW_CLIP_FOLDER] = clip_folder_icon;
+       folder_icons[AW_MEDIA_FOLDER] = media_folder_icon;
+       folder_icons[AW_PROXY_FOLDER] = proxy_folder_icon;
+
+       theme_icon(clip_vframe,        clip_icon,        "clip_icon");
+       theme_icon(atransition_vframe, atransition_icon, "atransition_icon");
+       theme_icon(vtransition_vframe, vtransition_icon, "vtransition_icon");
+       theme_icon(aeffect_vframe,     aeffect_icon,     "aeffect_icon");
+       theme_icon(veffect_vframe,     veffect_icon,     "veffect_icon");
+
+       plugin_icon(ladspa_vframe, ladspa_icon, "lad_picon", lad_picon_png);
+       plugin_icon(ff_aud_vframe, ff_aud_icon, "ff_audio",  ff_audio_png);
+       plugin_icon(ff_vid_vframe, ff_vid_icon, "ff_video",  ff_video_png);
 
 // Mandatory folders
        folders.append(new AssetPicon(mwindow, this, AW_AEFFECT_FOLDER, 1));
@@ -894,7 +905,7 @@ void AWindowGUI::update_folder_list()
        stop_vicon_drawing();
        for( int i = 0; i < folders.total; i++ ) {
                AssetPicon *picon = (AssetPicon*)folders.values[i];
-               picon->in_use--;
+               picon->in_use = 0;
        }
 
 // Search assets for folders
@@ -967,7 +978,7 @@ void AWindowGUI::update_asset_list()
 {
        for( int i = 0; i < assets.total; i++ ) {
                AssetPicon *picon = (AssetPicon*)assets.values[i];
-               picon->in_use--;
+               picon->in_use = 0;
        }
 
 // Synchronize EDL clips
@@ -1109,6 +1120,12 @@ void AWindowGUI::sort_assets()
        update_assets();
 }
 
+void AWindowGUI::sort_folders()
+{
+       sort_picons(&folders);
+       update_assets();
+}
+
 void AWindowGUI::collect_assets()
 {
        int i = 0;
index 62e865970aee8a631f6f5b61f4fa8586d909a9b0..e8bd76f542c52623a5beb977be8aedf719974d45 100644 (file)
@@ -51,7 +51,6 @@ public:
        AssetPicon(MWindow *mwindow, AWindowGUI *gui, PluginServer *plugin);
        AssetPicon(MWindow *mwindow, AWindowGUI *gui, Label *plugin);
        AssetPicon(MWindow *mwindow, AWindowGUI *gui, int folder, int persist);
-       AssetPicon(MWindow *mwindow, AWindowGUI *gui, const char *folder_name, int folder_num);
        virtual ~AssetPicon();
 
        void create_objects();
@@ -140,6 +139,7 @@ public:
        void async_update_assets();     // Sends update asset event
        void update_effects();
        void sort_assets();
+       void sort_folders();
        void reposition_objects();
        static int folder_number(const char *name);
 // Call back for MWindow entry point
@@ -169,9 +169,9 @@ public:
 
        VFrame *get_picon(const char *name, const char *plugin_icons);
        VFrame *get_picon(const char *name);
-       VFrame *resource_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, int idx);
-       VFrame *theme_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn);
-       VFrame *plugin_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, unsigned char *png);
+       void resource_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, int idx);
+       void theme_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn);
+       void plugin_icon(VFrame *&vfrm, BC_Pixmap *&icon, const char *fn, unsigned char *png);
 
        MWindow *mwindow;
        AWindow *awindow;
@@ -199,19 +199,30 @@ public:
 
        BC_Hash *defaults;
 // Persistent icons
-       BC_Pixmap *folder_icon;       VFrame *folder_res,  *folder_vframe;
-       BC_Pixmap *file_icon;         VFrame *file_res,    *file_vframe;
-       BC_Pixmap *audio_icon;        VFrame *audio_res,   *audio_vframe;
-       BC_Pixmap *video_icon;        VFrame *video_res,   *video_vframe;
-       BC_Pixmap *label_icon;        VFrame *label_res,   *label_vframe;
-       BC_Pixmap *clip_icon;         VFrame *clip_res,    *clip_vframe;
-       BC_Pixmap *atransition_icon;  VFrame *atrans_res,  *atransition_vframe;
-       BC_Pixmap *vtransition_icon;  VFrame *vtrans_res,  *vtransition_vframe;
-       BC_Pixmap *aeffect_icon;      VFrame *aeffect_res, *aeffect_vframe;
-       BC_Pixmap *veffect_icon;      VFrame *veffect_res, *veffect_vframe;
-       BC_Pixmap *ladspa_icon;       VFrame *ladspa_res,  *ladspa_vframe;
-       BC_Pixmap *ff_aud_icon;       VFrame *ff_aud_res,  *ff_aud_vframe;
-       BC_Pixmap *ff_vid_icon;       VFrame *ff_vid_res,  *ff_vid_vframe;
+       BC_Pixmap *aeffect_folder_icon;      VFrame *aeffect_folder_vframe;
+       BC_Pixmap *atransition_folder_icon;  VFrame *atransition_folder_vframe;
+       BC_Pixmap *clip_folder_icon;         VFrame *clip_folder_vframe;
+       BC_Pixmap *label_folder_icon;        VFrame *label_folder_vframe;
+       BC_Pixmap *media_folder_icon;        VFrame *media_folder_vframe;
+       BC_Pixmap *proxy_folder_icon;        VFrame *proxy_folder_vframe;
+       BC_Pixmap *veffect_folder_icon;      VFrame *veffect_folder_vframe;
+       BC_Pixmap *vtransition_folder_icon;  VFrame *vtransition_folder_vframe;
+       BC_Pixmap *folder_icons[AWINDOW_FOLDERS];
+
+       BC_Pixmap *folder_icon;       VFrame *folder_vframe;
+       BC_Pixmap *file_icon;         VFrame *file_vframe;
+       BC_Pixmap *audio_icon;        VFrame *audio_vframe;
+       BC_Pixmap *video_icon;        VFrame *video_vframe;
+       BC_Pixmap *label_icon;        VFrame *label_vframe;
+       BC_Pixmap *clip_icon;         VFrame *clip_vframe;
+       BC_Pixmap *atransition_icon;  VFrame *atransition_vframe;
+       BC_Pixmap *vtransition_icon;  VFrame *vtransition_vframe;
+       BC_Pixmap *aeffect_icon;      VFrame *aeffect_vframe;
+       BC_Pixmap *veffect_icon;      VFrame *veffect_vframe;
+       BC_Pixmap *ladspa_icon;       VFrame *ladspa_vframe;
+       BC_Pixmap *ff_aud_icon;       VFrame *ff_aud_vframe;
+       BC_Pixmap *ff_vid_icon;       VFrame *ff_vid_vframe;
+
        NewFolderThread *newfolder_thread;
 
 // Popup menus
index 134aa8c9641f0faaa1407cf4e30da16d7c15a1b1..d6810aa763b05bd779b34a4a3c441c648aa381bf 100644 (file)
@@ -1552,7 +1552,7 @@ void EDL::append_vwindow_edl(EDL *edl, int increase_counter)
 double EDL::next_edit(double position)
 {
        Units::fix_double(&position);
-       double new_position = INFINITY;
+       double new_position = tracks->total_length();
 
        double max_rate = get_frame_rate();
        int sample_rate = get_sample_rate();
index 0eb39c2a77a1a766108fe3871f655851c4175a83..823c9f3105df2c85e5a53e40f161c6ac887642de 100644 (file)
@@ -42,10 +42,10 @@ FolderListMenu::~FolderListMenu()
 void FolderListMenu::create_objects()
 {
        add_item(format = new FolderListFormat(mwindow, this));
+       add_item(new FolderListSort(mwindow, this));
        update_titles();
 }
 
-
 void FolderListMenu::update_titles()
 {
        format->set_text(mwindow->edl->session->folderlist_format == FOLDERS_TEXT ?
@@ -53,7 +53,6 @@ void FolderListMenu::update_titles()
 }
 
 
-
 FolderListFormat::FolderListFormat(MWindow *mwindow, FolderListMenu *menu)
  : BC_MenuItem("")
 {
@@ -79,3 +78,17 @@ int FolderListFormat::handle_event()
        return 1;
 }
 
+
+FolderListSort::FolderListSort(MWindow *mwindow, FolderListMenu *menu)
+ : BC_MenuItem(_("Sort items"))
+{
+       this->mwindow = mwindow;
+       this->menu = menu;
+}
+
+int FolderListSort::handle_event()
+{
+       mwindow->awindow->gui->sort_folders();
+       return 1;
+}
+
index 41f0860c1f9306033b0149cf829be5560e3b9f24..184e609249a3ec4ff393d551e796202199abdcda 100644 (file)
@@ -37,6 +37,16 @@ public:
        FolderListMenu *menu;
 };
 
+class FolderListSort : public BC_MenuItem
+{
+public:
+       FolderListSort(MWindow *mwindow, FolderListMenu *menu);
+
+       int handle_event();
+       MWindow *mwindow;
+       FolderListMenu *menu;
+};
+
 class FolderListMenu : public BC_PopupMenu
 {
 public:
index a68a83e5e17763239da21f3c52a48213980375f2..ee183476925482bb6fd97237b1db5149af66ccb8 100644 (file)
@@ -26,9 +26,9 @@
  }
 */
 
-static inline float in_clip(float mx, float ofs, float v)
+static inline float in_clip(float v, float mx)
 {
-       return (v+=ofs) < 0 ? 0 : v > mx ? mx : v;
+       return v < 0 ? 0 : v > mx ? mx : v;
 }
 
 static inline float interp_linear(float dx, float p1, float p2)
@@ -55,10 +55,10 @@ static inline float interp_cubic(float dx, float p0, float p1, float p2, float p
        int c0 = itx+0, r0 = ity+0; \
        typ *r0p = r0>=in_min_y && r0<in_max_y ? ((typ**)interp_rows)[r0] : 0
 
-#define NEAREST_ROW(in_row, ofs, bg) (!in_row ? bg : ( \
+#define NEAREST_ROW(in_row, ofs, bg) (!in_row ? bg - ofs : ( \
        (c0>=in_min_x && c0<in_max_x ? in_row[c0*in_comps] : bg) - ofs))
 
-#define nearest_interp(ofs, bg) in_clip(in_max, ofs, NEAREST_ROW(r0p, ofs, bg))
+#define nearest_interp(ofs, bg) in_clip(NEAREST_ROW(r0p, ofs, bg) + ofs, in_max)
 
 #define nearest_next(s) { if(r0p) ++r0p; }
 
@@ -72,12 +72,12 @@ static inline float interp_cubic(float dx, float p0, float p1, float p2, float p
        typ *r0p = r0>=in_min_y && r0<in_max_y ? ((typ**)interp_rows)[r0] : 0; \
        typ *r1p = r1>=in_min_y && r1<in_max_y ? ((typ**)interp_rows)[r1] : 0
 
-#define LINEAR_ROW(in_row, ofs, bg) (!in_row ? bg : interp_linear(dx, \
+#define LINEAR_ROW(in_row, ofs, bg) (!in_row ? bg - ofs : interp_linear(dx, \
        (c0>=in_min_x && c0<in_max_x ? in_row[c0*in_comps] : bg) - ofs, \
        (c1>=in_min_x && c1<in_max_x ? in_row[c1*in_comps] : bg) - ofs))
 
-#define bi_linear_interp(ofs, bg) in_clip(in_max, ofs, interp_linear(dy, \
-       LINEAR_ROW(r0p, ofs, bg), LINEAR_ROW(r1p, ofs, bg)))
+#define bi_linear_interp(ofs, bg) in_clip(interp_linear(dy, \
+       LINEAR_ROW(r0p, ofs, bg), LINEAR_ROW(r1p, ofs, bg)) + ofs, in_max)
 
 #define bi_linear_next(s) { if(r0p) ++r0p;  if(r1p) ++r1p; }
 
@@ -94,15 +94,15 @@ static inline float interp_cubic(float dx, float p0, float p1, float p2, float p
        typ *r1p = r1>=in_min_y && r1<in_max_y ? ((typ**)interp_rows)[r1] : 0; \
        typ *r2p = r2>=in_min_y && r2<in_max_y ? ((typ**)interp_rows)[r2] : 0
 
-#define CUBIC_ROW(in_row, ofs, bg) (!in_row ? bg : interp_cubic(dx, \
+#define CUBIC_ROW(in_row, ofs, bg) (!in_row ? bg - ofs : interp_cubic(dx, \
        (cp>=in_min_x && cp<in_max_x ? in_row[cp*in_comps] : bg) - ofs, \
        (c0>=in_min_x && c0<in_max_x ? in_row[c0*in_comps] : bg) - ofs, \
        (c1>=in_min_x && c1<in_max_x ? in_row[c1*in_comps] : bg) - ofs, \
        (c2>=in_min_x && c2<in_max_x ? in_row[c2*in_comps] : bg) - ofs))
 
-#define bi_cubic_interp(ofs, bg) in_clip(in_max, ofs, interp_cubic(dy, \
+#define bi_cubic_interp(ofs, bg) in_clip(interp_cubic(dy, \
        CUBIC_ROW(rpp, ofs, bg), CUBIC_ROW(r0p, ofs, bg), \
-       CUBIC_ROW(r1p, ofs, bg), CUBIC_ROW(r2p, ofs, bg)))
+       CUBIC_ROW(r1p, ofs, bg), CUBIC_ROW(r2p, ofs, bg)) + ofs, in_max)
 
 #define bi_cubic_next(s) { if(rpp) ++rpp;  if(r0p) ++r0p;  if(r1p) ++r1p;  if(r2p) ++r2p; }
 
index 36b8269bda42d4919ab0d548b09ae2aa5a37f0f9..0e4121b121ae18e17b414cedc264912507ac5cc0 100644 (file)
@@ -544,7 +544,7 @@ void MWindow::cut(double start, double end, double new_position)
 
 void MWindow::snap_left_edit()
 {
-       double start_pos = edl->local_session->get_selectionstart();
+       double start_pos = edl->local_session->get_selectionstart(1);
        double position = edl->prev_edit(start_pos);
        if( position < start_pos )
                cut(position, start_pos, position);
@@ -552,7 +552,7 @@ void MWindow::snap_left_edit()
 
 void MWindow::snap_right_edit()
 {
-       double end_pos = edl->local_session->get_selectionend();
+       double end_pos = edl->local_session->get_selectionend(1);
        double position = edl->next_edit(end_pos);
        if( end_pos < position )
                cut(end_pos, position, end_pos);
@@ -560,7 +560,7 @@ void MWindow::snap_right_edit()
 
 void MWindow::snap_left_label()
 {
-       double start_pos = edl->local_session->get_selectionstart();
+       double start_pos = edl->local_session->get_selectionstart(1);
        Label *left_label = edl->labels->prev_label(start_pos);
        if( !left_label ) return;
        double position = left_label->position;
@@ -570,7 +570,7 @@ void MWindow::snap_left_label()
 
 void MWindow::snap_right_label()
 {
-       double end_pos = edl->local_session->get_selectionend();
+       double end_pos = edl->local_session->get_selectionend(1);
        Label *right_label = edl->labels->next_label(end_pos);
        if( !right_label ) return;
        double position = right_label->position;
index 47bc2f1a201e853cc3f3eba68b5d8254fe2e3758..06fb11cc463c4c76d4204b51baac1c002f92ab3a 100644 (file)
@@ -683,7 +683,7 @@ int MWindow::next_edit_handle(int shift_down)
 {
        double position = edl->local_session->get_selectionend(1);
        double new_position = edl->next_edit(position);
-       if(new_position != INFINITY) {
+       if( new_position < edl->tracks->total_length() ) {
                edl->local_session->set_selectionend(new_position);
 //printf("MWindow::next_edit_handle %d\n", shift_down);
                if(!shift_down)
index a0ba9f27a4c406391329bb31d50d85c5719ef855..740dea55b294ca7e6aa0c1024b1f92fd78e09898 100644 (file)
@@ -46,6 +46,7 @@
 #include "keyframepopup.h"
 #include "keyframes.h"
 #include "keys.h"
+#include "labels.h"
 #include "localsession.h"
 #include "mainclock.h"
 #include "maincursor.h"
@@ -109,6 +110,7 @@ TrackCanvas::TrackCanvas(MWindow *mwindow,
        render_timer = new Timer;
        hourglass_enabled = 0;
        timebar_position = -1;
+       snapped = 0;
 }
 
 TrackCanvas::~TrackCanvas()
@@ -1763,7 +1765,7 @@ void TrackCanvas::draw_drag_handle()
                        mwindow->edl->local_session->zoom_sample -
                        mwindow->edl->local_session->view_start[pane->number]);
 //printf("TrackCanvas::draw_drag_handle 2 %d %jd\n", pane->number, pixel1);
-               set_color(GREEN);
+               set_color(!snapped ? GREEN : (snapped=0, YELLOW));
                set_inverse();
 //printf("TrackCanvas::draw_drag_handle 3\n");
                draw_line(pixel1, 0, pixel1, get_h());
@@ -3472,15 +3474,46 @@ int TrackCanvas::deactivate()
 void TrackCanvas::update_drag_handle()
 {
        double new_position;
+       int cursor_x = get_cursor_x();
 
        new_position =
-               (double)(get_cursor_x() +
+               (double)(cursor_x +
                mwindow->edl->local_session->view_start[pane->number]) *
                mwindow->edl->local_session->zoom_sample /
                mwindow->edl->session->sample_rate;
+
        new_position =
                mwindow->edl->align_to_frame(new_position, 0);
 
+       if( ctrl_down() && alt_down() ) {
+#define snapper(v) do { \
+       double pos = (v); \
+       if( pos < 0 ) break; \
+       double dist = fabs(new_position - pos); \
+       if( dist >= snap_min ) break; \
+       snap_position = pos;  snap_min = dist; \
+} while(0)
+               double snap_position = new_position;
+               double snap_min = DBL_MAX;
+               if( mwindow->edl->local_session->inpoint_valid() )
+                       snapper(mwindow->edl->local_session->get_inpoint());
+               if( mwindow->edl->local_session->outpoint_valid() )
+                       snapper(mwindow->edl->local_session->get_outpoint());
+               snapper(mwindow->edl->prev_edit(new_position));
+               snapper(mwindow->edl->next_edit(new_position));
+               Label *prev_label = mwindow->edl->labels->prev_label(new_position);
+               if( prev_label ) snapper(prev_label->position);
+               Label *next_label = mwindow->edl->labels->next_label(new_position);
+               if( next_label ) snapper(next_label->position);
+               int snap_x = snap_position * mwindow->edl->session->sample_rate /
+                       mwindow->edl->local_session->zoom_sample -
+                       mwindow->edl->local_session->view_start[pane->number];
+               if( abs(snap_x - cursor_x) < HANDLE_W ) {
+                       snapped = 1;
+                       new_position = snap_position;
+               }
+#undef snapper
+       }
 
        if(new_position != mwindow->session->drag_position)
        {
@@ -4658,7 +4691,6 @@ int TrackCanvas::button_press_event()
        int result = 0;
        int cursor_x, cursor_y;
        int new_cursor;
-       double start_position = mwindow->edl->local_session->get_selectionstart(1);
 
        cursor_x = get_cursor_x();
        cursor_y = get_cursor_y();
@@ -4815,23 +4847,7 @@ int TrackCanvas::button_press_event()
                        gui->flash_canvas(1);
                }
        }
-// if snapping to selection point
-       if( gui->ctrl_down() && gui->alt_down() ) {
-               switch( mwindow->session->current_operation ) {
-               case DRAG_EDITHANDLE1:
-                       mwindow->session->drag_position = start_position;
-                       mwindow->session->current_operation = NO_OPERATION;
-                       drag_scroll = 0;
-                       end_edithandle_selection();
-                       break;
-               case DRAG_PLUGINHANDLE1:
-                       mwindow->session->drag_position = start_position;
-                       mwindow->session->current_operation = NO_OPERATION;
-                       drag_scroll = 0;
-                       end_pluginhandle_selection();
-                       break;
-               }
-       }
+
        return result;
 }
 
index ab82e1606ec0c46f42472dfd9952cab75d646707..a99ca1438c2a9d58d54b31710370f3b37544b47a 100644 (file)
@@ -413,7 +413,7 @@ public:
 // ====================================== cursor selection type
 
        double selection_midpoint;        // division between current ends
-
+       int snapped;                    // drag handle snapping
 };
 
 #endif
index 207084d7415f054650989df444b4ba79905df8fe..021a87fc8cb82aae3edc8662093adc9264ad0312 100644 (file)
@@ -883,25 +883,13 @@ int BC_FileBox::delete_tables()
 
 BC_Pixmap* BC_FileBox::get_icon(char *path, int is_dir)
 {
-       char *suffix = strrchr(path, '.');
+       if( is_dir ) return icons[ICON_FOLDER];
        int icon_type = ICON_UNKNOWN;
-
-       if(is_dir) return icons[ICON_FOLDER];
-
-       if(suffix)
-       {
-               suffix++;
-               if(*suffix != 0)
-               {
-                       for(int i = 0; i < TOTAL_SUFFIXES; i++)
-                       {
-                               if(!strcasecmp(suffix, BC_WindowBase::get_resources()->suffix_to_type[i].suffix))
-                               {
-                                       icon_type = BC_WindowBase::get_resources()->suffix_to_type[i].icon_type;
-                                       break;
-                               }
-                       }
-               }
+       char *suffix = strrchr(path, '.');
+       if( suffix && *++suffix ) {
+               suffix_to_type_t *stp = &BC_WindowBase::get_resources()->suffix_to_type[0];
+               while( stp->suffix && strcasecmp(stp->suffix, suffix) ) ++stp;
+               if( stp->icon_type ) icon_type = stp->icon_type;
        }
 
        return icons[icon_type];
index e3769675d030ed9eb8f7b113de99c73f2f6d9e9f..d2f0b7a912ff6cdbb5e6f68dfe0d5adab5ce6a15 100644 (file)
@@ -173,19 +173,63 @@ void BC_Resources::finit_font_defs()
        delete [] big_font_xft2;
 }
 
+
 suffix_to_type_t BC_Resources::suffix_to_type[] =
 {
-       { "m2v", ICON_FILM },
-       { "mov", ICON_FILM },
-       { "mp2", ICON_SOUND },
-       { "mp3", ICON_SOUND },
-       { "ac3", ICON_SOUND },
-       { "mpg", ICON_FILM },
-       { "vob", ICON_FILM },
-       { "ifo", ICON_FILM },
-       { "ts",  ICON_FILM },
-       { "vts", ICON_FILM },
-       { "wav", ICON_SOUND }
+    { "aac", ICON_SOUND },
+    { "ac3", ICON_SOUND },
+    { "dts", ICON_SOUND },
+    { "flac", ICON_SOUND },
+    { "mp2", ICON_SOUND },
+    { "mp3", ICON_SOUND },
+    { "wav", ICON_SOUND },
+    { "wma", ICON_SOUND },
+    { "wmv", ICON_SOUND },
+    { "avi", ICON_FILM },
+    { "bmp", ICON_FILM },
+    { "cr2", ICON_FILM },
+    { "dnxhd", ICON_FILM },
+    { "dvd", ICON_FILM },
+    { "dv", ICON_FILM },
+    { "f4v", ICON_FILM },
+    { "flv", ICON_FILM },
+    { "gif", ICON_FILM },
+    { "gxf", ICON_FILM },
+    { "h264", ICON_FILM },
+    { "h265", ICON_FILM },
+    { "hevc", ICON_FILM },
+    { "ifo", ICON_FILM },
+    { "jpeg", ICON_FILM },
+    { "jpg", ICON_FILM },
+    { "m2ts", ICON_FILM },
+    { "m2v", ICON_FILM },
+    { "m4v", ICON_FILM },
+    { "mkv", ICON_FILM },
+    { "mov", ICON_FILM },
+    { "mp4", ICON_FILM },
+    { "mpeg", ICON_FILM },
+    { "mpg", ICON_FILM },
+    { "mts", ICON_FILM },
+    { "mxf", ICON_FILM },
+    { "ogg", ICON_FILM },
+    { "ogv", ICON_FILM },
+    { "pcm", ICON_FILM },
+    { "pgm", ICON_FILM },
+    { "png", ICON_FILM },
+    { "ppm", ICON_FILM },
+    { "qt", ICON_FILM },
+    { "rm", ICON_FILM },
+    { "swf", ICON_FILM },
+    { "tiff", ICON_FILM },
+    { "tif", ICON_FILM },
+    { "ts",  ICON_FILM },
+    { "vob", ICON_FILM },
+    { "vts", ICON_FILM },
+    { "webm", ICON_FILM },
+    { "webp", ICON_FILM },
+    { "xml", ICON_FILM },
+    { "y4m", ICON_FILM },
+    { 0, 0 },
 };
 
 BC_Signals* BC_Resources::signal_handler = 0;
index 1f2037bd1747f6b6531204c4042a4a7d33122767..8ff046490d423555a99fecd7489af29f1a6e8728 100644 (file)
@@ -277,7 +277,7 @@ public:
        int drag_radius;
 
 // Filebox
-       static suffix_to_type_t suffix_to_type[TOTAL_SUFFIXES];
+       static suffix_to_type_t suffix_to_type[];
        VFrame **type_to_icon;
 // Display mode for fileboxes
        int filebox_mode;
index 1f103082b74987a602abf2bc9321e34689fa30c1..39c6a1190ec4173d45ca1e7f77f37ae0057ef964 100644 (file)
@@ -26,7 +26,6 @@
 class BC_Resources;
 
 #define TOTAL_ICONS 5
-#define TOTAL_SUFFIXES 11
 #define TOTAL_7SEGMENT 20
 
 // Length of language and region buffer
diff --git a/cinelerra-5.1/picon_cinfinity/aeffect_folder.png b/cinelerra-5.1/picon_cinfinity/aeffect_folder.png
new file mode 100644 (file)
index 0000000..0d5c8bc
Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/aeffect_folder.png differ
diff --git a/cinelerra-5.1/picon_cinfinity/atransition_folder.png b/cinelerra-5.1/picon_cinfinity/atransition_folder.png
new file mode 100644 (file)
index 0000000..b36bb9c
Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/atransition_folder.png differ
diff --git a/cinelerra-5.1/picon_cinfinity/clip_folder.png b/cinelerra-5.1/picon_cinfinity/clip_folder.png
new file mode 100644 (file)
index 0000000..c30d5dd
Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/clip_folder.png differ
diff --git a/cinelerra-5.1/picon_cinfinity/label_folder.png b/cinelerra-5.1/picon_cinfinity/label_folder.png
new file mode 100644 (file)
index 0000000..92bc563
Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/label_folder.png differ
diff --git a/cinelerra-5.1/picon_cinfinity/media_folder.png b/cinelerra-5.1/picon_cinfinity/media_folder.png
new file mode 100644 (file)
index 0000000..59928ae
Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/media_folder.png differ
diff --git a/cinelerra-5.1/picon_cinfinity/proxy_folder.png b/cinelerra-5.1/picon_cinfinity/proxy_folder.png
new file mode 100644 (file)
index 0000000..177a9ba
Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/proxy_folder.png differ
diff --git a/cinelerra-5.1/picon_cinfinity/proxy_icon.png b/cinelerra-5.1/picon_cinfinity/proxy_icon.png
new file mode 100644 (file)
index 0000000..177a9ba
Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/proxy_icon.png differ
diff --git a/cinelerra-5.1/picon_cinfinity/veffect_folder.png b/cinelerra-5.1/picon_cinfinity/veffect_folder.png
new file mode 100644 (file)
index 0000000..92ec75e
Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/veffect_folder.png differ
diff --git a/cinelerra-5.1/picon_cinfinity/vtransition_folder.png b/cinelerra-5.1/picon_cinfinity/vtransition_folder.png
new file mode 100644 (file)
index 0000000..cfd135b
Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/vtransition_folder.png differ