diff --git a/src/move.c b/src/move.c index 6b5ef201..fdfa2776 100644 --- a/src/move.c +++ b/src/move.c @@ -22,6 +22,36 @@ #include "xschem.h" + +void flip_rotate_ellipse(int c, int n, int rot, int flip) +{ + xRect *r = &xctx->rect[c][n]; + if(r->ellipse_a == -1) return; + else if(r->ellipse_b == 360) return; + else { + char str[100]; + if(flip) { + r->ellipse_a = 180 - r->ellipse_a - r->ellipse_b; + my_snprintf(str, S(str), "%d,%d", r->ellipse_a, r->ellipse_b); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ellipse", str)); + } + if(rot) { + if(rot == 3) { + r->ellipse_a += 90; + r->ellipse_a %= 360; + } else if(rot == 2) { + r->ellipse_a += 180; + r->ellipse_a %= 360; + } else if(rot == 1) { + r->ellipse_a += 270; + r->ellipse_a %= 360; + } + my_snprintf(str, S(str), "%d,%d", r->ellipse_a, r->ellipse_b); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ellipse", str)); + } + } +} + void rebuild_selected_array() /* can be used only if new selected set is lower */ /* that is, xctx->sel_array[] size can not increase */ { @@ -745,6 +775,7 @@ void copy_objects(int what) storeobject(-1, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay, xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay,xRECT, c, SELECTED, xctx->rect[c][n].prop_ptr); l = xctx->rects[c] - 1; + flip_rotate_ellipse(c, l, xctx->move_rot, xctx->move_flip); break; case xTEXT: @@ -1164,6 +1195,8 @@ void move_objects(int what, int merge, double dx, double dy) xctx->rect[c][n].x2, xctx->rect[c][n].y2, xctx->rx2,xctx->ry2); } + flip_rotate_ellipse(c, n, xctx->move_rot, xctx->move_flip); + if( xctx->rect[c][n].sel == SELECTED) { xctx->rx1+=xctx->deltax; xctx->ry1+=xctx->deltay; diff --git a/src/xschem.h b/src/xschem.h index 6e3bbfd7..3ffbc848 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -1535,6 +1535,7 @@ extern void select_rect(int what, int select); extern void new_rect(int what, double mousex_snap, double mousey_snap); extern void new_polygon(int what, double mousex_snap, double mousey_snap); extern void compile_font(void); +extern void flip_rotate_ellipse(int c, int n, int rot, int flip); extern void rebuild_selected_array(void); extern int get_instance(const char *s);