Use GdkRectangle for LayoutOptions::log_window
[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 struct AnimationData;
26 struct FileData;
27 struct FullScreenData;
28 struct ImageWindow;
29 struct SlideShowData;
30 struct ViewDir;
31 struct ViewFile;
32
33 #define LAYOUT_ID_CURRENT "_current_"
34 #define MAX_SPLIT_IMAGES 4
35
36 extern GList *layout_window_list;
37
38
39 enum LayoutLocation {
40         LAYOUT_HIDE   = 0,
41         LAYOUT_LEFT   = 1 << 0,
42         LAYOUT_RIGHT  = 1 << 1,
43         LAYOUT_TOP    = 1 << 2,
44         LAYOUT_BOTTOM = 1 << 3
45 };
46
47 struct LayoutWindow
48 {
49         LayoutOptions options;
50
51         FileData *dir_fd;
52
53         /* base */
54
55         GtkWidget *window;
56
57         GtkWidget *main_box;
58
59         GtkWidget *group_box;
60         GtkWidget *h_pane;
61         GtkWidget *v_pane;
62
63         /* menus, path selector */
64
65         GtkActionGroup *action_group;
66         GtkActionGroup *action_group_editors;
67         guint ui_editors_id;
68         GtkUIManager *ui_manager;
69         guint toolbar_merge_id[TOOLBAR_COUNT];
70         GList *toolbar_actions[TOOLBAR_COUNT];
71
72         GtkWidget *path_entry;
73
74         /* image */
75
76         LayoutLocation image_location;
77
78         ImageWindow *image;
79
80         ImageWindow *split_images[MAX_SPLIT_IMAGES];
81         ImageSplitMode split_mode;
82         gint active_split_image;
83
84         GtkWidget *split_image_widget;
85         GtkSizeGroup *split_image_sizegroup;
86
87         /* tools window (float) */
88
89         GtkWidget *tools;
90         GtkWidget *tools_pane;
91
92         GtkWidget *menu_tool_bar; /**< Combined menu and toolbar box */
93         GtkWidget *menu_bar; /**< referenced by lw, exist during whole lw lifetime */
94         /* toolbar */
95
96         GtkWidget *toolbar[TOOLBAR_COUNT]; /**< referenced by lw, exist during whole lw lifetime */
97
98         GtkWidget *back_button;
99
100         /* dir view */
101
102         LayoutLocation dir_location;
103
104         ViewDir *vd;
105         GtkWidget *dir_view;
106
107         /* file view */
108
109         LayoutLocation file_location;
110
111         ViewFile *vf;
112
113         GtkWidget *file_view;
114
115         GtkWidget *info_box; /**< status bar */
116         GtkWidget *info_progress_bar; /**< status bar */
117         GtkWidget *info_sort; /**< status bar */
118         GtkWidget *info_status; /**< status bar */
119         GtkWidget *info_details; /**< status bar */
120         GtkWidget *info_zoom; /**< status bar */
121         GtkWidget *info_pixel; /**< status bar */
122
123         /* slide show */
124
125         SlideShowData *slideshow;
126
127         /* full screen */
128
129         FullScreenData *full_screen;
130
131         /* misc */
132
133         GtkWidget *utility_box; /**< referenced by lw, exist during whole lw lifetime */
134         GtkWidget *utility_paned; /**< between image and bar */
135         GtkWidget *bar_sort;
136         GtkWidget *bar;
137
138         gboolean bar_sort_enabled; /**< Set during start-up, and checked when the editors have loaded */
139
140         GtkWidget *exif_window;
141         GtkWidget *sar_window; /**< Search and Run window */
142
143         AnimationData *animation;
144
145         GtkWidget *log_window;
146 };
147
148 LayoutWindow *layout_new(FileData *dir_fd, LayoutOptions *lop);
149 LayoutWindow *layout_new_with_geometry(FileData *dir_fd, LayoutOptions *lop,
150                                        const gchar *geometry);
151 LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar **attribute_values, gboolean use_commandline);
152 void layout_update_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values);
153 LayoutWindow *layout_new_from_default();
154
155 void layout_close(LayoutWindow *lw);
156 void layout_free(LayoutWindow *lw);
157
158 gboolean layout_valid(LayoutWindow **lw);
159
160 void layout_show_config_window(LayoutWindow *lw);
161
162 void layout_apply_options(LayoutWindow *lw, LayoutOptions *lop);
163
164 void layout_sync_options_with_current_state(LayoutWindow *lw);
165 void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names, const gchar **attribute_values);
166 void layout_write_attributes(LayoutOptions *layout, GString *outstr, gint indent);
167 void layout_write_config(LayoutWindow *lw, GString *outstr, gint indent);
168
169
170 LayoutWindow *layout_find_by_image(ImageWindow *imd);
171 LayoutWindow *layout_find_by_image_fd(ImageWindow *imd);
172 LayoutWindow *layout_find_by_layout_id(const gchar *id);
173
174
175 const gchar *layout_get_path(LayoutWindow *lw);
176 gboolean layout_set_path(LayoutWindow *lw, const gchar *path);
177 gboolean layout_set_fd(LayoutWindow *lw, FileData *fd);
178
179 void layout_status_update_progress(LayoutWindow *lw, gdouble val, const gchar *text);
180 void layout_status_update_info(LayoutWindow *lw, const gchar *text);
181 void layout_status_update_image(LayoutWindow *lw);
182 void layout_status_update_all(LayoutWindow *lw);
183
184 GList *layout_list(LayoutWindow *lw);
185 guint layout_list_count(LayoutWindow *lw, gint64 *bytes);
186 FileData *layout_list_get_fd(LayoutWindow *lw, gint index);
187 gint layout_list_get_index(LayoutWindow *lw, FileData *fd);
188 void layout_list_sync_fd(LayoutWindow *lw, FileData *fd);
189
190 GList *layout_selection_list(LayoutWindow *lw);
191 /* return list of pointers to int for selection */
192 GList *layout_selection_list_by_index(LayoutWindow *lw);
193 guint layout_selection_count(LayoutWindow *lw, gint64 *bytes);
194 void layout_select_all(LayoutWindow *lw);
195 void layout_select_none(LayoutWindow *lw);
196 void layout_select_invert(LayoutWindow *lw);
197 void layout_select_list(LayoutWindow *lw, GList *list);
198
199 void layout_mark_to_selection(LayoutWindow *lw, gint mark, MarkToSelectionMode mode);
200 void layout_selection_to_mark(LayoutWindow *lw, gint mark, SelectionToMarkMode mode);
201
202 void layout_mark_filter_toggle(LayoutWindow *lw, gint mark);
203
204 void layout_refresh(LayoutWindow *lw);
205
206 void layout_thumb_set(LayoutWindow *lw, gboolean enable);
207
208 void layout_marks_set(LayoutWindow *lw, gboolean enable);
209
210 void layout_file_filter_set(LayoutWindow *lw, gboolean enable);
211
212 void layout_sort_set_files(LayoutWindow *lw, SortType type, gboolean ascend, gboolean case_sensitive);
213 gboolean layout_sort_get(LayoutWindow *lw, SortType *type, gboolean *ascend, gboolean *case_sensitive);
214
215 gboolean layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h);
216 gboolean layout_geometry_get_dividers(LayoutWindow *lw, gint *h, gint *v);
217
218 void layout_views_set(LayoutWindow *lw, DirViewType dir_view_type, FileViewType file_view_type);
219
220 void layout_views_set_sort_dir(LayoutWindow *lw, SortType method, gboolean ascend, gboolean case_sensitive);
221
222 void layout_status_update(LayoutWindow *lw, const gchar *text);
223
224 void layout_style_set(LayoutWindow *lw, gint style, const gchar *order);
225
226 void layout_menu_update_edit();
227 void layout_styles_update();
228 void layout_colors_update();
229
230
231 gboolean layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h, gint *divider_pos);
232 void layout_tools_float_set(LayoutWindow *lw, gboolean popped, gboolean hidden);
233 gboolean layout_tools_float_get(LayoutWindow *lw, gboolean *popped, gboolean *hidden);
234
235 void layout_tools_float_toggle(LayoutWindow *lw);
236 void layout_tools_hide_toggle(LayoutWindow *lw);
237
238
239 void layout_selectable_toolbars_toggle(LayoutWindow *lw);
240 void layout_info_pixel_set(LayoutWindow *lw, gboolean show);
241
242 void layout_split_change(LayoutWindow *lw, ImageSplitMode mode);
243
244 void save_layout(LayoutWindow *lw);
245 gchar *layout_get_unique_id();
246 guint layout_window_count();
247
248 #endif
249 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */