home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)versionbro.tcl /main/titanic/15
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)versionbro.tcl /main/titanic/15 25 Nov 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
-
- require "vbtreearea.tcl"
- require "vbwmtarea.tcl"
-
- # End user added include file section
-
- require "wmttool.tcl"
-
- Class VersionBrowser : {WmtTool MainWindow} {
- method destructor
- constructor
- method createInterface
- method selectedVersionSet
- method selectedObjSet
- method selectedNameSet
- method initialize
- method selectionChanged
- method addContextArea
- method updateWmtArea
- method updateToolBar
- method updateView
- method helpOnName
- method getStatus
- method setStatus
- method removeStatus
- attribute initialContext
- attribute currentVersion
- attribute _selectedVersionSet
- attribute _selectedObjSet
- attribute opened
- attribute objectHdlr
- attribute infoView
- attribute wmtArea
- attribute menuHdlr
- attribute status
- }
-
- method VersionBrowser::destructor {this} {
- # Start destructor user section
- if [$this opened] {
- $this saveToolBarPresence vb
- $this saveContextAreaPresence vb
- $this saveMessageAreaPresence vb
- $this saveWindowGeometry vb
- }
- # End destructor user section
- $this WmtTool::destructor
- }
-
- constructor VersionBrowser {class this name toolId} {
- set this [MainWindow::constructor $class $this $name]
- set this [WmtTool::constructor $class $this $name]
-
- global makeSelectionUpToDate
- set makeSelectionUpToDate 1
-
- $this opened 0
-
- MenuBar new $this.MB
- $this menuHdlr [CustBrMenuHandler new $toolId $globalModuleHandler]
- $this objectHdlr [CustObjHandler new $globalModuleHandler]
- $this createInterface
-
- # Check if handlers are created without errors:
- # the corporate customization files exist
- if [isCommand .main.error] {
- return $this
- }
-
- [$this menuHdlr] setCurrentContext
-
- $this setWindowGeometry vb
-
- return $this
- }
-
- method VersionBrowser::createInterface {this} {
-
- DlgColumn new $this.DC
- $this setToolBarPresence vb
- $this setContextAreaPresence vb
- $this infoView [VBTreeArea new $this.DC.infoIV]
- # create popup menu for view
- DrAreaPopUpMenu new [$this infoView].pop \
- -poppedUp {
- [.main infoView].pop entrySet \
- [[.main menuHdlr] validPopUpEntrySet]
- }
- [$this infoView] selectionChanged {.main selectionChanged}
- $this setMessageAreaPresence vb
- }
-
- method VersionBrowser::selectedVersionSet {this} {
- if {[$this _selectedVersionSet] == "undefined"} {
- set selectedVersionSet [[$this infoView] selectedSet]
- $this _selectedVersionSet $selectedVersionSet
- }
- return [$this _selectedVersionSet]
- }
-
-
- # function to make it possible to use commonbrowser stuff
- #
- #
- method VersionBrowser::selectedObjSet {this} {
- set selectedObjSet [$this _selectedObjSet]
- if {"$selectedObjSet" == "undefined"} {
- set selectedObjSet {}
- foreach node [$this selectedVersionSet] {
- lappend selectedObjSet [$node version]
- }
- $this _selectedObjSet $selectedObjSet
- }
- if $makeSelectionUpToDate {
- foreach obj $selectedObjSet {
- $obj makeUpToDate
- }
- }
- return $selectedObjSet
- }
-
-
- # function to make it possible to use some commonbrowser stuff.
- #
- method VersionBrowser::selectedNameSet {this} {
- set selectedNameSet ""
- foreach node [$this selectedVersionSet] {
- set version [$node version]
- lappend selectedNameSet [list \
- "[$version getInfo Name]" \
- "[$version getInfo Type]" \
- ]
- }
- return $selectedNameSet
- }
-
- method VersionBrowser::initialize {this} {
-
- busy {
- wmtkmessage "Loading ..."
- [$this infoView] setVersionInfo [$this currentVersion]
- if [isCommand [$this wmtArea]] {
- [$this wmtArea] update
- }
- [.main infoView] scale [[.main infoView] scale]
- [.main infoView] redraw
- wmtkmessage Done
- $this opened 1
- }
- }
-
- method VersionBrowser::selectionChanged {this {keepSelection 0}} {
- global makeSelectionUpToDate
- set makeSelectionUpToDate 0
-
- if $keepSelection {
- # Keep the selected objects that still exist selected
- set selectedSet {}
- set infoView [$this infoView]
- foreach obj [$this _selectedObjSet] {
- set node [$infoView getNode $obj]
- if {! [isCommand $node]} continue
- lappend selectedSet $node
- }
- $infoView selectedSet $selectedSet
- }
- $this _selectedVersionSet "undefined"
- $this _selectedObjSet "undefined"
-
- # reset the status info (frozen, working etc)
- $this status [Dictionary new]
-
- [$this menuHdlr] selectionChanged
-
- set makeSelectionUpToDate 1
- }
-
- method VersionBrowser::addContextArea {this} {
- $this wmtArea [VBWmtArea new $this.DC.WA]
- }
-
- method VersionBrowser::updateWmtArea {this} {
- [$this wmtArea] update
- }
-
- method VersionBrowser::updateToolBar {this} {
-
- if [catch {[$this menuHdlr] setCurrentContext} errorMsg] {
- if [info exists errorInfo] {
- set errorTrace $errorInfo
- set errorCodeCopy $errorCode
- resetErrorVars
- } else {
- set errorTrace ""
- set errorCodeCopy ""
- }
- } else {
- set errorMsg ""
- }
- }
-
-
- # Used after executing a command. ( startCommand in wmttool)
- # when the update flag is up.
- #
- #
- method VersionBrowser::updateView {this} {
-
- VBViewMenuProcs::updateView
- }
-
- method VersionBrowser::helpOnName {this name} {
- global short2url
- if {! [catch {set url $short2url($name)}]} {
- showHelp $url
- return
- }
-
- if [regsub "crnt_" $name "" name] {
- $this helpOnName $name
- return
- }
-
- wmtkerror "Sorry, no help available for '$name'"
- }
-
- # Do not delete this line -- regeneration end marker
-
- method VersionBrowser::getStatus {this status} {
- return [[$this status] set $status]
- }
-
- method VersionBrowser::setStatus {this status newStatus} {
- [$this status] set $status $newStatus
- }
-
- method VersionBrowser::removeStatus {this status} {
- [$this status] unset $status
- }
-
-