remove some dead code, fix redrawing in `xschem move_instance` command

This commit is contained in:
stefan schippers 2023-10-30 00:57:28 +01:00
parent 36b1a9f9e7
commit 8f2af6803a
3 changed files with 16 additions and 65 deletions

View File

@ -3429,23 +3429,11 @@ void select_rect(int what, int select)
/* 20171026 update unselected objects while dragging */ /* 20171026 update unselected objects while dragging */
rebuild_selected_array(); rebuild_selected_array();
#if 0
if(xctx->nl_dir == 0) {
bbox(START,0.0, 0.0, 0.0, 0.0);
bbox(ADD, xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2);
bbox(SET,0.0, 0.0, 0.0, 0.0);
}
#endif
draw_selection(xctx->gc[SELLAYER], 0); draw_selection(xctx->gc[SELLAYER], 0);
/* if(xctx->nl_sel) { */ /* if(xctx->nl_sel) { */
if(xctx->nl_dir == 0) select_inside(xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2, xctx->nl_sel); if(xctx->nl_dir == 0) select_inside(xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2, xctx->nl_sel);
else select_touch(xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2, xctx->nl_sel); else select_touch(xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2, xctx->nl_sel);
/* } */ /* } */
#if 0
if(xctx->nl_dir == 0) {
bbox(END,0.0, 0.0, 0.0, 0.0);
}
#endif
xctx->nl_xx1=xctx->nl_xr;xctx->nl_xx2=xctx->nl_xr2;xctx->nl_yy1=xctx->nl_yr;xctx->nl_yy2=xctx->nl_yr2; 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); RECTORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
drawtemprect(xctx->gc[SELLAYER],NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2); drawtemprect(xctx->gc[SELLAYER],NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
@ -3480,26 +3468,10 @@ void select_rect(int what, int select)
} else { } else {
drawtemprect(xctx->gctiled, NOW, 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(xctx->gc[SELLAYER], 0); */
if(xctx->nl_dir == 0) select_inside(xctx->nl_xr,xctx->nl_yr,xctx->nl_xr2,xctx->nl_yr2, xctx->nl_sel); if(xctx->nl_dir == 0) select_inside(xctx->nl_xr,xctx->nl_yr,xctx->nl_xr2,xctx->nl_yr2, xctx->nl_sel);
else select_touch(xctx->nl_xr,xctx->nl_yr,xctx->nl_xr2,xctx->nl_yr2, xctx->nl_sel); else select_touch(xctx->nl_xr,xctx->nl_yr,xctx->nl_xr2,xctx->nl_yr2, xctx->nl_sel);
#if 0
if(xctx->nl_dir == 0) {
bbox(START,0.0, 0.0, 0.0, 0.0);
bbox(ADD, xctx->nl_xr, xctx->nl_yr, xctx->nl_xr2, xctx->nl_yr2);
bbox(SET,0.0, 0.0, 0.0, 0.0);
}
#endif
draw_selection(xctx->gc[SELLAYER], 0); draw_selection(xctx->gc[SELLAYER], 0);
#if 0
if(xctx->nl_dir == 0) {
bbox(END,0.0, 0.0, 0.0, 0.0);
}
#endif
/* /20171219 */
xctx->ui_state &= ~STARTSELECT; xctx->ui_state &= ~STARTSELECT;
xctx->nl_sem=0; xctx->nl_sem=0;
} }

View File

@ -1250,20 +1250,6 @@ static int edit_text_property(int x)
for(l=0;l<c; ++l) { for(l=0;l<c; ++l) {
if(xctx->text[sel].txt_ptr && if(xctx->text[sel].txt_ptr &&
!strcmp( (get_tok_value(xctx->rect[PINLAYER][l].prop_ptr, "name",0)), xctx->text[sel].txt_ptr) ) { !strcmp( (get_tok_value(xctx->rect[PINLAYER][l].prop_ptr, "name",0)), xctx->text[sel].txt_ptr) ) {
/*
#if HAS_CAIRO==1
customfont = set_text_custom_font(&xctx->text[sel]);
#endif
text_bbox(get_text_floater(sel), xctx->text[sel].xscale,
xctx->text[sel].yscale, (short)rot, (short)flip, xctx->text[sel].hcenter,
xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0,
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
#if HAS_CAIRO==1
if(customfont) {
cairo_restore(xctx->cairo_ctx);
}
#endif
*/
pcx = (xctx->rect[PINLAYER][l].x1+xctx->rect[PINLAYER][l].x2)/2.0; pcx = (xctx->rect[PINLAYER][l].x1+xctx->rect[PINLAYER][l].x2)/2.0;
pcy = (xctx->rect[PINLAYER][l].y1+xctx->rect[PINLAYER][l].y2)/2.0; pcy = (xctx->rect[PINLAYER][l].y1+xctx->rect[PINLAYER][l].y2)/2.0;
if( if(
@ -1300,20 +1286,6 @@ static int edit_text_property(int x)
xctx->text[sel].xscale=hsize; xctx->text[sel].xscale=hsize;
xctx->text[sel].yscale=vsize; xctx->text[sel].yscale=vsize;
} }
/* calculate bbox, some cleanup needed here */
#if HAS_CAIRO==1
customfont = set_text_custom_font(&xctx->text[sel]);
#endif
text_bbox(get_text_floater(sel), xctx->text[sel].xscale,
xctx->text[sel].yscale, (short)rot, (short)flip, xctx->text[sel].hcenter,
xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0,
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
#if HAS_CAIRO==1
if(customfont) {
cairo_restore(xctx->cairo_ctx);
}
#endif
} /* for(k=0;k<xctx->lastsel; ++k) */ } /* for(k=0;k<xctx->lastsel; ++k) */
draw(); draw();
} }

View File

@ -2492,13 +2492,17 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
} }
} }
if(argc > 6) { if(argc > 6) {
int i; int i, s_pnetname, floaters;
if((i = get_instance(argv[2])) < 0 ) { if((i = get_instance(argv[2])) < 0 ) {
Tcl_SetResult(interp, "xschem move_instance: instance not found", TCL_STATIC); Tcl_SetResult(interp, "xschem move_instance: instance not found", TCL_STATIC);
return TCL_ERROR; return TCL_ERROR;
} }
s_pnetname = tclgetboolvar("show_pin_net_names");
floaters = set_modify(1);
floaters |= s_pnetname;
if(undo) xctx->push_undo(); if(undo) xctx->push_undo();
if(dr) { if(dr && !floaters) {
bbox(START,0.0,0.0,0.0,0.0); bbox(START,0.0,0.0,0.0,0.0);
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2); bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
} }
@ -2507,16 +2511,19 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(strcmp(argv[5], "-")) xctx->inst[i].rot = (unsigned short)atoi(argv[5]); if(strcmp(argv[5], "-")) xctx->inst[i].rot = (unsigned short)atoi(argv[5]);
if(strcmp(argv[6], "-")) xctx->inst[i].flip = (unsigned short)atoi(argv[6]); if(strcmp(argv[6], "-")) xctx->inst[i].flip = (unsigned short)atoi(argv[6]);
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2); symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
if(dr) {
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
bbox(SET,0.0,0.0,0.0,0.0);
draw();
bbox(END,0.0,0.0,0.0,0.0);
}
set_modify(1);
xctx->prep_hash_inst=0; xctx->prep_hash_inst=0;
xctx->prep_net_structs=0; xctx->prep_net_structs=0;
xctx->prep_hi_structs=0; xctx->prep_hi_structs=0;
if(dr) {
if(!floaters) {
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
bbox(SET,0.0,0.0,0.0,0.0);
}
draw();
if(!floaters) {
bbox(END,0.0,0.0,0.0,0.0);
}
}
} }
} }
/* move_objects [dx dy] [kissing] [stretch] /* move_objects [dx dy] [kissing] [stretch]