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 /* session.h for gretl */
21 
22 #ifndef SESSION_H
23 #define SESSION_H
24 
25 #include "objstack.h"
26 
27 enum {
28     SCHEDULE_FOR_DELETION,
29     REALLY_DELETE_ALL,
30     CLEAR_DELFILES
31 };
32 
33 enum {
34     ADD_OBJECT_OK,
35     ADD_OBJECT_REPLACE,
36     ADD_OBJECT_FAIL
37 };
38 
39 enum {
40     LOG_SAVE,
41     LOG_SAVE_AS,
42     LOG_OPEN,
43     LOG_CLOSE,
44     LOG_NULL
45 };
46 
47 int save_session (char *fname);
48 
49 int save_session_commands (char *fname);
50 
51 int save_session_dataset (void);
52 
53 int session_is_modified (void);
54 
55 int session_is_open (void);
56 
57 void set_commands_recorded (void);
58 
59 int get_commands_recorded (void);
60 
61 void session_menu_state (gboolean s);
62 
63 int have_session_objects (void);
64 
65 int widget_is_iconview (GtkWidget *w);
66 
67 const char *get_session_dirname (void);
68 
69 int real_add_text_to_session (PRN *prn, int pos, const char *tname);
70 
71 void save_output_as_text_icon (windata_t *vwin);
72 
73 int gui_add_graph_to_session (char *fname, char *fullname, int type);
74 
75 int cli_add_graph_to_session (const char *fname, const char *gname,
76 			      GretlObjType type, int display);
77 
78 char *session_graph_make_path (char *path, const char *fname);
79 
80 const char *last_session_graph_name (void);
81 
82 void model_add_as_icon (GtkAction *action, gpointer p);
83 
84 int add_model_to_session_callback (void *ptr, GretlObjType type,
85 				   gretlopt opt);
86 
87 void session_model_callback (void *ptr, int action);
88 
89 void bundle_add_as_icon (GtkAction *action, gpointer p);
90 
91 void *get_session_object_by_name (const char *name, GretlObjType *type);
92 
93 int session_user_var_destroy_by_name (const char *name,
94 				      GretlObjType type);
95 
96 void delete_text_from_session (void *p);
97 
98 void display_saved_text (void *p);
99 
100 void mark_session_changed (void);
101 
102 void session_init (void);
103 
104 gboolean do_open_session (void);
105 
106 void gui_clear_dataset (void);
107 
108 void verify_clear_data (void);
109 
110 void close_session (gretlopt opt);
111 
112 void free_session (int on_exit);
113 
114 int highest_numbered_variable_in_session (void);
115 
116 GList *session_model_list (void);
117 
118 int is_session_model (void *p);
119 
120 void view_session (void);
121 
122 void maybe_view_session (void);
123 
124 void maybe_sensitize_iconview (void);
125 
126 void save_session_callback (GtkAction *action);
127 
128 int session_file_is_open (void);
129 
130 int clear_or_save_model (MODEL **ppmod, DATASET *pdinfo, int rebuild);
131 
132 void disable_graph_page (void);
133 
134 void display_session_graph_by_data (void *p);
135 
136 gchar *session_graph_get_filename (void *p);
137 
138 void view_matrix_properties (const gretl_matrix *m, const char *name);
139 
140 void session_notes_callback (GtkWidget *w, gpointer p);
141 
142 #endif /* SESSION_H */
143