annotate src/pan-item.c @ 150:976fba0add7c

more operations with file marks
author nadvornik
date Sun, 25 Nov 2007 10:25:25 +0000
parents 71e1ebee420e
children f6e307c7bad6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
105
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
1 /*
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
2 * GQview
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
3 * (C) 2006 John Ellis
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
4 *
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
5 * Author: John Ellis
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
6 *
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
8 * Please read the included file COPYING for more information.
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
10 */
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
11
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
12
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
13 #include "gqview.h"
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
14 #include "pan-types.h"
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
15
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
16
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
17 /*
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
18 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
19 * item base functions
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
20 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
21 */
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
22
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
23 void pan_item_free(PanItem *pi)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
24 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
25 if (!pi) return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
26
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
27 if (pi->pixbuf) g_object_unref(pi->pixbuf);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 105
diff changeset
28 if (pi->fd) file_data_unref(pi->fd);
105
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
29 g_free(pi->text);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
30 g_free(pi->key);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
31 g_free(pi->data);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
32
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
33 g_free(pi);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
34 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
35
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
36 void pan_item_set_key(PanItem *pi, const gchar *key)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
37 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
38 gchar *tmp;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
39
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
40 if (!pi) return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
41
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
42 tmp = pi->key;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
43 pi->key = g_strdup(key);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
44 g_free(tmp);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
45 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
46
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
47 void pan_item_added(PanWindow *pw, PanItem *pi)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
48 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
49 if (!pi) return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
50 image_area_changed(pw->imd, pi->x, pi->y, pi->width, pi->height);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
51 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
52
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
53 void pan_item_remove(PanWindow *pw, PanItem *pi)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
54 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
55 if (!pi) return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
56
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
57 if (pw->click_pi == pi) pw->click_pi = NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
58 if (pw->queue_pi == pi) pw->queue_pi = NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
59 if (pw->search_pi == pi) pw->search_pi = NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
60 pw->queue = g_list_remove(pw->queue, pi);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
61
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
62 pw->list = g_list_remove(pw->list, pi);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
63 image_area_changed(pw->imd, pi->x, pi->y, pi->width, pi->height);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
64 pan_item_free(pi);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
65 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
66
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
67 void pan_item_size_by_item(PanItem *pi, PanItem *child, gint border)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
68 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
69 if (!pi || !child) return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
70
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
71 if (pi->x + pi->width < child->x + child->width + border)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
72 pi->width = child->x + child->width + border - pi->x;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
73
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
74 if (pi->y + pi->height < child->y + child->height + border)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
75 pi->height = child->y + child->height + border - pi->y;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
76 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
77
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
78 void pan_item_size_coordinates(PanItem *pi, gint border, gint *w, gint *h)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
79 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
80 if (!pi) return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
81
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
82 if (*w < pi->x + pi->width + border) *w = pi->x + pi->width + border;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
83 if (*h < pi->y + pi->height + border) *h = pi->y + pi->height + border;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
84 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
85
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
86
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
87 /*
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
88 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
89 * item box type
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
90 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
91 */
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
92
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
93 PanItem *pan_item_box_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
94 gint border_size,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
95 guint8 base_r, guint8 base_g, guint8 base_b, guint8 base_a,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
96 guint8 bord_r, guint8 bord_g, guint8 bord_b, guint8 bord_a)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
97 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
98 PanItem *pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
99
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
100 pi = g_new0(PanItem, 1);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
101 pi->type = PAN_ITEM_BOX;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
102 pi->fd = fd;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
103 pi->x = x;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
104 pi->y = y;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
105 pi->width = width;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
106 pi->height = height;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
107
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
108 pi->color_r = base_r;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
109 pi->color_g = base_g;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
110 pi->color_b = base_b;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
111 pi->color_a = base_a;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
112
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
113 pi->color2_r = bord_r;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
114 pi->color2_g = bord_g;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
115 pi->color2_b = bord_b;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
116 pi->color2_a = bord_a;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
117 pi->border = border_size;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
118
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
119 pw->list = g_list_prepend(pw->list, pi);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
120
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
121 return pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
122 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
123
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
124 void pan_item_box_shadow(PanItem *pi, gint offset, gint fade)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
125 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
126 gint *shadow;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
127
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
128 if (!pi || pi->type != PAN_ITEM_BOX) return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
129
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
130 shadow = pi->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
131 if (shadow)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
132 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
133 pi->width -= shadow[0];
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
134 pi->height -= shadow[0];
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
135 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
136
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
137 shadow = g_new0(gint, 2);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
138 shadow[0] = offset;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
139 shadow[1] = fade;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
140
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
141 pi->width += offset;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
142 pi->height += offset;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
143
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
144 g_free(pi->data);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
145 pi->data = shadow;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
146 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
147
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
148 gint pan_item_box_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
149 gint x, gint y, gint width, gint height)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
150 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
151 gint bw, bh;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
152 gint *shadow;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
153 gint rx, ry, rw, rh;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
154
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
155 bw = pi->width;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
156 bh = pi->height;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
157
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
158 shadow = pi->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
159 if (shadow)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
160 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
161 bw -= shadow[0];
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
162 bh -= shadow[0];
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
163
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
164 if (pi->color_a > 254)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
165 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
166 pixbuf_draw_shadow(pixbuf, pi->x - x + bw, pi->y - y + shadow[0],
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
167 shadow[0], bh - shadow[0],
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
168 pi->x - x + shadow[0], pi->y - y + shadow[0], bw, bh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
169 shadow[1],
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
170 PAN_SHADOW_COLOR, PAN_SHADOW_ALPHA);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
171 pixbuf_draw_shadow(pixbuf, pi->x - x + shadow[0], pi->y - y + bh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
172 bw, shadow[0],
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
173 pi->x - x + shadow[0], pi->y - y + shadow[0], bw, bh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
174 shadow[1],
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
175 PAN_SHADOW_COLOR, PAN_SHADOW_ALPHA);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
176 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
177 else
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
178 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
179 gint a;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
180 a = pi->color_a * PAN_SHADOW_ALPHA >> 8;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
181 pixbuf_draw_shadow(pixbuf, pi->x - x + shadow[0], pi->y - y + shadow[0],
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
182 bw, bh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
183 pi->x - x + shadow[0], pi->y - y + shadow[0], bw, bh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
184 shadow[1],
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
185 PAN_SHADOW_COLOR, a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
186 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
187 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
188
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
189 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
190 pi->x, pi->y, bw, bh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
191 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
192 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
193 pixbuf_draw_rect_fill(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
194 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
195 pi->color_r, pi->color_g, pi->color_b, pi->color_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
196 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
197 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
198 pi->x, pi->y, bw, pi->border,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
199 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
200 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
201 pixbuf_draw_rect_fill(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
202 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
203 pi->color2_r, pi->color2_g, pi->color2_b, pi->color2_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
204 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
205 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
206 pi->x, pi->y + pi->border, pi->border, bh - pi->border * 2,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
207 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
208 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
209 pixbuf_draw_rect_fill(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
210 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
211 pi->color2_r, pi->color2_g, pi->color2_b, pi->color2_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
212 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
213 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
214 pi->x + bw - pi->border, pi->y + pi->border,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
215 pi->border, bh - pi->border * 2,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
216 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
217 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
218 pixbuf_draw_rect_fill(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
219 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
220 pi->color2_r, pi->color2_g, pi->color2_b, pi->color2_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
221 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
222 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
223 pi->x, pi->y + bh - pi->border,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
224 bw, pi->border,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
225 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
226 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
227 pixbuf_draw_rect_fill(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
228 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
229 pi->color2_r, pi->color2_g, pi->color2_b, pi->color2_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
230 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
231
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
232 return FALSE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
233 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
234
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
235
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
236 /*
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
237 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
238 * item triangle type
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
239 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
240 */
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
241
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
242 PanItem *pan_item_tri_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
243 gint x1, gint y1, gint x2, gint y2, gint x3, gint y3,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
244 guint8 r, guint8 g, guint8 b, guint8 a)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
245 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
246 PanItem *pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
247 gint *coord;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
248
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
249 pi = g_new0(PanItem, 1);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
250 pi->type = PAN_ITEM_TRIANGLE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
251 pi->x = x;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
252 pi->y = y;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
253 pi->width = width;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
254 pi->height = height;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
255
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
256 pi->color_r = r;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
257 pi->color_g = g;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
258 pi->color_b = b;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
259 pi->color_a = a;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
260
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
261 coord = g_new0(gint, 6);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
262 coord[0] = x1;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
263 coord[1] = y1;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
264 coord[2] = x2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
265 coord[3] = y2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
266 coord[4] = x3;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
267 coord[5] = y3;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
268
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
269 pi->data = coord;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
270
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
271 pi->border = PAN_BORDER_NONE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
272
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
273 pw->list = g_list_prepend(pw->list, pi);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
274
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
275 return pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
276 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
277
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
278 void pan_item_tri_border(PanItem *pi, gint borders,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
279 guint8 r, guint8 g, guint8 b, guint8 a)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
280 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
281 if (!pi || pi->type != PAN_ITEM_TRIANGLE) return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
282
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
283 pi->border = borders;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
284
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
285 pi->color2_r = r;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
286 pi->color2_g = g;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
287 pi->color2_b = b;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
288 pi->color2_a = a;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
289 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
290
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
291 gint pan_item_tri_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
292 gint x, gint y, gint width, gint height)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
293 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
294 gint rx, ry, rw, rh;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
295
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
296 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
297 pi->x, pi->y, pi->width, pi->height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
298 &rx, &ry, &rw, &rh) && pi->data)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
299 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
300 gint *coord = pi->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
301 pixbuf_draw_triangle(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
302 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
303 coord[0] - x, coord[1] - y,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
304 coord[2] - x, coord[3] - y,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
305 coord[4] - x, coord[5] - y,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
306 pi->color_r, pi->color_g, pi->color_b, pi->color_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
307
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
308 if (pi->border & PAN_BORDER_1)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
309 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
310 pixbuf_draw_line(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
311 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
312 coord[0] - x, coord[1] - y,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
313 coord[2] - x, coord[3] - y,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
314 pi->color2_r, pi->color2_g, pi->color2_b, pi->color2_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
315 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
316 if (pi->border & PAN_BORDER_2)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
317 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
318 pixbuf_draw_line(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
319 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
320 coord[2] - x, coord[3] - y,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
321 coord[4] - x, coord[5] - y,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
322 pi->color2_r, pi->color2_g, pi->color2_b, pi->color2_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
323 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
324 if (pi->border & PAN_BORDER_3)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
325 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
326 pixbuf_draw_line(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
327 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
328 coord[4] - x, coord[5] - y,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
329 coord[0] - x, coord[1] - y,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
330 pi->color2_r, pi->color2_g, pi->color2_b, pi->color2_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
331 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
332 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
333
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
334 return FALSE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
335 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
336
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
337
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
338 /*
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
339 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
340 * item text type
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
341 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
342 */
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
343
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
344 static PangoLayout *pan_item_text_layout(PanItem *pi, GtkWidget *widget)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
345 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
346 PangoLayout *layout;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
347
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
348 layout = gtk_widget_create_pango_layout(widget, NULL);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
349
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
350 if (pi->text_attr & PAN_TEXT_ATTR_MARKUP)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
351 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
352 pango_layout_set_markup(layout, pi->text, -1);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
353 return layout;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
354 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
355
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
356 if (pi->text_attr & PAN_TEXT_ATTR_BOLD ||
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
357 pi->text_attr & PAN_TEXT_ATTR_HEADING)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
358 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
359 PangoAttrList *pal;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
360 PangoAttribute *pa;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
361
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
362 pal = pango_attr_list_new();
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
363 if (pi->text_attr & PAN_TEXT_ATTR_BOLD)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
364 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
365 pa = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
366 pa->start_index = 0;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
367 pa->end_index = G_MAXINT;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
368 pango_attr_list_insert(pal, pa);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
369 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
370 if (pi->text_attr & PAN_TEXT_ATTR_HEADING)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
371 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
372 pa = pango_attr_scale_new(PANGO_SCALE_LARGE);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
373 pa->start_index = 0;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
374 pa->end_index = G_MAXINT;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
375 pango_attr_list_insert(pal, pa);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
376 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
377 pango_layout_set_attributes(layout, pal);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
378 pango_attr_list_unref(pal);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
379 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
380
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
381 pango_layout_set_text(layout, pi->text, -1);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
382 return layout;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
383 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
384
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
385 static void pan_item_text_compute_size(PanItem *pi, GtkWidget *widget)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
386 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
387 PangoLayout *layout;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
388
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
389 if (!pi || !pi->text || !widget) return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
390
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
391 layout = pan_item_text_layout(pi, widget);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
392 pango_layout_get_pixel_size(layout, &pi->width, &pi->height);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
393 g_object_unref(G_OBJECT(layout));
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
394
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
395 pi->width += pi->border * 2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
396 pi->height += pi->border * 2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
397 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
398
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
399 PanItem *pan_item_text_new(PanWindow *pw, gint x, gint y, const gchar *text,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
400 PanTextAttrType attr, PanBorderType border,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
401 guint8 r, guint8 g, guint8 b, guint8 a)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
402 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
403 PanItem *pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
404
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
405 pi = g_new0(PanItem, 1);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
406 pi->type = PAN_ITEM_TEXT;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
407 pi->x = x;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
408 pi->y = y;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
409 pi->text = g_strdup(text);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
410 pi->text_attr = attr;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
411
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
412 pi->color_r = r;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
413 pi->color_g = g;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
414 pi->color_b = b;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
415 pi->color_a = a;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
416
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
417 pi->border = border;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
418
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
419 pan_item_text_compute_size(pi, pw->imd->pr);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
420
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
421 pw->list = g_list_prepend(pw->list, pi);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
422
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
423 return pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
424 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
425
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
426 gint pan_item_text_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
427 gint x, gint y, gint width, gint height)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
428 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
429 PangoLayout *layout;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
430
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
431 layout = pan_item_text_layout(pi, (GtkWidget *)pr);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
432 pixbuf_draw_layout(pixbuf, layout, (GtkWidget *)pr,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
433 pi->x - x + pi->border, pi->y - y + pi->border,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
434 pi->color_r, pi->color_g, pi->color_b, pi->color_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
435 g_object_unref(G_OBJECT(layout));
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
436
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
437 return FALSE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
438 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
439
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
440
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
441 /*
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
442 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
443 * item thumbnail type
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
444 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
445 */
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
446
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
447 PanItem *pan_item_thumb_new(PanWindow *pw, FileData *fd, gint x, gint y)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
448 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
449 PanItem *pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
450
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
451 pi = g_new0(PanItem, 1);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
452 pi->type = PAN_ITEM_THUMB;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
453 pi->fd = fd;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
454 pi->x = x;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
455 pi->y = y;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
456 pi->width = PAN_THUMB_SIZE + PAN_SHADOW_OFFSET * 2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
457 pi->height = PAN_THUMB_SIZE + PAN_SHADOW_OFFSET * 2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
458
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
459 pi->pixbuf = NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
460
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
461 pi->queued = FALSE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
462
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
463 pw->list = g_list_prepend(pw->list, pi);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
464
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
465 return pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
466 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
467
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
468 gint pan_item_thumb_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
469 gint x, gint y, gint width, gint height)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
470 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
471 gint tx, ty, tw, th;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
472 gint rx, ry, rw, rh;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
473
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
474 if (pi->pixbuf)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
475 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
476 tw = gdk_pixbuf_get_width(pi->pixbuf);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
477 th = gdk_pixbuf_get_height(pi->pixbuf);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
478
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
479 tx = pi->x + (pi->width - tw) / 2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
480 ty = pi->y + (pi->height - th) / 2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
481
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
482 if (gdk_pixbuf_get_has_alpha(pi->pixbuf))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
483 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
484 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
485 tx + PAN_SHADOW_OFFSET, ty + PAN_SHADOW_OFFSET, tw, th,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
486 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
487 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
488 pixbuf_draw_shadow(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
489 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
490 tx + PAN_SHADOW_OFFSET - x, ty + PAN_SHADOW_OFFSET - y, tw, th,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
491 PAN_SHADOW_FADE,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
492 PAN_SHADOW_COLOR, PAN_SHADOW_ALPHA);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
493 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
494 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
495 else
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
496 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
497 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
498 tx + tw, ty + PAN_SHADOW_OFFSET,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
499 PAN_SHADOW_OFFSET, th - PAN_SHADOW_OFFSET,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
500 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
501 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
502 pixbuf_draw_shadow(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
503 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
504 tx + PAN_SHADOW_OFFSET - x, ty + PAN_SHADOW_OFFSET - y, tw, th,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
505 PAN_SHADOW_FADE,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
506 PAN_SHADOW_COLOR, PAN_SHADOW_ALPHA);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
507 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
508 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
509 tx + PAN_SHADOW_OFFSET, ty + th, tw, PAN_SHADOW_OFFSET,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
510 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
511 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
512 pixbuf_draw_shadow(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
513 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
514 tx + PAN_SHADOW_OFFSET - x, ty + PAN_SHADOW_OFFSET - y, tw, th,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
515 PAN_SHADOW_FADE,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
516 PAN_SHADOW_COLOR, PAN_SHADOW_ALPHA);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
517 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
518 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
519
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
520 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
521 tx, ty, tw, th,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
522 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
523 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
524 gdk_pixbuf_composite(pi->pixbuf, pixbuf, rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
525 (double) tx - x,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
526 (double) ty - y,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
527 1.0, 1.0, GDK_INTERP_NEAREST,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
528 255);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
529 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
530
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
531 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
532 tx, ty, tw, PAN_OUTLINE_THICKNESS,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
533 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
534 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
535 pixbuf_draw_rect_fill(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
536 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
537 PAN_OUTLINE_COLOR_1, PAN_OUTLINE_ALPHA);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
538 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
539 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
540 tx, ty, PAN_OUTLINE_THICKNESS, th,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
541 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
542 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
543 pixbuf_draw_rect_fill(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
544 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
545 PAN_OUTLINE_COLOR_1, PAN_OUTLINE_ALPHA);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
546 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
547 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
548 tx + tw - PAN_OUTLINE_THICKNESS, ty + PAN_OUTLINE_THICKNESS,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
549 PAN_OUTLINE_THICKNESS, th - PAN_OUTLINE_THICKNESS,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
550 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
551 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
552 pixbuf_draw_rect_fill(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
553 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
554 PAN_OUTLINE_COLOR_2, PAN_OUTLINE_ALPHA);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
555 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
556 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
557 tx + PAN_OUTLINE_THICKNESS, ty + th - PAN_OUTLINE_THICKNESS,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
558 tw - PAN_OUTLINE_THICKNESS * 2, PAN_OUTLINE_THICKNESS,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
559 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
560 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
561 pixbuf_draw_rect_fill(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
562 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
563 PAN_OUTLINE_COLOR_2, PAN_OUTLINE_ALPHA);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
564 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
565 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
566 else
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
567 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
568 tw = pi->width - PAN_SHADOW_OFFSET * 2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
569 th = pi->height - PAN_SHADOW_OFFSET * 2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
570 tx = pi->x + PAN_SHADOW_OFFSET;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
571 ty = pi->y + PAN_SHADOW_OFFSET;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
572
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
573 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
574 tx, ty, tw, th,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
575 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
576 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
577 gint d;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
578
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
579 d = (pw->size <= PAN_IMAGE_SIZE_THUMB_NONE) ? 2 : 8;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
580 pixbuf_draw_rect_fill(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
581 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
582 PAN_SHADOW_COLOR,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
583 PAN_SHADOW_ALPHA / d);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
584 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
585 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
586
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
587 return (pi->pixbuf == NULL);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
588 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
589
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
590
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
591 /*
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
592 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
593 * item image type
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
594 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
595 */
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
596
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
597 static void pan_item_image_find_size(PanWindow *pw, PanItem *pi, gint w, gint h)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
598 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
599 GList *work;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
600
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
601 pi->width = w;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
602 pi->height = h;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
603
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
604 if (!pi->fd) return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
605
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
606 work = pw->cache_list;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
607 while (work)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
608 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
609 PanCacheData *pc;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
610
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
611 pc = work->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
612 work = work->next;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
613
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
614 if (pc->cd && pc->cd->dimensions &&
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 105
diff changeset
615 pc->fd && pc->fd == pi->fd)
105
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
616 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
617 pi->width = MAX(1, pc->cd->width * pw->image_size / 100);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
618 pi->height = MAX(1, pc->cd->height * pw->image_size / 100);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
619
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
620 pw->cache_list = g_list_remove(pw->cache_list, pc);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
621 cache_sim_data_free(pc->cd);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 105
diff changeset
622 file_data_unref(pc->fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 105
diff changeset
623 g_free(pc);
105
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
624 return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
625 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
626 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
627 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
628
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
629 PanItem *pan_item_image_new(PanWindow *pw, FileData *fd, gint x, gint y, gint w, gint h)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
630 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
631 PanItem *pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
632
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
633 pi = g_new0(PanItem, 1);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
634 pi->type = PAN_ITEM_IMAGE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
635 pi->fd = fd;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
636 pi->x = x;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
637 pi->y = y;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
638
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
639 pi->color_a = 255;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
640
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
641 pi->color2_r = 0;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
642 pi->color2_g = 0;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
643 pi->color2_b = 0;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
644 pi->color2_a = PAN_SHADOW_ALPHA / 2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
645
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
646 pan_item_image_find_size(pw, pi, w, h);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
647
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
648 pw->list = g_list_prepend(pw->list, pi);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
649
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
650 return pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
651 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
652
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
653 gint pan_item_image_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
654 gint x, gint y, gint width, gint height)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
655 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
656 gint rx, ry, rw, rh;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
657
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
658 if (util_clip_region(x, y, width, height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
659 pi->x, pi->y, pi->width, pi->height,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
660 &rx, &ry, &rw, &rh))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
661 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
662 if (pi->pixbuf)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
663 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
664 gdk_pixbuf_composite(pi->pixbuf, pixbuf, rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
665 (double) pi->x - x,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
666 (double) pi->y - y,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
667 1.0, 1.0, GDK_INTERP_NEAREST,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
668 pi->color_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
669 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
670 else
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
671 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
672 pixbuf_draw_rect_fill(pixbuf,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
673 rx - x, ry - y, rw, rh,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
674 pi->color2_r, pi->color2_g, pi->color2_b, pi->color2_a);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
675 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
676 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
677
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
678 return (pi->pixbuf == NULL);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
679 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
680
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
681
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
682 /*
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
683 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
684 * item lookup/search
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
685 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
686 */
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
687
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
688 PanItem *pan_item_find_by_key(PanWindow *pw, PanItemType type, const gchar *key)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
689 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
690 GList *work;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
691
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
692 if (!key) return NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
693
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
694 work = g_list_last(pw->list);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
695 while (work)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
696 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
697 PanItem *pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
698
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
699 pi = work->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
700 if ((pi->type == type || type == PAN_ITEM_NONE) &&
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
701 pi->key && strcmp(pi->key, key) == 0)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
702 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
703 return pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
704 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
705 work = work->prev;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
706 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
707 work = g_list_last(pw->list_static);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
708 while (work)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
709 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
710 PanItem *pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
711
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
712 pi = work->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
713 if ((pi->type == type || type == PAN_ITEM_NONE) &&
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
714 pi->key && strcmp(pi->key, key) == 0)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
715 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
716 return pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
717 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
718 work = work->prev;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
719 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
720
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
721 return NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
722 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
723
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
724 /* when ignore_case and partial are TRUE, path should be converted to lower case */
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
725 static GList *pan_item_find_by_path_l(GList *list, GList *search_list,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
726 PanItemType type, const gchar *path,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
727 gint ignore_case, gint partial)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
728 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
729 GList *work;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
730
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
731 work = g_list_last(search_list);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
732 while (work)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
733 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
734 PanItem *pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
735
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
736 pi = work->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
737 if ((pi->type == type || type == PAN_ITEM_NONE) && pi->fd)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
738 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
739 gint match = FALSE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
740
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
741 if (path[0] == '/')
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
742 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
743 if (pi->fd->path && strcmp(path, pi->fd->path) == 0) match = TRUE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
744 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
745 else if (pi->fd->name)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
746 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
747 if (partial)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
748 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
749 if (ignore_case)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
750 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
751 gchar *haystack;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
752
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
753 haystack = g_utf8_strdown(pi->fd->name, -1);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
754 match = (strstr(haystack, path) != NULL);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
755 g_free(haystack);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
756 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
757 else
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
758 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
759 if (strstr(pi->fd->name, path)) match = TRUE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
760 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
761 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
762 else if (ignore_case)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
763 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
764 if (strcasecmp(path, pi->fd->name) == 0) match = TRUE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
765 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
766 else
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
767 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
768 if (strcmp(path, pi->fd->name) == 0) match = TRUE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
769 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
770 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
771
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
772 if (match) list = g_list_prepend(list, pi);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
773 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
774 work = work->prev;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
775 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
776
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
777 return list;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
778 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
779
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
780 /* when ignore_case and partial are TRUE, path should be converted to lower case */
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
781 GList *pan_item_find_by_path(PanWindow *pw, PanItemType type, const gchar *path,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
782 gint ignore_case, gint partial)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
783 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
784 GList *list = NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
785
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
786 if (!path) return NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
787 if (partial && path[0] == '/') return NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
788
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
789 list = pan_item_find_by_path_l(list, pw->list_static, type, path, ignore_case, partial);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
790 list = pan_item_find_by_path_l(list, pw->list, type, path, ignore_case, partial);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
791
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
792 return g_list_reverse(list);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
793 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
794
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
795 static PanItem *pan_item_find_by_coord_l(GList *list, PanItemType type, gint x, gint y, const gchar *key)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
796 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
797 GList *work;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
798
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
799 work = list;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
800 while (work)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
801 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
802 PanItem *pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
803
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
804 pi = work->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
805 if ((pi->type == type || type == PAN_ITEM_NONE) &&
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
806 x >= pi->x && x < pi->x + pi->width &&
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
807 y >= pi->y && y < pi->y + pi->height &&
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
808 (!key || (pi->key && strcmp(pi->key, key) == 0)))
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
809 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
810 return pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
811 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
812 work = work->next;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
813 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
814
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
815 return NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
816 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
817
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
818 PanItem *pan_item_find_by_coord(PanWindow *pw, PanItemType type,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
819 gint x, gint y, const gchar *key)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
820 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
821 PanItem *pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
822
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
823 pi = pan_item_find_by_coord_l(pw->list, type, x, y, key);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
824 if (pi) return pi;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
825
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
826 return pan_item_find_by_coord_l(pw->list_static, type, x, y, key);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
827 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
828
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
829
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
830 /*
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
831 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
832 * text alignments
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
833 *-----------------------------------------------------------------------------
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
834 */
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
835
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
836 PanTextAlignment *pan_text_alignment_new(PanWindow *pw, gint x, gint y, const gchar *key)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
837 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
838 PanTextAlignment *ta;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
839
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
840 ta = g_new0(PanTextAlignment, 1);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
841
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
842 ta->pw = pw;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
843 ta->column1 = NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
844 ta->column2 = NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
845 ta->x = x;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
846 ta->y = y;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
847 ta->key = g_strdup(key);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
848
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
849 return ta;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
850 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
851
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
852 void pan_text_alignment_free(PanTextAlignment *ta)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
853 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
854 if (!ta) return;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
855
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
856 g_list_free(ta->column1);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
857 g_list_free(ta->column2);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
858 g_free(ta->key);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
859 g_free(ta);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
860 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
861
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
862 PanItem *pan_text_alignment_add(PanTextAlignment *ta, const gchar *label, const gchar *text)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
863 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
864 PanItem *item;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
865
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
866 if (label)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
867 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
868 item = pan_item_text_new(ta->pw, ta->x, ta->y, label,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
869 PAN_TEXT_ATTR_BOLD, 0,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
870 PAN_POPUP_TEXT_COLOR, 255);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
871 pan_item_set_key(item, ta->key);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
872 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
873 else
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
874 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
875 item = NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
876 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
877 ta->column1 = g_list_append(ta->column1, item);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
878
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
879 if (text)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
880 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
881 item = pan_item_text_new(ta->pw, ta->x, ta->y, text,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
882 PAN_TEXT_ATTR_NONE, 0,
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
883 PAN_POPUP_TEXT_COLOR, 255);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
884 pan_item_set_key(item, ta->key);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
885 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
886 else
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
887 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
888 item = NULL;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
889 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
890 ta->column2 = g_list_append(ta->column2, item);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
891
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
892 return item;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
893 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
894
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
895 void pan_text_alignment_calc(PanTextAlignment *ta, PanItem *box)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
896 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
897 gint cw1, cw2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
898 gint x, y;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
899 GList *work1;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
900 GList *work2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
901
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
902 cw1 = 0;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
903 cw2 = 0;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
904
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
905 work1 = ta->column1;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
906 while (work1)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
907 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
908 PanItem *p;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
909
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
910 p = work1->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
911 work1 = work1->next;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
912
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
913 if (p && p->width > cw1) cw1 = p->width;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
914 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
915
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
916 work2 = ta->column2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
917 while (work2)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
918 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
919 PanItem *p;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
920
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
921 p = work2->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
922 work2 = work2->next;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
923
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
924 if (p && p->width > cw2) cw2 = p->width;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
925 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
926
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
927 x = ta->x;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
928 y = ta->y;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
929 work1 = ta->column1;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
930 work2 = ta->column2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
931 while (work1 && work2)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
932 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
933 PanItem *p1;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
934 PanItem *p2;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
935 gint height = 0;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
936
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
937 p1 = work1->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
938 p2 = work2->data;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
939 work1 = work1->next;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
940 work2 = work2->next;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
941
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
942 if (p1)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
943 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
944 p1->x = x;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
945 p1->y = y;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
946 pan_item_size_by_item(box, p1, PREF_PAD_BORDER);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
947 height = p1->height;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
948 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
949 if (p2)
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
950 {
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
951 p2->x = x + cw1 + PREF_PAD_SPACE;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
952 p2->y = y;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
953 pan_item_size_by_item(box, p2, PREF_PAD_BORDER);
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
954 if (height < p2->height) height = p2->height;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
955 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
956
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
957 if (!p1 && !p2) height = PREF_PAD_GROUP;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
958
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
959 y += height;
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
960 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
961 }
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
962
de64a683d5d0 Thu Nov 9 17:43:06 2006 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
963