static void pr_signals_connect(PixbufRenderer *pr);
static void pr_size_cb(GtkWidget *widget, GtkAllocation *allocation, gpointer data);
static void pixbuf_renderer_paint(PixbufRenderer *pr, GdkRectangle *area);
+static void pr_stereo_temp_disable(PixbufRenderer *pr, gboolean disable);
/*
{
gboolean zoom_changed = FALSE;
- gint new_viewport_width = (pr->stereo_mode & PR_STEREO_HORIZ) ? new_width / 2 : new_width;
- gint new_viewport_height = (pr->stereo_mode & PR_STEREO_VERT) ? new_height / 2 : new_height;
+ gint new_viewport_width = (!pr->stereo_temp_disable && (pr->stereo_mode & PR_STEREO_HORIZ)) ? new_width / 2 : new_width;
+ gint new_viewport_height =(!pr->stereo_temp_disable && (pr->stereo_mode & PR_STEREO_VERT)) ? new_height / 2 : new_height;
if (pr->window_width == new_width && pr->window_height == new_height &&
pr->viewport_width == new_viewport_width && pr->viewport_height == new_viewport_height) return;
return;
}
+ if (pr->stereo_mode & PR_STEREO_TEMP_DISABLE)
+ {
+ gint disable = !pr->pixbuf || ! GPOINTER_TO_INT(g_object_get_data(G_OBJECT(pr->pixbuf), "stereo_data"));
+ pr_stereo_temp_disable(pr, disable);
+ }
+
pr_pixbuf_size_sync(pr);
pr_zoom_sync(pr, zoom, flags | PR_ZOOM_FORCE | PR_ZOOM_NEW, 0, 0);
}
}
}
-void pixbuf_renderer_stereo_set(PixbufRenderer *pr, gint stereo_mode)
+static void pr_stereo_set(PixbufRenderer *pr)
{
- gboolean redraw = !(pr->stereo_mode == stereo_mode);
- pr->stereo_mode = stereo_mode;
-
if (!pr->renderer) pr->renderer = (void *)renderer_tiles_new(pr);
- pr->renderer->stereo_set(pr->renderer, pr->stereo_mode);
+ pr->renderer->stereo_set(pr->renderer, pr->stereo_mode & ~PR_STEREO_MIRROR_RIGHT & ~PR_STEREO_FLIP_RIGHT);
if (pr->stereo_mode & (PR_STEREO_HORIZ | PR_STEREO_VERT))
{
if (!pr->renderer2) pr->renderer2 = (void *)renderer_tiles_new(pr);
- pr->renderer2->stereo_set(pr->renderer2, pr->stereo_mode | PR_STEREO_RIGHT);
+ pr->renderer2->stereo_set(pr->renderer2, pr->stereo_mode & ~PR_STEREO_MIRROR_LEFT & ~PR_STEREO_FLIP_LEFT | PR_STEREO_RIGHT);
}
else
{
if (pr->renderer2) pr->renderer2->free(pr->renderer2);
pr->renderer2 = NULL;
}
+}
+
+void pixbuf_renderer_stereo_set(PixbufRenderer *pr, gint stereo_mode)
+{
+ gboolean redraw = !(pr->stereo_mode == stereo_mode) || pr->stereo_temp_disable;
+ pr->stereo_mode = stereo_mode;
+ if ((stereo_mode & PR_STEREO_TEMP_DISABLE) && pr->stereo_temp_disable) return;
+
+ pr->stereo_temp_disable = FALSE;
+
+ pr_stereo_set(pr);
+
if (redraw)
{
pr_size_sync(pr, pr->window_width, pr->window_height); /* recalculate new viewport */
}
}
+
gint pixbuf_renderer_stereo_get(PixbufRenderer *pr)
{
return pr->stereo_mode;
}
+static void pr_stereo_temp_disable(PixbufRenderer *pr, gboolean disable)
+{
+ if (pr->stereo_temp_disable == disable) return;
+ pr->stereo_temp_disable = disable;
+ if (disable)
+ {
+ if (!pr->renderer) pr->renderer = (void *)renderer_tiles_new(pr);
+ pr->renderer->stereo_set(pr->renderer, PR_STEREO_NONE);
+ if (pr->renderer2) pr->renderer2->free(pr->renderer2);
+ pr->renderer2 = NULL;
+ }
+ else
+ {
+ pr_stereo_set(pr);
+ }
+ pr_size_sync(pr, pr->window_width, pr->window_height); /* recalculate new viewport */
+}
+
gboolean pixbuf_renderer_get_pixel_colors(PixbufRenderer *pr, gint x_pixel, gint y_pixel,
gint *r_mouse, gint *g_mouse, gint *b_mouse)
{
options->metadata.confirm_on_dir_change = c_options->metadata.confirm_on_dir_change;
options->metadata.keywords_case_sensitive = c_options->metadata.keywords_case_sensitive;
options->metadata.write_orientation = c_options->metadata.write_orientation;
-
- options->stereo.mode = c_options->stereo.mode;
- options->stereo.fallback = c_options->stereo.fallback;
- options->stereo.fsmode = c_options->stereo.fsmode;
+ options->stereo.mode = (c_options->stereo.mode & (PR_STEREO_HORIZ | PR_STEREO_VERT | PR_STEREO_FIXED | PR_STEREO_ANAGLYPH)) |
+ (c_options->stereo.tmp.mirror_right ? PR_STEREO_MIRROR_RIGHT : 0) |
+ (c_options->stereo.tmp.flip_right ? PR_STEREO_FLIP_RIGHT : 0) |
+ (c_options->stereo.tmp.mirror_left ? PR_STEREO_MIRROR_LEFT : 0) |
+ (c_options->stereo.tmp.flip_left ? PR_STEREO_FLIP_LEFT : 0) |
+ (c_options->stereo.tmp.swap ? PR_STEREO_SWAP : 0) |
+ (c_options->stereo.tmp.temp_disable ? PR_STEREO_TEMP_DISABLE : 0);
+ options->stereo.fsmode = (c_options->stereo.fsmode & (PR_STEREO_HORIZ | PR_STEREO_VERT | PR_STEREO_FIXED | PR_STEREO_ANAGLYPH)) |
+ (c_options->stereo.tmp.fs_mirror_right ? PR_STEREO_MIRROR_RIGHT : 0) |
+ (c_options->stereo.tmp.fs_flip_right ? PR_STEREO_FLIP_RIGHT : 0) |
+ (c_options->stereo.tmp.fs_mirror_left ? PR_STEREO_MIRROR_LEFT : 0) |
+ (c_options->stereo.tmp.fs_flip_left ? PR_STEREO_FLIP_LEFT : 0) |
+ (c_options->stereo.tmp.fs_swap ? PR_STEREO_SWAP : 0) |
+ (c_options->stereo.tmp.fs_temp_disable ? PR_STEREO_TEMP_DISABLE : 0);
options->stereo.enable_fsmode = c_options->stereo.enable_fsmode;
options->stereo.fixed_w = c_options->stereo.fixed_w;
options->stereo.fixed_h = c_options->stereo.fixed_h;
combo = gtk_combo_box_new_text();
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Single image"));
- if (option == PR_STEREO_NONE) current = 0;
+
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Anaglyph"));
- if (option == PR_STEREO_ANAGLYPH) current = 1;
+ if (option & PR_STEREO_ANAGLYPH) current = 1;
+
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Side by Side"));
- if (option == PR_STEREO_HORIZ) current = 2;
+ if (option & PR_STEREO_HORIZ) current = 2;
+
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Above - below"));
- if (option == PR_STEREO_VERT) current = 3;
+ if (option & PR_STEREO_VERT) current = 3;
if (add_fixed)
{
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Fixed position"));
- if (option == PR_STEREO_FIXED) current = 4;
+ if (option & PR_STEREO_FIXED) current = 4;
}
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), current);
table = pref_table_new(group, 2, 1, FALSE, FALSE);
add_stereo_mode_menu(table, 0, 0, _("Windowed stereo mode"), options->stereo.mode, &c_options->stereo.mode, FALSE);
- pref_checkbox_new_int(group, _("Fall back to single image mode on 2d"),
- options->stereo.fallback, &c_options->stereo.fallback);
+ pref_checkbox_new_int(group, _("Mirror left image"),
+ options->stereo.mode & PR_STEREO_MIRROR_LEFT, &c_options->stereo.tmp.mirror_left);
+ pref_checkbox_new_int(group, _("Flip left image"),
+ options->stereo.mode & PR_STEREO_FLIP_LEFT, &c_options->stereo.tmp.flip_left);
+ pref_checkbox_new_int(group, _("Mirror right image"),
+ options->stereo.mode & PR_STEREO_MIRROR_RIGHT, &c_options->stereo.tmp.mirror_right);
+ pref_checkbox_new_int(group, _("Flip right image"),
+ options->stereo.mode & PR_STEREO_FLIP_RIGHT, &c_options->stereo.tmp.flip_right);
+ pref_checkbox_new_int(group, _("Swap left and right images"),
+ options->stereo.mode & PR_STEREO_SWAP, &c_options->stereo.tmp.swap);
+ pref_checkbox_new_int(group, _("Disable stereo mode on single image source"),
+ options->stereo.mode & PR_STEREO_TEMP_DISABLE, &c_options->stereo.tmp.temp_disable);
group = pref_group_new(vbox, FALSE, _("Fullscreen stereo mode"), GTK_ORIENTATION_VERTICAL);
pref_checkbox_new_int(group, _("Use different settings for fullscreen"),
options->stereo.enable_fsmode, &c_options->stereo.enable_fsmode);
table = pref_table_new(group, 2, 1, FALSE, FALSE);
add_stereo_mode_menu(table, 0, 0, _("Fullscreen stereo mode"), options->stereo.fsmode, &c_options->stereo.fsmode, TRUE);
+ pref_checkbox_new_int(group, _("Mirror left image"),
+ options->stereo.fsmode & PR_STEREO_MIRROR_LEFT, &c_options->stereo.tmp.fs_mirror_left);
+ pref_checkbox_new_int(group, _("Flip left image"),
+ options->stereo.fsmode & PR_STEREO_FLIP_LEFT, &c_options->stereo.tmp.fs_flip_left);
+ pref_checkbox_new_int(group, _("Mirror right image"),
+ options->stereo.fsmode & PR_STEREO_MIRROR_RIGHT, &c_options->stereo.tmp.fs_mirror_right);
+ pref_checkbox_new_int(group, _("Flip right image"),
+ options->stereo.fsmode & PR_STEREO_FLIP_RIGHT, &c_options->stereo.tmp.fs_flip_right);
+ pref_checkbox_new_int(group, _("Swap left and right images"),
+ options->stereo.fsmode & PR_STEREO_SWAP, &c_options->stereo.tmp.fs_swap);
+ pref_checkbox_new_int(group, _("Disable stereo mode on single image source"),
+ options->stereo.fsmode & PR_STEREO_TEMP_DISABLE, &c_options->stereo.tmp.fs_temp_disable);
}
} ToolbarType;
typedef enum {
- PR_STEREO_NONE = 0, /* do nothing */
- PR_STEREO_DUAL = 1 << 0, /* independent stereo buffers, for example nvidia opengl */
- PR_STEREO_HORIZ = 1 << 2, /* side by side */
- PR_STEREO_VERT = 1 << 3, /* above below */
- PR_STEREO_FIXED = 1 << 1, /* custom position */
- /* flags for renderer: */
- PR_STEREO_RIGHT = 1 << 4, /* render right buffer */
- PR_STEREO_ANAGLYPH = 1 << 5, /* anaglyph */
- PR_STEREO_MIRROR = 1 << 6, /* mirror */
- PR_STEREO_FLIP = 1 << 7, /* flip */
- PR_STEREO_SWAP = 1 << 8 /* swap left and right buffers */
+ PR_STEREO_NONE = 0, /* do nothing */
+ PR_STEREO_DUAL = 1 << 0, /* independent stereo buffers, for example nvidia opengl */
+ PR_STEREO_FIXED = 1 << 1, /* custom position */
+ PR_STEREO_HORIZ = 1 << 2, /* side by side */
+ PR_STEREO_VERT = 1 << 3, /* above below */
+ PR_STEREO_RIGHT = 1 << 4, /* render right buffer */
+ PR_STEREO_ANAGLYPH = 1 << 5, /* anaglyph */
+
+ PR_STEREO_MIRROR_LEFT = 1 << 6, /* mirror */
+ PR_STEREO_FLIP_LEFT = 1 << 7, /* flip */
+
+ PR_STEREO_MIRROR_RIGHT = 1 << 8, /* mirror */
+ PR_STEREO_FLIP_RIGHT = 1 << 9, /* flip */
+
+ PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /* mirror mask*/
+ PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /* flip mask*/
+ PR_STEREO_SWAP = 1 << 10, /* swap left and right buffers */
+ PR_STEREO_TEMP_DISABLE = 1 << 11 /* temporarily disable stereo mode if source image is not stereo */
} PixbufRendererStereoMode;