home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM B4 / PD-ROM B4.iso / Utilities / Text and Speech / Alpha 5.3 / Tcl / SystemCode / flags.tcl < prev    next >
Encoding:
Text File  |  1993-01-30  |  3.3 KB  |  151 lines  |  [TEXT/ALFA]

  1. # The following three procs, together w/ the initialization 
  2. # for the flags below, allow a totally Tcl-controlled menu to 
  3. # shadow Alpha's internal variables.
  4. proc initFlag var {
  5.     global $var
  6.     addMenuItem -m Flags $var
  7.     trace vdelete $var w shadowFlag
  8.     shadowVar $var
  9.     markMenuItem Flags $var [expr ([set $var])?"on":"off"]
  10.     trace variable $var w shadowFlag
  11. }
  12.  
  13. # Called for ordinary tcl global vars we want included in the Flags menu.
  14. proc initTclFlag flag {
  15.     global $flag
  16.     addMenuItem -m Flags $flag
  17.     if {![info exists $flag]} {set $flag 0}
  18.     markMenuItem Flags $flag [expr ([set $flag])?"on":"off"]
  19.     trace variable $flag w shadowFlag
  20. }
  21.  
  22. # Called for ordinary tcl global vars we want included in the Vars menu.
  23. proc initTclVar var {
  24.     global $var
  25.     addMenuItem -m Vars $var
  26.     if {![info exists $var]} {set $var 0}
  27. }
  28.  
  29. proc shadowFlag {nm1 nm2 op} {
  30.     global $nm1
  31.     markMenuItem Flags $nm1 [expr [set $nm1]?"on":"off"]
  32. }
  33.  
  34. # 'fullNames' needs to be traced to update win menu.
  35. if {![info exists oldFNames]} {set oldFNames 0}
  36. proc shadowFullNames args {
  37.     global winNameToNum
  38.     global fullNames
  39.     global oldFNames
  40.     
  41.     if {$fullNames == $oldFNames} {return $fullNames}
  42.     set oldFNames $fullNames
  43.     
  44.     if {[catch {set nms [array names winNameToNum]}] == "1"} {
  45.         return $fullNames
  46.     }
  47.     
  48.     if {$fullNames == "1"} {
  49.         foreach name $nms {
  50.             if {$winNameToNum($name) < 10} {
  51.                 set lab /$winNameToNum($name)
  52.             } else {set lab ""}
  53.             regexp {[^:]*$} $name nm
  54.             catch {deleteMenuItem -m Wins $nm}
  55.             addMenuItem -m -l $lab Wins $name
  56.         }
  57.     } else {
  58.         foreach name $nms {
  59.             if {$winNameToNum($name) < 10} {
  60.                 set lab /$winNameToNum($name)
  61.             } else {set lab ""}
  62.             regexp {[^:]*$} $name nm
  63.             catch {deleteMenuItem -m Wins $name}
  64.             addMenuItem -m -l $lab Wins $nm
  65.         }
  66.     }
  67.     return $fullNames
  68. }
  69.  
  70. proc initVar var {
  71.     global $var
  72.     shadowVar $var
  73.     addMenuItem -m Vars $var
  74. }
  75.  
  76. # Keep 'currFileSet' up to date.
  77. trace vdelete currFileSet w shadowCurrFileSet
  78. trace variable currFileSet w shadowCurrFileSet
  79. proc shadowCurrFileSet {nm1 nm2 op} {
  80.     global fileSetNames
  81.     global currFileSet
  82.     foreach name $fileSetNames {
  83.         if {$name == $currFileSet} {
  84.             markMenuItem fileSets $name on
  85.         } else {
  86.             markMenuItem fileSets $name off
  87.         }
  88.     }
  89.     return $currFileSet
  90. }
  91.  
  92.  
  93. # This file contains methods allowing the shadowing of tcl variables 
  94.  
  95. initFlag autoSave
  96. initFlag backup
  97. initFlag backupFolder
  98. initFlag bwWindows
  99. initFlag elecLBrace
  100. initFlag elecRBrace
  101. initFlag electricSemi
  102. initFlag fullNames
  103. trace vdelete fullNames w shadowFullNames
  104. trace variable fullNames w shadowFullNames
  105. initFlag fullScreen
  106. initTclFlag iconifyOnSwitch
  107. initFlag indentOnCR
  108. initFlag moveInsertion
  109. initFlag openAllFiles
  110. initFlag optionIsMeta
  111. initFlag posActivate
  112. initFlag powerThumb
  113. initFlag showRowCol
  114. initFlag showMenuHeads
  115. initFlag sortedIsDefault
  116. initFlag suppressHeader
  117. initFlag tempMem
  118. initFlag undoOn
  119. initFlag wordWrap
  120.  
  121. initVar backExtension
  122. initVar backupFolderName
  123. initVar bottomMargin
  124. initVar changesLim
  125. initVar defHeight
  126. initVar defWidth
  127. initVar defaultFont
  128. initVar fillColumn
  129. initVar fontSaving
  130. initVar fontSize
  131. initVar funcExpr
  132. initVar funcPar
  133. initVar funcTitle
  134. initVar leftFillColumn
  135. initVar leftMargin
  136. initVar markLabel
  137. initVar markSorting
  138. initVar numWinsToTile
  139. initVar paraColumn
  140. initVar    printerFont
  141. initVar replaceStr
  142. initVar savedState
  143. initVar searchStr
  144. initVar sortColumn
  145. initVar tabSize
  146. initVar tagFile
  147. initVar topMargin
  148. initVar wordBreak
  149. initVar wordBreakPreface
  150.  
  151.