annotate src/layout.c @ 984:bc73dc055cd0

Only display status if there is at least one file in the file list.
author zas_
date Sat, 23 Aug 2008 17:35:57 +0000
parents 37fdfe8f2ab1
children 6ca2c5fd7b13
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 166
diff changeset
2 * Geeqie
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
3 * (C) 2006 John Ellis
475
48c8e49b571c updated copyright in source files
nadvornik
parents: 442
diff changeset
4 * Copyright (C) 2008 The Geeqie Team
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 278
diff changeset
13 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 #include "layout.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents: 506
diff changeset
16 #include "color-man.h"
586
905688aa2317 split filelist.c to filefilter.c and filedata.c
nadvornik
parents: 583
diff changeset
17 #include "filedata.h"
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents: 506
diff changeset
18 #include "histogram.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "image.h"
482
75b7154e6435 Use image_osd_toggle() in layout_menu_overlay_cb().
zas_
parents: 480
diff changeset
20 #include "image-overlay.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "layout_config.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "layout_image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "layout_util.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "menu.h"
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
25 #include "pixbuf-renderer.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 #include "pixbuf_util.h"
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
27 #include "utilops.h"
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
28 #include "view_dir.h"
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
29 #include "view_file.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 #include "ui_misc.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 #include "ui_tabcomp.h"
648
e34c1002e553 Move some functions from main.[ch] to new window.[ch].
zas_
parents: 632
diff changeset
34 #include "window.h"
e34c1002e553 Move some functions from main.[ch] to new window.[ch].
zas_
parents: 632
diff changeset
35
528
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
36 #ifdef HAVE_LIRC
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
37 #include "lirc.h"
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
38 #endif
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
40 #define MAINWINDOW_DEF_WIDTH 700
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
41 #define MAINWINDOW_DEF_HEIGHT 500
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42
553
32cf2e7992fd Change default positions of dividers since width of the main menu
zas_
parents: 531
diff changeset
43 #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
44 #define MAIN_WINDOW_DIV_VPOS (MAINWINDOW_DEF_HEIGHT / 2)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 #define TOOLWINDOW_DEF_WIDTH 260
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47 #define TOOLWINDOW_DEF_HEIGHT 450
553
32cf2e7992fd Change default positions of dividers since width of the main menu
zas_
parents: 531
diff changeset
48
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 #define PROGRESS_WIDTH 150
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 #define ZOOM_LABEL_WIDTH 64
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 #define PANE_DIVIDER_SIZE 10
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 GList *layout_window_list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63 * misc
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67 gint layout_valid(LayoutWindow **lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 if (*lw == NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 if (layout_window_list) *lw = layout_window_list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 return (*lw != NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 return (g_list_find(layout_window_list, *lw) != NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 LayoutWindow *layout_find_by_image(ImageWindow *imd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 work = layout_window_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 LayoutWindow *lw = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 if (lw->image == imd) return lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93
368
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
94 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
95 {
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
96 GList *work;
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
97
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
98 work = layout_window_list;
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
99 while (work)
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 LayoutWindow *lw = work->data;
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
102 work = work->next;
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
103 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
104 return lw;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
105
368
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
106 }
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
107
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
108 return NULL;
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
109 }
95fe470440ad New Go to directory view feature that permits to find and display the directory
zas_
parents: 340
diff changeset
110
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 * menu, toolbar, and dir view
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117 static void layout_path_entry_changed_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 if (gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124 buf = g_strdup(gtk_entry_get_text(GTK_ENTRY(lw->path_entry)));
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
125 if (!buf || (lw->dir_fd && strcmp(buf, lw->dir_fd->path) == 0))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 layout_set_path(lw, buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
133 g_free(buf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
135
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
136 static void layout_path_entry_tab_cb(const gchar *path, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140 gchar *base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142 buf = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 parse_out_relatives(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 base = remove_level_from_path(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146 if (isdir(buf))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
148 if ((!lw->dir_fd || strcmp(lw->dir_fd->path, buf) != 0) && layout_set_path(lw, buf))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 gint pos = -1;
726
a1dcef8cd1ae Use G_DIR_SEPARATOR where applicable.
zas_
parents: 725
diff changeset
151 /* put the G_DIR_SEPARATOR back, if we are in tab completion for a dir and result was path change */
725
eda074e91ddd Use G_DIR_SEPARATOR_S where applicable.
zas_
parents: 694
diff changeset
152 gtk_editable_insert_text(GTK_EDITABLE(lw->path_entry), G_DIR_SEPARATOR_S, -1, &pos);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 gtk_editable_set_position(GTK_EDITABLE(lw->path_entry),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154 strlen(gtk_entry_get_text(GTK_ENTRY(lw->path_entry))));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 }
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
157 else if (lw->dir_fd && strcmp(lw->dir_fd->path, base) == 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 layout_list_scroll_to_subpart(lw, filename_from_path(buf));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 g_free(base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 static void layout_path_entry_cb(const gchar *path, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 buf = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172 parse_out_relatives(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174 layout_set_path(lw, buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
179 static void layout_vd_select_cb(ViewDir *vd, const gchar *path, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 layout_set_path(lw, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 static GtkWidget *layout_tool_setup(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 GtkWidget *box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 GtkWidget *menu_bar;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 GtkWidget *tabcomp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192 box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 menu_bar = layout_actions_menu_bar(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 gtk_widget_show(menu_bar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 lw->toolbar = layout_button_bar(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199 gtk_box_pack_start(GTK_BOX(box), lw->toolbar, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 if (!lw->toolbar_hidden) gtk_widget_show(lw->toolbar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 tabcomp = tab_completion_new_with_history(&lw->path_entry, NULL, "path_list", -1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 layout_path_entry_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 tab_completion_add_tab_func(lw->path_entry, layout_path_entry_tab_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 gtk_widget_show(tabcomp);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 g_signal_connect(G_OBJECT(lw->path_entry->parent), "changed",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 G_CALLBACK(layout_path_entry_changed_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
211 lw->vd = vd_new(lw->dir_view_type, lw->dir_fd);
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
212 vd_set_layout(lw->vd, lw);
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
213 vd_set_select_func(lw->vd, layout_vd_select_cb, lw);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
215 lw->dir_view = lw->vd->widget;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 gtk_box_pack_start(GTK_BOX(box), lw->dir_view, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 gtk_widget_show(lw->dir_view);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 gtk_widget_show(box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 return box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 * sort button (and menu)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 static void layout_sort_menu_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 LayoutWindow *lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 SortType type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
236 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
237
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 lw = submenu_item_get_data(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 type = (SortType)GPOINTER_TO_INT(data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243 layout_sort_set(lw, type, lw->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 static void layout_sort_menu_ascend_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 layout_sort_set(lw, lw->sort_method, !lw->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 static void layout_sort_menu_hide_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 /* destroy the menu */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 gtk_widget_unref(GTK_WIDGET(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
257 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
258
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259 static void layout_sort_button_press_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 GtkWidget *menu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263 GdkEvent *event;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264 guint32 etime;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 menu = submenu_add_sort(NULL, G_CALLBACK(layout_sort_menu_cb), lw, FALSE, FALSE, TRUE, lw->sort_method);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267
88
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
268 /* take ownership of menu */
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
269 #ifdef GTK_OBJECT_FLOATING
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
270 /* GTK+ < 2.10 */
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 g_object_ref(G_OBJECT(menu));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 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
273 #else
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
274 /* GTK+ >= 2.10 */
2099ee3f9a8d Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents: 81
diff changeset
275 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
276 #endif
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
278 /* ascending option */
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 menu_item_add_divider(menu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 menu_item_add_check(menu, _("Ascending"), lw->sort_ascend, G_CALLBACK(layout_sort_menu_ascend_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 g_signal_connect(G_OBJECT(menu), "selection_done",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 G_CALLBACK(layout_sort_menu_hide_cb), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 event = gtk_get_current_event();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 if (event)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 etime = gdk_event_get_time(event);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 gdk_event_free(event);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 etime = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, etime);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 static GtkWidget *layout_sort_button(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 button = gtk_button_new_with_label(sort_type_get_text(lw->sort_method));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
304 g_signal_connect(G_OBJECT(button), "clicked",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 G_CALLBACK(layout_sort_button_press_cb), lw);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
306 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
308 return button;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 *-----------------------------------------------------------------------------
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
313 * color profile button (and menu)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
314 *-----------------------------------------------------------------------------
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
315 */
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
316
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
317 static void layout_color_menu_enable_cb(GtkWidget *widget, gpointer data)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
318 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
319 LayoutWindow *lw = data;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
320
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
321 layout_image_color_profile_set_use(lw, (!layout_image_color_profile_get_use(lw)));
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
322 layout_image_refresh(lw);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
323 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
324
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
325 static void layout_color_menu_use_image_cb(GtkWidget *widget, gpointer data)
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
326 {
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
327 LayoutWindow *lw = data;
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
328 gint input, screen, use_image;
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
329
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
330 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return;
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
331 layout_image_color_profile_set(lw, input, screen, !use_image);
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
332 layout_image_refresh(lw);
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
333 }
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
334
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
335 #define COLOR_MENU_KEY "color_menu_key"
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
336
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
337 static void layout_color_menu_input_cb(GtkWidget *widget, gpointer data)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
338 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
339 LayoutWindow *lw = data;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
340 gint type;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
341 gint input, screen, use_image;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
342
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
343 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
344
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
345 type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), COLOR_MENU_KEY));
432
96f8389c36de fixed max. number of profiles
nadvornik
parents: 426
diff changeset
346 if (type < 0 || type >= COLOR_PROFILE_FILE + COLOR_PROFILE_INPUTS) return;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
347
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
348 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
349 if (type == input) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
350
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
351 layout_image_color_profile_set(lw, type, screen, use_image);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
352 layout_image_refresh(lw);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
353 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
354
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
355 static void layout_color_menu_screen_cb(GtkWidget *widget, gpointer data)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
356 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
357 LayoutWindow *lw = data;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
358 gint type;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
359 gint input, screen, use_image;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
360
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
361 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
362
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
363 type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), COLOR_MENU_KEY));
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
364 if (type < 0 || type > 1) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
365
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
366 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
367 if (type == screen) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
368
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
369 layout_image_color_profile_set(lw, input, type, use_image);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
370 layout_image_refresh(lw);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
371 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
372
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
373 static gchar *layout_color_name_parse(const gchar *name)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
374 {
269
dca6c0b9f862 Simplify layout_color_name_parse() using g_strdelimit().
zas_
parents: 268
diff changeset
375 if (!name) return g_strdup(_("Empty"));
dca6c0b9f862 Simplify layout_color_name_parse() using g_strdelimit().
zas_
parents: 268
diff changeset
376 return g_strdelimit(g_strdup(name), "_", '-');
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
377 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
378
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
379 static void layout_color_button_press_cb(GtkWidget *widget, gpointer data)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
380 {
288
d1f74154463e Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents: 281
diff changeset
381 #ifndef HAVE_LCMS
d1f74154463e Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents: 281
diff changeset
382 gchar *msg = g_strdup_printf(_("This installation of %s was not built with support for color profiles."), GQ_APPNAME);
d1f74154463e Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents: 281
diff changeset
383 file_util_warning_dialog(_("Color profiles not supported"),
d1f74154463e Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents: 281
diff changeset
384 msg,
d1f74154463e Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents: 281
diff changeset
385 GTK_STOCK_DIALOG_INFO, widget);
d1f74154463e Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents: 281
diff changeset
386 g_free(msg);
d1f74154463e Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents: 281
diff changeset
387 return;
d1f74154463e Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents: 281
diff changeset
388 #else
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
389 LayoutWindow *lw = data;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
390 GtkWidget *menu;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
391 GtkWidget *item;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
392 gchar *buf;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
393 gint active;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
394 gint input = 0;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
395 gint screen = 0;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
396 gint use_image = 0;
426
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
397 gint from_image = 0;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
398 gint i;
878
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
399
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
400 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
401
426
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
402 from_image = use_image && (layout_image_color_profile_get_from_image(lw) != COLOR_PROFILE_NONE);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
403 menu = popup_menu_short_lived();
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
404
270
67db7e4505c6 Move active variable affectation after the test.
zas_
parents: 269
diff changeset
405 active = layout_image_color_profile_get_use(lw);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
406 menu_item_add_check(menu, _("Use _color profiles"), active,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
407 G_CALLBACK(layout_color_menu_enable_cb), lw);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
408
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
409 menu_item_add_divider(menu);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
410
114
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
411 item = menu_item_add_check(menu, _("Use profile from _image"), use_image,
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
412 G_CALLBACK(layout_color_menu_use_image_cb), lw);
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
413 gtk_widget_set_sensitive(item, active);
50fc73e08550 Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents: 113
diff changeset
414
426
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
415 for (i = COLOR_PROFILE_SRGB; i < COLOR_PROFILE_FILE; i++)
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
416 {
878
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
417 const gchar *label;
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
418
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
419 switch (i)
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
420 {
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
421 case COLOR_PROFILE_SRGB: label = _("sRGB"); break;
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
422 case COLOR_PROFILE_ADOBERGB: label = _("AdobeRGB compatible"); break;
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
423 default: label = "fixme"; break;
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
424 }
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
425 buf = g_strdup_printf(_("Input _%d: %s"), i, label);
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
426 item = menu_item_add_radio(menu, (i == COLOR_PROFILE_SRGB) ? NULL : item,
426
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
427 buf, (input == i),
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
428 G_CALLBACK(layout_color_menu_input_cb), lw);
426
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
429 g_free(buf);
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
430 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i));
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
431 gtk_widget_set_sensitive(item, active && !from_image);
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
432 }
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
433
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
434 for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
435 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
436 const gchar *name;
878
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
437 gchar *end;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
438
327
049d6b00cc14 Rename color profile options.
zas_
parents: 320
diff changeset
439 name = options->color_profile.input_name[i];
049d6b00cc14 Rename color profile options.
zas_
parents: 320
diff changeset
440 if (!name) name = filename_from_path(options->color_profile.input_file[i]);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
441
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
442 end = layout_color_name_parse(name);
878
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
443 buf = g_strdup_printf(_("Input _%d: %s"), i + COLOR_PROFILE_FILE, end);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
444 g_free(end);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
445
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
446 item = menu_item_add_radio(menu, item,
426
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
447 buf, (i + COLOR_PROFILE_FILE == input),
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
448 G_CALLBACK(layout_color_menu_input_cb), lw);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
449 g_free(buf);
426
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
450 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + COLOR_PROFILE_FILE));
9fe0ca1b5263 show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents: 390
diff changeset
451 gtk_widget_set_sensitive(item, active && options->color_profile.input_file[i] && !from_image);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
452 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
453
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
454 menu_item_add_divider(menu);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
455
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
456 item = menu_item_add_radio(menu, NULL,
878
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
457 _("Screen sRGB"), (screen == 0),
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
458 G_CALLBACK(layout_color_menu_screen_cb), lw);
878
1b14c0e177ad layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents: 837
diff changeset
459
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
460 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(0));
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
461 gtk_widget_set_sensitive(item, active);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
462
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
463 item = menu_item_add_radio(menu, item,
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
464 _("_Screen profile"), (screen == 1),
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
465 G_CALLBACK(layout_color_menu_screen_cb), lw);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
466 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(1));
327
049d6b00cc14 Rename color profile options.
zas_
parents: 320
diff changeset
467 gtk_widget_set_sensitive(item, active && options->color_profile.screen_file);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
468
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
469 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME);
288
d1f74154463e Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents: 281
diff changeset
470 #endif /* HAVE_LCMS */
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
471 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
472
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
473 static GtkWidget *layout_color_button(LayoutWindow *lw)
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
474 {
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
475 GtkWidget *button;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
476 GtkWidget *image;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
477 gint enable;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
478
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
479 button = gtk_button_new();
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
480 image = gtk_image_new_from_stock(GTK_STOCK_SELECT_COLOR, GTK_ICON_SIZE_MENU);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
481 gtk_container_add(GTK_CONTAINER(button), image);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
482 gtk_widget_show(image);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
483 g_signal_connect(G_OBJECT(button), "clicked",
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
484 G_CALLBACK(layout_color_button_press_cb), lw);
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
485 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
486
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
487 #ifdef HAVE_LCMS
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
488 enable = (lw->image) ? lw->image->color_profile_enable : FALSE;
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
489 #else
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
490 enable = FALSE;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
491 #endif
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
492 gtk_widget_set_sensitive(image, enable);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
493
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
494 return button;
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
495 }
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
496
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
497
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
498 /*
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
499 *-----------------------------------------------------------------------------
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
500 * status bar
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
502 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
504 void layout_status_update_progress(LayoutWindow *lw, gdouble val, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
505 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
506 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
507 if (!lw->info_progress_bar) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
508
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(lw->info_progress_bar), val);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
510 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(lw->info_progress_bar), (text) ? text : " ");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513 void layout_status_update_info(LayoutWindow *lw, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 gchar *buf = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 if (!text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520 {
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 726
diff changeset
521 guint n;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
522 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
523
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
524 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
525
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
526 if (n)
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
527 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
528 guint s;
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
529 gint64 s_bytes = 0;
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
530 const gchar *ss;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
532 if (layout_image_slideshow_active(lw))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
534 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
535 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
536 ss = _(" Slideshow");
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
537 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
538 else
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
539 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
540 ss = _(" Paused");
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
541 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
544 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
545 ss = "";
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
546 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
547
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
548 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
549
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
550 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
551
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
552 if (s > 0)
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
553 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
554 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
555 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
556 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
557 g_free(b);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
558 g_free(sb);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
559 }
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
560 else if (n > 0)
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
561 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
562 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
563 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
564 g_free(b);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
565 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
566 else
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
567 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
568 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
569 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
570
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
571 text = buf;
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
572
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
573 image_osd_update(lw->image);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
577 text = "";
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 }
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
579 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
580
583
de3e2bc22336 Revert patch 675, and correctly fix gtk assertion failure.
zas_
parents: 574
diff changeset
581 if (lw->info_status) gtk_label_set_text(GTK_LABEL(lw->info_status), text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585 void layout_status_update_image(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
587 guint64 n;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
588
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589 if (!layout_valid(&lw) || !lw->image) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
591 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
592
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
593 if (!n)
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
594 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
595 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
596 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
597 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
598 else
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
599 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
600 gchar *text;
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
601 gchar *b;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
603 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
604 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
605 g_free(text);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
606
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
607 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
608
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
609 if (lw->image->unknown)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
611 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
612 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
613 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
614 }
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
615 else
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
616 {
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
617 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
618 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 {
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
622 gint width, height;
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
623
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
624 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
625 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
626 width, height, b);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
628
984
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
629 g_free(b);
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
630
bc73dc055cd0 Only display status if there is at least one file in the file list.
zas_
parents: 960
diff changeset
631 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
632 g_free(text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636 void layout_status_update_all(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
637 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
638 layout_status_update_progress(lw, 0.0, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 layout_status_update_info(lw, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 layout_status_update_image(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
641 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
642
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
643 static GtkWidget *layout_status_label(gchar *text, GtkWidget *box, gint start, gint size, gint expand)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
644 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
645 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
646 GtkWidget *frame;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
647
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
648 frame = gtk_frame_new(NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649 if (size) gtk_widget_set_size_request(frame, size, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
651 if (start)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653 gtk_box_pack_start(GTK_BOX(box), frame, expand, expand, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657 gtk_box_pack_end(GTK_BOX(box), frame, expand, expand, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 gtk_widget_show(frame);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
661 label = gtk_label_new(text ? text : "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662 gtk_container_add(GTK_CONTAINER(frame), label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663 gtk_widget_show(label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 return label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
668 static void layout_status_setup(LayoutWindow *lw, GtkWidget *box, gint small_format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672 if (lw->info_box) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
673
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674 if (small_format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 lw->info_box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
679 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680 lw->info_box = gtk_hbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682 gtk_box_pack_end(GTK_BOX(box), lw->info_box, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683 gtk_widget_show(lw->info_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
684
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 if (small_format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
686 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 hbox = gtk_hbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
689 gtk_widget_show(hbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
690 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
691 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
692 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 hbox = lw->info_box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
695 lw->info_progress_bar = gtk_progress_bar_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696 gtk_widget_set_size_request(lw->info_progress_bar, PROGRESS_WIDTH, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697 gtk_box_pack_start(GTK_BOX(hbox), lw->info_progress_bar, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
698 gtk_widget_show(lw->info_progress_bar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
700 lw->info_sort = layout_sort_button(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701 gtk_box_pack_start(GTK_BOX(hbox), lw->info_sort, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
702 gtk_widget_show(lw->info_sort);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
703
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
704 lw->info_color = layout_color_button(lw);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
705 gtk_widget_show(lw->info_color);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
706
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
707 if (small_format) gtk_box_pack_end(GTK_BOX(hbox), lw->info_color, FALSE, FALSE, 0);
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
708
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
709 lw->info_status = layout_status_label(NULL, lw->info_box, TRUE, 0, (!small_format));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
711 if (small_format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 hbox = gtk_hbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
715 gtk_widget_show(hbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
716 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
717 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
718 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719 hbox = lw->info_box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
721 lw->info_details = layout_status_label(NULL, hbox, TRUE, 0, TRUE);
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
722 if (!small_format) gtk_box_pack_start(GTK_BOX(hbox), lw->info_color, FALSE, FALSE, 0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723 lw->info_zoom = layout_status_label(NULL, hbox, FALSE, ZOOM_LABEL_WIDTH, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
725
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
726 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728 * views
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
729 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
730 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
731
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
732 static GtkWidget *layout_tools_new(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
734 lw->dir_view = layout_tool_setup(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735 return lw->dir_view;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
738 static void layout_list_status_cb(ViewFile *vf, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
740 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
741
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
742 layout_status_update_info(lw, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
743 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
744
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
745 static void layout_list_thumb_cb(ViewFile *vf, gdouble val, const gchar *text, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
746 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
747 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
748
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749 layout_status_update_progress(lw, val, text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
750 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
751
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
752 static GtkWidget *layout_list_new(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753 {
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
754 lw->vf = vf_new(lw->file_view_type, NULL);
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
755 vf_set_layout(lw->vf, lw);
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
756
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
757 vf_set_status_func(lw->vf, layout_list_status_cb, lw);
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
758 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
759
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
760 vf_marks_set(lw->vf, lw->marks_enabled);
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
761
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
762 switch (lw->file_view_type)
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
763 {
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
764 case FILEVIEW_ICON:
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
765 break;
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
766 case FILEVIEW_LIST:
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
767 vf_thumb_set(lw->vf, lw->thumbs_enabled);
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
768 break;
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
769 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
770
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
771 return lw->vf->widget;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
772 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
773
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
774 static void layout_list_sync_thumb(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
775 {
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
776 if (lw->vf) vf_thumb_set(lw->vf, lw->thumbs_enabled);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
778
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
779 static void layout_list_sync_marks(LayoutWindow *lw)
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
780 {
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
781 if (lw->vf) vf_marks_set(lw->vf, lw->marks_enabled);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
782 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
783
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
784 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
786 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
787 #if 0
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
788 if (lw->vf) vf_scroll_to_subpart(lw->vf, needle);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
790 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
791
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 GList *layout_list(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
793 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
794 if (!layout_valid(&lw)) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
796 if (lw->vf) return vf_get_list(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
797
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
800
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 726
diff changeset
801 guint layout_list_count(LayoutWindow *lw, gint64 *bytes)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
802 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
803 if (!layout_valid(&lw)) return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
804
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
805 if (lw->vf) return vf_count(lw->vf, bytes);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
806
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
809
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
810 FileData *layout_list_get_fd(LayoutWindow *lw, gint index)
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
811 {
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
812 if (!layout_valid(&lw)) return NULL;
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
813
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
814 if (lw->vf) return vf_index_get_data(lw->vf, index);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
815
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
816 return NULL;
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
817 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
818
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
819 gint layout_list_get_index(LayoutWindow *lw, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
821 if (!layout_valid(&lw) || !fd) return -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
823 if (lw->vf) return vf_index_by_path(lw->vf, fd->path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
825 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
826 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
828 void layout_list_sync_fd(LayoutWindow *lw, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
830 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
832 if (lw->vf) vf_select_by_fd(lw->vf, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
834
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835 static void layout_list_sync_sort(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
836 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
838
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
839 if (lw->vf) vf_sort_set(lw->vf, lw->sort_method, lw->sort_ascend);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
841
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
842 GList *layout_selection_list(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
843 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
844 if (!layout_valid(&lw)) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
845
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
846 if (layout_image_get_collection(lw, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
847 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
848 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
849
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
850 fd = layout_image_get_fd(lw);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
851 if (fd) return g_list_append(NULL, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
852 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
853 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
854
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
855 if (lw->vf) return vf_selection_get_list(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
856
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
857 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
858 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
859
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
860 GList *layout_selection_list_by_index(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
861 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
862 if (!layout_valid(&lw)) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
863
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
864 if (lw->vf) return vf_selection_get_list_by_index(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
865
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
866 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
867 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
868
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 726
diff changeset
869 guint layout_selection_count(LayoutWindow *lw, gint64 *bytes)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
870 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
871 if (!layout_valid(&lw)) return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
872
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
873 if (lw->vf) return vf_selection_count(lw->vf, bytes);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
874
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
875 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
876 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
877
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
878 void layout_select_all(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
879 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
880 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
881
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
882 if (lw->vf) vf_select_all(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
884
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
885 void layout_select_none(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
886 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
887 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
888
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
889 if (lw->vf) vf_select_none(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
890 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
891
601
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
892 void layout_select_invert(LayoutWindow *lw)
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
893 {
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
894 if (!layout_valid(&lw)) return;
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
895
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
896 if (lw->vf) vf_select_invert(lw->vf);
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
897 }
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 586
diff changeset
898
162
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
899 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
900 {
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
901 if (!layout_valid(&lw)) return;
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
902
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
903 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
904 }
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
905
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
906 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
907 {
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
908 if (!layout_valid(&lw)) return;
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
909
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
910 if (lw->vf) vf_selection_to_mark(lw->vf, mark, mode);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
911
162
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
912 layout_status_update_info(lw, NULL); /* osd in fullscreen mode */
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
913 }
1a42a2451575 created menu "Select" with selection and marks operations
nadvornik
parents: 138
diff changeset
914
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
915 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
916 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
917 * access
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
918 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
919 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
920
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
921 const gchar *layout_get_path(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
922 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
923 if (!layout_valid(&lw)) return NULL;
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
924 return lw->dir_fd ? lw->dir_fd->path : NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
925 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
926
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
927 static void layout_sync_path(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
928 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
929 if (!lw->dir_fd) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
930
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
931 if (lw->path_entry) gtk_entry_set_text(GTK_ENTRY(lw->path_entry), lw->dir_fd->path);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
932 if (lw->vd) vd_set_fd(lw->vd, lw->dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
933
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
934 if (lw->vf) vf_set_fd(lw->vf, lw->dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
935 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
936
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
937 gint layout_set_path(LayoutWindow *lw, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
938 {
959
9791230f83d3 fixed crash in geeqie --blank
nadvornik
parents: 902
diff changeset
939 FileData *fd;
9791230f83d3 fixed crash in geeqie --blank
nadvornik
parents: 902
diff changeset
940 if (!path) return FALSE;
9791230f83d3 fixed crash in geeqie --blank
nadvornik
parents: 902
diff changeset
941 fd = file_data_new_simple(path);
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
942 gint ret = layout_set_fd(lw, fd);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
943 file_data_unref(fd);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
944 return ret;
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
945 }
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
946
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
947
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
948 gint layout_set_fd(LayoutWindow *lw, FileData *fd)
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
949 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
950 gint have_file = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
951
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
952 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
953
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
954 if (!fd || !isname(fd->path)) return FALSE;
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
955 if (lw->dir_fd && fd == lw->dir_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
956 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
957 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
958 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
959
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
960 if (isdir(fd->path))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
961 {
791
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
962 if (lw->dir_fd)
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
963 {
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
964 file_data_unregister_real_time_monitor(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
965 file_data_unref(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
966 }
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
967 lw->dir_fd = file_data_ref(fd);
791
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
968 file_data_register_real_time_monitor(fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
969 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
970 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
971 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
972 gchar *base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
973
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
974 base = remove_level_from_path(fd->path);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
975 if (lw->dir_fd && strcmp(lw->dir_fd->path, base) == 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
976 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
977 g_free(base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
978 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
979 else if (isdir(base))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
980 {
791
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
981 if (lw->dir_fd)
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
982 {
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
983 file_data_unregister_real_time_monitor(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
984 file_data_unref(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
985 }
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
986 lw->dir_fd = file_data_new_simple(base);
791
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
987 file_data_register_real_time_monitor(lw->dir_fd);
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
988 g_free(base);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
989 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
990 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
991 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
992 g_free(base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
993 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
994 }
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
995 if (isfile(fd->path)) have_file = TRUE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
996 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
997
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
998 if (lw->path_entry) tab_completion_append_to_history(lw->path_entry, lw->dir_fd->path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
999 layout_sync_path(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1000
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1001 if (have_file)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1002 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1003 gint row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1004
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1005 row = layout_list_get_index(lw, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1006 if (row >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1007 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1008 layout_image_set_index(lw, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1009 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1010 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1011 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1012 layout_image_set_fd(lw, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1013 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1014 }
320
c74af1cbd61a Move more options to ConfOptions.
zas_
parents: 318
diff changeset
1015 else if (!options->lazy_image_sync)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1016 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1017 layout_image_set_index(lw, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1018 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1019
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1020 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1021 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1022
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1023 static void layout_refresh_lists(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1024 {
390
39369521e263 Fix two errors made in revision 473.
zas_
parents: 380
diff changeset
1025 if (lw->vd) vd_refresh(lw->vd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1026
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
1027 if (lw->vf) vf_refresh(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1028 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1029
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1030 void layout_refresh(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1031 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1032 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1033
506
fc9c8a3e1a8b Handle the newline in DEBUG_N() macro instead of adding one
zas_
parents: 501
diff changeset
1034 DEBUG_1("layout refresh");
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1035
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1036 layout_refresh_lists(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1037
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1038 if (lw->image) layout_image_refresh(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1039 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1040
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1041 void layout_thumb_set(LayoutWindow *lw, gint enable)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1042 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1043 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1044
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1045 if (lw->thumbs_enabled == enable) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1046
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1047 lw->thumbs_enabled = enable;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1048
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1049 layout_util_sync_thumb(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1050 layout_list_sync_thumb(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1051 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1052
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1053 void layout_marks_set(LayoutWindow *lw, gint enable)
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1054 {
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1055 if (!layout_valid(&lw)) return;
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1056
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1057 if (lw->marks_enabled == enable) return;
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1058
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1059 lw->marks_enabled = enable;
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1060
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1061 // layout_util_sync_marks(lw);
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1062 layout_list_sync_marks(lw);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1063 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 127
diff changeset
1064
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1065 gint layout_thumb_get(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1066 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1067 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1068
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1069 return lw->thumbs_enabled;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1070 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1071
433
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1072 gint layout_marks_get(LayoutWindow *lw)
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1073 {
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1074 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
1075
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1076 return lw->marks_enabled;
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1077 }
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1078
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1079 void layout_sort_set(LayoutWindow *lw, SortType type, gint ascend)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1080 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1081 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1082 if (lw->sort_method == type && lw->sort_ascend == ascend) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1083
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1084 lw->sort_method = type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1085 lw->sort_ascend = ascend;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1086
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1087 if (lw->info_sort) gtk_label_set_text(GTK_LABEL(GTK_BIN(lw->info_sort)->child),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1088 sort_type_get_text(type));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1089 layout_list_sync_sort(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1090 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1091
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1092 gint layout_sort_get(LayoutWindow *lw, SortType *type, gint *ascend)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1093 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1094 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1095
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1096 if (type) *type = lw->sort_method;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1097 if (ascend) *ascend = lw->sort_ascend;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1098
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1099 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1100 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1101
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1102 gint layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1103 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1104 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1105
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1106 gdk_window_get_root_origin(lw->window->window, x, y);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1107 gdk_drawable_get_size(lw->window->window, w, h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1108
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1109 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1110 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1111
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1112 gint layout_geometry_get_dividers(LayoutWindow *lw, gint *h, gint *v)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1113 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1114 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1115
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1116 if (lw->h_pane && GTK_PANED(lw->h_pane)->child1->allocation.x >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1117 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1118 *h = GTK_PANED(lw->h_pane)->child1->allocation.width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1119 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1120 else if (h != &lw->div_h)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1121 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1122 *h = lw->div_h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1123 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1124
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1125 if (lw->v_pane && GTK_PANED(lw->v_pane)->child1->allocation.x >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1126 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1127 *v = GTK_PANED(lw->v_pane)->child1->allocation.height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1128 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1129 else if (v != &lw->div_v)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1130 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1131 *v = lw->div_v;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1132 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1133
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1134 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1135 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1136
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
1137 void layout_views_set(LayoutWindow *lw, DirViewType dir_view_type, FileViewType file_view_type)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1138 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1139 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1140
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
1141 if (lw->dir_view_type == dir_view_type && lw->file_view_type == file_view_type) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1142
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
1143 lw->dir_view_type = dir_view_type;
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
1144 lw->file_view_type = file_view_type;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1145
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1146 layout_style_set(lw, -1, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1147 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1148
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
1149 gint layout_views_get(LayoutWindow *lw, DirViewType *dir_view_type, FileViewType *file_view_type)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1150 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1151 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1152
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
1153 *dir_view_type = lw->dir_view_type;
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
1154 *file_view_type = lw->file_view_type;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1155
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1156 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1157 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1158
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1159 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1160 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1161 * location utils
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1162 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1163 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1164
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1165 static gint layout_location_single(LayoutLocation l)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1166 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1167 return (l == LAYOUT_LEFT ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1168 l == LAYOUT_RIGHT ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1169 l == LAYOUT_TOP ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1170 l == LAYOUT_BOTTOM);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1171 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1172
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1173 static gint layout_location_vertical(LayoutLocation l)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1174 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1175 return (l & LAYOUT_TOP ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1176 l & LAYOUT_BOTTOM);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1177 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1178
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1179 static gint layout_location_first(LayoutLocation l)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1180 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1181 return (l & LAYOUT_TOP ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1182 l & LAYOUT_LEFT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1183 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1184
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1185 static LayoutLocation layout_grid_compass(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1186 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1187 if (layout_location_single(lw->dir_location)) return lw->dir_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1188 if (layout_location_single(lw->file_location)) return lw->file_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1189 return lw->image_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1190 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1191
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1192 static void layout_location_compute(LayoutLocation l1, LayoutLocation l2,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1193 GtkWidget *s1, GtkWidget *s2,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1194 GtkWidget **d1, GtkWidget **d2)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1195 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1196 LayoutLocation l;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1197
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1198 l = l1 & l2; /* get common compass direction */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1199 l = l1 - l; /* remove it */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1201 if (layout_location_first(l))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1202 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1203 *d1 = s1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1204 *d2 = s2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1205 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1206 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1207 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1208 *d1 = s2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1209 *d2 = s1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1210 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1211 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1212
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1213 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1214 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1215 * tools window (for floating/hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1216 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1217 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1218
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1219 gint layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h, gint *divider_pos)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1220 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1221 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1222
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1223 if (!lw->tools || !GTK_WIDGET_VISIBLE(lw->tools))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1224 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1225 /* use the stored values (sort of breaks success return value) */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1226
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1227 *divider_pos = lw->div_float;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1228
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1229 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1230 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1231
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1232 gdk_window_get_root_origin(lw->tools->window, x, y);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1233 gdk_drawable_get_size(lw->tools->window, w, h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1234
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1235 if (GTK_IS_VPANED(lw->tools_pane))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1236 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1237 *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1238 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1239 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1240 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1241 *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1242 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1243
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1244 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1245 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1246
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1247 static void layout_tools_geometry_sync(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1248 {
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1249 layout_geometry_get_tools(lw, &options->layout.float_window.x, &options->layout.float_window.x,
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1250 &options->layout.float_window.w, &options->layout.float_window.h, &lw->div_float);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1251 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1252
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1253 static void layout_tools_hide(LayoutWindow *lw, gint hide)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1254 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1255 if (!lw->tools) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1256
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1257 if (hide)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1258 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1259 if (GTK_WIDGET_VISIBLE(lw->tools))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1260 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1261 layout_tools_geometry_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1262 gtk_widget_hide(lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1263 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1264 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1265 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1266 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1267 if (!GTK_WIDGET_VISIBLE(lw->tools))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1268 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1269 gtk_widget_show(lw->tools);
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
1270 if (lw->vf) vf_refresh(lw->vf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1271 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1272 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1273
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1274 lw->tools_hidden = hide;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1275 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1276
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1277 static gint layout_tools_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1278 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1279 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1280
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1281 layout_tools_float_toggle(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1282
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1283 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1284 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1285
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1286 static void layout_tools_setup(LayoutWindow *lw, GtkWidget *tools, GtkWidget *files)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1287 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1288 GtkWidget *vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1289 GtkWidget *w1, *w2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1290 gint vertical;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1291 gint new_window = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1292
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1293 vertical = (layout_location_single(lw->image_location) && !layout_location_vertical(lw->image_location)) ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1294 (!layout_location_single(lw->image_location) && layout_location_vertical(layout_grid_compass(lw)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1295 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1296 layout_location_compute(lw->dir_location, lw->file_location,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1297 tools, files, &w1, &w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1298 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1299 /* for now, tools/dir are always first in order */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1300 w1 = tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1301 w2 = files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1302
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1303 if (!lw->tools)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1304 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1305 GdkGeometry geometry;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1306 GdkWindowHints hints;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1307
289
6a7298988a7a Simplify and unify gtk_window creation with the help of
zas_
parents: 288
diff changeset
1308 lw->tools = window_new(GTK_WINDOW_TOPLEVEL, "tools", PIXBUF_INLINE_ICON_TOOLS, NULL, _("Tools"));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1309 g_signal_connect(G_OBJECT(lw->tools), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1310 G_CALLBACK(layout_tools_delete_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1311 layout_keyboard_init(lw, lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1312
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1313 if (options->layout.save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1314 {
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
1315 hints = GDK_HINT_USER_POS;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1316 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1317 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1318 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1319 hints = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1320 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1321
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1322 geometry.min_width = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1323 geometry.min_height = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1324 geometry.base_width = TOOLWINDOW_DEF_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1325 geometry.base_height = TOOLWINDOW_DEF_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1326 gtk_window_set_geometry_hints(GTK_WINDOW(lw->tools), NULL, &geometry,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1327 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hints);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1328
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1329
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1330 gtk_window_set_resizable(GTK_WINDOW(lw->tools), TRUE);
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1331 gtk_container_set_border_width(GTK_CONTAINER(lw->tools), 0);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
1332
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1333 new_window = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1334 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1335 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1336 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1337 layout_tools_geometry_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1338 /* dump the contents */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1339 gtk_widget_destroy(GTK_BIN(lw->tools)->child);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1340 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1341
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1342 layout_actions_add_window(lw, lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1343
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1344 vbox = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1345 gtk_container_add(GTK_CONTAINER(lw->tools), vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1346 gtk_widget_show(vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1347
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1348 layout_status_setup(lw, vbox, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1349
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1350 if (vertical)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1351 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1352 lw->tools_pane = gtk_vpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1353 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1354 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1355 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1356 lw->tools_pane = gtk_hpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1357 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1358 gtk_box_pack_start(GTK_BOX(vbox), lw->tools_pane, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1359 gtk_widget_show(lw->tools_pane);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1360
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1361 gtk_paned_pack1(GTK_PANED(lw->tools_pane), w1, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1362 gtk_paned_pack2(GTK_PANED(lw->tools_pane), w2, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1363
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1364 gtk_widget_show(tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1365 gtk_widget_show(files);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1366
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1367 if (new_window)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1368 {
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1369 if (options->layout.save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1370 {
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1371 gtk_window_set_default_size(GTK_WINDOW(lw->tools), options->layout.float_window.w, options->layout.float_window.h);
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1372 gtk_window_move(GTK_WINDOW(lw->tools), options->layout.float_window.x, options->layout.float_window.y);
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1373 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1374 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1375 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1376 if (vertical)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1377 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1378 gtk_window_set_default_size(GTK_WINDOW(lw->tools),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1379 TOOLWINDOW_DEF_WIDTH, TOOLWINDOW_DEF_HEIGHT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1380 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1381 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1382 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1383 gtk_window_set_default_size(GTK_WINDOW(lw->tools),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1384 TOOLWINDOW_DEF_HEIGHT, TOOLWINDOW_DEF_WIDTH);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1385 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1386 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1387 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1388
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1389 if (!options->layout.save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1390 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1391 if (vertical)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1392 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1393 lw->div_float = MAIN_WINDOW_DIV_VPOS;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1394 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1395 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1396 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1397 lw->div_float = MAIN_WINDOW_DIV_HPOS;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1398 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1399 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1400
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1401 gtk_paned_set_position(GTK_PANED(lw->tools_pane), lw->div_float);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1402 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1403
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1404 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1405 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1406 * glue (layout arrangement)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1407 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1408 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1409
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1410 static void layout_grid_compute(LayoutWindow *lw,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1411 GtkWidget *image, GtkWidget *tools, GtkWidget *files,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1412 GtkWidget **w1, GtkWidget **w2, GtkWidget **w3)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1413 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1414 /* heh, this was fun */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1415
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1416 if (layout_location_single(lw->dir_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1417 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1418 if (layout_location_first(lw->dir_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1419 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1420 *w1 = tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1421 layout_location_compute(lw->file_location, lw->image_location, files, image, w2, w3);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1422 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1423 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1424 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1425 *w3 = tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1426 layout_location_compute(lw->file_location, lw->image_location, files, image, w1, w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1427 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1428 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1429 else if (layout_location_single(lw->file_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1430 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1431 if (layout_location_first(lw->file_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1432 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1433 *w1 = files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1434 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w2, w3);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1435 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1436 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1437 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1438 *w3 = files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1439 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w1, w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1440 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1441 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1442 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1443 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1444 /* image */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1445 if (layout_location_first(lw->image_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1446 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1447 *w1 = image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1448 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w2, w3);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1449 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1450 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1451 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1452 *w3 = image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1453 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w1, w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1454 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1455 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1456 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1457
127
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1458 void layout_split_change(LayoutWindow *lw, ImageSplitMode mode)
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1459 {
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1460 GtkWidget *image;
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1461 gint i;
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1462
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1463 for (i = 0; i < MAX_SPLIT_IMAGES; i++)
127
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1464 {
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1465 if (lw->split_images[i])
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1466 {
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1467 gtk_widget_hide(lw->split_images[i]->widget);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
1468 if (lw->split_images[i]->widget->parent != lw->utility_box)
127
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1469 gtk_container_remove(GTK_CONTAINER(lw->split_images[i]->widget->parent), lw->split_images[i]->widget);
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1470 }
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1471 }
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1472 gtk_container_remove(GTK_CONTAINER(lw->utility_box), lw->split_image_widget);
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1473
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1474 image = layout_image_setup_split(lw, mode);
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1475
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1476 gtk_box_pack_start(GTK_BOX(lw->utility_box), image, TRUE, TRUE, 0);
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1477 gtk_box_reorder_child(GTK_BOX(lw->utility_box), image, 0);
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1478 gtk_widget_show(image);
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1479 }
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1480
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1481 static void layout_grid_setup(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1482 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1483 gint priority_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1484 GtkWidget *h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1485 GtkWidget *v;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1486 GtkWidget *w1, *w2, *w3;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1487
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1488 GtkWidget *image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1489 GtkWidget *tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1490 GtkWidget *files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1491
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1492 layout_actions_setup(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1493 layout_actions_add_window(lw, lw->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1494
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1495 lw->group_box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1496 gtk_box_pack_start(GTK_BOX(lw->main_box), lw->group_box, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1497 gtk_widget_show(lw->group_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1498
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1499 priority_location = layout_grid_compass(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1500
127
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1501 image = layout_image_setup_split(lw, lw->split_mode);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
1502
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1503 tools = layout_tools_new(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1504 files = layout_list_new(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1505
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1506 image = layout_bars_prepare(lw, image);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1507
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1508 if (lw->tools_float || lw->tools_hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1509 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1510 gtk_box_pack_start(GTK_BOX(lw->group_box), image, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1511 gtk_widget_show(image);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1512
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1513 layout_tools_setup(lw, tools, files);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1514
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1515 gtk_widget_grab_focus(lw->image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1516
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1517 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1518 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1519 else if (lw->tools)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1520 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1521 layout_tools_geometry_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1522 gtk_widget_destroy(lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1523 lw->tools = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1524 lw->tools_pane = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1525 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1526
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1527 layout_status_setup(lw, lw->group_box, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1528
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1529 layout_grid_compute(lw, image, tools, files, &w1, &w2, &w3);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1530
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1531 v = lw->v_pane = gtk_vpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1532
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1533 h = lw->h_pane = gtk_hpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1534
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1535 if (!layout_location_vertical(priority_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1536 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1537 GtkWidget *tmp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1538
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1539 tmp = v;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1540 v = h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1541 h = tmp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1542 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1543
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1544 gtk_box_pack_start(GTK_BOX(lw->group_box), v, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1545
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1546 if (!layout_location_first(priority_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1547 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1548 gtk_paned_pack1(GTK_PANED(v), h, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1549 gtk_paned_pack2(GTK_PANED(v), w3, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1550
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1551 gtk_paned_pack1(GTK_PANED(h), w1, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1552 gtk_paned_pack2(GTK_PANED(h), w2, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1553 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1554 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1555 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1556 gtk_paned_pack1(GTK_PANED(v), w1, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1557 gtk_paned_pack2(GTK_PANED(v), h, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1558
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1559 gtk_paned_pack1(GTK_PANED(h), w2, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1560 gtk_paned_pack2(GTK_PANED(h), w3, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1561 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1562
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1563 gtk_widget_show(image);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1564 gtk_widget_show(tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1565 gtk_widget_show(files);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1566
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1567 gtk_widget_show(v);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1568 gtk_widget_show(h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1569
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1570 /* fix to have image pane visible when it is left and priority widget */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1571 if (lw->div_h == -1 &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1572 w1 == image &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1573 !layout_location_vertical(priority_location) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1574 layout_location_first(priority_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1575 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1576 gtk_widget_set_size_request(image, 200, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1577 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1578
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1579 gtk_paned_set_position(GTK_PANED(lw->h_pane), lw->div_h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1580 gtk_paned_set_position(GTK_PANED(lw->v_pane), lw->div_v);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1581
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1582 gtk_widget_grab_focus(lw->image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1583 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1584
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1585 void layout_style_set(LayoutWindow *lw, gint style, const gchar *order)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1586 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1587 FileData *dir_fd;
127
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1588 gint i;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1589
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1590 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1591
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1592 if (style != -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1593 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1594 LayoutLocation d, f, i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1595
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1596 layout_config_parse(style, order, &d, &f, &i);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1597
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1598 if (lw->dir_location == d &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1599 lw->file_location == f &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1600 lw->image_location == i) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1601
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1602 lw->dir_location = d;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1603 lw->file_location = f;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1604 lw->image_location = i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1605 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1606
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1607 /* remember state */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1608
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1609 layout_image_slideshow_stop(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1610 layout_image_full_screen_stop(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1611
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1612 dir_fd = lw->dir_fd;
960
37fdfe8f2ab1 fixed crash with float file list and geeqie --blank
nadvornik
parents: 959
diff changeset
1613 if (dir_fd) file_data_unregister_real_time_monitor(dir_fd);
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1614 lw->dir_fd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1615 lw->image = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1616 lw->utility_box = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1617
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1618 layout_geometry_get_dividers(lw, &lw->div_h, &lw->div_v);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1619
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1620 /* clear it all */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1621
268
98268a6b8182 Tidy up, whitespaces and indentation fix.
zas_
parents: 254
diff changeset
1622 for (i = 0; i < MAX_SPLIT_IMAGES; i++)
127
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1623 {
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1624 if (lw->split_images[i])
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1625 {
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1626 gtk_widget_hide(lw->split_images[i]->widget);
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1627 gtk_container_remove(GTK_CONTAINER(lw->split_images[i]->widget->parent), lw->split_images[i]->widget);
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1628 }
271afad04d07 implemented split windows
nadvornik
parents: 122
diff changeset
1629 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1630
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1631 lw->h_pane = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1632 lw->v_pane = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1633
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1634 lw->toolbar = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1635 lw->thumb_button = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1636 lw->path_entry = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1637 lw->dir_view = NULL;
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 368
diff changeset
1638 lw->vd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1639
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1640 lw->file_view = NULL;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 559
diff changeset
1641 lw->vf = NULL;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
1642 lw->vf = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1643
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1644 lw->info_box = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1645 lw->info_progress_bar = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1646 lw->info_sort = NULL;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 91
diff changeset
1647 lw->info_color = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1648 lw->info_status = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1649 lw->info_details = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1650 lw->info_zoom = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1651
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1652 if (lw->ui_manager) g_object_unref(lw->ui_manager);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1653 lw->ui_manager = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1654 lw->action_group = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1655
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1656 gtk_container_remove(GTK_CONTAINER(lw->main_box), lw->group_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1657 lw->group_box = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1658
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1659 /* re-fill */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1660
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1661 layout_grid_setup(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1662 layout_tools_hide(lw, lw->tools_hidden);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1663
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1664 layout_list_sync_sort(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1665 layout_util_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1666 layout_status_update_all(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1667
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1668 /* sync */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1669
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1670 if (image_get_fd(lw->image))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1671 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1672 layout_set_fd(lw, image_get_fd(lw->image));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1673 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1674 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1675 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1676 layout_set_fd(lw, dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1677 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1678 image_top_window_set_sync(lw->image, (lw->tools_float || lw->tools_hidden));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1679
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1680 /* clean up */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1681
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1682 file_data_unref(dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1683 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1684
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1685 void layout_styles_update(void)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1686 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1687 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1688
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1689 work = layout_window_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1690 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1691 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1692 LayoutWindow *lw = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1693 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1694
327
049d6b00cc14 Rename color profile options.
zas_
parents: 320
diff changeset
1695 layout_style_set(lw, options->layout.style, options->layout.order);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1696 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1697 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1698
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1699 void layout_colors_update(void)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1700 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1701 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1702
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1703 work = layout_window_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1704 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1705 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1706 LayoutWindow *lw = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1707 work = work->next;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
1708
208
fa0e05f985c3 set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents: 196
diff changeset
1709 if (!lw->image) continue;
339
de1c2cd06fce Rename user_specified_window_background and window_background_color
zas_
parents: 338
diff changeset
1710 image_background_set_color(lw->image, options->image.use_custom_border_color ? &options->image.border_color : NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1711 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1712 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1713
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1714 void layout_tools_float_toggle(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1715 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1716 gint popped;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1717
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1718 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1719
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1720 if (!lw->tools_hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1721 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1722 popped = !lw->tools_float;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1723 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1724 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1725 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1726 popped = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1727 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1728
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1729 if (lw->tools_float == popped)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1730 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1731 if (popped && lw->tools_hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1732 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1733 layout_tools_float_set(lw, popped, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1734 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1735 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1736 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1737 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1738 if (lw->tools_float)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1739 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1740 layout_tools_float_set(lw, FALSE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1741 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1742 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1743 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1744 layout_tools_float_set(lw, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1745 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1746 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1747 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1748
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1749 void layout_tools_hide_toggle(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1750 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1751 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1752
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1753 layout_tools_float_set(lw, lw->tools_float, !lw->tools_hidden);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1754 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1755
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1756 void layout_tools_float_set(LayoutWindow *lw, gint popped, gint hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1757 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1758 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1759
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1760 if (lw->tools_float == popped && lw->tools_hidden == hidden) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1761
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1762 if (lw->tools_float == popped && lw->tools_float && lw->tools)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1763 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1764 layout_tools_hide(lw, hidden);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1765 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1766 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1767
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1768 lw->tools_float = popped;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1769 lw->tools_hidden = hidden;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1770
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1771 layout_style_set(lw, -1, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1772 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1773
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1774 gint layout_tools_float_get(LayoutWindow *lw, gint *popped, gint *hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1775 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1776 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1777
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1778 *popped = lw->tools_float;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1779 *hidden = lw->tools_hidden;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1780
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1781 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1782 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1783
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1784 void layout_toolbar_toggle(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1785 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1786 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1787 if (!lw->toolbar) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1788
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1789 lw->toolbar_hidden = !lw->toolbar_hidden;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1790
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1791 if (lw->toolbar_hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1792 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1793 if (GTK_WIDGET_VISIBLE(lw->toolbar)) gtk_widget_hide(lw->toolbar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1794 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1795 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1796 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1797 if (!GTK_WIDGET_VISIBLE(lw->toolbar)) gtk_widget_show(lw->toolbar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1798 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1799 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1800
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1801 gint layout_toolbar_hidden(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1802 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1803 if (!layout_valid(&lw)) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1804
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1805 return lw->toolbar_hidden;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1806 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1807
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1808 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1809 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1810 * base
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1811 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1812 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1813
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1814 void layout_close(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1815 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1816 if (layout_window_list && layout_window_list->next)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1817 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1818 layout_free(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1819 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1820 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1821 {
278
04abf5b160eb exit_gqview() renamed to exit_program().
zas_
parents: 273
diff changeset
1822 exit_program();
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1823 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1824 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1825
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1826 void layout_free(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1827 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1828 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1829
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1830 layout_window_list = g_list_remove(layout_window_list, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1831
791
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1832
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1833 layout_bars_close(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1834
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1835 gtk_widget_destroy(lw->window);
837
f8c22438376c use GtkSizeGroup to control initial size of split images
nadvornik
parents: 820
diff changeset
1836
f8c22438376c use GtkSizeGroup to control initial size of split images
nadvornik
parents: 820
diff changeset
1837 if (lw->split_image_sizegroup) g_object_unref(lw->split_image_sizegroup);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 433
diff changeset
1838
796
0be132a51f51 use new notification in layout and layout_image
nadvornik
parents: 791
diff changeset
1839 file_data_unregister_notify_func(layout_image_notify_cb, lw);
0be132a51f51 use new notification in layout and layout_image
nadvornik
parents: 791
diff changeset
1840
791
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1841 if (lw->dir_fd)
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1842 {
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1843 file_data_unregister_real_time_monitor(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1844 file_data_unref(lw->dir_fd);
6d65167764ea realtime file monitor
nadvornik
parents: 787
diff changeset
1845 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1846
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1847 g_free(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1848 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1849
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1850 static gint layout_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1851 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1852 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1853
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1854 layout_close(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1855 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1856 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1857
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1858 LayoutWindow *layout_new(FileData *dir_fd, gint popped, gint hidden)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1859 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1860 return layout_new_with_geometry(dir_fd, popped, hidden, NULL);
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1861 }
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1862
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1863 LayoutWindow *layout_new_with_geometry(FileData *dir_fd, gint popped, gint hidden,
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1864 const gchar *geometry)
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1865 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1866 LayoutWindow *lw;
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1867 GdkGeometry hint;
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1868 GdkWindowHints hint_mask;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1869
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1870 lw = g_new0(LayoutWindow, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1871
340
77103f3f2cb1 Rename option thumbnails.enabled to layout.show_thumbnails as it makes
zas_
parents: 339
diff changeset
1872 lw->thumbs_enabled = options->layout.show_thumbnails;
433
5ddcf93278c7 Save Show Marks state to rc file and display current state in menu.
zas_
parents: 432
diff changeset
1873 lw->marks_enabled = options->layout.show_marks;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1874 lw->sort_method = SORT_NAME;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1875 lw->sort_ascend = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1876
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1877 lw->tools_float = popped;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1878 lw->tools_hidden = hidden;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1879
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1880 lw->toolbar_hidden = options->layout.toolbar_hidden;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1881
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1882 lw->utility_box = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1883 lw->bar_sort = NULL;
489
3809ffa3567b Save state and width of exif, info and sort panels to rc file.
zas_
parents: 482
diff changeset
1884 lw->bar_sort_enabled = options->panels.sort.enabled;
3809ffa3567b Save state and width of exif, info and sort panels to rc file.
zas_
parents: 482
diff changeset
1885
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1886 lw->bar_exif = NULL;
489
3809ffa3567b Save state and width of exif, info and sort panels to rc file.
zas_
parents: 482
diff changeset
1887 lw->bar_exif_enabled = options->panels.exif.enabled;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1888 lw->bar_exif_advanced = FALSE;
489
3809ffa3567b Save state and width of exif, info and sort panels to rc file.
zas_
parents: 482
diff changeset
1889
3809ffa3567b Save state and width of exif, info and sort panels to rc file.
zas_
parents: 482
diff changeset
1890 lw->bar_info = NULL;
3809ffa3567b Save state and width of exif, info and sort panels to rc file.
zas_
parents: 482
diff changeset
1891 lw->bar_info_enabled = options->panels.info.enabled;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1892
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1893 /* default layout */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1894
327
049d6b00cc14 Rename color profile options.
zas_
parents: 320
diff changeset
1895 layout_config_parse(options->layout.style, options->layout.order,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1896 &lw->dir_location, &lw->file_location, &lw->image_location);
523
0717bcc4f2b7 Handle the case of reduction of the number of view directory types.
zas_
parents: 507
diff changeset
1897 lw->dir_view_type = CLAMP(options->layout.dir_view_type, 0, VIEW_DIR_TYPES_COUNT - 1);
556
fe675761d091 Replace Layout icon_view field by more generic file_view_type.
zas_
parents: 555
diff changeset
1898 lw->file_view_type = CLAMP(options->layout.file_view_type, 0, VIEW_FILE_TYPES_COUNT - 1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1899
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1900 /* divider positions */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1901
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1902 if (options->layout.save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1903 {
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1904 lw->div_h = options->layout.main_window.hdivider_pos;
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1905 lw->div_v = options->layout.main_window.vdivider_pos;
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1906 lw->div_float = options->layout.float_window.vdivider_pos;
489
3809ffa3567b Save state and width of exif, info and sort panels to rc file.
zas_
parents: 482
diff changeset
1907 lw->bar_exif_width = options->panels.exif.width;
3809ffa3567b Save state and width of exif, info and sort panels to rc file.
zas_
parents: 482
diff changeset
1908 lw->bar_info_width = options->panels.info.width;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1909 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1910 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1911 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1912 lw->div_h = MAIN_WINDOW_DIV_HPOS;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1913 lw->div_v = MAIN_WINDOW_DIV_VPOS;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1914 lw->div_float = MAIN_WINDOW_DIV_VPOS;
489
3809ffa3567b Save state and width of exif, info and sort panels to rc file.
zas_
parents: 482
diff changeset
1915 lw->bar_exif_width = PANEL_DEFAULT_WIDTH;
3809ffa3567b Save state and width of exif, info and sort panels to rc file.
zas_
parents: 482
diff changeset
1916 lw->bar_info_width = PANEL_DEFAULT_WIDTH;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1917 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1918
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1919 /* window */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1920
289
6a7298988a7a Simplify and unify gtk_window creation with the help of
zas_
parents: 288
diff changeset
1921 lw->window = window_new(GTK_WINDOW_TOPLEVEL, GQ_WMCLASS, NULL, NULL, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1922 gtk_window_set_resizable(GTK_WINDOW(lw->window), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1923 gtk_container_set_border_width(GTK_CONTAINER(lw->window), 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1924
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1925 if (options->layout.save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1926 {
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1927 hint_mask = GDK_HINT_USER_POS;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1928 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1929 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1930 {
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1931 hint_mask = 0;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1932 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1933
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1934 hint.min_width = 32;
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1935 hint.min_height = 32;
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1936 hint.base_width = 0;
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1937 hint.base_height = 0;
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1938 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
1939 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hint_mask);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1940
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1941 if (options->layout.save_window_positions)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1942 {
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1943 gtk_window_set_default_size(GTK_WINDOW(lw->window), options->layout.main_window.w, options->layout.main_window.h);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1944 if (!layout_window_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1945 {
338
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1946 gtk_window_move(GTK_WINDOW(lw->window), options->layout.main_window.x, options->layout.main_window.y);
41c3cb73120f Rename window options (moved to layout) and re-order rc file.
zas_
parents: 333
diff changeset
1947 if (options->layout.main_window.maximized) gtk_window_maximize(GTK_WINDOW(lw->window));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1948 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1949 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1950 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1951 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1952 gtk_window_set_default_size(GTK_WINDOW(lw->window), MAINWINDOW_DEF_WIDTH, MAINWINDOW_DEF_HEIGHT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1953 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1954
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1955 g_signal_connect(G_OBJECT(lw->window), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1956 G_CALLBACK(layout_delete_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1957
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1958 layout_keyboard_init(lw, lw->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1959
528
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
1960 #ifdef HAVE_LIRC
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
1961 layout_image_lirc_init(lw);
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
1962 #endif
bf9c9e37adf4 Added LIRC patch written by Matteo Beniamino
nadvornik
parents: 523
diff changeset
1963
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1964 lw->main_box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1965 gtk_container_add(GTK_CONTAINER(lw->window), lw->main_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1966 gtk_widget_show(lw->main_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1967
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1968 layout_grid_setup(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1969 image_top_window_set_sync(lw->image, (lw->tools_float || lw->tools_hidden));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1970
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1971 layout_util_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1972 layout_status_update_all(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1973
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1974 if (dir_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1975 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 774
diff changeset
1976 layout_set_fd(lw, dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1977 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1978 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1979 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1980 GdkPixbuf *pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1981
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1982 pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1983 image_change_pixbuf(lw->image, pixbuf, 1.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1984 gdk_pixbuf_unref(pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1985 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1986
81
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1987 if (geometry)
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1988 {
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1989 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
1990 {
694
a3218946bd2d Sort out log_printf() vs printf_term() mix up.
zas_
parents: 671
diff changeset
1991 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
1992 }
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1993 }
0ef72a64930b Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
1994
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1995 gtk_widget_show(lw->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1996 layout_tools_hide(lw, lw->tools_hidden);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1997
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1998 layout_window_list = g_list_append(layout_window_list, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1999
796
0be132a51f51 use new notification in layout and layout_image
nadvornik
parents: 791
diff changeset
2000 file_data_register_notify_func(layout_image_notify_cb, lw, NOTIFY_PRIORITY_LOW);
0be132a51f51 use new notification in layout and layout_image
nadvornik
parents: 791
diff changeset
2001
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2002 return lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2003 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2004