1 /* 2 * FIG : Facility for Interactive Generation of figures 3 * Copyright (c) 1985-1988 by Supoj Sutanthavibul 4 * Parts Copyright (c) 1989-2007 by Brian V. Smith 5 * Parts Copyright (c) 1991 by Paul King 6 * Parts Copyright (c) 2004 by Chris Moller 7 * 8 * Any party obtaining a copy of these files is granted, free of charge, a 9 * full and unrestricted irrevocable, world-wide, paid up, royalty-free, 10 * nonexclusive right and license to deal in this software and documentation 11 * files (the "Software"), including without limitation the rights to use, 12 * copy, modify, merge, publish, distribute, sublicense and/or sell copies of 13 * the Software, and to permit persons who receive copies from any such 14 * party to do so, with the only requirement being that the above copyright 15 * and this permission notice remain intact. 16 * 17 */ 18 19 #ifndef W_SNAP_H 20 #define W_SNAP_H 21 22 extern void snap_hold(Widget w, XtPointer closure, XtPointer call_data); 23 extern void snap_release(Widget w, XtPointer closure, XtPointer call_data); 24 extern void snap_endpoint(Widget w, XtPointer closure, XtPointer call_data); 25 extern void snap_midpoint(Widget w, XtPointer closure, XtPointer call_data); 26 extern void snap_nearest(Widget w, XtPointer closure, XtPointer call_data); 27 extern void snap_focus(Widget w, XtPointer closure, XtPointer call_data); 28 extern void snap_diameter(Widget w, XtPointer closure, XtPointer call_data); 29 extern void snap_normal(Widget w, XtPointer closure, XtPointer call_data); 30 extern void snap_tangent(Widget w, XtPointer closure, XtPointer call_data); 31 extern void snap_intersect(Widget w, XtPointer closure, XtPointer call_data); 32 extern Boolean snap_process(int * px, int *py, unsigned int state); 33 extern void get_line_from_points(double * c, struct f_point * s1, struct f_point * s2); 34 extern void snap_rotate_vector(double * dx, double * dy, double x, double y, double theta); 35 extern Boolean is_point_on_arc(F_arc * a, int x, int y); 36 extern void snap_polyline_focus_handler(F_line * a, int x, int y); 37 extern void init_snap_panel(Widget parent); 38 39 typedef enum { 40 SNAP_MODE_NONE, 41 SNAP_MODE_ENDPOINT, 42 SNAP_MODE_MIDPOINT, 43 SNAP_MODE_NEAREST, 44 SNAP_MODE_FOCUS, 45 SNAP_MODE_DIAMETER, 46 SNAP_MODE_NORMAL, 47 SNAP_MODE_TANGENT, 48 SNAP_MODE_INTERSECT 49 } snap_mode_e; 50 51 typedef enum { 52 INTERSECT_INITIAL, 53 INTERSECT_FIRST_FOUND 54 } intersect_state_e; 55 56 extern intersect_state_e intersect_state; 57 58 extern snap_mode_e snap_mode; 59 extern Boolean snap_msg_set; 60 extern int snap_gx; 61 extern int snap_gy; 62 extern Boolean snap_found; 63 extern Widget snap_indicator_panel; 64 extern Widget snap_indicator_label; 65 66 # define signbit_(x) \ 67 ((0.0 > (x)) ? 1 : 0) 68 69 70 #endif 71