home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / hcustfuiob.tcl < prev    next >
Encoding:
Text File  |  1996-12-12  |  4.3 KB  |  160 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1996
  4. #
  5. #      File:           @(#)hcustfuiob.tcl    /main/hindenburg/5
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)hcustfuiob.tcl    /main/hindenburg/5   12 Dec 1996 Copyright 1996 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14. require "browsuiobj.tcl"
  15.  
  16. Class HCustFUiObj : {BrowsUiObj} {
  17.     constructor
  18.     method destructor
  19.     method externalFiles
  20.     method initializeInfo
  21.     method printObjects
  22.     method removeObjects
  23. }
  24.  
  25. global HCustFUiObj::uiClass
  26. set HCustFUiObj::uiClass "CustomFiles"
  27.  
  28.  
  29. constructor HCustFUiObj {class this name} {
  30.     set this [BrowsUiObj::constructor $class $this $name]
  31.     # Start constructor user section
  32.  
  33.     $this uiName "<customization files>"
  34.     $this uiText "customization files"
  35.  
  36.     # End constructor user section
  37.     return $this
  38. }
  39.  
  40. method HCustFUiObj::destructor {this} {
  41.     # Start destructor user section
  42.     # End destructor user section
  43.     $this BrowsUiObj::destructor
  44. }
  45.  
  46. proc HCustFUiObj::associations {} {
  47.     return {externalFiles}
  48. }
  49.  
  50. proc HCustFUiObj::childTypes {assoc} {
  51.     if {[lsearch -exact "[HCustFUiObj::associations]" "$assoc"] == -1} {
  52.     return ""
  53.     }
  54.     set childTypes [BrowserProcs::childTypes $assoc]
  55.     case "$childTypes" in {
  56.     {ExternalFile} {
  57.         return {ExternalDirectory ExternalFile}
  58.     }
  59.     {default} {
  60.         return "$childTypes"
  61.     }
  62.     }
  63. }
  64.  
  65. proc HCustFUiObj::externalEtcFileNames {} {
  66.     return {
  67.     cad.mnu cad.pnl ccd.mnu ccd.pnl checkconfig class.mnu desk.mnu desk.vie
  68.     dfd.mnu dfd.pnl diagram.mnu etd.mnu etd.pnl mgd.mnu mgd.pnl m4env
  69.     objtype.objtype opendefs.opendefs openlocs.openlocs propdefs.propdefs
  70.     proplocs.proplocs roundtrip.roundtrip std.mnu std.pnl ucd.mnu ucd.pnl
  71.     }
  72. }
  73.  
  74. proc HCustFUiObj::externalFileNames {} {
  75.     set currentObj [[$wmttoolObj currentObj] browsUiObj]
  76.     if {"$currentObj" == "" || (! [$currentObj isA ExtFUiObj])} {
  77.     return ""
  78.     }
  79.     for {set parent [$currentObj parent]} \
  80.     {"$parent" != ""} \
  81.     {set parent [$parent parent]} {
  82.         if {! [$parent isA ExtFUiObj]} break
  83.         set currentObj $parent
  84.     }
  85.     if {"[$currentObj getInfo Name]" == "tcl"} {
  86.     return [HCustFUiObj::externalTclFileNames]
  87.     }
  88.     return [HCustFUiObj::externalEtcFileNames]
  89. }
  90.  
  91. proc HCustFUiObj::externalTclFileNames {} {
  92.     return {
  93.     u_clbrowse.tcl u_desk.tcl u_docbatch.tcl u_mtool.tcl u_uce.tcl
  94.     u_ude.tcl
  95.     }
  96. }
  97.  
  98. method HCustFUiObj::externalFiles {this} {
  99.     set externalFiles ""
  100.     set directory [m4_var get M4_home]
  101.     foreach tuple {{etc *} {tcl *}} {
  102.     set file [lindex $tuple 0]
  103.     set pattern [lindex $tuple 1]
  104.     regsub -all " |\\." "$file" "_" fileId
  105.     set externalFile $this.${ExtFUiObj::uiClass}:$fileId
  106.     if {! [isCommand $externalFile]} {
  107.         ExtFUiObj new $externalFile \
  108.         -parent $this \
  109.         -uiName "$file" \
  110.         -directory $directory \
  111.         -isDirectory 1 \
  112.         -pattern $pattern
  113.     }
  114.     lappend externalFiles $externalFile
  115.     }
  116.     return "$externalFiles"
  117. }
  118.  
  119. proc HCustFUiObj::infoProperties {} {
  120.     return [BrowserProcs::infoProperties]
  121. }
  122.  
  123. method HCustFUiObj::initializeInfo {this dummy} {
  124.     $this BrowsUiObj::initializeInfo $dummy
  125.     $this setInfo Text "[$this uiText] of [[$this parent] getInfo Text]"
  126. }
  127.  
  128. method HCustFUiObj::printObjects {this} {
  129.     set asciiFiles ""
  130.     foreach obj [$wmttoolObj selectedObjSet] {
  131.     lappend asciiFiles [path_name concat [$obj directory] [$obj uiName]]
  132.     }
  133.     BrowserProcs::printObjects $asciiFiles "" ""
  134. }
  135.  
  136. method HCustFUiObj::removeObjects {this} {
  137.     set box $wmttoolObj.removeWarning
  138.     WarningDialog new $box \
  139.     -title "Delete Warning" \
  140.     -message [BrowserProcs::removeMessage] \
  141.     -helpPressed {.main helpOnName removeWarning} \
  142.     -cancelPressed {%this delete} \
  143.     -okPressed {
  144.         set script ""
  145.         foreach obj [$wmttoolObj selectedObjSet] {
  146.         if {"$script" != ""} {
  147.             append script " ;"
  148.         }
  149.         append script [list BasicFS::removeFile \
  150.             [path_name concat [$obj directory] [$obj uiName]]]
  151.         }
  152.         $wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
  153.         %this delete
  154.     }
  155.     $box popUp
  156. }
  157.  
  158. # Do not delete this line -- regeneration end marker
  159.  
  160.