Bwidget Source Code
Hex Artifact Content
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.

Artifact 938be10bcd19f81cd88e6c26d58b785aea9e6c15:


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 32 37 20 32 30 31 30  .tcl,v 1.27 2010
00b0: 2f 31 31 2f 30 39 20 31 36 3a 30 34 3a 34 35 20  /11/09 16:04:45 
00c0: 6f 65 68 68 61 72 20 45 78 70 20 24 0a 23 20 2d  oehhar Exp $.# -
00d0: 2d 2d 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 0a 23 20  -------------.# 
0120: 20 49 6e 64 65 78 20 6f 66 20 63 6f 6d 6d 61 6e   Index of comman
0130: 64 73 3a 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e  ds:.#     - Main
0140: 46 72 61 6d 65 3a 3a 63 72 65 61 74 65 0a 23 20  Frame::create.# 
0150: 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a      - MainFrame:
0160: 3a 63 6f 6e 66 69 67 75 72 65 0a 23 20 20 20 20  :configure.#    
0170: 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 63 67   - MainFrame::cg
0180: 65 74 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46  et.#     - MainF
0190: 72 61 6d 65 3a 3a 67 65 74 66 72 61 6d 65 0a 23  rame::getframe.#
01a0: 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65       - MainFrame
01b0: 3a 3a 61 64 64 74 6f 6f 6c 62 61 72 0a 23 20 20  ::addtoolbar.#  
01c0: 20 20 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a     - MainFrame::
01d0: 67 65 74 74 6f 6f 6c 62 61 72 0a 23 20 20 20 20  gettoolbar.#    
01e0: 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 61 64   - MainFrame::ad
01f0: 64 69 6e 64 69 63 61 74 6f 72 0a 23 20 20 20 20  dindicator.#    
0200: 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65   - MainFrame::ge
0210: 74 69 6e 64 69 63 61 74 6f 72 0a 23 20 20 20 20  tindicator.#    
0220: 20 2d 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65   - MainFrame::ge
0230: 74 6d 65 6e 75 0a 23 20 20 20 20 20 2d 20 4d 61  tmenu.#     - Ma
0240: 69 6e 46 72 61 6d 65 3a 3a 6d 65 6e 75 6f 6e 6c  inFrame::menuonl
0250: 79 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72  y.#     - MainFr
0260: 61 6d 65 3a 3a 73 68 6f 77 74 6f 6f 6c 62 61 72  ame::showtoolbar
0270: 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72 61  .#     - MainFra
0280: 6d 65 3a 3a 73 68 6f 77 73 74 61 74 75 73 62 61  me::showstatusba
0290: 72 0a 23 20 20 20 20 20 2d 20 4d 61 69 6e 46 72  r.#     - MainFr
02a0: 61 6d 65 3a 3a 5f 63 72 65 61 74 65 5f 6d 65 6e  ame::_create_men
02b0: 75 62 61 72 0a 23 20 20 20 20 20 2d 20 4d 61 69  ubar.#     - Mai
02c0: 6e 46 72 61 6d 65 3a 3a 5f 63 72 65 61 74 65 5f  nFrame::_create_
02d0: 65 6e 74 72 69 65 73 0a 23 20 20 20 20 20 2d 20  entries.#     - 
02e0: 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 70 61 72 73  MainFrame::_pars
02f0: 65 5f 6e 61 6d 65 0a 23 20 20 20 20 20 2d 20 4d  e_name.#     - M
0300: 61 69 6e 46 72 61 6d 65 3a 3a 5f 70 61 72 73 65  ainFrame::_parse
0310: 5f 61 63 63 65 6c 65 72 61 74 6f 72 0a 23 20 2d  _accelerator.# -
0320: 2d 2d 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 0a 0a 6e 61 6d  -----------..nam
0370: 65 73 70 61 63 65 20 65 76 61 6c 20 4d 61 69 6e  espace eval Main
0380: 46 72 61 6d 65 20 7b 0a 20 20 20 20 57 69 64 67  Frame {.    Widg
0390: 65 74 3a 3a 64 65 66 69 6e 65 20 4d 61 69 6e 46  et::define MainF
03a0: 72 61 6d 65 20 6d 61 69 6e 66 72 61 6d 65 20 50  rame mainframe P
03b0: 72 6f 67 72 65 73 73 42 61 72 0a 0a 20 20 20 20  rogressBar..    
03c0: 57 69 64 67 65 74 3a 3a 62 77 69 6e 63 6c 75 64  Widget::bwinclud
03d0: 65 20 4d 61 69 6e 46 72 61 6d 65 20 50 72 6f 67  e MainFrame Prog
03e0: 72 65 73 73 42 61 72 20 2e 73 74 61 74 75 73 2e  ressBar .status.
03f0: 70 72 67 20 5c 0a 20 20 20 20 20 20 20 20 72 65  prg \.        re
0400: 6d 6f 76 65 20 7b 0a 09 20 20 20 20 2d 66 67 20  move {..    -fg 
0410: 2d 62 67 20 2d 62 64 20 2d 74 72 6f 75 67 68 63  -bg -bd -troughc
0420: 6f 6c 6f 72 20 2d 62 61 63 6b 67 72 6f 75 6e 64  olor -background
0430: 20 2d 62 6f 72 64 65 72 77 69 64 74 68 0a 09 20   -borderwidth.. 
0440: 20 20 20 2d 72 65 6c 69 65 66 20 2d 6f 72 69 65     -relief -orie
0450: 6e 74 20 2d 77 69 64 74 68 20 2d 68 65 69 67 68  nt -width -heigh
0460: 74 0a 20 20 20 20 20 20 20 20 7d 20 5c 0a 09 72  t.        } \..r
0470: 65 6e 61 6d 65 20 7b 0a 09 20 20 20 20 2d 6d 61  ename {..    -ma
0480: 78 69 6d 75 6d 20 20 20 20 2d 70 72 6f 67 72 65  ximum    -progre
0490: 73 73 6d 61 78 0a 09 20 20 20 20 2d 76 61 72 69  ssmax..    -vari
04a0: 61 62 6c 65 20 20 20 2d 70 72 6f 67 72 65 73 73  able   -progress
04b0: 76 61 72 0a 09 20 20 20 20 2d 74 79 70 65 20 20  var..    -type  
04c0: 20 20 20 20 20 2d 70 72 6f 67 72 65 73 73 74 79       -progressty
04d0: 70 65 0a 09 20 20 20 20 2d 66 6f 72 65 67 72 6f  pe..    -foregro
04e0: 75 6e 64 20 2d 70 72 6f 67 72 65 73 73 66 67 0a  und -progressfg.
04f0: 20 20 20 20 7d 0a 0a 20 20 20 20 57 69 64 67 65      }..    Widge
0500: 74 3a 3a 64 65 63 6c 61 72 65 20 4d 61 69 6e 46  t::declare MainF
0510: 72 61 6d 65 20 7b 0a 09 7b 2d 77 69 64 74 68 20  rame {..{-width 
0520: 20 20 20 20 20 20 20 54 6b 52 65 73 6f 75 72 63         TkResourc
0530: 65 20 30 20 20 20 20 20 20 30 20 66 72 61 6d 65  e 0      0 frame
0540: 7d 0a 09 7b 2d 68 65 69 67 68 74 20 20 20 20 20  }..{-height     
0550: 20 20 54 6b 52 65 73 6f 75 72 63 65 20 30 20 20    TkResource 0  
0560: 20 20 20 20 30 20 66 72 61 6d 65 7d 0a 09 7b 2d      0 frame}..{-
0570: 62 61 63 6b 67 72 6f 75 6e 64 20 20 20 43 6f 6c  background   Col
0580: 6f 72 20 20 20 20 20 20 22 53 79 73 74 65 6d 57  or      "SystemW
0590: 69 6e 64 6f 77 46 72 61 6d 65 22 20 30 7d 0a 09  indowFrame" 0}..
05a0: 7b 2d 74 65 78 74 76 61 72 69 61 62 6c 65 20 53  {-textvariable S
05b0: 74 72 69 6e 67 20 20 20 20 20 22 22 20 20 20 20  tring     ""    
05c0: 20 30 7d 0a 09 7b 2d 6d 65 6e 75 20 20 20 20 20   0}..{-menu     
05d0: 20 20 20 20 53 74 72 69 6e 67 20 20 20 20 20 7b      String     {
05e0: 7d 20 20 20 20 20 31 7d 0a 09 7b 2d 73 65 70 61  }     1}..{-sepa
05f0: 72 61 74 6f 72 20 20 20 20 45 6e 75 6d 20 20 20  rator    Enum   
0600: 20 20 20 20 62 6f 74 68 20 20 20 31 20 7b 6e 6f      both   1 {no
0610: 6e 65 20 74 6f 70 20 62 6f 74 74 6f 6d 20 62 6f  ne top bottom bo
0620: 74 68 7d 7d 0a 09 7b 2d 62 67 20 20 20 20 20 20  th}}..{-bg      
0630: 20 20 20 20 20 53 79 6e 6f 6e 79 6d 20 20 20 20       Synonym    
0640: 2d 62 61 63 6b 67 72 6f 75 6e 64 7d 0a 0a 09 7b  -background}...{
0650: 2d 6d 65 6e 75 62 61 72 66 6f 6e 74 20 20 20 53  -menubarfont   S
0660: 74 72 69 6e 67 20 20 20 20 20 22 22 20 20 30 7d  tring     ""  0}
0670: 0a 09 7b 2d 6d 65 6e 75 65 6e 74 72 79 66 6f 6e  ..{-menuentryfon
0680: 74 20 53 74 72 69 6e 67 20 20 20 20 20 22 22 20  t String     "" 
0690: 20 30 7d 0a 09 7b 2d 73 74 61 74 75 73 62 61 72   0}..{-statusbar
06a0: 66 6f 6e 74 20 53 74 72 69 6e 67 20 20 20 20 20  font String     
06b0: 22 22 20 20 30 7d 0a 20 20 20 20 7d 0a 0a 20 20  ""  0}.    }..  
06c0: 20 20 57 69 64 67 65 74 3a 3a 61 64 64 6d 61 70    Widget::addmap
06d0: 20 4d 61 69 6e 46 72 61 6d 65 20 22 22 20 2e 66   MainFrame "" .f
06e0: 72 61 6d 65 20 20 7b 2d 77 69 64 74 68 20 7b 7d  rame  {-width {}
06f0: 20 2d 68 65 69 67 68 74 20 7b 7d 20 2d 62 61 63   -height {} -bac
0700: 6b 67 72 6f 75 6e 64 20 7b 7d 7d 0a 20 20 20 20  kground {}}.    
0710: 57 69 64 67 65 74 3a 3a 61 64 64 6d 61 70 20 4d  Widget::addmap M
0720: 61 69 6e 46 72 61 6d 65 20 22 22 20 2e 74 6f 70  ainFrame "" .top
0730: 66 20 20 20 7b 2d 62 61 63 6b 67 72 6f 75 6e 64  f   {-background
0740: 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67 65 74 3a   {}}.    Widget:
0750: 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46 72 61 6d  :addmap MainFram
0760: 65 20 22 22 20 2e 62 6f 74 66 20 20 20 7b 2d 62  e "" .botf   {-b
0770: 61 63 6b 67 72 6f 75 6e 64 20 7b 7d 7d 0a 20 20  ackground {}}.  
0780: 20 20 57 69 64 67 65 74 3a 3a 61 64 64 6d 61 70    Widget::addmap
0790: 20 4d 61 69 6e 46 72 61 6d 65 20 22 22 20 2e 73   MainFrame "" .s
07a0: 74 61 74 75 73 20 7b 2d 62 61 63 6b 67 72 6f 75  tatus {-backgrou
07b0: 6e 64 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67 65  nd {}}.    Widge
07c0: 74 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46 72  t::addmap MainFr
07d0: 61 6d 65 20 22 22 20 2e 73 74 61 74 75 73 2e 6c  ame "" .status.l
07e0: 61 62 65 6c 20 7b 2d 62 61 63 6b 67 72 6f 75 6e  abel {-backgroun
07f0: 64 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67 65 74  d {}}.    Widget
0800: 3a 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46 72 61  ::addmap MainFra
0810: 6d 65 20 22 22 20 2e 73 74 61 74 75 73 2e 69 6e  me "" .status.in
0820: 64 66 20 20 7b 2d 62 61 63 6b 67 72 6f 75 6e 64  df  {-background
0830: 20 7b 7d 7d 0a 20 20 20 20 57 69 64 67 65 74 3a   {}}.    Widget:
0840: 3a 61 64 64 6d 61 70 20 4d 61 69 6e 46 72 61 6d  :addmap MainFram
0850: 65 20 22 22 20 2e 73 74 61 74 75 73 2e 70 72 67  e "" .status.prg
0860: 66 20 20 7b 2d 62 61 63 6b 67 72 6f 75 6e 64 20  f  {-background 
0870: 7b 7d 7d 0a 20 20 20 20 57 69 64 67 65 74 3a 3a  {}}.    Widget::
0880: 61 64 64 6d 61 70 20 4d 61 69 6e 46 72 61 6d 65  addmap MainFrame
0890: 20 50 72 6f 67 72 65 73 73 42 61 72 20 2e 73 74   ProgressBar .st
08a0: 61 74 75 73 2e 70 72 67 20 7b 2d 62 61 63 6b 67  atus.prg {-backg
08b0: 72 6f 75 6e 64 20 7b 7d 20 2d 62 61 63 6b 67 72  round {} -backgr
08c0: 6f 75 6e 64 20 2d 74 72 6f 75 67 68 63 6f 6c 6f  ound -troughcolo
08d0: 72 7d 0a 0a 20 20 20 20 76 61 72 69 61 62 6c 65  r}..    variable
08e0: 20 5f 77 69 64 67 65 74 0a 7d 0a 0a 0a 23 20 2d   _widget.}...# -
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 2d 2d 2d 2d  ----------------
0920: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0930: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43  -----------.#  C
0940: 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65  ommand MainFrame
0950: 3a 3a 63 72 65 61 74 65 0a 23 20 2d 2d 2d 2d 2d  ::create.# -----
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 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0990: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
09a0: 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69  -------.proc Mai
09b0: 6e 46 72 61 6d 65 3a 3a 63 72 65 61 74 65 20 7b  nFrame::create {
09c0: 20 70 61 74 68 20 61 72 67 73 20 7d 20 7b 0a 20   path args } {. 
09d0: 20 20 20 67 6c 6f 62 61 6c 20 20 20 74 63 6c 5f     global   tcl_
09e0: 70 6c 61 74 66 6f 72 6d 0a 20 20 20 20 76 61 72  platform.    var
09f0: 69 61 62 6c 65 20 5f 77 69 64 67 65 74 0a 20 20  iable _widget.  
0a00: 20 20 0a 20 20 20 20 73 65 74 20 70 61 74 68 20    .    set path 
0a10: 5b 42 57 69 64 67 65 74 3a 3a 77 72 61 70 20 66  [BWidget::wrap f
0a20: 72 61 6d 65 20 24 70 61 74 68 20 5c 0a 20 20 20  rame $path \.   
0a30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d                 -
0a40: 63 6c 61 73 73 20 4d 61 69 6e 46 72 61 6d 65 20  class MainFrame 
0a50: 2d 74 61 6b 65 66 6f 63 75 73 20 30 20 2d 68 69  -takefocus 0 -hi
0a60: 67 68 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73  ghlightthickness
0a70: 20 30 5d 0a 0a 20 20 20 20 73 65 74 20 74 6f 70   0]..    set top
0a80: 20 20 5b 77 69 6e 66 6f 20 70 61 72 65 6e 74 20    [winfo parent 
0a90: 24 70 61 74 68 5d 0a 20 20 20 20 69 66 20 7b 20  $path].    if { 
0aa0: 21 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 5b  ![string equal [
0ab0: 77 69 6e 66 6f 20 74 6f 70 6c 65 76 65 6c 20 24  winfo toplevel $
0ac0: 70 61 74 68 5d 20 24 74 6f 70 5d 20 7d 20 7b 0a  path] $top] } {.
0ad0: 20 20 20 20 20 20 20 20 64 65 73 74 72 6f 79 20          destroy 
0ae0: 24 70 61 74 68 0a 20 20 20 20 20 20 20 20 72 65  $path.        re
0af0: 74 75 72 6e 20 2d 63 6f 64 65 20 65 72 72 6f 72  turn -code error
0b00: 20 22 70 61 72 65 6e 74 20 6d 75 73 74 20 62 65   "parent must be
0b10: 20 61 20 74 6f 70 6c 65 76 65 6c 22 0a 20 20 20   a toplevel".   
0b20: 20 7d 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 69   }.    Widget::i
0b30: 6e 69 74 20 4d 61 69 6e 46 72 61 6d 65 20 24 70  nit MainFrame $p
0b40: 61 74 68 20 24 61 72 67 73 0a 0a 20 20 20 20 69  ath $args..    i
0b50: 66 20 7b 20 24 74 63 6c 5f 70 6c 61 74 66 6f 72  f { $tcl_platfor
0b60: 6d 28 70 6c 61 74 66 6f 72 6d 29 20 3d 3d 20 22  m(platform) == "
0b70: 75 6e 69 78 22 20 7d 20 7b 0a 20 20 20 20 20 20  unix" } {.      
0b80: 20 20 73 65 74 20 72 65 6c 69 65 66 20 72 61 69    set relief rai
0b90: 73 65 64 0a 20 20 20 20 20 20 20 20 73 65 74 20  sed.        set 
0ba0: 62 64 20 20 20 20 20 31 0a 20 20 20 20 7d 20 65  bd     1.    } e
0bb0: 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 73 65  lse {.        se
0bc0: 74 20 72 65 6c 69 65 66 20 66 6c 61 74 0a 20 20  t relief flat.  
0bd0: 20 20 20 20 20 20 73 65 74 20 62 64 20 20 20 20        set bd    
0be0: 20 30 0a 20 20 20 20 7d 0a 20 20 20 20 73 65 74   0.    }.    set
0bf0: 20 75 73 65 72 66 72 61 6d 65 20 5b 65 76 61 6c   userframe [eval
0c00: 20 5c 0a 20 20 20 20 20 20 20 20 20 20 5b 6c 69   \.          [li
0c10: 73 74 20 42 57 69 64 67 65 74 3a 3a 77 72 61 70  st BWidget::wrap
0c20: 20 66 72 61 6d 65 20 24 70 61 74 68 2e 66 72 61   frame $path.fra
0c30: 6d 65 5d 20 5c 0a 09 09 09 20 20 20 5b 57 69 64  me] \....   [Wid
0c40: 67 65 74 3a 3a 73 75 62 63 67 65 74 20 24 70 61  get::subcget $pa
0c50: 74 68 20 2e 66 72 61 6d 65 5d 20 5c 0a 09 09 09  th .frame] \....
0c60: 20 20 20 2d 72 65 6c 69 65 66 20 24 72 65 6c 69     -relief $reli
0c70: 65 66 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20  ef -borderwidth 
0c80: 24 62 64 5d 0a 20 20 20 20 73 65 74 20 74 6f 70  $bd].    set top
0c90: 66 72 61 6d 65 20 5b 65 76 61 6c 20 5c 0a 20 20  frame [eval \.  
0ca0: 20 20 20 20 20 20 20 20 5b 6c 69 73 74 20 42 57          [list BW
0cb0: 69 64 67 65 74 3a 3a 77 72 61 70 20 66 72 61 6d  idget::wrap fram
0cc0: 65 20 24 70 61 74 68 2e 74 6f 70 66 5d 20 5c 0a  e $path.topf] \.
0cd0: 09 09 09 20 20 20 5b 57 69 64 67 65 74 3a 3a 73  ...   [Widget::s
0ce0: 75 62 63 67 65 74 20 24 70 61 74 68 20 2e 74 6f  ubcget $path .to
0cf0: 70 66 5d 5d 0a 20 20 20 20 73 65 74 20 62 6f 74  pf]].    set bot
0d00: 66 72 61 6d 65 20 5b 65 76 61 6c 20 5c 0a 20 20  frame [eval \.  
0d10: 20 20 20 20 20 20 20 20 5b 6c 69 73 74 20 42 57          [list BW
0d20: 69 64 67 65 74 3a 3a 77 72 61 70 20 66 72 61 6d  idget::wrap fram
0d30: 65 20 24 70 61 74 68 2e 62 6f 74 66 5d 20 5c 0a  e $path.botf] \.
0d40: 09 09 09 20 20 20 2d 72 65 6c 69 65 66 20 24 72  ...   -relief $r
0d50: 65 6c 69 65 66 20 2d 62 6f 72 64 65 72 77 69 64  elief -borderwid
0d60: 74 68 20 24 62 64 20 5c 0a 09 09 09 20 20 20 5b  th $bd \....   [
0d70: 57 69 64 67 65 74 3a 3a 73 75 62 63 67 65 74 20  Widget::subcget 
0d80: 24 70 61 74 68 20 2e 62 6f 74 66 5d 5d 0a 0a 20  $path .botf]].. 
0d90: 20 20 20 70 61 63 6b 20 24 74 6f 70 66 72 61 6d     pack $topfram
0da0: 65 20 2d 66 69 6c 6c 20 78 0a 20 20 20 20 67 72  e -fill x.    gr
0db0: 69 64 20 63 6f 6c 75 6d 6e 63 6f 6e 66 69 67 75  id columnconfigu
0dc0: 72 65 20 24 74 6f 70 66 72 61 6d 65 20 30 20 2d  re $topframe 0 -
0dd0: 77 65 69 67 68 74 20 31 0a 0a 20 20 20 20 69 66  weight 1..    if
0de0: 20 7b 20 21 5b 42 57 69 64 67 65 74 3a 3a 75 73   { ![BWidget::us
0df0: 69 6e 67 20 74 74 6b 5d 20 7d 20 7b 0a 09 73 65  ing ttk] } {..se
0e00: 74 20 62 67 20 5b 57 69 64 67 65 74 3a 3a 63 67  t bg [Widget::cg
0e10: 65 74 20 24 70 61 74 68 20 2d 62 61 63 6b 67 72  et $path -backgr
0e20: 6f 75 6e 64 5d 0a 09 24 70 61 74 68 20 63 6f 6e  ound]..$path con
0e30: 66 69 67 75 72 65 20 2d 62 61 63 6b 67 72 6f 75  figure -backgrou
0e40: 6e 64 20 24 62 67 0a 20 20 20 20 7d 0a 20 20 20  nd $bg.    }.   
0e50: 20 69 66 20 7b 20 24 74 63 6c 5f 70 6c 61 74 66   if { $tcl_platf
0e60: 6f 72 6d 28 70 6c 61 74 66 6f 72 6d 29 20 21 3d  orm(platform) !=
0e70: 20 22 75 6e 69 78 22 20 7d 20 7b 0a 20 20 20 20   "unix" } {.    
0e80: 20 20 20 20 73 65 74 20 73 65 70 6f 70 74 20 5b      set sepopt [
0e90: 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f  Widget::getoptio
0ea0: 6e 20 24 70 61 74 68 20 2d 73 65 70 61 72 61 74  n $path -separat
0eb0: 6f 72 5d 0a 20 20 20 20 20 20 20 20 69 66 20 7b  or].        if {
0ec0: 20 24 73 65 70 6f 70 74 20 3d 3d 20 22 62 6f 74   $sepopt == "bot
0ed0: 68 22 20 7c 7c 20 24 73 65 70 6f 70 74 20 3d 3d  h" || $sepopt ==
0ee0: 20 22 74 6f 70 22 20 7d 20 7b 0a 09 20 20 20 20   "top" } {..    
0ef0: 69 66 20 7b 20 5b 42 57 69 64 67 65 74 3a 3a 75  if { [BWidget::u
0f00: 73 69 6e 67 20 74 74 6b 5d 20 7d 20 7b 0a 09 09  sing ttk] } {...
0f10: 73 65 74 20 73 65 70 20 5b 74 74 6b 3a 3a 73 65  set sep [ttk::se
0f20: 70 61 72 61 74 6f 72 20 24 70 61 74 68 2e 73 65  parator $path.se
0f30: 70 20 2d 6f 72 69 65 6e 74 20 68 6f 72 69 7a 6f  p -orient horizo
0f40: 6e 74 61 6c 5d 0a 09 20 20 20 20 7d 20 65 6c 73  ntal]..    } els
0f50: 65 20 7b 0a 09 09 73 65 74 20 73 65 70 20 5b 53  e {...set sep [S
0f60: 65 70 61 72 61 74 6f 72 3a 3a 63 72 65 61 74 65  eparator::create
0f70: 20 24 70 61 74 68 2e 73 65 70 20 2d 6f 72 69 65   $path.sep -orie
0f80: 6e 74 20 68 6f 72 69 7a 6f 6e 74 61 6c 20 2d 62  nt horizontal -b
0f90: 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d 0a 09  ackground $bg]..
0fa0: 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20      }.          
0fb0: 20 20 70 61 63 6b 20 24 73 65 70 20 2d 66 69 6c    pack $sep -fil
0fc0: 6c 20 78 0a 20 20 20 20 20 20 20 20 7d 0a 20 20  l x.        }.  
0fd0: 20 20 20 20 20 20 69 66 20 7b 20 24 73 65 70 6f        if { $sepo
0fe0: 70 74 20 3d 3d 20 22 62 6f 74 68 22 20 7c 7c 20  pt == "both" || 
0ff0: 24 73 65 70 6f 70 74 20 3d 3d 20 22 62 6f 74 74  $sepopt == "bott
1000: 6f 6d 22 20 7d 20 7b 0a 09 20 20 20 20 69 66 20  om" } {..    if 
1010: 7b 20 5b 42 57 69 64 67 65 74 3a 3a 75 73 69 6e  { [BWidget::usin
1020: 67 20 74 74 6b 5d 20 7d 20 7b 0a 09 09 73 65 74  g ttk] } {...set
1030: 20 73 65 70 20 5b 74 74 6b 3a 3a 73 65 70 61 72   sep [ttk::separ
1040: 61 74 6f 72 20 24 62 6f 74 66 72 61 6d 65 2e 73  ator $botframe.s
1050: 65 70 20 2d 6f 72 69 65 6e 74 20 68 6f 72 69 7a  ep -orient horiz
1060: 6f 6e 74 61 6c 5d 0a 09 20 20 20 20 7d 20 65 6c  ontal]..    } el
1070: 73 65 20 7b 0a 09 09 73 65 74 20 73 65 70 20 5b  se {...set sep [
1080: 53 65 70 61 72 61 74 6f 72 3a 3a 63 72 65 61 74  Separator::creat
1090: 65 20 24 62 6f 74 66 72 61 6d 65 2e 73 65 70 20  e $botframe.sep 
10a0: 2d 6f 72 69 65 6e 74 20 68 6f 72 69 7a 6f 6e 74  -orient horizont
10b0: 61 6c 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24  al -background $
10c0: 62 67 5d 0a 09 20 20 20 20 7d 0a 20 20 20 20 20  bg]..    }.     
10d0: 20 20 20 20 20 20 20 70 61 63 6b 20 24 73 65 70         pack $sep
10e0: 20 2d 66 69 6c 6c 20 78 0a 20 20 20 20 20 20 20   -fill x.       
10f0: 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 23 20   }.    }..    # 
1100: 2d 2d 2d 20 73 74 61 74 75 73 20 62 61 72 20 2d  --- status bar -
1110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1120: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1130: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1140: 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 69 66 20  --------.    if 
1150: 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20  {[string length 
1160: 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69  [Widget::getopti
1170: 6f 6e 20 24 70 61 74 68 20 2d 73 74 61 74 75 73  on $path -status
1180: 62 61 72 66 6f 6e 74 5d 5d 7d 20 7b 0a 09 73 65  barfont]]} {..se
1190: 74 20 73 62 66 6e 74 20 5b 6c 69 73 74 20 2d 66  t sbfnt [list -f
11a0: 6f 6e 74 20 5b 57 69 64 67 65 74 3a 3a 67 65 74  ont [Widget::get
11b0: 6f 70 74 69 6f 6e 20 24 70 61 74 68 20 2d 73 74  option $path -st
11c0: 61 74 75 73 62 61 72 66 6f 6e 74 5d 5d 0a 20 20  atusbarfont]].  
11d0: 20 20 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74 20    } else {..set 
11e0: 73 62 66 6e 74 20 22 22 0a 20 20 20 20 7d 0a 0a  sbfnt "".    }..
11f0: 20 20 20 20 69 66 20 7b 20 5b 42 57 69 64 67 65      if { [BWidge
1200: 74 3a 3a 75 73 69 6e 67 20 74 74 6b 5d 20 7d 20  t::using ttk] } 
1210: 7b 0a 09 73 65 74 20 73 74 61 74 75 73 20 20 20  {..set status   
1220: 5b 74 74 6b 3a 3a 66 72 61 6d 65 20 24 70 61 74  [ttk::frame $pat
1230: 68 2e 73 74 61 74 75 73 5d 0a 09 73 65 74 20 6c  h.status]..set l
1240: 61 62 65 6c 20 20 20 20 5b 65 76 61 6c 20 5b 6c  abel    [eval [l
1250: 69 73 74 20 74 74 6b 3a 3a 6c 61 62 65 6c 20 24  ist ttk::label $
1260: 73 74 61 74 75 73 2e 6c 61 62 65 6c 20 5c 0a 09  status.label \..
1270: 09 09 09 2d 74 65 78 74 76 61 72 69 61 62 6c 65  ...-textvariable
1280: 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70 74   [Widget::getopt
1290: 69 6f 6e 20 24 70 61 74 68 20 2d 74 65 78 74 76  ion $path -textv
12a0: 61 72 69 61 62 6c 65 5d 5d 20 24 73 62 66 6e 74  ariable]] $sbfnt
12b0: 5d 0a 09 73 65 74 20 69 6e 64 66 72 61 6d 65 20  ]..set indframe 
12c0: 5b 74 74 6b 3a 3a 66 72 61 6d 65 20 24 73 74 61  [ttk::frame $sta
12d0: 74 75 73 2e 69 6e 64 66 5d 0a 09 73 65 74 20 70  tus.indf]..set p
12e0: 72 67 66 72 61 6d 65 20 5b 74 74 6b 3a 3a 66 72  rgframe [ttk::fr
12f0: 61 6d 65 20 24 73 74 61 74 75 73 2e 70 72 67 66  ame $status.prgf
1300: 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09  ].    } else {..
1310: 73 65 74 20 73 74 61 74 75 73 20 20 20 5b 66 72  set status   [fr
1320: 61 6d 65 20 24 70 61 74 68 2e 73 74 61 74 75 73  ame $path.status
1330: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67   -background $bg
1340: 5d 0a 09 73 65 74 20 6c 61 62 65 6c 20 20 20 20  ]..set label    
1350: 5b 65 76 61 6c 20 5b 6c 69 73 74 20 6c 61 62 65  [eval [list labe
1360: 6c 20 24 73 74 61 74 75 73 2e 6c 61 62 65 6c 20  l $status.label 
1370: 5c 0a 09 09 09 09 2d 74 65 78 74 76 61 72 69 61  \.....-textvaria
1380: 62 6c 65 20 5b 57 69 64 67 65 74 3a 3a 67 65 74  ble [Widget::get
1390: 6f 70 74 69 6f 6e 20 24 70 61 74 68 20 2d 74 65  option $path -te
13a0: 78 74 76 61 72 69 61 62 6c 65 5d 20 5c 0a 09 09  xtvariable] \...
13b0: 09 09 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62  ..-background $b
13c0: 67 5d 20 24 73 62 66 6e 74 5d 0a 09 73 65 74 20  g] $sbfnt]..set 
13d0: 69 6e 64 66 72 61 6d 65 20 5b 66 72 61 6d 65 20  indframe [frame 
13e0: 24 73 74 61 74 75 73 2e 69 6e 64 66 20 2d 62 61  $status.indf -ba
13f0: 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d 0a 09 73  ckground $bg]..s
1400: 65 74 20 70 72 67 66 72 61 6d 65 20 5b 66 72 61  et prgframe [fra
1410: 6d 65 20 24 73 74 61 74 75 73 2e 70 72 67 66 20  me $status.prgf 
1420: 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d  -background $bg]
1430: 0a 20 20 20 20 7d 0a 0a 20 20 20 20 70 6c 61 63  .    }..    plac
1440: 65 20 24 6c 61 62 65 6c 20 20 20 20 2d 61 6e 63  e $label    -anc
1450: 68 6f 72 20 77 20 2d 78 20 30 20 2d 72 65 6c 79  hor w -x 0 -rely
1460: 20 30 2e 35 0a 20 20 20 20 70 6c 61 63 65 20 24   0.5.    place $
1470: 69 6e 64 66 72 61 6d 65 20 2d 61 6e 63 68 6f 72  indframe -anchor
1480: 20 6e 65 20 2d 72 65 6c 78 20 31 20 2d 79 20 30   ne -relx 1 -y 0
1490: 20 2d 72 65 6c 68 65 69 67 68 74 20 31 0a 20 20   -relheight 1.  
14a0: 20 20 70 61 63 6b 20 20 24 70 72 67 66 72 61 6d    pack  $prgfram
14b0: 65 20 2d 69 6e 20 24 69 6e 64 66 72 61 6d 65 20  e -in $indframe 
14c0: 2d 73 69 64 65 20 6c 65 66 74 20 2d 70 61 64 78  -side left -padx
14d0: 20 32 0a 20 20 20 20 24 73 74 61 74 75 73 20 63   2.    $status c
14e0: 6f 6e 66 69 67 75 72 65 20 2d 68 65 69 67 68 74  onfigure -height
14f0: 20 5b 77 69 6e 66 6f 20 72 65 71 68 65 69 67 68   [winfo reqheigh
1500: 74 20 24 6c 61 62 65 6c 5d 0a 0a 20 20 20 20 73  t $label]..    s
1510: 65 74 20 70 72 6f 67 72 65 73 73 20 5b 65 76 61  et progress [eva
1520: 6c 20 5b 6c 69 73 74 20 50 72 6f 67 72 65 73 73  l [list Progress
1530: 42 61 72 3a 3a 63 72 65 61 74 65 20 24 73 74 61  Bar::create $sta
1540: 74 75 73 2e 70 72 67 5d 20 5c 0a 09 09 20 20 20  tus.prg] \...   
1550: 20 20 20 5b 57 69 64 67 65 74 3a 3a 73 75 62 63     [Widget::subc
1560: 67 65 74 20 24 70 61 74 68 20 2e 73 74 61 74 75  get $path .statu
1570: 73 2e 70 72 67 5d 20 5c 0a 20 20 20 20 20 20 20  s.prg] \.       
1580: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d                 -
1590: 77 69 64 74 68 20 20 20 20 20 20 20 35 30 20 5c  width       50 \
15a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
15b0: 20 20 20 20 20 20 20 2d 68 65 69 67 68 74 20 20         -height  
15c0: 20 20 20 20 5b 65 78 70 72 20 7b 5b 77 69 6e 66      [expr {[winf
15d0: 6f 20 72 65 71 68 65 69 67 68 74 20 24 6c 61 62  o reqheight $lab
15e0: 65 6c 5d 2d 32 7d 5d 20 5c 0a 20 20 20 20 20 20  el]-2}] \.      
15f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1600: 2d 62 6f 72 64 65 72 77 69 64 74 68 20 31 20 5c  -borderwidth 1 \
1610: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
1620: 20 20 20 20 20 20 20 2d 72 65 6c 69 65 66 20 20         -relief  
1630: 20 20 20 20 73 75 6e 6b 65 6e 5d 0a 20 20 20 20      sunken].    
1640: 70 61 63 6b 20 24 73 74 61 74 75 73 20 20 20 20  pack $status    
1650: 2d 69 6e 20 24 62 6f 74 66 72 61 6d 65 20 2d 66  -in $botframe -f
1660: 69 6c 6c 20 78 20 2d 70 61 64 79 20 32 0a 20 20  ill x -pady 2.  
1670: 20 20 70 61 63 6b 20 24 62 6f 74 66 72 61 6d 65    pack $botframe
1680: 20 20 2d 73 69 64 65 20 62 6f 74 74 6f 6d 20 2d    -side bottom -
1690: 66 69 6c 6c 20 78 0a 20 20 20 20 70 61 63 6b 20  fill x.    pack 
16a0: 24 75 73 65 72 66 72 61 6d 65 20 2d 66 69 6c 6c  $userframe -fill
16b0: 20 62 6f 74 68 20 2d 65 78 70 61 6e 64 20 79 65   both -expand ye
16c0: 73 0a 0a 20 20 20 20 73 65 74 20 5f 77 69 64 67  s..    set _widg
16d0: 65 74 28 24 70 61 74 68 2c 74 6f 70 29 20 20 20  et($path,top)   
16e0: 20 20 20 24 74 6f 70 0a 20 20 20 20 73 65 74 20     $top.    set 
16f0: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6e 74  _widget($path,nt
1700: 6f 6f 6c 62 61 72 29 20 30 0a 20 20 20 20 73 65  oolbar) 0.    se
1710: 74 20 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c  t _widget($path,
1720: 6e 69 6e 64 69 63 29 20 20 20 30 0a 0a 20 20 20  nindic)   0..   
1730: 20 73 65 74 20 6d 65 6e 75 20 5b 57 69 64 67 65   set menu [Widge
1740: 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61  t::getoption $pa
1750: 74 68 20 2d 6d 65 6e 75 5d 0a 20 20 20 20 69 66  th -menu].    if
1760: 20 7b 20 5b 6c 6c 65 6e 67 74 68 20 24 6d 65 6e   { [llength $men
1770: 75 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 5f  u] } {.        _
1780: 63 72 65 61 74 65 5f 6d 65 6e 75 62 61 72 20 24  create_menubar $
1790: 70 61 74 68 20 24 6d 65 6e 75 0a 20 20 20 20 7d  path $menu.    }
17a0: 0a 0a 20 20 20 20 62 69 6e 64 20 24 70 61 74 68  ..    bind $path
17b0: 20 3c 44 65 73 74 72 6f 79 3e 20 5b 6c 69 73 74   <Destroy> [list
17c0: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 64 65 73   MainFrame::_des
17d0: 74 72 6f 79 20 25 57 5d 0a 0a 20 20 20 20 72 65  troy %W]..    re
17e0: 74 75 72 6e 20 5b 57 69 64 67 65 74 3a 3a 63 72  turn [Widget::cr
17f0: 65 61 74 65 20 4d 61 69 6e 46 72 61 6d 65 20 24  eate MainFrame $
1800: 70 61 74 68 5d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d  path].}...# ----
1810: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1820: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1830: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1840: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1850: 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d  --------.#  Comm
1860: 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 63  and MainFrame::c
1870: 6f 6e 66 69 67 75 72 65 0a 23 20 2d 2d 2d 2d 2d  onfigure.# -----
1880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1890: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
18a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
18b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
18c0: 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69  -------.proc Mai
18d0: 6e 46 72 61 6d 65 3a 3a 63 6f 6e 66 69 67 75 72  nFrame::configur
18e0: 65 20 7b 20 70 61 74 68 20 61 72 67 73 20 7d 20  e { path args } 
18f0: 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f  {.    variable _
1900: 77 69 64 67 65 74 0a 0a 20 20 20 20 73 65 74 20  widget..    set 
1910: 72 65 73 20 5b 57 69 64 67 65 74 3a 3a 63 6f 6e  res [Widget::con
1920: 66 69 67 75 72 65 20 24 70 61 74 68 20 24 61 72  figure $path $ar
1930: 67 73 5d 0a 0a 20 20 20 20 69 66 20 7b 20 5b 57  gs]..    if { [W
1940: 69 64 67 65 74 3a 3a 68 61 73 43 68 61 6e 67 65  idget::hasChange
1950: 64 20 24 70 61 74 68 20 2d 74 65 78 74 76 61 72  d $path -textvar
1960: 69 61 62 6c 65 20 6e 65 77 76 5d 20 7d 20 7b 0a  iable newv] } {.
1970: 20 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20          uplevel 
1980: 5c 23 30 20 24 70 61 74 68 2e 73 74 61 74 75 73  \#0 $path.status
1990: 2e 6c 61 62 65 6c 20 63 6f 6e 66 69 67 75 72 65  .label configure
19a0: 20 2d 74 65 78 74 76 61 72 69 61 62 6c 65 20 5b   -textvariable [
19b0: 6c 69 73 74 20 24 6e 65 77 76 5d 0a 20 20 20 20  list $newv].    
19c0: 7d 0a 0a 20 20 20 20 23 20 54 68 65 20 74 74 6b  }..    # The ttk
19d0: 20 66 72 61 6d 65 20 68 61 73 20 6e 6f 20 2d 62   frame has no -b
19e0: 61 63 6b 67 72 6f 75 6e 64 0a 20 20 20 20 69 66  ackground.    if
19f0: 20 7b 20 21 5b 42 57 69 64 67 65 74 3a 3a 75 73   { ![BWidget::us
1a00: 69 6e 67 20 74 74 6b 5d 20 20 26 26 20 5b 57 69  ing ttk]  && [Wi
1a10: 64 67 65 74 3a 3a 68 61 73 43 68 61 6e 67 65 64  dget::hasChanged
1a20: 20 24 70 61 74 68 20 2d 62 61 63 6b 67 72 6f 75   $path -backgrou
1a30: 6e 64 20 62 67 5d 20 7d 20 7b 0a 09 69 66 20 7b  nd bg] } {..if {
1a40: 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28  $::tcl_platform(
1a50: 70 6c 61 74 66 6f 72 6d 29 20 3d 3d 20 22 75 6e  platform) == "un
1a60: 69 78 22 7d 20 7b 0a 09 20 20 20 20 73 65 74 20  ix"} {..    set 
1a70: 6c 69 73 74 6d 65 6e 75 20 5b 24 5f 77 69 64 67  listmenu [$_widg
1a80: 65 74 28 24 70 61 74 68 2c 74 6f 70 29 20 63 67  et($path,top) cg
1a90: 65 74 20 2d 6d 65 6e 75 5d 0a 09 20 20 20 20 77  et -menu]..    w
1aa0: 68 69 6c 65 20 7b 20 5b 6c 6c 65 6e 67 74 68 20  hile { [llength 
1ab0: 24 6c 69 73 74 6d 65 6e 75 5d 20 7d 20 7b 0a 09  $listmenu] } {..
1ac0: 09 73 65 74 20 6e 65 77 6c 69 73 74 20 7b 7d 0a  .set newlist {}.
1ad0: 09 09 66 6f 72 65 61 63 68 20 6d 65 6e 75 20 24  ..foreach menu $
1ae0: 6c 69 73 74 6d 65 6e 75 20 7b 0a 09 09 20 20 20  listmenu {...   
1af0: 20 24 6d 65 6e 75 20 63 6f 6e 66 69 67 75 72 65   $menu configure
1b00: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67   -background $bg
1b10: 0a 09 09 20 20 20 20 73 65 74 20 6e 65 77 6c 69  ...    set newli
1b20: 73 74 20 5b 63 6f 6e 63 61 74 20 24 6e 65 77 6c  st [concat $newl
1b30: 69 73 74 20 5b 77 69 6e 66 6f 20 63 68 69 6c 64  ist [winfo child
1b40: 72 65 6e 20 24 6d 65 6e 75 5d 5d 0a 09 09 7d 0a  ren $menu]]...}.
1b50: 09 09 73 65 74 20 6c 69 73 74 6d 65 6e 75 20 24  ..set listmenu $
1b60: 6e 65 77 6c 69 73 74 0a 09 20 20 20 20 7d 0a 09  newlist..    }..
1b70: 7d 0a 09 66 6f 72 65 61 63 68 20 73 65 70 20 7b  }..foreach sep {
1b80: 2e 73 65 70 20 2e 62 6f 74 66 2e 73 65 70 7d 20  .sep .botf.sep} 
1b90: 7b 0a 09 20 20 20 20 69 66 20 7b 5b 77 69 6e 66  {..    if {[winf
1ba0: 6f 20 65 78 69 73 74 73 20 24 70 61 74 68 2e 24  o exists $path.$
1bb0: 73 65 70 5d 7d 20 7b 0a 09 09 53 65 70 61 72 61  sep]} {...Separa
1bc0: 74 6f 72 3a 3a 63 6f 6e 66 69 67 75 72 65 20 24  tor::configure $
1bd0: 70 61 74 68 2e 24 73 65 70 20 2d 62 61 63 6b 67  path.$sep -backg
1be0: 72 6f 75 6e 64 20 24 62 67 0a 09 20 20 20 20 7d  round $bg..    }
1bf0: 0a 09 7d 0a 09 66 6f 72 65 61 63 68 20 77 20 5b  ..}..foreach w [
1c00: 77 69 6e 66 6f 20 63 68 69 6c 64 72 65 6e 20 24  winfo children $
1c10: 70 61 74 68 2e 74 6f 70 66 5d 20 7b 0a 09 20 20  path.topf] {..  
1c20: 20 20 24 77 20 63 6f 6e 66 69 67 75 72 65 20 2d    $w configure -
1c30: 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 0a 09  background $bg..
1c40: 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20  }.    }..    if 
1c50: 7b 20 5b 57 69 64 67 65 74 3a 3a 68 61 73 43 68  { [Widget::hasCh
1c60: 61 6e 67 65 64 20 24 70 61 74 68 20 2d 6d 65 6e  anged $path -men
1c70: 75 62 61 72 66 6f 6e 74 20 6e 65 77 6d 62 66 6e  ubarfont newmbfn
1c80: 74 5d 20 7d 20 7b 0a 09 69 66 20 7b 5b 73 74 72  t] } {..if {[str
1c90: 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e 65 77 6d  ing length $newm
1ca0: 62 66 6e 74 5d 7d 20 7b 0a 09 20 20 20 20 73 65  bfnt]} {..    se
1cb0: 74 20 6d 62 66 6e 74 20 5b 6c 69 73 74 20 2d 66  t mbfnt [list -f
1cc0: 6f 6e 74 20 24 6e 65 77 6d 62 66 6e 74 5d 0a 09  ont $newmbfnt]..
1cd0: 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20 20 73 65  } else {..    se
1ce0: 74 20 6d 62 66 6e 74 20 22 22 0a 09 7d 0a 09 73  t mbfnt ""..}..s
1cf0: 65 74 20 74 6f 70 20 20 20 20 20 24 5f 77 69 64  et top     $_wid
1d00: 67 65 74 28 24 70 61 74 68 2c 74 6f 70 29 0a 09  get($path,top)..
1d10: 69 66 20 7b 5b 73 74 72 69 6e 67 20 65 71 75 61  if {[string equa
1d20: 6c 20 24 74 6f 70 20 2e 5d 7d 20 7b 0a 09 20 20  l $top .]} {..  
1d30: 20 20 65 76 61 6c 20 5b 6c 69 73 74 20 2e 6d 65    eval [list .me
1d40: 6e 75 62 61 72 20 63 6f 6e 66 69 67 75 72 65 5d  nubar configure]
1d50: 20 24 6d 62 66 6e 74 0a 09 7d 20 65 6c 73 65 20   $mbfnt..} else 
1d60: 7b 0a 09 20 20 20 20 65 76 61 6c 20 5b 6c 69 73  {..    eval [lis
1d70: 74 20 24 74 6f 70 2e 6d 65 6e 75 62 61 72 20 63  t $top.menubar c
1d80: 6f 6e 66 69 67 75 72 65 5d 20 24 6d 62 66 6e 74  onfigure] $mbfnt
1d90: 0a 09 7d 0a 20 20 20 20 7d 0a 20 20 20 20 69 66  ..}.    }.    if
1da0: 20 7b 20 5b 57 69 64 67 65 74 3a 3a 68 61 73 43   { [Widget::hasC
1db0: 68 61 6e 67 65 64 20 24 70 61 74 68 20 2d 6d 65  hanged $path -me
1dc0: 6e 75 65 6e 74 72 79 66 6f 6e 74 20 6e 65 77 6d  nuentryfont newm
1dd0: 65 66 6e 74 5d 20 7d 20 7b 0a 09 69 66 20 7b 5b  efnt] } {..if {[
1de0: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e  string length $n
1df0: 65 77 6d 65 66 6e 74 5d 7d 20 7b 0a 09 20 20 20  ewmefnt]} {..   
1e00: 20 73 65 74 20 6d 65 66 6e 74 20 5b 6c 69 73 74   set mefnt [list
1e10: 20 2d 66 6f 6e 74 20 24 6e 65 77 6d 65 66 6e 74   -font $newmefnt
1e20: 5d 0a 09 7d 20 65 6c 73 65 20 7b 0a 09 20 20 20  ]..} else {..   
1e30: 20 73 65 74 20 6d 65 66 6e 74 20 22 22 0a 09 7d   set mefnt ""..}
1e40: 0a 09 73 65 74 20 74 6f 70 20 20 20 20 20 24 5f  ..set top     $_
1e50: 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 6f 70  widget($path,top
1e60: 29 0a 09 69 66 20 7b 5b 73 74 72 69 6e 67 20 65  )..if {[string e
1e70: 71 75 61 6c 20 24 74 6f 70 20 2e 5d 7d 20 7b 0a  qual $top .]} {.
1e80: 09 20 20 20 20 73 65 74 20 6d 62 20 2e 6d 65 6e  .    set mb .men
1e90: 75 62 61 72 0a 09 7d 20 65 6c 73 65 20 7b 0a 09  ubar..} else {..
1ea0: 20 20 20 20 73 65 74 20 6d 62 20 24 74 6f 70 2e      set mb $top.
1eb0: 6d 65 6e 75 62 61 72 0a 09 7d 0a 09 73 65 74 20  menubar..}..set 
1ec0: 6c 20 5b 77 69 6e 66 6f 20 63 68 69 6c 64 72 65  l [winfo childre
1ed0: 6e 20 24 6d 62 5d 0a 09 77 68 69 6c 65 20 7b 5b  n $mb]..while {[
1ee0: 6c 6c 65 6e 67 74 68 20 24 6c 5d 7d 20 7b 0a 09  llength $l]} {..
1ef0: 20 20 20 20 73 65 74 20 65 20 5b 6c 69 6e 64 65      set e [linde
1f00: 78 20 24 6c 20 30 5d 0a 09 20 20 20 20 73 65 74  x $l 0]..    set
1f10: 20 6c 20 5b 6c 72 61 6e 67 65 20 24 6c 20 31 20   l [lrange $l 1 
1f20: 65 6e 64 5d 0a 09 20 20 20 20 69 66 20 7b 5b 73  end]..    if {[s
1f30: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 65 5d  tring length $e]
1f40: 20 3d 3d 20 30 7d 20 7b 63 6f 6e 74 69 6e 75 65   == 0} {continue
1f50: 7d 0a 09 20 20 20 20 6c 61 70 70 65 6e 64 20 6c  }..    lappend l
1f60: 20 5b 77 69 6e 66 6f 20 63 68 69 6c 64 72 65 6e   [winfo children
1f70: 20 24 65 5d 0a 09 20 20 20 20 65 76 61 6c 20 5b   $e]..    eval [
1f80: 6c 69 73 74 20 24 65 20 63 6f 6e 66 69 67 75 72  list $e configur
1f90: 65 5d 20 24 6d 65 66 6e 74 0a 09 7d 0a 20 20 20  e] $mefnt..}.   
1fa0: 20 7d 0a 0a 0a 20 20 20 20 69 66 20 7b 20 5b 57   }...    if { [W
1fb0: 69 64 67 65 74 3a 3a 68 61 73 43 68 61 6e 67 65  idget::hasChange
1fc0: 64 20 24 70 61 74 68 20 2d 73 74 61 74 75 73 62  d $path -statusb
1fd0: 61 72 66 6f 6e 74 20 6e 65 77 73 62 66 6e 74 5d  arfont newsbfnt]
1fe0: 20 7d 20 7b 0a 09 69 66 20 7b 5b 73 74 72 69 6e   } {..if {[strin
1ff0: 67 20 6c 65 6e 67 74 68 20 24 6e 65 77 73 62 66  g length $newsbf
2000: 6e 74 5d 7d 20 7b 0a 09 20 20 20 20 73 65 74 20  nt]} {..    set 
2010: 73 62 66 6e 74 20 5b 6c 69 73 74 20 2d 66 6f 6e  sbfnt [list -fon
2020: 74 20 24 6e 65 77 73 62 66 6e 74 5d 0a 09 7d 20  t $newsbfnt]..} 
2030: 65 6c 73 65 20 7b 0a 09 20 20 20 20 73 65 74 20  else {..    set 
2040: 73 62 66 6e 74 20 22 22 0a 09 7d 0a 09 66 6f 72  sbfnt ""..}..for
2050: 20 7b 73 65 74 20 69 6e 64 65 78 20 30 7d 20 7b   {set index 0} {
2060: 24 69 6e 64 65 78 3c 24 5f 77 69 64 67 65 74 28  $index<$_widget(
2070: 24 70 61 74 68 2c 6e 69 6e 64 69 63 29 7d 20 7b  $path,nindic)} {
2080: 69 6e 63 72 20 69 6e 64 65 78 7d 20 7b 0a 09 20  incr index} {.. 
2090: 20 20 20 73 65 74 20 69 6e 64 69 63 20 24 70 61     set indic $pa
20a0: 74 68 2e 73 74 61 74 75 73 2e 69 6e 64 66 2e 66  th.status.indf.f
20b0: 24 69 6e 64 65 78 0a 09 20 20 20 20 65 76 61 6c  $index..    eval
20c0: 20 5b 6c 69 73 74 20 24 69 6e 64 69 63 20 63 6f   [list $indic co
20d0: 6e 66 69 67 75 72 65 5d 20 24 73 62 66 6e 74 0a  nfigure] $sbfnt.
20e0: 09 7d 0a 09 65 76 61 6c 20 5b 6c 69 73 74 20 24  .}..eval [list $
20f0: 70 61 74 68 2e 73 74 61 74 75 73 2e 6c 61 62 65  path.status.labe
2100: 6c 20 63 6f 6e 66 69 67 75 72 65 5d 20 24 73 62  l configure] $sb
2110: 66 6e 74 0a 09 24 70 61 74 68 2e 73 74 61 74 75  fnt..$path.statu
2120: 73 20 63 6f 6e 66 69 67 75 72 65 20 2d 68 65 69  s configure -hei
2130: 67 68 74 20 5b 77 69 6e 66 6f 20 72 65 71 68 65  ght [winfo reqhe
2140: 69 67 68 74 20 24 70 61 74 68 2e 73 74 61 74 75  ight $path.statu
2150: 73 2e 6c 61 62 65 6c 5d 0a 0a 09 24 70 61 74 68  s.label]...$path
2160: 2e 73 74 61 74 75 73 2e 70 72 67 20 63 6f 6e 66  .status.prg conf
2170: 69 67 75 72 65 20 5c 0a 09 09 2d 68 65 69 67 68  igure \...-heigh
2180: 74 20 5b 65 78 70 72 20 7b 5b 77 69 6e 66 6f 20  t [expr {[winfo 
2190: 72 65 71 68 65 69 67 68 74 20 24 70 61 74 68 2e  reqheight $path.
21a0: 73 74 61 74 75 73 2e 6c 61 62 65 6c 5d 2d 32 7d  status.label]-2}
21b0: 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 72 65 74  ].    }..    ret
21c0: 75 72 6e 20 24 72 65 73 0a 7d 0a 0a 0a 23 20 2d  urn $res.}...# -
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 2d 2d 2d 2d 2d 2d  ----------------
21f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2200: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2210: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43  -----------.#  C
2220: 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65  ommand MainFrame
2230: 3a 3a 63 67 65 74 0a 23 20 2d 2d 2d 2d 2d 2d 2d  ::cget.# -------
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 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2260: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2270: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2280: 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46  -----.proc MainF
2290: 72 61 6d 65 3a 3a 63 67 65 74 20 7b 20 70 61 74  rame::cget { pat
22a0: 68 20 6f 70 74 69 6f 6e 20 7d 20 7b 0a 20 20 20  h option } {.   
22b0: 20 72 65 74 75 72 6e 20 5b 57 69 64 67 65 74 3a   return [Widget:
22c0: 3a 63 67 65 74 20 24 70 61 74 68 20 24 6f 70 74  :cget $path $opt
22d0: 69 6f 6e 5d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d  ion].}...# -----
22e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
22f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2300: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
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 0a 23 20 20 43 6f 6d 6d 61  -------.#  Comma
2330: 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65  nd MainFrame::ge
2340: 74 66 72 61 6d 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d  tframe.# -------
2350: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2360: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2370: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2380: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2390: 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46  -----.proc MainF
23a0: 72 61 6d 65 3a 3a 67 65 74 66 72 61 6d 65 20 7b  rame::getframe {
23b0: 20 70 61 74 68 20 7d 20 7b 0a 20 20 20 20 72 65   path } {.    re
23c0: 74 75 72 6e 20 24 70 61 74 68 2e 66 72 61 6d 65  turn $path.frame
23d0: 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  .}...# ---------
23e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
23f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2400: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2410: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2420: 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d  ---.#  Command M
2430: 61 69 6e 46 72 61 6d 65 3a 3a 61 64 64 74 6f 6f  ainFrame::addtoo
2440: 6c 62 61 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  lbar.# ---------
2450: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2460: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2470: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2480: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2490: 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61  ---.proc MainFra
24a0: 6d 65 3a 3a 61 64 64 74 6f 6f 6c 62 61 72 20 7b  me::addtoolbar {
24b0: 20 70 61 74 68 20 7d 20 7b 0a 20 20 20 20 67 6c   path } {.    gl
24c0: 6f 62 61 6c 20 20 20 74 63 6c 5f 70 6c 61 74 66  obal   tcl_platf
24d0: 6f 72 6d 0a 20 20 20 20 76 61 72 69 61 62 6c 65  orm.    variable
24e0: 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 73 65   _widget..    se
24f0: 74 20 69 6e 64 65 78 20 20 20 20 20 24 5f 77 69  t index     $_wi
2500: 64 67 65 74 28 24 70 61 74 68 2c 6e 74 6f 6f 6c  dget($path,ntool
2510: 62 61 72 29 0a 20 20 20 20 73 65 74 20 74 6f 6f  bar).    set too
2520: 6c 66 72 61 6d 65 20 24 70 61 74 68 2e 74 6f 70  lframe $path.top
2530: 66 2e 66 24 69 6e 64 65 78 0a 20 20 20 20 73 65  f.f$index.    se
2540: 74 20 74 6f 6f 6c 62 61 72 20 20 20 24 70 61 74  t toolbar   $pat
2550: 68 2e 74 6f 70 66 2e 74 62 24 69 6e 64 65 78 0a  h.topf.tb$index.
2560: 20 20 20 20 73 65 74 20 62 67 20 20 20 20 20 20      set bg      
2570: 20 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70    [Widget::getop
2580: 74 69 6f 6e 20 24 70 61 74 68 20 2d 62 61 63 6b  tion $path -back
2590: 67 72 6f 75 6e 64 5d 0a 20 20 20 20 69 66 20 7b  ground].    if {
25a0: 20 24 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70   $tcl_platform(p
25b0: 6c 61 74 66 6f 72 6d 29 20 3d 3d 20 22 75 6e 69  latform) == "uni
25c0: 78 22 20 7d 20 7b 0a 09 69 66 20 7b 20 5b 42 57  x" } {..if { [BW
25d0: 69 64 67 65 74 3a 3a 75 73 69 6e 67 20 74 74 6b  idget::using ttk
25e0: 5d 20 7d 20 7b 0a 09 20 20 20 20 74 74 6b 3a 3a  ] } {..    ttk::
25f0: 66 72 61 6d 65 20 24 74 6f 6f 6c 66 72 61 6d 65  frame $toolframe
2600: 20 2d 70 61 64 64 69 6e 67 20 31 20 2d 72 65 6c   -padding 1 -rel
2610: 69 65 66 20 72 61 69 73 65 64 20 2d 62 6f 72 64  ief raised -bord
2620: 65 72 77 69 64 74 68 20 31 0a 09 7d 20 65 6c 73  erwidth 1..} els
2630: 65 20 7b 0a 09 20 20 20 20 66 72 61 6d 65 20 24  e {..    frame $
2640: 74 6f 6f 6c 66 72 61 6d 65 20 2d 72 65 6c 69 65  toolframe -relie
2650: 66 20 72 61 69 73 65 64 20 2d 62 6f 72 64 65 72  f raised -border
2660: 77 69 64 74 68 20 31 20 5c 0a 09 09 2d 74 61 6b  width 1 \...-tak
2670: 65 66 6f 63 75 73 20 30 20 2d 68 69 67 68 6c 69  efocus 0 -highli
2680: 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30 20 2d  ghtthickness 0 -
2690: 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 0a 09  background $bg..
26a0: 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09  }.    } else {..
26b0: 69 66 20 7b 20 5b 42 57 69 64 67 65 74 3a 3a 75  if { [BWidget::u
26c0: 73 69 6e 67 20 74 74 6b 5d 20 7d 20 7b 0a 09 20  sing ttk] } {.. 
26d0: 20 20 20 74 74 6b 3a 3a 66 72 61 6d 65 20 24 74     ttk::frame $t
26e0: 6f 6f 6c 66 72 61 6d 65 0a 09 20 20 20 20 73 65  oolframe..    se
26f0: 74 20 73 65 70 20 5b 74 74 6b 3a 3a 73 65 70 61  t sep [ttk::sepa
2700: 72 61 74 6f 72 20 24 74 6f 6f 6c 66 72 61 6d 65  rator $toolframe
2710: 2e 73 65 70 20 2d 6f 72 69 65 6e 74 20 68 6f 72  .sep -orient hor
2720: 69 7a 6f 6e 74 61 6c 5d 0a 09 7d 20 65 6c 73 65  izontal]..} else
2730: 20 7b 0a 09 20 20 20 20 66 72 61 6d 65 20 24 74   {..    frame $t
2740: 6f 6f 6c 66 72 61 6d 65 20 2d 72 65 6c 69 65 66  oolframe -relief
2750: 20 66 6c 61 74 20 2d 62 6f 72 64 65 72 77 69 64   flat -borderwid
2760: 74 68 20 30 20 2d 74 61 6b 65 66 6f 63 75 73 20  th 0 -takefocus 
2770: 30 20 5c 0a 09 09 2d 68 69 67 68 6c 69 67 68 74  0 \...-highlight
2780: 74 68 69 63 6b 6e 65 73 73 20 30 20 2d 62 61 63  thickness 0 -bac
2790: 6b 67 72 6f 75 6e 64 20 24 62 67 0a 09 20 20 20  kground $bg..   
27a0: 20 73 65 74 20 73 65 70 20 5b 53 65 70 61 72 61   set sep [Separa
27b0: 74 6f 72 3a 3a 63 72 65 61 74 65 20 24 74 6f 6f  tor::create $too
27c0: 6c 66 72 61 6d 65 2e 73 65 70 20 2d 6f 72 69 65  lframe.sep -orie
27d0: 6e 74 20 68 6f 72 69 7a 6f 6e 74 61 6c 20 2d 62  nt horizontal -b
27e0: 61 63 6b 67 72 6f 75 6e 64 20 24 62 67 5d 0a 09  ackground $bg]..
27f0: 7d 0a 20 20 20 20 20 20 20 20 70 61 63 6b 20 24  }.        pack $
2800: 73 65 70 20 2d 66 69 6c 6c 20 78 0a 20 20 20 20  sep -fill x.    
2810: 7d 0a 20 20 20 20 69 66 20 7b 20 5b 42 57 69 64  }.    if { [BWid
2820: 67 65 74 3a 3a 75 73 69 6e 67 20 74 74 6b 5d 20  get::using ttk] 
2830: 7d 20 7b 0a 09 73 65 74 20 74 6f 6f 6c 62 61 72  } {..set toolbar
2840: 20 5b 74 74 6b 3a 3a 66 72 61 6d 65 20 24 74 6f   [ttk::frame $to
2850: 6f 6c 62 61 72 20 2d 70 61 64 64 69 6e 67 20 32  olbar -padding 2
2860: 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09  ].    } else {..
2870: 73 65 74 20 74 6f 6f 6c 62 61 72 20 5b 66 72 61  set toolbar [fra
2880: 6d 65 20 24 74 6f 6f 6c 62 61 72 20 2d 72 65 6c  me $toolbar -rel
2890: 69 65 66 20 66 6c 61 74 20 2d 62 6f 72 64 65 72  ief flat -border
28a0: 77 69 64 74 68 20 32 20 5c 0a 09 09 09 20 2d 74  width 2 \.... -t
28b0: 61 6b 65 66 6f 63 75 73 20 30 20 2d 68 69 67 68  akefocus 0 -high
28c0: 6c 69 67 68 74 74 68 69 63 6b 6e 65 73 73 20 30  lightthickness 0
28d0: 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 24 62 67   -background $bg
28e0: 5d 0a 20 20 20 20 7d 0a 20 20 20 20 70 61 63 6b  ].    }.    pack
28f0: 20 24 74 6f 6f 6c 62 61 72 20 2d 69 6e 20 24 74   $toolbar -in $t
2900: 6f 6f 6c 66 72 61 6d 65 20 2d 61 6e 63 68 6f 72  oolframe -anchor
2910: 20 77 20 2d 65 78 70 61 6e 64 20 79 65 73 20 2d   w -expand yes -
2920: 66 69 6c 6c 20 78 0a 20 20 20 20 69 6e 63 72 20  fill x.    incr 
2930: 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6e 74  _widget($path,nt
2940: 6f 6f 6c 62 61 72 29 0a 20 20 20 20 67 72 69 64  oolbar).    grid
2950: 20 24 74 6f 6f 6c 66 72 61 6d 65 20 2d 63 6f 6c   $toolframe -col
2960: 75 6d 6e 20 30 20 2d 72 6f 77 20 24 69 6e 64 65  umn 0 -row $inde
2970: 78 20 2d 73 74 69 63 6b 79 20 65 77 0a 20 20 20  x -sticky ew.   
2980: 20 72 65 74 75 72 6e 20 24 74 6f 6f 6c 62 61 72   return $toolbar
2990: 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  .}...# ---------
29a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
29b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
29c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
29d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
29e0: 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d  ---.#  Command M
29f0: 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74 74 6f 6f  ainFrame::gettoo
2a00: 6c 62 61 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  lbar.# ---------
2a10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2a20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2a30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2a40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2a50: 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61  ---.proc MainFra
2a60: 6d 65 3a 3a 67 65 74 74 6f 6f 6c 62 61 72 20 7b  me::gettoolbar {
2a70: 20 70 61 74 68 20 69 6e 64 65 78 20 7d 20 7b 0a   path index } {.
2a80: 20 20 20 20 72 65 74 75 72 6e 20 24 70 61 74 68      return $path
2a90: 2e 74 6f 70 66 2e 74 62 24 69 6e 64 65 78 0a 7d  .topf.tb$index.}
2aa0: 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ...# -----------
2ab0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ac0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ad0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ae0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2af0: 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69  -.#  Command Mai
2b00: 6e 46 72 61 6d 65 3a 3a 61 64 64 69 6e 64 69 63  nFrame::addindic
2b10: 61 74 6f 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  ator.# ---------
2b20: 2d 2d 2d 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 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61  ---.proc MainFra
2b70: 6d 65 3a 3a 61 64 64 69 6e 64 69 63 61 74 6f 72  me::addindicator
2b80: 20 7b 20 70 61 74 68 20 61 72 67 73 20 7d 20 7b   { path args } {
2b90: 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77  .    variable _w
2ba0: 69 64 67 65 74 0a 0a 20 20 20 20 69 66 20 7b 5b  idget..    if {[
2bb0: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 5b 57  string length [W
2bc0: 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e  idget::getoption
2bd0: 20 24 70 61 74 68 20 2d 73 74 61 74 75 73 62 61   $path -statusba
2be0: 72 66 6f 6e 74 5d 5d 7d 20 7b 0a 09 73 65 74 20  rfont]]} {..set 
2bf0: 73 62 66 6e 74 20 5b 6c 69 73 74 20 2d 66 6f 6e  sbfnt [list -fon
2c00: 74 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f 70  t [Widget::getop
2c10: 74 69 6f 6e 20 24 70 61 74 68 20 2d 73 74 61 74  tion $path -stat
2c20: 75 73 62 61 72 66 6f 6e 74 5d 5d 0a 20 20 20 20  usbarfont]].    
2c30: 7d 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 73 62  } else {..set sb
2c40: 66 6e 74 20 22 22 0a 20 20 20 20 7d 0a 0a 20 20  fnt "".    }..  
2c50: 20 20 73 65 74 20 69 6e 64 65 78 20 24 5f 77 69    set index $_wi
2c60: 64 67 65 74 28 24 70 61 74 68 2c 6e 69 6e 64 69  dget($path,nindi
2c70: 63 29 0a 20 20 20 20 73 65 74 20 69 6e 64 69 63  c).    set indic
2c80: 20 24 70 61 74 68 2e 73 74 61 74 75 73 2e 69 6e   $path.status.in
2c90: 64 66 2e 66 24 69 6e 64 65 78 0a 20 20 20 20 65  df.f$index.    e
2ca0: 76 61 6c 20 5b 6c 69 73 74 20 6c 61 62 65 6c 20  val [list label 
2cb0: 24 69 6e 64 69 63 5d 20 24 61 72 67 73 20 2d 72  $indic] $args -r
2cc0: 65 6c 69 65 66 20 73 75 6e 6b 65 6e 20 2d 62 6f  elief sunken -bo
2cd0: 72 64 65 72 77 69 64 74 68 20 31 20 5c 0a 20 20  rderwidth 1 \.  
2ce0: 20 20 20 20 20 20 2d 74 61 6b 65 66 6f 63 75 73        -takefocus
2cf0: 20 30 20 2d 68 69 67 68 6c 69 67 68 74 74 68 69   0 -highlightthi
2d00: 63 6b 6e 65 73 73 20 30 20 24 73 62 66 6e 74 0a  ckness 0 $sbfnt.
2d10: 0a 20 20 20 20 70 61 63 6b 20 24 69 6e 64 69 63  .    pack $indic
2d20: 20 2d 73 69 64 65 20 6c 65 66 74 20 2d 61 6e 63   -side left -anc
2d30: 68 6f 72 20 77 20 2d 70 61 64 78 20 32 20 2d 66  hor w -padx 2 -f
2d40: 69 6c 6c 20 79 20 2d 65 78 70 61 6e 64 20 31 0a  ill y -expand 1.
2d50: 0a 20 20 20 20 69 6e 63 72 20 5f 77 69 64 67 65  .    incr _widge
2d60: 74 28 24 70 61 74 68 2c 6e 69 6e 64 69 63 29 0a  t($path,nindic).
2d70: 0a 20 20 20 20 72 65 74 75 72 6e 20 24 69 6e 64  .    return $ind
2d80: 69 63 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d  ic.}...# -------
2d90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2da0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2db0: 2d 2d 2d 2d 2d 2d 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 0a 23 20 20 43 6f 6d 6d 61 6e 64  -----.#  Command
2de0: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74 69   MainFrame::geti
2df0: 6e 64 69 63 61 74 6f 72 0a 23 20 2d 2d 2d 2d 2d  ndicator.# -----
2e00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2e10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
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 0a 70 72 6f 63 20 4d 61 69  -------.proc Mai
2e50: 6e 46 72 61 6d 65 3a 3a 67 65 74 69 6e 64 69 63  nFrame::getindic
2e60: 61 74 6f 72 20 7b 20 70 61 74 68 20 69 6e 64 65  ator { path inde
2e70: 78 20 7d 20 7b 0a 20 20 20 20 72 65 74 75 72 6e  x } {.    return
2e80: 20 24 70 61 74 68 2e 73 74 61 74 75 73 2e 69 6e   $path.status.in
2e90: 64 66 2e 66 24 69 6e 64 65 78 0a 7d 0a 0a 0a 23  df.f$index.}...#
2ea0: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
2eb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ec0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ed0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ee0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20  -------------.# 
2ef0: 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61   Command MainFra
2f00: 6d 65 3a 3a 67 65 74 6d 65 6e 75 0a 23 20 2d 2d  me::getmenu.# --
2f10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2f20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2f30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2f40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2f50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20  ----------.proc 
2f60: 4d 61 69 6e 46 72 61 6d 65 3a 3a 67 65 74 6d 65  MainFrame::getme
2f70: 6e 75 20 7b 20 70 61 74 68 20 6d 65 6e 75 69 64  nu { path menuid
2f80: 20 7d 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c   } {.    variabl
2f90: 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 69  e _widget..    i
2fa0: 66 20 7b 20 5b 69 6e 66 6f 20 65 78 69 73 74 73  f { [info exists
2fb0: 20 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 6d   _widget($path,m
2fc0: 65 6e 75 69 64 2c 24 6d 65 6e 75 69 64 29 5d 20  enuid,$menuid)] 
2fd0: 7d 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75  } {.        retu
2fe0: 72 6e 20 24 5f 77 69 64 67 65 74 28 24 70 61 74  rn $_widget($pat
2ff0: 68 2c 6d 65 6e 75 69 64 2c 24 6d 65 6e 75 69 64  h,menuid,$menuid
3000: 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75  ).    }.    retu
3010: 72 6e 20 22 22 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d  rn "".}...# ----
3020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3050: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3060: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d  ---------.#  Com
3070: 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d 65 3a 3a  mand MainFrame::
3080: 73 65 74 6d 65 6e 75 73 74 61 74 65 0a 23 20 2d  setmenustate.# -
3090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
30a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
30b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
30c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
30d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f  ------------.pro
30e0: 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 73 65 74  c MainFrame::set
30f0: 6d 65 6e 75 73 74 61 74 65 20 7b 20 70 61 74 68  menustate { path
3100: 20 74 61 67 20 73 74 61 74 65 20 7d 20 7b 0a 20   tag state } {. 
3110: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64     variable _wid
3120: 67 65 74 0a 0a 20 20 20 20 23 20 53 65 74 20 6d  get..    # Set m
3130: 65 6e 75 73 74 61 74 65 20 74 6f 20 65 6e 61 62  enustate to enab
3140: 6c 65 64 20 77 68 65 6e 20 41 4c 4c 20 6f 66 20  led when ALL of 
3150: 69 74 73 20 74 61 67 73 20 61 72 65 20 65 6e 61  its tags are ena
3160: 62 6c 65 64 2e 0a 0a 20 20 20 20 23 20 46 69 72  bled...    # Fir
3170: 73 74 20 73 65 65 20 69 66 20 74 68 69 73 20 69  st see if this i
3180: 73 20 61 20 72 65 61 6c 20 74 61 67 0a 20 20 20  s a real tag.   
3190: 20 69 66 20 7b 20 5b 69 6e 66 6f 20 65 78 69 73   if { [info exis
31a0: 74 73 20 5f 77 69 64 67 65 74 28 24 70 61 74 68  ts _widget($path
31b0: 2c 74 61 67 73 74 61 74 65 2c 24 74 61 67 29 5d  ,tagstate,$tag)]
31c0: 20 7d 20 7b 0a 09 69 66 20 7b 20 21 5b 73 74 72   } {..if { ![str
31d0: 69 6e 67 20 65 71 75 61 6c 20 24 73 74 61 74 65  ing equal $state
31e0: 20 22 64 69 73 61 62 6c 65 64 22 5d 20 7d 20 7b   "disabled"] } {
31f0: 0a 09 20 20 20 20 73 65 74 20 5f 77 69 64 67 65  ..    set _widge
3200: 74 28 24 70 61 74 68 2c 74 61 67 73 74 61 74 65  t($path,tagstate
3210: 2c 24 74 61 67 29 20 31 0a 09 7d 20 65 6c 73 65  ,$tag) 1..} else
3220: 20 7b 0a 09 20 20 20 20 73 65 74 20 5f 77 69 64   {..    set _wid
3230: 67 65 74 28 24 70 61 74 68 2c 74 61 67 73 74 61  get($path,tagsta
3240: 74 65 2c 24 74 61 67 29 20 30 0a 09 7d 0a 09 66  te,$tag) 0..}..f
3250: 6f 72 65 61 63 68 20 7b 6d 65 6e 75 20 65 6e 74  oreach {menu ent
3260: 72 79 7d 20 24 5f 77 69 64 67 65 74 28 24 70 61  ry} $_widget($pa
3270: 74 68 2c 74 61 67 73 2c 24 74 61 67 29 20 7b 0a  th,tags,$tag) {.
3280: 09 20 20 20 20 73 65 74 20 65 78 70 72 65 73 73  .    set express
3290: 69 6f 6e 20 22 31 22 0a 09 20 20 20 20 66 6f 72  ion "1"..    for
32a0: 65 61 63 68 20 6d 65 6e 75 74 61 67 20 24 5f 77  each menutag $_w
32b0: 69 64 67 65 74 28 24 70 61 74 68 2c 6d 65 6e 75  idget($path,menu
32c0: 74 61 67 73 2c 5b 6c 69 73 74 20 24 6d 65 6e 75  tags,[list $menu
32d0: 20 24 65 6e 74 72 79 5d 29 20 7b 0a 09 09 61 70   $entry]) {...ap
32e0: 70 65 6e 64 20 65 78 70 72 65 73 73 69 6f 6e 20  pend expression 
32f0: 22 20 26 26 20 24 5f 77 69 64 67 65 74 28 24 70  " && $_widget($p
3300: 61 74 68 2c 74 61 67 73 74 61 74 65 2c 24 6d 65  ath,tagstate,$me
3310: 6e 75 74 61 67 29 22 0a 09 20 20 20 20 7d 0a 09  nutag)"..    }..
3320: 20 20 20 20 69 66 20 7b 20 5b 65 78 70 72 20 24      if { [expr $
3330: 65 78 70 72 65 73 73 69 6f 6e 5d 20 7d 20 7b 0a  expression] } {.
3340: 09 09 73 65 74 20 73 74 61 74 65 20 6e 6f 72 6d  ..set state norm
3350: 61 6c 0a 09 20 20 20 20 7d 20 65 6c 73 65 20 7b  al..    } else {
3360: 0a 09 09 73 65 74 20 73 74 61 74 65 20 64 69 73  ...set state dis
3370: 61 62 6c 65 64 0a 09 20 20 20 20 7d 0a 09 20 20  abled..    }..  
3380: 20 20 24 6d 65 6e 75 20 65 6e 74 72 79 63 6f 6e    $menu entrycon
3390: 66 69 67 75 72 65 20 24 65 6e 74 72 79 20 2d 73  figure $entry -s
33a0: 74 61 74 65 20 24 73 74 61 74 65 0a 09 7d 0a 20  tate $state..}. 
33b0: 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 0a     }.    return.
33c0: 7d 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  }..# -----------
33d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
33e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
33f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3400: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3410: 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 4d 61  --.#  Command Ma
3420: 69 6e 46 72 61 6d 65 3a 3a 67 65 74 6d 65 6e 75  inFrame::getmenu
3430: 73 74 61 74 65 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  state.# --------
3440: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3450: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3460: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3470: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3480: 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46  -----.proc MainF
3490: 72 61 6d 65 3a 3a 67 65 74 6d 65 6e 75 73 74 61  rame::getmenusta
34a0: 74 65 20 7b 20 70 61 74 68 20 74 61 67 20 7d 20  te { path tag } 
34b0: 7b 0a 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f  {.    variable _
34c0: 77 69 64 67 65 74 0a 0a 20 20 20 20 69 66 20 7b  widget..    if {
34d0: 24 5f 77 69 64 67 65 74 28 24 70 61 74 68 2c 74  $_widget($path,t
34e0: 61 67 73 74 61 74 65 2c 24 74 61 67 29 7d 20 7b  agstate,$tag)} {
34f0: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20  .        return 
3500: 6e 6f 72 6d 61 6c 0a 20 20 20 20 7d 20 65 6c 73  normal.    } els
3510: 65 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75  e {.        retu
3520: 72 6e 20 64 69 73 61 62 6c 65 64 0a 20 20 20 20  rn disabled.    
3530: 7d 0a 7d 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  }.}..# ---------
3540: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
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 0a 23 20 20 43 6f 6d 6d 61 6e 64 20  ----.#  Command 
3590: 4d 61 69 6e 46 72 61 6d 65 3a 3a 6d 65 6e 75 6f  MainFrame::menuo
35a0: 6e 6c 79 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  nly.# ----------
35b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 64 2d 2d 2d  ------------d---
35c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
35d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
35e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
35f0: 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61  ---.proc MainFra
3600: 6d 65 3a 3a 6d 65 6e 75 6f 6e 6c 79 20 7b 20 70  me::menuonly { p
3610: 61 74 68 20 7d 20 7b 0a 20 20 20 20 76 61 72 69  ath } {.    vari
3620: 61 62 6c 65 20 5f 77 69 64 67 65 74 0a 0a 20 20  able _widget..  
3630: 20 20 63 61 74 63 68 20 7b 70 61 63 6b 20 66 6f    catch {pack fo
3640: 72 67 65 74 20 24 70 61 74 68 2e 73 65 70 7d 0a  rget $path.sep}.
3650: 20 20 20 20 63 61 74 63 68 20 7b 70 61 63 6b 20      catch {pack 
3660: 66 6f 72 67 65 74 20 24 70 61 74 68 2e 62 6f 74  forget $path.bot
3670: 66 2e 73 65 70 7d 0a 20 20 20 20 63 61 74 63 68  f.sep}.    catch
3680: 20 7b 70 61 63 6b 20 66 6f 72 67 65 74 20 24 70   {pack forget $p
3690: 61 74 68 2e 66 72 61 6d 65 7d 0a 7d 0a 0a 23 20  ath.frame}.}..# 
36a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
36b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
36c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
36d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
36e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
36f0: 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61 6d  Command MainFram
3700: 65 3a 3a 73 68 6f 77 74 6f 6f 6c 62 61 72 0a 23  e::showtoolbar.#
3710: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
3720: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3730: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3740: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3750: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
3760: 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 73 68  oc MainFrame::sh
3770: 6f 77 74 6f 6f 6c 62 61 72 20 7b 20 70 61 74 68  owtoolbar { path
3780: 20 69 6e 64 65 78 20 62 6f 6f 6c 20 7d 20 7b 0a   index bool } {.
3790: 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69      variable _wi
37a0: 64 67 65 74 0a 0a 20 20 20 20 73 65 74 20 74 6f  dget..    set to
37b0: 6f 6c 66 72 61 6d 65 20 24 70 61 74 68 2e 74 6f  olframe $path.to
37c0: 70 66 2e 66 24 69 6e 64 65 78 0a 20 20 20 20 69  pf.f$index.    i
37d0: 66 20 7b 20 5b 77 69 6e 66 6f 20 65 78 69 73 74  f { [winfo exist
37e0: 73 20 24 74 6f 6f 6c 66 72 61 6d 65 5d 20 7d 20  s $toolframe] } 
37f0: 7b 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20 21  {.        if { !
3800: 24 62 6f 6f 6c 20 26 26 20 5b 6c 6c 65 6e 67 74  $bool && [llengt
3810: 68 20 5b 67 72 69 64 20 69 6e 66 6f 20 24 74 6f  h [grid info $to
3820: 6f 6c 66 72 61 6d 65 5d 5d 20 7d 20 7b 0a 20 20  olframe]] } {.  
3830: 20 20 20 20 20 20 20 20 20 20 67 72 69 64 20 66            grid f
3840: 6f 72 67 65 74 20 24 74 6f 6f 6c 66 72 61 6d 65  orget $toolframe
3850: 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 70 61  .            $pa
3860: 74 68 2e 74 6f 70 66 20 63 6f 6e 66 69 67 75 72  th.topf configur
3870: 65 20 2d 68 65 69 67 68 74 20 31 0a 20 20 20 20  e -height 1.    
3880: 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 20 24      } elseif { $
3890: 62 6f 6f 6c 20 26 26 20 21 5b 6c 6c 65 6e 67 74  bool && ![llengt
38a0: 68 20 5b 67 72 69 64 20 69 6e 66 6f 20 24 74 6f  h [grid info $to
38b0: 6f 6c 66 72 61 6d 65 5d 5d 20 7d 20 7b 0a 20 20  olframe]] } {.  
38c0: 20 20 20 20 20 20 20 20 20 20 67 72 69 64 20 24            grid $
38d0: 74 6f 6f 6c 66 72 61 6d 65 20 2d 63 6f 6c 75 6d  toolframe -colum
38e0: 6e 20 30 20 2d 72 6f 77 20 24 69 6e 64 65 78 20  n 0 -row $index 
38f0: 2d 73 74 69 63 6b 79 20 65 77 0a 20 20 20 20 20  -sticky ew.     
3900: 20 20 20 7d 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23     }.    }.}...#
3910: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
3920: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3930: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3940: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3950: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20  -------------.# 
3960: 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61   Command MainFra
3970: 6d 65 3a 3a 73 68 6f 77 73 74 61 74 75 73 62 61  me::showstatusba
3980: 72 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  r.# ------------
3990: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
39a0: 2d 2d 2d 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: 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61 6d 65 3a  .proc MainFrame:
39e0: 3a 73 68 6f 77 73 74 61 74 75 73 62 61 72 20 7b  :showstatusbar {
39f0: 20 70 61 74 68 20 6e 61 6d 65 20 7d 20 7b 0a 20   path name } {. 
3a00: 20 20 20 73 65 74 20 73 74 61 74 75 73 20 24 70     set status $p
3a10: 61 74 68 2e 73 74 61 74 75 73 0a 20 20 20 20 73  ath.status.    s
3a20: 65 74 20 62 6f 74 66 72 61 6d 65 20 24 70 61 74  et botframe $pat
3a30: 68 2e 62 6f 74 66 0a 20 20 20 20 69 66 20 7b 20  h.botf.    if { 
3a40: 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 24 6e  [string equal $n
3a50: 61 6d 65 20 22 6e 6f 6e 65 22 5d 20 7d 20 7b 0a  ame "none"] } {.
3a60: 20 20 20 20 20 20 20 20 70 61 63 6b 20 66 6f 72          pack for
3a70: 67 65 74 20 24 73 74 61 74 75 73 0a 20 20 20 20  get $status.    
3a80: 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20  } else {.       
3a90: 20 70 61 63 6b 20 24 73 74 61 74 75 73 20 2d 66   pack $status -f
3aa0: 69 6c 6c 20 78 20 2d 69 6e 20 24 62 6f 74 66 72  ill x -in $botfr
3ab0: 61 6d 65 20 2d 66 69 6c 6c 20 78 20 2d 70 61 64  ame -fill x -pad
3ac0: 79 20 32 0a 20 20 20 20 20 20 20 20 73 77 69 74  y 2.        swit
3ad0: 63 68 20 2d 2d 20 24 6e 61 6d 65 20 7b 0a 20 20  ch -- $name {.  
3ae0: 20 20 20 20 20 20 20 20 20 20 73 74 61 74 75 73            status
3af0: 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20   {.             
3b00: 20 20 20 63 61 74 63 68 20 7b 70 61 63 6b 20 66     catch {pack f
3b10: 6f 72 67 65 74 20 24 73 74 61 74 75 73 2e 70 72  orget $status.pr
3b20: 67 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d  g}.            }
3b30: 0a 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f  .            pro
3b40: 67 72 65 73 73 69 6f 6e 20 7b 0a 20 20 20 20 20  gression {.     
3b50: 20 20 20 20 20 20 20 20 20 20 20 70 61 63 6b 20             pack 
3b60: 24 73 74 61 74 75 73 2e 70 72 67 20 2d 69 6e 20  $status.prg -in 
3b70: 24 73 74 61 74 75 73 2e 70 72 67 66 0a 20 20 20  $status.prgf.   
3b80: 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20           }.     
3b90: 20 20 20 7d 0a 20 20 20 20 7d 0a 7d 0a 0a 0a 23     }.    }.}...#
3ba0: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 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 0a 23 20  -------------.# 
3bf0: 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72 61   Command MainFra
3c00: 6d 65 3a 3a 5f 64 65 73 74 72 6f 79 0a 23 20 2d  me::_destroy.# -
3c10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
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 0a 70 72 6f 63  -----------.proc
3c60: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 64 65 73   MainFrame::_des
3c70: 74 72 6f 79 20 7b 20 70 61 74 68 20 7d 20 7b 0a  troy { path } {.
3c80: 20 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69      variable _wi
3c90: 64 67 65 74 0a 0a 20 20 20 20 57 69 64 67 65 74  dget..    Widget
3ca0: 3a 3a 64 65 73 74 72 6f 79 20 24 70 61 74 68 0a  ::destroy $path.
3cb0: 20 20 20 20 63 61 74 63 68 20 7b 64 65 73 74 72      catch {destr
3cc0: 6f 79 20 5b 24 5f 77 69 64 67 65 74 28 24 70 61  oy [$_widget($pa
3cd0: 74 68 2c 74 6f 70 29 20 63 67 65 74 20 2d 6d 65  th,top) cget -me
3ce0: 6e 75 5d 7d 0a 20 20 20 20 24 5f 77 69 64 67 65  nu]}.    $_widge
3cf0: 74 28 24 70 61 74 68 2c 74 6f 70 29 20 63 6f 6e  t($path,top) con
3d00: 66 69 67 75 72 65 20 2d 6d 65 6e 75 20 7b 7d 0a  figure -menu {}.
3d10: 0a 20 20 20 20 23 20 55 6e 73 65 74 20 61 6c 6c  .    # Unset all
3d20: 20 6f 66 20 74 68 65 20 73 74 61 74 65 20 76 61   of the state va
3d30: 72 73 20 61 73 73 6f 63 69 61 74 65 64 20 77 69  rs associated wi
3d40: 74 68 20 74 68 69 73 20 6d 61 69 6e 20 66 72 61  th this main fra
3d50: 6d 65 2e 0a 20 20 20 20 66 6f 72 65 61 63 68 20  me..    foreach 
3d60: 69 6e 64 65 78 20 5b 61 72 72 61 79 20 6e 61 6d  index [array nam
3d70: 65 73 20 5f 77 69 64 67 65 74 20 24 70 61 74 68  es _widget $path
3d80: 2c 2a 5d 20 7b 0a 09 75 6e 73 65 74 20 5f 77 69  ,*] {..unset _wi
3d90: 64 67 65 74 28 24 69 6e 64 65 78 29 0a 20 20 20  dget($index).   
3da0: 20 7d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d   }.}...# -------
3db0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3dc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3de0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3df0: 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64  -----.#  Command
3e00: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 63 72 65   MainFrame::_cre
3e10: 61 74 65 5f 6d 65 6e 75 62 61 72 0a 23 20 2d 2d  ate_menubar.# --
3e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20  ----------.proc 
3e70: 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 63 72 65 61  MainFrame::_crea
3e80: 74 65 5f 6d 65 6e 75 62 61 72 20 7b 20 70 61 74  te_menubar { pat
3e90: 68 20 64 65 73 63 6d 65 6e 75 20 7d 20 7b 0a 20  h descmenu } {. 
3ea0: 20 20 20 76 61 72 69 61 62 6c 65 20 5f 77 69 64     variable _wid
3eb0: 67 65 74 0a 20 20 20 20 67 6c 6f 62 61 6c 20 20  get.    global  
3ec0: 20 20 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 0a 0a    tcl_platform..
3ed0: 20 20 20 20 73 65 74 20 74 6f 70 20 24 5f 77 69      set top $_wi
3ee0: 64 67 65 74 28 24 70 61 74 68 2c 74 6f 70 29 0a  dget($path,top).
3ef0: 0a 20 20 20 20 66 6f 72 65 61 63 68 20 7b 76 20  .    foreach {v 
3f00: 78 7d 20 7b 6d 62 66 6e 74 20 2d 6d 65 6e 75 62  x} {mbfnt -menub
3f10: 61 72 66 6f 6e 74 20 6d 65 66 6e 74 20 2d 6d 65  arfont mefnt -me
3f20: 6e 75 65 6e 74 72 79 66 6f 6e 74 7d 20 7b 0a 09  nuentryfont} {..
3f30: 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67  if {[string leng
3f40: 74 68 20 5b 57 69 64 67 65 74 3a 3a 67 65 74 6f  th [Widget::geto
3f50: 70 74 69 6f 6e 20 24 70 61 74 68 20 24 78 5d 5d  ption $path $x]]
3f60: 7d 20 7b 0a 09 20 20 20 20 73 65 74 20 24 76 20  } {..    set $v 
3f70: 5b 6c 69 73 74 20 2d 66 6f 6e 74 20 5b 57 69 64  [list -font [Wid
3f80: 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24  get::getoption $
3f90: 70 61 74 68 20 24 78 5d 5d 0a 09 7d 20 65 6c 73  path $x]]..} els
3fa0: 65 20 7b 0a 09 20 20 20 20 73 65 74 20 24 76 20  e {..    set $v 
3fb0: 22 22 0a 09 7d 0a 20 20 20 20 7d 0a 0a 20 20 20  ""..}.    }..   
3fc0: 20 69 66 20 7b 20 21 5b 42 57 69 64 67 65 74 3a   if { ![BWidget:
3fd0: 3a 75 73 69 6e 67 20 74 74 6b 5d 20 26 26 20 24  :using ttk] && $
3fe0: 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 70 6c 61  tcl_platform(pla
3ff0: 74 66 6f 72 6d 29 20 3d 3d 20 22 75 6e 69 78 22  tform) == "unix"
4000: 0a 20 20 20 20 20 20 20 20 26 26 20 5b 74 6b 20  .        && [tk 
4010: 77 69 6e 64 6f 77 69 6e 67 73 79 73 74 65 6d 5d  windowingsystem]
4020: 20 21 3d 22 61 71 75 61 22 20 7d 20 7b 0a 09 73   !="aqua" } {..s
4030: 65 74 20 6d 65 6e 75 6f 70 74 73 20 5b 6c 69 73  et menuopts [lis
4040: 74 20 2d 62 61 63 6b 67 72 6f 75 6e 64 20 5b 57  t -background [W
4050: 69 64 67 65 74 3a 3a 67 65 74 6f 70 74 69 6f 6e  idget::getoption
4060: 20 24 70 61 74 68 20 2d 62 61 63 6b 67 72 6f 75   $path -backgrou
4070: 6e 64 5d 20 5c 0a 09 09 09 20 20 2d 62 6f 72 64  nd] \....  -bord
4080: 65 72 77 69 64 74 68 20 31 5d 0a 20 20 20 20 7d  erwidth 1].    }
4090: 20 65 6c 73 65 20 7b 0a 09 73 65 74 20 6d 65 6e   else {..set men
40a0: 75 6f 70 74 73 20 5b 6c 69 73 74 5d 0a 20 20 20  uopts [list].   
40b0: 20 7d 0a 20 20 20 20 73 65 74 20 6d 65 6e 75 62   }.    set menub
40c0: 61 72 20 5b 65 76 61 6c 20 5b 6c 69 73 74 20 6d  ar [eval [list m
40d0: 65 6e 75 20 24 74 6f 70 2e 6d 65 6e 75 62 61 72  enu $top.menubar
40e0: 20 2d 74 65 61 72 6f 66 66 20 30 5d 20 24 6d 65   -tearoff 0] $me
40f0: 6e 75 6f 70 74 73 20 24 6d 62 66 6e 74 5d 0a 20  nuopts $mbfnt]. 
4100: 20 20 20 24 74 6f 70 20 63 6f 6e 66 69 67 75 72     $top configur
4110: 65 20 2d 6d 65 6e 75 20 24 6d 65 6e 75 62 61 72  e -menu $menubar
4120: 0a 0a 20 20 20 20 73 65 74 20 63 6f 75 6e 74 20  ..    set count 
4130: 30 0a 20 20 20 20 66 6f 72 65 61 63 68 20 7b 6e  0.    foreach {n
4140: 61 6d 65 20 74 61 67 73 20 6d 65 6e 75 69 64 20  ame tags menuid 
4150: 74 65 61 72 6f 66 66 20 65 6e 74 72 69 65 73 7d  tearoff entries}
4160: 20 24 64 65 73 63 6d 65 6e 75 20 7b 0a 20 20 20   $descmenu {.   
4170: 20 20 20 20 20 73 65 74 20 6f 70 74 20 20 5b 5f       set opt  [_
4180: 70 61 72 73 65 5f 6e 61 6d 65 20 24 6e 61 6d 65  parse_name $name
4190: 5d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73  ].        if {[s
41a0: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6d 65  tring length $me
41b0: 6e 75 69 64 5d 0a 09 20 20 20 20 26 26 20 21 5b  nuid]..    && ![
41c0: 69 6e 66 6f 20 65 78 69 73 74 73 20 5f 77 69 64  info exists _wid
41d0: 67 65 74 28 24 70 61 74 68 2c 6d 65 6e 75 69 64  get($path,menuid
41e0: 2c 24 6d 65 6e 75 69 64 29 5d 20 7d 20 7b 0a 20  ,$menuid)] } {. 
41f0: 20 20 20 20 20 20 20 20 20 20 20 23 20 6d 65 6e             # men
4200: 75 20 68 61 73 20 69 64 65 6e 74 69 66 69 65 72  u has identifier
4210: 0a 09 20 20 20 20 23 20 77 65 20 75 73 65 20 69  ..    # we use i
4220: 74 20 66 6f 72 20 69 74 73 20 70 61 74 68 6e 61  t for its pathna
4230: 6d 65 2c 20 74 6f 20 65 6e 61 62 6c 65 20 73 70  me, to enable sp
4240: 65 63 69 61 6c 20 6d 65 6e 75 20 65 6e 74 72 69  ecial menu entri
4250: 65 73 0a 09 20 20 20 20 23 20 28 68 65 6c 70 2c  es..    # (help,
4260: 20 73 79 73 74 65 6d 2c 20 2e 2e 2e 29 0a 09 20   system, ...).. 
4270: 20 20 20 73 65 74 20 6d 65 6e 75 20 24 6d 65 6e     set menu $men
4280: 75 62 61 72 2e 24 6d 65 6e 75 69 64 0a 20 20 20  ubar.$menuid.   
4290: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09 20       } else {.. 
42a0: 20 20 20 73 65 74 20 6d 65 6e 75 20 24 6d 65 6e     set menu $men
42b0: 75 62 61 72 2e 6d 65 6e 75 24 63 6f 75 6e 74 0a  ubar.menu$count.
42c0: 09 7d 0a 20 20 20 20 20 20 20 20 65 76 61 6c 20  .}.        eval 
42d0: 5b 6c 69 73 74 20 24 6d 65 6e 75 62 61 72 20 61  [list $menubar a
42e0: 64 64 20 63 61 73 63 61 64 65 5d 20 24 6f 70 74  dd cascade] $opt
42f0: 20 5b 6c 69 73 74 20 2d 6d 65 6e 75 20 24 6d 65   [list -menu $me
4300: 6e 75 5d 0a 20 20 20 20 20 20 20 20 65 76 61 6c  nu].        eval
4310: 20 5b 6c 69 73 74 20 6d 65 6e 75 20 24 6d 65 6e   [list menu $men
4320: 75 20 2d 74 65 61 72 6f 66 66 20 24 74 65 61 72  u -tearoff $tear
4330: 6f 66 66 5d 20 24 6d 65 6e 75 6f 70 74 73 20 24  off] $menuopts $
4340: 6d 65 66 6e 74 0a 20 20 20 20 20 20 20 20 66 6f  mefnt.        fo
4350: 72 65 61 63 68 20 74 61 67 20 24 74 61 67 73 20  reach tag $tags 
4360: 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c 61  {.            la
4370: 70 70 65 6e 64 20 5f 77 69 64 67 65 74 28 24 70  ppend _widget($p
4380: 61 74 68 2c 74 61 67 73 2c 24 74 61 67 29 20 24  ath,tags,$tag) $
4390: 6d 65 6e 75 62 61 72 20 24 63 6f 75 6e 74 0a 09  menubar $count..
43a0: 20 20 20 20 23 20 65 72 69 63 6d 40 73 63 72 69      # [email protected]
43b0: 70 74 69 63 73 3a 20 20 41 64 64 20 61 20 74 61  ptics:  Add a ta
43c0: 67 73 74 61 74 65 20 74 72 61 63 6b 65 72 0a 09  gstate tracker..
43d0: 20 20 20 20 69 66 20 7b 20 21 5b 69 6e 66 6f 20      if { ![info 
43e0: 65 78 69 73 74 73 20 5f 77 69 64 67 65 74 28 24  exists _widget($
43f0: 70 61 74 68 2c 74 61 67 73 74 61 74 65 2c 24 74  path,tagstate,$t
4400: 61 67 29 5d 20 7d 20 7b 0a 09 09 73 65 74 20 5f  ag)] } {...set _
4410: 77 69 64 67 65 74 28 24 70 61 74 68 2c 74 61 67  widget($path,tag
4420: 73 74 61 74 65 2c 24 74 61 67 29 20 31 0a 09 20  state,$tag) 1.. 
4430: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 7d 0a 09     }.        }..
4440: 23 20 65 72 69 63 6d 40 73 63 72 69 70 74 69 63  # [email protected]
4450: 73 3a 20 20 41 64 64 20 6d 61 70 70 69 6e 67 20  s:  Add mapping 
4460: 66 72 6f 6d 20 6d 65 6e 75 20 69 74 65 6d 73 20  from menu items 
4470: 74 6f 20 74 61 67 73 0a 09 73 65 74 20 5f 77 69  to tags..set _wi
4480: 64 67 65 74 28 24 70 61 74 68 2c 6d 65 6e 75 74  dget($path,menut
4490: 61 67 73 2c 5b 6c 69 73 74 20 24 6d 65 6e 75 62  ags,[list $menub
44a0: 61 72 20 24 63 6f 75 6e 74 5d 29 20 24 74 61 67  ar $count]) $tag
44b0: 73 0a 0a 20 20 20 20 20 20 20 20 69 66 20 7b 20  s..        if { 
44c0: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24  [string length $
44d0: 6d 65 6e 75 69 64 5d 20 7d 20 7b 0a 20 20 20 20  menuid] } {.    
44e0: 20 20 20 20 20 20 20 20 23 20 6d 65 6e 75 20 68          # menu h
44f0: 61 73 20 69 64 65 6e 74 69 66 69 65 72 0a 20 20  as identifier.  
4500: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 5f 77            set _w
4510: 69 64 67 65 74 28 24 70 61 74 68 2c 6d 65 6e 75  idget($path,menu
4520: 69 64 2c 24 6d 65 6e 75 69 64 29 20 24 6d 65 6e  id,$menuid) $men
4530: 75 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20  u.        }.    
4540: 20 20 20 20 5f 63 72 65 61 74 65 5f 65 6e 74 72      _create_entr
4550: 69 65 73 20 24 70 61 74 68 20 24 6d 65 6e 75 20  ies $path $menu 
4560: 24 6d 65 6e 75 6f 70 74 73 20 24 65 6e 74 72 69  $menuopts $entri
4570: 65 73 0a 20 20 20 20 20 20 20 20 69 6e 63 72 20  es.        incr 
4580: 63 6f 75 6e 74 0a 20 20 20 20 7d 0a 7d 0a 0a 0a  count.    }.}...
4590: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
45a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
45b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
45c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
45d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
45e0: 20 20 43 6f 6d 6d 61 6e 64 20 4d 61 69 6e 46 72    Command MainFr
45f0: 61 6d 65 3a 3a 5f 63 72 65 61 74 65 5f 65 6e 74  ame::_create_ent
4600: 72 69 65 73 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d  ries.# ---------
4610: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4620: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4630: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4640: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4650: 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e 46 72 61  ---.proc MainFra
4660: 6d 65 3a 3a 5f 63 72 65 61 74 65 5f 65 6e 74 72  me::_create_entr
4670: 69 65 73 20 7b 20 70 61 74 68 20 6d 65 6e 75 20  ies { path menu 
4680: 6d 65 6e 75 6f 70 74 73 20 65 6e 74 72 69 65 73  menuopts entries
4690: 20 7d 20 7b 0a 20 20 20 20 76 61 72 69 61 62 6c   } {.    variabl
46a0: 65 20 5f 77 69 64 67 65 74 0a 0a 20 20 20 20 73  e _widget..    s
46b0: 65 74 20 63 6f 75 6e 74 20 20 20 20 20 20 5b 24  et count      [$
46c0: 6d 65 6e 75 20 63 67 65 74 20 2d 74 65 61 72 6f  menu cget -tearo
46d0: 66 66 5d 0a 20 20 20 20 73 65 74 20 72 65 67 69  ff].    set regi
46e0: 73 74 65 72 65 64 20 30 0a 20 20 20 20 66 6f 72  stered 0.    for
46f0: 65 61 63 68 20 65 6e 74 72 79 20 24 65 6e 74 72  each entry $entr
4700: 69 65 73 20 7b 0a 20 20 20 20 20 20 20 20 73 65  ies {.        se
4710: 74 20 6c 65 6e 20 20 5b 6c 6c 65 6e 67 74 68 20  t len  [llength 
4720: 24 65 6e 74 72 79 5d 0a 20 20 20 20 20 20 20 20  $entry].        
4730: 73 65 74 20 74 79 70 65 20 5b 6c 69 6e 64 65 78  set type [lindex
4740: 20 24 65 6e 74 72 79 20 30 5d 0a 0a 20 20 20 20   $entry 0]..    
4750: 20 20 20 20 69 66 20 7b 20 5b 73 74 72 69 6e 67      if { [string
4760: 20 65 71 75 61 6c 20 24 74 79 70 65 20 22 73 65   equal $type "se
4770: 70 61 72 61 74 6f 72 22 5d 20 7d 20 7b 0a 20 20  parator"] } {.  
4780: 20 20 20 20 20 20 20 20 20 20 24 6d 65 6e 75 20            $menu 
4790: 61 64 64 20 73 65 70 61 72 61 74 6f 72 0a 20 20  add separator.  
47a0: 20 20 20 20 20 20 20 20 20 20 69 6e 63 72 20 63            incr c
47b0: 6f 75 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20  ount.           
47c0: 20 63 6f 6e 74 69 6e 75 65 0a 20 20 20 20 20 20   continue.      
47d0: 20 20 7d 0a 0a 20 20 20 20 20 20 20 20 23 20 65    }..        # e
47e0: 6e 74 72 79 20 6e 61 6d 65 20 61 6e 64 20 74 61  ntry name and ta
47f0: 67 73 0a 20 20 20 20 20 20 20 20 73 65 74 20 6f  gs.        set o
4800: 70 74 20 20 5b 5f 70 61 72 73 65 5f 6e 61 6d 65  pt  [_parse_name
4810: 20 5b 6c 69 6e 64 65 78 20 24 65 6e 74 72 79 20   [lindex $entry 
4820: 31 5d 5d 0a 20 20 20 20 20 20 20 20 73 65 74 20  1]].        set 
4830: 74 61 67 73 20 5b 6c 69 6e 64 65 78 20 24 65 6e  tags [lindex $en
4840: 74 72 79 20 32 5d 0a 20 20 20 20 20 20 20 20 66  try 2].        f
4850: 6f 72 65 61 63 68 20 74 61 67 20 24 74 61 67 73  oreach tag $tags
4860: 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c   {.            l
4870: 61 70 70 65 6e 64 20 5f 77 69 64 67 65 74 28 24  append _widget($
4880: 70 61 74 68 2c 74 61 67 73 2c 24 74 61 67 29 20  path,tags,$tag) 
4890: 24 6d 65 6e 75 20 24 63 6f 75 6e 74 0a 09 20 20  $menu $count..  
48a0: 20 20 23 20 65 72 69 63 6d 40 73 63 72 69 70 74    # [email protected]
48b0: 69 63 73 3a 20 20 41 64 64 20 61 20 74 61 67 73  ics:  Add a tags
48c0: 74 61 74 65 20 74 72 61 63 6b 65 72 0a 09 20 20  tate tracker..  
48d0: 20 20 69 66 20 7b 20 21 5b 69 6e 66 6f 20 65 78    if { ![info ex
48e0: 69 73 74 73 20 5f 77 69 64 67 65 74 28 24 70 61  ists _widget($pa
48f0: 74 68 2c 74 61 67 73 74 61 74 65 2c 24 74 61 67  th,tagstate,$tag
4900: 29 5d 20 7d 20 7b 0a 09 09 73 65 74 20 5f 77 69  )] } {...set _wi
4910: 64 67 65 74 28 24 70 61 74 68 2c 74 61 67 73 74  dget($path,tagst
4920: 61 74 65 2c 24 74 61 67 29 20 31 0a 09 20 20 20  ate,$tag) 1..   
4930: 20 7d 0a 20 20 20 20 20 20 20 20 7d 0a 09 23 20   }.        }..# 
4940: 65 72 69 63 6d 40 73 63 72 69 70 74 69 63 73 3a  [email protected]:
4950: 20 20 41 64 64 20 6d 61 70 70 69 6e 67 20 66 72    Add mapping fr
4960: 6f 6d 20 6d 65 6e 75 20 69 74 65 6d 73 20 74 6f  om menu items to
4970: 20 74 61 67 73 0a 09 73 65 74 20 5f 77 69 64 67   tags..set _widg
4980: 65 74 28 24 70 61 74 68 2c 6d 65 6e 75 74 61 67  et($path,menutag
4990: 73 2c 5b 6c 69 73 74 20 24 6d 65 6e 75 20 24 63  s,[list $menu $c
49a0: 6f 75 6e 74 5d 29 20 24 74 61 67 73 0a 0a 20 20  ount]) $tags..  
49b0: 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e        if {[strin
49c0: 67 20 65 71 75 61 6c 20 24 74 79 70 65 20 22 63  g equal $type "c
49d0: 61 73 63 61 64 65 22 5d 20 7c 7c 20 5b 73 74 72  ascade"] || [str
49e0: 69 6e 67 20 65 71 75 61 6c 20 24 74 79 70 65 20  ing equal $type 
49f0: 22 63 61 73 63 61 64 22 5d 7d 20 7b 0a 20 20 20  "cascad"]} {.   
4a00: 20 20 20 20 20 20 20 20 20 73 65 74 20 6d 65 6e           set men
4a10: 75 69 64 20 20 5b 6c 69 6e 64 65 78 20 24 65 6e  uid  [lindex $en
4a20: 74 72 79 20 33 5d 0a 20 20 20 20 20 20 20 20 20  try 3].         
4a30: 20 20 20 73 65 74 20 74 65 61 72 6f 66 66 20 5b     set tearoff [
4a40: 6c 69 6e 64 65 78 20 24 65 6e 74 72 79 20 34 5d  lindex $entry 4]
4a50: 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74  .            set
4a60: 20 73 75 62 6d 65 6e 75 20 24 6d 65 6e 75 2e 6d   submenu $menu.m
4a70: 65 6e 75 24 63 6f 75 6e 74 0a 20 20 20 20 20 20  enu$count.      
4a80: 20 20 20 20 20 20 65 76 61 6c 20 5b 6c 69 73 74        eval [list
4a90: 20 24 6d 65 6e 75 20 61 64 64 20 63 61 73 63 61   $menu add casca
4aa0: 64 65 5d 20 24 6f 70 74 20 5b 6c 69 73 74 20 2d  de] $opt [list -
4ab0: 6d 65 6e 75 20 24 73 75 62 6d 65 6e 75 5d 0a 20  menu $submenu]. 
4ac0: 20 20 20 20 20 20 20 20 20 20 20 65 76 61 6c 20             eval 
4ad0: 5b 6c 69 73 74 20 6d 65 6e 75 20 24 73 75 62 6d  [list menu $subm
4ae0: 65 6e 75 20 2d 74 65 61 72 6f 66 66 20 24 74 65  enu -tearoff $te
4af0: 61 72 6f 66 66 5d 20 24 6d 65 6e 75 6f 70 74 73  aroff] $menuopts
4b00: 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20  .            if 
4b10: 7b 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68  { [string length
4b20: 20 24 6d 65 6e 75 69 64 5d 20 7d 20 7b 0a 20 20   $menuid] } {.  
4b30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20                # 
4b40: 6d 65 6e 75 20 68 61 73 20 69 64 65 6e 74 69 66  menu has identif
4b50: 69 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20  ier.            
4b60: 20 20 20 20 73 65 74 20 5f 77 69 64 67 65 74 28      set _widget(
4b70: 24 70 61 74 68 2c 6d 65 6e 75 69 64 2c 24 6d 65  $path,menuid,$me
4b80: 6e 75 69 64 29 20 24 73 75 62 6d 65 6e 75 0a 20  nuid) $submenu. 
4b90: 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20             }.   
4ba0: 20 20 20 20 20 20 20 20 20 5f 63 72 65 61 74 65           _create
4bb0: 5f 65 6e 74 72 69 65 73 20 24 70 61 74 68 20 24  _entries $path $
4bc0: 73 75 62 6d 65 6e 75 20 24 6d 65 6e 75 6f 70 74  submenu $menuopt
4bd0: 73 20 5b 6c 69 6e 64 65 78 20 24 65 6e 74 72 79  s [lindex $entry
4be0: 20 35 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20   5].            
4bf0: 69 6e 63 72 20 63 6f 75 6e 74 0a 20 20 20 20 20  incr count.     
4c00: 20 20 20 20 20 20 20 63 6f 6e 74 69 6e 75 65 0a         continue.
4c10: 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20          }..     
4c20: 20 20 20 23 20 65 6e 74 72 79 20 68 65 6c 70 20     # entry help 
4c30: 64 65 73 63 72 69 70 74 69 6f 6e 0a 20 20 20 20  description.    
4c40: 20 20 20 20 73 65 74 20 64 65 73 63 20 5b 6c 69      set desc [li
4c50: 6e 64 65 78 20 24 65 6e 74 72 79 20 33 5d 0a 20  ndex $entry 3]. 
4c60: 20 20 20 20 20 20 20 69 66 20 7b 20 5b 73 74 72         if { [str
4c70: 69 6e 67 20 6c 65 6e 67 74 68 20 24 64 65 73 63  ing length $desc
4c80: 5d 20 7d 20 7b 0a 20 20 20 20 20 20 20 20 20 20  ] } {.          
4c90: 20 20 69 66 20 7b 20 21 24 72 65 67 69 73 74 65    if { !$registe
4ca0: 72 65 64 20 7d 20 7b 0a 20 20 20 20 20 20 20 20  red } {.        
4cb0: 20 20 20 20 20 20 20 20 44 79 6e 61 6d 69 63 48          DynamicH
4cc0: 65 6c 70 3a 3a 72 65 67 69 73 74 65 72 20 24 6d  elp::register $m
4cd0: 65 6e 75 20 6d 65 6e 75 20 5b 57 69 64 67 65 74  enu menu [Widget
4ce0: 3a 3a 67 65 74 6f 70 74 69 6f 6e 20 24 70 61 74  ::getoption $pat
4cf0: 68 20 2d 74 65 78 74 76 61 72 69 61 62 6c 65 5d  h -textvariable]
4d00: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .               
4d10: 20 73 65 74 20 72 65 67 69 73 74 65 72 65 64 20   set registered 
4d20: 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a  1.            }.
4d30: 20 20 20 20 20 20 20 20 20 20 20 20 44 79 6e 61              Dyna
4d40: 6d 69 63 48 65 6c 70 3a 3a 72 65 67 69 73 74 65  micHelp::registe
4d50: 72 20 24 6d 65 6e 75 20 6d 65 6e 75 65 6e 74 72  r $menu menuentr
4d60: 79 20 24 63 6f 75 6e 74 20 24 64 65 73 63 0a 20  y $count $desc. 
4d70: 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20         }..      
4d80: 20 20 23 20 65 6e 74 72 79 20 61 63 63 65 6c 65    # entry accele
4d90: 72 61 74 6f 72 0a 20 20 20 20 20 20 20 20 73 65  rator.        se
4da0: 74 20 61 63 63 65 6c 20 5b 5f 70 61 72 73 65 5f  t accel [_parse_
4db0: 61 63 63 65 6c 65 72 61 74 6f 72 20 5b 6c 69 6e  accelerator [lin
4dc0: 64 65 78 20 24 65 6e 74 72 79 20 34 5d 5d 0a 20  dex $entry 4]]. 
4dd0: 20 20 20 20 20 20 20 69 66 20 7b 20 5b 6c 6c 65         if { [lle
4de0: 6e 67 74 68 20 24 61 63 63 65 6c 5d 20 7d 20 7b  ngth $accel] } {
4df0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 70  .            lap
4e00: 70 65 6e 64 20 6f 70 74 20 2d 61 63 63 65 6c 65  pend opt -accele
4e10: 72 61 74 6f 72 20 5b 6c 69 6e 64 65 78 20 24 61  rator [lindex $a
4e20: 63 63 65 6c 20 30 5d 0a 20 20 20 20 20 20 20 20  ccel 0].        
4e30: 20 20 20 20 62 69 6e 64 20 24 5f 77 69 64 67 65      bind $_widge
4e40: 74 28 24 70 61 74 68 2c 74 6f 70 29 20 5b 6c 69  t($path,top) [li
4e50: 6e 64 65 78 20 24 61 63 63 65 6c 20 31 5d 20 5b  ndex $accel 1] [
4e60: 6c 69 73 74 20 24 6d 65 6e 75 20 69 6e 76 6f 6b  list $menu invok
4e70: 65 20 24 63 6f 75 6e 74 5d 0a 20 20 20 20 20 20  e $count].      
4e80: 20 20 7d 0a 0a 20 20 20 20 20 20 20 20 23 20 75    }..        # u
4e90: 73 65 72 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20  ser options.    
4ea0: 20 20 20 20 73 65 74 20 75 73 65 72 6f 70 74 20      set useropt 
4eb0: 5b 6c 72 61 6e 67 65 20 24 65 6e 74 72 79 20 35  [lrange $entry 5
4ec0: 20 65 6e 64 5d 0a 20 20 20 20 20 20 20 20 69 66   end].        if
4ed0: 20 7b 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c   { [string equal
4ee0: 20 24 74 79 70 65 20 22 63 6f 6d 6d 61 6e 64 22   $type "command"
4ef0: 5d 20 7c 7c 0a 20 20 20 20 20 20 20 20 20 20 20  ] ||.           
4f00: 20 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20    [string equal 
4f10: 24 74 79 70 65 20 22 72 61 64 69 6f 62 75 74 74  $type "radiobutt
4f20: 6f 6e 22 5d 20 7c 7c 0a 20 20 20 20 20 20 20 20  on"] ||.        
4f30: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 65 71 75       [string equ
4f40: 61 6c 20 24 74 79 70 65 20 22 63 68 65 63 6b 62  al $type "checkb
4f50: 75 74 74 6f 6e 22 5d 20 7d 20 7b 0a 20 20 20 20  utton"] } {.    
4f60: 20 20 20 20 20 20 20 20 65 76 61 6c 20 5b 6c 69          eval [li
4f70: 73 74 20 24 6d 65 6e 75 20 61 64 64 20 24 74 79  st $menu add $ty
4f80: 70 65 5d 20 24 6f 70 74 20 24 75 73 65 72 6f 70  pe] $opt $userop
4f90: 74 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65  t.        } else
4fa0: 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 72   {.            r
4fb0: 65 74 75 72 6e 20 2d 63 6f 64 65 20 65 72 72 6f  eturn -code erro
4fc0: 72 20 22 69 6e 76 61 6c 69 64 20 6d 65 6e 75 20  r "invalid menu 
4fd0: 74 79 70 65 20 5c 22 24 74 79 70 65 5c 22 22 0a  type \"$type\"".
4fe0: 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20          }.      
4ff0: 20 20 69 6e 63 72 20 63 6f 75 6e 74 0a 20 20 20    incr count.   
5000: 20 7d 0a 7d 0a 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d   }.}...# -------
5010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5050: 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64  -----.#  Command
5060: 20 4d 61 69 6e 46 72 61 6d 65 3a 3a 5f 70 61 72   MainFrame::_par
5070: 73 65 5f 6e 61 6d 65 0a 23 20 2d 2d 2d 2d 2d 2d  se_name.# ------
5080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
50a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
50b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
50c0: 2d 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 4d 61 69 6e  ------.proc Main
50d0: 46 72 61 6d 65 3a 3a 5f 70 61 72 73 65 5f 6e 61  Frame::_parse_na
50e0: 6d 65 20 7b 20 6d 65 6e 75 6e 61 6d 65 20 7d 20  me { menuname } 
50f0: 7b 0a 20 20 20 20 73 65 74 20 69 64 78 20 5b 73  {.    set idx [s
5100: 74 72 69 6e 67 20 66 69 72 73 74 20 22 26 22 20  tring first "&" 
5110: 24 6d 65 6e 75 6e 61 6d 65 5d 0a 20 20 20 20 69  $menuname].    i
5120: 66 20 7b 20 24 69 64 78 20 3d 3d 20 2d 31 20 7d  f { $idx == -1 }
5130: 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72   {.        retur
5140: 6e 20 5b 6c 69 73 74 20 2d 6c 61 62 65 6c 20 24  n [list -label $
5150: 6d 65 6e 75 6e 61 6d 65 5d 0a 20 20 20 20 7d 20  menuname].    } 
5160: 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 73  else {.        s
5170: 65 74 20 62 65 67 20 5b 73 74 72 69 6e 67 20 72  et beg [string r
5180: 61 6e 67 65 20 24 6d 65 6e 75 6e 61 6d 65 20 30  ange $menuname 0
5190: 20 5b 65 78 70 72 20 7b 24 69 64 78 2d 31 7d 5d   [expr {$idx-1}]
51a0: 5d 0a 20 20 20 20 20 20 20 20 73 65 74 20 65 6e  ].        set en
51b0: 64 20 5b 73 74 72 69 6e 67 20 72 61 6e 67 65 20  d [string range 
51c0: 24 6d 65 6e 75 6e 61 6d 65 20 5b 65 78 70 72 20  $menuname [expr 
51d0: 7b 24 69 64 78 2b 31 7d 5d 20 65 6e 64 5d 0a 20  {$idx+1}] end]. 
51e0: 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 62 65         append be
51f0: 67 20 24 65 6e 64 0a 20 20 20 20 20 20 20 20 72  g $end.        r
5200: 65 74 75 72 6e 20 5b 6c 69 73 74 20 2d 6c 61 62  eturn [list -lab
5210: 65 6c 20 24 62 65 67 20 2d 75 6e 64 65 72 6c 69  el $beg -underli
5220: 6e 65 20 24 69 64 78 5d 0a 20 20 20 20 7d 0a 7d  ne $idx].    }.}
5230: 0a 0a 0a 23 20 4d 61 69 6e 46 72 61 6d 65 3a 3a  ...# MainFrame::
5240: 5f 70 61 72 73 65 5f 61 63 63 65 6c 65 72 61 74  _parse_accelerat
5250: 6f 72 20 2d 2d 0a 23 0a 23 09 47 69 76 65 6e 20  or --.#.#.Given 
5260: 61 20 6b 65 79 20 63 6f 6d 62 6f 20 64 65 73 63  a key combo desc
5270: 72 69 70 74 69 6f 6e 2c 20 63 6f 6e 73 74 72 75  ription, constru
5280: 63 74 20 61 6e 20 61 70 70 72 6f 70 72 69 61 74  ct an appropriat
5290: 65 20 68 75 6d 61 6e 20 72 65 61 64 61 62 6c 65  e human readable
52a0: 0a 23 09 73 74 72 69 6e 67 20 28 66 6f 72 20 64  .#.string (for d
52b0: 69 73 70 6c 61 79 20 6f 6e 20 61 73 20 61 20 6d  isplay on as a m
52c0: 65 6e 75 20 61 63 63 65 6c 65 72 61 74 6f 72 29  enu accelerator)
52d0: 20 61 6e 64 20 74 68 65 20 63 6f 72 72 65 73 70   and the corresp
52e0: 6f 6e 64 69 6e 67 0a 23 09 62 69 6e 64 20 65 76  onding.#.bind ev
52f0: 65 6e 74 2e 0a 23 0a 23 20 41 72 67 75 6d 65 6e  ent..#.# Argumen
5300: 74 73 3a 0a 23 09 64 65 73 63 09 61 20 6c 69 73  ts:.#.desc.a lis
5310: 74 20 77 69 74 68 20 74 68 65 20 66 6f 6c 6c 6f  t with the follo
5320: 77 69 6e 67 20 66 6f 72 6d 61 74 3a 0a 23 09 09  wing format:.#..
5330: 09 3f 73 65 71 75 65 6e 63 65 3f 20 6b 65 79 0a  .?sequence? key.
5340: 23 09 09 73 65 71 75 65 6e 63 65 20 6d 61 79 20  #..sequence may 
5350: 62 65 20 4e 6f 6e 65 2c 20 43 74 72 6c 2c 20 41  be None, Ctrl, A
5360: 6c 74 2c 20 6f 72 20 43 74 72 6c 41 6c 74 0a 23  lt, or CtrlAlt.#
5370: 09 09 6b 65 79 20 6d 61 79 20 62 65 20 61 6e 79  ..key may be any
5380: 20 6b 65 79 0a 23 0a 23 20 52 65 73 75 6c 74 73   key.#.# Results
5390: 3a 0a 23 09 7b 61 63 63 65 6c 20 65 76 65 6e 74  :.#.{accel event
53a0: 7d 09 61 20 6c 69 73 74 20 63 6f 6e 74 61 69 6e  }.a list contain
53b0: 69 6e 67 20 74 68 65 20 61 63 63 65 6c 65 72 61  ing the accelera
53c0: 74 6f 72 20 73 74 72 69 6e 67 20 61 6e 64 20 74  tor string and t
53d0: 68 65 20 65 76 65 6e 74 0a 0a 70 72 6f 63 20 4d  he event..proc M
53e0: 61 69 6e 46 72 61 6d 65 3a 3a 5f 70 61 72 73 65  ainFrame::_parse
53f0: 5f 61 63 63 65 6c 65 72 61 74 6f 72 20 7b 20 64  _accelerator { d
5400: 65 73 63 20 7d 20 7b 0a 20 20 20 20 69 66 20 7b  esc } {.    if {
5410: 20 5b 6c 6c 65 6e 67 74 68 20 24 64 65 73 63 5d   [llength $desc]
5420: 20 3d 3d 20 31 20 7d 20 7b 0a 09 73 65 74 20 73   == 1 } {..set s
5430: 65 71 20 4e 6f 6e 65 0a 09 73 65 74 20 6b 65 79  eq None..set key
5440: 20 5b 73 74 72 69 6e 67 20 74 6f 6c 6f 77 65 72   [string tolower
5450: 20 5b 6c 69 6e 64 65 78 20 24 64 65 73 63 20 30   [lindex $desc 0
5460: 5d 5d 0a 09 23 20 49 66 20 74 68 65 20 6b 65 79  ]]..# If the key
5470: 20 69 73 20 61 6e 20 46 20 6b 65 79 20 28 69 65   is an F key (ie
5480: 2c 20 46 31 2c 20 46 32 2c 20 65 74 63 29 2c 20  , F1, F2, etc), 
5490: 69 74 20 68 61 73 20 74 6f 20 62 65 20 63 61 70  it has to be cap
54a0: 69 74 61 6c 69 7a 65 64 0a 09 69 66 20 7b 5b 72  italized..if {[r
54b0: 65 67 65 78 70 20 7b 5e 66 28 5b 31 2d 39 5d 7c  egexp {^f([1-9]|
54c0: 28 5b 31 32 5d 5b 30 2d 39 5d 7c 33 5b 30 2d 35  ([12][0-9]|3[0-5
54d0: 5d 29 29 24 7d 20 24 6b 65 79 5d 7d 20 7b 0a 09  ]))$} $key]} {..
54e0: 20 20 20 20 73 65 74 20 6b 65 79 20 5b 73 74 72      set key [str
54f0: 69 6e 67 20 74 6f 75 70 70 65 72 20 24 6b 65 79  ing toupper $key
5500: 5d 0a 09 7d 0a 20 20 20 20 7d 20 65 6c 73 65 69  ]..}.    } elsei
5510: 66 20 7b 20 5b 6c 6c 65 6e 67 74 68 20 24 64 65  f { [llength $de
5520: 73 63 5d 20 3d 3d 20 32 20 7d 20 7b 0a 20 20 20  sc] == 2 } {.   
5530: 20 20 20 20 20 73 65 74 20 73 65 71 20 5b 6c 69       set seq [li
5540: 6e 64 65 78 20 24 64 65 73 63 20 30 5d 0a 20 20  ndex $desc 0].  
5550: 20 20 20 20 20 20 73 65 74 20 6b 65 79 20 5b 73        set key [s
5560: 74 72 69 6e 67 20 74 6f 6c 6f 77 65 72 20 5b 6c  tring tolower [l
5570: 69 6e 64 65 78 20 24 64 65 73 63 20 31 5d 5d 0a  index $desc 1]].
5580: 09 23 20 49 66 20 74 68 65 20 6b 65 79 20 69 73  .# If the key is
5590: 20 61 6e 20 46 20 6b 65 79 20 28 69 65 2c 20 46   an F key (ie, F
55a0: 31 2c 20 46 32 2c 20 65 74 63 29 2c 20 69 74 20  1, F2, etc), it 
55b0: 68 61 73 20 74 6f 20 62 65 20 63 61 70 69 74 61  has to be capita
55c0: 6c 69 7a 65 64 0a 09 69 66 20 7b 5b 72 65 67 65  lized..if {[rege
55d0: 78 70 20 7b 5e 66 28 5b 31 2d 39 5d 7c 28 5b 31  xp {^f([1-9]|([1
55e0: 32 5d 5b 30 2d 39 5d 7c 33 5b 30 2d 35 5d 29 29  2][0-9]|3[0-5]))
55f0: 24 7d 20 24 6b 65 79 5d 7d 20 7b 0a 09 20 20 20  $} $key]} {..   
5600: 20 73 65 74 20 6b 65 79 20 5b 73 74 72 69 6e 67   set key [string
5610: 20 74 6f 75 70 70 65 72 20 24 6b 65 79 5d 0a 09   toupper $key]..
5620: 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 09  }.    } else {..
5630: 72 65 74 75 72 6e 20 7b 7d 0a 20 20 20 20 7d 0a  return {}.    }.
5640: 20 20 20 20 73 77 69 74 63 68 20 2d 2d 20 24 73      switch -- $s
5650: 65 71 20 7b 0a 09 4e 6f 6e 65 20 7b 0a 09 20 20  eq {..None {..  
5660: 20 20 73 65 74 20 61 63 63 65 6c 20 22 5b 73 74    set accel "[st
5670: 72 69 6e 67 20 74 6f 75 70 70 65 72 20 24 6b 65  ring toupper $ke
5680: 79 5d 22 0a 09 20 20 20 20 73 65 74 20 65 76 65  y]"..    set eve
5690: 6e 74 20 22 3c 4b 65 79 2d 24 6b 65 79 3e 22 0a  nt "<Key-$key>".
56a0: 09 7d 0a 09 43 74 72 6c 20 7b 0a 09 20 20 20 20  .}..Ctrl {..    
56b0: 73 65 74 20 61 63 63 65 6c 20 22 43 74 72 6c 2b  set accel "Ctrl+
56c0: 5b 73 74 72 69 6e 67 20 74 6f 75 70 70 65 72 20  [string toupper 
56d0: 24 6b 65 79 5d 22 0a 09 20 20 20 20 73 65 74 20  $key]"..    set 
56e0: 65 76 65 6e 74 20 22 3c 43 6f 6e 74 72 6f 6c 2d  event "<Control-
56f0: 4b 65 79 2d 24 6b 65 79 3e 22 0a 09 7d 0a 09 41  Key-$key>"..}..A
5700: 6c 74 20 7b 0a 09 20 20 20 20 73 65 74 20 61 63  lt {..    set ac
5710: 63 65 6c 20 22 41 6c 74 2b 5b 73 74 72 69 6e 67  cel "Alt+[string
5720: 20 74 6f 75 70 70 65 72 20 24 6b 65 79 5d 22 0a   toupper $key]".
5730: 09 20 20 20 20 73 65 74 20 65 76 65 6e 74 20 22  .    set event "
5740: 3c 41 6c 74 2d 4b 65 79 2d 24 6b 65 79 3e 22 0a  <Alt-Key-$key>".
5750: 09 7d 0a 09 43 74 72 6c 41 6c 74 20 7b 0a 09 20  .}..CtrlAlt {.. 
5760: 20 20 20 73 65 74 20 61 63 63 65 6c 20 22 43 74     set accel "Ct
5770: 72 6c 2b 41 6c 74 2b 5b 73 74 72 69 6e 67 20 74  rl+Alt+[string t
5780: 6f 75 70 70 65 72 20 24 6b 65 79 5d 22 0a 09 20  oupper $key]".. 
5790: 20 20 20 73 65 74 20 65 76 65 6e 74 20 22 3c 43     set event "<C
57a0: 6f 6e 74 72 6f 6c 2d 41 6c 74 2d 4b 65 79 2d 24  ontrol-Alt-Key-$
57b0: 6b 65 79 3e 22 0a 09 7d 0a 09 64 65 66 61 75 6c  key>"..}..defaul
57c0: 74 20 7b 0a 09 20 20 20 20 72 65 74 75 72 6e 20  t {..    return 
57d0: 2d 63 6f 64 65 20 65 72 72 6f 72 20 22 69 6e 76  -code error "inv
57e0: 61 6c 69 64 20 61 63 63 65 6c 65 72 61 74 6f 72  alid accelerator
57f0: 20 63 6f 64 65 20 24 73 65 71 22 0a 09 7d 0a 20   code $seq"..}. 
5800: 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20     }.    return 
5810: 5b 6c 69 73 74 20 24 61 63 63 65 6c 20 24 65 76  [list $accel $ev
5820: 65 6e 74 5d 0a 7d 0a                             ent].}.