From 25f34ee413661569f1aa4c9c0e796d57c78263dc Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Thu, 9 Mar 2023 22:48:25 +0100 Subject: [PATCH] add xschemrc variable zoom_full_center, if set to 1 full zoom will center the schematic instead of anchoring to lower-left drawing area corner. --- src/callback.c | 6 ++++-- src/scheduler.c | 1 + src/xschem.tcl | 5 +++-- src/xschemrc | 4 ++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/callback.c b/src/callback.c index a8c7004d..603053bb 100644 --- a/src/callback.c +++ b/src/callback.c @@ -2377,12 +2377,14 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key, break; } if(key=='f' && state == 0 ) /* full zoom */ - { + { + int flags = 1; if(waves_selected(event, key, state, button)) { waves_callback(event, mx, my, key, button, aux, state); break; } - zoom_full(1, 0, 1, 0.97); + if(tclgetboolvar("zoom_full_center")) flags |= 2; + zoom_full(1, 0, flags, 0.97); break; } if((key=='z' && state==ControlMask)) /* zoom out */ diff --git a/src/scheduler.c b/src/scheduler.c index d8c86a3e..eef10ef6 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -3594,6 +3594,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(endptr == argv[i]) shrink = 1.0; } } + if(tclgetboolvar("zoom_full_center")) flags |= 2; zoom_full(draw, 0, flags, shrink); Tcl_ResetResult(interp); } diff --git a/src/xschem.tcl b/src/xschem.tcl index 7f5442b6..2477115f 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -5318,7 +5318,7 @@ proc no_open_dialogs {} { set tctx::global_list { PDK_ROOT PDK SKYWATER_MODELS SKYWATER_STDCELLS INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR XSCHEM_LIBRARY_PATH - auto_hilight autofocus_mainwindow + 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 connect_by_kissing constrained_move copy_cell custom_label_prefix custom_token dark_colors dark_colorscheme dim_bg dim_value @@ -5340,7 +5340,7 @@ set tctx::global_list { textwindow_fileid textwindow_filename textwindow_w tmp_bus_char toolbar_horiz toolbar_list toolbar_visible transparent_svg undo_type use_lab_wire use_label_prefix user_wants_copy_cell verilog_2001 verilog_bitblast viewdata_fileid viewdata_filename viewdata_w - vsize xschem_libs xschem_listen_port add_all_windows_drives + vsize xschem_libs xschem_listen_port zoom_full_center } ## list of global arrays to save/restore on context switching @@ -6400,6 +6400,7 @@ set_ne transparent_svg 0 set_ne only_probes 0 ; # 20110112 set_ne fullscreen 0 set_ne unzoom_nodrift 0 +set_ne zoom_full_center 0 set_ne change_lw 1 set_ne line_width 0 set_ne live_cursor2_backannotate 0 diff --git a/src/xschemrc b/src/xschemrc index fe226be3..97dd11e0 100644 --- a/src/xschemrc +++ b/src/xschemrc @@ -150,6 +150,10 @@ #### default setting: 0 # set unzoom_nodrift 0 +#### if set to 1 full zoom will center the drawing instead of anhoring to lower +#### left corner. Default: 0 +# set zoom_full_center 1 + #### if set to 1 allow to place multiple components with same name. #### Warning: this is normally not allowed in any simulation netlist. #### default: 0, do not allow place multiple elements with same name (refdes)