1 /*
2  *  gretl -- Gnu Regression, Econometrics and Time-series Library
3  *  Copyright (C) 2001 Allin Cottrell and Riccardo "Jack" Lucchetti
4  *
5  *  This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation, either version 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  */
19 
20 #ifndef DIALOGS_H
21 #define DIALOGS_H
22 
23 #include <stdarg.h>
24 
25 #define GRETL_CANCEL (-1)
26 #define canceled(r) (r == -1)
27 
28 enum { GRETL_YES, GRETL_NO };
29 
30 #ifndef BUILDING_PLUGIN
31 typedef struct dialog_t_ dialog_t;
32 
33 void copy_format_dialog (windata_t *vwin, int action);
34 #endif
35 
36 void msgbox (const char *msg, int msgtype, GtkWidget *parent);
37 
38 void errbox (const char *err);
39 
40 void errbox_printf (const char *template, ...);
41 
42 void infobox (const char *info);
43 
44 void infobox_printf (const char *template, ...);
45 
46 void warnbox (const char *warn);
47 
48 void warnbox_printf (const char *template, ...);
49 
50 void maybe_warn (void);
51 
52 void file_read_errbox (const char *fname);
53 
54 void file_write_errbox (const char *fname);
55 
56 gint yes_no_dialog (const char *title, const char *msg,
57 		    GtkWidget *parent);
58 
59 gint yes_no_cancel_dialog (const char *title, const char *msg,
60 			   GtkWidget *parent);
61 
62 gint no_yes_dialog (const char *title, const char *msg);
63 
64 void gretl_dialog_add_message (GtkWidget *dlg, const char *msg);
65 
66 int make_default_storelist (void);
67 
68 gboolean exit_check (void);
69 
70 void menu_exit_check (void);
71 
72 double gui_double_from_string (const char *str, int *err);
73 
74 int csv_options_dialog (int ci, GretlObjType otype, GtkWidget *parent);
75 
76 void rand_seed_dialog (void);
77 
78 int select_list_dialog (char *listname);
79 
80 void database_description_dialog (const char *binname);
81 
82 int select_var_from_list_with_opt (const int *list,
83 				   const char *query,
84 				   dialog_opts *opts,
85 				   int hcode,
86 				   GtkWidget *parent);
87 
88 int select_var_from_list (const int *list, const char *query,
89 			  GtkWidget *parent);
90 
91 void sample_range_dialog (GtkAction *action, gpointer p);
92 
93 void range_dummy_dialog (GtkAction *action, gpointer p);
94 
95 void sample_restrict_dialog (GtkAction *action, gpointer p);
96 
97 int panel_graph_dialog (int *t1, int *t2);
98 
99 void data_compact_dialog (int spd, int *target_pd, int *mon_start,
100 			  CompactMethod *method, int *repday,
101 			  GtkWidget *parent);
102 
103 void data_expand_dialog (int *newpd, GtkWidget *parent);
104 
105 int pergm_dialog (gretlopt *opt, int *spinval, int spinmin, int spinmax,
106 		  GtkWidget *parent);
107 
108 int density_dialog (int vnum, double *bw);
109 
110 int radio_dialog (const char *title, const char *label, const char **opts,
111 		  int nopts, int deflt, int helpcode, GtkWidget *parent);
112 
113 int radio_dialog_with_spinner (const char *title, const char **opts,
114 			       int nopts, int deflt, int helpcode,
115 			       int *spinvar, const char *spintxt,
116 			       int spinmin, int spinmax,
117 			       GtkWidget *parent);
118 
119 int radio_dialog_with_check (const char *title, const char *label,
120 			     const char **opts, int nopts, int deflt, int hcode,
121 			     int *checkvar, const char *checktxt,
122 			     GtkWidget *parent);
123 
124 void set_checks_dialog_extra (int i, GtkWidget *extra);
125 
126 GtkWidget *
127 build_checks_dialog (const char *title, const char *blurb,
128 		     const char **opts,
129 		     int nopts, int *active,
130 		     int check_min, int check_max,
131 		     int nradios, int *rvar,
132 		     int *spinvar, const char *spintxt,
133 		     int spinmin, int spinmax,
134 		     int hcode, GtkWidget *parent, int *ret);
135 
136 int checks_dialog (const char *title, const char *blurb,
137 		   const char **opts,
138 		   int nopts, int *active,
139 		   int check_min, int check_max,
140 		   int nradios, int *rvar,
141 		   int *spinvar, const char *spintxt,
142 		   int spinmin, int spinmax,
143 		   int hcode, GtkWidget *parent);
144 
145 int checks_only_dialog (const char *title, const char *blurb,
146 			const char **opts, int nopts,
147 			int *active, int hcode,
148 			GtkWidget *parent);
149 
150 int spin_dialog (const char *title, const char *blurb,
151 		 int *spinvar, const char *spintxt,
152 		 int spinmin, int spinmax, int helpcode,
153 		 GtkWidget *parent);
154 
155 int combo_selector_dialog (GList *list, const char *msg,
156 			   int deflt, GtkWidget *parent);
157 
158 int yes_no_help_dialog (const char *msg, int hcode, int deflt);
159 
160 int add_obs_dialog (const char *blurb, int addmin,
161 		    gretlopt opt, GtkWidget *parent);
162 
163 int forecast_dialog (int t1min, int t1max, int *t1,
164 		     int t2min, int t2max, int *t2,
165 		     int *k, int pmin, int pmax, int *p,
166 		     int dyn, gretlopt *optp,
167 		     double *conf, MODEL *pmod,
168 		     GtkWidget *parent);
169 
170 int simple_forecast_dialog (int *t1, int *t2, GtkWidget *parent);
171 
172 void dialog_add_confidence_selector (GtkWidget *dlg, double *conf,
173 				     gretlopt *gopt);
174 
175 void dialog_add_iters_spinner (GtkWidget *dlg, int *iters);
176 
177 int freq_dialog (const char *title, const char *blurb,
178 		 int *nbins, int nbmax, double *f0, double *fwid,
179 		 double xmin, double xmax, int *dist, int *plot);
180 
181 int model_table_dialog (int *colhead_opt, int *se_opt, int *pv_opt,
182 			int *ast_opt, int *figs, char *fmt,
183 			GtkWidget *parent);
184 
185 int bootstrap_dialog (windata_t *vwin, int *pp, int *pB,
186 		      gretlopt *popt);
187 
188 int chow_dialog (int tmin, int tmax, int *t, int *dumv,
189 		 gretlopt *popt, GtkWidget *parent);
190 
191 int iter_control_dialog (int *optim, int *pmaxit, double *ptol,
192 			 int *plmem, GtkWidget *parent);
193 
194 void tex_format_dialog (GtkAction *action, gpointer data);
195 
196 int paste_data_dialog (int *append);
197 
198 int object_name_entry_dialog (char *name, GretlType type,
199 			      const char *labeltxt, int *show,
200 			      GtkWidget *parent);
201 
202 int hc_config_dialog (char *vname, gretlopt opt, gboolean robust_conf,
203 		      GtkWidget *parent);
204 
205 int output_policy_dialog (windata_t *source, windata_t *target,
206 			  int toolbar);
207 
208 void single_percent_change_dialog (int v, int idxvals);
209 
210 void multi_percent_change_dialog (int idxvals);
211 
212 int midas_term_dialog (const char *name, int m,
213 		       int *minlag, int *maxlag,
214 		       int *ptype, int *ncoef,
215 		       gboolean no_beta1,
216 		       GtkWidget *parent);
217 
218 int dbnomics_dialog (char **dbcode, GtkWidget *parent);
219 
220 int map_options_dialog (GList *plist, int selpos, gretl_bundle *b,
221 			int *payload_id);
222 
223 void tdisagg_dialog (int v);
224 
225 void bdstest_dialog (int v, GtkWidget *parent);
226 
227 void regls_advanced_dialog (gretl_bundle *b, GtkWidget *parent);
228 
229 #endif /* DIALOGS_H */
230