Allow to set image overlay info position through options:
authorLaurent Monin <geeqie@norz.org>
Thu, 12 Jun 2008 20:33:51 +0000 (20:33 +0000)
committerLaurent Monin <geeqie@norz.org>
Thu, 12 Jun 2008 20:33:51 +0000 (20:33 +0000)
- image_overlay.common.x
- image_overlay.common.y

For now, there are only editable through rc file.

src/image-overlay.c
src/options.c
src/options.h
src/rcfile.c

index f27938f..975c9f4 100644 (file)
@@ -42,6 +42,9 @@ struct _OverlayStateData {
        OsdShowFlags show;
 
        gint ovl_info;
+       
+       gint x;
+       gint y;
 
        gint icon_time[IMAGE_OSD_COUNT];
        gint icon_id[IMAGE_OSD_COUNT];
@@ -73,9 +76,6 @@ static OSDIcon osd_icons[] = {
 
 #define OSD_DATA "overlay-data"
 
-#define OSD_INFO_X 10
-#define OSD_INFO_Y -10
-
 #define IMAGE_OSD_DEFAULT_DURATION 30
 
 #define HISTOGRAM_HEIGHT 140
@@ -761,11 +761,11 @@ static gint image_osd_update_cb(gpointer data)
                                if (osd->ovl_info == 0)
                                        {
                                        osd->ovl_info = image_overlay_add(osd->imd, pixbuf,
-                                                                         OSD_INFO_X, OSD_INFO_Y, TRUE, FALSE);
+                                                                         osd->x, osd->y, TRUE, FALSE);
                                        }
                                else
                                        {
-                                       image_overlay_set(osd->imd, osd->ovl_info, pixbuf, OSD_INFO_X, OSD_INFO_Y);
+                                       image_overlay_set(osd->imd, osd->ovl_info, pixbuf, osd->x, osd->y);
                                        }
                                g_object_unref(pixbuf);
                                }
@@ -970,7 +970,9 @@ static void image_osd_enable(ImageWindow *imd, OsdShowFlags show)
                osd->timer_id = -1;
                osd->show = OSD_SHOW_NOTHING;
                osd->histogram = NULL;
-
+               osd->x = options->image_overlay.common.x;
+               osd->y = options->image_overlay.common.y;
+               
                osd->destroy_id = g_signal_connect(G_OBJECT(imd->pr), "destroy",
                                                   G_CALLBACK(image_osd_destroy_cb), osd);
                image_set_osd_data(imd, osd);
index 2d2604a..5442314 100644 (file)
@@ -86,6 +86,8 @@ ConfOptions *init_options(ConfOptions *options)
        options->image_overlay.common.state = (guint)OSD_SHOW_NOTHING;
        options->image_overlay.common.show_at_startup = FALSE;
        options->image_overlay.common.template_string = NULL;
+       options->image_overlay.common.x = 10;
+       options->image_overlay.common.y = -10;
 
        options->layout.dir_view_type = DIRVIEW_LIST;
        options->layout.file_view_type = FILEVIEW_LIST;
index 6f5d0d0..142c3a9 100644 (file)
@@ -150,6 +150,8 @@ struct _ConfOptions
                        guint state;
                        gint show_at_startup;
                        gchar *template_string;
+                       gint x;
+                       gint y;
                } common;
        } image_overlay;
 
index 96620fa..669f9fd 100644 (file)
@@ -491,6 +491,8 @@ static gboolean save_options_to(const gchar *utf8_path, ConfOptions *options)
        WRITE_UINT(image_overlay.common.state);
        WRITE_BOOL(image_overlay.common.show_at_startup);
        WRITE_CHAR(image_overlay.common.template_string);
+       WRITE_INT(image_overlay.common.x);
+       WRITE_INT(image_overlay.common.y);
 
 
        WRITE_SUBTITLE("Slideshow Options");
@@ -841,6 +843,10 @@ static gboolean load_options_from(const gchar *utf8_path, ConfOptions *options)
                COMPAT_READ_CHAR(fullscreen.info, image_overlay.common.template_string); /* 2008-04-21 */
                READ_CHAR(image_overlay.common.template_string);
 
+               READ_INT(image_overlay.common.x);
+               READ_INT(image_overlay.common.y);
+
+
                /* slideshow options */
                READ_INT_UNIT(slideshow.delay, SLIDESHOW_SUBSECOND_PRECISION);
                READ_BOOL(slideshow.random);