From bf10a025d7eb106e082cbf2f33ca9ba9847b8730 Mon Sep 17 00:00:00 2001 From: Ananth Date: Tue, 11 Feb 2025 10:55:29 -0700 Subject: [PATCH] added CD's vars - ortho wiring, snap_cursor, snap_cur size, cadence_compat - all not yet used; use_cursor_for_selection - used; updated xschem.tcl to include in global list and set defaults; callback updated to use use_cursor_for_sel when mouse clicked --- src/callback.c | 3 ++- src/xschem.tcl | 8 +++++++- src/xschemrc | 13 +++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/callback.c b/src/callback.c index 114461b0..133fe31b 100644 --- a/src/callback.c +++ b/src/callback.c @@ -3927,6 +3927,7 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m static void handle_button_press(int event, int state, int rstate, KeySym key, int button, int mx, int my, double c_snap, int draw_xhair, int crosshair_size, int enable_stretch, int aux ) { + int use_cursor_for_sel = tclgetintvar("use_cursor_for_selection"); dbg(1, "callback(): ButtonPress ui_state=%d state=%d\n",xctx->ui_state,state); if(waves_selected(event, key, state, button)) { waves_callback(event, mx, my, key, button, aux, state); @@ -4057,7 +4058,7 @@ static void handle_button_press(int event, int state, int rstate, KeySym key, in /* find closest object. Use snap coordinates if full crosshair is enabled * since the mouse pointer is obscured and crosshair is snapped to grid points */ - if(draw_xhair && crosshair_size == 0) { + if(draw_xhair && (use_cursor_for_sel || crosshair_size == 0)) { sel = find_closest_obj(xctx->mousex_snap, xctx->mousey_snap, 0); } else { sel = find_closest_obj(xctx->mousex, xctx->mousey, 0); diff --git a/src/xschem.tcl b/src/xschem.tcl index 807cbcd7..41fd2800 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -7768,7 +7768,8 @@ set tctx::global_list { toolbar_visible top_is_subckt transparent_svg undo_type use_lab_wire unselect_partial_sel_wires use_label_prefix use_tclreadline user_wants_copy_cell verilog_2001 verilog_bitblast viewdata_fileid viewdata_filename viewdata_w - tctx::vsize xschem_libs xschem_listen_port zoom_full_center + tctx::vsize xschem_libs xschem_listen_port zoom_full_center orthogonal_wiring snap_cursor + snap_cursor_size cadence_compat use_cursor_for_selection } ## list of global arrays to save/restore on context switching @@ -9220,6 +9221,11 @@ set_ne draw_grid_axes 1 set_ne persistent_command 0 set_ne intuitive_interface 1 set_ne infix_interface 1 +set_ne orthogonal_wiring 0 +set_ne snap_cursor 0 +set_ne snap_cursor_size 6 +set_ne cadence_compat 0 +set_ne use_cursor_for_selection 0 set_ne autotrim_wires 0 set_ne compare_sch 0 set_ne disable_unique_names 0 diff --git a/src/xschemrc b/src/xschemrc index 0d1e0bb3..f6dbf330 100644 --- a/src/xschemrc +++ b/src/xschemrc @@ -273,6 +273,19 @@ #### set crosshair size; Default: 0 (full screen spanning crosshair) # set crosshair_size 5 +#### enable drawing a diamond-shaped cursor at the closest circuit endpoint. Default: disabled (0) +# set snap_cursor 1 + +#### set snap_cursor_size; Default: 6 (Diamond-shaped cursor that snaps to nearest circuit endpoint) +# set snap_cursor_size 6 + +#### set cadence_compat; Default: 0 (Cadence-style keybinds are not used by default) +# set cadence_compat 1 + +#### if set, then, when cursor (regardless of style) is on an object, and user clicks (though mouse pointer is not on the object), +#### the object is selected. Default: 0 +# set use_cursor_for_selection 1 + #### enable to scale grid point size as done with lines at close zoom, default: 0 # set big_grid_points 0