From 7281c129a9bf11594179a768aa34213fe69e98ed Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 29 Sep 2011 16:34:37 +0200 Subject: feh_printf: Check feh_file_info_load return status --- src/filelist.c | 9 ++++----- src/slideshow.c | 20 +++++--------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/filelist.c b/src/filelist.c index 215f371..23239f9 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -321,11 +321,10 @@ int feh_file_info_load(feh_file * file, Imlib_Image im) if (im) im1 = im; - else if (!feh_load_image(&im1, file)) - return(1); - - if (!im1) + else if (!feh_load_image(&im1, file) || !im1) { + weprintf("couldn't load %s", file->filename); return(1); + } file->info = feh_file_info_new(); @@ -340,7 +339,7 @@ int feh_file_info_load(feh_file * file, Imlib_Image im) file->info->size = st.st_size; - if (need_free && im1) + if (need_free) gib_imlib_free_image_and_decache(im1); return(0); } diff --git a/src/slideshow.c b/src/slideshow.c index e6ffb56..52ef4b3 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -402,41 +402,31 @@ char *feh_printf(char *str, feh_file * file) strcat(ret, file->name); break; case 'w': - if (file) { - if (!file->info) - feh_file_info_load(file, NULL); + if (file && (file->info || !feh_file_info_load(file, NULL))) { snprintf(buf, sizeof(buf), "%d", file->info->width); strcat(ret, buf); } break; case 'h': - if (file) { - if (!file->info) - feh_file_info_load(file, NULL); + if (file && (file->info || !feh_file_info_load(file, NULL))) { snprintf(buf, sizeof(buf), "%d", file->info->height); strcat(ret, buf); } break; case 's': - if (file) { - if (!file->info) - feh_file_info_load(file, NULL); + if (file && (file->info || !feh_file_info_load(file, NULL))) { snprintf(buf, sizeof(buf), "%d", file->info->size); strcat(ret, buf); } break; case 'p': - if (file) { - if (!file->info) - feh_file_info_load(file, NULL); + if (file && (file->info || !feh_file_info_load(file, NULL))) { snprintf(buf, sizeof(buf), "%d", file->info->pixels); strcat(ret, buf); } break; case 't': - if (file) { - if (!file->info) - feh_file_info_load(file, NULL); + if (file && (file->info || !feh_file_info_load(file, NULL))) { strcat(ret, file->info->format); } break; -- cgit v1.2.3 From 702db61e222518bf71383e471547c233322b6b7f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 29 Sep 2011 17:10:19 +0200 Subject: feh_printf: Add %S (size in kB) --- ChangeLog | 1 + src/slideshow.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index e1b3be8..7d6a0c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ git HEAD * Fix --info bug when the command wrote no lines to stdout * The button-options -0 through -9 are no longer supported. Use .config/feh/buttons instead (see feh manpage) + * New format specifier: %S (size in kB) Mon, 26 Sep 2011 09:35:41 +0200 Daniel Friesel diff --git a/src/slideshow.c b/src/slideshow.c index 52ef4b3..b9d9494 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -419,6 +419,13 @@ char *feh_printf(char *str, feh_file * file) strcat(ret, buf); } break; + case 'S': + if (file && (file->info || !feh_file_info_load(file, NULL))) { + snprintf(buf, sizeof(buf), + "%.2fkB", ((double)file->info->size / 1000)); + strcat(ret, buf); + } + break; case 'p': if (file && (file->info || !feh_file_info_load(file, NULL))) { snprintf(buf, sizeof(buf), "%d", file->info->pixels); -- cgit v1.2.3 From 23029c351dacce90d78b5648ffc4bc7bcf6aa359 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 29 Sep 2011 17:27:56 +0200 Subject: start --index-{name,dim,size} -> printf transition --- man/feh.pre | 17 ++----- src/index.c | 143 +++++++++++++--------------------------------------------- src/options.c | 15 ++---- src/options.h | 1 + 4 files changed, 41 insertions(+), 135 deletions(-) diff --git a/man/feh.pre b/man/feh.pre index b40510e..6fbff64 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -286,18 +286,6 @@ name beneath each thumbnail. Index mode enables certain other options, see and .Sx MONTAGE MODE OPTIONS . . -.It Cm --index-dim Ar bool -. -Toggle showing image dimensions in thumbnail/index mode. -. -.It Cm --index-name Ar bool -. -Toggle showing the filename in thumbnail/index mode. -. -.It Cm --index-size Ar bool -. -Toggle showing the filesize in thumbnail/index mode. -. .It Cm --info Ar commandline . Execute @@ -726,6 +714,11 @@ Number of image pixels . Image size in bytes . +.It %S +. +Image size in kilobytes +.Pq with kB postfix +. .It %t . Image format diff --git a/src/index.c b/src/index.c index 897a47d..448c0bb 100644 --- a/src/index.c +++ b/src/index.c @@ -29,9 +29,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "winwidget.h" #include "options.h" -static char *create_index_dimension_string(int w, int h); -static char *create_index_size_string(char *file); static char *create_index_title_string(int num, int w, int h); +static char *create_index_string(feh_file * file); +static int get_index_info_no_lines(void); /* TODO Break this up a bit ;) */ /* TODO s/bit/lot */ @@ -51,7 +51,7 @@ void init_index_mode(void) Imlib_Font title_fn = NULL; int text_area_w = 0; int tw = 0, th = 0; - int fw_name, fw_size, fw_dim, fw, fh; + int fw, fh; int vertical = 0; int max_column_w = 0; int thumbnailcount = 0; @@ -60,7 +60,7 @@ void init_index_mode(void) int lines; unsigned char trans_bg = 0; int index_image_width, index_image_height; - int x_offset_name = 0, x_offset_dim = 0, x_offset_size = 0; + int x_offset_text = 0; char *s; if (opt.montage) { @@ -93,7 +93,7 @@ void init_index_mode(void) /* Work out how tall the font is */ gib_imlib_get_text_size(fn, "W", NULL, &tw, &th, IMLIB_TEXT_TO_RIGHT); /* For now, allow room for the right number of lines with small gaps */ - text_area_h = ((th + 2) * (opt.index_show_name + opt.index_show_size + opt.index_show_dim)) + 5; + text_area_h = ((th + 2) * get_index_info_no_lines()) + 5; /* This includes the text area for index data */ tot_thumb_h = opt.thumb_h + text_area_h; @@ -151,22 +151,10 @@ void init_index_mode(void) for (l = filelist; l; l = l->next) { file = FEH_FILE(l->data); text_area_w = opt.thumb_w; - if (opt.index_show_name) { - gib_imlib_get_text_size(fn, file->name, NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > text_area_w) - text_area_w = fw; - } - if (opt.index_show_dim) { + if (opt.index_info) { gib_imlib_get_text_size(fn, - create_index_dimension_string - (1000, 1000), NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > text_area_w) - text_area_w = fw; - } - if (opt.index_show_size) { - gib_imlib_get_text_size(fn, - create_index_size_string - (file->filename), NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + create_index_string(file), + NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); if (fw > text_area_w) text_area_w = fw; } @@ -198,22 +186,10 @@ void init_index_mode(void) file = FEH_FILE(l->data); text_area_w = opt.thumb_w; /* Calc width of text */ - if (opt.index_show_name) { - gib_imlib_get_text_size(fn, file->name, NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > text_area_w) - text_area_w = fw; - } - if (opt.index_show_dim) { - gib_imlib_get_text_size(fn, - create_index_dimension_string - (1000, 1000), NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > text_area_w) - text_area_w = fw; - } - if (opt.index_show_size) { + if (opt.index_info) { gib_imlib_get_text_size(fn, - create_index_size_string - (file->filename), NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + create_index_string(file), + NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); if (fw > text_area_w) text_area_w = fw; } @@ -240,22 +216,10 @@ void init_index_mode(void) for (l = filelist; l; l = l->next) { file = FEH_FILE(l->data); text_area_w = opt.thumb_w; - if (opt.index_show_name) { - gib_imlib_get_text_size(fn, file->name, NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > text_area_w) - text_area_w = fw; - } - if (opt.index_show_dim) { + if (opt.index_info) { gib_imlib_get_text_size(fn, - create_index_dimension_string - (1000, 1000), NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > text_area_w) - text_area_w = fw; - } - if (opt.index_show_size) { - gib_imlib_get_text_size(fn, - create_index_size_string - (file->filename), NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + create_index_string(file), + NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); if (fw > text_area_w) text_area_w = fw; } @@ -356,32 +320,18 @@ void init_index_mode(void) text_area_w = opt.thumb_w; /* Now draw on the info text */ - if (opt.index_show_name) { - gib_imlib_get_text_size(fn, file->name, NULL, &fw_name, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw_name > text_area_w) - text_area_w = fw_name; - } - if (opt.index_show_dim) { + if (opt.index_info) { gib_imlib_get_text_size(fn, - create_index_dimension_string - (ww, hh), NULL, &fw_dim, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw_dim > text_area_w) - text_area_w = fw_dim; - } - if (opt.index_show_size) { - gib_imlib_get_text_size(fn, - create_index_size_string - (file->filename), NULL, &fw_size, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw_size > text_area_w) - text_area_w = fw_size; + create_index_string(file), + NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + if (fw > text_area_w) + text_area_w = fw; } if (text_area_w > opt.thumb_w) text_area_w += 5; /* offsets for centering text */ - x_offset_name = (text_area_w - fw_name) / 2; - x_offset_dim = (text_area_w - fw_dim) / 2; - x_offset_size = (text_area_w - fw_size) / 2; + x_offset_text = (text_area_w - fw) / 2; if (vertical) { if (text_area_w > max_column_w) @@ -419,28 +369,12 @@ void init_index_mode(void) gib_imlib_free_image_and_decache(im_thumb); lines = 0; - if (opt.index_show_name) - gib_imlib_text_draw(im_main, fn, NULL, - x + x_offset_name, - y + opt.thumb_h + - (lines++ * (th + 2)) + - 2, file->name, IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); - if (opt.index_show_dim) + if (opt.index_info) gib_imlib_text_draw(im_main, fn, NULL, - x + x_offset_dim, - y + opt.thumb_h + - (lines++ * (th + 2)) + - 2, - create_index_dimension_string - (ww, hh), IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); - if (opt.index_show_size) - gib_imlib_text_draw(im_main, fn, NULL, - x + x_offset_size, - y + opt.thumb_h + - (lines++ * (th + 2)) + - 2, - create_index_size_string - (file->filename), IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); + x + x_offset_text, + y + opt.thumb_h + (lines++ * (th + 2)) + 2, + create_index_string(file), + IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); if (vertical) y += tot_thumb_h; @@ -502,30 +436,17 @@ void init_index_mode(void) return; } -static char *create_index_size_string(char *file) +static int get_index_info_no_lines(void) { - static char str[50]; - int size = 0; - double kbs = 0.0; - struct stat st; - - if (stat(file, &st)) - kbs = 0.0; - else { - size = st.st_size; - kbs = (double) size / 1000; - } - - snprintf(str, sizeof(str), "%.2fKb", kbs); - return(str); + if (opt.index_info) + /* TODO */ + return 3; + return 0; } -static char *create_index_dimension_string(int w, int h) +static char *create_index_string(feh_file * file) { - static char str[50]; - - snprintf(str, sizeof(str), "%dx%d", w, h); - return(str); + return feh_printf(opt.index_info, file); } static char *create_index_title_string(int num, int w, int h) diff --git a/src/options.c b/src/options.c index 316f62d..6f44607 100644 --- a/src/options.c +++ b/src/options.c @@ -386,9 +386,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"action9" , 1, 0, 217}, {"bg-fill" , 0, 0, 218}, {"bg-max" , 0, 0, 219}, - {"index-name" , 1, 0, 230}, - {"index-size" , 1, 0, 231}, - {"index-dim" , 1, 0, 232}, {"thumb-redraw" , 1, 0, 'J'}, {"info" , 1, 0, 234}, {"force-aliasing", 0, 0, 235}, @@ -420,6 +417,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 'i': opt.index = 1; + opt.index_info = estrdup("%n"); opt.index_show_name = 1; opt.index_show_size = 0; opt.index_show_dim = 0; @@ -429,6 +427,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 'I': opt.index = 1; + opt.index_info = estrdup("%n \n %S \n %wx%h"); opt.index_show_name = 1; opt.index_show_size = 1; opt.index_show_dim = 1; @@ -612,6 +611,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 't': opt.thumbs = 1; + opt.index_info = ("%n"); opt.index_show_name = 1; opt.index_show_size = 0; opt.index_show_dim = 0; @@ -701,15 +701,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case 229: opt.text_bg = TEXT_BG_TINTED; break; - case 230: - opt.index_show_name = atoi(optarg); - break; - case 231: - opt.index_show_size = atoi(optarg); - break; - case 232: - opt.index_show_dim = atoi(optarg); - break; case 'J': opt.thumb_redraw = atoi(optarg); break; diff --git a/src/options.h b/src/options.h index f1fe3c4..9a294b8 100644 --- a/src/options.h +++ b/src/options.h @@ -89,6 +89,7 @@ struct __fehoptions { char *caption_path; char *start_list_at; char *info_cmd; + char *index_info; gib_style *menu_style_l; -- cgit v1.2.3 From 86dfce8a424dd088f261fcbb4d34e59135dfddfd Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 29 Sep 2011 18:02:32 +0200 Subject: make get_index_info_no_lines return actual line number --- src/index.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/index.c b/src/index.c index 448c0bb..844897c 100644 --- a/src/index.c +++ b/src/index.c @@ -438,10 +438,22 @@ void init_index_mode(void) static int get_index_info_no_lines(void) { - if (opt.index_info) - /* TODO */ - return 3; - return 0; + static int no_lines = 0; + char *pos = opt.index_info; + + if (no_lines) + return no_lines; + + if (!opt.index_info) + return 0; + + no_lines = 1; + while ((pos = strchr(pos, '\n'))) { + no_lines++; + pos++; + } + + return no_lines; } static char *create_index_string(feh_file * file) -- cgit v1.2.3 From ca99c34c74999682dc6ce70d7455ba2ff778b1f8 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 30 Sep 2011 02:14:06 +0200 Subject: index: Proper multiline support --- src/index.c | 89 +++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 26 deletions(-) diff --git a/src/index.c b/src/index.c index 844897c..d194cf6 100644 --- a/src/index.c +++ b/src/index.c @@ -30,7 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "options.h" static char *create_index_title_string(int num, int w, int h); -static char *create_index_string(feh_file * file); +static char *create_index_string(feh_file *file); +static void get_index_string_dim(feh_file *file, Imlib_Font fn, int *w, int *h); static int get_index_info_no_lines(void); /* TODO Break this up a bit ;) */ @@ -57,11 +58,11 @@ void init_index_mode(void) int thumbnailcount = 0; gib_list *l = NULL, *last = NULL; feh_file *file = NULL; - int lines; + int lineno; unsigned char trans_bg = 0; int index_image_width, index_image_height; - int x_offset_text = 0; char *s; + gib_list *line, *lines; if (opt.montage) { mode = "montage"; @@ -76,7 +77,6 @@ void init_index_mode(void) fn = gib_imlib_load_font(DEFAULT_FONT); if (opt.title_font) { - int fh, fw; title_fn = gib_imlib_load_font(opt.title_font); if (!title_fn) @@ -152,9 +152,7 @@ void init_index_mode(void) file = FEH_FILE(l->data); text_area_w = opt.thumb_w; if (opt.index_info) { - gib_imlib_get_text_size(fn, - create_index_string(file), - NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + get_index_string_dim(file, fn, &fw, &fh); if (fw > text_area_w) text_area_w = fw; } @@ -187,9 +185,7 @@ void init_index_mode(void) text_area_w = opt.thumb_w; /* Calc width of text */ if (opt.index_info) { - gib_imlib_get_text_size(fn, - create_index_string(file), - NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + get_index_string_dim(file, fn, &fw, &fh); if (fw > text_area_w) text_area_w = fw; } @@ -217,9 +213,7 @@ void init_index_mode(void) file = FEH_FILE(l->data); text_area_w = opt.thumb_w; if (opt.index_info) { - gib_imlib_get_text_size(fn, - create_index_string(file), - NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + get_index_string_dim(file, fn, &fw, &fh); if (fw > text_area_w) text_area_w = fw; } @@ -321,18 +315,13 @@ void init_index_mode(void) text_area_w = opt.thumb_w; /* Now draw on the info text */ if (opt.index_info) { - gib_imlib_get_text_size(fn, - create_index_string(file), - NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + get_index_string_dim(file, fn, &fw, &fh); if (fw > text_area_w) text_area_w = fw; } if (text_area_w > opt.thumb_w) text_area_w += 5; - /* offsets for centering text */ - x_offset_text = (text_area_w - fw) / 2; - if (vertical) { if (text_area_w > max_column_w) max_column_w = text_area_w; @@ -368,13 +357,23 @@ void init_index_mode(void) gib_imlib_free_image_and_decache(im_thumb); - lines = 0; - if (opt.index_info) - gib_imlib_text_draw(im_main, fn, NULL, - x + x_offset_text, - y + opt.thumb_h + (lines++ * (th + 2)) + 2, - create_index_string(file), - IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); + lineno = 0; + if (opt.index_info) { + line = lines = feh_wrap_string(create_index_string(file), + opt.thumb_w * 2, fn, NULL); + + while (line) { + gib_imlib_get_text_size(fn, (char *) line->data, + NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + gib_imlib_text_draw(im_main, fn, NULL, + x + ((text_area_w - fw) >> 1), + y + opt.thumb_h + (lineno++ * (th + 2)) + 2, + (char *) line->data, + IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); + line = line->next; + } + gib_list_free_and_data(lines); + } if (vertical) y += tot_thumb_h; @@ -456,6 +455,44 @@ static int get_index_info_no_lines(void) return no_lines; } +static void get_index_string_dim(feh_file *file, Imlib_Font fn, int *fw, int *fh) +{ + int line_w, line_h; + gib_list *line, *lines; + static int max_w = 0, total_h = 0; + static feh_file *last_file; + + if (last_file == file) { + *fw = max_w; + *fh = total_h; + return; + } + + last_file = file; + + if (!opt.index_info) + return; + + line = lines = feh_wrap_string(create_index_string(file), opt.thumb_w * 2, fn, NULL); + + while (line) { + gib_imlib_get_text_size(fn, (char *) line->data, + NULL, &line_w, &line_h, IMLIB_TEXT_TO_RIGHT); + + if (line_w > max_w) + max_w = line_w; + total_h += line_h + 2; + + line = line->next; + } + + gib_list_free_and_data(lines); + + *fw = max_w; + *fh = total_h; + return; +} + static char *create_index_string(feh_file * file) { return feh_printf(opt.index_info, file); -- cgit v1.2.3 From a5f36f763cb8f66b1c658057f7af1ee6d7f246b7 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 30 Sep 2011 02:33:43 +0200 Subject: Add --index-info option --- ChangeLog | 2 ++ src/index.c | 37 ++++--------------------------------- src/options.c | 6 +++++- 3 files changed, 11 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d6a0c6..b07c47c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ git HEAD * The button-options -0 through -9 are no longer supported. Use .config/feh/buttons instead (see feh manpage) * New format specifier: %S (size in kB) + * The --index-{dim,name,size} options are no longer supported. + Use --index-info with format specifiers instead Mon, 26 Sep 2011 09:35:41 +0200 Daniel Friesel diff --git a/src/index.c b/src/index.c index d194cf6..3ac5997 100644 --- a/src/index.c +++ b/src/index.c @@ -32,7 +32,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static char *create_index_title_string(int num, int w, int h); static char *create_index_string(feh_file *file); static void get_index_string_dim(feh_file *file, Imlib_Font fn, int *w, int *h); -static int get_index_info_no_lines(void); /* TODO Break this up a bit ;) */ /* TODO s/bit/lot */ @@ -92,8 +91,9 @@ void init_index_mode(void) /* Work out how tall the font is */ gib_imlib_get_text_size(fn, "W", NULL, &tw, &th, IMLIB_TEXT_TO_RIGHT); + get_index_string_dim(NULL, fn, &fw, &fh); /* For now, allow room for the right number of lines with small gaps */ - text_area_h = ((th + 2) * get_index_info_no_lines()) + 5; + text_area_h = fh + 5; /* This includes the text area for index data */ tot_thumb_h = opt.thumb_h + text_area_h; @@ -360,7 +360,7 @@ void init_index_mode(void) lineno = 0; if (opt.index_info) { line = lines = feh_wrap_string(create_index_string(file), - opt.thumb_w * 2, fn, NULL); + opt.thumb_w * 3, fn, NULL); while (line) { gib_imlib_get_text_size(fn, (char *) line->data, @@ -435,45 +435,16 @@ void init_index_mode(void) return; } -static int get_index_info_no_lines(void) -{ - static int no_lines = 0; - char *pos = opt.index_info; - - if (no_lines) - return no_lines; - - if (!opt.index_info) - return 0; - - no_lines = 1; - while ((pos = strchr(pos, '\n'))) { - no_lines++; - pos++; - } - - return no_lines; -} - static void get_index_string_dim(feh_file *file, Imlib_Font fn, int *fw, int *fh) { int line_w, line_h; gib_list *line, *lines; static int max_w = 0, total_h = 0; - static feh_file *last_file; - - if (last_file == file) { - *fw = max_w; - *fh = total_h; - return; - } - - last_file = file; if (!opt.index_info) return; - line = lines = feh_wrap_string(create_index_string(file), opt.thumb_w * 2, fn, NULL); + line = lines = feh_wrap_string(create_index_string(file), opt.thumb_w * 3, fn, NULL); while (line) { gib_imlib_get_text_size(fn, (char *) line->data, diff --git a/src/options.c b/src/options.c index 6f44607..4b29d35 100644 --- a/src/options.c +++ b/src/options.c @@ -374,6 +374,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"menu-style" , 1, 0, 204}, {"zoom" , 1, 0, 205}, {"no-screen-clip", 0, 0, 206}, + {"index-info" , 1, 0, 207}, {"caption-path" , 1, 0, 'K'}, {"action1" , 1, 0, 209}, {"action2" , 1, 0, 210}, @@ -427,7 +428,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 'I': opt.index = 1; - opt.index_info = estrdup("%n \n %S \n %wx%h"); + opt.index_info = estrdup("%n\n%S\n%wx%h"); opt.index_show_name = 1; opt.index_show_size = 1; opt.index_show_dim = 1; @@ -650,6 +651,9 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case 206: opt.screen_clip = 0; break; + case 207: + opt.index_info = estrdup(optarg); + break; case 'K': opt.caption_path = estrdup(optarg); break; -- cgit v1.2.3 From 555f7bccebc92d28a14eb0fd6d29a2a39b8f83e1 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 30 Sep 2011 02:40:44 +0200 Subject: make common index.c functions externally accessible --- src/index.c | 10 ++++------ src/index.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 src/index.h diff --git a/src/index.c b/src/index.c index 3ac5997..11974bd 100644 --- a/src/index.c +++ b/src/index.c @@ -28,10 +28,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "filelist.h" #include "winwidget.h" #include "options.h" +#include "index.h" -static char *create_index_title_string(int num, int w, int h); -static char *create_index_string(feh_file *file); -static void get_index_string_dim(feh_file *file, Imlib_Font fn, int *w, int *h); /* TODO Break this up a bit ;) */ /* TODO s/bit/lot */ @@ -435,7 +433,7 @@ void init_index_mode(void) return; } -static void get_index_string_dim(feh_file *file, Imlib_Font fn, int *fw, int *fh) +void get_index_string_dim(feh_file *file, Imlib_Font fn, int *fw, int *fh) { int line_w, line_h; gib_list *line, *lines; @@ -464,12 +462,12 @@ static void get_index_string_dim(feh_file *file, Imlib_Font fn, int *fw, int *fh return; } -static char *create_index_string(feh_file * file) +char *create_index_string(feh_file * file) { return feh_printf(opt.index_info, file); } -static char *create_index_title_string(int num, int w, int h) +char *create_index_title_string(int num, int w, int h) { static char str[50]; diff --git a/src/index.h b/src/index.h new file mode 100644 index 0000000..288b0ee --- /dev/null +++ b/src/index.h @@ -0,0 +1,33 @@ +/* index.h + +Copyright (C) 2011 Daniel Friesel. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies of the Software and its documentation and acknowledgment shall be +given in the documentation and software packages that this Software was +used. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef INDEX_H +#define INDEX_H + +char *create_index_string(feh_file *file); +char *create_index_title_string(int num, int w, int h); +void get_index_string_dim(feh_file *file, Imlib_Font fn, int *w, int *h); + +#endif -- cgit v1.2.3 From f933dd396cf0f5cbb5b053d5a8f85fbcfc9761fd Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 30 Sep 2011 03:10:07 +0200 Subject: Apply changes to thumbnail mode --- src/index.c | 2 + src/options.c | 14 +---- src/options.h | 3 - src/thumbnail.c | 173 +++++++++++--------------------------------------------- 4 files changed, 36 insertions(+), 156 deletions(-) diff --git a/src/index.c b/src/index.c index 11974bd..466ce21 100644 --- a/src/index.c +++ b/src/index.c @@ -457,6 +457,8 @@ void get_index_string_dim(feh_file *file, Imlib_Font fn, int *fw, int *fh) gib_list_free_and_data(lines); + printf("dim is %dx%d\n", max_w, total_h); + *fw = max_w; *fh = total_h; return; diff --git a/src/options.c b/src/options.c index 4b29d35..1583eb8 100644 --- a/src/options.c +++ b/src/options.c @@ -409,9 +409,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 'm': opt.index = 1; - opt.index_show_name = 0; - opt.index_show_size = 0; - opt.index_show_dim = 0; break; case 'c': opt.collage = 1; @@ -419,9 +416,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case 'i': opt.index = 1; opt.index_info = estrdup("%n"); - opt.index_show_name = 1; - opt.index_show_size = 0; - opt.index_show_dim = 0; break; case '.': opt.scale_down = 1; @@ -429,9 +423,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case 'I': opt.index = 1; opt.index_info = estrdup("%n\n%S\n%wx%h"); - opt.index_show_name = 1; - opt.index_show_size = 1; - opt.index_show_dim = 1; break; case 'l': opt.list = 1; @@ -612,10 +603,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 't': opt.thumbs = 1; - opt.index_info = ("%n"); - opt.index_show_name = 1; - opt.index_show_size = 0; - opt.index_show_dim = 0; + opt.index_info = estrdup("%n"); break; case 'j': opt.output_dir = estrdup(optarg); diff --git a/src/options.h b/src/options.h index 9a294b8..4946927 100644 --- a/src/options.h +++ b/src/options.h @@ -32,9 +32,6 @@ struct __fehoptions { unsigned char montage; unsigned char collage; unsigned char index; - unsigned char index_show_name; - unsigned char index_show_dim; - unsigned char index_show_size; unsigned char thumbs; unsigned char slideshow; unsigned char recursive; diff --git a/src/thumbnail.c b/src/thumbnail.c index 16dbcf3..191fc8e 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -31,10 +31,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "thumbnail.h" #include "md5.h" #include "feh_png.h" +#include "index.h" -static char *create_index_dimension_string(int w, int h); -static char *create_index_size_string(char *file); -static char *create_index_title_string(int num, int w, int h); static gib_list *thumbnails = NULL; static thumbmode_data td; @@ -65,15 +63,15 @@ void init_thumbnail_mode(void) unsigned char trans_bg = 0; int title_area_h = 0; int tw = 0, th = 0; - int fw_name, fw_size, fw_dim, fh; + int fw, fh; int thumbnailcount = 0; feh_file *file = NULL; gib_list *l, *last = NULL; - int lines; + int lineno; int index_image_width, index_image_height; - int x_offset_name = 0, x_offset_dim = 0, x_offset_size = 0; char *s; unsigned int thumb_counter = 0; + gib_list *line, *lines; /* initialize thumbnail mode data */ td.im_main = NULL; @@ -119,9 +117,8 @@ void init_thumbnail_mode(void) /* Work out how tall the font is */ gib_imlib_get_text_size(td.font_main, "W", NULL, &tw, &th, IMLIB_TEXT_TO_RIGHT); - /* For now, allow room for the right number of lines with small gaps */ - td.text_area_h = ((th + 2) * (opt.index_show_name + opt.index_show_size + - opt.index_show_dim)) + 5; + get_index_string_dim(NULL, td.font_main, &fw, &fh); + td.text_area_h = fh + 5; /* This includes the text area for index data */ td.thumb_tot_h = opt.thumb_h + td.text_area_h; @@ -264,34 +261,14 @@ void init_thumbnail_mode(void) td.text_area_w = opt.thumb_w; /* Now draw on the info text */ - if (opt.index_show_name) { - gib_imlib_get_text_size(td.font_main, file->name, NULL, - &fw_name, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw_name > td.text_area_w) - td.text_area_w = fw_name; - } - if (opt.index_show_dim) { - gib_imlib_get_text_size(td.font_main, - create_index_dimension_string(ww, hh), - NULL, &fw_dim, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw_dim > td.text_area_w) - td.text_area_w = fw_dim; - } - if (opt.index_show_size) { - gib_imlib_get_text_size(td.font_main, - create_index_size_string(file->filename), - NULL, &fw_size, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw_size > td.text_area_w) - td.text_area_w = fw_size; + if (opt.index_info) { + get_index_string_dim(file, td.font_main, &fw, &fh); + if (fw > td.text_area_w) + td.text_area_w = fw; } if (td.text_area_w > opt.thumb_w) td.text_area_w += 5; - /* offsets for centering text */ - x_offset_name = (td.text_area_w - fw_name) / 2; - x_offset_dim = (td.text_area_w - fw_dim) / 2; - x_offset_size = (td.text_area_w - fw_size) / 2; - if (td.vertical) { if (td.text_area_w > td.max_column_w) td.max_column_w = td.text_area_w; @@ -332,28 +309,23 @@ void init_thumbnail_mode(void) gib_imlib_free_image_and_decache(im_thumb); - lines = 0; - if (opt.index_show_name) - gib_imlib_text_draw(td.im_main, - td.font_main, NULL, - x + x_offset_name, - y + opt.thumb_h + (lines++ * (th + 2)) + 2, - file->name, IMLIB_TEXT_TO_RIGHT, - 255, 255, 255, 255); - if (opt.index_show_dim) - gib_imlib_text_draw(td.im_main, - td.font_main, NULL, - x + x_offset_dim, - y + opt.thumb_h + (lines++ * (th + 2)) + 2, - create_index_dimension_string(orig_w, orig_h), - IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); - if (opt.index_show_size) - gib_imlib_text_draw(td.im_main, - td.font_main, NULL, - x + x_offset_size, - y + opt.thumb_h + (lines++ * (th + 2)) + 2, - create_index_size_string(file->filename), - IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); + lineno = 0; + if (opt.index_info) { + line = lines = feh_wrap_string(create_index_string(file), + opt.thumb_w * 3, td.font_main, NULL); + + while (line) { + gib_imlib_get_text_size(td.font_main, (char *) line -> data, + NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + gib_imlib_text_draw(td.im_main, td.font_main, NULL, + x + ((td.text_area_w - fw) >> 1), + y + opt.thumb_h + (lineno++ * (th + 2)) + 2, + (char *) line->data, + IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); + line = line->next; + } + gib_list_free_and_data(lines); + } if (td.vertical) y += td.thumb_tot_h; @@ -424,40 +396,6 @@ void init_thumbnail_mode(void) return; } -static char *create_index_size_string(char *file) -{ - static char str[50]; - int size = 0; - double kbs = 0.0; - struct stat st; - - if (stat(file, &st)) - kbs = 0.0; - else { - size = st.st_size; - kbs = (double) size / 1000; - } - - snprintf(str, sizeof(str), "%.2fKb", kbs); - return(str); -} - -static char *create_index_dimension_string(int w, int h) -{ - static char str[50]; - - snprintf(str, sizeof(str), "%dx%d", w, h); - return(str); -} - -static char *create_index_title_string(int num, int w, int h) -{ - static char str[50]; - - snprintf(str, sizeof(str), PACKAGE " index - %d thumbnails, %d by %d pixels", num, w, h); - return(str); -} - feh_thumbnail *feh_thumbnail_new(feh_file * file, int x, int y, int w, int h) { feh_thumbnail *thumb; @@ -606,23 +544,8 @@ void feh_thumbnail_calculate_geometry(void) for (l = filelist; l; l = l->next) { file = FEH_FILE(l->data); td.text_area_w = opt.thumb_w; - if (opt.index_show_name) { - gib_imlib_get_text_size(td.font_main, file->name, NULL, - &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > td.text_area_w) - td.text_area_w = fw; - } - if (opt.index_show_dim) { - gib_imlib_get_text_size(td.font_main, - create_index_dimension_string(1000, 1000), - NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > td.text_area_w) - td.text_area_w = fw; - } - if (opt.index_show_size) { - gib_imlib_get_text_size(td.font_main, - create_index_size_string(file->filename), - NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + if (opt.index_info) { + get_index_string_dim(file, td.font_main, &fw, &fh); if (fw > td.text_area_w) td.text_area_w = fw; } @@ -654,23 +577,8 @@ void feh_thumbnail_calculate_geometry(void) file = FEH_FILE(l->data); td.text_area_w = opt.thumb_w; /* Calc width of text */ - if (opt.index_show_name) { - gib_imlib_get_text_size(td.font_main, file->name, NULL, - &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > td.text_area_w) - td.text_area_w = fw; - } - if (opt.index_show_dim) { - gib_imlib_get_text_size(td.font_main, - create_index_dimension_string(1000, 1000), - NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > td.text_area_w) - td.text_area_w = fw; - } - if (opt.index_show_size) { - gib_imlib_get_text_size(td.font_main, - create_index_size_string(file->filename), - NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + if (opt.index_info) { + get_index_string_dim(file, td.font_main, &fw, &fh); if (fw > td.text_area_w) td.text_area_w = fw; } @@ -697,23 +605,8 @@ void feh_thumbnail_calculate_geometry(void) for (l = filelist; l; l = l->next) { file = FEH_FILE(l->data); td.text_area_w = opt.thumb_w; - if (opt.index_show_name) { - gib_imlib_get_text_size(td.font_main, file->name, NULL, - &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > td.text_area_w) - td.text_area_w = fw; - } - if (opt.index_show_dim) { - gib_imlib_get_text_size(td.font_main, - create_index_dimension_string(1000, 1000), - NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); - if (fw > td.text_area_w) - td.text_area_w = fw; - } - if (opt.index_show_size) { - gib_imlib_get_text_size(td.font_main, - create_index_size_string(file->filename), - NULL, &fw, &fh, IMLIB_TEXT_TO_RIGHT); + if (opt.index_info) { + get_index_string_dim(file, td.font_main, &fw, &fh); if (fw > td.text_area_w) td.text_area_w = fw; } -- cgit v1.2.3 From 1d5caf587462e4e60e69938d183ba0b2faa1ed0b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 30 Sep 2011 03:16:36 +0200 Subject: get_index_string_dim: Fix dimansion report for file = NULL --- src/index.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/index.c b/src/index.c index 466ce21..49efc17 100644 --- a/src/index.c +++ b/src/index.c @@ -436,12 +436,22 @@ void init_index_mode(void) void get_index_string_dim(feh_file *file, Imlib_Font fn, int *fw, int *fh) { int line_w, line_h; + char fake_file = 0; gib_list *line, *lines; static int max_w = 0, total_h = 0; if (!opt.index_info) return; + /* called with file = NULL in the setup phase. + * We need a fake file, otherwise feh_printf will remove format specifiers, + * leading e.g. to a 0x0 report for index_dim = "%n". + */ + if (file == NULL) { + file = feh_file_new("foo"); + file->info = feh_file_info_new(); + } + line = lines = feh_wrap_string(create_index_string(file), opt.thumb_w * 3, fn, NULL); while (line) { @@ -456,8 +466,8 @@ void get_index_string_dim(feh_file *file, Imlib_Font fn, int *fw, int *fh) } gib_list_free_and_data(lines); - - printf("dim is %dx%d\n", max_w, total_h); + if (fake_file) + feh_file_free(file); *fw = max_w; *fh = total_h; -- cgit v1.2.3 From ad1b17d8f170c499a441fe24924f994ccf0b7e74 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 30 Sep 2011 03:24:45 +0200 Subject: Fix memory leaks --- src/index.c | 1 + src/thumbnail.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/index.c b/src/index.c index 49efc17..580585d 100644 --- a/src/index.c +++ b/src/index.c @@ -448,6 +448,7 @@ void get_index_string_dim(feh_file *file, Imlib_Font fn, int *fw, int *fh) * leading e.g. to a 0x0 report for index_dim = "%n". */ if (file == NULL) { + fake_file = 1; file = feh_file_new("foo"); file->info = feh_file_info_new(); } diff --git a/src/thumbnail.c b/src/thumbnail.c index 191fc8e..f7a31c6 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -921,11 +921,14 @@ int feh_thumbnail_setup_thumbnail_dir(void) weprintf("unable to create %s directory", dir_thumbnails); } + free(dir_thumbnails); + if (mkdir(dir, 0700) == -1) weprintf("unable to create %s directory", dir); else status = 1; } + free(dir); } return status; -- cgit v1.2.3 From c012215477b91ace372bfe4131d16519024bc286 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 30 Sep 2011 03:28:47 +0200 Subject: feh_file_info_load: do not display error when run with --quiet --- src/filelist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/filelist.c b/src/filelist.c index 23239f9..91b6b89 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -322,7 +322,8 @@ int feh_file_info_load(feh_file * file, Imlib_Image im) if (im) im1 = im; else if (!feh_load_image(&im1, file) || !im1) { - weprintf("couldn't load %s", file->filename); + if (!opt.quiet) + weprintf("couldn't load %s", file->filename); return(1); } -- cgit v1.2.3 From eff624290d52d526e4db834b40aff08f1c1db069 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 30 Sep 2011 13:48:46 +0200 Subject: Add --index-info to documentation --- man/feh.pre | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/man/feh.pre b/man/feh.pre index 6fbff64..fe4037c 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -243,8 +243,10 @@ Disable antialiasing for zooming, background setting etc. . .It Cm -I , --fullindex . -Same as Index mode, but you also get image size and dimensions printed -below each thumbnail. Enables +Same as index mode, but with additional information below the thumbnails. +Works just like +.Qq feh --index --index-info \&"\&%n\en\&%S\en\&%wx\&%h\&" . +Enables .Sx MONTAGE MODE OPTIONS . . .It Cm -F , --fullscreen @@ -286,6 +288,14 @@ name beneath each thumbnail. Index mode enables certain other options, see and .Sx MONTAGE MODE OPTIONS . . +.It Cm --index-info Ar format +. +Show image information based on +.Ar format +below thumbnails in index / thumbnail mode. See +.Sx FORMAT SPECIFIERS . +May contain newlines. +. .It Cm --info Ar commandline . Execute -- cgit v1.2.3 From f55de5185347da52e7cd282491afdc7114418e50 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 1 Oct 2011 22:42:09 +0200 Subject: index.c, thumbnail.c: Fix alignment issues --- src/index.c | 14 +++++++++++++- src/thumbnail.c | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/index.c b/src/index.c index 580585d..d9e068a 100644 --- a/src/index.c +++ b/src/index.c @@ -153,6 +153,10 @@ void init_index_mode(void) get_index_string_dim(file, fn, &fw, &fh); if (fw > text_area_w) text_area_w = fw; + if (fh > text_area_h) { + text_area_h = fh + 5; + tot_thumb_h = opt.thumb_h + text_area_h; + } } if (text_area_w > opt.thumb_w) text_area_w += 5; @@ -186,6 +190,10 @@ void init_index_mode(void) get_index_string_dim(file, fn, &fw, &fh); if (fw > text_area_w) text_area_w = fw; + if (fh > text_area_h) { + text_area_h = fh + 5; + tot_thumb_h = opt.thumb_h + text_area_h; + } } if (text_area_w > opt.thumb_w) text_area_w += 5; @@ -214,6 +222,10 @@ void init_index_mode(void) get_index_string_dim(file, fn, &fw, &fh); if (fw > text_area_w) text_area_w = fw; + if (fh > text_area_h) { + text_area_h = fh + 5; + tot_thumb_h = opt.thumb_h + text_area_h; + } } if (text_area_w > opt.thumb_w) @@ -438,7 +450,7 @@ void get_index_string_dim(feh_file *file, Imlib_Font fn, int *fw, int *fh) int line_w, line_h; char fake_file = 0; gib_list *line, *lines; - static int max_w = 0, total_h = 0; + int max_w = 0, total_h = 0; if (!opt.index_info) return; diff --git a/src/thumbnail.c b/src/thumbnail.c index f7a31c6..86d254b 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -265,6 +265,10 @@ void init_thumbnail_mode(void) get_index_string_dim(file, td.font_main, &fw, &fh); if (fw > td.text_area_w) td.text_area_w = fw; + if (fh > td.text_area_h) { + td.text_area_h = fh + 5; + td.thumb_tot_h = opt.thumb_h + td.text_area_h; + } } if (td.text_area_w > opt.thumb_w) td.text_area_w += 5; -- cgit v1.2.3