diff --git a/src/callback.c b/src/callback.c index 13d1dce4..986a166b 100644 --- a/src/callback.c +++ b/src/callback.c @@ -3879,7 +3879,6 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m if(state & ControlMask) { /* change line width */ xctx->lw = round_to_n_digits(xctx->lw + 0.5, 2); change_linewidth(xctx->lw); - tclsetboolvar("change_lw", 0); draw(); } break; @@ -3889,11 +3888,10 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m xctx->lw = round_to_n_digits(xctx->lw - 0.5, 2); if(xctx->lw < 0.0) xctx->lw = 0.0; change_linewidth(xctx->lw); - tclsetboolvar("change_lw", 0); draw(); } else if(EQUAL_MODMASK) { - tcleval("set change_lw 0; input_line \"Enter linewidth (float):\" \"xschem line_width\""); + tcleval("input_line \"Enter linewidth (float):\" \"xschem line_width\""); } break; diff --git a/src/xinit.c b/src/xinit.c index 4498d0ae..bdad71e9 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -512,6 +512,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) xctx->ui_state = 0; xctx->ui_state2 = 0; xctx->lw = 0.0; + xctx->min_lw = 0; xctx->need_reb_sel_arr = 1; xctx->lastsel = 0; xctx->maxsel = 0; @@ -2077,10 +2078,11 @@ void change_linewidth(double w) } /* explicitly set line width */ } else { + xctx->min_lw = (int)w; xctx->lw=w; } + linew = XLINEWIDTH(xctx->lw); if(has_x) { - linew = INT_WIDTH(xctx->lw); dbg(1, "Line width = %d\n", linew); for(i=0;igc[i], linew, LineSolid, LINECAP , LINEJOIN); @@ -2097,8 +2099,8 @@ void change_linewidth(double w) } #if HAS_CAIRO==1 if(has_x) { - cairo_set_line_width(xctx->cairo_ctx, INT_WIDTH(xctx->lw)); - cairo_set_line_width(xctx->cairo_save_ctx, INT_WIDTH(xctx->lw)); + cairo_set_line_width(xctx->cairo_ctx, linew); + cairo_set_line_width(xctx->cairo_save_ctx, linew); } #endif } diff --git a/src/xschem.h b/src/xschem.h index 73462014..e0cead37 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -422,8 +422,8 @@ do { \ #define SWAP(a,b, tmp) do { tmp = a; a = b; b = tmp; } while(0) -#define XLINEWIDTH(x) ( tclgetboolvar("change_lw") ? ( (int)(x) == 0 ? 1 : (int)(x) ) : (int)(x) ) -#define INT_WIDTH(x) ((int)(x) == 0 ? 1 : (int)(x)) +#define XLINEWIDTH(x) MAJOR((tclgetboolvar("change_lw") ? ((int)(x) == 0 ? 1 : (int)(x)) : (int)(x)), xctx->min_lw) +#define INT_WIDTH(x) MAJOR(((int)(x) == 0 ? 1 : (int)(x)), xctx->min_lw) #define INT_BUS_WIDTH(x) ( (int)( (BUS_WIDTH) * (x) ) == 0 ? 1 : (int)( (BUS_WIDTH) * (x) ) ) /* set do double if you need more precision at the expense of memory */ @@ -942,6 +942,7 @@ typedef struct { double zoom; double mooz; double lw; + int min_lw; /* minimum allowed line width (for UHD displays) */ unsigned int ui_state; /* this signals that we are doing a net place,panning etc. * used to prevent nesting of some commands */ unsigned int ui_state2; /* sub states of ui_state MENUSTART bit */ diff --git a/src/xschem.tcl b/src/xschem.tcl index 8524cbcf..5eeb7739 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -9110,7 +9110,6 @@ proc build_widgets { {topwin {} } } { -selectcolor $selectcolor -accelerator {_} $topwin.menubar.view add command -label "Set line width" -accelerator {Alt+-} \ -command { - set change_lw 0 input_line "Enter linewidth (float):" "xschem line_width" } $topwin.menubar.view add command -label "Set grid point size" \