home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
namechange.tcl
< prev
next >
Wrap
Text File
|
1997-11-11
|
4KB
|
153 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1996
#
# File: @(#)namechange.tcl /main/titanic/8
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)namechange.tcl /main/titanic/8 11 Nov 1997 Copyright 1996 Cadre Technologies Inc.
# Start user added include file section
require illegalcha.tcl
require nameconfli.tcl
# End user added include file section
Class NameChangeDialog : {TemplateDialog} {
constructor
method destructor
method popUp
method text
method handleTextModified
method handleOk
method popUpConflict
attribute configV
attribute keeper
attribute item
attribute prevText
attribute illegalCharacters
attribute tool
}
constructor NameChangeDialog {class this name tool} {
set this [TemplateDialog::constructor $class $this $name]
$this tool $tool
# Start constructor user section
interface DlgColumn $this.c {
Label message {
text "New Name:"
}
SingleLineText name {
columnCount 30
}
}
$this.c.name textModified "$this handleTextModified"
$this config -okPressed "$this handleOk" \
-helpPressed {.main helpOnName changeName} \
-cancelPressed "$this delete" \
-title "Change Name" \
-autoPopDown 0 \
-modal 1
# End constructor user section
return $this
}
method NameChangeDialog::destructor {this} {
# Start destructor user section
$this popDown
# End destructor user section
}
method NameChangeDialog::popUp {this} {
global illegalCharacters
if { "[$this item]" != "" } {
$this illegalCharacters $illegalCharacters([[$this item] type])
} else {
$this illegalCharacters $illegalCharacters(name)
}
$this prevText ""
$this handleTextModified
$this TemplateDialog::popUp
}
method NameChangeDialog::text {this {newText ,}} {
if {$newText == ","} {
return [$this.c.name text]
}
$this.c.name text $newText
}
method NameChangeDialog::handleTextModified {this} {
if { ("[$this illegalCharacters]" != "") && \
[regexp [$this illegalCharacters] [$this.c.name text]] } {
set cursorIndex [$this.c.name cursorIndex]
$this.c.name text [$this prevText]
$this.c.name cursorIndex [expr $cursorIndex - 1]
} else {
$this prevText [$this.c.name text]
}
if {"[rmWhiteSpace [$this.c.name text]]" == ""} {
$this okSensitive 0
} else {
$this okSensitive 1
}
$this okDefault [$this okSensitive]
$this cancelDefault [expr 1 - [$this okSensitive]]
}
method NameChangeDialog::handleOk {this} {
set newName [$this.c.name text]
set configV [$this configV]
set keeper [$this keeper]
set oldItem [$this item]
# name change for objects without item
if { "$oldItem" == "" } {
$this busy 1
if [catch {$this changeObjectName} msg] {
wmtkerror $msg
$this busy 0
}
return
}
set itemType [$oldItem type]
set itemQual [$oldItem qualifier]
if [$itemQual isNil] {
set newItem [$keeper findDeclaration \
$newName $itemType $configV]
} else {
set newItem [$keeper findDeclaration $itemQual \
$newName $itemType $configV]
}
if [$newItem isNil] {
$this busy 1
if [catch {$this changeName 1} msg] {
wmtkerror $msg
$this busy 0
}
return
}
if {[$newItem item] != $oldItem} {
$this popUpConflict
return
}
wmtkerror "Name not changed: Specified name equals original name"
}
method NameChangeDialog::popUpConflict {this} {
set conflict [$this tool].nameConflict
if {![isCommand $conflict]} {
NameConflictDialog new $conflict $this
}
$conflict popUp
}
# Do not delete this line -- regeneration end marker