| 1 |
# callback.tcl |
| 2 |
# by Benjamin A. Allan and Kirk A. Abbott |
| 3 |
# Created: January 1994 |
| 4 |
# Part of ASCEND |
| 5 |
# Revision: $Revision: 1.5 $ |
| 6 |
# Last modified on: $Date: 1998/06/18 15:55:22 $ |
| 7 |
# Last modified by: $Author: mthomas $ |
| 8 |
# Revision control file: $RCSfile: callback.tcl,v $ |
| 9 |
# |
| 10 |
# This file is part of the ASCEND Tcl/Tk Interface. |
| 11 |
# |
| 12 |
# Copyright (C) 1994-1998 Carnegie Mellon University |
| 13 |
# |
| 14 |
# The ASCEND Tcl/Tk Interface is free software; you can redistribute |
| 15 |
# it and/or modify it under the terms of the GNU General Public |
| 16 |
# License as published by the Free Software Foundation; either |
| 17 |
# version 2 of the License, or (at your option) any later version. |
| 18 |
# |
| 19 |
# The ASCEND Tcl/Tk Interface is distributed in hope that it will be |
| 20 |
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
| 21 |
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
# GNU General Public License for more details. |
| 23 |
# |
| 24 |
# You should have received a copy of the GNU General Public License |
| 25 |
# along with the program; if not, write to the Free Software |
| 26 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the |
| 27 |
# file named COPYING. COPYING is found in ../compiler. |
| 28 |
|
| 29 |
# Module: callback.tcl |
| 30 |
# Tcl version: 8.0 (Tcl/Tk/XF) |
| 31 |
# Tk version: 8.0 |
| 32 |
# XF version: 4.0 |
| 33 |
# |
| 34 |
|
| 35 |
# module contents |
| 36 |
global moduleList |
| 37 |
global autoLoadList |
| 38 |
set moduleList(callback.tcl) { .callback} |
| 39 |
set autoLoadList(callback.tcl) {0} |
| 40 |
|
| 41 |
# procedures to show toplevel windows |
| 42 |
|
| 43 |
|
| 44 |
# procedure to show window .$t |
| 45 |
proc VShowWindow.callback {args} {# xf ignore me 7 |
| 46 |
|
| 47 |
set t callback |
| 48 |
# build widget .$t |
| 49 |
catch {destroy .$t} |
| 50 |
toplevel .$t |
| 51 |
|
| 52 |
# Window manager configurations |
| 53 |
wm positionfrom .$t "" |
| 54 |
wm sizefrom .$t "" |
| 55 |
wm maxsize .$t 1137 870 |
| 56 |
wm minsize .$t 1 1 |
| 57 |
wm protocol .$t WM_DELETE_WINDOW "destroy $t" |
| 58 |
wm title .$t {A4 Tcl-C callbacks} |
| 59 |
|
| 60 |
|
| 61 |
# build widget .$t.grp_frm |
| 62 |
frame .$t.grp_frm \ |
| 63 |
-background {red} \ |
| 64 |
-borderwidth 0 |
| 65 |
|
| 66 |
# build widget .$t.grp_frm.com_list |
| 67 |
frame .$t.grp_frm.com_list |
| 68 |
|
| 69 |
set ascCallbackVect(grouplabel) "Command groups:" |
| 70 |
# build widget .$t.grp_frm.com_list.label |
| 71 |
label .$t.grp_frm.com_list.label \ |
| 72 |
-textvariable ascCallbackVect(grouplabel) |
| 73 |
|
| 74 |
# build widget .$t.grp_frm.com_list.scrollbar3 |
| 75 |
scrollbar .$t.grp_frm.com_list.scrollbar3 \ |
| 76 |
-command ".$t.grp_frm.com_list.listbox1 xview" \ |
| 77 |
-orient {horizontal} \ |
| 78 |
-relief flat |
| 79 |
|
| 80 |
# build widget .$t.grp_frm.com_list.scrollbar2 |
| 81 |
scrollbar .$t.grp_frm.com_list.scrollbar2 \ |
| 82 |
-command ".$t.grp_frm.com_list.listbox1 yview" \ |
| 83 |
-relief flat |
| 84 |
|
| 85 |
# build widget .$t.grp_frm.com_list.listbox1 |
| 86 |
listbox .$t.grp_frm.com_list.listbox1 \ |
| 87 |
-relief flat \ |
| 88 |
-exportselection 0 \ |
| 89 |
-xscrollcommand ".$t.grp_frm.com_list.scrollbar3 set" \ |
| 90 |
-yscrollcommand ".$t.grp_frm.com_list.scrollbar2 set" |
| 91 |
|
| 92 |
# build widget .$t.grp_frm.com_expl |
| 93 |
frame .$t.grp_frm.com_expl \ |
| 94 |
-relief flat |
| 95 |
|
| 96 |
set ascCallbackVect(purposelabel) "Group purpose:" |
| 97 |
|
| 98 |
# build widget .$t.grp_frm.com_expl.label |
| 99 |
label .$t.grp_frm.com_expl.label \ |
| 100 |
-textvariable ascCallbackVect(purposelabel) |
| 101 |
|
| 102 |
# build widget .$t.grp_frm.com_expl.scrollbar1 |
| 103 |
scrollbar .$t.grp_frm.com_expl.scrollbar1 \ |
| 104 |
-command ".$t.grp_frm.com_expl.text2 yview" \ |
| 105 |
-relief flat |
| 106 |
|
| 107 |
# build widget .$t.grp_frm.com_expl.text2 |
| 108 |
text .$t.grp_frm.com_expl.text2 \ |
| 109 |
-exportselection 0 \ |
| 110 |
-height 2 \ |
| 111 |
-relief flat \ |
| 112 |
-width 2 \ |
| 113 |
-wrap word \ |
| 114 |
-yscrollcommand ".$t.grp_frm.com_expl.scrollbar1 set" |
| 115 |
|
| 116 |
# build widget .$t.com_frm |
| 117 |
frame .$t.com_frm \ |
| 118 |
-borderwidth 0 |
| 119 |
|
| 120 |
# build widget .$t.com_frm.frame |
| 121 |
frame .$t.com_frm.frame |
| 122 |
|
| 123 |
set ascCallbackVect(listlabel) "Commands:" |
| 124 |
# build widget .$t.com_frm.frame.label |
| 125 |
label .$t.com_frm.frame.label \ |
| 126 |
-textvariable ascCallbackVect(listlabel) |
| 127 |
|
| 128 |
# build widget .$t.com_frm.frame.scrollbar3 |
| 129 |
scrollbar .$t.com_frm.frame.scrollbar3 \ |
| 130 |
-command ".$t.com_frm.frame.listbox1 xview" \ |
| 131 |
-orient {horizontal} \ |
| 132 |
-relief flat |
| 133 |
|
| 134 |
# build widget .$t.com_frm.frame.scrollbar2 |
| 135 |
scrollbar .$t.com_frm.frame.scrollbar2 \ |
| 136 |
-command ".$t.com_frm.frame.listbox1 yview" \ |
| 137 |
-relief flat |
| 138 |
|
| 139 |
# build widget .$t.com_frm.frame.listbox1 |
| 140 |
listbox .$t.com_frm.frame.listbox1 \ |
| 141 |
-exportselection 0 \ |
| 142 |
-relief flat \ |
| 143 |
-xscrollcommand ".$t.com_frm.frame.scrollbar3 set" \ |
| 144 |
-yscrollcommand ".$t.com_frm.frame.scrollbar2 set" |
| 145 |
|
| 146 |
# build widget .$t.com_frm.frame11 |
| 147 |
frame .$t.com_frm.frame11 \ |
| 148 |
-relief flat |
| 149 |
|
| 150 |
# build widget .$t.com_frm.frame11.scrollbar1 |
| 151 |
scrollbar .$t.com_frm.frame11.scrollbar1 \ |
| 152 |
-command ".$t.com_frm.frame11.text2 yview" \ |
| 153 |
-relief flat |
| 154 |
|
| 155 |
# build widget .$t.com_frm.frame11.text2 |
| 156 |
text .$t.com_frm.frame11.text2 \ |
| 157 |
-exportselection 0 \ |
| 158 |
-relief flat \ |
| 159 |
-wrap word \ |
| 160 |
-yscrollcommand ".$t.com_frm.frame11.scrollbar1 set" |
| 161 |
|
| 162 |
# build widget .$t.frame0 |
| 163 |
frame .$t.frame0 \ |
| 164 |
-borderwidth 0 \ |
| 165 |
-relief flat |
| 166 |
|
| 167 |
# build widget .$t.menubar |
| 168 |
menu .$t.menubar |
| 169 |
|
| 170 |
# The File menu |
| 171 |
menu .$t.menubar.file \ |
| 172 |
-tearoffcommand .[string toupper $t].MENUBAR.FILE \ |
| 173 |
-tearoff 0 |
| 174 |
.$t.menubar.file add command \ |
| 175 |
-command {Callback_do_Print} \ |
| 176 |
-label {Print ...} \ |
| 177 |
-underline 0 |
| 178 |
.$t.menubar.file add separator |
| 179 |
.$t.menubar.file add command \ |
| 180 |
-command {Callback_do_Close} \ |
| 181 |
-label {Close window} \ |
| 182 |
-underline 0 |
| 183 |
|
| 184 |
# The Find menu |
| 185 |
menu .$t.menubar.search \ |
| 186 |
-tearoffcommand .[string toupper $t].MENUBAR.SEARCH \ |
| 187 |
-tearoff 0 |
| 188 |
.$t.menubar.search add command \ |
| 189 |
-command {Callback_do_wordsearch} \ |
| 190 |
-state disabled \ |
| 191 |
-label {Keywords ...} \ |
| 192 |
-underline 0 |
| 193 |
.$t.menubar.search add command \ |
| 194 |
-command {Callback_do_usagesearch} \ |
| 195 |
-state disabled \ |
| 196 |
-label {Short explanations ...} \ |
| 197 |
-underline 0 |
| 198 |
.$t.menubar.search add command \ |
| 199 |
-command {Callback_do_textsearch} \ |
| 200 |
-state disabled \ |
| 201 |
-label {Long explanations ...} \ |
| 202 |
-underline 0 |
| 203 |
.$t.menubar.search add command \ |
| 204 |
-command {Callback_do_command} \ |
| 205 |
-state disabled \ |
| 206 |
-label {Name of command ...} \ |
| 207 |
-underline 0 |
| 208 |
|
| 209 |
# The View menu |
| 210 |
menu .$t.menubar.view \ |
| 211 |
-tearoffcommand .[string toupper $t].MENUBAR.VIEW \ |
| 212 |
-tearoff 0 |
| 213 |
# the group list cascade under view. |
| 214 |
menu .$t.menubar.view.groups \ |
| 215 |
-tearoffcommand .[string toupper $t].MENUBAR.VIEW.GROUPS \ |
| 216 |
-tearoff 0 |
| 217 |
.$t.menubar.view add command \ |
| 218 |
-command {Callback_do_All} \ |
| 219 |
-label {All callbacks} \ |
| 220 |
-underline 0 |
| 221 |
.$t.menubar.view add command \ |
| 222 |
-command {Callback_do_Groups} \ |
| 223 |
-label {Group of callbacks} \ |
| 224 |
-underline 0 |
| 225 |
.$t.menubar.view add command \ |
| 226 |
-command {Callback_do_Arrays} \ |
| 227 |
-label {Global arrays} \ |
| 228 |
-underline 7 |
| 229 |
.$t.menubar.view add separator |
| 230 |
.$t.menubar.view add command \ |
| 231 |
-command {Callback_do_Font} \ |
| 232 |
-label {Font ...} \ |
| 233 |
-underline 0 |
| 234 |
|
| 235 |
# The Help menu |
| 236 |
menu .$t.menubar.help \ |
| 237 |
-tearoffcommand .[string toupper $t].MENUBAR.HELP \ |
| 238 |
-tearoff 0 |
| 239 |
.$t.menubar.help add command \ |
| 240 |
-command {Callback_do_About} \ |
| 241 |
-label {About ASCEND Callbacks} \ |
| 242 |
-underline 0 |
| 243 |
.$t.menubar.help add command \ |
| 244 |
-command {Callback_do_syntax} \ |
| 245 |
-label {Callback options} \ |
| 246 |
-underline 0 |
| 247 |
.$t.menubar.help add command \ |
| 248 |
-command {Callback_do_TOC} \ |
| 249 |
-label {Table of contents} \ |
| 250 |
-underline 0 |
| 251 |
|
| 252 |
# |
| 253 |
# Add the menus as cascades of the toplevel's menu; |
| 254 |
# add the toplevel's menu to the toplevel |
| 255 |
# |
| 256 |
.$t.menubar add cascade \ |
| 257 |
-menu .$t.menubar.file \ |
| 258 |
-label {File} \ |
| 259 |
-underline 0 |
| 260 |
.$t.menubar add cascade \ |
| 261 |
-menu .$t.menubar.search \ |
| 262 |
-label {Find} \ |
| 263 |
-underline 0 |
| 264 |
.$t.menubar add cascade \ |
| 265 |
-menu .$t.menubar.view \ |
| 266 |
-label {View} \ |
| 267 |
-underline 0 |
| 268 |
.$t.menubar add cascade \ |
| 269 |
-menu .$t.menubar.help \ |
| 270 |
-label {Help} \ |
| 271 |
-underline 0 |
| 272 |
.$t configure \ |
| 273 |
-menu .$t.menubar |
| 274 |
|
| 275 |
# pack master .$t.grp_frm |
| 276 |
pack configure .$t.grp_frm.com_list \ |
| 277 |
-expand 1 \ |
| 278 |
-fill both \ |
| 279 |
-side left |
| 280 |
pack configure .$t.grp_frm.com_expl \ |
| 281 |
-expand 1 \ |
| 282 |
-fill both \ |
| 283 |
-side left |
| 284 |
|
| 285 |
# pack master .$t.grp_frm.com_list |
| 286 |
pack configure .$t.grp_frm.com_list.label \ |
| 287 |
-fill x \ |
| 288 |
-side top |
| 289 |
pack configure .$t.grp_frm.com_list.scrollbar2 \ |
| 290 |
-fill y \ |
| 291 |
-side left |
| 292 |
pack configure .$t.grp_frm.com_list.listbox1 \ |
| 293 |
-expand 1 \ |
| 294 |
-fill both |
| 295 |
pack configure .$t.grp_frm.com_list.scrollbar3 \ |
| 296 |
-fill x \ |
| 297 |
-side bottom |
| 298 |
|
| 299 |
# pack master .$t.grp_frm.com_expl |
| 300 |
pack configure .$t.grp_frm.com_expl.label \ |
| 301 |
-fill x \ |
| 302 |
-side top |
| 303 |
pack configure .$t.grp_frm.com_expl.scrollbar1 \ |
| 304 |
-fill y \ |
| 305 |
-side right |
| 306 |
pack configure .$t.grp_frm.com_expl.text2 \ |
| 307 |
-expand 1 \ |
| 308 |
-fill both |
| 309 |
|
| 310 |
# pack master .$t.com_frm |
| 311 |
pack configure .$t.com_frm.frame \ |
| 312 |
-expand 1 \ |
| 313 |
-fill both \ |
| 314 |
-side left |
| 315 |
pack configure .$t.com_frm.frame11 \ |
| 316 |
-expand 1 \ |
| 317 |
-fill both \ |
| 318 |
-side left |
| 319 |
|
| 320 |
# pack master .$t.com_frm.frame |
| 321 |
pack configure .$t.com_frm.frame.label \ |
| 322 |
-fill x \ |
| 323 |
-side top |
| 324 |
pack configure .$t.com_frm.frame.scrollbar2 \ |
| 325 |
-fill y \ |
| 326 |
-side left |
| 327 |
pack configure .$t.com_frm.frame.listbox1 \ |
| 328 |
-expand 1 \ |
| 329 |
-fill both |
| 330 |
pack configure .$t.com_frm.frame.scrollbar3 \ |
| 331 |
-fill x \ |
| 332 |
-side bottom |
| 333 |
|
| 334 |
# pack master .$t.com_frm.frame11 |
| 335 |
pack configure .$t.com_frm.frame11.scrollbar1 \ |
| 336 |
-fill y \ |
| 337 |
-side right |
| 338 |
pack configure .$t.com_frm.frame11.text2 \ |
| 339 |
-expand 1 \ |
| 340 |
-fill both |
| 341 |
|
| 342 |
pack configure .$t.grp_frm \ |
| 343 |
-expand 1 \ |
| 344 |
-fill both |
| 345 |
pack configure .$t.com_frm \ |
| 346 |
-expand 1 \ |
| 347 |
-fill both |
| 348 |
|
| 349 |
.$t.grp_frm.com_list.listbox1 insert end {list of groups} |
| 350 |
.$t.grp_frm.com_expl.text2 insert end {explanation of selected group} |
| 351 |
.$t.com_frm.frame.listbox1 insert end {list of commands} |
| 352 |
.$t.com_frm.frame11.text2 insert end {explanation of command selected at left} |
| 353 |
|
| 354 |
|
| 355 |
EndSrc.callback |
| 356 |
} |
| 357 |
|
| 358 |
proc DestroyWindow.callback {} {# xf ignore me 7 |
| 359 |
catch "destroy .callback" |
| 360 |
} |
| 361 |
|
| 362 |
|
| 363 |
# User defined procedures |
| 364 |
|
| 365 |
proc EndSrc.callback {} { |
| 366 |
Callback_Update |
| 367 |
} |
| 368 |
|
| 369 |
# User defined images |
| 370 |
|
| 371 |
|
| 372 |
# Internal procedures |
| 373 |
|
| 374 |
# eof |
| 375 |
# |
| 376 |
|