add draw_crosshair setting in xschemrc: draw a crosshair at mouse coordinates
This commit is contained in:
parent
a1fbbcfd80
commit
8f0d920a96
|
|
@ -508,6 +508,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li><kbd> abort_operation</kbd></li><pre>
|
||||
|
|
@ -846,7 +847,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
open file or opening a new(not existing) file.
|
||||
'noundoreset': do not reset the undo history
|
||||
'symbol': do not load symbols (used if loading a symbol instead of a schematic)
|
||||
'nofullzoom': do not do a fll zoom on new schematic.</pre>
|
||||
'nofullzoom': do not do a full zoom on new schematic.</pre>
|
||||
<li><kbd> load_new_window [f]</kbd></li><pre>
|
||||
Load schematic in a new tab/window. If 'f' not given prompt user
|
||||
if 'f' is given as empty '{}' then open untitled.sch </pre>
|
||||
|
|
@ -1269,10 +1270,11 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
<li><kbd> wire [x1 y1 x2 y2] [pos] [prop] [sel]</kbd></li><pre>
|
||||
Place a new wire
|
||||
if no coordinates are given start a GUI wire placement </pre>
|
||||
<li><kbd> wire_cut [x y]</kbd></li><pre>
|
||||
<li><kbd> wire_cut [x y] [noalign]</kbd></li><pre>
|
||||
start a wire cut operation. Point the mouse in the middle of a wire and
|
||||
click left button.
|
||||
if x and y are given cut wire at given point </pre>
|
||||
Alt-click right button.
|
||||
if x and y are given cut wire at given point
|
||||
if noalign is given and is set to 'noalign' do not align the cut point to closest snap point </pre>
|
||||
<li><kbd> xcb_info</kbd></li><pre>
|
||||
For debug </pre>
|
||||
<li><kbd> zoom_box [x1 y1 x2 y2] [factor]</kbd></li><pre>
|
||||
|
|
@ -1319,7 +1321,6 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -45,11 +45,15 @@ static int waves_selected(int event, KeySym key, int state, int button)
|
|||
POINTINSIDE(xctx->mousex, xctx->mousey, r->x1, r->y1, r->x2 - 40, r->y1 + 20) ||
|
||||
POINTINSIDE(xctx->mousex, xctx->mousey, r->x1 + 20, r->y1, r->x2 - 30, r->y2 - 10) ) {
|
||||
is_inside = 1;
|
||||
draw_crosshair(1);
|
||||
tclvareval(xctx->top_path, ".drw configure -cursor tcross" , NULL);
|
||||
}
|
||||
}
|
||||
if(!is_inside) {
|
||||
tclvareval(xctx->top_path, ".drw configure -cursor {}" , NULL);
|
||||
if(tclgetboolvar("draw_crosshair"))
|
||||
tclvareval(xctx->top_path, ".drw configure -cursor none" , NULL);
|
||||
else
|
||||
tclvareval(xctx->top_path, ".drw configure -cursor {}" , NULL);
|
||||
if(xctx->graph_flags & 64) {
|
||||
tcleval("graph_show_measure stop");
|
||||
}
|
||||
|
|
@ -974,6 +978,50 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
return 0;
|
||||
}
|
||||
|
||||
void draw_crosshair(int del)
|
||||
{
|
||||
int sdw, sdp;
|
||||
|
||||
|
||||
sdw = xctx->draw_window;
|
||||
sdp = xctx->draw_pixmap;
|
||||
|
||||
xctx->draw_pixmap = 0;
|
||||
xctx->draw_window = 1;
|
||||
|
||||
bbox(START,0.0, 0.0, 0.0, 0.0);
|
||||
bbox(ADD, X_TO_XSCHEM(xctx->areax1), xctx->prev_crossy - xctx->lw,
|
||||
X_TO_XSCHEM(xctx->areax2), xctx->prev_crossy + xctx->lw);
|
||||
bbox(SET, 0.0, 0.0, 0.0, 0.0);
|
||||
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0], xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y);
|
||||
bbox(END, 0.0, 0.0, 0.0, 0.0);
|
||||
bbox(START,0.0, 0.0, 0.0, 0.0);
|
||||
bbox(ADD, xctx->prev_crossx - xctx->lw, Y_TO_XSCHEM(xctx->areay1),
|
||||
xctx->prev_crossx + xctx->lw, Y_TO_XSCHEM(xctx->areay2));
|
||||
bbox(SET, 0.0, 0.0, 0.0, 0.0);
|
||||
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0], xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y);
|
||||
bbox(END, 0.0, 0.0, 0.0, 0.0);
|
||||
draw_selection(xctx->gc[SELLAYER], 1);
|
||||
drawtempline(xctx->gctiled, NOW, X_TO_XSCHEM(xctx->areax1),
|
||||
xctx->prev_crossy, X_TO_XSCHEM(xctx->areax2), xctx->prev_crossy);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->prev_crossx, Y_TO_XSCHEM(xctx->areay1),
|
||||
xctx->prev_crossx, Y_TO_XSCHEM(xctx->areay2));
|
||||
|
||||
if(!del) {
|
||||
drawline(TEXTLAYER, NOW,X_TO_XSCHEM( xctx->areax1), xctx->mousey_snap,
|
||||
X_TO_XSCHEM(xctx->areax2), xctx->mousey_snap, 2, NULL);
|
||||
drawline(TEXTLAYER, NOW, xctx->mousex_snap, Y_TO_XSCHEM(xctx->areay1),
|
||||
xctx->mousex_snap, Y_TO_XSCHEM(xctx->areay2), 2, NULL);
|
||||
}
|
||||
xctx->prev_crossx = xctx->mousex_snap;
|
||||
xctx->prev_crossy = xctx->mousey_snap;
|
||||
|
||||
xctx->draw_window = sdw;
|
||||
xctx->draw_pixmap = sdp;
|
||||
}
|
||||
|
||||
/* main window callback */
|
||||
/* mx and my are set to the mouse coord. relative to window */
|
||||
/* winpath: set to .drw or sub windows .x1.drw, .x2.drw, ... */
|
||||
|
|
@ -992,7 +1040,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
#else
|
||||
XKeyboardState kbdstate;
|
||||
#endif
|
||||
|
||||
int draw_xhair = tclgetboolvar("draw_crosshair");
|
||||
|
||||
#ifndef __unix__
|
||||
if(cstate & 0x0001) { /* caps lock */
|
||||
|
|
@ -1073,6 +1121,10 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
switch(event)
|
||||
{
|
||||
case EnterNotify:
|
||||
if(tclgetboolvar("draw_crosshair"))
|
||||
tclvareval(xctx->top_path, ".drw configure -cursor none" , NULL);
|
||||
else
|
||||
tclvareval(xctx->top_path, ".drw configure -cursor {}" , NULL);
|
||||
if(!xctx->sel_or_clip[0]) my_snprintf(xctx->sel_or_clip, S(xctx->sel_or_clip), "%s/%s",
|
||||
user_conf_dir, ".selection.sch");
|
||||
|
||||
|
|
@ -1123,6 +1175,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
|
||||
case MotionNotify:
|
||||
|
||||
if( waves_selected(event, key, state, button)) {
|
||||
waves_callback(event, mx, my, key, button, aux, state);
|
||||
break;
|
||||
|
|
@ -1138,6 +1191,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y);
|
||||
}
|
||||
#endif
|
||||
if(draw_xhair) draw_crosshair(0);
|
||||
if(xctx->semaphore >= 2) break;
|
||||
if(xctx->ui_state) {
|
||||
if(abs(mx-xctx->mx_save) > 8 || abs(my-xctx->my_save) > 8 ) {
|
||||
|
|
@ -2795,7 +2849,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
xctx->my_double_save=xctx->mousey_snap;
|
||||
if( !(state & ShiftMask) && !(state & Mod1Mask) ) {
|
||||
unselect_all(1);
|
||||
#if defined(FIX_BROKEN_TILED_FILL) || !defined(__unix__)
|
||||
#if defined(FIX_BROKEN_TILED_FILL) || !defined(__unix__)
|
||||
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0], xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y);
|
||||
#endif
|
||||
|
|
@ -2854,6 +2908,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
/* 20150927 filter out button4 and button5 events */
|
||||
if(!(state&(Button4Mask|Button5Mask) ) ) select_rect(END,-1);
|
||||
}
|
||||
if(draw_xhair) draw_crosshair(0);
|
||||
rebuild_selected_array();
|
||||
my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d path: %s",
|
||||
xctx->mousex_snap, xctx->mousey_snap, xctx->lastsel, xctx->sch_path[xctx->currsch] );
|
||||
|
|
|
|||
|
|
@ -195,9 +195,11 @@ void draw_selection(GC g, int interruptable)
|
|||
|
||||
if(g != xctx->gctiled) xctx->movelastsel = xctx->lastsel;
|
||||
#if defined(FIX_BROKEN_TILED_FILL)
|
||||
else
|
||||
else {
|
||||
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0], xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y);
|
||||
if(tclgetboolvar("draw_crosshair")) draw_crosshair(0);
|
||||
}
|
||||
#endif
|
||||
for(i=0;i<xctx->movelastsel; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -605,6 +605,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->gridpoint=(XPoint*)my_calloc(_ALLOC_ID_, CADMAXGRIDPOINTS,sizeof(XPoint));
|
||||
xctx->enable_drill = 0;
|
||||
xctx->prev_set_modify = -1;
|
||||
xctx->prev_crossx = xctx->prev_crossy = 0.0;
|
||||
xctx->pending_fullzoom = 0;
|
||||
my_strncpy(xctx->hiersep, ".", S(xctx->hiersep));
|
||||
xctx->no_undo = 0;
|
||||
|
|
|
|||
|
|
@ -971,6 +971,8 @@ typedef struct {
|
|||
/* pan */
|
||||
double xpan,ypan,xpan2,ypan2;
|
||||
double p_xx1,p_xx2,p_yy1,p_yy2;
|
||||
/* draw_crosshair */
|
||||
double prev_crossx, prev_crossy;
|
||||
/* set_modify */
|
||||
int prev_set_modify;
|
||||
/* pan */
|
||||
|
|
@ -1270,6 +1272,7 @@ extern void select_inside(double x1,double y1, double x2, double y2, int sel);
|
|||
extern int select_dangling_nets(void);
|
||||
extern int Tcl_AppInit(Tcl_Interp *interp);
|
||||
extern void abort_operation(void);
|
||||
extern void draw_crosshair(int del);
|
||||
extern int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
||||
int button, int aux, int state);
|
||||
extern void resetwin(int create_pixmap, int clear_pixmap, int force, int w, int h);
|
||||
|
|
|
|||
|
|
@ -5568,7 +5568,7 @@ set tctx::global_list {
|
|||
cadsnap cairo_font_name change_lw color_ps colors compare_sch connect_by_kissing constrained_move
|
||||
copy_cell custom_label_prefix custom_token dark_colors dark_colorscheme
|
||||
delay_flag dim_bg dim_value
|
||||
disable_unique_names do_all_inst draw_grid draw_window edit_prop_pos edit_prop_size
|
||||
disable_unique_names do_all_inst draw_crosshair draw_grid draw_window edit_prop_pos edit_prop_size
|
||||
edit_symbol_prop_new_sel editprop_sympath en_hilight_conn_inst enable_dim_bg enable_stretch
|
||||
filetmp flat_netlist fullscreen gaw_fd gaw_tcp_address graph_bus graph_change_done graph_digital
|
||||
graph_linewidth_mult graph_logx
|
||||
|
|
@ -6726,6 +6726,7 @@ set_ne incr_hilight 1
|
|||
set_ne enable_stretch 0
|
||||
set_ne constrained_move 0
|
||||
set_ne connect_by_kissing 0
|
||||
set_ne draw_crosshair 0
|
||||
set_ne draw_grid 1
|
||||
set_ne big_grid_points 0
|
||||
set_ne persistent_command 0
|
||||
|
|
|
|||
|
|
@ -195,6 +195,12 @@
|
|||
#### disable some symbol layers. Default: none, all layers are visible.
|
||||
# set enable_layer(5) 0 ;# example to disable pin red boxes
|
||||
|
||||
#### enable drawing the grid. Default: enabled (1)
|
||||
# set draw_grid 1
|
||||
|
||||
#### enable drawing crosshairs at mouse coordinates. Default: disabled (0)
|
||||
# set draw_crosshair 1
|
||||
|
||||
#### enable to scale grid point size as done with lines at close zoom, default: 0
|
||||
# set big_grid_points 0
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue