Revised the wrapper script to use the Tk command "font measure"
to get the pixel size of the default font, and scale the window glyphs and scrollbars to match, so that the display is automatically adjusted for screen resolution and does not require manual intervention to correct for high resolution displays.
This commit is contained in:
parent
3af205cd66
commit
2e9c554f2c
|
|
@ -554,7 +554,6 @@ set Opts(crosshair) 0
|
|||
set Opts(hidelocked) 0
|
||||
set Opts(hidespecial) 0
|
||||
set Opts(toolbar) 0
|
||||
set Opts(scale) 1.0
|
||||
set Opts(toolscale) 1.0
|
||||
set Opts(drc) 1
|
||||
set Opts(autobuttontext) 1
|
||||
|
|
@ -1135,6 +1134,16 @@ proc magic::openwrapper {{cell ""} {framename ""}} {
|
|||
toplevel $framename
|
||||
tkwait visibility $framename
|
||||
|
||||
# Get scale from the TkDefaultFont size, unless Opts(scale) is already
|
||||
# set. On standard displays, an "M" in the Sans font is usually 10
|
||||
# pixels wide, and 22 on high resolution displays, so this maps to
|
||||
# a scale of 1 on standard displays and a scale of 2 on high resolution
|
||||
# displays.
|
||||
|
||||
if [catch {set Opts(scale)}] {
|
||||
set Opts(scale) [expr {int([font measure TkDefaultFont M] / 10)}]
|
||||
}
|
||||
|
||||
# Resize the window
|
||||
if {[catch {wm geometry ${framename} $Winopts(${framename},geometry)}]} {
|
||||
catch {wm geometry ${framename} $Opts(geometry)}
|
||||
|
|
|
|||
Loading…
Reference in New Issue