summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2021-04-10 13:19:50 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2021-04-10 13:19:50 +0000
commit682e49a9cd691c15f7e37b9706781fe5190d6fd2 (patch)
treed7f67bd5b5e57580274378500346cb3cb026822b /Master/tlpkg
parent6bfda08f1bbd2cfc5a1b75e6197bdf29ffc8724d (diff)
Better bindings for Linux Unicode check- and radiobuttons
git-svn-id: svn://tug.org/texlive/trunk@58813 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rw-r--r--Master/tlpkg/tltcl/tltcl.tcl50
1 files changed, 29 insertions, 21 deletions
diff --git a/Master/tlpkg/tltcl/tltcl.tcl b/Master/tlpkg/tltcl/tltcl.tcl
index 4e2288bef04..4ed73859cb4 100644
--- a/Master/tlpkg/tltcl/tltcl.tcl
+++ b/Master/tlpkg/tltcl/tltcl.tcl
@@ -792,10 +792,14 @@ proc dirbrowser2widget {w} {
# on unix/linux the original indicators are hard-coded as bitmaps,
# which cannot scale with the rest of the interface.
-# the hack below replaces them with unicode characters.
+# the hack below replaces them with unicode characters, which are scaled
+# along with other text.
# This is implemented by removing the original indicators and prepending
# a unicode symbol and a unicode wide space to the text label.
+# The combobox down arrow and the treeview triangles (directory browser)
+# are still unscaled.
+
if $::plain_unix {
# from General Punctuation, 2000-206f
@@ -811,7 +815,7 @@ if $::plain_unix {
ttk::style layout TCheckbutton "Checkbutton.padding -sticky nswe -children {Checkbutton.focus -side left -sticky w -children {Checkbutton.label -sticky nswe}}"
ttk::style layout TRadiobutton "Radiobutton.padding -sticky nswe -children {Radiobutton.focus -side left -sticky w -children {Radiobutton.label -sticky nswe}}"
- proc tlupdate_check {w} {
+ proc tlupdate_check {w n e o} { ; # n, e, o added to keep trace happy
upvar [$w cget -variable] v
set s [$w cget -text]
set ck [expr {$v ? $::chk1 : $::chk0}]
@@ -821,35 +825,39 @@ if $::plain_unix {
} else {
set s "$ck$::wsp$s"
}
+ if {[string length $s] == 2} {
+ # indicator plus wide space plus empty string. Remove wide space.
+ set s [string range $s 0 0]
+ }
$w configure -text $s
- return $w
}
- bind TCheckbutton <ButtonRelease-1> {+tlupdate_check %W}
- bind TCheckbutton <Key-space> {+tlupdate_check %W}
- bind TCheckbutton <Map> {+tlupdate_check %W}
+ bind TCheckbutton <Map> {+tlupdate_check %W n e o}
+ bind TCheckbutton <Map> {+trace add variable [%W cget -variable] write \
+ [list tlupdate_check %W]}
+ bind TCheckbutton <Unmap> \
+ {+trace remove variable [%W cget -variable] write [list tlupdate_check %W]}
- proc tlupdate_radio {w} {
+ proc tlupdate_radio {w n e o} {
upvar [$w cget -variable] v
set ck [expr {$v eq [$w cget -value] ? $::rad1 : $::rad0}]
set s [$w cget -text]
set s0 [string index $s 0]
if {$s0 eq $::rad0 || $s0 eq $::rad1} {
- $w configure -text "$ck$::wsp[string range $s 2 end]"
+ set s "$ck$::wsp[string range $s 2 end]"
} else {
- $w configure -text "$ck$::wsp$s"
+ set s "$ck$::wsp$s"
}
- }
- proc tlupdate_radios {w} {
- upvar [$w cget -variable] v
- foreach sibling [winfo children [winfo parent $w]] {
- if {[winfo class $sibling] eq "TRadiobutton" &&
- [$sibling cget -variable] eq [$w cget -variable]
- && ![$sibling instate disabled]} {
- tlupdate_radio $sibling
- }
+ if {[string length $s] == 2} {
+ # indicator plus wide space plus empty string. Remove wide space.
+ set s [string range $s 0 0]
}
+ $w configure -text $s
}
- bind TRadiobutton <ButtonRelease-1> {+tlupdate_radios %W}
- bind TRadiobutton <Key-space> {+tlupdate_radios %W}
- bind TRadiobutton <Map> {+tlupdate_radio %W}
+
+ bind TRadiobutton <Map> {+tlupdate_radio %W n e o}
+ bind TRadiobutton <Map> {+trace add variable [%W cget -variable] write \
+ [list tlupdate_radio %W]}
+ bind TRadiobutton <Unmap> \
+ {+trace remove variable [%W cget -variable] write [list tlupdate_radio %W]}
}
+