Reset parser in grace_set_project().
[grace.git] / src / grace.h
blob0e65fc3bd982fabaa35da38e67c0e576ada2219f
1 /*
2 * Grace - GRaphing, Advanced Computation and Exploration of data
3 *
4 * Home page: http://plasma-gate.weizmann.ac.il/Grace/
5 *
6 * Copyright (c) 2001-2003 Grace Development Team
7 *
8 * Maintained by Evgeny Stambulchik
9 *
11 * All Rights Reserved
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #ifndef __GRACE_H_
29 #define __GRACE_H_
31 #include <config.h>
33 /* For FILE */
34 #include <stdio.h>
36 #include "grace/baseP.h"
37 #include "grace/canvas.h"
38 #include "grace/core.h"
39 #include "defines.h"
41 typedef struct _Grace Grace;
43 typedef struct _X11Stuff X11Stuff;
44 typedef struct _ExplorerUI ExplorerUI;
46 typedef struct _GUI {
47 /* Parent */
48 Grace *P;
50 /* true if running X */
51 int inwin;
53 /* true if running in the free page mode */
54 int page_free;
56 /* Zoom factor */
57 double zoom;
59 /* use GXxor or GXinvert for xor'ing */
60 int invert;
61 /* if true, redraw graph each time action is performed */
62 int auto_redraw;
63 int focus_policy;
64 int draw_focus_flag;
65 /* if TRUE, assume yes for everything */
66 int noask;
67 /* instant update enabled for controls on appearance dialogs */
68 int instant_update;
69 /* toolbars visible on/off */
70 int toolbar;
71 int statusbar;
72 int locbar;
74 /* if TRUE, color selectors need update */
75 int need_colorsel_update;
77 /* if TRUE, font selectors need update */
78 int need_fontsel_update;
80 /* colormap stuff */
81 int install_cmap;
82 int private_cmap;
84 X11Stuff *xstuff;
86 ExplorerUI *eui;
87 } GUI;
89 typedef struct _RunTime {
90 /* Parent */
91 Grace *P;
93 QuarkFactory *qfactory;
95 /* safe mode flag */
96 int safe_mode;
98 /* terminal device */
99 int tdevice;
100 /* hardcopy device */
101 int hdevice;
103 /* print to file */
104 int ptofile;
106 /* target set */
107 Quark *target_set;
109 /* real-time input delay (prevents getting stuck reading) */
110 int timer_delay;
111 /* autoscale after reading in data sets */
112 int autoscale_onread;
113 /* used in the parser */
114 int curtype;
115 int cursource;
116 /* file for results */
117 FILE *resfp;
119 /* scroll fraction */
120 double scrollper;
121 /* expand/shrink fraction */
122 double shexper;
124 /* flag raised on emergency save */
125 int emergency_save;
126 /* number of interrupts received during the emergency save */
127 int interrupts;
129 /* location of the Grace home directory */
130 char *grace_home;
132 /* print command */
133 char *print_cmd;
135 /* editor */
136 char *grace_editor;
138 /* html viewer */
139 char *help_viewer;
141 /* working directory */
142 char *workingdir;
144 /* username */
145 char *username;
147 /* $HOME */
148 char *userhome;
150 /* printout */
151 char print_file[GR_MAXPATHLEN];
153 Canvas *canvas;
155 /* Misc dictionaries */
156 Dictionary *graph_type_dict;
157 Dictionary *set_type_dict;
158 Dictionary *inout_placement_dict;
159 Dictionary *side_placement_dict;
160 Dictionary *spec_ticks_dict;
161 Dictionary *region_type_dict;
163 /* color index for autocolorization of new sets */
164 unsigned int setcolor;
166 /* debug level */
167 #ifdef DEBUG
168 int debuglevel;
169 #endif
170 } RunTime;
172 struct _Grace {
173 #if 0
174 Quark *prefs;
175 #endif
176 RunTime *rt;
177 GUI *gui;
178 Quark *project;
181 Quark *project_new(QuarkFactory *qfactory);
183 GUI *gui_new(Grace *grace);
184 void gui_free(GUI *gui);
186 RunTime *runtime_new(Grace *grace);
187 void runtime_free(RunTime *rt);
189 Grace *grace_new(void);
190 void grace_free(Grace *grace);
192 Grace *grace_from_quark(const Quark *q);
193 RunTime *rt_from_quark(const Quark *q);
194 GUI *gui_from_quark(const Quark *q);
196 int gui_is_page_free(const GUI *gui);
197 void gui_set_page_free(GUI *gui, int onoff);
198 void gui_set_barebones(GUI *gui);
200 int grace_set_project(Grace *grace, Quark *project);
202 int set_page_dimensions(Grace *grace, int wpp, int hpp, int rescale);
203 int set_printer(Grace *grace, int device);
204 int set_printer_by_name(Grace *grace, const char *dname);
205 void set_ptofile(Grace *grace, int flag);
206 int get_ptofile(const Grace *grace);
208 void project_reset_version(Quark *q);
210 int project_get_graphs(Quark *q, Quark ***graphs);
212 void project_set_wrap_year(Quark *q, int wrap_year);
215 char *grace_path(Grace *grace, char *fn);
216 char *grace_path2(Grace *grace, const char *prefix, char *fn);
217 char *grace_exe_path(Grace *grace, char *fn);
219 FILE *grace_openw(Grace *grace, char *fn);
220 FILE *grace_openr(Grace *grace, char *fn, int src);
221 void grace_close(FILE *fp);
224 #endif /* __GRACE_H_ */