home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / tcl / xf2.3-p / xf2 / xf2.3 / src / xfmodules.tcl < prev    next >
Encoding:
Text File  |  1993-11-20  |  19.1 KB  |  619 lines

  1. # Program: xf
  2. # Description: specify module structure
  3. #
  4. # $Header: xfmodules.tcl[2.4] Wed Mar 10 12:07:07 1993 garfield@garfield frozen $
  5.  
  6. ##########
  7. # Procedure: XFModules
  8. # Description: specify module strucrure
  9. # Arguments: none
  10. # Returns: none
  11. # Sideeffects: none
  12. ##########
  13. proc XFModules {} {
  14.   global moduleList
  15.   global xfStatus
  16.  
  17.   XFMiscUpdateModuleList
  18.  
  19.   # build widget structure
  20.   XFTmpltToplevel .xfModules 540x420 \
  21.    "XF module structure"
  22.  
  23.   label .xfModules.message1 \
  24.     -relief raised \
  25.     -text "Module structure:"
  26.  
  27.   XFTmpltFrame .xfModules.frame1 0
  28.  
  29.   button .xfModules.frame1.ok \
  30.     -text {OK} \
  31.     -command {destroy .xfModules}
  32.  
  33.   button .xfModules.frame1.save \
  34.     -text {Save} \
  35.     -command {
  36.       global xfPath
  37.       global xfStatus
  38.       if {$xfStatus(handleTemplates)} {
  39.         foreach xfCounter $xfStatus(tmpltList) {
  40.           if {![catch "winfo class $xfCounter"]} {
  41.             XFEditSetStatus "Creating template..."
  42.             XFSaveSubTree $xfCounter $xfPath(tmp)/tb$xfStatus(uniqueId)
  43.             XFEditSetStatus "Creating template...done"
  44.           }
  45.         }
  46.         XFSaveProcsTmplt
  47.         XFProcEditSaveCutAsTemplate tb
  48.       } {
  49.         XFProcFileSave
  50.       }}
  51.  
  52.   checkbutton .xfModules.frame1.tmplt \
  53.     -text {Handle Templates} \
  54.     -variable xfStatus(handleTemplates) \
  55.     -command {
  56.       global xfStatus
  57.       XFModulesReadProcs
  58.       XFModulesReadTree
  59.       XFModulesReadModules
  60.       XFModulesReadContents
  61.       if {$xfStatus(handleTemplates)} {
  62.         .xfModules.frame2.toplevels.toplevelsMess configure \
  63.           -text Widgets:
  64.       } {
  65.         .xfModules.frame2.toplevels.toplevelsMess configure \
  66.           -text Toplevels:
  67.       }}
  68.  
  69.   button .xfModules.frame1.rescan \
  70.     -text {Rescan} \
  71.     -command {
  72.       XFModulesReadProcs
  73.       XFModulesReadTree
  74.       XFModulesReadModules
  75.       XFModulesReadContents}
  76.  
  77.   XFTmpltFrame .xfModules.frame3 0
  78.  
  79.   button .xfModules.frame3.insert \
  80.     -text {Add module} \
  81.     -command {
  82.       global autoLoadList
  83.       global moduleList
  84.       global xfSaveModuleList
  85.       global xfStatus
  86.       set xfModName [lindex [.xfModules.modname.modname get] 0]
  87.       if {"$xfModName" != ""} {
  88.         catch "set {moduleList($xfModName)} \"\""
  89.         catch "set {autoLoadList($xfModName)} 0"
  90.         if {[llength $xfSaveModuleList] > 0} {
  91.           if {[lsearch $xfSaveModuleList $xfModName] == -1} {
  92.             lappend xfSaveModuleList $xfModName
  93.             set xfStatus(saveModuleList) 1
  94.           }
  95.         }
  96.         XFModulesReadModules
  97.         XFModulesReadContents
  98.       }}
  99.  
  100.   button .xfModules.frame3.erase \
  101.     -text {Remove module} \
  102.     -command {
  103.       global autoLoadList
  104.       global moduleList
  105.       global xfSaveModuleList
  106.       set xfModName [lindex [.xfModules.modname.modname get] 0]
  107.       if {"$xfModName" != ""} {
  108.         catch "unset {moduleList($xfModName)}"
  109.         catch "unset {autoLoadList($xfModName)}"
  110.         if {[llength $xfSaveModuleList] > 0} {
  111.           set xfTmpIndex [lsearch $xfSaveModuleList $xfModName]
  112.           if {$xfTmpIndex != -1} {
  113.             set xfSaveModuleList [lreplace $xfSaveModuleList $xfTmpIndex $xfTmpIndex]
  114.           }
  115.         }
  116.         XFModulesReadModules      
  117.         XFModulesReadContents
  118.       }}
  119.  
  120.   button .xfModules.frame3.erase2 \
  121.     -text {Delete element} \
  122.     -command {
  123.       set xfCurSelect [.xfModules.frame2.contents.contents curselect]
  124.       if {$xfCurSelect >= 0} {
  125.         XFModulesRemoveFromModule \
  126.           [.xfModules.frame2.contents.contents get $xfCurSelect]
  127.       }}
  128.  
  129.   XFTmpltLabledEntry .xfModules modname "Module name:"
  130.  
  131.   checkbutton .xfModules.modname.save \
  132.     -text {Save module} \
  133.     -variable xfStatus(saveModuleList) \
  134.     -command {
  135.       global moduleList
  136.       global xfConf
  137.       global xfSaveModuleList
  138.       global xfStatus
  139.       set xfModName [.xfModules.modname.modname get]
  140.       if {[llength $xfSaveModuleList] == 0} {
  141.         foreach xfCounter [array names moduleList] {
  142.           lappend xfSaveModuleList $xfCounter
  143.         }
  144.         if {[lsearch $xfSaveModuleList $xfConf(programName)] == -1} {
  145.           lappend xfSaveModuleList $xfConf(programName)
  146.         }
  147.       }
  148.       if {$xfStatus(saveModuleList)} {
  149.         if {[lsearch $xfSaveModuleList $xfModName] == -1} {
  150.           lappend xfSaveModuleList $xfModName
  151.         }
  152.       } {
  153.         set xfTmpIndex [lsearch $xfSaveModuleList $xfModName]
  154.         if {$xfTmpIndex != -1} {
  155.           set xfSaveModuleList [lreplace $xfSaveModuleList $xfTmpIndex $xfTmpIndex]
  156.         }
  157.       }}
  158.  
  159.   checkbutton .xfModules.modname.autoload \
  160.     -text {Auto load} \
  161.     -variable xfStatus(autoLoadModule) \
  162.     -command {
  163.       global autoLoadList
  164.       global xfStatus
  165.       if {![catch "set moduleList([.xfModules.modname.modname get])"]} {
  166.         set autoLoadList([.xfModules.modname.modname get]) \
  167.           $xfStatus(autoLoadModule)
  168.       }}
  169.  
  170.   XFTmpltFrame .xfModules.frame2 0
  171.  
  172.   XFTmpltListbox .xfModules.frame2 procs
  173.   .xfModules.frame2.procs.procs configure \
  174.     -geometry 14x30
  175.  
  176.   label .xfModules.frame2.procs.procsMess \
  177.     -relief raised \
  178.     -text {Procedures:}
  179.  
  180.   XFTmpltListbox .xfModules.frame2 toplevels
  181.   .xfModules.frame2.toplevels.toplevels configure \
  182.     -geometry 14x30
  183.  
  184.   label .xfModules.frame2.toplevels.toplevelsMess \
  185.     -relief raised \
  186.     -text {Toplevels:}
  187.  
  188.   XFTmpltListbox .xfModules.frame2 modules
  189.   .xfModules.frame2.modules.modules configure \
  190.     -geometry 14x30
  191.  
  192.   label .xfModules.frame2.modules.modulesMess \
  193.     -relief raised \
  194.     -text {Modules:}
  195.  
  196.   XFTmpltListbox .xfModules.frame2 contents
  197.  
  198.   label .xfModules.frame2.contents.contentsMess \
  199.     -relief raised \
  200.     -text {Contents:}
  201.  
  202.   scale .xfModules.frame2.mover \
  203.     -orient vertical \
  204.     -width 8 \
  205.     -sliderlength 15 \
  206.     -from 0 \
  207.     -command {XFModulesReposition}
  208.  
  209.   if {"[array names moduleList]" != ""} {
  210.     .xfModules.modname.modname insert 0 [lindex [array names moduleList] 0]
  211.   }
  212.  
  213.   XFModulesReadProcs
  214.   XFModulesReadTree
  215.   XFModulesReadModules
  216.   XFModulesReadContents
  217.  
  218.   # bindings
  219.   bind .xfModules.frame2.procs.procs <ButtonPress-1> {
  220.     XFBindSelectOne %W %y
  221.     .xfModules.frame2.toplevels.toplevels select clear
  222.     set xfCurSelect [.xfModules.frame2.procs.procs curselect]
  223.     if {$xfCurSelect >= 0} {
  224.       XFModulesAddToModule \
  225.         [.xfModules.frame2.procs.procs get $xfCurSelect]
  226.     }}
  227.   bind .xfModules.frame2.procs.procs <Button1-Motion> {
  228.     XFBindSelectOne %W %y
  229.     .xfModules.frame2.toplevels.toplevels select clear}
  230.   bind .xfModules.frame2.procs.procs <Shift-ButtonPress-1> {
  231.     XFBindSelectOne %W %y
  232.     .xfModules.frame2.toplevels.toplevels select clear}
  233.   bind .xfModules.frame2.procs.procs <Shift-Button1-Motion> {
  234.     XFBindSelectOne %W %y
  235.     .xfModules.frame2.toplevels.toplevels select clear}
  236.  
  237.   bind .xfModules.frame2.toplevels.toplevels <ButtonPress-1> {
  238.     XFBindSelectOne %W %y
  239.     .xfModules.frame2.procs.procs select clear
  240.     set xfCurSelect [.xfModules.frame2.toplevels.toplevels curselect]
  241.     if {$xfCurSelect >= 0} {
  242.       XFModulesAddToModule \
  243.         [.xfModules.frame2.toplevels.toplevels get $xfCurSelect]
  244.     }}
  245.   bind .xfModules.frame2.toplevels.toplevels <Button1-Motion> {
  246.     XFBindSelectOne %W %y
  247.     .xfModules.frame2.procs.procs select clear}
  248.   bind .xfModules.frame2.toplevels.toplevels <Shift-ButtonPress-1> {
  249.     XFBindSelectOne %W %y
  250.     .xfModules.frame2.procs.procs select clear}
  251.   bind .xfModules.frame2.toplevels.toplevels <Shift-Button1-Motion> {
  252.     XFBindSelectOne %W %y
  253.     .xfModules.frame2.procs.procs select clear}
  254.  
  255.   bind .xfModules.frame2.modules.modules <ButtonPress-1> {
  256.     XFBindSelectOneIntoEntry %W %y .xfModules.modname.modname
  257.     XFModulesReadContents}
  258.   bind .xfModules.frame2.modules.modules <Button1-Motion> {
  259.     XFBindSelectOneIntoEntry %W %y .xfModules.modname.modname
  260.     XFModulesReadContents}
  261.   bind .xfModules.frame2.modules.modules <Shift-ButtonPress-1> {
  262.     XFBindSelectOneIntoEntry %W %y .xfModules.modname.modname
  263.     XFModulesReadContents}
  264.   bind .xfModules.frame2.modules.modules <Shift-Button1-Motion> {
  265.     XFBindSelectOneIntoEntry %W %y .xfModules.modname.modname
  266.     XFModulesReadContents}
  267.  
  268.   bind .xfModules.frame2.contents.contents <Double-ButtonPress-1> {
  269.     set xfCurSelect [.xfModules.frame2.contents.contents curselect]
  270.     if {$xfCurSelect >= 0} {
  271.       XFModulesRemoveFromModule \
  272.         [.xfModules.frame2.contents.contents get $xfCurSelect]
  273.     }}
  274.   bind .xfModules.frame2.contents.contents <ButtonPress-1> {
  275.     XFBindSelectOne %W %y}
  276.   bind .xfModules.frame2.contents.contents <Button1-Motion> {
  277.     XFBindSelectOne %W %y}
  278.   bind .xfModules.frame2.contents.contents <Shift-ButtonPress-1> {
  279.     XFBindSelectOne %W %y}
  280.   bind .xfModules.frame2.contents.contents <Shift-Button1-Motion> {
  281.     XFBindSelectOne %W %y}
  282.  
  283.   bind .xfModules.modname.modname <Return> {
  284.     global autoLoadList
  285.     global moduleList
  286.     global xfSaveModuleList
  287.     global xfStatus
  288.     set xfModName [lindex [.xfModules.modname.modname get] 0]
  289.     if {"$xfModName" != ""} {
  290.       catch "set {moduleList($xfModName)} \"\""
  291.       catch "set {autoLoadList($xfModName)} 0"
  292.       if {[llength $xfSaveModuleList] > 0} {
  293.         if {[lsearch $xfSaveModuleList $xfModName] == -1} {
  294.           lappend xfSaveModuleList $xfModName
  295.           set xfStatus(saveModuleList) 1
  296.         }
  297.       }
  298.       XFModulesReadModules
  299.       XFModulesReadContents
  300.     }}
  301.  
  302.   # packing
  303.   pack after .xfModules.modname.modname \
  304.              .xfModules.modname.autoload {right fill} \
  305.              .xfModules.modname.save {right fill}
  306.   pack before .xfModules.frame2.procs.vscroll \
  307.               .xfModules.frame2.procs.procsMess {top fillx}
  308.   pack before .xfModules.frame2.toplevels.vscroll \
  309.               .xfModules.frame2.toplevels.toplevelsMess {top fillx}
  310.   pack before .xfModules.frame2.modules.vscroll \
  311.               .xfModules.frame2.modules.modulesMess {top fillx}
  312.   pack before .xfModules.frame2.contents.vscroll \
  313.               .xfModules.frame2.contents.contentsMess {top fillx}
  314.   pack append .xfModules.frame1 \
  315.               .xfModules.frame1.ok {left fill expand} \
  316.               .xfModules.frame1.save {left fill expand} \
  317.               .xfModules.frame1.tmplt {left fill expand} \
  318.               .xfModules.frame1.rescan {left fill expand}
  319.   pack append .xfModules.frame2 \
  320.               .xfModules.frame2.procs {left fill} \
  321.               .xfModules.frame2.toplevels {left fill} \
  322.               .xfModules.frame2.modules {left fill} \
  323.               .xfModules.frame2.mover {right fill} \
  324.               .xfModules.frame2.contents {left fill expand}
  325.   pack append .xfModules.frame3 \
  326.               .xfModules.frame3.insert {left fill expand} \
  327.               .xfModules.frame3.erase {left fill expand} \
  328.               .xfModules.frame3.erase2 {left fill expand}
  329.   pack append .xfModules \
  330.               .xfModules.frame1 {bottom fill} \
  331.               .xfModules.message1 {top fillx} \
  332.               .xfModules.frame3 {bottom fill} \
  333.               .xfModules.modname {bottom fill} \
  334.               .xfModules.frame2 {top fill expand}
  335. }
  336.  
  337. ##########
  338. # Procedure: XFModulesAddToModule
  339. # Description: add selected item to module
  340. # Arguments: xfName - the name of the item to add
  341. # Returns: none
  342. # Sideeffects: none
  343. ##########
  344. proc XFModulesAddToModule {xfName} {
  345.   global moduleList
  346.   global xfStatus
  347.  
  348.   if {"$xfName" != ""} {
  349.     if {$xfStatus(handleTemplates)} {
  350.       if {[llength $xfName] == 2} {
  351.         set xfName [lindex $xfName 1]
  352.       }
  353.       set xfModuleList $xfStatus(tmpltList)
  354.       set xfStatus(tmpltList) ""
  355.       foreach xfCounter $xfModuleList {
  356.         if {"$xfCounter" != "$xfName"} {
  357.           if {[catch "winfo class $xfCounter"] ||
  358.               [catch "winfo class $xfName"]} {
  359.             append xfStatus(tmpltList) " $xfCounter"
  360.           }
  361.         }
  362.       }
  363.       if {"$xfName" != "."} {
  364.         append xfStatus(tmpltList) " $xfName"
  365.       }
  366.       XFModulesReadContents
  367.     } {
  368.       if {![catch "set moduleList([.xfModules.modname.modname get])"]} {
  369.         foreach xfCounter [lsort [array names moduleList]] {
  370.           set xfModuleList [set moduleList($xfCounter)]
  371.           set moduleList($xfCounter) ""
  372.           foreach xfCounter2 $xfModuleList {
  373.             if {"$xfCounter2" != "$xfName"} {
  374.               append moduleList($xfCounter) " $xfCounter2"
  375.             }
  376.           }
  377.         }
  378.         append moduleList([.xfModules.modname.modname get]) " $xfName"
  379.         XFModulesReadContents
  380.       }
  381.     }
  382.   }
  383. }
  384.  
  385. ##########
  386. # Procedure: XFModulesReadContents
  387. # Description: read module contents
  388. # Arguments: none
  389. # Returns: none
  390. # Sideeffects: none
  391. ##########
  392. proc XFModulesReadContents {} {
  393.   global autoLoadList
  394.   global moduleList
  395.   global xfConf
  396.   global xfSaveModuleList
  397.   global xfStatus
  398.  
  399.   if {$xfStatus(handleTemplates)} {
  400.     XFMiscClearList .xfModules.frame2.contents.contents
  401.     foreach xfCounter $xfStatus(tmpltList) {
  402.       .xfModules.frame2.contents.contents insert end $xfCounter
  403.     }
  404.   } {
  405.     XFMiscUpdateModuleList
  406.     set xfModName [.xfModules.modname.modname get]
  407.     if {"$xfModName" != ""} {
  408.       if {"$xfModName" == $xfConf(programName)} {
  409.         XFMiscClearList .xfModules.frame2.contents.contents
  410.         set xfTmpList ""
  411.         foreach xfCounter2 [set moduleList($xfModName)] {
  412.           if {![XFMiscInModule $xfCounter2]} {
  413.             .xfModules.frame2.contents.contents insert end $xfCounter2
  414.             lappend xfTmpList "$xfCounter2"
  415.           }
  416.         }
  417.         set xfCounter 0
  418.         set xfLength [.xfModules.frame2.procs.procs size]
  419.         while {$xfCounter < $xfLength} {
  420.           set xfCounter2 [.xfModules.frame2.procs.procs get $xfCounter]
  421.           if {![XFMiscInModule $xfCounter2] &&
  422.               [lsearch $xfTmpList $xfCounter2] == -1} {
  423.             .xfModules.frame2.contents.contents insert end $xfCounter2
  424.           }
  425.           incr xfCounter 1
  426.         }
  427.         set xfCounter 0
  428.         set xfLength [.xfModules.frame2.toplevels.toplevels size]
  429.         while {$xfCounter < $xfLength} {
  430.           set xfCounter2 [.xfModules.frame2.toplevels.toplevels get $xfCounter]
  431.           if {![XFMiscInModule $xfCounter2] &&
  432.               [lsearch $xfTmpList $xfCounter2] == -1} {
  433.             .xfModules.frame2.contents.contents insert end $xfCounter2
  434.           }
  435.           incr xfCounter 1
  436.         }
  437.       } {
  438.         foreach xfCounter [lsort [array names moduleList]] {
  439.           if {[string compare $xfCounter $xfModName] == 0} {
  440.             XFMiscClearList .xfModules.frame2.contents.contents
  441.             foreach xfCounter2 [set moduleList($xfCounter)] {
  442.               .xfModules.frame2.contents.contents insert end $xfCounter2
  443.             }
  444.           }
  445.         }
  446.       }
  447.       if {[llength $xfSaveModuleList] > 0} {
  448.         if {[lsearch $xfSaveModuleList $xfModName] != -1} {
  449.           set xfStatus(saveModuleList) 1
  450.         } {
  451.           set xfStatus(saveModuleList) 0
  452.         }
  453.       } {
  454.         foreach xfCounter [array names moduleList] {
  455.           lappend xfSaveModuleList $xfCounter
  456.         }
  457.         if {[lsearch $xfSaveModuleList $xfConf(programName)] == -1} {
  458.           lappend xfSaveModuleList $xfConf(programName)
  459.         }
  460.         set xfStatus(saveModuleList) 1
  461.       }
  462.       if {[info exists autoLoadList($xfModName)]} {
  463.         set xfStatus(autoLoadModule) $autoLoadList($xfModName)
  464.       } {
  465.         set xfStatus(autoLoadModule) 0
  466.       }
  467.     }
  468.   }
  469.   if {[.xfModules.frame2.contents.contents size] > 0} {
  470.     .xfModules.frame2.mover configure \
  471.       -to [.xfModules.frame2.contents.contents size]
  472.   } {
  473.     .xfModules.frame2.mover configure \
  474.       -to 1
  475.   }
  476. }
  477.  
  478. ##########
  479. # Procedure: XFModulesReadModules
  480. # Description: read module list
  481. # Arguments: none
  482. # Returns: none
  483. # Sideeffects: none
  484. ##########
  485. proc XFModulesReadModules {} {
  486.   global moduleList
  487.  
  488.   XFMiscUpdateModuleList
  489.   XFMiscClearList .xfModules.frame2.modules.modules
  490.   foreach xfCounter [lsort [array names moduleList]] {
  491.     .xfModules.frame2.modules.modules insert end $xfCounter
  492.   }
  493. }
  494.  
  495. ##########
  496. # Procedure: XFModulesReadProcs
  497. # Description: read procedures
  498. # Arguments: none
  499. # Returns: none
  500. # Sideeffects: none
  501. ##########
  502. proc XFModulesReadProcs {} {
  503.  
  504.   XFMiscClearList .xfModules.frame2.procs.procs
  505.   set xfElementList [lsort [info procs]]
  506.  
  507.   foreach xfCounter $xfElementList {
  508.     if {![catch "winfo class $xfCounter"] ||
  509.         [XFMiscIsXFElement $xfCounter]} {
  510.       continue
  511.     }
  512.     .xfModules.frame2.procs.procs insert end $xfCounter
  513.   }
  514. }
  515.  
  516. ##########
  517. # Procedure: XFModulesReadTree
  518. # Description: read widget tree
  519. # Arguments: none
  520. # Returns: none
  521. # Sideeffects: none
  522. ##########
  523. proc XFModulesReadTree {} {
  524.   global xfStatus
  525.  
  526.   if {$xfStatus(handleTemplates)} {
  527.     XFMiscReadTree . .xfModules.frame2.toplevels.toplevels all
  528.   } {
  529.     XFMiscClearList .xfModules.frame2.toplevels.toplevels
  530.  
  531.     .xfModules.frame2.toplevels.toplevels insert end .
  532.     foreach xfCounter [winfo children .] {
  533.       if {![string match ".xf*" $xfCounter] &&
  534.           ![string match "xf*" [winfo name $xfCounter]] &&
  535.           "[winfo class $xfCounter]" == "Toplevel"} {
  536.         .xfModules.frame2.toplevels.toplevels insert end $xfCounter
  537.       }
  538.     }
  539.     foreach xfCounter [info procs ShowWindow.*] {
  540.       if {[catch "winfo class [string range $xfCounter 10 end]"]} {
  541.         .xfModules.frame2.toplevels.toplevels insert end \
  542.           [string range $xfCounter 10 end]
  543.       }
  544.     }
  545.   }
  546. }
  547.  
  548. ##########
  549. # Procedure: XFModulesRemoveFromModule
  550. # Description: remove selected item from module
  551. # Arguments: xfName - the name of the item to remove
  552. # Returns: none
  553. # Sideeffects: none
  554. ##########
  555. proc XFModulesRemoveFromModule {xfName} {
  556.   global moduleList
  557.   global xfStatus
  558.  
  559.   if {$xfStatus(handleTemplates)} {
  560.     set xfModuleList $xfStatus(tmpltList)
  561.     set xfStatus(tmpltList) ""
  562.     foreach xfCounter $xfModuleList {
  563.       if {"$xfCounter" != "$xfName"} {
  564.         append xfStatus(tmpltList) " $xfCounter"
  565.       }
  566.       XFModulesReadContents
  567.     }
  568.   } {
  569.     if {"$xfName" != ""} {
  570.       if {![catch "set moduleList([.xfModules.modname.modname get])"]} {
  571.         set xfModuleList [set moduleList([.xfModules.modname.modname get])]
  572.         set moduleList([.xfModules.modname.modname get]) ""
  573.         foreach xfCounter $xfModuleList {
  574.           if {"$xfCounter" != "$xfName"} {
  575.             append moduleList([.xfModules.modname.modname get]) " $xfCounter"
  576.           }
  577.         }
  578.         XFModulesReadContents
  579.       }
  580.     }
  581.   }
  582. }
  583.  
  584. ##########
  585. # Procedure: XFModulesReposition
  586. # Description: reposition the seletected module item
  587. # Arguments: xfPosition - scale position
  588. # Returns: none
  589. # Sideeffects: none
  590. ##########
  591. proc XFModulesReposition {xfPosition} {
  592.   global moduleList
  593.  
  594.   set xfCurSelect [.xfModules.frame2.contents.contents curselect]
  595.   if {$xfCurSelect >= 0} {
  596.     set xfTmpVal [.xfModules.frame2.contents.contents get $xfCurSelect]
  597.     .xfModules.frame2.contents.contents delete $xfCurSelect
  598.     .xfModules.frame2.contents.contents insert $xfPosition $xfTmpVal
  599.     .xfModules.frame2.contents.contents select from $xfPosition
  600.     .xfModules.frame2.contents.contents select to $xfPosition
  601.  
  602.     set xfModuleName [.xfModules.modname.modname get]
  603.     if {![catch "set moduleList($xfModuleName)"]} {
  604.       set xfModuleList [set moduleList($xfModuleName)]
  605.       set moduleList($xfModuleName) ""
  606.       set xfCounter 0
  607.       set xfSize [.xfModules.frame2.contents.contents size]
  608.       while {$xfCounter < $xfSize} {
  609.         append moduleList($xfModuleName) \
  610.           " [.xfModules.frame2.contents.contents get $xfCounter]"
  611.         incr xfCounter
  612.       }
  613.     }
  614.   }
  615. }
  616.  
  617. # eof
  618.  
  619.