~mdoyen/homebank/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/*  HomeBank -- Free, easy, personal accounting for everyone.
 *  Copyright (C) 1995-2023 Maxime DOYEN
 *
 *  This file is part of HomeBank.
 *
 *  HomeBank is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  HomeBank is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __HB_PREFERENCES_H__
#define __HB_PREFERENCES_H__

#include "hb-currency.h"
#include "list-account.h"


#define DEFAULT_FORMAT_DATE			"%x"

#define MAX_FRAC_DIGIT		6

//Tango light
#define LIGHT_EXP_COLOR		"#fcaf3e"	//Orange
#define LIGHT_INC_COLOR		"#8ae234"	//Chameleon
#define LIGHT_WARN_COLOR	"#ef2929"	//Scarlett Red

//Tango medium
#define MEDIUM_EXP_COLOR	"#f57900"	//Orange
#define MEDIUM_INC_COLOR	"#73d216"	//Chameleon
#define MEDIUM_WARN_COLOR	"#cc0000"	//Scarlett Red

//Tango dark
#define DEFAULT_EXP_COLOR		"#ce5c00"	//Orange
#define DEFAULT_INC_COLOR		"#4e9a36"	//Chameleon
#define DEFAULT_WARN_COLOR		"#a40000"	//Scarlett Red


#define PRF_DTEX_CSVSEP_BUFFER "\t,; "
enum {
	PRF_DTEX_CSVSEP_TAB,
	PRF_DTEX_CSVSEP_COMMA,
	PRF_DTEX_CSVSEP_SEMICOLON,
	PRF_DTEX_CSVSEP_SPACE,
};


/*
** Preference datas
*/

struct WinGeometry
{
	gint		l, t, w, h, s;
};


struct Preferences
{
	//general
	gboolean	showsplash;
	gboolean	showwelcome;
	gboolean	loadlast;
	gboolean	appendscheduled;
	gboolean	do_update_currency;

	//top spending
	gint		date_range_wal;
	gint		rep_maxspenditems;

	//interface
	gshort		toolbar_style;
	gshort		grid_lines;
	gboolean	gtk_override;
	gshort		gtk_fontsize;
	gboolean	gtk_darktheme;

	gboolean	icon_symbolic;
	gboolean	custom_colors;
	gchar		*color_exp;
	gchar		*color_inc;
	gchar		*color_warn;

	//locale
	gchar		*language;
	gchar		*date_format;
	gshort		fisc_year_day;
	gshort		fisc_year_month;
	gboolean	vehicle_unit_ismile;	// true if unit is mile, default Km
	gboolean	vehicle_unit_isgal;		// true if unit is gallon, default Liter

	//transactions
	//-- register
	gint		date_range_txn;
	gint		date_future_nbdays;
	gboolean	hidereconciled;
	gboolean    showremind;
	gboolean    showvoid;
	gboolean	includeremind;
	gboolean	lockreconciled;
	//-- dialog
	gboolean	heritdate;
	gboolean	txn_memoacp;
	gshort		txn_xfer_daygap;
	gshort		txn_memoacp_days;
	gboolean	txn_showconfirm;

	//import/export
	gint		dtex_datefmt;
	gint		dtex_daygap;
	gint		dtex_ofxname;
	gint		dtex_ofxmemo;
	gboolean	dtex_qifmemo;
	gboolean	dtex_qifswap;
	gboolean	dtex_ucfirst;
	gint		dtex_csvsep;

	//report options
	gint		date_range_rep;
	gint		report_color_scheme;
	gboolean	rep_smallfont;
	gboolean	stat_byamount;
	gboolean	stat_showrate;
	gboolean	stat_showdetail;
	gboolean	stat_includexfer;
	gboolean	budg_showdetail;	

	//backup option
	gboolean	bak_is_automatic;
	gshort		bak_max_num_copies;

	//folders
	gchar		*path_hbfile;
	gchar		*path_hbbak;
	gchar		*path_import;
	gchar		*path_export;
	gchar		*path_attach;

	//euro zone
	gboolean	euro_active;
	gint		euro_country;
	gdouble		euro_value;
	Currency	minor_cur;


	//---- others data (not in pref dialog) -----
	gboolean	dtex_nointro;
	gboolean	dtex_dodefpayee;
	gboolean	dtex_doautoassign;

	gchar	    IntCurrSymbol[8];

	gint 		lst_impope_columns[NUM_LST_DSPOPE+1];

	//register list column
	gint 		lst_ope_columns[NUM_LST_DSPOPE+1];
	gint 		lst_ope_col_width[NUM_LST_DSPOPE+1];
	gint		lst_ope_sort_id;	// -- implicit --
	gint		lst_ope_sort_order; // -- implicit --

	//detail list column
	gint 		lst_det_columns[NUM_LST_DSPOPE+1];
	gint 		lst_det_col_width[NUM_LST_DSPOPE+1];

	/* windows/dialogs size an position */
	struct WinGeometry	wal_wg;
	struct WinGeometry	acc_wg;
	
	struct WinGeometry	sta_wg;
	struct WinGeometry	tme_wg;
	struct WinGeometry	ove_wg;
	struct WinGeometry	bud_wg;
	struct WinGeometry	cst_wg;

	struct WinGeometry	txn_wg;

	// main window stuffs 
	gboolean	wal_toolbar;
	gboolean	wal_spending;
	gboolean	wal_upcoming;

	gint		wal_vpaned;
	gint		wal_hpaned;

	//home panel
	gshort		pnl_acc_col_acc_width;
	gint 		lst_acc_columns[NUM_LST_COL_DSPACC+1];
	gshort		pnl_acc_show_by;

	gshort		pnl_upc_col_pay_show;
	gshort		pnl_upc_col_pay_width;
	gshort		pnl_upc_col_cat_show;
	gshort		pnl_upc_col_cat_width;
	gshort		pnl_upc_col_mem_show;
	gshort		pnl_upc_col_mem_width;
	gint		pnl_upc_range;
	
	gchar		*pnl_list_tab;

	//vehiclecost units (mile/gal or km/liters)
	
	gchar	   *vehicle_unit_dist0;
	gchar	   *vehicle_unit_dist1;
	gchar	   *vehicle_unit_vol;
	gchar	   *vehicle_unit_100;
	gchar	   *vehicle_unit_distbyvol;

};

gint homebank_pref_list_column_get(gint *cols_id, gint uid, gint maxcol);

void homebank_pref_setdefault_lst_ope_columns(void);
void homebank_pref_setdefault_lst_det_columns(void);
void homebank_pref_setdefault_win(void);
void homebank_prefs_set_default(void);
void homebank_pref_free(void);
void homebank_pref_createformat(void);
void homebank_pref_init_measurement_units(void);

void homebank_pref_apply(void);
gboolean homebank_pref_load(void);
gboolean homebank_pref_save(void);
void homebank_pref_setdefault(void);

#endif