home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
document.tcl
< prev
next >
Wrap
Text File
|
1997-11-17
|
6KB
|
273 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)document.tcl /main/titanic/9
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)document.tcl /main/titanic/9 17 Nov 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require_module_file "dsysvdbobj.tcl" docwriter
Class Document : {DSysVDbObj} {
method destructor
constructor
method promoter
method initialize
method initializeInfo
method title
method subject
method documentedSystem
method type
method reference
method keywords
method date
method authors
method docStatus
method docEditor
method setGetProp
method directory
attribute editor
attribute docSys
attribute initialized
attribute configVersion
}
method Document::destructor {this} {
# Start destructor user section
# End destructor user section
$this DSysVDbObj::destructor
}
constructor Document {class this name} {
set this [DSysVDbObj::constructor $class $this $name]
return $this
}
method Document::promoter {this} {
if {"[$this initialized]" == ""} {
$this initialized 0
}
}
method Document::initialize {this configVersion} {
if {[$this initialized] || "$configVersion" == ""} {
return
}
# create an instance of the documented system
$this configVersion $configVersion
set docSys [$this setGetProp doc_sys]
set phase [$this phase]
set phaseV [$configVersion findPhaseVersion \
"[$phase name]" "[$phase type]"]
if {"$docSys" == ""} {
wmtkerror "Documented system not specified\
for document '[$this getInfo Name]'"
return
}
$this docSys [$phaseV findSystemVersion $docSys system]
# create the docEditor
if {"[$this editor]" == ""} {
set docEditor [$this docEditor]
if {$docEditor == ""} {
wmtkerror "Document editor not specified\
for document '[$this getInfo Name]'"
return
} else {
global docwriterEditors
if {![info exist docwriterEditors($docEditor)] ||
$docwriterEditors($docEditor) == ""} {
wmtkerror "Invalid docwriter module '$docEditor' \
specified for document '[$this getInfo Name]'"
return
}
}
# make the specific editor class
if [catch {$this editor [${docEditor}DocEditor new \
$this.docEditor]} msg] {
wmtkerror "Initializing document failed : $msg"
return
}
}
# check the current level
case "[[ClientContext::global] currentLevel]" in {
{None Corporate Project Config} {
return
}
}
if {[[ClientContext::global] currentConfig] != $configVersion} {
return
}
if {[[$this editor] dirExtension] != "" } {
# check if directory name is valid
set dir [$this getPropertyValue fileSystemPath]
if {![regexp ".[[$this editor] dirExtension]" $dir]} {
# invalid name set valid one
# strip "."
set name [[$this system] name]
regsub -all {\.} $name {_} name
$this setProperty fileSystemPath \
$name.[[$this editor] dirExtension]
}
}
set error [[$this editor] configDirectory [$this directory]]
if {$error != ""} {
wmtkerror "$error\nChange property 'File System Path Part' to a valid value before using the document."
return
}
$this initialized 1
}
method Document::initializeInfo {this configVersion} {
$this initialize $configVersion
$this SysVDbObj::initializeInfo dummy
}
method Document::title {this args} {
return [$this setGetProp title $args]
}
method Document::subject {this args} {
return [$this setGetProp subject $args]
}
method Document::documentedSystem {this} {
return [$this docSys]
}
method Document::type {this args} {
return [$this setGetProp type $args]
}
method Document::reference {this args} {
return [$this setGetProp ref $args]
}
method Document::keywords {this args} {
return [$this setGetProp keywords $args]
}
method Document::date {this args} {
return [$this setGetProp date $args]
}
method Document::authors {this args} {
return [$this setGetProp authors $args]
}
method Document::docStatus {this args} {
return [$this setGetProp status $args]
}
method Document::docEditor {this} {
return [$this setGetProp editor]
}
method Document::setGetProp {this args} {
set prop [lindex $args 0]
set value [lindex [lindex $args 1] 0]
if [lempty $value] {
return [$this getPropertyValue $prop]
} else {
$this setProperty $prop $value
}
}
method Document::directory {this} {
return [$this path]
}
proc Document::getClass {editor version type} {
set firstChar [string toupper [string range $type 0 0]]
set lastPart [string tolower [string range $type 1 end]]
set type ${firstChar}${lastPart}
set class ${editor}${version}${type}Section
if {! [isCommand $class]} {
# try without version
set class ${editor}${type}Section
if {! [isCommand $class]} {
# try without editor name
set class ${type}Section
if {! [isCommand $class]} {
return ""
}
}
}
return $class
}
proc Document::getFileClass {editor version type} {
set class [Document::getClass $editor $version $type]
if {$class == ""} {
# unknown class
return externalBinary
}
if [isCommand $class::isAscii] {
if [$class::isAscii] {
return externalText
} else {
return externalBinary
}
} else {
foreach class [Document::getSuperClasses $class] {
if [isCommand $class::isAscii] {
if [$class::isAscii] {
return externalText
} else {
return externalBinary
}
}
}
}
# no super with isAscii proc found
return externalBinary
}
proc Document::getSuperClasses {class} {
set supers [$class info supers]
foreach i $supers {
set supers "$supers [Document::getSuperClasses $i]"
}
return $supers
}
# Do not delete this line -- regeneration end marker