home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Westmount Technology 1994
- #
- # File: @(#)docstructn.tcl 1.8
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)docstructn.tcl 1.8 07 Mar 1996 Copyright 1994 Westmount Technology
-
- # Start user added include file section
- # End user added include file section
-
-
- Class DocStructNode : {BrowsNode} {
- method destructor
- constructor
- method name
- method nodes
- method save
- method setParent
- attribute count
- attribute fiComponent
- }
-
- method DocStructNode::destructor {this} {
- # Start destructor user section
-
- if {[isCommand [$this tree]] && [isCommand [[$this tree] dialog]]} {
- # Append name to list of remved sections
- [[$this tree] dialog] _removedSectionList [concat \
- [[[$this tree] dialog] _removedSectionList] \
- [list [$this label]] \
- ]
- }
-
- set fiComponent [$this fiComponent]
- if [isCommand $fiComponent] {
- $fiComponent delete
- }
-
- # End destructor user section
- }
-
- constructor DocStructNode {class this name label} {
- set this [BrowsNode::constructor $class $this $name]
-
- if {"[$this parent]" == ""} {
- set objType SystemVersion
- set uiType DocumentVersion
- set activated ""
- } else {
- set objType LocalSection
- set uiType ""
- set activated [list [[$this tree] dialog] editSection]
-
- set fileInfo [[[$this tree] dialog] fileInfo]
- set fiComponent [$fileInfo findComponent "$label"]
- if {"$fiComponent" == ""} {
- set fiComponent [DocComponent new $this.fiComponent $fileInfo \
- -indentation 0 \
- -uiName "$label"]
- }
- $this fiComponent $fiComponent
- }
- set typeSpec [getObjectSpec [$wmttoolObj objectHdlr] $objType $uiType]
- if {"$typeSpec" != ""} {
- set icon [$typeSpec normalIcon]
- } else {
- set icon ""
- }
- $this config \
- -icon $icon \
- -activeIcon $icon \
- -label "$label" \
- -hasChildren 0 \
- -count 0 \
- -activated $activated \
- -conversionSet "SECTION name"
-
- return $this
- }
-
- method DocStructNode::name {this} {
- return $this
- }
-
- method DocStructNode::nodes {this} {
- set nodes ""
- foreach child [$this childSet] {
- lappend nodes $child
- set nodes [concat $nodes [$child nodes]]
- }
- return $nodes
- }
-
- method DocStructNode::save {this} {
- global DocStructNode::prevNode
- if {"[$this parent]" != ""} {
- set fiComponent [$this fiComponent]
- set parentFiComponent [[$this parent] fiComponent]
-
- if {"${DocStructNode::prevNode}" != ""} {
- set prevFiComponent [${DocStructNode::prevNode} fiComponent]
- if {"$prevFiComponent" != "[$fiComponent previous]"} {
- $fiComponent moveBehind $prevFiComponent
- }
- }
-
- if {"$parentFiComponent" == ""} {
- set indentation 0
- } else {
- set indentation [expr [$parentFiComponent indentation] + 1]
- }
- $fiComponent config \
- -uiName [$this label] \
- -indentation $indentation
-
- set DocStructNode::prevNode "$this"
- } else {
- set DocStructNode::prevNode ""
- }
-
- foreach child [$this childSet] {
- $child save
- }
- }
-
- method DocStructNode::setParent {this newParent} {
- if {"$newParent" == "" || (! [$newParent isA DocStructNode])} {
- return 0
- }
-
- # Skip if one of newParent's parent is this section
- for {set node $newParent} {"$node" != ""} {set node [$node parent]} {
- if {$node == $this} {
- return 0
- }
- }
-
- set parent [$this parent]
- if {$newParent != $parent} {
- if {! [$newParent hasChildren]} {
- $newParent hasChildren 1
- $newParent foldState 0
- }
- $this parent $newParent
- if {"$parent" != "" && [lempty [$parent childSet]]} {
- $parent foldState 1
- $parent hasChildren 0
- }
- }
- return 1
- }
-
- # Do not delete this line -- regeneration end marker
-
-