set line width commands also set minimum allowed line width (good for UHD displays)
This commit is contained in:
parent
8d0837d5e9
commit
c3cb1218a1
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;i<cadlayers; ++i) {
|
||||
XSetLineAttributes(display, xctx->gc[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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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" \
|
||||
|
|
|
|||
Loading…
Reference in New Issue