Save state and width of exif, info and sort panels to rc file.
[geeqie.git] / src / main.h
1 /*
2  * Geeqie
3  * (C) 2006 John Ellis
4  * Copyright (C) 2008 The Geeqie Team
5  *
6  * Author: John Ellis
7  *
8  * This software is released under the GNU General Public License (GNU GPL).
9  * Please read the included file COPYING for more information.
10  * This software comes with no warranty of any kind, use at your own risk!
11  */
12
13
14 #ifndef MAIN_H
15 #define MAIN_H
16
17 #ifdef HAVE_CONFIG_H
18 #  include "config.h"
19 #endif
20
21 #ifdef HAVE_STRVERSCMP
22 #  ifndef _GNU_SOURCE
23 #    define _GNU_SOURCE
24 #  endif
25 #endif
26
27 #include "intl.h"
28
29 /*
30  *-------------------------------------
31  * Standard library includes
32  *-------------------------------------
33  */
34
35 #include <pwd.h>
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <string.h>
39 #include <time.h>
40 #include <unistd.h>
41 #include <sys/stat.h>
42 #include <sys/time.h>
43 #include <sys/types.h>
44 #include <dirent.h>
45 #include <fcntl.h>
46
47 /*
48  *-------------------------------------
49  * includes for glib / gtk / gdk-pixbuf
50  *-------------------------------------
51  */
52
53 #include <gdk/gdk.h>
54 #include <gtk/gtk.h>
55
56 #include <gdk-pixbuf/gdk-pixbuf.h>
57 #include <gdk-pixbuf/gdk-pixbuf-loader.h>
58
59
60 /*
61  *----------------------------------------------------------------------------
62  * defines
63  *----------------------------------------------------------------------------
64  */
65
66 #define GQ_APPNAME "Geeqie"
67 #define GQ_APPNAME_LC "geeqie"
68 #define GQ_WEBSITE "geeqie.sourceforge.net"
69 #define GQ_EMAIL_ADDRESS "geeqie-devel@lists.sourceforge.net"
70
71 #define GQ_WMCLASS GQ_APPNAME_LC
72
73 #define GQ_RC_DIR             "." GQ_APPNAME_LC
74 #define GQ_RC_DIR_COLLECTIONS GQ_RC_DIR"/collections"
75 #define GQ_RC_DIR_TRASH       GQ_RC_DIR"/trash"
76
77 #define RC_FILE_NAME GQ_APPNAME_LC "rc"
78
79 #define ZOOM_RESET_ORIGINAL 0
80 #define ZOOM_RESET_FIT_WINDOW 1
81 #define ZOOM_RESET_NONE 2
82
83 #define SCROLL_RESET_TOPLEFT 0
84 #define SCROLL_RESET_CENTER 1
85 #define SCROLL_RESET_NOCHANGE 2
86
87 #define MOUSEWHEEL_SCROLL_SIZE 20
88
89 #define GQ_EDITOR_GENERIC_SLOTS 10
90
91 #define COLOR_PROFILE_INPUTS 4
92
93 #define DEFAULT_THUMB_WIDTH     96
94 #define DEFAULT_THUMB_HEIGHT    72
95
96 #define IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT   4096
97 #define IMAGE_LOADER_READ_BUFFER_SIZE_MIN       512
98 #define IMAGE_LOADER_READ_BUFFER_SIZE_MAX       16*1024*1024
99
100 #define IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT       1
101 #define IMAGE_LOADER_IDLE_READ_LOOP_COUNT_MIN           1
102 #define IMAGE_LOADER_IDLE_READ_LOOP_COUNT_MAX           16
103
104 #define PANEL_MIN_WIDTH 64
105 #define PANEL_DEFAULT_WIDTH 288
106 #define PANEL_MAX_WIDTH 1200
107
108 #define DEFAULT_OVERLAY_INFO    "%collection%(%number%/%total%) [%zoom%] <b>%name%</b>\n" \
109                                 "%res%|%date%|%size%\n" \
110                                 "%fAperture%|%fShutterSpeed%|%fISOSpeedRating%|%fFocalLength%|%fExposureBias%\n" \
111                                 "%fCamera%|%fFlash%" \
112
113 #if 1 /* set to 0 to disable debugging code and related options */
114 # ifndef DEBUG
115 # define DEBUG 1
116 # endif
117 #endif
118 #ifndef DEBUG
119 # define debug 0
120 #endif
121
122 #include "typedefs.h"
123
124 /*
125  *----------------------------------------------------------------------------
126  * globals
127  *----------------------------------------------------------------------------
128  */
129 ConfOptions *init_options(ConfOptions *options); /* TODO: move to globals.h */
130
131 ConfOptions *options;
132
133
134
135 #ifdef DEBUG
136 extern gint debug;
137 #endif
138
139
140
141 /*
142  *----------------------------------------------------------------------------
143  * main.c
144  *----------------------------------------------------------------------------
145  */
146
147 /*
148  * This also doubles as the main.c header.
149  */
150
151 GtkWidget *window_new(GtkWindowType type, const gchar *name, const gchar *icon,
152                       const gchar *icon_file, const gchar *subtitle);
153 void window_set_icon(GtkWidget *window, const gchar *icon, const gchar *file);
154 gint window_maximized(GtkWidget *window);
155
156 gdouble get_zoom_increment(void);
157
158 const gchar *get_exec_time();
159
160 void help_window_show(const gchar *key);
161
162 void keyboard_scroll_calc(gint *x, gint *y, GdkEventKey *event);
163 gint key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data);
164 void exit_program(void);
165
166 #define CASE_SORT(a, b) ( (options->file_sort.case_sensitive) ? strcmp((a), (b)) : strcasecmp((a), (b)) )
167
168
169 #endif