home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
menupartno.tcl
< prev
next >
Wrap
Text File
|
1997-03-14
|
6KB
|
248 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)menupartno.tcl /main/titanic/4
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)menupartno.tcl /main/titanic/4 14 Mar 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require "custbrowso.tcl"
Class MenuPartNode : {BrowsNode CustBrowsObject} {
method destructor
constructor
method displayName
method infoList
method updateView
method open
method openUnregister
method check
method changeDotName
attribute parentType
attribute id
attribute redefined
attribute ancestor
attribute predecessor
}
method MenuPartNode::destructor {this} {
# Start destructor user section
if [isCommand .main] {
set area [.main editorArea]
if [isCommand $area] {
set names [$area getMenuPartNode [$this name]]
set newNames ""
foreach j $names {
if {$j != $this} {
set newNames "$newNames $j"
}
}
if {![lempty $newNames]} {
$area setMenuPartNode [$this name] $newNames
} else {
$area removeMenuPartNode [$this name]
}
}
}
# End destructor user section
$this CustBrowsObject::destructor
}
constructor MenuPartNode {class this name specification} {
set this [BrowsNode::constructor $class $this $name]
set this [CustBrowsObject::constructor $class $this $name]
$this config -activated {%this open} -id $this \
-conversionSet "WMT_MENUNODE id"
while {![lempty $specification]} {
set key [lvarpop specification]
$this $key [lvarpop specification]
}
set specification [$this objSpec]
set index [lsearch -exact $specification "label"]
if {$index != -1} {
incr index
$this displayName [lindex $specification $index]
}
return $this
}
method MenuPartNode::displayName {this args} {
if {$args == ""} {
return [$this _displayName]
} else {
$this _displayName [join $args]
if { [$this type] != "CustMenuBarButton"} {
if { [$this parent] != "" } {
$this changeDotName [[$this parent] name].menu
}
} else {
$this changeDotName ""
}
}
}
method MenuPartNode::infoList {this} {
set list [$this CustBrowsObject::infoList]
lappend list Visible
if [$this alwaysVisible] {
lappend list always
} else {
set visible ""
if [lindex [$this visible] 0] {
lappend visible corporate
}
if [lindex [$this visible] 1] {
lappend visible project
}
if [lindex [$this visible] 2] {
lappend visible config.
}
if [lindex [$this visible] 3] {
lappend visible phase
}
if [lindex [$this visible] 4] {
lappend visible system
}
lappend list $visible
}
lappend list MenuPath [$this name]
lappend list index [$this index]
if {[$this ancestor] != ""} {
lappend list ancestor [$this ancestor]
}
if {[$this predecessor] != ""} {
lappend list predecessor [$this predecessor]
}
return $list
}
method MenuPartNode::updateView {this} {
set editStatus ""
set unregister ""
if [$this editable] {
set editStatus "*"
}
if [$this unregister] {
set unregister " <clear>"
}
$this label "[$this _displayName] $editStatus$unregister"
}
method MenuPartNode::open {this} {
}
method MenuPartNode::openUnregister {this} {
.main busy TRUE
if {[catch {.main.unregisterDefiner load $this}]} {
require unregister.tcl
set definer [UnregisterDialog new .main.unregisterDefiner]
.main.unregisterDefiner load $this
}
.main busy FALSE
}
method MenuPartNode::check {this newScope newVisible newSpecLevel newParent} {
#check if parent is always available for this object
set parent $newParent
if {[$parent specLevel] == "user" && $newSpecLevel != "user"} {
return "An user-defined parent, can not have not-user-defined \
children"
}
set parentVisible [$parent visible]
set objectVisible $newVisible
set index 0
foreach i $objectVisible {
if {$i == 1} {
if {[lindex $parentVisible $index] == 0} {
return "Parent not always available"
}
}
incr index
}
set parentScope [$parent scope]
set objectScope $newScope
if {[llength $objectScope] < [llength $parentScope]} {
return "Parent is not available when child should be present"
}
# check from current scope not from begin because begin
# is (should be) *
set area [.main editorArea]
set curScope [$area _scope]
set index [llength $curScope]
foreach i [lrange $objectScope $index end] {
set x [lindex $parentScope $index]
if {$x == ""} {
break
}
if {$x != "*" } {
# if not always on this level, check if parent
# is on this level when child is.
if {$i == "*"} {
return "Parent not always available"
}
foreach y $i {
if {[lsearch $x $y] == -1 } {
return "Parent not always available"
}
}
}
incr index
}
return ""
}
method MenuPartNode::changeDotName {this newDotName} {
set tclName [MenuEdArea::makeTclName [$this displayName]]
set newObjs ""
foreach i [[$this tree] getMenuPartNode [$this name]] {
if {$i != $this} {
set newObjs "$newObjs $i"
}
}
if {![lempty $newObjs]} {
[$this tree] setMenuPartNode [$this name] $newObjs
} else {
[$this tree] removeMenuPartNode [$this name]
}
$this name $newDotName.$tclName
set objs [[$this tree] getMenuPartNode [$this name]]
set objs "$objs $this"
[$this tree] setMenuPartNode [$this name] $objs
foreach i [$this childSet] {
$i changeDotName [$this name].menu
}
}
# Do not delete this line -- regeneration end marker