home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
extfuiobj.tcl
< prev
next >
Wrap
Text File
|
1997-11-18
|
13KB
|
505 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)extfuiobj.tcl /main/titanic/12
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)extfuiobj.tcl /main/titanic/12 18 Nov 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require "browsuiobj.tcl"
Class ExtFUiObj : {BrowsUiObj} {
constructor
method destructor
method addExternalFile
method browserType
method downLoad
method editFile
method externalFiles
method hasChildren
method initializeInfo
method openFile
method printObjects
method referredFile
method removeObjects
method showFile
method upLoad
attribute directory
attribute isAscii
attribute isDirectory
attribute inModule
attribute pattern
}
global ExtFUiObj::uiClass
set ExtFUiObj::uiClass "ExternalFile"
constructor ExtFUiObj {class this name} {
set this [BrowsUiObj::constructor $class $this $name]
$this isAscii 1
$this isDirectory 0
$this inModule 0
$this pattern "*"
# Start constructor user section
# End constructor user section
return $this
}
method ExtFUiObj::destructor {this} {
# Start destructor user section
# End destructor user section
$this BrowsUiObj::destructor
}
method ExtFUiObj::addExternalFile {this} {
if {! [$this isDirectory]} {
return
}
set parent [$this getParent HCustFUiObj]
if {"$parent" != ""} {
set childTypes [HCustFUiObj::externalFileNames]
} else {
set parent [$this getParent UCustFUiObj]
if {"$parent" != ""} {
set childTypes [UCustFUiObj::externalFileNames]
} else {
set childTypes [CustFVUiObj::customFileNames]
}
}
foreach childType $childTypes {
set externalFileList($childType) 1
}
foreach externalFile [$this getChildSet externalFiles] {
set type [$externalFile uiName]
if [info exists externalFileList($type)] {
unset externalFileList($type)
}
}
if [info exists externalFileList] {
set entrySet [lsort [array names externalFileList]]
} else {
set entrySet ""
}
require "editseldia.tcl"
set box .main.newExternalF
ClassMaker::extend EditSelDialog NewExternalFileEditSelDialog uiObj
NewExternalFileEditSelDialog new $box \
-title "New External File" \
-message "External File:" \
-entrySet $entrySet \
-uiObj $this \
-okPressed {
set dir ""
set uiObj [%this uiObj]
set file [%this text]
set script "global ExtFUiObj:custF"
append script " ;"
if [$uiObj inModule] {
set dir [path_name concat \
[$uiObj getInfo Directory] [$uiObj getInfo Name]]
append script " set ExtFUiObj:custF \
\[path_name concat $dir \"$file\" \]"
append script " ;"
append script " BasicFS::makeFile \${ExtFUiObj:custF}"
} else {
while {"$uiObj" != ""} {
if {! [$uiObj isA ExtFUiObj]} break
if {"$dir" == ""} {
set dir [$uiObj getInfo Name]
} else {
set dir [path_name concat [$uiObj getInfo Name] $dir]
}
set uiObj [$uiObj parent]
}
set selection [splitFileName $file]
set name [lindex $selection 0]
set type [lindex $selection 1]
append script " set ExtFUiObj:custF \
\[CustFileUtilities::make [.main corporateObj] \
[list $name] [list $type] [list $dir] \]"
require "custfileut.tcl"
}
.main startCommand tcl \
"$script" "" \
"Creating external file '$file'" \
{1 0} 1
%this delete
} \
-editPressed {
if [info exists ExtFUiObj:custF] {
if [file isfile ${ExtFUiObj:custF}] {
regsub -all " |\\." "[$this text]" "_" fileId
[$this uiObj].ExternalFile:$fileId editFile
}
unset ExtFUiObj:custF
}
}
$box popUp
}
proc ExtFUiObj::associations {} {
return {externalFiles}
}
method ExtFUiObj::browserType {this} {
if [$this isDirectory] {
return ExternalDirectory
} else {
return [$this BrowsUiObj::browserType]
}
}
proc ExtFUiObj::childTypes {assoc} {
if {[lsearch -exact "[ExtFUiObj::associations]" "$assoc"] == -1} {
return ""
}
set childTypes [BrowserProcs::childTypes $assoc]
case "$childTypes" in {
{ExternalFile} {
return {ExternalDirectory ExternalFile}
}
{default} {
return "$childTypes"
}
}
}
method ExtFUiObj::downLoad {this fileName} {
set path [$this getInfo Path]
BasicFS::copyFile $path $fileName
}
method ExtFUiObj::editFile {this} {
if [$this isDirectory] {
return
}
set path [$this getInfo Path]
if {! [file writable $path]} {
$this showFile
return
}
if [$this inModule] {
.main startM4Command editor "[path_name concat \
[$this directory] [$this uiName]]" "" "[$this uiName]"
return
}
set file [splitFileName "[$this uiName]"]
set name [lindex "$file" 0]
set type [lindex "$file" 1]
if [[$this parent] isA UCustFUiObj] {
set level "user"
} else {
set level "corporate"
}
case "$type" in {
{mnu vie objtype modules copyspecs} {
set script "SystemUtilities::fork otk uce \
-c [list [get_comm_name]] \
-fi $level [list $name].[list $type]"
.main startCommand tcl \
"$script" "" \
"Starting uce for '$name.$type'" \
{0 0} 1
}
{opendefs openlocs propdefs proplocs} {
if {$level == "user"} {
.main startM4Command editor "$path" "" "[$this uiName]"
return
}
set script "SystemUtilities::fork otk uce \
-c [list [get_comm_name]] \
-fi $level [list $name].[list $type]"
.main startCommand tcl \
"$script" "" \
"Starting uce for '$name.$type'" \
{0 0} 1
}
{gdr} {
require "groupdefin.tcl"
global classCount
incr classCount
set dlgName .main.groupDefinitionFileDialog$classCount
GroupDefinitionFileDialog new $dlgName $this \
-helpPressed ".main helpOnName groupDefinitionFileDialog" \
-fileName $name \
-editable 1
$dlgName popUp
}
{pnl} {
require "ctrlpnldia.tcl"
global classCount
incr classCount
set dlgName .main.ctrlPnlDialog$classCount
CtrlPnlDialog new $dlgName \
-helpPressed ".main helpOnName ctrlPnlDialog" \
-lvlObj [$this getParent Corporate] \
-fileName $name \
-fileType $type \
-editable 1
$dlgName popUp
}
{checkconfig} {
require "custcheckd.tcl"
global classCount
incr classCount
set dlgName .main.custCheckDialog$classCount
CustCheckDialog new $dlgName
$dlgName edit [$this getParent CustomLevelVersion]
}
{default} {
.main startM4Command editor "$path" "" "[$this uiName]"
}
}
}
method ExtFUiObj::externalFiles {this} {
if {! [$this isDirectory]} {
return ""
}
set externalFiles ""
set externalDirectories ""
set directory [$this getInfo Path]
set extFilePattern [path_name concat $directory [$this pattern]]
if {[catch {set files [otglob $extFilePattern]}]} {
set files ""
}
set inModule [$this inModule]
foreach pathFile [lsort $files] {
set file [file tail $pathFile]
regsub -all " |\\." "$file" "_" fileId
set externalFile $this.${ExtFUiObj::uiClass}:$fileId
set isDirectory [file isdirectory \
[path_name concat $directory $file]]
if {! [isCommand $externalFile]} {
ExtFUiObj new $externalFile \
-parent $this \
-uiName "$file" \
-directory "$directory" \
-isDirectory $isDirectory \
-inModule $inModule
}
if $isDirectory {
lappend externalDirectories $externalFile
} else {
lappend externalFiles $externalFile
}
}
return [concat $externalDirectories $externalFiles]
}
method ExtFUiObj::hasChildren {this} {
if [$this isDirectory] {
return 1
} else {
return 0
}
}
proc ExtFUiObj::infoProperties {} {
return [concat \
[BrowserProcs::infoProperties] \
{Directory Path} \
]
}
method ExtFUiObj::initializeInfo {this dummy} {
set directory [$this directory]
set file [$this uiName]
set path [path_name concat $directory $file]
if {! [file exists $path]} {
set path $file
$this directory [path_name directory $path]
$this uiName [path_name file $path]
}
case "[lindex [splitFileName [$this uiName]] 1]" in {
{dot con tlb} {
$this isAscii 0
}
}
$this BrowsUiObj::initializeInfo $dummy
$this setInfo Text "external file '$path'"
$this setInfo Directory "[$this directory]"
$this setInfo Path "$path"
}
method ExtFUiObj::openFile {this} {
if {[$this isDirectory] || (! [$this isAscii])} {
BrowserProcs::showInfo
} elseif {! [file writable [$this getInfo Path]]} {
$this showFile
} else {
$this editFile
}
}
method ExtFUiObj::printObjects {this} {
if {! [$this isDirectory]} {
return
}
set parent [$this getParent HCustFUiObj]
if {"$parent" == ""} {
set parent [$this getParent UCustFUiObj]
}
if {"$parent" == ""} {
set parent [$this getParent CustFVUiObj]
}
$parent printObjects
}
method ExtFUiObj::referredFile {this {showWarning 0}} {
set path [$this getInfo Path]
if {[$this getParent UCustFUiObj] != ""} {
return $path
}
set file [splitFileName "[$this uiName]"]
set name [lindex "$file" 0]
set type [lindex "$file" 1]
set uiObj [$this parent]
set dir ""
while {"$uiObj" != ""} {
if {! [$uiObj isA ExtFUiObj]} break
set dir [$uiObj getInfo Name]
set uiObj [$uiObj parent]
}
if {"$dir" == ""} {
return $path
}
require "custfileut.tcl"
set custF "[CustFileUtilities::find \
[.main corporateObj] [list $name] [list $type] [list $dir]]"
if {"$custF" == ""} {
return $path
}
if {$showWarning && ("$path" != "$custF")} {
wmtkwarning "\
Customization file '$name.$type' already exists in \
the intallation directory.\nUsing file '$custF'"
}
return $custF
}
method ExtFUiObj::removeObjects {this} {
if {! [$this isDirectory]} {
return
}
set parent [$this getParent HCustFUiObj]
if {"$parent" == ""} {
set parent [$this getParent UCustFUiObj]
}
if {"$parent" == ""} {
set parent [$this getParent CustFVUiObj]
}
$parent removeObjects
}
method ExtFUiObj::showFile {this} {
if [$this isDirectory] {
return
}
if [$this inModule] {
.main startM4Command viewer "[path_name concat \
[$this directory] [$this uiName]]" "" "[$this uiName]"
return
}
set path [$this getInfo Path]
set file [splitFileName "[$this uiName]"]
set name [lindex "$file" 0]
set type [lindex "$file" 1]
if [[$this parent] isA UCustFUiObj] {
set level "user"
} else {
set level "corporate"
}
case "$type" in {
{mnu vie objtype modules copyspecs} {
set script "SystemUtilities::fork otk uce -r \
-c [list [get_comm_name]] \
-fi $level [list $name].[list $type]"
.main startCommand tcl \
"$script" "" \
"Starting uce for '$name.$type'" \
{0 0} 1
}
{opendefs openlocs propdefs proplocs} {
if {$level == "user"} {
.main startM4Command viewer "$path" "" "[$this uiName]"
return
}
set script "SystemUtilities::fork otk uce -r \
-c [list [get_comm_name]] \
-fi $level [list $name].[list $type]"
.main startCommand tcl \
"$script" "" \
"Starting uce for '$name.$type'" \
{0 0} 1
}
{pnl} {
require "ctrlpnldia.tcl"
global classCount
incr classCount
set dlgName .main.ctrlPnlDialog$classCount
CtrlPnlDialog new $dlgName \
-helpPressed ".main helpOnName ctrlPnlDialog" \
-lvlObj [$this getParent Corporate] \
-fileName $name \
-fileType $type \
-editable 0
$dlgName popUp
}
{gdr} {
require "groupdefin.tcl"
global classCount
incr classCount
set dlgName .main.groupDefinitionFileDialog$classCount
GroupDefinitionFileDialog new $dlgName $this \
-helpPressed ".main helpOnName groupDefinitionFileDialog" \
-fileName $name \
-editable 0
$dlgName popUp
}
{checkconfig} {
require "custcheckd.tcl"
global classCount
incr classCount
set dlgName .main.custCheckDialog$classCount
CustCheckDialog new $dlgName
$dlgName show [$this getParent CustomLevelVersion]
}
{default} {
.main startM4Command viewer "$path" "" "[$this uiName]"
}
}
}
method ExtFUiObj::upLoad {this fileName} {
set path [$this getInfo Path]
BasicFS::copyFile $fileName $path
}
# Do not delete this line -- regeneration end marker