Alt-x to toggle crosshair display, removed alt-x and ctrl-shift-X for compare schematic functions (seldom used) improved calculation of `delta` in drawgrid, improved search() (added missing arcs and polygon attribute searches)

This commit is contained in:
stefan schippers 2024-03-10 12:11:51 +01:00
parent 64bfb94b86
commit 90241d2463
6 changed files with 79 additions and 14 deletions

View File

@ -223,6 +223,7 @@ shift 'W' Place wire, snapping to closest pin or net endpoint
ctrl 'x' Cut into clipboard
- 'x' New cad session
shift 'X' Highlight discrepancies between object ports and attached nets
alt 'x' Toggle draw crosshair at mouse position
- 'y' Toggle stretching wires
- 'z' Zoom box
shift 'Z' Zoom in

View File

@ -2604,17 +2604,12 @@ int rstate; /* (reduced state, without ShiftMask) */
}
break;
}
if(key=='X' && rstate == ControlMask) /* swap compare schematics */
if(key=='x' && EQUAL_MODMASK) /* toggle draw crosshair at mouse pos */
{
tcleval("swap_compare_schematics");
}
if(key=='x' && EQUAL_MODMASK) /* compare schematics(must set first) */
{
unselect_all(0);
if(tclgetboolvar("compare_sch")) {
tclsetvar("compare_sch", "0");
if(tclgetboolvar("draw_crosshair")) {
tclsetvar("draw_crosshair", "0");
} else {
tclsetvar("compare_sch", "1");
tclsetvar("draw_crosshair", "1");
}
draw();
}

View File

@ -911,6 +911,7 @@ static void drawgrid()
int i=0;
int big_gr = tclgetboolvar("big_grid_points");
int axes = tclgetboolvar("draw_grid_axes");
double mult;
#endif
dbg(1, "drawgrid(): draw grid\n");
@ -919,7 +920,16 @@ static void drawgrid()
#if DRAW_ALL_CAIRO==1
set_cairo_color(GRIDLAYER);
#endif
while(delta < CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
if(delta < CADGRIDTHRESHOLD) {
mult = ceil( (log(CADGRIDTHRESHOLD) - log(delta) ) / log(CADGRIDMULTIPLY) );
delta = delta * pow(CADGRIDMULTIPLY, mult);
}
/* while(delta < CADGRIDTHRESHOLD) delta *= CADGRIDMULTIPLY; */ /* <-- to be improved,but works */
#if DRAW_ALL_CAIRO==1
x =floor(xctx->xorigin*xctx->mooz) + 0.5; y = floor(xctx->yorigin*xctx->mooz) + 0.5;
#else

View File

@ -841,6 +841,65 @@ int search(const char *tok, const char *val, int sub, int sel, int match_case)
}
}
if(sel) for(c = 0; c < cadlayers; ++c) for(i=0;i<xctx->arcs[c]; ++i) {
str = get_tok_value(xctx->arc[c][i].prop_ptr, tok,0);
if(xctx->tok_size) {
#ifdef __unix__
if( (!regexec(&re, str,0 , NULL, 0) && !sub ) ||
( !comparefn(str, val) && sub ))
#else
if( (win_regexec(regexp_options, val, str) && !sub ) ||
( !comparefn(str, val) && sub ))
#endif
{
if(sel==1) {
xctx->arc[c][i].sel = SELECTED;
set_first_sel(ARC, i, c);
xctx->need_reb_sel_arr=1;
}
if(sel==-1) {
xctx->arc[c][i].sel = 0;
xctx->need_reb_sel_arr=1;
}
found = 1;
}
else {
dbg(2, "search(): not found arc=%d col=%d, tok=%s, val=%s search=%s\n",
i, c, tok, str, val);
}
}
}
if(sel) for(c = 0; c < cadlayers; ++c) for(i=0;i<xctx->polygons[c]; ++i) {
str = get_tok_value(xctx->poly[c][i].prop_ptr, tok,0);
if(xctx->tok_size) {
#ifdef __unix__
if( (!regexec(&re, str,0 , NULL, 0) && !sub ) ||
( !comparefn(str, val) && sub ))
#else
if( (win_regexec(regexp_options, val, str) && !sub ) ||
( !comparefn(str, val) && sub ))
#endif
{
if(sel==1) {
xctx->poly[c][i].sel = SELECTED;
set_first_sel(POLYGON, i, c);
xctx->need_reb_sel_arr=1;
}
if(sel==-1) {
xctx->poly[c][i].sel = 0;
xctx->need_reb_sel_arr=1;
}
found = 1;
}
else {
dbg(2, "search(): not found arc=%d col=%d, tok=%s, val=%s search=%s\n",
i, c, tok, str, val);
}
}
}
if(sel) for(i=0;i<xctx->texts; ++i) {
str = get_tok_value(xctx->text[i].prop_ptr, tok,0);
if(xctx->tok_size) {

View File

@ -183,6 +183,7 @@ shift 'W' Place wire, snapping to closest pin or net endpoint
ctrl 'x' Cut into clipboard
- 'x' New cad session
shift 'X' Highlight discrepancies between object ports and attached nets
alt 'x' Toggle draw crosshair at mouse position
- 'y' Toggle stretching wires
- 'z' Zoom box
shift 'Z' Zoom in

View File

@ -7413,7 +7413,7 @@ proc build_widgets { {topwin {} } } {
-command {xschem set intuitive_interface $intuitive_interface}
$topwin.menubar.option.menu add checkbutton -label "Draw crosshair" \
-variable draw_crosshair -selectcolor $selectcolor
-variable draw_crosshair -selectcolor $selectcolor -accelerator {Alt-X}
$topwin.menubar.option.menu add command -label "Replace \[ and \] for buses in SPICE netlist" \
-command {
@ -7762,15 +7762,14 @@ proc build_widgets { {topwin {} } } {
-label {Set schematic to compare and compare with} \
-command "set compare_sch 1; xschem compare_schematics"
$topwin.menubar.hilight.menu add command \
-label {Swap compare schematics} -accelerator {Ctrl-Shift-X} \
-label {Swap compare schematics} \
-command "swap_compare_schematics"
$topwin.menubar.hilight.menu add checkbutton \
-selectcolor $selectcolor -label {Compare schematics} \
-command {
xschem unselect_all
xschem redraw } \
-variable compare_sch \
-accelerator {Alt-X}
-variable compare_sch
$topwin.menubar.hilight.menu add checkbutton -label "View only Probes" -variable only_probes \
-selectcolor $selectcolor -accelerator {5} \
-command { xschem only_probes }