Bwidget Source Code
Hex Artifact Content
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Artifact e376d10b8ed5f0188a55534c6e83cc669080a008:


0000: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
0010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
0050: 20 20 6d 61 69 6e 66 72 61 6d 65 2e 74 63 6c 0a    mainframe.tcl.
0060: 23 20 20 54 68 69 73 20 66 69 6c 65 20 69 73 20  #  This file is 
0070: 70 61 72 74 20 6f 66 20 55 6e 69 66 69 78 20 42  part of Unifix B
0080: 57 69 64 67 65 74 20 54 6f 6f 6c 6b 69 74 0a 23  Widget Toolkit.#
0090: 20 20 24 49 64 3a 20 6d 61 69 6e 66 72 61 6d 65    $Id: mainframe
00a0: 2e 74 63 6c 2c 76 20 31 2e 31 37 20 32 30 30 34  .tcl,v 1.17 2004
00b0: 2f 31 30 2f 30 39 20 30 30 3a 31 38 3a 30 37 20  /10/09 00:18:07 
00c0: 70 6f 69 6e 74 73 6d 61 6e 20 45 78 70 20 24 0a  pointsman Exp $.
00d0: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
00e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
00f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0100: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0120: 0a 23 20 20 49 6e 64 65 78 20 6f 66 20 63 6f 6d  .#  Index of com
0130: 6d 61 6e 64 73 3a 0a 23 20 20 20 20 20 2d 20 4d  mands:.#     - M
0140: 61 69 6e 46 72 61 6d 65 3a 3a 63 72 65 61 74 65  ainFrame::create
0150: 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61  .#     - MainFra
0160: 6d 65 3a 3a 63 6f 6e 66 69 67 75 72 65 0a 23 20  me::configure.# 
0170: 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a      - MainFrame:
0180: 3a 63 67 65 74 0a 23 20 20 20 20 20 2d 20 4d 61  :cget.#     - Ma
0190: 69 6e 46 72 61 6d 65 3a 3a 67 65 74 66 72 61 6d  inFrame::getfram
01a0: 65 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72  e.#     - MainFr
01b0: 61 6d 65 3a 3a 61 64 64 74 6f 6f 6c 62 61 72 0a  ame::addtoolbar.
01c0: 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d  #     - MainFram
01d0: 65 3a 3a 67 65 74 74 6f 6f 6c 62 61 72 0a 23 20  e::gettoolbar.# 
01e0: 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a      - MainFrame:
01f0: 3a 61 64 64 69 6e 64 69 63 61 74 6f 72 0a 23 20  :addindicator.# 
0200: 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a      - MainFrame:
0210: 3a 67 65 74 69 6e 64 69 63 61 74 6f 72 0a 23 20  :getindicator.# 
0220: 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a      - MainFrame:
0230: 3a 67 65 74 6d 65 6e 75 0a 23 20 20 20 20 20 2d  :getmenu.#     -
0240: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 6d 65 6e 75   MainFrame::menu
0250: 6f 6e 6c 79 0a 23 20 20 20 20 20 2d 20 4d 61 69  only.#     - Mai
0260: 6e 46 72 61 6d 65 3a 3a 73 68 6f 77 74 6f 6f 6c  nFrame::showtool
0270: 62 61 72 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e  bar.#     - Main
0280: 46 72 61 6d 65 3a 3a 73 68 6f 77 73 74 61 74 75  Frame::showstatu
0290: 73 62 61 72 0a 23 20 20 20 20 20 2d 20 4d 61 69  sbar.#     - Mai
02a0: 6e 46 72 61 6d 65 3a 3a 5f 63 72 65 61 74 65 5f  nFrame::_create_
02b0: 6d 65 6e 75 62 61 72 0a 23 20 20 20 20 20 2d 20  menubar.#     - 
02c0: 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 63 72 65 61  MainFrame::_crea
02d0: 74 65 5f 65 6e 74 72 69 65 73 0a 23 20 20 20 20  te_entries.#    
02e0: 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 70   - MainFrame::_p
02f0: 61 72 73 65 5f 6e 61 6d 65 0a 23 20 20 20 20 20  arse_name.#     
0300: 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 70 61  - MainFrame::_pa
0310: 72 73 65 5f 61 63 63 65 6c 65 72 61 74 6f 72 0a  rse_accelerator.
0320: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
0330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0350: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0360: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a  --------------..
0370: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20 4d  namespace eval M
0380: 61 69 6e 46 72 61 6d 65 20 7b 0a 20 20 20 20 57  ainFrame {.    W
0390: 69 64 67 65 74 3a 3a 64 65 66 69 6e 65 20 4d 61  idget::define Ma
03a0: 69 6e 46 72 61 6d 65 20 6d 61 69 6e 66 72 61 6d  inFrame mainfram
03b0: 65 20 50 72 6f 67 72 65 73 73 42 61 72 0a 0a 20  e ProgressBar.. 
03c0: 20 20 20 57 69 64 67 65 74 3a 3a 62 77 69 6e 63     Widget::bwinc
03d0: 6c 75 64 65 20 4d 61 69 6e 46 72 61 6d 65 20 50  lude MainFrame P
03e0: 72 6f 67 72 65 73 73 42 61 72 20 2e 73 74 61 74  rogressBar .stat
03f0: 75 73 2e 70 72 67 20 5c 0a 09 20 20 20 20 72 65  us.prg \..    re
0400: 6d 6f 76 65 20 7b 0a 09 2d 66 67 20 2d 62 67 20  move {..-fg -bg 
0410: 2d 62 64 20 2d 74 72 6f 75 67 68 63 6f 6c 6f 72  -bd -troughcolor
0420: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 2d 62 6f   -background -bo
0430: 72 64 65 72 77 69 64 74 68 0a 09 2d 72 65 6c 69  rderwidth..-reli
0440: 65 66 20 2d 6f 72 69 65 6e 74 20 2d 77 69 64 74  ef -orient -widt
0450: 68 20 2d 68 65 69 67 68 74 0a 20 20 20 20 7d 20  h -height.    } 
0460: 5c 0a 09 20 20 20 20 72 65 6e 61 6d 65 20 7b 0a  \..    rename {.
0470: 09 2d 6d 61 78 69 6d 75 6d 20 20 20 20 2d 70 72  .-maximum    -pr
0480: 6f 67 72 65 73 73 6d 61 78 0a 09 2d 76 61 72 69  ogressmax..-vari
0490: 61 62 6c 65 20 20 20 2d 70 72 6f 67 72 65 73 73  able   -progress
04a0: 76 61 72 0a 09 2d 74 79 70 65 20 20 20 20 20 20  var..-type      
04b0: 20 2d 70 72 6f 67 72 65 73 73 74 79 70 65 0a 09   -progresstype..
04c0: 2d 66 6f 72 65 67 72 6f 75 6e 64 20 2d 70 72 6f  -foreground -pro
04d0: 67 72 65 73 73 66 67 0a 20 20 20 20 7d 0a 0a 20  gressfg.    }.. 
04e0: 20 20 20 57 69 64 67 65 74 3a 3a 64 65 63 6c 61     Widget::decla
04f0: 72 65 20 4d 61 69 6e 46 72 61 6d 65 20 7b 0a 09  re MainFrame {..
0500: 7b 2d 77 69 64 74 68 20 20 20 20 20 20 20 20 54  {-width        T
0510: 6b 52 65 73 6f 75 72 63 65 20 30 20 20 20 20 20  kResource 0     
0520: 20 30 20 66 72 61 6d 65 7d 0a 09 7b 2d 68 65 69   0 frame}..{-hei
0530: 67 68 74 20 20 20 20 20 20 20 54 6b 52 65 73 6f  ght       TkReso
0540: 75 72 63 65 20 30 20 20 20 20 20 20 30 20 66 72  urce 0      0 fr
0550: 61 6d 65 7d 0a 09 7b 2d 62 61 63 6b 67 72 6f 75  ame}..{-backgrou
0560: 6e 64 20 20 20 54 6b 52 65 73 6f 75 72 63 65 20  nd   TkResource 
0570: 22 22 20 20 20 20 20 30 20 66 72 61 6d 65 7d 0a  ""     0 frame}.
0580: 09 7b 2d 74 65 78 74 76 61 72 69 61 62 6c 65 20  .{-textvariable 
0590: 53 74 72 69 6e 67 20 20 20 20 20 22 22 20 20 20  String     ""   
05a0: 20 20 30 7d 0a 09 7b 2d 6d 65 6e 75 20 20 20 20    0}..{-menu    
05b0: 20 20 20 20 20 53 74 72 69 6e 67 20 20 20 20 20       String     
05c0: 7b 7d 20 20 20 20 20 31 7d 0a 09 7b 2d 73 65 70  {}     1}..{-sep
05d0: 61 72 61 74 6f 72 20 20 20 20 45 6e 75 6d 20 20  arator    Enum  
05e0: 20 20 20 20 20 62 6f 74 68 20 20 20 31 20 7b 6e       both   1 {n
05f0: 6f 6e 65 20 74 6f 70 20 62 6f 74 74 6f 6d 20 62  one top bottom b
0600: 6f 74 68 7d 7d 0a 09 7b 2d 62 67 20 20 20 20 20  oth}}..{-bg     
0610: 20 20 20 20 20 20 53 79 6e 6f 6e 79 6d 20 20 20        Synonym   
0620: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 7d 0a 0a 09   -background}...
0630: 7b 2d 6d 65 6e 75 62 61 72 66 6f 6e 74 20 20 20  {-menubarfont   
0640: 53 74 72 69 6e 67 20 20 20 20 20 22 22 20 20 30  String     ""  0
0650: 7d 0a 09 7b 2d 6d 65 6e 75 65 6e 74 72 79 66 6f  }..{-menuentryfo
0660: 6e 74 20 53 74 72 69 6e 67 20 20 20 20 20 22 22  nt String     ""
0670: 20 20 30 7d 0a 09 7b 2d 73 74 61 74 75 73 62 61    0}..{-statusba
0680: 72 66 6f 6e 74 20 53 74 72 69 6e 67 20 20 20 20  rfont String    
0690: 20 22 22 20 20 30 7d 0a 20 20 20 20 7d 0a 0a 20   ""  0}.    }.. 
06a0: 20 20 20 57 69 64 67 65 74 3a 3a 61 64 64 6d 61     Widget::addma
06b0: 70 20 4d 61 69 6e 46 72 61 6d 65 20 22 22 20 2e  p MainFrame "" .
06c0: 66 72 61 6d 65 20 20 7b 2d 77 69 64 74 68 20 7b  frame  {-width {
06d0: 7d 20 2d 68 65 69 67 68 74 20 7b 7d 20 2d 62 61  } -height {} -ba
06e0: 63 6b 67 72 6f 75 6e 64 20 7b 7d 7d 0a 20 20 20  ckground {}}.   
06f0: 20 57 69 64 67 65 74 3a 3a 61 64 64 6d 61 70 20   Widget::addmap 
0700: 4d 61 69 6e 46 72 61 6d 65 20 22 22 20 2e 74 6f  MainFrame "" .to
0710: 70 66 20 20 20 7b 2d 62 61 63 6b 67 72 6f 75 6e  pf   {-backgroun
0720: 64 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67 65 74  d {}}.    Widget
0730: 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46 72 61  ::addmap MainFra
0740: 6d 65 20 22 22 20 2e 62 6f 74 66 20 20 20 7b 2d  me "" .botf   {-
0750: 62 61 63 6b 67 72 6f 75 6e 64 20 7b 7d 7d 0a 20  background {}}. 
0760: 20 20 20 57 69 64 67 65 74 3a 3a 61 64 64 6d 61     Widget::addma
0770: 70 20 4d 61 69 6e 46 72 61 6d 65 20 22 22 20 2e  p MainFrame "" .
0780: 73 74 61 74 75 73 20 7b 2d 62 61 63 6b 67 72 6f  status {-backgro
0790: 75 6e 64 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67  und {}}.    Widg
07a0: 65 74 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46  et::addmap MainF
07b0: 72 61 6d 65 20 22 22 20 2e 73 74 61 74 75 73 2e  rame "" .status.
07c0: 6c 61 62 65 6c 20 7b 2d 62 61 63 6b 67 72 6f 75  label {-backgrou
07d0: 6e 64 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67 65  nd {}}.    Widge
07e0: 74 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46 72  t::addmap MainFr
07f0: 61 6d 65 20 22 22 20 2e 73 74 61 74 75 73 2e 69  ame "" .status.i
0800: 6e 64 66 20 20 7b 2d 62 61 63 6b 67 72 6f 75 6e  ndf  {-backgroun
0810: 64 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67 65 74  d {}}.    Widget
0820: 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46 72 61  ::addmap MainFra
0830: 6d 65 20 22 22 20 2e 73 74 61 74 75 73 2e 70 72  me "" .status.pr
0840: 67 66 20 20 7b 2d 62 61 63 6b 67 72 6f 75 6e 64  gf  {-background
0850: 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67 65 74 3a   {}}.    Widget:
0860: 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46 72 61 6d  :addmap MainFram
0870: 65 20 50 72 6f 67 72 65 73 73 42 61 72 20 2e 73  e ProgressBar .s
0880: 74 61 74 75 73 2e 70 72 67 20 7b 2d 62 61 63 6b  tatus.prg {-back
0890: 67 72 6f 75 6e 64 20 7b 7d 20 2d 62 61 63 6b 67  ground {} -backg
08a0: 72 6f 75 6e 64 20 2d 74 72 6f 75 67 68 63 6f 6c  round -troughcol
08b0: 6f 72 7d 0a 0a 20 20 20 20 76 61 72 69 61 62 6c  or}..    variabl
08c0: 65 20 5f 77 69 64 67 65 74 0a 7d 0a 0a 0a 23 20  e _widget.}...# 
08d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
08e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
08f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0900: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0910: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
0920: 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d  Command MainFram
0930: 65 3a 3a 63 72 65 61 74 65 0a 23 20 2d 2d 2d 2d  e::create.# ----
0940: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0950: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0960: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0970: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0980: 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61  --------.proc Ma
0990: 69 6e 46 72 61 6d 65 3a 3a 63 72 65 61 74 65 20  inFrame::create 
09a0: 7b 20 70 61 74 68 20 61 72 67 73 20 7d 20 7b 0a  { path args } {.
09b0: 20 20 20 20 67 6c 6f 62 61 6c 20 20 20 74 63 6c      global   tcl
09c0: 5f 70 6c 61 74 66 6f 72 6d 0a 20 20 20 20 76 61  _platform.    va
09d0: 72 69 61 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a  riable _widget..
09e0: 20 20 20 20 73 65 74 20 70 61 74 68 20 5b 66 72      set path [fr
09f0: 61 6d 65 20 24 70 61 74 68 20 2d 74 61 6b 65 66  ame $path -takef
0a00: 6f 63 75 73 20 30 20 2d 68 69 67 68 6c 69 67 68  ocus 0 -highligh
0a10: 74 74 68 69 63 6b 6e 65 73 73 20 30 5d 0a 20 20  tthickness 0].  
0a20: 20 20 73 65 74 20 74 6f 70 20 20 5b 77 69 6e 66    set top  [winf
0a30: 6f 20 70 61 72 65 6e 74 20 24 70 61 74 68 5d 0a  o parent $path].
0a40: 20 20 20 20 69 66 20 7b 20 21 5b 73 74 72 69 6e      if { ![strin
0a50: 67 20 65 71 75 61 6c 20 5b 77 69 6e 66 6f 20 74  g equal [winfo t
0a60: 6f 70 6c 65 76 65 6c 20 24 70 61 74 68 5d 20 24  oplevel $path] $
0a70: 74 6f 70 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20  top] } {.       
0a80: 20 64 65 73 74 72 6f 79 20 24 70 61 74 68 0a 20   destroy $path. 
0a90: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 2d 63         return -c
0aa0: 6f 64 65 20 65 72 72 6f 72 20 22 70 61 72 65 6e  ode error "paren
0ab0: 74 20 6d 75 73 74 20 62 65 20 61 20 74 6f 70 6c  t must be a topl
0ac0: 65 76 65 6c 22 0a 20 20 20 20 7d 0a 20 20 20 20  evel".    }.    
0ad0: 57 69 64 67 65 74 3a 3a 69 6e 69 74 20 4d 61 69  Widget::init Mai
0ae0: 6e 46 72 61 6d 65 20 24 70 61 74 68 20 24 61 72  nFrame $path $ar
0af0: 67 73 0a 0a 20 20 20 20 69 66 20 7b 20 24 74 63  gs..    if { $tc
0b00: 6c 5f 70 6c 61 74 66 6f 72 6d 28 70 6c 61 74 66  l_platform(platf
0b10: 6f 72 6d 29 20 3d 3d 20 22 75 6e 69 78 22 20 7d  orm) == "unix" }
0b20: 20 7b 0a 20 20 20 20 20 20 20 20 73 65 74 20 72   {.        set r
0b30: 65 6c 69 65 66 20 72 61 69 73 65 64 0a 20 20 20  elief raised.   
0b40: 20 20 20 20 20 73 65 74 20 62 64 20 20 20 20 20       set bd     
0b50: 31 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20  1.    } else {. 
0b60: 20 20 20 20 20 20 20 73 65 74 20 72 65 6c 69 65         set relie
0b70: 66 20 66 6c 61 74 0a 20 20 20 20 20 20 20 20 73  f flat.        s
0b80: 65 74 20 62 64 20 20 20 20 20 30 0a 20 20 20 20  et bd     0.    
0b90: 7d 0a 20 20 20 20 73 65 74 20 74 6f 70 66 72 61  }.    set topfra
0ba0: 6d 65 20 20 5b 65 76 61 6c 20 5b 6c 69 73 74 20  me  [eval [list 
0bb0: 66 72 61 6d 65 20 24 70 61 74 68 2e 74 6f 70 66  frame $path.topf
0bc0: 5d 20 5c 0a 09 09 20 20 20 20 20 20 20 2d 72 65  ] \...       -re
0bd0: 6c 69 65 66 20 66 6c 61 74 20 2d 62 6f 72 64 65  lief flat -borde
0be0: 72 77 69 64 74 68 20 30 20 5c 0a 09 09 20 20 20  rwidth 0 \...   
0bf0: 20 20 20 20 5b 57 69 64 67 65 74 3a 3a 73 75 62      [Widget::sub
0c00: 63 67 65 74 20 24 70 61 74 68 20 2e 74 6f 70 66  cget $path .topf
0c10: 5d 5d 0a 20 20 20 20 73 65 74 20 75 73 65 72 66  ]].    set userf
0c20: 72 61 6d 65 20 5b 65 76 61 6c 20 5b 6c 69 73 74  rame [eval [list
0c30: 20 66 72 61 6d 65 20 24 70 61 74 68 2e 66 72 61   frame $path.fra
0c40: 6d 65 5d 20 5c 0a 09 09 20 20 20 20 20 20 20 5b  me] \...       [
0c50: 57 69 64 67 65 74 3a 3a 73 75 62 63 67 65 74 20  Widget::subcget 
0c60: 24 70 61 74 68 20 2e 66 72 61 6d 65 5d 20 5c 0a  $path .frame] \.
0c70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0c80: 20 20 20 20 20 20 20 2d 72 65 6c 69 65 66 20 24         -relief $
0c90: 72 65 6c 69 65 66 20 2d 62 6f 72 64 65 72 77 69  relief -borderwi
0ca0: 64 74 68 20 24 62 64 5d 0a 20 20 20 20 73 65 74  dth $bd].    set
0cb0: 20 62 6f 74 66 72 61 6d 65 20 20 5b 65 76 61 6c   botframe  [eval
0cc0: 20 5b 6c 69 73 74 20 66 72 61 6d 65 20 24 70 61   [list frame $pa
0cd0: 74 68 2e 62 6f 74 66 5d 20 5c 0a 09 09 20 20 20  th.botf] \...   
0ce0: 20 20 20 20 2d 72 65 6c 69 65 66 20 24 72 65 6c      -relief $rel
0cf0: 69 65 66 20 2d 62 6f 72 64 65 72 77 69 64 74 68  ief -borderwidth
0d00: 20 24 62 64 20 5c 0a 09 09 20 20 20 20 20 20 20   $bd \...       
0d10: 5b 57 69 64 67 65 74 3a 3a 73 75 62 63 67 65 74  [Widget::subcget
0d20: 20 24 70 61 74 68 20 2e 62 6f 74 66 5d 5d 0a 0a   $path .botf]]..
0d30: 20 20 20 20 70 61 63 6b 20 24 74 6f 70 66 72 61      pack $topfra
0d40: 6d 65 20 2d 66 69 6c 6c 20 78 0a 20 20 20 20 67  me -fill x.    g
0d50: 72 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67  rid columnconfig
0d60: 75 72 65 20 24 74 6f 70 66 72 61 6d 65 20 30 20  ure $topframe 0 
0d70: 2d 77 65 69 67 68 74 20 31 0a 0a 20 20 20 20 73  -weight 1..    s
0d80: 65 74 20 62 67 20 5b 57 69 64 67 65 74 3a 3a 63  et bg [Widget::c
0d90: 67 65 74 20 24 70 61 74 68 20 2d 62 61 63 6b 67  get $path -backg
0da0: 72 6f 75 6e 64 5d 0a 20 20 20 20 24 70 61 74 68  round].    $path
0db0: 20 63 6f 6e 66 69 67 75 72 65 20 2d 62 61 63 6b   configure -back
0dc0: 67 72 6f 75 6e 64 20 24 62 67 0a 20 20 20 20 69  ground $bg.    i
0dd0: 66 20 7b 20 24 74 63 6c 5f 70 6c 61 74 66 6f 72  f { $tcl_platfor
0de0: 6d 28 70 6c 61 74 66 6f 72 6d 29 20 21 3d 20 22  m(platform) != "
0df0: 75 6e 69 78 22 20 7d 20 7b 0a 20 20 20 20 20 20  unix" } {.      
0e00: 20 20 73 65 74 20 73 65 70 6f 70 74 20 5b 57 69    set sepopt [Wi
0e10: 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20  dget::getoption 
0e20: 24 70 61 74 68 20 2d 73 65 70 61 72 61 74 6f 72  $path -separator
0e30: 5d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20 24  ].        if { $
0e40: 73 65 70 6f 70 74 20 3d 3d 20 22 62 6f 74 68 22  sepopt == "both"
0e50: 20 7c 7c 20 24 73 65 70 6f 70 74 20 3d 3d 20 22   || $sepopt == "
0e60: 74 6f 70 22 20 7d 20 7b 0a 20 20 20 20 20 20 20  top" } {.       
0e70: 20 20 20 20 20 73 65 74 20 73 65 70 20 5b 53 65       set sep [Se
0e80: 70 61 72 61 74 6f 72 3a 3a 63 72 65 61 74 65 20  parator::create 
0e90: 24 70 61 74 68 2e 73 65 70 20 2d 6f 72 69 65 6e  $path.sep -orien
0ea0: 74 20 68 6f 72 69 7a 6f 6e 74 61 6c 20 2d 62 61  t horizontal -ba
0eb0: 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d 0a 20 20  ckground $bg].  
0ec0: 20 20 20 20 20 20 20 20 20 20 70 61 63 6b 20 24            pack $
0ed0: 73 65 70 20 2d 66 69 6c 6c 20 78 0a 20 20 20 20  sep -fill x.    
0ee0: 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 69 66      }.        if
0ef0: 20 7b 20 24 73 65 70 6f 70 74 20 3d 3d 20 22 62   { $sepopt == "b
0f00: 6f 74 68 22 20 7c 7c 20 24 73 65 70 6f 70 74 20  oth" || $sepopt 
0f10: 3d 3d 20 22 62 6f 74 74 6f 6d 22 20 7d 20 7b 0a  == "bottom" } {.
0f20: 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20              set 
0f30: 73 65 70 20 5b 53 65 70 61 72 61 74 6f 72 3a 3a  sep [Separator::
0f40: 63 72 65 61 74 65 20 24 62 6f 74 66 72 61 6d 65  create $botframe
0f50: 2e 73 65 70 20 2d 6f 72 69 65 6e 74 20 68 6f 72  .sep -orient hor
0f60: 69 7a 6f 6e 74 61 6c 20 2d 62 61 63 6b 67 72 6f  izontal -backgro
0f70: 75 6e 64 20 24 62 67 5d 0a 20 20 20 20 20 20 20  und $bg].       
0f80: 20 20 20 20 20 70 61 63 6b 20 24 73 65 70 20 2d       pack $sep -
0f90: 66 69 6c 6c 20 78 0a 20 20 20 20 20 20 20 20 7d  fill x.        }
0fa0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20 2d 2d  .    }..    # --
0fb0: 2d 20 73 74 61 74 75 73 20 62 61 72 20 2d 2d 2d  - status bar ---
0fc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0fd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0fe0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0ff0: 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 69 66 20 7b 5b  ------.    if {[
1000: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 5b 57  string length [W
1010: 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e  idget::getoption
1020: 20 24 70 61 74 68 20 2d 73 74 61 74 75 73 62 61   $path -statusba
1030: 72 66 6f 6e 74 5d 5d 20 3e 30 20 7d 20 7b 0a 09  rfont]] >0 } {..
1040: 73 65 74 20 73 62 66 6e 74 20 5b 6c 69 73 74 20  set sbfnt [list 
1050: 2d 66 6f 6e 74 20 5b 57 69 64 67 65 74 3a 3a 67  -font [Widget::g
1060: 65 74 6f 70 74 69 6f 6e 20 24 70 61 74 68 20 2d  etoption $path -
1070: 73 74 61 74 75 73 62 61 72 66 6f 6e 74 5d 5d 0a  statusbarfont]].
1080: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65      } else {..se
1090: 74 20 73 62 66 6e 74 20 22 22 0a 20 20 20 20 7d  t sbfnt "".    }
10a0: 0a 0a 20 20 20 20 73 65 74 20 73 74 61 74 75 73  ..    set status
10b0: 20 20 20 5b 66 72 61 6d 65 20 24 70 61 74 68 2e     [frame $path.
10c0: 73 74 61 74 75 73 20 2d 72 65 6c 69 65 66 20 66  status -relief f
10d0: 6c 61 74 20 2d 62 6f 72 64 65 72 77 69 64 74 68  lat -borderwidth
10e0: 20 30 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20   0 \.           
10f0: 20 20 20 20 20 20 20 20 20 20 20 2d 74 61 6b 65             -take
1100: 66 6f 63 75 73 20 30 20 2d 68 69 67 68 6c 69 67  focus 0 -highlig
1110: 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20 2d 62  htthickness 0 -b
1120: 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d 0a 20  ackground $bg]. 
1130: 20 20 20 73 65 74 20 6c 61 62 65 6c 20 20 20 20     set label    
1140: 5b 65 76 61 6c 20 5b 6c 69 73 74 20 6c 61 62 65  [eval [list labe
1150: 6c 20 24 73 74 61 74 75 73 2e 6c 61 62 65 6c 20  l $status.label 
1160: 5c 0a 09 20 20 20 20 2d 74 65 78 74 76 61 72 69  \..    -textvari
1170: 61 62 6c 65 20 5b 57 69 64 67 65 74 3a 3a 67 65  able [Widget::ge
1180: 74 6f 70 74 69 6f 6e 20 24 70 61 74 68 20 2d 74  toption $path -t
1190: 65 78 74 76 61 72 69 61 62 6c 65 5d 20 5c 0a 09  extvariable] \..
11a0: 20 20 20 20 2d 74 61 6b 65 66 6f 63 75 73 20 30      -takefocus 0
11b0: 20 2d 68 69 67 68 6c 69 67 68 74 74 68 69 63 6b   -highlightthick
11c0: 6e 65 73 73 20 30 20 2d 62 61 63 6b 67 72 6f 75  ness 0 -backgrou
11d0: 6e 64 20 24 62 67 5d 20 24 73 62 66 6e 74 5d 0a  nd $bg] $sbfnt].
11e0: 20 20 20 20 73 65 74 20 69 6e 64 66 72 61 6d 65      set indframe
11f0: 20 5b 66 72 61 6d 65 20 24 73 74 61 74 75 73 2e   [frame $status.
1200: 69 6e 64 66 20 2d 72 65 6c 69 65 66 20 66 6c 61  indf -relief fla
1210: 74 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20 30  t -borderwidth 0
1220: 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20   \.             
1230: 20 20 20 20 20 20 20 20 20 2d 74 61 6b 65 66 6f           -takefo
1240: 63 75 73 20 30 20 2d 68 69 67 68 6c 69 67 68 74  cus 0 -highlight
1250: 74 68 69 63 6b 6e 65 73 73 20 30 20 2d 62 61 63  thickness 0 -bac
1260: 6b 67 72 6f 75 6e 64 20 24 62 67 5d 0a 20 20 20  kground $bg].   
1270: 20 73 65 74 20 70 72 67 66 72 61 6d 65 20 5b 66   set prgframe [f
1280: 72 61 6d 65 20 24 73 74 61 74 75 73 2e 70 72 67  rame $status.prg
1290: 66 20 2d 72 65 6c 69 65 66 20 66 6c 61 74 20 2d  f -relief flat -
12a0: 62 6f 72 64 65 72 77 69 64 74 68 20 30 20 5c 0a  borderwidth 0 \.
12b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
12c0: 20 20 20 20 20 20 2d 74 61 6b 65 66 6f 63 75 73        -takefocus
12d0: 20 30 20 2d 68 69 67 68 6c 69 67 68 74 74 68 69   0 -highlightthi
12e0: 63 6b 6e 65 73 73 20 30 20 2d 62 61 63 6b 67 72  ckness 0 -backgr
12f0: 6f 75 6e 64 20 24 62 67 5d 0a 0a 20 20 20 20 70  ound $bg]..    p
1300: 6c 61 63 65 20 24 6c 61 62 65 6c 20 20 20 20 2d  lace $label    -
1310: 61 6e 63 68 6f 72 20 77 20 2d 78 20 30 20 2d 72  anchor w -x 0 -r
1320: 65 6c 79 20 30 2e 35 0a 20 20 20 20 70 6c 61 63  ely 0.5.    plac
1330: 65 20 24 69 6e 64 66 72 61 6d 65 20 2d 61 6e 63  e $indframe -anc
1340: 68 6f 72 20 6e 65 20 2d 72 65 6c 78 20 31 20 2d  hor ne -relx 1 -
1350: 79 20 30 20 2d 72 65 6c 68 65 69 67 68 74 20 31  y 0 -relheight 1
1360: 0a 20 20 20 20 70 61 63 6b 20 20 24 70 72 67 66  .    pack  $prgf
1370: 72 61 6d 65 20 2d 69 6e 20 24 69 6e 64 66 72 61  rame -in $indfra
1380: 6d 65 20 2d 73 69 64 65 20 6c 65 66 74 20 2d 70  me -side left -p
1390: 61 64 78 20 32 0a 20 20 20 20 24 73 74 61 74 75  adx 2.    $statu
13a0: 73 20 63 6f 6e 66 69 67 75 72 65 20 2d 68 65 69  s configure -hei
13b0: 67 68 74 20 5b 77 69 6e 66 6f 20 72 65 71 68 65  ght [winfo reqhe
13c0: 69 67 68 74 20 24 6c 61 62 65 6c 5d 0a 0a 20 20  ight $label]..  
13d0: 20 20 73 65 74 20 70 72 6f 67 72 65 73 73 20 5b    set progress [
13e0: 65 76 61 6c 20 5b 6c 69 73 74 20 50 72 6f 67 72  eval [list Progr
13f0: 65 73 73 42 61 72 3a 3a 63 72 65 61 74 65 20 24  essBar::create $
1400: 73 74 61 74 75 73 2e 70 72 67 5d 20 5c 0a 09 09  status.prg] \...
1410: 20 20 20 20 20 20 5b 57 69 64 67 65 74 3a 3a 73        [Widget::s
1420: 75 62 63 67 65 74 20 24 70 61 74 68 20 2e 73 74  ubcget $path .st
1430: 61 74 75 73 2e 70 72 67 5d 20 5c 0a 20 20 20 20  atus.prg] \.    
1440: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1450: 20 20 2d 77 69 64 74 68 20 20 20 20 20 20 20 35    -width       5
1460: 30 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20  0 \.            
1470: 20 20 20 20 20 20 20 20 20 20 2d 68 65 69 67 68            -heigh
1480: 74 20 20 20 20 20 20 5b 65 78 70 72 20 7b 5b 77  t      [expr {[w
1490: 69 6e 66 6f 20 72 65 71 68 65 69 67 68 74 20 24  info reqheight $
14a0: 6c 61 62 65 6c 5d 2d 32 7d 5d 20 5c 0a 20 20 20  label]-2}] \.   
14b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
14c0: 20 20 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20     -borderwidth 
14d0: 31 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20  1 \.            
14e0: 20 20 20 20 20 20 20 20 20 20 2d 72 65 6c 69 65            -relie
14f0: 66 20 20 20 20 20 20 73 75 6e 6b 65 6e 5d 0a 20  f      sunken]. 
1500: 20 20 20 70 61 63 6b 20 24 73 74 61 74 75 73 20     pack $status 
1510: 20 20 20 2d 69 6e 20 24 62 6f 74 66 72 61 6d 65     -in $botframe
1520: 20 2d 66 69 6c 6c 20 78 20 2d 70 61 64 79 20 32   -fill x -pady 2
1530: 0a 20 20 20 20 70 61 63 6b 20 24 62 6f 74 66 72  .    pack $botfr
1540: 61 6d 65 20 20 2d 73 69 64 65 20 62 6f 74 74 6f  ame  -side botto
1550: 6d 20 2d 66 69 6c 6c 20 78 0a 20 20 20 20 70 61  m -fill x.    pa
1560: 63 6b 20 24 75 73 65 72 66 72 61 6d 65 20 2d 66  ck $userframe -f
1570: 69 6c 6c 20 62 6f 74 68 20 2d 65 78 70 61 6e 64  ill both -expand
1580: 20 79 65 73 0a 0a 20 20 20 20 73 65 74 20 5f 77   yes..    set _w
1590: 69 64 67 65 74 28 24 70 61 74 68 2c 74 6f 70 29  idget($path,top)
15a0: 20 20 20 20 20 20 24 74 6f 70 0a 20 20 20 20 73        $top.    s
15b0: 65 74 20 5f 77 69 64 67 65 74 28 24 70 61 74 68  et _widget($path
15c0: 2c 6e 74 6f 6f 6c 62 61 72 29 20 30 0a 20 20 20  ,ntoolbar) 0.   
15d0: 20 73 65 74 20 5f 77 69 64 67 65 74 28 24 70 61   set _widget($pa
15e0: 74 68 2c 6e 69 6e 64 69 63 29 20 20 20 30 0a 0a  th,nindic)   0..
15f0: 20 20 20 20 73 65 74 20 6d 65 6e 75 20 5b 57 69      set menu [Wi
1600: 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20  dget::getoption 
1610: 24 70 61 74 68 20 2d 6d 65 6e 75 5d 0a 20 20 20  $path -menu].   
1620: 20 69 66 20 7b 20 5b 6c 6c 65 6e 67 74 68 20 24   if { [llength $
1630: 6d 65 6e 75 5d 20 7d 20 7b 0a 20 20 20 20 20 20  menu] } {.      
1640: 20 20 5f 63 72 65 61 74 65 5f 6d 65 6e 75 62 61    _create_menuba
1650: 72 20 24 70 61 74 68 20 24 6d 65 6e 75 0a 20 20  r $path $menu.  
1660: 20 20 7d 0a 0a 20 20 20 20 62 69 6e 64 20 24 70    }..    bind $p
1670: 61 74 68 20 3c 44 65 73 74 72 6f 79 3e 20 5b 6c  ath <Destroy> [l
1680: 69 73 74 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f  ist MainFrame::_
1690: 64 65 73 74 72 6f 79 20 25 57 5d 0a 0a 20 20 20  destroy %W]..   
16a0: 20 72 65 74 75 72 6e 20 5b 57 69 64 67 65 74 3a   return [Widget:
16b0: 3a 63 72 65 61 74 65 20 4d 61 69 6e 46 72 61 6d  :create MainFram
16c0: 65 20 24 70 61 74 68 5d 0a 7d 0a 0a 0a 23 20 2d  e $path].}...# -
16d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1700: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1710: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43  -----------.#  C
1720: 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65  ommand MainFrame
1730: 3a 3a 63 6f 6e 66 69 67 75 72 65 0a 23 20 2d 2d  ::configure.# --
1740: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1750: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1760: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1780: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20  ----------.proc 
1790: 4d 61 69 6e 46 72 61 6d 65 3a 3a 63 6f 6e 66 69  MainFrame::confi
17a0: 67 75 72 65 20 7b 20 70 61 74 68 20 61 72 67 73  gure { path args
17b0: 20 7d 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c   } {.    variabl
17c0: 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 73  e _widget..    s
17d0: 65 74 20 72 65 73 20 5b 57 69 64 67 65 74 3a 3a  et res [Widget::
17e0: 63 6f 6e 66 69 67 75 72 65 20 24 70 61 74 68 20  configure $path 
17f0: 24 61 72 67 73 5d 0a 0a 20 20 20 20 69 66 20 7b  $args]..    if {
1800: 20 5b 57 69 64 67 65 74 3a 3a 68 61 73 43 68 61   [Widget::hasCha
1810: 6e 67 65 64 20 24 70 61 74 68 20 2d 74 65 78 74  nged $path -text
1820: 76 61 72 69 61 62 6c 65 20 6e 65 77 76 5d 20 7d  variable newv] }
1830: 20 7b 0a 20 20 20 20 20 20 20 20 75 70 6c 65 76   {.        uplev
1840: 65 6c 20 5c 23 30 20 24 70 61 74 68 2e 73 74 61  el \#0 $path.sta
1850: 74 75 73 2e 6c 61 62 65 6c 20 63 6f 6e 66 69 67  tus.label config
1860: 75 72 65 20 2d 74 65 78 74 76 61 72 69 61 62 6c  ure -textvariabl
1870: 65 20 5b 6c 69 73 74 20 24 6e 65 77 76 5d 0a 20  e [list $newv]. 
1880: 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 7b 20 5b     }..    if { [
1890: 57 69 64 67 65 74 3a 3a 68 61 73 43 68 61 6e 67  Widget::hasChang
18a0: 65 64 20 24 70 61 74 68 20 2d 62 61 63 6b 67 72  ed $path -backgr
18b0: 6f 75 6e 64 20 62 67 5d 20 7d 20 7b 0a 09 69 66  ound bg] } {..if
18c0: 20 7b 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72   {$::tcl_platfor
18d0: 6d 28 70 6c 61 74 66 6f 72 6d 29 20 3d 3d 20 22  m(platform) == "
18e0: 75 6e 69 78 22 7d 20 7b 0a 09 20 20 20 20 73 65  unix"} {..    se
18f0: 74 20 6c 69 73 74 6d 65 6e 75 20 5b 24 5f 77 69  t listmenu [$_wi
1900: 64 67 65 74 28 24 70 61 74 68 2c 74 6f 70 29 20  dget($path,top) 
1910: 63 67 65 74 20 2d 6d 65 6e 75 5d 0a 09 20 20 20  cget -menu]..   
1920: 20 77 68 69 6c 65 20 7b 20 5b 6c 6c 65 6e 67 74   while { [llengt
1930: 68 20 24 6c 69 73 74 6d 65 6e 75 5d 20 7d 20 7b  h $listmenu] } {
1940: 0a 09 09 73 65 74 20 6e 65 77 6c 69 73 74 20 7b  ...set newlist {
1950: 7d 0a 09 09 66 6f 72 65 61 63 68 20 6d 65 6e 75  }...foreach menu
1960: 20 24 6c 69 73 74 6d 65 6e 75 20 7b 0a 09 09 20   $listmenu {... 
1970: 20 20 20 24 6d 65 6e 75 20 63 6f 6e 66 69 67 75     $menu configu
1980: 72 65 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24  re -background $
1990: 62 67 0a 09 09 20 20 20 20 73 65 74 20 6e 65 77  bg...    set new
19a0: 6c 69 73 74 20 5b 63 6f 6e 63 61 74 20 24 6e 65  list [concat $ne
19b0: 77 6c 69 73 74 20 5b 77 69 6e 66 6f 20 63 68 69  wlist [winfo chi
19c0: 6c 64 72 65 6e 20 24 6d 65 6e 75 5d 5d 0a 09 09  ldren $menu]]...
19d0: 7d 0a 09 09 73 65 74 20 6c 69 73 74 6d 65 6e 75  }...set listmenu
19e0: 20 24 6e 65 77 6c 69 73 74 0a 09 20 20 20 20 7d   $newlist..    }
19f0: 0a 09 7d 0a 20 20 20 20 20 20 20 20 66 6f 72 65  ..}.        fore
1a00: 61 63 68 20 73 65 70 20 7b 2e 73 65 70 20 2e 62  ach sep {.sep .b
1a10: 6f 74 66 2e 73 65 70 7d 20 7b 0a 20 20 20 20 20  otf.sep} {.     
1a20: 20 20 20 20 20 20 20 69 66 20 7b 20 5b 77 69 6e         if { [win
1a30: 66 6f 20 65 78 69 73 74 73 20 24 70 61 74 68 2e  fo exists $path.
1a40: 24 73 65 70 5d 20 7d 20 7b 0a 20 20 20 20 20 20  $sep] } {.      
1a50: 20 20 20 20 20 20 20 20 20 20 53 65 70 61 72 61            Separa
1a60: 74 6f 72 3a 3a 63 6f 6e 66 69 67 75 72 65 20 24  tor::configure $
1a70: 70 61 74 68 2e 24 73 65 70 20 2d 62 61 63 6b 67  path.$sep -backg
1a80: 72 6f 75 6e 64 20 24 62 67 0a 20 20 20 20 20 20  round $bg.      
1a90: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20        }.        
1aa0: 7d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63  }.        foreac
1ab0: 68 20 77 20 5b 77 69 6e 66 6f 20 63 68 69 6c 64  h w [winfo child
1ac0: 72 65 6e 20 24 70 61 74 68 2e 74 6f 70 66 5d 20  ren $path.topf] 
1ad0: 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 77  {.            $w
1ae0: 20 63 6f 6e 66 69 67 75 72 65 20 2d 62 61 63 6b   configure -back
1af0: 67 72 6f 75 6e 64 20 24 62 67 0a 20 20 20 20 20  ground $bg.     
1b00: 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20     }.    }..    
1b10: 69 66 20 7b 20 5b 57 69 64 67 65 74 3a 3a 68 61  if { [Widget::ha
1b20: 73 43 68 61 6e 67 65 64 20 24 70 61 74 68 20 2d  sChanged $path -
1b30: 6d 65 6e 75 62 61 72 66 6f 6e 74 20 6e 65 77 6d  menubarfont newm
1b40: 62 66 6e 74 5d 20 7d 20 7b 0a 09 69 66 20 7b 5b  bfnt] } {..if {[
1b50: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e  string length $n
1b60: 65 77 6d 62 66 6e 74 5d 7d 20 7b 0a 09 20 20 20  ewmbfnt]} {..   
1b70: 20 73 65 74 20 6d 62 66 6e 74 20 5b 6c 69 73 74   set mbfnt [list
1b80: 20 2d 66 6f 6e 74 20 24 6e 65 77 6d 62 66 6e 74   -font $newmbfnt
1b90: 5d 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20  ]..} else {..   
1ba0: 20 73 65 74 20 6d 62 66 6e 74 20 22 22 0a 09 7d   set mbfnt ""..}
1bb0: 0a 09 73 65 74 20 74 6f 70 20 20 20 20 20 24 5f  ..set top     $_
1bc0: 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 6f 70  widget($path,top
1bd0: 29 0a 09 69 66 20 7b 5b 73 74 72 69 6e 67 20 65  )..if {[string e
1be0: 71 75 61 6c 20 24 74 6f 70 20 2e 5d 7d 20 7b 0a  qual $top .]} {.
1bf0: 09 20 20 20 20 65 76 61 6c 20 5b 6c 69 73 74 20  .    eval [list 
1c00: 2e 6d 65 6e 75 62 61 72 20 63 6f 6e 66 69 67 75  .menubar configu
1c10: 72 65 5d 20 24 6d 62 66 6e 74 0a 09 7d 20 65 6c  re] $mbfnt..} el
1c20: 73 65 20 7b 0a 09 20 20 20 20 65 76 61 6c 20 5b  se {..    eval [
1c30: 6c 69 73 74 20 24 74 6f 70 2e 6d 65 6e 75 62 61  list $top.menuba
1c40: 72 20 63 6f 6e 66 69 67 75 72 65 5d 20 24 6d 62  r configure] $mb
1c50: 66 6e 74 0a 09 7d 0a 20 20 20 20 7d 0a 20 20 20  fnt..}.    }.   
1c60: 20 69 66 20 7b 20 5b 57 69 64 67 65 74 3a 3a 68   if { [Widget::h
1c70: 61 73 43 68 61 6e 67 65 64 20 24 70 61 74 68 20  asChanged $path 
1c80: 2d 6d 65 6e 75 65 6e 74 72 79 66 6f 6e 74 20 6e  -menuentryfont n
1c90: 65 77 6d 65 66 6e 74 5d 20 7d 20 7b 0a 09 69 66  ewmefnt] } {..if
1ca0: 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68   {[string length
1cb0: 20 24 6e 65 77 6d 65 66 6e 74 5d 7d 20 7b 0a 09   $newmefnt]} {..
1cc0: 20 20 20 20 73 65 74 20 6d 65 66 6e 74 20 5b 6c      set mefnt [l
1cd0: 69 73 74 20 2d 66 6f 6e 74 20 24 6e 65 77 6d 65  ist -font $newme
1ce0: 66 6e 74 5d 0a 09 7d 20 65 6c 73 65 20 7b 0a 09  fnt]..} else {..
1cf0: 20 20 20 20 73 65 74 20 6d 65 66 6e 74 20 22 22      set mefnt ""
1d00: 0a 09 7d 0a 09 73 65 74 20 74 6f 70 20 20 20 20  ..}..set top    
1d10: 20 24 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c   $_widget($path,
1d20: 74 6f 70 29 0a 09 69 66 20 7b 5b 73 74 72 69 6e  top)..if {[strin
1d30: 67 20 65 71 75 61 6c 20 24 74 6f 70 20 2e 5d 7d  g equal $top .]}
1d40: 20 7b 0a 09 20 20 20 20 73 65 74 20 6d 62 20 2e   {..    set mb .
1d50: 6d 65 6e 75 62 61 72 0a 09 7d 20 65 6c 73 65 20  menubar..} else 
1d60: 7b 0a 09 20 20 20 20 73 65 74 20 6d 62 20 24 74  {..    set mb $t
1d70: 6f 70 2e 6d 65 6e 75 62 61 72 0a 09 7d 0a 09 73  op.menubar..}..s
1d80: 65 74 20 6c 20 5b 77 69 6e 66 6f 20 63 68 69 6c  et l [winfo chil
1d90: 64 72 65 6e 20 24 6d 62 5d 0a 09 77 68 69 6c 65  dren $mb]..while
1da0: 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 6c 5d 7d 20   {[llength $l]} 
1db0: 7b 0a 09 20 20 20 20 73 65 74 20 65 20 5b 6c 69  {..    set e [li
1dc0: 6e 64 65 78 20 24 6c 20 30 5d 0a 09 20 20 20 20  ndex $l 0]..    
1dd0: 73 65 74 20 6c 20 5b 6c 72 61 6e 67 65 20 24 6c  set l [lrange $l
1de0: 20 31 20 65 6e 64 5d 0a 09 20 20 20 20 69 66 20   1 end]..    if 
1df0: 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20  {[string length 
1e00: 24 65 5d 20 3d 3d 20 30 7d 20 7b 63 6f 6e 74 69  $e] == 0} {conti
1e10: 6e 75 65 7d 0a 09 20 20 20 20 6c 61 70 70 65 6e  nue}..    lappen
1e20: 64 20 6c 20 5b 77 69 6e 66 6f 20 63 68 69 6c 64  d l [winfo child
1e30: 72 65 6e 20 24 65 5d 0a 09 20 20 20 20 65 76 61  ren $e]..    eva
1e40: 6c 20 5b 6c 69 73 74 20 24 65 20 63 6f 6e 66 69  l [list $e confi
1e50: 67 75 72 65 5d 20 24 6d 65 66 6e 74 0a 09 7d 0a  gure] $mefnt..}.
1e60: 20 20 20 20 7d 0a 0a 0a 20 20 20 20 69 66 20 7b      }...    if {
1e70: 20 5b 57 69 64 67 65 74 3a 3a 68 61 73 43 68 61   [Widget::hasCha
1e80: 6e 67 65 64 20 24 70 61 74 68 20 2d 73 74 61 74  nged $path -stat
1e90: 75 73 62 61 72 66 6f 6e 74 20 6e 65 77 73 62 66  usbarfont newsbf
1ea0: 6e 74 5d 20 7d 20 7b 0a 09 69 66 20 7b 5b 73 74  nt] } {..if {[st
1eb0: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e 65 77  ring length $new
1ec0: 73 62 66 6e 74 5d 7d 20 7b 0a 09 20 20 20 20 73  sbfnt]} {..    s
1ed0: 65 74 20 73 62 66 6e 74 20 5b 6c 69 73 74 20 2d  et sbfnt [list -
1ee0: 66 6f 6e 74 20 24 6e 65 77 73 62 66 6e 74 5d 0a  font $newsbfnt].
1ef0: 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 73  .} else {..    s
1f00: 65 74 20 73 62 66 6e 74 20 22 22 0a 09 7d 0a 09  et sbfnt ""..}..
1f10: 66 6f 72 20 7b 73 65 74 20 69 6e 64 65 78 20 30  for {set index 0
1f20: 7d 20 7b 24 69 6e 64 65 78 3c 24 5f 77 69 64 67  } {$index<$_widg
1f30: 65 74 28 24 70 61 74 68 2c 6e 69 6e 64 69 63 29  et($path,nindic)
1f40: 7d 20 7b 69 6e 63 72 20 69 6e 64 65 78 7d 20 7b  } {incr index} {
1f50: 0a 09 20 20 20 20 73 65 74 20 69 6e 64 69 63 20  ..    set indic 
1f60: 24 70 61 74 68 2e 73 74 61 74 75 73 2e 69 6e 64  $path.status.ind
1f70: 66 2e 66 24 69 6e 64 65 78 0a 09 20 20 20 20 65  f.f$index..    e
1f80: 76 61 6c 20 5b 6c 69 73 74 20 24 69 6e 64 69 63  val [list $indic
1f90: 20 63 6f 6e 66 69 67 75 72 65 5d 20 24 73 62 66   configure] $sbf
1fa0: 6e 74 0a 09 7d 0a 09 65 76 61 6c 20 5b 6c 69 73  nt..}..eval [lis
1fb0: 74 20 24 70 61 74 68 2e 73 74 61 74 75 73 2e 6c  t $path.status.l
1fc0: 61 62 65 6c 20 63 6f 6e 66 69 67 75 72 65 5d 20  abel configure] 
1fd0: 24 73 62 66 6e 74 0a 09 24 70 61 74 68 2e 73 74  $sbfnt..$path.st
1fe0: 61 74 75 73 20 63 6f 6e 66 69 67 75 72 65 20 2d  atus configure -
1ff0: 68 65 69 67 68 74 20 5b 77 69 6e 66 6f 20 72 65  height [winfo re
2000: 71 68 65 69 67 68 74 20 24 70 61 74 68 2e 73 74  qheight $path.st
2010: 61 74 75 73 2e 6c 61 62 65 6c 5d 0a 0a 09 24 70  atus.label]...$p
2020: 61 74 68 2e 73 74 61 74 75 73 2e 70 72 67 20 63  ath.status.prg c
2030: 6f 6e 66 69 67 75 72 65 20 5c 0a 09 09 2d 68 65  onfigure \...-he
2040: 69 67 68 74 20 5b 65 78 70 72 20 7b 5b 77 69 6e  ight [expr {[win
2050: 66 6f 20 72 65 71 68 65 69 67 68 74 20 24 70 61  fo reqheight $pa
2060: 74 68 2e 73 74 61 74 75 73 2e 6c 61 62 65 6c 5d  th.status.label]
2070: 2d 32 7d 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20  -2}].    }..    
2080: 72 65 74 75 72 6e 20 24 72 65 73 0a 7d 0a 0a 0a  return $res.}...
2090: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
20a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
20b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
20c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
20d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
20e0: 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72    Command MainFr
20f0: 61 6d 65 3a 3a 63 67 65 74 0a 23 20 2d 2d 2d 2d  ame::cget.# ----
2100: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2120: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2130: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2140: 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61  --------.proc Ma
2150: 69 6e 46 72 61 6d 65 3a 3a 63 67 65 74 20 7b 20  inFrame::cget { 
2160: 70 61 74 68 20 6f 70 74 69 6f 6e 20 7d 20 7b 0a  path option } {.
2170: 20 20 20 20 72 65 74 75 72 6e 20 5b 57 69 64 67      return [Widg
2180: 65 74 3a 3a 63 67 65 74 20 24 70 61 74 68 20 24  et::cget $path $
2190: 6f 70 74 69 6f 6e 5d 0a 7d 0a 0a 0a 23 20 2d 2d  option].}...# --
21a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
21e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f  ----------.#  Co
21f0: 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a  mmand MainFrame:
2200: 3a 67 65 74 66 72 61 6d 65 0a 23 20 2d 2d 2d 2d  :getframe.# ----
2210: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2220: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2230: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2240: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2250: 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61  --------.proc Ma
2260: 69 6e 46 72 61 6d 65 3a 3a 67 65 74 66 72 61 6d  inFrame::getfram
2270: 65 20 7b 20 70 61 74 68 20 7d 20 7b 0a 20 20 20  e { path } {.   
2280: 20 72 65 74 75 72 6e 20 24 70 61 74 68 2e 66 72   return $path.fr
2290: 61 6d 65 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d  ame.}...# ------
22a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22e0: 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e  ------.#  Comman
22f0: 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 61 64 64  d MainFrame::add
2300: 74 6f 6f 6c 62 61 72 0a 23 20 2d 2d 2d 2d 2d 2d  toolbar.# ------
2310: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2350: 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e  ------.proc Main
2360: 46 72 61 6d 65 3a 3a 61 64 64 74 6f 6f 6c 62 61  Frame::addtoolba
2370: 72 20 7b 20 70 61 74 68 20 7d 20 7b 0a 20 20 20  r { path } {.   
2380: 20 67 6c 6f 62 61 6c 20 20 20 74 63 6c 5f 70 6c   global   tcl_pl
2390: 61 74 66 6f 72 6d 0a 20 20 20 20 76 61 72 69 61  atform.    varia
23a0: 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20  ble _widget..   
23b0: 20 73 65 74 20 69 6e 64 65 78 20 20 20 20 20 24   set index     $
23c0: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6e 74  _widget($path,nt
23d0: 6f 6f 6c 62 61 72 29 0a 20 20 20 20 73 65 74 20  oolbar).    set 
23e0: 74 6f 6f 6c 66 72 61 6d 65 20 24 70 61 74 68 2e  toolframe $path.
23f0: 74 6f 70 66 2e 66 24 69 6e 64 65 78 0a 20 20 20  topf.f$index.   
2400: 20 73 65 74 20 74 6f 6f 6c 62 61 72 20 20 20 24   set toolbar   $
2410: 70 61 74 68 2e 74 6f 70 66 2e 74 62 24 69 6e 64  path.topf.tb$ind
2420: 65 78 0a 20 20 20 20 73 65 74 20 62 67 20 20 20  ex.    set bg   
2430: 20 20 20 20 20 5b 57 69 64 67 65 74 3a 3a 67 65       [Widget::ge
2440: 74 6f 70 74 69 6f 6e 20 24 70 61 74 68 20 2d 62  toption $path -b
2450: 61 63 6b 67 72 6f 75 6e 64 5d 0a 20 20 20 20 69  ackground].    i
2460: 66 20 7b 20 24 74 63 6c 5f 70 6c 61 74 66 6f 72  f { $tcl_platfor
2470: 6d 28 70 6c 61 74 66 6f 72 6d 29 20 3d 3d 20 22  m(platform) == "
2480: 75 6e 69 78 22 20 7d 20 7b 0a 20 20 20 20 20 20  unix" } {.      
2490: 20 20 66 72 61 6d 65 20 24 74 6f 6f 6c 66 72 61    frame $toolfra
24a0: 6d 65 20 2d 72 65 6c 69 65 66 20 72 61 69 73 65  me -relief raise
24b0: 64 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20 31  d -borderwidth 1
24c0: 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 2d   \.            -
24d0: 74 61 6b 65 66 6f 63 75 73 20 30 20 2d 68 69 67  takefocus 0 -hig
24e0: 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20  hlightthickness 
24f0: 30 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62  0 -background $b
2500: 67 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20  g.    } else {. 
2510: 20 20 20 20 20 20 20 66 72 61 6d 65 20 24 74 6f         frame $to
2520: 6f 6c 66 72 61 6d 65 20 2d 72 65 6c 69 65 66 20  olframe -relief 
2530: 66 6c 61 74 20 2d 62 6f 72 64 65 72 77 69 64 74  flat -borderwidt
2540: 68 20 30 20 2d 74 61 6b 65 66 6f 63 75 73 20 30  h 0 -takefocus 0
2550: 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 2d   \.            -
2560: 68 69 67 68 6c 69 67 68 74 74 68 69 63 6b 6e 65  highlightthickne
2570: 73 73 20 30 20 2d 62 61 63 6b 67 72 6f 75 6e 64  ss 0 -background
2580: 20 24 62 67 0a 20 20 20 20 20 20 20 20 73 65 74   $bg.        set
2590: 20 73 65 70 20 5b 53 65 70 61 72 61 74 6f 72 3a   sep [Separator:
25a0: 3a 63 72 65 61 74 65 20 24 74 6f 6f 6c 66 72 61  :create $toolfra
25b0: 6d 65 2e 73 65 70 20 2d 6f 72 69 65 6e 74 20 68  me.sep -orient h
25c0: 6f 72 69 7a 6f 6e 74 61 6c 20 2d 62 61 63 6b 67  orizontal -backg
25d0: 72 6f 75 6e 64 20 24 62 67 5d 0a 20 20 20 20 20  round $bg].     
25e0: 20 20 20 70 61 63 6b 20 24 73 65 70 20 2d 66 69     pack $sep -fi
25f0: 6c 6c 20 78 0a 20 20 20 20 7d 0a 20 20 20 20 73  ll x.    }.    s
2600: 65 74 20 74 6f 6f 6c 62 61 72 20 5b 66 72 61 6d  et toolbar [fram
2610: 65 20 24 74 6f 6f 6c 62 61 72 20 2d 72 65 6c 69  e $toolbar -reli
2620: 65 66 20 66 6c 61 74 20 2d 62 6f 72 64 65 72 77  ef flat -borderw
2630: 69 64 74 68 20 32 20 5c 0a 20 20 20 20 20 20 20  idth 2 \.       
2640: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 74                -t
2650: 61 6b 65 66 6f 63 75 73 20 30 20 2d 68 69 67 68  akefocus 0 -high
2660: 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30  lightthickness 0
2670: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67   -background $bg
2680: 5d 0a 20 20 20 20 70 61 63 6b 20 24 74 6f 6f 6c  ].    pack $tool
2690: 62 61 72 20 2d 69 6e 20 24 74 6f 6f 6c 66 72 61  bar -in $toolfra
26a0: 6d 65 20 2d 61 6e 63 68 6f 72 20 77 20 2d 65 78  me -anchor w -ex
26b0: 70 61 6e 64 20 79 65 73 20 2d 66 69 6c 6c 20 78  pand yes -fill x
26c0: 0a 20 20 20 20 69 6e 63 72 20 5f 77 69 64 67 65  .    incr _widge
26d0: 74 28 24 70 61 74 68 2c 6e 74 6f 6f 6c 62 61 72  t($path,ntoolbar
26e0: 29 0a 20 20 20 20 67 72 69 64 20 24 74 6f 6f 6c  ).    grid $tool
26f0: 66 72 61 6d 65 20 2d 63 6f 6c 75 6d 6e 20 30 20  frame -column 0 
2700: 2d 72 6f 77 20 24 69 6e 64 65 78 20 2d 73 74 69  -row $index -sti
2710: 63 6b 79 20 65 77 0a 20 20 20 20 72 65 74 75 72  cky ew.    retur
2720: 6e 20 24 74 6f 6f 6c 62 61 72 0a 7d 0a 0a 0a 23  n $toolbar.}...#
2730: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
2740: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2750: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2760: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20  -------------.# 
2780: 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61   Command MainFra
2790: 6d 65 3a 3a 67 65 74 74 6f 6f 6c 62 61 72 0a 23  me::gettoolbar.#
27a0: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
27b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
27c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
27d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
27e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
27f0: 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65  oc MainFrame::ge
2800: 74 74 6f 6f 6c 62 61 72 20 7b 20 70 61 74 68 20  ttoolbar { path 
2810: 69 6e 64 65 78 20 7d 20 7b 0a 20 20 20 20 72 65  index } {.    re
2820: 74 75 72 6e 20 24 70 61 74 68 2e 74 6f 70 66 2e  turn $path.topf.
2830: 74 62 24 69 6e 64 65 78 0a 7d 0a 0a 0a 23 20 2d  tb$index.}...# -
2840: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2850: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2860: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2870: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43  -----------.#  C
2890: 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65  ommand MainFrame
28a0: 3a 3a 61 64 64 69 6e 64 69 63 61 74 6f 72 0a 23  ::addindicator.#
28b0: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
28c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
2900: 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 61 64  oc MainFrame::ad
2910: 64 69 6e 64 69 63 61 74 6f 72 20 7b 20 70 61 74  dindicator { pat
2920: 68 20 61 72 67 73 20 7d 20 7b 0a 20 20 20 20 76  h args } {.    v
2930: 61 72 69 61 62 6c 65 20 5f 77 69 64 67 65 74 0a  ariable _widget.
2940: 0a 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67  .    if {[string
2950: 20 6c 65 6e 67 74 68 20 5b 57 69 64 67 65 74 3a   length [Widget:
2960: 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61 74 68  :getoption $path
2970: 20 2d 73 74 61 74 75 73 62 61 72 66 6f 6e 74 5d   -statusbarfont]
2980: 5d 7d 20 7b 0a 09 73 65 74 20 73 62 66 6e 74 20  ]} {..set sbfnt 
2990: 5b 6c 69 73 74 20 2d 66 6f 6e 74 20 5b 57 69 64  [list -font [Wid
29a0: 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24  get::getoption $
29b0: 70 61 74 68 20 2d 73 74 61 74 75 73 62 61 72 66  path -statusbarf
29c0: 6f 6e 74 5d 5d 0a 20 20 20 20 7d 20 65 6c 73 65  ont]].    } else
29d0: 20 7b 0a 09 73 65 74 20 73 62 66 6e 74 20 22 22   {..set sbfnt ""
29e0: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73 65 74 20  .    }..    set 
29f0: 69 6e 64 65 78 20 24 5f 77 69 64 67 65 74 28 24  index $_widget($
2a00: 70 61 74 68 2c 6e 69 6e 64 69 63 29 0a 20 20 20  path,nindic).   
2a10: 20 73 65 74 20 69 6e 64 69 63 20 24 70 61 74 68   set indic $path
2a20: 2e 73 74 61 74 75 73 2e 69 6e 64 66 2e 66 24 69  .status.indf.f$i
2a30: 6e 64 65 78 0a 20 20 20 20 65 76 61 6c 20 5b 6c  ndex.    eval [l
2a40: 69 73 74 20 6c 61 62 65 6c 20 24 69 6e 64 69 63  ist label $indic
2a50: 5d 20 24 61 72 67 73 20 2d 72 65 6c 69 65 66 20  ] $args -relief 
2a60: 73 75 6e 6b 65 6e 20 2d 62 6f 72 64 65 72 77 69  sunken -borderwi
2a70: 64 74 68 20 31 20 5c 0a 20 20 20 20 20 20 20 20  dth 1 \.        
2a80: 2d 74 61 6b 65 66 6f 63 75 73 20 30 20 2d 68 69  -takefocus 0 -hi
2a90: 67 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73  ghlightthickness
2aa0: 20 30 20 24 73 62 66 6e 74 0a 0a 20 20 20 20 70   0 $sbfnt..    p
2ab0: 61 63 6b 20 24 69 6e 64 69 63 20 2d 73 69 64 65  ack $indic -side
2ac0: 20 6c 65 66 74 20 2d 61 6e 63 68 6f 72 20 77 20   left -anchor w 
2ad0: 2d 70 61 64 78 20 32 20 2d 66 69 6c 6c 20 79 20  -padx 2 -fill y 
2ae0: 2d 65 78 70 61 6e 64 20 31 0a 0a 20 20 20 20 69  -expand 1..    i
2af0: 6e 63 72 20 5f 77 69 64 67 65 74 28 24 70 61 74  ncr _widget($pat
2b00: 68 2c 6e 69 6e 64 69 63 29 0a 0a 20 20 20 20 72  h,nindic)..    r
2b10: 65 74 75 72 6e 20 24 69 6e 64 69 63 0a 7d 0a 0a  eturn $indic.}..
2b20: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
2b30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2b60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
2b70: 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46  #  Command MainF
2b80: 72 61 6d 65 3a 3a 67 65 74 69 6e 64 69 63 61 74  rame::getindicat
2b90: 6f 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  or.# -----------
2ba0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2bb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2bc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2bd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2be0: 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65  -.proc MainFrame
2bf0: 3a 3a 67 65 74 69 6e 64 69 63 61 74 6f 72 20 7b  ::getindicator {
2c00: 20 70 61 74 68 20 69 6e 64 65 78 20 7d 20 7b 0a   path index } {.
2c10: 20 20 20 20 72 65 74 75 72 6e 20 24 70 61 74 68      return $path
2c20: 2e 73 74 61 74 75 73 2e 69 6e 64 66 2e 66 24 69  .status.indf.f$i
2c30: 6e 64 65 78 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d  ndex.}...# -----
2c40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c80: 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61  -------.#  Comma
2c90: 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65  nd MainFrame::ge
2ca0: 74 6d 65 6e 75 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  tmenu.# --------
2cb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2cc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2cd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ce0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2cf0: 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72  ----.proc MainFr
2d00: 61 6d 65 3a 3a 67 65 74 6d 65 6e 75 20 7b 20 70  ame::getmenu { p
2d10: 61 74 68 20 6d 65 6e 75 69 64 20 7d 20 7b 0a 20  ath menuid } {. 
2d20: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64     variable _wid
2d30: 67 65 74 0a 0a 20 20 20 20 69 66 20 7b 20 5b 69  get..    if { [i
2d40: 6e 66 6f 20 65 78 69 73 74 73 20 5f 77 69 64 67  nfo exists _widg
2d50: 65 74 28 24 70 61 74 68 2c 6d 65 6e 75 69 64 2c  et($path,menuid,
2d60: 24 6d 65 6e 75 69 64 29 5d 20 7d 20 7b 0a 20 20  $menuid)] } {.  
2d70: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 5f 77        return $_w
2d80: 69 64 67 65 74 28 24 70 61 74 68 2c 6d 65 6e 75  idget($path,menu
2d90: 69 64 2c 24 6d 65 6e 75 69 64 29 0a 20 20 20 20  id,$menuid).    
2da0: 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 22 22 0a  }.    return "".
2db0: 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  }...# ----------
2dc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2de0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2df0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2e00: 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d  ---.#  Command M
2e10: 61 69 6e 46 72 61 6d 65 3a 3a 73 65 74 6d 65 6e  ainFrame::setmen
2e20: 75 73 74 61 74 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d  ustate.# -------
2e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2e60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2e70: 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e  ------.proc Main
2e80: 46 72 61 6d 65 3a 3a 73 65 74 6d 65 6e 75 73 74  Frame::setmenust
2e90: 61 74 65 20 7b 20 70 61 74 68 20 74 61 67 20 73  ate { path tag s
2ea0: 74 61 74 65 20 7d 20 7b 0a 20 20 20 20 76 61 72  tate } {.    var
2eb0: 69 61 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20  iable _widget.. 
2ec0: 20 20 20 23 20 20 20 20 69 66 20 7b 20 5b 69 6e     #    if { [in
2ed0: 66 6f 20 65 78 69 73 74 73 20 5f 77 69 64 67 65  fo exists _widge
2ee0: 74 28 24 70 61 74 68 2c 74 61 67 73 2c 24 74 61  t($path,tags,$ta
2ef0: 67 29 5d 20 7d 20 7b 0a 20 20 20 20 23 20 20 20  g)] } {.    #   
2f00: 20 20 20 20 20 66 6f 72 65 61 63 68 20 7b 6d 65       foreach {me
2f10: 6e 75 20 65 6e 74 72 79 7d 20 24 5f 77 69 64 67  nu entry} $_widg
2f20: 65 74 28 24 70 61 74 68 2c 74 61 67 73 2c 24 74  et($path,tags,$t
2f30: 61 67 29 20 7b 0a 20 20 20 20 23 20 20 20 20 20  ag) {.    #     
2f40: 20 20 20 20 20 20 20 24 6d 65 6e 75 20 65 6e 74         $menu ent
2f50: 72 79 63 6f 6e 66 69 67 75 72 65 20 24 65 6e 74  ryconfigure $ent
2f60: 72 79 20 2d 73 74 61 74 65 20 24 73 74 61 74 65  ry -state $state
2f70: 0a 20 20 20 20 23 20 20 20 20 20 20 20 20 7d 0a  .    #        }.
2f80: 20 20 20 20 23 20 20 20 20 7d 0a 0a 20 20 20 20      #    }..    
2f90: 23 20 57 65 20 6e 65 65 64 20 61 20 6d 6f 72 65  # We need a more
2fa0: 20 73 6f 70 68 69 73 74 69 63 61 74 65 64 20 73   sophisticated s
2fb0: 74 61 74 65 20 73 79 73 74 65 6d 2e 0a 20 20 20  tate system..   
2fc0: 20 23 20 54 68 65 20 6f 72 69 67 69 6e 61 6c 20   # The original 
2fd0: 6d 6f 64 65 6c 20 77 61 73 20 74 68 69 73 3a 20  model was this: 
2fe0: 20 65 61 63 68 20 6d 65 6e 75 20 69 74 65 6d 20   each menu item 
2ff0: 68 61 73 20 61 20 6c 69 73 74 20 6f 66 20 74 61  has a list of ta
3000: 67 73 3b 0a 20 20 20 20 23 20 77 68 65 6e 65 76  gs;.    # whenev
3010: 65 72 20 61 6e 79 20 6f 6e 65 20 6f 66 20 74 68  er any one of th
3020: 6f 73 65 20 74 61 67 73 20 63 68 61 6e 67 65 64  ose tags changed
3030: 20 73 74 61 74 65 2c 20 74 68 65 20 6d 65 6e 75   state, the menu
3040: 20 69 74 65 6d 20 64 69 64 20 74 6f 6f 2e 0a 20   item did too.. 
3050: 20 20 20 23 20 54 68 69 73 20 6d 61 6b 65 73 20     # This makes 
3060: 69 74 20 68 61 72 64 20 74 6f 20 68 61 76 65 20  it hard to have 
3070: 69 74 65 6d 73 20 74 68 61 74 20 61 72 65 20 65  items that are e
3080: 6e 61 62 6c 65 64 20 6f 6e 6c 79 20 77 68 65 6e  nabled only when
3090: 20 62 6f 74 68 20 74 61 67 41 20 61 6e 64 0a 20   both tagA and. 
30a0: 20 20 20 23 20 74 61 67 42 20 61 72 65 2e 20 20     # tagB are.  
30b0: 54 68 65 20 6e 65 77 20 6d 6f 64 65 6c 20 74 68  The new model th
30c0: 65 72 65 66 6f 72 65 20 6f 6e 6c 79 20 73 65 74  erefore only set
30d0: 73 20 74 68 65 20 6d 65 6e 75 73 74 61 74 65 20  s the menustate 
30e0: 74 6f 20 65 6e 61 62 6c 65 64 0a 20 20 20 20 23  to enabled.    #
30f0: 20 77 68 65 6e 20 41 4c 4c 20 6f 66 20 69 74 73   when ALL of its
3100: 20 74 61 67 73 20 61 72 65 20 65 6e 61 62 6c 65   tags are enable
3110: 64 2e 0a 0a 20 20 20 20 23 20 46 69 72 73 74 20  d...    # First 
3120: 73 65 65 20 69 66 20 74 68 69 73 20 69 73 20 61  see if this is a
3130: 20 72 65 61 6c 20 74 61 67 0a 20 20 20 20 69 66   real tag.    if
3140: 20 7b 20 5b 69 6e 66 6f 20 65 78 69 73 74 73 20   { [info exists 
3150: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 61  _widget($path,ta
3160: 67 73 74 61 74 65 2c 24 74 61 67 29 5d 20 7d 20  gstate,$tag)] } 
3170: 7b 0a 09 69 66 20 7b 20 21 5b 73 74 72 69 6e 67  {..if { ![string
3180: 20 65 71 75 61 6c 20 24 73 74 61 74 65 20 22 64   equal $state "d
3190: 69 73 61 62 6c 65 64 22 5d 20 7d 20 7b 0a 09 20  isabled"] } {.. 
31a0: 20 20 20 73 65 74 20 5f 77 69 64 67 65 74 28 24     set _widget($
31b0: 70 61 74 68 2c 74 61 67 73 74 61 74 65 2c 24 74  path,tagstate,$t
31c0: 61 67 29 20 31 0a 09 7d 20 65 6c 73 65 20 7b 0a  ag) 1..} else {.
31d0: 09 20 20 20 20 73 65 74 20 5f 77 69 64 67 65 74  .    set _widget
31e0: 28 24 70 61 74 68 2c 74 61 67 73 74 61 74 65 2c  ($path,tagstate,
31f0: 24 74 61 67 29 20 30 0a 09 7d 0a 09 66 6f 72 65  $tag) 0..}..fore
3200: 61 63 68 20 7b 6d 65 6e 75 20 65 6e 74 72 79 7d  ach {menu entry}
3210: 20 24 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c   $_widget($path,
3220: 74 61 67 73 2c 24 74 61 67 29 20 7b 0a 09 20 20  tags,$tag) {..  
3230: 20 20 73 65 74 20 65 78 70 72 65 73 73 69 6f 6e    set expression
3240: 20 22 31 22 0a 09 20 20 20 20 66 6f 72 65 61 63   "1"..    foreac
3250: 68 20 6d 65 6e 75 74 61 67 20 24 5f 77 69 64 67  h menutag $_widg
3260: 65 74 28 24 70 61 74 68 2c 6d 65 6e 75 74 61 67  et($path,menutag
3270: 73 2c 5b 6c 69 73 74 20 24 6d 65 6e 75 20 24 65  s,[list $menu $e
3280: 6e 74 72 79 5d 29 20 7b 0a 09 09 61 70 70 65 6e  ntry]) {...appen
3290: 64 20 65 78 70 72 65 73 73 69 6f 6e 20 22 20 26  d expression " &
32a0: 26 20 24 5f 77 69 64 67 65 74 28 24 70 61 74 68  & $_widget($path
32b0: 2c 74 61 67 73 74 61 74 65 2c 24 6d 65 6e 75 74  ,tagstate,$menut
32c0: 61 67 29 22 0a 09 20 20 20 20 7d 0a 09 20 20 20  ag)"..    }..   
32d0: 20 69 66 20 7b 20 5b 65 78 70 72 20 24 65 78 70   if { [expr $exp
32e0: 72 65 73 73 69 6f 6e 5d 20 7d 20 7b 0a 09 09 73  ression] } {...s
32f0: 65 74 20 73 74 61 74 65 20 6e 6f 72 6d 61 6c 0a  et state normal.
3300: 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 09  .    } else {...
3310: 73 65 74 20 73 74 61 74 65 20 64 69 73 61 62 6c  set state disabl
3320: 65 64 0a 09 20 20 20 20 7d 0a 09 20 20 20 20 24  ed..    }..    $
3330: 6d 65 6e 75 20 65 6e 74 72 79 63 6f 6e 66 69 67  menu entryconfig
3340: 75 72 65 20 24 65 6e 74 72 79 20 2d 73 74 61 74  ure $entry -stat
3350: 65 20 24 73 74 61 74 65 0a 09 7d 0a 20 20 20 20  e $state..}.    
3360: 7d 0a 20 20 20 20 72 65 74 75 72 6e 0a 7d 0a 0a  }.    return.}..
3370: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
3380: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3390: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
33a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
33b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
33c0: 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e  .#  Command Main
33d0: 46 72 61 6d 65 3a 3a 6d 65 6e 75 6f 6e 6c 79 0a  Frame::menuonly.
33e0: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
33f0: 2d 2d 2d 2d 2d 2d 2d 2d 64 2d 2d 2d 2d 2d 2d 2d  --------d-------
3400: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3410: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3420: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
3430: 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a  proc MainFrame::
3440: 6d 65 6e 75 6f 6e 6c 79 20 7b 20 70 61 74 68 20  menuonly { path 
3450: 7d 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65  } {.    variable
3460: 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 63 61   _widget..    ca
3470: 74 63 68 20 7b 70 61 63 6b 20 66 6f 72 67 65 74  tch {pack forget
3480: 20 24 70 61 74 68 2e 73 65 70 7d 0a 20 20 20 20   $path.sep}.    
3490: 63 61 74 63 68 20 7b 70 61 63 6b 20 66 6f 72 67  catch {pack forg
34a0: 65 74 20 24 70 61 74 68 2e 62 6f 74 66 2e 73 65  et $path.botf.se
34b0: 70 7d 0a 20 20 20 20 63 61 74 63 68 20 7b 70 61  p}.    catch {pa
34c0: 63 6b 20 66 6f 72 67 65 74 20 24 70 61 74 68 2e  ck forget $path.
34d0: 66 72 61 6d 65 7d 0a 7d 0a 0a 23 20 2d 2d 2d 2d  frame}.}..# ----
34e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
34f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3500: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3520: 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d  --------.#  Comm
3530: 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 73  and MainFrame::s
3540: 68 6f 77 74 6f 6f 6c 62 61 72 0a 23 20 2d 2d 2d  howtoolbar.# ---
3550: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3560: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3570: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3580: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3590: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d  ---------.proc M
35a0: 61 69 6e 46 72 61 6d 65 3a 3a 73 68 6f 77 74 6f  ainFrame::showto
35b0: 6f 6c 62 61 72 20 7b 20 70 61 74 68 20 69 6e 64  olbar { path ind
35c0: 65 78 20 62 6f 6f 6c 20 7d 20 7b 0a 20 20 20 20  ex bool } {.    
35d0: 76 61 72 69 61 62 6c 65 20 5f 77 69 64 67 65 74  variable _widget
35e0: 0a 0a 20 20 20 20 73 65 74 20 74 6f 6f 6c 66 72  ..    set toolfr
35f0: 61 6d 65 20 24 70 61 74 68 2e 74 6f 70 66 2e 66  ame $path.topf.f
3600: 24 69 6e 64 65 78 0a 20 20 20 20 69 66 20 7b 20  $index.    if { 
3610: 5b 77 69 6e 66 6f 20 65 78 69 73 74 73 20 24 74  [winfo exists $t
3620: 6f 6f 6c 66 72 61 6d 65 5d 20 7d 20 7b 0a 20 20  oolframe] } {.  
3630: 20 20 20 20 20 20 69 66 20 7b 20 21 24 62 6f 6f        if { !$boo
3640: 6c 20 26 26 20 5b 6c 6c 65 6e 67 74 68 20 5b 67  l && [llength [g
3650: 72 69 64 20 69 6e 66 6f 20 24 74 6f 6f 6c 66 72  rid info $toolfr
3660: 61 6d 65 5d 5d 20 7d 20 7b 0a 20 20 20 20 20 20  ame]] } {.      
3670: 20 20 20 20 20 20 67 72 69 64 20 66 6f 72 67 65        grid forge
3680: 74 20 24 74 6f 6f 6c 66 72 61 6d 65 0a 20 20 20  t $toolframe.   
3690: 20 20 20 20 20 20 20 20 20 24 70 61 74 68 2e 74           $path.t
36a0: 6f 70 66 20 63 6f 6e 66 69 67 75 72 65 20 2d 68  opf configure -h
36b0: 65 69 67 68 74 20 31 0a 20 20 20 20 20 20 20 20  eight 1.        
36c0: 7d 20 65 6c 73 65 69 66 20 7b 20 24 62 6f 6f 6c  } elseif { $bool
36d0: 20 26 26 20 21 5b 6c 6c 65 6e 67 74 68 20 5b 67   && ![llength [g
36e0: 72 69 64 20 69 6e 66 6f 20 24 74 6f 6f 6c 66 72  rid info $toolfr
36f0: 61 6d 65 5d 5d 20 7d 20 7b 0a 20 20 20 20 20 20  ame]] } {.      
3700: 20 20 20 20 20 20 67 72 69 64 20 24 74 6f 6f 6c        grid $tool
3710: 66 72 61 6d 65 20 2d 63 6f 6c 75 6d 6e 20 30 20  frame -column 0 
3720: 2d 72 6f 77 20 24 69 6e 64 65 78 20 2d 73 74 69  -row $index -sti
3730: 63 6b 79 20 65 77 0a 20 20 20 20 20 20 20 20 7d  cky ew.        }
3740: 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20 2d 2d 2d  .    }.}...# ---
3750: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3760: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3780: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3790: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d  ---------.#  Com
37a0: 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a  mand MainFrame::
37b0: 73 68 6f 77 73 74 61 74 75 73 62 61 72 0a 23 20  showstatusbar.# 
37c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
37d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
37e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
37f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3800: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f  ------------.pro
3810: 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 73 68 6f  c MainFrame::sho
3820: 77 73 74 61 74 75 73 62 61 72 20 7b 20 70 61 74  wstatusbar { pat
3830: 68 20 6e 61 6d 65 20 7d 20 7b 0a 20 20 20 20 73  h name } {.    s
3840: 65 74 20 73 74 61 74 75 73 20 24 70 61 74 68 2e  et status $path.
3850: 73 74 61 74 75 73 0a 20 20 20 20 69 66 20 7b 20  status.    if { 
3860: 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24 6e  [string equal $n
3870: 61 6d 65 20 22 6e 6f 6e 65 22 5d 20 7d 20 7b 0a  ame "none"] } {.
3880: 20 20 20 20 20 20 20 20 70 61 63 6b 20 66 6f 72          pack for
3890: 67 65 74 20 24 73 74 61 74 75 73 0a 20 20 20 20  get $status.    
38a0: 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20  } else {.       
38b0: 20 70 61 63 6b 20 24 73 74 61 74 75 73 20 2d 66   pack $status -f
38c0: 69 6c 6c 20 78 0a 20 20 20 20 20 20 20 20 73 77  ill x.        sw
38d0: 69 74 63 68 20 2d 2d 20 24 6e 61 6d 65 20 7b 0a  itch -- $name {.
38e0: 20 20 20 20 20 20 20 20 20 20 20 20 73 74 61 74              stat
38f0: 75 73 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20  us {.           
3900: 20 20 20 20 20 63 61 74 63 68 20 7b 70 61 63 6b       catch {pack
3910: 20 66 6f 72 67 65 74 20 24 73 74 61 74 75 73 2e   forget $status.
3920: 70 72 67 7d 0a 20 20 20 20 20 20 20 20 20 20 20  prg}.           
3930: 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 70   }.            p
3940: 72 6f 67 72 65 73 73 69 6f 6e 20 7b 0a 20 20 20  rogression {.   
3950: 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61 63               pac
3960: 6b 20 24 73 74 61 74 75 73 2e 70 72 67 20 2d 69  k $status.prg -i
3970: 6e 20 24 73 74 61 74 75 73 2e 70 72 67 66 0a 20  n $status.prgf. 
3980: 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20             }.   
3990: 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 7d 0a 0a       }.    }.}..
39a0: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
39b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
39c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
39d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
39e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
39f0: 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46  #  Command MainF
3a00: 72 61 6d 65 3a 3a 5f 64 65 73 74 72 6f 79 0a 23  rame::_destroy.#
3a10: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
3a20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3a50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
3a60: 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 64  oc MainFrame::_d
3a70: 65 73 74 72 6f 79 20 7b 20 70 61 74 68 20 7d 20  estroy { path } 
3a80: 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f  {.    variable _
3a90: 77 69 64 67 65 74 0a 0a 20 20 20 20 57 69 64 67  widget..    Widg
3aa0: 65 74 3a 3a 64 65 73 74 72 6f 79 20 24 70 61 74  et::destroy $pat
3ab0: 68 0a 20 20 20 20 63 61 74 63 68 20 7b 64 65 73  h.    catch {des
3ac0: 74 72 6f 79 20 5b 24 5f 77 69 64 67 65 74 28 24  troy [$_widget($
3ad0: 70 61 74 68 2c 74 6f 70 29 20 63 67 65 74 20 2d  path,top) cget -
3ae0: 6d 65 6e 75 5d 7d 0a 20 20 20 20 24 5f 77 69 64  menu]}.    $_wid
3af0: 67 65 74 28 24 70 61 74 68 2c 74 6f 70 29 20 63  get($path,top) c
3b00: 6f 6e 66 69 67 75 72 65 20 2d 6d 65 6e 75 20 7b  onfigure -menu {
3b10: 7d 0a 0a 20 20 20 20 23 20 55 6e 73 65 74 20 61  }..    # Unset a
3b20: 6c 6c 20 6f 66 20 74 68 65 20 73 74 61 74 65 20  ll of the state 
3b30: 76 61 72 73 20 61 73 73 6f 63 69 61 74 65 64 20  vars associated 
3b40: 77 69 74 68 20 74 68 69 73 20 6d 61 69 6e 20 66  with this main f
3b50: 72 61 6d 65 2e 0a 20 20 20 20 66 6f 72 65 61 63  rame..    foreac
3b60: 68 20 69 6e 64 65 78 20 5b 61 72 72 61 79 20 6e  h index [array n
3b70: 61 6d 65 73 20 5f 77 69 64 67 65 74 20 24 70 61  ames _widget $pa
3b80: 74 68 2c 2a 5d 20 7b 0a 09 75 6e 73 65 74 20 5f  th,*] {..unset _
3b90: 77 69 64 67 65 74 28 24 69 6e 64 65 78 29 0a 20  widget($index). 
3ba0: 20 20 20 7d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d     }.}...# -----
3bb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3bc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3bd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3be0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3bf0: 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61  -------.#  Comma
3c00: 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 63  nd MainFrame::_c
3c10: 72 65 61 74 65 5f 6d 65 6e 75 62 61 72 0a 23 20  reate_menubar.# 
3c20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3c30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3c40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3c50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3c60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f  ------------.pro
3c70: 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 63 72  c MainFrame::_cr
3c80: 65 61 74 65 5f 6d 65 6e 75 62 61 72 20 7b 20 70  eate_menubar { p
3c90: 61 74 68 20 64 65 73 63 6d 65 6e 75 20 7d 20 7b  ath descmenu } {
3ca0: 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77  .    variable _w
3cb0: 69 64 67 65 74 0a 20 20 20 20 67 6c 6f 62 61 6c  idget.    global
3cc0: 20 20 20 20 74 63 6c 5f 70 6c 61 74 66 6f 72 6d      tcl_platform
3cd0: 0a 0a 20 20 20 20 73 65 74 20 74 6f 70 20 24 5f  ..    set top $_
3ce0: 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 6f 70  widget($path,top
3cf0: 29 0a 0a 20 20 20 20 66 6f 72 65 61 63 68 20 7b  )..    foreach {
3d00: 76 20 78 7d 20 7b 6d 62 66 6e 74 20 2d 6d 65 6e  v x} {mbfnt -men
3d10: 75 62 61 72 66 6f 6e 74 20 6d 65 66 6e 74 20 2d  ubarfont mefnt -
3d20: 6d 65 6e 75 65 6e 74 72 79 66 6f 6e 74 7d 20 7b  menuentryfont} {
3d30: 0a 09 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65  ..if {[string le
3d40: 6e 67 74 68 20 5b 57 69 64 67 65 74 3a 3a 67 65  ngth [Widget::ge
3d50: 74 6f 70 74 69 6f 6e 20 24 70 61 74 68 20 24 78  toption $path $x
3d60: 5d 5d 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 24  ]]} {..    set $
3d70: 76 20 5b 6c 69 73 74 20 2d 66 6f 6e 74 20 5b 57  v [list -font [W
3d80: 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e  idget::getoption
3d90: 20 24 70 61 74 68 20 24 78 5d 5d 0a 09 7d 20 65   $path $x]]..} e
3da0: 6c 73 65 20 7b 0a 09 20 20 20 20 73 65 74 20 24  lse {..    set $
3db0: 76 20 22 22 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20  v ""..}.    }.. 
3dc0: 20 20 20 69 66 20 7b 24 74 63 6c 5f 70 6c 61 74     if {$tcl_plat
3dd0: 66 6f 72 6d 28 70 6c 61 74 66 6f 72 6d 29 20 3d  form(platform) =
3de0: 3d 20 22 75 6e 69 78 22 7d 20 7b 0a 09 73 65 74  = "unix"} {..set
3df0: 20 6d 65 6e 75 6f 70 74 73 20 5b 6c 69 73 74 20   menuopts [list 
3e00: 2d 62 61 63 6b 67 72 6f 75 6e 64 20 5b 57 69 64  -background [Wid
3e10: 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24  get::getoption $
3e20: 70 61 74 68 20 2d 62 61 63 6b 67 72 6f 75 6e 64  path -background
3e30: 5d 20 5c 0a 09 09 09 20 20 2d 62 6f 72 64 65 72  ] \....  -border
3e40: 77 69 64 74 68 20 31 5d 0a 20 20 20 20 7d 20 65  width 1].    } e
3e50: 6c 73 65 20 7b 0a 09 73 65 74 20 6d 65 6e 75 6f  lse {..set menuo
3e60: 70 74 73 20 5b 6c 69 73 74 5d 0a 20 20 20 20 7d  pts [list].    }
3e70: 0a 20 20 20 20 73 65 74 20 6d 65 6e 75 62 61 72  .    set menubar
3e80: 20 5b 65 76 61 6c 20 5b 6c 69 73 74 20 6d 65 6e   [eval [list men
3e90: 75 20 24 74 6f 70 2e 6d 65 6e 75 62 61 72 20 2d  u $top.menubar -
3ea0: 74 65 61 72 6f 66 66 20 30 5d 20 24 6d 65 6e 75  tearoff 0] $menu
3eb0: 6f 70 74 73 20 24 6d 62 66 6e 74 5d 0a 20 20 20  opts $mbfnt].   
3ec0: 20 24 74 6f 70 20 63 6f 6e 66 69 67 75 72 65 20   $top configure 
3ed0: 2d 6d 65 6e 75 20 24 6d 65 6e 75 62 61 72 0a 0a  -menu $menubar..
3ee0: 20 20 20 20 73 65 74 20 63 6f 75 6e 74 20 30 0a      set count 0.
3ef0: 20 20 20 20 66 6f 72 65 61 63 68 20 7b 6e 61 6d      foreach {nam
3f00: 65 20 74 61 67 73 20 6d 65 6e 75 69 64 20 74 65  e tags menuid te
3f10: 61 72 6f 66 66 20 65 6e 74 72 69 65 73 7d 20 24  aroff entries} $
3f20: 64 65 73 63 6d 65 6e 75 20 7b 0a 20 20 20 20 20  descmenu {.     
3f30: 20 20 20 73 65 74 20 6f 70 74 20 20 5b 5f 70 61     set opt  [_pa
3f40: 72 73 65 5f 6e 61 6d 65 20 24 6e 61 6d 65 5d 0a  rse_name $name].
3f50: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72          if {[str
3f60: 69 6e 67 20 6c 65 6e 67 74 68 20 24 6d 65 6e 75  ing length $menu
3f70: 69 64 5d 0a 09 20 20 20 20 26 26 20 21 5b 69 6e  id]..    && ![in
3f80: 66 6f 20 65 78 69 73 74 73 20 5f 77 69 64 67 65  fo exists _widge
3f90: 74 28 24 70 61 74 68 2c 6d 65 6e 75 69 64 2c 24  t($path,menuid,$
3fa0: 6d 65 6e 75 69 64 29 5d 20 7d 20 7b 0a 20 20 20  menuid)] } {.   
3fb0: 20 20 20 20 20 20 20 20 20 23 20 6d 65 6e 75 20           # menu 
3fc0: 68 61 73 20 69 64 65 6e 74 69 66 69 65 72 0a 09  has identifier..
3fd0: 20 20 20 20 23 20 77 65 20 75 73 65 20 69 74 20      # we use it 
3fe0: 66 6f 72 20 69 74 73 20 70 61 74 68 6e 61 6d 65  for its pathname
3ff0: 2c 20 74 6f 20 65 6e 61 62 6c 65 20 73 70 65 63  , to enable spec
4000: 69 61 6c 20 6d 65 6e 75 20 65 6e 74 72 69 65 73  ial menu entries
4010: 0a 09 20 20 20 20 23 20 28 68 65 6c 70 2c 20 73  ..    # (help, s
4020: 79 73 74 65 6d 2c 20 2e 2e 2e 29 0a 09 20 20 20  ystem, ...)..   
4030: 20 73 65 74 20 6d 65 6e 75 20 24 6d 65 6e 75 62   set menu $menub
4040: 61 72 2e 24 6d 65 6e 75 69 64 0a 20 20 20 20 20  ar.$menuid.     
4050: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20     } else {..   
4060: 20 73 65 74 20 6d 65 6e 75 20 24 6d 65 6e 75 62   set menu $menub
4070: 61 72 2e 6d 65 6e 75 24 63 6f 75 6e 74 0a 09 7d  ar.menu$count..}
4080: 0a 20 20 20 20 20 20 20 20 65 76 61 6c 20 5b 6c  .        eval [l
4090: 69 73 74 20 24 6d 65 6e 75 62 61 72 20 61 64 64  ist $menubar add
40a0: 20 63 61 73 63 61 64 65 5d 20 24 6f 70 74 20 5b   cascade] $opt [
40b0: 6c 69 73 74 20 2d 6d 65 6e 75 20 24 6d 65 6e 75  list -menu $menu
40c0: 5d 0a 20 20 20 20 20 20 20 20 65 76 61 6c 20 5b  ].        eval [
40d0: 6c 69 73 74 20 6d 65 6e 75 20 24 6d 65 6e 75 20  list menu $menu 
40e0: 2d 74 65 61 72 6f 66 66 20 24 74 65 61 72 6f 66  -tearoff $tearof
40f0: 66 5d 20 24 6d 65 6e 75 6f 70 74 73 20 24 6d 65  f] $menuopts $me
4100: 66 6e 74 0a 20 20 20 20 20 20 20 20 66 6f 72 65  fnt.        fore
4110: 61 63 68 20 74 61 67 20 24 74 61 67 73 20 7b 0a  ach tag $tags {.
4120: 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 70 70              lapp
4130: 65 6e 64 20 5f 77 69 64 67 65 74 28 24 70 61 74  end _widget($pat
4140: 68 2c 74 61 67 73 2c 24 74 61 67 29 20 24 6d 65  h,tags,$tag) $me
4150: 6e 75 62 61 72 20 24 63 6f 75 6e 74 0a 09 20 20  nubar $count..  
4160: 20 20 23 20 65 72 69 63 6d 40 73 63 72 69 70 74    # [email protected]
4170: 69 63 73 3a 20 20 41 64 64 20 61 20 74 61 67 73  ics:  Add a tags
4180: 74 61 74 65 20 74 72 61 63 6b 65 72 0a 09 20 20  tate tracker..  
4190: 20 20 69 66 20 7b 20 21 5b 69 6e 66 6f 20 65 78    if { ![info ex
41a0: 69 73 74 73 20 5f 77 69 64 67 65 74 28 24 70 61  ists _widget($pa
41b0: 74 68 2c 74 61 67 73 74 61 74 65 2c 24 74 61 67  th,tagstate,$tag
41c0: 29 5d 20 7d 20 7b 0a 09 09 73 65 74 20 5f 77 69  )] } {...set _wi
41d0: 64 67 65 74 28 24 70 61 74 68 2c 74 61 67 73 74  dget($path,tagst
41e0: 61 74 65 2c 24 74 61 67 29 20 31 0a 09 20 20 20  ate,$tag) 1..   
41f0: 20 7d 0a 20 20 20 20 20 20 20 20 7d 0a 09 23 20   }.        }..# 
4200: 65 72 69 63 6d 40 73 63 72 69 70 74 69 63 73 3a  [email protected]:
4210: 20 20 41 64 64 20 6d 61 70 70 69 6e 67 20 66 72    Add mapping fr
4220: 6f 6d 20 6d 65 6e 75 20 69 74 65 6d 73 20 74 6f  om menu items to
4230: 20 74 61 67 73 0a 09 73 65 74 20 5f 77 69 64 67   tags..set _widg
4240: 65 74 28 24 70 61 74 68 2c 6d 65 6e 75 74 61 67  et($path,menutag
4250: 73 2c 5b 6c 69 73 74 20 24 6d 65 6e 75 62 61 72  s,[list $menubar
4260: 20 24 63 6f 75 6e 74 5d 29 20 24 74 61 67 73 0a   $count]) $tags.
4270: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20 5b 73  .        if { [s
4280: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6d 65  tring length $me
4290: 6e 75 69 64 5d 20 7d 20 7b 0a 20 20 20 20 20 20  nuid] } {.      
42a0: 20 20 20 20 20 20 23 20 6d 65 6e 75 20 68 61 73        # menu has
42b0: 20 69 64 65 6e 74 69 66 69 65 72 0a 20 20 20 20   identifier.    
42c0: 20 20 20 20 20 20 20 20 73 65 74 20 5f 77 69 64          set _wid
42d0: 67 65 74 28 24 70 61 74 68 2c 6d 65 6e 75 69 64  get($path,menuid
42e0: 2c 24 6d 65 6e 75 69 64 29 20 24 6d 65 6e 75 0a  ,$menuid) $menu.
42f0: 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20          }.      
4300: 20 20 5f 63 72 65 61 74 65 5f 65 6e 74 72 69 65    _create_entrie
4310: 73 20 24 70 61 74 68 20 24 6d 65 6e 75 20 24 6d  s $path $menu $m
4320: 65 6e 75 6f 70 74 73 20 24 65 6e 74 72 69 65 73  enuopts $entries
4330: 0a 20 20 20 20 20 20 20 20 69 6e 63 72 20 63 6f  .        incr co
4340: 75 6e 74 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23 20  unt.    }.}...# 
4350: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4360: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4370: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4380: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4390: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
43a0: 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d  Command MainFram
43b0: 65 3a 3a 5f 63 72 65 61 74 65 5f 65 6e 74 72 69  e::_create_entri
43c0: 65 73 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  es.# -----------
43d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
43e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
43f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4400: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4410: 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65  -.proc MainFrame
4420: 3a 3a 5f 63 72 65 61 74 65 5f 65 6e 74 72 69 65  ::_create_entrie
4430: 73 20 7b 20 70 61 74 68 20 6d 65 6e 75 20 6d 65  s { path menu me
4440: 6e 75 6f 70 74 73 20 65 6e 74 72 69 65 73 20 7d  nuopts entries }
4450: 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20   {.    variable 
4460: 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 73 65 74  _widget..    set
4470: 20 63 6f 75 6e 74 20 20 20 20 20 20 5b 24 6d 65   count      [$me
4480: 6e 75 20 63 67 65 74 20 2d 74 65 61 72 6f 66 66  nu cget -tearoff
4490: 5d 0a 20 20 20 20 73 65 74 20 72 65 67 69 73 74  ].    set regist
44a0: 65 72 65 64 20 30 0a 20 20 20 20 66 6f 72 65 61  ered 0.    forea
44b0: 63 68 20 65 6e 74 72 79 20 24 65 6e 74 72 69 65  ch entry $entrie
44c0: 73 20 7b 0a 20 20 20 20 20 20 20 20 73 65 74 20  s {.        set 
44d0: 6c 65 6e 20 20 5b 6c 6c 65 6e 67 74 68 20 24 65  len  [llength $e
44e0: 6e 74 72 79 5d 0a 20 20 20 20 20 20 20 20 73 65  ntry].        se
44f0: 74 20 74 79 70 65 20 5b 6c 69 6e 64 65 78 20 24  t type [lindex $
4500: 65 6e 74 72 79 20 30 5d 0a 0a 20 20 20 20 20 20  entry 0]..      
4510: 20 20 69 66 20 7b 20 5b 73 74 72 69 6e 67 20 65    if { [string e
4520: 71 75 61 6c 20 24 74 79 70 65 20 22 73 65 70 61  qual $type "sepa
4530: 72 61 74 6f 72 22 5d 20 7d 20 7b 0a 20 20 20 20  rator"] } {.    
4540: 20 20 20 20 20 20 20 20 24 6d 65 6e 75 20 61 64          $menu ad
4550: 64 20 73 65 70 61 72 61 74 6f 72 0a 20 20 20 20  d separator.    
4560: 20 20 20 20 20 20 20 20 69 6e 63 72 20 63 6f 75          incr cou
4570: 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 63  nt.            c
4580: 6f 6e 74 69 6e 75 65 0a 20 20 20 20 20 20 20 20  ontinue.        
4590: 7d 0a 0a 20 20 20 20 20 20 20 20 23 20 65 6e 74  }..        # ent
45a0: 72 79 20 6e 61 6d 65 20 61 6e 64 20 74 61 67 73  ry name and tags
45b0: 0a 20 20 20 20 20 20 20 20 73 65 74 20 6f 70 74  .        set opt
45c0: 20 20 5b 5f 70 61 72 73 65 5f 6e 61 6d 65 20 5b    [_parse_name [
45d0: 6c 69 6e 64 65 78 20 24 65 6e 74 72 79 20 31 5d  lindex $entry 1]
45e0: 5d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 61  ].        set ta
45f0: 67 73 20 5b 6c 69 6e 64 65 78 20 24 65 6e 74 72  gs [lindex $entr
4600: 79 20 32 5d 0a 20 20 20 20 20 20 20 20 66 6f 72  y 2].        for
4610: 65 61 63 68 20 74 61 67 20 24 74 61 67 73 20 7b  each tag $tags {
4620: 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 70  .            lap
4630: 70 65 6e 64 20 5f 77 69 64 67 65 74 28 24 70 61  pend _widget($pa
4640: 74 68 2c 74 61 67 73 2c 24 74 61 67 29 20 24 6d  th,tags,$tag) $m
4650: 65 6e 75 20 24 63 6f 75 6e 74 0a 09 20 20 20 20  enu $count..    
4660: 23 20 65 72 69 63 6d 40 73 63 72 69 70 74 69 63  # [email protected]
4670: 73 3a 20 20 41 64 64 20 61 20 74 61 67 73 74 61  s:  Add a tagsta
4680: 74 65 20 74 72 61 63 6b 65 72 0a 09 20 20 20 20  te tracker..    
4690: 69 66 20 7b 20 21 5b 69 6e 66 6f 20 65 78 69 73  if { ![info exis
46a0: 74 73 20 5f 77 69 64 67 65 74 28 24 70 61 74 68  ts _widget($path
46b0: 2c 74 61 67 73 74 61 74 65 2c 24 74 61 67 29 5d  ,tagstate,$tag)]
46c0: 20 7d 20 7b 0a 09 09 73 65 74 20 5f 77 69 64 67   } {...set _widg
46d0: 65 74 28 24 70 61 74 68 2c 74 61 67 73 74 61 74  et($path,tagstat
46e0: 65 2c 24 74 61 67 29 20 31 0a 09 20 20 20 20 7d  e,$tag) 1..    }
46f0: 0a 20 20 20 20 20 20 20 20 7d 0a 09 23 20 65 72  .        }..# er
4700: 69 63 6d 40 73 63 72 69 70 74 69 63 73 3a 20 20  [email protected]:  
4710: 41 64 64 20 6d 61 70 70 69 6e 67 20 66 72 6f 6d  Add mapping from
4720: 20 6d 65 6e 75 20 69 74 65 6d 73 20 74 6f 20 74   menu items to t
4730: 61 67 73 0a 09 73 65 74 20 5f 77 69 64 67 65 74  ags..set _widget
4740: 28 24 70 61 74 68 2c 6d 65 6e 75 74 61 67 73 2c  ($path,menutags,
4750: 5b 6c 69 73 74 20 24 6d 65 6e 75 20 24 63 6f 75  [list $menu $cou
4760: 6e 74 5d 29 20 24 74 61 67 73 0a 0a 20 20 20 20  nt]) $tags..    
4770: 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20      if {[string 
4780: 65 71 75 61 6c 20 24 74 79 70 65 20 22 63 61 73  equal $type "cas
4790: 63 61 64 65 22 5d 20 7c 7c 20 5b 73 74 72 69 6e  cade"] || [strin
47a0: 67 20 65 71 75 61 6c 20 24 74 79 70 65 20 22 63  g equal $type "c
47b0: 61 73 63 61 64 22 5d 7d 20 7b 0a 20 20 20 20 20  ascad"]} {.     
47c0: 20 20 20 20 20 20 20 73 65 74 20 6d 65 6e 75 69         set menui
47d0: 64 20 20 5b 6c 69 6e 64 65 78 20 24 65 6e 74 72  d  [lindex $entr
47e0: 79 20 33 5d 0a 20 20 20 20 20 20 20 20 20 20 20  y 3].           
47f0: 20 73 65 74 20 74 65 61 72 6f 66 66 20 5b 6c 69   set tearoff [li
4800: 6e 64 65 78 20 24 65 6e 74 72 79 20 34 5d 0a 20  ndex $entry 4]. 
4810: 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73             set s
4820: 75 62 6d 65 6e 75 20 24 6d 65 6e 75 2e 6d 65 6e  ubmenu $menu.men
4830: 75 24 63 6f 75 6e 74 0a 20 20 20 20 20 20 20 20  u$count.        
4840: 20 20 20 20 65 76 61 6c 20 5b 6c 69 73 74 20 24      eval [list $
4850: 6d 65 6e 75 20 61 64 64 20 63 61 73 63 61 64 65  menu add cascade
4860: 5d 20 24 6f 70 74 20 5b 6c 69 73 74 20 2d 6d 65  ] $opt [list -me
4870: 6e 75 20 24 73 75 62 6d 65 6e 75 5d 0a 20 20 20  nu $submenu].   
4880: 20 20 20 20 20 20 20 20 20 65 76 61 6c 20 5b 6c           eval [l
4890: 69 73 74 20 6d 65 6e 75 20 24 73 75 62 6d 65 6e  ist menu $submen
48a0: 75 20 2d 74 65 61 72 6f 66 66 20 24 74 65 61 72  u -tearoff $tear
48b0: 6f 66 66 5d 20 24 6d 65 6e 75 6f 70 74 73 0a 20  off] $menuopts. 
48c0: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 20             if { 
48d0: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24  [string length $
48e0: 6d 65 6e 75 69 64 5d 20 7d 20 7b 0a 20 20 20 20  menuid] } {.    
48f0: 20 20 20 20 20 20 20 20 20 20 20 20 23 20 6d 65              # me
4900: 6e 75 20 68 61 73 20 69 64 65 6e 74 69 66 69 65  nu has identifie
4910: 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  r.              
4920: 20 20 73 65 74 20 5f 77 69 64 67 65 74 28 24 70    set _widget($p
4930: 61 74 68 2c 6d 65 6e 75 69 64 2c 24 6d 65 6e 75  ath,menuid,$menu
4940: 69 64 29 20 24 73 75 62 6d 65 6e 75 0a 20 20 20  id) $submenu.   
4950: 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20           }.     
4960: 20 20 20 20 20 20 20 5f 63 72 65 61 74 65 5f 65         _create_e
4970: 6e 74 72 69 65 73 20 24 70 61 74 68 20 24 73 75  ntries $path $su
4980: 62 6d 65 6e 75 20 24 6d 65 6e 75 6f 70 74 73 20  bmenu $menuopts 
4990: 5b 6c 69 6e 64 65 78 20 24 65 6e 74 72 79 20 35  [lindex $entry 5
49a0: 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 6e  ].            in
49b0: 63 72 20 63 6f 75 6e 74 0a 20 20 20 20 20 20 20  cr count.       
49c0: 20 20 20 20 20 63 6f 6e 74 69 6e 75 65 0a 20 20       continue.  
49d0: 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 20        }..       
49e0: 20 23 20 65 6e 74 72 79 20 68 65 6c 70 20 64 65   # entry help de
49f0: 73 63 72 69 70 74 69 6f 6e 0a 20 20 20 20 20 20  scription.      
4a00: 20 20 73 65 74 20 64 65 73 63 20 5b 6c 69 6e 64    set desc [lind
4a10: 65 78 20 24 65 6e 74 72 79 20 33 5d 0a 20 20 20  ex $entry 3].   
4a20: 20 20 20 20 20 69 66 20 7b 20 5b 73 74 72 69 6e       if { [strin
4a30: 67 20 6c 65 6e 67 74 68 20 24 64 65 73 63 5d 20  g length $desc] 
4a40: 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20  } {.            
4a50: 69 66 20 7b 20 21 24 72 65 67 69 73 74 65 72 65  if { !$registere
4a60: 64 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20  d } {.          
4a70: 20 20 20 20 20 20 44 79 6e 61 6d 69 63 48 65 6c        DynamicHel
4a80: 70 3a 3a 72 65 67 69 73 74 65 72 20 24 6d 65 6e  p::register $men
4a90: 75 20 6d 65 6e 75 20 5b 57 69 64 67 65 74 3a 3a  u menu [Widget::
4aa0: 67 65 74 6f 70 74 69 6f 6e 20 24 70 61 74 68 20  getoption $path 
4ab0: 2d 74 65 78 74 76 61 72 69 61 62 6c 65 5d 0a 20  -textvariable]. 
4ac0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73                 s
4ad0: 65 74 20 72 65 67 69 73 74 65 72 65 64 20 31 0a  et registered 1.
4ae0: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20              }.  
4af0: 20 20 20 20 20 20 20 20 20 20 44 79 6e 61 6d 69            Dynami
4b00: 63 48 65 6c 70 3a 3a 72 65 67 69 73 74 65 72 20  cHelp::register 
4b10: 24 6d 65 6e 75 20 6d 65 6e 75 65 6e 74 72 79 20  $menu menuentry 
4b20: 24 63 6f 75 6e 74 20 24 64 65 73 63 0a 20 20 20  $count $desc.   
4b30: 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 20 20       }..        
4b40: 23 20 65 6e 74 72 79 20 61 63 63 65 6c 65 72 61  # entry accelera
4b50: 74 6f 72 0a 20 20 20 20 20 20 20 20 73 65 74 20  tor.        set 
4b60: 61 63 63 65 6c 20 5b 5f 70 61 72 73 65 5f 61 63  accel [_parse_ac
4b70: 63 65 6c 65 72 61 74 6f 72 20 5b 6c 69 6e 64 65  celerator [linde
4b80: 78 20 24 65 6e 74 72 79 20 34 5d 5d 0a 20 20 20  x $entry 4]].   
4b90: 20 20 20 20 20 69 66 20 7b 20 5b 6c 6c 65 6e 67       if { [lleng
4ba0: 74 68 20 24 61 63 63 65 6c 5d 20 7d 20 7b 0a 20  th $accel] } {. 
4bb0: 20 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 65             lappe
4bc0: 6e 64 20 6f 70 74 20 2d 61 63 63 65 6c 65 72 61  nd opt -accelera
4bd0: 74 6f 72 20 5b 6c 69 6e 64 65 78 20 24 61 63 63  tor [lindex $acc
4be0: 65 6c 20 30 5d 0a 20 20 20 20 20 20 20 20 20 20  el 0].          
4bf0: 20 20 62 69 6e 64 20 24 5f 77 69 64 67 65 74 28    bind $_widget(
4c00: 24 70 61 74 68 2c 74 6f 70 29 20 5b 6c 69 6e 64  $path,top) [lind
4c10: 65 78 20 24 61 63 63 65 6c 20 31 5d 20 5b 6c 69  ex $accel 1] [li
4c20: 73 74 20 24 6d 65 6e 75 20 69 6e 76 6f 6b 65 20  st $menu invoke 
4c30: 24 63 6f 75 6e 74 5d 0a 20 20 20 20 20 20 20 20  $count].        
4c40: 7d 0a 0a 20 20 20 20 20 20 20 20 23 20 75 73 65  }..        # use
4c50: 72 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 20 20  r options.      
4c60: 20 20 73 65 74 20 75 73 65 72 6f 70 74 20 5b 6c    set useropt [l
4c70: 72 61 6e 67 65 20 24 65 6e 74 72 79 20 35 20 65  range $entry 5 e
4c80: 6e 64 5d 0a 20 20 20 20 20 20 20 20 69 66 20 7b  nd].        if {
4c90: 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24   [string equal $
4ca0: 74 79 70 65 20 22 63 6f 6d 6d 61 6e 64 22 5d 20  type "command"] 
4cb0: 7c 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  ||.             
4cc0: 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24 74  [string equal $t
4cd0: 79 70 65 20 22 72 61 64 69 6f 62 75 74 74 6f 6e  ype "radiobutton
4ce0: 22 5d 20 7c 7c 0a 20 20 20 20 20 20 20 20 20 20  "] ||.          
4cf0: 20 20 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c     [string equal
4d00: 20 24 74 79 70 65 20 22 63 68 65 63 6b 62 75 74   $type "checkbut
4d10: 74 6f 6e 22 5d 20 7d 20 7b 0a 20 20 20 20 20 20  ton"] } {.      
4d20: 20 20 20 20 20 20 65 76 61 6c 20 5b 6c 69 73 74        eval [list
4d30: 20 24 6d 65 6e 75 20 61 64 64 20 24 74 79 70 65   $menu add $type
4d40: 5d 20 24 6f 70 74 20 24 75 73 65 72 6f 70 74 0a  ] $opt $useropt.
4d50: 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b          } else {
4d60: 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74  .            ret
4d70: 75 72 6e 20 2d 63 6f 64 65 20 65 72 72 6f 72 20  urn -code error 
4d80: 22 69 6e 76 61 6c 69 64 20 6d 65 6e 75 20 74 79  "invalid menu ty
4d90: 70 65 20 5c 22 24 74 79 70 65 5c 22 22 0a 20 20  pe \"$type\"".  
4da0: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20        }.        
4db0: 69 6e 63 72 20 63 6f 75 6e 74 0a 20 20 20 20 7d  incr count.    }
4dc0: 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  .}...# ---------
4dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4de0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4df0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e10: 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d  ---.#  Command M
4e20: 61 69 6e 46 72 61 6d 65 3a 3a 5f 70 61 72 73 65  ainFrame::_parse
4e30: 5f 6e 61 6d 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  _name.# --------
4e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e80: 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72  ----.proc MainFr
4e90: 61 6d 65 3a 3a 5f 70 61 72 73 65 5f 6e 61 6d 65  ame::_parse_name
4ea0: 20 7b 20 6d 65 6e 75 6e 61 6d 65 20 7d 20 7b 0a   { menuname } {.
4eb0: 20 20 20 20 73 65 74 20 69 64 78 20 5b 73 74 72      set idx [str
4ec0: 69 6e 67 20 66 69 72 73 74 20 22 26 22 20 24 6d  ing first "&" $m
4ed0: 65 6e 75 6e 61 6d 65 5d 0a 20 20 20 20 69 66 20  enuname].    if 
4ee0: 7b 20 24 69 64 78 20 3d 3d 20 2d 31 20 7d 20 7b  { $idx == -1 } {
4ef0: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20  .        return 
4f00: 5b 6c 69 73 74 20 2d 6c 61 62 65 6c 20 24 6d 65  [list -label $me
4f10: 6e 75 6e 61 6d 65 5d 0a 20 20 20 20 7d 20 65 6c  nuname].    } el
4f20: 73 65 20 7b 0a 20 20 20 20 20 20 20 20 73 65 74  se {.        set
4f30: 20 62 65 67 20 5b 73 74 72 69 6e 67 20 72 61 6e   beg [string ran
4f40: 67 65 20 24 6d 65 6e 75 6e 61 6d 65 20 30 20 5b  ge $menuname 0 [
4f50: 65 78 70 72 20 7b 24 69 64 78 2d 31 7d 5d 5d 0a  expr {$idx-1}]].
4f60: 20 20 20 20 20 20 20 20 73 65 74 20 65 6e 64 20          set end 
4f70: 5b 73 74 72 69 6e 67 20 72 61 6e 67 65 20 24 6d  [string range $m
4f80: 65 6e 75 6e 61 6d 65 20 5b 65 78 70 72 20 7b 24  enuname [expr {$
4f90: 69 64 78 2b 31 7d 5d 20 65 6e 64 5d 0a 20 20 20  idx+1}] end].   
4fa0: 20 20 20 20 20 61 70 70 65 6e 64 20 62 65 67 20       append beg 
4fb0: 24 65 6e 64 0a 20 20 20 20 20 20 20 20 72 65 74  $end.        ret
4fc0: 75 72 6e 20 5b 6c 69 73 74 20 2d 6c 61 62 65 6c  urn [list -label
4fd0: 20 24 62 65 67 20 2d 75 6e 64 65 72 6c 69 6e 65   $beg -underline
4fe0: 20 24 69 64 78 5d 0a 20 20 20 20 7d 0a 7d 0a 0a   $idx].    }.}..
4ff0: 0a 23 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 70  .# MainFrame::_p
5000: 61 72 73 65 5f 61 63 63 65 6c 65 72 61 74 6f 72  arse_accelerator
5010: 20 2d 2d 0a 23 0a 23 09 47 69 76 65 6e 20 61 20   --.#.#.Given a 
5020: 6b 65 79 20 63 6f 6d 62 6f 20 64 65 73 63 72 69  key combo descri
5030: 70 74 69 6f 6e 2c 20 63 6f 6e 73 74 72 75 63 74  ption, construct
5040: 20 61 6e 20 61 70 70 72 6f 70 72 69 61 74 65 20   an appropriate 
5050: 68 75 6d 61 6e 20 72 65 61 64 61 62 6c 65 0a 23  human readable.#
5060: 09 73 74 72 69 6e 67 20 28 66 6f 72 20 64 69 73  .string (for dis
5070: 70 6c 61 79 20 6f 6e 20 61 73 20 61 20 6d 65 6e  play on as a men
5080: 75 20 61 63 63 65 6c 65 72 61 74 6f 72 29 20 61  u accelerator) a
5090: 6e 64 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e  nd the correspon
50a0: 64 69 6e 67 0a 23 09 62 69 6e 64 20 65 76 65 6e  ding.#.bind even
50b0: 74 2e 0a 23 0a 23 20 41 72 67 75 6d 65 6e 74 73  t..#.# Arguments
50c0: 3a 0a 23 09 64 65 73 63 09 61 20 6c 69 73 74 20  :.#.desc.a list 
50d0: 77 69 74 68 20 74 68 65 20 66 6f 6c 6c 6f 77 69  with the followi
50e0: 6e 67 20 66 6f 72 6d 61 74 3a 0a 23 09 09 09 3f  ng format:.#...?
50f0: 73 65 71 75 65 6e 63 65 3f 20 6b 65 79 0a 23 09  sequence? key.#.
5100: 09 73 65 71 75 65 6e 63 65 20 6d 61 79 20 62 65  .sequence may be
5110: 20 4e 6f 6e 65 2c 20 43 74 72 6c 2c 20 41 6c 74   None, Ctrl, Alt
5120: 2c 20 6f 72 20 43 74 72 6c 41 6c 74 0a 23 09 09  , or CtrlAlt.#..
5130: 6b 65 79 20 6d 61 79 20 62 65 20 61 6e 79 20 6b  key may be any k
5140: 65 79 0a 23 0a 23 20 52 65 73 75 6c 74 73 3a 0a  ey.#.# Results:.
5150: 23 09 7b 61 63 63 65 6c 20 65 76 65 6e 74 7d 09  #.{accel event}.
5160: 61 20 6c 69 73 74 20 63 6f 6e 74 61 69 6e 69 6e  a list containin
5170: 67 20 74 68 65 20 61 63 63 65 6c 65 72 61 74 6f  g the accelerato
5180: 72 20 73 74 72 69 6e 67 20 61 6e 64 20 74 68 65  r string and the
5190: 20 65 76 65 6e 74 0a 0a 70 72 6f 63 20 4d 61 69   event..proc Mai
51a0: 6e 46 72 61 6d 65 3a 3a 5f 70 61 72 73 65 5f 61  nFrame::_parse_a
51b0: 63 63 65 6c 65 72 61 74 6f 72 20 7b 20 64 65 73  ccelerator { des
51c0: 63 20 7d 20 7b 0a 20 20 20 20 69 66 20 7b 20 5b  c } {.    if { [
51d0: 6c 6c 65 6e 67 74 68 20 24 64 65 73 63 5d 20 3d  llength $desc] =
51e0: 3d 20 31 20 7d 20 7b 0a 09 73 65 74 20 73 65 71  = 1 } {..set seq
51f0: 20 4e 6f 6e 65 0a 09 73 65 74 20 6b 65 79 20 5b   None..set key [
5200: 73 74 72 69 6e 67 20 74 6f 6c 6f 77 65 72 20 5b  string tolower [
5210: 6c 69 6e 64 65 78 20 24 64 65 73 63 20 30 5d 5d  lindex $desc 0]]
5220: 0a 09 23 20 49 66 20 74 68 65 20 6b 65 79 20 69  ..# If the key i
5230: 73 20 61 6e 20 46 20 6b 65 79 20 28 69 65 2c 20  s an F key (ie, 
5240: 46 31 2c 20 46 32 2c 20 65 74 63 29 2c 20 69 74  F1, F2, etc), it
5250: 20 68 61 73 20 74 6f 20 62 65 20 63 61 70 69 74   has to be capit
5260: 61 6c 69 7a 65 64 0a 09 69 66 20 7b 5b 72 65 67  alized..if {[reg
5270: 65 78 70 20 7b 5e 66 28 5b 31 2d 39 5d 7c 28 5b  exp {^f([1-9]|([
5280: 31 32 5d 5b 30 2d 39 5d 7c 33 5b 30 2d 35 5d 29  12][0-9]|3[0-5])
5290: 29 24 7d 20 24 6b 65 79 5d 7d 20 7b 0a 09 20 20  )$} $key]} {..  
52a0: 20 20 73 65 74 20 6b 65 79 20 5b 73 74 72 69 6e    set key [strin
52b0: 67 20 74 6f 75 70 70 65 72 20 24 6b 65 79 5d 0a  g toupper $key].
52c0: 09 7d 0a 20 20 20 20 7d 20 65 6c 73 65 69 66 20  .}.    } elseif 
52d0: 7b 20 5b 6c 6c 65 6e 67 74 68 20 24 64 65 73 63  { [llength $desc
52e0: 5d 20 3d 3d 20 32 20 7d 20 7b 0a 20 20 20 20 20  ] == 2 } {.     
52f0: 20 20 20 73 65 74 20 73 65 71 20 5b 6c 69 6e 64     set seq [lind
5300: 65 78 20 24 64 65 73 63 20 30 5d 0a 20 20 20 20  ex $desc 0].    
5310: 20 20 20 20 73 65 74 20 6b 65 79 20 5b 73 74 72      set key [str
5320: 69 6e 67 20 74 6f 6c 6f 77 65 72 20 5b 6c 69 6e  ing tolower [lin
5330: 64 65 78 20 24 64 65 73 63 20 31 5d 5d 0a 09 23  dex $desc 1]]..#
5340: 20 49 66 20 74 68 65 20 6b 65 79 20 69 73 20 61   If the key is a
5350: 6e 20 46 20 6b 65 79 20 28 69 65 2c 20 46 31 2c  n F key (ie, F1,
5360: 20 46 32 2c 20 65 74 63 29 2c 20 69 74 20 68 61   F2, etc), it ha
5370: 73 20 74 6f 20 62 65 20 63 61 70 69 74 61 6c 69  s to be capitali
5380: 7a 65 64 0a 09 69 66 20 7b 5b 72 65 67 65 78 70  zed..if {[regexp
5390: 20 7b 5e 66 28 5b 31 2d 39 5d 7c 28 5b 31 32 5d   {^f([1-9]|([12]
53a0: 5b 30 2d 39 5d 7c 33 5b 30 2d 35 5d 29 29 24 7d  [0-9]|3[0-5]))$}
53b0: 20 24 6b 65 79 5d 7d 20 7b 0a 09 20 20 20 20 73   $key]} {..    s
53c0: 65 74 20 6b 65 79 20 5b 73 74 72 69 6e 67 20 74  et key [string t
53d0: 6f 75 70 70 65 72 20 24 6b 65 79 5d 0a 09 7d 0a  oupper $key]..}.
53e0: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 72 65      } else {..re
53f0: 74 75 72 6e 20 7b 7d 0a 20 20 20 20 7d 0a 20 20  turn {}.    }.  
5400: 20 20 73 77 69 74 63 68 20 2d 2d 20 24 73 65 71    switch -- $seq
5410: 20 7b 0a 09 4e 6f 6e 65 20 7b 0a 09 20 20 20 20   {..None {..    
5420: 73 65 74 20 61 63 63 65 6c 20 22 5b 73 74 72 69  set accel "[stri
5430: 6e 67 20 74 6f 75 70 70 65 72 20 24 6b 65 79 5d  ng toupper $key]
5440: 22 0a 09 20 20 20 20 73 65 74 20 65 76 65 6e 74  "..    set event
5450: 20 22 3c 4b 65 79 2d 24 6b 65 79 3e 22 0a 09 7d   "<Key-$key>"..}
5460: 0a 09 43 74 72 6c 20 7b 0a 09 20 20 20 20 73 65  ..Ctrl {..    se
5470: 74 20 61 63 63 65 6c 20 22 43 74 72 6c 2b 5b 73  t accel "Ctrl+[s
5480: 74 72 69 6e 67 20 74 6f 75 70 70 65 72 20 24 6b  tring toupper $k
5490: 65 79 5d 22 0a 09 20 20 20 20 73 65 74 20 65 76  ey]"..    set ev
54a0: 65 6e 74 20 22 3c 43 6f 6e 74 72 6f 6c 2d 4b 65  ent "<Control-Ke
54b0: 79 2d 24 6b 65 79 3e 22 0a 09 7d 0a 09 41 6c 74  y-$key>"..}..Alt
54c0: 20 7b 0a 09 20 20 20 20 73 65 74 20 61 63 63 65   {..    set acce
54d0: 6c 20 22 41 6c 74 2b 5b 73 74 72 69 6e 67 20 74  l "Alt+[string t
54e0: 6f 75 70 70 65 72 20 24 6b 65 79 5d 22 0a 09 20  oupper $key]".. 
54f0: 20 20 20 73 65 74 20 65 76 65 6e 74 20 22 3c 41     set event "<A
5500: 6c 74 2d 4b 65 79 2d 24 6b 65 79 3e 22 0a 09 7d  lt-Key-$key>"..}
5510: 0a 09 43 74 72 6c 41 6c 74 20 7b 0a 09 20 20 20  ..CtrlAlt {..   
5520: 20 73 65 74 20 61 63 63 65 6c 20 22 43 74 72 6c   set accel "Ctrl
5530: 2b 41 6c 74 2b 5b 73 74 72 69 6e 67 20 74 6f 75  +Alt+[string tou
5540: 70 70 65 72 20 24 6b 65 79 5d 22 0a 09 20 20 20  pper $key]"..   
5550: 20 73 65 74 20 65 76 65 6e 74 20 22 3c 43 6f 6e   set event "<Con
5560: 74 72 6f 6c 2d 41 6c 74 2d 4b 65 79 2d 24 6b 65  trol-Alt-Key-$ke
5570: 79 3e 22 0a 09 7d 0a 09 64 65 66 61 75 6c 74 20  y>"..}..default 
5580: 7b 0a 09 20 20 20 20 72 65 74 75 72 6e 20 2d 63  {..    return -c
5590: 6f 64 65 20 65 72 72 6f 72 20 22 69 6e 76 61 6c  ode error "inval
55a0: 69 64 20 61 63 63 65 6c 65 72 61 74 6f 72 20 63  id accelerator c
55b0: 6f 64 65 20 24 73 65 71 22 0a 09 7d 0a 20 20 20  ode $seq"..}.   
55c0: 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 5b 6c   }.    return [l
55d0: 69 73 74 20 24 61 63 63 65 6c 20 24 65 76 65 6e  ist $accel $even
55e0: 74 5d 0a 7d 0a                                   t].}.