summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-06-07 20:48:03 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-06-07 20:48:03 +0200
commitf86dcb5ddea5cfb4fa16241318a47428cc2a18a1 (patch)
tree72b90a99b395897a3740c13559667b8dd2c99fbc /src
parent618beee24166caf02f2bc881a1d27a4ef1b3ccbd (diff)
downloadfeh-f86dcb5ddea5cfb4fa16241318a47428cc2a18a1.zip
Show a little message in caption editing mode to indicate that is active
Diffstat (limited to 'src')
-rw-r--r--src/imlib.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/imlib.c b/src/imlib.c
index 1abd767..ae1acb1 100644
--- a/src/imlib.c
+++ b/src/imlib.c
@@ -722,18 +722,16 @@ void feh_draw_caption(winwidget w)
* winwidget_render_image().
*/
file->caption = estrdup("");
- D_RETURN_(4);
}
- if (file->caption == '\0') {
+ if (*(file->caption) == '\0' && !w->caption_entry)
D_RETURN_(4);
- }
- if (!caption_style) {
- caption_style = gib_style_new("caption");
- caption_style->bits = gib_list_add_front(caption_style->bits, gib_style_bit_new(0, 0, 0, 0, 0, 0));
- caption_style->bits = gib_list_add_front(caption_style->bits, gib_style_bit_new(1, 1, 0, 0, 0, 255));
- }
+ caption_style = gib_style_new("caption");
+ caption_style->bits = gib_list_add_front(caption_style->bits,
+ gib_style_bit_new(0, 0, 0, 0, 0, 0));
+ caption_style->bits = gib_list_add_front(caption_style->bits,
+ gib_style_bit_new(1, 1, 0, 0, 0, 255));
if (!fn) {
memset(atab, 0, sizeof(atab));
@@ -748,7 +746,13 @@ void feh_draw_caption(winwidget w)
D_RETURN_(4);
}
- lines = feh_wrap_string(file->caption, w->w, fn, NULL);
+ if (*(file->caption) == '\0') {
+ p = estrdup("Caption entry mode - Hit ESC to cancel");
+ lines = feh_wrap_string(p, w->w, fn, NULL);
+ free(p);
+ } else
+ lines = feh_wrap_string(file->caption, w->w, fn, NULL);
+
if (!lines)
D_RETURN_(4);
@@ -786,11 +790,15 @@ void feh_draw_caption(winwidget w)
p = (char *) l->data;
gib_imlib_get_text_size(fn, p, caption_style, &ww, &hh, IMLIB_TEXT_TO_RIGHT);
x = (tw - ww) / 2;
- if (w->caption_entry) {
- gib_imlib_text_draw(im, fn, caption_style, x, y, p, IMLIB_TEXT_TO_RIGHT, 255, 255, 0, 255);
- } else {
- gib_imlib_text_draw(im, fn, caption_style, x, y, p, IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255);
- }
+ if (w->caption_entry && (*(file->caption) == '\0'))
+ gib_imlib_text_draw(im, fn, caption_style, x, y, p,
+ IMLIB_TEXT_TO_RIGHT, 255, 255, 127, 255);
+ else if (w->caption_entry)
+ gib_imlib_text_draw(im, fn, caption_style, x, y, p,
+ IMLIB_TEXT_TO_RIGHT, 255, 255, 0, 255);
+ else
+ gib_imlib_text_draw(im, fn, caption_style, x, y, p,
+ IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255);
y += hh + 1; /* line spacing */
l = l->next;