]> Dogcows Code - chaz/homebank/blob - src/homebank.h
import homebank-4.6.3
[chaz/homebank] / src / homebank.h
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2014 Maxime DOYEN
3 *
4 * This file is part of HomeBank.
5 *
6 * HomeBank is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * HomeBank is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef __HOMEBANK_H__
21 #define __HOMEBANK_H__
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26
27 #include <ctype.h> /* isprint */
28 #include <errno.h>
29 #include <math.h>
30 #include <libintl.h>
31 #include <locale.h>
32 #include <stdlib.h> /* atoi, atof, atol */
33 #include <string.h> /* memset, memcpy, strcmp, strcpy */
34 #include <time.h>
35
36 #include <glib.h>
37 #include <glib/gstdio.h>
38 #include <gtk/gtk.h>
39
40 #include "enums.h"
41 #include "hb-preferences.h"
42
43 #include "hb-transaction.h"
44 #include "hb-account.h"
45 #include "hb-archive.h"
46 #include "hb-assign.h"
47 #include "hb-category.h"
48 #include "hb-encoding.h"
49 #include "hb-export.h"
50 #include "hb-filter.h"
51 #include "hb-import.h"
52 #include "hb-misc.h"
53 #include "hb-payee.h"
54 #include "hb-report.h"
55 #include "hb-tag.h"
56 #include "hb-hbfile.h"
57 #include "hb-xml.h"
58
59 #include "ui-dialogs.h"
60 #include "ui-pref.h"
61 #include "ui-widgets.h"
62
63 #define _(str) gettext (str)
64 #define gettext_noop(str) (str)
65 #define N_(str) gettext_noop (str)
66
67 /* = = = = = = = = */
68 /* = = = = = = = = = = = = = = = = */
69 /* = = = = = = = = = = = = = = = = = = = = = = = = */
70 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
71
72 #define HB_UNSTABLE FALSE
73 #define HB_VERSION "4.6.3"
74 #define FILE_VERSION 0.9
75 #define PREF_VERSION 460
76
77 #if HB_UNSTABLE == FALSE
78 #define PROGNAME "HomeBank"
79 #define HB_DATA_PATH "homebank"
80 #else
81 #define PROGNAME "HomeBank " HB_VERSION " (unstable)"
82 #define HB_DATA_PATH "homebank_unstable"
83 #endif
84
85 #ifdef G_OS_WIN32
86 #define GETTEXT_PACKAGE "homebank"
87 #define LOCALE_DIR "locale"
88 #define PIXMAPS_DIR "images"
89 #define HELP_DIR "help"
90 #define PACKAGE_VERSION HB_VERSION
91 #define PACKAGE "homebank"
92 #define VERSION HB_VERSION
93
94 //#define PORTABLE_APP
95 //#define NOOFX
96
97 #define ENABLE_NLS 1
98 #endif
99
100 /* container spacing */
101 #define PHI 1.61803399
102
103 #define HB_MAINBOX_SPACING 12
104 #define HB_BOX_SPACING 6
105
106 #define HB_HSPACE_SPACING 18 /* used to separate dialog block */
107 #define HB_TABROW_SPACING 6
108 #define HB_TABCOL_SPACING 6
109
110 /* widget minimum width */
111 #define HB_MINWIDTH_LIST 161
112 #define HB_MINWIDTH_COMBO 80
113
114
115 /* for transaction dialog */
116 #define GTK_RESPONSE_ADD 1
117
118
119 #define HB_NUMBER_SAMPLE 20457.99
120
121
122 enum
123 {
124 FILETYPE_UNKNOW,
125 FILETYPE_HOMEBANK,
126 FILETYPE_OFX,
127 FILETYPE_QIF,
128 FILETYPE_CSV_HB,
129 FILETYPE_AMIGA_HB,
130 NUM_FILETYPE
131 };
132
133 /*
134 ** stock icons
135 */
136
137 /* Custom HomeBank named icons */
138 #define HB_STOCK_ACCOUNT "hb-account"
139 #define HB_STOCK_ARCHIVE "hb-archive"
140 #define HB_STOCK_ASSIGN "hb-assign"
141 #define HB_STOCK_BUDGET "hb-budget"
142 #define HB_STOCK_CATEGORY "hb-category"
143 #define HB_STOCK_PAYEE "hb-payee"
144 #define HB_STOCK_FILTER "hb-filter"
145 #define HB_STOCK_OPE_ADD "hb-ope-add"
146 #define HB_STOCK_OPE_HERIT "hb-ope-herit"
147 #define HB_STOCK_OPE_EDIT "hb-ope-edit"
148 #define HB_STOCK_OPE_SHOW "hb-ope-show"
149 #define HB_STOCK_OPE_DELETE "hb-ope-delete"
150 #define HB_STOCK_OPE_VALID "hb-ope-valid"
151 #define HB_STOCK_OPE_REMIND "hb-ope-remind"
152 #define HB_STOCK_OPE_AUTO "hb-ope-auto"
153 #define HB_STOCK_REP_STATS "hb-rep-stats"
154 #define HB_STOCK_REP_TIME "hb-rep-time"
155 #define HB_STOCK_REP_BALANCE "hb-rep-balance"
156 #define HB_STOCK_REP_BUDGET "hb-rep-budget"
157 #define HB_STOCK_REP_CAR "hb-rep-vehicle"
158
159
160 /*
161 ** Global application datas
162 */
163 struct HomeBank
164 {
165 // hbfile storage
166 GHashTable *h_cur; //currencies
167 GHashTable *h_acc; //accounts
168 GHashTable *h_pay; //payees
169 GHashTable *h_cat; //categories
170 GHashTable *h_tag; //tags
171 GHashTable *h_rul; //assign rules
172
173 GHashTable *h_memo; //memo/description
174
175 GList *arc_list; //archives
176 GList *ope_list; //transactions
177
178 // hbfile (saved properties)
179 gchar *owner;
180 gshort auto_smode;
181 gshort auto_weekday;
182 gshort auto_nbdays;
183
184 guint32 vehicle_category;
185 //guint32 kcur; // base currency
186
187 // hbfile (unsaved properties)
188 guint changes_count;
189 gboolean hbfile_is_new;
190 gchar *xhb_filepath;
191 gboolean xhb_hasbak; //file has backup (*.xhb~) used for revert menu sensitivity
192
193 // really global stuffs
194 gboolean first_run;
195 guint32 today; //today's date
196 gint define_off; //>0 when a stat, account window is opened
197 gboolean minor;
198
199 GtkWidget *mainwindow; //should be global to access attached window data
200 GdkPixbuf *lst_pixbuf[NUM_LST_PIXBUF];
201 gint lst_pixbuf_maxwidth;
202
203 };
204
205 gint homebank_alienfile_recognize(gchar *filename);
206 gchar *homebank_filepath_with_extention(gchar *path, gchar *extension);
207 gchar *homebank_filename_without_extention(gchar *path);
208 void homebank_file_ensure_xhb(void);
209 void homebank_backup_current_file(gchar *pathname);
210 gboolean homebank_util_url_show (const gchar *url);
211 gboolean homebank_lastopenedfiles_load(void);
212 gboolean homebank_lastopenedfiles_save(void);
213
214
215 void homebank_window_set_icon_from_file(GtkWindow *window, gchar *filename);
216
217 const gchar *homebank_app_get_config_dir (void);
218 const gchar *homebank_app_get_images_dir (void);
219 const gchar *homebank_app_get_pixmaps_dir (void);
220 const gchar *homebank_app_get_locale_dir (void);
221 const gchar *homebank_app_get_help_dir (void);
222 const gchar *homebank_app_get_datas_dir (void);
223 guint32 homebank_app_date_get_julian(void);
224
225 /* - - - - obsolete things - - - - */
226
227 /*
228
229 typedef struct _budget Budget;
230
231 struct _budget
232 {
233 guint key;
234 gushort flags;
235 guint cat_key;
236 guint year;
237 gdouble value[13];
238 };
239 */
240
241 /*
242 struct _investment
243 {
244 guint date;
245 gdouble buy_amount;
246 gdouble curr_amount;
247 gdouble commission;
248 guint number;
249 guint account;
250 gchar *name;
251 gchar *symbol;
252 gchar *note;
253 };
254 */
255
256
257
258
259 #endif
This page took 0.041052 seconds and 5 git commands to generate.