X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcfilebox.C;h=6c1ceb314b61d0a65aa3087919ae0c1ba826c544;hb=576087eacf577a0fa5d3008d37c4d5b597f0990a;hp=207084d7415f054650989df444b4ba79905df8fe;hpb=4b6c39e6cf4a3fd9c1b347db6de686ab55d6cac8;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bcfilebox.C b/cinelerra-5.1/guicast/bcfilebox.C index 207084d7..6c1ceb31 100644 --- a/cinelerra-5.1/guicast/bcfilebox.C +++ b/cinelerra-5.1/guicast/bcfilebox.C @@ -1,7 +1,7 @@ /* * CINELERRA - * Copyright (C) 1997-2011 Adam Williams + * Copyright (C) 1997-2017 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 @@ -683,9 +683,7 @@ int BC_FileBox::get_listbox_w() int BC_FileBox::get_listbox_h(int y) { - int result = get_h() - - y - - h_padding; + int result = get_h() - y - h_padding - 10; if(want_directory) result -= BC_WindowBase::get_resources()->dirbox_margin; else @@ -837,15 +835,11 @@ int BC_FileBox::create_tables() // Date entry if(!is_dir || 1) { - static const char *month_text[13] = { "Nul", - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - sprintf(string, - "%s %d, %d", - month_text[file_item->month], - file_item->day, - file_item->year); + struct tm mod_time; + localtime_r(&file_item->mtime, &mod_time); + sprintf(string, "%04d.%02d.%02d %02d:%02d:%02d", + mod_time.tm_year+1900, mod_time.tm_mon+1, mod_time.tm_mday, + mod_time.tm_hour, mod_time.tm_min, mod_time.tm_sec); new_item = new BC_ListBoxItem(string, get_resources()->file_color); } else @@ -883,25 +877,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];