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();
}
AssetPicon::AssetPicon(MWindow *mwindow,
- AWindowGUI *gui,
- EDL *edl)
+ AWindowGUI *gui, EDL *edl)
: BC_ListBoxItem()
{
reset();
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;
}
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();
this->plugin = plugin;
}
-
AssetPicon::AssetPicon(MWindow *mwindow,
- AWindowGUI *gui,
- Label *label)
+ AWindowGUI *gui, Label *label)
: BC_ListBoxItem()
{
reset();
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;
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)
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()
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));
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
{
for( int i = 0; i < assets.total; i++ ) {
AssetPicon *picon = (AssetPicon*)assets.values[i];
- picon->in_use--;
+ picon->in_use = 0;
}
// Synchronize EDL clips
update_assets();
}
+void AWindowGUI::sort_folders()
+{
+ sort_picons(&folders);
+ update_assets();
+}
+
void AWindowGUI::collect_assets()
{
int i = 0;
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();
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
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;
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
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();
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 ?
}
-
FolderListFormat::FolderListFormat(MWindow *mwindow, FolderListMenu *menu)
: BC_MenuItem("")
{
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;
+}
+
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:
}
*/
-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)
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; }
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; }
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; }
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);
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);
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;
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;
{
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)
#include "keyframepopup.h"
#include "keyframes.h"
#include "keys.h"
+#include "labels.h"
#include "localsession.h"
#include "mainclock.h"
#include "maincursor.h"
render_timer = new Timer;
hourglass_enabled = 0;
timebar_position = -1;
+ snapped = 0;
}
TrackCanvas::~TrackCanvas()
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());
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)
{
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();
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;
}
// ====================================== cursor selection type
double selection_midpoint; // division between current ends
-
+ int snapped; // drag handle snapping
};
#endif
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];
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;
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;
class BC_Resources;
#define TOTAL_ICONS 5
-#define TOTAL_SUFFIXES 11
#define TOTAL_7SEGMENT 20
// Length of language and region buffer