summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2020-04-24 19:09:00 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2020-04-24 19:09:00 +0000
commit2e573ea714d6be8a266980f0f79ce6daf8fcc3ee (patch)
treea0194900f8008744c61ebdfef9de186b87fa622f
parentaf0b0a952d24678a758b9662e4979129dcd4a276 (diff)
Tcl GUIs: add browser shortcuts for font scaling
git-svn-id: svn://tug.org/texlive/trunk@54861 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/texmf-dist/scripts/tlshell/tlshell.tcl29
-rwxr-xr-xMaster/tlpkg/installer/install-tl-gui.tcl42
2 files changed, 56 insertions, 15 deletions
diff --git a/Master/texmf-dist/scripts/tlshell/tlshell.tcl b/Master/texmf-dist/scripts/tlshell/tlshell.tcl
index e0e10993713..a78f494655c 100755
--- a/Master/texmf-dist/scripts/tlshell/tlshell.tcl
+++ b/Master/texmf-dist/scripts/tlshell/tlshell.tcl
@@ -2010,6 +2010,11 @@ proc set_fontscale {s} {
}
}
+proc zoom {n} {
+ if {$n <= 0} {set n 1}
+ set_fontscale [expr {$n*$::tkfontscale}]
+}
+
##### running external commands #####
# For capturing an external command, we need a separate output channel,
@@ -2179,14 +2184,22 @@ proc populate_main {} {
.mn.opt add cascade -label [__ "GUI font scaling"] \
-menu .mn.opt.fscale
menu .mn.opt.fscale
- foreach s {0.5 0.7 1 1.25 1.5 2 3 4 6 8} {
- if {$s eq $::tkfontscale} {
- set mlabel "$s *"
- } else {
- set mlabel $s
- }
- .mn.opt.fscale add command -label $mlabel \
- -command "set_fontscale $s"
+ foreach s {0.6 0.8 1 1.2 1.6 2 2.5 3 3.8 5 6 7.5 9} {
+ .mn.opt.fscale add command -label $s -command "set_fontscale $s"
+ }
+
+ # browser-style keyboard shortcuts for scaling
+ bind . <Control-KeyRelease-minus> {zoom 0.8}
+ bind . <Control-KeyRelease-equal> {zoom 1.25}
+ bind . <Control-Shift-KeyRelease-equal> {zoom 1.25}
+ bind . <Control-KeyRelease-plus> {zoom 1.25}
+ bind . <Control-KeyRelease-0> {set_fontscale 1}
+ if {$::tcl_platform(os) eq "Darwin"} {
+ bind . <Command-KeyRelease-minus> {zoom 0.8}
+ bind . <Command-KeyRelease-equal> {zoom 1.25}
+ bind . <Command-Shift-KeyRelease-equal> {zoom 1.25}
+ bind . <Command-KeyRelease-plus> {zoom 1.25}
+ bind . <Command-KeyRelease-0> {set_fontscale 1}
}
diff --git a/Master/tlpkg/installer/install-tl-gui.tcl b/Master/tlpkg/installer/install-tl-gui.tcl
index e831f8984be..2a2f10896ff 100755
--- a/Master/tlpkg/installer/install-tl-gui.tcl
+++ b/Master/tlpkg/installer/install-tl-gui.tcl
@@ -1319,6 +1319,11 @@ proc set_fontscale {s} {
run_menu
}
+proc zoom {n} {
+ if {$n <= 0} {set n 1}
+ set_fontscale [expr {$n*$::tkfontscale}]
+}
+
# menus: disable tearoff feature
option add *Menu.tearOff 0
@@ -1394,13 +1399,22 @@ proc run_menu {} {
menu .mn.gui.fscale
.mn.gui add cascade -label [__ "Font scaling"] -menu .mn.gui.fscale
- foreach s {0.5 0.7 1 1.25 1.5 2 3 4 6 8} {
- if {$s eq $::tkfontscale} {
- set mlabel "$s *"
- } else {
- set mlabel $s
- }
- .mn.gui.fscale add command -label $mlabel -command "set_fontscale $s"
+ foreach s {0.6 0.8 1 1.2 1.6 2 2.5 3 3.8 5 6 7.5 9} {
+ .mn.gui.fscale add command -label $s -command "set_fontscale $s"
+ }
+
+ # browser-style keyboard shortcuts for scaling
+ bind . <Control-KeyRelease-minus> {zoom 0.8}
+ bind . <Control-KeyRelease-equal> {zoom 1.25}
+ bind . <Control-Shift-KeyRelease-equal> {zoom 1.25}
+ bind . <Control-KeyRelease-plus> {zoom 1.25}
+ bind . <Control-KeyRelease-0> {set_fontscale 1}
+ if {$::tcl_platform(os) eq "Darwin"} {
+ bind . <Command-KeyRelease-minus> {zoom 0.8}
+ bind . <Command-KeyRelease-equal> {zoom 1.25}
+ bind . <Command-Shift-KeyRelease-equal> {zoom 1.25}
+ bind . <Command-KeyRelease-plus> {zoom 1.25}
+ bind . <Command-KeyRelease-0> {set_fontscale 1}
}
# wallpaper, for a uniform background
@@ -2128,6 +2142,20 @@ If this takes too long, press Abort or choose another repository." \
}
}
if {$answer eq "startinst"} {
+ # disable browser-style keyboard shortcuts for scaling
+ bind . <Control-KeyRelease-minus> {}
+ bind . <Control-KeyRelease-equal> {}
+ bind . <Control-Shift-KeyRelease-equal> {}
+ bind . <Control-KeyRelease-plus> {}
+ bind . <Control-KeyRelease-0> {}
+ if {$::tcl_platform(os) eq "Darwin"} {
+ bind . <Command-KeyRelease-minus> {}
+ bind . <Command-KeyRelease-equal> {}
+ bind . <Command-Shift-KeyRelease-equal> {}
+ bind . <Command-KeyRelease-plus> {}
+ bind . <Command-KeyRelease-0> {}
+ }
+
run_installer
# invokes show_log which first destroys previous children
} else {