annotate src/pan-view/pan-view.c @ 2909:2e7fd08bfbe4

DEBUG_NAME() function for use with GTKInspector This debug function can be used with GTKInspector to provide a visual indication of where a widget is declared. This is a documentation facility to aid developers new to the project. Sample call: GTK_DEBUG=interactive src/geeqie
author Colin Clark <colin.clark@cclark.uk>
date Thu, 14 Feb 2019 12:05:04 +0000
parents b20a96b979a3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2 * Copyright (C) 2006 John Ellis
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
3 * Copyright (C) 2008 - 2016 The Geeqie Team
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
4 *
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
5 * Author: John Ellis
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
6 *
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
10 * (at your option) any later version.
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
11 *
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
15 * GNU General Public License for more details.
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
16 *
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License along
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
18 * with this program; if not, write to the Free Software Foundation, Inc.,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
20 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
21
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
22 #include "pan-view.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
23
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
24 #include "bar_exif.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
25 #include "dnd.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
26 #include "editors.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
27 #include "exif.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
28 #include "fullscreen.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
29 #include "history_list.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
30 #include "image.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
31 #include "img-view.h"
2694
4126aaeef776 Context-sensitve help
Colin Clark <colin.clark@cclark.uk>
parents: 2663
diff changeset
32 #include "layout_util.h"
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
33 #include "menu.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
34 #include "metadata.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
35 #include "misc.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
36 #include "pan-calendar.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
37 #include "pan-folder.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
38 #include "pan-grid.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
39 #include "pan-item.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
40 #include "pan-timeline.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
41 #include "pan-util.h"
2530
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
42 #include "pan-view-filter.h"
2528
d1b4dd282048 Start moving pan view search code to its own module
Omari Stephens <xsdg@google.com>
parents: 2422
diff changeset
43 #include "pan-view-search.h"
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
44 #include "pixbuf-renderer.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
45 #include "pixbuf_util.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
46 #include "thumb.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
47 #include "ui_fileops.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
48 #include "ui_menu.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
49 #include "ui_misc.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
50 #include "ui_tabcomp.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
51 #include "ui_utildlg.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
52 #include "uri_utils.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
53 #include "utilops.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
54 #include "window.h"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
55
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
56 #include <gdk/gdkkeysyms.h> /* for keyboard values */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
57
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
58 #include <math.h>
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
59
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
60
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
61 #define PAN_WINDOW_DEFAULT_WIDTH 720
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
62 #define PAN_WINDOW_DEFAULT_HEIGHT 500
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
63
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
64 #define PAN_TILE_SIZE 512
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
65
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
66 #define ZOOM_INCREMENT 1.0
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
67 #define ZOOM_LABEL_WIDTH 64
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
68
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
69
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
70 #define PAN_PREF_GROUP "pan_view_options"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
71 #define PAN_PREF_HIDE_WARNING "hide_performance_warning"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
72 #define PAN_PREF_EXIF_PAN_DATE "use_exif_date"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
73 #define PAN_PREF_INFO_IMAGE "info_image_size"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
74 #define PAN_PREF_INFO_EXIF "info_includes_exif"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
75
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
76
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
77 static GList *pan_window_list = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
78
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
79
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
80 static void pan_layout_update_idle(PanWindow *pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
81
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
82 static void pan_fullscreen_toggle(PanWindow *pw, gboolean force_off);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
83
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
84 static void pan_window_close(PanWindow *pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
85
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
86 static GtkWidget *pan_popup_menu(PanWindow *pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
87
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
88 static void pan_window_dnd_init(PanWindow *pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
89
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
90
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
91 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
92 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
93 * the image/thumb loader queue
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
94 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
95 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
96
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
97 static gboolean pan_queue_step(PanWindow *pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
98
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
99
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
100 static void pan_queue_thumb_done_cb(ThumbLoader *tl, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
101 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
102 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
103
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
104 if (pw->queue_pi)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
105 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
106 PanItem *pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
107 gint rc;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
108
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
109 pi = pw->queue_pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
110 pw->queue_pi = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
111
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
112 pi->queued = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
113
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
114 if (pi->pixbuf) g_object_unref(pi->pixbuf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
115 pi->pixbuf = thumb_loader_get_pixbuf(tl);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
116
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
117 rc = pi->refcount;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
118 image_area_changed(pw->imd, pi->x, pi->y, pi->width, pi->height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
119 pi->refcount = rc;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
120 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
121
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
122 thumb_loader_free(pw->tl);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
123 pw->tl = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
124
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
125 while (pan_queue_step(pw));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
126 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
127
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
128 static void pan_queue_image_done_cb(ImageLoader *il, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
129 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
130 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
131
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
132 if (pw->queue_pi)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
133 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
134 PanItem *pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
135 gint rc;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
136
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
137 pi = pw->queue_pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
138 pw->queue_pi = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
139
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
140 pi->queued = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
141
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
142 if (pi->pixbuf) g_object_unref(pi->pixbuf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
143 pi->pixbuf = image_loader_get_pixbuf(pw->il);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
144 if (pi->pixbuf) g_object_ref(pi->pixbuf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
145
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
146 if (pi->pixbuf && pw->size != PAN_IMAGE_SIZE_100 &&
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
147 (gdk_pixbuf_get_width(pi->pixbuf) > pi->width ||
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
148 gdk_pixbuf_get_height(pi->pixbuf) > pi->height))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
149 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
150 GdkPixbuf *tmp;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
151
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
152 tmp = pi->pixbuf;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
153 pi->pixbuf = gdk_pixbuf_scale_simple(tmp, pi->width, pi->height,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
154 (GdkInterpType)options->image.zoom_quality);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
155 g_object_unref(tmp);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
156 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
157
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
158 rc = pi->refcount;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
159 image_area_changed(pw->imd, pi->x, pi->y, pi->width, pi->height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
160 pi->refcount = rc;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
161 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
162
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
163 image_loader_free(pw->il);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
164 pw->il = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
165
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
166 while (pan_queue_step(pw));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
167 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
168
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
169 static gboolean pan_queue_step(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
170 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
171 PanItem *pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
172
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
173 if (!pw->queue) return FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
174
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
175 pi = pw->queue->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
176 pw->queue = g_list_remove(pw->queue, pi);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
177 pw->queue_pi = pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
178
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
179 if (!pw->queue_pi->fd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
180 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
181 pw->queue_pi->queued = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
182 pw->queue_pi = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
183 return TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
184 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
185
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
186 image_loader_free(pw->il);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
187 pw->il = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
188 thumb_loader_free(pw->tl);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
189 pw->tl = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
190
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
191 if (pi->type == PAN_ITEM_IMAGE)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
192 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
193 pw->il = image_loader_new(pi->fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
194
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
195 if (pw->size != PAN_IMAGE_SIZE_100)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
196 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
197 image_loader_set_requested_size(pw->il, pi->width, pi->height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
198 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
199
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
200 g_signal_connect(G_OBJECT(pw->il), "error", (GCallback)pan_queue_image_done_cb, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
201 g_signal_connect(G_OBJECT(pw->il), "done", (GCallback)pan_queue_image_done_cb, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
202
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
203 if (image_loader_start(pw->il)) return FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
204
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
205 image_loader_free(pw->il);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
206 pw->il = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
207 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
208 else if (pi->type == PAN_ITEM_THUMB)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
209 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
210 pw->tl = thumb_loader_new(PAN_THUMB_SIZE, PAN_THUMB_SIZE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
211
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
212 if (!pw->tl->standard_loader)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
213 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
214 /* The classic loader will recreate a thumbnail any time we
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
215 * request a different size than what exists. This view will
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
216 * almost never use the user configured sizes so disable cache.
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
217 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
218 thumb_loader_set_cache(pw->tl, FALSE, FALSE, FALSE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
219 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
220
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
221 thumb_loader_set_callbacks(pw->tl,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
222 pan_queue_thumb_done_cb,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
223 pan_queue_thumb_done_cb,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
224 NULL, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
225
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
226 if (thumb_loader_start(pw->tl, pi->fd)) return FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
227
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
228 thumb_loader_free(pw->tl);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
229 pw->tl = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
230 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
231
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
232 pw->queue_pi->queued = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
233 pw->queue_pi = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
234 return TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
235 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
236
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
237 static void pan_queue_add(PanWindow *pw, PanItem *pi)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
238 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
239 if (!pi || pi->queued || pi->pixbuf) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
240 if (pw->size <= PAN_IMAGE_SIZE_THUMB_NONE &&
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
241 (!pi->key || strcmp(pi->key, "info") != 0) )
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
242 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
243 return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
244 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
245
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
246 pi->queued = TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
247 pw->queue = g_list_prepend(pw->queue, pi);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
248
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
249 if (!pw->tl && !pw->il) while (pan_queue_step(pw));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
250 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
251
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
252
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
253 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
254 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
255 * tile request/dispose handlers
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
256 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
257 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
258
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
259 static gboolean pan_window_request_tile_cb(PixbufRenderer *pr, gint x, gint y,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
260 gint width, gint height, GdkPixbuf *pixbuf, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
261 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
262 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
263 GList *list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
264 GList *work;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
265 gint i;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
266
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
267 pixbuf_set_rect_fill(pixbuf,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
268 0, 0, width, height,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
269 PAN_BACKGROUND_COLOR, 255);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
270
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
271 for (i = (x / PAN_GRID_SIZE) * PAN_GRID_SIZE; i < x + width; i += PAN_GRID_SIZE)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
272 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
273 gint rx, ry, rw, rh;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
274
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
275 if (util_clip_region(x, y, width, height,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
276 i, y, 1, height,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
277 &rx, &ry, &rw, &rh))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
278 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
279 pixbuf_draw_rect_fill(pixbuf,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
280 rx - x, ry - y, rw, rh,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
281 PAN_GRID_COLOR, PAN_GRID_ALPHA);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
282 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
283 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
284 for (i = (y / PAN_GRID_SIZE) * PAN_GRID_SIZE; i < y + height; i += PAN_GRID_SIZE)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
285 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
286 gint rx, ry, rw, rh;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
287
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
288 if (util_clip_region(x, y, width, height,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
289 x, i, width, 1,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
290 &rx, &ry, &rw, &rh))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
291 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
292 pixbuf_draw_rect_fill(pixbuf,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
293 rx - x, ry - y, rw, rh,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
294 PAN_GRID_COLOR, PAN_GRID_ALPHA);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
295 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
296 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
297
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
298 list = pan_layout_intersect(pw, x, y, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
299 work = list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
300 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
301 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
302 PanItem *pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
303 gboolean queue = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
304
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
305 pi = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
306 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
307
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
308 pi->refcount++;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
309
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
310 switch (pi->type)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
311 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
312 case PAN_ITEM_BOX:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
313 queue = pan_item_box_draw(pw, pi, pixbuf, pr, x, y, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
314 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
315 case PAN_ITEM_TRIANGLE:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
316 queue = pan_item_tri_draw(pw, pi, pixbuf, pr, x, y, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
317 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
318 case PAN_ITEM_TEXT:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
319 queue = pan_item_text_draw(pw, pi, pixbuf, pr, x, y, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
320 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
321 case PAN_ITEM_THUMB:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
322 queue = pan_item_thumb_draw(pw, pi, pixbuf, pr, x, y, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
323 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
324 case PAN_ITEM_IMAGE:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
325 queue = pan_item_image_draw(pw, pi, pixbuf, pr, x, y, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
326 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
327 case PAN_ITEM_NONE:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
328 default:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
329 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
330 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
331
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
332 if (queue) pan_queue_add(pw, pi);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
333 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
334
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
335 g_list_free(list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
336
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
337 return TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
338 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
339
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
340 static void pan_window_dispose_tile_cb(PixbufRenderer *pr, gint x, gint y,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
341 gint width, gint height, GdkPixbuf *pixbuf, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
342 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
343 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
344 GList *list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
345 GList *work;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
346
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
347 list = pan_layout_intersect(pw, x, y, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
348 work = list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
349 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
350 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
351 PanItem *pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
352
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
353 pi = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
354 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
355
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
356 if (pi->refcount > 0)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
357 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
358 pi->refcount--;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
359
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
360 if (pi->refcount == 0)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
361 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
362 if (pi->queued)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
363 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
364 pw->queue = g_list_remove(pw->queue, pi);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
365 pi->queued = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
366 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
367 if (pw->queue_pi == pi) pw->queue_pi = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
368 if (pi->pixbuf)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
369 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
370 g_object_unref(pi->pixbuf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
371 pi->pixbuf = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
372 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
373 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
374 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
375 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
376
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
377 g_list_free(list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
378 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
379
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
380
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
381 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
382 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
383 * misc
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
384 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
385 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
386
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
387 static void pan_window_message(PanWindow *pw, const gchar *text)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
388 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
389 GList *work;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
390 gint count = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
391 gint64 size = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
392 gchar *ss;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
393 gchar *buf;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
394
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
395 if (text)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
396 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
397 gtk_label_set_text(GTK_LABEL(pw->label_message), text);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
398 return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
399 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
400
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
401 work = pw->list_static;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
402 if (pw->layout == PAN_LAYOUT_CALENDAR)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
403 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
404 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
405 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
406 PanItem *pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
407
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
408 pi = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
409 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
410
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
411 if (pi->fd &&
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
412 pi->type == PAN_ITEM_BOX &&
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
413 pi->key && strcmp(pi->key, "dot") == 0)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
414 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
415 size += pi->fd->size;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
416 count++;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
417 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
418 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
419 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
420 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
421 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
422 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
423 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
424 PanItem *pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
425
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
426 pi = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
427 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
428
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
429 if (pi->fd &&
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
430 (pi->type == PAN_ITEM_THUMB || pi->type == PAN_ITEM_IMAGE))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
431 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
432 size += pi->fd->size;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
433 count++;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
434 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
435 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
436 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
437
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
438 ss = text_from_size_abrev(size);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
439 buf = g_strdup_printf(_("%d images, %s"), count, ss);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
440 g_free(ss);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
441 gtk_label_set_text(GTK_LABEL(pw->label_message), buf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
442 g_free(buf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
443 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
444
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
445 static void pan_warning_folder(const gchar *path, GtkWidget *parent)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
446 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
447 gchar *message;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
448
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
449 message = g_strdup_printf(_("The pan view does not support the folder \"%s\"."), path);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
450 warning_dialog(_("Folder not supported"), message,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
451 GTK_STOCK_DIALOG_INFO, parent);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
452 g_free(message);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
453 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
454
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
455 static void pan_window_zoom_limit(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
456 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
457 gdouble min;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
458
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
459 switch (pw->size)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
460 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
461 case PAN_IMAGE_SIZE_THUMB_DOTS:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
462 case PAN_IMAGE_SIZE_THUMB_NONE:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
463 case PAN_IMAGE_SIZE_THUMB_SMALL:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
464 case PAN_IMAGE_SIZE_THUMB_NORMAL:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
465 #if 0
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
466 /* easily requires > 512mb ram when window size > 1024x768 and zoom is <= -8 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
467 min = -16.0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
468 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
469 #endif
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
470 case PAN_IMAGE_SIZE_THUMB_LARGE:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
471 min = -6.0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
472 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
473 case PAN_IMAGE_SIZE_10:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
474 case PAN_IMAGE_SIZE_25:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
475 min = -4.0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
476 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
477 case PAN_IMAGE_SIZE_33:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
478 case PAN_IMAGE_SIZE_50:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
479 case PAN_IMAGE_SIZE_100:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
480 default:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
481 min = -2.0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
482 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
483 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
484
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
485 image_zoom_set_limits(pw->imd, min, 32.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
486 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
487
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
488
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
489 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
490 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
491 * cache
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
492 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
493 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
494
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
495 static gint pan_cache_sort_file_cb(gpointer a, gpointer b)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
496 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
497 PanCacheData *pca = a;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
498 PanCacheData *pcb = b;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
499 return filelist_sort_compare_filedata(pca->fd, pcb->fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
500 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
501 GList *pan_cache_sort(GList *list, SortType method, gboolean ascend)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
502 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
503 return filelist_sort_full(list, method, ascend, (GCompareFunc) pan_cache_sort_file_cb);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
504 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
505
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
506
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
507 static void pan_cache_free(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
508 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
509 GList *work;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
510
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
511 work = pw->cache_list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
512 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
513 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
514 PanCacheData *pc;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
515
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
516 pc = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
517 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
518
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
519 cache_sim_data_free(pc->cd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
520 file_data_unref(pc->fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
521 g_free(pc);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
522 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
523
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
524 g_list_free(pw->cache_list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
525 pw->cache_list = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
526
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
527 filelist_free(pw->cache_todo);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
528 pw->cache_todo = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
529
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
530 pw->cache_count = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
531 pw->cache_total = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
532 pw->cache_tick = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
533
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
534 cache_loader_free(pw->cache_cl);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
535 pw->cache_cl = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
536 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
537
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
538 static void pan_cache_fill(PanWindow *pw, FileData *dir_fd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
539 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
540 GList *list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
541
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
542 pan_cache_free(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
543
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
544 list = pan_list_tree(dir_fd, SORT_NAME, TRUE, pw->ignore_symlinks);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
545 pw->cache_todo = g_list_reverse(list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
546
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
547 pw->cache_total = g_list_length(pw->cache_todo);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
548 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
549
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
550 static void pan_cache_step_done_cb(CacheLoader *cl, gint error, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
551 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
552 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
553
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
554 if (pw->cache_list)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
555 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
556 PanCacheData *pc;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
557 pc = pw->cache_list->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
558
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
559 if (!pc->cd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
560 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
561 pc->cd = cl->cd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
562 cl->cd = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
563 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
564 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
565
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
566 cache_loader_free(cl);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
567 pw->cache_cl = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
568
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
569 pan_layout_update_idle(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
570 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
571
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
572 static gboolean pan_cache_step(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
573 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
574 FileData *fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
575 PanCacheData *pc;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
576 CacheDataType load_mask;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
577
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
578 if (!pw->cache_todo) return TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
579
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
580 fd = pw->cache_todo->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
581 pw->cache_todo = g_list_remove(pw->cache_todo, fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
582
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
583 pc = g_new0(PanCacheData, 1);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
584 pc->fd = file_data_ref(fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
585
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
586 pc->cd = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
587
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
588 pw->cache_list = g_list_prepend(pw->cache_list, pc);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
589
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
590 cache_loader_free(pw->cache_cl);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
591
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
592 load_mask = CACHE_LOADER_NONE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
593 if (pw->size > PAN_IMAGE_SIZE_THUMB_LARGE) load_mask |= CACHE_LOADER_DIMENSIONS;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
594 if (pw->exif_date_enable) load_mask |= CACHE_LOADER_DATE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
595 pw->cache_cl = cache_loader_new(pc->fd, load_mask,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
596 pan_cache_step_done_cb, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
597 return (pw->cache_cl == NULL);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
598 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
599
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
600 /* This sync date function is optimized for lists with a common sort */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
601 void pan_cache_sync_date(PanWindow *pw, GList *list)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
602 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
603 GList *haystack;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
604 GList *work;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
605
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
606 haystack = g_list_copy(pw->cache_list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
607
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
608 work = list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
609 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
610 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
611 FileData *fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
612 GList *needle;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
613
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
614 fd = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
615 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
616
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
617 needle = haystack;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
618 while (needle)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
619 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
620 PanCacheData *pc;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
621
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
622 pc = needle->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
623 if (pc->fd == fd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
624 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
625 if (pc->cd && pc->cd->have_date && pc->cd->date >= 0)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
626 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
627 fd->date = pc->cd->date;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
628 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
629
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
630 haystack = g_list_delete_link(haystack, needle);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
631 needle = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
632 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
633 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
634 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
635 needle = needle->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
636 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
637 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
638 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
639
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
640 g_list_free(haystack);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
641 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
642
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
643 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
644 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
645 * item grid
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
646 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
647 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
648
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
649 static void pan_grid_clear(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
650 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
651 GList *work;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
652
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
653 work = pw->list_grid;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
654 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
655 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
656 PanGrid *pg;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
657
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
658 pg = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
659 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
660
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
661 g_list_free(pg->list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
662 g_free(pg);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
663 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
664
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
665 g_list_free(pw->list_grid);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
666 pw->list_grid = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
667
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
668 pw->list = g_list_concat(pw->list, pw->list_static);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
669 pw->list_static = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
670 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
671
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
672 static void pan_grid_build(PanWindow *pw, gint width, gint height, gint grid_size)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
673 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
674 GList *work;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
675 gint col, row;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
676 gint cw, ch;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
677 gint l;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
678 gint i, j;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
679
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
680 pan_grid_clear(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
681
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
682 l = g_list_length(pw->list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
683
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
684 if (l < 1) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
685
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
686 col = (gint)(sqrt((gdouble)l / grid_size) * width / height + 0.999);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
687 col = CLAMP(col, 1, l / grid_size + 1);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
688 row = (gint)((gdouble)l / grid_size / col);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
689 if (row < 1) row = 1;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
690
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
691 /* limit minimum size of grid so that a tile will always fit regardless of position */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
692 cw = MAX((gint)ceil((gdouble)width / col), PAN_TILE_SIZE * 2);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
693 ch = MAX((gint)ceil((gdouble)height / row), PAN_TILE_SIZE * 2);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
694
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
695 row = row * 2 - 1;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
696 col = col * 2 - 1;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
697
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
698 DEBUG_1("intersect speedup grid is %dx%d, based on %d average per grid", col, row, grid_size);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
699
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
700 for (j = 0; j < row; j++)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
701 for (i = 0; i < col; i++)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
702 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
703 if ((i + 1) * cw / 2 < width && (j + 1) * ch / 2 < height)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
704 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
705 PanGrid *pg;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
706
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
707 pg = g_new0(PanGrid, 1);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
708 pg->x = i * cw / 2;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
709 pg->y = j * ch / 2;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
710 pg->w = cw;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
711 pg->h = ch;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
712
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
713 pw->list_grid = g_list_prepend(pw->list_grid, pg);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
714
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
715 DEBUG_1("grid section: %d,%d (%dx%d)", pg->x, pg->y, pg->w, pg->h);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
716 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
717 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
718
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
719 work = pw->list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
720 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
721 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
722 PanItem *pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
723 GList *grid;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
724
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
725 pi = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
726 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
727
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
728 grid = pw->list_grid;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
729 while (grid)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
730 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
731 PanGrid *pg;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
732 gint rx, ry, rw, rh;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
733
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
734 pg = grid->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
735 grid = grid->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
736
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
737 if (util_clip_region(pi->x, pi->y, pi->width, pi->height,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
738 pg->x, pg->y, pg->w, pg->h,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
739 &rx, &ry, &rw, &rh))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
740 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
741 pg->list = g_list_prepend(pg->list, pi);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
742 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
743 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
744 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
745
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
746 work = pw->list_grid;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
747 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
748 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
749 PanGrid *pg;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
750
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
751 pg = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
752 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
753
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
754 pg->list = g_list_reverse(pg->list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
755 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
756
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
757 pw->list_static = pw->list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
758 pw->list = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
759 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
760
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
761
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
762 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
763 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
764 * layout state reset
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
765 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
766 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
767
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
768 static void pan_window_items_free(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
769 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
770 GList *work;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
771
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
772 pan_grid_clear(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
773
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
774 work = pw->list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
775 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
776 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
777 PanItem *pi = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
778 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
779
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
780 pan_item_free(pi);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
781 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
782
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
783 g_list_free(pw->list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
784 pw->list = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
785
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
786 g_list_free(pw->queue);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
787 pw->queue = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
788 pw->queue_pi = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
789
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
790 image_loader_free(pw->il);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
791 pw->il = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
792
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
793 thumb_loader_free(pw->tl);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
794 pw->tl = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
795
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
796 pw->click_pi = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
797 pw->search_pi = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
798 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
799
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
800
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
801 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
802 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
803 * layout generation, queries, sizing
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
804 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
805 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
806
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
807 static void pan_layout_compute(PanWindow *pw, FileData *dir_fd,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
808 gint *width, gint *height,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
809 gint *scroll_x, gint *scroll_y)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
810 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
811 pan_window_items_free(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
812
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
813 switch (pw->size)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
814 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
815 case PAN_IMAGE_SIZE_THUMB_DOTS:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
816 pw->thumb_size = PAN_THUMB_SIZE_DOTS;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
817 pw->thumb_gap = PAN_THUMB_GAP_DOTS;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
818 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
819 case PAN_IMAGE_SIZE_THUMB_NONE:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
820 pw->thumb_size = PAN_THUMB_SIZE_NONE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
821 pw->thumb_gap = PAN_THUMB_GAP_SMALL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
822 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
823 case PAN_IMAGE_SIZE_THUMB_SMALL:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
824 pw->thumb_size = PAN_THUMB_SIZE_SMALL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
825 pw->thumb_gap = PAN_THUMB_GAP_SMALL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
826 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
827 case PAN_IMAGE_SIZE_THUMB_NORMAL:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
828 default:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
829 pw->thumb_size = PAN_THUMB_SIZE_NORMAL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
830 pw->thumb_gap = PAN_THUMB_GAP_NORMAL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
831 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
832 case PAN_IMAGE_SIZE_THUMB_LARGE:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
833 pw->thumb_size = PAN_THUMB_SIZE_LARGE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
834 pw->thumb_gap = PAN_THUMB_GAP_LARGE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
835 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
836 case PAN_IMAGE_SIZE_10:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
837 pw->image_size = 10;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
838 pw->thumb_gap = PAN_THUMB_GAP_NORMAL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
839 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
840 case PAN_IMAGE_SIZE_25:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
841 pw->image_size = 25;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
842 pw->thumb_gap = PAN_THUMB_GAP_NORMAL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
843 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
844 case PAN_IMAGE_SIZE_33:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
845 pw->image_size = 33;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
846 pw->thumb_gap = PAN_THUMB_GAP_LARGE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
847 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
848 case PAN_IMAGE_SIZE_50:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
849 pw->image_size = 50;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
850 pw->thumb_gap = PAN_THUMB_GAP_HUGE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
851 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
852 case PAN_IMAGE_SIZE_100:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
853 pw->image_size = 100;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
854 pw->thumb_gap = PAN_THUMB_GAP_HUGE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
855 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
856 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
857
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
858 *width = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
859 *height = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
860 *scroll_x = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
861 *scroll_y = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
862
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
863 switch (pw->layout)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
864 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
865 case PAN_LAYOUT_GRID:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
866 default:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
867 pan_grid_compute(pw, dir_fd, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
868 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
869 case PAN_LAYOUT_FOLDERS_LINEAR:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
870 pan_folder_tree_compute(pw, dir_fd, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
871 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
872 case PAN_LAYOUT_FOLDERS_FLOWER:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
873 pan_flower_compute(pw, dir_fd, width, height, scroll_x, scroll_y);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
874 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
875 case PAN_LAYOUT_CALENDAR:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
876 pan_calendar_compute(pw, dir_fd, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
877 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
878 case PAN_LAYOUT_TIMELINE:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
879 pan_timeline_compute(pw, dir_fd, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
880 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
881 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
882
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
883 pan_cache_free(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
884
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
885 DEBUG_1("computed %d objects", g_list_length(pw->list));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
886 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
887
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
888 static GList *pan_layout_intersect_l(GList *list, GList *item_list,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
889 gint x, gint y, gint width, gint height)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
890 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
891 GList *work;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
892
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
893 work = item_list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
894 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
895 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
896 PanItem *pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
897 gint rx, ry, rw, rh;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
898
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
899 pi = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
900 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
901
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
902 if (util_clip_region(x, y, width, height,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
903 pi->x, pi->y, pi->width, pi->height,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
904 &rx, &ry, &rw, &rh))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
905 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
906 list = g_list_prepend(list, pi);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
907 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
908 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
909
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
910 return list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
911 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
912
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
913 GList *pan_layout_intersect(PanWindow *pw, gint x, gint y, gint width, gint height)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
914 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
915 GList *list = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
916 GList *grid;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
917 PanGrid *pg = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
918
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
919 grid = pw->list_grid;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
920 while (grid && !pg)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
921 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
922 pg = grid->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
923 grid = grid->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
924
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
925 if (x < pg->x || x + width > pg->x + pg->w ||
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
926 y < pg->y || y + height > pg->y + pg->h)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
927 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
928 pg = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
929 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
930 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
931
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
932 list = pan_layout_intersect_l(list, pw->list, x, y, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
933
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
934 if (pg)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
935 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
936 list = pan_layout_intersect_l(list, pg->list, x, y, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
937 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
938 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
939 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
940 list = pan_layout_intersect_l(list, pw->list_static, x, y, width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
941 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
942
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
943 return list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
944 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
945
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
946 void pan_layout_resize(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
947 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
948 gint width = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
949 gint height = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
950 GList *work;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
951 PixbufRenderer *pr;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
952
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
953 work = pw->list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
954 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
955 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
956 PanItem *pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
957
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
958 pi = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
959 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
960
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
961 if (width < pi->x + pi->width) width = pi->x + pi->width;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
962 if (height < pi->y + pi->height) height = pi->y + pi->height;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
963 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
964 work = pw->list_static;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
965 while (work)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
966 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
967 PanItem *pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
968
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
969 pi = work->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
970 work = work->next;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
971
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
972 if (width < pi->x + pi->width) width = pi->x + pi->width;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
973 if (height < pi->y + pi->height) height = pi->y + pi->height;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
974 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
975
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
976 width += PAN_BOX_BORDER * 2;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
977 height += PAN_BOX_BORDER * 2;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
978
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
979 pr = PIXBUF_RENDERER(pw->imd->pr);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
980 if (width < pr->window_width) width = pr->window_width;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
981 if (height < pr->window_width) height = pr->window_height;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
982
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
983 pixbuf_renderer_set_tiles_size(PIXBUF_RENDERER(pw->imd->pr), width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
984 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
985
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
986 static gint pan_layout_update_idle_cb(gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
987 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
988 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
989 gint width;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
990 gint height;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
991 gint scroll_x;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
992 gint scroll_y;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
993
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
994 if (pw->size > PAN_IMAGE_SIZE_THUMB_LARGE ||
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
995 (pw->exif_date_enable && (pw->layout == PAN_LAYOUT_TIMELINE || pw->layout == PAN_LAYOUT_CALENDAR)))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
996 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
997 if (!pw->cache_list && !pw->cache_todo)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
998 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
999 pan_cache_fill(pw, pw->dir_fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1000 if (pw->cache_todo)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1001 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1002 pan_window_message(pw, _("Reading image data..."));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1003 return TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1004 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1005 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1006 if (pw->cache_todo)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1007 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1008 pw->cache_count++;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1009 pw->cache_tick++;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1010 if (pw->cache_count == pw->cache_total)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1011 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1012 pan_window_message(pw, _("Sorting..."));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1013 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1014 else if (pw->cache_tick > 9)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1015 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1016 gchar *buf;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1017
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1018 buf = g_strdup_printf("%s %d / %d", _("Reading image data..."),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1019 pw->cache_count, pw->cache_total);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1020 pan_window_message(pw, buf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1021 g_free(buf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1022
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1023 pw->cache_tick = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1024 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1025
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1026 if (pan_cache_step(pw)) return TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1027
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1028 pw->idle_id = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1029 return FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1030 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1031 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1032
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1033 pan_layout_compute(pw, pw->dir_fd, &width, &height, &scroll_x, &scroll_y);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1034
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1035 pan_window_zoom_limit(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1036
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1037 if (width > 0 && height > 0)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1038 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1039 gdouble align;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1040
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1041 DEBUG_1("Canvas size is %d x %d", width, height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1042
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1043 pan_grid_build(pw, width, height, 1000);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1044
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1045 pixbuf_renderer_set_tiles(PIXBUF_RENDERER(pw->imd->pr), width, height,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1046 PAN_TILE_SIZE, PAN_TILE_SIZE, 10,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1047 pan_window_request_tile_cb,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1048 pan_window_dispose_tile_cb, pw, 1.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1049
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1050 if (scroll_x == 0 && scroll_y == 0)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1051 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1052 align = 0.0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1053 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1054 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1055 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1056 align = 0.5;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1057 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1058 pixbuf_renderer_scroll_to_point(PIXBUF_RENDERER(pw->imd->pr), scroll_x, scroll_y, align, align);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1059 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1060
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1061 pan_window_message(pw, NULL);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1062
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1063 pw->idle_id = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1064 return FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1065 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1066
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1067 static void pan_layout_update_idle(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1068 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1069 if (!pw->idle_id)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1070 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1071 pw->idle_id = g_idle_add(pan_layout_update_idle_cb, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1072 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1073 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1074
2530
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1075 void pan_layout_update(PanWindow *pw)
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1076 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1077 pan_window_message(pw, _("Sorting images..."));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1078 pan_layout_update_idle(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1079 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1080
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1081 static void pan_layout_set_fd(PanWindow *pw, FileData *dir_fd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1082 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1083 if (!dir_fd) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1084
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1085 if (strcmp(dir_fd->path, G_DIR_SEPARATOR_S) == 0)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1086 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1087 pan_warning_folder(dir_fd->path, pw->window);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1088 return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1089 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1090
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1091 file_data_unref(pw->dir_fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1092 pw->dir_fd = file_data_ref(dir_fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1093
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1094 pan_layout_update(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1095 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1096
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1097
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1098 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1099 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1100 * keyboard handlers
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1101 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1102 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1103
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1104 FileData *pan_menu_click_fd(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1105 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1106 if (pw->click_pi && pw->click_pi->fd) return pw->click_pi->fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1107 return NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1108 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1109
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1110 static void pan_window_menu_pos_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1111 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1112 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1113
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1114 gdk_window_get_origin(gtk_widget_get_window(pw->imd->pr), x, y);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1115 popup_menu_position_clamp(menu, x, y, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1116 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1117
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1118 static gboolean pan_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1119 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1120 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1121 PixbufRenderer *pr;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1122 FileData *fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1123 gboolean stop_signal = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1124 GtkWidget *menu;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1125 GtkWidget *imd_widget;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1126 gint x = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1127 gint y = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1128 gint focused;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1129 gint on_entry;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1130
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1131 pr = PIXBUF_RENDERER(pw->imd->pr);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1132 fd = pan_menu_click_fd(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1133
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1134 imd_widget = gtk_container_get_focus_child(GTK_CONTAINER(pw->imd->widget));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1135 focused = (pw->fs || (imd_widget && gtk_widget_has_focus(imd_widget)));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1136 on_entry = (gtk_widget_has_focus(pw->path_entry) ||
2530
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1137 gtk_widget_has_focus(pw->search_ui->search_entry) ||
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1138 gtk_widget_has_focus(pw->filter_ui->filter_entry));
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1139
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1140 if (focused)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1141 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1142 stop_signal = TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1143 switch (event->keyval)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1144 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1145 case GDK_KEY_Left: case GDK_KEY_KP_Left:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1146 x -= 1;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1147 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1148 case GDK_KEY_Right: case GDK_KEY_KP_Right:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1149 x += 1;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1150 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1151 case GDK_KEY_Up: case GDK_KEY_KP_Up:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1152 y -= 1;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1153 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1154 case GDK_KEY_Down: case GDK_KEY_KP_Down:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1155 y += 1;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1156 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1157 case GDK_KEY_Page_Up: case GDK_KEY_KP_Page_Up:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1158 pixbuf_renderer_scroll(pr, 0, 0 - pr->vis_height / 2);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1159 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1160 case GDK_KEY_Page_Down: case GDK_KEY_KP_Page_Down:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1161 pixbuf_renderer_scroll(pr, 0, pr->vis_height / 2);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1162 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1163 case GDK_KEY_Home: case GDK_KEY_KP_Home:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1164 pixbuf_renderer_scroll(pr, 0 - pr->vis_width / 2, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1165 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1166 case GDK_KEY_End: case GDK_KEY_KP_End:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1167 pixbuf_renderer_scroll(pr, pr->vis_width / 2, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1168 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1169 default:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1170 stop_signal = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1171 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1172 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1173
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1174 if (x != 0 || y!= 0)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1175 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1176 if (event->state & GDK_SHIFT_MASK)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1177 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1178 x *= 3;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1179 y *= 3;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1180 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1181 keyboard_scroll_calc(&x, &y, event);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1182 pixbuf_renderer_scroll(pr, x, y);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1183 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1184 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1185
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1186 if (stop_signal) return stop_signal;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1187
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1188 if (event->state & GDK_CONTROL_MASK)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1189 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1190 stop_signal = TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1191 switch (event->keyval)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1192 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1193 case '1':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1194 case '2':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1195 case '3':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1196 case '4':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1197 case '5':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1198 case '6':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1199 case '7':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1200 case '8':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1201 case '9':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1202 case '0':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1203 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1204 case 'C': case 'c':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1205 if (fd) file_util_copy(fd, NULL, NULL, GTK_WIDGET(pr));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1206 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1207 case 'M': case 'm':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1208 if (fd) file_util_move(fd, NULL, NULL, GTK_WIDGET(pr));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1209 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1210 case 'R': case 'r':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1211 if (fd) file_util_rename(fd, NULL, GTK_WIDGET(pr));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1212 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1213 case 'D': case 'd':
2860
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
1214 if (fd)
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
1215 {
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
1216 options->file_ops.safe_delete_enable = TRUE;
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
1217 file_util_delete(fd, NULL, GTK_WIDGET(pr));
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
1218 }
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1219 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1220 case 'F': case 'f':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1221 pan_search_toggle_visible(pw, TRUE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1222 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1223 case 'G': case 'g':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1224 pan_search_activate(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1225 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1226 case 'W': case 'w':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1227 pan_window_close(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1228 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1229 default:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1230 stop_signal = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1231 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1232 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1233 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1234 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1235 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1236 stop_signal = TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1237 switch (event->keyval)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1238 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1239 case GDK_KEY_Escape:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1240 if (pw->fs)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1241 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1242 pan_fullscreen_toggle(pw, TRUE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1243 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1244 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1245 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1246 pan_search_toggle_visible(pw, FALSE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1247 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1248 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1249 default:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1250 stop_signal = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1251 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1252 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1253
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1254 if (stop_signal) return stop_signal;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1255
2529
74d73f2f5667 Pull the search UI construction code out into a distinct function.
Omari Stephens <xsdg@google.com>
parents: 2528
diff changeset
1256 // Don't steal characters from entry boxes.
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1257 if (!on_entry)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1258 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1259 stop_signal = TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1260 switch (event->keyval)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1261 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1262 case '+': case '=': case GDK_KEY_KP_Add:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1263 pixbuf_renderer_zoom_adjust(pr, ZOOM_INCREMENT);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1264 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1265 case '-': case GDK_KEY_KP_Subtract:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1266 pixbuf_renderer_zoom_adjust(pr, -ZOOM_INCREMENT);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1267 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1268 case 'Z': case 'z': case GDK_KEY_KP_Divide: case '1':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1269 pixbuf_renderer_zoom_set(pr, 1.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1270 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1271 case '2':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1272 pixbuf_renderer_zoom_set(pr, 2.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1273 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1274 case '3':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1275 pixbuf_renderer_zoom_set(pr, 3.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1276 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1277 case '4':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1278 pixbuf_renderer_zoom_set(pr, 4.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1279 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1280 case '7':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1281 pixbuf_renderer_zoom_set(pr, -4.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1282 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1283 case '8':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1284 pixbuf_renderer_zoom_set(pr, -3.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1285 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1286 case '9':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1287 pixbuf_renderer_zoom_set(pr, -2.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1288 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1289 case 'F': case 'f':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1290 case 'V': case 'v':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1291 case GDK_KEY_F11:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1292 pan_fullscreen_toggle(pw, FALSE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1293 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1294 case 'I': case 'i':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1295 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1296 case GDK_KEY_Delete: case GDK_KEY_KP_Delete:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1297 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1298 case GDK_KEY_Menu:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1299 case GDK_KEY_F10:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1300 menu = pan_popup_menu(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1301 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1302 pan_window_menu_pos_cb, pw, 0, GDK_CURRENT_TIME);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1303 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1304 case '/':
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1305 pan_search_toggle_visible(pw, TRUE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1306 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1307 stop_signal = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1308 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1309 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1310 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1311 }
2694
4126aaeef776 Context-sensitve help
Colin Clark <colin.clark@cclark.uk>
parents: 2663
diff changeset
1312 if (!stop_signal && is_help_key(event))
4126aaeef776 Context-sensitve help
Colin Clark <colin.clark@cclark.uk>
parents: 2663
diff changeset
1313 {
4126aaeef776 Context-sensitve help
Colin Clark <colin.clark@cclark.uk>
parents: 2663
diff changeset
1314 help_window_show("GuideOtherWindowsPanView.html");
4126aaeef776 Context-sensitve help
Colin Clark <colin.clark@cclark.uk>
parents: 2663
diff changeset
1315 stop_signal = TRUE;
4126aaeef776 Context-sensitve help
Colin Clark <colin.clark@cclark.uk>
parents: 2663
diff changeset
1316 }
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1317
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1318 return stop_signal;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1319 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1320
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1321 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1322 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1323 * info popup
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1324 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1325 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1326
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1327 static void pan_info_add_exif(PanTextAlignment *ta, FileData *fd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1328 {
2759
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1329 GList *exif_list;
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1330 gchar *text;
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1331 gchar *title;
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1332 gchar *key;
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1333
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1334 if (!fd) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1335
2759
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1336 exif_list = bar_pane_exif_list();
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1337 while (exif_list)
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1338 {
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1339 title = exif_list->data;
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1340 exif_list = exif_list->next;
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1341 key = exif_list->data;
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1342 exif_list = exif_list->next;
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1343
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1344 text = metadata_read_string(fd, key, METADATA_FORMATTED);
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1345 if (text && text[0] != '\0')
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1346 {
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1347 pan_text_alignment_add(ta, title, text);
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1348 }
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1349
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1350 g_free(text);
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1351 }
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1352
dc29a31b7c47 Pan view - implement exif data display
Colin Clark <colin.clark@cclark.uk>
parents: 2758
diff changeset
1353 string_list_free(exif_list);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1354 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1355
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1356
2528
d1b4dd282048 Start moving pan view search code to its own module
Omari Stephens <xsdg@google.com>
parents: 2422
diff changeset
1357 void pan_info_update(PanWindow *pw, PanItem *pi)
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1358 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1359 PanTextAlignment *ta;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1360 PanItem *pbox;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1361 PanItem *p;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1362 gchar *buf;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1363 gint x1, y1, x2, y2, x3, y3;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1364 gint x, y, w, h;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1365
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1366 if (pw->click_pi == pi) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1367 if (pi && !pi->fd) pi = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1368
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1369 while ((p = pan_item_find_by_key(pw, PAN_ITEM_NONE, "info"))) pan_item_remove(pw, p);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1370 pw->click_pi = pi;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1371
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1372 if (!pi) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1373
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1374 DEBUG_1("info set to %s", pi->fd->path);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1375
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1376 pbox = pan_item_box_new(pw, NULL, pi->x + pi->width + 4, pi->y, 10, 10,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1377 PAN_POPUP_BORDER,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1378 PAN_POPUP_COLOR, PAN_POPUP_ALPHA,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1379 PAN_POPUP_BORDER_COLOR, PAN_POPUP_ALPHA);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1380 pan_item_set_key(pbox, "info");
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1381
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1382 if (pi->type == PAN_ITEM_THUMB && pi->pixbuf)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1383 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1384 w = gdk_pixbuf_get_width(pi->pixbuf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1385 h = gdk_pixbuf_get_height(pi->pixbuf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1386
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1387 x1 = pi->x + pi->width - (pi->width - w) / 2 - 8;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1388 y1 = pi->y + (pi->height - h) / 2 + 8;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1389 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1390 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1391 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1392 x1 = pi->x + pi->width - 8;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1393 y1 = pi->y + 8;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1394 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1395
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1396 x2 = pbox->x + 1;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1397 y2 = pbox->y + 36;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1398 x3 = pbox->x + 1;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1399 y3 = pbox->y + 12;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1400 util_clip_triangle(x1, y1, x2, y2, x3, y3,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1401 &x, &y, &w, &h);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1402
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1403 p = pan_item_tri_new(pw, NULL, x, y, w, h,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1404 x1, y1, x2, y2, x3, y3,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1405 PAN_POPUP_COLOR, PAN_POPUP_ALPHA);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1406 pan_item_tri_border(p, PAN_BORDER_1 | PAN_BORDER_3, PAN_POPUP_BORDER_COLOR, PAN_POPUP_ALPHA);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1407 pan_item_set_key(p, "info");
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1408 pan_item_added(pw, p);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1409
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1410 ta = pan_text_alignment_new(pw, pbox->x + PREF_PAD_BORDER, pbox->y + PREF_PAD_BORDER, "info");
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1411
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1412 pan_text_alignment_add(ta, _("Filename:"), pi->fd->name);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1413 buf = remove_level_from_path(pi->fd->path);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1414 pan_text_alignment_add(ta, _("Location:"), buf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1415 g_free(buf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1416 pan_text_alignment_add(ta, _("Date:"), text_from_time(pi->fd->date));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1417 buf = text_from_size(pi->fd->size);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1418 pan_text_alignment_add(ta, _("Size:"), buf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1419 g_free(buf);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1420
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1421 if (pw->info_includes_exif)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1422 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1423 pan_info_add_exif(ta, pi->fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1424 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1425
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1426 pan_text_alignment_calc(ta, pbox);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1427 pan_text_alignment_free(ta);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1428
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1429 pan_item_box_shadow(pbox, PAN_SHADOW_OFFSET * 2, PAN_SHADOW_FADE * 2);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1430 pan_item_added(pw, pbox);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1431
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1432 if (pw->info_image_size > PAN_IMAGE_SIZE_THUMB_NONE)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1433 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1434 gint iw, ih;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1435 if (image_load_dimensions(pi->fd, &iw, &ih))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1436 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1437 gint scale = 25;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1438
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1439 switch (pw->info_image_size)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1440 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1441 case PAN_IMAGE_SIZE_10:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1442 scale = 10;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1443 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1444 case PAN_IMAGE_SIZE_25:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1445 scale = 25;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1446 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1447 case PAN_IMAGE_SIZE_33:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1448 scale = 33;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1449 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1450 case PAN_IMAGE_SIZE_50:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1451 scale = 50;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1452 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1453 case PAN_IMAGE_SIZE_100:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1454 scale = 100;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1455 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1456 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1457
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1458 iw = MAX(1, iw * scale / 100);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1459 ih = MAX(1, ih * scale / 100);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1460
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1461 pbox = pan_item_box_new(pw, NULL, pbox->x, pbox->y + pbox->height + 8, 10, 10,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1462 PAN_POPUP_BORDER,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1463 PAN_POPUP_COLOR, PAN_POPUP_ALPHA,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1464 PAN_POPUP_BORDER_COLOR, PAN_POPUP_ALPHA);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1465 pan_item_set_key(pbox, "info");
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1466
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1467 p = pan_item_image_new(pw, file_data_new_group(pi->fd->path),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1468 pbox->x + PREF_PAD_BORDER, pbox->y + PREF_PAD_BORDER, iw, ih);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1469 pan_item_set_key(p, "info");
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1470 pan_item_size_by_item(pbox, p, PREF_PAD_BORDER);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1471
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1472 pan_item_box_shadow(pbox, PAN_SHADOW_OFFSET * 2, PAN_SHADOW_FADE * 2);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1473 pan_item_added(pw, pbox);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1474 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1475 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1476
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1477 pan_layout_resize(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1478 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1479
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1480
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1481 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1482 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1483 * main window
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1484 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1485 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1486
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1487 static void button_cb(PixbufRenderer *pr, GdkEventButton *event, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1488 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1489 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1490 PanItem *pi = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1491 GtkWidget *menu;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1492 gint rx, ry;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1493
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1494 rx = ry = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1495 if (pr->scale)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1496 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1497 rx = (gdouble)(pr->x_scroll + event->x - pr->x_offset) / pr->scale;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1498 ry = (gdouble)(pr->y_scroll + event->y - pr->y_offset) / pr->scale;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1499 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1500
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1501 pi = pan_item_find_by_coord(pw, PAN_ITEM_BOX, rx, ry, "info");
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1502 if (pi && event->button == MOUSE_BUTTON_LEFT)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1503 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1504 pan_info_update(pw, NULL);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1505 return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1506 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1507
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1508 pi = pan_item_find_by_coord(pw, (pw->size > PAN_IMAGE_SIZE_THUMB_LARGE) ? PAN_ITEM_IMAGE : PAN_ITEM_THUMB,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1509 rx, ry, NULL);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1510
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1511 switch (event->button)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1512 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1513 case MOUSE_BUTTON_LEFT:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1514 pan_info_update(pw, pi);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1515
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1516 if (!pi && pw->layout == PAN_LAYOUT_CALENDAR)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1517 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1518 pi = pan_item_find_by_coord(pw, PAN_ITEM_BOX, rx, ry, "day");
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1519 pan_calendar_update(pw, pi);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1520 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1521 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1522 case MOUSE_BUTTON_MIDDLE:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1523 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1524 case MOUSE_BUTTON_RIGHT:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1525 pan_info_update(pw, pi);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1526 menu = pan_popup_menu(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1527 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1528 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1529 default:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1530 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1531 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1532 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1533
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1534 static void scroll_cb(PixbufRenderer *pr, GdkEventScroll *event, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1535 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1536 gint w, h;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1537
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1538 w = pr->vis_width;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1539 h = pr->vis_height;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1540
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1541 if (!(event->state & GDK_SHIFT_MASK))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1542 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1543 w /= 3;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1544 h /= 3;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1545 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1546
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1547 if (event->state & GDK_CONTROL_MASK)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1548 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1549 switch (event->direction)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1550 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1551 case GDK_SCROLL_UP:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1552 pixbuf_renderer_zoom_adjust_at_point(pr, ZOOM_INCREMENT,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1553 (gint)event->x, (gint)event->y);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1554 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1555 case GDK_SCROLL_DOWN:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1556 pixbuf_renderer_zoom_adjust_at_point(pr, -ZOOM_INCREMENT,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1557 (gint)event->x, (gint)event->y);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1558 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1559 default:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1560 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1561 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1562 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1563 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1564 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1565 switch (event->direction)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1566 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1567 case GDK_SCROLL_UP:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1568 pixbuf_renderer_scroll(pr, 0, -h);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1569 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1570 case GDK_SCROLL_DOWN:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1571 pixbuf_renderer_scroll(pr, 0, h);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1572 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1573 case GDK_SCROLL_LEFT:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1574 pixbuf_renderer_scroll(pr, -w, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1575 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1576 case GDK_SCROLL_RIGHT:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1577 pixbuf_renderer_scroll(pr, w, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1578 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1579 default:
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1580 break;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1581 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1582 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1583 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1584
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1585 static void pan_image_set_buttons(PanWindow *pw, ImageWindow *imd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1586 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1587 g_signal_connect(G_OBJECT(imd->pr), "clicked",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1588 G_CALLBACK(button_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1589 g_signal_connect(G_OBJECT(imd->pr), "scroll_event",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1590 G_CALLBACK(scroll_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1591 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1592
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1593 static void pan_fullscreen_stop_func(FullScreenData *fs, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1594 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1595 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1596
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1597 pw->fs = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1598 pw->imd = pw->imd_normal;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1599 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1600
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1601 static void pan_fullscreen_toggle(PanWindow *pw, gboolean force_off)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1602 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1603 if (force_off && !pw->fs) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1604
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1605 if (pw->fs)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1606 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1607 fullscreen_stop(pw->fs);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1608 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1609 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1610 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1611 pw->fs = fullscreen_start(pw->window, pw->imd, pan_fullscreen_stop_func, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1612 pan_image_set_buttons(pw, pw->fs->imd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1613 g_signal_connect(G_OBJECT(pw->fs->window), "key_press_event",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1614 G_CALLBACK(pan_window_key_press_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1615
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1616 pw->imd = pw->fs->imd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1617 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1618 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1619
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1620 static void pan_window_image_zoom_cb(PixbufRenderer *pr, gdouble zoom, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1621 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1622 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1623 gchar *text;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1624
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1625 text = image_zoom_get_as_text(pw->imd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1626 gtk_label_set_text(GTK_LABEL(pw->label_zoom), text);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1627 g_free(text);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1628 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1629
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1630 static void pan_window_image_scroll_notify_cb(PixbufRenderer *pr, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1631 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1632 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1633 GtkAdjustment *adj;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1634 GdkRectangle rect;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1635 gint width, height;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1636
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1637 if (pr->scale == 0.0) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1638
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1639 pixbuf_renderer_get_visible_rect(pr, &rect);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1640 pixbuf_renderer_get_image_size(pr, &width, &height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1641
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1642 adj = gtk_range_get_adjustment(GTK_RANGE(pw->scrollbar_h));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1643 gtk_adjustment_set_page_size(adj, rect.width);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1644 gtk_adjustment_set_page_increment(adj, gtk_adjustment_get_page_size(adj) / 2.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1645 gtk_adjustment_set_step_increment(adj, 48.0 / pr->scale);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1646 gtk_adjustment_set_lower(adj, 0.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1647 gtk_adjustment_set_upper(adj, MAX((gdouble)width, 1.0));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1648 gtk_adjustment_set_value(adj, (gdouble)rect.x);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1649
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1650 pref_signal_block_data(pw->scrollbar_h, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1651 gtk_adjustment_changed(adj);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1652 gtk_adjustment_value_changed(adj);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1653 pref_signal_unblock_data(pw->scrollbar_h, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1654
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1655 adj = gtk_range_get_adjustment(GTK_RANGE(pw->scrollbar_v));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1656 gtk_adjustment_set_page_size(adj, rect.height);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1657 gtk_adjustment_set_page_increment(adj, gtk_adjustment_get_page_size(adj) / 2.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1658 gtk_adjustment_set_step_increment(adj, 48.0 / pr->scale);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1659 gtk_adjustment_set_lower(adj, 0.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1660 gtk_adjustment_set_upper(adj, MAX((gdouble)height, 1.0));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1661 gtk_adjustment_set_value(adj, (gdouble)rect.y);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1662
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1663 pref_signal_block_data(pw->scrollbar_v, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1664 gtk_adjustment_changed(adj);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1665 gtk_adjustment_value_changed(adj);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1666 pref_signal_unblock_data(pw->scrollbar_v, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1667 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1668
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1669 static void pan_window_scrollbar_h_value_cb(GtkRange *range, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1670 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1671 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1672 PixbufRenderer *pr;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1673 gint x;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1674
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1675 pr = PIXBUF_RENDERER(pw->imd_normal->pr);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1676
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1677 if (!pr->scale) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1678
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1679 x = (gint)gtk_range_get_value(range);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1680
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1681 pixbuf_renderer_scroll_to_point(pr, x, (gint)((gdouble)pr->y_scroll / pr->scale), 0.0, 0.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1682 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1683
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1684 static void pan_window_scrollbar_v_value_cb(GtkRange *range, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1685 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1686 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1687 PixbufRenderer *pr;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1688 gint y;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1689
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1690 pr = PIXBUF_RENDERER(pw->imd_normal->pr);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1691
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1692 if (!pr->scale) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1693
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1694 y = (gint)gtk_range_get_value(range);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1695
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1696 pixbuf_renderer_scroll_to_point(pr, (gint)((gdouble)pr->x_scroll / pr->scale), y, 0.0, 0.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1697 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1698
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1699 static void pan_window_layout_change_cb(GtkWidget *combo, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1700 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1701 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1702
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1703 pw->layout = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1704 pan_layout_update(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1705 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1706
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1707 static void pan_window_layout_size_cb(GtkWidget *combo, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1708 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1709 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1710
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1711 pw->size = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1712 pan_layout_update(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1713 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1714
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1715 static void pan_window_entry_activate_cb(const gchar *new_text, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1716 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1717 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1718 gchar *path;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1719
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1720 path = remove_trailing_slash(new_text);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1721 parse_out_relatives(path);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1722
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1723 if (!isdir(path))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1724 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1725 warning_dialog(_("Folder not found"),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1726 _("The entered path is not a folder"),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1727 GTK_STOCK_DIALOG_WARNING, pw->path_entry);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1728 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1729 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1730 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1731 FileData *dir_fd = file_data_new_dir(path);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1732 tab_completion_append_to_history(pw->path_entry, path);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1733
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1734 pan_layout_set_fd(pw, dir_fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1735 file_data_unref(dir_fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1736 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1737
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1738 g_free(path);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1739 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1740
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1741 static void pan_window_close(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1742 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1743 pan_window_list = g_list_remove(pan_window_list, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1744
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1745 pref_list_int_set(PAN_PREF_GROUP, PAN_PREF_EXIF_PAN_DATE, pw->exif_date_enable);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1746 pref_list_int_set(PAN_PREF_GROUP, PAN_PREF_INFO_IMAGE, pw->info_image_size);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1747 pref_list_int_set(PAN_PREF_GROUP, PAN_PREF_INFO_EXIF, pw->info_includes_exif);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1748
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1749 if (pw->idle_id)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1750 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1751 g_source_remove(pw->idle_id);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1752 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1753
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1754 pan_fullscreen_toggle(pw, TRUE);
2530
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1755 pan_search_ui_destroy(&pw->search_ui);
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1756 pan_filter_ui_destroy(&pw->filter_ui);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1757 gtk_widget_destroy(pw->window);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1758
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1759 pan_window_items_free(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1760 pan_cache_free(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1761
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1762 file_data_unref(pw->dir_fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1763
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1764 g_free(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1765 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1766
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1767 static gboolean pan_window_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1768 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1769 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1770
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1771 pan_window_close(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1772 return TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1773 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1774
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1775 static void pan_window_new_real(FileData *dir_fd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1776 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1777 PanWindow *pw;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1778 GtkWidget *vbox;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1779 GtkWidget *box;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1780 GtkWidget *combo;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1781 GtkWidget *hbox;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1782 GtkWidget *frame;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1783 GtkWidget *table;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1784 GdkGeometry geometry;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1785
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1786 pw = g_new0(PanWindow, 1);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1787
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1788 pw->dir_fd = file_data_ref(dir_fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1789 pw->layout = PAN_LAYOUT_TIMELINE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1790 pw->size = PAN_IMAGE_SIZE_THUMB_NORMAL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1791 pw->thumb_size = PAN_THUMB_SIZE_NORMAL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1792 pw->thumb_gap = PAN_THUMB_GAP_NORMAL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1793
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1794 if (!pref_list_int_get(PAN_PREF_GROUP, PAN_PREF_EXIF_PAN_DATE, &pw->exif_date_enable))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1795 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1796 pw->exif_date_enable = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1797 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1798 if (!pref_list_int_get(PAN_PREF_GROUP, PAN_PREF_INFO_IMAGE, &pw->info_image_size))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1799 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1800 pw->info_image_size = PAN_IMAGE_SIZE_THUMB_NONE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1801 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1802 if (!pref_list_int_get(PAN_PREF_GROUP, PAN_PREF_INFO_EXIF, &pw->info_includes_exif))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1803 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1804 pw->info_includes_exif = TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1805 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1806
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1807 pw->ignore_symlinks = TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1808
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1809 pw->idle_id = 0;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1810
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1811 pw->window = window_new(GTK_WINDOW_TOPLEVEL, "panview", NULL, NULL, _("Pan View"));
2909
2e7fd08bfbe4 DEBUG_NAME() function for use with GTKInspector
Colin Clark <colin.clark@cclark.uk>
parents: 2860
diff changeset
1812 DEBUG_NAME(pw->window);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1813
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1814 geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1815 geometry.min_height = DEFAULT_MINIMAL_WINDOW_SIZE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1816 gtk_window_set_geometry_hints(GTK_WINDOW(pw->window), NULL, &geometry, GDK_HINT_MIN_SIZE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1817
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1818 gtk_window_set_resizable(GTK_WINDOW(pw->window), TRUE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1819 gtk_container_set_border_width(GTK_CONTAINER(pw->window), 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1820
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1821 vbox = gtk_vbox_new(FALSE, 0);
2909
2e7fd08bfbe4 DEBUG_NAME() function for use with GTKInspector
Colin Clark <colin.clark@cclark.uk>
parents: 2860
diff changeset
1822 DEBUG_NAME(vbox);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1823 gtk_container_add(GTK_CONTAINER(pw->window), vbox);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1824 gtk_widget_show(vbox);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1825
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1826 box = pref_box_new(vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1827
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1828 pref_spacer(box, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1829 pref_label_new(box, _("Location:"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1830 combo = tab_completion_new_with_history(&pw->path_entry, dir_fd->path, "pan_view_path", -1,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1831 pan_window_entry_activate_cb, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1832 gtk_box_pack_start(GTK_BOX(box), combo, TRUE, TRUE, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1833 gtk_widget_show(combo);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1834
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1835 combo = gtk_combo_box_text_new();
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1836 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Timeline"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1837 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Calendar"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1838 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Folders"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1839 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Folders (flower)"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1840 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Grid"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1841
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1842 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), pw->layout);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1843 g_signal_connect(G_OBJECT(combo), "changed",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1844 G_CALLBACK(pan_window_layout_change_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1845 gtk_box_pack_start(GTK_BOX(box), combo, FALSE, FALSE, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1846 gtk_widget_show(combo);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1847
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1848 combo = gtk_combo_box_text_new();
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1849 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Dots"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1850 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("No Images"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1851 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Small Thumbnails"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1852 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Normal Thumbnails"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1853 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Large Thumbnails"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1854 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("1:10 (10%)"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1855 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("1:4 (25%)"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1856 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("1:3 (33%)"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1857 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("1:2 (50%)"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1858 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("1:1 (100%)"));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1859
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1860 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), pw->size);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1861 g_signal_connect(G_OBJECT(combo), "changed",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1862 G_CALLBACK(pan_window_layout_size_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1863 gtk_box_pack_start(GTK_BOX(box), combo, FALSE, FALSE, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1864 gtk_widget_show(combo);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1865
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1866 table = pref_table_new(vbox, 2, 2, FALSE, TRUE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1867 gtk_table_set_row_spacings(GTK_TABLE(table), 2);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1868 gtk_table_set_col_spacings(GTK_TABLE(table), 2);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1869
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1870 pw->imd = image_new(TRUE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1871 pw->imd_normal = pw->imd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1872
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1873 g_signal_connect(G_OBJECT(pw->imd->pr), "zoom",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1874 G_CALLBACK(pan_window_image_zoom_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1875 g_signal_connect(G_OBJECT(pw->imd->pr), "scroll_notify",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1876 G_CALLBACK(pan_window_image_scroll_notify_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1877
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1878 gtk_table_attach(GTK_TABLE(table), pw->imd->widget, 0, 1, 0, 1,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1879 GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1880 gtk_widget_show(GTK_WIDGET(pw->imd->widget));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1881
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1882 pan_window_dnd_init(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1883
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1884 pan_image_set_buttons(pw, pw->imd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1885
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1886 pw->scrollbar_h = gtk_hscrollbar_new(NULL);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1887 g_signal_connect(G_OBJECT(pw->scrollbar_h), "value_changed",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1888 G_CALLBACK(pan_window_scrollbar_h_value_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1889 gtk_table_attach(GTK_TABLE(table), pw->scrollbar_h, 0, 1, 1, 2,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1890 GTK_FILL | GTK_EXPAND, 0, 0, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1891 gtk_widget_show(pw->scrollbar_h);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1892
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1893 pw->scrollbar_v = gtk_vscrollbar_new(NULL);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1894 g_signal_connect(G_OBJECT(pw->scrollbar_v), "value_changed",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1895 G_CALLBACK(pan_window_scrollbar_v_value_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1896 gtk_table_attach(GTK_TABLE(table), pw->scrollbar_v, 1, 2, 0, 1,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1897 0, GTK_FILL | GTK_EXPAND, 0, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1898 gtk_widget_show(pw->scrollbar_v);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1899
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1900 /* find bar */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1901
2529
74d73f2f5667 Pull the search UI construction code out into a distinct function.
Omari Stephens <xsdg@google.com>
parents: 2528
diff changeset
1902 pw->search_ui = pan_search_ui_new(pw);
74d73f2f5667 Pull the search UI construction code out into a distinct function.
Omari Stephens <xsdg@google.com>
parents: 2528
diff changeset
1903 gtk_box_pack_start(GTK_BOX(vbox), pw->search_ui->search_box, FALSE, FALSE, 2);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1904
2530
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1905 /* filter bar */
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1906 pw->filter_ui = pan_filter_ui_new(pw);
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1907 gtk_box_pack_start(GTK_BOX(vbox), pw->filter_ui->filter_box, FALSE, FALSE, 2);
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1908
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1909 /* status bar */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1910
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1911 box = pref_box_new(vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1912
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1913 frame = gtk_frame_new(NULL);
2909
2e7fd08bfbe4 DEBUG_NAME() function for use with GTKInspector
Colin Clark <colin.clark@cclark.uk>
parents: 2860
diff changeset
1914 DEBUG_NAME(frame);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1915 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1916 gtk_widget_set_size_request(frame, ZOOM_LABEL_WIDTH, -1);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1917 gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1918 gtk_widget_show(frame);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1919
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1920 hbox = gtk_hbox_new(FALSE, PREF_PAD_SPACE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1921 gtk_container_add(GTK_CONTAINER(frame), hbox);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1922 gtk_widget_show(hbox);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1923
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1924 pref_spacer(hbox, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1925 pw->label_message = pref_label_new(hbox, "");
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1926
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1927 frame = gtk_frame_new(NULL);
2909
2e7fd08bfbe4 DEBUG_NAME() function for use with GTKInspector
Colin Clark <colin.clark@cclark.uk>
parents: 2860
diff changeset
1928 DEBUG_NAME(frame);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1929 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1930 gtk_widget_set_size_request(frame, ZOOM_LABEL_WIDTH, -1);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1931 gtk_box_pack_end(GTK_BOX(box), frame, FALSE, FALSE, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1932 gtk_widget_show(frame);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1933
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1934 pw->label_zoom = gtk_label_new("");
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1935 gtk_container_add(GTK_CONTAINER(frame), pw->label_zoom);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1936 gtk_widget_show(pw->label_zoom);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1937
2529
74d73f2f5667 Pull the search UI construction code out into a distinct function.
Omari Stephens <xsdg@google.com>
parents: 2528
diff changeset
1938 // Add the "Find" button to the status bar area.
74d73f2f5667 Pull the search UI construction code out into a distinct function.
Omari Stephens <xsdg@google.com>
parents: 2528
diff changeset
1939 gtk_box_pack_end(GTK_BOX(box), pw->search_ui->search_button, FALSE, FALSE, 0);
74d73f2f5667 Pull the search UI construction code out into a distinct function.
Omari Stephens <xsdg@google.com>
parents: 2528
diff changeset
1940 gtk_widget_show(pw->search_ui->search_button);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1941
2530
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1942 // Add the "Filter" button to the status bar area.
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1943 gtk_box_pack_end(GTK_BOX(box), pw->filter_ui->filter_button, FALSE, FALSE, 0);
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1944 gtk_widget_show(pw->filter_ui->filter_button);
949b146aaa23 Adds a keyword filtering feature to Timeline PanView.
Omari Stephens <xsdg@google.com>
parents: 2529
diff changeset
1945
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1946 g_signal_connect(G_OBJECT(pw->window), "delete_event",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1947 G_CALLBACK(pan_window_delete_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1948 g_signal_connect(G_OBJECT(pw->window), "key_press_event",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1949 G_CALLBACK(pan_window_key_press_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1950
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1951 gtk_window_set_default_size(GTK_WINDOW(pw->window), PAN_WINDOW_DEFAULT_WIDTH, PAN_WINDOW_DEFAULT_HEIGHT);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1952
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1953 pan_layout_update(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1954
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1955 gtk_widget_grab_focus(GTK_WIDGET(pw->imd->widget));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1956 gtk_widget_show(pw->window);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1957
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1958 pan_window_list = g_list_append(pan_window_list, pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1959 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1960
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1961 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1962 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1963 * peformance warnings
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1964 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1965 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1966
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1967 static void pan_warning_ok_cb(GenericDialog *gd, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1968 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1969 FileData *dir_fd = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1970
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1971 generic_dialog_close(gd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1972
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1973 pan_window_new_real(dir_fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1974 file_data_unref(dir_fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1975 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1976
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1977 static void pan_warning_hide_cb(GtkWidget *button, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1978 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1979 gboolean hide_dlg;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1980
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1981 hide_dlg = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1982 pref_list_int_set(PAN_PREF_GROUP, PAN_PREF_HIDE_WARNING, hide_dlg);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1983 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1984
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1985 static gboolean pan_warning(FileData *dir_fd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1986 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1987 GenericDialog *gd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1988 GtkWidget *box;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1989 GtkWidget *group;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1990 GtkWidget *button;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1991 GtkWidget *ct_button;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1992 gboolean hide_dlg;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1993
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1994 if (dir_fd && strcmp(dir_fd->path, G_DIR_SEPARATOR_S) == 0)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1995 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1996 pan_warning_folder(dir_fd->path, NULL);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1997 return TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1998 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
1999
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2000 if (options->thumbnails.enable_caching &&
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2001 options->thumbnails.spec_standard) return FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2002
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2003 if (!pref_list_int_get(PAN_PREF_GROUP, PAN_PREF_HIDE_WARNING, &hide_dlg)) hide_dlg = FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2004 if (hide_dlg) return FALSE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2005
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2006 gd = generic_dialog_new(_("Pan View Performance"), "pan_view_warning", NULL, FALSE,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2007 NULL, NULL);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2008 gd->data = file_data_ref(dir_fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2009 generic_dialog_add_button(gd, GTK_STOCK_OK, NULL,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2010 pan_warning_ok_cb, TRUE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2011
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2012 box = generic_dialog_add_message(gd, GTK_STOCK_DIALOG_INFO,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2013 _("Pan view performance may be poor."),
2797
6ed30da8b62d Pan view warning window
Colin Clark <colin.clark@cclark.uk>
parents: 2768
diff changeset
2014 _("To improve the performance of thumbnails in\npan view the following options can be enabled.\n\nNote that both options must be enabled to\nnotice a change in performance."), TRUE);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2015
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2016 group = pref_box_new(box, FALSE, GTK_ORIENTATION_HORIZONTAL, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2017 pref_spacer(group, PREF_PAD_INDENT);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2018 group = pref_box_new(group, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2019
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2020 ct_button = pref_checkbox_new_int(group, _("Cache thumbnails"),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2021 options->thumbnails.enable_caching, &options->thumbnails.enable_caching);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2022 button = pref_checkbox_new_int(group, _("Use shared thumbnail cache"),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2023 options->thumbnails.spec_standard, &options->thumbnails.spec_standard);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2024 pref_checkbox_link_sensitivity(ct_button, button);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2025
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2026 pref_line(box, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2027
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2028 pref_checkbox_new(box, _("Do not show this dialog again"), hide_dlg,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2029 G_CALLBACK(pan_warning_hide_cb), NULL);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2030
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2031 gtk_widget_show(gd->dialog);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2032
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2033 return TRUE;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2034 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2035
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2036
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2037 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2038 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2039 * entry point
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2040 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2041 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2042
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2043 void pan_window_new(FileData *dir_fd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2044 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2045 if (pan_warning(dir_fd)) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2046
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2047 pan_window_new_real(dir_fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2048 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2049
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2050
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2051 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2052 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2053 * menus
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2054 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2055 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2056
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2057 #define INFO_IMAGE_SIZE_KEY "image_size_data"
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2058
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2059
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2060 static void pan_new_window_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2061 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2062 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2063 FileData *fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2064
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2065 fd = pan_menu_click_fd(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2066 if (fd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2067 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2068 pan_fullscreen_toggle(pw, TRUE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2069 view_window_new(fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2070 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2071 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2072
2764
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2073 static void pan_go_to_original_cb(GtkWidget *widget, gpointer data)
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2074 {
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2075 LayoutWindow *lw = NULL;
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2076 PanWindow *pw = data;
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2077 FileData *fd;
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2078
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2079 if (!layout_valid(&lw)) return;
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2080
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2081 fd = pan_menu_click_fd(pw);
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2082 if (fd)
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2083 {
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2084 layout_set_fd(lw, fd);
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2085 }
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2086 }
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2087
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2088 static void pan_edit_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2089 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2090 PanWindow *pw;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2091 FileData *fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2092 const gchar *key = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2093
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2094 pw = submenu_item_get_data(widget);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2095 if (!pw) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2096
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2097 fd = pan_menu_click_fd(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2098 if (fd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2099 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2100 if (!editor_window_flag_set(key))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2101 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2102 pan_fullscreen_toggle(pw, TRUE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2103 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2104 file_util_start_editor_from_file(key, fd, pw->imd->widget);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2105 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2106 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2107
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2108 static void pan_zoom_in_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2109 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2110 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2111
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2112 image_zoom_adjust(pw->imd, ZOOM_INCREMENT);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2113 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2114
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2115 static void pan_zoom_out_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2116 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2117 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2118
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2119 image_zoom_adjust(pw->imd, -ZOOM_INCREMENT);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2120 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2121
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2122 static void pan_zoom_1_1_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2123 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2124 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2125
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2126 image_zoom_set(pw->imd, 1.0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2127 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2128
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2129 static void pan_copy_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2130 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2131 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2132 FileData *fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2133
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2134 fd = pan_menu_click_fd(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2135 if (fd) file_util_copy(fd, NULL, NULL, pw->imd->widget);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2136 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2137
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2138 static void pan_move_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2139 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2140 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2141 FileData *fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2142
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2143 fd = pan_menu_click_fd(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2144 if (fd) file_util_move(fd, NULL, NULL, pw->imd->widget);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2145 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2146
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2147 static void pan_rename_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2148 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2149 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2150 FileData *fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2151
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2152 fd = pan_menu_click_fd(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2153 if (fd) file_util_rename(fd, NULL, pw->imd->widget);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2154 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2155
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2156 static void pan_delete_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2157 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2158 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2159 FileData *fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2160
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2161 fd = pan_menu_click_fd(pw);
2860
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2162 if (fd)
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2163 {
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2164 options->file_ops.safe_delete_enable = FALSE;
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2165 file_util_delete(fd, NULL, pw->imd->widget);
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2166 }
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2167 }
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2168
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2169 static void pan_move_to_trash_cb(GtkWidget *widget, gpointer data)
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2170 {
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2171 PanWindow *pw = data;
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2172 FileData *fd;
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2173
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2174 fd = pan_menu_click_fd(pw);
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2175 if (fd)
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2176 {
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2177 options->file_ops.safe_delete_enable = TRUE;
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2178 file_util_delete(fd, NULL, pw->imd->widget);
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2179 }
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2180 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2181
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2182 static void pan_copy_path_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2183 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2184 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2185 FileData *fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2186
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2187 fd = pan_menu_click_fd(pw);
2663
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2188 if (fd) file_util_copy_path_to_clipboard(fd, TRUE);
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2189 }
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2190
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2191 static void pan_copy_path_unquoted_cb(GtkWidget *widget, gpointer data)
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2192 {
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2193 PanWindow *pw = data;
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2194 FileData *fd;
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2195
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2196 fd = pan_menu_click_fd(pw);
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2197 if (fd) file_util_copy_path_to_clipboard(fd, FALSE);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2198 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2199
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2200 static void pan_exif_date_toggle_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2201 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2202 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2203
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2204 pw->exif_date_enable = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2205 pan_layout_update(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2206 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2207
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2208 static void pan_info_toggle_exif_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2209 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2210 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2211
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2212 pw->info_includes_exif = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2213 /* fixme: sync info now */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2214 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2215
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2216 static void pan_info_toggle_image_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2217 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2218 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2219
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2220 pw->info_image_size = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), INFO_IMAGE_SIZE_KEY));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2221 /* fixme: sync info now */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2222 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2223
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2224 static void pan_fullscreen_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2225 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2226 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2227
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2228 pan_fullscreen_toggle(pw, FALSE);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2229 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2230
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2231 static void pan_close_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2232 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2233 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2234
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2235 pan_window_close(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2236 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2237
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2238 static void pan_popup_menu_destroy_cb(GtkWidget *widget, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2239 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2240 GList *editmenu_fd_list = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2241
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2242 filelist_free(editmenu_fd_list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2243 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2244
2768
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2245 static void pan_play_cb(GtkWidget *widget, gpointer data)
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2246 {
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2247 PanWindow *pw = data;
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2248
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2249 start_editor_from_file(options->image_l_click_video_editor, pw->click_pi->fd);
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2250 }
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2251
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2252 static GList *pan_view_get_fd_list(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2253 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2254 GList *list = NULL;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2255 FileData *fd = pan_menu_click_fd(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2256
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2257 if (fd) list = g_list_prepend(filelist_copy(fd->sidecar_files), file_data_ref(fd));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2258
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2259 return list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2260 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2261
2583
6e92c0ad76f2 Change recent code comments to Doxygen style
Colin Clark <colin.clark@cclark.uk>
parents: 2582
diff changeset
2262 /**
6e92c0ad76f2 Change recent code comments to Doxygen style
Colin Clark <colin.clark@cclark.uk>
parents: 2582
diff changeset
2263 * @brief Add file selection list to a collection
6e92c0ad76f2 Change recent code comments to Doxygen style
Colin Clark <colin.clark@cclark.uk>
parents: 2582
diff changeset
2264 * @param[in] widget
6e92c0ad76f2 Change recent code comments to Doxygen style
Colin Clark <colin.clark@cclark.uk>
parents: 2582
diff changeset
2265 * @param[in] data Index to the collection list menu item selected, or -1 for new collection
6e92c0ad76f2 Change recent code comments to Doxygen style
Colin Clark <colin.clark@cclark.uk>
parents: 2582
diff changeset
2266 *
6e92c0ad76f2 Change recent code comments to Doxygen style
Colin Clark <colin.clark@cclark.uk>
parents: 2582
diff changeset
2267 *
2582
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2268 */
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2269 static void pan_pop_menu_collections_cb(GtkWidget *widget, gpointer data)
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2270 {
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2271 PanWindow *pw;
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2272 GList *selection_list = NULL;
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2273
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2274 pw = submenu_item_get_data(widget);
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2275 selection_list = g_list_append(selection_list, pan_menu_click_fd(pw));
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2276 pop_menu_collections(selection_list, data);
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2277
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2278 filelist_free(selection_list);
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2279 }
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2280
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2281 static GtkWidget *pan_popup_menu(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2282 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2283 GtkWidget *menu;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2284 GtkWidget *submenu;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2285 GtkWidget *item;
2768
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2286 gboolean active, video;
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2287 GList *editmenu_fd_list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2288
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2289 active = (pw->click_pi != NULL);
2768
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2290 video = (active && pw->click_pi->fd && pw->click_pi->fd->format_class == FORMAT_CLASS_VIDEO);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2291
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2292 menu = popup_menu_short_lived();
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2293
2768
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2294 menu_item_add_stock_sensitive(menu, _("_Play"), GTK_STOCK_MEDIA_PLAY, video,
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2295 G_CALLBACK(pan_play_cb), pw);
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2296 menu_item_add_divider(menu);
7d275582e37d Fix #612: Pan view image class filtering
Tomasz Golinski <tomaszg@math.uwb.edu.pl>
parents: 2764
diff changeset
2297
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2298 menu_item_add_stock(menu, _("Zoom _in"), GTK_STOCK_ZOOM_IN,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2299 G_CALLBACK(pan_zoom_in_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2300 menu_item_add_stock(menu, _("Zoom _out"), GTK_STOCK_ZOOM_OUT,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2301 G_CALLBACK(pan_zoom_out_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2302 menu_item_add_stock(menu, _("Zoom _1:1"), GTK_STOCK_ZOOM_100,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2303 G_CALLBACK(pan_zoom_1_1_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2304 menu_item_add_divider(menu);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2305
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2306 editmenu_fd_list = pan_view_get_fd_list(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2307 g_signal_connect(G_OBJECT(menu), "destroy",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2308 G_CALLBACK(pan_popup_menu_destroy_cb), editmenu_fd_list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2309
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2310 submenu_add_edit(menu, &item, G_CALLBACK(pan_edit_cb), pw, editmenu_fd_list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2311 gtk_widget_set_sensitive(item, active);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2312
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2313 menu_item_add_stock_sensitive(menu, _("View in _new window"), GTK_STOCK_NEW, active,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2314 G_CALLBACK(pan_new_window_cb), pw);
2764
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2315 menu_item_add_stock(menu, _("Go to original"), GTK_STOCK_FIND,
4ef24fe642b5 Pan view - right click menu goto original
Colin Clark <colin.clark@cclark.uk>
parents: 2759
diff changeset
2316 G_CALLBACK(pan_go_to_original_cb), pw);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2317
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2318 menu_item_add_divider(menu);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2319 menu_item_add_stock_sensitive(menu, _("_Copy..."), GTK_STOCK_COPY, active,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2320 G_CALLBACK(pan_copy_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2321 menu_item_add_sensitive(menu, _("_Move..."), active,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2322 G_CALLBACK(pan_move_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2323 menu_item_add_sensitive(menu, _("_Rename..."), active,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2324 G_CALLBACK(pan_rename_cb), pw);
2572
31c6e3c9163e Fix #505: ‘Copy path’ and ‘Delete’ are too close in the drop down menu
Colin Clark <colin.clark@cclark.uk>
parents: 2530
diff changeset
2325 menu_item_add_sensitive(menu, _("_Copy path"), active,
31c6e3c9163e Fix #505: ‘Copy path’ and ‘Delete’ are too close in the drop down menu
Colin Clark <colin.clark@cclark.uk>
parents: 2530
diff changeset
2326 G_CALLBACK(pan_copy_path_cb), pw);
2663
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2327 menu_item_add_sensitive(menu, _("_Copy path unquoted"), active,
3e6d26094fb4 Fix #520: copy path inserts quotes around path
Colin Clark <colin.clark@cclark.uk>
parents: 2587
diff changeset
2328 G_CALLBACK(pan_copy_path_unquoted_cb), pw);
2860
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2329
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2330 menu_item_add_divider(menu);
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2331 menu_item_add_stock_sensitive(menu,
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2332 options->file_ops.confirm_move_to_trash ? _("Move to Trash...") :
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2333 _("Move to Trash"), PIXBUF_INLINE_ICON_TRASH, active,
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2334 G_CALLBACK(pan_move_to_trash_cb), pw);
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2335 menu_item_add_stock_sensitive(menu,
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2336 options->file_ops.confirm_delete ? _("_Delete...") :
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2337 _("_Delete"), GTK_STOCK_DELETE, active,
b20a96b979a3 Fix #437: Delete to standard Trash directory
Colin Clark <colin.clark@cclark.uk>
parents: 2797
diff changeset
2338 G_CALLBACK(pan_delete_cb), pw);
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2339
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2340 menu_item_add_divider(menu);
2582
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2341
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2342 submenu = submenu_add_collections(menu, &item,
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2343 G_CALLBACK(pan_pop_menu_collections_cb), pw);
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2344 gtk_widget_set_sensitive(item, TRUE);
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2345 menu_item_add_divider(menu);
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2346
03014a1eb7e7 Right-click menus - collections
Colin Clark <colin.clark@cclark.uk>
parents: 2572
diff changeset
2347
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2348 item = menu_item_add_check(menu, _("Sort by E_xif date"), pw->exif_date_enable,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2349 G_CALLBACK(pan_exif_date_toggle_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2350 gtk_widget_set_sensitive(item, (pw->layout == PAN_LAYOUT_TIMELINE || pw->layout == PAN_LAYOUT_CALENDAR));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2351
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2352 menu_item_add_divider(menu);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2353
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2354 menu_item_add_check(menu, _("_Show Exif information"), pw->info_includes_exif,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2355 G_CALLBACK(pan_info_toggle_exif_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2356 item = menu_item_add(menu, _("Show im_age"), NULL, NULL);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2357 submenu = gtk_menu_new();
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2358 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2359
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2360 item = menu_item_add_check(submenu, _("_None"), (pw->info_image_size == PAN_IMAGE_SIZE_THUMB_NONE),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2361 G_CALLBACK(pan_info_toggle_image_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2362 g_object_set_data(G_OBJECT(item), INFO_IMAGE_SIZE_KEY, GINT_TO_POINTER(PAN_IMAGE_SIZE_THUMB_NONE));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2363
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2364 item = menu_item_add_check(submenu, _("_Full size"), (pw->info_image_size == PAN_IMAGE_SIZE_100),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2365 G_CALLBACK(pan_info_toggle_image_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2366 g_object_set_data(G_OBJECT(item), INFO_IMAGE_SIZE_KEY, GINT_TO_POINTER(PAN_IMAGE_SIZE_100));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2367
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2368 item = menu_item_add_check(submenu, _("1:2 (50%)"), (pw->info_image_size == PAN_IMAGE_SIZE_50),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2369 G_CALLBACK(pan_info_toggle_image_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2370 g_object_set_data(G_OBJECT(item), INFO_IMAGE_SIZE_KEY, GINT_TO_POINTER(PAN_IMAGE_SIZE_50));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2371
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2372 item = menu_item_add_check(submenu, _("1:3 (33%)"), (pw->info_image_size == PAN_IMAGE_SIZE_33),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2373 G_CALLBACK(pan_info_toggle_image_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2374 g_object_set_data(G_OBJECT(item), INFO_IMAGE_SIZE_KEY, GINT_TO_POINTER(PAN_IMAGE_SIZE_33));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2375
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2376 item = menu_item_add_check(submenu, _("1:4 (25%)"), (pw->info_image_size == PAN_IMAGE_SIZE_25),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2377 G_CALLBACK(pan_info_toggle_image_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2378 g_object_set_data(G_OBJECT(item), INFO_IMAGE_SIZE_KEY, GINT_TO_POINTER(PAN_IMAGE_SIZE_25));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2379
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2380 item = menu_item_add_check(submenu, _("1:10 (10%)"), (pw->info_image_size == PAN_IMAGE_SIZE_10),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2381 G_CALLBACK(pan_info_toggle_image_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2382 g_object_set_data(G_OBJECT(item), INFO_IMAGE_SIZE_KEY, GINT_TO_POINTER(PAN_IMAGE_SIZE_10));
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2383
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2384
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2385
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2386 menu_item_add_divider(menu);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2387
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2388 if (pw->fs)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2389 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2390 menu_item_add(menu, _("Exit _full screen"), G_CALLBACK(pan_fullscreen_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2391 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2392 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2393 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2394 menu_item_add(menu, _("_Full screen"), G_CALLBACK(pan_fullscreen_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2395 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2396
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2397 menu_item_add_divider(menu);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2398 menu_item_add_stock(menu, _("C_lose window"), GTK_STOCK_CLOSE, G_CALLBACK(pan_close_cb), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2399
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2400 return menu;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2401 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2402
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2403
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2404 /*
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2405 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2406 * drag and drop
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2407 *-----------------------------------------------------------------------------
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2408 */
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2409
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2410 static void pan_window_get_dnd_data(GtkWidget *widget, GdkDragContext *context,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2411 gint x, gint y,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2412 GtkSelectionData *selection_data, guint info,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2413 guint time, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2414 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2415 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2416
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2417 if (gtk_drag_get_source_widget(context) == pw->imd->pr) return;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2418
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2419 if (info == TARGET_URI_LIST)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2420 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2421 GList *list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2422
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2423 list = uri_filelist_from_gtk_selection_data(selection_data);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2424 if (list && isdir(((FileData *)list->data)->path))
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2425 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2426 FileData *fd = list->data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2427
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2428 pan_layout_set_fd(pw, fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2429 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2430
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2431 filelist_free(list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2432 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2433 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2434
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2435 static void pan_window_set_dnd_data(GtkWidget *widget, GdkDragContext *context,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2436 GtkSelectionData *selection_data, guint info,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2437 guint time, gpointer data)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2438 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2439 PanWindow *pw = data;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2440 FileData *fd;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2441
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2442 fd = pan_menu_click_fd(pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2443 if (fd)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2444 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2445 GList *list;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2446
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2447 list = g_list_append(NULL, fd);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2448 uri_selection_data_set_uris_from_filelist(selection_data, list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2449 g_list_free(list);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2450 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2451 else
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2452 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2453 gtk_selection_data_set(selection_data, gtk_selection_data_get_target(selection_data),
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2454 8, NULL, 0);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2455 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2456 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2457
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2458 static void pan_window_dnd_init(PanWindow *pw)
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2459 {
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2460 GtkWidget *widget;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2461
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2462 widget = pw->imd->pr;
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2463
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2464 gtk_drag_source_set(widget, GDK_BUTTON2_MASK,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2465 dnd_file_drag_types, dnd_file_drag_types_count,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2466 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2467 g_signal_connect(G_OBJECT(widget), "drag_data_get",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2468 G_CALLBACK(pan_window_set_dnd_data), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2469
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2470 gtk_drag_dest_set(widget,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2471 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2472 dnd_file_drop_types, dnd_file_drop_types_count,
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2473 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2474 g_signal_connect(G_OBJECT(widget), "drag_data_received",
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2475 G_CALLBACK(pan_window_get_dnd_data), pw);
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2476 }
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2477
d2539dd6858c Move pan-view components to their own subdir.
Omari Stephens <xsdg@google.com>
parents:
diff changeset
2478 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */