apply center full zoom in all zoom full commands if tcl variable zoom_full_center is set

This commit is contained in:
stefan schippers 2023-06-23 09:04:55 +02:00
parent f85d46a0cb
commit c6df85cce5
5 changed files with 23 additions and 24 deletions

View File

@ -555,7 +555,7 @@ void ask_new_file(void)
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch],".");
xctx->sch_path_hash[xctx->currsch] = 0;
xctx->sch_inst_number[xctx->currsch] = 1;
zoom_full(1, 0, 1, 0.97);
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
}
}
}
@ -1844,7 +1844,7 @@ int descend_schematic(int instnumber)
propagate_hilights(1, 0, XINSERT_NOREPLACE);
}
dbg(1, "descend_schematic(): before zoom(): prep_hash_inst=%d\n", xctx->prep_hash_inst);
zoom_full(1, 0, 1, 0.97);
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
}
return 1;
}

View File

@ -1502,7 +1502,7 @@ void updatebbox(int count, xRect *boundbox, xRect *tmp)
{
RECTORDER(tmp->x1, tmp->y1, tmp->x2, tmp->y2);
/* dbg(1, "updatebbox(): count=%d, tmp = %g %g %g %g\n",
count, tmp->x1, tmp->y1, tmp->x2, tmp->y2); */
* count, tmp->x1, tmp->y1, tmp->x2, tmp->y2); */
if(count==1) *boundbox = *tmp;
else
{
@ -4159,7 +4159,7 @@ void descend_symbol(void)
}
my_free(_ALLOC_ID_, &sympath);
}
zoom_full(1, 0, 1, 0.97);
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
}
/* 20111023 align selected object to current grid setting */

View File

@ -1982,7 +1982,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
xctx->sch_path_hash[xctx->currsch] = 0;
xctx->sch_inst_number[xctx->currsch] = 1;
if(nofullzoom) draw();
else zoom_full(1, 0, 1, 0.97);
else zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
}
}
}
@ -2498,7 +2498,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(h == 0) h = xctx->xrect[0].height;
save_restore_zoom(1);
set_viewport_size(w, h, 1.0);
zoom_full(0, 0, 2, 0.97);
zoom_full(0, 0, 2 * tclgetboolvar("zoom_full_center"), 0.97);
resetwin(1, 1, 1, w, h);
print_image();
save_restore_zoom(0);
@ -2533,7 +2533,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
h = atoi(argv[5]);
save_restore_zoom(1);
set_viewport_size(w, h, 1.0);
zoom_full(0, 0, 2, 0.97);
zoom_full(0, 0, 2 * tclgetboolvar("zoom_full_center"), 0.97);
svg_draw();
save_restore_zoom(0);
} else if(argc == 10) {
@ -2825,7 +2825,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
remove_symbols();
load_schematic(1, xctx->sch[xctx->currsch], 1, 1);
if(argc > 2 && !strcmp(argv[2], "zoom_full") ) {
zoom_full(1, 0, 1, 0.97);
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
} else {
draw();
}
@ -4108,7 +4108,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* Zoom to highlighted objects */
else if(!strcmp(argv[1], "zoom_hilighted"))
{
zoom_full(1, 2, 1, 0.97);
zoom_full(1, 2, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
Tcl_ResetResult(interp);
}
@ -4132,7 +4132,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* Zoom to selection */
else if(!strcmp(argv[1], "zoom_selected"))
{
zoom_full(1, 1, 1, 0.97);
zoom_full(1, 1, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
Tcl_ResetResult(interp);
}
else { cmd_found = 0;}

View File

@ -57,7 +57,7 @@ void hier_psprint(char **res, int what) /* netlister driver */
if((what & 1) && !ps_draw(1)) return; /* prolog */
xctx->push_undo();
str_hash_init(&subckt_table, HASHSIZE);
zoom_full(0, 0, 3, 0.97);
zoom_full(0, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
if(what & 1) ps_draw(2); /* page */
if(what & 2) { /* print cellname */
my_strcat(_ALLOC_ID_, res, hier_psprint_mtime(xctx->sch[xctx->currsch]));
@ -98,7 +98,7 @@ void hier_psprint(char **res, int what) /* netlister driver */
dbg(1, "hier_psprint(): loading file: |%s|\n", filename);
load_schematic(1,filename, 0, 1);
get_additional_symbols(1);
zoom_full(0, 0, 1, 0.97);
zoom_full(0, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
if(what & 1) ps_draw(2); /* page */
if(what & 2) { /* print cellname */
my_strcat(_ALLOC_ID_, res, hier_psprint_mtime(xctx->sch[xctx->currsch]));
@ -123,7 +123,7 @@ void hier_psprint(char **res, int what) /* netlister driver */
my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name));
xctx->do_copy_area = save;
if(what & 1) ps_draw(4); /* trailer */
zoom_full(0, 0, 3, 0.97);
zoom_full(0, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
draw();
}

View File

@ -1092,7 +1092,7 @@ void toggle_fullscreen(const char *topwin)
* pending_fullzoom does not work on the last corect ConfigureNotify event,
* so wee zoom_full() again */
}
zoom_full(1, 0, 1, 0.97); /* draw */
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); /* draw */
}
@ -1163,7 +1163,7 @@ void preview_window(const char *what, const char *win_path, const char *fname)
dbg(1, "preview_window() draw, load schematic\n");
load_schematic(1,fname, 0, 1);
}
zoom_full(1, 0, 1, 0.97); /* draw */
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); /* draw */
xctx = save_xctx;
}
else if(!strcmp(what, "destroy")) {
@ -1524,9 +1524,9 @@ static void create_new_window(int *window_count, const char *noconfirm, const ch
build_colors(0.0, 0.0);
resetwin(1, 0, 1, 0, 0); /* create preview pixmap. resetwin(create_pixmap, clear_pixmap, force, w, h) */
/* draw empty window so if following load fails due to missing file window appears correctly drawn */
zoom_full(1, 0, 1, 0.97);
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
load_schematic(1, fname, 1, 1);
zoom_full(1, 0, 1, 0.97); /* draw */
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); /* draw */
tclvareval("set_bindings ", window_path[n], NULL);
tclvareval("save_ctx ", window_path[n], NULL);
/* restore previous context,
@ -1623,9 +1623,9 @@ static void create_new_tab(int *window_count, const char *noconfirm, const char
resetwin(1, 0, 1, 0, 0); /* create pixmap. resetwin(create_pixmap, clear_pixmap, force, w, h) */
/* draw empty window so if following load fails due to missing file window appears correctly drawn */
tclvareval("housekeeping_ctx", NULL);
zoom_full(1, 0, 1, 0.97);
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
load_schematic(1,fname, 1, 1);
zoom_full(1, 0, 1, 0.97); /* draw */
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); /* draw */
}
static void destroy_window(int *window_count, const char *win_path)
@ -2071,7 +2071,7 @@ void resetwin(int create_pixmap, int clear_pixmap, int force, int w, int h)
}
if(xctx->pending_fullzoom > 0) {
dbg(1, "resetwin(): pending_fulzoom: doing zoom_full()\n");
zoom_full(1, 0, 1, 0.97);
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
xctx->pending_fullzoom--;
}
dbg(1, "resetwin(): Window reset\n");
@ -2676,9 +2676,8 @@ int Tcl_AppInit(Tcl_Interp *inter)
to tcl is_xschem_file that could change xctx->netlist_type to symbol */
load_schematic(1, fname, !cli_opt_do_netlist, 1);
}
zoom_full(0, 0, 1, 0.97); /* Necessary to tell xschem the initial area to display */
/* Necessary to tell xschem the initial area to display */
zoom_full(0, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
xctx->pending_fullzoom=1;
if(cli_opt_do_netlist) {
if(debug_var>=1) {
@ -2719,7 +2718,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
xctx->areay1 = -2;
xctx->areaw = xctx->areax2-xctx->areax1;
xctx->areah = xctx->areay2-xctx->areay1;
zoom_full(0, 0, 2, 0.97);
zoom_full(0, 0, 2 * tclgetboolvar("zoom_full_center"), 0.97);
ps_draw(7);
} else if(cli_opt_do_print == 2) {
if(!has_x) {