1 /*  HomeBank -- Free, easy, personal accounting for everyone.
2  *  Copyright (C) 1995-2021 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 __HB_PREFERENCES_H__
21 #define __HB_PREFERENCES_H__
22 
23 #include "hb-currency.h"
24 #include "list-account.h"
25 
26 
27 #define DEFAULT_FORMAT_DATE			"%x"
28 
29 #define MAX_FRAC_DIGIT		6
30 
31 //Tango light
32 #define LIGHT_EXP_COLOR		"#fcaf3e"	//Orange
33 #define LIGHT_INC_COLOR		"#8ae234"	//Chameleon
34 #define LIGHT_WARN_COLOR	"#ef2929"	//Scarlett Red
35 
36 //Tango medium
37 #define MEDIUM_EXP_COLOR	"#f57900"	//Orange
38 #define MEDIUM_INC_COLOR	"#73d216"	//Chameleon
39 #define MEDIUM_WARN_COLOR	"#cc0000"	//Scarlett Red
40 
41 //Tango dark
42 #define DEFAULT_EXP_COLOR		"#ce5c00"	//Orange
43 #define DEFAULT_INC_COLOR		"#4e9a36"	//Chameleon
44 #define DEFAULT_WARN_COLOR		"#a40000"	//Scarlett Red
45 
46 
47 #define PRF_DTEX_CSVSEP_BUFFER "\t,; "
48 enum {
49 	PRF_DTEX_CSVSEP_TAB,
50 	PRF_DTEX_CSVSEP_COMMA,
51 	PRF_DTEX_CSVSEP_SEMICOLON,
52 	PRF_DTEX_CSVSEP_SPACE,
53 };
54 
55 
56 /*
57 ** Preference datas
58 */
59 
60 struct WinGeometry
61 {
62 	gint		l, t, w, h, s;
63 };
64 
65 
66 struct Preferences
67 {
68 	//general
69 	gboolean	showsplash;
70 	gboolean	showwelcome;
71 	gboolean	loadlast;
72 	gboolean	appendscheduled;
73 	gboolean	do_update_currency;
74 
75 	//top spending
76 	gint		date_range_wal;
77 	gint		rep_maxspenditems;
78 
79 	//interface
80 	gshort		toolbar_style;
81 	gshort		grid_lines;
82 	gboolean	gtk_override;
83 	gshort		gtk_fontsize;
84 	gboolean	gtk_darktheme;
85 
86 	gboolean	icon_symbolic;
87 	gboolean	custom_colors;
88 	gchar		*color_exp;
89 	gchar		*color_inc;
90 	gchar		*color_warn;
91 
92 	//locale
93 	gchar		*language;
94 	gchar		*date_format;
95 	gshort		fisc_year_day;
96 	gshort		fisc_year_month;
97 	gboolean	vehicle_unit_ismile;	// true if unit is mile, default Km
98 	gboolean	vehicle_unit_isgal;		// true if unit is gallon, default Liter
99 
100 	//transactions
101 	gint		date_range_txn;
102 	gint		date_future_nbdays;
103 	gboolean	hidereconciled;
104 	gboolean    showremind;
105 	gboolean    showvoid;
106 	gboolean	includeremind;
107 
108 	gboolean	heritdate;
109 	gboolean	txn_memoacp;
110 	gshort		txn_xfer_daygap;
111 	gshort		txn_memoacp_days;
112 	gboolean	txn_showconfirm;
113 
114 	//import/export
115 	gint		dtex_datefmt;
116 	gint		dtex_daygap;
117 	gint		dtex_ofxname;
118 	gint		dtex_ofxmemo;
119 	gboolean	dtex_qifmemo;
120 	gboolean	dtex_qifswap;
121 	gboolean	dtex_ucfirst;
122 	gint		dtex_csvsep;
123 
124 	//report options
125 	gint		date_range_rep;
126 	gint		report_color_scheme;
127 	gboolean	rep_smallfont;
128 	gboolean	stat_byamount;
129 	gboolean	stat_showrate;
130 	gboolean	stat_showdetail;
131 	gboolean	budg_showdetail;
132 
133 	//backup option
134 	gboolean	bak_is_automatic;
135 	gshort		bak_max_num_copies;
136 
137 	//folders
138 	gchar		*path_hbfile;
139 	gchar		*path_hbbak;
140 	gchar		*path_import;
141 	gchar		*path_export;
142 	gchar		*path_attach;
143 
144 	//euro zone
145 	gboolean	euro_active;
146 	gint		euro_country;
147 	gdouble		euro_value;
148 	Currency	minor_cur;
149 
150 
151 	//---- others data (not in pref dialog) -----
152 	gboolean	dtex_nointro;
153 	gboolean	dtex_dodefpayee;
154 	gboolean	dtex_doautoassign;
155 
156 	gchar	    IntCurrSymbol[8];
157 	gint 		lst_impope_columns[NUM_LST_DSPOPE+1];
158 	gint 		lst_ope_columns[NUM_LST_DSPOPE+1];
159 	gint 		lst_ope_col_width[NUM_LST_DSPOPE+1];
160 	gint		lst_ope_sort_id;	// -- implicit --
161 	gint		lst_ope_sort_order; // -- implicit --
162 
163 	/* windows/dialogs size an position */
164 	struct WinGeometry	wal_wg;
165 	struct WinGeometry	acc_wg;
166 
167 	struct WinGeometry	sta_wg;
168 	struct WinGeometry	tme_wg;
169 	struct WinGeometry	ove_wg;
170 	struct WinGeometry	bud_wg;
171 	struct WinGeometry	cst_wg;
172 
173 	struct WinGeometry	txn_wg;
174 
175 	// main window stuffs
176 	gboolean	wal_toolbar;
177 	gboolean	wal_spending;
178 	gboolean	wal_upcoming;
179 
180 	gint		wal_vpaned;
181 	gint		wal_hpaned;
182 
183 	//home panel
184 	gshort		pnl_acc_col_acc_width;
185 	gint 		lst_acc_columns[NUM_LST_COL_DSPACC+1];
186 	gshort		pnl_acc_show_by;
187 
188 	gshort		pnl_upc_col_pay_width;
189 	gshort		pnl_upc_col_mem_width;
190 	gint		pnl_upc_range;
191 
192 	gchar		*pnl_list_tab;
193 
194 	//vehiclecost units (mile/gal or km/liters)
195 
196 	gchar	   *vehicle_unit_dist0;
197 	gchar	   *vehicle_unit_dist1;
198 	gchar	   *vehicle_unit_vol;
199 	gchar	   *vehicle_unit_100;
200 	gchar	   *vehicle_unit_distbyvol;
201 
202 };
203 
204 gint homebank_pref_list_column_get(gint *cols_id, gint uid, gint maxcol);
205 
206 void homebank_prefs_set_default(void);
207 void homebank_pref_free(void);
208 void homebank_pref_createformat(void);
209 void homebank_pref_init_measurement_units(void);
210 
211 void homebank_pref_apply(void);
212 gboolean homebank_pref_load(void);
213 gboolean homebank_pref_save(void);
214 void homebank_pref_setdefault(void);
215 
216 #endif
217