Add an option to Image preferences to restrict custom border to fullscreen mode only...
authorLaurent Monin <geeqie@norz.org>
Thu, 4 Jun 2009 19:51:20 +0000 (19:51 +0000)
committerLaurent Monin <geeqie@norz.org>
Thu, 4 Jun 2009 19:51:20 +0000 (19:51 +0000)
src/fullscreen.c
src/image.c
src/image.h
src/img-view.c
src/layout.c
src/layout_image.c
src/options.c
src/options.h
src/preferences.c
src/rcfile.c

index 2782c40..49f0197 100644 (file)
@@ -291,11 +291,7 @@ FullScreenData *fullscreen_start(GtkWidget *window, ImageWindow *imd,
 
        gtk_container_add(GTK_CONTAINER(fs->window), fs->imd->widget);
 
-       if (options->image.use_custom_border_color)
-               {
-               image_background_set_color(fs->imd, &options->image.border_color);
-               }
-
+       image_background_set_color_from_options(fs->imd, TRUE);
        image_set_delay_flip(fs->imd, options->fullscreen.clean_flip);
        image_auto_refresh_enable(fs->imd, fs->normal_imd->auto_refresh);
 
index 71de933..4c5edc7 100644 (file)
@@ -1463,6 +1463,19 @@ void image_background_set_color(ImageWindow *imd, GdkColor *color)
        pixbuf_renderer_set_color((PixbufRenderer *)imd->pr, color);
 }
 
+void image_background_set_color_from_options(ImageWindow *imd, gboolean fullscreen)
+{
+       GdkColor *color = NULL;
+
+       if (options->image.use_custom_border_color
+           && (!options->image.custom_border_fullscreen_only || fullscreen))
+               {
+               color = &options->image.border_color;
+               }
+
+       image_background_set_color(imd, color);
+}
+
 void image_color_profile_set(ImageWindow *imd,
                             gint input_type,
                             gboolean use_image)
index 7f4811c..5746d46 100644 (file)
@@ -102,6 +102,7 @@ void image_top_window_set_sync(ImageWindow *imd, gboolean allow_sync);
 
 /* background of image */
 void image_background_set_color(ImageWindow *imd, GdkColor *color);
+void image_background_set_color_from_options(ImageWindow *imd, gboolean fullscreen);
 
 /* color profiles */
 void image_color_profile_set(ImageWindow *imd,
index afc0db7..12f3dc8 100644 (file)
@@ -848,7 +848,7 @@ static ViewWindow *real_view_window_new(FileData *fd, GList *list, CollectionDat
 
        vw->imd = image_new(FALSE);
 
-       image_background_set_color(vw->imd, options->image.use_custom_border_color ? &options->image.border_color : NULL);
+       image_background_set_color_from_options(vw->imd, FALSE);
 
        image_attach_window(vw->imd, vw->window, NULL, GQ_APPNAME, TRUE);
 
@@ -1002,8 +1002,8 @@ void view_window_colors_update(void)
                {
                ViewWindow *vw = work->data;
                work = work->next;
-
-               image_background_set_color(vw->imd, options->image.use_custom_border_color ? &options->image.border_color : NULL);
+               
+               image_background_set_color_from_options(vw->imd, !!vw->fs);
                }
 }
 
index ddaf540..85de627 100644 (file)
@@ -1611,11 +1611,19 @@ void layout_colors_update(void)
        work = layout_window_list;
        while (work)
                {
+               gint i;
                LayoutWindow *lw = work->data;
                work = work->next;
-
+               
                if (!lw->image) continue;
-               image_background_set_color(lw->image, options->image.use_custom_border_color ? &options->image.border_color : NULL);
+
+               for (i = 0; i < MAX_SPLIT_IMAGES; i++)
+                       {
+                       if (!lw->split_images[i]) continue;
+                       image_background_set_color_from_options(lw->split_images[i], !!lw->full_screen);
+                       }
+               
+               image_background_set_color_from_options(lw->image, !!lw->full_screen);
                }
 }
 
index af7e3e3..33b8f19 100644 (file)
@@ -1610,7 +1610,7 @@ GtkWidget *layout_image_new(LayoutWindow *lw, gint i)
                g_signal_connect(G_OBJECT(lw->split_images[i]->pr), "update-pixel",
                                 G_CALLBACK(layout_status_update_pixel_cb), lw);
 
-               image_background_set_color(lw->split_images[i], options->image.use_custom_border_color ? &options->image.border_color : NULL);
+               image_background_set_color_from_options(lw->split_images[i], FALSE);
 
                image_auto_refresh_enable(lw->split_images[i], TRUE);
 
index ce44223..dbe3867 100644 (file)
@@ -75,6 +75,7 @@ ConfOptions *init_options(ConfOptions *options)
        options->image.tile_cache_max = 10;
        options->image.image_cache_max = 128; /* 4 x 10MPix */
        options->image.use_custom_border_color = FALSE;
+       options->image.custom_border_fullscreen_only = FALSE;
        options->image.zoom_2pass = TRUE;
        options->image.zoom_increment = 5;
        options->image.zoom_mode = ZOOM_RESET_NONE;
index 72656fb..e3f596b 100644 (file)
@@ -68,7 +68,8 @@ struct _ConfOptions
                guint zoom_quality;
                gint zoom_increment;    /* 10 is 1.0, 5 is 0.05, 20 is 2.0, etc. */
 
-               gint use_custom_border_color;
+               gboolean custom_border_fullscreen_only;
+               gboolean use_custom_border_color;
                GdkColor border_color;
        } image;
 
index f1f0662..05039a0 100644 (file)
@@ -314,9 +314,12 @@ static void config_window_apply(void)
 
        options->image.enable_read_ahead = c_options->image.enable_read_ahead;
 
+       
        if (options->image.use_custom_border_color != c_options->image.use_custom_border_color
+           || options->image.custom_border_fullscreen_only != c_options->image.custom_border_fullscreen_only
            || !gdk_color_equal(&options->image.border_color, &c_options->image.border_color))
                {
+               options->image.custom_border_fullscreen_only = c_options->image.custom_border_fullscreen_only;
                options->image.use_custom_border_color = c_options->image.use_custom_border_color;
                options->image.border_color = c_options->image.border_color;
                layout_colors_update();
@@ -1333,6 +1336,9 @@ static void config_tab_image(GtkWidget *notebook)
 
        pref_checkbox_new_int(group, _("Custom border color"),
                              options->image.use_custom_border_color, &c_options->image.use_custom_border_color);
+       
+       pref_checkbox_new_int(group, _("Apply custom border to fullscreen mode only"),
+                             options->image.custom_border_fullscreen_only, &c_options->image.custom_border_fullscreen_only);
 
        pref_color_button_new(group, _("Border color"), &options->image.border_color,
                              G_CALLBACK(pref_color_button_set_cb), &c_options->image.border_color);
index cde5de8..7dc7229 100644 (file)
@@ -330,6 +330,7 @@ static void write_global_attributes(GString *outstr, gint indent)
        WRITE_NL(); WRITE_BOOL(*options, image.enable_read_ahead);
        WRITE_NL(); WRITE_BOOL(*options, image.exif_rotate_enable);
        WRITE_NL(); WRITE_BOOL(*options, image.use_custom_border_color);
+       WRITE_NL(); WRITE_BOOL(*options, image.custom_border_fullscreen_only);
        WRITE_NL(); WRITE_COLOR(*options, image.border_color);
 
 //     WRITE_SUBTITLE("Thumbnails Options");
@@ -613,6 +614,7 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar **
                if (READ_BOOL(*options, image.enable_read_ahead)) continue;
                if (READ_BOOL(*options, image.exif_rotate_enable)) continue;
                if (READ_BOOL(*options, image.use_custom_border_color)) continue;
+               if (READ_BOOL(*options, image.custom_border_fullscreen_only)) continue;
                if (READ_COLOR(*options, image.border_color)) continue;
 
                /* thumbnails options */