#include "color-man.h"
#include "dnd.h"
#include "editors.h"
+#include "exif.h"
#include "filedata.h"
#include "fullscreen.h"
#include "image.h"
#include "layout.h"
#include "layout_util.h"
#include "menu.h"
+#include "metadata.h"
#include "misc.h"
#include "pixbuf_util.h"
#include "pixbuf-renderer.h"
#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)
submenu = submenu_add_edit(menu, &item, G_CALLBACK(li_pop_menu_edit_cb), lw, editmenu_fd_list);
if (!path) gtk_widget_set_sensitive(item, FALSE);
menu_item_add_divider(submenu);
+#if !GTK_CHECK_VERSION(3,0,0)
menu_item_add(submenu, _("Set as _wallpaper"), G_CALLBACK(li_pop_menu_wallpaper_cb), lw);
-
+#endif
item = submenu_add_alter(menu, G_CALLBACK(li_pop_menu_alter_cb), lw);
item = menu_item_add_stock(menu, _("View in _new window"), GTK_STOCK_NEW, G_CALLBACK(li_pop_menu_new_cb), lw);
{
image_zoom_adjust_at_point(lw->full_screen->imd, increment, x, y);
}
-
- if (!connect_zoom) return;
+ if (!connect_zoom && !lw->split_mode) return;
for (i = 0; i < MAX_SPLIT_IMAGES; i++)
{
- if (lw->split_images[i] && lw->split_images[i] != lw->image)
+ if (lw->split_images[i] && lw->split_images[i] != lw->image &&
+ lw->split_images[i]->mouse_wheel_mode)
image_zoom_adjust_at_point(lw->split_images[i], increment, x, y);
}
}
{
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);
+ }
+}
+
+static void image_alter_rating(FileData *fd_n, const gchar *rating)
+{
+ metadata_write_string(fd_n, RATING_KEY, rating);
+}
+
+void layout_image_rating(LayoutWindow *lw, const gchar *rating)
+{
+ if (!layout_valid(&lw)) return;
+
+ 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_rating(fd_n, rating);
+ }
+}
+
+void layout_image_reset_orientation(LayoutWindow *lw)
+{
+ ImageWindow *imd= lw->image;
+
+ if (!layout_valid(&lw)) return;
+ if (!imd || !imd->pr || !imd->image_fd) return;
+
+ if (imd->orientation < 1 || imd->orientation > 8) imd->orientation = 1;
+
+ if (options->image.exif_rotate_enable)
+ {
+ imd->orientation = metadata_read_int(imd->image_fd, ORIENTATION_KEY, EXIF_ORIENTATION_TOP_LEFT);
+ }
+ else
+ {
+ imd->orientation = 1;
+ }
+
+ if (imd->image_fd->user_orientation != 0)
+ {
+ imd->orientation = imd->image_fd->user_orientation;
+ }
+
+ pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation);
}
void layout_image_set_desaturate(LayoutWindow *lw, gboolean desaturate)
switch (event->button)
{
case MOUSE_BUTTON_LEFT:
+ if (event->type == GDK_2BUTTON_PRESS)
+ {
+ if (lw->full_screen)
+ layout_image_full_screen_stop(lw);
+ }
if (options->image_lm_click_nav && lw->split_mode == SPLIT_NONE)
layout_image_next(lw);
break;
}
- if (event->state & GDK_CONTROL_MASK)
+ if ((event->state & GDK_CONTROL_MASK) ||
+ (imd->mouse_wheel_mode && !options->image_lm_click_nav))
{
switch (event->direction)
{
}
}
-static void layout_image_drag_cb(ImageWindow *imd, GdkEventButton *event, gdouble dx, gdouble dy, gpointer data)
+static void layout_image_drag_cb(ImageWindow *imd, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer data)
{
gint i;
LayoutWindow *lw = data;
}
-static void layout_image_drag_inactive_cb(ImageWindow *imd, GdkEventButton *event, gdouble dx, gdouble dy, gpointer data)
+static void layout_image_drag_inactive_cb(ImageWindow *imd, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer data)
{
LayoutWindow *lw = data;
gint i = image_idx(lw, imd);
GList *work = g_list_last(layout_selection_list(lw));
gint j = 0;
- if (work) work = work->prev;
-
while (work && j < i)
{
FileData *fd = work->data;
work = work->prev;
- j++;
- if (!fd || !*fd->path) continue;
+ if (!fd || !*fd->path || fd->parent ||
+ fd == lw->split_images[0]->image_fd)
+ {
+ continue;
+ }
img_fd = fd;
+
+ j++;
}
}