diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 114222f1..2c1db59f 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -507,6 +507,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" + + + @@ -638,9 +641,11 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" xschem expandlabel {2*A[3:0]} --> A[3],A[2],A[1],A[0],A[3],A[2],A[1],A[0] 8 last field is the number of bits since [ and ] are TCL special characters argument must be quoted with { and } -
+
Find n-th field string separated by characters in sep. 1st field is in position 1
- xschem find_nth {aaa,bbb,ccc,ddd} {,} 2 --> bbb
+ do not split quoted fields (if quote characters are given) and return unquoted.
+ xschem find_nth {aaa,bbb,ccc,ddd} {,} 2 --> bbb
+ xschem find_nth {aaa, "bbb, ccc" , ddd} { ,} {"} 2 --> bbb, ccc
Flip selection horizontally around point x0 y0.
if x0, y0 not given use mouse coordinates
@@ -663,6 +668,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
+ test for my_strtok_r() function
Place a new net label
'type': 1: place a 'lab_pin.sym' label
@@ -1138,8 +1147,13 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
Returns number of selected items (wires,labels) if danglings found, 0 otherwise
Select all highlight objects (wires, labels, pins, instances)
- - Return a list of selected instance names+
+ Select all objects inside the indicated area + if [sel] is set to '0' do an unselect operation+
+ Return a list of selected instance names + If what is not given or set to 'inst' return list of selected instance names + If what set to 'rect' return list of selected rectangles with their coordinates
Return list of selected nets
@@ -1277,6 +1291,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
Translate string 'str' replacing @xxx tokens with values in instance 'n' attributes
Example: xschem translate vref {the voltage is @value}
the voltage is 1.8
+ + Remove leading and trailing chars matching any character in 'sep' from str
Remove operlapping wires, join lines, trim wires at intersections
diff --git a/src/findnet.c b/src/findnet.c
index 78bd239b..e6ab23fe 100644
--- a/src/findnet.c
+++ b/src/findnet.c
@@ -223,7 +223,7 @@ static void find_closest_arc(double mx,double my)
}
-static void find_closest_box(double mx,double my)
+static void find_closest_box(double mx,double my, int override_lock)
{
double tmp;
int i,c,r=-1, col = 0;
@@ -244,8 +244,7 @@ static void find_closest_box(double mx,double my)
} /* end for i */
} /* end for c */
dbg(1, "find_closest_box(): distance=%.16g\n", distance);
- if( r!=-1)
- {
+ if( r!=-1 && (override_lock || strboolcmp(get_tok_value(xctx->rect[col][r].prop_ptr, "lock", 0), "true"))) {
sel.n = r; sel.type = xRECT; sel.col = col;
}
}
@@ -319,7 +318,7 @@ Selected find_closest_obj(double mx,double my, int override_lock)
find_closest_line(mx,my);
find_closest_polygon(mx,my);
/* dbg(1, "1 find_closest_obj(): sel.n=%d, sel.col=%d, sel.type=%d\n", sel.n, sel.col, sel.type); */
- find_closest_box(mx,my);
+ find_closest_box(mx,my, override_lock);
find_closest_arc(mx,my);
/* dbg(1, "2 find_closest_obj(): sel.n=%d, sel.col=%d, sel.type=%d\n", sel.n, sel.col, sel.type); */
find_closest_text(mx,my);
diff --git a/src/scheduler.c b/src/scheduler.c
index d1c5a36c..19a7f45f 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -3795,15 +3795,50 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp);
}
- /* selected_set
- * Return a list of selected instance names */
+ /* select_inside x1 y1 x2 y2 [sel]
+ * Select all objects inside the indicated area
+ if [sel] is set to '0' do an unselect operation */
+ else if(!strcmp(argv[1], "select_inside"))
+ {
+ int sel = SELECTED;
+ double x1, y1, x2, y2;
+ if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
+ if(argc > 6 && argv[6][0] == '0') sel = 0;
+ x1 = atof(argv[2]);
+ y1 = atof(argv[3]);
+ x2 = atof(argv[4]);
+ y2 = atof(argv[5]);
+ select_inside(x1, y1, x2, y2, sel);
+ Tcl_ResetResult(interp);
+ }
+
+ /* selected_set [what]
+ * Return a list of selected instance names
+ * If what is not given or set to 'inst' return list of selected instance names
+ * If what set to 'rect' return list of selected rectangles with their coordinates */
else if(!strcmp(argv[1], "selected_set"))
{
int n, i, first = 1;
+ int what = ELEMENT;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
+
+ if(argc > 2) {
+ if(!strcmp(argv[2], "rect")) what = xRECT;
+ }
rebuild_selected_array();
for(n=0; n < xctx->lastsel; ++n) {
- if(xctx->sel_array[n].type == ELEMENT) {
+ if(what == xRECT && xctx->sel_array[n].type == xRECT) {
+ char col[30], num[30], coord[200];
+ int c = xctx->sel_array[n].col;
+ i = xctx->sel_array[n].n;
+ my_strncpy(col, my_itoa(c), S(col));
+ my_strncpy(num, my_itoa(i), S(num));
+ my_snprintf(coord, S(coord), "%g %g %g %g",
+ xctx->rect[c][i].x1, xctx->rect[c][i].y1, xctx->rect[c][i].x2, xctx->rect[c][i].y2);
+ if(first == 0) Tcl_AppendResult(interp, "\n", NULL);
+ first = 0;
+ Tcl_AppendResult(interp,col, " ", num, " ", coord , NULL);
+ } else if(what == ELEMENT && xctx->sel_array[n].type == ELEMENT) {
i = xctx->sel_array[n].n;
if(first == 0) Tcl_AppendResult(interp, " ", NULL);
Tcl_AppendResult(interp, "{", xctx->inst[i].instname, "}", NULL);
@@ -4214,7 +4249,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
}
if(change_done) set_modify(1);
- set_rect_flags(r); /* set cached .flags bitmask from on attributes */
+ set_rect_flags(r); /* set cached .flags bitmask from attributes */
if(!fast) {
bbox(ADD, r->x1, r->y1, r->x2, r->y2);
/* redraw rect with new props */
diff --git a/src/select.c b/src/select.c
index 0729ab13..d972a6e5 100644
--- a/src/select.c
+++ b/src/select.c
@@ -1243,7 +1243,7 @@ Selected select_object(double mx,double my, unsigned short select_mode, int over
select_polygon(sel.col, sel.n, select_mode,0);
break;
case xRECT:
- select_box(sel.col,sel.n, select_mode,0, 0);
+ select_box(sel.col,sel.n, select_mode,0, override_lock);
break;
case ARC:
select_arc(sel.col,sel.n, select_mode,0);
@@ -1478,7 +1478,15 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
if(RECT_INSIDE(xctx->rect[c][i].x1,xctx->rect[c][i].y1,xctx->rect[c][i].x2,xctx->rect[c][i].y2, x1,y1,x2,y2))
{
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
- sel? select_box(c,i, SELECTED, 1, 1): select_box(c,i, 0, 1, 0);
+
+
+ if(sel) {
+ if(strboolcmp(get_tok_value(xctx->rect[c][i].prop_ptr, "lock", 0), "true")) {
+ select_box(c,i, SELECTED, 1, 1);
+ }
+ } else {
+ select_box(c,i, 0, 1, 0);
+ }
}
else if(c != GRIDLAYER || !(xctx->rect[c][i].flags & 2048)){ /* no stretch on unscaled images */
if( sel && en_s && POINTINSIDE(xctx->rect[c][i].x1,xctx->rect[c][i].y1, x1,y1,x2,y2) )