blob: cebfcb08d7d3919a89668659fa57bffcdd8d1558 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
package provide dialog_font 0.1
namespace eval ::dialog_font:: {
variable fontsize 0
variable dofont_fontsize 0
variable stretchval 0
variable whichstretch 0
namespace export pdtk_canvas_dofont
}
proc ::dialog_font::apply {mytoplevel myfontsize} {
pdsend "$mytoplevel font $myfontsize $stretchval $whichstretch"
}
proc ::dialog_font::close {mytoplevel} {
pdsend "$mytoplevel cancel"
}
proc ::dialog_font::cancel {mytoplevel} {
::dialog_font::apply $mytoplevel $fontsize ;# reinstate previous font size
pdsend "$mytoplevel cancel"
}
proc ::dialog_font::ok {mytoplevel} {
set fontsize $::dialog_font::fontsize
::dialog_font::apply $mytoplevel $fontsize
::dialog_font::close $mytoplevel
}
# this should be called pdtk_font_dialog like the rest of the panels, but it
# is called from the C side, so we'll leave it be
proc ::dialog_font::pdtk_canvas_dofont {mytoplevel initsize} {
create_panel $mytoplevel $initsize
}
proc ::dialog_font::create_panel {mytoplevel initsize} {
set fontsize $initsize
set dofont_fontsize $initsize
set stretchval 100
set whichstretch 1
toplevel $mytoplevel
wm title $mytoplevel {Patch Font}
wm protocol $mytoplevel WM_DELETE_WINDOW "::dialog_font::cancel $mytoplevel"
pdtk_panelkeybindings $mytoplevel font
frame $mytoplevel.buttonframe
pack $mytoplevel.buttonframe -side bottom -fill x -pady 2m
button $mytoplevel.buttonframe.cancel -text "Cancel" \
-command "::dialog_font::cancel $mytoplevel"
button $mytoplevel.buttonframe.ok -text "OK" \
-command "::dialog_font::ok $mytoplevel"
pack $mytoplevel.buttonframe.cancel -side left -expand 1
pack $mytoplevel.buttonframe.ok -side left -expand 1
frame $mytoplevel.radiof
pack $mytoplevel.radiof -side left
label $mytoplevel.radiof.label -text {Font Size:}
pack $mytoplevel.radiof.label -side top
radiobutton $mytoplevel.radiof.radio8 -value 8 -variable ::dialog_font::fontsize -text "8" \
-command "::dialog_font::apply $mytoplevel 8"
radiobutton $mytoplevel.radiof.radio10 -value 10 -variable ::dialog_font::fontsize -text "10" \
-command "::dialog_font::apply $mytoplevel 10"
radiobutton $mytoplevel.radiof.radio12 -value 12 -variable ::dialog_font::fontsize -text "12" \
-command "::dialog_font::apply $mytoplevel 12"
radiobutton $mytoplevel.radiof.radio16 -value 16 -variable ::dialog_font::fontsize -text "16" \
-command "::dialog_font::apply $mytoplevel 16"
radiobutton $mytoplevel.radiof.radio24 -value 24 -variable ::dialog_font::fontsize -text "24" \
-command "::dialog_font::apply $mytoplevel 24"
radiobutton $mytoplevel.radiof.radio36 -value 36 -variable ::dialog_font::fontsize -text "36" \
-command "::dialog_font::apply $mytoplevel 36"
pack $mytoplevel.radiof.radio8 -side top -anchor w
pack $mytoplevel.radiof.radio10 -side top -anchor w
pack $mytoplevel.radiof.radio12 -side top -anchor w
pack $mytoplevel.radiof.radio16 -side top -anchor w
pack $mytoplevel.radiof.radio24 -side top -anchor w
pack $mytoplevel.radiof.radio36 -side top -anchor w
set current_radiobutton [format "$mytoplevel.radiof.radio%d" $initsize]
$current_radiobutton select
frame $mytoplevel.stretchf
pack $mytoplevel.stretchf -side left
label $mytoplevel.stretchf.label -text "Stretch:"
pack $mytoplevel.stretchf.label -side top
entry $mytoplevel.stretchf.entry -textvariable stretchval -width 5
pack $mytoplevel.stretchf.entry -side left
radiobutton $mytoplevel.stretchf.radio1 \
-value 1 -variable whichstretch -text "X and Y"
radiobutton $mytoplevel.stretchf.radio2 \
-value 2 -variable whichstretch -text "X only"
radiobutton $mytoplevel.stretchf.radio3 \
-value 3 -variable whichstretch -text "Y only"
pack $mytoplevel.stretchf.radio1 -side top -anchor w
pack $mytoplevel.stretchf.radio2 -side top -anchor w
pack $mytoplevel.stretchf.radio3 -side top -anchor w
}
|