File: ct.h

package info (click to toggle)
chemtool 1.5-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,036 kB
  • ctags: 2,117
  • sloc: ansic: 31,960; pascal: 825; sh: 153; makefile: 90
file content (287 lines) | stat: -rw-r--r-- 7,816 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#undef __GNUC__
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/stat.h>
#include <gtk/gtk.h>

#define VERSION "1.5"
#define PIXMAPWIDTH 1600
#define PIXMAPHEIGHT 1200

#define MAXCL 80
#define Hex 1    /* define angletypes and textdirect. , DONT CHANGE THEM !*/
#define Pent 2
#define Pent_switch 3
#define Octa 4
#define No_angle 0
#define Left_Text 0 
#define Middle_Text -1
#define Right_Text -2
#define False 0
#define True 1
struct data {
            int x,y;
            int tx,ty;
	    int bond;
            int smarked,tmarked;
	    int decoration;
	    struct data *next;
	    struct data *prev; 
	    } da_root, *new;

struct dc {
	    int x,y;
	    char c[MAXCL];
	    int direct;
	    int marked;
	    struct dc *next;
	    struct dc *prev; 
  	  } dac_root, *new_c;

struct data_head {
	    int pix_width, pix_height;
	    int width, height;
	    } head;
  
struct new {
	   int x,y;
	   int tx,ty;
	   int n, nc;
	   int nsp; 
	   } *hp; 

struct xy_co {
	    int x,y;
	    int tx,ty;
	    } xycoord[30];

struct marked {
	   int x,y;
	   int w, h;
	   int flag;
	   } mark; 

struct spline {
            int x0,y0;
            int x1,y1;
            int x2,y2;
            int x3,y3;
	    int type;
            int marked;
	    struct spline *next;
	    struct spline *prev; 
	    } sp_root, *sp_new;


float size_factor; 
int zoom_factor;

int draw_angle;
int text_direct;
int font_type;
int line_type;
int modify;
int addflag;
int xbmflag;
int drawmode;
int xref,yref;
char *paper[11]={"A4","A3","A2","A1","A0","Letter",
		"Legal","Ledger","C","D","E"};
int papersize;
char *orientation[2]={"-p 1","-l 1"};
int orient;
float printscale;
int printcmd;
char *printcommand[2]={"lpr -P","lp -d"};
char *queuename;
char datadir[PATH_MAX];
char datamask[PATH_MAX];
int figversion;
int importflag;
int pdbmode;

void Clear(void);

/*	chemproc.c	*/

extern struct data *select_vector(int mx, int my, float s_f);
extern void add_struct(int x,int y,int tx, int ty, int bond, int smarked, int tmarked, int decoration);
extern int round_coord(int i, float step);
extern void del_char(struct dc *hpc);
extern void del_struct(struct data *hpc);
extern void add_char(int x,int y, char *c, int direct, int marked);
extern struct dc *select_char(int mx, int my, float s_f);
extern struct xy_co *calc_angle(int x, int y, int ang_type, int angle);
extern struct xy_co *position(int x, int y, int ax, int ay, int ang_type);
extern void setup_data(void);
extern void clear_data(void);
extern int partial_delete(int x, int y, int tx, int ty);
extern void center_mol(void);
extern int move_pos(int x, int y, int tx, int ty);
extern int check_pos_rec(int x, int y, int rx, int ry, int rtx, int rty);
extern int partial_move(int x, int y, int tx, int ty, int dx, int dy);
extern int partial_rotate(int xcent, int ycent, double rotsin, double rotcos);

extern int calc_vector(int dx, int dy);
extern struct xy_co *multi_bonds(int mx, int my, int mtx, int mty, int r);
extern struct xy_co *center_double_bond(int mx,int my,int mtx, int mty, int r);
struct xy_co *bond_cut(int x, int y, int tx, int ty, int r);
extern void add_box1(void);
extern void add_box2(void);
extern void add_box3(void);
extern void add_box4(void);

extern void Unmark_all(void);
extern void get_center_marked (int*, int*);
/*	graph.c	*/

extern void CreatePix(void);
extern void FreePix(void );
extern void CopyPlane(void );
extern void Display_Mol(void);
extern void Drawline( int , int, int, int , int );
extern void DrawWide( int, int, int, int, int);
extern void DrawWedge( int, int, int, int, int);
extern void DrawDashedWedge( int, int, int, int, int);
extern void DrawArrow( int, int, int, int, int,int);
extern void DrawWiggly( int, int, int, int, int);
extern void Drawstring( int, int, char*, int, int);
extern int Extra_char(char c);
extern int Load_Font(int);
extern void Set_Line(int);

/*	draw.c	*/

extern void Add_double(int, int);
extern void Add_vector(int, int, int);
extern void Del_vector( int, int);
extern void Set_vector( int, int,int);
extern void Put_vector( int, int);
extern void Invert_vector(int, int);
extern void Add_atom( int, int);
extern void Fetch_atom( int, int);
extern void Del_atom( int, int);
extern void Set_start_rec( int, int);
extern void Put_rec(int, int);
extern void Del_rec(void);
extern void Mark_rec( int, int, int);
extern void Mark_atom(int, int);
extern void Center(void);
extern void Put_pmove(int, int,int);
extern void Set_pmove(int, int);
extern void Put_protate( int, int, int);
extern void Put_pscale( int, int, int);
extern void Add_ring (int, int, int, int, int);

/*	dialog.c	*/

extern void Load(void);
extern void Add(void);
extern void Save(void);
extern void Quit(void);
extern void Zoom(GtkWidget*, gpointer);
extern void Change_Text(GtkWidget*, gpointer);
extern void Change_Angle(GtkWidget*, gpointer);
extern void flip_horiz(void);
extern void flip_vert(void);
extern void copy_obj(void);
/*	inout.c	*/

extern int save_mol(FILE *fp, int partial);
extern int load_mol(char *filename);
extern int import_mdl_mol(char *filename);
extern int import_pdb(char *filename);
extern int add_mol(char *filename);
extern int export_bitmap(char *filename);
extern int export_xfig(char *filename);
extern int export_latex_pic(char *filename, float scalefactor);
extern int export_svg(char *filename);
extern int export_latex_pic(char *filename, float scalefactor);
extern int export_ps_pic(char *filename, float scalefactor);
extern int print_ps_pic(char *filename);
extern int export_fw(char *filename);
extern int export_mdl_mol(char *filename);
extern int readrc(void);
extern int writerc(void);
extern void pdbrotate(int,int,int);

#ifdef LIBUNDO
extern int undo_get_undo_count();
extern int undo_get_redo_count();
extern int undo_undo();
extern int undo_undo();
extern int undo_redo();
extern int undo_snapshot();
extern int undo_new();
extern int undo_destroy();
extern int undo_set_memory_limit(size_t memmax);
#endif

GdkPixmap *picture,*savedpicture,*preview;
GtkWidget *textbox;
int xcent,ycent;
int bondtypes=18;
int *tmpx,*tmpy;
char formula[21],weight[21],eweight[21],compos[64];
  
void yesnodialog (void (*)(void));
void CheckAndClear(void);
void yesnodialog2 (void (*)(void),char*);
void do_fw(void);
void set_bond (GtkWidget* , gpointer);
void Bondmode (GtkWidget*);
void Movemode (GtkWidget*);
void Markmode (GtkWidget*);
void Rotatemode (GtkWidget*);
void Rescalemode (GtkWidget*);
void show_or_raise (GtkWidget*);
void Add_template (GtkWidget*, gpointer);
void exp_mode (GtkWidget*, gpointer);
void do_export (GtkWidget*,GtkFileSelection*);
void really_export(void);
void file_ok_sel(GtkWidget*,GtkFileSelection*);
void reallysave(void);
void CheckAndLoad(void);
int CheckAndQuit(void);
void Set_bondtype(int, int, int);
void tidy_mol(void);
void do_undo(void);
void do_redo(void);
int newpaper(GtkWidget*,gpointer);
int neworient(GtkWidget*,gpointer);
int newprcmd(GtkWidget*,gpointer);
void Set_Textmode(GtkWidget*,GdkEvent*);
void Splinemode(GtkWidget*);
void Import(void);
void Import_PDB(void);
void SaveAs(void);
void Export(void);

extern void add_bracket(void);
extern void add_r_bracket(void);
extern void add_brace(void);

void add_spline(int, int, int, int, int, int, int, int, int, int);
void show_boxmenu(void);
void print_ps(void);
void setup_printer(GtkWidget*,gpointer);
void do_complete(void);
void check_fig2dev(void);
void ct_crash(int);
void restore_picture(void);
void getpreview(GtkWidget*, gint, gint,  GdkEventButton*, gpointer);
void set_icon(GtkWidget*);
extern int load_preview(char*);
extern void pdbstore(void);
double *pdbx, *pdby,*pdbz;
int *bondfrom,*bondto;
short *bondtype,*atjust;
char **atcode;
int pdbn=0;
int nbonds=0;
float importfactor=50.;
int importoffset=500;