annotate src/layout.c @ 1589:05909b952b06

merged
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 01 May 2009 15:50:26 +0900
parents 9a64eda3e020 0434f34b1ee4
children 69f7270b3b27
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 166
diff changeset
2 * Geeqie
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
3 * (C) 2006 John Ellis
1284
8b89e3ff286b Add year 2009 to copyright info everywhere.
zas_
parents: 1279
diff changeset
4 * Copyright (C) 2008 - 2009 The Geeqie Team
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 278
diff changeset
13 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 #include "layout.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents: 506
diff changeset
16 #include "color-man.h"
586
905688aa2317 split filelist.c to filefilter.c and filedata.c
nadvornik
parents: 583
diff changeset
17 #include "filedata.h"
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents: 506
diff changeset
18 #include "histogram.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "image.h"
482
75b7154e6435 Use image_osd_toggle() in layout_menu_overlay_cb().
zas_
parents: 480
diff changeset
20 #include "image-overlay.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "layout_config.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "layout_image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "layout_util.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "menu.h"
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
25 #include "pixbuf-renderer.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 #include "pixbuf_util.h"
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
27 #include "utilops.h"
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
28 #include "view_dir.h"
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
29 #include "view_file.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 #include "ui_misc.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 #include "ui_tabcomp.h"
648
e34c1002e553 Move some functions from main.[ch] to new window.[ch].
zas_
parents: 632
diff changeset
34 #include "window.h"
1214
31402ecb2aed write metadata after timeout, image change or dir change
nadvornik
parents: 1177
diff changeset
35 #include "metadata.h"
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
36 #include "rcfile.h"
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
37 #include "bar.h"
1320
055ed09d5a03 improved bar_sort configuration
nadvornik
parents: 1317
diff changeset
38 #include "bar_sort.h"
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
39 #include "preferences.h"
648
e34c1002e553 Move some functions from main.[ch] to new window.[ch].
zas_
parents: 632
diff changeset
40
528
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
41 #ifdef HAVE_LIRC
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
42 #include "lirc.h"
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
43 #endif
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
45 #define MAINWINDOW_DEF_WIDTH 700
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
46 #define MAINWINDOW_DEF_HEIGHT 500
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47
553
32cf2e7992fd Change default positions of dividers since width of the main menu
zas_
parents: 531
diff changeset
48 #define MAIN_WINDOW_DIV_HPOS (MAINWINDOW_DEF_WIDTH / 2)
32cf2e7992fd Change default positions of dividers since width of the main menu
zas_
parents: 531
diff changeset
49 #define MAIN_WINDOW_DIV_VPOS (MAINWINDOW_DEF_HEIGHT / 2)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 #define TOOLWINDOW_DEF_WIDTH 260
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 #define TOOLWINDOW_DEF_HEIGHT 450
553
32cf2e7992fd Change default positions of dividers since width of the main menu
zas_
parents: 531
diff changeset
53
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 #define PROGRESS_WIDTH 150
1375
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
55 #define PIXEL_LABEL_WIDTH 130
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 #define ZOOM_LABEL_WIDTH 64
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 #define PANE_DIVIDER_SIZE 10
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 GList *layout_window_list = NULL;
1473
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
62 LayoutWindow *current_lw = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 * misc
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
73 gboolean layout_valid(LayoutWindow **lw)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 if (*lw == NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 {
1473
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
77 if (current_lw) *lw = current_lw;
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
78 else if (layout_window_list) *lw = layout_window_list->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 return (*lw != NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 return (g_list_find(layout_window_list, *lw) != NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84 LayoutWindow *layout_find_by_image(ImageWindow *imd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 work = layout_window_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 LayoutWindow *lw = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 if (lw->image == imd) return lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99
368
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
100 LayoutWindow *layout_find_by_image_fd(ImageWindow *imd)
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
101 {
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
102 GList *work;
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
103
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
104 work = layout_window_list;
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
105 while (work)
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
106 {
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
107 LayoutWindow *lw = work->data;
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
108 work = work->next;
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
109
368
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
110 if (lw->image->image_fd == imd->image_fd)
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
111 return lw;
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
112 }
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
113
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
114 return NULL;
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
115 }
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
116
1466
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
117 LayoutWindow *layout_find_by_layout_id(const gchar *id)
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
118 {
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
119 GList *work;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
120
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
121 if (!id || !id[0]) return NULL;
1473
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
122
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
123 if (strcmp(id, LAYOUT_ID_CURRENT) == 0)
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
124 {
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
125 if (current_lw) return current_lw;
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
126 if (layout_window_list) return layout_window_list->data;
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
127 return NULL;
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
128 }
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
129
1466
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
130 work = layout_window_list;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
131 while (work)
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
132 {
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
133 LayoutWindow *lw = work->data;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
134 work = work->next;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
135
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
136 if (lw->options.id && strcmp(id, lw->options.id) == 0)
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
137 return lw;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
138 }
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
139
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
140 return NULL;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
141 }
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
142
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
143 static void layout_set_unique_id(LayoutWindow *lw)
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
144 {
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
145 char id[10];
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
146 gint i;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
147 if (lw->options.id && lw->options.id[0]) return; /* id is already set */
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
148
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
149 g_free(lw->options.id);
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
150 lw->options.id = NULL;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
151
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
152 if (!layout_find_by_layout_id("main"))
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
153 {
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
154 lw->options.id = g_strdup("main");
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
155 return;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
156 }
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
157
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
158 i = 1;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
159 while (TRUE)
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
160 {
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
161 g_snprintf(id, sizeof(id), "lw%d", i);
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
162 if (!layout_find_by_layout_id(id))
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
163 {
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
164 lw->options.id = g_strdup(id);
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
165 return;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
166 }
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
167 i++;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
168 }
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
169 }
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
170
1473
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
171 static gboolean layout_set_current_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data)
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
172 {
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
173 LayoutWindow *lw = data;
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
174 current_lw = lw;
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
175 return FALSE;
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
176 }
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
177
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 * menu, toolbar, and dir view
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 static void layout_path_entry_changed_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 if (gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191 buf = g_strdup(gtk_entry_get_text(GTK_ENTRY(lw->path_entry)));
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
192 if (!lw->dir_fd || strcmp(buf, lw->dir_fd->path) != 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 {
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
194 layout_set_path(lw, buf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
197 g_free(buf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 static void layout_path_entry_tab_cb(const gchar *path, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 buf = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 parse_out_relatives(buf);
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
207
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 if (isdir(buf))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
210 if ((!lw->dir_fd || strcmp(lw->dir_fd->path, buf) != 0) && layout_set_path(lw, buf))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 gint pos = -1;
726
a1dcef8cd1ae Use G_DIR_SEPARATOR where applicable.
zas_
parents: 725
diff changeset
213 /* put the G_DIR_SEPARATOR back, if we are in tab completion for a dir and result was path change */
725
eda074e91ddd Use G_DIR_SEPARATOR_S where applicable.
zas_
parents: 694
diff changeset
214 gtk_editable_insert_text(GTK_EDITABLE(lw->path_entry), G_DIR_SEPARATOR_S, -1, &pos);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 gtk_editable_set_position(GTK_EDITABLE(lw->path_entry),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 strlen(gtk_entry_get_text(GTK_ENTRY(lw->path_entry))));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 }
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
219 else if (lw->dir_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 {
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
221 gchar *base = remove_level_from_path(buf);
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
222
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
223 if (strcmp(lw->dir_fd->path, base) == 0)
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
224 {
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
225 layout_list_scroll_to_subpart(lw, filename_from_path(buf));
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
226 }
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
227 g_free(base);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 }
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
229
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 static void layout_path_entry_cb(const gchar *path, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 buf = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 parse_out_relatives(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 layout_set_path(lw, buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
246 static void layout_vd_select_cb(ViewDir *vd, const gchar *path, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 layout_set_path(lw, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252
1167
e812b1a7adda Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents: 1055
diff changeset
253 static void layout_path_entry_tab_append_cb(const gchar *path, gpointer data, gint n)
e812b1a7adda Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents: 1055
diff changeset
254 {
e812b1a7adda Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents: 1055
diff changeset
255 LayoutWindow *lw = data;
e812b1a7adda Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents: 1055
diff changeset
256
e812b1a7adda Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents: 1055
diff changeset
257 if (!lw || !lw->back_button) return;
e812b1a7adda Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents: 1055
diff changeset
258 if (!layout_valid(&lw)) return;
e812b1a7adda Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents: 1055
diff changeset
259
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
260 /* Enable back button if it makes sense */
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
261 gtk_widget_set_sensitive(lw->back_button, (n > 1));
1167
e812b1a7adda Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents: 1055
diff changeset
262 }
e812b1a7adda Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents: 1055
diff changeset
263
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264 static GtkWidget *layout_tool_setup(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 GtkWidget *box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 GtkWidget *menu_bar;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 GtkWidget *tabcomp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 menu_bar = layout_actions_menu_bar(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 gtk_widget_show(menu_bar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275
1470
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
276 layout_actions_toolbar(lw);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 gtk_box_pack_start(GTK_BOX(box), lw->toolbar, FALSE, FALSE, 0);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
278 if (!lw->options.toolbar_hidden) gtk_widget_show(lw->toolbar);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 tabcomp = tab_completion_new_with_history(&lw->path_entry, NULL, "path_list", -1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281 layout_path_entry_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 tab_completion_add_tab_func(lw->path_entry, layout_path_entry_tab_cb, lw);
1167
e812b1a7adda Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents: 1055
diff changeset
283 tab_completion_add_append_func(lw->path_entry, layout_path_entry_tab_append_cb, lw);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 gtk_widget_show(tabcomp);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287 g_signal_connect(G_OBJECT(lw->path_entry->parent), "changed",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 G_CALLBACK(layout_path_entry_changed_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
290 lw->vd = vd_new(lw->options.dir_view_type, lw->dir_fd);
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
291 vd_set_layout(lw->vd, lw);
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
292 vd_set_select_func(lw->vd, layout_vd_select_cb, lw);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
294 lw->dir_view = lw->vd->widget;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296 gtk_box_pack_start(GTK_BOX(box), lw->dir_view, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 gtk_widget_show(lw->dir_view);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 gtk_widget_show(box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 return box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 * sort button (and menu)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 static void layout_sort_menu_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 LayoutWindow *lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313 SortType type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
315 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
316
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 lw = submenu_item_get_data(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 type = (SortType)GPOINTER_TO_INT(data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 layout_sort_set(lw, type, lw->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 static void layout_sort_menu_ascend_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 layout_sort_set(lw, lw->sort_method, !lw->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 static void layout_sort_menu_hide_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334 /* destroy the menu */
1043
5fc64d6252e7 Replaced gtk depreceated code.
bruclik
parents: 1029
diff changeset
335 #if GTK_CHECK_VERSION(2,12,0)
5fc64d6252e7 Replaced gtk depreceated code.
bruclik
parents: 1029
diff changeset
336 g_object_unref(widget);
5fc64d6252e7 Replaced gtk depreceated code.
bruclik
parents: 1029
diff changeset
337 #else
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 gtk_widget_unref(GTK_WIDGET(widget));
1043
5fc64d6252e7 Replaced gtk depreceated code.
bruclik
parents: 1029
diff changeset
339 #endif
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 static void layout_sort_button_press_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345 GtkWidget *menu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
346 GdkEvent *event;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347 guint32 etime;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349 menu = submenu_add_sort(NULL, G_CALLBACK(layout_sort_menu_cb), lw, FALSE, FALSE, TRUE, lw->sort_method);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350
88
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
351 /* take ownership of menu */
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
352 #ifdef GTK_OBJECT_FLOATING
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
353 /* GTK+ < 2.10 */
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 g_object_ref(G_OBJECT(menu));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355 gtk_object_sink(GTK_OBJECT(menu));
88
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
356 #else
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
357 /* GTK+ >= 2.10 */
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
358 g_object_ref_sink(G_OBJECT(menu));
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
359 #endif
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
361 /* ascending option */
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362 menu_item_add_divider(menu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363 menu_item_add_check(menu, _("Ascending"), lw->sort_ascend, G_CALLBACK(layout_sort_menu_ascend_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365 g_signal_connect(G_OBJECT(menu), "selection_done",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 G_CALLBACK(layout_sort_menu_hide_cb), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
368 event = gtk_get_current_event();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369 if (event)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371 etime = gdk_event_get_time(event);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372 gdk_event_free(event);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376 etime = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, etime);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 static GtkWidget *layout_sort_button(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
383 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
386 button = gtk_button_new_with_label(sort_type_get_text(lw->sort_method));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
387 g_signal_connect(G_OBJECT(button), "clicked",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388 G_CALLBACK(layout_sort_button_press_cb), lw);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
389 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
391 return button;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393
1588
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
394 /*
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
395 *-----------------------------------------------------------------------------
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
396 * color profile button (and menu)
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
397 *-----------------------------------------------------------------------------
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
398 */
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
399
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
400 #ifdef HAVE_LCMS
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
401
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
402 static void layout_color_menu_enable_cb(GtkWidget *widget, gpointer data)
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
403 {
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
404 LayoutWindow *lw = data;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
405
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
406 layout_image_color_profile_set_use(lw, (!layout_image_color_profile_get_use(lw)));
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
407 layout_image_refresh(lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
408 }
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
409
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
410 static void layout_color_menu_use_image_cb(GtkWidget *widget, gpointer data)
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
411 {
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
412 LayoutWindow *lw = data;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
413 gint input, screen;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
414 gboolean use_image;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
415
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
416 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
417 layout_image_color_profile_set(lw, input, screen, !use_image);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
418 layout_image_refresh(lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
419 }
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
420
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
421 #define COLOR_MENU_KEY "color_menu_key"
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
422
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
423 static void layout_color_menu_input_cb(GtkWidget *widget, gpointer data)
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
424 {
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
425 LayoutWindow *lw = data;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
426 gint type;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
427 gint input, screen;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
428 gboolean use_image;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
429
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
430 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
431
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
432 type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), COLOR_MENU_KEY));
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
433 if (type < 0 || type >= COLOR_PROFILE_FILE + COLOR_PROFILE_INPUTS) return;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
434
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
435 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
436 if (type == input) return;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
437
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
438 layout_image_color_profile_set(lw, type, screen, use_image);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
439 layout_image_refresh(lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
440 }
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
441
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
442 static void layout_color_menu_screen_cb(GtkWidget *widget, gpointer data)
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
443 {
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
444 LayoutWindow *lw = data;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
445 gint type;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
446 gint input, screen;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
447 gboolean use_image;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
448
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
449 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
450
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
451 type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), COLOR_MENU_KEY));
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
452 if (type < 0 || type > 1) return;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
453
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
454 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
455 if (type == screen) return;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
456
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
457 layout_image_color_profile_set(lw, input, type, use_image);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
458 layout_image_refresh(lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
459 }
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
460
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
461 static gchar *layout_color_name_parse(const gchar *name)
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
462 {
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
463 if (!name || !*name) return g_strdup(_("Empty"));
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
464 return g_strdelimit(g_strdup(name), "_", '-');
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
465 }
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
466
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
467 #endif /* HAVE_LCMS */
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
468
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
469 static void layout_color_button_press_cb(GtkWidget *widget, gpointer data)
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
470 {
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
471 #ifndef HAVE_LCMS
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
472 gchar *msg = g_strdup_printf(_("This installation of %s was not built with support for color profiles."), GQ_APPNAME);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
473 file_util_warning_dialog(_("Color profiles not supported"),
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
474 msg,
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
475 GTK_STOCK_DIALOG_INFO, widget);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
476 g_free(msg);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
477 return;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
478 #else
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
479 LayoutWindow *lw = data;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
480 GtkWidget *menu;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
481 GtkWidget *item;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
482 gchar *buf;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
483 gboolean active;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
484 gint input = 0;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
485 gint screen = 0;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
486 gboolean use_image = FALSE;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
487 gboolean from_image;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
488 gint image_profile;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
489 gint i;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
490
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
491 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
492
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
493 image_profile = layout_image_color_profile_get_from_image(lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
494 from_image = use_image && (image_profile != COLOR_PROFILE_NONE);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
495 menu = popup_menu_short_lived();
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
496
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
497 active = layout_image_color_profile_get_use(lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
498 menu_item_add_check(menu, _("Use _color profiles"), active,
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
499 G_CALLBACK(layout_color_menu_enable_cb), lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
500
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
501 menu_item_add_divider(menu);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
502
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
503 item = menu_item_add_check(menu, _("Use profile from _image"), use_image,
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
504 G_CALLBACK(layout_color_menu_use_image_cb), lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
505 gtk_widget_set_sensitive(item, image_profile == COLOR_PROFILE_MEM || (image_profile > COLOR_PROFILE_NONE && image_profile < COLOR_PROFILE_FILE));
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
506
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
507 for (i = COLOR_PROFILE_SRGB; i < COLOR_PROFILE_FILE; i++)
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
508 {
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
509 const gchar *label;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
510
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
511 switch (i)
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
512 {
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
513 case COLOR_PROFILE_SRGB: label = _("sRGB"); break;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
514 case COLOR_PROFILE_ADOBERGB: label = _("AdobeRGB compatible"); break;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
515 default: label = "fixme"; break;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
516 }
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
517 buf = g_strdup_printf(_("Input _%d: %s%s"), i, label, (i == image_profile) ? " *" : "");
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
518 item = menu_item_add_radio(menu, (i == COLOR_PROFILE_SRGB) ? NULL : item,
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
519 buf, (input == i),
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
520 G_CALLBACK(layout_color_menu_input_cb), lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
521 g_free(buf);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
522 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i));
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
523 gtk_widget_set_sensitive(item, active && !from_image);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
524 }
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
525
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
526 for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
527 {
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
528 const gchar *name = options->color_profile.input_name[i];
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
529 const gchar *file = options->color_profile.input_file[i];
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
530 gchar *end;
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
531
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
532 if (!name || !name[0]) name = filename_from_path(file);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
533
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
534 end = layout_color_name_parse(name);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
535 buf = g_strdup_printf(_("Input _%d: %s"), i + COLOR_PROFILE_FILE, end);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
536 g_free(end);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
537
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
538 item = menu_item_add_radio(menu, item,
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
539 buf, (i + COLOR_PROFILE_FILE == input),
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
540 G_CALLBACK(layout_color_menu_input_cb), lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
541 g_free(buf);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
542 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + COLOR_PROFILE_FILE));
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
543 gtk_widget_set_sensitive(item, active && !from_image && is_readable_file(file));
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
544 }
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
545
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
546 menu_item_add_divider(menu);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
547
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
548 item = menu_item_add_radio(menu, NULL,
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
549 _("Screen sRGB"), (screen == 0),
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
550 G_CALLBACK(layout_color_menu_screen_cb), lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
551
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
552 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(0));
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
553 gtk_widget_set_sensitive(item, active);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
554
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
555 item = menu_item_add_radio(menu, item,
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
556 _("_Screen profile"), (screen == 1),
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
557 G_CALLBACK(layout_color_menu_screen_cb), lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
558 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(1));
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
559 gtk_widget_set_sensitive(item, active && is_readable_file(options->color_profile.screen_file));
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
560
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
561 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
562 #endif /* HAVE_LCMS */
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
563 }
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
564
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
565 static GtkWidget *layout_color_button(LayoutWindow *lw)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
566 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
567 GtkWidget *button;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
568 GtkWidget *image;
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
569 gboolean enable;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
570
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
571 button = gtk_button_new();
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
572 image = gtk_image_new_from_stock(GTK_STOCK_SELECT_COLOR, GTK_ICON_SIZE_MENU);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
573 gtk_container_add(GTK_CONTAINER(button), image);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
574 gtk_widget_show(image);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
575 g_signal_connect(G_OBJECT(button), "clicked",
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
576 G_CALLBACK(layout_color_button_press_cb), lw);
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
577 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
578
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
579 #ifdef HAVE_LCMS
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
580 enable = (lw->image) ? lw->image->color_profile_enable : FALSE;
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
581 #else
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
582 enable = FALSE;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
583 #endif
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
584 gtk_widget_set_sensitive(image, enable);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
585
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
586 return button;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
587 }
1588
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
588
1240
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
589 /*
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
590 *-----------------------------------------------------------------------------
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
591 * write button
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
592 *-----------------------------------------------------------------------------
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
593 */
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
594
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
595 static void layout_write_button_press_cb(GtkWidget *widget, gpointer data)
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
596 {
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
597 metadata_write_queue_confirm(NULL, NULL);
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
598 }
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
599
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
600 static GtkWidget *layout_write_button(LayoutWindow *lw)
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
601 {
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
602 GtkWidget *button;
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
603 GtkWidget *image;
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
604
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
605 button = gtk_button_new();
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
606 image = gtk_image_new_from_stock(GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU);
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
607 gtk_container_add(GTK_CONTAINER(button), image);
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
608 gtk_widget_show(image);
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
609 g_signal_connect(G_OBJECT(button), "clicked",
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
610 G_CALLBACK(layout_write_button_press_cb), lw);
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
611 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
612
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
613 gtk_widget_set_sensitive(button, metadata_queue_length() > 0);
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
614
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
615 return button;
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
616 }
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
617
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
618
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
619 /*
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
620 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 * status bar
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624
1240
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
625 void layout_status_update_write(LayoutWindow *lw)
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
626 {
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
627 if (!layout_valid(&lw)) return;
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
628 if (!lw->info_write) return;
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
629
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
630 gtk_widget_set_sensitive(lw->info_write, metadata_queue_length() > 0);
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
631 /* FIXME: maybe show also the number of files */
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
632 }
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
633
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
634 void layout_status_update_write_all(void)
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
635 {
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
636 GList *work;
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
637
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
638 work = layout_window_list;
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
639 while (work)
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
640 {
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
641 LayoutWindow *lw = work->data;
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
642 work = work->next;
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
643
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
644 layout_status_update_write(lw);
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
645 }
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
646 }
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
647
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
648
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649 void layout_status_update_progress(LayoutWindow *lw, gdouble val, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
651 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 if (!lw->info_progress_bar) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(lw->info_progress_bar), val);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(lw->info_progress_bar), (text) ? text : " ");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658 void layout_status_update_info(LayoutWindow *lw, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660 gchar *buf = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
661
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664 if (!text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 {
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 726
diff changeset
666 guint n;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667 gint64 n_bytes = 0;
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
668
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
669 n = layout_list_count(lw, &n_bytes);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
670
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
671 if (n)
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
672 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
673 guint s;
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
674 gint64 s_bytes = 0;
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
675 const gchar *ss;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
677 if (layout_image_slideshow_active(lw))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
679 if (!layout_image_slideshow_paused(lw))
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
680 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
681 ss = _(" Slideshow");
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
682 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
683 else
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
684 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
685 ss = _(" Paused");
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
686 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
689 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
690 ss = "";
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
691 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
692
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
693 s = layout_selection_count(lw, &s_bytes);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
694
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
695 layout_bars_new_selection(lw, s);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
696
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
697 if (s > 0)
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
698 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
699 gchar *b = text_from_size_abrev(n_bytes);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
700 gchar *sb = text_from_size_abrev(s_bytes);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
701 buf = g_strdup_printf(_("%s, %d files (%s, %d)%s"), b, n, sb, s, ss);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
702 g_free(b);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
703 g_free(sb);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
704 }
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
705 else if (n > 0)
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
706 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
707 gchar *b = text_from_size_abrev(n_bytes);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
708 buf = g_strdup_printf(_("%s, %d files%s"), b, n, ss);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
709 g_free(b);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
710 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
711 else
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
712 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
713 buf = g_strdup_printf(_("%d files%s"), n, ss);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
714 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
715
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
716 text = buf;
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
717
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
718 image_osd_update(lw->image);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
721 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
722 text = "";
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723 }
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
724 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
725
583
de3e2bc22336 Revert patch 675, and correctly fix gtk assertion failure.
zas_
parents: 574
diff changeset
726 if (lw->info_status) gtk_label_set_text(GTK_LABEL(lw->info_status), text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
729
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
730 void layout_status_update_image(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
731 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
732 guint64 n;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
734 if (!layout_valid(&lw) || !lw->image) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
736 n = layout_list_count(lw, NULL);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
737
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
738 if (!n)
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
739 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
740 gtk_label_set_text(GTK_LABEL(lw->info_zoom), "");
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
741 gtk_label_set_text(GTK_LABEL(lw->info_details), "");
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
742 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
743 else
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
744 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
745 gchar *text;
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
746 gchar *b;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
747
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
748 text = image_zoom_get_as_text(lw->image);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
749 gtk_label_set_text(GTK_LABEL(lw->info_zoom), text);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
750 g_free(text);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
751
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
752 b = image_get_fd(lw->image) ? text_from_size(image_get_fd(lw->image)->size) : g_strdup("0");
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
753
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
754 if (lw->image->unknown)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
755 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
756 if (image_get_path(lw->image) && !access_file(image_get_path(lw->image), R_OK))
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
757 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
758 text = g_strdup_printf(_("(no read permission) %s bytes"), b);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
759 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
760 else
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
761 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
762 text = g_strdup_printf(_("( ? x ? ) %s bytes"), b);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
763 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
764 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
765 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
766 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
767 gint width, height;
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
768
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
769 image_get_image_size(lw->image, &width, &height);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
770 text = g_strdup_printf(_("( %d x %d ) %s bytes"),
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
771 width, height, b);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
772 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
773
1375
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
774 g_signal_emit_by_name (lw->image->pr, "update-pixel");
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
775
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
776 g_free(b);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
777
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
778 gtk_label_set_text(GTK_LABEL(lw->info_details), text);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
779 g_free(text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
780 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
781 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
782
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
783 void layout_status_update_all(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
784 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785 layout_status_update_progress(lw, 0.0, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
786 layout_status_update_info(lw, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
787 layout_status_update_image(lw);
1240
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
788 layout_status_update_write(lw);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
790
1433
b4ad1d201279 Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents: 1431
diff changeset
791 static GtkWidget *layout_status_label(gchar *text, GtkWidget *box, gboolean start, gint size, gboolean expand)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
793 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
794 GtkWidget *frame;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
796 frame = gtk_frame_new(NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
797 if (size) gtk_widget_set_size_request(frame, size, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799 if (start)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
800 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
801 gtk_box_pack_start(GTK_BOX(box), frame, expand, expand, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
802 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
803 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
804 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
805 gtk_box_pack_end(GTK_BOX(box), frame, expand, expand, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
806 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807 gtk_widget_show(frame);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
809 label = gtk_label_new(text ? text : "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
810 gtk_container_add(GTK_CONTAINER(frame), label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
811 gtk_widget_show(label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
813 return label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
814 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
815
1433
b4ad1d201279 Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents: 1431
diff changeset
816 static void layout_status_setup(LayoutWindow *lw, GtkWidget *box, gboolean small_format)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
817 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
818 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820 if (lw->info_box) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
821
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822 if (small_format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824 lw->info_box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
825 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
826 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828 lw->info_box = gtk_hbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
830 gtk_box_pack_end(GTK_BOX(box), lw->info_box, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831 gtk_widget_show(lw->info_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
832
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833 if (small_format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
834 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835 hbox = gtk_hbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
836 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837 gtk_widget_show(hbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
838 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
839 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
841 hbox = lw->info_box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
842 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
843 lw->info_progress_bar = gtk_progress_bar_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
844 gtk_widget_set_size_request(lw->info_progress_bar, PROGRESS_WIDTH, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
845 gtk_box_pack_start(GTK_BOX(hbox), lw->info_progress_bar, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
846 gtk_widget_show(lw->info_progress_bar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
847
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
848 lw->info_sort = layout_sort_button(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
849 gtk_box_pack_start(GTK_BOX(hbox), lw->info_sort, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850 gtk_widget_show(lw->info_sort);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
851
1588
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
852 lw->info_color = layout_color_button(lw);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
853 gtk_widget_show(lw->info_color);
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
854
1240
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
855 lw->info_write = layout_write_button(lw);
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
856 gtk_widget_show(lw->info_write);
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
857
1588
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
858 if (small_format) gtk_box_pack_end(GTK_BOX(hbox), lw->info_color, FALSE, FALSE, 0);
1240
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
859 if (small_format) gtk_box_pack_end(GTK_BOX(hbox), lw->info_write, FALSE, FALSE, 0);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
860
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
861 lw->info_status = layout_status_label(NULL, lw->info_box, TRUE, 0, (!small_format));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
862
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
863 if (small_format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
864 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
865 hbox = gtk_hbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
866 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
867 gtk_widget_show(hbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
868 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
869 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
870 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
871 hbox = lw->info_box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
872 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
873 lw->info_details = layout_status_label(NULL, hbox, TRUE, 0, TRUE);
1588
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
874 if (!small_format) gtk_box_pack_start(GTK_BOX(hbox), lw->info_color, FALSE, FALSE, 0);
1240
30e207ac22e4 added a status bar button for writting metadata immediately
nadvornik
parents: 1231
diff changeset
875 if (!small_format) gtk_box_pack_start(GTK_BOX(hbox), lw->info_write, FALSE, FALSE, 0);
1375
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
876 lw->info_pixel = layout_status_label(NULL, hbox, FALSE, PIXEL_LABEL_WIDTH, TRUE);
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
877 if (lw->options.info_pixel_hidden) gtk_widget_hide(gtk_widget_get_parent(lw->info_pixel));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
878 lw->info_zoom = layout_status_label(NULL, hbox, FALSE, ZOOM_LABEL_WIDTH, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
879 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
880
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
881 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
882 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883 * views
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
884 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
885 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
886
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
887 static GtkWidget *layout_tools_new(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
888 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
889 lw->dir_view = layout_tool_setup(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
890 return lw->dir_view;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
891 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
892
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
893 static void layout_list_status_cb(ViewFile *vf, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
894 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
895 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
896
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
897 layout_status_update_info(lw, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
898 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
899
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
900 static void layout_list_thumb_cb(ViewFile *vf, gdouble val, const gchar *text, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
901 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
902 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
903
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
904 layout_status_update_progress(lw, val, text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
905 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
906
1506
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
907 static void layout_list_sync_thumb(LayoutWindow *lw)
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
908 {
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
909 if (lw->vf) vf_thumb_set(lw->vf, lw->options.show_thumbnails);
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
910 }
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
911
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
912 static GtkWidget *layout_list_new(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
913 {
1412
5a534e1501e1 fixed saving of file_view_type
nadvornik
parents: 1403
diff changeset
914 lw->vf = vf_new(lw->options.file_view_type, NULL);
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
915 vf_set_layout(lw->vf, lw);
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
916
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
917 vf_set_status_func(lw->vf, layout_list_status_cb, lw);
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
918 vf_set_thumb_status_func(lw->vf, layout_list_thumb_cb, lw);
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
919
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
920 vf_marks_set(lw->vf, lw->options.show_marks);
1506
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
921
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
922 layout_list_sync_thumb(lw);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
923
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
924 return lw->vf->widget;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
925 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
926
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
927 static void layout_list_sync_marks(LayoutWindow *lw)
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
928 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
929 if (lw->vf) vf_marks_set(lw->vf, lw->options.show_marks);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
930 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
931
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
932 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
933 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
934 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
935 #if 0
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
936 if (lw->vf) vf_scroll_to_subpart(lw->vf, needle);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
937 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
938 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
939
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
940 GList *layout_list(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
941 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
942 if (!layout_valid(&lw)) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
943
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
944 if (lw->vf) return vf_get_list(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
945
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
946 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
947 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
948
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 726
diff changeset
949 guint layout_list_count(LayoutWindow *lw, gint64 *bytes)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
950 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
951 if (!layout_valid(&lw)) return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
952
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
953 if (lw->vf) return vf_count(lw->vf, bytes);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
954
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
955 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
956 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
957
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
958 FileData *layout_list_get_fd(LayoutWindow *lw, gint index)
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
959 {
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
960 if (!layout_valid(&lw)) return NULL;
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
961
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
962 if (lw->vf) return vf_index_get_data(lw->vf, index);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
963
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
964 return NULL;
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
965 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
966
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
967 gint layout_list_get_index(LayoutWindow *lw, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
968 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
969 if (!layout_valid(&lw) || !fd) return -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
970
1503
331e2d60d447 improved next/prev operation on sidecar files
nadvornik
parents: 1482
diff changeset
971 if (lw->vf) return vf_index_by_fd(lw->vf, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
972
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
973 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
974 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
975
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
976 void layout_list_sync_fd(LayoutWindow *lw, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
977 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
978 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
979
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
980 if (lw->vf) vf_select_by_fd(lw->vf, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
981 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
982
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
983 static void layout_list_sync_sort(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
984 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
985 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
986
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
987 if (lw->vf) vf_sort_set(lw->vf, lw->sort_method, lw->sort_ascend);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
988 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
989
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
990 GList *layout_selection_list(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
991 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
992 if (!layout_valid(&lw)) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
993
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
994 if (layout_image_get_collection(lw, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
995 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
996 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
997
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
998 fd = layout_image_get_fd(lw);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
999 if (fd) return g_list_append(NULL, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1000 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1001 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1002
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
1003 if (lw->vf) return vf_selection_get_list(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1004
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1005 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1006 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1007
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1008 GList *layout_selection_list_by_index(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1009 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1010 if (!layout_valid(&lw)) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1011
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
1012 if (lw->vf) return vf_selection_get_list_by_index(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1013
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1014 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1015 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1016
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 726
diff changeset
1017 guint layout_selection_count(LayoutWindow *lw, gint64 *bytes)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1018 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1019 if (!layout_valid(&lw)) return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1020
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
1021 if (lw->vf) return vf_selection_count(lw->vf, bytes);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1022
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1023 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1024 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1025
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1026 void layout_select_all(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1027 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1028 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1029
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
1030 if (lw->vf) vf_select_all(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1031 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1032
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1033 void layout_select_none(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1034 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1035 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1036
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
1037 if (lw->vf) vf_select_none(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1038 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1039
601
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
1040 void layout_select_invert(LayoutWindow *lw)
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
1041 {
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
1042 if (!layout_valid(&lw)) return;
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
1043
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
1044 if (lw->vf) vf_select_invert(lw->vf);
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
1045 }
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
1046
162
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1047 void layout_mark_to_selection(LayoutWindow *lw, gint mark, MarkToSelectionMode mode)
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1048 {
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1049 if (!layout_valid(&lw)) return;
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1050
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
1051 if (lw->vf) vf_mark_to_selection(lw->vf, mark, mode);
162
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1052 }
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1053
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1054 void layout_selection_to_mark(LayoutWindow *lw, gint mark, SelectionToMarkMode mode)
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1055 {
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1056 if (!layout_valid(&lw)) return;
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1057
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
1058 if (lw->vf) vf_selection_to_mark(lw->vf, mark, mode);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
1059
162
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1060 layout_status_update_info(lw, NULL); /* osd in fullscreen mode */
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1061 }
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
1062
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1063 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1064 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1065 * access
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1066 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1067 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1068
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1069 const gchar *layout_get_path(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1070 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1071 if (!layout_valid(&lw)) return NULL;
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1072 return lw->dir_fd ? lw->dir_fd->path : NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1073 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1074
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1075 static void layout_sync_path(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1076 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1077 if (!lw->dir_fd) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1078
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1079 if (lw->path_entry) gtk_entry_set_text(GTK_ENTRY(lw->path_entry), lw->dir_fd->path);
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
1080
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1081 if (lw->vd) vd_set_fd(lw->vd, lw->dir_fd);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1082 if (lw->vf) vf_set_fd(lw->vf, lw->dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1083 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1084
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1085 gboolean layout_set_path(LayoutWindow *lw, const gchar *path)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1086 {
959
9791230f83d3 fixed crash in geeqie --blank
nadvornik
parents: 902
diff changeset
1087 FileData *fd;
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1088 gboolean ret;
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
1089
959
9791230f83d3 fixed crash in geeqie --blank
nadvornik
parents: 902
diff changeset
1090 if (!path) return FALSE;
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
1091
959
9791230f83d3 fixed crash in geeqie --blank
nadvornik
parents: 902
diff changeset
1092 fd = file_data_new_simple(path);
1372
4db89b602093 Random tidy up.
zas_
parents: 1365
diff changeset
1093 ret = layout_set_fd(lw, fd);
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1094 file_data_unref(fd);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1095 return ret;
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1096 }
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1097
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1098
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1099 gboolean layout_set_fd(LayoutWindow *lw, FileData *fd)
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1100 {
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1101 gboolean have_file = FALSE;
1558
e6da3a90e7b2 fixed metadata.confirm_on_dir_change
nadvornik
parents: 1549
diff changeset
1102 gboolean dir_changed = TRUE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1103
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1104 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1105
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1106 if (!fd || !isname(fd->path)) return FALSE;
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1107 if (lw->dir_fd && fd == lw->dir_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1108 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1109 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1110 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1111
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1112 if (isdir(fd->path))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1113 {
791
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1114 if (lw->dir_fd)
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1115 {
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1116 file_data_unregister_real_time_monitor(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1117 file_data_unref(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1118 }
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1119 lw->dir_fd = file_data_ref(fd);
791
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1120 file_data_register_real_time_monitor(fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1121 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1122 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1123 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1124 gchar *base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1125
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1126 base = remove_level_from_path(fd->path);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1127 if (lw->dir_fd && strcmp(lw->dir_fd->path, base) == 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1128 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1129 g_free(base);
1558
e6da3a90e7b2 fixed metadata.confirm_on_dir_change
nadvornik
parents: 1549
diff changeset
1130 dir_changed = FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1131 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1132 else if (isdir(base))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1133 {
791
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1134 if (lw->dir_fd)
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1135 {
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1136 file_data_unregister_real_time_monitor(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1137 file_data_unref(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1138 }
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1139 lw->dir_fd = file_data_new_simple(base);
791
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1140 file_data_register_real_time_monitor(lw->dir_fd);
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1141 g_free(base);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1142 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1143 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1144 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1145 g_free(base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1146 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1147 }
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1148 if (isfile(fd->path)) have_file = TRUE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1149 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1150
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1151 if (lw->path_entry) tab_completion_append_to_history(lw->path_entry, lw->dir_fd->path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1152 layout_sync_path(lw);
1301
8c47a4f521ad Fix bug 2599857: file list sort order was wrong in many cases.
zas_
parents: 1296
diff changeset
1153 layout_list_sync_sort(lw);
8c47a4f521ad Fix bug 2599857: file list sort order was wrong in many cases.
zas_
parents: 1296
diff changeset
1154
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1155 if (have_file)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1156 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1157 gint row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1158
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1159 row = layout_list_get_index(lw, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1160 if (row >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1161 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1162 layout_image_set_index(lw, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1163 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1164 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1165 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1166 layout_image_set_fd(lw, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1167 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1168 }
320
c74af1cbd61a Move more options to ConfOptions.
zas_
parents: 318
diff changeset
1169 else if (!options->lazy_image_sync)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1170 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1171 layout_image_set_index(lw, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1172 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1173
1558
e6da3a90e7b2 fixed metadata.confirm_on_dir_change
nadvornik
parents: 1549
diff changeset
1174 if (options->metadata.confirm_on_dir_change && dir_changed)
1231
ca8ccf0c3e81 added done callback to utilops
nadvornik
parents: 1214
diff changeset
1175 metadata_write_queue_confirm(NULL, NULL);
1214
31402ecb2aed write metadata after timeout, image change or dir change
nadvornik
parents: 1177
diff changeset
1176
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1177 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1178 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1179
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1180 static void layout_refresh_lists(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1181 {
390
39369521e263 Fix two errors made in revision 473.
zas_
parents: 380
diff changeset
1182 if (lw->vd) vd_refresh(lw->vd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1183
1506
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
1184 if (lw->vf)
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
1185 {
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
1186 vf_refresh(lw->vf);
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
1187 vf_thumb_update(lw->vf);
d352a44545a6 Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents: 1503
diff changeset
1188 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1189 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1190
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1191 void layout_refresh(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1192 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1193 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1194
506
fc9c8a3e1a8b Handle the newline in DEBUG_N() macro instead of adding one
zas_
parents: 501
diff changeset
1195 DEBUG_1("layout refresh");
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1196
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1197 layout_refresh_lists(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1198
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1199 if (lw->image) layout_image_refresh(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1200 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1201
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1202 void layout_thumb_set(LayoutWindow *lw, gboolean enable)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1203 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1204 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1205
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1206 if (lw->options.show_thumbnails == enable) return;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1207
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1208 lw->options.show_thumbnails = enable;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1209
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1210 layout_util_sync_thumb(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1211 layout_list_sync_thumb(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1212 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1213
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1214 void layout_marks_set(LayoutWindow *lw, gboolean enable)
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1215 {
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1216 if (!layout_valid(&lw)) return;
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1217
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1218 if (lw->options.show_marks == enable) return;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1219
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1220 lw->options.show_marks = enable;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1221
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1222 // layout_util_sync_marks(lw);
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1223 layout_list_sync_marks(lw);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1224 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1225
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1226 gboolean layout_thumb_get(LayoutWindow *lw)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1227 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1228 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1229
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1230 return lw->options.show_thumbnails;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1231 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1232
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1233 gboolean layout_marks_get(LayoutWindow *lw)
433
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1234 {
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1235 if (!layout_valid(&lw)) return FALSE;
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1236
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1237 return lw->options.show_marks;
433
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1238 }
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1239
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1240 void layout_sort_set(LayoutWindow *lw, SortType type, gboolean ascend)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1241 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1242 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1243 if (lw->sort_method == type && lw->sort_ascend == ascend) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1244
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1245 lw->sort_method = type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1246 lw->sort_ascend = ascend;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1247
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1248 if (lw->info_sort) gtk_label_set_text(GTK_LABEL(GTK_BIN(lw->info_sort)->child),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1249 sort_type_get_text(type));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1250 layout_list_sync_sort(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1251 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1252
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1253 gboolean layout_sort_get(LayoutWindow *lw, SortType *type, gboolean *ascend)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1254 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1255 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1256
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1257 if (type) *type = lw->sort_method;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1258 if (ascend) *ascend = lw->sort_ascend;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1259
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1260 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1261 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1262
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1263 gboolean layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1264 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1265 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1266
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1267 gdk_window_get_root_origin(lw->window->window, x, y);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1268 gdk_drawable_get_size(lw->window->window, w, h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1269
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1270 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1271 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1272
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1273 gboolean layout_geometry_get_dividers(LayoutWindow *lw, gint *h, gint *v)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1274 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1275 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1276
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1277 if (lw->h_pane && GTK_PANED(lw->h_pane)->child1->allocation.x >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1278 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1279 *h = GTK_PANED(lw->h_pane)->child1->allocation.width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1280 }
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1281 else if (h != &lw->options.main_window.hdivider_pos)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1282 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1283 *h = lw->options.main_window.hdivider_pos;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1284 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1285
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1286 if (lw->v_pane && GTK_PANED(lw->v_pane)->child1->allocation.x >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1287 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1288 *v = GTK_PANED(lw->v_pane)->child1->allocation.height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1289 }
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1290 else if (v != &lw->options.main_window.vdivider_pos)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1291 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1292 *v = lw->options.main_window.vdivider_pos;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1293 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1294
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1295 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1296 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1297
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
1298 void layout_views_set(LayoutWindow *lw, DirViewType dir_view_type, FileViewType file_view_type)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1299 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1300 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1301
1412
5a534e1501e1 fixed saving of file_view_type
nadvornik
parents: 1403
diff changeset
1302 if (lw->options.dir_view_type == dir_view_type && lw->options.file_view_type == file_view_type) return;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1303
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1304 lw->options.dir_view_type = dir_view_type;
1412
5a534e1501e1 fixed saving of file_view_type
nadvornik
parents: 1403
diff changeset
1305 lw->options.file_view_type = file_view_type;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1306
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1307 layout_style_set(lw, -1, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1308 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1309
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1310 gboolean layout_views_get(LayoutWindow *lw, DirViewType *dir_view_type, FileViewType *file_view_type)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1311 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1312 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1313
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1314 *dir_view_type = lw->options.dir_view_type;
1412
5a534e1501e1 fixed saving of file_view_type
nadvornik
parents: 1403
diff changeset
1315 *file_view_type = lw->options.file_view_type;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1316
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1317 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1318 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1319
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1320 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1321 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1322 * location utils
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1323 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1324 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1325
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1326 static gboolean layout_location_single(LayoutLocation l)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1327 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1328 return (l == LAYOUT_LEFT ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1329 l == LAYOUT_RIGHT ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1330 l == LAYOUT_TOP ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1331 l == LAYOUT_BOTTOM);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1332 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1333
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1334 static gboolean layout_location_vertical(LayoutLocation l)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1335 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1336 return (l & LAYOUT_TOP ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1337 l & LAYOUT_BOTTOM);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1338 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1339
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1340 static gboolean layout_location_first(LayoutLocation l)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1341 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1342 return (l & LAYOUT_TOP ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1343 l & LAYOUT_LEFT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1344 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1345
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1346 static LayoutLocation layout_grid_compass(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1347 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1348 if (layout_location_single(lw->dir_location)) return lw->dir_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1349 if (layout_location_single(lw->file_location)) return lw->file_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1350 return lw->image_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1351 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1352
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1353 static void layout_location_compute(LayoutLocation l1, LayoutLocation l2,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1354 GtkWidget *s1, GtkWidget *s2,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1355 GtkWidget **d1, GtkWidget **d2)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1356 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1357 LayoutLocation l;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1358
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1359 l = l1 & l2; /* get common compass direction */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1360 l = l1 - l; /* remove it */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1361
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1362 if (layout_location_first(l))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1363 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1364 *d1 = s1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1365 *d2 = s2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1366 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1367 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1368 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1369 *d1 = s2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1370 *d2 = s1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1371 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1372 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1373
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1374 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1375 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1376 * tools window (for floating/hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1377 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1378 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1379
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1380 gboolean layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h, gint *divider_pos)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1381 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1382 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1383
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1384 if (!lw->tools || !GTK_WIDGET_VISIBLE(lw->tools))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1385 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1386 /* use the stored values (sort of breaks success return value) */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1387
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1388 *divider_pos = lw->options.float_window.vdivider_pos;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1389
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1390 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1391 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1392
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1393 gdk_window_get_root_origin(lw->tools->window, x, y);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1394 gdk_drawable_get_size(lw->tools->window, w, h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1395
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1396 if (GTK_IS_VPANED(lw->tools_pane))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1397 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1398 *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1399 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1400 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1401 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1402 *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1403 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1404
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1405 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1406 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1407
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1408 static void layout_tools_geometry_sync(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1409 {
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1410 layout_geometry_get_tools(lw, &lw->options.float_window.x, &lw->options.float_window.x,
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1411 &lw->options.float_window.w, &lw->options.float_window.h, &lw->options.float_window.vdivider_pos);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1412 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1413
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1414 static void layout_tools_hide(LayoutWindow *lw, gboolean hide)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1415 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1416 if (!lw->tools) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1417
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1418 if (hide)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1419 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1420 if (GTK_WIDGET_VISIBLE(lw->tools))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1421 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1422 layout_tools_geometry_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1423 gtk_widget_hide(lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1424 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1425 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1426 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1427 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1428 if (!GTK_WIDGET_VISIBLE(lw->tools))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1429 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1430 gtk_widget_show(lw->tools);
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
1431 if (lw->vf) vf_refresh(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1432 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1433 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1434
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1435 lw->options.tools_hidden = hide;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1436 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1437
1433
b4ad1d201279 Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents: 1431
diff changeset
1438 static gboolean layout_tools_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1439 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1440 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1441
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1442 layout_tools_float_toggle(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1443
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1444 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1445 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1446
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1447 static void layout_tools_setup(LayoutWindow *lw, GtkWidget *tools, GtkWidget *files)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1448 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1449 GtkWidget *vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1450 GtkWidget *w1, *w2;
1433
b4ad1d201279 Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents: 1431
diff changeset
1451 gboolean vertical;
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1452 gboolean new_window = FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1453
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1454 vertical = (layout_location_single(lw->image_location) && !layout_location_vertical(lw->image_location)) ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1455 (!layout_location_single(lw->image_location) && layout_location_vertical(layout_grid_compass(lw)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1456 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1457 layout_location_compute(lw->dir_location, lw->file_location,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1458 tools, files, &w1, &w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1459 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1460 /* for now, tools/dir are always first in order */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1461 w1 = tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1462 w2 = files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1463
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1464 if (!lw->tools)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1465 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1466 GdkGeometry geometry;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1467 GdkWindowHints hints;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1468
289
6a7298988a7a Simplify and unify gtk_window creation with the help of
zas_
parents: 288
diff changeset
1469 lw->tools = window_new(GTK_WINDOW_TOPLEVEL, "tools", PIXBUF_INLINE_ICON_TOOLS, NULL, _("Tools"));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1470 g_signal_connect(G_OBJECT(lw->tools), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1471 G_CALLBACK(layout_tools_delete_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1472 layout_keyboard_init(lw, lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1473
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1474 if (options->save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1475 {
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
1476 hints = GDK_HINT_USER_POS;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1477 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1478 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1479 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1480 hints = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1481 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1482
1029
1a4b18c58556 Use a constant for minimal window size. Set it to 32 for all dialogs.
zas_
parents: 1006
diff changeset
1483 geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
1a4b18c58556 Use a constant for minimal window size. Set it to 32 for all dialogs.
zas_
parents: 1006
diff changeset
1484 geometry.min_height = DEFAULT_MINIMAL_WINDOW_SIZE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1485 geometry.base_width = TOOLWINDOW_DEF_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1486 geometry.base_height = TOOLWINDOW_DEF_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1487 gtk_window_set_geometry_hints(GTK_WINDOW(lw->tools), NULL, &geometry,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1488 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hints);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1489
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1490
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1491 gtk_window_set_resizable(GTK_WINDOW(lw->tools), TRUE);
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1492 gtk_container_set_border_width(GTK_CONTAINER(lw->tools), 0);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
1493
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1494 new_window = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1495 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1496 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1497 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1498 layout_tools_geometry_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1499 /* dump the contents */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1500 gtk_widget_destroy(GTK_BIN(lw->tools)->child);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1501 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1502
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1503 layout_actions_add_window(lw, lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1504
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1505 vbox = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1506 gtk_container_add(GTK_CONTAINER(lw->tools), vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1507 gtk_widget_show(vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1508
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1509 layout_status_setup(lw, vbox, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1510
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1511 if (vertical)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1512 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1513 lw->tools_pane = gtk_vpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1514 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1515 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1516 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1517 lw->tools_pane = gtk_hpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1518 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1519 gtk_box_pack_start(GTK_BOX(vbox), lw->tools_pane, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1520 gtk_widget_show(lw->tools_pane);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1521
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1522 gtk_paned_pack1(GTK_PANED(lw->tools_pane), w1, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1523 gtk_paned_pack2(GTK_PANED(lw->tools_pane), w2, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1524
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1525 gtk_widget_show(tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1526 gtk_widget_show(files);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1527
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1528 if (new_window)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1529 {
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1530 if (options->save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1531 {
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1532 gtk_window_set_default_size(GTK_WINDOW(lw->tools), lw->options.float_window.w, lw->options.float_window.h);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1533 gtk_window_move(GTK_WINDOW(lw->tools), lw->options.float_window.x, lw->options.float_window.y);
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1534 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1535 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1536 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1537 if (vertical)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1538 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1539 gtk_window_set_default_size(GTK_WINDOW(lw->tools),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1540 TOOLWINDOW_DEF_WIDTH, TOOLWINDOW_DEF_HEIGHT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1541 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1542 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1543 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1544 gtk_window_set_default_size(GTK_WINDOW(lw->tools),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1545 TOOLWINDOW_DEF_HEIGHT, TOOLWINDOW_DEF_WIDTH);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1546 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1547 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1548 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1549
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1550 if (!options->save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1551 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1552 if (vertical)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1553 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1554 lw->options.float_window.vdivider_pos = MAIN_WINDOW_DIV_VPOS;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1555 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1556 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1557 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1558 lw->options.float_window.vdivider_pos = MAIN_WINDOW_DIV_HPOS;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1559 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1560 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1561
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1562 gtk_paned_set_position(GTK_PANED(lw->tools_pane), lw->options.float_window.vdivider_pos);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1563 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1564
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1565 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1566 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1567 * glue (layout arrangement)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1568 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1569 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1570
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1571 static void layout_grid_compute(LayoutWindow *lw,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1572 GtkWidget *image, GtkWidget *tools, GtkWidget *files,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1573 GtkWidget **w1, GtkWidget **w2, GtkWidget **w3)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1574 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1575 /* heh, this was fun */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1576
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1577 if (layout_location_single(lw->dir_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1578 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1579 if (layout_location_first(lw->dir_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1580 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1581 *w1 = tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1582 layout_location_compute(lw->file_location, lw->image_location, files, image, w2, w3);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1583 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1584 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1585 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1586 *w3 = tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1587 layout_location_compute(lw->file_location, lw->image_location, files, image, w1, w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1588 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1589 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1590 else if (layout_location_single(lw->file_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1591 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1592 if (layout_location_first(lw->file_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1593 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1594 *w1 = files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1595 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w2, w3);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1596 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1597 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1598 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1599 *w3 = files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1600 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w1, w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1601 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1602 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1603 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1604 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1605 /* image */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1606 if (layout_location_first(lw->image_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1607 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1608 *w1 = image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1609 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w2, w3);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1610 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1611 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1612 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1613 *w3 = image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1614 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w1, w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1615 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1616 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1617 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1618
127
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1619 void layout_split_change(LayoutWindow *lw, ImageSplitMode mode)
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1620 {
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1621 GtkWidget *image;
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1622 gint i;
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1623
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1624 for (i = 0; i < MAX_SPLIT_IMAGES; i++)
127
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1625 {
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1626 if (lw->split_images[i])
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1627 {
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1628 gtk_widget_hide(lw->split_images[i]->widget);
1383
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1375
diff changeset
1629 if (lw->split_images[i]->widget->parent != lw->utility_paned)
127
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1630 gtk_container_remove(GTK_CONTAINER(lw->split_images[i]->widget->parent), lw->split_images[i]->widget);
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1631 }
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1632 }
1383
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1375
diff changeset
1633 gtk_container_remove(GTK_CONTAINER(lw->utility_paned), lw->split_image_widget);
127
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1634
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1635 image = layout_image_setup_split(lw, mode);
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1636
1383
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1375
diff changeset
1637 // gtk_box_pack_start(GTK_BOX(lw->utility_box), image, TRUE, TRUE, 0);
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1375
diff changeset
1638 // gtk_box_reorder_child(GTK_BOX(lw->utility_box), image, 0);
3c9abbc05792 use standard GtkHPaned for sidebar width
nadvornik
parents: 1375
diff changeset
1639 gtk_paned_pack1(GTK_PANED(lw->utility_paned), image, TRUE, FALSE);
127
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1640 gtk_widget_show(image);
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1641 }
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1642
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1643 static void layout_grid_setup(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1644 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1645 gint priority_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1646 GtkWidget *h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1647 GtkWidget *v;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1648 GtkWidget *w1, *w2, *w3;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1649
1322
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1650 GtkWidget *image_sb; /* image together with sidebars in utility box */
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1651 GtkWidget *tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1652 GtkWidget *files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1653
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1654 layout_actions_setup(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1655
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1656 lw->group_box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1657 gtk_box_pack_start(GTK_BOX(lw->main_box), lw->group_box, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1658 gtk_widget_show(lw->group_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1659
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1660 priority_location = layout_grid_compass(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1661
1322
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1662 if (lw->utility_box)
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1663 {
1480
077924265c28 split-mode cleanup and improvements
nadvornik
parents: 1473
diff changeset
1664 layout_split_change(lw, lw->split_mode); /* this re-creates image frame for the new configuration */
1322
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1665 image_sb = lw->utility_box;
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1666 }
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1667 else
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1668 {
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1669 GtkWidget *image; /* image or split images together */
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1670 image = layout_image_setup_split(lw, lw->split_mode);
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1671 image_sb = layout_bars_prepare(lw, image);
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1672 }
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1673
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1674 tools = layout_tools_new(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1675 files = layout_list_new(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1676
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1677
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1678 if (lw->options.tools_float || lw->options.tools_hidden)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1679 {
1322
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1680 gtk_box_pack_start(GTK_BOX(lw->group_box), image_sb, TRUE, TRUE, 0);
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1681 gtk_widget_show(image_sb);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1682
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1683 layout_tools_setup(lw, tools, files);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1684
1482
dac747d99394 fixed keyboard focus on start-up
nadvornik
parents: 1480
diff changeset
1685 image_grab_focus(lw->image);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1686
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1687 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1688 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1689 else if (lw->tools)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1690 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1691 layout_tools_geometry_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1692 gtk_widget_destroy(lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1693 lw->tools = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1694 lw->tools_pane = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1695 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1696
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1697 layout_status_setup(lw, lw->group_box, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1698
1322
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1699 layout_grid_compute(lw, image_sb, tools, files, &w1, &w2, &w3);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1700
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1701 v = lw->v_pane = gtk_vpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1702
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1703 h = lw->h_pane = gtk_hpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1704
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1705 if (!layout_location_vertical(priority_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1706 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1707 GtkWidget *tmp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1708
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1709 tmp = v;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1710 v = h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1711 h = tmp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1712 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1713
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1714 gtk_box_pack_start(GTK_BOX(lw->group_box), v, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1715
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1716 if (!layout_location_first(priority_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1717 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1718 gtk_paned_pack1(GTK_PANED(v), h, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1719 gtk_paned_pack2(GTK_PANED(v), w3, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1720
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1721 gtk_paned_pack1(GTK_PANED(h), w1, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1722 gtk_paned_pack2(GTK_PANED(h), w2, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1723 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1724 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1725 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1726 gtk_paned_pack1(GTK_PANED(v), w1, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1727 gtk_paned_pack2(GTK_PANED(v), h, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1728
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1729 gtk_paned_pack1(GTK_PANED(h), w2, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1730 gtk_paned_pack2(GTK_PANED(h), w3, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1731 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1732
1322
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1733 gtk_widget_show(image_sb);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1734 gtk_widget_show(tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1735 gtk_widget_show(files);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1736
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1737 gtk_widget_show(v);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1738 gtk_widget_show(h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1739
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1740 /* fix to have image pane visible when it is left and priority widget */
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1741 if (lw->options.main_window.hdivider_pos == -1 &&
1322
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1742 w1 == image_sb &&
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1743 !layout_location_vertical(priority_location) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1744 layout_location_first(priority_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1745 {
1322
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1746 gtk_widget_set_size_request(image_sb, 200, -1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1747 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1748
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1749 gtk_paned_set_position(GTK_PANED(lw->h_pane), lw->options.main_window.hdivider_pos);
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1750 gtk_paned_set_position(GTK_PANED(lw->v_pane), lw->options.main_window.vdivider_pos);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1751
1482
dac747d99394 fixed keyboard focus on start-up
nadvornik
parents: 1480
diff changeset
1752 image_grab_focus(lw->image);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1753 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1754
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1755 void layout_style_set(LayoutWindow *lw, gint style, const gchar *order)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1756 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1757 FileData *dir_fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1758
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1759 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1760
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1761 if (style != -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1762 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1763 LayoutLocation d, f, i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1764
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1765 layout_config_parse(style, order, &d, &f, &i);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1766
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1767 if (lw->dir_location == d &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1768 lw->file_location == f &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1769 lw->image_location == i) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1770
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1771 lw->dir_location = d;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1772 lw->file_location = f;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1773 lw->image_location = i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1774 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1775
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1776 /* remember state */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1777
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1778 layout_image_slideshow_stop(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1779 layout_image_full_screen_stop(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1780
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1781 dir_fd = lw->dir_fd;
960
37fdfe8f2ab1 fixed crash with float file list and geeqie --blank
nadvornik
parents: 959
diff changeset
1782 if (dir_fd) file_data_unregister_real_time_monitor(dir_fd);
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1783 lw->dir_fd = NULL;
1322
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1784
1403
9274b3b4eaad fixed crash with certain layout configurations
nadvornik
parents: 1383
diff changeset
1785 layout_geometry_get_dividers(lw, &lw->options.main_window.hdivider_pos, &lw->options.main_window.vdivider_pos);
9274b3b4eaad fixed crash with certain layout configurations
nadvornik
parents: 1383
diff changeset
1786
1470
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
1787 /* preserve utility_box (image + sidebars), menu_bar and toolbar to be reused later in layout_grid_setup */
1322
4370b90fa774 reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents: 1320
diff changeset
1788 /* lw->image is preserved together with lw->utility_box */
1470
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
1789 if (lw->utility_box) gtk_container_remove(GTK_CONTAINER(lw->utility_box->parent), lw->utility_box);
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
1790 if (lw->menu_bar) gtk_container_remove(GTK_CONTAINER(lw->menu_bar->parent), lw->menu_bar);
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
1791 if (lw->toolbar) gtk_container_remove(GTK_CONTAINER(lw->toolbar->parent), lw->toolbar);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1792
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1793 /* clear it all */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1794
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1795 lw->h_pane = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1796 lw->v_pane = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1797
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1798 lw->path_entry = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1799 lw->dir_view = NULL;
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
1800 lw->vd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1801
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1802 lw->file_view = NULL;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
1803 lw->vf = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1804
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1805 lw->info_box = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1806 lw->info_progress_bar = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1807 lw->info_sort = NULL;
1588
0434f34b1ee4 Backed out changeset 2a3efbdf73b0
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1547
diff changeset
1808 lw->info_color = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1809 lw->info_status = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1810 lw->info_details = NULL;
1375
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1811 lw->info_pixel = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1812 lw->info_zoom = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1813
1470
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
1814 /*
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1815 if (lw->ui_manager) g_object_unref(lw->ui_manager);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1816 lw->ui_manager = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1817 lw->action_group = NULL;
1463
25168240a247 added function to reload external editors at any time
nadvornik
parents: 1461
diff changeset
1818 lw->action_group_editors = NULL;
1470
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
1819 */
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1820
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1821 gtk_container_remove(GTK_CONTAINER(lw->main_box), lw->group_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1822 lw->group_box = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1823
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1824 /* re-fill */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1825
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1826 layout_grid_setup(lw);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1827 layout_tools_hide(lw, lw->options.tools_hidden);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1828
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1829 layout_util_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1830 layout_status_update_all(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1831
1470
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
1832
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
1833 // printf("%d %d %d \n", G_OBJECT(lw->utility_box)->ref_count, G_OBJECT(lw->menu_bar)->ref_count, G_OBJECT(lw->toolbar)->ref_count);
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
1834
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1835 /* sync */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1836
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1837 if (image_get_fd(lw->image))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1838 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1839 layout_set_fd(lw, image_get_fd(lw->image));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1840 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1841 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1842 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1843 layout_set_fd(lw, dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1844 }
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1845 image_top_window_set_sync(lw->image, (lw->options.tools_float || lw->options.tools_hidden));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1846
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1847 /* clean up */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1848
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1849 file_data_unref(dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1850 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1851
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1852 void layout_colors_update(void)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1853 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1854 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1855
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1856 work = layout_window_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1857 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1858 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1859 LayoutWindow *lw = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1860 work = work->next;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
1861
208
fa0e05f985c3 set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents: 196
diff changeset
1862 if (!lw->image) continue;
339
de1c2cd06fce Rename user_specified_window_background and window_background_color
zas_
parents: 338
diff changeset
1863 image_background_set_color(lw->image, options->image.use_custom_border_color ? &options->image.border_color : NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1864 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1865 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1866
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1867 void layout_tools_float_toggle(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1868 {
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1869 gboolean popped;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1870
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1871 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1872
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1873 if (!lw->options.tools_hidden)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1874 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1875 popped = !lw->options.tools_float;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1876 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1877 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1878 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1879 popped = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1880 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1881
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1882 if (lw->options.tools_float == popped)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1883 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1884 if (popped && lw->options.tools_hidden)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1885 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1886 layout_tools_float_set(lw, popped, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1887 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1888 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1889 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1890 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1891 if (lw->options.tools_float)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1892 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1893 layout_tools_float_set(lw, FALSE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1894 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1895 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1896 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1897 layout_tools_float_set(lw, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1898 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1899 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1900 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1901
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1902 void layout_tools_hide_toggle(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1903 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1904 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1905
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1906 layout_tools_float_set(lw, lw->options.tools_float, !lw->options.tools_hidden);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1907 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1908
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1909 void layout_tools_float_set(LayoutWindow *lw, gboolean popped, gboolean hidden)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1910 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1911 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1912
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1913 if (lw->options.tools_float == popped && lw->options.tools_hidden == hidden) return;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1914
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1915 if (lw->options.tools_float == popped && lw->options.tools_float && lw->tools)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1916 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1917 layout_tools_hide(lw, hidden);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1918 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1919 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1920
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1921 lw->options.tools_float = popped;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1922 lw->options.tools_hidden = hidden;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1923
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1924 layout_style_set(lw, -1, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1925 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1926
1416
9fe2fede7ae5 Use gboolean pseudo type where applicable.
zas_
parents: 1415
diff changeset
1927 gboolean layout_tools_float_get(LayoutWindow *lw, gboolean *popped, gboolean *hidden)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1928 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1929 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1930
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1931 *popped = lw->options.tools_float;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1932 *hidden = lw->options.tools_hidden;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1933
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1934 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1935 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1936
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1937 void layout_toolbar_toggle(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1938 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1939 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1940 if (!lw->toolbar) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1941
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1942 lw->options.toolbar_hidden = !lw->options.toolbar_hidden;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1943
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
1944 if (lw->options.toolbar_hidden)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1945 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1946 if (GTK_WIDGET_VISIBLE(lw->toolbar)) gtk_widget_hide(lw->toolbar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1947 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1948 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1949 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1950 if (!GTK_WIDGET_VISIBLE(lw->toolbar)) gtk_widget_show(lw->toolbar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1951 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1952 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1953
1375
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1954 void layout_info_pixel_toggle(LayoutWindow *lw)
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1955 {
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1956 GtkWidget *frame;
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1957
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1958 if (!layout_valid(&lw)) return;
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1959 if (!lw->info_pixel) return;
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1960
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1961 lw->options.info_pixel_hidden = !lw->options.info_pixel_hidden;
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1962
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1963 frame = gtk_widget_get_parent(lw->info_pixel);
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1964 if (lw->options.info_pixel_hidden)
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1965 {
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1966 if (GTK_WIDGET_VISIBLE(frame)) gtk_widget_hide(frame);
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1967 }
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1968 else
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1969 {
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1970 if (!GTK_WIDGET_VISIBLE(frame)) gtk_widget_show(frame);
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1971 }
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1972 }
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
1973
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1974 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1975 *-----------------------------------------------------------------------------
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1976 * configuration
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1977 *-----------------------------------------------------------------------------
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1978 */
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1979
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1980 #define CONFIG_WINDOW_DEF_WIDTH 600
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1981 #define CONFIG_WINDOW_DEF_HEIGHT 400
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1982
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1983 typedef struct _LayoutConfig LayoutConfig;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1984 struct _LayoutConfig
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1985 {
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1986 LayoutWindow *lw;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1987
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1988 GtkWidget *configwindow;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1989 GtkWidget *home_path_entry;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1990 GtkWidget *layout_widget;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1991
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1992 LayoutOptions options;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1993 };
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1994
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1995 static gint layout_config_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1996
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1997 static void layout_config_close_cb(GtkWidget *widget, gpointer data)
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1998 {
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
1999 LayoutConfig *lc = data;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2000
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2001 gtk_widget_destroy(lc->configwindow);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2002 free_layout_options_content(&lc->options);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2003 g_free(lc);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2004 }
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2005
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2006 static gint layout_config_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2007 {
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2008 layout_config_close_cb(w, data);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2009 return TRUE;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2010 }
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2011
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2012 static void layout_config_apply_cb(GtkWidget *widget, gpointer data)
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2013 {
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2014 LayoutConfig *lc = data;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2015
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2016 g_free(lc->options.order);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2017 lc->options.order = layout_config_get(lc->layout_widget, &lc->options.style);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2018
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2019 config_entry_to_option(lc->home_path_entry, &lc->options.home_path, remove_trailing_slash);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2020
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2021 layout_apply_options(lc->lw, &lc->options);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2022 }
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2023
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2024 static void layout_config_ok_cb(GtkWidget *widget, gpointer data)
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2025 {
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2026 LayoutConfig *lc = data;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2027 layout_config_apply_cb(widget, lc);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2028 layout_config_close_cb(widget, lc);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2029 }
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2030
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2031 static void home_path_set_current_cb(GtkWidget *widget, gpointer data)
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2032 {
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2033 LayoutConfig *lc = data;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2034 gtk_entry_set_text(GTK_ENTRY(lc->home_path_entry), layout_get_path(lc->lw));
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2035 }
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2036
1511
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2037 static void startup_path_set_current_cb(GtkWidget *widget, gpointer data)
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2038 {
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2039 LayoutConfig *lc = data;
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2040 lc->options.startup_path = STARTUP_PATH_CURRENT;
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2041 }
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2042
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2043 static void startup_path_set_last_cb(GtkWidget *widget, gpointer data)
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2044 {
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2045 LayoutConfig *lc = data;
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2046 lc->options.startup_path = STARTUP_PATH_LAST;
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2047 }
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2048
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2049 static void startup_path_set_home_cb(GtkWidget *widget, gpointer data)
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2050 {
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2051 LayoutConfig *lc = data;
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2052 lc->options.startup_path = STARTUP_PATH_HOME;
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2053 }
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2054
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2055
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2056 /*
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2057 static void layout_config_save_cb(GtkWidget *widget, gpointer data)
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2058 {
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2059 layout_config_apply();
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2060 save_options(options);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2061 }
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2062 */
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2063
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2064 void layout_show_config_window(LayoutWindow *lw)
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2065 {
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2066 LayoutConfig *lc;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2067 GtkWidget *win_vbox;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2068 GtkWidget *hbox;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2069 GtkWidget *vbox;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2070 GtkWidget *button;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2071 GtkWidget *ct_button;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2072 GtkWidget *group;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2073 GtkWidget *frame;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2074 GtkWidget *tabcomp;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2075
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2076 lc = g_new0(LayoutConfig, 1);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2077 lc->lw = lw;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2078 layout_sync_options_with_current_state(lw);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2079 copy_layout_options(&lc->options, &lw->options);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2080
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2081 lc->configwindow = window_new(GTK_WINDOW_TOPLEVEL, "Layout", PIXBUF_INLINE_ICON_CONFIG, NULL, _("Window options and layout"));
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2082 gtk_window_set_type_hint(GTK_WINDOW(lc->configwindow), GDK_WINDOW_TYPE_HINT_DIALOG);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2083
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2084 g_signal_connect(G_OBJECT(lc->configwindow), "delete_event",
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2085 G_CALLBACK(layout_config_delete_cb), lc);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2086
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2087 gtk_window_set_default_size(GTK_WINDOW(lc->configwindow), CONFIG_WINDOW_DEF_WIDTH, CONFIG_WINDOW_DEF_HEIGHT);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2088 gtk_window_set_resizable(GTK_WINDOW(lc->configwindow), TRUE);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2089 gtk_container_set_border_width(GTK_CONTAINER(lc->configwindow), PREF_PAD_BORDER);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2090
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2091 win_vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2092 gtk_container_add(GTK_CONTAINER(lc->configwindow), win_vbox);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2093 gtk_widget_show(win_vbox);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2094
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2095 hbox = gtk_hbutton_box_new();
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2096 gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2097 gtk_box_set_spacing(GTK_BOX(hbox), PREF_PAD_BUTTON_GAP);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2098 gtk_box_pack_end(GTK_BOX(win_vbox), hbox, FALSE, FALSE, 0);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2099 gtk_widget_show(hbox);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2100
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2101 button = pref_button_new(NULL, GTK_STOCK_OK, NULL, FALSE,
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2102 G_CALLBACK(layout_config_ok_cb), lc);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2103 gtk_container_add(GTK_CONTAINER(hbox), button);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2104 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2105 gtk_widget_grab_default(button);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2106 gtk_widget_show(button);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2107
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2108 ct_button = button;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2109 /*
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2110 button = pref_button_new(NULL, GTK_STOCK_SAVE, NULL, FALSE,
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2111 G_CALLBACK(layout_config_save_cb), NULL);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2112 gtk_container_add(GTK_CONTAINER(hbox), button);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2113 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2114 gtk_widget_show(button);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2115 */
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2116 button = pref_button_new(NULL, GTK_STOCK_APPLY, NULL, FALSE,
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2117 G_CALLBACK(layout_config_apply_cb), lc);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2118 gtk_container_add(GTK_CONTAINER(hbox), button);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2119 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2120 gtk_widget_show(button);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2121
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2122 button = pref_button_new(NULL, GTK_STOCK_CANCEL, NULL, FALSE,
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2123 G_CALLBACK(layout_config_close_cb), lc);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2124 gtk_container_add(GTK_CONTAINER(hbox), button);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2125 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2126 gtk_widget_show(button);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2127
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2128 if (!generic_dialog_get_alternative_button_order(lc->configwindow))
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2129 {
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2130 gtk_box_reorder_child(GTK_BOX(hbox), ct_button, -1);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2131 }
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2132
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2133 frame = pref_frame_new(win_vbox, TRUE, NULL, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2134
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2135 vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2136 gtk_container_add(GTK_CONTAINER(frame), vbox);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2137 gtk_widget_show(vbox);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2138
1511
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2139
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2140 group = pref_group_new(vbox, FALSE, _("General options"), GTK_ORIENTATION_VERTICAL);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2141
1511
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2142 pref_label_new(group, _("Home path (empty to use your home directory)"));
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2143 hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2144
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2145 tabcomp = tab_completion_new(&lc->home_path_entry, lc->options.home_path, NULL, NULL);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2146 tab_completion_add_select_button(lc->home_path_entry, NULL, TRUE);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2147 gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2148 gtk_widget_show(tabcomp);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2149
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2150 button = pref_button_new(hbox, NULL, _("Use current"), FALSE,
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2151 G_CALLBACK(home_path_set_current_cb), lc);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2152
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2153 pref_checkbox_new_int(group, _("Show date in directories list view"),
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2154 lc->options.show_directory_date, &lc->options.show_directory_date);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2155
1514
22174e704d0b added option that simplifies saving of multi-window configurations
nadvornik
parents: 1511
diff changeset
2156 pref_checkbox_new_int(group, _("Exit program when this window is closed"),
22174e704d0b added option that simplifies saving of multi-window configurations
nadvornik
parents: 1511
diff changeset
2157 lc->options.exit_on_close, &lc->options.exit_on_close);
22174e704d0b added option that simplifies saving of multi-window configurations
nadvornik
parents: 1511
diff changeset
2158
1511
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2159 group = pref_group_new(vbox, FALSE, _("Start-up directory:"), GTK_ORIENTATION_VERTICAL);
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2160
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2161 button = pref_radiobutton_new(group, NULL, _("No change"),
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2162 (lc->options.startup_path == STARTUP_PATH_CURRENT),
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2163 G_CALLBACK(startup_path_set_current_cb), lc);
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2164 button = pref_radiobutton_new(group, button, _("Restore last path"),
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2165 (lc->options.startup_path == STARTUP_PATH_LAST),
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2166 G_CALLBACK(startup_path_set_last_cb), lc);
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2167 button = pref_radiobutton_new(group, button, _("Home path"),
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2168 (lc->options.startup_path == STARTUP_PATH_HOME),
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2169 G_CALLBACK(startup_path_set_home_cb), lc);
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2170
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2171 group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2172
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2173 lc->layout_widget = layout_config_new();
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2174 layout_config_set(lc->layout_widget, lw->options.style, lw->options.order);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2175 gtk_box_pack_start(GTK_BOX(group), lc->layout_widget, TRUE, TRUE, 0);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2176
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2177 gtk_widget_show(lc->layout_widget);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2178 gtk_widget_show(lc->configwindow);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2179 }
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2180
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2181 /*
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2182 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2183 * base
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2184 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2185 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2186
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2187 void layout_sync_options_with_current_state(LayoutWindow *lw)
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2188 {
1336
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2189 Histogram *histogram;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2190 if (!layout_valid(&lw)) return;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2191
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2192 lw->options.main_window.maximized = window_maximized(lw->window);
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2193 if (!lw->options.main_window.maximized)
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2194 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2195 layout_geometry_get(lw, &lw->options.main_window.x, &lw->options.main_window.y,
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2196 &lw->options.main_window.w, &lw->options.main_window.h);
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2197 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2198
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2199 layout_geometry_get_dividers(lw, &lw->options.main_window.hdivider_pos, &lw->options.main_window.vdivider_pos);
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2200
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2201 // layout_sort_get(NULL, &options->file_sort.method, &options->file_sort.ascending);
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2202
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2203 layout_geometry_get_tools(lw, &lw->options.float_window.x, &lw->options.float_window.y,
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2204 &lw->options.float_window.w, &lw->options.float_window.h, &lw->options.float_window.vdivider_pos);
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2205
1336
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2206 lw->options.image_overlay.state = image_osd_get(lw->image);
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2207 histogram = image_osd_get_histogram(lw->image);
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2208
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2209 lw->options.image_overlay.histogram_channel = histogram->histogram_channel;
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2210 lw->options.image_overlay.histogram_mode = histogram->histogram_mode;
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2211
1511
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2212 g_free(lw->options.last_path);
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2213 lw->options.last_path = g_strdup(layout_get_path(lw));
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2214 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2215
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2216 void layout_apply_options(LayoutWindow *lw, LayoutOptions *lop)
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2217 {
1437
a3d3208b0c50 gint -> gboolean.
zas_
parents: 1436
diff changeset
2218 gboolean refresh_style;
a3d3208b0c50 gint -> gboolean.
zas_
parents: 1436
diff changeset
2219 gboolean refresh_lists;
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2220
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2221 if (!layout_valid(&lw)) return;
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2222 /* FIXME: add other options too */
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2223
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2224 refresh_style = (lop->style != lw->options.style || strcmp(lop->order, lw->options.order) != 0);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2225 refresh_lists = (lop->show_directory_date != lw->options.show_directory_date);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2226
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2227 copy_layout_options(&lw->options, lop);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2228
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2229 if (refresh_style) layout_style_set(lw, lw->options.style, lw->options.order);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2230 if (refresh_lists) layout_refresh(lw);
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2231 }
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2232
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2233
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2234 void layout_close(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2235 {
1514
22174e704d0b added option that simplifies saving of multi-window configurations
nadvornik
parents: 1511
diff changeset
2236 if (!lw->options.exit_on_close && layout_window_list && layout_window_list->next)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2237 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2238 layout_free(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2239 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2240 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2241 {
278
04abf5b160eb exit_gqview() renamed to exit_program().
zas_
parents: 273
diff changeset
2242 exit_program();
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2243 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2244 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2245
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2246 void layout_free(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2247 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2248 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2249
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2250 layout_window_list = g_list_remove(layout_window_list, lw);
1473
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2251 if (current_lw == lw) current_lw = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2252
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents: 1291
diff changeset
2253 if (lw->exif_window) g_signal_handlers_disconnect_matched(G_OBJECT(lw->exif_window), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, lw);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents: 1291
diff changeset
2254
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2255 layout_bars_close(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2256
1470
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
2257 g_object_unref(lw->menu_bar);
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
2258 g_object_unref(lw->toolbar);
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
2259 g_object_unref(lw->utility_box);
38925ff71a46 do not re-create ui_manager at layout change
nadvornik
parents: 1466
diff changeset
2260
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2261 gtk_widget_destroy(lw->window);
837
f8c22438376c use GtkSizeGroup to control initial size of split images
nadvornik
parents: 820
diff changeset
2262
f8c22438376c use GtkSizeGroup to control initial size of split images
nadvornik
parents: 820
diff changeset
2263 if (lw->split_image_sizegroup) g_object_unref(lw->split_image_sizegroup);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
2264
796
0be132a51f51 use new notification in layout and layout_image
nadvornik
parents: 791
diff changeset
2265 file_data_unregister_notify_func(layout_image_notify_cb, lw);
0be132a51f51 use new notification in layout and layout_image
nadvornik
parents: 791
diff changeset
2266
995
6ca2c5fd7b13 Whitespaces cleanup.
zas_
parents: 984
diff changeset
2267 if (lw->dir_fd)
791
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
2268 {
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
2269 file_data_unregister_real_time_monitor(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
2270 file_data_unref(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
2271 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2272
1335
588d96cda850 save and restore toolbar configuration
nadvornik
parents: 1334
diff changeset
2273 string_list_free(lw->toolbar_actions);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2274 free_layout_options_content(&lw->options);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2275 g_free(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2276 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2277
1433
b4ad1d201279 Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents: 1431
diff changeset
2278 static gboolean layout_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2279 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2280 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2281
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2282 layout_close(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2283 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2284 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2285
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2286 LayoutWindow *layout_new(FileData *dir_fd, LayoutOptions *lop)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2287 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2288 return layout_new_with_geometry(dir_fd, lop, NULL);
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2289 }
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2290
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2291 LayoutWindow *layout_new_with_geometry(FileData *dir_fd, LayoutOptions *lop,
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2292 const gchar *geometry)
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2293 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2294 LayoutWindow *lw;
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2295 GdkGeometry hint;
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2296 GdkWindowHints hint_mask;
1336
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2297 Histogram *histogram;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2298
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2299 lw = g_new0(LayoutWindow, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2300
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2301 if (lop)
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2302 copy_layout_options(&lw->options, lop);
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2303 else
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2304 init_layout_options(&lw->options);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2305
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2306 lw->sort_method = SORT_NAME;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2307 lw->sort_ascend = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2308
1466
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2309 layout_set_unique_id(lw);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2310 // lw->options.tools_float = popped;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2311 // lw->options.tools_hidden = hidden;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2312 // lw->bar_sort_enabled = options->panels.sort.enabled;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2313 // lw->bar_enabled = options->panels.info.enabled;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2314
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2315 /* default layout */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2316
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2317 layout_config_parse(lw->options.style, lw->options.order,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2318 &lw->dir_location, &lw->file_location, &lw->image_location);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2319 if (lw->options.dir_view_type >= VIEW_DIR_TYPES_COUNT) lw->options.dir_view_type = 0;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2320 if (lw->options.file_view_type >= VIEW_FILE_TYPES_COUNT) lw->options.file_view_type = 0;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2321
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2322 /* divider positions */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2323
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2324 if (!options->save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2325 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2326 lw->options.main_window.hdivider_pos = MAIN_WINDOW_DIV_HPOS;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2327 lw->options.main_window.vdivider_pos = MAIN_WINDOW_DIV_VPOS;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2328 lw->options.float_window.vdivider_pos = MAIN_WINDOW_DIV_VPOS;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2329 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2330
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2331 /* window */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2332
1174
0bea79d87065 Drop useless wmclass stuff. Gtk will take care of it and as said in the documentation using gtk_window_set_wmclass() is sort of pointless.
zas_
parents: 1167
diff changeset
2333 lw->window = window_new(GTK_WINDOW_TOPLEVEL, GQ_APPNAME_LC, NULL, NULL, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2334 gtk_window_set_resizable(GTK_WINDOW(lw->window), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2335 gtk_container_set_border_width(GTK_CONTAINER(lw->window), 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2336
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2337 if (options->save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2338 {
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2339 hint_mask = GDK_HINT_USER_POS;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2340 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2341 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2342 {
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2343 hint_mask = 0;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2344 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2345
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2346 hint.min_width = 32;
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2347 hint.min_height = 32;
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2348 hint.base_width = 0;
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2349 hint.base_height = 0;
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2350 gtk_window_set_geometry_hints(GTK_WINDOW(lw->window), NULL, &hint,
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2351 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hint_mask);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2352
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2353 if (options->save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2354 {
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2355 gtk_window_set_default_size(GTK_WINDOW(lw->window), lw->options.main_window.w, lw->options.main_window.h);
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2356 // if (!layout_window_list)
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2357 // {
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2358 gtk_window_move(GTK_WINDOW(lw->window), lw->options.main_window.x, lw->options.main_window.y);
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2359 if (lw->options.main_window.maximized) gtk_window_maximize(GTK_WINDOW(lw->window));
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2360 // }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2361 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2362 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2363 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2364 gtk_window_set_default_size(GTK_WINDOW(lw->window), MAINWINDOW_DEF_WIDTH, MAINWINDOW_DEF_HEIGHT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2365 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2366
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2367 g_signal_connect(G_OBJECT(lw->window), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2368 G_CALLBACK(layout_delete_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2369
1473
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2370 g_signal_connect(G_OBJECT(lw->window), "focus-in-event",
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2371 G_CALLBACK(layout_set_current_cb), lw);
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2372
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2373 layout_keyboard_init(lw, lw->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2374
528
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
2375 #ifdef HAVE_LIRC
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
2376 layout_image_lirc_init(lw);
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
2377 #endif
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
2378
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2379 lw->main_box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2380 gtk_container_add(GTK_CONTAINER(lw->window), lw->main_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2381 gtk_widget_show(lw->main_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2382
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2383 layout_grid_setup(lw);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2384 image_top_window_set_sync(lw->image, (lw->options.tools_float || lw->options.tools_hidden));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2385
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2386 layout_util_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2387 layout_status_update_all(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2388
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
2389 if (dir_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2390 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
2391 layout_set_fd(lw, dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2392 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2393 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2394 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2395 GdkPixbuf *pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2396
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2397 pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO);
1287
5fdf258f9c24 Start with "Fit to window" in "Leave Zoom at previous setting" mode
nadvornik
parents: 1284
diff changeset
2398
5fdf258f9c24 Start with "Fit to window" in "Leave Zoom at previous setting" mode
nadvornik
parents: 1284
diff changeset
2399 /* FIXME: the zoom value set here is the value, which is then copied again and again
5fdf258f9c24 Start with "Fit to window" in "Leave Zoom at previous setting" mode
nadvornik
parents: 1284
diff changeset
2400 in "Leave Zoom at previous setting" mode. This is not ideal. */
5fdf258f9c24 Start with "Fit to window" in "Leave Zoom at previous setting" mode
nadvornik
parents: 1284
diff changeset
2401 image_change_pixbuf(lw->image, pixbuf, 0.0, FALSE);
1043
5fc64d6252e7 Replaced gtk depreceated code.
bruclik
parents: 1029
diff changeset
2402 g_object_unref(pixbuf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2403 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2404
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2405 if (geometry)
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2406 {
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2407 if (!gtk_window_parse_geometry(GTK_WINDOW(lw->window), geometry))
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2408 {
694
a3218946bd2d Sort out log_printf() vs printf_term() mix up.
zas_
parents: 671
diff changeset
2409 log_printf("%s", _("Invalid geometry\n"));
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2410 }
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2411 }
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
2412
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2413 gtk_widget_show(lw->window);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2414 layout_tools_hide(lw, lw->options.tools_hidden);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2415
1336
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2416 image_osd_set(lw->image, lw->options.image_overlay.state);
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2417 histogram = image_osd_get_histogram(lw->image);
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2418
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2419 histogram->histogram_channel = lw->options.image_overlay.histogram_channel;
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2420 histogram->histogram_mode = lw->options.image_overlay.histogram_mode;
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2421
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2422 layout_window_list = g_list_append(layout_window_list, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2423
796
0be132a51f51 use new notification in layout and layout_image
nadvornik
parents: 791
diff changeset
2424 file_data_register_notify_func(layout_image_notify_cb, lw, NOTIFY_PRIORITY_LOW);
0be132a51f51 use new notification in layout and layout_image
nadvornik
parents: 791
diff changeset
2425
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2426 return lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2427 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2428
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2429 void layout_write_attributes(LayoutOptions *layout, GString *outstr, gint indent)
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2430 {
1466
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2431 WRITE_NL(); WRITE_CHAR(*layout, id);
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2432
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2433 WRITE_NL(); WRITE_INT(*layout, style);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2434 WRITE_NL(); WRITE_CHAR(*layout, order);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2435 WRITE_NL(); WRITE_UINT(*layout, dir_view_type);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2436 WRITE_NL(); WRITE_UINT(*layout, file_view_type);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2437 WRITE_NL(); WRITE_BOOL(*layout, show_marks);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2438 WRITE_NL(); WRITE_BOOL(*layout, show_thumbnails);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2439 WRITE_NL(); WRITE_BOOL(*layout, show_directory_date);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2440 WRITE_NL(); WRITE_CHAR(*layout, home_path);
1511
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2441 WRITE_NL(); WRITE_CHAR(*layout, last_path);
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2442 WRITE_NL(); WRITE_UINT(*layout, startup_path);
1514
22174e704d0b added option that simplifies saving of multi-window configurations
nadvornik
parents: 1511
diff changeset
2443 WRITE_NL(); WRITE_BOOL(*layout, exit_on_close);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2444 WRITE_SEPARATOR();
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2445
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2446 WRITE_NL(); WRITE_INT(*layout, main_window.x);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2447 WRITE_NL(); WRITE_INT(*layout, main_window.y);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2448 WRITE_NL(); WRITE_INT(*layout, main_window.w);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2449 WRITE_NL(); WRITE_INT(*layout, main_window.h);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2450 WRITE_NL(); WRITE_BOOL(*layout, main_window.maximized);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2451 WRITE_NL(); WRITE_INT(*layout, main_window.hdivider_pos);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2452 WRITE_NL(); WRITE_INT(*layout, main_window.vdivider_pos);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2453 WRITE_SEPARATOR();
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2454
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2455 WRITE_NL(); WRITE_INT(*layout, float_window.x);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2456 WRITE_NL(); WRITE_INT(*layout, float_window.y);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2457 WRITE_NL(); WRITE_INT(*layout, float_window.w);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2458 WRITE_NL(); WRITE_INT(*layout, float_window.h);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2459 WRITE_NL(); WRITE_INT(*layout, float_window.vdivider_pos);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2460 WRITE_SEPARATOR();
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2461
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2462 WRITE_NL(); WRITE_INT(*layout, properties_window.w);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2463 WRITE_NL(); WRITE_INT(*layout, properties_window.h);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2464 WRITE_SEPARATOR();
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2465
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2466 WRITE_NL(); WRITE_BOOL(*layout, tools_float);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2467 WRITE_NL(); WRITE_BOOL(*layout, tools_hidden);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2468 WRITE_SEPARATOR();
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2469
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2470 WRITE_NL(); WRITE_BOOL(*layout, toolbar_hidden);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2471 WRITE_NL(); WRITE_BOOL(*layout, info_pixel_hidden);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2472
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2473 WRITE_NL(); WRITE_UINT(*layout, image_overlay.state);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2474 WRITE_NL(); WRITE_INT(*layout, image_overlay.histogram_channel);
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2475 WRITE_NL(); WRITE_INT(*layout, image_overlay.histogram_mode);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2476 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2477
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2478
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2479 void layout_write_config(LayoutWindow *lw, GString *outstr, gint indent)
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2480 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2481 layout_sync_options_with_current_state(lw);
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2482 WRITE_NL(); WRITE_STRING("<layout");
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2483 layout_write_attributes(&lw->options, outstr, indent + 1);
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2484 WRITE_STRING(">");
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2485
1320
055ed09d5a03 improved bar_sort configuration
nadvornik
parents: 1317
diff changeset
2486 bar_sort_write_config(lw->bar_sort, outstr, indent + 1);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2487 bar_write_config(lw->bar, outstr, indent + 1);
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2488
1335
588d96cda850 save and restore toolbar configuration
nadvornik
parents: 1334
diff changeset
2489 layout_toolbar_write_config(lw, outstr, indent + 1);
588d96cda850 save and restore toolbar configuration
nadvornik
parents: 1334
diff changeset
2490
1461
e015b6573d36 improved config file formatting
nadvornik
parents: 1437
diff changeset
2491 WRITE_NL(); WRITE_STRING("</layout>");
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2492 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2493
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2494 void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names, const gchar **attribute_values)
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2495 {
1473
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2496 gchar *id = NULL;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2497
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2498 while (*attribute_names)
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2499 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2500 const gchar *option = *attribute_names++;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2501 const gchar *value = *attribute_values++;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2502
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2503 /* layout options */
1473
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2504 if (READ_CHAR_FULL("id", id)) continue;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2505
1315
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2506 if (READ_INT(*layout, style)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2507 if (READ_CHAR(*layout, order)) continue;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2508
1315
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2509 if (READ_UINT(*layout, dir_view_type)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2510 if (READ_UINT(*layout, file_view_type)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2511 if (READ_BOOL(*layout, show_marks)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2512 if (READ_BOOL(*layout, show_thumbnails)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2513 if (READ_BOOL(*layout, show_directory_date)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2514 if (READ_CHAR(*layout, home_path)) continue;
1511
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2515 if (READ_CHAR(*layout, last_path)) continue;
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2516 if (READ_UINT_CLAMP(*layout, startup_path, 0, STARTUP_PATH_HOME)) continue;
1514
22174e704d0b added option that simplifies saving of multi-window configurations
nadvornik
parents: 1511
diff changeset
2517 if (READ_BOOL(*layout, exit_on_close)) continue;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2518
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2519 /* window positions */
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2520
1315
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2521 if (READ_INT(*layout, main_window.x)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2522 if (READ_INT(*layout, main_window.y)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2523 if (READ_INT(*layout, main_window.w)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2524 if (READ_INT(*layout, main_window.h)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2525 if (READ_BOOL(*layout, main_window.maximized)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2526 if (READ_INT(*layout, main_window.hdivider_pos)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2527 if (READ_INT(*layout, main_window.vdivider_pos)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2528
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2529 if (READ_INT(*layout, float_window.x)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2530 if (READ_INT(*layout, float_window.y)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2531 if (READ_INT(*layout, float_window.w)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2532 if (READ_INT(*layout, float_window.h)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2533 if (READ_INT(*layout, float_window.vdivider_pos)) continue;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2534
1315
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2535 if (READ_INT(*layout, properties_window.w)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2536 if (READ_INT(*layout, properties_window.h)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2537
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2538 if (READ_BOOL(*layout, tools_float)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2539 if (READ_BOOL(*layout, tools_hidden)) continue;
c1d108ab3388 Since READ_*() macros are now exported, do not hide
zas_
parents: 1314
diff changeset
2540 if (READ_BOOL(*layout, toolbar_hidden)) continue;
1375
df58e511d90e Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents: 1372
diff changeset
2541 if (READ_BOOL(*layout, info_pixel_hidden)) continue;
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2542
1336
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2543 if (READ_UINT(*layout, image_overlay.state)) continue;
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2544 if (READ_INT(*layout, image_overlay.histogram_channel)) continue;
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2545 if (READ_INT(*layout, image_overlay.histogram_mode)) continue;
4179d41d1149 fixed overlay configuration
nadvornik
parents: 1335
diff changeset
2546
1464
1b3751ac4743 be more verbose on parse errors
nadvornik
parents: 1463
diff changeset
2547 log_printf("unknown attribute %s = %s\n", option, value);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2548 }
1473
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2549 if (id && strcmp(id, LAYOUT_ID_CURRENT) != 0)
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2550 {
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2551 g_free(layout->id);
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2552 layout->id = id;
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2553 }
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2554 else
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2555 {
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2556 g_free(id);
01693e68707b layout id "_current_" matches the currently active layout window
nadvornik
parents: 1470
diff changeset
2557 }
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2558 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2559
1511
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2560 static void layout_config_startup_path(LayoutOptions *lop, gchar **path)
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2561 {
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2562 switch (lop->startup_path)
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2563 {
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2564 case STARTUP_PATH_LAST:
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2565 *path = (lop->last_path && isdir(lop->last_path)) ? g_strdup(lop->last_path) : get_current_dir();
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2566 break;
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2567 case STARTUP_PATH_HOME:
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2568 *path = (lop->home_path && isdir(lop->home_path)) ? g_strdup(lop->home_path) : g_strdup(homedir());
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2569 break;
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2570 default:
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2571 *path = get_current_dir();
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2572 break;
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2573 }
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2574 }
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2575
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2576
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2577 static void layout_config_commandline(LayoutOptions *lop, gchar **path)
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2578 {
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2579 if (command_line->startup_blank)
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2580 {
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2581 *path = NULL;
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2582 }
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2583 else if (command_line->file)
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2584 {
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2585 *path = g_strdup(command_line->file);
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2586 }
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2587 else if (command_line->path)
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2588 {
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2589 *path = g_strdup(command_line->path);
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2590 }
1511
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2591 else layout_config_startup_path(lop, path);
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2592
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2593 if (command_line->tools_show)
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2594 {
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2595 lop->tools_float = FALSE;
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2596 lop->tools_hidden = FALSE;
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2597 }
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2598 else if (command_line->tools_hide)
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2599 {
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2600 lop->tools_hidden = TRUE;
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2601 }
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2602 }
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2603
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2604 LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar **attribute_values, gboolean use_commandline)
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2605 {
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2606 LayoutOptions lop;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2607 LayoutWindow *lw;
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2608 gchar *path = NULL;
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2609
1436
d7a6fb7a90dd completely separated global and layout window options
nadvornik
parents: 1433
diff changeset
2610 init_layout_options(&lop);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2611
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2612 if (attribute_names) layout_load_attributes(&lop, attribute_names, attribute_values);
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2613
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2614 if (use_commandline)
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2615 {
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2616 layout_config_commandline(&lop, &path);
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2617 }
1511
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2618 else
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2619 {
1511
73cecf473802 startup path options simplified and moved to layout options
nadvornik
parents: 1506
diff changeset
2620 layout_config_startup_path(&lop, &path);
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2621 }
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2622
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2623 lw = layout_new_with_geometry(NULL, &lop, use_commandline ? command_line->geometry : NULL);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2624 layout_sort_set(lw, options->file_sort.method, options->file_sort.ascending);
1313
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2625 layout_set_path(lw, path);
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2626
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2627 if (use_commandline && command_line->startup_full_screen) layout_image_full_screen_start(lw);
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2628 if (use_commandline && command_line->startup_in_slideshow) layout_image_slideshow_start(lw);
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2629
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2630
1ffa5222dc61 enabled commandline again
nadvornik
parents: 1309
diff changeset
2631 g_free(path);
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2632 free_layout_options_content(&lop);
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2633 return lw;
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2634 }
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2635
1466
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2636 void layout_update_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values)
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2637 {
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2638 LayoutOptions lop;
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2639
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2640 init_layout_options(&lop);
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2641
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2642 if (attribute_names) layout_load_attributes(&lop, attribute_names, attribute_values);
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2643
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2644 layout_apply_options(lw, &lop);
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2645
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2646 free_layout_options_content(&lop);
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2647 }
6e020d3ab168 added possibility to update existing layout window from config
nadvornik
parents: 1464
diff changeset
2648
1309
55ea4962887a config file format changed to XML
nadvornik
parents: 1301
diff changeset
2649
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1045
diff changeset
2650 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */