Remove commented out code.
[geeqie.git] / src / image.c
index 2ee7528..aaf9873 100644 (file)
@@ -345,9 +345,6 @@ static gboolean image_post_process_color(ImageWindow *imd, gint start_row, gbool
                        }
 
                imd->cm = (gpointer)cm;
-#if 0
-               if (run_in_bg) color_man_start_bg(imd->cm, image_post_process_color_cb, imd);
-#endif
                }
 
        image_update_util(imd);
@@ -1166,7 +1163,7 @@ static void image_loader_sync_data(ImageLoader *il, gpointer old_data, gpointer
 /* this is more like a move function
  * it moves most data from source to imd
  */
-void image_change_from_image(ImageWindow *imd, ImageWindow *source)
+void image_move_from_image(ImageWindow *imd, ImageWindow *source)
 {
        if (imd == source) return;
 
@@ -1192,6 +1189,47 @@ void image_change_from_image(ImageWindow *imd, ImageWindow *source)
                source->delay_alter_type = ALTER_NONE;
                }
 
+       imd->color_profile_enable = source->color_profile_enable;
+       imd->color_profile_input = source->color_profile_input;
+       imd->color_profile_use_image = source->color_profile_use_image;
+       color_man_free((ColorMan *)imd->cm);
+       imd->cm = NULL;
+
+       file_data_unref(imd->read_ahead_fd);
+       source->read_ahead_fd = NULL;
+
+       imd->orientation = source->orientation;
+       imd->desaturate = source->desaturate;
+
+       imd->user_stereo = source->user_stereo;
+
+       pixbuf_renderer_move(PIXBUF_RENDERER(imd->pr), PIXBUF_RENDERER(source->pr));
+
+       if (imd->cm || imd->desaturate)
+               pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) );
+       else
+               pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, TRUE);
+
+}
+
+/* this is  a copy function
+ * source stays unchanged
+ */
+void image_copy_from_image(ImageWindow *imd, ImageWindow *source)
+{
+       if (imd == source) return;
+
+       imd->unknown = source->unknown;
+
+       imd->collection = source->collection;
+       imd->collection_info = source->collection_info;
+
+       image_loader_free(imd->il);
+       imd->il = NULL;
+
+       image_set_fd(imd, image_get_fd(source));
+
+
        imd->color_profile_enable = source->color_profile_enable;
        imd->color_profile_input = source->color_profile_input;
        imd->color_profile_use_image = source->color_profile_use_image;
@@ -1227,7 +1265,7 @@ void image_change_from_image(ImageWindow *imd, ImageWindow *source)
 
        imd->user_stereo = source->user_stereo;
 
-       pixbuf_renderer_move(PIXBUF_RENDERER(imd->pr), PIXBUF_RENDERER(source->pr));
+       pixbuf_renderer_copy(PIXBUF_RENDERER(imd->pr), PIXBUF_RENDERER(source->pr));
 
        if (imd->cm || imd->desaturate)
                pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) );
@@ -1236,6 +1274,7 @@ void image_change_from_image(ImageWindow *imd, ImageWindow *source)
 
 }
 
+
 /* manipulation */
 
 void image_area_changed(ImageWindow *imd, gint x, gint y, gint width, gint height)
@@ -1655,9 +1694,6 @@ static void image_options_set(ImageWindow *imd)
        g_object_set(G_OBJECT(imd->pr), "zoom_quality", options->image.zoom_quality,
                                        "zoom_2pass", options->image.zoom_2pass,
                                        "zoom_expand", options->image.zoom_to_fit_allow_expand,
-#if !GTK_CHECK_VERSION(3,0,0)
-                                       "dither_quality", options->image.dither_quality,
-#endif
                                        "scroll_reset", options->image.scroll_reset_method,
                                        "cache_display", options->image.tile_cache_max,
                                        "window_fit", (imd->top_window_sync && options->image.fit_window_to_image),
@@ -1723,12 +1759,42 @@ static void image_destroy_cb(GtkWidget *widget, gpointer data)
        ImageWindow *imd = data;
        image_free(imd);
 }
+#if GTK_CHECK_VERSION(3,0,0)   
+gboolean selectable_frame_draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data)
+{
+       GtkAllocation allocation;
+       gtk_widget_get_allocation(widget, &allocation);
+       gtk_paint_flat_box(gtk_widget_get_style(widget),
+                          cr,
+                          gtk_widget_get_state(widget),
+                          gtk_frame_get_shadow_type(GTK_FRAME(widget)),
+                          widget,
+                          NULL,
+                          allocation.x + 3, allocation.y + 3,
+                          allocation.width - 6, allocation.height - 6);
+
+       if (gtk_widget_has_focus(widget))
+               {
+               gtk_paint_focus(gtk_widget_get_style(widget), cr, GTK_STATE_ACTIVE,
+                               widget, "image_window",
+                               allocation.x, allocation.y,
+                               allocation.width - 1, allocation.height - 1);
+               }
+       else
+               {
+               gtk_paint_shadow(gtk_widget_get_style(widget), cr, GTK_STATE_NORMAL, GTK_SHADOW_IN,
+                                widget, "image_window",
+                                allocation.x, allocation.y,
+                                allocation.width - 1, allocation.height - 1);
+               }
+       return FALSE;
+}
 
+#else
 gboolean selectable_frame_expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
 {
        GtkAllocation allocation;
        gtk_widget_get_allocation(widget, &allocation);
-#if !GTK_CHECK_VERSION(3,0,0)  
        gtk_paint_flat_box(gtk_widget_get_style(widget),
                           gtk_widget_get_window(widget),
                           gtk_widget_get_state(widget),
@@ -1753,9 +1819,9 @@ gboolean selectable_frame_expose_cb(GtkWidget *widget, GdkEventExpose *event, gp
                                 allocation.x, allocation.y,
                                 allocation.width - 1, allocation.height - 1);
                }
-#endif
        return FALSE;
 }
+#endif
 
 
 void image_set_frame(ImageWindow *imd, gboolean frame)
@@ -1769,59 +1835,39 @@ void image_set_frame(ImageWindow *imd, gboolean frame)
        if (frame)
                {
                imd->frame = gtk_frame_new(NULL);
-#if GTK_CHECK_VERSION(2,12,0)
                g_object_ref(imd->pr);
-#else
-               gtk_widget_ref(imd->pr);
-#endif
                if (imd->has_frame != -1) gtk_container_remove(GTK_CONTAINER(imd->widget), imd->pr);
                gtk_container_add(GTK_CONTAINER(imd->frame), imd->pr);
 
-#if GTK_CHECK_VERSION(2,12,0)
                g_object_unref(imd->pr);
-#else
-               gtk_widget_unref(imd->pr);
-#endif
                gtk_widget_set_can_focus(imd->frame, TRUE);
                gtk_widget_set_app_paintable(imd->frame, TRUE);
                
+#if GTK_CHECK_VERSION(3,0,0)   
+               g_signal_connect(G_OBJECT(imd->frame), "draw",
+                                G_CALLBACK(selectable_frame_draw_cb), NULL);
+#else
                g_signal_connect(G_OBJECT(imd->frame), "expose_event",
                                 G_CALLBACK(selectable_frame_expose_cb), NULL);
-
+#endif
                g_signal_connect(G_OBJECT(imd->frame), "focus_in_event",
                                 G_CALLBACK(image_focus_in_cb), imd);
 
-#if GTK_CHECK_VERSION(2,14,0)
                gtk_box_pack_start(GTK_BOX(imd->widget), imd->frame, TRUE, TRUE, 0);
-#else
-               gtk_box_pack_start_defaults(GTK_BOX(imd->widget), imd->frame);
-#endif
                gtk_widget_show(imd->frame);
                }
        else
                {
-#if GTK_CHECK_VERSION(2,12,0)
                g_object_ref(imd->pr);
-#else
-               gtk_widget_ref(imd->pr);
-#endif
                if (imd->frame)
                        {
                        gtk_container_remove(GTK_CONTAINER(imd->frame), imd->pr);
                        gtk_widget_destroy(imd->frame);
                        imd->frame = NULL;
                        }
-#if GTK_CHECK_VERSION(2,14,0)
                gtk_box_pack_start(GTK_BOX(imd->widget), imd->pr, TRUE, TRUE, 0);
-#else
-               gtk_box_pack_start_defaults(GTK_BOX(imd->widget), imd->pr);
-#endif
 
-#if GTK_CHECK_VERSION(2,12,0)
                g_object_unref(imd->pr);
-#else
-               gtk_widget_unref(imd->pr);
-#endif
                }
 
        gtk_widget_show(imd->pr);