diff --git a/doc/xschem_man/commands.html b/doc/xschem_man/commands.html index 742fb29c..baf25d69 100644 --- a/doc/xschem_man/commands.html +++ b/doc/xschem_man/commands.html @@ -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 diff --git a/src/callback.c b/src/callback.c index a568c0c7..8a496c25 100644 --- a/src/callback.c +++ b/src/callback.c @@ -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(); } diff --git a/src/draw.c b/src/draw.c index fdb97304..03d721e8 100644 --- a/src/draw.c +++ b/src/draw.c @@ -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 diff --git a/src/hilight.c b/src/hilight.c index 74be8ddc..23e3cf89 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -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;iarcs[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;ipolygons[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;itexts; ++i) { str = get_tok_value(xctx->text[i].prop_ptr, tok,0); if(xctx->tok_size) { diff --git a/src/keys.help b/src/keys.help index 01ec1c4a..77447c51 100644 --- a/src/keys.help +++ b/src/keys.help @@ -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 diff --git a/src/xschem.tcl b/src/xschem.tcl index 5d3fe22b..f158ca2e 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -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 }