home *** CD-ROM | disk | FTP | other *** search
- /*
- * FIG : Facility for Interactive Generation of figures
- *
- * Adapted by Brian V. Smith from box.c originally writen by:
- *
- * Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
- * January 1985.
- * 1st revision : Aug 1985.
- *
- * %W% %G%
- */
- #include "fig.h"
- #include "resources.h"
- #include "alloc.h"
- #include "func.h"
- #include "object.h"
- #include "paintop.h"
-
- extern int line_style, line_thickness;
- extern float cur_styleval;
- extern int cur_color;
- extern int cur_areafill;
- extern int cur_radius;
- extern int fill_mode;
- extern int fix_x, fix_y, cur_x, cur_y;
- extern (*canvas_kbd_proc)();
- extern (*canvas_locmove_proc)();
- extern (*canvas_leftbut_proc)();
- extern (*canvas_middlebut_proc)();
- extern (*canvas_rightbut_proc)();
- extern null_proc();
- extern set_popupmenu();
-
- extern F_compound objects;
-
- /*************************** locally global procedures *********************/
-
- extern int elastic_box();
- extern int create_arc_boxobject();
- extern int init_arc_box_drawing();
-
- arc_box_drawing_selected()
- {
- 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 = set_popupmenu;
- set_cursor(&arrow_cursor);
- reset_action_on();
- }
-
- init_arc_box_drawing(x, y)
- int x, y;
- {
- cur_x = fix_x = x;
- cur_y = fix_y = y;
- canvas_locmove_proc = elastic_box;
- canvas_leftbut_proc = canvas_rightbut_proc = null_proc;
- canvas_middlebut_proc = create_arc_boxobject;
- draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT);
- set_temp_cursor(&null_cursor);
- set_action_on();
- }
-
- create_arc_boxobject(x, y)
- int x, y;
- {
- F_line *box;
- F_point *point;
-
- draw_rectbox(fix_x, fix_y, cur_x, cur_y, INV_PAINT);
-
-
- if ((Point_malloc(point)) == NULL) {
- blink_msg();
- put_msg(Err_mem);
- return;
- }
- point->x = x;
- point->y = y;
- point->next = NULL;
-
- Line_malloc(box);
- box->type = T_ARC_BOX;
- box->style = line_style;
- box->thickness = line_thickness;
- box->color = cur_color;
- box->depth = 0;
- box->pen = 0;
- box->area_fill = fill_mode? cur_areafill : 0;
- box->style_val = cur_styleval;
- box->radius = cur_radius; /* corner radius */
- box->for_arrow = NULL;
- box->back_arrow = NULL;
- box->points = point;
- box->next = NULL;
- append_point(x, fix_y, &point);
- append_point(fix_x, fix_y, &point);
- append_point(fix_x, y, &point);
- append_point(x, y, &point);
- draw_line(box, PAINT);
- clean_up();
- set_action_object(F_CREATE, O_POLYLINE);
- insert_line(&objects.lines, box);
- set_latestline(box);
- set_modifiedflag();
- arc_box_drawing_selected();
- }
-