Skip to content

Commit d57c06d

Browse files
committed
added font choice
1 parent 884f7ed commit d57c06d

File tree

1 file changed

+56
-21
lines changed

1 file changed

+56
-21
lines changed

sources/gorilla.tcl

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ exec tclsh8.5 "$0" ${1+"$@"}
3131

3232
package provide app-gorilla 1.0
3333

34-
set ::gorillaVersion {$Revision: 1.5.2.4 $}
34+
set ::gorillaVersion {$Revision: 1.5.2.5 $}
3535
set ::gorillaDir [file dirname [info script]]
3636

3737
# ----------------------------------------------------------------------
@@ -53,6 +53,8 @@ if {[catch {package require Tk 8.5} oops]} {
5353

5454
option add *Dialog.msg.font {Sans 9}
5555
option add *Dialog.msg.wrapLength 6i
56+
# option add *Font "Sans 8"
57+
# option add *Button.Font "Sans 8"
5658

5759
if {[catch {package require Tcl 8.5}]} {
5860
wm withdraw .
@@ -206,13 +208,17 @@ proc gorilla::Init {} {
206208
}
207209

208210
# Some default preferences
211+
# will be overwritten by LoadPreferencesFromRCFile if set
209212

210213
set ::gorilla::preference(defaultVersion) 3
211214
set ::gorilla::preference(unicodeSupport) 1
212215
set ::gorilla::preference(lru) [list]
213-
# added 27.11.2009 zdia
216+
# added by zdia
214217
set ::gorilla::preference(rememberGeometries) 1
215-
218+
set ::gorilla::preference(lang) en
219+
# set ::gorilla::preference(fontsize) 10 ;# look PreferencesDialog default value
220+
# [string trim [lindex $::gorilla::ActualDefaultFont \
221+
# [expr {[lsearch $::gorilla::ActualDefaultFont -size] + 1}]] -]
216222
}
217223

218224
# This callback traces writes to the ::gorilla::status variable, which
@@ -243,13 +249,11 @@ proc gorilla::ClearStatus {} {
243249
}
244250

245251
proc gorilla::InitGui {} {
246-
247-
# option add *Button.font {Helvetica 10 bold}
248-
# option add *title.font {Helvetica 16 bold}
249-
option add *Menu.tearOff 0
250-
# themed widgets brauchen font etc nicht, wird von styles geregelt
251-
# keine Hilfstexte in der unteren Fensterleiste wie in bwidget, ist nicht üblich
252-
252+
# themed widgets do'nt know a resource database
253+
# option add *Button.font {Helvetica 10 bold}
254+
# option add *title.font {Helvetica 16 bold}
255+
option add *Menu.tearOff 0
256+
253257
menu .mbar
254258
. configure -menu .mbar
255259

@@ -359,7 +363,7 @@ set ::gorilla::menu_desc {
359363
#---------------------------------------------------------------------
360364

361365
set tree [ttk::treeview .tree \
362-
-yscroll ".vsb set" -xscroll ".hsb set" -show tree]
366+
-yscroll ".vsb set" -xscroll ".hsb set" -show tree -style My.Treeview]
363367
.tree tag configure red -foreground red
364368
.tree tag configure black -foreground black
365369

@@ -3870,7 +3874,8 @@ proc gorilla::LockDatabase {} {
38703874
set aframe [ttk::frame $top.right -padding {10 10}]
38713875
38723876
# Titel packen
3873-
ttk::label $aframe.title -anchor center -font {Helvetica 12 bold}
3877+
# ttk::label $aframe.title -anchor center -font {Helvetica 12 bold}
3878+
ttk::label $aframe.title -anchor center
38743879
pack $aframe.title -side top -fill x -pady 10
38753880
38763881
ttk::labelframe $aframe.file -text [mc "Database:"]
@@ -4545,8 +4550,9 @@ proc gorilla::PreferencesDialog {} {
45454550
lockDatabaseAfter 0 \
45464551
rememberGeometries 1 \
45474552
saveImmediatelyDefault 0 \
4548-
unicodeSupport 1
4549-
lang en} {
4553+
unicodeSupport 1 \
4554+
lang en
4555+
fontsize 10} {
45504556
if {[info exists ::gorilla::preference($pref)]} {
45514557
set ::gorilla::prefTemp($pref) $::gorilla::preference($pref)
45524558
} else {
@@ -4675,6 +4681,7 @@ pack $epf.password $epf.notes $epf.unicode $epf.warning $epf.fs \
46754681
46764682
set languages [gorilla::getAvailableLanguages]
46774683
# format: {en English de Deutsch ...}
4684+
# Fehlerabfrage für falschen prefTemp(lang) Eintrag?
46784685
set ::gorilla::fullLangName [dict get $languages $::gorilla::prefTemp(lang)]
46794686
46804687
set display $top.nb.display
@@ -4697,6 +4704,25 @@ pack $epf.password $epf.notes $epf.unicode $epf.warning $epf.fs \
46974704
46984705
# font options
46994706
4707+
ttk::frame $display.size -padding {10 10}
4708+
ttk::label $display.size.label -text [mc "Size:"] -width 9
4709+
ttk::menubutton $display.size.mb -textvariable ::gorilla::prefTemp(fontsize) \
4710+
-width 8 -direction right
4711+
set m [menu $display.size.mb.menu -tearoff 0]
4712+
$display.size.mb configure -menu $m
4713+
4714+
set sizes "8 9 10 11 12 14 16"
4715+
foreach {size} $sizes {
4716+
$m add radio -label $size -variable ::gorilla::prefTemp(fontsize) -value $size \
4717+
-command "
4718+
font configure TkDefaultFont -size $size
4719+
font configure TkTextFont -size $size
4720+
font configure TkMenuFont -size $size"
4721+
}
4722+
4723+
pack $display.size.label $display.size.mb -side left
4724+
pack $display.size -anchor w
4725+
47004726
#
47014727
# End of NoteBook tabs
47024728
#
@@ -4713,9 +4739,9 @@ pack $epf.password $epf.notes $epf.unicode $epf.warning $epf.fs \
47134739
# pack $top.sep -side top -fill x -pady 7
47144740
47154741
frame $top.buts
4716-
set but1 [button $top.buts.b1 -width 15 -text "OK" \
4742+
set but1 [ttk::button $top.buts.b1 -width 15 -text "OK" \
47174743
-command "set ::gorilla::guimutex 1"]
4718-
set but2 [button $top.buts.b2 -width 15 -text [mc "Cancel"] \
4744+
set but2 [ttk::button $top.buts.b2 -width 15 -text [mc "Cancel"] \
47194745
-command "set ::gorilla::guimutex 2"]
47204746
pack $but1 $but2 -side left -pady 10 -padx 20
47214747
pack $top.buts -side top -pady 10 -fill both
@@ -4774,11 +4800,10 @@ return
47744800
saveImmediatelyDefault \
47754801
unicodeSupport
47764802
lang \
4803+
fontsize \
47774804
} {
47784805
set ::gorilla::preference($pref) $::gorilla::prefTemp($pref)
47794806
}
4780-
puts "::gorilla::prefTemp($pref) $::gorilla::prefTemp($pref)"
4781-
puts "gorilla::fullLangName $gorilla::fullLangName:"
47824807
}
47834808
47844809
proc gorilla::Preferences {} {
@@ -4929,7 +4954,8 @@ proc gorilla::SavePreferencesToRCFile {} {
49294954
rememberGeometries \
49304955
saveImmediatelyDefault \
49314956
unicodeSupport \
4932-
lang} {
4957+
lang \
4958+
fontsize} {
49334959
if {[info exists ::gorilla::preference($pref)]} {
49344960
puts $f "$pref=$::gorilla::preference($pref)"
49354961
}
@@ -5225,6 +5251,12 @@ proc gorilla::LoadPreferencesFromRCFile {} {
52255251
mclocale $value
52265252
mcload [file join $::gorillaDir msgs]
52275253
}
5254+
fontsize {
5255+
set ::gorilla::preference($pref) $value
5256+
font configure TkDefaultFont -size $value
5257+
font configure TkTextFont -size $value
5258+
font configure TkMenuFont -size $value
5259+
}
52285260
}
52295261
}
52305262
@@ -6552,5 +6584,8 @@ if {$::gorilla::init == 0} {
65526584
raise .
65536585
update
65546586
6555-
set ::gorilla::status [mc "Welcome to the Password Gorilla."]
6556-
6587+
if {[tk windowingsystem] == "aqua"} {
6588+
exec say [mc "Welcome to the Password Gorilla."]
6589+
} else {
6590+
set ::gorilla::status [mc "Welcome to the Password Gorilla."]
6591+
}

0 commit comments

Comments
 (0)