static void fix_movedcompoundpoint(int x, int y) { float scalex, scaley; 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 */ erase_lengths(); adjust_box_pos(x, y, from_x, from_y, &cur_x, &cur_y); /* make a copy of the original and save as unchanged object */ old_c = copy_compound(cur_c); clean_up(); old_c->next = cur_c; set_latestcompound(old_c); set_action_object(F_EDIT, O_COMPOUND); scalex = ((float) (cur_x - fix_x)) / (from_x - fix_x); scaley = ((float) (cur_y - fix_y)) / (from_y - fix_y); /* scale the compound */ scale_compound(cur_c, scalex, scaley, fix_x, fix_y); /* redraw anything under the old compound */ redisplay_compound(old_c); /* and the new compound */ redisplay_compound(cur_c); /* turn back on all relevant markers */ update_markers(new_objmask); set_lastposition(from_x, from_y); set_newposition(cur_x, cur_y); set_modifiedflag(); wrapup_movepoint(); }
static void create_compoundobject(int x, int y) { F_compound *c; if ((c = create_compound()) == NULL) return; if (compose_compound(c) == 0) { free((char *) c); compound_selected(); draw_mousefun_canvas(); put_msg("Empty compound, ignored"); return; } /* * Make the bounding box exactly match the dimensions of the compound. */ compound_bound(c, &c->nwcorner.x, &c->nwcorner.y, &c->secorner.x, &c->secorner.y); /* if zero width or height in the compound, adjust to next positioning grid point or a few pixels if positioning grid is "ANY" */ if (c->nwcorner.x == c->secorner.x) { if (cur_pointposn != P_ANY) { c->secorner.x += posn_rnd[cur_gridunit][cur_pointposn]; c->secorner.x = ceil_coords_x(c->secorner.x,c->secorner.y); } } if (c->nwcorner.y == c->secorner.y) { if (cur_pointposn != P_ANY) { c->secorner.y += posn_rnd[cur_gridunit][cur_pointposn]; c->secorner.y = ceil_coords_y(c->secorner.x,c->secorner.y); } } c->next = NULL; clean_up(); set_action(F_GLUE); toggle_markers_in_compound(c); list_add_compound(&objects.compounds, c); mask_toggle_compoundmarker(c); set_latestcompound(c); set_modifiedflag(); compound_selected(); draw_mousefun_canvas(); }
static void init_align(F_line *p, int type, int x, int y, int px, int py) { if (type != O_COMPOUND) return; cur_c = (F_compound *) p; toggle_compoundmarker(cur_c); draw_compoundelements(cur_c, ERASE); old_c = copy_compound(cur_c); compound_bound(cur_c, &xcmin, &ycmin, &xcmax, &ycmax); align_ellipse(); align_arc(); align_line(); align_spline(); align_compound(); align_text(); /* * Perform the distribution of the objects in the compound */ if ( (cur_halign == ALIGN_DISTRIB_C) || (cur_halign == ALIGN_DISTRIB_E) || (cur_halign == ALIGN_ABUT) ) distribute_horizontally(); if ( (cur_valign == ALIGN_DISTRIB_C) || (cur_valign == ALIGN_DISTRIB_E) || (cur_valign == ALIGN_ABUT) ) distribute_vertically(); /* * recompute the compound's bounding box */ compound_bound(cur_c, &cur_c->nwcorner.x, &cur_c->nwcorner.y, &cur_c->secorner.x, &cur_c->secorner.y); draw_compoundelements(cur_c, PAINT); toggle_compoundmarker(cur_c); clean_up(); old_c->next = cur_c; set_latestcompound(old_c); set_action_object(F_EDIT, O_COMPOUND); set_modifiedflag(); }
static void 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_locmove_proc = null_proc; canvas_ref_proc = null_proc; adjust_pos(x, y, fix_x, fix_y, &x, &y); dx = x - fix_x; dy = y - fix_y; translate_compound(new_c, dx, dy); clean_up(); set_latestcompound(new_c); if (return_proc == copy_selected) { add_compound(new_c); adjust_links(cur_linkmode, cur_links, dx, dy, 0, 0, 1.0, 1.0, True); free_linkinfo(&cur_links); } else { list_add_compound(&objects.compounds, new_c); adjust_links(cur_linkmode, cur_links, dx, dy, 0, 0, 1.0, 1.0, False); set_lastposition(fix_x, fix_y); set_newposition(x, y); set_lastlinkinfo(cur_linkmode, cur_links); cur_links = NULL; set_action_object(F_MOVE, O_COMPOUND); } set_modifiedflag(); redisplay_compound(new_c); /* turn back on all relevant markers */ update_markers(new_objmask); (*return_proc) (); draw_mousefun_canvas(); }