home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1996
- #
- # File: @(#)custfvuiob.tcl /main/titanic/18
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)custfvuiob.tcl /main/titanic/18 26 Nov 1997 Copyright 1996 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require "browsuiobj.tcl"
-
- Class CustFVUiObj : {BrowsUiObj} {
- constructor
- method destructor
- method addCustomFileV
- method customFileVersions
- method deselectObjects
- method initializeInfo
- method moduleFiles
- method newObjects
- method printObjects
- method removeObjects
- method selectObject
- }
-
- global CustFVUiObj::uiClass
- set CustFVUiObj::uiClass "CustomFileVersions"
-
-
- constructor CustFVUiObj {class this name} {
- set this [BrowsUiObj::constructor $class $this $name]
- # Start constructor user section
-
- $this uiName "<customization files>"
- $this uiText "customization files"
-
- # End constructor user section
- return $this
- }
-
- method CustFVUiObj::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this BrowsUiObj::destructor
- }
-
- method CustFVUiObj::addCustomFileV {this} {
- foreach childType [CustFVUiObj::customFileNames] {
- set customFileList($childType) 1
- }
- foreach obj [$this getChildSet customFileVersions] {
- set customFile [$obj customFile]
- set name [$customFile name]
- set type [$customFile type]
- if {"$type" != ""} {
- append name ".$type"
- }
- if [info exists customFileList($name)] {
- unset customFileList($name)
- }
- }
- if [info exists customFileList] {
- set entrySet [lsort [array names customFileList]]
- } else {
- set entrySet ""
- }
-
- require "editseldia.tcl"
- set box .main.newCustfileV
- ClassMaker::extend EditSelDialog NewCustfileVEditSelDialog dbObj
- NewCustfileVEditSelDialog new $box \
- -title "New Customization File Version" \
- -message "Customization File:" \
- -entrySet $entrySet \
- -dbObj [$this getParent CustomLevelVersion] \
- -okPressed {
- set file [%this text]
- set selection [splitFileName $file]
- set name [lindex $selection 0]
- set type [lindex $selection 1]
- set script "global CustFVUiObj:custFV"
- append script " ;"
- append script " set CustFVUiObj:custFV \[CustFileUtilities::make \
- [%this dbObj] [list $name] [list $type] \
- \]"
- require "custfileut.tcl"
- .main startCommand tcl \
- "$script" "" \
- "Creating customization file version '$file'" \
- {1 0} 1
- %this delete
- } \
- -editPressed {
- if [info exists CustFVUiObj:custFV] {
- ${CustFVUiObj:custFV} editFile
- unset CustFVUiObj:custFV
- }
- }
- $box popUp
- }
-
- proc CustFVUiObj::associations {} {
- set associations {customFileVersions}
-
- # Only show module files when it is visible within the view spec
- if [catch {
- set viewSpec [[.main viewHdlr] getViewSpec \
- "${CustFVUiObj::uiClass}" "" "[[.main infoView] currentViewName]"]
- }] {
- resetErrorVars
- lappend associations moduleFiles
- } elseif {[isCommand $viewSpec] &&
- [lsearch -exact "[$viewSpec associations]" moduleFiles] != -1} {
- lappend associations moduleFiles
- }
-
- return $associations
- }
-
- proc CustFVUiObj::childTypes {assoc} {
- if {[lsearch -exact "[CustFVUiObj::associations]" "$assoc"] == -1} {
- return ""
- }
- set childTypes [BrowserProcs::childTypes $assoc]
- case "$childTypes" in {
- {CustomFileVersion} {
- return {
- mnu modules objtype opendefs openlocs pnl propdefs proplocs
- roundtrip vie
- }
- }
- {ModuleFile} {
- return ExternalDirectory
- }
- {default} {
- return "$childTypes"
- }
- }
- }
-
- proc CustFVUiObj::customEtcFileNames {} {
- set customEtcFileNames {
- cad.mnu cad.pnl ccd.mnu ccd.pnl checkconfig.checkconfig class.mnu
- copyspecs.copyspecs cod.mnu cod.pnl desk.mnu desk.vie
- dfd.mnu dfd.pnl diagram.mnu etd.mnu etd.pnl m4env.m4env mgd.mnu mgd.pnl
- maketmpl.maketmpl objtype.objtype opendefs.opendefs openlocs.openlocs
- propdefs.propdefs proplocs.proplocs roundtrip.roundtrip std.mnu
- std.pnl ucd.mnu ucd.pnl
- }
- if [[[.main currentObj] browsUiObj] isA CustFVUiObj] {
- lappend customEtcFileNames modules.modules
- }
- return $customEtcFileNames
- }
-
- proc CustFVUiObj::customFileNames {} {
- set currentObj [[.main currentObj] browsUiObj]
- if {"$currentObj" == ""} {
- return ""
- }
- if [$currentObj isA CustFVUiObj] {
- return [concat \
- [CustFVUiObj::customEtcFileNames] \
- [CustFVUiObj::customTclFileNames] \
- ]
- }
- for {set parent $currentObj} \
- {"$parent" != ""} \
- {set parent [$parent parent]} {
- if {! [$parent isA ExtFUiObj]} break
- if {"[$parent getInfo Type]" != "ExternalDirectory"} continue
- if {"[$parent getInfo Name]" == "tcl"} {
- return [CustFVUiObj::customTclFileNames]
- }
- if {"[$parent getInfo Name]" == "etc"} {
- return [CustFVUiObj::customEtcFileNames]
- }
- }
- return ""
- }
-
- method CustFVUiObj::customFileVersions {this} {
- return [[$this parent] customFileVersions]
- }
-
- proc CustFVUiObj::customTclFileNames {} {
- if [[[.main currentObj] browsUiObj] isA CustFVUiObj] {
- return ""
- }
- return {
- clbrowse.tcl d_desk.tcl docbatch.tcl mtool.tcl s_desk.tcl uce.tcl
- ude.tcl
- }
- }
-
- method CustFVUiObj::deselectObjects {this} {
- set custlvlV [$this getParent CustomLevelVersion]
- set script ""
- foreach obj [.main selectedObjSet] {
- if {"$script" != ""} {
- append script " ;"
- }
- append script " $custlvlV deselectVersion $obj"
- }
- .main startCommand tcl "$script" "" "" {1 0} 1
- }
-
- proc CustFVUiObj::infoProperties {} {
- return [BrowserProcs::infoProperties]
- }
-
- method CustFVUiObj::initializeInfo {this dummy} {
- $this BrowsUiObj::initializeInfo $dummy
- $this setInfo Text "[$this uiText] of [[$this parent] getInfo Text]"
- }
-
- method CustFVUiObj::moduleFiles {this} {
- set moduleFiles ""
- if {[.main customLevelVersion] == [$this parent]} {
- foreach module [[.main moduleHdlr] moduleSpecSet] {
- set path [$module path]
- set directory [path_name directory $path]
- set file [path_name file $path]
- regsub -all " |\\." "$file" "_" fileId
- set moduleFile $this.${ExtFUiObj::uiClass}:$fileId
- if {! [isCommand $moduleFile]} {
- ExtFUiObj new $moduleFile \
- -parent $this \
- -uiName "$file" \
- -directory $directory \
- -isDirectory 1 \
- -inModule 1
- }
- lappend moduleFiles $moduleFile
- }
- }
- return $moduleFiles
- }
-
- method CustFVUiObj::newObjects {this} {
- set custlvlV [$this getParent CustomLevelVersion]
- set script ""
- foreach obj [.main selectedObjSet] {
- if {"$script" != ""} {
- append script " ;"
- }
- append script " $custlvlV derive $obj"
- }
- .main startCommand tcl "$script" "" "" {1 0} 1
- }
-
- method CustFVUiObj::printObjects {this} {
- set tmpFiles ""
- set asciiFiles ""
- foreach obj [.main selectedObjSet] {
- if [$obj isA CustomFileVersion] {
- set tmpFile [args_file {}]
- $obj downLoad $tmpFile
- lappend tmpFiles $tmpFile
- } else {
- lappend asciiFiles [path_name concat [$obj directory] [$obj uiName]]
- }
- }
- BrowserProcs::printObjects $tmpFiles "" 1
- BrowserProcs::printObjects $asciiFiles "" 0
- }
-
- method CustFVUiObj::removeObjects {this} {
- set box .main.removeWarning
- ClassMaker::extend YesNoWarningDialog RemoveObjectsWarningDialog dbObj
- RemoveObjectsWarningDialog new $box \
- -title "Confirm Customization File Version Delete" \
- -message [BrowserProcs::removeMessage] \
- -dbObj [$this getParent CustomLevelVersion] \
- -noPressed {%this delete} \
- -yesPressed {
- set dbObj [%this dbObj]
- set script ""
- foreach obj [.main selectedObjSet] {
- if {"$script" != ""} {
- append script " ;"
- }
- if [$obj isA BrowsDbObj] {
- append script " $dbObj remove $obj"
- } else {
- append script [list BasicFS::removeFile \
- [path_name concat [$obj directory] [$obj uiName]]]
- }
- }
- .main startCommand tcl "$script" "" "" {1 0} 1
- %this delete
- }
- $box delCancelButton
- $box popUp
- }
-
- method CustFVUiObj::selectObject {this mode} {
- busy {
- set custlvlV [$this getParent CustomLevelVersion]
- set versionList ""
- foreach custFV [$custlvlV customFileVersions] {
- set workingList([$custFV customFile]) $custFV
- }
- case "$mode" in {
- {new} {
- set custFList ""
- foreach custF [[$custlvlV customLevel] customFiles] {
- if [info exists workingList($custF)] continue
- lappend custFList $custF
- }
- }
- {default} {
- set custFList ""
- foreach obj [.main selectedObjSet] {
- lappend custFList [$obj customFile]
- }
- }
- }
- foreach custF $custFList {
- set custFName [$custF name]
- if [info exists workingList($custF)] {
- set working $workingList($custF)
- } else {
- set working [ORB::nil]
- }
- foreach version [$custF customFileVersions] {
- if [$version isSame $working] continue
- if {"[$version status]" == "working"} continue
- lappend versionList [list $version "$custFName"]
- }
- }
- BrowserProcs::selectObject $custlvlV $versionList $mode
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
-