Deduplicate cr3 image loader
[geeqie.git] / src / layout.h
1 /*
2  * Copyright (C) 2004 John Ellis
3  * Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  * Author: John Ellis
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef LAYOUT_H
23 #define LAYOUT_H
24
25 #include <glib.h>
26 #include <gtk/gtk.h>
27
28 #include "options.h"
29 #include "typedefs.h"
30
31 struct AnimationData;
32 struct FileData;
33 struct FullScreenData;
34 struct ImageWindow;
35 struct SlideShowData;
36 struct ViewDir;
37 struct ViewFile;
38
39 #define LAYOUT_ID_CURRENT "_current_"
40 #define MAX_SPLIT_IMAGES 4
41
42 extern GList *layout_window_list;
43
44
45 enum LayoutLocation {
46         LAYOUT_HIDE   = 0,
47         LAYOUT_LEFT   = 1 << 0,
48         LAYOUT_RIGHT  = 1 << 1,
49         LAYOUT_TOP    = 1 << 2,
50         LAYOUT_BOTTOM = 1 << 3
51 };
52
53 struct LayoutWindow
54 {
55         LayoutOptions options;
56
57         FileData *dir_fd;
58
59         /* base */
60
61         GtkWidget *window;
62
63         GtkWidget *main_box;
64
65         GtkWidget *group_box;
66         GtkWidget *h_pane;
67         GtkWidget *v_pane;
68
69         /* menus, path selector */
70
71         GtkActionGroup *action_group;
72         GtkActionGroup *action_group_editors;
73         guint ui_editors_id;
74         GtkUIManager *ui_manager;
75         guint toolbar_merge_id[TOOLBAR_COUNT];
76         GList *toolbar_actions[TOOLBAR_COUNT];
77
78         GtkWidget *path_entry;
79
80         /* image */
81
82         LayoutLocation image_location;
83
84         ImageWindow *image;
85
86         ImageWindow *split_images[MAX_SPLIT_IMAGES];
87         ImageSplitMode split_mode;
88         gint active_split_image;
89
90         GtkWidget *split_image_widget;
91         GtkSizeGroup *split_image_sizegroup;
92
93         /* tools window (float) */
94
95         GtkWidget *tools;
96         GtkWidget *tools_pane;
97
98         GtkWidget *menu_tool_bar; /**< Combined menu and toolbar box */
99         GtkWidget *menu_bar; /**< referenced by lw, exist during whole lw lifetime */
100         /* toolbar */
101
102         GtkWidget *toolbar[TOOLBAR_COUNT]; /**< referenced by lw, exist during whole lw lifetime */
103
104         GtkWidget *back_button;
105
106         /* dir view */
107
108         LayoutLocation dir_location;
109
110         ViewDir *vd;
111         GtkWidget *dir_view;
112
113         /* file view */
114
115         LayoutLocation file_location;
116
117         ViewFile *vf;
118
119         GtkWidget *file_view;
120
121         GtkWidget *info_box; /**< status bar */
122         GtkWidget *info_progress_bar; /**< status bar */
123         GtkWidget *info_sort; /**< status bar */
124         GtkWidget *info_status; /**< status bar */
125         GtkWidget *info_details; /**< status bar */
126         GtkWidget *info_zoom; /**< status bar */
127         GtkWidget *info_pixel; /**< status bar */
128
129         /* slide show */
130
131         SlideShowData *slideshow;
132
133         /* full screen */
134
135         FullScreenData *full_screen;
136
137         /* misc */
138
139         GtkWidget *utility_box; /**< referenced by lw, exist during whole lw lifetime */
140         GtkWidget *utility_paned; /**< between image and bar */
141         GtkWidget *bar_sort;
142         GtkWidget *bar;
143
144         gboolean bar_sort_enabled; /**< Set during start-up, and checked when the editors have loaded */
145
146         GtkWidget *exif_window;
147         GtkWidget *sar_window; /**< Search and Run window */
148
149         AnimationData *animation;
150
151         GtkWidget *log_window;
152 };
153
154 LayoutWindow *layout_new(FileData *dir_fd, LayoutOptions *lop);
155 LayoutWindow *layout_new_with_geometry(FileData *dir_fd, LayoutOptions *lop,
156                                        const gchar *geometry);
157 LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar **attribute_values, gboolean use_commandline);
158 void layout_update_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values);
159 LayoutWindow *layout_new_from_default();
160
161 void layout_close(LayoutWindow *lw);
162 void layout_free(LayoutWindow *lw);
163
164 gboolean layout_valid(LayoutWindow **lw);
165
166 void layout_show_config_window(LayoutWindow *lw);
167
168 void layout_apply_options(LayoutWindow *lw, LayoutOptions *lop);
169
170 void layout_sync_options_with_current_state(LayoutWindow *lw);
171 void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names, const gchar **attribute_values);
172 void layout_write_attributes(LayoutOptions *layout, GString *outstr, gint indent);
173 void layout_write_config(LayoutWindow *lw, GString *outstr, gint indent);
174
175
176 LayoutWindow *layout_find_by_image(ImageWindow *imd);
177 LayoutWindow *layout_find_by_image_fd(ImageWindow *imd);
178 LayoutWindow *layout_find_by_layout_id(const gchar *id);
179
180
181 const gchar *layout_get_path(LayoutWindow *lw);
182 gboolean layout_set_path(LayoutWindow *lw, const gchar *path);
183 gboolean layout_set_fd(LayoutWindow *lw, FileData *fd);
184
185 void layout_status_update_progress(LayoutWindow *lw, gdouble val, const gchar *text);
186 void layout_status_update_info(LayoutWindow *lw, const gchar *text);
187 void layout_status_update_image(LayoutWindow *lw);
188 void layout_status_update_all(LayoutWindow *lw);
189
190 GList *layout_list(LayoutWindow *lw);
191 guint layout_list_count(LayoutWindow *lw, gint64 *bytes);
192 FileData *layout_list_get_fd(LayoutWindow *lw, gint index);
193 gint layout_list_get_index(LayoutWindow *lw, FileData *fd);
194 void layout_list_sync_fd(LayoutWindow *lw, FileData *fd);
195
196 GList *layout_selection_list(LayoutWindow *lw);
197 /* return list of pointers to int for selection */
198 GList *layout_selection_list_by_index(LayoutWindow *lw);
199 guint layout_selection_count(LayoutWindow *lw, gint64 *bytes);
200 void layout_select_all(LayoutWindow *lw);
201 void layout_select_none(LayoutWindow *lw);
202 void layout_select_invert(LayoutWindow *lw);
203 void layout_select_list(LayoutWindow *lw, GList *list);
204
205 void layout_mark_to_selection(LayoutWindow *lw, gint mark, MarkToSelectionMode mode);
206 void layout_selection_to_mark(LayoutWindow *lw, gint mark, SelectionToMarkMode mode);
207
208 void layout_mark_filter_toggle(LayoutWindow *lw, gint mark);
209
210 void layout_refresh(LayoutWindow *lw);
211
212 void layout_thumb_set(LayoutWindow *lw, gboolean enable);
213
214 void layout_marks_set(LayoutWindow *lw, gboolean enable);
215
216 void layout_file_filter_set(LayoutWindow *lw, gboolean enable);
217
218 void layout_sort_set_files(LayoutWindow *lw, SortType type, gboolean ascend, gboolean case_sensitive);
219 gboolean layout_sort_get(LayoutWindow *lw, SortType *type, gboolean *ascend, gboolean *case_sensitive);
220
221 gboolean layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h);
222 gboolean layout_geometry_get_dividers(LayoutWindow *lw, gint *h, gint *v);
223
224 void layout_views_set(LayoutWindow *lw, DirViewType dir_view_type, FileViewType file_view_type);
225
226 void layout_views_set_sort_dir(LayoutWindow *lw, SortType method, gboolean ascend, gboolean case_sensitive);
227
228 void layout_status_update(LayoutWindow *lw, const gchar *text);
229
230 void layout_style_set(LayoutWindow *lw, gint style, const gchar *order);
231
232 void layout_menu_update_edit();
233 void layout_styles_update();
234 void layout_colors_update();
235
236
237 gboolean layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h, gint *divider_pos);
238 void layout_tools_float_set(LayoutWindow *lw, gboolean popped, gboolean hidden);
239 gboolean layout_tools_float_get(LayoutWindow *lw, gboolean *popped, gboolean *hidden);
240
241 void layout_tools_float_toggle(LayoutWindow *lw);
242 void layout_tools_hide_toggle(LayoutWindow *lw);
243
244
245 void layout_selectable_toolbars_toggle(LayoutWindow *lw);
246 void layout_info_pixel_set(LayoutWindow *lw, gboolean show);
247
248 void layout_split_change(LayoutWindow *lw, ImageSplitMode mode);
249
250 void save_layout(LayoutWindow *lw);
251 gchar *layout_get_unique_id();
252 guint layout_window_count();
253
254 #endif
255 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */