CTABLE_COLUMN_COUNT
};
-typedef enum {
- SELECTION_NONE = 0,
- SELECTION_SELECTED = 1 << 0,
- SELECTION_PRELIGHT = 1 << 1,
- SELECTION_FOCUS = 1 << 2
-} SelectionType;
-
-
#define INFO_SELECTED(x) (x->flag_mask & SELECTION_SELECTED)
}
-void image_alter_orientation(ImageWindow *imd, AlterType type)
+void image_alter_orientation(ImageWindow *imd, FileData *fd_n, AlterType type)
{
static const gint rotate_90[] = {1, 6, 7, 8, 5, 2, 3, 4, 1};
static const gint rotate_90_cc[] = {1, 8, 5, 6, 7, 4, 1, 2, 3};
static const gint mirror[] = {1, 2, 1, 4, 3, 6, 5, 8, 7};
static const gint flip[] = {1, 4, 3, 2, 1, 8, 7, 6, 5};
+ gint orientation;
- if (!imd || !imd->pr || !imd->image_fd) return;
+ if (!imd || !imd->pr || !imd->image_fd || !fd_n) return;
- if (imd->orientation < 1 || imd->orientation > 8) imd->orientation = 1;
+ orientation = EXIF_ORIENTATION_TOP_LEFT;
+ {
+ if (fd_n->user_orientation)
+ {
+ orientation = fd_n->user_orientation;
+ }
+ else
+ if (options->metadata.write_orientation)
+ {
+ orientation = metadata_read_int(fd_n, ORIENTATION_KEY, EXIF_ORIENTATION_TOP_LEFT);
+ }
+ }
switch (type)
{
case ALTER_ROTATE_90:
- imd->orientation = rotate_90[imd->orientation];
+ orientation = rotate_90[orientation];
break;
case ALTER_ROTATE_90_CC:
- imd->orientation = rotate_90_cc[imd->orientation];
+ orientation = rotate_90_cc[orientation];
break;
case ALTER_ROTATE_180:
- imd->orientation = rotate_180[imd->orientation];
+ orientation = rotate_180[orientation];
break;
case ALTER_MIRROR:
- imd->orientation = mirror[imd->orientation];
+ orientation = mirror[orientation];
break;
case ALTER_FLIP:
- imd->orientation = flip[imd->orientation];
+ orientation = flip[orientation];
break;
case ALTER_NONE:
- imd->orientation = imd->image_fd->exif_orientation ? imd->image_fd->exif_orientation : 1;
+ orientation = fd_n->exif_orientation ? fd_n->exif_orientation : 1;
break;
default:
return;
break;
}
- if (imd->orientation != (imd->image_fd->exif_orientation ? imd->image_fd->exif_orientation : 1))
+ if (orientation != (fd_n->exif_orientation ? fd_n->exif_orientation : 1))
{
if (!options->metadata.write_orientation)
{
we must however handle switching metadata.write_orientation on and off, therefore
we just disable referencing new fd's, not unreferencing the old ones
*/
- if (imd->image_fd->user_orientation == 0) file_data_ref(imd->image_fd);
- imd->image_fd->user_orientation = imd->orientation;
+ if (fd_n->user_orientation == 0) file_data_ref(fd_n);
+ fd_n->user_orientation = orientation;
}
}
else
{
- if (imd->image_fd->user_orientation != 0) file_data_unref(imd->image_fd);
- imd->image_fd->user_orientation = 0;
+ if (fd_n->user_orientation != 0) file_data_unref(fd_n);
+ fd_n->user_orientation = 0;
}
if (options->metadata.write_orientation)
{
if (type == ALTER_NONE)
{
- metadata_write_revert(imd->image_fd, ORIENTATION_KEY);
+ metadata_write_revert(fd_n, ORIENTATION_KEY);
}
else
{
- metadata_write_int(imd->image_fd, ORIENTATION_KEY, imd->orientation);
+ metadata_write_int(fd_n, ORIENTATION_KEY, orientation);
}
}
- pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation);
+ if (imd->image_fd == fd_n && !(options->metadata.write_orientation && !options->image.exif_rotate_enable))
+ {
+ imd->orientation = orientation;
+ pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, orientation);
+ }
}
void image_set_desaturate(ImageWindow *imd, gboolean desaturate)
gdouble x_align, gdouble y_align);
void image_get_scroll_center(ImageWindow *imd, gdouble *x, gdouble *y);
void image_set_scroll_center(ImageWindow *imd, gdouble x, gdouble y);
-void image_alter_orientation(ImageWindow *imd, AlterType type);
+void image_alter_orientation(ImageWindow *imd, FileData *fd, AlterType type);
void image_set_desaturate(ImageWindow *imd, gboolean desaturate);
gboolean image_get_desaturate(ImageWindow *imd);
switch (event->keyval)
{
case 'R': case 'r':
- image_alter_orientation(imd, ALTER_ROTATE_180);
+ image_alter_orientation(imd, imd->image_fd, ALTER_ROTATE_180);
break;
case 'M': case 'm':
- image_alter_orientation(imd, ALTER_MIRROR);
+ image_alter_orientation(imd, imd->image_fd, ALTER_MIRROR);
break;
case 'F': case 'f':
- image_alter_orientation(imd, ALTER_FLIP);
+ image_alter_orientation(imd, imd->image_fd, ALTER_FLIP);
break;
case 'G': case 'g':
image_set_desaturate(imd, !image_get_desaturate(imd));
view_overlay_toggle(vw);
break;
case ']':
- image_alter_orientation(imd, ALTER_ROTATE_90);
+ image_alter_orientation(imd, imd->image_fd, ALTER_ROTATE_90);
break;
case '[':
- image_alter_orientation(imd, ALTER_ROTATE_90_CC);
+ image_alter_orientation(imd, imd->image_fd, ALTER_ROTATE_90_CC);
break;
case GDK_KEY_Delete: case GDK_KEY_KP_Delete:
if (options->file_ops.enable_delete_key)
type = GPOINTER_TO_INT(data);
if (!vw) return;
- image_alter_orientation(vw->imd, type);
+ image_alter_orientation(vw->imd, vw->imd->image_fd, type);
}
static void view_wallpaper_cb(GtkWidget *widget, gpointer data)
#include <gdk/gdkkeysyms.h> /* for keyboard values */
+#define FILE_COLUMN_POINTER 0
static GtkWidget *layout_image_pop_menu(LayoutWindow *lw);
static void layout_image_set_buttons(LayoutWindow *lw);
lw = submenu_item_get_data(widget);
type = (AlterType)GPOINTER_TO_INT(data);
- image_alter_orientation(lw->image, type);
+ image_alter_orientation(lw->image, lw->image->image_fd, type);
}
static void li_pop_menu_new_cb(GtkWidget *widget, gpointer data)
{
if (!layout_valid(&lw)) return;
- image_alter_orientation(lw->image, type);
+ GtkTreeModel *store;
+ GList *work;
+ GtkTreeSelection *selection;
+ GtkTreePath *tpath;
+ FileData *fd_n;
+ GtkTreeIter iter;
+ IconData *id;
+
+ if (!lw || !lw->vf) return;
+
+ if (lw->vf->type == FILEVIEW_ICON)
+ {
+ if (!VFICON(lw->vf)->selection) return;
+ work = VFICON(lw->vf)->selection;
+ }
+ else
+ {
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(lw->vf->listview));
+ work = gtk_tree_selection_get_selected_rows(selection, &store);
+ }
+
+ while (work)
+ {
+ if (lw->vf->type == FILEVIEW_ICON)
+ {
+ id = work->data;
+ fd_n = id->fd;
+ work = work->next;
+ }
+ else
+ {
+ tpath = work->data;
+ gtk_tree_model_get_iter(store, &iter, tpath);
+ gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd_n, -1);
+ work = work->next;
+ }
+
+ image_alter_orientation(lw->image, fd_n, type);
+ }
}
void layout_image_reset_orientation(LayoutWindow *lw)
guint select_idle_id; /* event source id */
};
-struct _IconData;
+typedef enum {
+ SELECTION_NONE = 0,
+ SELECTION_SELECTED = 1 << 0,
+ SELECTION_PRELIGHT = 1 << 1,
+ SELECTION_FOCUS = 1 << 2
+} SelectionType;
+
+typedef struct _IconData IconData;
+struct _IconData
+{
+ SelectionType selected;
+ FileData *fd;
+};
struct _ViewFileInfoIcon
{
FILE_COLUMN_COUNT
};
-typedef enum {
- SELECTION_NONE = 0,
- SELECTION_SELECTED = 1 << 0,
- SELECTION_PRELIGHT = 1 << 1,
- SELECTION_FOCUS = 1 << 2
-} SelectionType;
-
-typedef struct _IconData IconData;
-struct _IconData
-{
- SelectionType selected;
- FileData *fd;
-};
-
static gint vficon_index_by_id(ViewFile *vf, IconData *in_id);
static IconData *vficon_icon_data(ViewFile *vf, FileData *fd)