home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
newextfvdi.tcl
< prev
next >
Wrap
Text File
|
1996-09-12
|
5KB
|
204 lines
#---------------------------------------------------------------------------
#
# (c) Westmount Technology 1994
#
# File: @(#)newextfvdi.tcl /main/hindenburg/1
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)newextfvdi.tcl /main/hindenburg/1 12 Sep 1996 Copyright 1994 Westmount Technology
# Start user added include file section
require wmt_util.tcl
# End user added include file section
Class NewExtFVDialog : {TemplateDialog} {
constructor
method destructor
method checkcreateExtFile
method createExtFile
method createInterface
method typeSelectionChanged
method nameTextModified
method createAndEdit
attribute ExtFileVList
}
constructor NewExtFVDialog {class this name} {
set this [TemplateDialog::constructor $class $this $name]
# Start constructor user section
$this createInterface
# End constructor user section
return $this
}
method NewExtFVDialog::destructor {this} {
# Start destructor user section
# End destructor user section
}
method NewExtFVDialog::checkcreateExtFile {this} {
busy {
set type [$this.DC.ExtFVtypeTL selectedSet]
set name [$this.DC.ExtFVnameSLT text]
# of type makefile, maketemplate, library/executable
# only one instance per system is allowed
case $type in {
{makefile maketemplate executable library} {
set sysV [[ClientContext::global] currentSystem]
foreach fv [$sysV localFileVersions] {
if {[[$fv file] type] == $type} {
wmtkerror "$type already exists."
return ""
}
}
if {$type == "executable" || $type == "library"} {
set tmpType executable
if {$type == "executable"} {
set tmpType library
}
foreach fv [$sysV localFileVersions] {
if {[[$fv file] type] == $tmpType} {
wmtkerror "$tmpType already exists."
return ""
}
}
}
if {$type == "makefile" || $type == "maketemplate"} {
return [$this createExtFile $type $type]
}
}
}
}
return [$this createExtFile $name $type]
}
method NewExtFVDialog::createExtFile {this name type} {
set objSpec [getObjectSpec [.main objectHdlr] ExternalFileVersion $type]
if {"$objSpec" == ""} return ""
wmtkmessage "Creating '$type' External File Version '$name'..."
busy {
set sysV [[ClientContext::global] currentSystem]
set configV [[ClientContext::global] currentConfig]
if {[$objSpec isAscii]} {
set fileV [$sysV createFileVersion \
$name cl 0 $type externalText $configV]
} else {
set fileV [$sysV createFileVersion \
$name cl 0 $type externalBinary $configV]
}
set fsExt [$objSpec fsExtension]
if {$fsExt == ""} {
$fileV setProperty fileSystemPath $name
} else {
$fileV setProperty fileSystemPath $name.$fsExt
}
if {"$type" != "library"} {
$fileV synchWithFileSystem
}
.main updateView
}
wmtkmessage ""
return $fileV
}
method NewExtFVDialog::createInterface {this} {
interface DlgColumn $this.DC {
allowResize 1
Label L {
text "Type:"
}
TextList ExtFVtypeTL {
entrySet {}
rowCount 10
}
Label L {
text "Name:"
}
SingleLineText ExtFVnameSLT {
}
}
PushButton new $this.edit \
-label Edit \
-sensitive 0 \
-activated "$this createAndEdit ; $this popDown"
$this config \
-title "New External File Version" \
-okPressed "$this checkcreateExtFile" \
-helpPressed ".main helpOnName [nt_get_type $this]"
$this okSensitive 0
$this okDefault 0
$this cancelDefault 1
$this.DC.ExtFVtypeTL selectionChanged "$this typeSelectionChanged"
$this.DC.ExtFVnameSLT textModified "$this nameTextModified"
# fill the type entry set with all the possible externalfileversion
# skip 'section' type
set types {}
foreach objectSpec [[.main objectHdlr] getCurrentObjectSpecSet] {
if {[$objectSpec repositoryType] == "ExternalFileVersion"} {
set browserType [$objectSpec browserType]
if {"$browserType" != ""} {
lappend types "$browserType"
}
}
}
$this.DC.ExtFVtypeTL entrySet [lsort $types]
}
method NewExtFVDialog::typeSelectionChanged {this} {
# for some entries there is no name possible
case [$this.DC.ExtFVtypeTL selectedSet] in {
{makefile maketemplate} {
$this.DC.ExtFVnameSLT text ""
$this.DC.ExtFVnameSLT editable 0
$this okSensitive 1
$this okDefault 1
$this.edit sensitive 1
} {default} {
$this.DC.ExtFVnameSLT editable 1
$this nameTextModified
}
}
}
method NewExtFVDialog::nameTextModified {this} {
if {[llength [$this.DC.ExtFVtypeTL selectedSet]] > 0 &&
"[rmWhiteSpace [$this.DC.ExtFVnameSLT text]]" != ""} {
$this okSensitive 1
$this okDefault 1
$this.edit sensitive 1
} else {
$this okSensitive 0
$this cancelDefault 1
$this.edit sensitive 0
}
}
method NewExtFVDialog::createAndEdit {this} {
set obj [$this checkcreateExtFile]
if {$obj == ""} {
return
} else {
$obj editFile
}
}
# Do not delete this line -- regeneration end marker