lock attribute extended to all objects
This commit is contained in:
parent
a93fb64e12
commit
e266642c2c
|
|
@ -1066,7 +1066,7 @@ void clear_partial_selected_wires(void)
|
|||
rebuild_selected_array();
|
||||
for(j=0; j < xctx->lastsel; ++j) if(xctx->sel_array[j].type == WIRE) {
|
||||
int wire = xctx->sel_array[j].n;
|
||||
select_wire(wire, 0, 1);
|
||||
select_wire(wire, 0, 1, 1);
|
||||
}
|
||||
xctx->need_reb_sel_arr = 1;
|
||||
rebuild_selected_array();
|
||||
|
|
@ -1229,7 +1229,7 @@ int unselect_partial_sel_wires(void)
|
|||
while(wptr) {
|
||||
xWire *w = &xctx->wire[wptr->n];
|
||||
if(touch(w->x1, w->y1, w->x2, w->y2, pinx0, piny0) && w->sel && w->sel != SELECTED) {
|
||||
select_wire(wptr->n, 0, 1);
|
||||
select_wire(wptr->n, 0, 1, 1);
|
||||
changed = 1;
|
||||
}
|
||||
wptr = wptr->next;
|
||||
|
|
@ -1258,7 +1258,7 @@ int unselect_partial_sel_wires(void)
|
|||
}
|
||||
if(touch(w->x1, w->y1, w->x2, w->y2, x0, y0) && w->sel && w->sel != SELECTED) {
|
||||
xctx->wire[wptr->n].sel = 0;
|
||||
select_wire(wptr->n, 0, 1);
|
||||
select_wire(wptr->n, 0, 1, 1);
|
||||
changed = 1;
|
||||
}
|
||||
wptr = wptr->next;
|
||||
|
|
@ -3830,7 +3830,7 @@ int place_text(int draw_text, double mx, double my)
|
|||
dbg(1,"props=%s, txt=%s\n", props, txt);
|
||||
|
||||
create_text(draw_text, mx, my, 0, 0, txt, props, atof(hsize), atof(vsize));
|
||||
select_text(xctx->texts - 1, SELECTED, 0);
|
||||
select_text(xctx->texts - 1, SELECTED, 0, 1);
|
||||
rebuild_selected_array(); /* sets xctx->ui_state |= SELECTION */
|
||||
drawtemprect(xctx->gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0);
|
||||
drawtempline(xctx->gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0);
|
||||
|
|
|
|||
|
|
@ -2401,33 +2401,33 @@ void unselect_attached_floaters(void)
|
|||
for(i = 0; i < xctx->lines[c]; i++) {
|
||||
if(get_tok_value(xctx->line[c][i].prop_ptr, "name", 0)[0]) {
|
||||
found = 1;
|
||||
select_line(c, i, 0, 1);
|
||||
select_line(c, i, 0, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < xctx->polygons[c]; i++) {
|
||||
if(get_tok_value(xctx->poly[c][i].prop_ptr, "name", 0)[0]) {
|
||||
found = 1;
|
||||
select_polygon(c, i, 0, 1);
|
||||
select_polygon(c, i, 0, 1, 1);
|
||||
}
|
||||
}
|
||||
for(i = 0; i < xctx->arcs[c]; i++) {
|
||||
if(get_tok_value(xctx->arc[c][i].prop_ptr, "name", 0)[0]) {
|
||||
found = 1;
|
||||
select_arc(c, i, 0, 1);
|
||||
select_arc(c, i, 0, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i = 0; i < xctx->wires; i++) {
|
||||
if(get_tok_value(xctx->wire[i].prop_ptr, "name", 0)[0]) {
|
||||
found = 1;
|
||||
select_wire(i, 0, 1);
|
||||
select_wire(i, 0, 1, 1);
|
||||
}
|
||||
}
|
||||
for(i = 0; i < xctx->texts; i++) {
|
||||
if(get_tok_value(xctx->text[i].prop_ptr, "name", 0)[0]) {
|
||||
found = 1;
|
||||
select_text(i, 0, 1);
|
||||
select_text(i, 0, 1, 1);
|
||||
}
|
||||
}
|
||||
if(found) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
static double distance; /* safe to keep even with multiple schematics */
|
||||
static Selected sel; /* safe to keep even with multiple schematics */
|
||||
|
||||
static void find_closest_wire(double mx, double my)
|
||||
static void find_closest_wire(double mx, double my, int override_lock)
|
||||
/* returns the net that is closest to the mouse pointer */
|
||||
/* if there are nets and distance < CADWIREMINDIST */
|
||||
{
|
||||
|
|
@ -42,7 +42,8 @@ static void find_closest_wire(double mx, double my)
|
|||
w = i; d = tmp;
|
||||
}
|
||||
}
|
||||
if( d <= threshold && w!=-1)
|
||||
if( w != -1 && d <= threshold &&
|
||||
(override_lock || strboolcmp(get_tok_value(xctx->wire[w].prop_ptr, "lock", 0), "true")) )
|
||||
{
|
||||
sel.n = w; sel.type = WIRE;
|
||||
distance = d;
|
||||
|
|
@ -107,7 +108,7 @@ static double find_closest_bezier(double mx, double my, double d, int c, int i,
|
|||
return d;
|
||||
}
|
||||
|
||||
static void find_closest_polygon(double mx, double my)
|
||||
static void find_closest_polygon(double mx, double my, int override_lock)
|
||||
/* returns the polygon that is closest to the mouse pointer */
|
||||
/* if there are lines and distance < CADWIREMINDIST */
|
||||
{
|
||||
|
|
@ -144,7 +145,8 @@ static void find_closest_polygon(double mx, double my)
|
|||
}
|
||||
} /* end for i */
|
||||
} /* end for c */
|
||||
if( d <= threshold && l!=-1)
|
||||
if( d <= threshold && l!=-1 &&
|
||||
(override_lock || strboolcmp(get_tok_value(xctx->poly[col][l].prop_ptr, "lock", 0), "true")))
|
||||
{
|
||||
sel.n = l; sel.type = POLYGON; sel.col = col;
|
||||
distance = d;
|
||||
|
|
@ -152,7 +154,7 @@ static void find_closest_polygon(double mx, double my)
|
|||
}
|
||||
|
||||
|
||||
static void find_closest_line(double mx, double my)
|
||||
static void find_closest_line(double mx, double my, int override_lock)
|
||||
/* returns the line that is closest to the mouse pointer */
|
||||
/* if there are lines and distance < CADWIREMINDIST */
|
||||
{
|
||||
|
|
@ -174,7 +176,8 @@ static void find_closest_line(double mx, double my)
|
|||
}
|
||||
} /* end for i */
|
||||
} /* end for c */
|
||||
if( d <= threshold && l!=-1)
|
||||
if( d <= threshold && l!=-1 &&
|
||||
(override_lock || strboolcmp(get_tok_value(xctx->line[col][l].prop_ptr, "lock", 0), "true")))
|
||||
{
|
||||
sel.n = l; sel.type = LINE; sel.col = col;
|
||||
distance = d;
|
||||
|
|
@ -319,7 +322,7 @@ void xfind_closest_net_or_symbol_pin(double mx, double my, double *x, double *y)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void find_closest_arc(double mx, double my)
|
||||
static void find_closest_arc(double mx, double my, int override_lock)
|
||||
{
|
||||
double dist, angle, angle1, angle2;
|
||||
int i, c, r=-1, col;
|
||||
|
|
@ -364,7 +367,8 @@ static void find_closest_arc(double mx, double my)
|
|||
}
|
||||
} /* end for i */
|
||||
} /* end for c */
|
||||
if( r!=-1 && d <= threshold ) /* * pow(xctx->arc[col][r].r, 2)) */
|
||||
if(r!=-1 && d <= threshold &&
|
||||
strboolcmp(get_tok_value(xctx->arc[col][r].prop_ptr, "lock", 0), "true"))
|
||||
{
|
||||
sel.n = r; sel.type = ARC; sel.col = col;
|
||||
distance = d;
|
||||
|
|
@ -432,7 +436,7 @@ static void find_closest_element(double mx, double my, int override_lock)
|
|||
}
|
||||
}
|
||||
|
||||
static void find_closest_text(double mx, double my)
|
||||
static void find_closest_text(double mx, double my, int override_lock)
|
||||
{
|
||||
short rot, flip;
|
||||
double xx1, xx2, yy1, yy2;
|
||||
|
|
@ -469,7 +473,9 @@ static void find_closest_text(double mx, double my)
|
|||
dbg(2, "find_closest_text(): finding closest text, texts=%d, dist=%.16g\n", i, d);
|
||||
}
|
||||
} /* end for i */
|
||||
if( d <= threshold && r!=-1)
|
||||
|
||||
if( r != -1 && d <= threshold &&
|
||||
(override_lock || strboolcmp(get_tok_value(xctx->text[r].prop_ptr, "lock", 0), "true")) )
|
||||
{
|
||||
sel.n = r; sel.type = xTEXT;
|
||||
distance = d;
|
||||
|
|
@ -480,14 +486,14 @@ Selected find_closest_obj(double mx, double my, int override_lock)
|
|||
{
|
||||
sel.n = 0L; sel.col = 0; sel.type = 0;
|
||||
distance = DBL_MAX;
|
||||
find_closest_line(mx, my);
|
||||
find_closest_polygon(mx, my);
|
||||
find_closest_line(mx, my, override_lock);
|
||||
find_closest_polygon(mx, my, override_lock);
|
||||
/* 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, override_lock);
|
||||
find_closest_arc(mx, my);
|
||||
find_closest_arc(mx, my, override_lock);
|
||||
/* 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);
|
||||
find_closest_wire(mx, my);
|
||||
find_closest_text(mx, my, override_lock);
|
||||
find_closest_wire(mx, my, override_lock);
|
||||
find_closest_element(mx, my, override_lock);
|
||||
return sel; /*sel.type = 0 if nothing found */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -678,7 +678,7 @@ static void print_wires(void)
|
|||
ptr=xctx->wire_spatial_table[0][1];
|
||||
while(ptr)
|
||||
{
|
||||
select_wire(ptr->n,SELECTED, 1);
|
||||
select_wire(ptr->n,SELECTED, 1, 1);
|
||||
rebuild_selected_array();
|
||||
ptr=ptr->next;
|
||||
}
|
||||
|
|
|
|||
10
src/paste.c
10
src/paste.c
|
|
@ -48,7 +48,7 @@ static void merge_text(FILE *fd)
|
|||
xctx->text[i].sel=0;
|
||||
load_ascii_string(&xctx->text[i].prop_ptr,fd);
|
||||
set_text_flags(&xctx->text[i]);
|
||||
select_text(i,SELECTED, 1);
|
||||
select_text(i,SELECTED, 1, 1);
|
||||
xctx->texts++;
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ static void merge_wire(FILE *fd)
|
|||
load_ascii_string( &ptr, fd);
|
||||
storeobject(-1, x1,y1,x2,y2,WIRE,0,SELECTED,ptr);
|
||||
my_free(_ALLOC_ID_, &ptr);
|
||||
select_wire(i, SELECTED, 1);
|
||||
select_wire(i, SELECTED, 1, 1);
|
||||
}
|
||||
|
||||
static void merge_box(FILE *fd)
|
||||
|
|
@ -172,7 +172,7 @@ static void merge_arc(FILE *fd)
|
|||
ptr[i].dash = 0;
|
||||
}
|
||||
|
||||
select_arc(c,i, SELECTED, 1);
|
||||
select_arc(c,i, SELECTED, 1, 1);
|
||||
xctx->arcs[c]++;
|
||||
}
|
||||
|
||||
|
|
@ -232,7 +232,7 @@ static void merge_polygon(FILE *fd)
|
|||
ptr[i].dash = 0;
|
||||
}
|
||||
|
||||
select_polygon(c,i, SELECTED, 1);
|
||||
select_polygon(c,i, SELECTED, 1, 1);
|
||||
xctx->polygons[c]++;
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ static void merge_line(FILE *fd)
|
|||
ptr[i].bus = 1;
|
||||
else
|
||||
ptr[i].bus = 0;
|
||||
select_line(c,i, SELECTED, 1);
|
||||
select_line(c,i, SELECTED, 1, 1);
|
||||
xctx->lines[c]++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4960,7 +4960,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int n=atoi(argv[3]);
|
||||
int valid = n < xctx->wires && n >= 0;
|
||||
if(valid) {
|
||||
select_wire(n, sel, fast);
|
||||
select_wire(n, sel, fast, 1);
|
||||
xctx->ui_state |= SELECTION;
|
||||
}
|
||||
Tcl_SetResult(interp, valid ? "1" : "0" , TCL_STATIC);
|
||||
|
|
@ -4970,7 +4970,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int n=atoi(argv[4]);
|
||||
int valid = n < xctx->lines[c] && n >= 0 && c < cadlayers && c >= 0;
|
||||
if(valid) {
|
||||
select_line(c, n, sel, fast);
|
||||
select_line(c, n, sel, fast, 0);
|
||||
xctx->ui_state |= SELECTION;
|
||||
}
|
||||
Tcl_SetResult(interp, valid ? "1" : "0" , TCL_STATIC);
|
||||
|
|
@ -4990,7 +4990,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int n=atoi(argv[4]);
|
||||
int valid = n < xctx->arcs[c] && n >= 0 && c < cadlayers && c >= 0;
|
||||
if(valid) {
|
||||
select_arc(c, n, sel, fast);
|
||||
select_arc(c, n, sel, fast, 0);
|
||||
xctx->ui_state |= SELECTION;
|
||||
}
|
||||
Tcl_SetResult(interp, valid ? "1" : "0" , TCL_STATIC);
|
||||
|
|
@ -5000,7 +5000,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int n=atoi(argv[4]);
|
||||
int valid = n < xctx->polygons[c] && n >= 0 && c < cadlayers && c >= 0;
|
||||
if(valid) {
|
||||
select_polygon(c, n, sel, fast);
|
||||
select_polygon(c, n, sel, fast, 0);
|
||||
xctx->ui_state |= SELECTION;
|
||||
}
|
||||
Tcl_SetResult(interp, valid ? "1" : "0" , TCL_STATIC);
|
||||
|
|
@ -5009,7 +5009,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int n=atoi(argv[3]);
|
||||
int valid = n < xctx->texts && n >= 0;
|
||||
if(valid) {
|
||||
select_text(n, sel, fast);
|
||||
select_text(n, sel, fast, 0);
|
||||
xctx->ui_state |= SELECTION;
|
||||
}
|
||||
Tcl_SetResult(interp, valid ? "1" : "0" , TCL_STATIC);
|
||||
|
|
@ -5936,22 +5936,22 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
select_element(n, SELECTED, 1, 1);
|
||||
break;
|
||||
case WIRE:
|
||||
select_wire(n, SELECTED, 1);
|
||||
select_wire(n, SELECTED, 1, 1);
|
||||
break;
|
||||
case xTEXT:
|
||||
select_text(n, SELECTED, 1);
|
||||
select_text(n, SELECTED, 1, 1);
|
||||
break;
|
||||
case xRECT:
|
||||
select_box(c, n, SELECTED, 1, 0);
|
||||
select_box(c, n, SELECTED, 1, 1);
|
||||
break;
|
||||
case LINE:
|
||||
select_line(c, n, SELECTED, 1);
|
||||
select_line(c, n, SELECTED, 1, 1);
|
||||
break;
|
||||
case POLYGON:
|
||||
select_polygon(c, n, SELECTED, 1);
|
||||
select_polygon(c, n, SELECTED, 1, 1);
|
||||
break;
|
||||
case ARC:
|
||||
select_arc(c, n, SELECTED, 1);
|
||||
select_arc(c, n, SELECTED, 1, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
122
src/select.c
122
src/select.c
|
|
@ -896,10 +896,12 @@ void unselect_all(int dr)
|
|||
}
|
||||
}
|
||||
|
||||
void select_wire(int i,unsigned short select_mode, int fast)
|
||||
void select_wire(int i,unsigned short select_mode, int fast, int override_lock)
|
||||
{
|
||||
char str[1024]; /* overflow safe */
|
||||
/*my_strncpy(s,xctx->wire[i].prop_ptr!=NULL?xctx->wire[i].prop_ptr:"<NULL>",256); */
|
||||
if(!strboolcmp(get_tok_value(xctx->wire[i].prop_ptr, "lock", 0), "true") &&
|
||||
select_mode == SELECTED && !override_lock) return;
|
||||
if( !fast )
|
||||
{
|
||||
my_snprintf(str, S(str), "Info: selected wire: n=%d end1=%d end2=%d\nnode=%s",i,
|
||||
|
|
@ -959,33 +961,33 @@ static int select_attached_items(int inst, const char *name)
|
|||
for(i = 0; i < xctx->lines[c]; i++) {
|
||||
if(!strcmp(name, get_tok_value(xctx->line[c][i].prop_ptr, "name", 0))) {
|
||||
found = 1;
|
||||
select_line(c, i, SELECTED, 1);
|
||||
select_line(c, i, SELECTED, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < xctx->polygons[c]; i++) {
|
||||
if(!strcmp(name, get_tok_value(xctx->poly[c][i].prop_ptr, "name", 0))) {
|
||||
found = 1;
|
||||
select_polygon(c, i, SELECTED, 1);
|
||||
select_polygon(c, i, SELECTED, 1, 1);
|
||||
}
|
||||
}
|
||||
for(i = 0; i < xctx->arcs[c]; i++) {
|
||||
if(!strcmp(name, get_tok_value(xctx->arc[c][i].prop_ptr, "name", 0))) {
|
||||
found = 1;
|
||||
select_arc(c, i, SELECTED, 1);
|
||||
select_arc(c, i, SELECTED, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i = 0; i < xctx->wires; i++) {
|
||||
if(!strcmp(name, get_tok_value(xctx->wire[i].prop_ptr, "name", 0))) {
|
||||
found = 1;
|
||||
select_wire(i, SELECTED, 1);
|
||||
select_wire(i, SELECTED, 1, 1);
|
||||
}
|
||||
}
|
||||
for(i = 0; i < xctx->texts; i++) {
|
||||
if(!strcmp(name, get_tok_value(xctx->text[i].prop_ptr, "name", 0))) {
|
||||
found = 1;
|
||||
select_text(i, SELECTED, 1);
|
||||
select_text(i, SELECTED, 1, 1);
|
||||
}
|
||||
}
|
||||
for(i = 0; i < xctx->instances; i++) {
|
||||
|
|
@ -1059,13 +1061,15 @@ void select_element(int i,unsigned short select_mode, int fast, int override_loc
|
|||
xctx->need_reb_sel_arr=1;
|
||||
}
|
||||
|
||||
void select_text(int i,unsigned short select_mode, int fast)
|
||||
void select_text(int i, unsigned short select_mode, int fast, int override_lock)
|
||||
{
|
||||
char str[1024]; /* overflow safe */
|
||||
char s[256]; /* overflow safe */
|
||||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
#endif
|
||||
if(!strboolcmp(get_tok_value(xctx->text[i].prop_ptr, "lock", 0), "true") &&
|
||||
select_mode == SELECTED && !override_lock) return;
|
||||
if(!fast) {
|
||||
my_strncpy(s,xctx->text[i].prop_ptr!=NULL?xctx->text[i].prop_ptr:"<NULL>",S(s));
|
||||
my_snprintf(str, S(str), "Info: selected text %d: properties: %s", i,s);
|
||||
|
|
@ -1140,7 +1144,7 @@ void select_box(int c, int i, unsigned short select_mode, int fast, int override
|
|||
|
||||
|
||||
|
||||
void select_arc(int c, int i, unsigned short select_mode, int fast)
|
||||
void select_arc(int c, int i, unsigned short select_mode, int fast, int override_lock)
|
||||
{
|
||||
char str[1024]; /* overflow safe */
|
||||
char s[256]; /* overflow safe */
|
||||
|
|
@ -1170,11 +1174,14 @@ void select_arc(int c, int i, unsigned short select_mode, int fast)
|
|||
xctx->need_reb_sel_arr=1;
|
||||
}
|
||||
|
||||
void select_polygon(int c, int i, unsigned short select_mode, int fast )
|
||||
void select_polygon(int c, int i, unsigned short select_mode, int fast, int override_lock )
|
||||
{
|
||||
char str[1024]; /* overflow safe */
|
||||
char s[256]; /* overflow safe */
|
||||
int bezier;
|
||||
|
||||
if(!strboolcmp(get_tok_value(xctx->poly[c][i].prop_ptr, "lock", 0), "true") &&
|
||||
select_mode == SELECTED && !override_lock) return;
|
||||
if(!fast)
|
||||
{
|
||||
my_strncpy(s,xctx->poly[c][i].prop_ptr!=NULL?xctx->poly[c][i].prop_ptr:"<NULL>",S(s));
|
||||
|
|
@ -1199,10 +1206,13 @@ void select_polygon(int c, int i, unsigned short select_mode, int fast )
|
|||
xctx->need_reb_sel_arr=1;
|
||||
}
|
||||
|
||||
void select_line(int c, int i, unsigned short select_mode, int fast )
|
||||
void select_line(int c, int i, unsigned short select_mode, int fast, int override_lock )
|
||||
{
|
||||
char str[1024]; /* overflow safe */
|
||||
char s[256]; /* overflow safe */
|
||||
|
||||
if(!strboolcmp(get_tok_value(xctx->line[c][i].prop_ptr, "lock", 0), "true") &&
|
||||
select_mode == SELECTED && !override_lock) return;
|
||||
if(!fast)
|
||||
{
|
||||
my_strncpy(s,xctx->line[c][i].prop_ptr!=NULL?xctx->line[c][i].prop_ptr:"<NULL>",S(s));
|
||||
|
|
@ -1258,19 +1268,19 @@ Selected select_object(double mx,double my, unsigned short select_mode,
|
|||
{
|
||||
case WIRE:
|
||||
if(xctx->wire[sel.n].sel) xctx->already_selected = 1;
|
||||
select_wire(sel.n, select_mode, 0);
|
||||
select_wire(sel.n, select_mode, 0, override_lock);
|
||||
break;
|
||||
case xTEXT:
|
||||
if(xctx->text[sel.n].sel) xctx->already_selected = 1;
|
||||
select_text(sel.n, select_mode, 0);
|
||||
select_text(sel.n, select_mode, 0, override_lock);
|
||||
break;
|
||||
case LINE:
|
||||
if(xctx->line[sel.col][sel.n].sel) xctx->already_selected = 1;
|
||||
select_line(sel.col, sel.n, select_mode,0);
|
||||
select_line(sel.col, sel.n, select_mode,0, override_lock);
|
||||
break;
|
||||
case POLYGON:
|
||||
if(xctx->poly[sel.col][sel.n].sel) xctx->already_selected = 1;
|
||||
select_polygon(sel.col, sel.n, select_mode,0);
|
||||
select_polygon(sel.col, sel.n, select_mode,0, override_lock);
|
||||
break;
|
||||
case xRECT:
|
||||
if(xctx->rect[sel.col][sel.n].sel) xctx->already_selected = 1;
|
||||
|
|
@ -1278,7 +1288,7 @@ Selected select_object(double mx,double my, unsigned short select_mode,
|
|||
break;
|
||||
case ARC:
|
||||
if(xctx->arc[sel.col][sel.n].sel) xctx->already_selected = 1;
|
||||
select_arc(sel.col,sel.n, select_mode,0);
|
||||
select_arc(sel.col,sel.n, select_mode,0, override_lock);
|
||||
break;
|
||||
case ELEMENT:
|
||||
if(xctx->inst[sel.n].sel) xctx->already_selected = 1;
|
||||
|
|
@ -1325,10 +1335,10 @@ void select_attached_nets(void)
|
|||
for(wptr=xctx->wire_spatial_table[sqx][sqy]; wptr; wptr=wptr->next) {
|
||||
i = wptr->n;
|
||||
if(xctx->wire[i].x1 == x0 && xctx->wire[i].y1 == y0) {
|
||||
select_wire(i,SELECTED1, 1);
|
||||
select_wire(i,SELECTED1, 1, 0);
|
||||
}
|
||||
if(xctx->wire[i].x2 == x0 && xctx->wire[i].y2 == y0) {
|
||||
select_wire(i,SELECTED2, 1);
|
||||
select_wire(i,SELECTED2, 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1351,10 +1361,10 @@ void select_attached_nets(void)
|
|||
i = wptr->n;
|
||||
if(i == wire) continue;
|
||||
if(xctx->wire[i].x1 == x0 && xctx->wire[i].y1 == y0) {
|
||||
select_wire(i,SELECTED1, 1);
|
||||
select_wire(i,SELECTED1, 1, 0);
|
||||
}
|
||||
if(xctx->wire[i].x2 == x0 && xctx->wire[i].y2 == y0) {
|
||||
select_wire(i,SELECTED2, 1);
|
||||
select_wire(i,SELECTED2, 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1381,23 +1391,23 @@ void select_inside(int stretch, double x1,double y1, double x2, double y2, int s
|
|||
if(RECT_INSIDE(xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, x1,y1,x2,y2))
|
||||
{
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
select_wire(i, SELECTED, 1);
|
||||
select_wire(i, SELECTED, 1, 0);
|
||||
}
|
||||
else if(stretch && POINTINSIDE(xctx->wire[i].x1,xctx->wire[i].y1, x1,y1,x2,y2) )
|
||||
{
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_wire(i, SELECTED1, 1);
|
||||
select_wire(i, SELECTED1, 1, 0);
|
||||
}
|
||||
else if(stretch && POINTINSIDE(xctx->wire[i].x2,xctx->wire[i].y2, x1,y1,x2,y2) )
|
||||
{
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_wire(i, SELECTED2, 1);
|
||||
select_wire(i, SELECTED2, 1, 0);
|
||||
}
|
||||
} else {
|
||||
if(RECT_INSIDE(xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, x1,y1,x2,y2))
|
||||
{
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
select_wire(i, 0, 1);
|
||||
select_wire(i, 0, 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1423,7 +1433,7 @@ void select_inside(int stretch, double x1,double y1, double x2, double y2, int s
|
|||
if(RECT_INSIDE(xx1,yy1, xx2, yy2,x1,y1,x2,y2))
|
||||
{
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
sel ? select_text(i, SELECTED, 1): select_text(i, 0, 1);
|
||||
sel ? select_text(i, SELECTED, 1, 0): select_text(i, 0, 1, 0);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
|
|
@ -1432,9 +1442,7 @@ void select_inside(int stretch, double x1,double y1, double x2, double y2, int s
|
|||
{
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
if(sel) {
|
||||
if(strboolcmp(get_tok_value(xctx->inst[i].prop_ptr, "lock", 0), "true")) {
|
||||
select_element(i, SELECTED, 1, 1);
|
||||
}
|
||||
select_element(i, SELECTED, 1, 0);
|
||||
} else {
|
||||
select_element(i, 0, 1, 0);
|
||||
}
|
||||
|
|
@ -1468,14 +1476,14 @@ void select_inside(int stretch, double x1,double y1, double x2, double y2, int s
|
|||
}
|
||||
if(flag) {
|
||||
if(selected_points==0) {
|
||||
select_polygon(c, i, 0, 1);
|
||||
select_polygon(c, i, 0, 1, 0);
|
||||
}
|
||||
if(selected_points==xctx->poly[c][i].points) {
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_polygon(c, i, SELECTED, 1);
|
||||
select_polygon(c, i, SELECTED, 1, 0);
|
||||
} else if(selected_points) {
|
||||
/* for polygon, SELECTED1 means partial sel */
|
||||
if(sel && stretch) select_polygon(c, i, SELECTED1,1);
|
||||
if(sel && stretch) select_polygon(c, i, SELECTED1, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1486,23 +1494,23 @@ void select_inside(int stretch, double x1,double y1, double x2, double y2, int s
|
|||
if(RECT_INSIDE(xctx->line[c][i].x1,xctx->line[c][i].y1,xctx->line[c][i].x2,xctx->line[c][i].y2, x1,y1,x2,y2))
|
||||
{
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_line(c,i,SELECTED,1);
|
||||
select_line(c, i, SELECTED, 1, 0);
|
||||
}
|
||||
else if(stretch && POINTINSIDE(xctx->line[c][i].x1,xctx->line[c][i].y1, x1,y1,x2,y2) )
|
||||
{
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
select_line(c, i,SELECTED1,1);
|
||||
select_line(c, i, SELECTED1, 1, 0);
|
||||
}
|
||||
else if(stretch && POINTINSIDE(xctx->line[c][i].x2,xctx->line[c][i].y2, x1,y1,x2,y2) )
|
||||
{
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_line(c, i,SELECTED2,1);
|
||||
select_line(c, i, SELECTED2, 1, 0);
|
||||
}
|
||||
} else {
|
||||
if(RECT_INSIDE(xctx->line[c][i].x1,xctx->line[c][i].y1,xctx->line[c][i].x2,xctx->line[c][i].y2, x1,y1,x2,y2))
|
||||
{
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_line(c,i,0,1);
|
||||
select_line(c, i, 0, 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1519,22 +1527,22 @@ void select_inside(int stretch, double x1,double y1, double x2, double y2, int s
|
|||
arc_bbox(x, y, r, a, b, &tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2);
|
||||
if(RECT_INSIDE(tmp.x1, tmp.y1, tmp.x2, tmp.y2, x1,y1,x2,y2)) {
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
sel? select_arc(c, i, SELECTED,1): select_arc(c, i, 0,1);
|
||||
sel? select_arc(c, i, SELECTED,1, 0): select_arc(c, i, 0,1, 0);
|
||||
}
|
||||
else if( sel && stretch && POINTINSIDE(x, y, x1, y1, x2, y2) )
|
||||
{
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
select_arc(c, i,SELECTED1,1);
|
||||
select_arc(c, i,SELECTED1,1, 0);
|
||||
}
|
||||
else if( sel && stretch && POINTINSIDE(xb, yb, x1, y1, x2, y2) )
|
||||
{
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
select_arc(c, i,SELECTED3,1);
|
||||
select_arc(c, i,SELECTED3,1, 0);
|
||||
}
|
||||
else if( sel && stretch && POINTINSIDE(xa, ya, x1, y1, x2, y2) )
|
||||
{
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
select_arc(c, i,SELECTED2,1);
|
||||
select_arc(c, i,SELECTED2,1, 0);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
|
|
@ -1545,9 +1553,7 @@ void select_inside(int stretch, double x1,double y1, double x2, double y2, int s
|
|||
|
||||
|
||||
if(sel) {
|
||||
if(strboolcmp(get_tok_value(xctx->rect[c][i].prop_ptr, "lock", 0), "true")) {
|
||||
select_box(c,i, SELECTED, 1, 1);
|
||||
}
|
||||
select_box(c,i, SELECTED, 1, 0);
|
||||
} else {
|
||||
select_box(c,i, 0, 1, 0);
|
||||
}
|
||||
|
|
@ -1609,7 +1615,7 @@ void select_touch(double x1,double y1, double x2, double y2, int sel) /*added un
|
|||
ly2 = xctx->wire[i].y2;
|
||||
if(lineclip(&lx1, &ly1, &lx2, &ly2, x1,y1,x2,y2)) {
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
sel ? select_wire(i,SELECTED, 1): select_wire(i,0, 1);
|
||||
sel ? select_wire(i,SELECTED, 1, 0): select_wire(i,0, 1, 0);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
|
|
@ -1635,7 +1641,7 @@ void select_touch(double x1,double y1, double x2, double y2, int sel) /*added un
|
|||
if(RECT_TOUCH(xx1, yy1, xx2, yy2,x1,y1,x2,y2))
|
||||
{
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
sel ? select_text(i, SELECTED, 1): select_text(i, 0, 1);
|
||||
sel ? select_text(i, SELECTED, 1, 0): select_text(i, 0, 1, 0);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
|
|
@ -1644,9 +1650,7 @@ void select_touch(double x1,double y1, double x2, double y2, int sel) /*added un
|
|||
{
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
if(sel) {
|
||||
if(strboolcmp(get_tok_value(xctx->inst[i].prop_ptr, "lock", 0), "true")) {
|
||||
select_element(i, SELECTED, 1, 1);
|
||||
}
|
||||
select_element(i, SELECTED, 1, 0);
|
||||
} else {
|
||||
select_element(i, 0, 1, 0);
|
||||
}
|
||||
|
|
@ -1670,7 +1674,7 @@ void select_touch(double x1,double y1, double x2, double y2, int sel) /*added un
|
|||
}
|
||||
}
|
||||
if(flag) {
|
||||
sel ? select_polygon(c, i, SELECTED, 1): select_polygon(c, i, 0, 1);
|
||||
sel ? select_polygon(c, i, SELECTED, 1, 0): select_polygon(c, i, 0, 1, 0);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->lines[c]; ++i)
|
||||
|
|
@ -1682,7 +1686,7 @@ void select_touch(double x1,double y1, double x2, double y2, int sel) /*added un
|
|||
ly2 = xctx->line[c][i].y2;
|
||||
if(lineclip(&lx1, &ly1, &lx2, &ly2, x1,y1,x2,y2)) {
|
||||
xctx->ui_state |= SELECTION;
|
||||
sel? select_line(c,i,SELECTED,1): select_line(c,i,0,1);
|
||||
sel? select_line(c, i, SELECTED, 1, 0): select_line(c, i, 0, 1, 0);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->arcs[c]; ++i) {
|
||||
|
|
@ -1698,7 +1702,7 @@ void select_touch(double x1,double y1, double x2, double y2, int sel) /*added un
|
|||
arc_bbox(x, y, r, a, b, &tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2);
|
||||
if(RECT_TOUCH(tmp.x1, tmp.y1, tmp.x2, tmp.y2, x1,y1,x2,y2)) {
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
sel? select_arc(c, i, SELECTED,1): select_arc(c, i, 0,1);
|
||||
sel? select_arc(c, i, SELECTED,1, 0): select_arc(c, i, 0,1, 0);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
|
|
@ -1707,9 +1711,7 @@ void select_touch(double x1,double y1, double x2, double y2, int sel) /*added un
|
|||
{
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
if(sel) {
|
||||
if(strboolcmp(get_tok_value(xctx->rect[c][i].prop_ptr, "lock", 0), "true")) {
|
||||
select_box(c,i, SELECTED, 1, 1);
|
||||
}
|
||||
select_box(c,i, SELECTED, 1, 0);
|
||||
} else {
|
||||
select_box(c,i, 0, 1, 0);
|
||||
}
|
||||
|
|
@ -1797,33 +1799,35 @@ void select_all(void)
|
|||
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
select_wire(i,SELECTED, 1);
|
||||
select_wire(i,SELECTED, 1, 0);
|
||||
}
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
select_text(i, SELECTED, 1);
|
||||
select_text(i, SELECTED, 1, 0);
|
||||
}
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
{
|
||||
select_element(i,SELECTED,1, 0);
|
||||
select_element(i, SELECTED, 1, 0);
|
||||
/* following not done in select_element() due to fast=1 argument */
|
||||
select_attached_items(i, get_tok_value(xctx->inst[i].prop_ptr, "attach", 0));
|
||||
}
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
for(i=0;i<xctx->polygons[c]; ++i)
|
||||
{
|
||||
select_polygon(c,i,SELECTED,1);
|
||||
select_polygon(c, i, SELECTED, 1, 0);
|
||||
}
|
||||
for(i=0;i<xctx->lines[c]; ++i)
|
||||
{
|
||||
select_line(c,i,SELECTED,1);
|
||||
select_line(c, i, SELECTED, 1, 0);
|
||||
}
|
||||
for(i=0;i<xctx->arcs[c]; ++i)
|
||||
{
|
||||
select_arc(c,i, SELECTED, 1);
|
||||
select_arc(c, i, SELECTED, 1, 0);
|
||||
}
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
{
|
||||
select_box(c,i, SELECTED, 1, 0);
|
||||
select_box(c, i, SELECTED, 1, 0);
|
||||
}
|
||||
} /* end for c */
|
||||
drawtemparc(xctx->gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
|
|
|||
10
src/xschem.h
10
src/xschem.h
|
|
@ -1690,13 +1690,13 @@ extern const char *expandlabel(const char *s, int *m);
|
|||
extern void parse(const char *s);
|
||||
extern void clear_expandlabel_data(void);
|
||||
extern void merge_file(int selection_load, const char ext[]);
|
||||
extern void select_wire(int i, unsigned short select_mode, int fast);
|
||||
extern void select_wire(int i, unsigned short select_mode, int fast, int override_lock);
|
||||
extern void select_element(int i, unsigned short select_mode, int fast, int override_lock);
|
||||
extern void select_text(int i, unsigned short select_mode, int fast);
|
||||
extern void select_text(int i, unsigned short select_mode, int fast, int override_lock);
|
||||
extern void select_box(int c, int i, unsigned short select_mode, int fast, int override_lock);
|
||||
extern void select_arc(int c, int i, unsigned short select_mode, int fast);
|
||||
extern void select_line(int c, int i, unsigned short select_mode, int fast);
|
||||
extern void select_polygon(int c, int i, unsigned short select_mode, int fast );
|
||||
extern void select_arc(int c, int i, unsigned short select_mode, int fast, int override_lock);
|
||||
extern void select_line(int c, int i, unsigned short select_mode, int fast, int override_lock);
|
||||
extern void select_polygon(int c, int i, unsigned short select_mode, int fast, int override_lock );
|
||||
extern const char *net_name(int i, int j, int *mult, int hash_prefix_unnamed_net, int erc);
|
||||
extern int record_global_node(int what, FILE *fp, const char *node);
|
||||
extern int count_items(const char *s, const char *sep, const char *quote);
|
||||
|
|
|
|||
Loading…
Reference in New Issue