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