line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
package TkGenerator; |
3
|
1
|
|
|
1
|
|
38473
|
use Tk; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
require Exporter; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @ISA = qw (Exporter); |
9
|
|
|
|
|
|
|
our @EXPORT = qw (generate $genwin); |
10
|
|
|
|
|
|
|
our @EXPORT_OK = (@EXPORT); |
11
|
|
|
|
|
|
|
our $VERSION = "00.1a"; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub generate |
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
my $optcnt1 = 0; $optcnt2 = 0; $optcnt3 = 0; $maincount=1; |
16
|
|
|
|
|
|
|
$genwin = new MainWindow(-title=>'Tk Code Generator'); |
17
|
|
|
|
|
|
|
$genwin -> maxsize (0, 390); |
18
|
|
|
|
|
|
|
$genwin -> minsize (0, 390); |
19
|
|
|
|
|
|
|
$t = $genwin -> Table (-rows=>40, -columns=>2) -> pack (-fill=>'x'); |
20
|
|
|
|
|
|
|
my $samplabel = $t -> Label (-text=>'Label'); |
21
|
|
|
|
|
|
|
$t -> put (0,1, $samplabel); |
22
|
|
|
|
|
|
|
my $genlabel = $t -> Button (-text=>'Generate', -command=>sub { generate2 ("Label"); } ); |
23
|
|
|
|
|
|
|
$t -> put (0, 2, $genlabel); |
24
|
|
|
|
|
|
|
my $sampbutton = $t -> Button (-text=>'Button', -state=>'disabled'); |
25
|
|
|
|
|
|
|
my $genbutton=$t-> Button (-text=>'Generate', -command=>sub { generate2 ("Button"); } ); |
26
|
|
|
|
|
|
|
my $samptlabel = $t -> Label (-text=>'Table'); |
27
|
|
|
|
|
|
|
$t-> put (1, 1, $sampbutton); |
28
|
|
|
|
|
|
|
$t-> put (1, 2, $genbutton); |
29
|
|
|
|
|
|
|
$t->put (2, 1, $samptlabel); |
30
|
|
|
|
|
|
|
my $samptable = $t -> Table (-rows=>1, -columns=>2, -scrollbars=>0); |
31
|
|
|
|
|
|
|
$t -> put (3, 1, $samptable); |
32
|
|
|
|
|
|
|
my $samptlabel2 = $samptable -> Label (-text=>"Sample Cell 1"); |
33
|
|
|
|
|
|
|
my $samptlabel3 = $samptable -> Label (-text=>"Sample Cell 2"); |
34
|
|
|
|
|
|
|
$samptable -> put (0, 1, $samptlabel2); |
35
|
|
|
|
|
|
|
$samptable -> put (0, 2, $samptlabel3); |
36
|
|
|
|
|
|
|
my $gentable = $t -> Button (-text=>'Generate', -command=>sub { generate2 ("Table"); } ); |
37
|
|
|
|
|
|
|
$t -> put (3, 2, $gentable); |
38
|
|
|
|
|
|
|
my $sampcanvaslabel = $t -> Label (-text=>'Canvas'); |
39
|
|
|
|
|
|
|
my $sampcanvas = $t -> Canvas (-width=>4, -height=>2); |
40
|
|
|
|
|
|
|
my $gencanvas = $t -> Button (-text=>'Generate', -command=>sub { generate2 ("Canvas"); } ); |
41
|
|
|
|
|
|
|
$t -> put (4, 1, $sampcanvaslabel); |
42
|
|
|
|
|
|
|
$t -> put (5, 1, $sampcanvas); |
43
|
|
|
|
|
|
|
$t -> put (5, 2, $gencanvas); |
44
|
|
|
|
|
|
|
my $sampanimation = $t -> Label (-text=>'Animation'); |
45
|
|
|
|
|
|
|
my $genanimation = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Animation'); }); |
46
|
|
|
|
|
|
|
$t -> put (6, 1, $sampanimation); |
47
|
|
|
|
|
|
|
$t -> put (6, 2, $genanimation); |
48
|
|
|
|
|
|
|
my $sampbrowseentryl = $t -> Label (-text=>"BrowseEntry"); |
49
|
|
|
|
|
|
|
my $sampbrowseentry = $t -> BrowseEntry (); |
50
|
|
|
|
|
|
|
$sampbrowseentry-> insert ('end', "Sample Option"); |
51
|
|
|
|
|
|
|
$sampbrowseentry-> insert ('end', "Sample Option 2"); |
52
|
|
|
|
|
|
|
my $genbrowseentry = $genwin -> Button (-text=>'Generate', -command=>sub { generate2 ('BrowseEntry'); }); |
53
|
|
|
|
|
|
|
$t -> put (7, 1, $sampbrowseentryl); |
54
|
|
|
|
|
|
|
$t -> put (8, 1, $sampbrowseentry); |
55
|
|
|
|
|
|
|
$t -> put (8, 2, $genbrowseentry); |
56
|
|
|
|
|
|
|
my $samptixgridl = $t -> Label (-text=>"TixGrid"); |
57
|
|
|
|
|
|
|
my $samptixgrid = $t -> TixGrid (-width=>1, -height=>1); |
58
|
|
|
|
|
|
|
my $gentixgrid = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('TixGrid'); }); |
59
|
|
|
|
|
|
|
$t -> put (9, 1, $samptixgridl); |
60
|
|
|
|
|
|
|
$t -> put (10, 1, $samptixgrid); |
61
|
|
|
|
|
|
|
$t -> put (10, 2, $gentixgrid); |
62
|
|
|
|
|
|
|
my $sampdirtreel = $t -> Label (-text=>'DirTree'); |
63
|
|
|
|
|
|
|
my $sampdirtree = $t -> DirTree (-width=>2, -height=>2); |
64
|
|
|
|
|
|
|
my $gendirtree = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('DirTree'); }); |
65
|
|
|
|
|
|
|
$t -> put (11, 1, $sampdirtreel); |
66
|
|
|
|
|
|
|
$t -> put (12, 1, $sampdirtree); |
67
|
|
|
|
|
|
|
$t -> put (12, 2, $gendirtree); |
68
|
|
|
|
|
|
|
my $sampdialogbox = $t -> Label (-text=>'DialogBox'); |
69
|
|
|
|
|
|
|
my $gendialogbox = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('DialogBox'); }); |
70
|
|
|
|
|
|
|
$t -> put (13, 1, $sampdialogbox); |
71
|
|
|
|
|
|
|
$t -> put (13, 2, $gendialogbox); |
72
|
|
|
|
|
|
|
my $sampframe = $t -> Label (-text=>"Frame"); |
73
|
|
|
|
|
|
|
my $genframe = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Frame'); }); |
74
|
|
|
|
|
|
|
$t -> put (14, 1, $sampframe); |
75
|
|
|
|
|
|
|
$t -> put (14, 2, $genframe); |
76
|
|
|
|
|
|
|
my $samplabframe = $t -> Label (-text=>"LabFrame"); |
77
|
|
|
|
|
|
|
my $genlabframe = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Frame'); }); |
78
|
|
|
|
|
|
|
$t -> put (15, 1, $samplabsframe); |
79
|
|
|
|
|
|
|
$t -> put (15, 2, $genlabframe); |
80
|
|
|
|
|
|
|
my $sampnotebookl = $t -> Label (-text=>"NoteBook"); |
81
|
|
|
|
|
|
|
my $sampnotebook = $t -> NoteBook (-width=>2); |
82
|
|
|
|
|
|
|
my $gennotebook = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('NoteBook'); }); |
83
|
|
|
|
|
|
|
$sampnotebook -> add ('Sample Tab 1'); |
84
|
|
|
|
|
|
|
$sampnotebook -> add ('Sample Tab 2'); |
85
|
|
|
|
|
|
|
$t -> put (16, 1, $sampnotebookl); |
86
|
|
|
|
|
|
|
$t -> put (17, 1, $sampnotebook); |
87
|
|
|
|
|
|
|
$t -> put (17, 2, $gennotebook); |
88
|
|
|
|
|
|
|
my $samptlist = $t -> Label (-text=>"TList"); |
89
|
|
|
|
|
|
|
my $gentlist = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('TList'); }); |
90
|
|
|
|
|
|
|
$t -> put (18, 1, $samptlist); |
91
|
|
|
|
|
|
|
$t -> put (18, 2, $gentlist); |
92
|
|
|
|
|
|
|
my $samptree = $t -> Label (-text=>'Tree' ); |
93
|
|
|
|
|
|
|
my $gentree = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Tree'); }); |
94
|
|
|
|
|
|
|
$t -> put (19,1, $samptree); |
95
|
|
|
|
|
|
|
$t -> put (19, 2, $gentree); |
96
|
|
|
|
|
|
|
my $sampinputo = $t -> Label (-text=>"InputO"); |
97
|
|
|
|
|
|
|
my $geninputo = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('InputO'); }); |
98
|
|
|
|
|
|
|
$t -> put (20, 1, $sampinputo); |
99
|
|
|
|
|
|
|
$t -> put (20, 2, $geninputo); |
100
|
|
|
|
|
|
|
my $sampcheckbutton = $t -> Checkbutton (-text=>"Checkbutton"); |
101
|
|
|
|
|
|
|
my $gencheckbutton = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Checkbutton'); }); |
102
|
|
|
|
|
|
|
$t -> put (21, 1, $sampcheckbutton); |
103
|
|
|
|
|
|
|
$t -> put (21, 2, $gencheckbutton); |
104
|
|
|
|
|
|
|
my $sampentryl = $t -> Label (-text=>"Entry"); |
105
|
|
|
|
|
|
|
my $sampentry = $t -> Entry(); |
106
|
|
|
|
|
|
|
my $genentry = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Entry'); }); |
107
|
|
|
|
|
|
|
$t -> put (22, 1, $sampentryl); |
108
|
|
|
|
|
|
|
$t -> put (23, 1, $sampentry); |
109
|
|
|
|
|
|
|
$t -> put (23, 2, $genentry); |
110
|
|
|
|
|
|
|
my $samphlist = $t -> Label (-text=>"HList"); |
111
|
|
|
|
|
|
|
my $genhlist = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('HList'); }); |
112
|
|
|
|
|
|
|
$t -> put (24, 1, $samphlist); |
113
|
|
|
|
|
|
|
$t -> put (24, 2, $genhlist); |
114
|
|
|
|
|
|
|
my $samplistboxl = $t -> Label (-text=>'Listbox'); |
115
|
|
|
|
|
|
|
my $samplistbox = $t -> Listbox (-height=>2); |
116
|
|
|
|
|
|
|
$samplistbox -> insert ('end', 'Sample List Item', 'Sample List Item'); |
117
|
|
|
|
|
|
|
my $genlistbox = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Listbox'); }); |
118
|
|
|
|
|
|
|
$t -> put (25, 1, $samplistboxl); |
119
|
|
|
|
|
|
|
$t -> put (26, 1, $samplistbox); |
120
|
|
|
|
|
|
|
$t -> put (26, 2, $genlistbox); |
121
|
|
|
|
|
|
|
my $sampmenu = $t -> Label (-text=>"Menu"); |
122
|
|
|
|
|
|
|
my $genmenu = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Menu'); }); |
123
|
|
|
|
|
|
|
$t -> put (27, 1, $sampmenu); |
124
|
|
|
|
|
|
|
$t -> put (27, 2, $genmenu); |
125
|
|
|
|
|
|
|
my $sampmessage = $t -> Label (-text=>"Message"); |
126
|
|
|
|
|
|
|
my $genmessage = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Message'); }); |
127
|
|
|
|
|
|
|
$t -> put (28, 1, $sampmessage); |
128
|
|
|
|
|
|
|
$t -> put (28, 2, $genmessage); |
129
|
|
|
|
|
|
|
my $sampoptionmenu = $t -> Label (-text=>"Optionmenu"); |
130
|
|
|
|
|
|
|
my $genoptionmenu = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Optionmenu'); }); |
131
|
|
|
|
|
|
|
$t -> put (29, 1, $sampoptionmenu); |
132
|
|
|
|
|
|
|
$t -> put (29, 2, $genoptionmenu); |
133
|
|
|
|
|
|
|
my $sampradiobutton = $t -> Radiobutton (-text=>"Radiobutton"); |
134
|
|
|
|
|
|
|
my $genradiobutton = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Radiobutton'); }); |
135
|
|
|
|
|
|
|
$t -> put (30, 1, $sampradiobutton); |
136
|
|
|
|
|
|
|
$t -> put (30, 2, $genradiobutton); |
137
|
|
|
|
|
|
|
my $sampscale = $t -> Label (-text=>'Scale'); |
138
|
|
|
|
|
|
|
my $genscale = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Scale'); }); |
139
|
|
|
|
|
|
|
$t -> put (31, 1, $sampscale); |
140
|
|
|
|
|
|
|
$t -> put (31, 2, $genscale); |
141
|
|
|
|
|
|
|
my $samptextl = $t -> Label (-text=>"Text"); |
142
|
|
|
|
|
|
|
my $samptext = $t -> Text (-height=>4); |
143
|
|
|
|
|
|
|
my $gentext = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Text'); }); |
144
|
|
|
|
|
|
|
$t -> put (32, 1, $samptextl); |
145
|
|
|
|
|
|
|
$t -> put (33, 1, $samptext); |
146
|
|
|
|
|
|
|
$t -> put (33, 2, $gentext); |
147
|
|
|
|
|
|
|
my $samptoplevel = $t -> Label (-text=>"Toplevel"); |
148
|
|
|
|
|
|
|
my $gentoplevel = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Toplevel'); }); |
149
|
|
|
|
|
|
|
$t -> put (34, 1, $samptoplevel); |
150
|
|
|
|
|
|
|
$t -> put (34, 2, $gentoplevel); |
151
|
|
|
|
|
|
|
my $sampchoosecolor = $t -> Label (-text=>"chooseColor"); |
152
|
|
|
|
|
|
|
my $genchoosecolor = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('chooseColor'); });\ |
153
|
|
|
|
|
|
|
$t -> put (35, 1, $sampchoosecolor); |
154
|
|
|
|
|
|
|
$t -> put (35, 2, $genchoosecolor); |
155
|
|
|
|
|
|
|
my $sampcoloreditor = $t -> Label (-text=>'ColorEditor'); |
156
|
|
|
|
|
|
|
my $gencoloreditor = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('ColorEditor'); }); |
157
|
|
|
|
|
|
|
$t -> put (36, 1, $sampcoloreditor); |
158
|
|
|
|
|
|
|
$t -> put (36, 2, $gencoloreditor); |
159
|
|
|
|
|
|
|
my $sampdialog = $t -> Label (-text=>"Dialog"); |
160
|
|
|
|
|
|
|
my $gendialog = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('Dialog'); }); |
161
|
|
|
|
|
|
|
$t -> put (37, 1, $sampdialog); |
162
|
|
|
|
|
|
|
$t -> put (37, 2, $gendialog); |
163
|
|
|
|
|
|
|
my $sampfileselect = $t -> Label (-text=>"FileSelect"); |
164
|
|
|
|
|
|
|
my $genfileselect = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('FileSelect'); }); |
165
|
|
|
|
|
|
|
$t -> put (38, 1, $sampfileselect); |
166
|
|
|
|
|
|
|
$t -> put (38, 2, $genfileselect); |
167
|
|
|
|
|
|
|
my $sampgetopenfile = $t -> Label (-text=>"getOpenFile"); |
168
|
|
|
|
|
|
|
my $gengetopenfile = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('getOpenFile'); }); |
169
|
|
|
|
|
|
|
$t -> put (39,1, $sampgetopenfile); |
170
|
|
|
|
|
|
|
$t -> put (39, 2, $gengetopenfile); |
171
|
|
|
|
|
|
|
my $sampmessagebox = $t -> Label (-text=>'messageBox'); |
172
|
|
|
|
|
|
|
my $genmessagebox = $t -> Button (-text=>'Generate', -command=>sub { generate2 ('messageBox'); }); |
173
|
|
|
|
|
|
|
$t -> put (40, 1, $sampmessagebox); |
174
|
|
|
|
|
|
|
$t -> put (40, 2, $genmessagebox); |
175
|
|
|
|
|
|
|
MainLoop(); |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub generate2 |
180
|
|
|
|
|
|
|
{ |
181
|
|
|
|
|
|
|
$type = shift; |
182
|
|
|
|
|
|
|
my $packflag = 0; |
183
|
|
|
|
|
|
|
if ( $genwin2 ) |
184
|
|
|
|
|
|
|
{ |
185
|
|
|
|
|
|
|
return; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
$genwin2 = new MainWindow(-title=>"Tk Code Generator"); |
188
|
|
|
|
|
|
|
my $topl = $genwin2 -> Label (-text=>"Enter The Scalar Variable for Your MainWindow.\nExample: \$win") -> pack (-fill=>'x'); |
189
|
|
|
|
|
|
|
$winentry = $genwin2 -> Entry () -> pack (-fill=>'x'); |
190
|
|
|
|
|
|
|
my $veryfirstdiv = $genwin2 -> Label () -> pack (-fill=>'x'); |
191
|
|
|
|
|
|
|
my $firstl = $genwin2 -> Label (-text=>"Options for MainWindow") -> pack (-fill=>'x'); |
192
|
|
|
|
|
|
|
my $firstdiv = $genwin2 -> Label () -> pack (-fill=>'x'); |
193
|
|
|
|
|
|
|
my $scaloptl = $genwin2 -> Label (-text=>'Option')->pack(-fill=>'x'); |
194
|
|
|
|
|
|
|
$scalaroption = $genwin2 -> Entry () -> pack (-fill=>'x') ; |
195
|
|
|
|
|
|
|
my $scalvall = $genwin2 -> Label (-text=>'Value')->pack(-fill=>'x'); |
196
|
|
|
|
|
|
|
$scalarvalue = $genwin2 -> Entry () -> pack (-fill=>'x') ; |
197
|
|
|
|
|
|
|
my $div = $genwin2 -> Label () -> pack (-fill=>'x'); |
198
|
|
|
|
|
|
|
my $checkpack = $genwin2 -> Checkbutton (-variable=>\$val, -text=>'Pack Widget?') -> pack(-fill=>'x'); |
199
|
|
|
|
|
|
|
my $packoptslabel = $genwin2 -> Label (-text=> "Options for the Pack Command for Widget $type") ->pack (-fill=>'x') ; |
200
|
|
|
|
|
|
|
my $packtopl = $genwin2 -> Label (-text=>"Option")->pack (-fill=>'x'); |
201
|
|
|
|
|
|
|
$winpackoption = $genwin2 -> Entry () -> pack (-fill=>'x'); |
202
|
|
|
|
|
|
|
my $packtopl2 = $genwin2 -> Label (-text=>"Value") -> pack (-fill=>'x'); |
203
|
|
|
|
|
|
|
$winpackvalue = $genwin2 -> Entry () -> pack (-fill=>'x'); |
204
|
|
|
|
|
|
|
my $middiv = $genwin2 -> Label () -> pack (-fill=>'x'); |
205
|
|
|
|
|
|
|
my $top2 = $genwin2 -> Label (-text=>"Add An Option for Widget $type") -> pack (-fill=>'x') ; |
206
|
|
|
|
|
|
|
my $div2 = $genwin2 -> Label () -> pack (-fill=>'x'); |
207
|
|
|
|
|
|
|
my $topl3 = $genwin2 -> Label (-text=>"Option")->pack (-fill=>'x'); |
208
|
|
|
|
|
|
|
$option = $genwin2 -> Entry () -> pack (-fill=>'x'); |
209
|
|
|
|
|
|
|
my $topl4 = $genwin2 -> Label (-text=>"Value") -> pack (-fill=>'x'); |
210
|
|
|
|
|
|
|
$value = $genwin2 -> Entry () -> pack (-fill=>'x'); |
211
|
|
|
|
|
|
|
my $div3 = $genwin2 -> Label () -> pack (-fill=>'x'); |
212
|
|
|
|
|
|
|
my $addbutton = $genwin2 -> Button (-command=>\&add, -text=>'Add') -> pack (-fill=>'x'); |
213
|
|
|
|
|
|
|
$codetext = $genwin2 -> Text (-height=>10) -> pack (-fill=>'both'); |
214
|
|
|
|
|
|
|
$genwin2 -> OnDestroy (sub { $genwin2 = ''; }) ; |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
MainLoop(); |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
sub add |
222
|
|
|
|
|
|
|
{ |
223
|
|
|
|
|
|
|
my $errordialog = $genwin2 -> Dialog (-title=>'Error', -text=>"Error:\nYou did not supply a scalar for the MainWindow"); |
224
|
|
|
|
|
|
|
if ($winentry -> get() =~ /^\s*$|^$/) |
225
|
|
|
|
|
|
|
{ |
226
|
|
|
|
|
|
|
$errordialog->Show(); |
227
|
|
|
|
|
|
|
return; |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
if ($scalaroption -> get() !~ /^\s*$|^$/ and $scalarvalue -> get() !~ /^\s*$|^$/) |
230
|
|
|
|
|
|
|
{ |
231
|
|
|
|
|
|
|
$scalaropts .= "-" . $scalaroption->get() . "=>" . '"' . $scalarvalue->get() . '"' if $optcnt1 == 0; |
232
|
|
|
|
|
|
|
$scalaropts .= "," . "-" . $scalaroption->get() . "=>" . '"' . $scalarvalue->get() . '"' if $optcnt1 > 0; |
233
|
|
|
|
|
|
|
$optcnt1+=1; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
if ($winpackoption -> get() !~ /^\s*$|^$/ and $winpackvalue -> get() !~ /^\s*$|^$/) |
236
|
|
|
|
|
|
|
{ |
237
|
|
|
|
|
|
|
$packopts .= "-" . $winpackoption->get() . "=>" . '"' . $winpackvalue->get() . '"' if $optcnt2 == 0 and $val; |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
$packopts .= "," . "-" . $winpackoption->get() . "=>" . '"' . $winpackvalue->get() . '"' if $optcnt2 > 0 and $val; |
240
|
|
|
|
|
|
|
$optcnt2+=1 if $val; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
if ($option -> get() !~ /^\s*$|^$/ and $value -> get() !~ /^\s*$|^$/) |
243
|
|
|
|
|
|
|
{ |
244
|
|
|
|
|
|
|
my $scalval = $value -> get(); |
245
|
|
|
|
|
|
|
if ($scalval !~ /sub\s*\{.*\}\s*|\\&.*/) |
246
|
|
|
|
|
|
|
{ |
247
|
|
|
|
|
|
|
$scalval = '"' . $scalval . '"'; |
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
$mainopts .= "-" . $option->get() . "=>" . $scalval if $optcnt3 == 0 ; |
250
|
|
|
|
|
|
|
$mainopts .= "," . "-" . $option->get() . "=>" . $scalval if $optcnt3 > 0; |
251
|
|
|
|
|
|
|
$optcnt3+=1; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
$firststr = "#Begin TkGenerator Code#\n" . $winentry -> get . " = new MainWindow($scalaropts)\n"; |
254
|
|
|
|
|
|
|
$mainstr = "\$$type$maincount = " . $winentry -> get() . " -> $type ($mainopts);\n" if ! $val; |
255
|
|
|
|
|
|
|
$mainstr = "\$$type$maincount = " . $winentry -> get() . " -> $type ($mainopts) -> pack ($packopts);\n" if $val; |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
$laststr = "MainLoop();\n#End TkGenerator Code#"; |
260
|
|
|
|
|
|
|
$finalstr = $firststr . $mainstr . $laststr; |
261
|
|
|
|
|
|
|
$maincount+=1; |
262
|
|
|
|
|
|
|
$codetext -> Contents ($finalstr); |
263
|
|
|
|
|
|
|
$winpackvalue -> delete (0, 'end'); |
264
|
|
|
|
|
|
|
$winpackoption -> delete (0, 'end'); |
265
|
|
|
|
|
|
|
$scalaroption -> delete (0, 'end'); |
266
|
|
|
|
|
|
|
$scalarvalue -> delete (0, 'end'); |
267
|
|
|
|
|
|
|
$option -> delete (0, 'end'); |
268
|
|
|
|
|
|
|
$value -> delete (0, 'end'); |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
1; |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
__END__ |