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 /* gretl.h, main header file for gretl gui */
21 
22 #ifndef GRETL_H
23 #define GRETL_H
24 
25 #include "config.h"
26 
27 #define FULL_XML_HEADERS
28 #include "libgretl.h"
29 
30 #ifdef WIN32
31 # include "gretl_win32.h"
32 #endif
33 
34 #include <gtk/gtk.h>
35 #include <gdk/gdkkeysyms.h>
36 
37 #include <string.h>
38 
39 #define GNULL (gconstpointer) NULL
40 
41 /* fixups for GTK3 */
42 
43 #if GTK_MAJOR_VERSION >= 3
44 # include <gdk/gdkkeysyms-compat.h>
45 # include <gtksourceview/gtksource.h>
46 # define gtk_combo_box_entry_new_text gtk_combo_box_text_new_with_entry
47 # define GTKSOURCEVIEW_VERSION GTK_SOURCE_MAJOR_VERSION
48 #else
49 # include <gtksourceview/gtksourceview.h>
50 # define GTKSOURCEVIEW_VERSION 2
51 #endif
52 
53 /* remedial macro for Mac */
54 #ifdef OS_OSX
55 # define right_click(e) (e->button == 3 || \
56 			 (e->button == 1 && \
57 			  (e->state & GDK_CONTROL_MASK)))
58 # define cmd_key(e) (e->state & GDK_META_MASK)
59 # define alt_w_key 0x1002211
60 # define alt_x_key 0x1002248
61 #else
62 # define right_click(e) (e->button == 3)
63 # define cmd_key(e) (0)
64 #endif
65 
66 #include "gretltypes.h"
67 #include "gui_utils.h"
68 #include "callbacks.h"
69 #include "dialogs.h"
70 #include "library.h"
71 #include "settings.h"
72 #include "helpfiles.h"
73 #include "focus.h"
74 
75 #ifdef ENABLE_NLS
76 # include "locale.h"
77 #endif
78 
79 #define GRETL_BUFSIZE 8192
80 #define MAXSTR FILENAME_MAX
81 #define CLIPTEMP "cliptmp.txt"
82 
83 #define SCRIPT_WIDTH 78
84 #define SCRIPT_HEIGHT 420
85 #define MODEL_WIDTH 72
86 #define MODEL_HEIGHT 420
87 
88 /* basic global program vars */
89 extern DATASET *dataset;
90 extern MODEL *model;
91 
92 /* global counters */
93 extern int orig_vars;
94 
95 /* global state variables */
96 extern int data_status;
97 extern float gui_scale;
98 
99 /* global filenames */
100 extern char datafile[MAXLEN];
101 extern char scriptfile[MAXLEN];
102 
103 /* global option-related vars */
104 extern int winsize;
105 extern int main_x;
106 extern int main_y;
107 extern int mainwin_width;
108 extern int mainwin_height;
109 extern int swallow;
110 
111 #if !defined(G_OS_WIN32) && !defined(OS_OSX)
112 extern char viewps[MAXSTR];
113 extern char viewpdf[MAXSTR];
114 extern char Browser[MAXSTR];
115 #endif
116 
117 extern char calculator[MAXSTR];
118 extern char latex[MAXSTR];
119 extern char viewdvi[MAXSTR];
120 extern char Rcommand[MAXSTR];
121 
122 /* global GUI equipment */
123 extern windata_t *mdata;
124 extern GtkTargetEntry gretl_drag_targets[];
125 extern PangoFontDescription *fixed_font;
126 
127 #include "gretl_enums.h"
128 
129 /* functions follow */
130 
131 #ifndef WIN32
132 int gretl_fork (const char *progvar, const char *arg,
133 		const char *opt);
134 void set_wm_icon (GtkWidget *w);
135 #endif
136 
137 void set_tryfile (const char *fname);
138 char *get_tryfile (void);
139 void clear_tryfile (void);
140 int tryfile_is_set (void);
141 gboolean open_tryfile (void);
142 
143 int mdata_selection_count (void);
144 int mdata_active_var (void);
145 void populate_varlist (void);
146 void clear_varlist (GtkWidget *widget);
147 void mdata_select_last_var (void);
148 int gui_restore_sample (DATASET *dset);
149 void make_list_from_main (void);
150 void do_stop_script (GtkWidget *w, windata_t *vwin);
151 int is_control_key (guint k);
152 void show_link_cursor (GtkWidget *w, gpointer p);
153 gchar *user_friendly_menu_path (const char *mpath,
154 				gboolean modelwin);
155 
156 int mainwin_get_vwin_insertion (void);
157 int mainwin_insert_vwin (windata_t *vwin);
158 
159 /* functions defined in files other than gretl.c */
160 void about_dialog (void);
161 
162 #endif /* GRETL_H */
163