static void place_lib_object(int x, int y, unsigned int shift) { F_compound *this_c; 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; put_draw(ERASE); clean_up(); if (draw_box) translate_compound(new_c,cur_x,cur_y); /* remove it from the depths because it will be added when it is put in the main list */ remove_compound_depth(new_c); add_compound(new_c); set_modifiedflag(); 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; clear_mousefun(); set_mousefun("","","", "", "", ""); turn_off_current(); set_cursor(arrow_cursor); edit_remember_lib_mode = True; this_c = new_c; edit_item(this_c, O_COMPOUND, 0, 0); } else { put_selected(); } }
void undo_break(void) { cut_objects(&objects, &object_tails); /* remove the depths from this compound because they'll be added in right after */ remove_compound_depth(saved_objects.compounds); list_add_compound(&objects.compounds, saved_objects.compounds); last_action = F_GLUE; toggle_markers_in_compound(saved_objects.compounds); mask_toggle_compoundmarker(saved_objects.compounds); }
static void place_lib_object_orig(int x, int y, unsigned int shift) { int dx,dy; canvas_ref_proc = null_proc; put_draw(ERASE); clean_up(); /* move back to original position */ dx = orig_put_x-x; dy = orig_put_y-y; translate_compound(new_c,dx,dy); /* remove it from the depths because it will be added when it is put in the main list */ remove_compound_depth(new_c); add_compound(new_c); set_modifiedflag(); redisplay_compound(new_c); put_selected(); }
void cancel_place_lib_obj(int x, int y, int shift) { /* if shift right-button, actually do a place in original position */ if (shift) { place_lib_object_orig(x, y, shift); return; } reset_action_on(); 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; canvas_kbd_proc = null_proc; clear_mousefun(); set_mousefun("","","", "", "", ""); turn_off_current(); set_cursor(arrow_cursor); put_draw(ERASE); /* remove it from the depths */ remove_compound_depth(new_c); }
static void get_compound(F_compound **list) { F_compound *compd, *c, *cc; for (c = objects.compounds; c != NULL;) { if (!c->tagged) { cc = c; c = c->next; continue; } remove_compound_depth(c); if (*list == NULL) *list = c; else compd->next = c; compd = c; if (c == objects.compounds) c = objects.compounds = objects.compounds->next; else c = cc->next = c->next; compd->next = NULL; } }
void undo_change(void) { char *swp_comm; F_compound swp_c; F_line swp_l; F_spline swp_s; F_ellipse swp_e; F_arc swp_a; F_text swp_t; last_action = F_NULL; /* to avoid a clean-up during "unchange" */ switch (last_object) { case O_POLYLINE: new_l = saved_objects.lines; /* the original */ old_l = saved_objects.lines->next; /* the changed object */ /* account for depths */ remove_depth(O_POLYLINE, old_l->depth); add_depth(O_POLYLINE, new_l->depth); /* swap old with new */ bcopy((char*)old_l, (char*)&swp_l, sizeof(F_line)); bcopy((char*)new_l, (char*)old_l, sizeof(F_line)); bcopy((char*)&swp_l, (char*)new_l, sizeof(F_line)); /* but keep the next pointers unchanged */ swp_l.next = old_l->next; old_l->next = new_l->next; new_l->next = swp_l.next; set_action_object(F_EDIT, O_POLYLINE); redisplay_lines(new_l, old_l); break; case O_ELLIPSE: new_e = saved_objects.ellipses; old_e = saved_objects.ellipses->next; /* account for depths */ remove_depth(O_ELLIPSE, old_e->depth); add_depth(O_ELLIPSE, new_e->depth); /* swap old with new */ bcopy((char*)old_e, (char*)&swp_e, sizeof(F_ellipse)); bcopy((char*)new_e, (char*)old_e, sizeof(F_ellipse)); bcopy((char*)&swp_e, (char*)new_e, sizeof(F_ellipse)); /* but keep the next pointers unchanged */ swp_e.next = old_e->next; old_e->next = new_e->next; new_e->next = swp_e.next; set_action_object(F_EDIT, O_ELLIPSE); redisplay_ellipses(new_e, old_e); break; case O_TXT: new_t = saved_objects.texts; old_t = saved_objects.texts->next; /* account for depths */ remove_depth(O_TXT, old_t->depth); add_depth(O_TXT, new_t->depth); /* swap old with new */ bcopy((char*)old_t, (char*)&swp_t, sizeof(F_text)); bcopy((char*)new_t, (char*)old_t, sizeof(F_text)); bcopy((char*)&swp_t, (char*)new_t, sizeof(F_text)); /* but keep the next pointers unchanged */ swp_t.next = old_t->next; old_t->next = new_t->next; new_t->next = swp_t.next; set_action_object(F_EDIT, O_TXT); redisplay_texts(new_t, old_t); break; case O_SPLINE: new_s = saved_objects.splines; old_s = saved_objects.splines->next; /* account for depths */ remove_depth(O_SPLINE, old_s->depth); add_depth(O_SPLINE, new_s->depth); /* swap old with new */ bcopy((char*)old_s, (char*)&swp_s, sizeof(F_spline)); bcopy((char*)new_s, (char*)old_s, sizeof(F_spline)); bcopy((char*)&swp_s, (char*)new_s, sizeof(F_spline)); /* but keep the next pointers unchanged */ swp_s.next = old_s->next; old_s->next = new_s->next; new_s->next = swp_s.next; set_action_object(F_EDIT, O_SPLINE); redisplay_splines(new_s, old_s); break; case O_ARC: new_a = saved_objects.arcs; old_a = saved_objects.arcs->next; /* account for depths */ remove_depth(O_ARC, old_a->depth); add_depth(O_ARC, new_a->depth); /* swap old with new */ bcopy((char*)old_a, (char*)&swp_a, sizeof(F_arc)); bcopy((char*)new_a, (char*)old_a, sizeof(F_arc)); bcopy((char*)&swp_a, (char*)new_a, sizeof(F_arc)); /* but keep the next pointers unchanged */ swp_a.next = old_a->next; old_a->next = new_a->next; new_a->next = swp_a.next; set_action_object(F_EDIT, O_ARC); redisplay_arcs(new_a, old_a); break; case O_COMPOUND: new_c = saved_objects.compounds; old_c = saved_objects.compounds->next; /* account for depths */ remove_compound_depth(old_c); add_compound_depth(new_c); /* swap old with new */ bcopy((char*)old_c, (char*)&swp_c, sizeof(F_compound)); bcopy((char*)new_c, (char*)old_c, sizeof(F_compound)); bcopy((char*)&swp_c, (char*)new_c, sizeof(F_compound)); /* but keep the next pointers unchanged */ swp_c.next = old_c->next; old_c->next = new_c->next; new_c->next = swp_c.next; set_action_object(F_EDIT, O_COMPOUND); redisplay_compounds(new_c, old_c); break; case O_FIGURE: /* swap saved figure comments with current */ swp_comm = objects.comments; objects.comments = saved_objects.comments; saved_objects.comments = swp_comm; set_action_object(F_EDIT, O_FIGURE); break; case O_ALL_OBJECT: swp_c = objects; objects = saved_objects; saved_objects = swp_c; new_c = &objects; old_c = &saved_objects; /* account for depths */ remove_compound_depth(old_c); add_compound_depth(new_c); set_action_object(F_EDIT, O_ALL_OBJECT); set_modifiedflag(); redisplay_zoomed_region(0, 0, BACKX(CANVAS_WD), BACKY(CANVAS_HT)); break; } }