draw_crosshair(): more logical what parameter values

This commit is contained in:
stefan schippers 2025-01-25 02:13:59 +01:00
parent 26bfe7691b
commit 4700483fa4
3 changed files with 8 additions and 8 deletions

View File

@ -1335,7 +1335,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
return 0; return 0;
} }
/* what == 0 : delete and draw /* what == 3 : delete and draw
* what == 1 : delete * what == 1 : delete
* what == 2 : draw */ * what == 2 : draw */
void draw_crosshair(int what) void draw_crosshair(int what)
@ -1350,7 +1350,7 @@ void draw_crosshair(int what)
xctx->draw_pixmap = 0; xctx->draw_pixmap = 0;
xctx->draw_window = 1; xctx->draw_window = 1;
if(what != 2) { /* delete previous */ if(what & 1) { /* delete previous */
if(fix_broken_tiled_fill || !_unix) { if(fix_broken_tiled_fill || !_unix) {
if(xhair_size) { if(xhair_size) {
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0], MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0],
@ -1408,7 +1408,7 @@ void draw_crosshair(int what)
} }
} }
} }
if(what != 1) { /* draw new */ if(what & 2) { /* draw new */
if(xhair_size) { if(xhair_size) {
draw_xhair_line(xctx->gc[xctx->crosshair_layer], xhair_size, draw_xhair_line(xctx->gc[xctx->crosshair_layer], xhair_size,
X_TO_SCREEN(xctx->mousex_snap) - xhair_size, X_TO_SCREEN(xctx->mousex_snap) - xhair_size,
@ -1439,7 +1439,7 @@ void draw_crosshair(int what)
X_TO_SCREEN(xctx->mousex_snap), xctx->areay2); X_TO_SCREEN(xctx->mousex_snap), xctx->areay2);
} }
} }
draw_selection(xctx->gc[SELLAYER], 0); if(what) draw_selection(xctx->gc[SELLAYER], 0);
xctx->prev_crossx = xctx->mousex_snap; xctx->prev_crossx = xctx->mousex_snap;
xctx->prev_crossy = xctx->mousey_snap; xctx->prev_crossy = xctx->mousey_snap;
@ -4302,7 +4302,7 @@ int rstate; /* (reduced state, without ShiftMask) */
break; break;
} }
if(draw_xhair) draw_crosshair(0); if(draw_xhair) draw_crosshair(3);
break; break;
case -3: /* double click : edit prop */ case -3: /* double click : edit prop */
if( waves_selected(event, key, state, button)) { if( waves_selected(event, key, state, button)) {

View File

@ -5137,7 +5137,7 @@ void draw(void)
} else { } else {
draw_selection(xctx->gc[SELLAYER], 0); /* 20181009 moved outside of cadlayers loop */ draw_selection(xctx->gc[SELLAYER], 0); /* 20181009 moved outside of cadlayers loop */
} }
if(tclgetboolvar("draw_crosshair")) draw_crosshair(0); if(tclgetboolvar("draw_crosshair")) draw_crosshair(3);
} /* if(has_x) */ } /* if(has_x) */
} }

View File

@ -907,7 +907,7 @@ void copy_objects(int what)
xctx->rotatelocal=0; xctx->rotatelocal=0;
} /* if(what & END) */ } /* if(what & END) */
draw_selection(xctx->gc[SELLAYER], 0); draw_selection(xctx->gc[SELLAYER], 0);
if(tclgetboolvar("draw_crosshair")) draw_crosshair(0); if(tclgetboolvar("draw_crosshair")) draw_crosshair(3);
} }
@ -1361,5 +1361,5 @@ void move_objects(int what, int merge, double dx, double dy)
xctx->rotatelocal=0; xctx->rotatelocal=0;
} /* what & end */ } /* what & end */
draw_selection(xctx->gc[SELLAYER], 0); draw_selection(xctx->gc[SELLAYER], 0);
if(tclgetboolvar("draw_crosshair")) draw_crosshair(0); if(tclgetboolvar("draw_crosshair")) draw_crosshair(3);
} }