add crosshair_layer tcl variable, so user can change crosshair layer.Crosshair is deleted on LeaveNotify events.
This commit is contained in:
parent
db1bf8818a
commit
64cb20dab9
|
|
@ -997,7 +997,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
void draw_crosshair(int del)
|
||||
{
|
||||
int sdw, sdp;
|
||||
dbg(1, "draw_crosshair()\n");
|
||||
dbg(1, "draw_crosshair(): del=%d\n", del);
|
||||
sdw = xctx->draw_window;
|
||||
sdp = xctx->draw_pixmap;
|
||||
|
||||
|
|
@ -1015,18 +1015,18 @@ void draw_crosshair(int del)
|
|||
4 * INT_WIDTH(xctx->lw), xctx->xrect[0].height,
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 2 * INT_WIDTH(xctx->lw), 0);
|
||||
}
|
||||
draw_selection(xctx->gc[SELLAYER], 0);
|
||||
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,
|
||||
drawline(xctx->crosshair_layer, NOW,X_TO_XSCHEM( xctx->areax1), xctx->mousey_snap,
|
||||
X_TO_XSCHEM(xctx->areax2), xctx->mousey_snap, 3, NULL);
|
||||
drawline(TEXTLAYER, NOW, xctx->mousex_snap, Y_TO_XSCHEM(xctx->areay1),
|
||||
drawline(xctx->crosshair_layer, NOW, xctx->mousex_snap, Y_TO_XSCHEM(xctx->areay1),
|
||||
xctx->mousex_snap, Y_TO_XSCHEM(xctx->areay2), 3, NULL);
|
||||
}
|
||||
draw_selection(xctx->gc[SELLAYER], 0);
|
||||
xctx->prev_crossx = xctx->mousex_snap;
|
||||
xctx->prev_crossy = xctx->mousey_snap;
|
||||
|
||||
|
|
@ -1142,6 +1142,9 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
dbg(1, "key=%d EQUAL_MODMASK=%d, SET_MODMASK=%d\n", key, SET_MODMASK, EQUAL_MODMASK);
|
||||
switch(event)
|
||||
{
|
||||
case LeaveNotify:
|
||||
draw_crosshair(1);
|
||||
break;
|
||||
case EnterNotify:
|
||||
if(tclgetboolvar("draw_crosshair"))
|
||||
tclvareval(xctx->top_path, ".drw configure -cursor none" , NULL);
|
||||
|
|
|
|||
|
|
@ -3657,7 +3657,11 @@ void draw(void)
|
|||
#endif
|
||||
|
||||
dbg(1, "draw()\n");
|
||||
|
||||
if(!xctx || xctx->no_draw) return;
|
||||
xctx->crosshair_layer = tclgetintvar("crosshair_layer");
|
||||
if(xctx->crosshair_layer < 0 ) xctx->crosshair_layer = 2;
|
||||
if(xctx->crosshair_layer >= cadlayers ) xctx->crosshair_layer = 2;
|
||||
#if HAS_CAIRO==1
|
||||
#ifndef __unix__
|
||||
clear_cairo_surface(xctx->cairo_save_ctx,
|
||||
|
|
|
|||
|
|
@ -630,6 +630,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->gcstipple=my_calloc(_ALLOC_ID_, cadlayers, sizeof(GC));
|
||||
xctx->color_array=my_calloc(_ALLOC_ID_, cadlayers, sizeof(char*));
|
||||
xctx->enable_layer=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int));
|
||||
xctx->crosshair_layer = TEXTLAYER;
|
||||
xctx->n_active_layers = 0;
|
||||
xctx->active_layer=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int));
|
||||
xctx->hide_symbols = 0;
|
||||
|
|
@ -2481,6 +2482,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
|
||||
/* get xschem globals from tcl variables set in xschemrc/xschem.tcl */
|
||||
cairo_font_line_spacing = tclgetdoublevar("cairo_font_line_spacing");
|
||||
|
||||
if(color_ps==-1)
|
||||
color_ps=atoi(tclgetvar("color_ps"));
|
||||
else {
|
||||
|
|
@ -2489,7 +2491,9 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
}
|
||||
l_width=atoi(tclgetvar("line_width"));
|
||||
if(tclgetboolvar("change_lw")) l_width = 0.0;
|
||||
|
||||
cadlayers=atoi(tclgetvar("cadlayers"));
|
||||
|
||||
fix_broken_tiled_fill = tclgetboolvar("fix_broken_tiled_fill");
|
||||
if(debug_var==-10) debug_var=0;
|
||||
my_snprintf(tmp, S(tmp), "%.16g",CADGRID);
|
||||
|
|
@ -2507,6 +2511,10 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
/* initialize current schematic name to empty string to avoid gazillion checks in the code for NULL */
|
||||
my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], "");
|
||||
|
||||
xctx->crosshair_layer = tclgetintvar("crosshair_layer");
|
||||
if(xctx->crosshair_layer < 0 ) xctx->crosshair_layer = 2;
|
||||
if(xctx->crosshair_layer >= cadlayers ) xctx->crosshair_layer = 2;
|
||||
|
||||
/* global context / graphic preferences/settings */
|
||||
pixdata=my_calloc(_ALLOC_ID_, cadlayers, sizeof(char*));
|
||||
for(i=0;i<cadlayers; ++i)
|
||||
|
|
|
|||
|
|
@ -916,6 +916,7 @@ typedef struct {
|
|||
int *enable_layer;
|
||||
int n_active_layers;
|
||||
int *active_layer;
|
||||
int crosshair_layer;
|
||||
char *undo_dirname;
|
||||
char *infowindow_text; /* ERC messages */
|
||||
int cur_undo_ptr;
|
||||
|
|
|
|||
|
|
@ -5589,7 +5589,7 @@ set tctx::global_list {
|
|||
add_all_windows_drives auto_hilight autofocus_mainwindow
|
||||
autotrim_wires bespice_listen_port big_grid_points bus_replacement_char cadgrid cadlayers
|
||||
cadsnap cairo_font_name change_lw color_ps colors compare_sch constrained_move
|
||||
copy_cell custom_label_prefix custom_token dark_colors dark_colorscheme
|
||||
copy_cell crosshair_layer custom_label_prefix custom_token dark_colors dark_colorscheme
|
||||
delay_flag dim_bg dim_value
|
||||
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
|
||||
|
|
@ -5762,7 +5762,7 @@ global env has_x OS autofocus_mainwindow
|
|||
}
|
||||
}
|
||||
"
|
||||
bind $topwin <Leave> "graph_show_measure stop"
|
||||
bind $topwin <Leave> "xschem callback %W %T %x %y 0 0 0 %s; graph_show_measure stop"
|
||||
bind $topwin <Expose> "xschem callback %W %T %x %y 0 %w %h %s"
|
||||
bind $topwin <Double-Button-1> "xschem callback %W -3 %x %y 0 %b 0 %s"
|
||||
bind $topwin <Double-Button-2> "xschem callback %W -3 %x %y 0 %b 0 %s"
|
||||
|
|
@ -6761,6 +6761,7 @@ set_ne split_files 0
|
|||
set_ne flat_netlist 0
|
||||
set_ne netlist_show 0
|
||||
set_ne color_ps 1
|
||||
set_ne crosshair_layer 3 ;# TEXTLAYER
|
||||
set_ne ps_paper_size {a4 842 595}
|
||||
set_ne transparent_svg 0
|
||||
set_ne only_probes 0 ; # 20110112
|
||||
|
|
|
|||
|
|
@ -213,6 +213,9 @@
|
|||
#### enable drawing crosshairs at mouse coordinates. Default: disabled (0)
|
||||
# set draw_crosshair 1
|
||||
|
||||
#### set crosshair layer; Default 3 (TEXTLAYER)
|
||||
# set crosshair_layer 3
|
||||
|
||||
#### 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