1 #ifndef _FIGURINE_FIGURINE_H
2 #define _FIGURINE_FIGURINE_H
3 
4 /* COPYRIGHT (C) 2000 THE VICTORIA UNIVERSITY OF MANCHESTER and John Levon
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the Free
7  * Software Foundation; either version 2 of the License, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17  * Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19 /*
20  * $Log: figurine.h,v $
21  * Revision 1.4  2000/12/17 00:57:44  moz
22  * examples, filled open splines, highlight_objects
23  *
24  * Revision 1.3  2000/12/08 22:33:38  moz
25  * Clean up possibly unsafe tmp file handling.
26  *
27  * Revision 1.2  2000/12/06 20:56:08  moz
28  * GPL stuff.
29  *
30  * Revision 1.1.1.1  2000/08/21 01:05:32  moz
31  *
32  *
33  * Revision 1.1.1.1  2000/07/19 22:45:32  moz
34  * CVS Import
35  *
36  * Revision 1.46  2000/03/11 19:11:52  moz
37  * recalc_text_box() changed.
38  *
39  * Revision 1.45  2000/03/11 18:18:17  moz
40  * calc_text_outer_box() -> calc_text_outer_box_adjust().
41  *
42  * Revision 1.44  2000/03/09 01:06:11  moz
43  * Compile fixes.
44  *
45  * Revision 1.43  2000/03/06 02:08:59  moz
46  * is_in_bbox prototype changed.
47  *
48  * Revision 1.42  2000/02/27 15:23:09  moz
49  * fillstyle_out,fillcolour_out take Object *.
50  *
51  * Revision 1.41  2000/02/18 21:19:23  moz
52  * Compile fixes.
53  *
54  * Revision 1.40  2000/02/17 22:25:28  moz
55  * Compiler fixes.
56  * Added clear_redo_stack() and kill_undo().
57  *
58  * Revision 1.39  2000/02/15 01:49:19  moz
59  * switch_icons() takes View *.
60  *
61  * Revision 1.38  2000/01/30 17:24:18  moz
62  * Removed unused View members.
63  *
64  * Revision 1.37  2000/01/26 18:26:01  moz
65  * Change prototypes for FIG_DEBUG_LIST_ALLOC.
66  *
67  * Revision 1.36  2000/01/25 01:38:06  moz
68  * Border not kept.
69  *
70  * Revision 1.35  2000/01/21 11:21:31  moz
71  * Use memwatch.
72  *
73  * Revision 1.34  1999/11/16 01:50:37  moz
74  * clip_line must take signed longs.
75  *
76  * Revision 1.33  1999/11/15 23:04:35  moz
77  * Prototype fixes.
78  *
79  * Revision 1.32  1999/11/15 02:13:06  moz
80  * Use enums.
81  * Rounded trig prototypes.
82  *
83  * Revision 1.31  1999/08/17 00:38:35  moz
84  * Proto fix.
85  *
86  * Revision 1.30  1999/08/09 00:17:30  moz
87  * New prototypes for handle_icon.c
88  *
89  * Revision 1.29  1999/08/08 20:54:23  moz
90  * Clean up structs.
91  *
92  * Revision 1.28  1999/07/29 20:56:37  moz
93  * draw_text() now takes rx,ry scaling factors.
94  *
95  * Revision 1.27  1999/07/03 21:36:09  moz
96  * zoom_in() zoom_out() prototypes take Boolean.
97  *
98  * Revision 1.26  1999/06/17 19:11:04  moz
99  * PDerry defined.
100  * Prototypes for persistent attachment functions.
101  *
102  * Revision 1.25  1999/05/23 20:11:34  moz
103  * Fixed broken prototype fix.
104  *
105  * Revision 1.24  1999/05/23 00:28:17  moz
106  * Pedantic changes.
107  *
108  * Revision 1.23  1999/05/22 23:39:59  moz
109  *  Pedantic ANSI.
110  *
111  * Revision 1.22  1999/05/22 15:09:04  moz
112  * new_doc() takes argument now.
113  *
114  * Revision 1.21  1999/05/19 17:11:10  moz
115  * 1.0 Checkin.
116  *
117  * Revision 1.20  1999/05/05 12:29:44  moz
118  * export_name() changed.
119  *
120  * Revision 1.19  1999/05/04 20:10:24  moz
121  * insert_after(), insert_before() prototypes.
122  *
123  * Revision 1.18  1999/05/03 06:22:03  moz
124  * fill_in_file now takes .fig file filter option.
125  *
126  * Revision 1.17  1999/05/02 22:49:35  moz
127  * Removed unused split_compound().
128  *
129  * Revision 1.16  1999/04/29 22:57:46  moz
130  * New function prototypes for redo.
131  *
132  * Revision 1.15  1999/04/28 16:36:11  moz
133  * Use TextLine->w in recalc_text_box.
134  *
135  * Revision 1.14  1999/04/27 16:58:50  moz
136  * Flip object prototypes.
137  *
138  * Revision 1.13  1999/04/27 07:41:10  moz
139  * notify_compound_undo prototype.
140  *
141  * Revision 1.12  1999/04/27 06:46:24  moz
142  * Allow cmdline new files.
143  *
144  * Revision 1.11  1999/04/27 04:25:07  moz
145  * draw_view change.
146  *
147  * Revision 1.10  1999/04/27 04:12:58  moz
148  * Added missing prototypes.
149  *
150  * Revision 1.9  1999/04/26 20:00:36  moz
151  * New prototype for move_object added.
152  *
153  * Revision 1.8  1999/04/25 00:22:09  moz
154  * draw_text takes angle now.
155  *
156  * Revision 1.7  1999/04/24 22:24:52  moz
157  * Change of gc_colour and gc_fillcolour prototypes.
158  * New UColour structure for user-defined colours.
159  *
160  * Revision 1.6  1999/04/23 01:06:39  moz
161  * Store state of show_fig_files_only.
162  *
163  * Revision 1.5  1999/04/23 00:40:51  moz
164  * Change redraw method of whole window.
165  *
166  * Revision 1.4  1999/04/22 22:18:11  moz
167  * Changes in prototypes.
168  *
169  * Revision 1.3  1999/04/22 21:39:25  moz
170  * New function for scaling compounds.
171  *
172  * Revision 1.2  1999/04/12 19:06:00  moz
173  * New functions for export facility.
174  *
175  * Revision 1.1  1999/03/30 00:10:20  moz
176  * Initial revision
177  *
178  */
179 
180 #include <X11/Xlib.h>
181 #include <X11/Xresource.h>
182 #include <X11/Xutil.h>
183 #include <limits.h>
184 #include <unistd.h>
185 #include <sys/param.h>
186 #include <stdio.h>
187 #include <stdlib.h>
188 #include <X11/cursorfont.h>
189 #include <string.h>
190 /* For maintainer */
191 #ifdef MEMWATCH
192 #include "memwatch.h"
193 #endif
194 
195 #include "define.h"
196 
197 /* typedefs used in STK & Figurine  */
198 
199 typedef struct _ListEl
200    {
201    unsigned long id;
202    unsigned long type;
203    void *data;
204    struct _ListEl *next;
205    struct _ListEl *prev;
206    } ListEl;
207 
208 typedef ListEl *List;
209 
210 enum _Boolean { FALSE, TRUE };
211 
212 typedef enum _Boolean Boolean;
213 
214 typedef struct _Papersize
215    {
216    char name[20];
217 	char fname[20];
218    double w;
219    double h;
220    } Papersize;
221 
222 /* contains info about an X window  */
223 typedef struct _WindowStruct
224 	{
225 	Window win;
226 	Window parent;
227 	int cursor_num;
228 	int x,y;
229 	uint w,h;
230 	XSizeHints *size_hints;
231 	XClassHint *class_hints;
232 	XWMHints *wm_hints;
233 	Boolean grabbed;
234 	GC gc;
235 	} WindowStruct;
236 
237 /* normal colour  */
238 typedef struct _VColour
239 	{
240 	char label[20];
241 	unsigned long colour;
242 	char name[10];
243 	int tag;
244 	} VColour;
245 
246 /* user defined colour  */
247 typedef struct _UColour
248 	{
249 	long tag;
250 	unsigned long colour;
251 	char name[10];
252 	} UColour;
253 
254 /* button event created by mouse_motion.c or mouse_button.c  */
255 typedef struct _BEvent
256 	{
257 	int type; /* one of BUTTON_CLICKED, BUTTON_HELD, BUTTON_RELEASED */
258 	int x,y;
259 	unsigned int state;
260 	int button; /* Button1, Button2, Button3  */
261 	} BEvent;
262 
263 /* normal polyline point  */
264 typedef struct _VPoint
265 	{
266 	long x;
267 	long y;
268 	Boolean derried;
269 	} VPoint;
270 
271 /* line - used for clip_line()  */
272 typedef struct _VLine
273 	{
274 	long x1;
275 	long y1;
276 	long x2;
277 	long y2;
278 	} VLine;
279 
280 /* used as bboxes  */
281 typedef struct _VRegion
282 	{
283 	long x1;
284 	long y1;
285 	long x2;
286 	long y2;
287 	} VRegion;
288 
289 /* font description  */
290 typedef struct _VFont
291 	{
292 	XFontStruct *x;
293 	int num; /* index into fontnames array  */
294 	int size; /* note this is actual zoomed size. e.g. 120 point could be representing 12 point at 100% zoom */
295 	} VFont;
296 
297 /* section of text. less than 20 chars, all same font  */
298 typedef struct _TextSection
299 	{
300 	Boolean isReturn;
301 	int num; /* index used to get relevant VFont */
302 	int size;
303 	char text[20];
304 	long x;
305 	long y;
306 	long w;
307 	long h;
308 	} TextSection;
309 
310 /* line of text sections  */
311 typedef struct _TextLine
312 	{
313 	long y;
314 	long w;
315 	long h;
316 	int just; /* LEFT, CENTRE, RIGHT  */
317 	List sections;
318 	} TextLine;
319 
320 /* for _Text  */
321 struct _Object;
322 
323 /* text object is a list of lines  */
324 typedef struct _Text
325 	{
326 	List lines;
327 	Boolean node;
328 	double angle;
329 	VRegion bbox; /* bbox of actual text == ob->bbox for normal text */
330 	struct _Object *ellipse; /* Object * to ellipse for node */
331 	} Text;
332 
333 /* polyline object  */
334 typedef struct _Polyline
335 	{
336 	List points;
337 	char *pic; /* pic line for import/export */
338 	} Polyline;
339 
340 /* roundbox object  */
341 typedef struct _RoundBox
342 	{
343 	int radius; /* units of 1/80th inch  */
344 	/* co-ords are specified by bbox  */
345 	} RoundBox;
346 
347 /* ellipse object  */
348 typedef struct _Ellipse
349 	{
350 	VPoint centre;
351 	long xradius;
352 	long yradius;
353 	} Ellipse;
354 
355 /* Control point for spline  */
356 typedef struct _SPoint
357 	{
358 	long x;
359 	long y;
360 	Boolean derried;
361 	double s; /* -1 <= s <= 1 */
362 	} SPoint;
363 
364 /* spline object  */
365 typedef struct _Spline
366 	{
367 	List points; /* control points + shape factors */
368 	List cache; /* points array for drawing  */
369 	Boolean closed;
370 	} Spline;
371 
372 /* arcellipse object  */
373 typedef struct _ArcEllipse
374 	{
375 	VPoint centre;
376 	long xradius;
377 	long yradius;
378 	double start; /* angles, +-clockwise from E   */
379 	double end;
380 	Boolean open;
381 	} ArcEllipse;
382 
383 /* compound object  */
384 typedef struct _Compound
385 	{
386 	List obs;
387 	} Compound;
388 
389 /* arrow definition  */
390 typedef struct _Arrow
391 	{
392 	ArrowStyle type; /* ARROWSTICK, ARROWFLAT, ARROWINDENTED, ARROWPOINTED */
393 	int filled;
394 	long lw; /* in 1/80th inch  */
395 	long w; /* in 1/80th inch  */
396 	long h; /* in 1/80th inch  */
397 	} Arrow;
398 
399 /* all objects are of this type  */
400 typedef struct _Object
401 	{
402 
403 	ObjectType type; /* POLYLINE, ARC, etc.  */
404 	unsigned long ticket; /* unique id */
405 	unsigned long depth; /* depth of object  */
406 	ColourType colour; /* color - STARTOFCOLOURS upwards */
407 	FillColourType fillcolour; /* color of fill STARTOFFILLCOLOURS upwards */
408 
409 	LineStyle ls; /* see include/defines.h for line styles  */
410 	int lw; /* line width, 1/80s inch  */
411 	int fs; /* see pixmaps/fillstyle.h  */
412 	int es; /* end style */
413 	int js; /* join style */
414 	long dash; /* (Pixel) size of dash  */
415 	long gap; /* (Pixel) size of gap  */
416 
417 	Arrow *farrow; /* forward arrow description  */
418 	Arrow *barrow; /* backward arrow description  */
419 
420 	VRegion bbox; /* bounding box of object  */
421 
422 	List derries; /* linked objects  */
423 	union
424 		{
425 		Text       text;
426 		Polyline      polyline;
427 		RoundBox      roundbox;
428 		/* rectangle and generalised case regular polygon
429 			represented by polyline object */
430 		/* whether to even check for fill is testing for POLYGON  */
431 		Spline        spline;
432 		Ellipse       ellipse;
433 		ArcEllipse    arcellipse;
434 		Compound compound;
435 		} ob;
436 
437 	} Object;
438 
439 /* leaf in object tree  */
440 /* branches have ob==NULL  */
441 /* real leaves have left==NULL,right==NULL */
442 /* up is used in still_same_object()  */
443 typedef struct _Node
444 	{
445 	struct _Node *left;
446 	Object *ob;
447 	VRegion bbox;
448 	struct _Node *right;
449 	struct _Node *up;
450 	} Node;
451 
452 typedef Node *Tree;
453 
454 /* main structure for a document  */
455 typedef struct _Document
456 	{
457 	Tree o; /* our tree of objects */
458 	List lo; /* list of objects  */
459 	List cols; /* user-defined colours for document */
460 	double ppi; /* always 1200  */
461 	unsigned long ob_depth; /* latest ob_depth  */
462 	double width_in_inches;
463 	double height_in_inches;
464 	List views; /* view list for document  */
465 	char canvas_name[40];
466 	Boolean landscape;
467 	Boolean centred; /* if ==0, flush left  */
468 	Boolean in_mm;
469 	double magnify; /* for export/print  */
470 	Boolean mpage; /* multipage  */
471 	int transcolour; /* transparent GIF colour index  */
472 	char pathname[FIGURINE_PATH_MAX];
473 	char filename[FIGURINE_PATH_MAX];
474 	Window check_dial; /* unpleasant hack ... */
475 	Window check_save;
476 	Window check_close;
477 	Window check_cancel;
478 	} Document;
479 
480 /* each view has this structure  */
481 typedef struct _View
482 	{
483 	WindowStruct window;
484 
485 	Document *doc; /* parent document  */
486 	WindowStruct *ruler_x_window;
487 	WindowStruct *ruler_y_window;
488 	WindowStruct *draw_window;
489 	WindowStruct *view_icon_window;
490 
491 	Boolean guide_lines; /* guide lines on ?  */
492 	Boolean guide_lines_displayed;
493 	Boolean in_mm; /* mm or inches  */
494 	Boolean show_compounds; /* dashgc round compound bbox  */
495 	Boolean highlight_objects;
496 
497 	Node *highlighted_object;
498 	Node *selected_object; /* which object is selected  */
499 	Node *edited_object; /* i.e. point editing of object  */
500 	int guide_x; /* position of guidelines  */
501 	int guide_y;
502 	unsigned long colour; /* colour to be used */
503 	unsigned long fillcolour; /* fill colour to be used */
504 
505 	Object *text_object; /* current text object  */
506 	Boolean showgrid;  /* whether grid is shown  */
507 	Boolean gridon; /* whether grid has an effect  */
508 	long grid_x; /* grid size  */
509 	long grid_y;
510 	int sides; /* no of sides of regular polygon  */
511 	double side_angle; /* pre-computed when sides changed  */
512 	Boolean regular; /* regular polygon ?  */
513 
514 	char wname[850]; /* window name  */
515 	double x_inches_offset; /* offset of rulers  */
516 	double y_inches_offset;
517 	double zoom_factor; /* current zoom value  */
518 	int zoom_level; /* current zoom position  */
519 	int linestyle; /* current object parameters  */
520 	int linewidth;
521 	int endstyle;
522 	int joinstyle;
523 	Boolean fillon;
524 	int fillstyle;
525 	Boolean roundbox;
526 	int roundsize;
527 	int fontnum;
528 	int fontsize; /* nominal e.g. 12pt when screen font is 120pt  */
529 	int justification;
530 	Boolean closed; /* for spline  */
531 	double current_sfactor; /* for splines  */
532 	Boolean openarc; /* for arcellipses  */
533 	Boolean farrow_on;
534 	Boolean barrow_on;
535 	Arrow farrow;
536 	Arrow barrow;
537 
538 	} View;
539 
540 /* stores useful state  */
541 typedef struct _State
542 	{
543 	IconType current_icon; /* current tool icon  */
544 	Boolean current_icon_window_open;
545 	Boolean busy_drawing;
546 	Boolean editing_object;
547 	Boolean editing_point;
548 	Boolean editing_text;
549 	Boolean compound_selected;
550 	Boolean drawing_released;
551 	Boolean rubberon;
552 	Boolean control_down; /* keys down  */
553 	Boolean shift_down;
554 	Boolean show_fig_files_only; /* in file dialogs  */
555 	ScalingCorner tied_corner; /* for scaling  */
556 	Time last_press;
557 	Time last_release;
558 	char cwd[FIGURINE_PATH_MAX]; /* working dir  */
559 	char print[200]; /* print command  */
560 	View *menu_view; /* current view with an icon menu open  */
561 	List views; /* all open views  */
562 	} State;
563 
564 typedef struct _Undo
565 	{
566 	UndoType type;
567 	Object *ob; /* usually duplicated object  */
568 	Object *real_ob; /* usually a pointer to the object in the tree  */
569 	Document *doc; /* relevant document  */
570 	} Undo;
571 
572 /* indicating an object is attached to this one  */
573 typedef struct _Derry
574 	{
575 	unsigned long ticket; /* ob_ticket of attached object  */
576 	VPoint *point; /* and the point itself  */
577 	} Derry;
578 
579 /* persistent derry structure used in load.c  */
580 
581 typedef struct _PDerry
582 	{
583 	Object *ob; /* this is the target */
584 	char tag[40]; /* this is the picked out tag == old pointer  */
585 	long x,y;
586 	} PDerry;
587 
588 /* function prototypes  */
589 #ifdef PROTOTYPES
590 void get_opts(int, char **);
591 void figurine_usage(char *argv[]);
592 void get_colour(ulong *return_colour, int want_white, char *res_string, char *res_class_string, char *color_name);
593 void open_display_and_parse_database(void);
594 void home_directory(char *);
595 void close_display(void);
596 void event_loop(void);
597 void figurine_init(int, char **);
598 void close_down(void);
599 int max_int(int, int);
600 List create_list(ulong, ulong, void *);
601 List add_to_list0(List list, ulong id, ulong type, void *data);
602 List add_to_list_neq0(List list, ulong id, ulong type, void *data);
603 void delete_list(List);
604 List insert_after(List list, ListEl *pos, ulong id, ulong type, void *data, ListEl **le);
605 List insert_before(List list, ListEl *pos, ulong id, ulong type, void *data, ListEl **le);
606 List delete_from_list(List, ulong);
607 List delete_from_list_v(List, void *);
608 Boolean is_in_list(List, ulong);
609 Boolean is_in_list_v(List, void *);
610 Boolean is_in_box(int, int, int, int, int, int);
611 Boolean is_in_bbox(int, int, int, int, int, int);
612 Boolean is_in_object(long, long, Object *);
613 Boolean is_in_object_p(View *, long, long, Object *);
614 void force_in_box(int *, int *, int, int, int, int);
615 void force_in_box_l(long *, long *, long, long, long, long);
616 void normalise_rectangle(long *, long *, long *, long *);
617 void normalise_frectangle(double *, double *, double *, double *);
618 Boolean is_contained(int, int, int, int, int, int, int, int);
619 Boolean is_contained_v(VRegion, VRegion);
620 Boolean intersects(int, int, int, int, int, int, int, int);
621 Boolean intersects_v(VRegion, VRegion);
622 List intersecting_objects(Tree, VRegion, List);
623 List where_in_list(List, ulong);
624 Document *new_doc(Boolean);
625 Window new_view0(Document *);
626 void new_view(Document *);
627 Boolean close_view(View *);
628 void really_close_view(View *);
629 Boolean close_doc(Document *,View *);
630 Boolean really_close_doc(Document *);
631 void draw_ruler_x(WindowStruct *, double, double);
632 void draw_ruler_x_mm(WindowStruct *, double, double);
633 void draw_ruler_y(WindowStruct *, double, double);
634 void draw_ruler_y_mm(WindowStruct *, double, double);
635 void toggle_guidelines(View *);
636 void toggle_rubber_line(WindowStruct *, int, int, int, int);
637 Boolean create_window(WindowStruct *, Window, List *, int, void *);
638 void send_redraw(WindowStruct *, int, int, int, int);
639 void send_redraw_v(View *,VRegion);
640 void send_redraw_object(View *, Object *);
641 void send_configure(WindowStruct *, int, int, int, int);
642 void set_window_name(WindowStruct *,char *);
643 void set_clip(GC, int, int, int, int);
644 void set_clip_v(GC, View *, VRegion);
645 void handle_button_press(XEvent *);
646 void handle_button_release(XEvent *);
647 void handle_motion(XEvent *);
648 void handle_keypress(XKeyPressedEvent *);
649 void zoom_in(View *,Boolean);
650 void zoom_out(View *,Boolean);
651 void polyline_button(BEvent *, View *);
652 void polyline_point_button(BEvent *, View *);
653 void polyline_point_motion(View *, long, long);
654 void ellipse_button(BEvent *, View *);
655 void polygon_button(BEvent *, View *);
656 void rectangle_button(BEvent *, View *);
657 void edit_button(BEvent *, View *);
658 void edit_motion(View *, long, long);
659 void text_button(BEvent *, View *);
660 void text_key(View *, XKeyPressedEvent *);
661 void toggle(View *, int, int);
662 void toggle_polyline(View *, int, int);
663 void toggle_ellipse(View *, int, int);
664 void toggle_polygon(View *, int, int);
665 void toggle_rectangle(View *, int, int);
666 void toggle_object_outline(View *);
667 void toggle_point_polyline(View *, long, long);
668 int nudge_ruler_x(WindowStruct *, View *, int);
669 int nudge_ruler_y(WindowStruct *, View *, int);
670 void recalc_polyline_bbox(Object *,Boolean);
671 List polygon_into_points(View *view, List points);
672 VRegion merge_boxes(VRegion, VRegion);
673 Tree add_object(Tree, List *, Object *);
674 Tree add_object0(Tree, Object *);
675 Tree delete_object(Tree, Object *);
676 Node *get_object_node(Tree, Object *);
677 void tree_walk(Tree t);
678 Tree change_bbox(Tree,Object *);
679 void resize_bbox(Tree,Object *);
680 Node *object_at_point(View *, Tree,long,long);
681 List object_at_point0(List match, View *v, Tree t, long x, long y);
682 Node *object_at_point_p(View *, Tree,long,long);
683 void draw_tree(Tree t, View *);
684 void draw_view(View *view, long,long,long,long);
685 void draw_section(View *, int, int, int, int);
686 void draw_section_v(View *, VRegion);
687 void draw_section0(View *, VRegion *, int, int, int, int);
688 void draw_object(Object *,View *, GC, long, long, double, double, double,long, long, long, long);
689 void draw_polyline(Object *,View *, GC, long, long, double, double, double);
690 void draw_ellipse(Object *,View *, GC, long, long, double, double);
691 void draw_roundbox(Object *,View *, GC, long, long, double, double);
692 void draw_spline(Object *, View *, GC, long, long, double, double, double);
693 void draw_text(Object *, View *, GC, long, long, double, double, double);
694 void draw_grid(View *,long, long, long, long);
695 void constrain_line(long, long, long *, long *);
696 void constrain_ellipse(long *, long *);
697 void constrain_resize(double *,double *);
698 void constrain_rectangle(long, long, long *, long *);
699 VLine *clip_line(long, long, long, long, VLine *, Boolean *, int);
700 signed long line_x_at_y(long, long, long, long, long);
701 signed long line_y_at_x(long, long, long, long, long);
702 long snap(long, long);
703 void draw_bbox_handles(View *);
704 void draw_handle(View *, long x, long y);
705 Boolean still_same_object(Node *,long,long);
706 Boolean still_same_object_p(View *, Node *, long, long);
707 void gc_line(GC, Object *);
708 void gc_fill(GC, Object *);
709 void gc_colour(View *, GC, Object *);
710 void gc_fillcolour(View *, GC, Object *);
711 void gc_lw(View *, GC, Object *);
712 void gc_lw_v(View *, GC, int);
713 void gc_end(GC, Object *);
714 void gc_join(GC, Object *);
715 Boolean edit_on_handle(View *, Object *, long, long);
716 Boolean edit_on_rotate_handle(View *, Object *, long, long);
717 void apply_scale_to_object(View *, Object *, double, double, Boolean);
718 void apply_rotate_to_object(View *, Object *, double);
719 void corner_magic(Object *, long *, long *, double, double);
720 void deselect_everything(void);
721 ListEl *polyline_nearest_point(List, long, long,double *);
722 List alloc_points(int);
723 void fill_in_file(Window,Window,Boolean);
724 Boolean is_directory(char *);
725 void strip_end_dir(char *);
726 double f_blend(double, double);
727 double g_blend(double, double);
728 double h_blend(double, double);
729 void compute_negative_s1(double, double, double *, double *);
730 void compute_negative_s2(double, double, double *, double *);
731 void compute_positive_s2(int, double, double, double *, double *);
732 void compute_positive_s1(int, double, double, double *, double *);
733 List compute_spline_segment(List,Boolean);
734 List spline_compute(List,double,int,SPoint *,SPoint *,SPoint *,SPoint *,double, double);
735 void spline_button(BEvent *, View *);
736 void toggle_spline_line(View *, int, int);
737 void spline_point_button(BEvent *, View *);
738 void spline_point_motion(View *, long, long);
739 void toggle_point_spline(View *, long, long);
740 long size_of_spline(List, View *);
741 Boolean point_in_ellipse(long, long, long, long, long, long);
742 int ellipse_box(long, long, long, long, long, long, long, long);
743 Boolean new_object(View *, long, long);
744 VFont *get_font(int, int);
745 void unselect_text(View *);
746 void unselect_compound(View *);
747 void unselect_arc(View *);
748 void recalc_text_box(View *, Object *,Boolean,Boolean);
749 void recalc_text_boxes(View *);
750 void calc_text_outer_box_adjust(Object *,long,long);
751 void set_window_cursor(Window,int);
752 void arcellipse_button(BEvent *, View *);
753 void draw_arcellipse(Object *ob, View *view, GC gc, long x,long y, double rx, double ry);
754 void toggle_arcellipse(View *view, int x, int y);
755 Tree trash_object(Tree t, List *lo, Object *ob);
756 Object *create_compound(View *view);
757 void add_to_compound(View *view, Object *ob);
758 void compound_button(BEvent *bev, View *view);
759 void draw_compound(Object *ob, View *view, GC gc, long x, long y, double rx, double ry, long, long, long, long);
760 void compound_move(View *,Object *,long, long, long, long);
761 void apply_scale_to_compound(View *view, Object *ob, double x, double y, long, long);
762 void break_compound(View *view, Object *ob);
763 void commit_ellipse(View *, long, long);
764 void commit_arc(View *view, long x, long y);
765 void commit_arcellipse(View *view, long x);
766 void commit_polygon(View *, long, long);
767 void commit_rectangle(View *, long, long);
768 void switch_icons(View *);
769 void kill_object(Object *);
770 Object *duplicate_object(Object *);
771 void cut_object(View *,Object *);
772 void copy_object(Object *);
773 void paste_object(View *,long,long);
774 void move_object(View *,Object *,long, long);
775 void free_list(void *);
776 void handle_dialog(XEvent report, ulong);
777 void change_function(XEvent report);
778 void icon_chosen(XEvent report);
779 void fake_icon_chosen(IconType icon, Window parent);
780 void dialog_text_val(Window te, long val);
781 void icon_swap_pixmap(View *v, Window parent, int a, int b);
782 void set_text_just(View *);
783 void place_cursor(View *view, int x, int y);
784 void new_text(BEvent *bev, View *view);
785 void insert_char(char *str, char c, int pos);
786 TextSection *new_section(View *view);
787 void add_char(View *,char *);
788 Boolean is_fluff(char *);
789 char *get_whole_line(void);
790 void parse_papersize(void);
791 Boolean string_eq(char *);
792 int stringcomp(char **a, char **b);
793 void skip_to_space(void);
794 double get_double(void);
795 int get_int(void);
796 int get_arc_open(void);
797 int get_line_style(void);
798 int get_fcolour(void);
799 int get_fill_fcolour(void);
800 int get_fill_colour(void);
801 ulong get_depth(void);
802 int get_fillstyle(Object *);
803 int get_capstyle(void);
804 int get_joinstyle(void);
805 Arrow *parse_arrow(void);
806 void parse_colour_object(void);
807 void parse_vcomment(Object *);
808 Object *parse_arc_ellipse(void);
809 Object *parse_compound(View *);
810 Object *parse_ellipse(void);
811 Object *parse_polyline(void);
812 VPoint *parse_point(Object *);
813 SPoint *parse_spoint(Object *);
814 Object *parse_spline(void);
815 Object *parse_text(View *);
816 void load(char *,Boolean cmdline);
817 void draw_arrow(View *view, GC gc, Arrow *arrow, int sx, int sy, int ex, int ey);
818 Arrow *make_arrow(Arrow arrow);
819 void bent_midpoint(long,long,long,long,double, short *, short *);
820 void set_arrow_radio(uint type, Window win);
821 void arc_button(BEvent *bev, View *view);
822 void toggle_arc(View *view, int x, int y);
823 Boolean arc_key(View *view, XKeyPressedEvent *report);
824 void register_undo(int type, Object *ob, Document *doc);
825 List push_undo(List, Undo *);
826 Undo *pop_undo(List *);
827 void do_undo(void);
828 void kill_undo(Undo *, int);
829 void replace_undo_refs(Object *old,Object *new);
830 Object *undo_duplicate_object(Object *);
831 void clear_redo_stack(void);
832 void nullify_sel_object(Document *doc);
833 void do_redo(void);
834 void insert_file(Document *, char *,Boolean ,Boolean );
835 Boolean get_nearest_point(View *view, Tree t, long cx, long cy, long *x,long *y,Object **);
836 List intersecting_objects_point(Tree t, long cx, long cy, List l);
837 void save(Document *d);
838 void save_name(Document *d, char *file);
839 void derry_out(Object *ob);
840 void derry_check(Object *ob);
841 void linestyle_out(int ls);
842 void colour_out(int col);
843 void fillcolour_out(Object *ob);
844 void depth_out(ulong depth);
845 void fillstyle_out(Object *ob);
846 void joinstyle_out(int js);
847 void capstyle_out(int es);
848 void arrow_out(Arrow *arrow);
849 void polyline_out(Object *ob);
850 void spline_out(Object *ob);
851 void polygon_out(Object *ob);
852 void roundbox_out(Object *ob);
853 void ellipse_out(Object *ob);
854 void arcellipse_out(Object *ob);
855 void text_out(Object *ob);
856 void compound_out(Object *ob);
857 void font_out(int num);
858 void add_derry(Object *,Object *,VPoint *);
859 Object *get_object_by_ticket(Tree t, ulong ticket);
860 void derry_move(View *, Object *, long, long);
861 void remove_derry(View *v,Object *ob, VPoint *p);
862 void delete_cache_list(List l);
863 void store_redraw_object(Object *ob);
864 void send_stored_redraw_object(View *v, Object *ob);
865 void polyline_export(Object *);
866 void spline_export(Object *);
867 void polygon_export(Object *);
868 void roundbox_export(Object *);
869 void ellipse_export(Object *);
870 void arcellipse_export(Object *);
871 void text_export(Object *);
872 void compound_export(Object *);
873 char *export_name(Document *, char *, ExportType);
874 void start_help(void);
875 void add_export_extension(int);
876 char *strip_dirname(char *);
877 void redraw_view_window(View *view);
878 double sinround(double angle);
879 double cosround(double angle);
880 double flip_angle_y(double angle);
881 double flip_angle_x(double angle);
882 void flip_object_x(View *view, Object *ob);
883 void flip_object_x0(View *view, Object *ob,Boolean);
884 void flip_object_y(View *view, Object *ob);
885 void flip_object_y0(View *view, Object *ob,Boolean);
886 #endif
887 
888 #endif
889