initial_geometry if set in xschemrc has priority over persistent geometry placement
This commit is contained in:
parent
ed9f069752
commit
bbfe761c18
12
src/xinit.c
12
src/xinit.c
|
|
@ -2813,6 +2813,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
tcleval(name);
|
||||
}
|
||||
}
|
||||
|
||||
if(debug_var==-10) debug_var=0;
|
||||
/* */
|
||||
/* EXECUTE xschem.tcl */
|
||||
|
|
@ -2923,16 +2924,18 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
if(cli_opt_flat_netlist) {
|
||||
tclsetvar("flat_netlist","1");
|
||||
}
|
||||
xctx->areaw = CADWIDTH+4*INT_LINE_W(xctx->lw); /* clip area extends 1 pixel beyond physical xctx->window area */
|
||||
xctx->areah = CADHEIGHT+4*INT_LINE_W(xctx->lw); /* to avoid drawing clipped rectangle borders at xctx->window edges */
|
||||
/* clip area extends 1 pixel beyond physical xctx->window area */
|
||||
/* to avoid drawing clipped rectangle borders at xctx->window edges */
|
||||
xctx->areaw = (short unsigned int) tclgetintvar("canvas_width") + 4 * INT_LINE_W(xctx->lw);
|
||||
xctx->areah = (short unsigned int) tclgetintvar("canvas_height") + 4 * INT_LINE_W(xctx->lw);
|
||||
xctx->areax1 = -2*INT_LINE_W(xctx->lw);
|
||||
xctx->areay1 = -2*INT_LINE_W(xctx->lw);
|
||||
xctx->areax2 = xctx->areaw-2*INT_LINE_W(xctx->lw);
|
||||
xctx->areay2 = xctx->areah-2*INT_LINE_W(xctx->lw);
|
||||
xctx->xrect[0].x = 0;
|
||||
xctx->xrect[0].y = 0;
|
||||
xctx->xrect[0].width = CADWIDTH;
|
||||
xctx->xrect[0].height = CADHEIGHT;
|
||||
xctx->xrect[0].width = (short unsigned int) tclgetintvar("canvas_width");
|
||||
xctx->xrect[0].height = (short unsigned int) tclgetintvar("canvas_height");
|
||||
|
||||
|
||||
my_strncpy(xctx->file_version, XSCHEM_FILE_VERSION, S(xctx->file_version));
|
||||
|
|
@ -2947,6 +2950,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
} else {
|
||||
my_strncpy(xctx->current_dirname, pwd_dir, S(xctx->current_dirname));
|
||||
}
|
||||
|
||||
|
||||
/* */
|
||||
/* X INITIALIZATION */
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@
|
|||
#define __unix__
|
||||
#endif
|
||||
|
||||
/* stringification: STRINGIFY(xxxx) --> "xxxx" */
|
||||
#define STRINGIFY2(x) #x
|
||||
#define STRINGIFY(x) STRINGIFY2(x)
|
||||
|
||||
/* approximate PI definition */
|
||||
#define XSCH_PI 3.14159265358979323846264338327950288419716939937
|
||||
|
||||
|
|
@ -138,8 +142,6 @@ extern char win_temp_dir[PATH_MAX];
|
|||
|
||||
#define _ALLOC_ID_ 0 /* to be replaced with unique IDs in my_*() allocations for memory tracking
|
||||
* see create_alloc_ids.awk */
|
||||
#define CADHEIGHT 700 /* initial window size */
|
||||
#define CADWIDTH 1000
|
||||
|
||||
/* max number of windows (including main) a single xschem process can handle */
|
||||
#define MAX_NEW_WINDOWS 20
|
||||
|
|
|
|||
|
|
@ -8523,61 +8523,40 @@ proc store_geom {win filename} {
|
|||
|
||||
proc set_geom {win {filename {}}} {
|
||||
global USER_CONF_DIR initial_geometry fullscreen
|
||||
set ret {}
|
||||
|
||||
set geom {}
|
||||
if {$fullscreen ne 0} {return}
|
||||
# puts "set_geom: $win $filename"
|
||||
set geom_file $USER_CONF_DIR/geometry
|
||||
if { [file exists $geom_file]} {
|
||||
set geom_data [read_data $geom_file]
|
||||
foreach {f g} $geom_data {
|
||||
set geom_array($f) $g
|
||||
}
|
||||
if {$filename ne {} && [info exists geom_array($filename)]} {
|
||||
set ret $geom_array($filename)
|
||||
}
|
||||
}
|
||||
set xmax [winfo screenwidth .]
|
||||
set ymax [winfo screenheight .]
|
||||
scan $ret {%dx%d+%d+%d} x y dx dy
|
||||
# puts "xmax=$xmax, ymax=$ymax, x=$x, y=$y dx=$dx dy=$dy"
|
||||
# off screen. do not use.
|
||||
if { $dx > $xmax - 100 || $dy > $ymax - 100} {
|
||||
set ret {}
|
||||
}
|
||||
if {$ret ne {}} {
|
||||
wm geometry $win $ret
|
||||
# puts "set to geometry: $ret"
|
||||
if {[info exists initial_geometry]} {
|
||||
set geom $initial_geometry
|
||||
} else {
|
||||
wm geometry $win $initial_geometry
|
||||
# puts "set to geometry: $initial_geometry"
|
||||
# puts "set_geom: $win $filename"
|
||||
set geom_file $USER_CONF_DIR/geometry
|
||||
if { [file exists $geom_file]} {
|
||||
set geom_data [read_data $geom_file]
|
||||
foreach {f g} $geom_data {
|
||||
set geom_array($f) $g
|
||||
}
|
||||
if {$filename ne {} && [info exists geom_array($filename)]} {
|
||||
set geom $geom_array($filename)
|
||||
}
|
||||
}
|
||||
set xmax [winfo screenwidth .]
|
||||
set ymax [winfo screenheight .]
|
||||
set n [scan $geom {%dx%d+%d+%d} x y dx dy]
|
||||
if {$n == 4} {
|
||||
# puts "xmax=$xmax, ymax=$ymax, x=$x, y=$y dx=$dx dy=$dy"
|
||||
# off screen. do not use.
|
||||
if { $dx > $xmax - 100 || $dy > $ymax - 100} {
|
||||
set geom {}
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$geom ne {}} {
|
||||
wm geometry $win $geom
|
||||
update
|
||||
}
|
||||
# tkwait visibility $win
|
||||
update
|
||||
}
|
||||
|
||||
proc get_geom {win {filename {}}} {
|
||||
global USER_CONF_DIR initial_geometry
|
||||
set ret {}
|
||||
# puts "get_geom: $win $filename"
|
||||
set geom_file $USER_CONF_DIR/geometry
|
||||
if { [file exists $geom_file]} {
|
||||
set geom_data [read_data $geom_file]
|
||||
foreach {f g} $geom_data {
|
||||
set geom_array($f) $g
|
||||
}
|
||||
if {$filename ne {} && [info exists geom_array($filename)]} {
|
||||
set ret $geom_array($filename)
|
||||
}
|
||||
}
|
||||
if {$ret ne {}} {
|
||||
return $ret
|
||||
} else {
|
||||
return $initial_geometry
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
proc quit_xschem { {force {}}} {
|
||||
global tabbed_interface
|
||||
|
||||
|
|
@ -9137,6 +9116,7 @@ proc load_raw {{type {}}} {
|
|||
# bind Menubutton <Button-1> {tk::menubutton1 %W %X %Y}
|
||||
|
||||
proc build_widgets { {topwin {} } } {
|
||||
global canvas_height canvas_width
|
||||
global XSCHEM_SHAREDIR tabbed_interface simulate_bg OS sim
|
||||
global dark_gui_colorscheme draw_crosshair grid_point_size
|
||||
global color_ps transparent_svg menu_debug_var enable_stretch
|
||||
|
|
@ -9144,7 +9124,7 @@ proc build_widgets { {topwin {} } } {
|
|||
global draw_grid big_grid_points sym_txt change_lw incr_hilight symbol_width cadence_compat
|
||||
global cadsnap cadgrid draw_window toolbar_visible hide_symbols undo_type snap_cursor
|
||||
global disable_unique_names persistent_command autotrim_wires infix_interface orthogonal_wiring en_hilight_conn_inst
|
||||
global local_netlist_dir editor netlist_type netlist_dir spiceprefix initial_geometry
|
||||
global local_netlist_dir editor netlist_type netlist_dir spiceprefix
|
||||
if { $dark_gui_colorscheme} {
|
||||
set selectcolor white
|
||||
} else {
|
||||
|
|
@ -9783,14 +9763,12 @@ tclcommand=\"xschem raw_read \$netlist_dir/[file tail [file rootname [xschem get
|
|||
|
||||
|
||||
# used to check status of Simulate button later. This variable is constant, never changed
|
||||
frame $topwin.drw -background {} -takefocus 1
|
||||
frame $topwin.drw -background {} -takefocus 1 -width $canvas_width -height $canvas_height
|
||||
|
||||
if { $topwin == {} } {set rootwin .} else { set rootwin $topwin}
|
||||
wm title $rootwin "xschem - "
|
||||
wm iconname $rootwin "xschem - "
|
||||
$rootwin configure -background {}
|
||||
# wm geometry $rootwin $initial_geometry
|
||||
# wm maxsize . 1600 1200
|
||||
if {$tabbed_interface} {
|
||||
wm protocol $rootwin WM_DELETE_WINDOW {
|
||||
xschem exit closewindow
|
||||
|
|
@ -10098,6 +10076,15 @@ proc entry_replace_selection {w} {
|
|||
|
||||
# tk_focusFollowsMouse
|
||||
|
||||
# set or get scaling factor
|
||||
if { [info exists tk_scaling] } {
|
||||
# set scaling
|
||||
tk scaling $tk_scaling ;# useful for 4k displays (set bigger widgets)
|
||||
} else {
|
||||
# get scaling
|
||||
set tk_scaling [tk scaling]
|
||||
}
|
||||
|
||||
set_ne dark_colorscheme 1
|
||||
set_ne dark_gui_colorscheme 0
|
||||
if { [info exists has_x]} {
|
||||
|
|
@ -10192,6 +10179,8 @@ if {$OS == "Windows"} {
|
|||
}
|
||||
|
||||
# used in C code
|
||||
set_ne canvas_width [expr {int(800. * $tk_scaling)}]
|
||||
set_ne canvas_height [expr {int(500. * $tk_scaling)}]
|
||||
set_ne xschem_libs {}
|
||||
set_ne noprint_libs {}
|
||||
set_ne nolist_libs {}
|
||||
|
|
@ -10301,7 +10290,6 @@ set_ne erc_shorted_output_is_error 0;# if set to 1 turn warnings into errors
|
|||
set_ne symbol_width 150
|
||||
set_ne editor {gvim -f}
|
||||
set_ne rainbow_colors 0
|
||||
set_ne initial_geometry {900x600}
|
||||
set_ne edit_symbol_prop_new_sel {}
|
||||
if {$OS == "Windows"} {
|
||||
set_ne launcher_default_program [auto_execok start]
|
||||
|
|
@ -10606,7 +10594,6 @@ if { ( $OS== "Windows" || [string length [lindex [array get env DISPLAY] 1] ] >
|
|||
font configure Underline-Font -underline true -size 24
|
||||
. configure -cursor left_ptr
|
||||
set_old_tk_fonts ;# for xschem compiled with old tcl-tk libs
|
||||
if { [info exists tk_scaling] } {tk scaling $tk_scaling} ;# useful for 4k displays (set bigger widgets)
|
||||
set infowindow_text {}
|
||||
infowindow
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue