fix flip / rotation of ellipses (no absolute angles)
This commit is contained in:
parent
ce1d4b4bbb
commit
059badaccd
33
src/move.c
33
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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue