1 /* Faster but has to be undefined when debugging. */
2 #define G_DISABLE_CAST_CHECKS
3 #define GTK_NO_CHECK_CASTS
8 # include "../config.h"
13 # define _(str) (gettext((str)))
18 /* Just to mark constant translatable strings, like in rcfile.c. */
21 #if HAVE_ISO_C_VARARGS
23 # define ERROR_MSG(...) \
27 message = g_strdup_printf(__VA_ARGS__); \
28 g_printerr(message); \
32 # define g_build_filename(...) \
33 clean_filename_free(g_build_filename(__VA_ARGS__))
35 #elif HAVE_GNU_C_VARARGS
37 # define ERROR_MSG(format...) \
41 message = g_strdup_printf(format); \
42 g_printerr(message); \
46 # define g_build_filename(str...) \
47 clean_filename_free(g_build_filename(str))
50 # error "No variadic macros"
53 /* Instead of finding it in a system or glib header. */
54 #define PI 3.1415926535897932384626433832795029L
56 /* User configurable settings. */
58 #define ZOOM_FACTOR 1.1
59 #define MOVE_OFFSET 20.0
60 #define BIG_ROTATION (PI / 4.0) /* 45 deg */
61 #define SMALL_ROTATION (PI / 1800.0) /* 0.1 deg */
62 #define MIPMAP_RATIO 0.75
64 /* Font for the help box. */
65 #define FONT "courier Medium 12"
68 /* End of user configurable settings. */
70 /* Loader according to filename extension. */
72 LOADER_NONE
, /* Unrecognized extension. */
73 LOADER_NORMAL
, /* GdkPixbuf, then ImageMagick. */
74 LOADER_DECOMP
/* ImageMagick with decompression. */
80 const loader_t loader
;
83 /* Bits for the refresh() function. */
84 #define REFRESH_IMAGE (1 << 0)
85 #define REFRESH_NOW (1 << 1)
86 #define REFRESH_STATUS (1 << 2)
87 #define APPEND_HISTORY (1 << 3)
89 /* Infos that can be freed once the map is created. */
110 loading_data
*map_init
;
113 /* The gliv_image structure. */
125 /* Options controlled by the user. */
133 gboolean zoom_pointer
;
134 gboolean alpha_checks
;
137 gboolean build_menus
;
149 /* Some global flags and variables. */
151 gboolean cursor_hidden
;
153 gboolean alpha_checks_changed
;
154 gboolean filtering_enabled
;
155 gint max_texture_size
;
156 GtkAllocation
*wid_size
;
162 void install_callbacks(gpointer object
);
163 void process_events(void);
166 gint
get_list_length(void);
167 GList
*get_list_head(void);
168 void remove_from_list(GList
* node
);
169 void reorder_files(gboolean shuffle
);
170 gchar
**get_sorted_files_array(void);
171 void init_list(gchar
** names
, gint num
, gboolean recursive
,
172 gboolean shuffle
, gboolean sort
);
173 void place_next(const gchar
* filename
);
174 gboolean
insert_after_current(gchar
** names
, gint nb
, gboolean shuffle
);
175 void confirm_remove_current(void);
176 void delete_selected_image(void);
179 typedef void (*foreach_file_func
) (const gchar
* path
);
180 void foreach_file(const gchar
* path
, foreach_file_func func
);
183 const struct format
*ext_to_loader(const gchar
* str
, guint len
);
186 void update_bg_color(void);
187 gboolean
toggle_cursor(gboolean visible
);
188 void schedule_hide_cursor(void);
189 void create_gl_widget(void);
192 G_GNUC_NORETURN
void quit(gint code
);
195 gboolean
toggle_help(void);
196 void show_about_box(void);
199 void init_history(void);
200 void append_history(void);
203 void clear_history(void);
206 GdkPixbuf
*load_with_imagemagick(const gchar
* filename
);
207 gboolean
have_imagemagick(void);
208 void imagemagick_finish(void);
211 void set_rebuilding_entry(GtkMenuItem
* item
);
212 void rebuild_directories(GtkMenuItem
* root
);
213 void rebuild_images(GtkMenuItem
* root
);
214 void rebuild_images_menus(void);
217 gboolean
is_loading(void);
218 void destroy_image(gliv_image
* im
);
219 void install_segv_handler(void);
220 void fill_ident(gliv_image
* im
);
221 gboolean
is_loadable(const gchar
* filename
);
222 GdkPixbuf
*load_gdk_pixbuf(const gchar
* filename
);
223 gliv_image
*load_file(const gchar
* filename
);
226 G_GNUC_PURE gfloat
get_matrix_zoom(void);
227 G_GNUC_PURE gfloat
get_matrix_angle(void);
228 G_GNUC_PURE gboolean
float_equal(gfloat a
, gfloat b
);
229 void get_matrix_bounding_box(gfloat
* min_x
, gfloat
* max_x
,
230 gfloat
* min_y
, gfloat
* max_y
);
231 void write_gl_matrix(void);
232 void matrix_cpy(gfloat
* dest
, gfloat
* src
);
233 gboolean
matrix_tile_visible(tile_dim
* tile
);
234 G_GNUC_PURE gboolean
is_matrix_symmetry(void);
235 G_GNUC_PURE gboolean
get_matrix_has_changed(void);
236 G_GNUC_PURE gboolean
is_filtering_needed(void);
237 gboolean
matrix_set_max_zoom(gint width
, gint height
, gboolean do_it
);
238 void matrix_reset(void);
239 void matrix_rotate(gfloat angle
);
240 void matrix_move(gfloat x
, gfloat y
);
241 void matrix_zoom(gfloat ratio
, gfloat x
, gfloat y
);
242 void matrix_flip_h(void);
243 void matrix_flip_v(void);
246 void set_menu_label(GtkMenuItem
* item
, const gchar
* text
, gboolean mnemonic
);
247 GtkAccelGroup
*create_menus(void);
250 void move_pointer(gint dest_x
, gint dest_y
);
253 void after_reorder(gint new_id
);
254 gboolean
load_direction(gint dir
);
255 void open_next_image(void);
256 void load_first_image(void);
257 void load_second_image(void);
258 void open_file(const gchar
* filename
, gboolean add_dir
, gboolean shuffle_flag
);
259 void reload_all_images(void);
260 void menu_load(const gchar
* filename
);
261 void unload(GList
* node
);
262 void set_slide_show_menu(GtkMenuItem
* item
);
263 void start_slide_show(void);
264 gboolean
slide_show_started(void);
265 void toggle_slide_show(void);
266 void begin_with_slide_show(void);
269 gboolean
menu_open(void);
272 void show_options(void);
275 options_struct
*load_rc(gboolean from_file
);
276 void load_accelerators(void);
277 void save_rc(options_struct
* opt
);
281 void zoom_in(gfloat ratio
);
282 void refresh(gint what
);
285 const gchar
*add_mnemonic(const gchar
* str
);
286 const gchar
*locale_to_utf8(const gchar
* str
);
287 gchar
*clean_filename(const gchar
* filename
);
288 gchar
*clean_filename_free(gchar
* filename
);
289 gchar
*fast_build_filename(const gchar
* dir
, const gchar
* file
);
290 gchar
*str_escape(const gchar
* str
);
293 void prioritize_textures(gliv_image
* im
, gboolean is_prio
);
294 void create_maps(gliv_image
* im
);
297 void show_dialog(GtkWidget
* widget
, const gchar
* name
,
298 gboolean unused_with_gtk2
);
299 void set_loading_entry(const gchar
* filename
);
300 void toggle_menu_bar(void);
301 void toggle_status_bar(void);
302 void toggle_scrollbars(void);
303 void update_status_bar(void);
304 void update_scrollbars(gboolean redraw
);
305 void refresh_all(void);
306 void create_windows(void);
307 void goto_window(gboolean force_resize
);
308 void toggle_fullscreen(gboolean enable
);
309 void update_window_title(void);
310 GtkWindow
*get_current_window(void);
313 void draw_zoom_frame(gboolean draw
);
314 void set_zoom_frame(gint x
, gint y
, gint width
, gint height
);
315 void clear_zoom_frame(void);
316 void zoom_frame(void);