home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1996
- #
- # File: @(#)browser.tcl /main/hindenburg/15
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)browser.tcl /main/hindenburg/15 5 Dec 1996 Copyright 1996 Cayenne Software Inc.
-
- # Start user added include file section
- require "browseropt.tcl"
- require "brsymb2url.tcl"
- require "classmaker.tcl"
- require "copyenvdia.tcl"
- require "dragbrowsv.tcl"
- require "infoobject.tcl"
- require "showversio.tcl"
- # End user added include file section
-
- require "commonbrow.tcl"
-
- # Definition of Browser class.
- # This class contains basic operations of the browsers.
-
- Class Browser : {CommonBrowser} {
- method destructor
- constructor
- method createInterface
- method flatView
- method helpOnContext
- method helpOnName
- method initView
- method popUp
- method selectedObjSet
- method selectedNameSet
- method selectionChanged
- method setViewButton
- method setViewMode
- method treeView
- method updateView
- method getStatus
- method setStatus
- method removeStatus
- attribute _selectedObjSet
- attribute _selectedNameSet
- attribute initialContext
- attribute undoButton
- attribute options
- attribute propKnowledgeDB
- attribute status
- }
-
- method Browser::destructor {this} {
- # Start destructor user section
-
- if [$this opened] {
- $this saveWindowGeometry desk
- }
- catch {
- [$this options] delete
- [$this propKnowledgeDB] delete
- }
-
- # End destructor user section
- $this CommonBrowser::destructor
- }
-
- constructor Browser {class this name} {
- set this [CommonBrowser::constructor $class $this $name desk]
-
- # Return if an error box is already popped up
- if [isCommand .main.error] {
- return $this
- }
-
- $this status [Dictionary new]
-
- $this options [BrowserOptions new $this.options]
- [$this options] setContexts editor {"" DoctextSection}
- [$this options] setContexts previewer {"" DoctextSection EpsfSection
- EpsiSection EpsSection PropertySection PsSection}
- [$this options] setContexts viewer {"" DoctextSection PropertySection}
-
- $this propKnowledgeDB [PropKnowledgeDB new $this.propKnowledgeDB]
-
- # create flat view
- [$this infoView] area [DragBrowsView new [$this infoView].area \
- -selectionChanged {.main selectionChanged} \
- -mode [m4_var get M4_infoview_mode -context desk] \
- -font "[m4_var get M4_font -context desk]" \
- -columnCount 46 \
- -selectionPolicy EXTENDED]
-
- # create popup menu for view
- ViewPopUpMenu new [[$this infoView] area].pop \
- -poppedUp {
- [[.main infoView] area].pop entrySet \
- [[.main menuHdlr] getValidPopUpEntrySet]
- }
-
- # config interface
- [$this navigationView] config \
- -selectionChanged {%this updateSelected} \
- -font "[m4_var get M4_font -context desk]" \
- -rowCount 12 \
- -columnCount 32
- $this notSavedM4Vars {
- M4_corproles__*
- M4_projroles__*
- M4_levelpath_ids
- }
- $this setWindowGeometry desk
-
- [$this treeView] view [$this flatView]
- [$this flatView] tree [$this treeView]
-
- return $this
- }
-
- method Browser::createInterface {this} {
- $this CommonBrowser::createInterface
- $this viewSelector [$this menuBar].view.menu
- $this exitButton [$this menuBar].file.menu.exit
- $this undoButton [$this menuBar].edit.menu.undo
- }
-
- method Browser::flatView {this} {
- return [[$this infoView] area]
- }
-
- method Browser::helpOnContext {this} {
- if {[llength [$this selectedObjSet]] == 1} {
- set prefix ""
- set obj [lindex [$this selectedObjSet] 0]
- } else {
- set prefix "crnt_"
- set currentObj [$this currentObj]
- if {"$currentObj" == ""} {
- set obj [$this corporateObj]
- } else {
- set obj [$currentObj browsUiObj]
- }
- }
-
- set browserObjType [$obj browserObjType]
- case "$browserObjType" in {
- {CustFVDbObj DSysVDbObj ExtFUiObj LocalSection
- PSysVDbObj SFileLDbObj SSysVDbObj UsrLDbObj} {
- set localKey "${prefix}$browserObjType"
- }
- default {
- set localKey "${prefix}[$obj browserType]"
- }
- }
-
- $this helpOnName $localKey
- }
-
- method Browser::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'"
- }
-
- method Browser::initView {this} {
- busy {
- wmtkmessage "Loading ..."
-
- $this open
-
- # Initialize according to the initialContext
- if {"[$this initialContext]" == ""} {
- set treeNode [lindex [[$this treeView] rootSet] 0]
- } else {
- set treeNode ""
- foreach objId [$this initialContext] {
- if {"$treeNode" == ""} {
- set childSet [[$this treeView] rootSet]
- } else {
- $treeNode foldState 0
- $treeNode appendChildren
- set childSet [$treeNode childSet]
- }
- set found 0
- foreach childNode $childSet {
- set identity [[$childNode browsUiObj] uiIdentity]
- if {"$identity" == "$objId"} {
- set found 1
- break
- }
- }
- if {! $found} {
- break
- }
- set treeNode $childNode
- if {! [[$treeNode browsUiObj] hasChildren]} {
- break
- }
- }
- }
- BrowserProcs::initializeInfo [$treeNode browsUiObj] $treeNode
- $treeNode open
- $this setViewButton
-
- wmtkmessage Done
- }
- }
-
- method Browser::popUp {this} {
- $this CommonBrowser::popUp
- $this setViewButton
- }
-
- method Browser::selectedObjSet {this} {
- set selectedObjSet [$this _selectedObjSet]
- if {"$selectedObjSet" == "undefined"} {
- set selectedObjSet ""
- foreach obj [[$this flatView] selectedSet] {
- lappend selectedObjSet [$obj browsUiObj]
- }
- $this _selectedObjSet $selectedObjSet
- }
- return $selectedObjSet
- }
-
- method Browser::selectedNameSet {this} {
- set selectedNameSet [$this _selectedNameSet]
- if {"$selectedNameSet" == "undefined"} {
- set selectedNameSet ""
- foreach obj [[$this flatView] selectedSet] {
- set browsUiObj [$obj browsUiObj]
- lappend selectedNameSet [list \
- "[$browsUiObj getInfo Name]" "[$browsUiObj getInfo Type]" \
- ]
- }
- $this _selectedNameSet $selectedNameSet
- }
- return $selectedNameSet
- }
-
-
- # This function is called when the selected state
- # has changed.
- #
- method Browser::selectionChanged {this {keepSelection 0}} {
- if $keepSelection {
- # Keep the selected objects that still exist selected
- set selectedSet ""
- foreach obj [[$this flatView] selectedSet] {
- if [$obj filteredOutState] continue
- lappend selectedSet $obj
- }
- [$this flatView] selectedSet $selectedSet
- }
-
- [$this status] contents ""
-
- $this _selectedObjSet "undefined"
- $this _selectedIdSet "undefined"
- $this _selectedNameSet "undefined"
- $this _selectedNameTypeSet "undefined"
-
- $this CommonBrowser::selectionChanged
-
- [$this flatView] updateConversionSet
- }
-
-
- # Select the view-radioButton button according to the
- # view-mode of the current view.
- #
- method Browser::setViewButton {this} {
- set arbiter [$this menuBar].view.menu.menuarbiter
- if {! [isCommand $arbiter]} return
-
- case "[[$this flatView] mode]" in {
- {ICON} {$arbiter currentButton 0}
- {SMALLICON} {$arbiter currentButton 1}
- {DETAIL} {$arbiter currentButton 2}
- }
- }
-
-
- # Set the mode of the view according to the current
- # selected view-radioButton.
- #
- method Browser::setViewMode {this} {
- set arbiter [$this menuBar].view.menu.menuarbiter
- if {! [isCommand $arbiter]} return
-
- case "[$arbiter currentButton]" in {
- {0} {[$this flatView] mode ICON}
- {1} {[$this flatView] mode SMALLICON}
- {2} {[$this flatView] mode DETAIL}
- }
- m4_var set M4_infoview_mode [[$this flatView] mode] -context desk
- }
-
- method Browser::treeView {this} {
- return [$this navigationView]
- }
-
- method Browser::updateView {this} {
- busy {
- [.main treeView] rebuild
- [$this infoView] display ""
- .main selectionChanged 1
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method Browser::getStatus {this value} {
- return [[$this status] set $value]
- }
-
- method Browser::setStatus {this value newStatus} {
- [$this status] set $value $newStatus
- }
-
- method Browser::removeStatus {this value} {
- [$this status] unset $value
- }
-
-