more state variables into xctx: move / create new objects
This commit is contained in:
parent
e7e5ad190b
commit
4d26ce66a8
|
|
@ -86,7 +86,7 @@ int find_script_fungw_user_call_ctx(const char *name, int logdepth, int fatal)
|
|||
int find_script_fungw_cfg_pupdir(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *lf, *cf, *inc;
|
||||
char * out;
|
||||
char * out;
|
||||
char *test_c =
|
||||
NL "#include <libfungw/fungw.h>"
|
||||
NL "int main() {"
|
||||
|
|
|
|||
813
src/actions.c
813
src/actions.c
|
|
@ -1414,48 +1414,45 @@ void view_unzoom(double z)
|
|||
|
||||
void zoom_box(int what)
|
||||
{
|
||||
static double x1,y1,x2,y2;
|
||||
static double xx1,yy1,xx2,yy2;
|
||||
|
||||
if( (what & START) )
|
||||
{
|
||||
x1=x2=xctx->mousex_snap;y1=y2=xctx->mousey_snap;
|
||||
xctx->nl_x1=xctx->nl_x2=xctx->mousex_snap;xctx->nl_y1=xctx->nl_y2=xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTZOOM;
|
||||
}
|
||||
if( what & END)
|
||||
{
|
||||
xctx->ui_state &= ~STARTZOOM;
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
drawtemprect(xctx->gctiled, NOW, xx1,yy1,xx2,yy2);
|
||||
xctx->xorigin=-x1;xctx->yorigin=-y1;
|
||||
xctx->zoom=(x2-x1)/(xctx->areaw-4*INT_WIDTH(xctx->lw));
|
||||
yy1=(y2-y1)/(xctx->areah-4*INT_WIDTH(xctx->lw));
|
||||
if(yy1>xctx->zoom) xctx->zoom=yy1;
|
||||
RECTORDER(xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2);
|
||||
drawtemprect(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
xctx->xorigin=-xctx->nl_x1;xctx->yorigin=-xctx->nl_y1;
|
||||
xctx->zoom=(xctx->nl_x2-xctx->nl_x1)/(xctx->areaw-4*INT_WIDTH(xctx->lw));
|
||||
xctx->nl_yy1=(xctx->nl_y2-xctx->nl_y1)/(xctx->areah-4*INT_WIDTH(xctx->lw));
|
||||
if(xctx->nl_yy1>xctx->zoom) xctx->zoom=xctx->nl_yy1;
|
||||
xctx->mooz=1/xctx->zoom;
|
||||
change_linewidth(-1.);
|
||||
draw();
|
||||
dbg(1, "zoom_box(): coord: %.16g %.16g %.16g %.16g zoom=%.16g\n",
|
||||
x1,y1,xctx->mousex_snap, xctx->mousey_snap,xctx->zoom);
|
||||
xctx->nl_x1,xctx->nl_y1,xctx->mousex_snap, xctx->mousey_snap,xctx->zoom);
|
||||
}
|
||||
if(what & RUBBER)
|
||||
{
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
RECTORDER(xx1,yy1,xx2,yy2);
|
||||
drawtemprect(xctx->gctiled,NOW, xx1,yy1,xx2,yy2);
|
||||
x2=xctx->mousex_snap;y2=xctx->mousey_snap;
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
RECTORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtemprect(xctx->gctiled,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
xctx->nl_x2=xctx->mousex_snap;xctx->nl_y2=xctx->mousey_snap;
|
||||
|
||||
|
||||
/* 20171211 update selected objects while dragging */
|
||||
rebuild_selected_array();
|
||||
bbox(START,0.0, 0.0, 0.0, 0.0);
|
||||
bbox(ADD, xx1, yy1, xx2, yy2);
|
||||
bbox(ADD, xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2);
|
||||
bbox(SET,0.0, 0.0, 0.0, 0.0);
|
||||
draw_selection(gc[SELLAYER], 0);
|
||||
bbox(END,0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
RECTORDER(xx1,yy1,xx2,yy2);
|
||||
drawtemprect(gc[SELLAYER], NOW, xx1,yy1,xx2,yy2);
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
RECTORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtemprect(gc[SELLAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1546,145 +1543,162 @@ void restore_selection(double x1, double y1, double x2, double y2)
|
|||
|
||||
void new_wire(int what, double mx_snap, double my_snap)
|
||||
{
|
||||
static double x1,y1,x2,y2;
|
||||
static double xx1,yy1,xx2,yy2;
|
||||
if( (what & PLACE) ) {
|
||||
if( (xctx->ui_state & STARTWIRE) && (xctx->nl_x1!=xctx->nl_x2 || xctx->nl_y1!=xctx->nl_y2) ) {
|
||||
push_undo();
|
||||
if(manhattan_lines==1) {
|
||||
if(xctx->nl_xx2!=xctx->nl_xx1) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1,WIRE,0,0,NULL);
|
||||
drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1, 0);
|
||||
}
|
||||
if(xctx->nl_yy2!=xctx->nl_yy1) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2,WIRE,0,0,NULL);
|
||||
drawline(WIRELAYER,NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0);
|
||||
}
|
||||
} else if(manhattan_lines==2) {
|
||||
if(xctx->nl_yy2!=xctx->nl_yy1) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2,WIRE,0,0,NULL);
|
||||
drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2, 0);
|
||||
}
|
||||
if(xctx->nl_xx2!=xctx->nl_xx1) {
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;
|
||||
xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2,WIRE,0,0,NULL);
|
||||
drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2, 0);
|
||||
}
|
||||
} else {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2,WIRE,0,0,NULL);
|
||||
drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0);
|
||||
}
|
||||
hash_wire(XINSERT, xctx->wires-1, 1);
|
||||
/* xctx->prep_hash_wires = 0; */
|
||||
xctx->prep_hi_structs = 0;
|
||||
|
||||
if( (what & PLACE) ) {
|
||||
if( (xctx->ui_state & STARTWIRE) && (x1!=x2 || y1!=y2) ) {
|
||||
push_undo();
|
||||
if(manhattan_lines==1) {
|
||||
if(xx2!=xx1) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy1);
|
||||
storeobject(-1, xx1,yy1,xx2,yy1,WIRE,0,0,NULL);
|
||||
drawline(WIRELAYER,NOW, xx1,yy1,xx2,yy1, 0);
|
||||
}
|
||||
if(yy2!=yy1) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx2,yy1,xx2,yy2);
|
||||
storeobject(-1, xx2,yy1,xx2,yy2,WIRE,0,0,NULL);
|
||||
drawline(WIRELAYER,NOW, xx2,yy1,xx2,yy2, 0);
|
||||
}
|
||||
} else if(manhattan_lines==2) {
|
||||
if(yy2!=yy1) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx1,yy2);
|
||||
storeobject(-1, xx1,yy1,xx1,yy2,WIRE,0,0,NULL);
|
||||
drawline(WIRELAYER,NOW, xx1,yy1,xx1,yy2, 0);
|
||||
}
|
||||
if(xx2!=xx1) {
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
ORDER(xx1,yy2,xx2,yy2);
|
||||
storeobject(-1, xx1,yy2,xx2,yy2,WIRE,0,0,NULL);
|
||||
drawline(WIRELAYER,NOW, xx1,yy2,xx2,yy2, 0);
|
||||
}
|
||||
} else {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
storeobject(-1, xx1,yy1,xx2,yy2,WIRE,0,0,NULL);
|
||||
drawline(WIRELAYER,NOW, xx1,yy1,xx2,yy2, 0);
|
||||
}
|
||||
hash_wire(XINSERT, xctx->wires-1, 1);
|
||||
/* xctx->prep_hash_wires = 0; */
|
||||
xctx->prep_hi_structs = 0;
|
||||
|
||||
update_conn_cues(1,1);
|
||||
if(show_pin_net_names) {
|
||||
prepare_netlist_structs(0);
|
||||
bbox(START , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
find_inst_to_be_redrawn(xctx->wire[xctx->wires-1].node);
|
||||
find_inst_hash_clear();
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
}
|
||||
draw_hilight_net(1);/* for updating connection bubbles on hilight nets */
|
||||
}
|
||||
if(! (what &END)) {
|
||||
x1=mx_snap;
|
||||
y1=my_snap;
|
||||
x2=xctx->mousex_snap;
|
||||
y2=xctx->mousey_snap;
|
||||
xx1=x1;
|
||||
yy1=y1;
|
||||
xx2=xctx->mousex_snap;
|
||||
yy2=xctx->mousey_snap;
|
||||
if(manhattan_lines==1) {
|
||||
x2 = mx_snap; y2 = my_snap;
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy1);
|
||||
drawtempline(gc[WIRELAYER], NOW, xx1,yy1,xx2,yy1);
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx2,yy1,xx2,yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xx2,yy1,xx2,yy2);
|
||||
} else if(manhattan_lines==2) {
|
||||
x2 = mx_snap; y2 = my_snap;
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx1,yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xx1,yy1,xx1,yy2);
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy2,xx2,yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xx1,yy2,xx2,yy2);
|
||||
} else {
|
||||
x2 = mx_snap; y2 = my_snap;
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xx1,yy1,xx2,yy2);
|
||||
}
|
||||
}
|
||||
xctx->ui_state |= STARTWIRE;
|
||||
}
|
||||
if( what & END) {
|
||||
xctx->ui_state &= ~STARTWIRE;
|
||||
}
|
||||
if( (what & RUBBER) ) {
|
||||
if(manhattan_lines==1) {
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
ORDER(xx1,yy1,xx2,yy1);
|
||||
drawtempline(xctx->gctiled, NOW, xx1,yy1,xx2,yy1);
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
ORDER(xx2,yy1,xx2,yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xx2,yy1,xx2,yy2);
|
||||
restore_selection(x1, y1, x2, y2);
|
||||
x2 = mx_snap; y2 = my_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy1);
|
||||
drawtempline(gc[WIRELAYER], NOW, xx1,yy1,xx2,yy1);
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx2,yy1,xx2,yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xx2,yy1,xx2,yy2);
|
||||
}
|
||||
} else if(manhattan_lines==2) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx1,yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xx1,yy1,xx1,yy2);
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy2,xx2,yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xx1,yy2,xx2,yy2);
|
||||
restore_selection(x1, y1, x2, y2);
|
||||
x2 = mx_snap; y2 = my_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx1,yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xx1,yy1,xx1,yy2);
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy2,xx2,yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xx1,yy2,xx2,yy2);
|
||||
}
|
||||
} else {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xx1,yy1,xx2,yy2);
|
||||
restore_selection(x1, y1, x2, y2);
|
||||
x2 = mx_snap; y2 = my_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xx1,yy1,xx2,yy2);
|
||||
}
|
||||
}
|
||||
}
|
||||
update_conn_cues(1,1);
|
||||
if(show_pin_net_names) {
|
||||
prepare_netlist_structs(0);
|
||||
bbox(START , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
find_inst_to_be_redrawn(xctx->wire[xctx->wires-1].node);
|
||||
find_inst_hash_clear();
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
}
|
||||
draw_hilight_net(1);/* for updating connection bubbles on hilight nets */
|
||||
}
|
||||
if(! (what &END)) {
|
||||
xctx->nl_x1=mx_snap;
|
||||
xctx->nl_y1=my_snap;
|
||||
xctx->nl_x2=xctx->mousex_snap;
|
||||
xctx->nl_y2=xctx->mousey_snap;
|
||||
xctx->nl_xx1=xctx->nl_x1;
|
||||
xctx->nl_yy1=xctx->nl_y1;
|
||||
xctx->nl_xx2=xctx->mousex_snap;
|
||||
xctx->nl_yy2=xctx->mousey_snap;
|
||||
if(manhattan_lines==1) {
|
||||
xctx->nl_x2 = mx_snap; xctx->nl_y2 = my_snap;
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
drawtempline(gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
} else if(manhattan_lines==2) {
|
||||
xctx->nl_x2 = mx_snap; xctx->nl_y2 = my_snap;
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
} else {
|
||||
xctx->nl_x2 = mx_snap; xctx->nl_y2 = my_snap;
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
}
|
||||
xctx->ui_state |= STARTWIRE;
|
||||
}
|
||||
if( what & END) {
|
||||
xctx->ui_state &= ~STARTWIRE;
|
||||
}
|
||||
if( (what & RUBBER) ) {
|
||||
if(manhattan_lines==1) {
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;
|
||||
xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;
|
||||
xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
restore_selection(xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2);
|
||||
xctx->nl_x2 = mx_snap; xctx->nl_y2 = my_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
drawtempline(gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
} else if(manhattan_lines==2) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
restore_selection(xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2);
|
||||
xctx->nl_x2 = mx_snap; xctx->nl_y2 = my_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
} else {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
restore_selection(xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2);
|
||||
xctx->nl_x2 = mx_snap; xctx->nl_y2 = my_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void change_layer()
|
||||
|
|
@ -1732,221 +1746,226 @@ void change_layer()
|
|||
|
||||
void new_arc(int what, double sweep)
|
||||
{
|
||||
static double x, y, r, a, b;
|
||||
static double x1, y1, x2, y2, x3, y3;
|
||||
static double xx1, yy1, xx2, yy2;
|
||||
static int state;
|
||||
static double sweep_angle;
|
||||
if(what & PLACE) {
|
||||
state=0;
|
||||
r = -1.;
|
||||
sweep_angle=sweep;
|
||||
xx1 = xx2 = x1 = x2 = x3 = xctx->mousex_snap;
|
||||
yy1 = yy2 = y1 = y2 = y3 = xctx->mousey_snap;
|
||||
xctx->nl_state=0;
|
||||
xctx->nl_r = -1.;
|
||||
xctx->nl_sweep_angle=sweep;
|
||||
xctx->nl_xx1 = xctx->nl_xx2 = xctx->nl_x1 = xctx->nl_x2 = xctx->nl_x3 = xctx->mousex_snap;
|
||||
xctx->nl_yy1 = xctx->nl_yy2 = xctx->nl_y1 = xctx->nl_y2 = xctx->nl_y3 = xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTARC;
|
||||
}
|
||||
if(what & SET) {
|
||||
if(state==0) {
|
||||
x2 = xctx->mousex_snap;
|
||||
y2 = xctx->mousey_snap;
|
||||
drawtempline(xctx->gctiled, NOW, xx1,yy1,xx2,yy2);
|
||||
state=1;
|
||||
} else if(state==1) {
|
||||
x3 = xctx->mousex_snap;
|
||||
y3 = xctx->mousey_snap;
|
||||
arc_3_points(x1, y1, x2, y2, x3, y3, &x, &y, &r, &a, &b);
|
||||
if(sweep_angle==360.) b=360.;
|
||||
if(r>0.) {
|
||||
if(xctx->nl_state==0) {
|
||||
xctx->nl_x2 = xctx->mousex_snap;
|
||||
xctx->nl_y2 = xctx->mousey_snap;
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
xctx->nl_state=1;
|
||||
} else if(xctx->nl_state==1) {
|
||||
xctx->nl_x3 = xctx->mousex_snap;
|
||||
xctx->nl_y3 = xctx->mousey_snap;
|
||||
arc_3_points(xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2,
|
||||
xctx->nl_x3, xctx->nl_y3, &xctx->nl_x, &xctx->nl_y, &xctx->nl_r, &xctx->nl_a, &xctx->nl_b);
|
||||
if(xctx->nl_sweep_angle==360.) xctx->nl_b=360.;
|
||||
if(xctx->nl_r>0.) {
|
||||
push_undo();
|
||||
drawarc(rectcolor, NOW, x, y, r, a, b, 0, 0);
|
||||
store_arc(-1, x, y, r, a, b, rectcolor, 0, NULL);
|
||||
drawarc(rectcolor, NOW, xctx->nl_x, xctx->nl_y, xctx->nl_r, xctx->nl_a, xctx->nl_b, 0, 0);
|
||||
store_arc(-1, xctx->nl_x, xctx->nl_y, xctx->nl_r, xctx->nl_a, xctx->nl_b, rectcolor, 0, NULL);
|
||||
}
|
||||
xctx->ui_state &= ~STARTARC;
|
||||
state=0;
|
||||
xctx->nl_state=0;
|
||||
}
|
||||
}
|
||||
if(what & RUBBER) {
|
||||
if(state==0) {
|
||||
drawtempline(xctx->gctiled, NOW, xx1,yy1,xx2,yy2);
|
||||
xx2 = xctx->mousex_snap;
|
||||
yy2 = xctx->mousey_snap;
|
||||
xx1 = x1;yy1 = y1;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
drawtempline(gc[SELLAYER], NOW, xx1,yy1,xx2,yy2);
|
||||
if(xctx->nl_state==0) {
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
xctx->nl_xx2 = xctx->mousex_snap;
|
||||
xctx->nl_yy2 = xctx->mousey_snap;
|
||||
xctx->nl_xx1 = xctx->nl_x1;xctx->nl_yy1 = xctx->nl_y1;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc[SELLAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
else if(state==1) {
|
||||
x3 = xctx->mousex_snap;
|
||||
y3 = xctx->mousey_snap;
|
||||
if(r>0.) drawtemparc(xctx->gctiled, NOW, x, y, r, a, b);
|
||||
arc_3_points(x1, y1, x2, y2, x3, y3, &x, &y, &r, &a, &b);
|
||||
if(sweep_angle==360.) b=360.;
|
||||
if(r>0.) drawtemparc(gc[rectcolor], NOW, x, y, r, a, b);
|
||||
else if(xctx->nl_state==1) {
|
||||
xctx->nl_x3 = xctx->mousex_snap;
|
||||
xctx->nl_y3 = xctx->mousey_snap;
|
||||
if(xctx->nl_r>0.) drawtemparc(xctx->gctiled, NOW, xctx->nl_x, xctx->nl_y, xctx->nl_r, xctx->nl_a, xctx->nl_b);
|
||||
arc_3_points(xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2,
|
||||
xctx->nl_x3, xctx->nl_y3, &xctx->nl_x, &xctx->nl_y, &xctx->nl_r, &xctx->nl_a, &xctx->nl_b);
|
||||
if(xctx->nl_sweep_angle==360.) xctx->nl_b=360.;
|
||||
if(xctx->nl_r>0.) drawtemparc(gc[rectcolor], NOW, xctx->nl_x, xctx->nl_y, xctx->nl_r, xctx->nl_a, xctx->nl_b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void new_line(int what)
|
||||
{
|
||||
static double x1,y1,x2,y2;
|
||||
static double xx1,yy1,xx2,yy2;
|
||||
if( (what & PLACE) )
|
||||
{
|
||||
if( (xctx->nl_x1!=xctx->nl_x2 || xctx->nl_y1!=xctx->nl_y2) && (xctx->ui_state & STARTLINE) )
|
||||
{
|
||||
push_undo();
|
||||
if(manhattan_lines==1) {
|
||||
if(xctx->nl_xx2!=xctx->nl_xx1) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1,LINE,rectcolor,0,NULL);
|
||||
drawline(rectcolor,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1, 0);
|
||||
}
|
||||
if(xctx->nl_yy2!=xctx->nl_yy1) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2,LINE,rectcolor,0,NULL);
|
||||
drawline(rectcolor,NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0);
|
||||
}
|
||||
} else if(manhattan_lines==2) {
|
||||
if(xctx->nl_yy2!=xctx->nl_yy1) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2,LINE,rectcolor,0,NULL);
|
||||
drawline(rectcolor,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2, 0);
|
||||
}
|
||||
if(xctx->nl_xx2!=xctx->nl_xx1) {
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;
|
||||
xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2,LINE,rectcolor,0,NULL);
|
||||
drawline(rectcolor,NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2, 0);
|
||||
}
|
||||
} else {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2,LINE,rectcolor,0,NULL);
|
||||
drawline(rectcolor,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0);
|
||||
}
|
||||
}
|
||||
xctx->nl_x1=xctx->nl_x2=xctx->mousex_snap;xctx->nl_y1=xctx->nl_y2=xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTLINE;
|
||||
}
|
||||
if( what & END)
|
||||
{
|
||||
xctx->ui_state &= ~STARTLINE;
|
||||
}
|
||||
|
||||
if( (what & PLACE) )
|
||||
{
|
||||
if( (x1!=x2 || y1!=y2) && (xctx->ui_state & STARTLINE) )
|
||||
{
|
||||
push_undo();
|
||||
if(manhattan_lines==1) {
|
||||
if(xx2!=xx1) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy1);
|
||||
storeobject(-1, xx1,yy1,xx2,yy1,LINE,rectcolor,0,NULL);
|
||||
drawline(rectcolor,NOW, xx1,yy1,xx2,yy1, 0);
|
||||
}
|
||||
if(yy2!=yy1) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx2,yy1,xx2,yy2);
|
||||
storeobject(-1, xx2,yy1,xx2,yy2,LINE,rectcolor,0,NULL);
|
||||
drawline(rectcolor,NOW, xx2,yy1,xx2,yy2, 0);
|
||||
}
|
||||
} else if(manhattan_lines==2) {
|
||||
if(yy2!=yy1) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx1,yy2);
|
||||
storeobject(-1, xx1,yy1,xx1,yy2,LINE,rectcolor,0,NULL);
|
||||
drawline(rectcolor,NOW, xx1,yy1,xx1,yy2, 0);
|
||||
}
|
||||
if(xx2!=xx1) {
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
ORDER(xx1,yy2,xx2,yy2);
|
||||
storeobject(-1, xx1,yy2,xx2,yy2,LINE,rectcolor,0,NULL);
|
||||
drawline(rectcolor,NOW, xx1,yy2,xx2,yy2, 0);
|
||||
}
|
||||
} else {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
storeobject(-1, xx1,yy1,xx2,yy2,LINE,rectcolor,0,NULL);
|
||||
drawline(rectcolor,NOW, xx1,yy1,xx2,yy2, 0);
|
||||
}
|
||||
}
|
||||
x1=x2=xctx->mousex_snap;y1=y2=xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTLINE;
|
||||
}
|
||||
if( what & END)
|
||||
{
|
||||
xctx->ui_state &= ~STARTLINE;
|
||||
}
|
||||
|
||||
if(what & RUBBER)
|
||||
{
|
||||
if(manhattan_lines==1) {
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
ORDER(xx1,yy1,xx2,yy1);
|
||||
drawtempline(xctx->gctiled, NOW, xx1,yy1,xx2,yy1);
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
ORDER(xx2,yy1,xx2,yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xx2,yy1,xx2,yy2);
|
||||
restore_selection(x1, y1, x2, y2);
|
||||
x2 = xctx->mousex_snap; y2 = xctx->mousey_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy1);
|
||||
drawtempline(gc[rectcolor], NOW, xx1,yy1,xx2,yy1);
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx2,yy1,xx2,yy2);
|
||||
drawtempline(gc[rectcolor], NOW, xx2,yy1,xx2,yy2);
|
||||
}
|
||||
} else if(manhattan_lines==2) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx1,yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xx1,yy1,xx1,yy2);
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy2,xx2,yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xx1,yy2,xx2,yy2);
|
||||
restore_selection(x1, y1, x2, y2);
|
||||
x2 = xctx->mousex_snap; y2 = xctx->mousey_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx1,yy2);
|
||||
drawtempline(gc[rectcolor], NOW, xx1,yy1,xx1,yy2);
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy2,xx2,yy2);
|
||||
drawtempline(gc[rectcolor], NOW, xx1,yy2,xx2,yy2);
|
||||
}
|
||||
} else {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xx1,yy1,xx2,yy2);
|
||||
restore_selection(x1, y1, x2, y2);
|
||||
x2 = xctx->mousex_snap; y2 = xctx->mousey_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
drawtempline(gc[rectcolor], NOW, xx1,yy1,xx2,yy2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(what & RUBBER)
|
||||
{
|
||||
if(manhattan_lines==1) {
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;
|
||||
xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;
|
||||
xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
restore_selection(xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2);
|
||||
xctx->nl_x2 = xctx->mousex_snap; xctx->nl_y2 = xctx->mousey_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
drawtempline(gc[rectcolor], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc[rectcolor], NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
} else if(manhattan_lines==2) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
restore_selection(xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2);
|
||||
xctx->nl_x2 = xctx->mousex_snap; xctx->nl_y2 = xctx->mousey_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
drawtempline(gc[rectcolor], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc[rectcolor], NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
} else {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
restore_selection(xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2);
|
||||
xctx->nl_x2 = xctx->mousex_snap; xctx->nl_y2 = xctx->mousey_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc[rectcolor], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void new_rect(int what)
|
||||
{
|
||||
static double x1,y1,x2,y2;
|
||||
static double xx1,yy1,xx2,yy2;
|
||||
|
||||
if( (what & PLACE) )
|
||||
if( (what & PLACE) )
|
||||
{
|
||||
if( (xctx->nl_x1!=xctx->nl_x2 || xctx->nl_y1!=xctx->nl_y2) && (xctx->ui_state & STARTRECT) )
|
||||
{
|
||||
if( (x1!=x2 || y1!=y2) && (xctx->ui_state & STARTRECT) )
|
||||
{
|
||||
int save_draw;
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
push_undo();
|
||||
drawrect(rectcolor, NOW, x1,y1,x2,y2, 0);
|
||||
save_draw = draw_window;
|
||||
draw_window = 1;
|
||||
filledrect(rectcolor, NOW, x1,y1,x2,y2); /* draw fill pattern even in XCopyArea mode */
|
||||
draw_window = save_draw;
|
||||
storeobject(-1, x1,y1,x2,y2,xRECT,rectcolor, 0, NULL);
|
||||
}
|
||||
x1=x2=xctx->mousex_snap;y1=y2=xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTRECT;
|
||||
}
|
||||
if( what & END)
|
||||
{
|
||||
xctx->ui_state &= ~STARTRECT;
|
||||
}
|
||||
if(what & RUBBER)
|
||||
{
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
RECTORDER(xx1,yy1,xx2,yy2);
|
||||
drawtemprect(xctx->gctiled,NOW, xx1,yy1,xx2,yy2);
|
||||
x2=xctx->mousex_snap;y2=xctx->mousey_snap;
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
RECTORDER(xx1,yy1,xx2,yy2);
|
||||
drawtemprect(gc[rectcolor], NOW, xx1,yy1,xx2,yy2);
|
||||
int save_draw;
|
||||
RECTORDER(xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2);
|
||||
push_undo();
|
||||
drawrect(rectcolor, NOW, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2, 0);
|
||||
save_draw = draw_window;
|
||||
draw_window = 1;
|
||||
/* draw fill pattern even in XCopyArea mode */
|
||||
filledrect(rectcolor, NOW, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2);
|
||||
draw_window = save_draw;
|
||||
storeobject(-1, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2,xRECT,rectcolor, 0, NULL);
|
||||
}
|
||||
xctx->nl_x1=xctx->nl_x2=xctx->mousex_snap;xctx->nl_y1=xctx->nl_y2=xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTRECT;
|
||||
}
|
||||
if( what & END)
|
||||
{
|
||||
xctx->ui_state &= ~STARTRECT;
|
||||
}
|
||||
if(what & RUBBER)
|
||||
{
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
RECTORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtemprect(xctx->gctiled,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
xctx->nl_x2=xctx->mousex_snap;xctx->nl_y2=xctx->mousey_snap;
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
RECTORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtemprect(gc[rectcolor], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void new_polygon(int what)
|
||||
{
|
||||
static double *x=NULL, *y=NULL;
|
||||
static int points=0;
|
||||
static int maxpoints=0;
|
||||
if( what & PLACE ) xctx->nl_points=0; /* start new polygon placement */
|
||||
|
||||
if( what & PLACE ) points=0; /* start new polygon placement */
|
||||
|
||||
if(points >= maxpoints-1) { /* check storage for 2 points */
|
||||
maxpoints = (1+points / CADCHUNKALLOC) * CADCHUNKALLOC;
|
||||
my_realloc(17, &x, sizeof(double)*maxpoints);
|
||||
my_realloc(18, &y, sizeof(double)*maxpoints);
|
||||
if(xctx->nl_points >= xctx->nl_maxpoints-1) { /* check storage for 2 xctx->nl_points */
|
||||
xctx->nl_maxpoints = (1+xctx->nl_points / CADCHUNKALLOC) * CADCHUNKALLOC;
|
||||
my_realloc(17, &xctx->nl_polyx, sizeof(double)*xctx->nl_maxpoints);
|
||||
my_realloc(18, &xctx->nl_polyy, sizeof(double)*xctx->nl_maxpoints);
|
||||
}
|
||||
if( what & PLACE )
|
||||
{
|
||||
/* fprintf(errfp, "new_poly: PLACE, points=%d\n", points); */
|
||||
y[points]=xctx->mousey_snap;
|
||||
x[points]=xctx->mousex_snap;
|
||||
points++;
|
||||
x[points]=x[points-1]; /* prepare next point for rubber */
|
||||
y[points] = y[points-1];
|
||||
/* fprintf(errfp, "added point: %.16g %.16g\n", x[points-1], y[points-1]); */
|
||||
/* fprintf(errfp, "new_poly: PLACE, xctx->nl_points=%d\n", xctx->nl_points); */
|
||||
xctx->nl_polyy[xctx->nl_points]=xctx->mousey_snap;
|
||||
xctx->nl_polyx[xctx->nl_points]=xctx->mousex_snap;
|
||||
xctx->nl_points++;
|
||||
xctx->nl_polyx[xctx->nl_points]=xctx->nl_polyx[xctx->nl_points-1]; /* prepare next point for rubber */
|
||||
xctx->nl_polyy[xctx->nl_points] = xctx->nl_polyy[xctx->nl_points-1];
|
||||
/* fprintf(errfp, "added point: %.16g %.16g\n", xctx->nl_polyx[xctx->nl_points-1],
|
||||
xctx->nl_polyy[xctx->nl_points-1]); */
|
||||
xctx->ui_state |= STARTPOLYGON;
|
||||
}
|
||||
if( what & ADD)
|
||||
|
|
@ -1954,42 +1973,45 @@ void new_polygon(int what)
|
|||
/* closed poly */
|
||||
if(what & END) {
|
||||
/* delete last rubber */
|
||||
drawtemppolygon(xctx->gctiled, NOW, x, y, points+1);
|
||||
x[points] = x[0];
|
||||
y[points] = y[0];
|
||||
drawtemppolygon(xctx->gctiled, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1);
|
||||
xctx->nl_polyx[xctx->nl_points] = xctx->nl_polyx[0];
|
||||
xctx->nl_polyy[xctx->nl_points] = xctx->nl_polyy[0];
|
||||
/* add point */
|
||||
} else if(x[points] != x[points-1] || y[points] != y[points-1]) {
|
||||
x[points] = xctx->mousex_snap;
|
||||
y[points] = xctx->mousey_snap;
|
||||
} else if(xctx->nl_polyx[xctx->nl_points] != xctx->nl_polyx[xctx->nl_points-1] ||
|
||||
xctx->nl_polyy[xctx->nl_points] != xctx->nl_polyy[xctx->nl_points-1]) {
|
||||
xctx->nl_polyx[xctx->nl_points] = xctx->mousex_snap;
|
||||
xctx->nl_polyy[xctx->nl_points] = xctx->mousey_snap;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
points++;
|
||||
xctx->nl_points++;
|
||||
/* prepare next point for rubber */
|
||||
x[points]=x[points-1];y[points]=y[points-1];
|
||||
xctx->nl_polyx[xctx->nl_points]=xctx->nl_polyx[xctx->nl_points-1];
|
||||
xctx->nl_polyy[xctx->nl_points]=xctx->nl_polyy[xctx->nl_points-1];
|
||||
}
|
||||
/* end open or closed poly by user request */
|
||||
if((what & SET || (what & END)) ||
|
||||
/* closed poly end by clicking on first point */
|
||||
((what & ADD) && x[points-1] == x[0] && y[points-1] == y[0]) ) {
|
||||
((what & ADD) && xctx->nl_polyx[xctx->nl_points-1] == xctx->nl_polyx[0] &&
|
||||
xctx->nl_polyy[xctx->nl_points-1] == xctx->nl_polyy[0]) ) {
|
||||
push_undo();
|
||||
drawtemppolygon(xctx->gctiled, NOW, x, y, points+1);
|
||||
store_poly(-1, x, y, points, rectcolor, 0, NULL);
|
||||
/* fprintf(errfp, "new_poly: finish: points=%d\n", points); */
|
||||
drawtemppolygon(gc[rectcolor], NOW, x, y, points);
|
||||
drawtemppolygon(xctx->gctiled, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1);
|
||||
store_poly(-1, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, rectcolor, 0, NULL);
|
||||
/* fprintf(errfp, "new_poly: finish: xctx->nl_points=%d\n", xctx->nl_points); */
|
||||
drawtemppolygon(gc[rectcolor], NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points);
|
||||
xctx->ui_state &= ~STARTPOLYGON;
|
||||
drawpolygon(rectcolor, NOW, x, y, points, 0, 0);
|
||||
my_free(711, &x);
|
||||
my_free(712, &y);
|
||||
maxpoints = points = 0;
|
||||
drawpolygon(rectcolor, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, 0, 0);
|
||||
my_free(711, &xctx->nl_polyx);
|
||||
my_free(712, &xctx->nl_polyy);
|
||||
xctx->nl_maxpoints = xctx->nl_points = 0;
|
||||
}
|
||||
if(what & RUBBER)
|
||||
{
|
||||
/* fprintf(errfp, "new_poly: RUBBER\n"); */
|
||||
drawtemppolygon(xctx->gctiled, NOW, x, y, points+1);
|
||||
y[points] = xctx->mousey_snap;
|
||||
x[points] = xctx->mousex_snap;
|
||||
drawtemppolygon(gc[rectcolor], NOW, x, y, points+1);
|
||||
drawtemppolygon(xctx->gctiled, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1);
|
||||
xctx->nl_polyy[xctx->nl_points] = xctx->mousey_snap;
|
||||
xctx->nl_polyx[xctx->nl_points] = xctx->mousex_snap;
|
||||
drawtemppolygon(gc[rectcolor], NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2232,26 +2254,26 @@ void place_text(int draw_text, double mx, double my)
|
|||
void pan2(int what, int mx, int my)
|
||||
{
|
||||
int dx, dy, ddx, ddy;
|
||||
static int mx_save, my_save;
|
||||
static int mmx_save, mmy_save;
|
||||
static int mx_s, my_s;
|
||||
static int mmx_s, mmy_s;
|
||||
static double xorig_save, yorig_save;
|
||||
if(what & START) {
|
||||
mmx_save = mx_save = mx;
|
||||
mmy_save = my_save = my;
|
||||
mmx_s = mx_s = mx;
|
||||
mmy_s = my_s = my;
|
||||
xorig_save = xctx->xorigin;
|
||||
yorig_save = xctx->yorigin;
|
||||
}
|
||||
else if(what == RUBBER) {
|
||||
dx = mx - mx_save;
|
||||
dy = my - my_save;
|
||||
ddx = abs(mx -mmx_save);
|
||||
ddy = abs(my -mmy_save);
|
||||
dx = mx - mx_s;
|
||||
dy = my - my_s;
|
||||
ddx = abs(mx -mmx_s);
|
||||
ddy = abs(my -mmy_s);
|
||||
if(ddx>5 || ddy>5) {
|
||||
xctx->xorigin = xorig_save + dx*xctx->zoom;
|
||||
xctx->yorigin = yorig_save + dy*xctx->zoom;
|
||||
draw();
|
||||
mmx_save = mx;
|
||||
mmy_save = my;
|
||||
mmx_s = mx;
|
||||
mmy_s = my;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2286,72 +2308,67 @@ void pan(int what)
|
|||
/* 20150927 select=1: select objects, select=0: unselect objects */
|
||||
void select_rect(int what, int select)
|
||||
{
|
||||
static double xr,yr,xr2,yr2;
|
||||
static double xx1,xx2,yy1,yy2;
|
||||
static int sel;
|
||||
static int sem=0;
|
||||
|
||||
if(what & RUBBER)
|
||||
{
|
||||
if(sem==0) {
|
||||
if(xctx->nl_sem==0) {
|
||||
fprintf(errfp, "ERROR: select_rect() RUBBER called before START\n");
|
||||
tcleval("alert_ {ERROR: select_rect() RUBBER called before START} {}");
|
||||
}
|
||||
xx1=xr;xx2=xr2;yy1=yr;yy2=yr2;
|
||||
RECTORDER(xx1,yy1,xx2,yy2);
|
||||
drawtemprect(xctx->gctiled,NOW, xx1,yy1,xx2,yy2);
|
||||
xr2=xctx->mousex_snap;yr2=xctx->mousey_snap;
|
||||
xctx->nl_xx1=xctx->nl_xr;xctx->nl_xx2=xctx->nl_xr2;xctx->nl_yy1=xctx->nl_yr;xctx->nl_yy2=xctx->nl_yr2;
|
||||
RECTORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtemprect(xctx->gctiled,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
xctx->nl_xr2=xctx->mousex_snap;xctx->nl_yr2=xctx->mousey_snap;
|
||||
|
||||
/* 20171026 update unselected objects while dragging */
|
||||
rebuild_selected_array();
|
||||
bbox(START,0.0, 0.0, 0.0, 0.0);
|
||||
bbox(ADD, xx1, yy1, xx2, yy2);
|
||||
bbox(ADD, xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2);
|
||||
bbox(SET,0.0, 0.0, 0.0, 0.0);
|
||||
draw_selection(gc[SELLAYER], 0);
|
||||
if(!sel) select_inside(xx1, yy1, xx2, yy2, sel);
|
||||
if(!xctx->nl_sel) select_inside(xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2, xctx->nl_sel);
|
||||
bbox(END,0.0, 0.0, 0.0, 0.0);
|
||||
xx1=xr;xx2=xr2;yy1=yr;yy2=yr2;
|
||||
RECTORDER(xx1,yy1,xx2,yy2);
|
||||
drawtemprect(gc[SELLAYER],NOW, xx1,yy1,xx2,yy2);
|
||||
xctx->nl_xx1=xctx->nl_xr;xctx->nl_xx2=xctx->nl_xr2;xctx->nl_yy1=xctx->nl_yr;xctx->nl_yy2=xctx->nl_yr2;
|
||||
RECTORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtemprect(gc[SELLAYER],NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
else if(what & START)
|
||||
{
|
||||
/*
|
||||
* if(sem==1) {
|
||||
* if(xctx->nl_sem==1) {
|
||||
* fprintf(errfp, "ERROR: reentrant call of select_rect()\n");
|
||||
* tcleval("alert_ {ERROR: reentrant call of select_rect()} {}");
|
||||
* }
|
||||
*/
|
||||
sel = select;
|
||||
xctx->nl_sel = select;
|
||||
xctx->ui_state |= STARTSELECT;
|
||||
|
||||
/* use m[xy]_double_save instead of mouse[xy]_snap */
|
||||
/* to avoid delays in setting the start point of a */
|
||||
/* selection rectangle, this is noticeable and annoying on */
|
||||
/* networked / slow X servers. 20171218 */
|
||||
/* xr=xr2=xctx->mousex_snap; */
|
||||
/* yr=yr2=xctx->mousey_snap; */
|
||||
xr=xr2=xctx->mx_double_save;
|
||||
yr=yr2=xctx->my_double_save;
|
||||
sem=1;
|
||||
/* xctx->nl_xr=xctx->nl_xr2=xctx->mousex_snap; */
|
||||
/* xctx->nl_yr=xctx->nl_yr2=xctx->mousey_snap; */
|
||||
xctx->nl_xr=xctx->nl_xr2=xctx->mx_double_save;
|
||||
xctx->nl_yr=xctx->nl_yr2=xctx->my_double_save;
|
||||
xctx->nl_sem=1;
|
||||
}
|
||||
else if(what & END)
|
||||
{
|
||||
RECTORDER(xr,yr,xr2,yr2);
|
||||
drawtemprect(xctx->gctiled, NOW, xr,yr,xr2,yr2);
|
||||
RECTORDER(xctx->nl_xr,xctx->nl_yr,xctx->nl_xr2,xctx->nl_yr2);
|
||||
drawtemprect(xctx->gctiled, NOW, xctx->nl_xr,xctx->nl_yr,xctx->nl_xr2,xctx->nl_yr2);
|
||||
/* draw_selection(gc[SELLAYER], 0); */
|
||||
select_inside(xr,yr,xr2,yr2, sel);
|
||||
select_inside(xctx->nl_xr,xctx->nl_yr,xctx->nl_xr2,xctx->nl_yr2, xctx->nl_sel);
|
||||
|
||||
|
||||
bbox(START,0.0, 0.0, 0.0, 0.0);
|
||||
bbox(ADD, xr, yr, xr2, yr2);
|
||||
bbox(ADD, xctx->nl_xr, xctx->nl_yr, xctx->nl_xr2, xctx->nl_yr2);
|
||||
bbox(SET,0.0, 0.0, 0.0, 0.0);
|
||||
draw_selection(gc[SELLAYER], 0);
|
||||
bbox(END,0.0, 0.0, 0.0, 0.0);
|
||||
/* /20171219 */
|
||||
|
||||
xctx->ui_state &= ~STARTSELECT;
|
||||
sem=0;
|
||||
xctx->nl_sem=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
115
src/callback.c
115
src/callback.c
|
|
@ -21,25 +21,23 @@
|
|||
*/
|
||||
|
||||
#include "xschem.h"
|
||||
static int mx_save, my_save;
|
||||
static int last_command=0;
|
||||
|
||||
void start_line(double mx, double my)
|
||||
{
|
||||
last_command = STARTLINE;
|
||||
xctx->last_command = STARTLINE;
|
||||
if(xctx->ui_state & STARTLINE) {
|
||||
if(!vertical_move) {
|
||||
mx_save = mx;
|
||||
xctx->mx_save = mx;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
}
|
||||
if(!horizontal_move) {
|
||||
my_save = my;
|
||||
xctx->my_save = my;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
}
|
||||
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
|
||||
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
|
||||
} else {
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
}
|
||||
|
|
@ -48,20 +46,20 @@ void start_line(double mx, double my)
|
|||
|
||||
void start_wire(double mx, double my)
|
||||
{
|
||||
last_command = STARTWIRE;
|
||||
xctx->last_command = STARTWIRE;
|
||||
if(xctx->ui_state & STARTWIRE) {
|
||||
if(!vertical_move) {
|
||||
mx_save = mx;
|
||||
xctx->mx_save = mx;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
}
|
||||
if(!horizontal_move) {
|
||||
my_save = my;
|
||||
xctx->my_save = my;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
}
|
||||
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
|
||||
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
|
||||
} else {
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
}
|
||||
|
|
@ -74,7 +72,6 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
int button, int aux, int state)
|
||||
{
|
||||
char str[PATH_MAX + 100]; /* overflow safe 20161122 */
|
||||
static char sel_or_clip[PATH_MAX] = "";/* overflow safe 20161122 */
|
||||
struct stat buf;
|
||||
unsigned short sel;
|
||||
static int capslock = 0;
|
||||
|
|
@ -146,24 +143,24 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
switch(event)
|
||||
{
|
||||
case EnterNotify:
|
||||
if(!sel_or_clip[0]) my_snprintf(sel_or_clip, S(sel_or_clip), "%s/%s", user_conf_dir, ".selection.sch");
|
||||
if(!xctx->sel_or_clip[0]) my_snprintf(xctx->sel_or_clip, S(xctx->sel_or_clip), "%s/%s", user_conf_dir, ".selection.sch");
|
||||
|
||||
/* xschem window *sending* selected objects
|
||||
when the pointer comes back in abort copy operation since it has been done
|
||||
in another xschem xctx->window; STARTCOPY set and selection file does not exist any more */
|
||||
if( stat(sel_or_clip, &buf) && (xctx->ui_state & STARTCOPY) )
|
||||
if( stat(xctx->sel_or_clip, &buf) && (xctx->ui_state & STARTCOPY) )
|
||||
{
|
||||
copy_objects(ABORT); /* also unlinks sel_or_flip file */
|
||||
unselect_all();
|
||||
}
|
||||
/* xschem window *receiving* selected objects */
|
||||
/* no selected objects and selection file exists */
|
||||
if(xctx->lastsel == 0 && !stat(sel_or_clip, &buf)) {
|
||||
if(xctx->lastsel == 0 && !stat(xctx->sel_or_clip, &buf)) {
|
||||
dbg(2, "callback(): Enter event\n");
|
||||
xctx->mousex_snap = 490;
|
||||
xctx->mousey_snap = -340;
|
||||
merge_file(1, ".sch");
|
||||
xunlink(sel_or_clip);
|
||||
xunlink(xctx->sel_or_clip);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -260,12 +257,12 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
!(state & ShiftMask) && !(xctx->ui_state & PLACE_SYMBOL))
|
||||
{
|
||||
static int onetime=0;
|
||||
if(mx != mx_save || my != my_save) {
|
||||
if(mx != xctx->mx_save || my != xctx->my_save) {
|
||||
if( !(xctx->ui_state & STARTSELECT)) {
|
||||
select_rect(START,1);
|
||||
onetime=1;
|
||||
}
|
||||
if(abs(mx-mx_save) > 8 || abs(my-my_save) > 8 ) { /* set some reasonable threshold before unselecting */
|
||||
if(abs(mx-xctx->mx_save) > 8 || abs(my-xctx->my_save) > 8 ) { /* set some reasonable threshold before unselecting */
|
||||
if(onetime) {
|
||||
unselect_all(); /* 20171026 avoid multiple calls of unselect_all() */
|
||||
onetime=0;
|
||||
|
|
@ -282,12 +279,12 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
else if((state&Button1Mask) && (state & ShiftMask) && !(xctx->ui_state & PLACE_SYMBOL) &&
|
||||
!(xctx->ui_state & STARTPAN2) ) {
|
||||
if(mx != mx_save || my != my_save) {
|
||||
if(mx != xctx->mx_save || my != xctx->my_save) {
|
||||
if( !(xctx->ui_state & STARTSELECT)) {
|
||||
select_rect(START,1);
|
||||
}
|
||||
if(abs(mx-mx_save) > 8 || abs(my-my_save) > 8 ) { /* set some reasonable threshold before unselecting */
|
||||
select_object(X_TO_XSCHEM(mx_save), Y_TO_XSCHEM(my_save), 0, 0); /* remove near object if dragging */
|
||||
if(abs(mx-xctx->mx_save) > 8 || abs(my-xctx->my_save) > 8 ) { /* set some reasonable threshold before unselecting */
|
||||
select_object(X_TO_XSCHEM(xctx->mx_save), Y_TO_XSCHEM(xctx->my_save), 0, 0); /* remove near object if dragging */
|
||||
rebuild_selected_array();
|
||||
}
|
||||
}
|
||||
|
|
@ -522,7 +519,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
find_closest_net_or_symbol_pin(xctx->mousex, xctx->mousey, &x, &y);
|
||||
xx = X_TO_SCREEN(x);
|
||||
yy = Y_TO_SCREEN(y);
|
||||
mx_save = xx; my_save = yy;
|
||||
xctx->mx_save = xx; xctx->my_save = yy;
|
||||
xctx->mx_double_save = ROUND(x / cadsnap) * cadsnap;
|
||||
xctx->my_double_save = ROUND(y / cadsnap) * cadsnap;
|
||||
new_wire(PLACE, x, y);
|
||||
|
|
@ -551,7 +548,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
no_draw = 0;
|
||||
if(xctx->semaphore >= 2) break;
|
||||
tcleval("set vertical_move 0; set horizontal_move 0" );
|
||||
last_command=0;
|
||||
xctx->last_command=0;
|
||||
manhattan_lines = 0;
|
||||
horizontal_move = vertical_move = 0;
|
||||
dbg(1, "callback(): Escape: xctx->ui_state=%ld\n", xctx->ui_state);
|
||||
|
|
@ -603,10 +600,10 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
{
|
||||
if(xctx->semaphore >= 2) break;
|
||||
dbg(1, "callback(): start polygon\n");
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
last_command = 0;
|
||||
xctx->last_command = 0;
|
||||
new_polygon(PLACE);
|
||||
break;
|
||||
}
|
||||
|
|
@ -680,17 +677,17 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key=='t' && state == 0) /* place text */
|
||||
{
|
||||
if(xctx->semaphore >= 2) break;
|
||||
last_command = 0;
|
||||
xctx->last_command = 0;
|
||||
place_text(1, xctx->mousex_snap, xctx->mousey_snap); /* 1 = draw text 24122002 */
|
||||
break;
|
||||
}
|
||||
if(key=='r' && !xctx->ui_state && state==0) /* start rect */
|
||||
{
|
||||
dbg(1, "callback(): start rect\n");
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
last_command = 0;
|
||||
xctx->last_command = 0;
|
||||
new_rect(PLACE);
|
||||
break;
|
||||
}
|
||||
|
|
@ -816,20 +813,20 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key=='C' && state == ShiftMask) /* place arc */
|
||||
{
|
||||
if(xctx->semaphore >= 2) break;
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
last_command = 0;
|
||||
xctx->last_command = 0;
|
||||
new_arc(PLACE, 180.);
|
||||
break;
|
||||
}
|
||||
if(key=='C' && state == (ControlMask|ShiftMask)) /* place circle */
|
||||
{
|
||||
if(xctx->semaphore >= 2) break;
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
last_command = 0;
|
||||
xctx->last_command = 0;
|
||||
new_arc(PLACE, 360.);
|
||||
break;
|
||||
}
|
||||
|
|
@ -887,7 +884,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key==XK_Insert || (key == 'I' && state == ShiftMask) ) /* insert sym */
|
||||
{
|
||||
if(xctx->semaphore >= 2) break;
|
||||
last_command = 0;
|
||||
xctx->last_command = 0;
|
||||
#if 1 /* enable on request also in scheduler.c */
|
||||
rebuild_selected_array();
|
||||
if(xctx->lastsel && xctx->sel_array[0].type==ELEMENT) {
|
||||
|
|
@ -898,7 +895,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
unselect_all();
|
||||
|
||||
/* place_symbol(-1,NULL,xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL,3, 1);*/
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save = xctx->mousex_snap;
|
||||
xctx->my_double_save = xctx->mousey_snap;
|
||||
if(place_symbol(-1,NULL,xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1) ) {
|
||||
|
|
@ -1116,7 +1113,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
else if(xctx->ui_state & STARTCOPY) copy_objects(FLIP);
|
||||
else {
|
||||
rebuild_selected_array();
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
move_objects(START,0,0,0);
|
||||
|
|
@ -1138,7 +1135,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
else if(xctx->ui_state & STARTCOPY) copy_objects(FLIP|ROTATELOCAL);
|
||||
else {
|
||||
rebuild_selected_array();
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
move_objects(START,0,0,0);
|
||||
|
|
@ -1153,7 +1150,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
else if(xctx->ui_state & STARTCOPY) copy_objects(ROTATE);
|
||||
else {
|
||||
rebuild_selected_array();
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
move_objects(START,0,0,0);
|
||||
|
|
@ -1170,7 +1167,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
else if(xctx->ui_state & STARTCOPY) copy_objects(ROTATE|ROTATELOCAL);
|
||||
else {
|
||||
rebuild_selected_array();
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
move_objects(START,0,0,0);
|
||||
|
|
@ -1181,7 +1178,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if(key=='m' && state==0 && !(xctx->ui_state & (STARTMOVE | STARTCOPY)))/* move selected obj. */
|
||||
{
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
move_objects(START,0,0,0);
|
||||
|
|
@ -1192,7 +1189,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
!(xctx->ui_state & (STARTMOVE | STARTCOPY)))
|
||||
{
|
||||
if(xctx->semaphore >= 2) break;
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
copy_objects(START);
|
||||
|
|
@ -1399,7 +1396,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
dbg(1, "callback(): ButtonPress xctx->ui_state=%ld state=%d\n",xctx->ui_state,state);
|
||||
if(xctx->ui_state & STARTPAN2) {
|
||||
xctx->ui_state &=~STARTPAN2;
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
|
||||
|
|
@ -1408,7 +1405,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(button==Button5 && state == 0 ) view_unzoom(CADZOOMSTEP);
|
||||
else if(button == Button3 && xctx->semaphore <2) {
|
||||
if(!(xctx->ui_state & STARTPOLYGON) && !(state & Mod1Mask) ) {
|
||||
last_command = 0;
|
||||
xctx->last_command = 0;
|
||||
unselect_all();
|
||||
select_object(xctx->mousex,xctx->mousey,SELECTED, 1);
|
||||
rebuild_selected_array();
|
||||
|
|
@ -1439,8 +1436,8 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
draw();
|
||||
}
|
||||
else if(button==Button1 && (state & Mod1Mask) ) {
|
||||
last_command = 0;
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->last_command = 0;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
|
||||
|
|
@ -1470,9 +1467,9 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
else if(button==Button1)
|
||||
{
|
||||
if(persistent_command && last_command) {
|
||||
if(last_command == STARTLINE) start_line(mx, my);
|
||||
if(last_command == STARTWIRE) start_wire(mx, my);
|
||||
if(persistent_command && xctx->last_command) {
|
||||
if(xctx->last_command == STARTLINE) start_line(mx, my);
|
||||
if(xctx->last_command == STARTWIRE) start_wire(mx, my);
|
||||
break;
|
||||
}
|
||||
if(!(xctx->ui_state & STARTPOLYGON) && !(xctx->ui_state & STARTWIRE) && !(xctx->ui_state & STARTLINE) ) {
|
||||
|
|
@ -1485,7 +1482,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
}
|
||||
if(xctx->ui_state & MENUSTARTWIRE) {
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
new_wire(PLACE, xctx->mousex_snap, xctx->mousey_snap);
|
||||
|
|
@ -1499,7 +1496,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
find_closest_net_or_symbol_pin(xctx->mousex, xctx->mousey, &x, &y);
|
||||
xx = X_TO_SCREEN(x);
|
||||
yy = Y_TO_SCREEN(y);
|
||||
mx_save = xx; my_save = yy;
|
||||
xctx->mx_save = xx; xctx->my_save = yy;
|
||||
xctx->mx_double_save = ROUND(x / cadsnap) * cadsnap;
|
||||
xctx->my_double_save = ROUND(y / cadsnap) * cadsnap;
|
||||
|
||||
|
|
@ -1508,7 +1505,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
}
|
||||
if(xctx->ui_state & MENUSTARTLINE) {
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
new_line(PLACE);
|
||||
|
|
@ -1516,7 +1513,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
}
|
||||
if(xctx->ui_state & MENUSTARTRECT) {
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
new_rect(PLACE);
|
||||
|
|
@ -1524,7 +1521,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
}
|
||||
if(xctx->ui_state & MENUSTARTPOLYGON) {
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
new_polygon(PLACE);
|
||||
|
|
@ -1532,7 +1529,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
}
|
||||
if(xctx->ui_state & MENUSTARTARC) {
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
new_arc(PLACE, 180.);
|
||||
|
|
@ -1540,7 +1537,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
}
|
||||
if(xctx->ui_state & MENUSTARTCIRCLE) {
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
new_arc(PLACE, 360.);
|
||||
|
|
@ -1563,11 +1560,11 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(xctx->ui_state & STARTWIRE) {
|
||||
if(persistent_command) {
|
||||
if(!vertical_move) {
|
||||
mx_save = mx;
|
||||
xctx->mx_save = mx;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
}
|
||||
if(!horizontal_move) {
|
||||
my_save = my;
|
||||
xctx->my_save = my;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
}
|
||||
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
|
||||
|
|
@ -1586,11 +1583,11 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(xctx->ui_state & STARTLINE) {
|
||||
if(persistent_command) {
|
||||
if(!vertical_move) {
|
||||
mx_save = mx;
|
||||
xctx->mx_save = mx;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
}
|
||||
if(!horizontal_move) {
|
||||
my_save = my;
|
||||
xctx->my_save = my;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
}
|
||||
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
|
||||
|
|
@ -1626,7 +1623,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if( !(xctx->ui_state & STARTSELECT) && !(xctx->ui_state & STARTWIRE) && !(xctx->ui_state & STARTLINE) ) {
|
||||
int prev_last_sel = xctx->lastsel;
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
if( !(state & ShiftMask) && !(state & Mod1Mask) ) {
|
||||
|
|
@ -1676,7 +1673,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
case ButtonRelease:
|
||||
if(xctx->ui_state & STARTPAN2) {
|
||||
xctx->ui_state &=~STARTPAN2;
|
||||
mx_save = mx; my_save = my;
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
|
||||
|
|
|
|||
696
src/move.c
696
src/move.c
File diff suppressed because it is too large
Load Diff
22
src/xinit.c
22
src/xinit.c
|
|
@ -424,6 +424,7 @@ void alloc_xschem_data()
|
|||
for(i = 0 ; i < HASHSIZE; i++) {
|
||||
xctx->node_table[i] = NULL;
|
||||
xctx->hilight_table[i] = NULL;
|
||||
xctx->node_redraw_table[i] = NULL; /* move.c */
|
||||
}
|
||||
xctx->inst_color=NULL;
|
||||
xctx->window = xctx->save_pixmap = 0;
|
||||
|
|
@ -436,6 +437,27 @@ void alloc_xschem_data()
|
|||
xctx->node_mult = NULL;
|
||||
xctx->node_mult_size = 0;
|
||||
|
||||
/* move.c */
|
||||
xctx->rx1 = xctx->rx2 = xctx->ry1 = xctx->ry2 = 0.0;
|
||||
xctx->move_rot = 0;
|
||||
xctx->move_flip = 0;
|
||||
xctx->x1 = xctx->y_1 = xctx->x2 = xctx->y_2 = xctx->deltax = xctx->deltay = 0.0;
|
||||
xctx->movelastsel = 0;
|
||||
xctx->rotatelocal=0;
|
||||
/* new_wire */
|
||||
xctx->nl_x1 = xctx->nl_y1 = xctx->nl_x2 = xctx->nl_y2 = 0.0;
|
||||
xctx->nl_xx1 = xctx->nl_yy1 = xctx->nl_xx2 = xctx->nl_yy2 = 0.0;
|
||||
/* new_arc */
|
||||
xctx->nl_x = xctx->nl_y = xctx->nl_r = xctx->nl_a = xctx->nl_b = xctx->nl_x3 = xctx->nl_y3 = 0.0;
|
||||
xctx->nl_state = 0;
|
||||
xctx->nl_sweep_angle = 0.0;
|
||||
/* new_polygon */
|
||||
xctx->nl_polyx = xctx->nl_polyy = NULL;
|
||||
xctx->nl_points = xctx->nl_maxpoints = 0;
|
||||
/* select_rect */
|
||||
xctx->nl_xr = xctx->nl_yr = xctx->nl_xr2 = xctx->nl_yr2 = 0.0;
|
||||
xctx->nl_sel = xctx->nl_sem = 0;
|
||||
|
||||
xctx->hilight_nets = 0;
|
||||
xctx->hilight_color = 0;
|
||||
for(i=0;i<CADMAXHIER;i++) xctx->sch_path[i]=NULL;
|
||||
|
|
|
|||
26
src/xschem.h
26
src/xschem.h
|
|
@ -552,6 +552,32 @@ typedef struct {
|
|||
int new_node;
|
||||
int *node_mult;
|
||||
int node_mult_size;
|
||||
/* callback.c */
|
||||
int mx_save, my_save, last_command;
|
||||
char sel_or_clip[PATH_MAX];
|
||||
/* move.c */
|
||||
struct int_hashentry *node_redraw_table[HASHSIZE];
|
||||
double rx1, rx2, ry1, ry2;
|
||||
short move_rot;
|
||||
short move_flip;
|
||||
double x1, y_1, x2, y_2, deltax, deltay;
|
||||
int movelastsel;
|
||||
short rotatelocal;
|
||||
/* new_wire, new_line, new_rect*/
|
||||
double nl_x1,nl_y1,nl_x2,nl_y2;
|
||||
double nl_xx1,nl_yy1,nl_xx2,nl_yy2;
|
||||
/* new_arc */
|
||||
double nl_x, nl_y, nl_r, nl_a, nl_b;
|
||||
double nl_x3, nl_y3;
|
||||
int nl_state;
|
||||
double nl_sweep_angle;
|
||||
/* new_polygon */
|
||||
double *nl_polyx, *nl_polyy;
|
||||
int nl_points, nl_maxpoints;
|
||||
/* select_rect */
|
||||
double nl_xr, nl_yr, nl_xr2, nl_yr2;
|
||||
int nl_sel, nl_sem;
|
||||
|
||||
|
||||
} Xschem_ctx;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue