From ff4c372a14e67e388fab5aaeb75b9dded7df88cc Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Fri, 31 Jan 2025 23:43:14 +0100 Subject: [PATCH 1/8] Fix prototypes for mouse button callbacks Bug: https://bugs.gentoo.org/946838 Upstream: https://sourceforge.net/p/mcj/xfig/merge-requests/1/ --- a/src/d_arc.c +++ b/src/d_arc.c @@ -57,11 +57,11 @@ double r; /* LOCAL */ -static void create_arcobject(int lx, int ly); -static void get_arcpoint(int x, int y); -static void init_arc_drawing(int x, int y); -static void cancel_arc(void); -static void init_arc_c_drawing(int x, int y); +static void create_arcobject(int lx, int ly, unsigned int shift); +static void get_arcpoint(int x, int y, unsigned int shift); +static void init_arc_drawing(int x, int y, unsigned int shift); +static void cancel_arc(int x, int y, unsigned int shift); +static void init_arc_c_drawing(int x, int y, unsigned int shift); static void resizing_arc(int x, int y); static F_arc *tmparc = 0; @@ -88,9 +88,11 @@ arc_drawing_selected(void) } static void -init_arc_drawing(int x, int y) +init_arc_drawing(int x, int y, unsigned int shift) { int i; + (void)shift; + if (center_marked) { /* erase the ellipse */ elastic_ebr(); @@ -144,18 +146,20 @@ init_arc_drawing(int x, int y) elastic_line(); } canvas_leftbut_proc = get_arcpoint; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; set_cursor(null_cursor); set_action_on(); } static void -init_arc_c_drawing(int x, int y) +init_arc_c_drawing(int x, int y, unsigned int shift) { + (void)shift; + set_mousefun("first point", "", "cancel", "", "", ""); draw_mousefun_canvas(); canvas_locmove_proc = resizing_cbr; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = cancel_arc; center_point.x = fix_x = cur_x = x; center_point.y = fix_y = cur_y = y; @@ -184,8 +190,12 @@ init_earc_c_drawing(int x, int y) } static void -cancel_arc(void) +cancel_arc(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + if (center_marked) { /* erase circle */ if (num_point == 0) elastic_cbr(); @@ -226,8 +236,10 @@ cancel_arc(void) } static void -get_arcpoint(int x, int y) +get_arcpoint(int x, int y, unsigned int shift) { + (void)shift; + if (x == fix_x && y == fix_y) return; @@ -254,12 +266,14 @@ get_arcpoint(int x, int y) } static void -create_arcobject(int lx, int ly) +create_arcobject(int lx, int ly, unsigned int shift) { F_arc *arc; int x, y; float xx, yy; + (void)shift; + /* erase last line segment */ if (!center_marked) elastic_line(); --- a/src/d_arcbox.c +++ b/src/d_arcbox.c @@ -33,9 +33,9 @@ /*************************** local procedures *********************/ -static void create_arc_boxobject(int x, int y); -static void cancel_arc_boxobject(void); -static void init_arc_box_drawing(int x, int y); +static void create_arc_boxobject(int x, int y, unsigned int shift); +static void cancel_arc_boxobject(int x, int y, unsigned int shift); +static void init_arc_box_drawing(int x, int y, unsigned int shift); @@ -46,22 +46,24 @@ arcbox_drawing_selected(void) canvas_kbd_proc = null_proc; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_arc_box_drawing; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; set_cursor(crosshair_cursor); reset_action_on(); } static void -init_arc_box_drawing(int x, int y) +init_arc_box_drawing(int x, int y, unsigned int shift) { + (void)shift; + cur_x = fix_x = x; cur_y = fix_y = y; set_mousefun("final point", "", "cancel", "", "", ""); draw_mousefun_canvas(); canvas_locmove_proc = resizing_box; canvas_leftbut_proc = create_arc_boxobject; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = cancel_arc_boxobject; elastic_box(fix_x, fix_y, cur_x, cur_y); set_cursor(null_cursor); @@ -69,19 +71,25 @@ init_arc_box_drawing(int x, int y) } static void -cancel_arc_boxobject(void) +cancel_arc_boxobject(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_box(fix_x, fix_y, cur_x, cur_y); arcbox_drawing_selected(); draw_mousefun_canvas(); } static void -create_arc_boxobject(int x, int y) +create_arc_boxobject(int x, int y, unsigned int shift) { F_line *box; F_point *point; + (void)shift; + elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_box_lengths(); --- a/src/d_box.c +++ b/src/d_box.c @@ -34,8 +34,8 @@ /*************************** local declarations *********************/ -static void create_boxobject(int x, int y); -static void cancel_box(void); +static void create_boxobject(int x, int y, unsigned int shift); +static void cancel_box(int x, int y, unsigned int shift); @@ -46,22 +46,24 @@ box_drawing_selected(void) canvas_kbd_proc = null_proc; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_box_drawing; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; set_cursor(crosshair_cursor); reset_action_on(); } void -init_box_drawing(int x, int y) +init_box_drawing(int x, int y, unsigned int shift) { + (void)shift; + cur_x = fix_x = x; cur_y = fix_y = y; set_mousefun("final point", "", "cancel", "", "", ""); draw_mousefun_canvas(); canvas_locmove_proc = resizing_box; canvas_leftbut_proc = create_boxobject; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = cancel_box; elastic_box(fix_x, fix_y, cur_x, cur_y); set_cursor(null_cursor); @@ -69,8 +71,12 @@ init_box_drawing(int x, int y) } static void -cancel_box(void) +cancel_box(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_box_lengths(); @@ -79,11 +85,13 @@ cancel_box(void) } static void -create_boxobject(int x, int y) +create_boxobject(int x, int y, unsigned int shift) { F_line *box; F_point *point; + (void)shift; + elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_box_lengths(); --- a/src/d_box.h +++ b/src/d_box.h @@ -16,5 +16,5 @@ * */ -extern void init_box_drawing(int x, int y); +extern void init_box_drawing(int x, int y, unsigned int shift); extern void box_drawing_selected (void); --- a/src/d_ellipse.c +++ b/src/d_ellipse.c @@ -36,18 +36,18 @@ /************************* local procedures ********************/ -static void init_ellipsebyradius_drawing(int x, int y); -static void init_ellipsebydiameter_drawing(int x, int y); -static void init_circlebyradius_drawing(int x, int y); -static void init_circlebydiameter_drawing(int x, int y); -static void create_ellipsebydia(int x, int y); -static void create_ellipsebyrad(int x, int y); -static void create_circlebyrad(int x, int y); -static void create_circlebydia(int x, int y); -static void cancel_ellipsebydia(void); -static void cancel_ellipsebyrad(void); -static void cancel_circlebyrad(void); -static void cancel_circlebydia(void); +static void init_ellipsebyradius_drawing(int x, int y, unsigned int shift); +static void init_ellipsebydiameter_drawing(int x, int y, unsigned int shift); +static void init_circlebyradius_drawing(int x, int y, unsigned int shift); +static void init_circlebydiameter_drawing(int x, int y, unsigned int shift); +static void create_ellipsebydia(int x, int y, unsigned int shift); +static void create_ellipsebyrad(int x, int y, unsigned int shift); +static void create_circlebyrad(int x, int y, unsigned int shift); +static void create_circlebydia(int x, int y, unsigned int shift); +static void cancel_ellipsebydia(int x, int y, unsigned int shift); +static void cancel_ellipsebyrad(int x, int y, unsigned int shift); +static void cancel_circlebyrad(int x, int y, unsigned int shift); +static void cancel_circlebydia(int x, int y, unsigned int shift); @@ -58,15 +58,17 @@ circle_ellipse_byradius_drawing_selected(void) canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_circlebyradius_drawing; canvas_middlebut_proc = init_ellipsebyradius_drawing; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(crosshair_cursor); set_mousefun("Circle center", "Ellipse center", "", "", "", ""); reset_action_on(); } static void -init_ellipsebyradius_drawing(int x, int y) +init_ellipsebyradius_drawing(int x, int y, unsigned int shift) { + (void)shift; + cur_mode = F_ELLIPSE_BY_RAD; cur_x = fix_x = x; cur_y = fix_y = y; @@ -84,8 +86,12 @@ init_ellipsebyradius_drawing(int x, int y) } static void -cancel_ellipsebyrad(void) +cancel_ellipsebyrad(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_ebr(); center_marker(fix_x, fix_y); circle_ellipse_byradius_drawing_selected(); @@ -93,10 +99,12 @@ cancel_ellipsebyrad(void) } static void -create_ellipsebyrad(int x, int y) +create_ellipsebyrad(int x, int y, unsigned int shift) { F_ellipse *ellipse; + (void)shift; + elastic_ebr(); center_marker(fix_x, fix_y); if ((ellipse = create_ellipse()) == NULL) @@ -137,14 +145,16 @@ void circle_ellipse_bydiameter_drawing_selected(void) canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_circlebydiameter_drawing; canvas_middlebut_proc = init_ellipsebydiameter_drawing; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(crosshair_cursor); reset_action_on(); } static void -init_ellipsebydiameter_drawing(int x, int y) +init_ellipsebydiameter_drawing(int x, int y, unsigned int shift) { + (void)shift; + cur_mode = F_ELLIPSE_BY_DIA; cur_x = fix_x = x; cur_y = fix_y = y; @@ -162,8 +172,12 @@ init_ellipsebydiameter_drawing(int x, int y) } static void -cancel_ellipsebydia(void) +cancel_ellipsebydia(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_ebd(); center_marker(fix_x, fix_y); circle_ellipse_bydiameter_drawing_selected(); @@ -171,10 +185,12 @@ cancel_ellipsebydia(void) } static void -create_ellipsebydia(int x, int y) +create_ellipsebydia(int x, int y, unsigned int shift) { F_ellipse *ellipse; + (void)shift; + elastic_ebd(); center_marker(fix_x, fix_y); if ((ellipse = create_ellipse()) == NULL) @@ -211,8 +227,10 @@ create_ellipsebydia(int x, int y) /*************************** circle section ************************/ static void -init_circlebyradius_drawing(int x, int y) +init_circlebyradius_drawing(int x, int y, unsigned int shift) { + (void)shift; + cur_mode = F_CIRCLE_BY_RAD; cur_x = fix_x = x; cur_y = fix_y = y; @@ -221,7 +239,7 @@ init_circlebyradius_drawing(int x, int y) draw_mousefun_canvas(); canvas_locmove_proc = resizing_cbr; canvas_leftbut_proc = create_circlebyrad; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = cancel_circlebyrad; set_cursor(null_cursor); elastic_cbr(); @@ -229,8 +247,12 @@ init_circlebyradius_drawing(int x, int y) } static void -cancel_circlebyrad(void) +cancel_circlebyrad(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_cbr(); center_marker(fix_x, fix_y); circle_ellipse_byradius_drawing_selected(); @@ -238,11 +260,13 @@ cancel_circlebyrad(void) } static void -create_circlebyrad(int x, int y) +create_circlebyrad(int x, int y, unsigned int shift) { F_ellipse *c; double rx, ry; + (void)shift; + elastic_cbr(); center_marker(fix_x, fix_y); if ((c = create_ellipse()) == NULL) @@ -278,8 +302,10 @@ create_circlebyrad(int x, int y) } static void -init_circlebydiameter_drawing(int x, int y) +init_circlebydiameter_drawing(int x, int y, unsigned int shift) { + (void)shift; + cur_mode = F_CIRCLE_BY_DIA; cur_x = fix_x = x; cur_y = fix_y = y; @@ -288,7 +314,7 @@ init_circlebydiameter_drawing(int x, int y) draw_mousefun_canvas(); canvas_locmove_proc = resizing_cbd; canvas_leftbut_proc = create_circlebydia; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = cancel_circlebydia; set_cursor(null_cursor); elastic_cbd(); @@ -296,8 +322,12 @@ init_circlebydiameter_drawing(int x, int y) } static void -cancel_circlebydia(void) +cancel_circlebydia(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_cbd(); center_marker(fix_x, fix_y); circle_ellipse_bydiameter_drawing_selected(); @@ -305,11 +335,13 @@ cancel_circlebydia(void) } static void -create_circlebydia(int x, int y) +create_circlebydia(int x, int y, unsigned int shift) { F_ellipse *c; double rx, ry; + (void)shift; + elastic_cbd(); center_marker(fix_x, fix_y); if ((c = create_ellipse()) == NULL) --- a/src/d_line.c +++ b/src/d_line.c @@ -44,8 +44,8 @@ Boolean freehand_line; static Boolean dimension_line; -static void init_line_drawing(int x, int y, int shift); -static void init_line_freehand_drawing(int x, int y); +static void init_line_drawing(int x, int y, unsigned int shift); +static void init_line_freehand_drawing(int x, int y, unsigned int shift); /********************** polyline and polygon section **********************/ @@ -62,7 +62,7 @@ line_drawing_selected(void) if (cur_mode == F_POLYGON) { set_mousefun("first point", "freehand", "", "", "", ""); min_num_points = 3; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; } else { set_mousefun("first point", "freehand", "single point", "dimension line", "", ""); min_num_points = 1; @@ -73,8 +73,10 @@ line_drawing_selected(void) } static void -init_line_freehand_drawing(int x, int y) +init_line_freehand_drawing(int x, int y, unsigned int shift) { + (void)shift; + freehand_line = True; /* not a dimension line */ dimension_line = False; @@ -82,7 +84,7 @@ init_line_freehand_drawing(int x, int y) } static void -init_line_drawing(int x, int y, int shift) +init_line_drawing(int x, int y, unsigned int shift) { freehand_line = False; /* if the user pressed shift then make a dimension line */ @@ -90,13 +92,17 @@ init_line_drawing(int x, int y, int shift) if (shift) { min_num_points = 2; } - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; init_trace_drawing(x, y); } void -cancel_line_drawing(void) +cancel_line_drawing(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_line(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -143,7 +149,7 @@ init_trace_drawing(int x, int y) set_mousefun("next point", "", "cancel", "del point", "", ""); if (dimension_line) { set_mousefun("final point", "", "cancel", "del point", "", ""); - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; } else if (num_point >= min_num_points - 1) { set_mousefun("next point", "final point", "cancel", "del point", "", ""); canvas_middlebut_proc = canvas_middlebut_save; @@ -172,7 +178,7 @@ freehand_get_intermediatepoint(int x, int y) } void -get_intermediatepoint(int x, int y, int shift) +get_intermediatepoint(int x, int y, unsigned int shift) { /* in freehand mode call unconstrained_line explicitely to move the mouse */ if (freehand_line) { @@ -233,12 +239,14 @@ get_intermediatepoint(int x, int y, int shift) /* or the second point of a dimension line */ void -create_lineobject(int x, int y) +create_lineobject(int x, int y, unsigned int shift) { F_line *line; F_compound *comp; int dot; + (void)shift; + if (num_point == 0) { if ((first_point = create_point()) == NULL) { line_drawing_selected(); --- a/src/d_line.h +++ b/src/d_line.h @@ -22,8 +22,8 @@ #include extern void init_trace_drawing(int x, int y); -extern void create_lineobject(int x, int y); -extern void get_intermediatepoint(int x, int y, int shift); +extern void create_lineobject(int x, int y, unsigned int shift); +extern void get_intermediatepoint(int x, int y, unsigned int shift); extern void freehand_get_intermediatepoint(int x, int y); extern Boolean freehand_line; --- a/src/d_picobj.c +++ b/src/d_picobj.c @@ -38,9 +38,9 @@ /*************************** local declarations *********************/ -static void init_picobj_drawing(int x, int y); -static void create_picobj(int x, int y); -static void cancel_picobj(void); +static void init_picobj_drawing(int x, int y, unsigned int shift); +static void create_picobj(int x, int y, unsigned int shift); +static void cancel_picobj(int x, int y, unsigned int shift); @@ -51,34 +51,40 @@ picobj_drawing_selected(void) canvas_kbd_proc = null_proc; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_picobj_drawing; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; set_cursor(crosshair_cursor); reset_action_on(); } static void -init_picobj_drawing(int x, int y) +init_picobj_drawing(int x, int y, unsigned int shift) { - init_box_drawing(x, y); + init_box_drawing(x, y, shift); canvas_leftbut_proc = create_picobj; canvas_rightbut_proc = cancel_picobj; } static void -cancel_picobj(void) +cancel_picobj(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_box(fix_x, fix_y, cur_x, cur_y); picobj_drawing_selected(); draw_mousefun_canvas(); } static void -create_picobj(int x, int y) +create_picobj(int x, int y, unsigned int shift) { F_line *box; F_point *point; + (void)shift; + /* erase last lengths if appres.showlengths is true */ erase_lengths(); elastic_box(fix_x, fix_y, cur_x, cur_y); --- a/src/d_regpoly.c +++ b/src/d_regpoly.c @@ -37,9 +37,9 @@ /*************************** local declarations *********************/ -static void init_regpoly_drawing(int x, int y); -static void create_regpoly(int x, int y); -static void cancel_regpoly(void); +static void init_regpoly_drawing(int x, int y, unsigned int shift); +static void create_regpoly(int x, int y, unsigned int shift); +static void cancel_regpoly(int x, int y, unsigned int shift); @@ -50,15 +50,17 @@ regpoly_drawing_selected(void) canvas_kbd_proc = null_proc; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_regpoly_drawing; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; set_cursor(crosshair_cursor); reset_action_on(); } static void -init_regpoly_drawing(int x, int y) +init_regpoly_drawing(int x, int y, unsigned int shift) { + (void)shift; + cur_x = fix_x = x; cur_y = fix_y = y; work_numsides = cur_numsides; @@ -66,7 +68,7 @@ init_regpoly_drawing(int x, int y) draw_mousefun_canvas(); canvas_locmove_proc = resizing_poly; canvas_leftbut_proc = create_regpoly; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = cancel_regpoly; elastic_poly(fix_x, fix_y, cur_x, cur_y, work_numsides); set_cursor(null_cursor); @@ -74,8 +76,12 @@ init_regpoly_drawing(int x, int y) } static void -cancel_regpoly(void) +cancel_regpoly(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_poly(fix_x, fix_y, cur_x, cur_y, work_numsides); /* erase any length info if appres.showlengths is true */ erase_lengths(); @@ -84,7 +90,7 @@ cancel_regpoly(void) } static void -create_regpoly(int x, int y) +create_regpoly(int x, int y, unsigned int shift) { register float angle; register int nx, ny, i; @@ -93,6 +99,8 @@ create_regpoly(int x, int y) F_line *poly; F_point *point; + (void)shift; + elastic_poly(fix_x, fix_y, cur_x, cur_y, work_numsides); /* erase any length info if appres.showlengths is true */ erase_lengths(); --- a/src/d_spline.c +++ b/src/d_spline.c @@ -40,10 +40,10 @@ /*************************** local declarations *********************/ -static void init_spline_drawing(int x, int y); -static void create_splineobject(int x, int y); -static void init_spline_freehand_drawing(int x, int y); -static void init_spline_drawing2(int x, int y); +static void init_spline_drawing(int x, int y, unsigned int shift); +static void create_splineobject(int x, int y, unsigned int shift); +static void init_spline_freehand_drawing(int x, int y, unsigned int shift); +static void init_spline_drawing2(int x, int y, unsigned int shift); @@ -55,28 +55,30 @@ spline_drawing_selected(void) canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_spline_drawing; canvas_middlebut_proc = init_spline_freehand_drawing; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(crosshair_cursor); reset_action_on(); } static void -init_spline_freehand_drawing(int x, int y) +init_spline_freehand_drawing(int x, int y, unsigned int shift) { freehand_line = True; - init_spline_drawing2(x, y); + init_spline_drawing2(x, y, shift); } static void -init_spline_drawing(int x, int y) +init_spline_drawing(int x, int y, unsigned int shift) { freehand_line = False; - init_spline_drawing2(x, y); + init_spline_drawing2(x, y, shift); } static void -init_spline_drawing2(int x, int y) +init_spline_drawing2(int x, int y, unsigned int shift) { + (void)shift; + if ((cur_mode == F_APPROX_SPLINE) || (cur_mode == F_INTERP_SPLINE)) { min_num_points = OPEN_SPLINE_MIN_NUM_POINTS; init_trace_drawing(x, y); @@ -85,7 +87,7 @@ init_spline_drawing2(int x, int y) min_num_points = CLOSED_SPLINE_MIN_NUM_POINTS; init_trace_drawing(x, y); canvas_middlebut_save = create_splineobject; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; } return_proc = spline_drawing_selected; @@ -93,10 +95,12 @@ init_spline_drawing2(int x, int y) static void -create_splineobject(int x, int y) +create_splineobject(int x, int y, unsigned int shift) { F_spline *spline; + (void)shift; + if (x != fix_x || y != fix_y) get_intermediatepoint(x, y, 0); if (num_point < min_num_points) { /* too few points */ --- a/src/d_text.c +++ b/src/d_text.c @@ -120,8 +120,9 @@ static float work_angle; /* in RADIANS */ static void begin_utf8char(unsigned char *str, int *pos); static void end_utf8char(unsigned char *str, int *pos); -static void finish_n_start(int x, int y); -static void init_text_input(int x, int y), cancel_text_input(void); +static void finish_n_start(int x, int y, unsigned int shift); +static void init_text_input(int x, int y, unsigned int shift); +static void cancel_text_input(int x, int y, unsigned int shift); static F_text *new_text(int len, char *string); static void new_text_line(void); @@ -146,7 +147,9 @@ static void xim_set_spot(); static pid_t preedit_pid = -1; static char preedit_filename[PATH_MAX] = ""; -static void open_preedit_proc(), close_preedit_proc(), paste_preedit_proc(); +static void open_preedit_proc(int x, int y, unsigned int shift); +static void close_preedit_proc(int x, int y, unsigned int shift); +static void paste_preedit_proc(int x, int y, unsigned int shift); static Boolean is_preedit_running(); /********************************************************/ @@ -161,9 +164,9 @@ text_drawing_selected(void) { canvas_kbd_proc = null_proc; canvas_locmove_proc = null_proc; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; canvas_leftbut_proc = init_text_input; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_mousefun("position cursor", "", "", "", "", ""); if (appres.international && strlen(appres.text_preedit) != 0) { if (is_preedit_running()) { @@ -205,7 +208,7 @@ commit_current_text(void) } static void -finish_n_start(int x, int y) +finish_n_start(int x, int y, unsigned int shift) { reset_action_on(); terminate_char_handler(); @@ -214,11 +217,11 @@ finish_n_start(int x, int y) work_fontsize = cur_fontsize; supersub = 0; is_newline = False; - init_text_input(x, y); + init_text_input(x, y, shift); } void -finish_text_input(int x, int y, int shift) +finish_text_input(int x, int y, unsigned int shift) { (void)x; (void)y; @@ -238,8 +241,12 @@ finish_text_input(int x, int y, int shift) } static void -cancel_text_input(void) +cancel_text_input(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + int a,b,c,d, e,f,g,h; /* erase the current text */ text_bound(cur_t, &a, &b, &c, &d); @@ -447,11 +454,13 @@ overlay_text_input(int x, int y) } static void -init_text_input(int x, int y) +init_text_input(int x, int y, unsigned int shift) { int asc; int desc; + (void)shift; + cur_x = x; cur_y = y; @@ -809,7 +818,7 @@ char_handler(unsigned char *c, int clen, KeySym keysym) int i; if (clen == 1 && c[0] == ESC) { - cancel_text_input(); + cancel_text_input(0, 0, 0); } else if (clen == 1 && (c[0] == CR || c[0] == NL)) { new_text_line(); } else if (clen == 1 && c[0] == CTRL_UNDERSCORE) { @@ -1401,10 +1410,11 @@ kill_preedit(void) } static void -close_preedit_proc(int x, int y) +close_preedit_proc(int x, int y, unsigned int shift) { (void)x; (void)y; + (void)shift; if (is_preedit_running()) { kill_preedit(); @@ -1415,10 +1425,11 @@ close_preedit_proc(int x, int y) } static void -open_preedit_proc(int x, int y) +open_preedit_proc(int x, int y, unsigned int shift) { (void)x; (void)y; + (void)shift; int i; if (!is_preedit_running()) { @@ -1451,14 +1462,14 @@ open_preedit_proc(int x, int y) } static void -paste_preedit_proc(int x, int y) +paste_preedit_proc(int x, int y, unsigned int shift) { FILE *fp; int ch; if (!is_preedit_running()) { - open_preedit_proc(x, y); + open_preedit_proc(x, y, shift); } else if ((fp = fopen(preedit_filename, "r")) != NULL) { - init_text_input(x, y); + init_text_input(x, y, shift); while ((ch = getc(fp)) != EOF) { if (ch == '\\') new_text_line(); --- a/src/d_text.h +++ b/src/d_text.h @@ -29,7 +29,7 @@ extern int work_font; extern XFontStruct *canvas_font; extern void char_handler(unsigned char *c, int clen, KeySym keysym); -extern void finish_text_input(int x, int y, int shift); +extern void finish_text_input(int x, int y, unsigned int shift); extern XIC xim_ic; extern Boolean xim_active; --- a/src/e_addpt.c +++ b/src/e_addpt.c @@ -39,8 +39,8 @@ static void init_point_adding(F_line *p, int type, int x, int y, int px, int py); -static void fix_linepoint_adding(int x, int y); -static void fix_splinepoint_adding(int x, int y); +static void fix_linepoint_adding(int x, int y, unsigned int shift); +static void fix_splinepoint_adding(int x, int y, unsigned int shift); static void init_linepointadding(int px, int py); static void init_splinepointadding(int px, int py); @@ -55,8 +55,8 @@ point_adding_selected(void) canvas_ref_proc = null_proc; init_searchproc_left(init_point_adding); canvas_leftbut_proc = object_search_left; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; set_cursor(pick9_cursor); force_nopositioning(); force_anglegeom(); @@ -118,8 +118,12 @@ wrapup_pointadding(void) } static void -cancel_pointadding(void) +cancel_pointadding(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_linelink(); /* turn back on all relevant markers */ @@ -128,7 +132,7 @@ cancel_pointadding(void) } static void -cancel_line_pointadding(void) +cancel_line_pointadding(int x, int y, unsigned int shift) { canvas_ref_proc = canvas_locmove_proc = null_proc; if (left_point != NULL && right_point != NULL) @@ -136,7 +140,7 @@ cancel_line_pointadding(void) right_point->x, right_point->y, PAINT, cur_l->thickness, cur_l->style, cur_l->style_val, cur_l->pen_color); - cancel_pointadding(); + cancel_pointadding(x, y, shift); } /************************** spline *******************************/ @@ -164,10 +168,12 @@ init_splinepointadding(int px, int py) } static void -fix_splinepoint_adding(int x, int y) +fix_splinepoint_adding(int x, int y, unsigned int shift) { F_point *p; + (void)shift; + /* if this point is coincident with the point being added to, return */ if (((left_point == NULL) && (cur_x == cur_s->points[0].x) && (cur_y == cur_s->points[0].y)) || @@ -279,10 +285,12 @@ init_linepointadding(int px, int py) } static void -fix_linepoint_adding(int x, int y) +fix_linepoint_adding(int x, int y, unsigned int shift) { F_point *p; + (void)shift; + /* if this point is coincident with the point being added to, return */ if (((left_point == NULL) && (cur_x == cur_l->points[0].x) && (cur_y == cur_l->points[0].y)) || --- a/src/e_align.c +++ b/src/e_align.c @@ -75,7 +75,7 @@ align_selected(void) init_searchproc_left(init_align); canvas_leftbut_proc = object_search_left; canvas_middlebut_proc = init_align_canvas; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(pick15_cursor); reset_action_on(); } --- a/src/e_arrow.c +++ b/src/e_arrow.c @@ -57,7 +57,7 @@ arrow_head_selected(void) init_searchproc_middle(delete_arrow_head); canvas_leftbut_proc = point_search_left; canvas_middlebut_proc = point_search_middle; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(pick9_cursor); reset_action_on(); } --- a/src/e_break.c +++ b/src/e_break.c @@ -50,7 +50,7 @@ break_selected(void) init_searchproc_middle(init_break_tag); canvas_leftbut_proc = object_search_left; canvas_middlebut_proc = object_search_middle; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(pick15_cursor); reset_action_on(); } --- a/src/e_chop.c +++ b/src/e_chop.c @@ -46,7 +46,7 @@ static void select_axe_object(); static void select_log_object(); -static void clear_axe_objects(); +static void clear_axe_objects(int x, int y, unsigned shift); typedef struct { void * object; @@ -140,9 +140,9 @@ select_axe_object(void *obj, int type, int x, int y, F_point *p, F_point * q) } static void -clear_axe_objects(void *obj, int type, int x, int y, F_point *p, F_point * q) +clear_axe_objects(int x, int y, unsigned shift) { - (void)obj; (void)type; (void)x; (void)y; (void)p; (void)q; + (void)x; (void)y; (void)shift; put_msg("Axe object list cleared."); axe_objects_next = 0; --- a/src/e_compound.c +++ b/src/e_compound.c @@ -133,7 +133,7 @@ open_compound_selected(void) init_searchproc_middle(init_open_compound_vis); canvas_leftbut_proc = object_search_left; canvas_middlebut_proc = object_search_middle; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(pick15_cursor); reset_action_on(); } --- a/src/e_convert.c +++ b/src/e_convert.c @@ -58,7 +58,7 @@ convert_selected(void) init_searchproc_left(init_convert_line_spline); init_searchproc_right(init_convert_open_closed); canvas_leftbut_proc = object_search_left; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = point_search_right; set_cursor(pick15_cursor); reset_action_on(); --- a/src/e_delete.c +++ b/src/e_delete.c @@ -53,7 +53,9 @@ static void init_delete(F_line *p, int type, int x, int y, int px, int py); -static void init_delete_region(int x, int y), delete_region(int x, int y), cancel_delete_region(void); +static void init_delete_region(int x, int y, unsigned int shift); +static void delete_region(int x, int y, unsigned int shift); +static void cancel_delete_region(int x, int y, unsigned int shift); static void init_delete_to_scrap(F_line *p, int type, int x, int y, int px, int py); @@ -117,19 +119,23 @@ init_delete(F_line *p, int type, int x, int y, int px, int py) } static void -init_delete_region(int x, int y) +init_delete_region(int x, int y, unsigned int shift) { - init_box_drawing(x, y); + init_box_drawing(x, y, shift); set_mousefun("", "final corner", "cancel", "", "", ""); draw_mousefun_canvas(); - canvas_leftbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = delete_region; canvas_rightbut_proc = cancel_delete_region; } static void -cancel_delete_region(void) +cancel_delete_region(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -138,10 +144,12 @@ cancel_delete_region(void) } static void -delete_region(int x, int y) +delete_region(int x, int y, unsigned int shift) { F_compound *c; + (void)shift; + if ((c = create_compound()) == NULL) return; --- a/src/e_deletept.c +++ b/src/e_deletept.c @@ -50,8 +50,8 @@ delete_point_selected(void) canvas_ref_proc = null_proc; init_searchproc_left(init_delete_point); canvas_leftbut_proc = point_search_left; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; set_cursor(pick9_cursor); reset_action_on(); } --- a/src/e_flip.c +++ b/src/e_flip.c @@ -51,7 +51,7 @@ static int copy; static void init_flip(F_line *p, int type, int x, int y, int px, int py); static void init_copynflip(F_line *p, int type, int x,int y, int px,int py); -static void set_unset_anchor(int x, int y); +static void set_unset_anchor(int x, int y, unsigned int shift); static void init_fliparc(F_arc *old_a, int px, int py); static void init_flipcompound(F_compound *old_c, int px, int py); static void init_flipellipse(F_ellipse *old_e, int px, int py); @@ -114,8 +114,10 @@ flip_selected(void) } static void -set_unset_anchor(int x, int y) +set_unset_anchor(int x, int y, unsigned int shift) { + (void)shift; + if (setanchor) { set_mousefun("flip", "copy & flip", "set anchor", LOC_OBJ, LOC_OBJ, "set anchor"); --- a/src/e_glue.c +++ b/src/e_glue.c @@ -41,10 +41,10 @@ #include "xfig_math.h" -static void create_compoundobject(int x, int y); -static void cancel_tag_region(void); -static void init_tag_region(int x, int y); -static void tag_region(int x, int y); +static void create_compoundobject(int x, int y, unsigned int shift); +static void cancel_tag_region(int x, int y, unsigned int shift); +static void init_tag_region(int x, int y, unsigned int shift); +static void tag_region(int x, int y, unsigned int shift); static void tag_object(F_line *p, int type, int x, int y, int px, int py); static void get_arc(F_arc **list); static void sel_arc(int xmin, int ymin, int xmax, int ymax); @@ -118,19 +118,23 @@ tag_object(F_line *p, int type, int x, int y, int px, int py) } static void -init_tag_region(int x, int y) +init_tag_region(int x, int y, unsigned int shift) { - init_box_drawing(x, y); + init_box_drawing(x, y, shift); set_mousefun("", "final corner", "cancel", "", "", ""); draw_mousefun_canvas(); - canvas_leftbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = tag_region; canvas_rightbut_proc = cancel_tag_region; } static void -cancel_tag_region(void) +cancel_tag_region(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_box_lengths(); @@ -139,10 +143,12 @@ cancel_tag_region(void) } static void -tag_region(int x, int y) +tag_region(int x, int y, unsigned int shift) { int xmin, ymin, xmax, ymax; + (void)shift; + elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_box_lengths(); @@ -156,9 +162,9 @@ tag_region(int x, int y) } static void -create_compoundobject(int x, int y) +create_compoundobject(int x, int y, unsigned int shift) { - (void)x; (void)y; + (void)x; (void)y; (void)shift; F_compound *c; if ((c = create_compound()) == NULL) --- a/src/e_joinsplit.c +++ b/src/e_joinsplit.c @@ -50,7 +50,7 @@ static void join_splines(F_spline *spline, F_point *prev_point, F_point *selected_point); static void split_line(int px, int py); static void split_spline(int px, int py); -static void cancel_join(void); +static void cancel_join(int x, int y, unsigned int shift); static void join_line2(F_line *obj, int type, int x, int y, F_point *p, F_point *q); static void join_spline2(F_line *obj, int type, int x, int y, F_point *p, @@ -80,7 +80,7 @@ join_split_selected(void) init_searchproc_middle(init_split); canvas_leftbut_proc = point_search_left; /* point search for join */ canvas_middlebut_proc = object_search_middle; /* object search for split */ - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(pick9_cursor); /* set the markers to show we only allow POLYLINES and open SPLINES */ /* (the markers are originally set this way from the mode panel, but @@ -150,7 +150,7 @@ join_lines(F_line *line, F_point *prev_point, F_point *selected_point) return; init_searchproc_left(join_line2); canvas_leftbut_proc = point_search_left; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = cancel_join; line1 = line; sel_point = selected_point; @@ -176,7 +176,7 @@ join_splines(F_spline *spline, F_point *prev_point, F_point *selected_point) return; init_searchproc_left(join_spline2); canvas_leftbut_proc = point_search_left; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = cancel_join; /* save pointer to first line and its points */ spline1 = spline; @@ -214,8 +214,12 @@ void erase_join_marker(F_point *point) static void -cancel_join(void) +cancel_join(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + join_split_selected(); /* erase any marker */ erase_join_marker(sel_point); --- a/src/e_measure.c +++ b/src/e_measure.c @@ -43,13 +43,13 @@ static void init_anglemeas_object(char *p, int type, int x, int y, F_point *pp, F_point *pq); static void init_anglemeas_object_m(char *p, int type, int x, int y, F_point *pp, F_point *pq); static void init_anglemeas_object_r(char *p, int type, int x, int y, F_point *pp, F_point *pq); -static void init_anglemeas_threepoints(int px, int py); +static void init_anglemeas_threepoints(int px, int py, unsigned int shift); -static void anglemeas_second(int x, int y); +static void anglemeas_second(int x, int y, unsigned int shift); static void anglemeas_third(int x, int y); -static void anglemeas_third_l(int x, int y); -static void anglemeas_third_m(int x, int y); -static void cancel_anglemeas(void); +static void anglemeas_third_l(int x, int y, unsigned int shift); +static void anglemeas_third_m(int x, int y, unsigned int shift); +static void cancel_anglemeas(int x, int y, unsigned int shift); static void anglemeas_line(F_line *l, F_point *p); static void anglemeas_arc(F_arc *a); static void angle_msg(double value, char *msgtext); @@ -58,12 +58,12 @@ static void angle_save(double value); static void init_lenmeas_object(char *p, int type, int x, int y, int px, int py); static void init_lenmeas_object_l(char *p, int type, int x, int y, int px, int py); static void init_lenmeas_object_m(char *p, int type, int x, int y, int px, int py); -static void clear_lenmeas_memory(void); +static void clear_lenmeas_memory(int x, int y, unsigned int shift); static void init_areameas_object(char *p, int type, int x, int y, int px, int py); static void init_areameas_object_l(char *p, int type, int x, int y, int px, int py); static void init_areameas_object_m(char *p, int type, int x, int y, int px, int py); -static void clear_areameas_memory(int x, int y, int arg); +static void clear_areameas_memory(int x, int y, unsigned int shift); static void freehand_line_nomsg(int x, int y); @@ -190,8 +190,10 @@ anglemeas_arc(F_arc *a) /* THREE-POINT ANGLE MEASURING */ static void -init_anglemeas_threepoints(int px, int py) +init_anglemeas_threepoints(int px, int py, unsigned int shift) { + (void)shift; + set_cursor(arrow_cursor); set_mousefun("angle tip", "", "cancel", "", "", LOC_OBJ); draw_mousefun_canvas(); @@ -202,7 +204,7 @@ init_anglemeas_threepoints(int px, int py) canvas_locmove_proc = freehand_line_nomsg; canvas_ref_proc = elastic_line; canvas_leftbut_proc = anglemeas_second; - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; elastic_line(); set_temp_cursor(null_cursor); save_objmask = cur_objmask; @@ -211,8 +213,10 @@ init_anglemeas_threepoints(int px, int py) } static void -anglemeas_second(int x, int y) +anglemeas_second(int x, int y, unsigned int shift) { + (void)shift; + if (x == fix_x && y == fix_y) return; if (np == 1) { /* should always be! */ @@ -232,15 +236,19 @@ anglemeas_second(int x, int y) } static void -anglemeas_third_l(int x, int y) +anglemeas_third_l(int x, int y, unsigned int shift) { + (void)shift; + save_rotnangle = 0; anglemeas_third(x, y); } static void -anglemeas_third_m(int x, int y) +anglemeas_third_m(int x, int y, unsigned int shift) { + (void)shift; + save_rotnangle = 1; anglemeas_third(x, y); } @@ -272,8 +280,12 @@ anglemeas_third(int x, int y) } static void -cancel_anglemeas(void) +cancel_anglemeas(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_line(); if (np == 2) { /* erase initial part of line */ @@ -397,8 +409,12 @@ init_lenmeas_object_m(char *p, int type, int x, int y, int px, int py) } static void -clear_lenmeas_memory(void) +clear_lenmeas_memory(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + total_len = 0.0; put_msg("length reset to 0"); } @@ -501,12 +517,12 @@ init_areameas_object_m(char *p, int type, int x, int y, int px, int py) } static void -clear_areameas_memory(int x, int y, int arg) +clear_areameas_memory(int x, int y, unsigned int shift) { (void)x; (void)y; total_area = 0.0; - signed_area = (arg != 0); + signed_area = (shift != 0); if (signed_area) put_msg("signed area reset to 0"); else --- a/src/e_move.c +++ b/src/e_move.c @@ -48,7 +48,7 @@ move_selected(void) init_searchproc_middle(init_constrained_move); canvas_leftbut_proc = object_search_left; canvas_middlebut_proc = object_search_middle; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; return_proc = move_selected; set_cursor(pick9_cursor); reset_action_on(); @@ -59,7 +59,7 @@ init_arb_move(F_line *p, int type, int x, int y, int px, int py) { constrained = MOVE_ARB; init_move(p, type, x, y, px, py); - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; set_mousefun("place object", "", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); } @@ -70,7 +70,7 @@ init_constrained_move(F_line *p, int type, int x, int y, int px, int py) constrained = MOVE_HORIZ_VERT; init_move(p, type, x, y, px, py); canvas_middlebut_proc = canvas_leftbut_proc; - canvas_leftbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; set_mousefun("", "place object", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); } --- a/src/e_movept.c +++ b/src/e_movept.c @@ -46,8 +46,8 @@ static F_point *moved_point; -static void fix_movedcompoundpoint(int x, int y); -static void cancel_compound(void); +static void fix_movedcompoundpoint(int x, int y, unsigned int shift); +static void cancel_compound(int x, int y, unsigned int shift); static Boolean init_ellipsepointmoving(void); static void init_arcpointmoving(void); @@ -64,17 +64,17 @@ static Boolean init_move_point(F_line *obj, int type, int x, int y, F_point *p, static void init_arb_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q, int pnum); static void init_stretch_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q, int pnum); -static void fix_movedarcpoint(int x, int y); -static void fix_movedellipsepoint(int x, int y); -static void fix_movedsplinepoint(int x, int y); -static void fix_box(int x, int y); -static void fix_movedlinepoint(int x, int y); +static void fix_movedarcpoint(int x, int y, unsigned int shift); +static void fix_movedellipsepoint(int x, int y, unsigned int shift); +static void fix_movedsplinepoint(int x, int y, unsigned int shift); +static void fix_box(int x, int y, unsigned int shift); +static void fix_movedlinepoint(int x, int y, unsigned int shift); -static void cancel_movedarcpoint(void); -static void cancel_movedellipsepoint(void); -static void cancel_movedsplinepoint(void); -static void cancel_movept_box(void); -static void cancel_movedlinepoint(void); +static void cancel_movedarcpoint(int x, int y, unsigned int shift); +static void cancel_movedellipsepoint(int x, int y, unsigned int shift); +static void cancel_movedsplinepoint(int x, int y, unsigned int shift); +static void cancel_movept_box(int x, int y, unsigned int shift); +static void cancel_movedlinepoint(int x, int y, unsigned int shift); void move_point_selected(void) @@ -87,7 +87,7 @@ void move_point_selected(void) init_searchproc_middle(init_stretch_move_point); canvas_leftbut_proc = point_search_left; canvas_middlebut_proc = point_search_middle; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(pick9_cursor); force_anglegeom(); reset_action_on(); @@ -101,7 +101,7 @@ init_arb_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q, return; set_mousefun("new posn", "", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; } static void @@ -113,7 +113,7 @@ init_stretch_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point set_mousefun("", "new posn", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); canvas_middlebut_proc = canvas_leftbut_proc; - canvas_leftbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; } static Boolean @@ -243,8 +243,12 @@ init_ellipsepointmoving(void) } static void -cancel_movedellipsepoint(void) +cancel_movedellipsepoint(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; /* erase elastic version */ switch (cur_e->type) { @@ -269,8 +273,10 @@ cancel_movedellipsepoint(void) } static void -fix_movedellipsepoint(int x, int y) +fix_movedellipsepoint(int x, int y, unsigned int shift) { + (void)shift; + switch (cur_e->type) { case T_ELLIPSE_BY_RAD: elastic_ebr(); @@ -377,8 +383,12 @@ init_arcpointmoving(void) } static void -cancel_movedarcpoint(void) +cancel_movedarcpoint(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_arclink(); /* erase last lengths if appres.showlengths is true */ @@ -389,8 +399,10 @@ cancel_movedarcpoint(void) } static void -fix_movedarcpoint(int x, int y) +fix_movedarcpoint(int x, int y, unsigned int shift) { + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_arclink(); /* erase last lengths if appres.showlengths is true */ @@ -501,8 +513,12 @@ init_splinepointmoving(void) } static void -cancel_movedsplinepoint(void) +cancel_movedsplinepoint(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_linelink(); /* erase last lengths if appres.showlengths is true */ @@ -513,8 +529,10 @@ cancel_movedsplinepoint(void) } static void -fix_movedsplinepoint(int x, int y) +fix_movedsplinepoint(int x, int y, unsigned int shift) { + (void)shift; + (*canvas_locmove_proc) (x, y); canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_linelink(); @@ -594,8 +612,12 @@ init_compoundpointmoving(void) } static void -cancel_compound(void) +cancel_compound(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ @@ -606,10 +628,12 @@ cancel_compound(void) } static void -fix_movedcompoundpoint(int x, int y) +fix_movedcompoundpoint(int x, int y, unsigned int shift) { float scalex, scaley; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ @@ -732,8 +756,12 @@ init_linepointmoving(void) } static void -cancel_movept_box(void) +cancel_movept_box(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; /* erase the elastic box */ elastic_box(fix_x, fix_y, cur_x, cur_y); @@ -747,8 +775,10 @@ cancel_movept_box(void) } static void -fix_box(int x, int y) +fix_box(int x, int y, unsigned int shift) { + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ @@ -805,8 +835,12 @@ assign_newboxpoint(F_line *b, int x1, int y1, int x2, int y2) } static void -cancel_movedlinepoint(void) +cancel_movedlinepoint(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; /* erase the elastic line */ elastic_linelink(); @@ -820,8 +854,10 @@ cancel_movedlinepoint(void) } static void -fix_movedlinepoint(int x, int y) +fix_movedlinepoint(int x, int y, unsigned int shift) { + (void)shift; + (*canvas_locmove_proc) (x, y); canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_linelink(); --- a/src/e_placelib.c +++ b/src/e_placelib.c @@ -62,7 +62,7 @@ static void change_draw_mode(int x, int y); static void transform_lib_obj(unsigned char *c, int clen, KeySym keysym); static void place_lib_object(int x, int y, unsigned int shift); static void put_draw(int paint_mode); -static void sel_place_lib_obj_proc(int x, int y, int shift); +static void sel_place_lib_obj_proc(int x, int y, unsigned int shift); static int orig_put_x, orig_put_y; @@ -149,7 +149,7 @@ transform_lib_obj(unsigned char *c, int clen, KeySym keysym) } static void -sel_place_lib_obj_proc(int x, int y, int shift) +sel_place_lib_obj_proc(int x, int y, unsigned int shift) { /* if shift-left button, change drawing mode */ if (shift) { @@ -166,9 +166,9 @@ sel_place_lib_obj(void) canvas_kbd_proc = (void (*)())transform_lib_obj; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; /* erase any object currently being dragged around the canvas */ if (lib_compounds && action_on && new_c) @@ -242,9 +242,9 @@ place_lib_object(int x, int y, unsigned int shift) (void)y; F_compound *this_c; - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; put_draw(ERASE); @@ -312,7 +312,7 @@ init_move_object(int x, int y) /* cancel placing a library object */ void -cancel_place_lib_obj(int x, int y, int shift) +cancel_place_lib_obj(int x, int y, unsigned int shift) { /* if shift right-button, actually do a place in original position */ if (shift) { @@ -320,9 +320,9 @@ cancel_place_lib_obj(int x, int y, int shift) return; } reset_action_on(); - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; canvas_kbd_proc = null_proc; --- a/src/e_placelib.h +++ b/src/e_placelib.h @@ -20,6 +20,6 @@ extern int cur_library_object; extern int old_library_object; -extern void cancel_place_lib_obj(int x, int y, int shift); +extern void cancel_place_lib_obj(int x, int y, unsigned int shift); extern void sel_place_lib_obj(void); extern void put_selected (void); --- a/src/e_rotate.c +++ b/src/e_rotate.c @@ -55,7 +55,7 @@ float act_rotnangle; static int copy; static void init_rotate(F_line *p, int type, int x, int y, int px, int py); -static void set_unset_center(int x, int y); +static void set_unset_center(int x, int y, unsigned int shift); static void init_copynrotate(F_line *p, int type, int x,int y,int px,int py); static void rotate_selected(void); static void rotate_search(F_line *p, int type, int x, int y, int px, int py); @@ -122,8 +122,10 @@ rotate_selected(void) } static void -set_unset_center(int x, int y) +set_unset_center(int x, int y, unsigned int shift) { + (void)shift; + if (setcenter) { set_mousefun("rotate object", "copy & rotate", "set center", LOC_OBJ, LOC_OBJ, "set center"); --- a/src/e_scale.c +++ b/src/e_scale.c @@ -80,23 +80,23 @@ static void rescale_points(F_line *obj, int x, int y); static void relocate_ellipsepoint(F_ellipse *ellipse, int x, int y); static void relocate_arcpoint(F_arc *arc, int x, int y); -static void fix_scale_arc(int x, int y); -static void fix_scale_spline(int x, int y); -static void fix_scale_line(int x, int y); -static void fix_scale_ellipse(int x, int y); -static void fix_boxscale_ellipse(int x, int y); -static void fix_boxscale_line(int x, int y); -static void fix_scale_compound(int x, int y); -static void fix_boxscale_compound(int x, int y); - -static void cancel_scale_arc(void); -static void cancel_scale_spline(void); -static void cancel_scale_line(void); -static void cancel_scale_ellipse(void); -static void cancel_boxscale_ellipse(void); -static void cancel_boxscale_line(void); -static void cancel_scale_compound(void); -static void cancel_boxscale_compound(void); +static void fix_scale_arc(int x, int y, unsigned int shift); +static void fix_scale_spline(int x, int y, unsigned int shift); +static void fix_scale_line(int x, int y, unsigned int shift); +static void fix_scale_ellipse(int x, int y, unsigned int shift); +static void fix_boxscale_ellipse(int x, int y, unsigned int shift); +static void fix_boxscale_line(int x, int y, unsigned int shift); +static void fix_scale_compound(int x, int y, unsigned int shift); +static void fix_boxscale_compound(int x, int y, unsigned int shift); + +static void cancel_scale_arc(int x, int y, unsigned int shift); +static void cancel_scale_spline(int x, int y, unsigned int shift); +static void cancel_scale_line(int x, int y, unsigned int shift); +static void cancel_scale_ellipse(int x, int y, unsigned int shift); +static void cancel_boxscale_ellipse(int x, int y, unsigned int shift); +static void cancel_boxscale_line(int x, int y, unsigned int shift); +static void cancel_scale_compound(int x, int y, unsigned int shift); +static void cancel_boxscale_compound(int x, int y, unsigned int shift); static void prescale_compound(F_compound *c, int x, int y); @@ -112,7 +112,7 @@ scale_selected(void) init_searchproc_middle(init_center_scale); canvas_leftbut_proc = object_search_left; canvas_middlebut_proc = object_search_middle; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(pick15_cursor); reset_action_on(); } @@ -149,7 +149,7 @@ init_box_scale(F_line *obj, int type, int x, int y, int px, int py) } set_mousefun("new posn", "", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); - canvas_middlebut_proc = null_proc; + canvas_middlebut_proc = null_proc_button; } static void @@ -197,7 +197,7 @@ init_center_scale(F_line *obj, int type, int x, int y, int px, int py) set_mousefun("", "new posn", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); - canvas_leftbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; } static void @@ -268,8 +268,12 @@ init_boxscale_ellipse(int x, int y) } static void -cancel_boxscale_ellipse(void) +cancel_boxscale_ellipse(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; if ((cur_e->type == T_CIRCLE_BY_DIA) || (cur_e->type == T_CIRCLE_BY_RAD)) @@ -281,8 +285,10 @@ cancel_boxscale_ellipse(void) } static void -fix_boxscale_ellipse(int x, int y) +fix_boxscale_ellipse(int x, int y, unsigned int shift) { + (void)shift; + if ((cur_e->type == T_CIRCLE_BY_DIA) || (cur_e->type == T_CIRCLE_BY_RAD)) elastic_cbd(); @@ -373,8 +379,12 @@ init_scale_ellipse(void) } static void -cancel_scale_ellipse(void) +cancel_scale_ellipse(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_scaleellipse(cur_e); toggle_ellipsemarker(cur_e); @@ -382,8 +392,10 @@ cancel_scale_ellipse(void) } static void -fix_scale_ellipse(int x, int y) +fix_scale_ellipse(int x, int y, unsigned int shift) { + (void)shift; + elastic_scaleellipse(cur_e); adjust_box_pos(x, y, from_x, from_y, &cur_x, &cur_y); new_e = copy_ellipse(cur_e); @@ -445,8 +457,12 @@ init_scale_arc(void) } static void -cancel_scale_arc(void) +cancel_scale_arc(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_scalearc(cur_a); /* erase last lengths if appres.showlengths is true */ @@ -456,11 +472,13 @@ cancel_scale_arc(void) } static void -fix_scale_arc(int x, int y) +fix_scale_arc(int x, int y, unsigned int shift) { double newx, newy, oldx, oldy; double newd, oldd, scalefact; + (void)shift; + elastic_scalearc(cur_a); adjust_box_pos(x, y, from_x, from_y, &x, &y); @@ -560,8 +578,12 @@ init_scale_spline(void) } static void -cancel_scale_spline(void) +cancel_scale_spline(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_scalepts(cur_s->points); toggle_splinemarker(cur_s); @@ -569,8 +591,10 @@ cancel_scale_spline(void) } static void -fix_scale_spline(int x, int y) +fix_scale_spline(int x, int y, unsigned int shift) { + (void)shift; + elastic_scalepts(cur_s->points); canvas_ref_proc = null_proc; adjust_box_pos(x, y, from_x, from_y, &x, &y); @@ -679,8 +703,12 @@ init_boxscale_compound(int x, int y) } static void -cancel_boxscale_compound(void) +cancel_boxscale_compound(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ @@ -690,10 +718,12 @@ cancel_boxscale_compound(void) } static void -fix_boxscale_compound(int x, int y) +fix_boxscale_compound(int x, int y, unsigned int shift) { double scalex, scaley; + (void)shift; + elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -726,8 +756,12 @@ init_scale_compound(void) } static void -cancel_scale_compound(void) +cancel_scale_compound(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_scalecompound(cur_c); /* erase last lengths if appres.showlengths is true */ @@ -737,8 +771,10 @@ cancel_scale_compound(void) } static void -fix_scale_compound(int x, int y) +fix_scale_compound(int x, int y, unsigned int shift) { + (void)shift; + elastic_scalecompound(cur_c); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -1295,8 +1331,12 @@ init_boxscale_line(int x, int y) } static void -cancel_boxscale_line(void) +cancel_boxscale_line(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ @@ -1306,10 +1346,12 @@ cancel_boxscale_line(void) } static void -fix_boxscale_line(int x, int y) +fix_boxscale_line(int x, int y, unsigned int shift) { int owd,oht, nwd, nht; + (void)shift; + elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -1393,8 +1435,12 @@ init_scale_line(void) } static void -cancel_scale_line(void) +cancel_scale_line(int x, int y, unsigned shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_scalepts(cur_l->points); /* erase last lengths if appres.showlengths is true */ @@ -1404,10 +1450,12 @@ cancel_scale_line(void) } static void -fix_scale_line(int x, int y) +fix_scale_line(int x, int y, unsigned int shift) { int owd,oht, nwd, nht; + (void)shift; + elastic_scalepts(cur_l->points); /* erase last lengths if appres.showlengths is true */ erase_lengths(); --- a/src/e_tangent.c +++ b/src/e_tangent.c @@ -56,7 +56,7 @@ tangent_selected(void) init_smart_searchproc_middle(init_normal_adding); canvas_leftbut_proc = smart_object_search_left; canvas_middlebut_proc = smart_object_search_middle; - canvas_rightbut_proc = smart_null_proc; + canvas_rightbut_proc = smart_null_proc_button; set_cursor(pick9_cursor); /* force_nopositioning(); */ reset_action_on(); --- a/src/e_update.c +++ b/src/e_update.c @@ -100,7 +100,7 @@ update_selected(void) init_searchproc_middle(init_update_settings); canvas_leftbut_proc = object_search_left; canvas_middlebut_proc = object_search_middle; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(pick9_cursor); /* manage on the update buttons */ manage_update_buts(); --- a/src/u_drag.c +++ b/src/u_drag.c @@ -37,12 +37,12 @@ #include "w_msgpanel.h" -static void array_place_line(int x, int y), place_line(int x, int y), place_line_x(int x, int y), cancel_line(void); -static void array_place_arc(int x, int y), place_arc(int x, int y), place_arc_x(int x, int y), cancel_drag_arc(void); -static void array_place_spline(int x, int y), place_spline(int x, int y), place_spline_x(int x, int y), cancel_spline(void); -static void array_place_ellipse(int x, int y), place_ellipse(int x, int y), place_ellipse_x(int x, int y), cancel_ellipse(void); -static void array_place_text(int x, int y), place_text(int x, int y), place_text_x(int x, int y), cancel_text(void); -static void array_place_compound(int x, int y), place_compound(int x, int y), place_compound_x(int x, int y), cancel_drag_compound(void); +static void array_place_line(int x, int y, unsigned int shift), place_line(int x, int y, unsigned int shift), place_line_x(int x, int y), cancel_line(int x, int y, unsigned int shift); +static void array_place_arc(int x, int y, unsigned int shift), place_arc(int x, int y, unsigned int shift), place_arc_x(int x, int y), cancel_drag_arc(int x, int y, unsigned int shift); +static void array_place_spline(int x, int y, unsigned int shift), place_spline(int x, int y, unsigned int shift), place_spline_x(int x, int y), cancel_spline(int x, int y, unsigned int shift); +static void array_place_ellipse(int x, int y, unsigned int shift), place_ellipse(int x, int y, unsigned int shift), place_ellipse_x(int x, int y), cancel_ellipse(int x, int y, unsigned int shift); +static void array_place_text(int x, int y, unsigned int shift), place_text(int x, int y, unsigned int shift), place_text_x(int x, int y), cancel_text(int x, int y, unsigned int shift); +static void array_place_compound(int x, int y, unsigned int shift), place_compound(int x, int y, unsigned int shift), place_compound_x(int x, int y), cancel_drag_compound(int x, int y, unsigned int shift); /***************************** ellipse section ************************/ @@ -69,8 +69,12 @@ init_ellipsedragging(F_ellipse *e, int x, int y) } static void -cancel_ellipse(void) +cancel_ellipse(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_moveellipse(); /* erase last lengths if appres.showlengths is true */ @@ -88,7 +92,7 @@ cancel_ellipse(void) } static void -array_place_ellipse(int x, int y) +array_place_ellipse(int x, int y, unsigned int shift) { int i, j, delta_x, delta_y, start_x, start_y; int nx, ny; @@ -102,7 +106,7 @@ array_place_ellipse(int x, int y) save_ellipse = new_e; if ((!cur_numxcopies) && (!cur_numycopies)) { - place_ellipse(x, y); + place_ellipse(x, y, shift); } else { delta_x = cur_x - fix_x; @@ -143,8 +147,10 @@ array_place_ellipse(int x, int y) } static void -place_ellipse(int x, int y) +place_ellipse(int x, int y, unsigned int shift) { + (void)shift; + elastic_moveellipse(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -154,9 +160,9 @@ place_ellipse(int x, int y) static void place_ellipse_x(int x, int y) { - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; adjust_pos(x, y, fix_x, fix_y, &x, &y); @@ -197,8 +203,12 @@ init_arcdragging(F_arc *a, int x, int y) } static void -cancel_drag_arc(void) +cancel_drag_arc(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_movearc(new_a); /* erase last lengths if appres.showlengths is true */ @@ -216,7 +226,7 @@ cancel_drag_arc(void) } static void -array_place_arc(int x, int y) +array_place_arc(int x, int y, unsigned int shift) { int i, j, delta_x, delta_y, start_x, start_y; int nx, ny; @@ -230,7 +240,7 @@ array_place_arc(int x, int y) save_arc = new_a; if ((!cur_numxcopies) && (!cur_numycopies)) { - place_arc(x, y); + place_arc(x, y, shift); } else { delta_x = cur_x - fix_x; delta_y = cur_y - fix_y; @@ -270,8 +280,10 @@ array_place_arc(int x, int y) } static void -place_arc(int x, int y) +place_arc(int x, int y, unsigned int shift) { + (void)shift; + elastic_movearc(new_a); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -281,9 +293,9 @@ place_arc(int x, int y) static void place_arc_x(int x, int y) { - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; adjust_pos(x, y, fix_x, fix_y, &x, &y); @@ -330,8 +342,12 @@ init_linedragging(F_line *l, int x, int y) } static void -cancel_line(void) +cancel_line(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_moveline(new_l->points); /* erase last lengths if appres.showlengths is true */ @@ -350,7 +366,7 @@ cancel_line(void) } static void -array_place_line(int x, int y) +array_place_line(int x, int y, unsigned int shift) { int i, j, delta_x, delta_y, start_x, start_y; int nx, ny; @@ -362,7 +378,7 @@ array_place_line(int x, int y) tail(&objects, &object_tails); save_line = new_l; if ((cur_numxcopies==0) && (cur_numycopies==0)) { - place_line(x, y); + place_line(x, y, shift); } else { delta_x = cur_x - fix_x; delta_y = cur_y - fix_y; @@ -402,8 +418,10 @@ array_place_line(int x, int y) } static void -place_line(int x, int y) +place_line(int x, int y, unsigned int shift) { + (void)shift; + elastic_moveline(new_l->points); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -414,9 +432,9 @@ static void place_line_x(int x, int y) { int dx, dy; - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; adjust_pos(x, y, fix_x, fix_y, &x, &y); @@ -479,7 +497,7 @@ init_textdragging(F_text *t, int x, int y) } static void -array_place_text(int x, int y) +array_place_text(int x, int y, unsigned int shift) { int i, j, delta_x, delta_y, start_x, start_y; int nx, ny; @@ -493,7 +511,7 @@ array_place_text(int x, int y) save_text = new_t; if ((!cur_numxcopies) && (!cur_numycopies)) { - place_text(x, y); + place_text(x, y, shift); } else { delta_x = cur_x - fix_x; delta_y = cur_y - fix_y; @@ -533,8 +551,12 @@ array_place_text(int x, int y) } static void -cancel_text(void) +cancel_text(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; /* move the text back to the original position, to clear the text at the last position it was dragged to */ @@ -554,8 +576,10 @@ cancel_text(void) } static void -place_text(int x, int y) +place_text(int x, int y, unsigned int shift) { + (void)shift; + elastic_movetext(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -565,9 +589,9 @@ place_text(int x, int y) static void place_text_x(int x, int y) { - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; adjust_pos(x, y, fix_x, fix_y, &x, &y); @@ -608,8 +632,12 @@ init_splinedragging(F_spline *s, int x, int y) } static void -cancel_spline(void) +cancel_spline(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_moveline(new_s->points); /* erase last lengths if appres.showlengths is true */ @@ -627,7 +655,7 @@ cancel_spline(void) } static void -array_place_spline(int x, int y) +array_place_spline(int x, int y, unsigned int shift) { int i, j, delta_x, delta_y, start_x, start_y; int nx, ny; @@ -641,7 +669,7 @@ array_place_spline(int x, int y) save_spline = new_s; if ((!cur_numxcopies) && (!cur_numycopies)) { - place_spline(x, y); + place_spline(x, y, shift); } else { delta_x = cur_x - fix_x; delta_y = cur_y - fix_y; @@ -681,8 +709,10 @@ array_place_spline(int x, int y) } static void -place_spline(int x, int y) +place_spline(int x, int y, unsigned int shift) { + (void)shift; + elastic_moveline(new_s->points); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -692,9 +722,9 @@ place_spline(int x, int y) static void place_spline_x(int x, int y) { - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; adjust_pos(x, y, fix_x, fix_y, &x, &y); @@ -740,8 +770,12 @@ init_compounddragging(F_compound *c, int x, int y) } static void -cancel_drag_compound(void) +cancel_drag_compound(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_movebox(); /* erase last lengths if appres.showlengths is true */ @@ -760,7 +794,7 @@ cancel_drag_compound(void) } static void -array_place_compound(int x, int y) +array_place_compound(int x, int y, unsigned int shift) { int i, j, delta_x, delta_y, start_x, start_y; int nx, ny; @@ -774,7 +808,7 @@ array_place_compound(int x, int y) save_compound = new_c; if ((!cur_numxcopies) && (!cur_numycopies)) { - place_compound(x, y); + place_compound(x, y, shift); } else { delta_x = cur_x - fix_x; delta_y = cur_y - fix_y; @@ -814,8 +848,9 @@ array_place_compound(int x, int y) } static void -place_compound(int x, int y) +place_compound(int x, int y, unsigned int shift) { + (void)shift; elastic_movebox(); /* erase last lengths if appres.showlengths is true */ @@ -828,9 +863,9 @@ place_compound_x(int x, int y) { int dx, dy; - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; adjust_pos(x, y, fix_x, fix_y, &x, &y); --- a/src/u_smartsearch.c +++ b/src/u_smartsearch.c @@ -505,3 +505,13 @@ smart_null_proc(void) if (highlighting) smart_erase_objecthighlight(); } + +void +smart_null_proc_button(int x, int y, unsigned int shift) +{ + (void)x; + (void)y; + (void)shift; + + smart_null_proc(); +} --- a/src/u_smartsearch.h +++ b/src/u_smartsearch.h @@ -31,6 +31,7 @@ void smart_object_search_left(int x, int y, unsigned int shift); void smart_object_search_middle(int x, int y, unsigned int shift); void smart_object_search_right(int x, int y, unsigned int shift); void smart_null_proc(void); +void smart_null_proc_button(int x, int y, unsigned int shift); extern F_point smart_point1, smart_point2; --- a/src/w_canvas.c +++ b/src/w_canvas.c @@ -72,10 +72,10 @@ void (*canvas_kbd_proc) (); void (*canvas_locmove_proc) (); void (*canvas_ref_proc) (); -void (*canvas_leftbut_proc) (); -void (*canvas_middlebut_proc) (); -void (*canvas_middlebut_save) (); -void (*canvas_rightbut_proc) (); +void (*canvas_leftbut_proc) (int x, int y, unsigned int shift); +void (*canvas_middlebut_proc) (int x, int y, unsigned int shift); +void (*canvas_middlebut_save) (int x, int y, unsigned int shift); +void (*canvas_rightbut_proc) (int x, int y, unsigned int shift); void (*return_proc) (); int clip_xmin, clip_ymin, clip_xmax, clip_ymax; @@ -115,6 +115,16 @@ null_proc(void) erase_objecthighlight(); } +void +null_proc_button(int x, int y, unsigned int shift) +{ + (void)x; + (void)y; + (void)shift; + + null_proc(); +} + static void canvas_exposed(Widget tool, XEvent *event, String *params, Cardinal *nparams) { @@ -199,9 +209,9 @@ init_canvas(Widget tool) canvas_sw = XtCreateWidget("canvas", labelWidgetClass, tool, Args, ArgCount); - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; canvas_kbd_proc = canvas_locmove_proc = null_proc; XtAugmentTranslations(canvas_sw, XtParseTranslationTable(canvas_translations)); --- a/src/w_canvas.h +++ b/src/w_canvas.h @@ -27,12 +27,13 @@ extern void add_canvas_actions(void); extern void (*canvas_kbd_proc) (); extern void (*canvas_locmove_proc) (); extern void (*canvas_ref_proc) (); -extern void (*canvas_leftbut_proc) (); -extern void (*canvas_middlebut_proc) (); -extern void (*canvas_middlebut_save) (); -extern void (*canvas_rightbut_proc) (); +extern void (*canvas_leftbut_proc) (int x, int y, unsigned int shift); +extern void (*canvas_middlebut_proc) (int x, int y, unsigned int shift); +extern void (*canvas_middlebut_save) (int x, int y, unsigned int shift); +extern void (*canvas_rightbut_proc) (int x, int y, unsigned int shift); extern void (*return_proc) (); extern void null_proc(void); +extern void null_proc_button(int x, int y, unsigned int shift); extern void toggle_show_balloons(void); extern void toggle_show_lengths(void); extern void toggle_show_vertexnums(void); --- a/src/w_cmdpanel.c +++ b/src/w_cmdpanel.c @@ -132,7 +132,7 @@ void delete_all_cmd(Widget w, int closure, int call_data); static void init_move_paste_object(int x, int y); static void move_paste_object(int x, int y); static void place_object(int x, int y, unsigned int shift); -static void cancel_paste(void); +static void cancel_paste(int x, int y, unsigned int shift); static void paste_draw(int paint_mode); static void place_object_orig_posn(int x, int y, unsigned int shift); static void place_menu(Widget w, XEvent *event, String *params, @@ -673,12 +673,16 @@ paste(Widget w, XtPointer closure, XtPointer call_data) } static void -cancel_paste(void) +cancel_paste(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + reset_action_on(); - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; clear_mousefun(); @@ -747,7 +751,7 @@ place_object(int x, int y, unsigned int shift) add_compound(new_c); set_modifiedflag(); redisplay_compound(new_c); - cancel_paste(); + cancel_paste(x, y, shift); } /* button 2: paste object in original location whence it came */ @@ -768,7 +772,7 @@ place_object_orig_posn(int x, int y, unsigned int shift) add_compound(new_c); set_modifiedflag(); redisplay_compound(new_c); - cancel_paste(); + cancel_paste(x, y, shift); } void --- a/src/w_library.c +++ b/src/w_library.c @@ -286,9 +286,9 @@ library_cancel(Widget w, XButtonEvent *ev) canvas_kbd_proc = null_proc; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; - canvas_leftbut_proc = null_proc; - canvas_middlebut_proc = null_proc; - canvas_rightbut_proc = null_proc; + canvas_leftbut_proc = null_proc_button; + canvas_middlebut_proc = null_proc_button; + canvas_rightbut_proc = null_proc_button; set_mousefun("","","","","",""); } } --- a/src/w_modepanel.c +++ b/src/w_modepanel.c @@ -528,7 +528,7 @@ sel_mode_but(Widget widget, XtPointer closure, XEvent *event, mode_sw_info *msw = (mode_sw_info *) closure; if (zoom_in_progress) - cancel_zoom(); + cancel_zoom(0, 0, 0); /* erase any existing anchor for flips */ if (setanchor) center_marker(setanchor_x, setanchor_y); --- a/src/w_zoom.c +++ b/src/w_zoom.c @@ -39,15 +39,15 @@ Boolean zoom_in_progress = False; -static void do_zoom(int x, int y); +static void do_zoom(int x, int y, unsigned int shift); static void init_zoombox_drawing(int x, int y); static void (*save_kbd_proc) (); static void (*save_locmove_proc) (); static void (*save_ref_proc) (); -static void (*save_leftbut_proc) (); -static void (*save_middlebut_proc) (); -static void (*save_rightbut_proc) (); +static void (*save_leftbut_proc) (int x, int y, unsigned int shift); +static void (*save_middlebut_proc) (int x, int y, unsigned int shift); +static void (*save_rightbut_proc) (int x, int y, unsigned int shift); static int save_cur_mode; float display_zoomscale; /* both zoomscales initialized in main() */ @@ -93,7 +93,7 @@ zoom_selected(int x, int y, unsigned int button) } } else if (button == Button1) { reset_cursor(); - do_zoom(x, y); + do_zoom(x, y, 0); } } @@ -137,7 +137,7 @@ init_zoombox_drawing(int x, int y) canvas_locmove_proc = my_box; canvas_ref_proc = elastic_mybox; canvas_leftbut_proc = do_zoom; - canvas_middlebut_proc = canvas_rightbut_proc = null_proc; + canvas_middlebut_proc = canvas_rightbut_proc = null_proc_button; canvas_rightbut_proc = cancel_zoom; elastic_box(my_fix_x, my_fix_y, my_cur_x, my_cur_y); set_action_on(); @@ -147,11 +147,13 @@ init_zoombox_drawing(int x, int y) } static void -do_zoom(int x, int y) +do_zoom(int x, int y, unsigned int shift) { int dimx, dimy; float scalex, scaley; + (void)shift; + /* don't allow zooming while previewing */ if (preview_in_progress) return; @@ -185,8 +187,12 @@ do_zoom(int x, int y) } void -cancel_zoom(void) +cancel_zoom(int x, int y, unsigned int shift) { + (void)x; + (void)y; + (void)shift; + elastic_box(my_fix_x, my_fix_y, my_cur_x, my_cur_y); /* restore state */ canvas_kbd_proc = save_kbd_proc; --- a/src/w_zoom.h +++ b/src/w_zoom.h @@ -30,7 +30,7 @@ extern Boolean zoom_in_progress; extern Boolean integral_zoom; extern void unzoom(void); -extern void cancel_zoom(void); +extern void cancel_zoom(int x, int y, unsigned int shift); extern void zoom_selected(int x, int y, unsigned int button); #endif /* W_ZOOM_H */ -- 2.45.3 From 74febf3cfb1b5ee388fb0211fbe5844dd3aded04 Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Sat, 1 Feb 2025 00:23:21 +0100 Subject: [PATCH 2/8] Fix prototypes for keyboard callbacks --- a/src/d_arc.c +++ b/src/d_arc.c @@ -78,7 +78,7 @@ arc_drawing_selected(void) center_marked = FALSE; ell_arc = FALSE; set_mousefun("first point", "center point", "", "", "", ""); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_arc_drawing; canvas_middlebut_proc = init_arc_c_drawing; --- a/src/d_arcbox.c +++ b/src/d_arcbox.c @@ -43,7 +43,7 @@ void arcbox_drawing_selected(void) { set_mousefun("corner point", "", "", "", "", ""); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_arc_box_drawing; canvas_middlebut_proc = null_proc_button; --- a/src/d_box.c +++ b/src/d_box.c @@ -43,7 +43,7 @@ void box_drawing_selected(void) { set_mousefun("corner point", "", "", "", "", ""); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_box_drawing; canvas_middlebut_proc = null_proc_button; --- a/src/d_ellipse.c +++ b/src/d_ellipse.c @@ -54,7 +54,7 @@ static void cancel_circlebydia(int x, int y, unsigned int shift); void circle_ellipse_byradius_drawing_selected(void) { - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_circlebyradius_drawing; canvas_middlebut_proc = init_ellipsebyradius_drawing; @@ -141,7 +141,7 @@ create_ellipsebyrad(int x, int y, unsigned int shift) void circle_ellipse_bydiameter_drawing_selected(void) { set_mousefun("Circle diameter", "Ellipse corner", "", "", "", ""); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_circlebydiameter_drawing; canvas_middlebut_proc = init_ellipsebydiameter_drawing; --- a/src/d_line.c +++ b/src/d_line.c @@ -53,7 +53,7 @@ static void init_line_freehand_drawing(int x, int y, unsigned int shift); void line_drawing_selected(void) { - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_line_drawing; canvas_middlebut_proc = init_line_freehand_drawing; --- a/src/d_picobj.c +++ b/src/d_picobj.c @@ -48,7 +48,7 @@ void picobj_drawing_selected(void) { set_mousefun("corner point", "", "", "", "", ""); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_picobj_drawing; canvas_middlebut_proc = null_proc_button; --- a/src/d_regpoly.c +++ b/src/d_regpoly.c @@ -47,7 +47,7 @@ void regpoly_drawing_selected(void) { set_mousefun("center point", "", "", "", "", ""); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_regpoly_drawing; canvas_middlebut_proc = null_proc_button; --- a/src/d_spline.c +++ b/src/d_spline.c @@ -51,7 +51,7 @@ void spline_drawing_selected(void) { set_mousefun("first point", "freehand", "", "", "", ""); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_leftbut_proc = init_spline_drawing; canvas_middlebut_proc = init_spline_freehand_drawing; --- a/src/d_text.c +++ b/src/d_text.c @@ -162,7 +162,7 @@ static Boolean is_preedit_running(); void text_drawing_selected(void) { - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_middlebut_proc = null_proc_button; canvas_leftbut_proc = init_text_input; @@ -407,7 +407,7 @@ overlay_text_input(int x, int y) set_mousefun("new text", "finish text", "cancel", "", "paste text", ""); draw_mousefun_kbd(); draw_mousefun_canvas(); - canvas_kbd_proc = (void (*)())char_handler; + canvas_kbd_proc = char_handler; canvas_middlebut_proc = finish_text_input; canvas_leftbut_proc = finish_n_start; canvas_rightbut_proc = cancel_text_input; @@ -471,7 +471,7 @@ init_text_input(int x, int y, unsigned int shift) set_mousefun("new text", "finish text", "cancel", "", "paste text", ""); draw_mousefun_kbd(); draw_mousefun_canvas(); - canvas_kbd_proc = (void (*)())char_handler; + canvas_kbd_proc = char_handler; canvas_middlebut_proc = finish_text_input; canvas_leftbut_proc = finish_n_start; canvas_rightbut_proc = cancel_text_input; @@ -813,7 +813,7 @@ terminate_char_handler(void) } void -char_handler(unsigned char *c, int clen, KeySym keysym) +char_handler(char *c, int clen, KeySym keysym) { int i; --- a/src/d_text.h +++ b/src/d_text.h @@ -28,7 +28,7 @@ extern int work_font; extern XFontStruct *canvas_font; -extern void char_handler(unsigned char *c, int clen, KeySym keysym); +extern void char_handler(char *c, int clen, KeySym keysym); extern void finish_text_input(int x, int y, unsigned int shift); extern XIC xim_ic; --- a/src/e_addpt.c +++ b/src/e_addpt.c @@ -50,7 +50,7 @@ void point_adding_selected(void) { set_mousefun("break/add here", "", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_point_adding); --- a/src/e_align.c +++ b/src/e_align.c @@ -69,7 +69,7 @@ void align_selected(void) { set_mousefun("align compound", "align canvas", "", LOC_OBJ, "", LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_align); --- a/src/e_arrow.c +++ b/src/e_arrow.c @@ -50,7 +50,7 @@ void arrow_head_selected(void) { set_mousefun("add arrow", "delete arrow", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(add_arrow_head); --- a/src/e_break.c +++ b/src/e_break.c @@ -43,7 +43,7 @@ void break_selected(void) { set_mousefun("break compound", "break and tag", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_break_only); --- a/src/e_chop.c +++ b/src/e_chop.c @@ -87,7 +87,7 @@ chop_selected(void) set_mousefun("Select axe object", "Select log object", "Clear axe list", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(select_axe_object); --- a/src/e_compound.c +++ b/src/e_compound.c @@ -126,7 +126,7 @@ open_compound_selected(void) set_mousefun("open compound", "open, keep visible", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_open_compound); --- a/src/e_convert.c +++ b/src/e_convert.c @@ -52,7 +52,7 @@ void convert_selected(void) { set_mousefun("spline<->line", "", "open<->closed", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_convert_line_spline); --- a/src/e_copy.c +++ b/src/e_copy.c @@ -51,7 +51,7 @@ static void init_copy_to_scrap(F_line *p, int type, int x, int y, int px, void copy_selected(void) { - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_arb_copy); --- a/src/e_delete.c +++ b/src/e_delete.c @@ -65,7 +65,7 @@ delete_selected(void) { set_mousefun("delete object", "delete region", "del to cut buf", LOC_OBJ, "", LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_delete); --- a/src/e_deletept.c +++ b/src/e_deletept.c @@ -45,7 +45,7 @@ void delete_point_selected(void) { set_mousefun("delete point", "", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_delete_point); --- a/src/e_edit.c +++ b/src/e_edit.c @@ -687,7 +687,7 @@ void edit_item_selected(void) { set_mousefun("edit object", "edit Main comment", "edit point", LOC_OBJ, "show comments", LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(edit_item); --- a/src/e_flip.c +++ b/src/e_flip.c @@ -102,7 +102,7 @@ flip_selected(void) { set_mousefun("flip", "copy & flip", "set anchor", LOC_OBJ, LOC_OBJ, "set anchor"); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_flip); --- a/src/e_glue.c +++ b/src/e_glue.c @@ -65,7 +65,7 @@ compound_selected(void) { set_mousefun("tag object", "tag region", "compound tagged", LOC_OBJ, "", ""); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(tag_object); --- a/src/e_joinsplit.c +++ b/src/e_joinsplit.c @@ -73,7 +73,7 @@ join_split_selected(void) set_mousefun("Join Lines/Splines", "Split Line/Spline", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_join); --- a/src/e_measure.c +++ b/src/e_measure.c @@ -89,7 +89,7 @@ static float total_area = 0.0; void anglemeas_selected(void) { set_mousefun("first point", "select & save", "select object", "", LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_middle(init_anglemeas_object_m); @@ -314,7 +314,7 @@ freehand_line_nomsg(int x, int y) void lenmeas_selected(void) { set_mousefun("select object", "select & add", "reset to 0", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_lenmeas_object_l); @@ -426,7 +426,7 @@ clear_lenmeas_memory(int x, int y, unsigned int shift) void areameas_selected(void) { set_mousefun("select object", "select & add", "reset to 0", LOC_OBJ, LOC_OBJ, "reset to +-0"); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_areameas_object_l); --- a/src/e_move.c +++ b/src/e_move.c @@ -42,7 +42,7 @@ void move_selected(void) { set_mousefun("move object", "horiz/vert move", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; init_searchproc_left(init_arb_move); init_searchproc_middle(init_constrained_move); --- a/src/e_movept.c +++ b/src/e_movept.c @@ -80,7 +80,7 @@ static void cancel_movedlinepoint(int x, int y, unsigned int shift); void move_point_selected(void) { set_mousefun("move point", "horiz/vert move", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_arb_move_point); --- a/src/e_placelib.c +++ b/src/e_placelib.c @@ -59,7 +59,7 @@ static int off_library_y; static void init_move_object(int x, int y); static void move_object(int x, int y); static void change_draw_mode(int x, int y); -static void transform_lib_obj(unsigned char *c, int clen, KeySym keysym); +static void transform_lib_obj(char *c, int clen, KeySym keysym); static void place_lib_object(int x, int y, unsigned int shift); static void put_draw(int paint_mode); static void sel_place_lib_obj_proc(int x, int y, unsigned int shift); @@ -116,7 +116,7 @@ put_selected(void) /* allow rotation or flipping of library object before placing on canvas */ static void -transform_lib_obj(unsigned char *c, int clen, KeySym keysym) +transform_lib_obj(char *c, int clen, KeySym keysym) { (void)keysym; (void)clen; @@ -163,7 +163,7 @@ sel_place_lib_obj_proc(int x, int y, unsigned int shift) void sel_place_lib_obj(void) { - canvas_kbd_proc = (void (*)())transform_lib_obj; + canvas_kbd_proc = transform_lib_obj; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; canvas_leftbut_proc = null_proc_button; @@ -258,7 +258,7 @@ place_lib_object(int x, int y, unsigned int shift) redisplay_compound(new_c); if (shift) { /* temporarily turn off library place mode so we can edit the object just placed */ - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; clear_mousefun(); set_mousefun("","","", "", "", ""); turn_off_current(); @@ -325,7 +325,7 @@ cancel_place_lib_obj(int x, int y, unsigned int shift) canvas_rightbut_proc = null_proc_button; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; clear_mousefun(); set_mousefun("","","", "", "", ""); turn_off_current(); --- a/src/e_rotate.c +++ b/src/e_rotate.c @@ -109,7 +109,7 @@ rotate_selected(void) { set_mousefun("rotate object", "copy & rotate", "set center", LOC_OBJ, LOC_OBJ, "set center"); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_rotate); --- a/src/e_scale.c +++ b/src/e_scale.c @@ -105,7 +105,7 @@ scale_selected(void) { set_mousefun("scale box", "scale about center", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_box_scale); --- a/src/e_tangent.c +++ b/src/e_tangent.c @@ -49,7 +49,7 @@ void tangent_selected(void) { set_mousefun("add tangent", "add normal", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = smart_null_proc; canvas_ref_proc = smart_null_proc; init_smart_searchproc_left(init_tangent_adding); --- a/src/e_update.c +++ b/src/e_update.c @@ -93,7 +93,7 @@ update_selected(void) { set_mousefun("update object", "update settings", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; init_searchproc_left(init_update_object); --- a/src/w_canvas.c +++ b/src/w_canvas.c @@ -69,7 +69,7 @@ /*********************** EXPORTS ************************/ -void (*canvas_kbd_proc) (); +void (*canvas_kbd_proc) (char *c, int clen, KeySym keysym); void (*canvas_locmove_proc) (); void (*canvas_ref_proc) (); void (*canvas_leftbut_proc) (int x, int y, unsigned int shift); @@ -125,6 +125,16 @@ null_proc_button(int x, int y, unsigned int shift) null_proc(); } +void +null_proc_kbd(char *c, int clen, KeySym keysym) +{ + (void)c; + (void)clen; + (void)keysym; + + null_proc(); +} + static void canvas_exposed(Widget tool, XEvent *event, String *params, Cardinal *nparams) { @@ -212,7 +222,8 @@ init_canvas(Widget tool) canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; - canvas_kbd_proc = canvas_locmove_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; + canvas_locmove_proc = null_proc; XtAugmentTranslations(canvas_sw, XtParseTranslationTable(canvas_translations)); readComposeKey(); @@ -629,7 +640,7 @@ canvas_selected(Widget tool, XButtonEvent *event, String *params, /* edit text */ } else { - if (canvas_kbd_proc != null_proc ) { + if (canvas_kbd_proc != null_proc_kbd ) { if (key == XK_Left || key == XK_Right || key == XK_Home || key == XK_End) { @@ -714,12 +725,12 @@ get_canvas_clipboard(Widget w, XtPointer client_data, Atom *selection, &tmp, &num_values); if (ret_status == Success || 0 < num_values) { for (i = 0; i < num_values; ++i) { - canvas_kbd_proc((unsigned char *)tmp[i], + canvas_kbd_proc((char *)tmp[i], (int)strlen(tmp[i]), (KeySym)0); } } } else { - canvas_kbd_proc((unsigned char *)buf, (int)(*length),(KeySym)0); + canvas_kbd_proc((char *)buf, (int)(*length),(KeySym)0); } XtFree(buf); } @@ -740,7 +751,7 @@ canvas_paste(Widget w, XKeyEvent *paste_event) Time event_time; Atom atom_utf8_string; - if (canvas_kbd_proc != (void (*)())char_handler) + if (canvas_kbd_proc != char_handler) return; if (paste_event != NULL) --- a/src/w_canvas.h +++ b/src/w_canvas.h @@ -24,7 +24,7 @@ extern void init_canvas(Widget tool); extern void add_canvas_actions(void); -extern void (*canvas_kbd_proc) (); +extern void (*canvas_kbd_proc) (char *c, int clen, KeySym keysym); extern void (*canvas_locmove_proc) (); extern void (*canvas_ref_proc) (); extern void (*canvas_leftbut_proc) (int x, int y, unsigned int shift); @@ -34,6 +34,7 @@ extern void (*canvas_rightbut_proc) (int x, int y, unsigned int shift); extern void (*return_proc) (); extern void null_proc(void); extern void null_proc_button(int x, int y, unsigned int shift); +extern void null_proc_kbd(char *c, int clen, KeySym keysym); extern void toggle_show_balloons(void); extern void toggle_show_lengths(void); extern void toggle_show_vertexnums(void); --- a/src/w_cmdpanel.c +++ b/src/w_cmdpanel.c @@ -1724,7 +1724,7 @@ paste_character(Widget w, XtPointer client_data, XEvent *ev, Boolean *pass) XftChar8 str[FC_UTF8_MAX_LEN]; /* only allow during text input */ - if (canvas_kbd_proc != (void (*)())char_handler) + if (canvas_kbd_proc != char_handler) return; len = FcUcs4ToUtf8((XftChar32)i.val, str); --- a/src/w_library.c +++ b/src/w_library.c @@ -283,7 +283,7 @@ library_cancel(Widget w, XButtonEvent *ev) } else { /* otherwise, cancel all library operations */ reset_action_on(); - canvas_kbd_proc = null_proc; + canvas_kbd_proc = null_proc_kbd; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; canvas_leftbut_proc = null_proc_button; --- a/src/w_zoom.c +++ b/src/w_zoom.c @@ -42,7 +42,7 @@ Boolean zoom_in_progress = False; static void do_zoom(int x, int y, unsigned int shift); static void init_zoombox_drawing(int x, int y); -static void (*save_kbd_proc) (); +static void (*save_kbd_proc) (char *c, int clen, KeySym keysym); static void (*save_locmove_proc) (); static void (*save_ref_proc) (); static void (*save_leftbut_proc) (int x, int y, unsigned int shift); -- 2.45.3 From af8f911a3b338bd52d72fa78995581cf58be5500 Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Sat, 1 Feb 2025 09:50:16 +0100 Subject: [PATCH 3/8] Fix old style definitions --- a/src/d_text.c +++ b/src/d_text.c @@ -150,7 +150,7 @@ static char preedit_filename[PATH_MAX] = ""; static void open_preedit_proc(int x, int y, unsigned int shift); static void close_preedit_proc(int x, int y, unsigned int shift); static void paste_preedit_proc(int x, int y, unsigned int shift); -static Boolean is_preedit_running(); +static Boolean is_preedit_running(void); /********************************************************/ /* */ --- a/src/d_text.h +++ b/src/d_text.h @@ -35,7 +35,7 @@ extern XIC xim_ic; extern Boolean xim_active; extern Boolean xim_initialize(Widget w); extern void xim_set_ic_geometry(XIC ic, int width, int height); -extern void kill_preedit(); +extern void kill_preedit(void); extern void text_drawing_selected (void); #endif --- a/src/e_chop.c +++ b/src/e_chop.c @@ -149,19 +149,19 @@ clear_axe_objects(int x, int y, unsigned shift) } static int -point_sort_fcn(a, b) - s_point_s * a; - s_point_s * b; +point_sort_fcn(const void *_a, const void *_b) { + const s_point_s *a = _a, *b = _b; + return (a->dist == b->dist) ? 0 : ((a->dist < b->dist) ? -1 : 1); } static int -point_sort_reverse_fcn(a, b) - s_point_s * a; - s_point_s * b; +point_sort_reverse_fcn(const void *_a, const void *_b) { + const s_point_s *a = _a, *b = _b; + return (a->dist == b->dist) ? 0 : ((a->dist > b->dist) ? -1 : 1); } --- a/src/e_edit.c +++ b/src/e_edit.c @@ -329,7 +329,7 @@ static char *pic_names[] = { static int ellipse_flag; static intptr_t fill_flag; static intptr_t flip_pic_flag; -static void (*done_proc) (); +static void (*done_proc) (void); static int button_result; static intptr_t textjust; static Color pen_color, fill_color; --- a/src/u_search.c +++ b/src/u_search.c @@ -69,10 +69,7 @@ static F_compound *c; /* this rotates (x, y) into a coordinate system orthogonal to the ellipse semi-axes */ inline static void -vector_rotate(a, b, angle) - double * a; - double * b; - float angle; +vector_rotate(double *a, double *b, float angle) { double x = fabs((*a * cos((double)angle)) - (*b * sin((double)angle))); double y = fabs((*a * sin((double)angle)) + (*b * cos((double)angle))); --- a/src/w_canvas.c +++ b/src/w_canvas.c @@ -76,7 +76,7 @@ void (*canvas_leftbut_proc) (int x, int y, unsigned int shift); void (*canvas_middlebut_proc) (int x, int y, unsigned int shift); void (*canvas_middlebut_save) (int x, int y, unsigned int shift); void (*canvas_rightbut_proc) (int x, int y, unsigned int shift); -void (*return_proc) (); +void (*return_proc) (void); int clip_xmin, clip_ymin, clip_xmax, clip_ymax; int clip_width, clip_height; --- a/src/w_canvas.h +++ b/src/w_canvas.h @@ -31,7 +31,7 @@ extern void (*canvas_leftbut_proc) (int x, int y, unsigned int shift); extern void (*canvas_middlebut_proc) (int x, int y, unsigned int shift); extern void (*canvas_middlebut_save) (int x, int y, unsigned int shift); extern void (*canvas_rightbut_proc) (int x, int y, unsigned int shift); -extern void (*return_proc) (); +extern void (*return_proc) (void); extern void null_proc(void); extern void null_proc_button(int x, int y, unsigned int shift); extern void null_proc_kbd(char *c, int clen, KeySym keysym); --- a/src/w_cmdpanel.c +++ b/src/w_cmdpanel.c @@ -828,7 +828,7 @@ delete_all_cmd(Widget w, int closure, int call_data) /* Toggle canvas orientation from Portrait to Landscape or vice versa */ void -change_orient() +change_orient(void) { Dimension formw, formh; int dx, dy; --- a/src/w_cmdpanel.h +++ b/src/w_cmdpanel.h @@ -50,15 +50,15 @@ typedef struct main_menu_struct { extern main_menu_info main_menus[]; -extern void init_cmd_panel(); +extern void init_cmd_panel(void); extern void add_cmd_actions(void); extern void quit(Widget w, XtPointer closure, XtPointer call_data); extern void new(Widget w, XtPointer closure, XtPointer call_data); extern void paste(Widget w, XtPointer closure, XtPointer call_data); extern void delete_all_cmd(Widget w, int closure, int call_data); -extern void setup_cmd_panel(); -extern void change_orient(); -extern void setup_cmd_panel(); +extern void setup_cmd_panel(void); +extern void change_orient(void); +extern void setup_cmd_panel(void); extern void show_global_settings(Widget w); extern void acc_load_recent_file(Widget w, XEvent *event, String *params, Cardinal *nparams); extern int num_main_menus(void); --- a/src/w_color.h +++ b/src/w_color.h @@ -90,13 +90,13 @@ typedef struct _CMY { extern RGB RGBWhite, RGBBlack; -RGB MixRGB(); -RGB MixHSV(); +RGB MixRGB(void); +RGB MixHSV(void); RGB HSVToRGB(HSV hsv); HSV RGBToHSV(RGB rgb); -float RGBDist(); +float RGBDist(void); RGB PctToRGB(float rr, float gg, float bb); -HSV PctToHSV(); -RGB CMYToRGB(); -CMY RGBToCMY(); +HSV PctToHSV(void); +RGB CMYToRGB(void); +CMY RGBToCMY(void); #endif /* W_COLOR_H */ --- a/src/w_icons.c +++ b/src/w_icons.c @@ -2153,7 +2153,7 @@ icon_struct areameas_ic; -void populate_icons_big() +void populate_icons_big(void) { icon_struct regpoly_ic_ = { regpoly_width_big, regpoly_height_big, (char*)regpoly_bits_big }; icon_struct addpt_ic_ = { addpt_width_big, addpt_height_big, (char*)addpt_bits_big }; @@ -2242,7 +2242,7 @@ void populate_icons_big() } -void populate_icons_small() +void populate_icons_small(void) { icon_struct regpoly_ic_ = { regpoly_width_small, regpoly_height_small, (char*)regpoly_bits_small }; icon_struct addpt_ic_ = { addpt_width_small, addpt_height_small, (char*)addpt_bits_small }; @@ -3255,14 +3255,14 @@ icon_struct spl_bckgnd_ic = { spl_bckgnd_width, spl_bckgnd_height, int mode_sw_ht; int mode_sw_wd; -void setup_icons_small() +void setup_icons_small(void) { mode_sw_ht = MODE_SW_HT_SMALL; mode_sw_wd = MODE_SW_WD_SMALL; populate_icons_small(); } -void setup_icons_big() +void setup_icons_big(void) { mode_sw_ht = MODE_SW_HT_BIG; mode_sw_wd = MODE_SW_WD_BIG; --- a/src/w_icons.h +++ b/src/w_icons.h @@ -26,8 +26,8 @@ extern int mode_sw_ht; extern int mode_sw_wd; -void setup_icons_small(); -void setup_icons_big(); +void setup_icons_small(void); +void setup_icons_big(void); typedef struct _icon_struct { --- a/src/w_indpanel.c +++ b/src/w_indpanel.c @@ -3772,8 +3772,7 @@ show_halign(ind_sw_info *sw) /* GRID MODE */ // isometric grid static void -show_gridmode(sw) - ind_sw_info *sw; +show_gridmode(ind_sw_info *sw) { update_choice_pixmap(sw, cur_gridmode); @@ -4559,7 +4558,7 @@ dec_zoom_centered(ind_sw_info *sw) /* zoom in either from wheel or accelerator, centering canvas on mouse */ void -wheel_inc_zoom() +wheel_inc_zoom(void) { Window root, child; int x1, y1, junk; @@ -4581,7 +4580,7 @@ wheel_inc_zoom() /* zoom out either from wheel or accelerator, centering canvas on mouse */ void -wheel_dec_zoom() +wheel_dec_zoom(void) { Window root, child; int x1, y1, junk; --- a/src/w_intersect.c +++ b/src/w_intersect.c @@ -93,12 +93,9 @@ boxes_overlap(struct f_point * p1a, struct f_point * p1b, } static void -do_circle_ellipse_intersect(r, X, Y, e, x, y, arc, isect_cb) - double r, X, Y; - F_ellipse * e; - int x, y; - F_arc * arc; - isect_cb_s * isect_cb; +do_circle_ellipse_intersect( + double r, double X, double Y, F_ellipse *e, int x, int y, + F_arc *arc, isect_cb_s *isect_cb) { double K, L, M, N; double hix, hiy; @@ -197,11 +194,7 @@ do_circle_ellipse_intersect(r, X, Y, e, x, y, arc, isect_cb) } static void -circle_ellipse_intersect(c, e, x, y, isect_cb) - F_ellipse * c; - F_ellipse * e; - int x, y; - isect_cb_s * isect_cb; +circle_ellipse_intersect(F_ellipse *c, F_ellipse *e, int x, int y, isect_cb_s *isect_cb) { double r = (double)(c->radiuses.x); double X = (double)(c->center.x - e->center.x); @@ -211,18 +204,12 @@ circle_ellipse_intersect(c, e, x, y, isect_cb) } static void -do_circle_circle(PX, PY, X2, Y2, R1, R2, OX, OY, arc, arc2, isect_cb) - double PX; /* event point */ - double PY; - double X2; /* translated arc center */ - double Y2; - double R1; /* circle radius */ - double R2; - double OX; /* circle -> arc displacement */ - double OY; - F_arc * arc; - F_arc * arc2; - isect_cb_s * isect_cb; +do_circle_circle( + double PX, double PY, /* event point */ + double X2, double Y2, /* translated arc center */ + double R1, double R2, /* circle radius */ + double OX, double OY, /* circle -> arc displacement */ + F_arc *arc, F_arc *arc2, isect_cb_s *isect_cb) { double dc = hypot(Y2, X2); @@ -310,11 +297,7 @@ do_circle_circle(PX, PY, X2, Y2, R1, R2, OX, OY, arc, arc2, isect_cb) } static void -circle_circle_intersect(e1, e2, x, y, isect_cb) - F_ellipse * e1; - F_ellipse * e2; - int x, y; - isect_cb_s * isect_cb; +circle_circle_intersect(F_ellipse *e1, F_ellipse *e2, int x, int y, isect_cb_s *isect_cb) { double PX = (double)(x - e1->center.x); double PY = (double)(y - e1->center.y); @@ -331,11 +314,7 @@ circle_circle_intersect(e1, e2, x, y, isect_cb) static void -non_ortho_ellipse_ellipse_intersect(e1, e2, x, y, isect_cb) - F_ellipse * e1; - F_ellipse * e2; - int x, y; - isect_cb_s * isect_cb; +non_ortho_ellipse_ellipse_intersect(F_ellipse *e1, F_ellipse *e2, int x, int y, isect_cb_s *isect_cb) { /* ellipse-ellipse -- non-orthogonal */ double A, B, C, D; @@ -568,11 +547,7 @@ non_ortho_ellipse_ellipse_intersect(e1, e2, x, y, isect_cb) static void -ortho_ellipse_ellipse_intersect(e1, e2, x, y, isect_cb) - F_ellipse * e1; - F_ellipse * e2; - int x, y; - isect_cb_s * isect_cb; +ortho_ellipse_ellipse_intersect(F_ellipse *e1, F_ellipse *e2, int x, int y, isect_cb_s *isect_cb) { /* ellipse-ellipse -- orthogonal */ /* * x^2 / a^2 + y^2 / b2 = 1 Eq 1, origin ctrd, eclipse 1 @@ -776,16 +751,9 @@ intersect_ellipse_ellipse_handler(F_ellipse * e1, F_ellipse * e2, int x, int y } static void -do_intersect_ellipse_polyline(ecx, ecy, ea, eb, theta, l, x, y, arc, isect_cb) - double ecx; - double ecy; - double ea; - double eb; - double theta; - F_line * l; - int x, y; - F_arc * arc; - isect_cb_s * isect_cb; +do_intersect_ellipse_polyline( + double ecx, double ecy, double ea, double eb, double theta, + F_line *l, int x, int y, F_arc *arc, isect_cb_s *isect_cb) { /* if arc is non-null, ecx, ecy, ea, and eb arc from arc.*/ /* if isect_cb is non-null, return the intersects */ @@ -1215,10 +1183,7 @@ intersect_spline_arc_handler(void *obj1, void *obj2, int x, int y) } static void -intersect_text_text_handler(t1, t2, x, y) - F_text * t1; - F_text * t2; - int x, y; +intersect_text_text_handler(F_text *t1, F_text *t2, int x, int y) { F_line * f1_line_p = build_text_bounding_box(t1); F_line * f2_line_p = build_text_bounding_box(t2); @@ -1228,10 +1193,7 @@ intersect_text_text_handler(t1, t2, x, y) } static void -intersect_text_arc_handler(t, a, x, y) - F_text * t; - F_arc * a; - int x, y; +intersect_text_arc_handler(F_text *t, F_arc *a, int x, int y) { F_line * f_line_p = build_text_bounding_box(t); intersect_polyline_arc_handler(f_line_p, a, x, y, NULL); @@ -1257,11 +1219,7 @@ intersect_arc_arc_handler(F_arc * a1, F_arc * a2, int x, int y, isect_cb_s * ise } static void -intersect_ellipse_handler(obj1, obj2, type2, x, y) - void * obj1; - void * obj2; - int type2; - int x, y; +intersect_ellipse_handler(void *obj1, void *obj2, int type2, int x, int y) { switch (type2) { case O_ELLIPSE: @@ -1283,11 +1241,7 @@ intersect_ellipse_handler(obj1, obj2, type2, x, y) } static void -intersect_polyline_handler(obj1, obj2, type2, x, y) - void * obj1; - void * obj2; - int type2; - int x, y; +intersect_polyline_handler(void *obj1, void *obj2, int type2, int x, int y) { switch (type2) { case O_ELLIPSE: @@ -1309,11 +1263,7 @@ intersect_polyline_handler(obj1, obj2, type2, x, y) } static void -intersect_spline_handler(obj1, obj2, type2, x, y) - void * obj1; - void * obj2; - int type2; - int x, y; +intersect_spline_handler(void *obj1, void *obj2, int type2, int x, int y) { switch (type2) { case O_ELLIPSE: @@ -1335,11 +1285,7 @@ intersect_spline_handler(obj1, obj2, type2, x, y) } static void -intersect_text_handler(obj1, obj2, type2, x, y) - void * obj1; - void * obj2; - int type2; - int x, y; +intersect_text_handler(void *obj1, void *obj2, int type2, int x, int y) { switch (type2) { case O_ELLIPSE: @@ -1361,11 +1307,7 @@ intersect_text_handler(obj1, obj2, type2, x, y) } static void -intersect_arc_handler(obj1, obj2, type2, x, y) - void * obj1; - void * obj2; - int type2; - int x, y; +intersect_arc_handler(void *obj1, void *obj2, int type2, int x, int y) { switch (type2) { case O_ELLIPSE: @@ -1387,12 +1329,7 @@ intersect_arc_handler(obj1, obj2, type2, x, y) } void -snap_intersect_handler(obj1, type1, obj2, type2, x, y) - void * obj1; - int type1; - void * obj2; - int type2; - int x, y; +snap_intersect_handler(void *obj1, int type1, void *obj2, int type2, int x, int y) { switch (type1) { case O_ELLIPSE: --- a/src/w_keyboard.c +++ b/src/w_keyboard.c @@ -414,7 +414,7 @@ static Widget keyboard_input = None; static void -create_keyboard_panel() +create_keyboard_panel(void) { Widget keyboard_form; Widget label, usage_hint; --- a/src/w_layers.c +++ b/src/w_layers.c @@ -725,7 +725,7 @@ any_active_in_compound(F_compound *cmpnd) } void -update_layerpanel() +update_layerpanel(void) { /* * We must test for the widgets, as this is called by --- a/src/w_layers.h +++ b/src/w_layers.h @@ -50,6 +50,6 @@ extern void reset_layers(void); extern void reset_depths(void); extern int LAYER_WD, LAYER_HT; -extern void update_layerpanel (); +extern void update_layerpanel (void); #endif --- a/src/w_modepanel.c +++ b/src/w_modepanel.c @@ -496,7 +496,7 @@ void setup_mode_panel(void) SetValues(mode_panel); } -void update_modepanel() +void update_modepanel(void) { int i; mode_sw_info *sw; --- a/src/w_modepanel.h +++ b/src/w_modepanel.h @@ -45,7 +45,7 @@ typedef struct mode_switch_struct { extern void change_mode (icon_struct *icon); extern void turn_off_current (void); -extern void update_modepanel (); +extern void update_modepanel (void); extern void setup_mode_panel(void); #endif --- a/src/w_mousefun.c +++ b/src/w_mousefun.c @@ -108,7 +108,7 @@ setup_mousefun(void) set_mousefun("", "", "", "", "", ""); } -void update_mousepanel() +void update_mousepanel(void) { if (mousefun) { if (appres.showballoons) --- a/src/w_mousefun.h +++ b/src/w_mousefun.h @@ -28,9 +28,9 @@ void set_mousefun(char *left, char *middle, char *right, char *sh_left, char *s void draw_mousefun_mode(void); void draw_mousefun_ind(void); void draw_mousefun_unitbox(void); -void shift_top_mousfun(); +void shift_top_mousfun(void); void draw_mousefun_topruler(Widget w, XEvent *event, String *params, Cardinal *num_params); -void shift_side_mousfun(); +void shift_side_mousfun(void); void draw_mousefun_sideruler(Widget w, XEvent *event, String *params, Cardinal *num_params); void draw_mousefun_canvas(void); void draw_mousefun(char *left, char *middle, char *right); @@ -42,10 +42,10 @@ void notused_right(void); void clear_right(void); void draw_mousefun_kbd(void); void clear_mousefun_kbd(void); -void init_mousefun_actions(); +void init_mousefun_actions(void); extern String kbd_translations; extern void init_kbd_actions (void); -extern void update_mousepanel (); +extern void update_mousepanel (void); extern void draw_shift_mousefun_canvas(void); extern void draw_shift_mousefun_canvas2(char *tl, char *tm, char *tr); --- a/src/w_rulers.c +++ b/src/w_rulers.c @@ -389,7 +389,7 @@ init_unitbox(Widget tool) static Widget unit_popup, unit_panel, cancel, set, beside, below, label; void -update_rulerpanel() +update_rulerpanel(void) { char msg[80]; --- a/src/w_rulers.h +++ b/src/w_rulers.h @@ -35,7 +35,7 @@ extern void resize_sideruler (void); extern void resize_topruler (void); extern void setup_sideruler (void); extern void reset_rulers (void); -extern void update_rulerpanel (); +extern void update_rulerpanel (void); extern void setup_rulers(void); extern void set_rulermark(int x, int y); extern void erase_siderulermark(void); --- a/src/w_snap.c +++ b/src/w_snap.c @@ -57,7 +57,7 @@ snap_mode_e snap_mode = SNAP_MODE_NONE; void snap_release(Widget w, XtPointer closure, XtPointer call_data); -static void snap_polyline_handler(F_line * l, int x, int y); +static void snap_polyline_handler(F_line *l, int x, int y); /* */ @@ -83,11 +83,7 @@ snap_rotate_vector(double * dx, double * dy, double x, double y, double theta) /* defined by two points */ static double -point_to_line(px, py, l1, l2) - int px; - int py; - struct f_point * l1; - struct f_point * l2; +point_to_line(int px, int py, struct f_point *l1, struct f_point *l2) { double x0 = (double)px; double y0 = (double)py; @@ -123,10 +119,7 @@ get_line_from_points(double * c, struct f_point * s1, struct f_point * s2) /* */ static void -snap_polyline_endpoint_handler(l, x, y) - F_line *l; - int x; - int y; +snap_polyline_endpoint_handler(F_line *l, int x, int y) { struct f_point * point; double mind = HUGE_VAL; @@ -146,7 +139,7 @@ snap_polyline_endpoint_handler(l, x, y) /* */ void -snap_polyline_focus_handler(F_line * l, int x, int y) +snap_polyline_focus_handler(F_line *l, int x, int y) { (void)x; (void)y; @@ -178,10 +171,7 @@ snap_polyline_focus_handler(F_line * l, int x, int y) /* */ static void -snap_polyline_midpoint_handler(l, x, y) - F_line *l; - int x; - int y; +snap_polyline_midpoint_handler(F_line *l, int x, int y) { struct f_point * prev_point = NULL; struct f_point * point; @@ -210,12 +200,7 @@ snap_polyline_midpoint_handler(l, x, y) /* */ static void -do_snap_polyline_normal(l, x, y, cur_point_x, cur_point_y) - F_line *l; - int x; - int y; - double cur_point_x; - double cur_point_y; +do_snap_polyline_normal(F_line *l, int x, int y, double cur_point_x, double cur_point_y) { struct f_point * prev_point = NULL; struct f_point * point; @@ -260,10 +245,7 @@ do_snap_polyline_normal(l, x, y, cur_point_x, cur_point_y) } static void -snap_polyline_normal_handler(l, x, y) - F_line *l; - int x; - int y; +snap_polyline_normal_handler(F_line *l, int x, int y) { do_snap_polyline_normal(l, x, y, (double)(cur_point->x), (double)(cur_point->y)); } @@ -273,10 +255,7 @@ snap_polyline_normal_handler(l, x, y) /* */ static void -snap_ellipse_focus_ellipse_handler(e, x, y) - F_ellipse *e; - int x; - int y; +snap_ellipse_focus_ellipse_handler(F_ellipse *e, int x, int y) { int idx; int idy; @@ -336,12 +315,7 @@ check_alignment(double x, double y, /* */ static void -snap_ellipse_normal_ellipse_handler(e, x, y, cur_point_x, cur_point_y) - F_ellipse *e; - int x; - int y; - double cur_point_x; - double cur_point_y; +snap_ellipse_normal_ellipse_handler(F_ellipse *e, int x, int y, double cur_point_x, double cur_point_y) { /* @@ -443,14 +417,7 @@ snap_ellipse_normal_ellipse_handler(e, x, y, cur_point_x, cur_point_y) /* */ static void -circle_normal_handler(center_x, center_y, radius, x, y, cur_point_x, cur_point_y) - double center_x; - double center_y; - double radius; - int x; - int y; - double cur_point_x; - double cur_point_y; +circle_normal_handler(double center_x, double center_y, double radius, int x, int y, double cur_point_x, double cur_point_y) { double a; double txa, tya; @@ -484,12 +451,7 @@ circle_normal_handler(center_x, center_y, radius, x, y, cur_point_x, cur_point_y } static void -snap_ellipse_normal_circle_handler(e, x, y, cur_point_x, cur_point_y) - F_ellipse *e; - int x; - int y; - double cur_point_x; - double cur_point_y; +snap_ellipse_normal_circle_handler(F_ellipse *e, int x, int y, double cur_point_x, double cur_point_y) { circle_normal_handler((double)(e->center.x), (double)(e->center.y), @@ -504,12 +466,7 @@ snap_ellipse_normal_circle_handler(e, x, y, cur_point_x, cur_point_y) /* */ static void -circle_tangent_handler(center_x, center_y, r, x, y) - double center_x; - double center_y; - double r; - int x; - int y; +circle_tangent_handler(double center_x, double center_y, double r, int x, int y) { double p = hypot(center_y - (double)(cur_point->y), center_x - (double)(cur_point->x)); @@ -549,10 +506,7 @@ circle_tangent_handler(center_x, center_y, r, x, y) } static void -snap_ellipse_tangent_circle_handler(e, x, y) - F_ellipse *e; - int x; - int y; +snap_ellipse_tangent_circle_handler(F_ellipse *e, int x, int y) { circle_tangent_handler((double)(e->center.x), (double)(e->center.y), (double)(e->radiuses.x), x, y); @@ -564,10 +518,7 @@ snap_ellipse_tangent_circle_handler(e, x, y) /* */ static void -snap_ellipse_tangent_ellipse_handler(e, x, y) - F_ellipse *e; - int x; - int y; +snap_ellipse_tangent_ellipse_handler(F_ellipse *e, int x, int y) { /* @@ -705,10 +656,7 @@ snap_ellipse_tangent_ellipse_handler(e, x, y) /* */ static void -snap_ellipse_endpoint_handler(e, x, y) - F_ellipse *e; - int x; - int y; +snap_ellipse_endpoint_handler(F_ellipse *e, int x, int y) { int i; double tx,ty; @@ -742,10 +690,7 @@ snap_ellipse_endpoint_handler(e, x, y) /* */ static void -snap_polyline_handler(l, x, y) - F_line *l; - int x; - int y; +snap_polyline_handler(F_line *l, int x, int y) { switch (snap_mode) { case SNAP_MODE_ENDPOINT: @@ -782,10 +727,7 @@ snap_polyline_handler(l, x, y) /* */ static void -snap_spline_handler(s, x, y) - F_spline *s; - int x; - int y; +snap_spline_handler(F_spline *s, int x, int y) { switch (snap_mode) { case SNAP_MODE_ENDPOINT: @@ -859,10 +801,7 @@ snap_spline_handler(s, x, y) /* */ static void -snap_text_handler(t, x, y) - F_text *t; - int x; - int y; +snap_text_handler(F_text *t, int x, int y) { F_line * f_line_p = build_text_bounding_box(t); snap_polyline_handler(f_line_p, x, y); @@ -871,10 +810,7 @@ snap_text_handler(t, x, y) Boolean -is_point_on_arc(a, x, y) - F_arc * a; - int x; - int y; +is_point_on_arc(F_arc *a, int x, int y) { /* * check if the found point is on the arc and not on the @@ -906,10 +842,7 @@ is_point_on_arc(a, x, y) /* */ static void -snap_arc_handler(a, x, y) - F_arc *a; - int x; - int y; +snap_arc_handler(F_arc *a, int x, int y) { switch (snap_mode) { case SNAP_MODE_ENDPOINT: @@ -1017,10 +950,7 @@ snap_arc_handler(a, x, y) /* */ static void -snap_ellipse_handler(e, x, y) - F_ellipse *e; - int x; - int y; +snap_ellipse_handler(F_ellipse *e, int x, int y) { switch (snap_mode) { case SNAP_MODE_ENDPOINT: @@ -1155,10 +1085,7 @@ snap_handler(void *p, int type, int x, int y, int px, int py) /* */ Boolean -snap_process(px, py, state) - int * px; - int * py; - unsigned int state; +snap_process(int *px, int *py, unsigned int state) { int hold_objmask = cur_objmask; @@ -1373,8 +1300,7 @@ Widget snap_indicator_label; void -init_snap_panel(parent) - Widget parent; +init_snap_panel(Widget parent) { Widget dlabel; DeclareArgs(10); -- 2.45.3 From 1423baef4f696b16f2a4adffce1a337c9efaba3a Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Sat, 1 Feb 2025 10:03:11 +0100 Subject: [PATCH 4/8] Remove obsolete declarations --- a/src/f_readpcx.c +++ b/src/f_readpcx.c @@ -110,8 +110,6 @@ read_pcx(F_pic *pic, struct xfig_stream *restrict pic_stream) file (actually a pipe). */ -void pcx_decode(); - int _read_pcx(FILE *pcxfile, F_pic *pic) { int i,w,h,bytepp,x,y,yy,byteline,plane,pmask; --- a/src/u_elastic.h +++ b/src/u_elastic.h @@ -53,7 +53,6 @@ extern void elastic_box(int x1, int y1, int x2, int y2); extern void elastic_fixedbox(void); extern void elastic_movebox(void); extern void resizing_box(int x, int y); -extern void elastic_box_constrained(); extern void constrained_resizing_box(int x, int y); extern void constrained_resizing_scale_box(int x, int y); extern void moving_box(int x, int y); @@ -80,10 +79,8 @@ extern void constrainedangle_line(int x, int y); extern void elastic_moveline(F_point *pts); extern void elastic_movenewline(void); extern void elastic_line(void); -extern void elastic_dimension_line(); extern void moving_line(int x, int y); extern void reshaping_line(int x, int y); -extern void reshaping_latexline(); extern void elastic_linelink(void); extern void elastic_scalepts(F_point *pts); extern void scaling_line(int x, int y); @@ -100,7 +97,6 @@ extern void elastic_scalearc(F_arc *a); extern void elastic_scale_curarc(void); extern void moving_text(int x, int y); -extern void draw_movingtext(); extern void elastic_movetext(void); extern void moving_spline(int x, int y); --- a/src/w_dir.h +++ b/src/w_dir.h @@ -84,7 +84,6 @@ extern void update_file_export_dir(const char *restrict dir); /* Xdir function declarations. */ -extern char *SaveString(); extern void MakeFullPath(char *root, char *filename, char *pathname); extern Boolean IsDirectory(char *path, char *file); extern void Rescan (Widget widget, XEvent *event, String *params, Cardinal *num_params); -- 2.45.3 From 99d4f5cff626c4367c2a95819d6c044edc1ed9bf Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Sat, 1 Feb 2025 22:10:05 +0100 Subject: [PATCH 5/8] Fix prototypes for moving callbacks --- a/src/d_arc.c +++ b/src/d_arc.c @@ -79,7 +79,7 @@ arc_drawing_selected(void) ell_arc = FALSE; set_mousefun("first point", "center point", "", "", "", ""); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; canvas_leftbut_proc = init_arc_drawing; canvas_middlebut_proc = init_arc_c_drawing; canvas_rightbut_proc = init_earc_c_drawing; --- a/src/d_arcbox.c +++ b/src/d_arcbox.c @@ -44,7 +44,7 @@ arcbox_drawing_selected(void) { set_mousefun("corner point", "", "", "", "", ""); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; canvas_leftbut_proc = init_arc_box_drawing; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; --- a/src/d_box.c +++ b/src/d_box.c @@ -44,7 +44,7 @@ box_drawing_selected(void) { set_mousefun("corner point", "", "", "", "", ""); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; canvas_leftbut_proc = init_box_drawing; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; --- a/src/d_ellipse.c +++ b/src/d_ellipse.c @@ -55,7 +55,7 @@ void circle_ellipse_byradius_drawing_selected(void) { canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; canvas_leftbut_proc = init_circlebyradius_drawing; canvas_middlebut_proc = init_ellipsebyradius_drawing; canvas_rightbut_proc = null_proc_button; @@ -142,7 +142,7 @@ void circle_ellipse_bydiameter_drawing_selected(void) { set_mousefun("Circle diameter", "Ellipse corner", "", "", "", ""); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; canvas_leftbut_proc = init_circlebydiameter_drawing; canvas_middlebut_proc = init_ellipsebydiameter_drawing; canvas_rightbut_proc = null_proc_button; --- a/src/d_line.c +++ b/src/d_line.c @@ -54,7 +54,7 @@ void line_drawing_selected(void) { canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; canvas_leftbut_proc = init_line_drawing; canvas_middlebut_proc = init_line_freehand_drawing; set_cursor(crosshair_cursor); --- a/src/d_picobj.c +++ b/src/d_picobj.c @@ -49,7 +49,7 @@ picobj_drawing_selected(void) { set_mousefun("corner point", "", "", "", "", ""); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; canvas_leftbut_proc = init_picobj_drawing; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; @@ -88,7 +88,7 @@ create_picobj(int x, int y, unsigned int shift) /* erase last lengths if appres.showlengths is true */ erase_lengths(); elastic_box(fix_x, fix_y, cur_x, cur_y); - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; if ((point = create_point()) == NULL) return; --- a/src/d_regpoly.c +++ b/src/d_regpoly.c @@ -48,7 +48,7 @@ regpoly_drawing_selected(void) { set_mousefun("center point", "", "", "", "", ""); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; canvas_leftbut_proc = init_regpoly_drawing; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; --- a/src/d_spline.c +++ b/src/d_spline.c @@ -52,7 +52,7 @@ spline_drawing_selected(void) { set_mousefun("first point", "freehand", "", "", "", ""); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; canvas_leftbut_proc = init_spline_drawing; canvas_middlebut_proc = init_spline_freehand_drawing; canvas_rightbut_proc = null_proc_button; --- a/src/d_text.c +++ b/src/d_text.c @@ -163,7 +163,7 @@ void text_drawing_selected(void) { canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; canvas_middlebut_proc = null_proc_button; canvas_leftbut_proc = init_text_input; canvas_rightbut_proc = null_proc_button; @@ -465,7 +465,7 @@ init_text_input(int x, int y, unsigned int shift) cur_y = y; /* clear canvas loc move proc in case we were in text select mode */ - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; set_action_on(); set_mousefun("new text", "finish text", "cancel", "", "paste text", ""); --- a/src/e_addpt.c +++ b/src/e_addpt.c @@ -51,8 +51,8 @@ point_adding_selected(void) { set_mousefun("break/add here", "", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_point_adding); canvas_leftbut_proc = object_search_left; canvas_middlebut_proc = null_proc_button; @@ -94,19 +94,19 @@ init_point_adding(F_line *p, int type, int x, int y, int px, int py) if (left_point == NULL || right_point == NULL) { if (latexline_mode || latexarrow_mode) { canvas_locmove_proc = latex_line; - canvas_ref_proc = elastic_line; + canvas_ref_proc = elastic_line_cb; return; } if (mountain_mode || manhattan_mode) { canvas_locmove_proc = constrainedangle_line; - canvas_ref_proc = elastic_line; + canvas_ref_proc = elastic_line_cb; return; } } else { force_noanglegeom(); } canvas_locmove_proc = reshaping_line; - canvas_ref_proc = elastic_linelink; + canvas_ref_proc = elastic_linelink_cb; } static void @@ -124,7 +124,7 @@ cancel_pointadding(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_linelink(); /* turn back on all relevant markers */ update_markers(new_objmask); @@ -134,7 +134,7 @@ cancel_pointadding(int x, int y, unsigned int shift) static void cancel_line_pointadding(int x, int y, unsigned int shift) { - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; if (left_point != NULL && right_point != NULL) pw_vector(canvas_win, left_point->x, left_point->y, right_point->x, right_point->y, PAINT, --- a/src/e_align.c +++ b/src/e_align.c @@ -70,8 +70,8 @@ align_selected(void) { set_mousefun("align compound", "align canvas", "", LOC_OBJ, "", LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_align); canvas_leftbut_proc = object_search_left; canvas_middlebut_proc = init_align_canvas; --- a/src/e_arrow.c +++ b/src/e_arrow.c @@ -51,8 +51,8 @@ arrow_head_selected(void) { set_mousefun("add arrow", "delete arrow", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(add_arrow_head); init_searchproc_middle(delete_arrow_head); canvas_leftbut_proc = point_search_left; --- a/src/e_break.c +++ b/src/e_break.c @@ -44,8 +44,8 @@ break_selected(void) { set_mousefun("break compound", "break and tag", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_break_only); init_searchproc_middle(init_break_tag); canvas_leftbut_proc = object_search_left; --- a/src/e_chop.c +++ b/src/e_chop.c @@ -88,8 +88,8 @@ chop_selected(void) LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(select_axe_object); init_searchproc_middle(select_log_object); /* init_searchproc_right(init_chop_right); */ /* fixme don't need this now */ --- a/src/e_compound.c +++ b/src/e_compound.c @@ -127,8 +127,8 @@ open_compound_selected(void) set_mousefun("open compound", "open, keep visible", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_open_compound); init_searchproc_middle(init_open_compound_vis); canvas_leftbut_proc = object_search_left; --- a/src/e_convert.c +++ b/src/e_convert.c @@ -53,8 +53,8 @@ convert_selected(void) { set_mousefun("spline<->line", "", "open<->closed", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_convert_line_spline); init_searchproc_right(init_convert_open_closed); canvas_leftbut_proc = object_search_left; --- a/src/e_copy.c +++ b/src/e_copy.c @@ -52,8 +52,8 @@ void copy_selected(void) { canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_arb_copy); init_searchproc_middle(init_constrained_copy); init_searchproc_right(init_copy_to_scrap); --- a/src/e_delete.c +++ b/src/e_delete.c @@ -66,8 +66,8 @@ delete_selected(void) set_mousefun("delete object", "delete region", "del to cut buf", LOC_OBJ, "", LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_delete); init_searchproc_right(init_delete_to_scrap); canvas_leftbut_proc = object_search_left; --- a/src/e_deletept.c +++ b/src/e_deletept.c @@ -46,8 +46,8 @@ delete_point_selected(void) { set_mousefun("delete point", "", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_delete_point); canvas_leftbut_proc = point_search_left; canvas_middlebut_proc = null_proc_button; --- a/src/e_edit.c +++ b/src/e_edit.c @@ -688,8 +688,8 @@ void edit_item_selected(void) set_mousefun("edit object", "edit Main comment", "edit point", LOC_OBJ, "show comments", LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(edit_item); init_searchproc_right(edit_spline_point); canvas_leftbut_proc = object_search_left; --- a/src/e_flip.c +++ b/src/e_flip.c @@ -103,8 +103,8 @@ flip_selected(void) set_mousefun("flip", "copy & flip", "set anchor", LOC_OBJ, LOC_OBJ, "set anchor"); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_flip); init_searchproc_middle(init_copynflip); canvas_leftbut_proc = object_search_left; --- a/src/e_glue.c +++ b/src/e_glue.c @@ -66,8 +66,8 @@ compound_selected(void) set_mousefun("tag object", "tag region", "compound tagged", LOC_OBJ, "", ""); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(tag_object); canvas_leftbut_proc = object_search_left; canvas_middlebut_proc = init_tag_region; --- a/src/e_joinsplit.c +++ b/src/e_joinsplit.c @@ -74,8 +74,8 @@ join_split_selected(void) LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_join); init_searchproc_middle(init_split); canvas_leftbut_proc = point_search_left; /* point search for join */ --- a/src/e_measure.c +++ b/src/e_measure.c @@ -90,8 +90,8 @@ void anglemeas_selected(void) { set_mousefun("first point", "select & save", "select object", "", LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_middle(init_anglemeas_object_m); init_searchproc_right(init_anglemeas_object_r); canvas_leftbut_proc = init_anglemeas_threepoints; @@ -202,7 +202,7 @@ init_anglemeas_threepoints(int px, int py, unsigned int shift) pa.y = fix_y = cur_y = py; np = 1; canvas_locmove_proc = freehand_line_nomsg; - canvas_ref_proc = elastic_line; + canvas_ref_proc = elastic_line_cb; canvas_leftbut_proc = anglemeas_second; canvas_middlebut_proc = null_proc_button; elastic_line(); @@ -315,8 +315,8 @@ void lenmeas_selected(void) { set_mousefun("select object", "select & add", "reset to 0", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_lenmeas_object_l); init_searchproc_middle(init_lenmeas_object_m); canvas_leftbut_proc = object_search_left; @@ -427,8 +427,8 @@ void areameas_selected(void) { set_mousefun("select object", "select & add", "reset to 0", LOC_OBJ, LOC_OBJ, "reset to +-0"); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_areameas_object_l); init_searchproc_middle(init_areameas_object_m); canvas_leftbut_proc = object_search_left; --- a/src/e_move.c +++ b/src/e_move.c @@ -43,7 +43,7 @@ move_selected(void) { set_mousefun("move object", "horiz/vert move", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; init_searchproc_left(init_arb_move); init_searchproc_middle(init_constrained_move); canvas_leftbut_proc = object_search_left; --- a/src/e_movept.c +++ b/src/e_movept.c @@ -81,8 +81,8 @@ void move_point_selected(void) { set_mousefun("move point", "horiz/vert move", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_arb_move_point); init_searchproc_middle(init_stretch_move_point); canvas_leftbut_proc = point_search_left; @@ -217,19 +217,19 @@ init_ellipsepointmoving(void) switch (cur_e->type) { case T_ELLIPSE_BY_RAD: canvas_locmove_proc = constrained_resizing_ebr; - canvas_ref_proc = elastic_ebr; + canvas_ref_proc = elastic_ebr_cb; break; case T_CIRCLE_BY_RAD: canvas_locmove_proc = resizing_cbr; - canvas_ref_proc = elastic_cbr; + canvas_ref_proc = elastic_cbr_cb; break; case T_ELLIPSE_BY_DIA: canvas_locmove_proc = constrained_resizing_ebd; - canvas_ref_proc = elastic_ebd; + canvas_ref_proc = elastic_ebd_cb; break; case T_CIRCLE_BY_DIA: canvas_locmove_proc = resizing_cbd; - canvas_ref_proc = elastic_cbd; + canvas_ref_proc = elastic_cbd_cb; break; } /* show current radius(ii) */ @@ -249,7 +249,7 @@ cancel_movedellipsepoint(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; /* erase elastic version */ switch (cur_e->type) { case T_ELLIPSE_BY_RAD: @@ -291,7 +291,7 @@ fix_movedellipsepoint(int x, int y, unsigned int shift) elastic_cbd(); break; } - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; adjust_box_pos(x, y, from_x, from_y, &cur_x, &cur_y); new_e = copy_ellipse(cur_e); relocate_ellipsepoint(new_e, cur_x, cur_y, movedpoint_num); @@ -374,7 +374,7 @@ init_arcpointmoving(void) cur_y = cur_a->point[movedpoint_num].y; set_cursor(crosshair_cursor); canvas_locmove_proc = reshaping_arc; - canvas_ref_proc = elastic_arclink; + canvas_ref_proc = elastic_arclink_cb; canvas_leftbut_proc = fix_movedarcpoint; canvas_rightbut_proc = cancel_movedarcpoint; elastic_arclink(); @@ -389,7 +389,7 @@ cancel_movedarcpoint(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_arclink(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -403,7 +403,7 @@ fix_movedarcpoint(int x, int y, unsigned int shift) { (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_arclink(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -475,27 +475,27 @@ init_splinepointmoving(void) } if (latexline_mode || latexarrow_mode) { canvas_locmove_proc = latex_line; - canvas_ref_proc = elastic_line; + canvas_ref_proc = elastic_line_cb; cur_latexcursor = crosshair_cursor; } else if (mountain_mode || manhattan_mode) { canvas_locmove_proc = constrainedangle_line; - canvas_ref_proc = elastic_line; + canvas_ref_proc = elastic_line_cb; } else { /* freehand line */ canvas_locmove_proc = reshaping_line; - canvas_ref_proc = elastic_linelink; + canvas_ref_proc = elastic_linelink_cb; } } else { /* linelink, always freehand */ force_noanglegeom(); canvas_locmove_proc = reshaping_line; - canvas_ref_proc = elastic_linelink; + canvas_ref_proc = elastic_linelink_cb; } } else { /* must be closed spline */ force_noanglegeom(); canvas_locmove_proc = reshaping_line; - canvas_ref_proc = elastic_linelink; + canvas_ref_proc = elastic_linelink_cb; if (left_point == NULL) { for (left_point = right_point; left_point->next != NULL; @@ -519,7 +519,7 @@ cancel_movedsplinepoint(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_linelink(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -534,7 +534,7 @@ fix_movedsplinepoint(int x, int y, unsigned int shift) (void)shift; (*canvas_locmove_proc) (x, y); - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_linelink(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -604,7 +604,7 @@ init_compoundpointmoving(void) sina = fabs(dy / l); } canvas_locmove_proc = constrained_resizing_scale_box; - canvas_ref_proc = elastic_fixedbox; + canvas_ref_proc = elastic_fixedbox_cb; canvas_leftbut_proc = fix_movedcompoundpoint; canvas_rightbut_proc = cancel_compound; /* show current length(s) */ @@ -618,7 +618,7 @@ cancel_compound(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -634,7 +634,7 @@ fix_movedcompoundpoint(int x, int y, unsigned int shift) (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -686,7 +686,7 @@ init_linepointmoving(void) left_point = p, p = p->next); force_noanglegeom(); canvas_locmove_proc = reshaping_line; - canvas_ref_proc = elastic_linelink; + canvas_ref_proc = elastic_linelink_cb; break; case T_BOX: @@ -713,7 +713,7 @@ init_linepointmoving(void) if (cur_l->thickness != 1) elastic_box(fix_x, fix_y, cur_x, cur_y); canvas_locmove_proc = constrained_resizing_box; - canvas_ref_proc = elastic_fixedbox; + canvas_ref_proc = elastic_fixedbox_cb; canvas_leftbut_proc = fix_box; canvas_rightbut_proc = cancel_movept_box; /* show current length(s) */ @@ -731,21 +731,21 @@ init_linepointmoving(void) } if (latexline_mode || latexarrow_mode) { canvas_locmove_proc = latex_line; - canvas_ref_proc = elastic_line; + canvas_ref_proc = elastic_line_cb; cur_latexcursor = crosshair_cursor; } else if (mountain_mode || manhattan_mode) { canvas_locmove_proc = constrainedangle_line; - canvas_ref_proc = elastic_line; + canvas_ref_proc = elastic_line_cb; } else { /* unconstrained or freehand line */ canvas_locmove_proc = reshaping_line; - canvas_ref_proc = elastic_linelink; + canvas_ref_proc = elastic_linelink_cb; } } else { /* linelink, always freehand */ force_noanglegeom(); canvas_locmove_proc = reshaping_line; - canvas_ref_proc = elastic_linelink; + canvas_ref_proc = elastic_linelink_cb; } break; } @@ -762,7 +762,7 @@ cancel_movept_box(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; /* erase the elastic box */ elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ @@ -779,7 +779,7 @@ fix_box(int x, int y, unsigned int shift) { (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_box_lengths(); @@ -841,7 +841,7 @@ cancel_movedlinepoint(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; /* erase the elastic line */ elastic_linelink(); /* erase last lengths if appres.showlengths is true */ @@ -859,7 +859,7 @@ fix_movedlinepoint(int x, int y, unsigned int shift) (void)shift; (*canvas_locmove_proc) (x, y); - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_linelink(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); --- a/src/e_placelib.c +++ b/src/e_placelib.c @@ -88,7 +88,7 @@ put_selected(void) orig_put_y = lib_compounds[cur_library_object]->corner.y; canvas_locmove_proc = init_move_object; - canvas_ref_proc = null_proc; + canvas_ref_proc = null_proc_move; canvas_leftbut_proc = place_lib_object; canvas_middlebut_proc = sel_place_lib_obj_proc; canvas_rightbut_proc = cancel_place_lib_obj; @@ -164,8 +164,8 @@ void sel_place_lib_obj(void) { canvas_kbd_proc = transform_lib_obj; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; @@ -220,7 +220,7 @@ place_lib_object_orig(int x, int y, unsigned int shift) (void)shift; int dx,dy; - canvas_ref_proc = null_proc; + canvas_ref_proc = null_proc_move; put_draw(ERASE); clean_up(); /* move back to original position */ @@ -245,8 +245,8 @@ place_lib_object(int x, int y, unsigned int shift) canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; put_draw(ERASE); clean_up(); if (draw_box) @@ -276,14 +276,14 @@ static void move_object(int x, int y) { int dx,dy; - void (*save_canvas_locmove_proc) (); - void (*save_canvas_ref_proc) (); + void (*save_canvas_locmove_proc) (int x, int y); + void (*save_canvas_ref_proc) (int x, int y); save_canvas_locmove_proc = canvas_locmove_proc; save_canvas_ref_proc = canvas_ref_proc; /* so we don't recurse infinitely */ - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; put_draw(ERASE); if (!draw_box) { dx=x-cur_x; @@ -323,8 +323,8 @@ cancel_place_lib_obj(int x, int y, unsigned int shift) canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; canvas_kbd_proc = null_proc_kbd; clear_mousefun(); set_mousefun("","","", "", "", ""); --- a/src/e_rotate.c +++ b/src/e_rotate.c @@ -110,8 +110,8 @@ rotate_selected(void) set_mousefun("rotate object", "copy & rotate", "set center", LOC_OBJ, LOC_OBJ, "set center"); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_rotate); init_searchproc_middle(init_copynrotate); canvas_leftbut_proc = object_search_left; --- a/src/e_scale.c +++ b/src/e_scale.c @@ -106,8 +106,8 @@ scale_selected(void) set_mousefun("scale box", "scale about center", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_box_scale); init_searchproc_middle(init_center_scale); canvas_leftbut_proc = object_search_left; @@ -255,11 +255,11 @@ init_boxscale_ellipse(int x, int y) if ((cur_e->type == T_CIRCLE_BY_DIA) || (cur_e->type == T_CIRCLE_BY_RAD)) { canvas_locmove_proc = constrained_resizing_cbd; - canvas_ref_proc = elastic_cbd; + canvas_ref_proc = elastic_cbd_cb; elastic_cbd(); } else { canvas_locmove_proc = constrained_resizing_ebd; - canvas_ref_proc = elastic_ebd; + canvas_ref_proc = elastic_ebd_cb; elastic_ebd(); } canvas_leftbut_proc = fix_boxscale_ellipse; @@ -274,7 +274,7 @@ cancel_boxscale_ellipse(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; if ((cur_e->type == T_CIRCLE_BY_DIA) || (cur_e->type == T_CIRCLE_BY_RAD)) elastic_cbd(); @@ -385,7 +385,7 @@ cancel_scale_ellipse(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_scaleellipse(cur_e); toggle_ellipsemarker(cur_e); wrapup_scale(); @@ -463,7 +463,7 @@ cancel_scale_arc(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_scalearc(cur_a); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -584,7 +584,7 @@ cancel_scale_spline(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_scalepts(cur_s->points); toggle_splinemarker(cur_s); wrapup_scale(); @@ -596,7 +596,7 @@ fix_scale_spline(int x, int y, unsigned int shift) (void)shift; elastic_scalepts(cur_s->points); - canvas_ref_proc = null_proc; + canvas_ref_proc = null_proc_move; adjust_box_pos(x, y, from_x, from_y, &x, &y); /* make a copy of the original and save as unchanged object */ old_s = copy_spline(cur_s); @@ -696,7 +696,7 @@ init_boxscale_compound(int x, int y) boxsize_scale_msg(1); elastic_box(fix_x, fix_y, cur_x, cur_y); canvas_locmove_proc = constrained_resizing_scale_box; - canvas_ref_proc = elastic_fixedbox; + canvas_ref_proc = elastic_fixedbox_cb; canvas_leftbut_proc = fix_boxscale_compound; canvas_rightbut_proc = cancel_boxscale_compound; return True; @@ -709,7 +709,7 @@ cancel_boxscale_compound(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -762,7 +762,7 @@ cancel_scale_compound(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_scalecompound(cur_c); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -1324,7 +1324,7 @@ init_boxscale_line(int x, int y) boxsize_msg(1); elastic_box(fix_x, fix_y, cur_x, cur_y); canvas_locmove_proc = constrained_resizing_box; - canvas_ref_proc = elastic_fixedbox; + canvas_ref_proc = elastic_fixedbox_cb; canvas_leftbut_proc = fix_boxscale_line; canvas_rightbut_proc = cancel_boxscale_line; return True; @@ -1337,7 +1337,7 @@ cancel_boxscale_line(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -1441,7 +1441,7 @@ cancel_scale_line(int x, int y, unsigned shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_scalepts(cur_l->points); /* erase last lengths if appres.showlengths is true */ erase_lengths(); --- a/src/e_tangent.c +++ b/src/e_tangent.c @@ -50,8 +50,8 @@ tangent_selected(void) { set_mousefun("add tangent", "add normal", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = smart_null_proc; - canvas_ref_proc = smart_null_proc; + canvas_locmove_proc = smart_null_proc_move; + canvas_ref_proc = smart_null_proc_move; init_smart_searchproc_left(init_tangent_adding); init_smart_searchproc_middle(init_normal_adding); canvas_leftbut_proc = smart_object_search_left; --- a/src/e_update.c +++ b/src/e_update.c @@ -94,8 +94,8 @@ update_selected(void) set_mousefun("update object", "update settings", "", LOC_OBJ, LOC_OBJ, LOC_OBJ); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; init_searchproc_left(init_update_object); init_searchproc_middle(init_update_settings); canvas_leftbut_proc = object_search_left; --- a/src/u_drag.c +++ b/src/u_drag.c @@ -60,7 +60,7 @@ init_ellipsedragging(F_ellipse *e, int x, int y) y1off = (e->center.y - e->radiuses.y) - cur_y; y2off = (e->center.y + e->radiuses.y) - cur_y; canvas_locmove_proc = moving_ellipse; - canvas_ref_proc = elastic_moveellipse; + canvas_ref_proc = elastic_moveellipse_cb; canvas_leftbut_proc = place_ellipse; canvas_middlebut_proc = array_place_ellipse; canvas_rightbut_proc = cancel_ellipse; @@ -75,7 +75,7 @@ cancel_ellipse(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_moveellipse(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -163,8 +163,8 @@ place_ellipse_x(int x, int y) canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; adjust_pos(x, y, fix_x, fix_y, &x, &y); translate_ellipse(new_e, x - fix_x, y - fix_y); if (return_proc == copy_selected) { @@ -209,7 +209,7 @@ cancel_drag_arc(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_movearc(new_a); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -296,8 +296,8 @@ place_arc_x(int x, int y) canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; adjust_pos(x, y, fix_x, fix_y, &x, &y); translate_arc(new_a, x - fix_x, y - fix_y); if (return_proc == copy_selected) { @@ -348,7 +348,7 @@ cancel_line(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_moveline(new_l->points); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -435,8 +435,8 @@ place_line_x(int x, int y) canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; adjust_pos(x, y, fix_x, fix_y, &x, &y); dx = x - fix_x; dy = y - fix_y; @@ -488,7 +488,7 @@ init_textdragging(F_text *t, int x, int y) text_origin(&x1off, &y1off, x1off, y1off, t->type, t->offset); canvas_locmove_proc = moving_text; - canvas_ref_proc = elastic_movetext; + canvas_ref_proc = elastic_movetext_cb; canvas_leftbut_proc = place_text; canvas_middlebut_proc = array_place_text; canvas_rightbut_proc = cancel_text; @@ -557,7 +557,7 @@ cancel_text(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; /* move the text back to the original position, to clear the text at the last position it was dragged to */ moving_text(new_t->base_x + x1off, new_t->base_y + y1off); @@ -592,8 +592,8 @@ place_text_x(int x, int y) canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; adjust_pos(x, y, fix_x, fix_y, &x, &y); translate_text(new_t, x - fix_x, y - fix_y); if (return_proc == copy_selected) { @@ -638,7 +638,7 @@ cancel_spline(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_moveline(new_s->points); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -725,8 +725,8 @@ place_spline_x(int x, int y) canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; adjust_pos(x, y, fix_x, fix_y, &x, &y); translate_spline(new_s, x - fix_x, y - fix_y); if (return_proc == copy_selected) { @@ -760,7 +760,7 @@ init_compounddragging(F_compound *c, int x, int y) y1off = c->nwcorner.y - y; y2off = c->secorner.y - y; canvas_locmove_proc = moving_box; - canvas_ref_proc = elastic_movebox; + canvas_ref_proc = elastic_movebox_cb; canvas_leftbut_proc = place_compound; canvas_middlebut_proc = array_place_compound; canvas_rightbut_proc = cancel_drag_compound; @@ -776,7 +776,7 @@ cancel_drag_compound(int x, int y, unsigned int shift) (void)y; (void)shift; - canvas_ref_proc = canvas_locmove_proc = null_proc; + canvas_ref_proc = canvas_locmove_proc = null_proc_move; elastic_movebox(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); @@ -866,8 +866,8 @@ place_compound_x(int x, int y) canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; adjust_pos(x, y, fix_x, fix_y, &x, &y); dx = x - fix_x; dy = y - fix_y; --- a/src/u_elastic.c +++ b/src/u_elastic.c @@ -82,6 +82,15 @@ elastic_fixedbox(void) elastic_box(fix_x, fix_y, cur_x, cur_y); } +void +elastic_fixedbox_cb(int x, int y) +{ + (void)x; + (void)y; + + elastic_fixedbox(); +} + void elastic_movebox(void) { @@ -95,6 +104,15 @@ elastic_movebox(void) elastic_links(cur_x - fix_x, cur_y - fix_y, 1.0, 1.0); } +void +elastic_movebox_cb(int x, int y) +{ + (void)x; + (void)y; + + elastic_movebox(); +} + void moving_box(int x, int y) { @@ -141,8 +159,11 @@ scaling_compound(int x, int y) } void -elastic_scale_curcompound(void) +elastic_scale_curcompound(int x, int y) { + (void)x; + (void)y; + elastic_scalecompound(cur_c); } @@ -182,6 +203,15 @@ elastic_line(void) INV_PAINT, 1, RUBBER_LINE, 0.0, DEFAULT); } +void +elastic_line_cb(int x, int y) +{ + (void)x; + (void)y; + + elastic_line(); +} + /* this is only called by get_intermediatepoint() for drawing lines and by the canvas_locmove_proc for drawing arcs */ @@ -331,6 +361,15 @@ elastic_linelink(void) } } +void +elastic_linelink_cb(int x, int y) +{ + (void)x; + (void)y; + + elastic_linelink(); +} + void moving_line(int x, int y) { @@ -341,8 +380,11 @@ moving_line(int x, int y) } void -elastic_movenewline(void) +elastic_movenewline(int x, int y) { + (void)x; + (void)y; + elastic_moveline(new_l->points); } @@ -446,8 +488,11 @@ scaling_spline(int x, int y) } void -elastic_scale_curspline(void) +elastic_scale_curspline(int x, int y) { + (void)x; + (void)y; + elastic_scalepts(cur_s->points); } @@ -545,6 +590,15 @@ elastic_ebr(void) } } +void +elastic_ebr_cb(int x, int y) +{ + (void)x; + (void)y; + + elastic_ebr(); +} + void resizing_ebr(int x, int y) { @@ -583,6 +637,15 @@ elastic_ebd(void) } } +void +elastic_ebd_cb(int x, int y) +{ + (void)x; + (void)y; + + elastic_ebd(); +} + void resizing_ebd(int x, int y) { @@ -619,6 +682,15 @@ elastic_cbr(void) RUBBER_LINE, 0.0, UNFILLED, DEFAULT, DEFAULT, CAP_BUTT); } +void +elastic_cbr_cb(int x, int y) +{ + (void)x; + (void)y; + + elastic_cbr(); +} + void resizing_cbr(int x, int y) { @@ -647,6 +719,15 @@ elastic_cbd(void) RUBBER_LINE, 0.0, UNFILLED, DEFAULT, DEFAULT, CAP_BUTT); } +void +elastic_cbd_cb(int x, int y) +{ + (void)x; + (void)y; + + elastic_cbd(); +} + void resizing_cbd(int x, int y) { @@ -685,6 +766,15 @@ elastic_moveellipse(void) } } +void +elastic_moveellipse_cb(int x, int y) +{ + (void)x; + (void)y; + + elastic_moveellipse(); +} + void moving_ellipse(int x, int y) { @@ -743,8 +833,11 @@ scaling_ellipse(int x, int y) } void -elastic_scale_curellipse(void) +elastic_scale_curellipse(int x, int y) { + (void)x; + (void)y; + elastic_scaleellipse(cur_e); } @@ -809,6 +902,15 @@ elastic_arclink(void) } } +void +elastic_arclink_cb(int x, int y) +{ + (void)x; + (void)y; + + elastic_arclink(); +} + void moving_arc(int x, int y) { @@ -819,8 +921,11 @@ moving_arc(int x, int y) } void -elastic_movenewarc(void) +elastic_movenewarc(int x, int y) { + (void)x; + (void)y; + elastic_movearc(new_a); } @@ -859,8 +964,11 @@ scaling_arc(int x, int y) } void -elastic_scale_curarc(void) +elastic_scale_curarc(int x, int y) { + (void)x; + (void)y; + elastic_scalearc(cur_a); } @@ -931,6 +1039,15 @@ elastic_movetext(void) new_t->cstring, new_t->color); } +void +elastic_movetext_cb(int x, int y) +{ + (void)x; + (void)y; + + elastic_movetext(); +} + /*************************** SPLINES *************************/ @@ -944,8 +1061,11 @@ moving_spline(int x, int y) } void -elastic_movenewspline(void) +elastic_movenewspline(int x, int y) { + (void)x; + (void)y; + elastic_moveline(new_s->points); } --- a/src/u_elastic.h +++ b/src/u_elastic.h @@ -51,7 +51,9 @@ extern F_point *left_point, *right_point; extern void elastic_box(int x1, int y1, int x2, int y2); extern void elastic_fixedbox(void); +extern void elastic_fixedbox_cb(int x, int y); extern void elastic_movebox(void); +extern void elastic_movebox_cb(int x, int y); extern void resizing_box(int x, int y); extern void constrained_resizing_box(int x, int y); extern void constrained_resizing_scale_box(int x, int y); @@ -61,27 +63,32 @@ extern void elastic_poly(int x1, int y1, int x2, int y2, int numsides); extern void resizing_poly(int x, int y); extern void scaling_compound(int x, int y); extern void elastic_scalecompound(F_compound *c); -extern void elastic_scale_curcompound(void); +extern void elastic_scale_curcompound(int x, int y); -extern void resizing_cbr(int x, int y), elastic_cbr(void), resizing_cbd(int x, int y), elastic_cbd(void); -extern void resizing_ebr(int x, int y), elastic_ebr(void), resizing_ebd(int x, int y), elastic_ebd(void); +extern void resizing_cbr(int x, int y), elastic_cbr(void), elastic_cbr_cb(int x, int y); +extern void resizing_cbd(int x, int y), elastic_cbd(void), elastic_cbd_cb(int x, int y); +extern void resizing_ebr(int x, int y), elastic_ebr(void), elastic_ebr_cb(int x, int y); +extern void resizing_ebd(int x, int y), elastic_ebd(void), elastic_ebd_cb(int x, int y); extern void constrained_resizing_ebr(int x, int y), constrained_resizing_ebd(int x, int y); extern void constrained_resizing_cbd(int x, int y); extern void elastic_moveellipse(void); +extern void elastic_moveellipse_cb(int x, int y); extern void moving_ellipse(int x, int y); extern void elastic_scaleellipse(F_ellipse *e); extern void scaling_ellipse(int x, int y); -extern void elastic_scale_curellipse(void); +extern void elastic_scale_curellipse(int x, int y); extern void unconstrained_line(int x, int y); extern void latex_line(int x, int y); extern void constrainedangle_line(int x, int y); extern void elastic_moveline(F_point *pts); -extern void elastic_movenewline(void); +extern void elastic_movenewline(int x, int y); extern void elastic_line(void); +extern void elastic_line_cb(int x, int y); extern void moving_line(int x, int y); extern void reshaping_line(int x, int y); extern void elastic_linelink(void); +extern void elastic_linelink_cb(int x, int y); extern void elastic_scalepts(F_point *pts); extern void scaling_line(int x, int y); extern void elastic_scale_curline(int x, int y); @@ -89,20 +96,22 @@ extern void elastic_scale_curline(int x, int y); extern void arc_point(int x, int y, int numpoint); extern void moving_arc(int x, int y); extern void elastic_movearc(F_arc *a); -extern void elastic_movenewarc(void); +extern void elastic_movenewarc(int x, int y); extern void reshaping_arc(int x, int y); extern void elastic_arclink(void); +extern void elastic_arclink_cb(int x, int y); extern void scaling_arc(int x, int y); extern void elastic_scalearc(F_arc *a); -extern void elastic_scale_curarc(void); +extern void elastic_scale_curarc(int x, int y); extern void moving_text(int x, int y); extern void elastic_movetext(void); +extern void elastic_movetext_cb(int x, int y); extern void moving_spline(int x, int y); -extern void elastic_movenewspline(void); +extern void elastic_movenewspline(int x, int y); extern void scaling_spline(int x, int y); -extern void elastic_scale_curspline(void); +extern void elastic_scale_curspline(int x, int y); extern void adjust_box_pos(int curs_x, int curs_y, int orig_x, int orig_y, int *ret_x, int *ret_y); extern void adjust_pos(int curs_x, int curs_y, int orig_x, int orig_y, int *ret_x, int *ret_y); --- a/src/u_smartsearch.c +++ b/src/u_smartsearch.c @@ -506,6 +506,15 @@ smart_null_proc(void) smart_erase_objecthighlight(); } +void +smart_null_proc_move(int x, int y) +{ + (void)x; + (void)y; + + smart_null_proc(); +} + void smart_null_proc_button(int x, int y, unsigned int shift) { --- a/src/u_smartsearch.h +++ b/src/u_smartsearch.h @@ -31,6 +31,7 @@ void smart_object_search_left(int x, int y, unsigned int shift); void smart_object_search_middle(int x, int y, unsigned int shift); void smart_object_search_right(int x, int y, unsigned int shift); void smart_null_proc(void); +void smart_null_proc_move(int x, int y); void smart_null_proc_button(int x, int y, unsigned int shift); extern F_point smart_point1, smart_point2; --- a/src/w_canvas.c +++ b/src/w_canvas.c @@ -70,8 +70,8 @@ /*********************** EXPORTS ************************/ void (*canvas_kbd_proc) (char *c, int clen, KeySym keysym); -void (*canvas_locmove_proc) (); -void (*canvas_ref_proc) (); +void (*canvas_locmove_proc) (int x, int y); +void (*canvas_ref_proc) (int x, int y); void (*canvas_leftbut_proc) (int x, int y, unsigned int shift); void (*canvas_middlebut_proc) (int x, int y, unsigned int shift); void (*canvas_middlebut_save) (int x, int y, unsigned int shift); @@ -107,7 +107,7 @@ static void popup_mode_panel(Widget widget, XButtonEvent *event, static void popdown_mode_panel(void); -void +static void null_proc(void) { /* almost does nothing */ @@ -115,6 +115,15 @@ null_proc(void) erase_objecthighlight(); } +void +null_proc_move(int x, int y) +{ + (void)x; + (void)y; + + null_proc(); +} + void null_proc_button(int x, int y, unsigned int shift) { @@ -223,7 +232,7 @@ init_canvas(Widget tool) canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; + canvas_locmove_proc = null_proc_move; XtAugmentTranslations(canvas_sw, XtParseTranslationTable(canvas_translations)); readComposeKey(); --- a/src/w_canvas.h +++ b/src/w_canvas.h @@ -25,14 +25,14 @@ extern void init_canvas(Widget tool); extern void add_canvas_actions(void); extern void (*canvas_kbd_proc) (char *c, int clen, KeySym keysym); -extern void (*canvas_locmove_proc) (); -extern void (*canvas_ref_proc) (); +extern void (*canvas_locmove_proc) (int x, int y); +extern void (*canvas_ref_proc) (int x, int y); extern void (*canvas_leftbut_proc) (int x, int y, unsigned int shift); extern void (*canvas_middlebut_proc) (int x, int y, unsigned int shift); extern void (*canvas_middlebut_save) (int x, int y, unsigned int shift); extern void (*canvas_rightbut_proc) (int x, int y, unsigned int shift); extern void (*return_proc) (void); -extern void null_proc(void); +extern void null_proc_move(int x, int y); extern void null_proc_button(int x, int y, unsigned int shift); extern void null_proc_kbd(char *c, int clen, KeySym keysym); extern void toggle_show_balloons(void); --- a/src/w_cmdpanel.c +++ b/src/w_cmdpanel.c @@ -642,7 +642,7 @@ paste(Widget w, XtPointer closure, XtPointer call_data) return; } /* redraw all of the pictures already on the canvas */ - canvas_ref_proc = null_proc; + canvas_ref_proc = null_proc_move; redraw_images(&objects); put_msg("Reading objects from \"%s\" ...Done", cut_buf_name); @@ -683,8 +683,8 @@ cancel_paste(int x, int y, unsigned int shift) canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; clear_mousefun(); set_mousefun("","","", "", "", ""); turn_off_current(); @@ -708,14 +708,14 @@ static void move_paste_object(int x, int y) { int dx,dy; - void (*save_canvas_locmove_proc) (); - void (*save_canvas_ref_proc) (); + void (*save_canvas_locmove_proc) (int x, int y); + void (*save_canvas_ref_proc) (int x, int y); save_canvas_locmove_proc = canvas_locmove_proc; save_canvas_ref_proc = canvas_ref_proc; /* so we don't recurse infinitely */ - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; paste_draw(ERASE); dx=x-cur_x; dy=y-cur_y; @@ -762,7 +762,7 @@ place_object_orig_posn(int x, int y, unsigned int shift) (void)shift; int dx,dy; - canvas_ref_proc = null_proc; + canvas_ref_proc = null_proc_move; paste_draw(ERASE); clean_up(); /* move back to original position */ --- a/src/w_library.c +++ b/src/w_library.c @@ -284,8 +284,8 @@ library_cancel(Widget w, XButtonEvent *ev) /* otherwise, cancel all library operations */ reset_action_on(); canvas_kbd_proc = null_proc_kbd; - canvas_locmove_proc = null_proc; - canvas_ref_proc = null_proc; + canvas_locmove_proc = null_proc_move; + canvas_ref_proc = null_proc_move; canvas_leftbut_proc = null_proc_button; canvas_middlebut_proc = null_proc_button; canvas_rightbut_proc = null_proc_button; --- a/src/w_zoom.c +++ b/src/w_zoom.c @@ -43,8 +43,8 @@ static void do_zoom(int x, int y, unsigned int shift); static void init_zoombox_drawing(int x, int y); static void (*save_kbd_proc) (char *c, int clen, KeySym keysym); -static void (*save_locmove_proc) (); -static void (*save_ref_proc) (); +static void (*save_locmove_proc) (int x, int y); +static void (*save_ref_proc) (int x, int y); static void (*save_leftbut_proc) (int x, int y, unsigned int shift); static void (*save_middlebut_proc) (int x, int y, unsigned int shift); static void (*save_rightbut_proc) (int x, int y, unsigned int shift); @@ -114,8 +114,11 @@ my_box(int x, int y) } static void -elastic_mybox(void) +elastic_mybox(int x, int y) { + (void)x; + (void)y; + elastic_box(my_fix_x, my_fix_y, my_cur_x, my_cur_y); } -- 2.45.3 From 4c32a8db6429054b9d781281ac1d4b356a7a2205 Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Sun, 2 Feb 2025 17:37:11 +0100 Subject: [PATCH 6/8] Fix prototypes for manipulation callbacks --- a/src/e_addpt.c +++ b/src/e_addpt.c @@ -17,6 +17,7 @@ #include "e_addpt.h" +#include #include #include "resources.h" @@ -38,7 +39,7 @@ #include "w_modepanel.h" -static void init_point_adding(F_line *p, int type, int x, int y, int px, int py); +static void init_point_adding(void *obj, int type, int x, int y, ...); static void fix_linepoint_adding(int x, int y, unsigned int shift); static void fix_splinepoint_adding(int x, int y, unsigned int shift); static void init_linepointadding(int px, int py); @@ -65,23 +66,32 @@ point_adding_selected(void) } static void -init_point_adding(F_line *p, int type, int x, int y, int px, int py) +init_point_adding(void *obj, int type, int x, int y, ...) { + va_list args; + int px; + int py; + (void)x; (void)y; + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + set_action_on(); set_mousefun("place new point", "", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); set_cursor(null_cursor); switch (type) { case O_POLYLINE: - cur_l = (F_line *) p; + cur_l = (F_line *) obj; /* the search routine will ensure that we don't have a box */ init_linepointadding(px, py); break; case O_SPLINE: - cur_s = (F_spline *) p; + cur_s = (F_spline *) obj; init_splinepointadding(px, py); break; default: --- a/src/e_align.c +++ b/src/e_align.c @@ -51,7 +51,7 @@ static Boolean pos_spline(F_spline *s, int *min, int *size, int dir); static Boolean pos_text(F_text *t, int *min, int *size, int dir); static Boolean pos_compound(F_compound *c, int *min, int *size, int dir); -static void init_align(F_line *p, int type, int x, int y, int px, int py); +static void init_align(void *obj, int type, int x, int y, ...); static void init_align_canvas(int x, int y, unsigned int shift); static void align_arc(void); static void align_ellipse(void); @@ -139,16 +139,14 @@ init_align_canvas(int x, int y, unsigned int shift) } static void -init_align(F_line *p, int type, int x, int y, int px, int py) +init_align(void *obj, int type, int x, int y, ...) { (void)x; (void)y; - (void)px; - (void)py; if (type != O_COMPOUND) return; - cur_c = (F_compound *) p; + cur_c = (F_compound *) obj; toggle_compoundmarker(cur_c); draw_compoundelements(cur_c, ERASE); old_c = copy_compound(cur_c); --- a/src/e_arrow.c +++ b/src/e_arrow.c @@ -18,6 +18,7 @@ #include "e_arrow.h" +#include #include #include "resources.h" @@ -34,10 +35,8 @@ #include "w_mousefun.h" -static void add_arrow_head(F_line *obj, int type, int x, int y, - F_point *p, F_point *q, int pnum); -static void delete_arrow_head(F_line *obj, int type, int x, int y, - F_point *p, F_point *q, int pnum); +static void add_arrow_head(void *obj, int type, int x, int y, ...); +static void delete_arrow_head(void *obj, int type, int x, int y, ...); static void add_linearrow(F_line *line, F_point *prev_point, F_point *selected_point); static void add_arcarrow(F_arc *arc, int point_num); @@ -63,12 +62,22 @@ arrow_head_selected(void) } static void -add_arrow_head(F_line *obj, int type, int x, int y, F_point *p, F_point *q, - int pnum) +add_arrow_head(void *obj, int type, int x, int y, ...) { (void)x; (void)y; + va_list args; + F_point *p; + F_point *q; + int pnum; + + va_start(args, y); + p = va_arg(args, F_point*); + q = va_arg(args, F_point*); + pnum = va_arg(args, int); + va_end(args); + switch (type) { case O_POLYLINE: cur_l = (F_line *) obj; @@ -86,12 +95,22 @@ add_arrow_head(F_line *obj, int type, int x, int y, F_point *p, F_point *q, } static void -delete_arrow_head(F_line *obj, int type, int x, int y, F_point *p, F_point *q, - int pnum) +delete_arrow_head(void *obj, int type, int x, int y, ...) { (void)x; (void)y; + F_point *p; + F_point *q; + int pnum; + + va_list args; + va_start(args, y); + p = va_arg(args, F_point*); + q = va_arg(args, F_point*); + pnum = va_arg(args, int); + va_end(args); + switch (type) { case O_POLYLINE: cur_l = (F_line *) obj; --- a/src/e_break.c +++ b/src/e_break.c @@ -30,12 +30,9 @@ #include "w_mousefun.h" -static void init_break(F_line *p, int type, int x, int y, int px, int py, - int loc_tag); -static void init_break_only(F_line *p, int type, int x, int y, int px, - int py); -static void init_break_tag(F_line *p, int type, int x, int y, int px, - int py); +static void init_break(void *obj, int type, int loc_tag); +static void init_break_only(void *obj, int type, int x, int y, ...); +static void init_break_tag(void *obj, int type, int x, int y, ...); @@ -56,29 +53,28 @@ break_selected(void) } static void -init_break_only(F_line *p, int type, int x, int y, int px, int py) +init_break_only(void *obj, int type, int x, int y, ...) { - init_break(p, type, x, y, px, py, 0); + (void)x; + (void)y; + init_break(obj, type, 0); } static void -init_break_tag(F_line *p, int type, int x, int y, int px, int py) +init_break_tag(void *obj, int type, int x, int y, ...) { - init_break(p, type, x, y, px, py, 1); + (void)x; + (void)y; + init_break(obj, type, 1); } static void -init_break(F_line *p, int type, int x, int y, int px, int py, int loc_tag) +init_break(void *obj, int type, int loc_tag) { - (void)x; - (void)y; - (void)px; - (void)py; - if (type != O_COMPOUND) return; - cur_c = (F_compound *) p; + cur_c = (F_compound *)obj; mask_toggle_compoundmarker(cur_c); clean_up(); list_delete_compound(&objects.compounds, cur_c); --- a/src/e_chop.c +++ b/src/e_chop.c @@ -44,8 +44,8 @@ #include "w_snap.h" #include "xfig_math.h" -static void select_axe_object(); -static void select_log_object(); +static void select_axe_object(void *obj, int type, int x, int y, ...); +static void select_log_object(void *obj, int type, int x, int y, ...); static void clear_axe_objects(int x, int y, unsigned shift); typedef struct { @@ -107,9 +107,9 @@ chop_selected(void) } static void -select_axe_object(void *obj, int type, int x, int y, F_point *p, F_point * q) +select_axe_object(void *obj, int type, int x, int y, ...) { - (void)x; (void)y; (void)p; (void)q; + (void)x; (void)y; int i; @@ -847,10 +847,8 @@ chop_ellipse(F_ellipse * e, int x, int y) } static void -select_log_object(void *obj, int type, int x, int y, F_point *p, F_point *q) +select_log_object(void *obj, int type, int x, int y, ...) { - (void)p; - (void)q; Boolean rc; switch(type) { --- a/src/e_compound.c +++ b/src/e_compound.c @@ -66,31 +66,25 @@ static void popup_close_compound (void); static void -init_open_compound(F_compound *c, int type, int x, int y, int px, int py) +init_open_compound(void *obj, int type, int x, int y, ...) { (void)x; (void)y; - (void)px; - (void)py; if (type != O_COMPOUND) return; - open_this_compound(c, False); + open_this_compound((F_compound*)obj, False); } static void -init_open_compound_vis(F_compound *c, int type, int x, int y, int px, int py, - int loc_tag) +init_open_compound_vis(void *obj, int type, int x, int y, ...) { (void)x; (void)y; - (void)px; - (void)py; - (void)loc_tag; if (type != O_COMPOUND) return; - open_this_compound(c, True); + open_this_compound((F_compound*)obj, True); } void --- a/src/e_convert.c +++ b/src/e_convert.c @@ -19,6 +19,7 @@ #include "e_convert.h" +#include #include #include "resources.h" @@ -41,10 +42,8 @@ #include "w_msgpanel.h" -static void init_convert_line_spline(F_line *p, int type, int x, int y, - int px, int py); -static void init_convert_open_closed(F_line *obj, int type, int x, int y, - F_point *p, F_point *q); +static void init_convert_line_spline(void *obj, int type, int x, int y, ...); +static void init_convert_open_closed(void *obj, int type, int x, int y, ...); @@ -65,12 +64,20 @@ convert_selected(void) } static void -init_convert_open_closed(F_line *obj, int type, int x, int y, F_point *p, - F_point *q) +init_convert_open_closed(void *obj, int type, int x, int y, ...) { (void)x; (void)y; + va_list args; + F_point *p; + F_point *q; + + va_start(args, y); + p = va_arg(args, F_point*); + q = va_arg(args, F_point*); + va_end(args); + switch (type) { case O_POLYLINE: cur_l = (F_line *) obj; @@ -86,15 +93,15 @@ init_convert_open_closed(F_line *obj, int type, int x, int y, F_point *p, } static void -init_convert_line_spline(F_line *p, int type, int x, int y, int px, int py) +init_convert_line_spline(void *obj, int type, int x, int y, ...) { - (void)x; (void)y; (void)px; (void)py; + (void)x; (void)y; static int flag = 0; switch (type) { case O_POLYLINE: - cur_l = (F_line *) p; + cur_l = (F_line *) obj; /* the search routine will ensure that we don't have a box */ if (cur_l->type == T_POLYLINE || cur_l->type == T_POLYGON) { line_spline(cur_l, cur_l->type == T_POLYGON ? @@ -105,7 +112,7 @@ init_convert_line_spline(F_line *p, int type, int x, int y, int px, int py) } break; case O_SPLINE: - cur_s = (F_spline *) p; + cur_s = (F_spline *) obj; flag = (cur_s->type==T_OPEN_INTERP) || (cur_s->type==T_CLOSED_INTERP); spline_line(cur_s); break; --- a/src/e_copy.c +++ b/src/e_copy.c @@ -39,12 +39,10 @@ #include "w_msgpanel.h" /* local routine declarations */ -static void init_copy(F_line *p, int type, int x, int y, int px, int py); -static void init_arb_copy(F_line *p, int type, int x, int y, int px,int py); -static void init_constrained_copy(F_line *p, int type, int x, int y, int px, - int py); -static void init_copy_to_scrap(F_line *p, int type, int x, int y, int px, - int py); +static void init_copy(void *obj, int type, int x, int y, int px, int py); +static void init_arb_copy(void *obj, int type, int x, int y, ...); +static void init_constrained_copy(void *obj, int type, int x, int y, ...); +static void init_copy_to_scrap(void *obj, int type, int x, int y, ...); @@ -68,64 +66,82 @@ copy_selected(void) } static void -init_arb_copy(F_line *p, int type, int x, int y, int px, int py) +init_arb_copy(void *obj, int type, int x, int y, ...) { + va_list args; + int px; + int py; + + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + constrained = MOVE_ARB; - init_copy(p, type, x, y, px, py); + init_copy(obj, type, x, y, px, py); set_mousefun("place object", "array placement", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); } static void -init_constrained_copy(F_line *p, int type, int x, int y, int px, int py) +init_constrained_copy(void *obj, int type, int x, int y, ...) { + va_list args; + int px; + int py; + + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + constrained = MOVE_HORIZ_VERT; - init_copy(p, type, x, y, px, py); + init_copy(obj, type, x, y, px, py); set_mousefun("place object", "array placement", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); } static void -init_copy(F_line *p, int type, int x, int y, int px, int py) +init_copy(void *obj, int type, int x, int y, int px, int py) { /* turn off all markers */ update_markers(0); switch (type) { case O_COMPOUND: set_cursor(null_cursor); - cur_c = (F_compound *) p; + cur_c = (F_compound *) obj; new_c = copy_compound(cur_c); init_compounddragging(new_c, px, py); break; case O_POLYLINE: set_cursor(null_cursor); - cur_l = (F_line *) p; + cur_l = (F_line *) obj; new_l = copy_line(cur_l); init_linedragging(new_l, px, py); break; case O_TXT: set_cursor(null_cursor); - cur_t = (F_text *) p; + cur_t = (F_text *) obj; new_t = copy_text(cur_t); init_textdragging(new_t, x, y); break; case O_ELLIPSE: set_cursor(null_cursor); - cur_e = (F_ellipse *) p; + cur_e = (F_ellipse *) obj; new_e = copy_ellipse(cur_e); init_ellipsedragging(new_e, px, py); break; case O_ARC: set_cursor(null_cursor); - cur_a = (F_arc *) p; + cur_a = (F_arc *) obj; new_a = copy_arc(cur_a); init_arcdragging(new_a, px, py); break; case O_SPLINE: set_cursor(null_cursor); - cur_s = (F_spline *) p; + cur_s = (F_spline *) obj; new_s = copy_spline(cur_s); init_splinedragging(new_s, px, py); break; @@ -135,9 +151,9 @@ init_copy(F_line *p, int type, int x, int y, int px, int py) } static void -init_copy_to_scrap(F_line *p, int type, int x, int y, int px, int py) +init_copy_to_scrap(void *obj, int type, int x, int y, ...) { - (void)x; (void)y; (void)px; (void)py; + (void)x; (void)y; FILE *fp; FILE *open_cut_file(void); @@ -149,27 +165,27 @@ init_copy_to_scrap(F_line *p, int type, int x, int y, int px, int py) switch (type) { case O_COMPOUND: - cur_c = (F_compound *) p; + cur_c = (F_compound *) obj; write_compound(fp, cur_c); break; case O_ARC: - cur_a = (F_arc *) p; + cur_a = (F_arc *) obj; write_arc(fp, cur_a); break; case O_ELLIPSE: - cur_e = (F_ellipse *) p; + cur_e = (F_ellipse *) obj; write_ellipse(fp, cur_e); break; case O_POLYLINE: - cur_l = (F_line *) p; + cur_l = (F_line *) obj; write_line(fp, cur_l); break; case O_TXT: - cur_t = (F_text *) p; + cur_t = (F_text *) obj; write_text(fp, cur_t); break; case O_SPLINE: - cur_s = (F_spline *) p; + cur_s = (F_spline *) obj; write_spline(fp, cur_s); break; default: --- a/src/e_delete.c +++ b/src/e_delete.c @@ -52,11 +52,11 @@ #include "xfig_math.h" -static void init_delete(F_line *p, int type, int x, int y, int px, int py); +static void init_delete(void *obj, int type, int x, int y, ...); static void init_delete_region(int x, int y, unsigned int shift); static void delete_region(int x, int y, unsigned int shift); static void cancel_delete_region(int x, int y, unsigned int shift); -static void init_delete_to_scrap(F_line *p, int type, int x, int y, int px, int py); +static void init_delete_to_scrap(void *obj, int type, int x, int y, ...); @@ -78,38 +78,38 @@ delete_selected(void) } static void -init_delete(F_line *p, int type, int x, int y, int px, int py) +init_delete(void *obj, int type, int x, int y, ...) { - (void)x; (void)y; (void)px; (void)py; + (void)x; (void)y; switch (type) { case O_COMPOUND: - cur_c = (F_compound *) p; + cur_c = (F_compound *) obj; delete_compound(cur_c); redisplay_compound(cur_c); break; case O_POLYLINE: - cur_l = (F_line *) p; + cur_l = (F_line *) obj; delete_line(cur_l); redisplay_line(cur_l); break; case O_TXT: - cur_t = (F_text *) p; + cur_t = (F_text *) obj; delete_text(cur_t); redisplay_text(cur_t); break; case O_ELLIPSE: - cur_e = (F_ellipse *) p; + cur_e = (F_ellipse *) obj; delete_ellipse(cur_e); redisplay_ellipse(cur_e); break; case O_ARC: - cur_a = (F_arc *) p; + cur_a = (F_arc *) obj; delete_arc(cur_a); redisplay_arc(cur_a); break; case O_SPLINE: - cur_s = (F_spline *) p; + cur_s = (F_spline *) obj; delete_spline(cur_s); redisplay_spline(cur_s); break; @@ -184,9 +184,9 @@ delete_region(int x, int y, unsigned int shift) } static void -init_delete_to_scrap(F_line *p, int type, int x, int y, int px, int py) +init_delete_to_scrap(void *obj, int type, int x, int y, ...) { - (void)x; (void)y; (void)px; (void)py; + (void)x; (void)y; FILE *fp; FILE *open_cut_file(void); @@ -198,37 +198,37 @@ init_delete_to_scrap(F_line *p, int type, int x, int y, int px, int py) switch (type) { case O_COMPOUND: - cur_c = (F_compound *) p; + cur_c = (F_compound *) obj; write_compound(fp, cur_c); delete_compound(cur_c); redisplay_compound(cur_c); break; case O_POLYLINE: - cur_l = (F_line *) p; + cur_l = (F_line *) obj; write_line(fp, cur_l); delete_line(cur_l); redisplay_line(cur_l); break; case O_TXT: - cur_t = (F_text *) p; + cur_t = (F_text *) obj; write_text(fp, cur_t); delete_text(cur_t); redisplay_text(cur_t); break; case O_ELLIPSE: - cur_e = (F_ellipse *) p; + cur_e = (F_ellipse *) obj; write_ellipse(fp, cur_e); delete_ellipse(cur_e); redisplay_ellipse(cur_e); break; case O_ARC: - cur_a = (F_arc *) p; + cur_a = (F_arc *) obj; write_arc(fp, cur_a); delete_arc(cur_a); redisplay_arc(cur_a); break; case O_SPLINE: - cur_s = (F_spline *) p; + cur_s = (F_spline *) obj; write_spline(fp, cur_s); delete_spline(cur_s); redisplay_spline(cur_s); --- a/src/e_deletept.c +++ b/src/e_deletept.c @@ -18,6 +18,7 @@ #include "e_deletept.h" +#include #include #include "resources.h" @@ -37,8 +38,7 @@ #include "w_msgpanel.h" -static void init_delete_point(F_line *obj, int type, int x, int y, - F_point *p, F_point *q); +static void init_delete_point(void *obj, int type, int x, int y, ...); void @@ -57,12 +57,21 @@ delete_point_selected(void) } static void -init_delete_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q) +init_delete_point(void *obj, int type, int x, int y, ...) { (void)x; (void)y; + + va_list args; + F_point *p; + F_point *q; int n; + va_start(args, y); + p = va_arg(args, F_point*); + q = va_arg(args, F_point*); + va_end(args); + switch (type) { case O_POLYLINE: cur_l = (F_line *) obj; --- a/src/e_edit.c +++ b/src/e_edit.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -679,8 +680,7 @@ void get_generic_arrows(F_line *x) } } -static void edit_spline_point(F_spline *spline, int type, int x, int y, - F_point *previous_point, F_point *the_point); +static void edit_spline_point(void *obj, int type, int x, int y, ...); static void edit_figure_comments(int x, int y, unsigned int shift); void edit_item_selected(void) @@ -704,7 +704,7 @@ void edit_item_selected(void) editing of the whole figure comments (shift=0) */ -static void popup_show_comments(F_line *p, int type, int x, int y); +static void popup_show_comments(void *obj, int type, int x, int y, ...); static void /* Shift Key Status from XEvent */ edit_figure_comments(int x, int y, unsigned int shift) @@ -722,7 +722,7 @@ edit_figure_comments(int x, int y, unsigned int shift) } static void -popup_show_comments(F_line *p, int type, int x, int y) +popup_show_comments(void *obj, int type, int x, int y, ...) { Widget form; static Boolean actions_added = False; @@ -736,27 +736,27 @@ popup_show_comments(F_line *p, int type, int x, int y) switch (type) { case O_ARC: - a = (F_arc *)p; + a = (F_arc *)obj; comments = a->comments; break; case O_COMPOUND: - c = (F_compound *)p; + c = (F_compound *)obj; comments = c->comments; break; case O_ELLIPSE: - e = (F_ellipse *)p; + e = (F_ellipse *)obj; comments = e->comments; break; case O_POLYLINE: - l = (F_line *)p; + l = (F_line *)obj; comments = l->comments; break; case O_SPLINE: - s = (F_spline *)p; + s = (F_spline *)obj; comments = s->comments; break; case O_TXT: - t = (F_text *)p; + t = (F_text *)obj; comments = t->comments; break; } /* switch */ @@ -819,7 +819,7 @@ popdown_comments(void) } void -edit_item(void *p, int type, int x, int y) +edit_item(void *obj, int type, int x, int y, ...) { XtWidgetGeometry xtgeom,comp; int llx, lly, urx, ury; @@ -856,37 +856,37 @@ edit_item(void *p, int type, int x, int y) /* get the bounds of the object to position the popup away from it */ switch (type) { case O_POLYLINE: - line_bound((F_line *)p, &llx, &lly, &urx, &ury); - make_window_line((F_line *)p); + line_bound((F_line *)obj, &llx, &lly, &urx, &ury); + make_window_line((F_line *)obj); break; case O_TXT: - text_bound((F_text *)p, &llx, &lly, &urx, &ury); - make_window_text((F_text *)p); + text_bound((F_text *)obj, &llx, &lly, &urx, &ury); + make_window_text((F_text *)obj); break; case O_ELLIPSE: - ellipse_bound((F_ellipse *)p, &llx, &lly, &urx, &ury); - make_window_ellipse((F_ellipse *)p); + ellipse_bound((F_ellipse *)obj, &llx, &lly, &urx, &ury); + make_window_ellipse((F_ellipse *)obj); break; case O_ARC: - arc_bound((F_arc *)p, &llx, &lly, &urx, &ury); - make_window_arc((F_arc *)p); + arc_bound((F_arc *)obj, &llx, &lly, &urx, &ury); + make_window_arc((F_arc *)obj); break; case O_SPLINE: - spline_bound((F_spline *)p, &llx, &lly, &urx, &ury); - make_window_spline((F_spline *)p); + spline_bound((F_spline *)obj, &llx, &lly, &urx, &ury); + make_window_spline((F_spline *)obj); break; case O_COMPOUND: /* make compound_bound() get boundaries in the current point positioning mode, do not create a tight bounding box */ anypointposn = 0; - compound_bound((F_compound *) p, &llx, &lly, &urx, &ury); + compound_bound((F_compound *) obj, &llx, &lly, &urx, &ury); /* turn on the point positioning indicator since it is used for editing compound */ update_indpanel(I_MIN2); - make_window_compound((F_compound *)p); + make_window_compound((F_compound *)obj); break; case O_FIGURE: - compound_bound((F_compound *)p, &llx, &lly, &urx, &ury); + compound_bound((F_compound *)obj, &llx, &lly, &urx, &ury); make_window_figure(); break; } @@ -969,12 +969,21 @@ reread_picfile(Widget panel_local, XtPointer closure, XtPointer call_data) static void -edit_spline_point(F_spline *spline, int type, int x, int y, - F_point *previous_point, F_point *the_point) +edit_spline_point(void *obj, int type, int x, int y, ...) { (void)x; (void)y; + va_list args; + F_point *previous_point; + F_point *the_point; + F_spline *spline = obj; + + va_start(args, y); + previous_point = va_arg(args, F_point*); + the_point = va_arg(args, F_point*); + va_end(args); + if (type!=O_SPLINE) { put_msg("Only spline points can be edited"); return; --- a/src/e_edit.h +++ b/src/e_edit.h @@ -34,7 +34,7 @@ extern Widget color_selection_panel(char *label, char *wname, char *name, Widget *button, Widget *popup, int color, XtCallbackProc callback); extern void color_select(Widget w, Color color); -extern void edit_item (void *p, int type, int x, int y); +extern void edit_item (void *p, int type, int x, int y, ...); extern void edit_item_selected (void); extern void push_apply_button (void); --- a/src/e_flip.c +++ b/src/e_flip.c @@ -19,6 +19,7 @@ #include "e_flip.h" #include +#include #include #include "resources.h" @@ -49,8 +50,8 @@ int setanchor_y; static int flip_axis; static int copy; -static void init_flip(F_line *p, int type, int x, int y, int px, int py); -static void init_copynflip(F_line *p, int type, int x,int y, int px,int py); +static void init_flip(void *p, int type, int x, int y, ...); +static void init_copynflip(void *p, int type, int x, int y, ...); static void set_unset_anchor(int x, int y, unsigned int shift); static void init_fliparc(F_arc *old_a, int px, int py); static void init_flipcompound(F_compound *old_c, int px, int py); @@ -58,7 +59,7 @@ static void init_flipellipse(F_ellipse *old_e, int px, int py); static void init_flipline(F_line *old_l, int px, int py); static void init_flipspline(F_spline *old_s, int px, int py); static void flip_selected(void); -static void flip_search(F_line *p, int type, int x, int y, int px, int py); +static void flip_search(void *obj, int type, int x, int y, int px, int py); static void flip_arc (F_arc *a, int x, int y, int flip_axis); static void flip_ellipse (F_ellipse *e, int x, int y, int flip_axis); static void flip_line (F_line *l, int x, int y, int flip_axis); @@ -139,52 +140,70 @@ set_unset_anchor(int x, int y, unsigned int shift) } static void -init_flip(F_line *p, int type, int x, int y, int px, int py) +init_flip(void *obj, int type, int x, int y, ...) { + va_list args; + int px; + int py; + + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + copy = 0; if (setanchor) - flip_search(p, type, x, y,setanchor_x,setanchor_y ); + flip_search(obj, type, x, y,setanchor_x,setanchor_y ); /* remember rotation center, e.g for multiple rotation*/ else - flip_search(p, type, x, y, px, py); + flip_search(obj, type, x, y, px, py); } static void -init_copynflip(F_line *p, int type, int x, int y, int px, int py) +init_copynflip(void *obj, int type, int x, int y, ...) { + va_list args; + int px; + int py; + + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + copy = 1; if (setanchor) - flip_search(p, type, x, y,setanchor_x,setanchor_y ); + flip_search(obj, type, x, y,setanchor_x,setanchor_y ); /* remember rotation center, e.g for multiple rotation*/ else - flip_search(p, type, x, y, px, py); + flip_search(obj, type, x, y, px, py); } static void -flip_search(F_line *p, int type, int x, int y, int px, int py) +flip_search(void *obj, int type, int x, int y, int px, int py) { (void)x; (void)y; switch (type) { case O_POLYLINE: - cur_l = (F_line *) p; + cur_l = (F_line *) obj; init_flipline(cur_l, px, py); break; case O_ARC: - cur_a = (F_arc *) p; + cur_a = (F_arc *) obj; init_fliparc(cur_a, px, py); break; case O_ELLIPSE: - cur_e = (F_ellipse *) p; + cur_e = (F_ellipse *) obj; init_flipellipse(cur_e, px, py); break; case O_SPLINE: - cur_s = (F_spline *) p; + cur_s = (F_spline *) obj; init_flipspline(cur_s, px, py); break; case O_COMPOUND: - cur_c = (F_compound *) p; + cur_c = (F_compound *) obj; init_flipcompound(cur_c, px, py); break; default: --- a/src/e_glue.c +++ b/src/e_glue.c @@ -45,7 +45,7 @@ static void create_compoundobject(int x, int y, unsigned int shift); static void cancel_tag_region(int x, int y, unsigned int shift); static void init_tag_region(int x, int y, unsigned int shift); static void tag_region(int x, int y, unsigned int shift); -static void tag_object(F_line *p, int type, int x, int y, int px, int py); +static void tag_object(void *obj, int type, int x, int y, ...); static void get_arc(F_arc **list); static void sel_arc(int xmin, int ymin, int xmax, int ymax); static void get_compound(F_compound **list); @@ -77,38 +77,38 @@ compound_selected(void) } static void -tag_object(F_line *p, int type, int x, int y, int px, int py) +tag_object(void *obj, int type, int x, int y, ...) { - (void)x; (void)y; (void)px; (void)py; + (void)x; (void)y; switch (type) { case O_COMPOUND: - cur_c = (F_compound *) p; + cur_c = (F_compound *) obj; toggle_compoundhighlight(cur_c); cur_c->tagged = 1 - cur_c->tagged; break; case O_POLYLINE: - cur_l = (F_line *) p; + cur_l = (F_line *) obj; toggle_linehighlight(cur_l); cur_l->tagged = 1 - cur_l->tagged; break; case O_TXT: - cur_t = (F_text *) p; + cur_t = (F_text *) obj; toggle_texthighlight(cur_t); cur_t->tagged = 1 - cur_t->tagged; break; case O_ELLIPSE: - cur_e = (F_ellipse *) p; + cur_e = (F_ellipse *) obj; toggle_ellipsehighlight(cur_e); cur_e->tagged = 1 - cur_e->tagged; break; case O_ARC: - cur_a = (F_arc *) p; + cur_a = (F_arc *) obj; toggle_archighlight(cur_a); cur_a->tagged = 1 - cur_a->tagged; break; case O_SPLINE: - cur_s = (F_spline *) p; + cur_s = (F_spline *) obj; toggle_splinehighlight(cur_s); cur_s->tagged = 1 - cur_s->tagged; break; --- a/src/e_joinsplit.c +++ b/src/e_joinsplit.c @@ -17,6 +17,7 @@ #include "e_joinsplit.h" +#include #include #include /* includes X11/Xlib.h */ @@ -41,9 +42,8 @@ #include "w_msgpanel.h" -static void init_join(F_line *obj, int type, int x, int y, F_point *p, - F_point *q); -static void init_split(F_line *obj, int type, int x, int y, int px, int py); +static void init_join(void *obj, int type, int x, int y, ...); +static void init_split(void *obj, int type, int x, int y, ...); static void join_lines(F_line *line, F_point *prev_point, F_point *selected_point); static void join_splines(F_spline *spline, F_point *prev_point, @@ -51,10 +51,8 @@ static void join_splines(F_spline *spline, F_point *prev_point, static void split_line(int px, int py); static void split_spline(int px, int py); static void cancel_join(int x, int y, unsigned int shift); -static void join_line2(F_line *obj, int type, int x, int y, F_point *p, - F_point *q); -static void join_spline2(F_line *obj, int type, int x, int y, F_point *p, - F_point *q); +static void join_line2(void *obj, int type, int x, int y, ...); +static void join_spline2(void *obj, int type, int x, int y, ...); static Boolean connect_line_points(F_line *line1, Boolean first1, F_line *line2, Boolean first2, F_line *new_line); static Boolean connect_spline_points(F_spline *spline1, Boolean first1, @@ -90,11 +88,20 @@ join_split_selected(void) } static void -init_join(F_line *obj, int type, int x, int y, F_point *p, F_point *q) +init_join(void *obj, int type, int x, int y, ...) { (void)x; (void)y; + va_list args; + F_point *p; + F_point *q; + + va_start(args, y); + p = va_arg(args, F_point*); + q = va_arg(args, F_point*); + va_end(args); + switch (type) { case O_POLYLINE: cur_l = (F_line *) obj; @@ -110,11 +117,20 @@ init_join(F_line *obj, int type, int x, int y, F_point *p, F_point *q) } static void -init_split(F_line *obj, int type, int x, int y, int px, int py) +init_split(void *obj, int type, int x, int y, ...) { (void)x; (void)y; + va_list args; + int px; + int py; + + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + switch (type) { case O_POLYLINE: cur_l = (F_line *) obj; @@ -227,13 +243,22 @@ cancel_join(int x, int y, unsigned int shift) } static void -join_line2(F_line *obj, int type, int x, int y, F_point *p, F_point *q) +join_line2(void *obj, int type, int x, int y, ...) { (void)x; (void)y; + + va_list args; + F_point *p; + F_point *q; F_line *line; F_point *lastp; + va_start(args, y); + p = va_arg(args, F_point*); + q = va_arg(args, F_point*); + va_end(args); + if (type != O_POLYLINE) return; /* only continue if the user has selected an end point */ @@ -276,19 +301,28 @@ join_line2(F_line *obj, int type, int x, int y, F_point *p, F_point *q) } static void -join_spline2(F_line *obj, int type, int x, int y, F_point *p, F_point *q) +join_spline2(void *obj, int type, int x, int y, ...) { (void)x; (void)y; + + va_list args; + F_point *p; + F_point *q; F_spline *spline; + va_start(args, y); + p = va_arg(args, F_point*); + q = va_arg(args, F_point*); + va_end(args); + if (type != O_SPLINE) return; /* only continue if the user has selected an end point */ if (p != NULL && q->next != NULL) return; spline = (F_spline *) obj; - first2 = (q == obj->points); + first2 = (q == spline->points); new_s = copy_spline(spline1); /* if user clicked on both endpoints of a spline, make it a closed SPLINE */ if (spline == spline1) { --- a/src/e_measure.c +++ b/src/e_measure.c @@ -40,9 +40,9 @@ /* Measuring angles, lengths and areas */ -static void init_anglemeas_object(char *p, int type, int x, int y, F_point *pp, F_point *pq); -static void init_anglemeas_object_m(char *p, int type, int x, int y, F_point *pp, F_point *pq); -static void init_anglemeas_object_r(char *p, int type, int x, int y, F_point *pp, F_point *pq); +static void init_anglemeas_object(void *p, int type, F_point *pq); +static void init_anglemeas_object_m(void *p, int type, int x, int y, ...); +static void init_anglemeas_object_r(void *p, int type, int x, int y, ...); static void init_anglemeas_threepoints(int px, int py, unsigned int shift); static void anglemeas_second(int x, int y, unsigned int shift); @@ -55,14 +55,14 @@ static void anglemeas_arc(F_arc *a); static void angle_msg(double value, char *msgtext); static void angle_save(double value); -static void init_lenmeas_object(char *p, int type, int x, int y, int px, int py); -static void init_lenmeas_object_l(char *p, int type, int x, int y, int px, int py); -static void init_lenmeas_object_m(char *p, int type, int x, int y, int px, int py); +static void init_lenmeas_object(void *obj, int type); +static void init_lenmeas_object_l(void *obj, int type, int x, int y, ...); +static void init_lenmeas_object_m(void *obj, int type, int x, int y, ...); static void clear_lenmeas_memory(int x, int y, unsigned int shift); -static void init_areameas_object(char *p, int type, int x, int y, int px, int py); -static void init_areameas_object_l(char *p, int type, int x, int y, int px, int py); -static void init_areameas_object_m(char *p, int type, int x, int y, int px, int py); +static void init_areameas_object(void *obj, int type); +static void init_areameas_object_l(void *obj, int type, int x, int y, ...); +static void init_areameas_object_m(void *obj, int type, int x, int y, ...); static void clear_areameas_memory(int x, int y, unsigned int shift); static void freehand_line_nomsg(int x, int y); @@ -122,33 +122,53 @@ angle_save(double value) /* OBJECT ANGLE MEASURING */ static void -init_anglemeas_object_m(char *p, int type, int x, int y, F_point *pp, F_point *pq) +init_anglemeas_object_m(void *obj, int type, int x, int y, ...) { + (void)x; + (void)y; + + va_list args; + F_point *pp; + F_point *pq; + + va_start(args, y); + pp = va_arg(args, F_point*); + pq = va_arg(args, F_point*); + va_end(args); + save_rotnangle = 1; - init_anglemeas_object(p, type, x, y, pp, pq); + init_anglemeas_object(obj, type, pq); } static void -init_anglemeas_object_r(char *p, int type, int x, int y, F_point *pp, F_point *pq) +init_anglemeas_object_r(void *obj, int type, int x, int y, ...) { + (void)x; + (void)y; + + va_list args; + F_point *pp; + F_point *pq; + + va_start(args, y); + pp = va_arg(args, F_point*); + pq = va_arg(args, F_point*); + va_end(args); + save_rotnangle = 0; - init_anglemeas_object(p, type, x, y, pp, pq); + init_anglemeas_object(obj, type, pq); } static void -init_anglemeas_object(char *p, int type, int x, int y, F_point *pp, F_point *pq) +init_anglemeas_object(void *obj, int type, F_point *pq) { - (void)x; - (void)y; - (void)pp; - switch(type) { case O_POLYLINE: - cur_l = (F_line*)p; + cur_l = (F_line*)obj; anglemeas_line(cur_l, pq); /* do_point_search returns `near' point in *q */ break; case O_ARC: - cur_a = (F_arc*)p; + cur_a = (F_arc*)obj; anglemeas_arc(cur_a); /* point doesn't matter */ break; default: @@ -328,9 +348,8 @@ void lenmeas_selected(void) } static void -init_lenmeas_object(char *p, int type, int x, int y, int px, int py) +init_lenmeas_object(void *obj, int type) { - (void)x; (void)y; (void)px; (void)py; float len; double a,b,z; int ok; @@ -340,7 +359,7 @@ init_lenmeas_object(char *p, int type, int x, int y, int px, int py) switch (type) { case O_POLYLINE: - cur_l = (F_line*) p; + cur_l = (F_line*) obj; (void) compute_poly_length(cur_l, &len); if (cur_l->type == T_BOX || cur_l->type == T_PICTURE) msgtext = "box"; @@ -356,7 +375,7 @@ init_lenmeas_object(char *p, int type, int x, int y, int px, int py) break; case O_ARC: - cur_a = (F_arc*) p; + cur_a = (F_arc*) obj; if (compute_arc_length(cur_a, &len)) { msgtext = "arc"; ok = 1; @@ -364,7 +383,7 @@ init_lenmeas_object(char *p, int type, int x, int y, int px, int py) break; case O_ELLIPSE: - cur_e = (F_ellipse*) p; + cur_e = (F_ellipse*) obj; /* ellipse or circle? */ if (cur_e->radiuses.x == cur_e->radiuses.y) { msgtext = "circle"; @@ -395,17 +414,23 @@ init_lenmeas_object(char *p, int type, int x, int y, int px, int py) } static void -init_lenmeas_object_l(char *p, int type, int x, int y, int px, int py) +init_lenmeas_object_l(void *obj, int type, int x, int y, ...) { + (void)x; + (void)y; + save_len = 0; - init_lenmeas_object(p, type, x, y, px, py); + init_lenmeas_object(obj, type); } static void -init_lenmeas_object_m(char *p, int type, int x, int y, int px, int py) +init_lenmeas_object_m(void *obj, int type, int x, int y, ...) { + (void)x; + (void)y; + save_len = 1; - init_lenmeas_object(p, type, x, y, px, py); + init_lenmeas_object(obj, type); } static void @@ -441,9 +466,8 @@ void areameas_selected(void) static void -init_areameas_object(char *p, int type, int x, int y, int px, int py) +init_areameas_object(void *obj, int type) { - (void)x; (void)y; (void)px; (void)py; float area; int ok; char *msgtext; @@ -452,7 +476,7 @@ init_areameas_object(char *p, int type, int x, int y, int px, int py) switch (type) { case O_POLYLINE: - cur_l = (F_line*) p; + cur_l = (F_line*) obj; if (1) { compute_poly_area(cur_l, &area); if (cur_l->type == T_BOX) @@ -469,7 +493,7 @@ init_areameas_object(char *p, int type, int x, int y, int px, int py) break; case O_ARC: - cur_a = (F_arc*) p; + cur_a = (F_arc*) obj; if (compute_arc_area(cur_a, &area)) { if (cur_a->type == T_OPEN_ARC) msgtext = "open arc"; @@ -480,7 +504,7 @@ init_areameas_object(char *p, int type, int x, int y, int px, int py) break; case O_ELLIPSE: - cur_e = (F_ellipse*) p; + cur_e = (F_ellipse*) obj; if (compute_ellipse_area(cur_e, &area)) { msgtext = "ellipse"; ok = 1; @@ -503,17 +527,23 @@ init_areameas_object(char *p, int type, int x, int y, int px, int py) } static void -init_areameas_object_l(char *p, int type, int x, int y, int px, int py) +init_areameas_object_l(void *obj, int type, int x, int y, ...) { + (void)x; + (void)y; + save_area = 0; - init_areameas_object(p, type, x, y, px, py); + init_areameas_object(obj, type); } static void -init_areameas_object_m(char *p, int type, int x, int y, int px, int py) +init_areameas_object_m(void *obj, int type, int x, int y, ...) { + (void)x; + (void)y; + save_area = 1; - init_areameas_object(p, type, x, y, px, py); + init_areameas_object(obj, type); } static void --- a/src/e_move.c +++ b/src/e_move.c @@ -16,6 +16,8 @@ * */ +#include + #include "e_move.h" #include "resources.h" @@ -32,10 +34,9 @@ #include "w_mousefun.h" -static void init_move(F_line *p, int type, int x, int y, int px, int py); -static void init_arb_move(F_line *p, int type, int x, int y, int px,int py); -static void init_constrained_move(F_line *p, int type, int x, int y, int px, - int py); +static void init_move(void *obj, int type, int x, int y, int px, int py); +static void init_arb_move(void *obj, int type, int x, int y, ...); +static void init_constrained_move(void *obj, int type, int x, int y, ...); void @@ -55,20 +56,38 @@ move_selected(void) } static void -init_arb_move(F_line *p, int type, int x, int y, int px, int py) +init_arb_move(void *obj, int type, int x, int y, ...) { + va_list args; + int px; + int py; + + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + constrained = MOVE_ARB; - init_move(p, type, x, y, px, py); + init_move(obj, type, x, y, px, py); canvas_middlebut_proc = null_proc_button; set_mousefun("place object", "", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); } static void -init_constrained_move(F_line *p, int type, int x, int y, int px, int py) +init_constrained_move(void *obj, int type, int x, int y, ...) { + va_list args; + int px; + int py; + + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + constrained = MOVE_HORIZ_VERT; - init_move(p, type, x, y, px, py); + init_move(obj, type, x, y, px, py); canvas_middlebut_proc = canvas_leftbut_proc; canvas_leftbut_proc = null_proc_button; set_mousefun("", "place object", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); @@ -76,14 +95,14 @@ init_constrained_move(F_line *p, int type, int x, int y, int px, int py) } static void -init_move(F_line *p, int type, int x, int y, int px, int py) +init_move(void *obj, int type, int x, int y, int px, int py) { /* turn off all markers */ update_markers(0); switch (type) { case O_COMPOUND: set_cursor(wait_cursor); - cur_c = (F_compound *) p; + cur_c = (F_compound *) obj; list_delete_compound(&objects.compounds, cur_c); redisplay_compound(cur_c); set_cursor(null_cursor); @@ -91,7 +110,7 @@ init_move(F_line *p, int type, int x, int y, int px, int py) break; case O_POLYLINE: set_cursor(wait_cursor); - cur_l = (F_line *) p; + cur_l = (F_line *) obj; list_delete_line(&objects.lines, cur_l); redisplay_line(cur_l); set_cursor(null_cursor); @@ -99,7 +118,7 @@ init_move(F_line *p, int type, int x, int y, int px, int py) break; case O_TXT: set_cursor(wait_cursor); - cur_t = (F_text *) p; + cur_t = (F_text *) obj; list_delete_text(&objects.texts, cur_t); redisplay_text(cur_t); set_cursor(null_cursor); @@ -107,7 +126,7 @@ init_move(F_line *p, int type, int x, int y, int px, int py) break; case O_ELLIPSE: set_cursor(wait_cursor); - cur_e = (F_ellipse *) p; + cur_e = (F_ellipse *) obj; list_delete_ellipse(&objects.ellipses, cur_e); redisplay_ellipse(cur_e); set_cursor(null_cursor); @@ -115,7 +134,7 @@ init_move(F_line *p, int type, int x, int y, int px, int py) break; case O_ARC: set_cursor(wait_cursor); - cur_a = (F_arc *) p; + cur_a = (F_arc *) obj; list_delete_arc(&objects.arcs, cur_a); redisplay_arc(cur_a); set_cursor(null_cursor); @@ -123,7 +142,7 @@ init_move(F_line *p, int type, int x, int y, int px, int py) break; case O_SPLINE: set_cursor(wait_cursor); - cur_s = (F_spline *) p; + cur_s = (F_spline *) obj; list_delete_spline(&objects.splines, cur_s); redisplay_spline(cur_s); set_cursor(null_cursor); --- a/src/e_movept.c +++ b/src/e_movept.c @@ -60,9 +60,9 @@ static void relocate_ellipsepoint(F_ellipse *ellipse, int x, int y, int point_nu static void relocate_linepoint(F_line *line, int x, int y, F_point *moved_point, F_point *left_point); static void relocate_splinepoint(F_spline *s, int x, int y, F_point *moved_point); -static Boolean init_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q, int pnum); -static void init_arb_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q, int pnum); -static void init_stretch_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q, int pnum); +static Boolean init_move_point(F_line *obj, int type, F_point *p, F_point *q, int pnum); +static void init_arb_move_point(void *obj, int type, int x, int y, ...); +static void init_stretch_move_point(void *obj, int type, int x, int y, ...); static void fix_movedarcpoint(int x, int y, unsigned int shift); static void fix_movedellipsepoint(int x, int y, unsigned int shift); @@ -94,10 +94,24 @@ void move_point_selected(void) } static void -init_arb_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q, int pnum) +init_arb_move_point(void *obj, int type, int x, int y, ...) { + (void)x; + (void)y; + + va_list args; + F_point *p; + F_point *q; + int pnum; + + va_start(args, y); + p = va_arg(args, F_point*); + q = va_arg(args, F_point*); + pnum = va_arg(args, int); + va_end(args); + constrained = MOVE_ARB; - if (!init_move_point(obj, type, x, y, p, q, pnum)) + if (!init_move_point(obj, type, p, q, pnum)) return; set_mousefun("new posn", "", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); @@ -105,10 +119,24 @@ init_arb_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q, } static void -init_stretch_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q, int pnum) +init_stretch_move_point(void *obj, int type, int x, int y, ...) { + (void)x; + (void)y; + + va_list args; + F_point *p; + F_point *q; + int pnum; + + va_start(args, y); + p = va_arg(args, F_point*); + q = va_arg(args, F_point*); + pnum = va_arg(args, int); + va_end(args); + constrained = MOVE_HORIZ_VERT; - if (!init_move_point(obj, type, x, y, p, q, pnum)) + if (!init_move_point(obj, type, p, q, pnum)) return; set_mousefun("", "new posn", "cancel", LOC_OBJ, LOC_OBJ, LOC_OBJ); draw_mousefun_canvas(); @@ -117,12 +145,8 @@ init_stretch_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point } static Boolean -init_move_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q, - int pnum) +init_move_point(F_line *obj, int type, F_point *p, F_point *q, int pnum) { - (void)x; - (void)y; - left_point = p; moved_point = q; switch (type) { --- a/src/e_rotate.c +++ b/src/e_rotate.c @@ -18,6 +18,7 @@ #include "e_rotate.h" +#include #include #include @@ -54,11 +55,11 @@ float act_rotnangle; static int copy; -static void init_rotate(F_line *p, int type, int x, int y, int px, int py); +static void init_rotate(void *obj, int type, int x, int y, ...); static void set_unset_center(int x, int y, unsigned int shift); -static void init_copynrotate(F_line *p, int type, int x,int y,int px,int py); +static void init_copynrotate(void *obj, int type, int x, int y, ...); static void rotate_selected(void); -static void rotate_search(F_line *p, int type, int x, int y, int px, int py); +static void rotate_search(F_line *p, int type, int px, int py); static void init_rotateline(F_line *l, int px, int py); static void init_rotatetext(F_text *t, int px, int py); static void init_rotatearc (F_arc *a, int px, int py); @@ -147,39 +148,59 @@ set_unset_center(int x, int y, unsigned int shift) } static void -init_rotate(F_line *p, int type, int x, int y, int px, int py) +init_rotate(void *obj, int type, int x, int y, ...) { + (void)x; + (void)y; + + va_list args; + int px; + int py; + + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + copy = 0; act_rotnangle = cur_rotnangle; if (setcenter) - rotate_search(p, type, x, y,setcenter_x,setcenter_y ); + rotate_search(obj, type, setcenter_x,setcenter_y ); /* remember rotation center, e.g for multiple rotation*/ else - rotate_search(p, type, x, y, px, py); + rotate_search(obj, type, px, py); } static void -init_copynrotate(F_line *p, int type, int x, int y, int px, int py) +init_copynrotate(void *obj, int type, int x, int y, ...) { + (void)x; + (void)y; + + va_list args; + int px; + int py; int i; + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + copy = 1; act_rotnangle = cur_rotnangle; for ( i = 1; i <= cur_numcopies; act_rotnangle += cur_rotnangle, i++) { if (setcenter) - rotate_search(p, type, x, y,setcenter_x,setcenter_y ); + rotate_search(obj, type, setcenter_x,setcenter_y ); /* remember rotation center */ else - rotate_search(p, type, x, y, px, py); + rotate_search(obj, type, px, py); } } static void -rotate_search(F_line *p, int type, int x, int y, int px, int py) +rotate_search(F_line *p, int type, int px, int py) { - (void)x; - (void)y; - switch (type) { case O_POLYLINE: cur_l = (F_line *) p; --- a/src/e_scale.c +++ b/src/e_scale.c @@ -22,6 +22,7 @@ #include "e_scale.h" #include +#include #include #include #include @@ -71,10 +72,9 @@ static void scale_text(F_text *t, float sx, float sy, int refx, int refy); static void scale_arrows(F_line *obj, float sx, float sy); static void scale_arrow(F_arrow *arrow, float sx, float sy); -static void init_box_scale(F_line *obj, int type, int x,int y,int px,int py); +static void init_box_scale(void *obj, int type, int x, int y, ...); static void boxrelocate_ellipsepoint(F_ellipse *ellipse, int x, int y); -static void init_center_scale(F_line *obj, int type, int x, int y, - int px, int py); +static void init_center_scale(void *obj, int type, int x, int y, ...); static void init_scale_compound(void); static void rescale_points(F_line *obj, int x, int y); static void relocate_ellipsepoint(F_ellipse *ellipse, int x, int y); @@ -121,11 +121,20 @@ char *BOX_SCL_MSG = "Can't use box scale on selected object"; char *BOX_SCL2_MSG = "Can't use box scale on selected object; try putting it into a compound"; static void -init_box_scale(F_line *obj, int type, int x, int y, int px, int py) +init_box_scale(void *obj, int type, int x, int y, ...) { (void)x; (void)y; + va_list args; + int px; + int py; + + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + switch (type) { case O_POLYLINE: cur_l = (F_line *) obj; @@ -153,12 +162,21 @@ init_box_scale(F_line *obj, int type, int x, int y, int px, int py) } static void -init_center_scale(F_line *obj, int type, int x, int y, int px, int py) +init_center_scale(void *obj, int type, int x, int y, ...) { (void)x; (void)y; + + va_list args; + int px; + int py; double dx, dy, l; + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); + cur_x = from_x = px; cur_y = from_y = py; constrained = BOX_SCALE; --- a/src/e_tangent.c +++ b/src/e_tangent.c @@ -16,6 +16,7 @@ #include "e_tangent.h" #include +#include #include #include "resources.h" @@ -37,10 +38,8 @@ #define ZERO_TOLERANCE 2.0 -static void init_tangent_adding(char *p, int type, int x, int y, - int px, int py); -static void init_normal_adding(char *p, int type, int x, int y, - int px, int py); +static void init_tangent_adding(void *obj, int type, int x, int y, ...); +static void init_normal_adding(void *obj, int type, int x, int y, ...); static void tangent_or_normal(int x, int y, int flag); static void tangent_normal_line(int x, int y, float vx, float vy); @@ -65,17 +64,35 @@ tangent_selected(void) /* smart_point1, smart_point2 are two points of the tangent */ static void -init_tangent_adding(char *p, int type, int x, int y, int px, int py) +init_tangent_adding(void *obj, int type, int x, int y, ...) { - (void)p; (void)type; (void)x; (void)y; + (void)obj; (void)type; (void)x; (void)y; + + va_list args; + int px; + int py; + + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); tangent_or_normal(px, py, 0); } static void -init_normal_adding(char *p, int type, int x, int y, int px, int py) +init_normal_adding(void *obj, int type, int x, int y, ...) { - (void)p; (void)type; (void)x; (void)y; + (void)obj; (void)type; (void)x; (void)y; + + va_list args; + int px; + int py; + + va_start(args, y); + px = va_arg(args, int); + py = va_arg(args, int); + va_end(args); tangent_or_normal(px, py, 1); } --- a/src/e_update.c +++ b/src/e_update.c @@ -55,10 +55,8 @@ static Boolean keep_depth = False; static int delta_depth; -static void init_update_object(F_line *p, int type, int x, int y, - int px, int py); -static void init_update_settings(F_line *p, int type, int x, int y, - int px, int py); +static void init_update_object(void *obj, int type, int x, int y, ...); +static void init_update_settings(void *obj, int type, int x, int y, ...); #define min(a,b) ((a)<(b)) ? (a) : (b) @@ -140,16 +138,16 @@ get_arrow_type(F_line *object) /* update the indicator buttons FROM the selected object */ static void -init_update_settings(F_line *p, int type, int x, int y, int px, int py) +init_update_settings(void *obj, int type, int x, int y, ...) { - (void)x; (void)y; (void)px; (void)py; + (void)x; (void)y; int old_psfont_flag, new_psfont_flag; F_line *dline, *dtick1, *dtick2, *dbox; F_text *dtext; switch (type) { case O_COMPOUND: - cur_c = (F_compound *) p; + cur_c = (F_compound *) obj; /* if this is a dimension line, update the dimline settings from it */ if (dimline_components(cur_c, &dline, &dtick1, &dtick2, &dbox)) { @@ -199,7 +197,7 @@ init_update_settings(F_line *p, int type, int x, int y, int px, int py) } break; case O_POLYLINE: - cur_l = (F_line *) p; + cur_l = (F_line *) obj; if (cur_l->type != T_PICTURE) { up_part(cur_linewidth, cur_l->thickness, I_LINEWIDTH); up_part(cur_fillstyle, cur_l->fill_style, I_FILLSTYLE); @@ -226,7 +224,7 @@ init_update_settings(F_line *p, int type, int x, int y, int px, int py) up_part(cur_boxradius, cur_l->radius, I_BOXRADIUS); break; case O_TXT: - cur_t = (F_text *) p; + cur_t = (F_text *) obj; up_part(cur_textjust, cur_t->type, I_TEXTJUST); up_part(cur_pencolor, cur_t->color, I_PEN_COLOR); up_depth_part(cur_depth, cur_t->depth); @@ -248,7 +246,7 @@ init_update_settings(F_line *p, int type, int x, int y, int px, int py) up_part(cur_fontsize, cur_t->size, I_FONTSIZE); break; case O_ELLIPSE: - cur_e = (F_ellipse *) p; + cur_e = (F_ellipse *) obj; up_part(cur_linewidth, cur_e->thickness, I_LINEWIDTH); up_part(cur_elltextangle, cur_e->angle/M_PI*180.0, I_ELLTEXTANGLE); up_part(cur_fillstyle, cur_e->fill_style, I_FILLSTYLE); @@ -261,7 +259,7 @@ init_update_settings(F_line *p, int type, int x, int y, int px, int py) up_depth_part(cur_depth, cur_e->depth); break; case O_ARC: - cur_a = (F_arc *) p; + cur_a = (F_arc *) obj; up_part(cur_linewidth, cur_a->thickness, I_LINEWIDTH); up_part(cur_fillstyle, cur_a->fill_style, I_FILLSTYLE); up_part(cur_pencolor, cur_a->pen_color, I_PEN_COLOR); @@ -281,7 +279,7 @@ init_update_settings(F_line *p, int type, int x, int y, int px, int py) up_from_arrow(cur_a->for_arrow,cur_a->thickness); break; case O_SPLINE: - cur_s = (F_spline *) p; + cur_s = (F_spline *) obj; up_part(cur_linewidth, cur_s->thickness, I_LINEWIDTH); up_part(cur_fillstyle, cur_s->fill_style, I_FILLSTYLE); up_part(cur_pencolor, cur_s->pen_color, I_PEN_COLOR); @@ -331,9 +329,9 @@ void up_from_arrow(F_arrow *arrow, int thick) /* update the selected object FROM the indicator buttons */ static void -init_update_object(F_line *p, int type, int x, int y, int px, int py) +init_update_object(void *obj, int type, int x, int y, ...) { - (void)x; (void)y; (void)px; (void)py; + (void)x; (void)y; int largest; Boolean dontupdate; @@ -342,7 +340,7 @@ init_update_object(F_line *p, int type, int x, int y, int px, int py) switch (type) { case O_COMPOUND: set_temp_cursor(wait_cursor); - cur_c = (F_compound *) p; + cur_c = (F_compound *) obj; new_c = copy_compound(cur_c); /* keep the depths of the objects inside the compound the same @@ -371,7 +369,7 @@ init_update_object(F_line *p, int type, int x, int y, int px, int py) break; case O_POLYLINE: set_temp_cursor(wait_cursor); - cur_l = (F_line *) p; + cur_l = (F_line *) obj; new_l = copy_line(cur_l); update_line(new_l); change_line(cur_l, new_l); @@ -382,7 +380,7 @@ init_update_object(F_line *p, int type, int x, int y, int px, int py) break; case O_TXT: set_temp_cursor(wait_cursor); - cur_t = (F_text *) p; + cur_t = (F_text *) obj; new_t = copy_text(cur_t); update_text(new_t); change_text(cur_t, new_t); @@ -391,7 +389,7 @@ init_update_object(F_line *p, int type, int x, int y, int px, int py) break; case O_ELLIPSE: set_temp_cursor(wait_cursor); - cur_e = (F_ellipse *) p; + cur_e = (F_ellipse *) obj; new_e = copy_ellipse(cur_e); update_ellipse(new_e); change_ellipse(cur_e, new_e); @@ -402,7 +400,7 @@ init_update_object(F_line *p, int type, int x, int y, int px, int py) break; case O_ARC: set_temp_cursor(wait_cursor); - cur_a = (F_arc *) p; + cur_a = (F_arc *) obj; new_a = copy_arc(cur_a); update_arc(new_a); change_arc(cur_a, new_a); @@ -413,7 +411,7 @@ init_update_object(F_line *p, int type, int x, int y, int px, int py) break; case O_SPLINE: set_temp_cursor(wait_cursor); - cur_s = (F_spline *) p; + cur_s = (F_spline *) obj; new_s = copy_spline(cur_s); update_spline(new_s); change_spline(cur_s, new_s); --- a/src/u_search.c +++ b/src/u_search.c @@ -43,10 +43,10 @@ #define TOLERANCE ((int)((display_zoomscale < 20.0? 10: 14) * \ PIX_PER_INCH/DISPLAY_PIX_PER_INCH/display_zoomscale)) -static void (*manipulate) (); -static void (*handlerproc_left) (); -static void (*handlerproc_middle) (); -static void (*handlerproc_right) (); +static void (*manipulate) (void *obj, int type, int x, int y, ...); +static void (*handlerproc_left) (void *obj, int type, int x, int y, ...); +static void (*handlerproc_middle) (void *obj, int type, int x, int y, ...); +static void (*handlerproc_right) (void *obj, int type, int x, int y, ...); static int type; static long objectcount; static long n; @@ -824,19 +824,19 @@ next_compound_point_found(int x, int y, int tol, int *p, int *q, unsigned int sh } void -init_searchproc_left(void (*handlerproc) (/* ??? */)) +init_searchproc_left(void (*handlerproc) (void *obj, int type, int x, int y, ...)) { handlerproc_left = handlerproc; } void -init_searchproc_middle(void (*handlerproc) (/* ??? */)) +init_searchproc_middle(void (*handlerproc) (void *obj, int type, int x, int y, ...)) { handlerproc_middle = handlerproc; } void -init_searchproc_right(void (*handlerproc) (/* ??? */)) +init_searchproc_right(void (*handlerproc) (void *obj, int type, int x, int y, ...)) { handlerproc_right = handlerproc; } --- a/src/u_search.h +++ b/src/u_search.h @@ -24,9 +24,9 @@ Boolean in_text_bound(F_text *t, int x, int y); -void init_searchproc_left(void (*handlerproc) (/* ??? */)); -void init_searchproc_middle(void (*handlerproc) (/* ??? */)); -void init_searchproc_right(void (*handlerproc) (/* ??? */)); +void init_searchproc_left(void (*handlerproc) (void *obj, int type, int x, int y, ...)); +void init_searchproc_middle(void (*handlerproc) (void *obj, int type, int x, int y, ...)); +void init_searchproc_right(void (*handlerproc) (void *obj, int type, int x, int y, ...)); void point_search_left(int x, int y, unsigned int shift); void point_search_middle(int x, int y, unsigned int shift); --- a/src/u_smartsearch.c +++ b/src/u_smartsearch.c @@ -59,10 +59,10 @@ void smart_toggle_objecthighlight(void); F_point smart_point1, smart_point2; /* locals: */ -static void (*manipulate) (); -static void (*handlerproc_left) (); -static void (*handlerproc_middle) (); -static void (*handlerproc_right) (); +static void (*manipulate) (void *, int type, int x, int y, ...); +static void (*handlerproc_left) (void *, int type, int x, int y, ...); +static void (*handlerproc_middle) (void *, int type, int x, int y, ...); +static void (*handlerproc_right) (void *, int type, int x, int y, ...); static int type; static long objectcount; static long n; @@ -82,19 +82,19 @@ static F_compound *c; void -init_smart_searchproc_left(void (*handlerproc) (/* ??? */)) +init_smart_searchproc_left(void (*handlerproc) (void *, int type, int x, int y, ...)) { handlerproc_left = handlerproc; } void -init_smart_searchproc_middle(void (*handlerproc) (/* ??? */)) +init_smart_searchproc_middle(void (*handlerproc) (void *, int type, int x, int y, ...)) { handlerproc_middle = handlerproc; } void -init_smart_searchproc_right(void (*handlerproc) (/* ??? */)) +init_smart_searchproc_right(void (*handlerproc) (void *, int type, int x, int y, ...)) { handlerproc_right = handlerproc; } --- a/src/u_smartsearch.h +++ b/src/u_smartsearch.h @@ -23,9 +23,9 @@ #include "object.h" -void init_smart_searchproc_left(void (*handlerproc) (/* ??? */)); -void init_smart_searchproc_middle(void (*handlerproc) (/* ??? */)); -void init_smart_searchproc_right(void (*handlerproc) (/* ??? */)); +void init_smart_searchproc_left(void (*handlerproc) (void *obj, int type, int x, int y, ...)); +void init_smart_searchproc_middle(void (*handlerproc) (void *obj, int type, int x, int y, ...)); +void init_smart_searchproc_right(void (*handlerproc) (void *obj, int type, int x, int y, ...)); void smart_object_search_left(int x, int y, unsigned int shift); void smart_object_search_middle(int x, int y, unsigned int shift); --- a/src/w_snap.c +++ b/src/w_snap.c @@ -1036,16 +1036,15 @@ snap_ellipse_handler(F_ellipse *e, int x, int y) } static void -snap_handler(void *p, int type, int x, int y, int px, int py) +snap_handler(void *obj, int type, int x, int y, ...) { - (void)px; (void)py; static void * intersect_object_1; static int intersect_type_1; if (snap_mode == SNAP_MODE_INTERSECT) { switch(intersect_state) { case INTERSECT_INITIAL: - intersect_object_1 = p; + intersect_object_1 = obj; intersect_type_1 = type; intersect_state = INTERSECT_FIRST_FOUND; XtVaSetValues(snap_indicator_label, XtNlabel, "I'sect 2 " , NULL); @@ -1053,7 +1052,7 @@ snap_handler(void *p, int type, int x, int y, int px, int py) snap_msg_set = True; break; case INTERSECT_FIRST_FOUND: - snap_intersect_handler(intersect_object_1, intersect_type_1, p, type, x, y); + snap_intersect_handler(intersect_object_1, intersect_type_1, obj, type, x, y); intersect_state = INTERSECT_INITIAL; XtVaSetValues(snap_indicator_label, XtNlabel, "Intersect" , NULL); break; @@ -1062,19 +1061,19 @@ snap_handler(void *p, int type, int x, int y, int px, int py) else { switch (type) { case O_ELLIPSE: - snap_ellipse_handler(p, x, y); + snap_ellipse_handler(obj, x, y); break; case O_POLYLINE: - snap_polyline_handler(p, x, y); + snap_polyline_handler(obj, x, y); break; case O_SPLINE: - snap_spline_handler(p, x, y); + snap_spline_handler(obj, x, y); break; case O_TXT: - snap_text_handler(p, x, y); + snap_text_handler(obj, x, y); break; case O_ARC: - snap_arc_handler(p, x, y); + snap_arc_handler(obj, x, y); break; } } -- 2.45.3 From 4239b93217dd95ff50caeb49737f9d6da16a77e2 Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Sun, 2 Feb 2025 22:14:10 +0100 Subject: [PATCH 7/8] Fix X callback prototypes --- a/src/w_cmdpanel.c +++ b/src/w_cmdpanel.c @@ -128,7 +128,6 @@ Widget global_panel; static void enter_cmd_but(Widget widget, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch); -void delete_all_cmd(Widget w, int closure, int call_data); static void init_move_paste_object(int x, int y); static void move_paste_object(int x, int y); static void place_object(int x, int y, unsigned int shift); @@ -142,7 +141,7 @@ static void popup_menu(Widget w, XEvent *event, String *params, static void load_recent_file(Widget w, XtPointer client_data, XtPointer call_data); -static void popup_global_panel(Widget w); +static void popup_global_panel(void); static void global_panel_done(Widget w, XButtonEvent *ev); static void global_panel_cancel(Widget w, XButtonEvent *ev); static void character_panel_close(void); @@ -185,15 +184,15 @@ static XtActionsRec menu_actions[] = { menu_def file_menu_items[] = { {"New (Meta-N)", 0, new, False}, - {"Open... (Meta-O)", 0, popup_open_panel, False}, - {"Merge... (Meta-M)", 0, popup_merge_panel, False}, + {"Open... (Meta-O)", 0, (XtCallbackProc)popup_open_panel, False}, + {"Merge... (Meta-M)", 0, (XtCallbackProc)popup_merge_panel, False}, #ifdef DIGITIZE - {"Digitize... (Meta-Z)", 0, popup_digitize_panel, False}, + {"Digitize... (Meta-Z)", 0, (XtCallbackProc)popup_digitize_panel, False}, #endif /* DIGITIZE */ - {"Save (Meta-S)", 0, do_save, False}, - {"Save As... (Meta-A)", 5, popup_saveas_panel, False}, - {"Export... (Meta-X) (Quick = Shift-Meta-X)", 0, popup_export_panel, False}, - {"Print... (Meta-P) (Quick = Shift-Meta-P)", 0, popup_print_panel, False}, + {"Save (Meta-S)", 0, (XtCallbackProc)do_save, False}, + {"Save As... (Meta-A)", 5, (XtCallbackProc)popup_saveas_panel, False}, + {"Export... (Meta-X) (Quick = Shift-Meta-X)", 0, (XtCallbackProc)popup_export_panel, False}, + {"Print... (Meta-P) (Quick = Shift-Meta-P)", 0, (XtCallbackProc)popup_print_panel, False}, {"Exit (Meta-Q)", 1, quit, False}, /* makes a line separator followed by recently loaded files */ {(char *) -1, 0, NULL, False}, @@ -201,15 +200,15 @@ menu_def file_menu_items[] = { }; menu_def edit_menu_items[] = { - {"Undo (Meta-U) ", 0, undo, False}, + {"Undo (Meta-U) ", 0, (XtCallbackProc)undo, False}, {"Paste Objects (Meta-T) ", 0, paste, False}, - {"Paste Text (F18/F20)", 6, paste_primary_selection, False}, - {"Search/Replace... (Meta-I) ", -1, popup_search_panel, False}, - {"Spell Check... (Meta-K) ", 0, spell_check, False}, + {"Paste Text (F18/F20)", 6, (XtCallbackProc)paste_primary_selection, False}, + {"Search/Replace... (Meta-I) ", -1, (XtCallbackProc)popup_search_panel, False}, + {"Spell Check... (Meta-K) ", 0, (XtCallbackProc)spell_check, False}, {"Delete All (Meta-D) ", 0, delete_all_cmd, False}, {"-", 0, NULL, False}, /* divider line */ - {"Global settings... (Meta-G) ", 0, show_global_settings, False}, - {"Set units... (Shift-U)", 5, popup_unit_panel, False}, + {"Global settings... (Meta-G) ", 0, (XtCallbackProc)show_global_settings, False}, + {"Set units... (Shift-U)", 5, (XtCallbackProc)popup_unit_panel, False}, {NULL, 0, NULL, False}, }; @@ -221,23 +220,23 @@ menu_def edit_menu_items[] = { #define AUTO_RFS_MSG "Autorefresh mode " menu_def view_menu_items[] = { - {"Manage Styles... (Ctrl-Y)", 7, popup_manage_style_panel, False}, - {"Redraw (Ctrl-L)", 0, redisplay_canvas, False}, - {"Portrait/Landscape (Meta-C)", 3, change_orient, False}, - {"Zoom In (Shift-Z)", 5, inc_zoom_centered, False}, - {"Zoom Out (z)", 5, dec_zoom_centered, False}, - {"Zoom to Fit canvas (Ctrl-Z)", 8, fit_zoom, False}, - {"Unzoom", 0, unzoom, False}, - {"Pan to origin", 0, pan_origin, False}, - {"Character map", 0, popup_character_map, False}, + {"Manage Styles... (Ctrl-Y)", 7, (XtCallbackProc)popup_manage_style_panel, False}, + {"Redraw (Ctrl-L)", 0, (XtCallbackProc)redisplay_canvas, False}, + {"Portrait/Landscape (Meta-C)", 3, (XtCallbackProc)change_orient, False}, + {"Zoom In (Shift-Z)", 5, (XtCallbackProc)inc_zoom_centered, False}, + {"Zoom Out (z)", 5, (XtCallbackProc)dec_zoom_centered, False}, + {"Zoom to Fit canvas (Ctrl-Z)", 8, (XtCallbackProc)fit_zoom, False}, + {"Unzoom", 0, (XtCallbackProc)unzoom, False}, + {"Pan to origin", 0, (XtCallbackProc)pan_origin, False}, + {"Character map", 0, (XtCallbackProc)popup_character_map, False}, {"-", 0, NULL, False}, /* divider line */ /* the following menu labels will be refreshed in refresh_view_menu() */ - {PAGE_BRD_MSG, 10, toggle_show_borders, True}, - {DPTH_MGR_MSG, 5, toggle_show_depths, True}, - {INFO_BAL_MSG, 6, toggle_show_balloons, True}, - {LINE_LEN_MSG, 10, toggle_show_lengths, True}, - {VRTX_NUM_MSG, 5, toggle_show_vertexnums, True}, - {AUTO_RFS_MSG, 0, toggle_refresh_mode, True}, + {PAGE_BRD_MSG, 10, (XtCallbackProc)toggle_show_borders, True}, + {DPTH_MGR_MSG, 5, (XtCallbackProc)toggle_show_depths, True}, + {INFO_BAL_MSG, 6, (XtCallbackProc)toggle_show_balloons, True}, + {LINE_LEN_MSG, 10, (XtCallbackProc)toggle_show_lengths, True}, + {VRTX_NUM_MSG, 5, (XtCallbackProc)toggle_show_vertexnums, True}, + {AUTO_RFS_MSG, 0, (XtCallbackProc)toggle_refresh_mode, True}, {NULL, 0, NULL, False}, }; @@ -298,7 +297,7 @@ main_menu_info main_menus[] = { /* needed by setup_sizes() */ -static void create_global_panel (Widget w); +static void create_global_panel (void); static size_t locate_menu (String *params, Cardinal *nparams); @@ -805,7 +804,7 @@ new(Widget w, XtPointer closure, XtPointer call_data) } void -delete_all_cmd(Widget w, int closure, int call_data) +delete_all_cmd(Widget w, XtPointer closure, XtPointer call_data) { (void)w; (void)closure; @@ -925,7 +924,7 @@ typedef struct _global { globalStruct global; void -show_global_settings(Widget w) +show_global_settings(void) { /* turn off Compose key LED */ setCompLED(0); @@ -940,18 +939,18 @@ show_global_settings(Widget w) global.allownegcoords = appres.allownegcoords; global.showaxislines = appres.showaxislines; - popup_global_panel(w); + popup_global_panel(); } static Widget show_bal, delay_label; static void -popup_global_panel(Widget w) +popup_global_panel(void) { Dimension ht; if (global_popup == 0) { - create_global_panel(w); + create_global_panel(); XtPopup(global_popup, XtGrabNonexclusive); (void)XSetWMProtocols(tool_d, XtWindow(global_popup), &wm_delete_window, 1); @@ -969,9 +968,8 @@ popup_global_panel(Widget w) } static void -create_global_panel(Widget w) +create_global_panel(void) { - (void)w; DeclareArgs(11); Widget beside, below, freehand, recent; Widget delay_form, delay_spinner; --- a/src/w_cmdpanel.h +++ b/src/w_cmdpanel.h @@ -31,7 +31,7 @@ typedef struct { char *name; /* name e.g. 'Save' */ int u_line; /* which character to underline (-1 means none) */ - void (*func)(); /* function that is called for menu choice */ + XtCallbackProc func; /* function that is called for menu choice */ Boolean checkmark; /* whether a checkmark is put in the left bitmap space */ } menu_def ; @@ -55,11 +55,11 @@ extern void add_cmd_actions(void); extern void quit(Widget w, XtPointer closure, XtPointer call_data); extern void new(Widget w, XtPointer closure, XtPointer call_data); extern void paste(Widget w, XtPointer closure, XtPointer call_data); -extern void delete_all_cmd(Widget w, int closure, int call_data); +extern void delete_all_cmd(Widget w, XtPointer closure, XtPointer call_data); extern void setup_cmd_panel(void); extern void change_orient(void); extern void setup_cmd_panel(void); -extern void show_global_settings(Widget w); +extern void show_global_settings(void); extern void acc_load_recent_file(Widget w, XEvent *event, String *params, Cardinal *nparams); extern int num_main_menus(void); extern Widget create_menu_item(main_menu_info *menup); --- a/src/w_digitize.c +++ b/src/w_digitize.c @@ -73,9 +73,8 @@ static char *example_save = (char *) NULL; static Boolean digitize_append_save; void -popup_digitize_panel(Widget w) +popup_digitize_panel(void) { - (void)w; DeclareArgs(2); char *tmpstr; --- a/src/w_digitize.h +++ b/src/w_digitize.h @@ -19,8 +19,6 @@ #ifndef W_DIGITIZE_H #define W_DIGITIZE_H -#include - -extern void popup_digitize_panel(Widget w); +extern void popup_digitize_panel(void); #endif --- a/src/w_dir.c +++ b/src/w_dir.c @@ -832,6 +832,7 @@ DoChangeDir(char *dir) void Rescan(Widget w, XEvent *ev, String *params, Cardinal *num_params) { + (void)w; (void)ev; (void)params; (void)num_params; char *dir; char **filelist, **dirlist; --- a/src/w_export.c +++ b/src/w_export.c @@ -82,7 +82,6 @@ Widget export_grid_major_menu_button, export_grid_major_menu; Widget export_grid_unit_label; void export_update_figure_size(void); -void do_export(Widget w); /* LOCAL */ @@ -180,7 +179,7 @@ static void get_magnif(void); static void get_quality(void); static void update_figure_size(void); static void fit_page(void); -static void create_export_panel(Widget w); +static void create_export_panel(void); static void manage_optional(void); static void set_export_mask(int lang); @@ -238,7 +237,7 @@ static char exp_msg[] = "The current figure is modified.\nDo you want to save it before exporting?"; void -do_export(Widget w) +do_export(void) { char *fval; int xoff, yoff; @@ -274,7 +273,7 @@ do_export(Widget w) return; /* cancel, do not export */ if (!export_popup) - create_export_panel(w); + create_export_panel(); /* if there is no default export name (e.g. if user has done "New" and not entered a name) then make one up */ @@ -982,7 +981,7 @@ get_quality(void) /* create (if necessary) and popup the export panel */ void -popup_export_panel(Widget w) +popup_export_panel(void) { char buf[60]; @@ -1030,7 +1029,7 @@ popup_export_panel(Widget w) compound_bound(&objects, &lx, &ly, &ux, &uy); export_update_figure_size(); } else { - create_export_panel(w); + create_export_panel(); } /* set the directory widget to the current export directory */ @@ -1148,9 +1147,8 @@ toggle_pdf_pagemode(Widget w, XtPointer closure, XtPointer call_data) return; } -void create_export_panel(Widget w) +void create_export_panel(void) { - (void)w; Widget beside, below; Widget entry, papersize_menu; XFontStruct *temp_font; --- a/src/w_export.h +++ b/src/w_export.h @@ -50,8 +50,8 @@ extern Widget export_grid_unit_label; extern void export_grid_minor_select(Widget w, XtPointer new_grid_choice, XtPointer call_data); extern void export_grid_major_select(Widget w, XtPointer new_grid_choice, XtPointer call_data); -extern void popup_export_panel(Widget w); -extern void do_export(Widget w); +extern void popup_export_panel(void); +extern void do_export(void); extern void update_def_filename (void); #endif --- a/src/w_file.c +++ b/src/w_file.c @@ -92,7 +92,7 @@ Widget preview_stop, preview_label, dummy_label; Widget comments_widget; Boolean cancel_preview = False; Boolean preview_in_progress = False; -void load_request(Widget w, XButtonEvent *ev); /* needed by main() */ +void load_request(void); /* needed by main() */ /* LOCALS */ @@ -133,9 +133,12 @@ static int save_avail_image_cols; static Boolean image_colors_are_saved = False; static void popup_file_panel(int mode); -static void file_panel_cancel(Widget w, XButtonEvent *ev); -static void do_load(Widget w, XButtonEvent *ev), do_merge(Widget w, XButtonEvent *ev); -static void merge_request(Widget w, XButtonEvent *ev), cancel_request(Widget w, XButtonEvent *ev), save_request(Widget w, XButtonEvent *ev); +static void file_panel_cancel(void); +static void do_load(void); +static void do_merge(void); +static void merge_request(void); +static void cancel_request(void); +static void save_request(void); static void clear_preview(void); DeclareStaticArgs(15); @@ -243,7 +246,7 @@ void file_getxyoff(int *ixoff, int *iyoff) } static void -merge_request(Widget w, XButtonEvent *ev) +merge_request(void) { if (preview_in_progress) { file_merge_request = True; @@ -252,15 +255,13 @@ merge_request(Widget w, XButtonEvent *ev) } else { /* make sure this is false from any previous previewing */ cancel_preview = False; - do_merge(w, ev); + do_merge(); } } static void -do_merge(Widget w, XButtonEvent *ev) +do_merge(void) { - (void)w; - (void)ev; char path[PATH_MAX], fname[PATH_MAX]; char *fval, *dval; int xoff, yoff; @@ -314,7 +315,7 @@ do_merge(Widget w, XButtonEvent *ev) */ void -load_request(Widget w, XButtonEvent *ev) +load_request(void) { if (preview_in_progress) { file_load_request = True; @@ -323,15 +324,13 @@ load_request(Widget w, XButtonEvent *ev) } else { /* make sure this is false from any previous previewing */ cancel_preview = False; - do_load(w, ev); + do_load(); } } static void -do_load(Widget w, XButtonEvent *ev) +do_load(void) { - (void)w; - (void)ev; char fname[PATH_MAX]; char *fval, *dval; int xoff, yoff; @@ -451,7 +450,7 @@ new_xfig_request(Widget w, XButtonEvent *ev) /* set a request to save. See notes above for load_request() */ void -save_request(Widget w, XButtonEvent *ev) +save_request(void) { /* turn off Compose key LED */ setCompLED(0); @@ -463,7 +462,7 @@ save_request(Widget w, XButtonEvent *ev) } else { /* make sure this is false from any previous previewing */ cancel_preview = False; - do_save(w, ev); + do_save(); } } @@ -522,10 +521,8 @@ warning: } void -do_save(Widget w, XButtonEvent *ev) +do_save(void) { - (void)w; - (void)ev; char *fval, *dval, fname[PATH_MAX]; int qresult; @@ -679,7 +676,7 @@ query_save(char *msg) if ((qresult = popup_query(QUERY_YESNOCAN, msg)) == RESULT_CANCEL) return False; else if (qresult == RESULT_YES) { - save_request((Widget) 0, (XButtonEvent *) 0); + save_request(); /* * if saving was not successful, figure_modified is still true: * do not quit! @@ -693,7 +690,7 @@ query_save(char *msg) } static void -cancel_request(Widget w, XButtonEvent *ev) +cancel_request(void) { if (preview_in_progress) { file_cancel_request = True; @@ -702,15 +699,13 @@ cancel_request(Widget w, XButtonEvent *ev) } else { /* make sure this is false from any previous previewing */ cancel_preview = False; - file_panel_cancel(w, ev); + file_panel_cancel(); } } static void -file_panel_cancel(Widget w, XButtonEvent *ev) +file_panel_cancel(void) { - (void)w; - (void)ev; if (user_colors_saved) { restore_user_colors(); restore_nuser_colors(); @@ -1648,22 +1643,22 @@ void preview_figure(char *filename, Widget parent, Widget canvas, Widget size_wi if (file_cancel_request) { cancel_preview = False; - file_panel_cancel((Widget) 0, (XButtonEvent *) 0); + file_panel_cancel(); } if (file_load_request) { cancel_preview = False; - do_load((Widget) 0, (XButtonEvent *) 0); + do_load(); /* if redisplay_region was called don't bother because we're loading a file over it */ request_redraw = False; } if (file_merge_request) { cancel_preview = False; - do_merge((Widget) 0, (XButtonEvent *) 0); + do_merge(); } if (file_save_request) { cancel_preview = False; - do_save((Widget) 0, (XButtonEvent *) 0); + do_save(); } /* if user requested a canvas redraw while preview was being generated do that now for full canvas */ --- a/src/w_file.h +++ b/src/w_file.h @@ -22,8 +22,8 @@ #include /* includes X11/Xlib.h */ extern Boolean colors_are_swapped; -extern void load_request(Widget w, XButtonEvent *ev); -extern void do_save(Widget w, XButtonEvent *ev); +extern void load_request(void); +extern void do_save(void); extern void popup_open_panel(void); extern void popup_merge_panel(void); extern void popup_saveas_panel(void); --- a/src/w_fontpanel.c +++ b/src/w_fontpanel.c @@ -50,7 +50,7 @@ static int *font_ps_sel; /* ptr to store selected ps font in */ static int *font_latex_sel; /* ptr to store selected latex font */ static int *flag_sel; /* pointer to store ps/latex flag */ static Widget font_widget; /* widget adr to store font image in */ -static void (*font_setimage) (); +static void (*font_setimage) (Widget font_widget); static MenuItemRec ps_fontmenu_items[NUM_FONTS + 1]; static MenuItemRec latex_fontmenu_items[NUM_LATEX_FONTS]; @@ -340,7 +340,7 @@ setup_fontmenu(void) } void -fontpane_popup(int *psfont_adr, int *latexfont_adr, int *psflag_adr, void (*showfont_fn) (/* ??? */), Widget show_widget) +fontpane_popup(int *psfont_adr, int *latexfont_adr, int *psflag_adr, void (*showfont_fn) (Widget font_widget), Widget show_widget) { DeclareArgs(2); Position xposn, yposn; --- a/src/w_help.c +++ b/src/w_help.c @@ -19,7 +19,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "w_help.h" #include #include @@ -36,6 +35,7 @@ #include "mode.h" #include "f_util.h" #include "w_canvas.h" +#include "w_help.h" #include "w_msgpanel.h" #include "w_util.h" --- a/src/w_help.h +++ b/src/w_help.h @@ -16,7 +16,9 @@ * */ -extern void launch_refman(), launch_refpdf_en(), launch_refpdf_jp(); -extern void launch_man(); -extern void launch_howto(); -extern void launch_about(); +extern void launch_refman(Widget w, XtPointer closure, XtPointer call_data); +extern void launch_refpdf_en(Widget w, XtPointer closure, XtPointer call_data); +extern void launch_refpdf_jp(Widget w, XtPointer closure, XtPointer call_data); +extern void launch_man(Widget w, XtPointer closure, XtPointer call_data); +extern void launch_howto(Widget w, XtPointer closure, XtPointer call_data); +extern void launch_about(Widget w, XtPointer closure, XtPointer call_data); --- a/src/w_indpanel.c +++ b/src/w_indpanel.c @@ -74,13 +74,11 @@ Boolean update_buts_managed; Widget choice_popup; void show_depth(ind_sw_info *sw), show_zoom(ind_sw_info *sw); void show_fillstyle(ind_sw_info *sw); -void fontpane_popup(int *psfont_adr, int *latexfont_adr, int *psflag_adr, void (*showfont_fn) (/* ??? */), Widget show_widget); +void fontpane_popup(int *psfont_adr, int *latexfont_adr, int *psflag_adr, void (*showfont_fn) (Widget w), Widget show_widget); void make_pulldown_menu_images(choice_info *entries, Cardinal nent, Pixmap *images, char **texts, Widget parent, XtCallbackProc callback); void tog_selective_update(long unsigned int mask); unsigned long cur_indmask; /* mask showing which indicator buttons are mapped */ -void inc_zoom_centered(ind_sw_info *sw); -void dec_zoom_centered(ind_sw_info *sw); -void fit_zoom(ind_sw_info *sw); +void fit_zoom(void); ind_sw_info ind_switches[]; ind_sw_info *fill_style_sw; ind_sw_info *pen_color_button, *fill_color_button, *depth_button; @@ -396,7 +394,7 @@ ind_sw_info *fill_style_sw; ind_sw_info ind_switches[] = { {I_FVAL, 0, "Zoom", "", NARROW_IND_SW_WD, /* always show zoom button */ - NULL, &display_zoomscale, inc_zoom_centered, dec_zoom_centered, + NULL, &display_zoomscale, (void (*)(ind_sw_info *sw))inc_zoom_centered, (void (*)(ind_sw_info *sw))dec_zoom_centered, show_zoom, 0 /* MIN_ZOOM */, MAX_ZOOM, 1.0, NULL, 0, 0, False, NULL, NULL, NULL, 0, NULL}, {I_CHOICE, 0, "Grid", "Mode", DEF_IND_SW_WD, /* and grid button */ &cur_gridmode, NULL, inc_choice, dec_choice, show_gridmode, 0, 0, 0.0, @@ -432,10 +430,10 @@ ind_sw_info ind_switches[] = { anglegeom_choices, NUM_ANGLEGEOM_CHOICES, NUM_ANGLEGEOM_CHOICES, False, NULL, NULL, NULL, 0, NULL}, {I_CHOICE, I_PEN_COLOR, "PenColor", "", XWIDE_IND_SW_WD, - (int *) &cur_pencolor, NULL, next_pencolor, prev_pencolor, show_pencolor, 0, 0, 0.0, + (int *) &cur_pencolor, NULL, next_pencolor, prev_pencolor, (void (*)(ind_sw_info *sw))show_pencolor, 0, 0, 0.0, color_choices, NUM_STD_COLS + 1, 7, False, NULL, NULL, NULL, 0, NULL}, {I_CHOICE, I_FILL_COLOR, "FillColor", "", XWIDE_IND_SW_WD, - (int *) &cur_fillcolor, NULL, next_fillcolor, prev_fillcolor, show_fillcolor,0, 0, 0.0, + (int *) &cur_fillcolor, NULL, next_fillcolor, prev_fillcolor, (void (*)(ind_sw_info *sw))show_fillcolor,0, 0, 0.0, color_choices, NUM_STD_COLS + 1, 7, False, NULL, NULL, NULL, 0, NULL}, {I_CHOICE, I_FILLSTYLE, "Fill", "Style", DEF_IND_SW_WD, &cur_fillstyle, NULL, darken_fill, lighten_fill, show_fillstyle,0, 0, 0.0, @@ -4543,16 +4541,14 @@ zoom_focus(int x, int y, void(* zoom)()) } void -inc_zoom_centered(ind_sw_info *sw) +inc_zoom_centered(void) { - (void)sw; zoom_focus(CANVAS_WD/2, CANVAS_HT/2, inc_zoom); } void -dec_zoom_centered(ind_sw_info *sw) +dec_zoom_centered(void) { - (void)sw; zoom_focus(CANVAS_WD/2, CANVAS_HT/2, dec_zoom); } @@ -4602,9 +4598,8 @@ wheel_dec_zoom(void) /* zoom figure to fully fit in canvas */ void -fit_zoom(ind_sw_info *sw) +fit_zoom(void) { - (void)sw; int width, height; float zoomx, zoomy; @@ -4807,7 +4802,7 @@ zoom_to_fit(Widget w, XtPointer closure, XtPointer call_data) (void)call_data; ind_sw_info *sw = (ind_sw_info *) closure; - fit_zoom(sw); + fit_zoom(); nval_panel_dismiss(); } --- a/src/w_indpanel.h +++ b/src/w_indpanel.h @@ -139,9 +139,9 @@ typedef struct ind_sw_struct { int sw_width; int *i_varadr; float *f_varadr; - void (*inc_func) (); - void (*dec_func) (); - void (*show_func) (); + void (*inc_func) (struct ind_sw_struct *isw); + void (*dec_func) (struct ind_sw_struct *isw); + void (*show_func) (struct ind_sw_struct *isw); int min, max; /* min, max values allowable */ float inc; /* increment for spinner */ choice_info *choices; /* specific to I_CHOICE */ @@ -169,14 +169,14 @@ extern Boolean update_buts_managed; extern Widget choice_popup; extern void show_depth(ind_sw_info *sw), show_zoom(ind_sw_info *sw); extern void show_fillstyle(ind_sw_info *sw); -extern void fontpane_popup(int *psfont_adr, int *latexfont_adr, int *psflag_adr, void (*showfont_fn) (/* ??? */), Widget show_widget); +extern void fontpane_popup(int *psfont_adr, int *latexfont_adr, int *psflag_adr, void (*showfont_fn) (Widget w), Widget show_widget); extern void make_pulldown_menu_images(choice_info *entries, Cardinal nent, Pixmap *images, char **texts, Widget parent, XtCallbackProc callback); extern void tog_selective_update(long unsigned int mask); extern unsigned long cur_indmask; /* mask showing which indicator buttons are mapped */ -extern void inc_zoom_centered(ind_sw_info *sw); -extern void dec_zoom_centered(ind_sw_info *sw); -extern void fit_zoom(ind_sw_info *sw); -extern void wheel_inc_zoom(), wheel_dec_zoom(); +extern void inc_zoom_centered(void); +extern void dec_zoom_centered(void); +extern void fit_zoom(void); +extern void wheel_inc_zoom(void), wheel_dec_zoom(void); extern void update_current_settings(void); extern void setup_ind_panel(void); extern void manage_update_buts (void); --- a/src/w_print.c +++ b/src/w_print.c @@ -69,7 +69,7 @@ Widget print_grid_major_menu_button, print_grid_major_menu; Widget print_grid_unit_label; void print_update_figure_size(void); -void do_print(Widget w), do_print_batch(Widget w); +void do_print(void), do_print_batch(void); /* LOCAL */ @@ -114,7 +114,7 @@ static void update_figure_size(void); static void fit_page(void); static Position xposn, yposn; -static void print_panel_dismiss(Widget w, XButtonEvent *ev), do_clear_batch(Widget w); +static void print_panel_dismiss(void), do_clear_batch(void); static void get_magnif(void); static void update_mag(Widget widget, XtPointer item, XtPointer event); @@ -145,14 +145,13 @@ static const char *print_command_items[] = { " lp", /* print_command == 0 */ "lpr" /* print_command == 1 */ }; -static void create_print_panel(Widget w); +static void create_print_panel(void); static void update_batch_count(void); static void -print_panel_dismiss(Widget w, XButtonEvent *ev) +print_panel_dismiss(void) { - (void)w; (void)ev; /* first get magnification in case it changed */ /* the other things like paper size, justification, etc. are already updated because they are from menus */ @@ -161,7 +160,7 @@ print_panel_dismiss(Widget w, XButtonEvent *ev) } void -do_print(Widget w) +do_print(void) { char *printer_val; char *param_val; @@ -179,7 +178,7 @@ do_print(Widget w) /* create popup panel if not already there so we have all the resources necessary (e.g. printer name etc.) */ if (!print_popup) - create_print_panel(w); + create_print_panel(); /* get the magnification into appres.magnification */ get_magnif(); @@ -199,7 +198,7 @@ do_print(Widget w) file_msg("Error during PRINT"); put_msg("Printed batch file %s", batch_file); /* clear the batch file and the count */ - do_clear_batch(w); + do_clear_batch(); app_flush(); } else { strcpy(cmd, param_val); @@ -312,7 +311,7 @@ update_figure_size(void) } void -do_print_batch(Widget w) +do_print_batch(void) { char backgrnd[10], grid[80]; @@ -345,7 +344,7 @@ do_print_batch(Widget w) batch_exists = True; } if (!print_popup) - create_print_panel(w); + create_print_panel(); /* get magnification into appres.magnification */ get_magnif(); @@ -378,10 +377,8 @@ do_print_batch(Widget w) } static void -do_clear_batch(Widget w) +do_clear_batch(void) { - (void)w; - if (close(fdbatch)) file_msg("Error closing batch file %s: %s", batch_file, strerror(errno)); @@ -634,7 +631,7 @@ print_update_figure_size(void) } void -popup_print_panel(Widget w) +popup_print_panel(void) { char buf[30]; @@ -658,7 +655,7 @@ popup_print_panel(Widget w) "Background Color", background_select, NO_TRANSP, INCL_BACKG); } else { - create_print_panel(w); + create_print_panel(); } XtPopup(print_popup, XtGrabNone); /* now that the popup is realized, put in the name of the first printer */ @@ -675,9 +672,8 @@ popup_print_panel(Widget w) /* make the popup print panel */ -void create_print_panel(Widget w) +void create_print_panel(void) { - (void)w; Widget image; Widget entry,mag_spinner, below, fitpage; Pixmap p; --- a/src/w_print.h +++ b/src/w_print.h @@ -34,9 +34,9 @@ extern Widget make_layer_choice(char *label_all, char *label_active, Widget parent, Widget below, Widget beside, int hdist, int vdist); extern void print_update_figure_size(void); -extern void popup_print_panel(Widget w); -extern void do_print(Widget w); -extern void do_print_batch(Widget w); +extern void popup_print_panel(void); +extern void do_print(void); +extern void do_print_batch(void); extern Widget print_grid_minor_text, print_grid_major_text; extern Widget print_grid_minor_menu_button, print_grid_minor_menu; --- a/src/w_util.c +++ b/src/w_util.c @@ -1483,7 +1483,9 @@ Widget make_grid_options(Widget parent, Widget put_below, Widget put_beside, char *minor_grid_value, char *major_grid_value, Widget *grid_minor_menu_button, Widget *grid_major_menu_button, Widget *grid_minor_menu, Widget *grid_major_menu, Widget *print_grid_minor_text, Widget *print_grid_major_text, - Widget *grid_unit_label, void (*grid_major_select) (/* ??? */), void (*grid_minor_select) (/* ??? */)) + Widget *grid_unit_label, + void (*grid_major_select) (Widget w, XtPointer new_grid_choice, XtPointer call_data), + void (*grid_minor_select) (Widget w, XtPointer new_grid_choice, XtPointer call_data)) { Widget below, beside; --- a/src/w_util.h +++ b/src/w_util.h @@ -77,7 +77,7 @@ extern char *grid_cm_choices[]; extern int num_grid_inch_choices, num_grid_tenth_inch_choices, num_grid_cm_choices; extern char **grid_choices; extern int n_grid_choices, grid_minor, grid_major; -extern Widget make_grid_options(Widget parent, Widget put_below, Widget put_beside, char *minor_grid_value, char *major_grid_value, Widget *grid_minor_menu_button, Widget *grid_major_menu_button, Widget *grid_minor_menu, Widget *grid_major_menu, Widget *print_grid_minor_text, Widget *print_grid_major_text, Widget *grid_unit_label, void (*grid_major_select) (/* ??? */), void (*grid_minor_select) (/* ??? */)); +extern Widget make_grid_options(Widget parent, Widget put_below, Widget put_beside, char *minor_grid_value, char *major_grid_value, Widget *grid_minor_menu_button, Widget *grid_major_menu_button, Widget *grid_minor_menu, Widget *grid_major_menu, Widget *print_grid_minor_text, Widget *print_grid_major_text, Widget *grid_unit_label, void (*grid_major_select) (Widget w, XtPointer new_grid_choice, XtPointer garbage), void (*grid_minor_select) (Widget w, XtPointer new_grid_choice, XtPointer call_data)); extern void reset_grid_menus(Boolean inches); extern Boolean check_action_on(void); -- 2.45.3 From 6228b74a901bb7d83935868e73ce922b7bb53c3f Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Sun, 2 Feb 2025 22:29:33 +0100 Subject: [PATCH 8/8] Fix miscellaneous prototypes --- a/src/d_text.c +++ b/src/d_text.c @@ -143,7 +143,7 @@ Boolean xim_active = False; static int save_base_x, save_base_y; -static void xim_set_spot(); +static void xim_set_spot(int x, int y); static pid_t preedit_pid = -1; static char preedit_filename[PATH_MAX] = ""; --- a/src/e_edit.c +++ b/src/e_edit.c @@ -108,7 +108,7 @@ static void new_generic_values(void); static void new_arrow_values(void); static void get_new_line_values(void); static void generic_window(char *object_type, char *sub_type, - icon_struct *icon, void (*d_proc)(/* ??? */), + icon_struct *icon, void (*d_proc)(void), Boolean generics, Boolean arrows, char *comments); static void spline_point_window(int x, int y); static void font_image_panel(Pixmap pixmap, char *label, Widget *pi_x); @@ -3389,7 +3389,7 @@ reset_edit_cursor(void) static void generic_window(char *object_type, char *sub_type, icon_struct *icon, - void (*d_proc) (/* ??? */), Boolean generics, Boolean arrows, + void (*d_proc) (void), Boolean generics, Boolean arrows, char *comments) { Dimension label_height, image_height; --- a/src/f_picobj.c +++ b/src/f_picobj.c @@ -71,7 +71,7 @@ extern int read_xpm(F_pic *pic, struct xfig_stream *restrict pic_stream); static struct _haeders { char *type; char *bytes; - int (*readfunc)(); + int (*readfunc)(F_pic *pic, struct xfig_stream *restrict pic_stream); } headers[] = { {"GIF", "GIF", read_gif}, {"PCX", "\012\005\001", read_pcx}, --- a/src/w_indpanel.c +++ b/src/w_indpanel.c @@ -4517,7 +4517,7 @@ dec_zoom(void) /* zoom in or out, keeping location x,y fixed */ void -zoom_focus(int x, int y, void(* zoom)()) +zoom_focus(int x, int y, void(* zoom)(void)) { double stretch; --- a/src/w_library.c +++ b/src/w_library.c @@ -187,19 +187,19 @@ static Widget make_library_menu(Widget parent, char *name, static int -SPComp(char **s1, char **s2) +SPComp(const void *s1, const void *s2) { - return (strcasecmp(*s1, *s2)); + return (strcasecmp(*(char**)s1, *(char**)s2)); } /* comparison function for librec sorting using qsort() */ static int -LRComp(struct lib_rec **r1, struct lib_rec **r2) +LRComp(const void *r1, const void *r2) { struct lib_rec *name1, *name2; - name1 = *r1; - name2 = *r2; + name1 = *(struct lib_rec **)r1; + name2 = *(struct lib_rec **)r2; return (strcasecmp(name1->name, name2->name)); } @@ -1345,7 +1345,7 @@ ScanLibraryDirectory(Boolean at_top, struct lib_rec **librec, char *path, closedir(dirp); if (recnum > 0) { /* sort them since the order of files in directories is not necessarily alphabetical */ - qsort(&librec[0], recnum, sizeof(struct lib_rec *), (int (*)())*LRComp); + qsort(&librec[0], recnum, sizeof(struct lib_rec *), LRComp); } /* all OK */ *nentries = recnum; @@ -1600,7 +1600,7 @@ MakeLibraryFileList(char *dir_name, char **obj_list) num_list_items = numobj; /* signals up/down arrows to start at 0 if user doesn't press mouse in list first */ which_num = -1; - qsort(obj_list,numobj,sizeof(char*),(int (*)())*SPComp); + qsort(obj_list,numobj,sizeof(char*),SPComp); closedir(dirp); return True; } --- a/src/w_modepanel.h +++ b/src/w_modepanel.h @@ -34,7 +34,7 @@ extern void init_mode_panel(Widget tool); typedef struct mode_switch_struct { icon_struct *icon; /* icon (xxx_ic struct) */ int mode; /* mode (e.g. F_CIRCLE_BY_RAD) */ - void (*setmode_func) (); /* function called when button is released */ + void (*setmode_func) (void); /* function called when button is released */ int objmask; /* mask of objects that may be affected by this */ unsigned long indmask; /* mask to display indicators for this func */ char modemsg[MAX_MODEMSG_LEN]; /* message for function */ --- a/src/w_srchrepl.c +++ b/src/w_srchrepl.c @@ -99,7 +99,7 @@ String search_results_translations = static void search_panel_dismiss(Widget widget, XtPointer closure, XtPointer call_data); static void search_and_replace_text(Widget widget, XtPointer closure, XtPointer call_data); -static Boolean search_text_in_compound(F_compound *com, char *pattern, void (*proc) (/* ??? */)); +static Boolean search_text_in_compound(F_compound *com, char *pattern, void (*proc) (F_text *t)); static Boolean replace_text_in_compound(F_compound *com, char *pattern, char *dst); static void found_text_panel_dismiss(void); static void do_replace(Widget widget, XtPointer closure, XtPointer call_data); @@ -376,7 +376,7 @@ search_and_replace_text(Widget widget, XtPointer closure, XtPointer call_data) } static Boolean -search_text_in_compound(F_compound *com, char *pattern, void (*proc) (/* ??? */)) +search_text_in_compound(F_compound *com, char *pattern, void (*proc) (F_text *t)) { F_compound *c; F_text *t; -- 2.45.3 --- a/src/d_arc.c +++ b/src/d_arc.c @@ -78,7 +78,7 @@ canvas_locmove_proc = null_proc_move; canvas_leftbut_proc = init_arc_drawing; canvas_middlebut_proc = init_arc_c_drawing; - canvas_rightbut_proc = null_proc; + canvas_rightbut_proc = null_proc_button; set_cursor(crosshair_cursor); reset_action_on(); } @@ -182,8 +182,10 @@ } static void -get_arcpoint(int x, int y) +get_arcpoint(int x, int y, unsigned int shift) { + (void)shift; + if (x == fix_x && y == fix_y) return; @@ -209,8 +211,10 @@ } static void -create_arcobject(int lx, int ly) +create_arcobject(int lx, int ly, unsigned int shift) { + (void)shift; + F_arc *arc; int x, y; float xx, yy;