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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096
|
# @(#)init.tcl 8.10 (Berkeley) 7/19/96
proc screen {} {
global tk_ssize_row
global tk_ssize_col
# Build menubar with File, Options and Help entries.
frame .menu -relief raised -borderwidth 1
pack append . .menu {top fillx}
# File pull-down menu
menubutton .menu.file -text "File" \
-menu .menu.file.fileops -underline 0
menu .menu.file.fileops
.menu.file.fileops add command -label "Edit ..." \
-command "tk_edit" -underline 0
.menu.file.fileops add command -label "Save File" \
-command "tk_write" -underline 0
.menu.file.fileops add command -label "Save File as ..." \
-command "tk_writeas" -underline 1
.menu.file.fileops add command -label "Save and Quit" \
-command "tk_writequit" -underline 7
.menu.file.fileops add command -label "Quit" \
-command "tk_quit" -underline 0
# Options pull-down menu
menubutton .menu.option -text "Options" \
-menu .menu.option.optionops -underline 0
menu .menu.option.optionops
.menu.option.optionops add command -label "Set all" \
-command tk_options -underline 0
# Help pull-down menu
menubutton .menu.help -text "Help" \
-menu .menu.help.helpops -underline 0
menu .menu.help.helpops
.menu.help.helpops add command -label "On Help" -underline 3 \
-command tk_help
.menu.help.helpops add command -label "On Version" -underline 3 \
-command tk_version
pack append .menu \
.menu.file {left} .menu.option {left} .menu.help {right}
# Set up for keyboard-based menu traversal
tk_bindForTraversal .
bind . <Any-Enter> {focus .}
focus .
tk_menuBar .menu .menu.file .menu.help
# Create text window
text .t -relief raised -bd 1 -setgrid true -yscrollcommand ".s set"
scrollbar .s -relief flat -command ".t yview"
pack append . .s {right filly} .t {expand fill}
# Use tags to build a cursor for the text window.
set bg [lindex [.t config -background] 4]
set fg [lindex [.t config -foreground] 4]
.t tag configure tk_cursor -background $fg -foreground $bg
.t mark set tk_cursor_indx insert
.t tag add tk_cursor tk_cursor_indx
# Bind the keys.
bind .t <Any-KeyPress> {tk_flash; break}
bind .t 0 {tk_key_enter "0"; break}
bind .t 1 {tk_key_enter "1"; break}
bind .t 2 {tk_key_enter "2"; break}
bind .t 3 {tk_key_enter "3"; break}
bind .t 4 {tk_key_enter "4"; break}
bind .t 5 {tk_key_enter "5"; break}
bind .t 6 {tk_key_enter "6"; break}
bind .t 7 {tk_key_enter "7"; break}
bind .t 8 {tk_key_enter "8"; break}
bind .t 9 {tk_key_enter "9"; break}
bind .t <BackSpace> {tk_key_enter "\010"; break}
bind .t <Control-a> {tk_key_enter "\001"; break}
bind .t <Control-b> {tk_key_enter "\002"; break}
bind .t <Control-c> {tk_key_enter "\003"; break}
bind .t <Control-d> {tk_key_enter "\004"; break}
bind .t <Control-e> {tk_key_enter "\005"; break}
bind .t <Control-f> {tk_key_enter "\006"; break}
bind .t <Control-g> {tk_key_enter "\007"; break}
bind .t <Control-h> {tk_key_enter "\010"; break}
bind .t <Control-i> {tk_key_enter "\011"; break}
bind .t <Control-j> {tk_key_enter "\012"; break}
bind .t <Control-k> {tk_key_enter "\013"; break}
bind .t <Control-l> {tk_key_enter "\014"; break}
bind .t <Control-m> {tk_key_enter "\015"; break}
bind .t <Control-n> {tk_key_enter "\016"; break}
bind .t <Control-o> {tk_key_enter "\017"; break}
bind .t <Control-p> {tk_key_enter "\020"; break}
bind .t <Control-q> {tk_key_enter "\021"; break}
bind .t <Control-r> {tk_key_enter "\022"; break}
bind .t <Control-s> {tk_key_enter "\023"; break}
bind .t <Control-t> {tk_key_enter "\024"; break}
bind .t <Control-u> {tk_key_enter "\025"; break}
bind .t <Control-v> {tk_key_enter "\026"; break}
bind .t <Control-w> {tk_key_enter "\027"; break}
bind .t <Control-x> {tk_key_enter "\030"; break}
bind .t <Control-y> {tk_key_enter "\031"; break}
bind .t <Control-z> {tk_key_enter "\032"; break}
bind .t <Control_L> {tk_noop; break}
bind .t <Control_R> {tk_noop; break}
bind .t <Delete> {tk_key_enter "x"; break}
bind .t <Down> {tk_key_enter "j"; break}
bind .t <End> {tk_key_enter "G"; break}
bind .t <Escape> {tk_key_enter "\033"; break}
bind .t <Home> {tk_key_enter "1G"; break}
bind .t <Insert> {tk_key_enter "i"; break}
bind .t <Left> {tk_key_enter "h"; break}
bind .t <Next> {tk_key_enter "\006"; break}
bind .t <Prior> {tk_key_enter "\002"; break}
bind .t <Return> {tk_key_enter "\015"; break}
bind .t <Right> {tk_key_enter "l"; break}
bind .t <Shift_L> {tk_noop; break}
bind .t <Shift_Lock> {tk_noop; break}
bind .t <Shift_R> {tk_noop; break}
bind .t <Tab> {tk_key_enter "\011"; break}
bind .t <Up> {tk_key_enter "k"; break}
bind .t <ampersand> {tk_key_enter "&"; break}
bind .t <asciicircum> {tk_key_enter "^"; break}
bind .t <asciitilde> {tk_key_enter "~"; break}
bind .t <asterisk> {tk_key_enter "*"; break}
bind .t <at> {tk_key_enter "@"; break}
bind .t <backslash> {tk_key_enter "\\"; break}
bind .t <bar> {tk_key_enter "|"; break}
bind .t <braceleft> {tk_key_enter "{"; break}
bind .t <braceright> {tk_key_enter "; break}"}
bind .t <bracketleft> {tk_key_enter "\["; break}
bind .t <bracketright> {tk_key_enter "]"; break}
bind .t <colon> {tk_key_enter ":"; break}
bind .t <comma> {tk_key_enter ","; break}
bind .t <dollar> {tk_key_enter "$"; break}
bind .t <equal> {tk_key_enter "="; break}
bind .t <exclam> {tk_key_enter "!"; break}
bind .t <greater> {tk_key_enter ">"; break}
bind .t <less> {tk_key_enter "<"; break}
bind .t <minus> {tk_key_enter "-"; break}
bind .t <numbersign> {tk_key_enter "#"; break}
bind .t <parenleft> {tk_key_enter "("; break}
bind .t <parenright> {tk_key_enter ")"; break}
bind .t <percent> {tk_key_enter "%"; break}
bind .t <period> {tk_key_enter "."; break}
bind .t <plus> {tk_key_enter "+"; break}
bind .t <question> {tk_key_enter "?"; break}
bind .t <quotedbl> {tk_key_enter "\""; break}
bind .t <quoteright> {tk_key_enter "'"; break}
bind .t <semicolon> {tk_key_enter ";"; break}
bind .t <slash> {tk_key_enter "/"; break}
bind .t <space> {tk_key_enter " "; break}
bind .t <underscore> {tk_key_enter "_"; break}
bind .t A {tk_key_enter "A"; break}
bind .t B {tk_key_enter "B"; break}
bind .t C {tk_key_enter "C"; break}
bind .t D {tk_key_enter "D"; break}
bind .t E {tk_key_enter "E"; break}
bind .t F {tk_key_enter "F"; break}
bind .t G {tk_key_enter "G"; break}
bind .t H {tk_key_enter "H"; break}
bind .t I {tk_key_enter "I"; break}
bind .t J {tk_key_enter "J"; break}
bind .t K {tk_key_enter "K"; break}
bind .t L {tk_key_enter "L"; break}
bind .t M {tk_key_enter "M"; break}
bind .t N {tk_key_enter "N"; break}
bind .t O {tk_key_enter "O"; break}
bind .t P {tk_key_enter "P"; break}
bind .t Q {tk_key_enter "Q"; break}
bind .t R {tk_key_enter "R"; break}
bind .t S {tk_key_enter "S"; break}
bind .t T {tk_key_enter "T"; break}
bind .t U {tk_key_enter "U"; break}
bind .t V {tk_key_enter "V"; break}
bind .t W {tk_key_enter "W"; break}
bind .t X {tk_key_enter "X"; break}
bind .t Y {tk_key_enter "Y"; break}
bind .t Z {tk_key_enter "Z"; break}
bind .t a {tk_key_enter "a"; break}
bind .t b {tk_key_enter "b"; break}
bind .t c {tk_key_enter "c"; break}
bind .t d {tk_key_enter "d"; break}
bind .t e {tk_key_enter "e"; break}
bind .t f {tk_key_enter "f"; break}
bind .t g {tk_key_enter "g"; break}
bind .t h {tk_key_enter "h"; break}
bind .t i {tk_key_enter "i"; break}
bind .t j {tk_key_enter "j"; break}
bind .t k {tk_key_enter "k"; break}
bind .t l {tk_key_enter "l"; break}
bind .t m {tk_key_enter "m"; break}
bind .t n {tk_key_enter "n"; break}
bind .t o {tk_key_enter "o"; break}
bind .t p {tk_key_enter "p"; break}
bind .t q {tk_key_enter "q"; break}
bind .t r {tk_key_enter "r"; break}
bind .t s {tk_key_enter "s"; break}
bind .t t {tk_key_enter "t"; break}
bind .t u {tk_key_enter "u"; break}
bind .t v {tk_key_enter "v"; break}
bind .t w {tk_key_enter "w"; break}
bind .t x {tk_key_enter "x"; break}
bind .t y {tk_key_enter "y"; break}
bind .t z {tk_key_enter "z"; break}
# XXX
# I haven't been able to make Tcl/Tk write uninitialized portions
# of the text window. Fill in the screen.
tk_ssize
.t mark set insert 1.0
for {set i 1} {$i <= $tk_ssize_row} {incr i} {
for {set j 1} {$j <= $tk_ssize_col} {incr j} {
.t insert insert " "
}
.t insert insert "\n"
}
}
# tk_noop --
# Do nothing.
#
# XXX
# I can't figure out how to get a binding that does nothing without
# calling a function, so this stub does it for me.
proc tk_noop {} {
}
# tk_key_enter --
# Enter a key.
proc tk_key_enter {val} {
global newkey
global waiting
set waiting 0
tk_key $val
set newkey 1
}
# tk_key_wait --
# Wait for a key.
proc tk_key_wait {timeout} {
global newkey
global waiting
if { $timeout != 0 } {
after $timeout "set newkey 1"
}
set waiting 1
tkwait variable newkey
}
# Callback functions for the File menu.
# tk_edit
# Edit another file.
proc tk_edit {} {
}
# tk_quit
# Quit.
proc tk_quit {} {
global newkey
global waiting
tk_op quit
if { $waiting != 0 } {
set newkey 1
}
}
# tk_write
# Write the edit buffer.
proc tk_write {} {
global newkey
global waiting
tk_op write
if { $waiting != 0 } {
set newkey 1
}
}
# tk_writeas
# Write the edit buffer to a named file.
proc tk_writeas {} {
}
# tk_writequit
# Write and quit.
proc tk_writequit {} {
global newkey
global waiting
tk_op writequit
if { $waiting != 0 } {
set newkey 1
}
}
# Callback functions for the Help menu.
#
# tk_help --
# Present a help screen.
proc tk_help {} {
tk_dialog .d {} "No help screen currently available." {} 0 Continue
}
# tk_options
# Contains the option selector box. It is divided into three parts, the
# checkbuttons for the boolean options, the entry fields for the string
# numeric options, and a control area containing buttons. There is only
# one function.
proc tk_options {} {
# Build option selector box with three subframes for boolean,
# numeric, and string options. Make it a toplevel window.
toplevel .os
wm title .os options
# Option variables.
global tko_altwerase
global tko_autoindent
global tko_autoprint
global tko_autowrite
global tko_backup
global tko_beautify
global tko_cdpath
global tko_cedit
global tko_columns
global tko_comment
global tko_directory
global tko_edcompatible
global tko_escapetime
global tko_errorbells
global tko_exrc
global tko_extended
global tko_filec
global tko_flash
global tko_hardtabs
global tko_iclower
global tko_ignorecase
global tko_keytime
global tko_leftright
global tko_lines
global tko_lisp
global tko_list
global tko_lock
global tko_magic
global tko_matchtime
global tko_mesg
global tko_modeline
global tko_msgcat
global tko_noprint
global tko_number
global tko_octal
global tko_open
global tko_optimize
global tko_paragraphs
global tko_print
global tko_prompt
global tko_readonly
global tko_recdir
global tko_redraw
global tko_remap
global tko_report
global tko_ruler
global tko_scroll
global tko_searchincr
global tko_sections
global tko_secure
global tko_shell
global tko_shellmeta
global tko_shiftwidth
global tko_showmatch
global tko_showmode
global tko_sidescroll
global tko_slowopen
global tko_sourceany
global tko_tabstop
global tko_taglength
global tko_tags
global tko_term
global tko_terse
global tko_tildeop
global tko_timeout
global tko_ttywerase
global tko_verbose
global tko_warn
global tko_window
global tko_windowname
global tko_wraplen
global tko_wrapmargin
global tko_wrapscan
global tko_writeany
# Initialize option values.
tk_opt_init
# Build subframe for boolean options.
frame .os.bopts
# This is the width of the edcompatible button.
set buttonwidth 13
# Pack the boolean os, 5 to a frame.
frame .os.bopts.f1
pack append .os.bopts .os.bopts.f1 {top}
checkbutton .os.bopts.f1.b1 \
-variable tko_altwerase -text "altwerase" \
-command "tk_opt_set altwerase $tko_altwerase" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f1.b2 \
-variable tko_autoindent -text "autoindent" \
-command "tk_opt_set autoindent $tko_autoindent" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f1.b3 \
-variable tko_autoprint -text "autoprint" \
-command "tk_opt_set autoprint $tko_autoprint" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f1.b4 \
-variable tko_autowrite -text "autowrite" \
-command "tk_opt_set autowrite $tko_autowrite" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f1.b5 \
-variable tko_beautify -text "beautify" \
-command "tk_opt_set beautify $tko_beautify" \
-width $buttonwidth -anchor w
pack append .os.bopts.f1 \
.os.bopts.f1.b1 {left frame w} \
.os.bopts.f1.b2 {left frame w} \
.os.bopts.f1.b3 {left frame w} \
.os.bopts.f1.b4 {left frame w} \
.os.bopts.f1.b5 {left frame w}
frame .os.bopts.f2
pack append .os.bopts .os.bopts.f2 {top}
checkbutton .os.bopts.f2.b1 \
-variable tko_comment -text "comment" \
-command "tk_opt_set comment $tko_comment" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f2.b2 \
-variable tko_edcompatible -text "edcompatible" \
-command "tk_opt_set edcompatible $tko_edcompatible" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f2.b3 \
-variable tko_errorbells -text "errorbells" \
-command "tk_opt_set errorbells $tko_errorbells" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f2.b4 \
-variable tko_exrc -text "exrc" \
-command "tk_opt_set exrc $tko_exrc" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f2.b5 \
-variable tko_extended -text "extended" \
-command "tk_opt_set extended $tko_extended" \
-width $buttonwidth -anchor w
pack append .os.bopts.f2 \
.os.bopts.f2.b1 {left frame w} \
.os.bopts.f2.b2 {left frame w} \
.os.bopts.f2.b3 {left frame w} \
.os.bopts.f2.b4 {left frame w} \
.os.bopts.f2.b5 {left frame w}
frame .os.bopts.f3
pack append .os.bopts .os.bopts.f3 {top}
checkbutton .os.bopts.f3.b1 \
-variable tko_flash -text "flash" \
-command "tk_opt_set flash $tko_flash" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f3.b2 \
-variable tko_iclower -text "iclower" \
-command "tk_opt_set iclower $tko_iclower" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f3.b3 \
-variable tko_ignorecase -text "ignorecase" \
-command "tk_opt_set ignorecase $tko_ignorecase" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f3.b4 \
-variable tko_leftright -text "leftright" \
-command "tk_opt_set leftright $tko_leftright" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f3.b5 \
-variable tko_lisp -text "lisp" \
-command "tk_opt_set lisp $tko_lisp" \
-width $buttonwidth -anchor w
pack append .os.bopts.f3 \
.os.bopts.f3.b1 {left frame w} \
.os.bopts.f3.b2 {left frame w} \
.os.bopts.f3.b3 {left frame w} \
.os.bopts.f3.b4 {left frame w} \
.os.bopts.f3.b5 {left frame w}
frame .os.bopts.f4
pack append .os.bopts .os.bopts.f4 {top}
checkbutton .os.bopts.f4.b1 \
-variable tko_list -text "list" \
-command "tk_opt_set list $tko_list" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f4.b2 \
-variable tko_lock -text "lock" \
-command "tk_opt_set lock $tko_lock" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f4.b3 \
-variable tko_magic -text "magic" \
-command "tk_opt_set magic $tko_magic" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f4.b4 \
-variable tko_mesg -text "mesg" \
-command "tk_opt_set mesg $tko_mesg" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f4.b5\
-variable tko_number -text "number" \
-command "tk_opt_set number $tko_number" \
-width $buttonwidth -anchor w
pack append .os.bopts.f4 \
.os.bopts.f4.b1 {left frame w} \
.os.bopts.f4.b2 {left frame w} \
.os.bopts.f4.b3 {left frame w} \
.os.bopts.f4.b4 {left frame w} \
.os.bopts.f4.b5 {left frame w}
frame .os.bopts.f5
pack append .os.bopts .os.bopts.f5 {top}
checkbutton .os.bopts.f5.b1 \
-variable tko_octal -text "octal" \
-command "tk_opt_set octal $tko_octal" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f5.b2 \
-variable tko_open -text "open" \
-command "tk_opt_set open $tko_open" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f5.b3 \
-variable tko_optimize -text "optimize" \
-command "tk_opt_set optimize $tko_optimize" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f5.b4 \
-variable tko_prompt -text "prompt" \
-command "tk_opt_set prompt $tko_prompt" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f5.b5 \
-variable tko_readonly -text "readonly" \
-command "tk_opt_set readonly $tko_readonly" \
-width $buttonwidth -anchor w
pack append .os.bopts.f5 \
.os.bopts.f5.b1 {left frame w} \
.os.bopts.f5.b2 {left frame w} \
.os.bopts.f5.b3 {left frame w} \
.os.bopts.f5.b4 {left frame w} \
.os.bopts.f5.b5 {left frame w}
frame .os.bopts.f6
pack append .os.bopts .os.bopts.f6 {top}
checkbutton .os.bopts.f6.b1 \
-variable tko_remap -text "remap" \
-command "tk_opt_set remap $tko_remap" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f6.b2 \
-variable tko_ruler -text "ruler" \
-command "tk_opt_set ruler $tko_ruler" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f6.b3 \
-variable tko_searchincr -text "searchincr" \
-command "tk_opt_set searchincr $tko_searchincr" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f6.b4 \
-variable tko_secure -text "secure" \
-command "tk_opt_set secure $tko_secure" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f6.b5 \
-variable tko_showmatch -text "showmatch" \
-command "tk_opt_set showmatch $tko_showmatch" \
-width $buttonwidth -anchor w
pack append .os.bopts.f6 \
.os.bopts.f6.b1 {left frame w} \
.os.bopts.f6.b2 {left frame w} \
.os.bopts.f6.b3 {left frame w} \
.os.bopts.f6.b4 {left frame w} \
.os.bopts.f6.b5 {left frame w}
frame .os.bopts.f7
pack append .os.bopts .os.bopts.f7 {top}
checkbutton .os.bopts.f7.b1 \
-variable tko_showmode -text "showmode" \
-command "tk_opt_set showmode $tko_showmode" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f7.b2 \
-variable tko_slowopen -text "slowopen" \
-command "tk_opt_set slowopen $tko_slowopen" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f7.b3 \
-variable tko_sourceany -text "sourceany" \
-command "tk_opt_set sourceany $tko_sourceany" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f7.b4 \
-variable tko_terse -text "terse" \
-command "tk_opt_set terse $tko_terse" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f7.b5 \
-variable tko_tildeop -text "tildeop" \
-command "tk_opt_set tildeope $tko_tildeop" \
-width $buttonwidth -anchor w
pack append .os.bopts.f7 \
.os.bopts.f7.b1 {left frame w} \
.os.bopts.f7.b2 {left frame w} \
.os.bopts.f7.b3 {left frame w} \
.os.bopts.f7.b4 {left frame w} \
.os.bopts.f7.b5 {left frame w}
frame .os.bopts.f8
pack append .os.bopts .os.bopts.f8 {top fillx}
checkbutton .os.bopts.f8.b1 \
-variable tko_timeout -text "timeout" \
-command "tk_opt_set timeout $tko_timeout" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f8.b2 \
-variable tko_ttywerase -text "ttywerase" \
-command "tk_opt_set ttywerase $tko_ttywerase" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f8.b3 \
-variable tko_verbose -text "verbose" \
-command "tk_opt_set verbose $tko_verbose" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f8.b4 \
-variable tko_warn -text "warn" \
-command "tk_opt_set warn $tko_warn" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f8.b5 \
-variable tko_windowname -text "windowname" \
-command "tk_opt_set windowname $tko_windowname" \
-width $buttonwidth -anchor w
pack append .os.bopts.f8 \
.os.bopts.f8.b1 {left frame w} \
.os.bopts.f8.b2 {left frame w} \
.os.bopts.f8.b3 {left frame w} \
.os.bopts.f8.b4 {left frame w} \
.os.bopts.f8.b5 {left frame w}
frame .os.bopts.f9
pack append .os.bopts .os.bopts.f9 {top fillx}
checkbutton .os.bopts.f9.b1 \
-variable tko_wrapscan -text "wrapscan" \
-command "tk_opt_set wrapscan $tko_wrapscan" \
-width $buttonwidth -anchor w
checkbutton .os.bopts.f9.b2 \
-variable tko_writeany -text "writeany" \
-command "tk_opt_set writeany $tko_writeany" \
-width $buttonwidth -anchor w
pack append .os.bopts.f9 \
.os.bopts.f9.b1 {left frame w} \
.os.bopts.f9.b2 {left frame w}
# Build frame for number options:
frame .os.nopts
# Label and entry widths.
set lwidth 12
set ewidth 3
frame .os.nopts.n1
label .os.nopts.n1.l -text "column:" -width $lwidth -anchor w
entry .os.nopts.n1.e -width $ewidth -relief raised \
-textvariable tko_columns
trace variable tko_columns w tk_opt_ew
pack append .os.nopts.n1 \
.os.nopts.n1.l {left} .os.nopts.n1.e {left frame w}
frame .os.nopts.n2
label .os.nopts.n2.l -text "escapetime:" -width $lwidth -anchor w
entry .os.nopts.n2.e -width $ewidth -textvariable tko_escapetime \
-relief raised
trace variable tko_escapetime w tk_opt_ew
pack append .os.nopts.n2 \
.os.nopts.n2.l {left} .os.nopts.n2.e {left frame w}
frame .os.nopts.n3
label .os.nopts.n3.l -text "hardtabs:" -width $lwidth -anchor w
entry .os.nopts.n3.e -width $ewidth -textvariable tko_hardtabs \
-relief raised
trace variable tko_hardtabs w tk_opt_ew
pack append .os.nopts.n3 \
.os.nopts.n3.l {left} .os.nopts.n3.e {left frame w}
frame .os.nopts.n4
label .os.nopts.n4.l -text "keytime:" -width $lwidth -anchor w
entry .os.nopts.n4.e -width $ewidth -textvariable tko_keytime \
-relief raised
trace variable tko_keytime w tk_opt_ew
pack append .os.nopts.n4 \
.os.nopts.n4.l {left} .os.nopts.n4.e {left frame w}
frame .os.nopts.n5
label .os.nopts.n5.l -text "lines:" -width $lwidth -anchor w
entry .os.nopts.n5.e -width $ewidth -textvariable tko_lines \
-relief raised
trace variable tko_lines w tk_opt_ew
pack append .os.nopts.n5 \
.os.nopts.n5.l {left} .os.nopts.n5.e {left frame w}
frame .os.nopts.n6
label .os.nopts.n6.l -text "matchtime:" -width $lwidth -anchor w
entry .os.nopts.n6.e -width $ewidth -textvariable tko_matchtime \
-relief raised
trace variable tko_matchtime w tk_opt_ew
pack append .os.nopts.n6 \
.os.nopts.n6.l {left} .os.nopts.n6.e {left frame w}
frame .os.nopts.n7
label .os.nopts.n7.l -text "report:" -width $lwidth -anchor w
entry .os.nopts.n7.e -width $ewidth -textvariable tko_report \
-relief raised
trace variable tko_report w tk_opt_ew
pack append .os.nopts.n7 \
.os.nopts.n7.l {left} .os.nopts.n7.e {left frame w}
frame .os.nopts.n8
label .os.nopts.n8.l -text "scroll:" -width $lwidth -anchor w
entry .os.nopts.n8.e -width $ewidth -textvariable tko_scroll \
-relief raised
trace variable tko_scroll w tk_opt_ew
pack append .os.nopts.n8 \
.os.nopts.n8.l {left} .os.nopts.n8.e {left frame w}
frame .os.nopts.n9
label .os.nopts.n9.l -text "shiftwidth:" -width $lwidth -anchor w
entry .os.nopts.n9.e -width $ewidth -textvariable tko_shiftwidth \
-relief raised
trace variable tko_shiftwidth w tk_opt_ew
pack append .os.nopts.n9 \
.os.nopts.n9.l {left} .os.nopts.n9.e {left frame w}
frame .os.nopts.n10
label .os.nopts.n10.l -text "sidescroll:" -width $lwidth -anchor w
entry .os.nopts.n10.e -width $ewidth -textvariable tko_sidescroll \
-relief raised
trace variable tko_sidescroll w tk_opt_ew
pack append .os.nopts.n10 \
.os.nopts.n10.l {left} .os.nopts.n10.e {left frame w}
frame .os.nopts.n11
label .os.nopts.n11.l -text "tabstop:" -width $lwidth -anchor w
entry .os.nopts.n11.e -width $ewidth -textvariable tko_tabstop \
-relief raised
trace variable tko_tabstop w tk_opt_ew
pack append .os.nopts.n11 \
.os.nopts.n11.l {left} .os.nopts.n11.e {left frame w}
frame .os.nopts.n12
label .os.nopts.n12.l -text "taglength:" -width $lwidth -anchor w
entry .os.nopts.n12.e -width $ewidth -textvariable tko_taglength \
-relief raised
trace variable tko_taglength w tk_opt_ew
pack append .os.nopts.n12 \
.os.nopts.n12.l {left} .os.nopts.n12.e {left frame w}
frame .os.nopts.n13
label .os.nopts.n13.l -text "window:" -width $lwidth -anchor w
entry .os.nopts.n13.e -width $ewidth -textvariable tko_window \
-relief raised
trace variable tko_window w tk_opt_ew
pack append .os.nopts.n13 \
.os.nopts.n13.l {left} .os.nopts.n13.e {left frame w}
frame .os.nopts.n14
label .os.nopts.n14.l -text "wraplen:" -width $lwidth -anchor w
entry .os.nopts.n14.e -width $ewidth -textvariable tko_wraplen \
-relief raised
trace variable tko_wraplen w tk_opt_ew
pack append .os.nopts.n14 \
.os.nopts.n14.l {left} .os.nopts.n14.e {left frame w}
frame .os.nopts.n15
label .os.nopts.n15.l -text "wrapmargin:" -width $lwidth -anchor w
entry .os.nopts.n15.e -width $ewidth -textvariable tko_wrapmargin \
-relief raised
trace variable tko_wrapmargin w tk_opt_ew
pack append .os.nopts.n15 \
.os.nopts.n15.l {left} .os.nopts.n15.e {left frame w}
pack append .os.nopts \
.os.nopts.n1 {top fillx} \
.os.nopts.n3 {top expand fillx} \
.os.nopts.n4 {top expand fillx} \
.os.nopts.n5 {top expand fillx} \
.os.nopts.n6 {top expand fillx} \
.os.nopts.n7 {top expand fillx} \
.os.nopts.n8 {top expand fillx} \
.os.nopts.n9 {top expand fillx} \
.os.nopts.n10 {top expand fillx} \
.os.nopts.n11 {top expand fillx} \
.os.nopts.n12 {top expand fillx} \
.os.nopts.n13 {top expand fillx} \
.os.nopts.n14 {top expand fillx} \
.os.nopts.n15 {top expand fillx}
# Build frame for string options
frame .os.sopts
# Entry width.
set ewidth 40
frame .os.sopts.s1
label .os.sopts.s1.l -text "backup:" -width $lwidth -anchor w
entry .os.sopts.s1.e -width $ewidth -textvariable tko_backup \
-relief raised
pack append .os.sopts.s1 \
.os.sopts.s1.l {left} .os.sopts.s1.e {left frame w}
frame .os.sopts.s2
label .os.sopts.s2.l -text "cdpath:" -width $lwidth -anchor w
entry .os.sopts.s2.e -width $ewidth -textvariable tko_cdpath \
-relief raised
pack append .os.sopts.s2 \
.os.sopts.s2.l {left} .os.sopts.s2.e {left frame w}
frame .os.sopts.s3
label .os.sopts.s3.l -text "directory:" -width $lwidth -anchor w
entry .os.sopts.s3.e -width $ewidth -textvariable tko_directory \
-relief raised
pack append .os.sopts.s3 \
.os.sopts.s3.l {left} .os.sopts.s3.e {left frame w}
frame .os.sopts.s4
label .os.sopts.s4.l -text "cedit:" -width $lwidth -anchor w
entry .os.sopts.s4.e -width $ewidth -textvariable tko_cedit \
-relief raised
pack append .os.sopts.s4 \
.os.sopts.s4.l {left} .os.sopts.s4.e {left frame w}
frame .os.sopts.s5
label .os.sopts.s5.l -text "filec:" -width $lwidth -anchor w
entry .os.sopts.s5.e -width $ewidth -textvariable tko_filec \
-relief raised
pack append .os.sopts.s5 \
.os.sopts.s5.l {left} .os.sopts.s5.e {left frame w}
frame .os.sopts.s6
label .os.sopts.s6.l -text "msgcat:" -width $lwidth -anchor w
entry .os.sopts.s6.e -width $ewidth -textvariable tko_msgcat \
-relief raised
pack append .os.sopts.s6 \
.os.sopts.s6.l {left} .os.sopts.s6.e {left frame w}
frame .os.sopts.s7
label .os.sopts.s7.l -text "noprint:" -width $lwidth -anchor w
entry .os.sopts.s7.e -width $ewidth -textvariable tko_noprint \
-relief raised
pack append .os.sopts.s7 \
.os.sopts.s7.l {left} .os.sopts.s7.e {left frame w}
frame .os.sopts.s8
label .os.sopts.s8.l -text "paragraphs:" -width $lwidth -anchor w
entry .os.sopts.s8.e -width $ewidth -textvariable tko_paragraphs \
-relief raised
pack append .os.sopts.s8 \
.os.sopts.s8.l {left} .os.sopts.s8.e {left frame w}
frame .os.sopts.s9
label .os.sopts.s9.l -text "print:" -width $lwidth -anchor w
entry .os.sopts.s9.e -width $ewidth -textvariable tko_print \
-relief raised
pack append .os.sopts.s9 \
.os.sopts.s9.l {left} .os.sopts.s9.e {left frame w}
frame .os.sopts.s10
label .os.sopts.s10.l -text "recdir:" -width $lwidth -anchor w
entry .os.sopts.s10.e -width $ewidth -textvariable tko_recdir \
-relief raised
pack append .os.sopts.s10 \
.os.sopts.s10.l {left} .os.sopts.s10.e {left frame w}
frame .os.sopts.s11
label .os.sopts.s11.l -text "sections:" -width $lwidth -anchor w
entry .os.sopts.s11.e -width $ewidth -textvariable tko_sections \
-relief raised
pack append .os.sopts.s11 \
.os.sopts.s11.l {left} .os.sopts.s11.e {left frame w}
frame .os.sopts.s12
label .os.sopts.s12.l -text "shell:" -width $lwidth -anchor w
entry .os.sopts.s12.e -width $ewidth -textvariable tko_shell \
-relief raised
pack append .os.sopts.s12 \
.os.sopts.s12.l {left} .os.sopts.s12.e {left frame w}
frame .os.sopts.s13
label .os.sopts.s13.l -text "shellmeta:" -width $lwidth -anchor w
entry .os.sopts.s13.e -width $ewidth -textvariable tko_shellmeta \
-relief raised
pack append .os.sopts.s13 \
.os.sopts.s13.l {left} .os.sopts.s13.e {left frame w}
frame .os.sopts.s14
label .os.sopts.s14.l -text "tags:" -width $lwidth -anchor w
entry .os.sopts.s14.e -width $ewidth -textvariable tko_tags \
-relief raised
pack append .os.sopts.s14 \
.os.sopts.s14.l {left} .os.sopts.s14.e {left frame w}
frame .os.sopts.s15
label .os.sopts.s15.l -text "term:" -width $lwidth -anchor w
entry .os.sopts.s15.e -width $ewidth -textvariable tko_term \
-relief raised
pack append .os.sopts.s15 \
.os.sopts.s15.l {left} .os.sopts.s15.e {left frame w}
pack append .os.sopts \
.os.sopts.s1 {top expand fillx} \
.os.sopts.s2 {top expand fillx} \
.os.sopts.s3 {top expand fillx} \
.os.sopts.s4 {top expand fillx} \
.os.sopts.s5 {top expand fillx} \
.os.sopts.s6 {top expand fillx} \
.os.sopts.s7 {top expand fillx} \
.os.sopts.s8 {top expand fillx} \
.os.sopts.s9 {top expand fillx} \
.os.sopts.s10 {top expand fillx} \
.os.sopts.s11 {top expand fillx} \
.os.sopts.s12 {top expand fillx} \
.os.sopts.s13 {top expand fillx} \
.os.sopts.s14 {top expand fillx} \
.os.sopts.s15 {top expand fillx}
# Build frame for continue button.
frame .os.control -bd 4
button .os.control.quit -text "Continue" -command "destroy .os"
bind .os <Return> ".os.control.quit flash; destroy .os"
pack append .os.control .os.control.quit {left}
# Pack everything together.
pack append .os \
.os.bopts {top} \
.os.control {bottom fillx} \
.os.nopts {left fillx padx 4m pady 4m} \
.os.sopts {left fillx pady 4m}
grab .os
focus .os
}
# tk_opt_ew --
# Handle a change to an option entry widget.
proc tk_opt_ew {name element op} {
upvar $name x
tk_opt_set "$name=$x"
}
# tk_err --
# Display a Tcl/Tk error message.
proc tk_err {msg} {
tk_dialog .d {} "$msg" {} 0 Continue
#puts "msg: $msg"
}
# tk_addstr --
# Add a string to the screen.
proc tk_addstr {len str} {
global tk_cursor_row
global tk_cursor_col
# Delete the current characters, then insert the new ones.
.t mark set insert $tk_cursor_row.$tk_cursor_col
.t delete insert "insert + $len chars"
.t insert insert "$str"
incr tk_cursor_col $len
#puts "tk_addstr: row $tk_cursor_row col $tk_cursor_col: insert $str"
}
# tk_clrtoeol --
# Clear to the end of the line.
proc tk_clrtoeol {} {
global tk_cursor_row
global tk_cursor_col
global tk_ssize_col
# Overwrite to the end of the line with spaces.
.t mark set insert $tk_cursor_row.$tk_cursor_col
.t delete insert "insert lineend"
for {set j $tk_cursor_col} {$j < $tk_ssize_col} {incr j} {
.t insert insert " "
}
#puts "tk_clrtoel: row $tk_cursor_row col $tk_cursor_col"
}
# tk_deleteln --
# Delete the line.
proc tk_deleteln {} {
global tk_cursor_row
global tk_cursor_col
global tk_ssize_col
# Delete the line.
.t mark set insert $tk_cursor_row.$tk_cursor_col
.t delete insert "insert lineend + 1 chars"
# Append a new, blank line at the end of the screen.
.t mark set insert end
for {set j 1} {$j <= $tk_ssize_col} {incr j} {
.t insert insert " "
}
.t insert insert "\n"
#puts "tk_deleteln: row $tk_cursor_row"
}
# tk_flash --
# Flash the screen.
proc tk_flash {} {
set bg [lindex [.t config -background] 4]
set fg [lindex [.t config -foreground] 4]
.t configure -background $fg -foreground $bg
update idletasks
.t configure -background $bg -foreground $fg
update idletasks
}
# tk_insertln --
# Insert the line.
proc tk_insertln {} {
global tk_cursor_row
global tk_cursor_col
global tk_ssize_row
global tk_ssize_col
# Delete the last line on the screen.
.t mark set insert $tk_ssize_row.0
.t delete insert "insert lineend + 1 chars"
# Insert a new, blank line.
.t mark set insert $tk_cursor_row.$tk_cursor_col
for {set j 1} {$j <= $tk_ssize_col} {incr j} {
.t insert insert " "
}
.t insert insert "\n"
#puts "tk_insertln: row $tk_cursor_row"
}
# tk_move --
# Move the cursor.
proc tk_move {row col} {
global tk_cursor_row
global tk_cursor_col
# Convert to Tcl/Tk coordinates, update the insert cursor.
set tk_cursor_row [ expr $row + 1 ]
set tk_cursor_col $col
.t mark set insert $tk_cursor_row.$tk_cursor_col
# Update the screen cursor.
.t tag remove tk_cursor tk_cursor_indx
.t mark set tk_cursor_indx insert
.t tag add tk_cursor tk_cursor_indx
#puts "tk_move: row $tk_cursor_row col $tk_cursor_col"
}
# tk_rename --
# Rename the screen.
proc tk_rename {name} {
wm title . "$name"
}
# tk_ssize --
# Return the window size.
proc tk_ssize {} {
global tk_ssize_col
global tk_ssize_row
set s [ .t configure -width ]
set tk_ssize_col [ lindex $s [ expr [ llength $s ] -1 ] ]
set s [ .t configure -height ]
set tk_ssize_row [ lindex $s [ expr [ llength $s ] -1 ] ]
#puts "tk_ssize: rows $tk_ssize_row, cols $tk_ssize_col"
}
# tk_standout --
# Change into standout mode.
proc tk_standout {} {
}
# tk_standend --
# Change out of standout mode.
proc tk_standend {} {
}
# Cursor
set tk_cursor_row 1
set tk_cursor_col 0
# Screen size
set tk_ssize_row 0
set tk_ssize_col 0
screen
#tkwait window .
|